ethereum / execution-spec-tests

A Python framework and collection of test cases to generate test vectors for Ethereum execution clients
https://ethereum.github.io/execution-spec-tests
MIT License
106 stars 72 forks source link

feat(fw): add pretty printing of vm traces #433

Open danceratopz opened 8 months ago

danceratopz commented 8 months ago

Currently, fill --traces -s does print vm traces to the terminal if a test fails (note -s to prevent pytest from capturing stdout), but they're rather ugly. It'd be nice to have a more compact pretty print of these traces.

For example (assuming the test has been modified to fail upon filling):

fill tests/berlin/eip2930_access_list/ --fork Berlin --evm-dump-dir=/tmp/evm-dump --traces -s

Screenshot: image

Here's an example of a clean trace representation from retesteth: image

winsvega commented 8 months ago

I think can even optimise it better.

I have 2 options --vmtraceraw is always available. (Unformatted)

raxhvl commented 7 months ago

Can we use this package for formatting the debug trace?

danceratopz commented 7 months ago

Can we use this package for formatting the debug trace?

Hi @raxhvl, looks like a nice package. Would you like to pick this up? You may want to wait until #474 is merged, or base your work on that.

raxhvl commented 7 months ago

Hi there - I'm picking this up. I'm in touch with @marioevz on #474 progress. Thanks for reviewing the package.

marioevz commented 7 months ago

Hi @raxhvl thanks! If you check the branch on #474, compile the required geth branch, then inject an error in any test (I've been dropping the gas limit in this test to produce an Out-of-gas error for example), you can see the current output of the relevant traces for the test, which are very bland. If you'd like to give it a go to use rich package to print this a bit better it would be very nice.