-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[trace] introduce trace failed to Ext #11019
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was suggesting to merge the two methods to simplify assumptions for implementation (i.e. trace_executed
is ALWAYS called after trace_prepare_execute
). It would also deduplicate poping from the stack in the implementation of VMTracer
.
But looks good anyway!
@@ -166,6 +166,9 @@ pub trait Ext { | |||
/// Prepare to trace an operation. Passthrough for the VM trace. | |||
fn trace_prepare_execute(&mut self, _pc: usize, _instruction: u8, _gas_cost: U256, _mem_written: Option<(usize, usize)>, _store_written: Option<(U256, U256)>) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we improve the docs here and underline the fact that this call is ALWAYS followed by either trace_executed
or trace_failed
. and that the implementation is responsible to clean up in either/both of those methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you opt to remove the bounds checks here? For performance reasons? Unless it's a severe regression I think it'd be good to have.
If the bounds could still be incorrect, it would indicate another bug and a warning could easily be missed/ignored. But if we reach a consensus on that the checks should be added back, I don't mind. |
@tomusdrw thoughts? Better to crash? |
@dvdplm I'd rather bound the |
f818b23 lgtm |
* master: fix: remove unused error-chain (#11028) fix: remove needless use of itertools (#11029) Convert `std::test` benchmarks to use Criterion (#10999) Fix block detail updating (#11015) [trace] introduce trace failed to Ext (#11019) cli: update usage and version headers (#10924) [private-tx] remove unused rand (#11024)
…he-right-place * master: cleanup json crate (#11027) [spec] add istanbul test spec (#11033) [json-spec] make blake2 pricing spec more readable (#11034) Add blake2_f precompile (#11017) Add new line after writing block to hex file. (#10984) fix: remove unused error-chain (#11028) fix: remove needless use of itertools (#11029) Convert `std::test` benchmarks to use Criterion (#10999) Fix block detail updating (#11015) [trace] introduce trace failed to Ext (#11019) cli: update usage and version headers (#10924) [private-tx] remove unused rand (#11024)
* [trace] add trace_failed to Ext, manage stack of trace data * [evm] call trace_failed only if self.do_trace * [evm] add a comment about do_trace set to true * [vm] improve the doc in trace_prepare_execute * [trace] add the bounds check back
* [trace] add trace_failed to Ext, manage stack of trace data * [evm] call trace_failed only if self.do_trace * [evm] add a comment about do_trace set to true * [vm] improve the doc in trace_prepare_execute * [trace] add the bounds check back
* [trace] add trace_failed to Ext, manage stack of trace data * [evm] call trace_failed only if self.do_trace * [evm] add a comment about do_trace set to true * [vm] improve the doc in trace_prepare_execute * [trace] add the bounds check back
* [trace] add trace_failed to Ext, manage stack of trace data * [evm] call trace_failed only if self.do_trace * [evm] add a comment about do_trace set to true * [vm] improve the doc in trace_prepare_execute * [trace] add the bounds check back
* add more tx tests (#11038) * Fix parallel transactions race-condition (#10995) * Add blake2_f precompile (#11017) * [trace] introduce trace failed to Ext (#11019) * Edit publish-onchain.sh to use https (#11016) * Fix deadlock in network-devp2p (#11013) * EIP 1108: Reduce alt_bn128 precompile gas costs (#11008) * xDai chain support and nodes list update (#10989) * EIP 2028: transaction gas lowered from 68 to 16 (#10987) * EIP-1344 Add CHAINID op-code (#10983) * manual publish jobs for releases, no changes for nightlies (#10977) * [blooms-db] Fix benchmarks (#10974) * Verify transaction against its block during import (#10954) * Better error message for rpc gas price errors (#10931) * Fix fork choice (#10837) * Fix compilation on recent nightlies (#10991)
* add more tx tests (#11038) * Fix parallel transactions race-condition (#10995) * Add blake2_f precompile (#11017) * [trace] introduce trace failed to Ext (#11019) * Edit publish-onchain.sh to use https (#11016) * Fix deadlock in network-devp2p (#11013) * EIP 1108: Reduce alt_bn128 precompile gas costs (#11008) * xDai chain support and nodes list update (#10989) * EIP 2028: transaction gas lowered from 68 to 16 (#10987) * EIP-1344 Add CHAINID op-code (#10983) * manual publish jobs for releases, no changes for nightlies (#10977) * [blooms-db] Fix benchmarks (#10974) * Verify transaction against its block during import (#10954) * Better error message for rpc gas price errors (#10931) * tx-pool: accept local tx with higher gas price when pool full (#10901) * Fix fork choice (#10837) * Cleanup unused vm dependencies (#10787) * Fix compilation on recent nightlies (#10991)
* master: (70 commits) ethcore: remove `test-helper feat` from build (#11047) Include test-helpers from ethjson (#11045) [ethcore]: cleanup dependencies (#11043) add more tx tests (#11038) Fix parallel transactions race-condition (#10995) [ethcore]: make it compile without `test-helpers` feature (#11036) Benchmarks for block verification (#11035) Move snapshot related traits to their proper place (#11012) cleanup json crate (#11027) [spec] add istanbul test spec (#11033) [json-spec] make blake2 pricing spec more readable (#11034) Add blake2_f precompile (#11017) Add new line after writing block to hex file. (#10984) fix: remove unused error-chain (#11028) fix: remove needless use of itertools (#11029) Convert `std::test` benchmarks to use Criterion (#10999) Fix block detail updating (#11015) [trace] introduce trace failed to Ext (#11019) cli: update usage and version headers (#10924) [private-tx] remove unused rand (#11024) ...
When a subcall fails, we need to clean up the tracing data (
last_mem_written
,last_store_written
) in theExecutiveVMTracer
. Also to properly track subcalls, we maintain a stack of tracing data.One approach of doing that is to pass
mem_written
directly totrace_executed
. It does introduce a perf regression.This PR adds a method
trace_failed
toExt
, which is called when the execution of an instruction has failed. An alternative suggested by @tomusdrw would be to mergetrace_failed
intotrace_executed
by passing aResult<(stack_push: &[U256], mem: &[u8]), ()>
, but I'm not sure if is any better.