-
Notifications
You must be signed in to change notification settings - Fork 7
fix vm roll #451
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
base: master
Are you sure you want to change the base?
fix vm roll #451
Conversation
Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
|
|
||
| revive_cheat_test!(test_custom_nonce, "Nonce"); | ||
| revive_cheat_test_original!(test_nonce, "Nonce"); | ||
| revive_cheat_test_original!(test_roll, "Roll"); |
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.
Do not we need to call revive_cheat_test!(test_custom_roll, "Roll")
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.
The only custom stuff is this: https://github.com/paritytech/foundry-polkadot/pull/451/files#diff-91c2bf2016961cb8b7dadc4b761d94c6529077494b377ddddda2aaab10d07f3fR36, which copied from your PR, but I think is not needed because this test are already running with --polkadot.
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.
My point was that revive_cheat_test_original is looking for tests in original cheats directory. and this test we have locally in revive dir
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.
Aaa ok, will fix it.
| // Set block number in pallet-revive runtime. | ||
| self.0.lock().unwrap().execute_with(|| { | ||
| System::set_block_number(new_height.try_into().expect("Block number exceeds u64")); | ||
| let new_block_number: u64 = new_height.try_into().expect("Block number exceeds u32"); |
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.
should not we use System::run_to_block?
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.
The problem with run_to_block or anything that populates all the blocks, is that roll parameter seems to be part of the fuzz test, so that test takes a really long time, I gave up after 10s of minutes.
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.
OK, should the block hashes be in sync between EVM and revive?
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 see that foundry just do:
#[inline]
fn block_hash_ref(&self, number: u64) -> Result<B256, Self::Error> {
Ok(keccak256(number.to_string().as_bytes()))
}
if they do not have already this in cache.
So it means that foundry does not build blocks to calculate hash, and this is not done in roll. It is generated when we are accessing blockhash as I understand.
New blocks needs to be finalised and initialised otherwise
blockhashopcode won't find the hash and fail.