Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Use static call and apparent value transfer for block reward contract…
Browse files Browse the repository at this point in the history
… code (#9603)
  • Loading branch information
sorpaas authored and andresilva committed Oct 10, 2018
1 parent 44ac095 commit 533a112
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion ethcore/src/engines/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use self::epoch::PendingTransition;

use account_provider::AccountProvider;
use builtin::Builtin;
use vm::{EnvInfo, Schedule, CreateContractAddress};
use vm::{EnvInfo, Schedule, CreateContractAddress, CallType, ActionValue};
use error::Error;
use header::{Header, BlockNumber};
use snapshot::SnapshotComponents;
Expand Down Expand Up @@ -163,8 +163,10 @@ pub fn default_system_or_code_call<'a>(machine: &'a ::machine::EthereumMachine,
None,
Some(code),
Some(code_hash),
Some(ActionValue::Apparent(U256::zero())),
U256::max_value(),
Some(data),
Some(CallType::StaticCall),
)
},
};
Expand Down
12 changes: 8 additions & 4 deletions ethcore/src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,10 @@ impl EthereumMachine {
Some(contract_address),
code,
code_hash,
None,
gas,
data
data,
None,
)
}

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

0 comments on commit 533a112

Please sign in to comment.