Skip to content

Commit

Permalink
Mumbai: fix fork ID for Agra (#8630)
Browse files Browse the repository at this point in the history
otherwise we start losing maticnetwork/bor peers on devp2p
  • Loading branch information
yperbasis authored Oct 31, 2023
1 parent d8d7d8d commit cabd2b2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/forkid/forkid.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ func GatherForks(config *chain.Config, genesisTime uint64) (heightForks []uint64
heightForks = append(heightForks, *config.Aura.PosdaoTransition)
}

if config.Bor != nil && config.Bor.AgraBlock != nil {
heightForks = append(heightForks, config.Bor.AgraBlock.Uint64())
}

// Sort the fork block numbers & times to permit chronological XOR
slices.Sort(heightForks)
slices.Sort(timeForks)
Expand Down
12 changes: 12 additions & 0 deletions core/forkid/forkid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,18 @@ func TestCreation(t *testing.T) {
{4100419, 1684934220, ID{Hash: checksumToBytes(0xa15a4252), Next: 0}}, // First Shanghai block
},
},
// Mumbai test cases
{
params.MumbaiChainConfig,
params.MumbaiGenesisHash,
[]testcase{
{0, 0, ID{Hash: checksumToBytes(0xf6ef3fdf), Next: 2722000}},
{2722000, 0, ID{Hash: checksumToBytes(0x8647df30), Next: 13996000}}, // First Istanbul block
{13996000, 0, ID{Hash: checksumToBytes(0x06cc1179), Next: 22640000}}, // First Berlin block
{22640000, 0, ID{Hash: checksumToBytes(0x9adf950e), Next: 41874000}}, // First London block
{41874000, 0, ID{Hash: checksumToBytes(0x0c015a91), Next: 0}}, // First Agra block
},
},
}
for i, tt := range tests {
for j, ttt := range tt.cases {
Expand Down

0 comments on commit cabd2b2

Please sign in to comment.