Open s1na opened 4 years ago
Update: is this still a thing? Eventually @ryanio has some opinion as the "state expert" in the team? 😄
When implementing this, also consider #560 along the way (not sure if this is meant here), will close #560 to consolidate on issues.
seems doable! we could implement this as suggested in OP by keeping track of a hash: address
mapping and then iterate over that list to dump the entire state or a diff between the pre
state.
@s1na do you have a fresh perspective on if this would still be valuable for you today?
@jochem-brouwer does this sound reasonable to you, would you prefer a different mechanism or would you find this helpful?
Just an additional note here: we should be careful to not introduce any performance penalties when the flag is not used if we decide to implement.
@s1na do you have a fresh perspective on if this would still be valuable for you today?
I think I ran into this when needing to debug when some state tests were failing, but don't have a use for it now. If you've found yourself in a similar situation when the bug is just evading you then might be worth it :)
@gabrocheleau can you take responsibilty for this issue, so either close or act upon? Thanks! 🙏
It'd be often helpful for debugging if the state test runner would optionally (e.g. given a
--dumpState
flag) print either the full post state (all accounts in trie and their storages) or the state diff betweenpre
andpost
.There currently exists a
dumpState
intests/util.js
which is not being used. One challenge is that when traversing the trie after the fact we only have access to the hash of addresses (SecureTrie
stores leaves under the hash of the key), and cannot infer the preimage of the hash (i.e. account/storage address) directly.I tried inheriting
SecureTrie
andCheckpointTrie
to add a map of formhash: address
which would allow us to recover addresses from their hashes. But because of how the old version ofmerkle-patricia-tree
does inheritance it's hard to get it right and I ended up copying code to VM directly.After the
merkle-patricia-tree
release this can be done cleanly.