aleth icon indicating copy to clipboard operation
aleth copied to clipboard

VM tracing doesn't work right when syncing from the snapshot

Open gumb0 opened this issue 7 years ago • 3 comments

The snapshot contains only hashed keys of storage, after import the state DB doesn't have prehashes of keys.

But vm tracing tries to display storage contents with prehashes, calling this function to get them https://github.com/ethereum/cpp-ethereum/blob/ee0c6776c01b09045a379220c7e490000dae9377/libethereum/State.cpp#L407

which looks to go into indefinite loop and output a lot of Aux not found messages

gumb0 avatar Feb 20 '18 10:02 gumb0

The fix could be to change trace format to have both hashed keys and prehashes with 0 prehashes when they are not available (similar to what debug_storageRangeAt RPC returns)

Also check what geth outputs after fast sync in this case.

gumb0 avatar Feb 20 '18 10:02 gumb0

HI i am new to the project but would be glad to help with this issue. Could you explain please how to repeat the problem?

Neyromancer avatar Mar 28 '19 19:03 Neyromancer

Hi @Neyromancer, thank you for your interest.

Here are the instructions to make snapshot sync work https://github.com/ethereum/aleth/blob/master/doc/snapshot_sync.rst You can also run the commands with --ropsten, it's a bit less huge snapshot to download.

You don't need to sync to the top, just import the snapshot and then you need to run aleth sync with VM tracing enabled. For that first build aleth with VMTRACE flag (cmake .. -DVMTRACE=1; make) and then just aleth -v 4 - you should see the problem in log at this point.

-- ~~You could also start with checking out the geth's VM trace - run geth sync (any testnet will do, also no need to wait until it's synced to the top) and find out what's the result of debug.traceBlock call from geth console for any block containing EVM execution~~ Ah no, for the blocks before fast-sync pivot it can't show the trace, trace methods return error. What I really wanted to check with geth is - sync to the top, then trace any block after that - does it show storage?

gumb0 avatar Mar 29 '19 10:03 gumb0