Commit 2586a82f authored by Adrian Sutton's avatar Adrian Sutton Committed by GitHub

op-e2e: Convert most FaultDisputeGame read operations to use custom contract bindings (#10533)

* op-e2e: Delete unused helpers from pre-output root support

* op-e2e: Convert most FaultDisputeGame read operations to use custom contract bindings

* op-e2e: Remove manual creation of contract bindings
parent 9300db95
......@@ -16,19 +16,19 @@ type ClaimHelper struct {
require *require.Assertions
game *OutputGameHelper
Index int64
ParentIndex uint32
ParentIndex int
Position types.Position
claim common.Hash
}
func newClaimHelper(game *OutputGameHelper, idx int64, claim ContractClaim) *ClaimHelper {
func newClaimHelper(game *OutputGameHelper, idx int64, claim types.Claim) *ClaimHelper {
return &ClaimHelper{
require: game.Require,
game: game,
Index: idx,
ParentIndex: claim.ParentIndex,
Position: types.NewPositionFromGIndex(claim.Position),
claim: claim.Claim,
ParentIndex: claim.ParentContractIndex,
Position: claim.Position,
claim: claim.Value,
}
}
......@@ -72,8 +72,8 @@ func (c *ClaimHelper) WaitForCounterClaim(ctx context.Context, ignoreClaims ...*
// This is the first claim we need to run cannon on, so give it more time
timeout = timeout * 2
}
counterIdx, counterClaim := c.game.waitForClaim(ctx, timeout, fmt.Sprintf("failed to find claim with parent idx %v", c.Index), func(claimIdx int64, claim ContractClaim) bool {
return int64(claim.ParentIndex) == c.Index && !containsClaim(claimIdx, ignoreClaims)
counterIdx, counterClaim := c.game.waitForClaim(ctx, timeout, fmt.Sprintf("failed to find claim with parent idx %v", c.Index), func(claimIdx int64, claim types.Claim) bool {
return int64(claim.ParentContractIndex) == c.Index && !containsClaim(claimIdx, ignoreClaims)
})
return newClaimHelper(c.game, counterIdx, counterClaim)
}
......@@ -115,7 +115,7 @@ func (c *ClaimHelper) RequireDifferentClaimValue(other *ClaimHelper) {
func (c *ClaimHelper) RequireOnlyCounteredBy(ctx context.Context, expected ...*ClaimHelper) {
claims := c.game.getAllClaims(ctx)
for idx, claim := range claims {
if int64(claim.ParentIndex) != c.Index {
if int64(claim.ParentContractIndex) != c.Index {
// Doesn't counter this claim, so ignore
continue
}
......
......@@ -25,7 +25,7 @@ func (d *DishonestHelper) ExhaustDishonestClaims(ctx context.Context, rootClaim
depth := d.MaxDepth(ctx)
splitDepth := d.SplitDepth(ctx)
move := func(claimIndex int64, claimData ContractClaim) {
move := func(claimIndex int64, claimData types.Claim) {
// dishonest level, valid attack
// dishonest level, invalid attack
// dishonest level, valid defense
......@@ -33,22 +33,21 @@ func (d *DishonestHelper) ExhaustDishonestClaims(ctx context.Context, rootClaim
// honest level, invalid attack
// honest level, invalid defense
pos := types.NewPositionFromGIndex(claimData.Position)
if pos.Depth() == depth {
if claimData.Depth() == depth {
return
}
d.LogGameData(ctx)
d.OutputGameHelper.T.Logf("Dishonest moves against claimIndex %d", claimIndex)
agreeWithLevel := d.defender == (pos.Depth()%2 == 0)
agreeWithLevel := d.defender == (claimData.Depth()%2 == 0)
if !agreeWithLevel {
d.OutputHonestHelper.Attack(ctx, claimIndex, WithIgnoreDuplicates())
if claimIndex != 0 && pos.Depth() != splitDepth+1 {
if claimIndex != 0 && claimData.Depth() != splitDepth+1 {
d.OutputHonestHelper.Defend(ctx, claimIndex, WithIgnoreDuplicates())
}
}
d.OutputGameHelper.Attack(ctx, claimIndex, common.Hash{byte(claimIndex)}, WithIgnoreDuplicates())
if claimIndex != 0 && pos.Depth() != splitDepth+1 {
if claimIndex != 0 && claimData.Depth() != splitDepth+1 {
d.OutputGameHelper.Defend(ctx, claimIndex, common.Hash{byte(claimIndex)}, WithIgnoreDuplicates())
}
}
......
......@@ -3,14 +3,14 @@ package disputegame
import (
"context"
"encoding/binary"
"fmt"
"math/big"
"testing"
"time"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/contracts"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/contracts/metrics"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/trace/outputs"
faultTypes "github.com/ethereum-optimism/optimism/op-challenger/game/fault/types"
"github.com/ethereum-optimism/optimism/op-e2e/bindings"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/challenger"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/disputegame/preimage"
......@@ -20,6 +20,7 @@ import (
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-service/eth"
"github.com/ethereum-optimism/optimism/op-service/sources"
"github.com/ethereum-optimism/optimism/op-service/sources/batching"
"github.com/ethereum-optimism/optimism/op-service/testlog"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
......@@ -40,30 +41,8 @@ var (
const (
cannonGameType uint32 = 0
alphabetGameType uint32 = 255
alphabetGameDepth = 4
)
type Status uint8
const (
StatusInProgress Status = iota
StatusChallengerWins
StatusDefenderWins
)
func (s Status) String() string {
switch s {
case StatusInProgress:
return "In Progress"
case StatusChallengerWins:
return "Challenger Wins"
case StatusDefenderWins:
return "Defender Wins"
default:
return fmt.Sprintf("Unknown status: %v", int(s))
}
}
type GameCfg struct {
allowFuture bool
allowUnsafe bool
......@@ -188,28 +167,27 @@ func (h *FactoryHelper) StartOutputCannonGame(ctx context.Context, l2Node string
h.Require.Len(rcpt.Logs, 2, "should have emitted a single DisputeGameCreated event")
createdEvent, err := h.Factory.ParseDisputeGameCreated(*rcpt.Logs[1])
h.Require.NoError(err)
game, err := bindings.NewFaultDisputeGame(createdEvent.DisputeProxy, h.Client)
gameBindings, err := bindings.NewFaultDisputeGame(createdEvent.DisputeProxy, h.Client)
h.Require.NoError(err)
game, err := contracts.NewFaultDisputeGameContract(ctx, metrics.NoopContractMetrics, createdEvent.DisputeProxy, batching.NewMultiCaller(h.Client.Client(), batching.DefaultBatchSize))
h.Require.NoError(err)
callOpts := &bind.CallOpts{Context: ctx}
prestateBlock, err := game.StartingBlockNumber(callOpts)
prestateBlock, poststateBlock, err := game.GetBlockRange(ctx)
h.Require.NoError(err, "Failed to load starting block number")
poststateBlock, err := game.L2BlockNumber(callOpts)
h.Require.NoError(err, "Failed to load l2 block number")
splitDepth, err := game.SplitDepth(callOpts)
splitDepth, err := game.GetSplitDepth(ctx)
h.Require.NoError(err, "Failed to load split depth")
l1Head := h.GetL1Head(ctx, game)
prestateProvider := outputs.NewPrestateProvider(rollupClient, prestateBlock.Uint64())
provider := outputs.NewTraceProvider(logger, prestateProvider, rollupClient, l2Client, l1Head, faultTypes.Depth(splitDepth.Uint64()), prestateBlock.Uint64(), poststateBlock.Uint64())
prestateProvider := outputs.NewPrestateProvider(rollupClient, prestateBlock)
provider := outputs.NewTraceProvider(logger, prestateProvider, rollupClient, l2Client, l1Head, splitDepth, prestateBlock, poststateBlock)
return &OutputCannonGameHelper{
OutputGameHelper: *NewOutputGameHelper(h.T, h.Require, h.Client, h.Opts, game, h.FactoryAddr, createdEvent.DisputeProxy, provider, h.System),
OutputGameHelper: *NewOutputGameHelper(h.T, h.Require, h.Client, h.Opts, game, gameBindings, h.FactoryAddr, createdEvent.DisputeProxy, provider, h.System),
}
}
func (h *FactoryHelper) GetL1Head(ctx context.Context, game *bindings.FaultDisputeGame) eth.BlockID {
l1HeadHash, err := game.L1Head(&bind.CallOpts{Context: ctx})
func (h *FactoryHelper) GetL1Head(ctx context.Context, game contracts.FaultDisputeGameContract) eth.BlockID {
l1HeadHash, err := game.GetL1Head(ctx)
h.Require.NoError(err, "Failed to load L1 head")
l1Header, err := h.Client.HeaderByHash(ctx, l1HeadHash)
h.Require.NoError(err, "Failed to load L1 header")
......@@ -245,23 +223,22 @@ func (h *FactoryHelper) StartOutputAlphabetGame(ctx context.Context, l2Node stri
h.Require.Len(rcpt.Logs, 2, "should have emitted a single DisputeGameCreated event")
createdEvent, err := h.Factory.ParseDisputeGameCreated(*rcpt.Logs[1])
h.Require.NoError(err)
game, err := bindings.NewFaultDisputeGame(createdEvent.DisputeProxy, h.Client)
gameBindings, err := bindings.NewFaultDisputeGame(createdEvent.DisputeProxy, h.Client)
h.Require.NoError(err)
game, err := contracts.NewFaultDisputeGameContract(ctx, metrics.NoopContractMetrics, createdEvent.DisputeProxy, batching.NewMultiCaller(h.Client.Client(), batching.DefaultBatchSize))
h.Require.NoError(err)
callOpts := &bind.CallOpts{Context: ctx}
prestateBlock, err := game.StartingBlockNumber(callOpts)
prestateBlock, poststateBlock, err := game.GetBlockRange(ctx)
h.Require.NoError(err, "Failed to load starting block number")
poststateBlock, err := game.L2BlockNumber(callOpts)
h.Require.NoError(err, "Failed to load l2 block number")
splitDepth, err := game.SplitDepth(callOpts)
splitDepth, err := game.GetSplitDepth(ctx)
h.Require.NoError(err, "Failed to load split depth")
l1Head := h.GetL1Head(ctx, game)
prestateProvider := outputs.NewPrestateProvider(rollupClient, prestateBlock.Uint64())
prestateProvider := outputs.NewPrestateProvider(rollupClient, prestateBlock)
provider := outputs.NewTraceProvider(logger, prestateProvider, rollupClient, l2Client, l1Head, faultTypes.Depth(splitDepth.Uint64()), prestateBlock.Uint64(), poststateBlock.Uint64())
provider := outputs.NewTraceProvider(logger, prestateProvider, rollupClient, l2Client, l1Head, splitDepth, prestateBlock, poststateBlock)
return &OutputAlphabetGameHelper{
OutputGameHelper: *NewOutputGameHelper(h.T, h.Require, h.Client, h.Opts, game, h.FactoryAddr, createdEvent.DisputeProxy, provider, h.System),
OutputGameHelper: *NewOutputGameHelper(h.T, h.Require, h.Client, h.Opts, game, gameBindings, h.FactoryAddr, createdEvent.DisputeProxy, provider, h.System),
}
}
......
......@@ -3,12 +3,9 @@ package disputegame
import (
"context"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/contracts"
contractMetrics "github.com/ethereum-optimism/optimism/op-challenger/game/fault/contracts/metrics"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/trace/outputs"
"github.com/ethereum-optimism/optimism/op-challenger/metrics"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/challenger"
"github.com/ethereum-optimism/optimism/op-service/sources/batching"
"github.com/ethereum-optimism/optimism/op-service/testlog"
"github.com/ethereum/go-ethereum/log"
)
......@@ -38,10 +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)
caller := batching.NewMultiCaller(g.System.NodeClient("l1").Client(), batching.DefaultBatchSize)
contract, err := contracts.NewFaultDisputeGameContract(ctx, contractMetrics.NoopContractMetrics, g.Addr, caller)
g.Require.NoError(err)
prestateBlock, poststateBlock, err := contract.GetBlockRange(ctx)
prestateBlock, poststateBlock, err := g.Game.GetBlockRange(ctx)
g.Require.NoError(err, "Get block range")
splitDepth := g.SplitDepth(ctx)
l1Head := g.GetL1Head(ctx)
......@@ -50,7 +44,7 @@ func (g *OutputAlphabetGameHelper) CreateHonestActor(ctx context.Context, l2Node
prestateProvider := outputs.NewPrestateProvider(rollupClient, prestateBlock)
correctTrace, err := outputs.NewOutputAlphabetTraceAccessor(logger, metrics.NoopMetrics, prestateProvider, rollupClient, l2Client, l1Head, splitDepth, prestateBlock, poststateBlock)
g.Require.NoError(err, "Create trace accessor")
return NewOutputHonestHelper(g.T, g.Require, &g.OutputGameHelper, contract, correctTrace)
return NewOutputHonestHelper(g.T, g.Require, &g.OutputGameHelper, g.Game, correctTrace)
}
func (g *OutputAlphabetGameHelper) CreateDishonestHelper(ctx context.Context, l2Node string, defender bool) *DishonestHelper {
......
......@@ -9,8 +9,6 @@ import (
"path/filepath"
"time"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/contracts"
contractMetrics "github.com/ethereum-optimism/optimism/op-challenger/game/fault/contracts/metrics"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/trace"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/trace/cannon"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/trace/outputs"
......@@ -55,11 +53,8 @@ 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)
caller := batching.NewMultiCaller(g.System.NodeClient("l1").Client(), batching.DefaultBatchSize)
contract, err := contracts.NewFaultDisputeGameContract(ctx, contractMetrics.NoopContractMetrics, g.Addr, caller)
g.Require.NoError(err)
prestateBlock, poststateBlock, err := contract.GetBlockRange(ctx)
prestateBlock, poststateBlock, err := g.Game.GetBlockRange(ctx)
g.Require.NoError(err, "Failed to load block range")
dir := filepath.Join(cfg.Datadir, "honest")
splitDepth := g.SplitDepth(ctx)
......@@ -69,7 +64,7 @@ func (g *OutputCannonGameHelper) CreateHonestActor(ctx context.Context, l2Node s
accessor, err := outputs.NewOutputCannonTraceAccessor(
logger, metrics.NoopMetrics, cfg, l2Client, prestateProvider, rollupClient, dir, l1Head, splitDepth, prestateBlock, poststateBlock)
g.Require.NoError(err, "Failed to create output cannon trace accessor")
return NewOutputHonestHelper(g.T, g.Require, &g.OutputGameHelper, contract, accessor)
return NewOutputHonestHelper(g.T, g.Require, &g.OutputGameHelper, g.Game, accessor)
}
type PreimageLoadCheck func(types.TraceProvider, uint64) error
......@@ -238,7 +233,7 @@ func (g *OutputCannonGameHelper) VerifyPreimage(ctx context.Context, outputRootC
g.Require.NotNil(oracleData, "Should have had required preimage oracle data")
g.Require.Equal(common.Hash(preimageKey.PreimageKey()).Bytes(), oracleData.OracleKey, "Must have correct preimage key")
tx, err := g.Game.AddLocalData(g.Opts,
tx, err := g.GameBindings.AddLocalData(g.Opts,
oracleData.GetIdent(),
big.NewInt(outputRootClaim.Index),
new(big.Int).SetUint64(uint64(oracleData.OracleOffset)))
......@@ -250,7 +245,7 @@ func (g *OutputCannonGameHelper) VerifyPreimage(ctx context.Context, outputRootC
g.Require.NoError(err, "Failed to get expected post state")
callOpts := &bind.CallOpts{Context: ctx}
vmAddr, err := g.Game.Vm(callOpts)
vmAddr, err := g.GameBindings.Vm(callOpts)
g.Require.NoError(err, "Failed to get VM address")
abi, err := bindings.MIPSMetaData.GetAbi()
......@@ -280,12 +275,9 @@ func (g *OutputCannonGameHelper) createCannonTraceProvider(ctx context.Context,
opt = append(opt, options...)
cfg := challenger.NewChallengerConfig(g.T, g.System, l2Node, opt...)
caller := batching.NewMultiCaller(g.System.NodeClient("l1").Client(), batching.DefaultBatchSize)
l2Client := g.System.NodeClient(l2Node)
contract, err := contracts.NewFaultDisputeGameContract(ctx, contractMetrics.NoopContractMetrics, g.Addr, caller)
g.Require.NoError(err)
prestateBlock, poststateBlock, err := contract.GetBlockRange(ctx)
prestateBlock, poststateBlock, err := g.Game.GetBlockRange(ctx)
g.Require.NoError(err, "Failed to load block range")
rollupClient := g.System.RollupClient(l2Node)
prestateProvider := outputs.NewPrestateProvider(rollupClient, prestateBlock)
......@@ -305,7 +297,7 @@ func (g *OutputCannonGameHelper) createCannonTraceProvider(ctx context.Context,
return cannon.NewTraceProviderForTest(logger, metrics.NoopMetrics, cfg, localInputs, subdir, g.MaxDepth(ctx)-splitDepth-1), nil
})
claims, err := contract.GetAllClaims(ctx, rpcblock.Latest)
claims, err := g.Game.GetAllClaims(ctx, rpcblock.Latest)
g.Require.NoError(err)
game := types.NewGameState(claims, g.MaxDepth(ctx))
......
......@@ -6,6 +6,7 @@ import (
"testing"
"time"
"github.com/ethereum-optimism/optimism/op-challenger/game/types"
op_e2e "github.com/ethereum-optimism/optimism/op-e2e"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/challenger"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/disputegame"
......@@ -68,7 +69,7 @@ func TestOutputAlphabetGame_ChallengerWins(t *testing.T) {
sys.TimeTravelClock.AdvanceTime(game.MaxClockDuration(ctx))
require.NoError(t, wait.ForNextBlock(ctx, l1Client))
game.WaitForGameStatus(ctx, disputegame.StatusChallengerWins)
game.WaitForGameStatus(ctx, types.GameStatusChallengerWon)
game.LogGameData(ctx)
}
......@@ -110,7 +111,7 @@ func TestOutputAlphabetGame_ReclaimBond(t *testing.T) {
sys.TimeTravelClock.AdvanceTime(game.MaxClockDuration(ctx))
require.NoError(t, wait.ForNextBlock(ctx, l1Client))
game.WaitForGameStatus(ctx, disputegame.StatusChallengerWins)
game.WaitForGameStatus(ctx, types.GameStatusChallengerWon)
game.LogGameData(ctx)
// Expect Alice's credit to be non-zero
......@@ -161,7 +162,7 @@ func TestOutputAlphabetGame_ValidOutputRoot(t *testing.T) {
sys.TimeTravelClock.AdvanceTime(game.MaxClockDuration(ctx))
require.NoError(t, wait.ForNextBlock(ctx, l1Client))
game.WaitForGameStatus(ctx, disputegame.StatusDefenderWins)
game.WaitForGameStatus(ctx, types.GameStatusDefenderWon)
}
func TestChallengerCompleteExhaustiveDisputeGame(t *testing.T) {
......@@ -213,9 +214,9 @@ func TestChallengerCompleteExhaustiveDisputeGame(t *testing.T) {
sys.TimeTravelClock.AdvanceTime(gameDuration)
require.NoError(t, wait.ForNextBlock(ctx, l1Client))
expectedStatus := disputegame.StatusChallengerWins
expectedStatus := types.GameStatusChallengerWon
if isRootCorrect {
expectedStatus = disputegame.StatusDefenderWins
expectedStatus = types.GameStatusDefenderWon
}
game.WaitForGameStatus(ctx, expectedStatus)
game.LogGameData(ctx)
......@@ -288,10 +289,11 @@ func TestOutputAlphabetGame_FreeloaderEarnsNothing(t *testing.T) {
game.LogGameData(ctx)
sys.TimeTravelClock.AdvanceTime(game.MaxClockDuration(ctx))
require.NoError(t, wait.ForNextBlock(ctx, l1Client))
game.WaitForGameStatus(ctx, disputegame.StatusDefenderWins)
game.WaitForGameStatus(ctx, types.GameStatusDefenderWon)
game.LogGameData(ctx)
amt := game.Credit(ctx, freeloaderOpts.From)
require.True(t, amt.BitLen() == 0, "freeloaders should not be rewarded")
require.Truef(t, amt.BitLen() == 0, "freeloaders should not be rewarded. Credit: %v", amt)
}
func TestHighestActedL1BlockMetric(t *testing.T) {
......@@ -307,7 +309,7 @@ func TestHighestActedL1BlockMetric(t *testing.T) {
sys.AdvanceTime(game1.MaxClockDuration(ctx))
require.NoError(t, wait.ForNextBlock(ctx, l1Client))
game1.WaitForGameStatus(ctx, disputegame.StatusDefenderWins)
game1.WaitForGameStatus(ctx, types.GameStatusDefenderWon)
disputeGameFactory.StartOutputAlphabetGame(ctx, "sequencer", 2, common.Hash{0xaa})
disputeGameFactory.StartOutputAlphabetGame(ctx, "sequencer", 3, common.Hash{0xaa})
......
......@@ -8,6 +8,7 @@ import (
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/trace/utils"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/types"
gameTypes "github.com/ethereum-optimism/optimism/op-challenger/game/types"
op_e2e "github.com/ethereum-optimism/optimism/op-e2e"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/challenger"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/disputegame"
......@@ -70,7 +71,7 @@ func TestOutputCannonGame(t *testing.T) {
sys.TimeTravelClock.AdvanceTime(game.MaxClockDuration(ctx))
require.NoError(t, wait.ForNextBlock(ctx, l1Client))
game.WaitForGameStatus(ctx, disputegame.StatusChallengerWins)
game.WaitForGameStatus(ctx, gameTypes.GameStatusChallengerWon)
}
func TestOutputCannon_ChallengeAllZeroClaim(t *testing.T) {
......@@ -98,7 +99,7 @@ func TestOutputCannon_ChallengeAllZeroClaim(t *testing.T) {
sys.TimeTravelClock.AdvanceTime(game.MaxClockDuration(ctx))
require.NoError(t, wait.ForNextBlock(ctx, l1Client))
game.WaitForGameStatus(ctx, disputegame.StatusChallengerWins)
game.WaitForGameStatus(ctx, gameTypes.GameStatusChallengerWon)
game.LogGameData(ctx)
}
......@@ -175,7 +176,7 @@ func TestOutputCannonDisputeGame(t *testing.T) {
require.NoError(t, wait.ForNextBlock(ctx, l1Client))
game.LogGameData(ctx)
game.WaitForGameStatus(ctx, disputegame.StatusChallengerWins)
game.WaitForGameStatus(ctx, gameTypes.GameStatusChallengerWon)
})
}
}
......@@ -213,7 +214,7 @@ func TestOutputCannonDefendStep(t *testing.T) {
game.WaitForInactivity(ctx, 10, true)
game.LogGameData(ctx)
require.EqualValues(t, disputegame.StatusChallengerWins, game.Status(ctx))
require.EqualValues(t, gameTypes.GameStatusChallengerWon, game.Status(ctx))
}
func TestOutputCannonStepWithLargePreimage(t *testing.T) {
......@@ -431,7 +432,7 @@ func TestOutputCannonProposedOutputRootValid(t *testing.T) {
game.WaitForInactivity(ctx, 10, true)
game.LogGameData(ctx)
require.EqualValues(t, disputegame.StatusDefenderWins, game.Status(ctx))
require.EqualValues(t, gameTypes.GameStatusDefenderWon, game.Status(ctx))
})
}
}
......@@ -497,7 +498,7 @@ func TestOutputCannonPoisonedPostState(t *testing.T) {
require.NoError(t, wait.ForNextBlock(ctx, l1Client))
game.LogGameData(ctx)
game.WaitForGameStatus(ctx, disputegame.StatusChallengerWins)
game.WaitForGameStatus(ctx, gameTypes.GameStatusChallengerWon)
}
func TestDisputeOutputRootBeyondProposedBlock_ValidOutputRoot(t *testing.T) {
......@@ -546,7 +547,7 @@ func TestDisputeOutputRootBeyondProposedBlock_ValidOutputRoot(t *testing.T) {
sys.TimeTravelClock.AdvanceTime(game.MaxClockDuration(ctx))
require.NoError(t, wait.ForNextBlock(ctx, l1Client))
game.WaitForGameStatus(ctx, disputegame.StatusDefenderWins)
game.WaitForGameStatus(ctx, gameTypes.GameStatusDefenderWon)
game.LogGameData(ctx)
}
......@@ -597,7 +598,7 @@ func TestDisputeOutputRootBeyondProposedBlock_InvalidOutputRoot(t *testing.T) {
sys.TimeTravelClock.AdvanceTime(game.MaxClockDuration(ctx))
require.NoError(t, wait.ForNextBlock(ctx, l1Client))
game.WaitForGameStatus(ctx, disputegame.StatusChallengerWins)
game.WaitForGameStatus(ctx, gameTypes.GameStatusChallengerWon)
game.LogGameData(ctx)
}
......@@ -657,7 +658,7 @@ func TestDisputeOutputRoot_ChangeClaimedOutputRoot(t *testing.T) {
sys.TimeTravelClock.AdvanceTime(game.MaxClockDuration(ctx))
require.NoError(t, wait.ForNextBlock(ctx, l1Client))
game.WaitForGameStatus(ctx, disputegame.StatusChallengerWins)
game.WaitForGameStatus(ctx, gameTypes.GameStatusChallengerWon)
game.LogGameData(ctx)
}
......@@ -717,7 +718,7 @@ func TestInvalidateUnsafeProposal(t *testing.T) {
sys.TimeTravelClock.AdvanceTime(game.MaxClockDuration(ctx))
require.NoError(t, wait.ForNextBlock(ctx, l1Client))
game.WaitForGameStatus(ctx, disputegame.StatusChallengerWins)
game.WaitForGameStatus(ctx, gameTypes.GameStatusChallengerWon)
game.LogGameData(ctx)
})
}
......@@ -779,7 +780,7 @@ func TestInvalidateProposalForFutureBlock(t *testing.T) {
sys.TimeTravelClock.AdvanceTime(game.MaxClockDuration(ctx))
require.NoError(t, wait.ForNextBlock(ctx, l1Client))
game.WaitForGameStatus(ctx, disputegame.StatusChallengerWins)
game.WaitForGameStatus(ctx, gameTypes.GameStatusChallengerWon)
game.LogGameData(ctx)
})
}
......@@ -813,6 +814,6 @@ func TestInvalidateCorrectProposalFutureBlock(t *testing.T) {
// The game should resolve as `CHALLENGER_WINS` always, because the root claim signifies a claim that does not exist
// yet in the L2 chain.
game.WaitForGameStatus(ctx, disputegame.StatusChallengerWins)
game.WaitForGameStatus(ctx, gameTypes.GameStatusChallengerWon)
game.LogGameData(ctx)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment