disputegame

package
v1.16.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 57 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// TestKey is the same test key that geth uses
	TestKey, _  = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
	TestAddress = crypto.PubkeyToAddress(TestKey.PublicKey)
)

Functions

func CreateInvalidSuper

func CreateInvalidSuper(timestamp uint64) *eth.SuperV1

CreateInvalidSuper creates a SuperV1 with invalid outputs

Types

type CannonHelper

type CannonHelper struct {
	// contains filtered or unexported fields
}

func NewCannonHelper

func NewCannonHelper(splitGameHelper *SplitGameHelper, defaultChallengerOptions func() []challenger.Option) *CannonHelper

func (*CannonHelper) ChallengePeriod

func (g *CannonHelper) ChallengePeriod(ctx context.Context) uint64

ChallengePeriod returns the challenge period fetched from the PreimageOracle contract. The returned uint64 value is the number of seconds for the challenge period.

func (*CannonHelper) ChallengePeriodStartTime

func (g *CannonHelper) ChallengePeriodStartTime(ctx context.Context, sender common.Address, data *types.PreimageOracleData) uint64

ChallengePeriodStartTime returns the start time of the challenge period for a given large preimage claim. If the returned start time is 0, the challenge period has not started.

func (*CannonHelper) ChallengeToPreimageLoad

func (g *CannonHelper) ChallengeToPreimageLoad(ctx context.Context, cannonTraceProviderFunc CannonTraceProviderFunc, preimage utils.PreimageOpt, preimageCheck PreimageLoadCheck, preloadPreimage bool)

ChallengeToPreimageLoad challenges the supplied execution root claim by inducing a step that requires a preimage to be loaded It does this by: 1. Identifying the first state transition that loads a global preimage 2. Descending the execution game tree to reach the step that loads the preimage 3. Asserting that the preimage was indeed loaded by an honest challenger (assuming the preimage is not preloaded) This expects an odd execution game depth in order for the honest challenger to step on our leaf claim

func (*CannonHelper) ChallengeToPreimageLoadAtTarget

func (g *CannonHelper) ChallengeToPreimageLoadAtTarget(ctx context.Context, cannonTraceProviderFunc CannonTraceProviderFunc, targetTraceIndex uint64, preimageCheck PreimageLoadCheck, preloadPreimage bool)

ChallengeToPreimageLoadAtTarget challenges the supplied execution root claim by inducing a step that requires a preimage to be loaded It does this by: 1. Descending the execution game tree to reach the target step that loads the preimage 2. Asserting that the preimage was indeed loaded by an honest challenger (assuming the preimage is not preloaded) This expects an odd execution game depth in order for the honest challenger to step on our leaf claim

func (*CannonHelper) CheckPreimageInOracle

func (g *CannonHelper) CheckPreimageInOracle(ctx context.Context, data *types.PreimageOracleData, expectedData [32]byte)

CheckPreimageInOracle verifies that expectedData is stored on-chain in the PreimageOracle

func (*CannonHelper) CreateStepLargePreimageLoadCheck

func (g *CannonHelper) CreateStepLargePreimageLoadCheck(ctx context.Context, sender common.Address) PreimageLoadCheck

func (*CannonHelper) CreateStepPreimageLoadCheck

func (g *CannonHelper) CreateStepPreimageLoadCheck(ctx context.Context) PreimageLoadCheck

CreateStepPreimageLoadCheck returns a PreimageLoadCheck that generates the expected preimage data and verifies that data for the expected key is stored on-chain (PreimageOracle.preimagePartOk[key][offset] == true).

func (*CannonHelper) CreateStepPreimageLoadStrictCheck

func (g *CannonHelper) CreateStepPreimageLoadStrictCheck(ctx context.Context, expectedData ExpectedDataGetter) PreimageLoadCheck

CreateStepPreimageLoadStrictCheck returns a PreimageLoadCheck that generates the expected preimage data and verifies that data for the expected key is stored on-chain (PreimageOracle.preimagePartOk[key][offset] == true). Additionally, it checks that the data stored on-chain (in PreimageOracle.preimageParts) is what we expect.

func (*CannonHelper) FindOddStepForPreimageLoad

func (g *CannonHelper) FindOddStepForPreimageLoad(ctx context.Context, cannonTraceProviderFunc CannonTraceProviderFunc, poConfig utils.PreimageOptConfig, opts ...FindPreimageStepOpt) uint64

FindOddStepForPreimageLoad attempts to find an odd step that matches the PreimageOptConfig. If no such step is found, falls back to an even step if allowEvenFallback is true, otherwise fails.

func (*CannonHelper) GetOracleKeyPrefixValidator

func (g *CannonHelper) GetOracleKeyPrefixValidator(prefix byte) OracleDataValidator

func (*CannonHelper) GetOracleKeyValidator

func (g *CannonHelper) GetOracleKeyValidator(key preimage.Key) OracleDataValidator

func (*CannonHelper) GetPreimageAtOffset

func (g *CannonHelper) GetPreimageAtOffset(data *types.PreimageOracleData) [32]byte

GetPreimageAtOffset returns a slice of the preimage data (with size prefix) at the specified offset This can be used to determine what preimage part we expect to be stored in the PreimageOracle contract. This only works for some types of preimages, however. For example, precompile preimages store data that is computed on-chain

func (*CannonHelper) NewMemoizedCannonTraceProvider

func (g *CannonHelper) NewMemoizedCannonTraceProvider(ctx context.Context, l2Node string, outputRootClaim *ClaimHelper, options ...challenger.Option) CannonTraceProviderFunc

NewMemoizedCannonTraceProvider returns a function that will generate a cannon trace provider once, memoize it and return the same trace provider on subsequent calls

func (*CannonHelper) StartChallenger

func (g *CannonHelper) StartChallenger(ctx context.Context, name string, options ...challenger.Option) *challenger.Helper

func (*CannonHelper) UploadPreimage

func (g *CannonHelper) UploadPreimage(ctx context.Context, data *types.PreimageOracleData)

func (*CannonHelper) VerifyPreimage

func (g *CannonHelper) VerifyPreimage(ctx context.Context, cannonTraceProviderFunc CannonTraceProviderFunc, preimageKey preimage.Key)

func (*CannonHelper) VerifyPreimageAtTarget

func (g *CannonHelper) VerifyPreimageAtTarget(ctx context.Context, cannonTraceProviderFunc CannonTraceProviderFunc, targetTraceIndex uint64, oracleDataValidator OracleDataValidator, uploadOracleData bool)

func (*CannonHelper) WaitForChallengePeriodStart

func (g *CannonHelper) WaitForChallengePeriodStart(ctx context.Context, sender common.Address, data *types.PreimageOracleData)

WaitForChallengePeriodStart waits for the challenge period to start for a given large preimage claim.

func (*CannonHelper) WaitForPreimageInOracle

func (g *CannonHelper) WaitForPreimageInOracle(ctx context.Context, data *types.PreimageOracleData)

type CannonTraceProviderFunc

type CannonTraceProviderFunc func() (*cannon.CannonTraceProviderForTest, common.Hash, *ClaimHelper)

type ClaimHelper

type ClaimHelper struct {
	Index       int64
	ParentIndex int
	Position    types.Position
	// contains filtered or unexported fields
}

func (*ClaimHelper) AgreesWithOutputRoot

func (c *ClaimHelper) AgreesWithOutputRoot() bool

func (*ClaimHelper) Attack

func (c *ClaimHelper) Attack(ctx context.Context, value common.Hash, opts ...MoveOpt) *ClaimHelper

func (*ClaimHelper) Defend

func (c *ClaimHelper) Defend(ctx context.Context, value common.Hash, opts ...MoveOpt) *ClaimHelper

func (*ClaimHelper) Depth

func (c *ClaimHelper) Depth() types.Depth

func (*ClaimHelper) IsBottomGameRoot

func (c *ClaimHelper) IsBottomGameRoot(ctx context.Context) bool

func (*ClaimHelper) IsMaxDepth

func (c *ClaimHelper) IsMaxDepth(ctx context.Context) bool

func (*ClaimHelper) IsOutputRoot

func (c *ClaimHelper) IsOutputRoot(ctx context.Context) bool

func (*ClaimHelper) IsOutputRootLeaf

func (c *ClaimHelper) IsOutputRootLeaf(ctx context.Context) bool

func (*ClaimHelper) IsRootClaim

func (c *ClaimHelper) IsRootClaim() bool

func (*ClaimHelper) RequireCorrectOutputRoot

func (c *ClaimHelper) RequireCorrectOutputRoot(ctx context.Context)

func (*ClaimHelper) RequireDifferentClaimValue

func (c *ClaimHelper) RequireDifferentClaimValue(other *ClaimHelper)

func (*ClaimHelper) RequireInvalidStatusCode

func (c *ClaimHelper) RequireInvalidStatusCode()

func (*ClaimHelper) RequireOnlyCounteredBy

func (c *ClaimHelper) RequireOnlyCounteredBy(ctx context.Context, expected ...*ClaimHelper)

func (*ClaimHelper) WaitForCounterClaim

func (c *ClaimHelper) WaitForCounterClaim(ctx context.Context, ignoreClaims ...*ClaimHelper) *ClaimHelper

WaitForCounterClaim waits for the claim to be countered by another claim being posted. It returns a helper for the claim that countered this one.

func (*ClaimHelper) WaitForCountered

func (c *ClaimHelper) WaitForCountered(ctx context.Context)

WaitForCountered waits until the claim is countered either by a child claim or by a step call.

type ContractClaim

type ContractClaim struct {
	ParentIndex uint32
	CounteredBy common.Address
	Claimant    common.Address
	Bond        *big.Int
	Claim       [32]byte
	Position    *big.Int
	Clock       *big.Int
}

type DefendClaimOpt

type DefendClaimOpt func(cfg *defendClaimCfg)

func WithoutWaitingForStep

func WithoutWaitingForStep() DefendClaimOpt

type DishonestHelper

type DishonestHelper struct {
	*OutputGameHelper
	*OutputHonestHelper
	// contains filtered or unexported fields
}

func (*DishonestHelper) ExhaustDishonestClaims

func (d *DishonestHelper) ExhaustDishonestClaims(ctx context.Context, rootClaim *ClaimHelper)

ExhaustDishonestClaims makes all possible significant moves (mod honest challenger's) in a game. It is very inefficient and should NOT be used on games with large depths

type DisputeSystem

type DisputeSystem interface {
	L1BeaconEndpoint() endpoint.RestHTTP
	SupervisorClient() *sources.SupervisorClient
	NodeEndpoint(name string) endpoint.RPC
	L2NodeEndpoints() []endpoint.RPC
	NodeClient(name string) *ethclient.Client
	RollupEndpoint(name string) endpoint.RPC
	SupervisorEndpoint() endpoint.RPC
	RollupClient(name string) *sources.RollupClient
	IsSupersystem() bool
	DisputeGameFactoryAddr() common.Address
	RollupCfgs() []*rollup.Config
	DependencySet() *depset.StaticConfigDependencySet
	L1Genesis() *core.Genesis
	L2Geneses() []*core.Genesis
	PrestateVariant() shared.PrestateVariant

	AdvanceTime(time.Duration)
}

type ExpectedDataGetter

type ExpectedDataGetter = func(p *types.PreimageOracleData) (bool, [32]byte)

ExpectedDataGetter should return (true, data) if expected data should be checked Otherwise should return (false, empty data)

type FactoryCfg

type FactoryCfg struct {
	PrivKey *ecdsa.PrivateKey
}

type FactoryHelper

type FactoryHelper struct {
	T           *testing.T
	Require     *require.Assertions
	System      DisputeSystem
	Client      *ethclient.Client
	Opts        *bind.TransactOpts
	PrivKey     *ecdsa.PrivateKey
	FactoryAddr common.Address
	Factory     *bindings.DisputeGameFactory
}

func NewFactoryHelper

func NewFactoryHelper(t *testing.T, ctx context.Context, system DisputeSystem, opts ...FactoryOption) *FactoryHelper

func (*FactoryHelper) CreateBisectionGameExtraData

func (h *FactoryHelper) CreateBisectionGameExtraData(l2Node string, l2BlockNumber uint64, cfg *GameCfg) []byte

func (*FactoryHelper) GetL1Head

func (*FactoryHelper) PreimageHelper

func (h *FactoryHelper) PreimageHelper(ctx context.Context) *preimage.Helper

func (*FactoryHelper) StartChallenger

func (h *FactoryHelper) StartChallenger(ctx context.Context, name string, options ...challenger.Option) *challenger.Helper

func (*FactoryHelper) StartOutputAlphabetGame

func (h *FactoryHelper) StartOutputAlphabetGame(ctx context.Context, l2Node string, l2BlockNumber uint64, rootClaim common.Hash, opts ...GameOpt) *OutputAlphabetGameHelper

func (*FactoryHelper) StartOutputAlphabetGameWithCorrectRoot

func (h *FactoryHelper) StartOutputAlphabetGameWithCorrectRoot(ctx context.Context, l2Node string, l2BlockNumber uint64, opts ...GameOpt) *OutputAlphabetGameHelper

func (*FactoryHelper) StartOutputCannonGame

func (h *FactoryHelper) StartOutputCannonGame(ctx context.Context, l2Node string, l2BlockNumber uint64, rootClaim common.Hash, opts ...GameOpt) *OutputCannonGameHelper

func (*FactoryHelper) StartOutputCannonGameWithCorrectRoot

func (h *FactoryHelper) StartOutputCannonGameWithCorrectRoot(ctx context.Context, l2Node string, l2BlockNumber uint64, opts ...GameOpt) *OutputCannonGameHelper

func (*FactoryHelper) StartPermissionedGame

func (h *FactoryHelper) StartPermissionedGame(ctx context.Context, l2Node string, l2BlockNumber uint64, rootClaim common.Hash, opts ...GameOpt) *OutputCannonGameHelper

func (*FactoryHelper) StartSuperCannonGame

func (h *FactoryHelper) StartSuperCannonGame(ctx context.Context, opts ...GameOpt) *SuperCannonGameHelper

func (*FactoryHelper) StartSuperCannonGameAtTimestamp

func (h *FactoryHelper) StartSuperCannonGameAtTimestamp(ctx context.Context, timestamp uint64, opts ...GameOpt) *SuperCannonGameHelper

func (*FactoryHelper) StartSuperCannonGameWithCorrectRoot

func (h *FactoryHelper) StartSuperCannonGameWithCorrectRoot(ctx context.Context, opts ...GameOpt) *SuperCannonGameHelper

func (*FactoryHelper) StartSuperCannonGameWithCorrectRootAtTimestamp

func (h *FactoryHelper) StartSuperCannonGameWithCorrectRootAtTimestamp(ctx context.Context, l2Timestamp uint64, opts ...GameOpt) *SuperCannonGameHelper

func (*FactoryHelper) WaitForBlock

func (h *FactoryHelper) WaitForBlock(l2Node string, l2BlockNumber uint64, cfg *GameCfg)

func (*FactoryHelper) WaitForSuperTimestamp

func (h *FactoryHelper) WaitForSuperTimestamp(l2Timestamp uint64, cfg *GameCfg)

type FactoryOption

type FactoryOption func(c *FactoryCfg)

func WithFactoryPrivKey

func WithFactoryPrivKey(privKey *ecdsa.PrivateKey) FactoryOption

type FindPreimageStepConfig

type FindPreimageStepConfig struct {
	// contains filtered or unexported fields
}

type FindPreimageStepOpt

type FindPreimageStepOpt func(cfg *FindPreimageStepConfig)

func AllowEvenFallback

func AllowEvenFallback() FindPreimageStepOpt

func SkipNPreimageLoads

func SkipNPreimageLoads(n int) FindPreimageStepOpt

type GameCfg

type GameCfg struct {
	// contains filtered or unexported fields
}

func NewGameCfg

func NewGameCfg(opts ...GameOpt) *GameCfg

type GameOpt

type GameOpt interface {
	Apply(cfg *GameCfg)
}

func WithFutureProposal

func WithFutureProposal() GameOpt

func WithInvalidSuperRoot

func WithInvalidSuperRoot() GameOpt

WithInvalidSuperRoot configures the game to use invalid super output roots.

func WithSuper

func WithSuper(super eth.Super) GameOpt

WithSuper allows specifying a custom super structure.

func WithUnsafeProposal

func WithUnsafeProposal() GameOpt

type HonestActorConfig

type HonestActorConfig struct {
	PrestateSequenceNumber  uint64
	PoststateSequenceNumber uint64
	ChallengerOpts          []challenger.Option
}

type HonestActorOpt

type HonestActorOpt func(cfg *HonestActorConfig)

func WithClaimedL2BlockNumber

func WithClaimedL2BlockNumber(num uint64) HonestActorOpt

func WithPrivKey

func WithPrivKey(privKey *ecdsa.PrivateKey) HonestActorOpt

type MoveOpt

type MoveOpt interface {
	Apply(cfg *moveCfg)
}

func WithIgnoreDuplicates

func WithIgnoreDuplicates() MoveOpt

func WithTransactOpts

func WithTransactOpts(Opts *bind.TransactOpts) MoveOpt

type Mover

type Mover func(parent *ClaimHelper) *ClaimHelper

Mover is a function that either attacks or defends the claim at parentClaimIdx

type OracleDataValidator

type OracleDataValidator = func(oracleData *types.PreimageOracleData)

type OutputAlphabetGameHelper

type OutputAlphabetGameHelper struct {
	OutputGameHelper
}

func (*OutputAlphabetGameHelper) CreateDishonestHelper

func (g *OutputAlphabetGameHelper) CreateDishonestHelper(ctx context.Context, l2Node string, defender bool) *DishonestHelper

func (*OutputAlphabetGameHelper) CreateHonestActor

func (g *OutputAlphabetGameHelper) CreateHonestActor(ctx context.Context, l2Node string) *OutputHonestHelper

func (*OutputAlphabetGameHelper) StartChallenger

func (g *OutputAlphabetGameHelper) StartChallenger(
	ctx context.Context,
	l2Node string,
	name string,
	options ...challenger.Option,
) *challenger.Helper

type OutputCannonGameHelper

type OutputCannonGameHelper struct {
	OutputGameHelper
	CannonHelper
}

func (*OutputCannonGameHelper) CreateHonestActor

func (g *OutputCannonGameHelper) CreateHonestActor(ctx context.Context, l2Node string, options ...HonestActorOpt) *OutputHonestHelper

type OutputGameHelper

type OutputGameHelper struct {
	SplitGameHelper
}

func NewOutputGameHelper

func NewOutputGameHelper(t *testing.T, require *require.Assertions, client *ethclient.Client, opts *bind.TransactOpts, privKey *ecdsa.PrivateKey,
	game contracts.FaultDisputeGameContract, factoryAddr common.Address, addr common.Address, correctOutputProvider *outputs.OutputTraceProvider, system DisputeSystem) *OutputGameHelper

func (*OutputGameHelper) StartingBlockNum

func (g *OutputGameHelper) StartingBlockNum(ctx context.Context) uint64

func (*OutputGameHelper) WaitForL2BlockNumberChallenged

func (g *OutputGameHelper) WaitForL2BlockNumberChallenged(ctx context.Context)

type OutputHonestHelper

type OutputHonestHelper struct {
	// contains filtered or unexported fields
}

func NewOutputHonestHelper

func NewOutputHonestHelper(t *testing.T, require *require.Assertions, game *SplitGameHelper, contract contracts.FaultDisputeGameContract, correctTrace types.TraceAccessor) *OutputHonestHelper

func (*OutputHonestHelper) Attack

func (h *OutputHonestHelper) Attack(ctx context.Context, claimIdx int64, opts ...MoveOpt)

func (*OutputHonestHelper) AttackClaim

func (h *OutputHonestHelper) AttackClaim(ctx context.Context, claim *ClaimHelper, opts ...MoveOpt) *ClaimHelper

func (*OutputHonestHelper) CounterClaim

func (h *OutputHonestHelper) CounterClaim(ctx context.Context, claim *ClaimHelper, opts ...MoveOpt) *ClaimHelper

func (*OutputHonestHelper) Defend

func (h *OutputHonestHelper) Defend(ctx context.Context, claimIdx int64, opts ...MoveOpt)

func (*OutputHonestHelper) DefendClaim

func (h *OutputHonestHelper) DefendClaim(ctx context.Context, claim *ClaimHelper, opts ...MoveOpt) *ClaimHelper

func (*OutputHonestHelper) StepClaimFails

func (h *OutputHonestHelper) StepClaimFails(ctx context.Context, claim *ClaimHelper, isAttack bool)

func (*OutputHonestHelper) StepFails

func (h *OutputHonestHelper) StepFails(ctx context.Context, claimIdx int64, isAttack bool)

type PreimageLoadCheck

type PreimageLoadCheck func(types.TraceProvider, uint64) error

type SplitGameHelper

type SplitGameHelper struct {
	T                       *testing.T
	Require                 *require.Assertions
	Client                  *ethclient.Client
	Opts                    *bind.TransactOpts
	PrivKey                 *ecdsa.PrivateKey
	Game                    contracts.FaultDisputeGameContract
	FactoryAddr             common.Address
	Addr                    common.Address
	CorrectOutputProvider   types.TraceProvider
	System                  DisputeSystem
	DescribePosition        func(pos types.Position, splitDepth types.Depth) string
	ClaimedL2SequenceNumber func(pos types.Position) (uint64, error)
}

func (*SplitGameHelper) Attack

func (g *SplitGameHelper) Attack(ctx context.Context, claimIdx int64, claim common.Hash, Opts ...MoveOpt)

func (*SplitGameHelper) AvailableCredit

func (g *SplitGameHelper) AvailableCredit(ctx context.Context, addr common.Address) *big.Int

func (*SplitGameHelper) ChallengeClaim

func (g *SplitGameHelper) ChallengeClaim(ctx context.Context, claim *ClaimHelper, performMove Mover, attemptStep Stepper)

ChallengeClaim uses the supplied functions to perform moves and steps in an attempt to challenge the supplied claim. It is assumed that the claim being disputed is valid and that an honest op-challenger is already running. When the game has reached the maximum depth it calls the Stepper to attempt to counter the leaf claim. Since the output root is valid, it should not be possible for the Stepper to call step successfully.

func (*SplitGameHelper) Credit

func (g *SplitGameHelper) Credit(ctx context.Context, addr common.Address) *big.Int

func (*SplitGameHelper) CreditUnlockDuration

func (g *SplitGameHelper) CreditUnlockDuration(ctx context.Context) time.Duration

func (*SplitGameHelper) Defend

func (g *SplitGameHelper) Defend(ctx context.Context, claimIdx int64, claim common.Hash, Opts ...MoveOpt)

func (*SplitGameHelper) DefendClaim

func (g *SplitGameHelper) DefendClaim(ctx context.Context, claim *ClaimHelper, performMove Mover, Opts ...DefendClaimOpt) *ClaimHelper

DefendClaim uses the supplied Mover to perform moves in an attempt to defend the supplied claim. It is assumed that the specified claim is invalid and that an honest op-challenger is already running. When the game has reached the maximum depth it waits for the honest challenger to counter the leaf claim with step. Returns the final leaf claim

func (*SplitGameHelper) DisputeBlock

func (g *SplitGameHelper) DisputeBlock(ctx context.Context, disputeBlockNum uint64) *ClaimHelper

DisputeBlock posts claims from both the honest and dishonest actor to progress the output root part of the game through to the split depth and the claims are setup such that the last block in the game range is the block to execute cannon on. ie the first block the honest and dishonest actors disagree about is the l2 block of the game.

func (*SplitGameHelper) DisputeLastBlock

func (g *SplitGameHelper) DisputeLastBlock(ctx context.Context) *ClaimHelper

func (*SplitGameHelper) ExecDepth

func (g *SplitGameHelper) ExecDepth(ctx context.Context) types.Depth

func (*SplitGameHelper) GameData

func (g *SplitGameHelper) GameData(ctx context.Context) string

func (*SplitGameHelper) GetClaimValue

func (g *SplitGameHelper) GetClaimValue(ctx context.Context, claimIdx int64) common.Hash

func (*SplitGameHelper) GetL1Head

func (g *SplitGameHelper) GetL1Head(ctx context.Context) eth.BlockID

func (*SplitGameHelper) L2BlockNum

func (g *SplitGameHelper) L2BlockNum(ctx context.Context) uint64

func (*SplitGameHelper) LogGameData

func (g *SplitGameHelper) LogGameData(ctx context.Context)

func (*SplitGameHelper) MaxClockDuration

func (g *SplitGameHelper) MaxClockDuration(ctx context.Context) time.Duration

func (*SplitGameHelper) MaxDepth

func (g *SplitGameHelper) MaxDepth(ctx context.Context) types.Depth

func (*SplitGameHelper) Resolve

func (g *SplitGameHelper) Resolve(ctx context.Context)

func (*SplitGameHelper) ResolveClaim

func (g *SplitGameHelper) ResolveClaim(ctx context.Context, claimIdx int64)

ResolveClaim resolves a single subgame

func (*SplitGameHelper) RootClaim

func (g *SplitGameHelper) RootClaim(ctx context.Context) *ClaimHelper

func (*SplitGameHelper) SplitDepth

func (g *SplitGameHelper) SplitDepth(ctx context.Context) types.Depth

func (*SplitGameHelper) Status

func (*SplitGameHelper) StepFails

func (g *SplitGameHelper) StepFails(ctx context.Context, claimIdx int64, isAttack bool, stateData []byte, proof []byte)

StepFails attempts to call step and verifies that it fails with ValidStep()

func (*SplitGameHelper) SupportClaim

func (g *SplitGameHelper) SupportClaim(ctx context.Context, claim *ClaimHelper, performMove Mover, attemptStep Stepper)

SupportClaim uses the supplied Mover to perform moves in an attempt to support the supplied claim. It is assumed that the specified claim is valid and that an honest op-challenger is already running. When the game has reached the maximum depth it uses the specified stepper to counter the leaf claim.

func (*SplitGameHelper) WaitForAllClaimsCountered

func (g *SplitGameHelper) WaitForAllClaimsCountered(ctx context.Context)

func (*SplitGameHelper) WaitForBondModeDecided

func (g *SplitGameHelper) WaitForBondModeDecided(ctx context.Context)

func (*SplitGameHelper) WaitForClaimAtDepth

func (g *SplitGameHelper) WaitForClaimAtDepth(ctx context.Context, depth types.Depth)

func (*SplitGameHelper) WaitForClaimAtMaxDepth

func (g *SplitGameHelper) WaitForClaimAtMaxDepth(ctx context.Context, countered bool)

func (*SplitGameHelper) WaitForClaimCount

func (g *SplitGameHelper) WaitForClaimCount(ctx context.Context, count int64)

WaitForClaimCount waits until there are at least count claims in the game. This does not check that the number of claims is exactly the specified count to avoid intermittent failures where a challenger posts an additional claim before this method sees the number of claims it was waiting for.

func (*SplitGameHelper) WaitForCorrectClaim

func (g *SplitGameHelper) WaitForCorrectClaim(ctx context.Context, claimIdx int64)

func (*SplitGameHelper) WaitForCountered

func (g *SplitGameHelper) WaitForCountered(ctx context.Context, claimIdx int64)

func (*SplitGameHelper) WaitForGameStatus

func (g *SplitGameHelper) WaitForGameStatus(ctx context.Context, expected gameTypes.GameStatus)

func (*SplitGameHelper) WaitForInactivity

func (g *SplitGameHelper) WaitForInactivity(ctx context.Context, numInactiveBlocks int, untilGameEnds bool)

func (*SplitGameHelper) WaitForNewClaim

func (g *SplitGameHelper) WaitForNewClaim(ctx context.Context, checkPoint int64) (int64, error)

func (*SplitGameHelper) WaitForNoAvailableCredit

func (g *SplitGameHelper) WaitForNoAvailableCredit(ctx context.Context, addr common.Address)

func (*SplitGameHelper) WethBalance

func (g *SplitGameHelper) WethBalance(ctx context.Context, addr common.Address) *big.Int

type Stepper

type Stepper func(parentClaimIdx int64)

Stepper is a function that attempts to perform a step against the claim at parentClaimIdx

type SuperCannonGameHelper

type SuperCannonGameHelper struct {
	SuperGameHelper
	CannonHelper
}

func (*SuperCannonGameHelper) ChallengeToPreimageLoad

func (g *SuperCannonGameHelper) ChallengeToPreimageLoad(ctx context.Context, topGameLeaf *ClaimHelper, challengerKey *ecdsa.PrivateKey, preimage utils.PreimageOpt, preimageCheck PreimageLoadCheck, preloadPreimage bool)

ChallengeToPreimageLoad challenges the supplied execution root claim by inducing a step that requires a preimage to be loaded It does this by: 1. Identifying the first state transition that loads a global preimage 2. Descending the execution game tree to reach the step that loads the preimage 3. Asserting that the preimage was indeed loaded by an honest challenger (assuming the preimage is not preloaded) This expects an even execution game depth in order for the honest challenger to step on our leaf claim PRECOND: - The topGameLeaf must be incorrect - The execution game depth must be even

func (*SuperCannonGameHelper) CreateHonestActor

func (g *SuperCannonGameHelper) CreateHonestActor(ctx context.Context, options ...HonestActorOpt) *OutputHonestHelper

func (*SuperCannonGameHelper) InitFirstDerivationGame

func (g *SuperCannonGameHelper) InitFirstDerivationGame(ctx context.Context, correctTrace *OutputHonestHelper) *ClaimHelper

InitFirstDerivationGame builds a top-level game whose deepest node (at splitDepth) asserts the first output-root derivation that follows the prestate (timestamp=1, step<=1). Returns the claim positioned at splitDepth, which is the parent of the constructed execution subgame root.

func (*SuperCannonGameHelper) SupportClaimIntoTargetTraceIndex

func (g *SuperCannonGameHelper) SupportClaimIntoTargetTraceIndex(ctx context.Context, claim *ClaimHelper, targetTraceIndexAtSplitDepth uint64)

SupportClaimIntoTargetTraceIndex supports the specified claim while bisecting to the target trace index at split depth.

type SuperDisputeSystem

type SuperDisputeSystem struct {
	// contains filtered or unexported fields
}

func (*SuperDisputeSystem) AdvanceTime

func (s *SuperDisputeSystem) AdvanceTime(duration time.Duration)

func (*SuperDisputeSystem) DependencySet

func (*SuperDisputeSystem) DisputeGameFactoryAddr

func (s *SuperDisputeSystem) DisputeGameFactoryAddr() common.Address

func (*SuperDisputeSystem) IsSupersystem

func (s *SuperDisputeSystem) IsSupersystem() bool

func (*SuperDisputeSystem) L1BeaconEndpoint

func (s *SuperDisputeSystem) L1BeaconEndpoint() endpoint.RestHTTP

func (*SuperDisputeSystem) L1Genesis

func (s *SuperDisputeSystem) L1Genesis() *core.Genesis

func (*SuperDisputeSystem) L2Geneses

func (s *SuperDisputeSystem) L2Geneses() []*core.Genesis

func (*SuperDisputeSystem) L2NodeEndpoints

func (s *SuperDisputeSystem) L2NodeEndpoints() []endpoint.RPC

func (*SuperDisputeSystem) NodeClient

func (s *SuperDisputeSystem) NodeClient(name string) *ethclient.Client

func (*SuperDisputeSystem) NodeEndpoint

func (s *SuperDisputeSystem) NodeEndpoint(name string) endpoint.RPC

func (*SuperDisputeSystem) PrestateVariant

func (s *SuperDisputeSystem) PrestateVariant() challenger.PrestateVariant

func (*SuperDisputeSystem) RollupCfgs

func (s *SuperDisputeSystem) RollupCfgs() []*rollup.Config

func (*SuperDisputeSystem) RollupClient

func (s *SuperDisputeSystem) RollupClient(name string) *sources.RollupClient

func (*SuperDisputeSystem) RollupEndpoint

func (s *SuperDisputeSystem) RollupEndpoint(name string) endpoint.RPC

func (*SuperDisputeSystem) SupervisorClient

func (s *SuperDisputeSystem) SupervisorClient() *sources.SupervisorClient

func (*SuperDisputeSystem) SupervisorEndpoint

func (s *SuperDisputeSystem) SupervisorEndpoint() endpoint.RPC

type SuperGameHelper

type SuperGameHelper struct {
	SplitGameHelper
}

func NewSuperGameHelper

func NewSuperGameHelper(t *testing.T, require *require.Assertions, client *ethclient.Client, opts *bind.TransactOpts, privKey *ecdsa.PrivateKey,
	game contracts.FaultDisputeGameContract, factoryAddr common.Address, addr common.Address, correctOutputProvider super.SuperTraceProvider, system DisputeSystem) *SuperGameHelper

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL