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: complete optimism mainnet forkid tests #8114
base: main
Are you sure you want to change the base?
Conversation
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.
left some comments, let me know if you're still stuck on getting the expected forkhash for these tests
crates/primitives/src/chain/spec.rs
Outdated
@@ -287,6 +287,7 @@ pub static OP_MAINNET: Lazy<Arc<ChainSpec>> = Lazy::new(|| { | |||
(Hardfork::Bedrock, ForkCondition::Block(105235063)), | |||
(Hardfork::Regolith, ForkCondition::Timestamp(0)), | |||
(Hardfork::Canyon, ForkCondition::Timestamp(1704992401)), | |||
(Hardfork::Delta, ForkCondition::Timestamp(1708560000)), |
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.
where did you find this? Is there an op mainnet genesis link somewhere?
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.
Added comment with link
2ea4bcc
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, reading this it looks like that's an op-node (CL) change, so it does not need to exist here
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.
Where do you see that?
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.
see https://docs.optimism.io/builders/node-operators/network-upgrades
The Delta upgrade uses a L2 block-timestamp activation-rule, and is specified only in the rollup-node (delta_time).
crates/primitives/src/chain/spec.rs
Outdated
// Canyon | ||
( | ||
Head { timestamp: 1704992401, ..Default::default() }, | ||
ForkId { hash: ForkHash([0x0, 0x0, 0x0, 0x0]), next: 1708560000 }, | ||
), | ||
// Delta | ||
( | ||
Head { timestamp: 1708560000, ..Default::default() }, | ||
ForkId { hash: ForkHash([0x0, 0x0, 0x0, 0x0]), next: 1710374401 }, | ||
), |
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.
re: #8012 (comment)
Is the forkhash supposed to be 00000000, do you have a source on that? That sounds incorrect
It's not supposed to be all zeros, typically values for this would be obtained from writing a similar test in geth, but since our final (ecotone) forkhash is compliant with geth, what we compute in test failures is probably also correct. However, starting at Canyon we can't use ..Default::default()
because the block needs to be higher than the london / bedrock block. Let's change it back to the previous block number
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.
[0x0, 0x0, 0x0, 0x0]
is just temporary since test failure output is not too useful, to be able to find back to the test case that failed
thread 'chain::spec::tests::op_mainnet_forkids' panicked at crates/primitives/src/chain/spec.rs:1643:13:
assertion `left == right` failed: Expected fork ID ForkId { hash: ForkHash("00000000"), next: 1708560000 }, computed fork ID ForkId { hash: ForkHash("caf517ed"), next: 3950000 } at block 0
left: ForkId { hash: ForkHash("00000000"), next: 1708560000 }
right: ForkId { hash: ForkHash("caf517ed"), next: 3950000 }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
crates/primitives/src/chain/spec.rs
Outdated
Head { number: 0, ..Default::default() }, | ||
ForkId { hash: ForkHash([0xca, 0xf5, 0x17, 0xed]), next: 3950000 }, | ||
), | ||
// TODO: complete these, see https://github.com/paradigmxyz/reth/issues/8012 | ||
// Berlin | ||
( | ||
Head { number: 105235063, timestamp: 1710374401, ..Default::default() }, | ||
Head { number: 3950000, ..Default::default() }, | ||
ForkId { hash: ForkHash([0x52, 0x6a, 0x21, 0x71]), next: 105235063 }, | ||
), | ||
// London | ||
( | ||
Head { number: 105235063, ..Default::default() }, | ||
ForkId { hash: ForkHash([0xe3, 0x39, 0x8d, 0x7c]), next: 1704992401 }, | ||
), | ||
// Arrow Glacier | ||
( | ||
Head { number: 105235063, ..Default::default() }, | ||
ForkId { hash: ForkHash([0xe3, 0x39, 0x8d, 0x7c]), next: 1704992401 }, | ||
), | ||
// Grey Glacier | ||
( | ||
Head { number: 105235063, ..Default::default() }, | ||
ForkId { hash: ForkHash([0xe3, 0x39, 0x8d, 0x7c]), next: 1704992401 }, | ||
), | ||
// Paris | ||
( | ||
Head { number: 105235063, ..Default::default() }, | ||
ForkId { hash: ForkHash([0xe3, 0x39, 0x8d, 0x7c]), next: 1704992401 }, | ||
), | ||
// Bedrock | ||
( | ||
Head { number: 105235063, ..Default::default() }, | ||
ForkId { hash: ForkHash([0xe3, 0x39, 0x8d, 0x7c]), next: 1704992401 }, | ||
), | ||
// Canyon | ||
( | ||
Head { timestamp: 1704992401, ..Default::default() }, | ||
ForkId { hash: ForkHash([0x0, 0x0, 0x0, 0x0]), next: 1708560000 }, | ||
), | ||
// Delta | ||
( | ||
Head { timestamp: 1708560000, ..Default::default() }, | ||
ForkId { hash: ForkHash([0x0, 0x0, 0x0, 0x0]), next: 1710374401 }, |
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.
let's make sure we specify number and timestamp explicitly for each of these
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.
using constants here, would be super helpful. would make it way easier to review if tests are correct + import values to other parts of codebase.
grouping constants in a type impl is nice.
pub struct OpMainnetForkHash;
impl OpMainnetForkHash {
pub const BEDROCK: ForkHash = <fork-hash>;
..
}
pub struct OpMainnetForkId;
impl OpMainnetForkId {
pub const BEDROCK: ForkId = ForkId::new(OpMainnetForkHash::BEDROCK, <next>);
..
}
pub struct OpMainnetForkTimestamp;
impl OpMainnetForkTimestamp {
pub const REGOLITH: u64 = 0;
..
}
IMO out of scope for this PR, since it should just be completing a few tests instead of introducing a new pattern for known forkhashes |
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.
needs lint and a few other small things
// Berlin | ||
( | ||
Head { number: 3950000, ..Default::default() }, | ||
ForkId { hash: ForkHash([0x52, 0x6a, 0x21, 0x71]), next: 105235063 }, | ||
), | ||
// London | ||
( | ||
Head { number: 105235063, ..Default::default() }, | ||
ForkId { hash: ForkHash([0xe3, 0x39, 0x8d, 0x7c]), next: 1704992401 }, | ||
), | ||
// Arrow Glacier | ||
( | ||
Head { number: 105235063, ..Default::default() }, | ||
ForkId { hash: ForkHash([0xe3, 0x39, 0x8d, 0x7c]), next: 1704992401 }, | ||
), | ||
// Grey Glacier | ||
( | ||
Head { number: 105235063, ..Default::default() }, | ||
ForkId { hash: ForkHash([0xe3, 0x39, 0x8d, 0x7c]), next: 1704992401 }, | ||
), | ||
// Paris | ||
( | ||
Head { number: 105235063, ..Default::default() }, | ||
ForkId { hash: ForkHash([0xe3, 0x39, 0x8d, 0x7c]), next: 1704992401 }, | ||
), | ||
// Bedrock | ||
( | ||
Head { number: 105235063, ..Default::default() }, | ||
ForkId { hash: ForkHash([0xe3, 0x39, 0x8d, 0x7c]), next: 1704992401 }, | ||
), | ||
// Shanghai | ||
( | ||
Head { number: 105235063, timestamp: 1704992401, ..Default::default() }, | ||
ForkId { hash: ForkHash([0xbd, 0xd4, 0xfd, 0xb2]), next: 1710374401 }, | ||
), |
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.
let's just use op-specific hardforks, I am realizing these are not super useful
/// Delta: | ||
/// https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/superchain-upgrades.md#delta | ||
#[cfg(feature = "optimism")] | ||
Delta, |
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.
this still needs to be removed
Closes #8012 when completed