fix error handling
This commit is contained in:
parent
34fb39da5b
commit
c313857485
@ -276,7 +276,12 @@ impl<'a, B: 'a + StateBackend> Executive<'a, B> {
|
|||||||
|
|
||||||
let cost = builtin.cost(data);
|
let cost = builtin.cost(data);
|
||||||
if cost <= params.gas {
|
if cost <= params.gas {
|
||||||
builtin.execute(data, &mut output)?;
|
if let Err(e) = builtin.execute(data, &mut output) {
|
||||||
|
self.state.revert_to_checkpoint();
|
||||||
|
let evm_err: evm::evm::Error = e.into();
|
||||||
|
tracer.trace_failed_call(trace_info, vec![], evm_err.clone().into());
|
||||||
|
Err(evm_err)
|
||||||
|
} else {
|
||||||
self.state.discard_checkpoint();
|
self.state.discard_checkpoint();
|
||||||
|
|
||||||
// trace only top level calls to builtins to avoid DDoS attacks
|
// trace only top level calls to builtins to avoid DDoS attacks
|
||||||
@ -295,6 +300,7 @@ impl<'a, B: 'a + StateBackend> Executive<'a, B> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Ok(params.gas - cost)
|
Ok(params.gas - cost)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// just drain the whole gas
|
// just drain the whole gas
|
||||||
self.state.revert_to_checkpoint();
|
self.state.revert_to_checkpoint();
|
||||||
|
Loading…
Reference in New Issue
Block a user