Skip to content

Commit

Permalink
Fix BlockReward contract "arithmetic operation overflow" (openethereu…
Browse files Browse the repository at this point in the history
…m#8611)

* Fix BlockReward contract "arithmetic operation overflow"

* Add docs on how execute_as_system works

* Fix typo
  • Loading branch information
sorpaas authored and VladLupashevskyi committed May 23, 2018
1 parent 345db57 commit 7de2a13
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ethcore/src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,13 @@ impl EthereumMachine {
}

impl EthereumMachine {
/// Execute a call as the system address.
/// Execute a call as the system address. Block environment information passed to the
/// VM is modified to have its gas limit bounded at the upper limit of possible used
/// gases including this system call, capped at the maximum value able to be
/// represented by U256. This system call modifies the block state, but discards other
/// information. If suicides, logs or refunds happen within the system call, they
/// will not be executed or recorded. Gas used by this system call will not be counted
/// on the block.
pub fn execute_as_system(
&self,
block: &mut ExecutedBlock,
Expand All @@ -132,7 +138,7 @@ impl EthereumMachine {
) -> Result<Vec<u8>, Error> {
let env_info = {
let mut env_info = block.env_info();
env_info.gas_limit = env_info.gas_used + gas;
env_info.gas_limit = env_info.gas_used.saturating_add(gas);
env_info
};

Expand Down

0 comments on commit 7de2a13

Please sign in to comment.