Skip to content

Commit

Permalink
op-e2e: Fix BackUnsafe tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pcw109550 committed Jan 21, 2024
1 parent f66609b commit cadb3d4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion op-e2e/actions/l2_verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (s *L2Verifier) L2Unsafe() eth.L2BlockRef {
}

func (s *L2Verifier) L2BackupUnsafe() eth.L2BlockRef {
return s.derivation.BackupUnsafeL2Head()
return s.engine.BackupUnsafeL2Head()
}

func (s *L2Verifier) SyncStatus() *eth.SyncStatus {
Expand Down
17 changes: 11 additions & 6 deletions op-e2e/actions/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/ethereum-optimism/optimism/op-batcher/compressor"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum-optimism/optimism/op-node/rollup/sync"
"github.com/ethereum-optimism/optimism/op-service/eth"
Expand All @@ -25,6 +26,10 @@ import (
"github.com/stretchr/testify/require"
)

var (
rollupCfg rollup.Config
)

// TestSyncBatchType run each sync test case in singular batch mode and span batch mode.
func TestSyncBatchType(t *testing.T) {
tests := []struct {
Expand Down Expand Up @@ -198,7 +203,7 @@ func TestBackupUnsafe(gt *testing.T) {
seqHead, err := seqEngCl.PayloadByLabel(t.Ctx(), eth.Unsafe)
require.NoError(t, err)
// eventually correct hash for A5
targetUnsafeHeadHash := seqHead.BlockHash
targetUnsafeHeadHash := seqHead.ExecutionPayload.BlockHash

// only advance unsafe head to A5
require.Equal(t, sequencer.L2Unsafe().Number, uint64(5))
Expand Down Expand Up @@ -246,7 +251,7 @@ func TestBackupUnsafe(gt *testing.T) {
block = block.WithBody([]*types.Transaction{block.Transactions()[0], invalidTx}, []*types.Header{})
}
// Add A1, B2, B3, B4, B5 into the channel
_, err = channelOut.AddBlock(block)
_, err = channelOut.AddBlock(&rollupCfg, block)
require.NoError(t, err)
}

Expand Down Expand Up @@ -370,7 +375,7 @@ func TestBackupUnsafeReorgForkChoiceInputError(gt *testing.T) {
seqHead, err := seqEngCl.PayloadByLabel(t.Ctx(), eth.Unsafe)
require.NoError(t, err)
// eventually correct hash for A5
targetUnsafeHeadHash := seqHead.BlockHash
targetUnsafeHeadHash := seqHead.ExecutionPayload.BlockHash

// only advance unsafe head to A5
require.Equal(t, sequencer.L2Unsafe().Number, uint64(5))
Expand Down Expand Up @@ -418,7 +423,7 @@ func TestBackupUnsafeReorgForkChoiceInputError(gt *testing.T) {
block = block.WithBody([]*types.Transaction{block.Transactions()[0], invalidTx}, []*types.Header{})
}
// Add A1, B2, B3, B4, B5 into the channel
_, err = channelOut.AddBlock(block)
_, err = channelOut.AddBlock(&rollupCfg, block)
require.NoError(t, err)
}

Expand Down Expand Up @@ -518,7 +523,7 @@ func TestBackupUnsafeReorgForkChoiceNotInputError(gt *testing.T) {
seqHead, err := seqEngCl.PayloadByLabel(t.Ctx(), eth.Unsafe)
require.NoError(t, err)
// eventually correct hash for A5
targetUnsafeHeadHash := seqHead.BlockHash
targetUnsafeHeadHash := seqHead.ExecutionPayload.BlockHash

// only advance unsafe head to A5
require.Equal(t, sequencer.L2Unsafe().Number, uint64(5))
Expand Down Expand Up @@ -566,7 +571,7 @@ func TestBackupUnsafeReorgForkChoiceNotInputError(gt *testing.T) {
block = block.WithBody([]*types.Transaction{block.Transactions()[0], invalidTx}, []*types.Header{})
}
// Add A1, B2, B3, B4, B5 into the channel
_, err = channelOut.AddBlock(block)
_, err = channelOut.AddBlock(&rollupCfg, block)
require.NoError(t, err)
}

Expand Down

0 comments on commit cadb3d4

Please sign in to comment.