diff --git a/op-challenger/cmd/list_claims.go b/op-challenger/cmd/list_claims.go index 6d07454aa388f..5fee347ce3d29 100644 --- a/op-challenger/cmd/list_claims.go +++ b/op-challenger/cmd/list_claims.go @@ -82,7 +82,7 @@ func listClaims(ctx context.Context, game contracts.FaultDisputeGameContract, ve return fmt.Errorf("failed to retrieve split depth: %w", err) } status := metadata.Status - l2StartBlockNum, l2BlockNum, err := game.GetBlockRange(ctx) + l2StartBlockNum, l2BlockNum, err := game.GetGameRange(ctx) if err != nil { return fmt.Errorf("failed to retrieve status: %w", err) } diff --git a/op-challenger/cmd/list_games.go b/op-challenger/cmd/list_games.go index 0e0ce1880a8e3..beb85bf1ec774 100644 --- a/op-challenger/cmd/list_games.go +++ b/op-challenger/cmd/list_games.go @@ -116,7 +116,7 @@ func listGames(ctx context.Context, caller *batching.MultiCaller, factory *contr return } infos[currIndex].status = metadata.Status - infos[currIndex].l2BlockNum = metadata.L2BlockNum + infos[currIndex].l2BlockNum = metadata.L2SequenceNum infos[currIndex].rootClaim = metadata.RootClaim claimCount, err := gameContract.GetClaimCount(ctx) if err != nil { diff --git a/op-challenger/game/fault/contracts/faultdisputegame.go b/op-challenger/game/fault/contracts/faultdisputegame.go index f0385cd50133a..547c8c32ff290 100644 --- a/op-challenger/game/fault/contracts/faultdisputegame.go +++ b/op-challenger/game/fault/contracts/faultdisputegame.go @@ -178,10 +178,10 @@ func (f *FaultDisputeGameContractLatest) GetBalanceAndDelay(ctx context.Context, return balance, delay, weth.Addr(), nil } -// GetBlockRange returns the block numbers of the absolute pre-state block (typically genesis or the bedrock activation block) +// GetGameRange returns the block numbers of the absolute pre-state block (typically genesis or the bedrock activation block) // and the post-state block (that the proposed output root is for). -func (f *FaultDisputeGameContractLatest) GetBlockRange(ctx context.Context) (prestateBlock uint64, poststateBlock uint64, retErr error) { - defer f.metrics.StartContractRequest("GetBlockRange")() +func (f *FaultDisputeGameContractLatest) GetGameRange(ctx context.Context) (prestateBlock uint64, poststateBlock uint64, retErr error) { + defer f.metrics.StartContractRequest("GetGameRange")() results, err := f.multiCaller.Call(ctx, rpcblock.Latest, f.contract.Call(methodStartingBlockNumber), f.contract.Call(methodL2BlockNumber)) @@ -200,7 +200,7 @@ func (f *FaultDisputeGameContractLatest) GetBlockRange(ctx context.Context) (pre type GameMetadata struct { L1Head common.Hash - L2BlockNum uint64 + L2SequenceNum uint64 RootClaim common.Hash Status gameTypes.GameStatus MaxClockDuration uint64 @@ -238,7 +238,7 @@ func (f *FaultDisputeGameContractLatest) GetGameMetadata(ctx context.Context, bl blockChallenger := results[6].GetAddress(0) return GameMetadata{ L1Head: l1Head, - L2BlockNum: l2BlockNumber, + L2SequenceNum: l2BlockNumber, RootClaim: rootClaim, Status: status, MaxClockDuration: duration, @@ -637,7 +637,7 @@ func (f *FaultDisputeGameContractLatest) decodeClaim(result *batching.CallResult type FaultDisputeGameContract interface { GetBalanceAndDelay(ctx context.Context, block rpcblock.Block) (*big.Int, time.Duration, common.Address, error) - GetBlockRange(ctx context.Context) (prestateBlock uint64, poststateBlock uint64, retErr error) + GetGameRange(ctx context.Context) (prestateBlock uint64, poststateBlock uint64, retErr error) GetGameMetadata(ctx context.Context, block rpcblock.Block) (GameMetadata, error) GetResolvedAt(ctx context.Context, block rpcblock.Block) (time.Time, error) GetStartingRootHash(ctx context.Context) (common.Hash, error) diff --git a/op-challenger/game/fault/contracts/faultdisputegame0180.go b/op-challenger/game/fault/contracts/faultdisputegame0180.go index e97a1211e398d..6c0bc61caeafb 100644 --- a/op-challenger/game/fault/contracts/faultdisputegame0180.go +++ b/op-challenger/game/fault/contracts/faultdisputegame0180.go @@ -46,7 +46,7 @@ func (f *FaultDisputeGameContract0180) GetGameMetadata(ctx context.Context, bloc duration := results[4].GetUint64(0) return GameMetadata{ L1Head: l1Head, - L2BlockNum: l2BlockNumber, + L2SequenceNum: l2BlockNumber, RootClaim: rootClaim, Status: status, MaxClockDuration: duration, diff --git a/op-challenger/game/fault/contracts/faultdisputegame080.go b/op-challenger/game/fault/contracts/faultdisputegame080.go index 0ac1b3f5ee514..492e160c16e5d 100644 --- a/op-challenger/game/fault/contracts/faultdisputegame080.go +++ b/op-challenger/game/fault/contracts/faultdisputegame080.go @@ -53,7 +53,7 @@ func (f *FaultDisputeGameContract080) GetGameMetadata(ctx context.Context, block duration := results[4].GetUint64(0) return GameMetadata{ L1Head: l1Head, - L2BlockNum: l2BlockNumber, + L2SequenceNum: l2BlockNumber, RootClaim: rootClaim, Status: status, MaxClockDuration: duration / 2, diff --git a/op-challenger/game/fault/contracts/faultdisputegame_test.go b/op-challenger/game/fault/contracts/faultdisputegame_test.go index 683dd06551a0d..151aec86325de 100644 --- a/op-challenger/game/fault/contracts/faultdisputegame_test.go +++ b/op-challenger/game/fault/contracts/faultdisputegame_test.go @@ -48,7 +48,7 @@ func (c contractVersion) Is(versions ...string) bool { } func (c contractVersion) String() string { - return fmt.Sprintf("%s (%s)", c.version, c.gameType) + return fmt.Sprintf("%s_%s", c.version, c.gameType) } func (c contractVersion) IsSuperCannon() bool { @@ -109,7 +109,7 @@ var versions = []contractVersion{ { version: verSuperCannon, gameType: faultTypes.SuperCannonGameType, - loadAbi: snapshots.LoadFaultDisputeGameABI, + loadAbi: snapshots.LoadSuperFaultDisputeGameABI, }, } @@ -543,9 +543,14 @@ func TestGetBlockRange(t *testing.T) { stubRpc, contract := setupFaultDisputeGameTest(t, version) expectedStart := uint64(65) expectedEnd := uint64(102) - stubRpc.SetResponse(fdgAddr, methodStartingBlockNumber, rpcblock.Latest, nil, []interface{}{new(big.Int).SetUint64(expectedStart)}) - stubRpc.SetResponse(fdgAddr, methodL2BlockNumber, rpcblock.Latest, nil, []interface{}{new(big.Int).SetUint64(expectedEnd)}) - start, end, err := contract.GetBlockRange(context.Background()) + if version.IsSuperCannon() { + stubRpc.SetResponse(fdgAddr, methodStartingSequenceNumber, rpcblock.Latest, nil, []interface{}{new(big.Int).SetUint64(expectedStart)}) + stubRpc.SetResponse(fdgAddr, methodL2SequenceNumber, rpcblock.Latest, nil, []interface{}{new(big.Int).SetUint64(expectedEnd)}) + } else { + stubRpc.SetResponse(fdgAddr, methodStartingBlockNumber, rpcblock.Latest, nil, []interface{}{new(big.Int).SetUint64(expectedStart)}) + stubRpc.SetResponse(fdgAddr, methodL2BlockNumber, rpcblock.Latest, nil, []interface{}{new(big.Int).SetUint64(expectedEnd)}) + } + start, end, err := contract.GetGameRange(context.Background()) require.NoError(t, err) require.Equal(t, expectedStart, start) require.Equal(t, expectedEnd, end) @@ -581,7 +586,11 @@ func TestGetGameMetadata(t *testing.T) { expectedL2BlockNumberChallenger := common.Address{0xee} block := rpcblock.ByNumber(889) stubRpc.SetResponse(fdgAddr, methodL1Head, block, nil, []interface{}{expectedL1Head}) - stubRpc.SetResponse(fdgAddr, methodL2BlockNumber, block, nil, []interface{}{new(big.Int).SetUint64(expectedL2BlockNumber)}) + if version.IsSuperCannon() { + stubRpc.SetResponse(fdgAddr, methodL2SequenceNumber, block, nil, []interface{}{new(big.Int).SetUint64(expectedL2BlockNumber)}) + } else { + stubRpc.SetResponse(fdgAddr, methodL2BlockNumber, block, nil, []interface{}{new(big.Int).SetUint64(expectedL2BlockNumber)}) + } stubRpc.SetResponse(fdgAddr, methodRootClaim, block, nil, []interface{}{expectedRootClaim}) stubRpc.SetResponse(fdgAddr, methodStatus, block, nil, []interface{}{expectedStatus}) supportsL2BlockNumChallenge := (version.version != vers080 && version.version != vers0180) && !version.IsSuperCannon() @@ -589,13 +598,13 @@ func TestGetGameMetadata(t *testing.T) { stubRpc.SetResponse(fdgAddr, methodMaxClockDuration, block, nil, []interface{}{expectedMaxClockDuration}) stubRpc.SetResponse(fdgAddr, methodL2BlockNumberChallenged, block, nil, []interface{}{expectedL2BlockNumberChallenged}) stubRpc.SetResponse(fdgAddr, methodL2BlockNumberChallenger, block, nil, []interface{}{expectedL2BlockNumberChallenger}) - } else if expectedL2BlockNumberChallenged { + } else { t.Skip("Can't have challenged L2 block number on this contract version") } actual, err := contract.GetGameMetadata(context.Background(), block) expected := GameMetadata{ L1Head: expectedL1Head, - L2BlockNum: expectedL2BlockNumber, + L2SequenceNum: expectedL2BlockNumber, RootClaim: expectedRootClaim, Status: expectedStatus, MaxClockDuration: expectedMaxClockDuration, diff --git a/op-challenger/game/fault/contracts/superfaultdisputegame.go b/op-challenger/game/fault/contracts/superfaultdisputegame.go index 5add719a453d9..ed0561c7a71f4 100644 --- a/op-challenger/game/fault/contracts/superfaultdisputegame.go +++ b/op-challenger/game/fault/contracts/superfaultdisputegame.go @@ -14,12 +14,17 @@ import ( "github.com/ethereum/go-ethereum/common" ) +var ( + methodL2SequenceNumber = "l2SequenceNumber" + methodStartingSequenceNumber = "startingSequenceNumber" +) + type SuperFaultDisputeGameContractLatest struct { FaultDisputeGameContractLatest } func NewSuperFaultDisputeGameContract(ctx context.Context, metrics metrics.ContractMetricer, addr common.Address, caller *batching.MultiCaller) (FaultDisputeGameContract, error) { - contractAbi := snapshots.LoadFaultDisputeGameABI() + contractAbi := snapshots.LoadSuperFaultDisputeGameABI() return &SuperFaultDisputeGameContractLatest{ FaultDisputeGameContractLatest: FaultDisputeGameContractLatest{ metrics: metrics, @@ -34,7 +39,7 @@ func (f *SuperFaultDisputeGameContractLatest) GetGameMetadata(ctx context.Contex defer f.metrics.StartContractRequest("GetGameMetadata")() results, err := f.multiCaller.Call(ctx, block, f.contract.Call(methodL1Head), - f.contract.Call(methodL2BlockNumber), + f.contract.Call(methodL2SequenceNumber), f.contract.Call(methodRootClaim), f.contract.Call(methodStatus), f.contract.Call(methodMaxClockDuration), @@ -46,7 +51,7 @@ func (f *SuperFaultDisputeGameContractLatest) GetGameMetadata(ctx context.Contex return GameMetadata{}, fmt.Errorf("expected 5 results but got %v", len(results)) } l1Head := results[0].GetHash(0) - l2BlockNumber := results[1].GetBigInt(0).Uint64() + l2Timestamp := results[1].GetBigInt(0).Uint64() rootClaim := results[2].GetHash(0) status, err := gameTypes.GameStatusFromUint8(results[3].GetUint8(0)) if err != nil { @@ -55,7 +60,7 @@ func (f *SuperFaultDisputeGameContractLatest) GetGameMetadata(ctx context.Contex duration := results[4].GetUint64(0) return GameMetadata{ L1Head: l1Head, - L2BlockNum: l2BlockNumber, + L2SequenceNum: l2Timestamp, RootClaim: rootClaim, Status: status, MaxClockDuration: duration, @@ -69,3 +74,22 @@ func (f *SuperFaultDisputeGameContractLatest) IsL2BlockNumberChallenged(ctx cont func (f *SuperFaultDisputeGameContractLatest) ChallengeL2BlockNumberTx(challenge *types.InvalidL2BlockNumberChallenge) (txmgr.TxCandidate, error) { return txmgr.TxCandidate{}, ErrChallengeL2BlockNotSupported } + +// GetGameRange returns the timestamps of the absolute pre-state and the proposed super root +func (f *SuperFaultDisputeGameContractLatest) GetGameRange(ctx context.Context) (prestateBlock uint64, poststateBlock uint64, retErr error) { + defer f.metrics.StartContractRequest("GetGameRange")() + results, err := f.multiCaller.Call(ctx, rpcblock.Latest, + f.contract.Call(methodStartingSequenceNumber), + f.contract.Call(methodL2SequenceNumber)) + if err != nil { + retErr = fmt.Errorf("failed to retrieve game range: %w", err) + return + } + if len(results) != 2 { + retErr = fmt.Errorf("expected 2 results but got %v", len(results)) + return + } + prestateBlock = results[0].GetBigInt(0).Uint64() + poststateBlock = results[1].GetBigInt(0).Uint64() + return +} diff --git a/op-challenger/game/fault/register_task.go b/op-challenger/game/fault/register_task.go index 0bf710b25d9f6..1bc233b8aa90b 100644 --- a/op-challenger/game/fault/register_task.go +++ b/op-challenger/game/fault/register_task.go @@ -273,7 +273,7 @@ func (e *RegisterTask) Register( return nil, fmt.Errorf("failed to load oracle for game %v: %w", game.Proxy, err) } oracles.RegisterOracle(oracle) - prestateBlock, poststateBlock, err := contract.GetBlockRange(ctx) + prestateBlock, poststateBlock, err := contract.GetGameRange(ctx) if err != nil { return nil, err } diff --git a/op-challenger/game/fault/trace/super/super_cannon.go b/op-challenger/game/fault/trace/super/super_cannon.go index 50545637f7a0b..679844d2eb4ef 100644 --- a/op-challenger/game/fault/trace/super/super_cannon.go +++ b/op-challenger/game/fault/trace/super/super_cannon.go @@ -30,23 +30,23 @@ func NewSuperCannonTraceAccessor( dir string, l1Head eth.BlockID, splitDepth types.Depth, - prestateBlock uint64, - poststateBlock uint64, + prestateTimestamp uint64, + poststateTimestamp uint64, ) (*trace.Accessor, error) { rollupCfgs, err := NewRollupConfigs(cfg) if err != nil { return nil, fmt.Errorf("failed to load rollup configs: %w", err) } - outputProvider := NewSuperTraceProvider(logger, rollupCfgs, prestateProvider, rootProvider, l1Head, splitDepth, prestateBlock, poststateBlock) + outputProvider := NewSuperTraceProvider(logger, rollupCfgs, prestateProvider, rootProvider, l1Head, splitDepth, prestateTimestamp, poststateTimestamp) cannonCreator := func(ctx context.Context, localContext common.Hash, depth types.Depth, claimInfo ClaimInfo) (types.TraceProvider, error) { logger := logger.New("agreedPrestate", claimInfo.AgreedPrestate, "claim", claimInfo.Claim, "localContext", localContext) subdir := filepath.Join(dir, localContext.Hex()) localInputs := utils.LocalGameInputs{ - L1Head: l1Head.Hash, - L2OutputRoot: crypto.Keccak256Hash(claimInfo.AgreedPrestate), - AgreedPreState: claimInfo.AgreedPrestate, - L2Claim: claimInfo.Claim, - L2BlockNumber: new(big.Int).SetUint64(poststateBlock), + L1Head: l1Head.Hash, + L2OutputRoot: crypto.Keccak256Hash(claimInfo.AgreedPrestate), + AgreedPreState: claimInfo.AgreedPrestate, + L2Claim: claimInfo.Claim, + L2SequenceNumber: new(big.Int).SetUint64(poststateTimestamp), } provider := cannon.NewTraceProvider(logger, m.ToTypedVmMetrics(cfg.VmType.String()), cfg, serverExecutor, prestateProvider, cannonPrestate, localInputs, subdir, depth) return provider, nil diff --git a/op-challenger/game/fault/trace/utils/local.go b/op-challenger/game/fault/trace/utils/local.go index 3604bfbfa2e4c..85f64e4021121 100644 --- a/op-challenger/game/fault/trace/utils/local.go +++ b/op-challenger/game/fault/trace/utils/local.go @@ -10,12 +10,12 @@ import ( ) type LocalGameInputs struct { - L1Head common.Hash - L2Head common.Hash - L2OutputRoot common.Hash - AgreedPreState []byte - L2Claim common.Hash - L2BlockNumber *big.Int + L1Head common.Hash + L2Head common.Hash + L2OutputRoot common.Hash + AgreedPreState []byte + L2Claim common.Hash + L2SequenceNumber *big.Int } type L2HeaderSource interface { @@ -57,10 +57,10 @@ func FetchLocalInputsFromProposals(ctx context.Context, l1Head common.Hash, l2Cl l2Head := agreedHeader.Hash() return LocalGameInputs{ - L1Head: l1Head, - L2Head: l2Head, - L2OutputRoot: agreedOutput.OutputRoot, - L2Claim: claimedOutput.OutputRoot, - L2BlockNumber: claimedOutput.L2BlockNumber, + L1Head: l1Head, + L2Head: l2Head, + L2OutputRoot: agreedOutput.OutputRoot, + L2Claim: claimedOutput.OutputRoot, + L2SequenceNumber: claimedOutput.L2BlockNumber, }, nil } diff --git a/op-challenger/game/fault/trace/utils/local_test.go b/op-challenger/game/fault/trace/utils/local_test.go index ee80528b407b8..cb6224429a9b4 100644 --- a/op-challenger/game/fault/trace/utils/local_test.go +++ b/op-challenger/game/fault/trace/utils/local_test.go @@ -38,7 +38,7 @@ func TestFetchLocalInputs(t *testing.T) { require.Equal(t, l2Client.header.Hash(), inputs.L2Head) require.EqualValues(t, contract.starting.OutputRoot, inputs.L2OutputRoot) require.EqualValues(t, contract.disputed.OutputRoot, inputs.L2Claim) - require.Equal(t, contract.disputed.L2BlockNumber, inputs.L2BlockNumber) + require.Equal(t, contract.disputed.L2BlockNumber, inputs.L2SequenceNumber) } func TestFetchLocalInputsFromProposals(t *testing.T) { @@ -66,7 +66,7 @@ func TestFetchLocalInputsFromProposals(t *testing.T) { require.Equal(t, l2Client.header.Hash(), inputs.L2Head) require.EqualValues(t, agreed.OutputRoot, inputs.L2OutputRoot) require.EqualValues(t, claimed.OutputRoot, inputs.L2Claim) - require.Equal(t, claimed.L2BlockNumber, inputs.L2BlockNumber) + require.Equal(t, claimed.L2BlockNumber, inputs.L2SequenceNumber) } type mockGameInputsSource struct { diff --git a/op-challenger/game/fault/trace/vm/executor_test.go b/op-challenger/game/fault/trace/vm/executor_test.go index 6deccea98130f..ba6c4f8a269db 100644 --- a/op-challenger/game/fault/trace/vm/executor_test.go +++ b/op-challenger/game/fault/trace/vm/executor_test.go @@ -39,11 +39,11 @@ func TestGenerateProof(t *testing.T) { } inputs := utils.LocalGameInputs{ - L1Head: common.Hash{0x11}, - L2Head: common.Hash{0x22}, - L2OutputRoot: common.Hash{0x33}, - L2Claim: common.Hash{0x44}, - L2BlockNumber: big.NewInt(3333), + L1Head: common.Hash{0x11}, + L2Head: common.Hash{0x22}, + L2OutputRoot: common.Hash{0x33}, + L2Claim: common.Hash{0x44}, + L2SequenceNumber: big.NewInt(3333), } info := &mipsevm.DebugInfo{ diff --git a/op-challenger/game/fault/trace/vm/kona_server_executor.go b/op-challenger/game/fault/trace/vm/kona_server_executor.go index 7bb787004ac82..8f1e9b60872de 100644 --- a/op-challenger/game/fault/trace/vm/kona_server_executor.go +++ b/op-challenger/game/fault/trace/vm/kona_server_executor.go @@ -36,7 +36,7 @@ func (s *KonaExecutor) OracleCommand(cfg Config, dataDir string, inputs utils.Lo "--l2-head", inputs.L2Head.Hex(), "--l2-output-root", inputs.L2OutputRoot.Hex(), "--l2-claim", inputs.L2Claim.Hex(), - "--l2-block-number", inputs.L2BlockNumber.Text(10), + "--l2-block-number", inputs.L2SequenceNumber.Text(10), } if s.nativeMode { diff --git a/op-challenger/game/fault/trace/vm/kona_server_executor_test.go b/op-challenger/game/fault/trace/vm/kona_server_executor_test.go index 74262bfb77aef..05413d8f4e038 100644 --- a/op-challenger/game/fault/trace/vm/kona_server_executor_test.go +++ b/op-challenger/game/fault/trace/vm/kona_server_executor_test.go @@ -20,11 +20,11 @@ func TestKonaFillHostCommand(t *testing.T) { Networks: []string{"op-mainnet"}, } inputs := utils.LocalGameInputs{ - L1Head: common.Hash{0x11}, - L2Head: common.Hash{0x22}, - L2OutputRoot: common.Hash{0x33}, - L2Claim: common.Hash{0x44}, - L2BlockNumber: big.NewInt(3333), + L1Head: common.Hash{0x11}, + L2Head: common.Hash{0x22}, + L2OutputRoot: common.Hash{0x33}, + L2Claim: common.Hash{0x44}, + L2SequenceNumber: big.NewInt(3333), } vmConfig := NewKonaExecutor() diff --git a/op-challenger/game/fault/trace/vm/kona_super_server_executor.go b/op-challenger/game/fault/trace/vm/kona_super_server_executor.go index 0838955482007..03a2747501903 100644 --- a/op-challenger/game/fault/trace/vm/kona_super_server_executor.go +++ b/op-challenger/game/fault/trace/vm/kona_super_server_executor.go @@ -36,7 +36,7 @@ func (s *KonaSuperExecutor) OracleCommand(cfg Config, dataDir string, inputs uti "--l1-head", inputs.L1Head.Hex(), "--agreed-l2-pre-state", common.Bytes2Hex(inputs.AgreedPreState), "--claimed-l2-post-state", inputs.L2Claim.Hex(), - "--claimed-l2-timestamp", inputs.L2BlockNumber.Text(10), + "--claimed-l2-timestamp", inputs.L2SequenceNumber.Text(10), } if s.nativeMode { diff --git a/op-challenger/game/fault/trace/vm/op_program_server_executor.go b/op-challenger/game/fault/trace/vm/op_program_server_executor.go index c79a1bfcaf967..f50196c1cb402 100644 --- a/op-challenger/game/fault/trace/vm/op_program_server_executor.go +++ b/op-challenger/game/fault/trace/vm/op_program_server_executor.go @@ -28,7 +28,7 @@ func (s *OpProgramServerExecutor) OracleCommand(cfg Config, dataDir string, inpu "--datadir", dataDir, "--l1.head", inputs.L1Head.Hex(), "--l2.claim", inputs.L2Claim.Hex(), - "--l2.blocknumber", inputs.L2BlockNumber.Text(10), + "--l2.blocknumber", inputs.L2SequenceNumber.Text(10), } if inputs.L2Head != (common.Hash{}) { args = append(args, "--l2.head", inputs.L2Head.Hex()) diff --git a/op-challenger/game/fault/trace/vm/op_program_server_executor_test.go b/op-challenger/game/fault/trace/vm/op_program_server_executor_test.go index c990f03a8bbfd..1120e02df8df4 100644 --- a/op-challenger/game/fault/trace/vm/op_program_server_executor_test.go +++ b/op-challenger/game/fault/trace/vm/op_program_server_executor_test.go @@ -39,11 +39,11 @@ func TestOpProgramFillHostCommand(t *testing.T) { Server: "./bin/mockserver", } inputs := utils.LocalGameInputs{ - L1Head: common.Hash{0x11}, - L2Head: common.Hash{0x22}, - L2OutputRoot: common.Hash{0x33}, - L2Claim: common.Hash{0x44}, - L2BlockNumber: big.NewInt(3333), + L1Head: common.Hash{0x11}, + L2Head: common.Hash{0x22}, + L2OutputRoot: common.Hash{0x33}, + L2Claim: common.Hash{0x44}, + L2SequenceNumber: big.NewInt(3333), } configModifier(&cfg, &inputs) executor := NewOpProgramServerExecutor(testlog.Logger(t, lvl)) @@ -59,7 +59,7 @@ func TestOpProgramFillHostCommand(t *testing.T) { require.Equal(t, dir, pairs["--datadir"]) require.Equal(t, inputs.L1Head.Hex(), pairs["--l1.head"]) require.Equal(t, inputs.L2Claim.Hex(), pairs["--l2.claim"]) - require.Equal(t, inputs.L2BlockNumber.String(), pairs["--l2.blocknumber"]) + require.Equal(t, inputs.L2SequenceNumber.String(), pairs["--l2.blocknumber"]) return pairs } diff --git a/op-challenger/runner/game_inputs.go b/op-challenger/runner/game_inputs.go index ab4d98b66c284..46637daed5287 100644 --- a/op-challenger/runner/game_inputs.go +++ b/op-challenger/runner/game_inputs.go @@ -70,11 +70,11 @@ func createGameInputsSingle(ctx context.Context, log log.Logger, client *sources return utils.LocalGameInputs{}, fmt.Errorf("failed to get claim output: %w", err) } localInputs := utils.LocalGameInputs{ - L1Head: l1Head.Hash, - L2Head: parentOutput.BlockRef.Hash, - L2OutputRoot: common.Hash(parentOutput.OutputRoot), - L2Claim: common.Hash(claimOutput.OutputRoot), - L2BlockNumber: new(big.Int).SetUint64(blockNumber), + L1Head: l1Head.Hash, + L2Head: parentOutput.BlockRef.Hash, + L2OutputRoot: common.Hash(parentOutput.OutputRoot), + L2Claim: common.Hash(claimOutput.OutputRoot), + L2SequenceNumber: new(big.Int).SetUint64(blockNumber), } return localInputs, nil } @@ -137,11 +137,11 @@ func createGameInputsInterop(ctx context.Context, log log.Logger, client *source } } localInputs := utils.LocalGameInputs{ - L1Head: l1Head.Hash, - AgreedPreState: agreedPrestate, - L2OutputRoot: crypto.Keccak256Hash(agreedPrestate), - L2Claim: claim, - L2BlockNumber: new(big.Int).SetUint64(claimTimestamp + 10), // Anything beyond the claim + L1Head: l1Head.Hash, + AgreedPreState: agreedPrestate, + L2OutputRoot: crypto.Keccak256Hash(agreedPrestate), + L2Claim: claim, + L2SequenceNumber: new(big.Int).SetUint64(claimTimestamp + 10), // Anything beyond the claim } return localInputs, nil } diff --git a/op-challenger/runner/runner.go b/op-challenger/runner/runner.go index 580b353e849fa..b717d286d83fc 100644 --- a/op-challenger/runner/runner.go +++ b/op-challenger/runner/runner.go @@ -177,7 +177,7 @@ func (r *Runner) runAndRecordOnce(ctx context.Context, runConfig RunConfig, roll return } - inputsLogger := r.log.New("l1", localInputs.L1Head, "l2", localInputs.L2Head, "l2Block", localInputs.L2BlockNumber, "claim", localInputs.L2Claim) + inputsLogger := r.log.New("l1", localInputs.L1Head, "l2", localInputs.L2Head, "l2Block", localInputs.L2SequenceNumber, "claim", localInputs.L2Claim) // Sanitize the directory name. safeName := regexp.MustCompile("[^a-zA-Z0-9_-]").ReplaceAllString(runConfig.Name, "") dir, err := r.prepDatadir(safeName) diff --git a/op-dispute-mon/mon/extract/extractor.go b/op-dispute-mon/mon/extract/extractor.go index c40b31ccb6c51..3ac1870f5fe9d 100644 --- a/op-dispute-mon/mon/extract/extractor.go +++ b/op-dispute-mon/mon/extract/extractor.go @@ -152,7 +152,7 @@ func (e *Extractor) enrichGame(ctx context.Context, blockHash common.Hash, game LastUpdateTime: e.clock.Now(), GameMetadata: game, L1Head: meta.L1Head, - L2BlockNumber: meta.L2BlockNum, + L2BlockNumber: meta.L2SequenceNum, RootClaim: meta.RootClaim, Status: meta.Status, MaxClockDuration: meta.MaxClockDuration, diff --git a/op-e2e/actions/proofs/helpers/kona.go b/op-e2e/actions/proofs/helpers/kona.go index e826bf75c51e1..203c10ede518a 100644 --- a/op-e2e/actions/proofs/helpers/kona.go +++ b/op-e2e/actions/proofs/helpers/kona.go @@ -56,11 +56,11 @@ func RunKonaNative( Server: konaHostPath, } inputs := utils.LocalGameInputs{ - L1Head: fixtureInputs.L1Head, - L2Head: fixtureInputs.L2Head, - L2OutputRoot: fixtureInputs.L2OutputRoot, - L2Claim: fixtureInputs.L2Claim, - L2BlockNumber: big.NewInt(int64(fixtureInputs.L2BlockNumber)), + L1Head: fixtureInputs.L1Head, + L2Head: fixtureInputs.L2Head, + L2OutputRoot: fixtureInputs.L2OutputRoot, + L2Claim: fixtureInputs.L2Claim, + L2SequenceNumber: big.NewInt(int64(fixtureInputs.L2BlockNumber)), } var hostCmd []string diff --git a/op-e2e/e2eutils/disputegame/cannon_helper.go b/op-e2e/e2eutils/disputegame/cannon_helper.go index b49c70c5bed8f..8284f6f35ce47 100644 --- a/op-e2e/e2eutils/disputegame/cannon_helper.go +++ b/op-e2e/e2eutils/disputegame/cannon_helper.go @@ -337,7 +337,7 @@ func (g *CannonHelper) createCannonTraceProvider(ctx context.Context, l2Node str l2Client := g.system.NodeClient(l2Node) - prestateBlock, poststateBlock, err := g.splitGame.Game.GetBlockRange(ctx) + prestateBlock, poststateBlock, err := g.splitGame.Game.GetGameRange(ctx) g.require.NoError(err, "Failed to load block range") rollupClient := g.system.RollupClient(l2Node) prestateProvider := outputs.NewPrestateProvider(rollupClient, prestateBlock) diff --git a/op-e2e/e2eutils/disputegame/helper.go b/op-e2e/e2eutils/disputegame/helper.go index 50d9cd9c4f141..9d07586d9a21f 100644 --- a/op-e2e/e2eutils/disputegame/helper.go +++ b/op-e2e/e2eutils/disputegame/helper.go @@ -202,7 +202,7 @@ func (h *FactoryHelper) startOutputCannonGameOfType(ctx context.Context, l2Node game, err := contracts.NewFaultDisputeGameContract(ctx, metrics.NoopContractMetrics, createdEvent.DisputeProxy, batching.NewMultiCaller(h.Client.Client(), batching.DefaultBatchSize)) h.Require.NoError(err) - prestateBlock, poststateBlock, err := game.GetBlockRange(ctx) + prestateBlock, poststateBlock, err := game.GetGameRange(ctx) h.Require.NoError(err, "Failed to load starting block number") splitDepth, err := game.GetSplitDepth(ctx) h.Require.NoError(err, "Failed to load split depth") @@ -240,7 +240,7 @@ func (h *FactoryHelper) startSuperCannonGameOfType(ctx context.Context, timestam game, err := contracts.NewFaultDisputeGameContract(ctx, metrics.NoopContractMetrics, createdEvent.DisputeProxy, batching.NewMultiCaller(h.Client.Client(), batching.DefaultBatchSize)) h.Require.NoError(err) - prestateTimestamp, poststateTimestamp, err := game.GetBlockRange(ctx) + prestateTimestamp, poststateTimestamp, err := game.GetGameRange(ctx) h.Require.NoError(err, "Failed to load starting block number") splitDepth, err := game.GetSplitDepth(ctx) h.Require.NoError(err, "Failed to load split depth") @@ -294,7 +294,7 @@ func (h *FactoryHelper) StartOutputAlphabetGame(ctx context.Context, l2Node stri game, err := contracts.NewFaultDisputeGameContract(ctx, metrics.NoopContractMetrics, createdEvent.DisputeProxy, batching.NewMultiCaller(h.Client.Client(), batching.DefaultBatchSize)) h.Require.NoError(err) - prestateBlock, poststateBlock, err := game.GetBlockRange(ctx) + prestateBlock, poststateBlock, err := game.GetGameRange(ctx) h.Require.NoError(err, "Failed to load starting block number") splitDepth, err := game.GetSplitDepth(ctx) h.Require.NoError(err, "Failed to load split depth") diff --git a/op-e2e/e2eutils/disputegame/output_alphabet_helper.go b/op-e2e/e2eutils/disputegame/output_alphabet_helper.go index b9acf24f2fa99..a6ad0cabe33cb 100644 --- a/op-e2e/e2eutils/disputegame/output_alphabet_helper.go +++ b/op-e2e/e2eutils/disputegame/output_alphabet_helper.go @@ -35,7 +35,7 @@ func (g *OutputAlphabetGameHelper) StartChallenger( func (g *OutputAlphabetGameHelper) CreateHonestActor(ctx context.Context, l2Node string) *OutputHonestHelper { logger := testlog.Logger(g.T, log.LevelInfo).New("role", "HonestHelper", "game", g.Addr) - prestateBlock, poststateBlock, err := g.Game.GetBlockRange(ctx) + prestateBlock, poststateBlock, err := g.Game.GetGameRange(ctx) g.Require.NoError(err, "Get block range") splitDepth := g.SplitDepth(ctx) l1Head := g.GetL1Head(ctx) diff --git a/op-e2e/e2eutils/disputegame/output_cannon_helper.go b/op-e2e/e2eutils/disputegame/output_cannon_helper.go index 533e4f779f4cc..a8686c95cb7c8 100644 --- a/op-e2e/e2eutils/disputegame/output_cannon_helper.go +++ b/op-e2e/e2eutils/disputegame/output_cannon_helper.go @@ -64,7 +64,7 @@ func (g *OutputCannonGameHelper) CreateHonestActor(ctx context.Context, l2Node s logger := testlog.Logger(g.T, log.LevelInfo).New("role", "HonestHelper", "game", g.Addr) l2Client := g.System.NodeClient(l2Node) - realPrestateBlock, realPostStateBlock, err := g.Game.GetBlockRange(ctx) + realPrestateBlock, realPostStateBlock, err := g.Game.GetGameRange(ctx) g.Require.NoError(err, "Failed to load block range") splitDepth := g.SplitDepth(ctx) rollupClient := g.System.RollupClient(l2Node) diff --git a/op-e2e/e2eutils/disputegame/output_game_helper.go b/op-e2e/e2eutils/disputegame/output_game_helper.go index a969c593094a1..055459def9f99 100644 --- a/op-e2e/e2eutils/disputegame/output_game_helper.go +++ b/op-e2e/e2eutils/disputegame/output_game_helper.go @@ -54,7 +54,7 @@ func NewOutputGameHelper(t *testing.T, require *require.Assertions, client *ethc } func (g *OutputGameHelper) StartingBlockNum(ctx context.Context) uint64 { - blockNum, _, err := g.Game.GetBlockRange(ctx) + blockNum, _, err := g.Game.GetGameRange(ctx) g.Require.NoError(err, "failed to load starting block number") return blockNum } diff --git a/op-e2e/e2eutils/disputegame/split_game_helper.go b/op-e2e/e2eutils/disputegame/split_game_helper.go index bb9dbc15608dd..05fcec2a7b62c 100644 --- a/op-e2e/e2eutils/disputegame/split_game_helper.go +++ b/op-e2e/e2eutils/disputegame/split_game_helper.go @@ -68,7 +68,7 @@ func WithIgnoreDuplicates() MoveOpt { } func (g *SplitGameHelper) L2BlockNum(ctx context.Context) uint64 { - _, blockNum, err := g.Game.GetBlockRange(ctx) + _, blockNum, err := g.Game.GetGameRange(ctx) g.Require.NoError(err, "failed to load l2 block number") return blockNum } diff --git a/op-e2e/faultproofs/cannon_benchmark_test.go b/op-e2e/faultproofs/cannon_benchmark_test.go index 9c05b9e9e1bd2..57b5f1d83e70e 100644 --- a/op-e2e/faultproofs/cannon_benchmark_test.go +++ b/op-e2e/faultproofs/cannon_benchmark_test.go @@ -94,11 +94,11 @@ func testBenchmarkCannonFPP(t *testing.T, allocType config.AllocType) { l1Head := l1HeadBlock.Hash() inputs := utils.LocalGameInputs{ - L1Head: l1Head, - L2Head: l2Head, - L2Claim: common.Hash(l2Claim), - L2OutputRoot: common.Hash(l2OutputRoot), - L2BlockNumber: l2ClaimBlockNumber, + L1Head: l1Head, + L2Head: l2Head, + L2Claim: common.Hash(l2Claim), + L2OutputRoot: common.Hash(l2OutputRoot), + L2SequenceNumber: l2ClaimBlockNumber, } debugfile := path.Join(t.TempDir(), "debug.json") runCannon(t, ctx, sys, inputs, "--debug-info", debugfile) diff --git a/op-e2e/faultproofs/precompile_test.go b/op-e2e/faultproofs/precompile_test.go index e4f3f24b48815..5210776fe894d 100644 --- a/op-e2e/faultproofs/precompile_test.go +++ b/op-e2e/faultproofs/precompile_test.go @@ -92,11 +92,11 @@ func testPrecompiles(t *testing.T, allocType e2e_config.AllocType) { l1Head := l1HeadBlock.Hash() inputs := utils.LocalGameInputs{ - L1Head: l1Head, - L2Head: l2Head, - L2Claim: common.Hash(l2Claim), - L2OutputRoot: common.Hash(l2OutputRoot), - L2BlockNumber: l2ClaimBlockNumber, + L1Head: l1Head, + L2Head: l2Head, + L2Claim: common.Hash(l2Claim), + L2OutputRoot: common.Hash(l2OutputRoot), + L2SequenceNumber: l2ClaimBlockNumber, } runCannon(t, ctx, sys, inputs) }) @@ -209,11 +209,11 @@ func testGranitePrecompiles(t *testing.T, allocType e2e_config.AllocType) { l1Head := l1HeadBlock.Hash() inputs := utils.LocalGameInputs{ - L1Head: l1Head, - L2Head: l2Head, - L2Claim: common.Hash(l2Claim), - L2OutputRoot: common.Hash(l2OutputRoot), - L2BlockNumber: l2ClaimBlockNumber, + L1Head: l1Head, + L2Head: l2Head, + L2Claim: common.Hash(l2Claim), + L2OutputRoot: common.Hash(l2OutputRoot), + L2SequenceNumber: l2ClaimBlockNumber, } runCannon(t, ctx, sys, inputs) } diff --git a/op-e2e/system/proofs/proposer_fp_test.go b/op-e2e/system/proofs/proposer_fp_test.go index 971ed06a46303..a4cccf138fffb 100644 --- a/op-e2e/system/proofs/proposer_fp_test.go +++ b/op-e2e/system/proofs/proposer_fp_test.go @@ -61,7 +61,7 @@ func TestL2OutputSubmitterFaultProofs(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() - _, gameBlockNumber, err := proxy.GetBlockRange(ctx) + _, gameBlockNumber, err := proxy.GetGameRange(ctx) require.Nil(t, err) l2Output, err := rollupClient.OutputAtBlock(ctx, gameBlockNumber) require.Nil(t, err) diff --git a/op-program/host/flags/flags.go b/op-program/host/flags/flags.go index 9adf43cf20e74..baeb3d2f84f5a 100644 --- a/op-program/host/flags/flags.go +++ b/op-program/host/flags/flags.go @@ -67,7 +67,7 @@ var ( } L2Head = &cli.StringFlag{ Name: "l2.head", - Usage: "Hash of the L2 block at l2.outputroot", + Usage: "Hash of the L2 block at l2.outputroot. Used for non-interop games.", EnvVars: prefixEnvVars("L2_HEAD"), } L2OutputRoot = &cli.StringFlag{ @@ -83,13 +83,14 @@ var ( } L2Claim = &cli.StringFlag{ Name: "l2.claim", - Usage: "Claimed L2 output root to validate", + Usage: "Claimed proposal root to validate", EnvVars: prefixEnvVars("L2_CLAIM"), } L2BlockNumber = &cli.Uint64Flag{ Name: "l2.blocknumber", - Usage: "Number of the L2 block that the claim is from", - EnvVars: prefixEnvVars("L2_BLOCK_NUM"), + Aliases: []string{"l2.sequencenumber"}, + Usage: "L2 block number or timestamp that the claim is from", + EnvVars: append(prefixEnvVars("L2_BLOCK_NUM"), prefixEnvVars("L2_SEQUENCE_NUMBER")...), } L2GenesisPath = &cli.StringSliceFlag{ Name: "l2.genesis", diff --git a/packages/contracts-bedrock/snapshots/abi_loader.go b/packages/contracts-bedrock/snapshots/abi_loader.go index 34d6375436b7e..4845485121871 100644 --- a/packages/contracts-bedrock/snapshots/abi_loader.go +++ b/packages/contracts-bedrock/snapshots/abi_loader.go @@ -10,6 +10,9 @@ import ( //go:embed abi/DisputeGameFactory.json var disputeGameFactory []byte +//go:embed abi/SuperFaultDisputeGame.json +var superFaultDisputeGame []byte + //go:embed abi/FaultDisputeGame.json var faultDisputeGame []byte @@ -31,6 +34,9 @@ var crossL2Inbox []byte func LoadDisputeGameFactoryABI() *abi.ABI { return loadABI(disputeGameFactory) } +func LoadSuperFaultDisputeGameABI() *abi.ABI { + return loadABI(superFaultDisputeGame) +} func LoadFaultDisputeGameABI() *abi.ABI { return loadABI(faultDisputeGame) }