reth icon indicating copy to clipboard operation
reth copied to clipboard

Complete optimism mainnet forkid tests

Open Rjected opened this issue 1 year ago • 9 comments

We have a comprehensive set of tests for the mainnet and testnet forkids, including some optimism network tests: https://github.com/paradigmxyz/reth/blob/3d28a69134daa4f7ea1de004692f2630db152774/crates/primitives/src/chain/spec.rs#L2443-L2472

We should also add these for optimism mainnet, so we have forkid tests for all of the optimism networks covered.

Rjected avatar Apr 30 '24 23:04 Rjected

Note: I just added a very basic, non-comprehensive test for this. The test now just needs to be completed with the other forks!

Rjected avatar May 01 '24 00:05 Rjected

I'd like to work on this

estensen avatar May 01 '24 08:05 estensen

Where can I find the block numbers for the forks? Found timestamps here: https://specs.optimism.io/protocol/superchain-upgrades.html#activation-timestamps

By knowing the block number I can find the Bedrock upgrade https://optimistic.etherscan.io/block/105235063

estensen avatar May 01 '24 19:05 estensen

Where can I find the block numbers for the forks? Found timestamps here: https://specs.optimism.io/protocol/superchain-upgrades.html#activation-timestamps

By knowing the block number I can find the Bedrock upgrade https://optimistic.etherscan.io/block/105235063

yes, those should be correct, also take a look at the OP_MAINNET chainspec for the proper block and timestamp values. Just assigned!

Rjected avatar May 01 '24 19:05 Rjected

I can only see the timestamps and not the blocks in the chainspec

https://github.com/paradigmxyz/reth/blob/3d28a69134daa4f7ea1de004692f2630db152774/crates/primitives/src/chain/spec.rs#L297-L300

Also, do you want forkid tests for all hardforks or just Canyon, Delta and Ecotone?

estensen avatar May 01 '24 20:05 estensen

some hardforks are only conditioned on the timestamp and not the block number which is why some of them do not have a block number:)

onbjerg avatar May 01 '24 20:05 onbjerg

I've added the forks as test cases, but I'm stuck on computing ForkHash and next for Canyon and Delta https://github.com/paradigmxyz/reth/pull/8114

Computed fork ID is not computed correctly for Canyon and Delta:

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 }

estensen avatar May 05 '24 20:05 estensen

Is the forkhash supposed to be 00000000, do you have a source on that? That sounds incorrect

onbjerg avatar May 06 '24 10:05 onbjerg

left some comments in reviews, let's move there

Rjected avatar May 06 '24 15:05 Rjected