Fix BlockReward contract "arithmetic operation overflow" (#8611)
* Fix BlockReward contract "arithmetic operation overflow" * Add docs on how execute_as_system works * Fix typo
This commit is contained in:
parent
938c3707fc
commit
af90fbfb33
@ -122,7 +122,13 @@ impl EthereumMachine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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(
|
pub fn execute_as_system(
|
||||||
&self,
|
&self,
|
||||||
block: &mut ExecutedBlock,
|
block: &mut ExecutedBlock,
|
||||||
@ -132,7 +138,7 @@ impl EthereumMachine {
|
|||||||
) -> 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();
|
||||||
env_info.gas_limit = env_info.gas_used + gas;
|
env_info.gas_limit = env_info.gas_used.saturating_add(gas);
|
||||||
env_info
|
env_info
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user