From 3bc8a18f63f8796fb75fda4f21eb59cc846f4013 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Sun, 13 May 2018 07:41:10 +0800 Subject: [PATCH 1/3] Fix BlockReward contract "arithmetic operation overflow" --- ethcore/src/machine.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index 4aa72b50d92..f976913a562 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -132,7 +132,7 @@ impl EthereumMachine { ) -> Result, 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 }; From ea8887964b222b5421326f689c195848ec9aa1ea Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Mon, 14 May 2018 14:32:43 +0800 Subject: [PATCH 2/3] Add docs on how execute_as_system works --- ethcore/src/machine.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index f976913a562..8e2d5b5781a 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -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 + /// informations. If suicides, logs or refunds happened 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, From e158f17e74bba87f5f215295c737c0384056014c Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Mon, 14 May 2018 14:50:05 +0800 Subject: [PATCH 3/3] Fix typo --- ethcore/src/machine.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index 8e2d5b5781a..d0d434b1de0 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -126,7 +126,7 @@ impl EthereumMachine { /// 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 - /// informations. If suicides, logs or refunds happened within the system call, they + /// 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(