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
cmd/evm, core/state: fix post-exec dump of state (statetests, blockchaintests) #28504
Conversation
a4a7be6
to
ba635fb
Compare
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.
Feels a little weird to have mismatch in behavior between Dump
and IteratorDump
? Also more generally, does it make sense for DumpCollector
to return accounts we don't know the preimage of? Failing silently-ish doesn't seem like a great option (although we do log that there were some number of accounts with missing preimages).
I know Felix recently used this in the hivechain
rewrite and there wouldn't be much use in outputing the preimages because it's expected that json will be consumed by programs which will process / antagonize the generated chain.
I agree, should be fixed.
Yes. The user/caller has passed in options, the options said In general, it can be useful to dump state even if the address is unknown, for whatever reason. |
Ahh okay I thought |
Yeah, me neither. I could go with |
I pushed another commit now, turns out we don't need two different structs. We can just omit to set the |
…ng preimages This changes makes it so that the block test executor takes a callback, just like the state test executor already does. This callback can be used to examine the post-execution state, e.g. to aid debugging of test failures. This change also modifies the mechanics of Dump: previously, all accounts for which we did not have the preimage (address) were silently discarded. Now they are output instead like this: ``` { "root": "3ef447699d08e3160c448903e77bd092c67ce3faeba773a3f83c500ab80f2400", "accounts": { "pre(0x03601462093b5945d1676df093446790fd31b20e7b12a2e8e5e09d068109616b)": { "balance": "10780210", "nonce": 1, ```
6d6a123
to
87aa2e5
Compare
I guess it's no longer true? Even with |
Good catch, fixed! |
…aintests) (ethereum#28504) There were several problems related to dumping state. - If a preimage was missing, even if we had set the `OnlyWithAddresses` to `false`, to export them anyway, the way the mapping was constructed (using `common.Address` as key) made the entries get lost anyway. Concerns both state- and blockchain tests. - Blockchain test execution was not configured to store preimages. This changes makes it so that the block test executor takes a callback, just like the state test executor already does. This callback can be used to examine the post-execution state, e.g. to aid debugging of test failures.
…aintests) (ethereum#28504) There were several problems related to dumping state. - If a preimage was missing, even if we had set the `OnlyWithAddresses` to `false`, to export them anyway, the way the mapping was constructed (using `common.Address` as key) made the entries get lost anyway. Concerns both state- and blockchain tests. - Blockchain test execution was not configured to store preimages. This changes makes it so that the block test executor takes a callback, just like the state test executor already does. This callback can be used to examine the post-execution state, e.g. to aid debugging of test failures.
In #28484 (comment), I mentioned some failures that I encountered while trying to state-dump a blockchain test (ethereum/execution-spec-tests#332) . It turns out that there were several problems.
OnlyWithAddresses
tofalse
, to export them anyway, the way the mapping was constructed (usingcommon.Address
as key) made the entries get lost anyway. This is fixed in the first commit, and concerns both state- and blockchain tests.This PR goes pretty well hand in hand with #28484 .