-
Notifications
You must be signed in to change notification settings - Fork 1.5k
chore(DONOTMERGE): Show tests failing when using history_by_block_hash
#15631
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
chore(DONOTMERGE): Show tests failing when using history_by_block_hash
#15631
Conversation
Removed most of the JSON tests and checked in SimpleTX.json from ethereum-tests. Running |
One thing to note is that if we do: let state_provider = provider.history_by_block_hash(block.parent_hash)?;
state_provider
.account_balance(&address!("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b"))
.unwrap(); The account is not there, but in the simpleTx.json file, we can see that this account should have funds. Going back to: let state_provider = provider.latest(); and we see that the account is present |
|
||
assert_eq!( | ||
chain_spec_genesis_hash, | ||
genesis_block.hash_slow(), | ||
"shouldn't these hashes be the same?" | ||
); |
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.
I would have expected these to be the same, I get:
left: 0xc0f91ac7900ffb638fdf6d1f20dc4a210294debe5bb4e9096390d852ab378304
right: 0x8cbc69e33bd85b1f8d7bc6cae8f1d4502b74cfd0cd5f24a558c0d0c257c69daa
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.
Ah the chain_spec is derived from the ForkId, so it is using the default genesis block for that fork instead of the genesis block header in the json file
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.
From what I can see then:
- The execution spec tests define a genesis block header, and a network parameter (eg Cancun)
- There was code to convert the network parameter into a ChainSpec which has a genesis block based off of mainnet
- history_by_block_hash seemed to have been looking for the genesis block hash based off of the ChainSpec, whereas we saved the genesis block block hash that corresponds to the one in the execution spec test json file.
- I haven't checked, but I'm guessing latest() was looking at what we saved in the database and ignoring the ChainSpec
Closing this as it has been fixed on the stateless branch |
CC @rkrasiuk
This PR highlights possibly my misuse of the API.
Tests Passing
First we change from the ExecutionStage to ExecutorProvider in commit
52d66c73c572bf02c9f55a7b1a8cddf47c65d202
Running
make ef-tests
here will pass all tests.Tests fails
Next instead of using
LatestStateProviderRef
to create a state_provider, we switch to usinghistory_by_block_hash
in commit afc64a3running
make ef-tests
here fails with various error messages indicating that the state was not correctly fetched such as :What I am trying to do:
Ultimately, I am trying to execute each block individually and make an
ExecutionWitness
for each block