Skip to content

Commit

Permalink
simulators/ethereum/engine: Fix bugs for ForkID and Missing Ancenstor…
Browse files Browse the repository at this point in the history
… Tests (ethereum#936)
  • Loading branch information
spencer-tb authored and Eikix committed Mar 1, 2024
1 parent b6c57c9 commit f366177
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions simulators/ethereum/engine/suites/engine/fork_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"strings"
"time"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/hive/simulators/ethereum/engine/clmock"
"github.com/ethereum/hive/simulators/ethereum/engine/config"
"github.com/ethereum/hive/simulators/ethereum/engine/devp2p"
Expand Down Expand Up @@ -34,6 +35,19 @@ func (ft ForkIDSpec) GetName() string {
return strings.Join(name, ", ")
}

func (s ForkIDSpec) GetForkConfig() *config.ForkConfig {
forkConfig := s.BaseSpec.GetForkConfig()
if forkConfig == nil {
return nil
}
// Merge fork happen at block 0
mainFork := s.GetMainFork()
if mainFork == config.Paris {
forkConfig.ParisNumber = common.Big0
}
return forkConfig
}

func (ft ForkIDSpec) Execute(t *test.Env) {
// Wait until TTD is reached by this client
t.CLMock.WaitForTTD()
Expand Down
6 changes: 6 additions & 0 deletions simulators/ethereum/engine/suites/engine/invalid_ancestor.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,12 @@ func (tc InvalidMissingAncestorReOrgSyncTest) Execute(t *test.Env) {
}
},
})

if !tc.ReOrgFromCanonical {
// Add back the original client before side chain production
t.CLMock.AddEngineClient(t.Engine)
}

t.Log("INFO: Starting side chain production")
t.CLMock.ProduceSingleBlock(clmock.BlockProcessCallbacks{
// Note: We perform the test in the middle of payload creation by the CL Mock, in order to be able to
Expand Down

0 comments on commit f366177

Please sign in to comment.