Use static call and apparent value transfer for block reward contract code (#9603)

This commit is contained in:
Wei Tang 2018-09-25 18:39:27 +08:00 committed by Marek Kotewicz
parent 346594c406
commit 4c2301fdf6
2 changed files with 11 additions and 5 deletions

View File

@ -44,7 +44,7 @@ use self::epoch::PendingTransition;
use account_provider::AccountProvider; use account_provider::AccountProvider;
use builtin::Builtin; use builtin::Builtin;
use vm::{EnvInfo, Schedule, CreateContractAddress}; use vm::{EnvInfo, Schedule, CreateContractAddress, CallType, ActionValue};
use error::Error; use error::Error;
use header::{Header, BlockNumber}; use header::{Header, BlockNumber};
use snapshot::SnapshotComponents; use snapshot::SnapshotComponents;
@ -163,8 +163,10 @@ pub fn default_system_or_code_call<'a>(machine: &'a ::machine::EthereumMachine,
None, None,
Some(code), Some(code),
Some(code_hash), Some(code_hash),
Some(ActionValue::Apparent(U256::zero())),
U256::max_value(), U256::max_value(),
Some(data), Some(data),
Some(CallType::StaticCall),
) )
}, },
}; };

View File

@ -135,8 +135,10 @@ impl EthereumMachine {
Some(contract_address), Some(contract_address),
code, code,
code_hash, code_hash,
None,
gas, gas,
data data,
None,
) )
} }
@ -149,8 +151,10 @@ impl EthereumMachine {
contract_address: Option<Address>, contract_address: Option<Address>,
code: Option<Arc<Vec<u8>>>, code: Option<Arc<Vec<u8>>>,
code_hash: Option<H256>, code_hash: Option<H256>,
value: Option<ActionValue>,
gas: U256, gas: U256,
data: Option<Vec<u8>> data: Option<Vec<u8>>,
call_type: Option<CallType>,
) -> Result<Vec<u8>, Error> { ) -> Result<Vec<u8>, Error> {
let env_info = { let env_info = {
let mut env_info = block.env_info(); let mut env_info = block.env_info();
@ -167,11 +171,11 @@ impl EthereumMachine {
origin: SYSTEM_ADDRESS, origin: SYSTEM_ADDRESS,
gas, gas,
gas_price: 0.into(), gas_price: 0.into(),
value: ActionValue::Transfer(0.into()), value: value.unwrap_or(ActionValue::Transfer(0.into())),
code, code,
code_hash, code_hash,
data, data,
call_type: CallType::Call, call_type: call_type.unwrap_or(CallType::Call),
params_type: ParamsType::Separate, params_type: ParamsType::Separate,
}; };
let schedule = self.schedule(env_info.number); let schedule = self.schedule(env_info.number);