-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Execution traces for call sequences failing tests #105
Conversation
…est call sequences
* Added helpers to extract Solidity errors/panics (now used by assertion test provider and execution tracer) * Added fuzzer tests to verify execution trace output contains revert reasons and assertion failures * Updated README with required solidity version for unit tests
# Conflicts: # fuzzing/calls/call_sequence.go # fuzzing/fuzzer_worker.go
…-execute a given call sequence without any custom checks * Updated FuzzerWorker to re-execute the finalized shrunken sequence before performing the "finalized shrunken sequence" callback, so all providers can assume state is post-execution. * Updated assertion test provider to attach an execution trace for the last call in a failing sequence * Updated property test provider to attach execution traces for the last call in a failing sequence, and for its property test * Updated the fuzzer worker so if a "trace all" flag is provided, it will attach execution traces to all finalized shrunken call sequence elements prior to returning the results to any test provider * Updated TestChain to provide a method to get the post-execution state root hash for a given block number
The last commit I pushed makes the following changes:
The "trace all" option is still currently a hardcoded bool and needs to be added to the config, along with a CLI flag to allow override enabling of it (even if config doesn't have it set). |
- Removed the hardcoding of traceAll in fuzzerWorker. - Added TraceAll config option - Added trace-all flag to CLI that can override config option if necessary
The following has changed in the last 3 commits:
|
The last commit added support for cheat code contracts in execution traces. I might do some further cleanup later today, otherwise it should be good to go. Note: CI failed on the last commit because markdown lint was flagging URLs in this repo as dead links, though it should have passed. I'm going to re-run it in a few hours and assume it was some glitch (as they are valid links). Otherwise I'll look into if a new release treats private repos differently. EDIT: CI is failing due to tcort/markdown-link-check#246 , a new release broke the config file support... EDIT (2): Applied a temporary fix for CI to master and merged it into this branch. |
…pilation-related "abiutils" package.
* Added test for contract deployments
…o track which part of call data represents ABI constructor args during deployment
coreTypes "github.com/ethereum/go-ethereum/core/types" | ||
) | ||
|
||
// UnpackEventAndValues takes a given contract ABI, and VM return values, and |
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.
incomplete comment
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.
Updated in 56caf88
@@ -76,47 +78,61 @@ func (t *PropertyTestCaseProvider) isPropertyTest(method abi.Method) bool { | |||
|
|||
// checkPropertyTestFailed executes a given property test method to see if it returns a failed status. This is used to | |||
// facilitate testing of property test methods after every call the Fuzzer makes when testing call sequences. | |||
func (t *PropertyTestCaseProvider) checkPropertyTestFailed(worker *FuzzerWorker, propertyTestMethod *contracts.DeployedContractMethod) (bool, error) { | |||
// The property test is executed over the state indicating by the provided state root hash. |
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.
not sure what we mean by "provided state root hash" here?
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.
This was old from temporary code changes, removed in 56caf88
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.
bada bing bada boom
* Introduction of execution trace attaching and displaying for failed test call sequences * Added helpers to extract Solidity errors/panics (now used by assertion test provider and execution tracer) * Added fuzzer tests to verify execution trace output * Updated README with required solidity version for unit tests * Provided a wrapper for ExecuteCallSequenceIteratively, to simply re-execute a given call sequence without any custom checks * Updated FuzzerWorker to re-execute the finalized shrunken sequence before performing the "finalized shrunken sequence" callback, so all providers can assume state is post-execution. * Updated assertion test provider to attach an execution trace for the last call in a failing sequence * Updated property test provider to attach execution traces for the last call in a failing sequence, and for its property test * Updated the fuzzer worker so if a "trace all" flag is provided, it will attach execution traces to all finalized shrunken call sequence elements prior to returning the results to any test provider * Updated TestChain to provide a method to get the post-execution state root hash for a given block number * Cleaned up ABI error and event helpers by splitting them off to a compilation-related "abiutils" package. --------- Co-authored-by: anishnaik <anish.r.naik@gmail.com>
This PR adds execution traces to call sequences which fail tests. All shrunken sequences will now be replayed to capture execution traces for discern what caused failures within a single transaction.
It currently supports:
Other TODOs:
--trace-all
flag and associated config option to indicate the fuzzer should attach execution traces to all finalized shrunken sequences.A later PR should add support for on-chain
console.log()
, which should be incorporated in the trace. An issue should be opened to track that prior to merging this PR.