commit
0aa604343e
@ -22,7 +22,7 @@ pub struct Substate {
|
||||
/// Refund counter of SSTORE nonzero->zero.
|
||||
refunds_count: U256,
|
||||
/// True if transaction, or one of its subcalls runs out of gas.
|
||||
out_of_gas: bool,
|
||||
excepted: bool,
|
||||
/// Created contracts.
|
||||
contracts_created: Vec<Address>
|
||||
}
|
||||
@ -34,7 +34,7 @@ impl Substate {
|
||||
suicides: HashSet::new(),
|
||||
logs: vec![],
|
||||
refunds_count: U256::zero(),
|
||||
out_of_gas: false,
|
||||
excepted: false,
|
||||
contracts_created: vec![]
|
||||
}
|
||||
}
|
||||
@ -43,11 +43,11 @@ impl Substate {
|
||||
self.suicides.extend(s.suicides.into_iter());
|
||||
self.logs.extend(s.logs.into_iter());
|
||||
self.refunds_count = self.refunds_count + s.refunds_count;
|
||||
self.out_of_gas |= s.out_of_gas;
|
||||
self.excepted |= s.excepted;
|
||||
self.contracts_created.extend(s.contracts_created.into_iter());
|
||||
}
|
||||
|
||||
pub fn out_of_gas(&self) -> bool { self.out_of_gas }
|
||||
pub fn excepted(&self) -> bool { self.excepted }
|
||||
}
|
||||
|
||||
/// Transaction execution receipt.
|
||||
@ -69,7 +69,7 @@ pub struct Executed {
|
||||
/// Vector of logs generated by transaction.
|
||||
pub logs: Vec<LogEntry>,
|
||||
/// Execution ended running out of gas.
|
||||
pub out_of_gas: bool,
|
||||
pub excepted: bool,
|
||||
/// Addresses of contracts created during execution of transaction.
|
||||
/// Ordered from earliest creation.
|
||||
///
|
||||
@ -293,7 +293,7 @@ impl<'a> Executive<'a> {
|
||||
refunded: refund,
|
||||
cumulative_gas_used: self.info.gas_used + gas_used,
|
||||
logs: substate.logs,
|
||||
out_of_gas: substate.out_of_gas,
|
||||
excepted: substate.excepted,
|
||||
contracts_created: substate.contracts_created
|
||||
})
|
||||
},
|
||||
@ -304,7 +304,7 @@ impl<'a> Executive<'a> {
|
||||
refunded: U256::zero(),
|
||||
cumulative_gas_used: self.info.gas_used + t.gas,
|
||||
logs: vec![],
|
||||
out_of_gas: true,
|
||||
excepted: true,
|
||||
contracts_created: vec![]
|
||||
})
|
||||
}
|
||||
@ -315,7 +315,7 @@ impl<'a> Executive<'a> {
|
||||
// TODO: handle other evm::Errors same as OutOfGas once they are implemented
|
||||
match result {
|
||||
&Err(evm::Error::OutOfGas) => {
|
||||
substate.out_of_gas = true;
|
||||
substate.excepted = true;
|
||||
self.state.revert(backup);
|
||||
},
|
||||
&Ok(_) | &Err(evm::Error::Internal) => substate.accrue(un_substate)
|
||||
@ -899,7 +899,7 @@ mod tests {
|
||||
assert_eq!(executed.refunded, U256::from(58_699));
|
||||
assert_eq!(executed.cumulative_gas_used, U256::from(41_301));
|
||||
assert_eq!(executed.logs.len(), 0);
|
||||
assert_eq!(executed.out_of_gas, false);
|
||||
assert_eq!(executed.excepted, false);
|
||||
assert_eq!(executed.contracts_created.len(), 0);
|
||||
assert_eq!(state.balance(&sender), U256::from(1));
|
||||
assert_eq!(state.balance(&contract), U256::from(17));
|
||||
|
Loading…
Reference in New Issue
Block a user