Documentation ¶
Index ¶
- type AlphabetGameHelper
- type ClaimHelper
- func (c *ClaimHelper) AgreesWithOutputRoot() bool
- func (c *ClaimHelper) Attack(ctx context.Context, value common.Hash, opts ...MoveOpt) *ClaimHelper
- func (c *ClaimHelper) Defend(ctx context.Context, value common.Hash, opts ...MoveOpt) *ClaimHelper
- func (c *ClaimHelper) Depth() types.Depth
- func (c *ClaimHelper) IsBottomGameRoot(ctx context.Context) bool
- func (c *ClaimHelper) IsMaxDepth(ctx context.Context) bool
- func (c *ClaimHelper) IsOutputRoot(ctx context.Context) bool
- func (c *ClaimHelper) IsOutputRootLeaf(ctx context.Context) bool
- func (c *ClaimHelper) IsRootClaim() bool
- func (c *ClaimHelper) RequireCorrectOutputRoot(ctx context.Context)
- func (c *ClaimHelper) RequireDifferentClaimValue(other *ClaimHelper)
- func (c *ClaimHelper) RequireOnlyCounteredBy(ctx context.Context, expected ...*ClaimHelper)
- func (c *ClaimHelper) WaitForCounterClaim(ctx context.Context, ignoreClaims ...*ClaimHelper) *ClaimHelper
- func (c *ClaimHelper) WaitForCountered(ctx context.Context)
- type ContractClaim
- type DefendClaimOpt
- type DishonestHelper
- type DisputeSystem
- type ErrWithData
- type FactoryHelper
- func (h *FactoryHelper) PreimageHelper(ctx context.Context) *preimage.Helper
- func (h *FactoryHelper) StartChallenger(ctx context.Context, name string, options ...challenger.Option) *challenger.Helper
- func (h *FactoryHelper) StartOutputAlphabetGame(ctx context.Context, l2Node string, l2BlockNumber uint64, ...) *OutputAlphabetGameHelper
- func (h *FactoryHelper) StartOutputAlphabetGameWithCorrectRoot(ctx context.Context, l2Node string, l2BlockNumber uint64, opts ...GameOpt) *OutputAlphabetGameHelper
- func (h *FactoryHelper) StartOutputCannonGame(ctx context.Context, l2Node string, l2BlockNumber uint64, ...) *OutputCannonGameHelper
- func (h *FactoryHelper) StartOutputCannonGameWithCorrectRoot(ctx context.Context, l2Node string, l2BlockNumber uint64, opts ...GameOpt) *OutputCannonGameHelper
- type FaultGameHelper
- func (g *FaultGameHelper) Addr() common.Address
- func (g *FaultGameHelper) Attack(ctx context.Context, claimIdx int64, claim common.Hash)
- func (g *FaultGameHelper) ChallengeRootClaim(ctx context.Context, performMove func(parentClaimIdx int64), ...)
- func (g *FaultGameHelper) Defend(ctx context.Context, claimIdx int64, claim common.Hash)
- func (g *FaultGameHelper) DefendRootClaim(ctx context.Context, performMove func(parentClaimIdx int64))
- func (g *FaultGameHelper) GameDuration(ctx context.Context) time.Duration
- func (g *FaultGameHelper) GetClaimPosition(ctx context.Context, claimIdx int64) types.Position
- func (g *FaultGameHelper) GetClaimValue(ctx context.Context, claimIdx int64) common.Hash
- func (g *FaultGameHelper) LogGameData(ctx context.Context)
- func (g *FaultGameHelper) MaxDepth(ctx context.Context) types.Depth
- func (g *FaultGameHelper) Resolve(ctx context.Context)
- func (g *FaultGameHelper) ResolveClaim(ctx context.Context, claimIdx int64)
- func (g *FaultGameHelper) Status(ctx context.Context) Status
- func (g *FaultGameHelper) StepFails(claimIdx int64, isAttack bool, stateData []byte, proof []byte)
- func (g *FaultGameHelper) WaitForAllClaimsCountered(ctx context.Context)
- func (g *FaultGameHelper) WaitForClaimAtDepth(ctx context.Context, depth types.Depth)
- func (g *FaultGameHelper) WaitForClaimAtMaxDepth(ctx context.Context, countered bool)
- func (g *FaultGameHelper) WaitForClaimCount(ctx context.Context, count int64)
- func (g *FaultGameHelper) WaitForGameStatus(ctx context.Context, expected Status)
- func (g *FaultGameHelper) WaitForInactivity(ctx context.Context, numInactiveBlocks int, untilGameEnds bool)
- func (g *FaultGameHelper) WaitForNewClaim(ctx context.Context, checkPoint int64) (int64, error)
- type GameOpt
- type HonestHelper
- type MoveOpt
- type Mover
- type OutputAlphabetGameHelper
- func (g *OutputAlphabetGameHelper) CreateDishonestHelper(ctx context.Context, l2Node string, defender bool) *DishonestHelper
- func (g *OutputAlphabetGameHelper) CreateHonestActor(ctx context.Context, l2Node string) *OutputHonestHelper
- func (g *OutputAlphabetGameHelper) StartChallenger(ctx context.Context, l2Node string, name string, options ...challenger.Option) *challenger.Helper
- type OutputCannonGameHelper
- func (g *OutputCannonGameHelper) ChallengeToPreimageLoad(ctx context.Context, outputRootClaim *ClaimHelper, ...)
- func (g *OutputCannonGameHelper) CreateHonestActor(ctx context.Context, l2Node string, options ...challenger.Option) *OutputHonestHelper
- func (g *OutputCannonGameHelper) CreateStepLargePreimageLoadCheck(ctx context.Context, sender common.Address) PreimageLoadCheck
- func (g *OutputCannonGameHelper) CreateStepPreimageLoadCheck(ctx context.Context) PreimageLoadCheck
- func (g *OutputCannonGameHelper) StartChallenger(ctx context.Context, l2Node string, name string, options ...challenger.Option) *challenger.Helper
- func (g *OutputCannonGameHelper) VerifyPreimage(ctx context.Context, outputRootClaim *ClaimHelper, preimageKey preimage.Key)
- type OutputGameHelper
- func (g *OutputGameHelper) Addr() common.Address
- func (g *OutputGameHelper) Attack(ctx context.Context, claimIdx int64, claim common.Hash, opts ...MoveOpt)
- func (g *OutputGameHelper) AvailableCredit(ctx context.Context, addr common.Address) *big.Int
- func (g *OutputGameHelper) ChallengeClaim(ctx context.Context, claim *ClaimHelper, performMove Mover, ...)
- func (g *OutputGameHelper) ChallengePeriod(ctx context.Context) uint64
- func (g *OutputGameHelper) ChallengePeriodStartTime(ctx context.Context, sender common.Address, data *types.PreimageOracleData) uint64
- func (g *OutputGameHelper) Credit(ctx context.Context, addr common.Address) *big.Int
- func (g *OutputGameHelper) CreditUnlockDuration(ctx context.Context) time.Duration
- func (g *OutputGameHelper) Defend(ctx context.Context, claimIdx int64, claim common.Hash, opts ...MoveOpt)
- func (g *OutputGameHelper) DefendClaim(ctx context.Context, claim *ClaimHelper, performMove Mover, ...) *ClaimHelper
- func (g *OutputGameHelper) DisputeBlock(ctx context.Context, disputeBlockNum uint64) *ClaimHelper
- func (g *OutputGameHelper) DisputeLastBlock(ctx context.Context) *ClaimHelper
- func (g *OutputGameHelper) ExecDepth(ctx context.Context) types.Depth
- func (g *OutputGameHelper) GameDuration(ctx context.Context) time.Duration
- func (g *OutputGameHelper) GetClaimValue(ctx context.Context, claimIdx int64) common.Hash
- func (g *OutputGameHelper) L2BlockNum(ctx context.Context) uint64
- func (g *OutputGameHelper) LogGameData(ctx context.Context)
- func (g *OutputGameHelper) MaxDepth(ctx context.Context) types.Depth
- func (g *OutputGameHelper) Resolve(ctx context.Context)
- func (g *OutputGameHelper) ResolveClaim(ctx context.Context, claimIdx int64)
- func (g *OutputGameHelper) RootClaim(ctx context.Context) *ClaimHelper
- func (g *OutputGameHelper) SplitDepth(ctx context.Context) types.Depth
- func (g *OutputGameHelper) StartingBlockNum(ctx context.Context) uint64
- func (g *OutputGameHelper) Status(ctx context.Context) Status
- func (g *OutputGameHelper) StepFails(claimIdx int64, isAttack bool, stateData []byte, proof []byte)
- func (g *OutputGameHelper) WaitForAllClaimsCountered(ctx context.Context)
- func (g *OutputGameHelper) WaitForChallengePeriodStart(ctx context.Context, sender common.Address, data *types.PreimageOracleData)
- func (g *OutputGameHelper) WaitForClaimAtDepth(ctx context.Context, depth types.Depth)
- func (g *OutputGameHelper) WaitForClaimAtMaxDepth(ctx context.Context, countered bool)
- func (g *OutputGameHelper) WaitForClaimCount(ctx context.Context, count int64)
- func (g *OutputGameHelper) WaitForCorrectOutputRoot(ctx context.Context, claimIdx int64)
- func (g *OutputGameHelper) WaitForGameStatus(ctx context.Context, expected Status)
- func (g *OutputGameHelper) WaitForInactivity(ctx context.Context, numInactiveBlocks int, untilGameEnds bool)
- func (g *OutputGameHelper) WaitForNewClaim(ctx context.Context, checkPoint int64) (int64, error)
- func (g *OutputGameHelper) WaitForNoAvailableCredit(ctx context.Context, addr common.Address)
- func (g *OutputGameHelper) WethBalance(ctx context.Context, addr common.Address) *big.Int
- type OutputHonestHelper
- func (h *OutputHonestHelper) Attack(ctx context.Context, claimIdx int64, opts ...MoveOpt)
- func (h *OutputHonestHelper) AttackClaim(ctx context.Context, claim *ClaimHelper, opts ...MoveOpt) *ClaimHelper
- func (h *OutputHonestHelper) CounterClaim(ctx context.Context, claim *ClaimHelper, opts ...MoveOpt) *ClaimHelper
- func (h *OutputHonestHelper) Defend(ctx context.Context, claimIdx int64, opts ...MoveOpt)
- func (h *OutputHonestHelper) DefendClaim(ctx context.Context, claim *ClaimHelper, opts ...MoveOpt) *ClaimHelper
- func (h *OutputHonestHelper) StepClaimFails(ctx context.Context, claim *ClaimHelper, isAttack bool)
- func (h *OutputHonestHelper) StepFails(ctx context.Context, claimIdx int64, isAttack bool)
- type PreimageLoadCheck
- type Status
- type Stepper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlphabetGameHelper ¶ added in v1.1.4
type AlphabetGameHelper struct {
FaultGameHelper
}
func (*AlphabetGameHelper) CreateHonestActor ¶ added in v1.1.6
func (g *AlphabetGameHelper) CreateHonestActor(alphabetTrace string, depth types.Depth) *HonestHelper
func (*AlphabetGameHelper) StartChallenger ¶ added in v1.1.4
func (g *AlphabetGameHelper) StartChallenger(ctx context.Context, sys challenger.EndpointProvider, name string, options ...challenger.Option) *challenger.Helper
type ClaimHelper ¶ added in v1.4.2
type ClaimHelper struct {
// contains filtered or unexported fields
}
func (*ClaimHelper) AgreesWithOutputRoot ¶ added in v1.4.2
func (c *ClaimHelper) AgreesWithOutputRoot() bool
func (*ClaimHelper) Attack ¶ added in v1.4.2
func (c *ClaimHelper) Attack(ctx context.Context, value common.Hash, opts ...MoveOpt) *ClaimHelper
func (*ClaimHelper) Defend ¶ added in v1.4.2
func (c *ClaimHelper) Defend(ctx context.Context, value common.Hash, opts ...MoveOpt) *ClaimHelper
func (*ClaimHelper) Depth ¶ added in v1.4.3
func (c *ClaimHelper) Depth() types.Depth
func (*ClaimHelper) IsBottomGameRoot ¶ added in v1.4.3
func (c *ClaimHelper) IsBottomGameRoot(ctx context.Context) bool
func (*ClaimHelper) IsMaxDepth ¶ added in v1.4.2
func (c *ClaimHelper) IsMaxDepth(ctx context.Context) bool
func (*ClaimHelper) IsOutputRoot ¶ added in v1.4.2
func (c *ClaimHelper) IsOutputRoot(ctx context.Context) bool
func (*ClaimHelper) IsOutputRootLeaf ¶ added in v1.4.2
func (c *ClaimHelper) IsOutputRootLeaf(ctx context.Context) bool
func (*ClaimHelper) IsRootClaim ¶ added in v1.4.3
func (c *ClaimHelper) IsRootClaim() bool
func (*ClaimHelper) RequireCorrectOutputRoot ¶ added in v1.4.2
func (c *ClaimHelper) RequireCorrectOutputRoot(ctx context.Context)
func (*ClaimHelper) RequireDifferentClaimValue ¶ added in v1.4.2
func (c *ClaimHelper) RequireDifferentClaimValue(other *ClaimHelper)
func (*ClaimHelper) RequireOnlyCounteredBy ¶ added in v1.4.3
func (c *ClaimHelper) RequireOnlyCounteredBy(ctx context.Context, expected ...*ClaimHelper)
func (*ClaimHelper) WaitForCounterClaim ¶ added in v1.4.2
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 ¶ added in v1.4.2
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 DefendClaimOpt ¶ added in v1.5.1
type DefendClaimOpt func(cfg *defendClaimCfg)
func WithoutWaitingForStep ¶ added in v1.5.1
func WithoutWaitingForStep() DefendClaimOpt
type DishonestHelper ¶ added in v1.1.6
type DishonestHelper struct { *OutputGameHelper *OutputHonestHelper // contains filtered or unexported fields }
func (*DishonestHelper) ExhaustDishonestClaims ¶ added in v1.1.6
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 ¶ added in v1.4.2
type DisputeSystem interface { L1BeaconEndpoint() string NodeEndpoint(name string) string NodeClient(name string) *ethclient.Client RollupEndpoint(name string) string RollupClient(name string) *sources.RollupClient L1Deployments() *genesis.L1Deployments RollupCfg() *rollup.Config L2Genesis() *core.Genesis AdvanceTime(time.Duration) }
type ErrWithData ¶ added in v1.1.6
type ErrWithData interface {
ErrorData() interface{}
}
type FactoryHelper ¶
type FactoryHelper struct {
// contains filtered or unexported fields
}
func NewFactoryHelper ¶
func NewFactoryHelper(t *testing.T, ctx context.Context, system DisputeSystem) *FactoryHelper
func (*FactoryHelper) PreimageHelper ¶ added in v1.5.0
func (h *FactoryHelper) PreimageHelper(ctx context.Context) *preimage.Helper
func (*FactoryHelper) StartChallenger ¶ added in v1.1.4
func (h *FactoryHelper) StartChallenger(ctx context.Context, name string, options ...challenger.Option) *challenger.Helper
func (*FactoryHelper) StartOutputAlphabetGame ¶ added in v1.4.2
func (h *FactoryHelper) StartOutputAlphabetGame(ctx context.Context, l2Node string, l2BlockNumber uint64, rootClaim common.Hash, opts ...GameOpt) *OutputAlphabetGameHelper
func (*FactoryHelper) StartOutputAlphabetGameWithCorrectRoot ¶ added in v1.4.3
func (h *FactoryHelper) StartOutputAlphabetGameWithCorrectRoot(ctx context.Context, l2Node string, l2BlockNumber uint64, opts ...GameOpt) *OutputAlphabetGameHelper
func (*FactoryHelper) StartOutputCannonGame ¶ added in v1.4.2
func (h *FactoryHelper) StartOutputCannonGame(ctx context.Context, l2Node string, l2BlockNumber uint64, rootClaim common.Hash, opts ...GameOpt) *OutputCannonGameHelper
func (*FactoryHelper) StartOutputCannonGameWithCorrectRoot ¶ added in v1.4.2
func (h *FactoryHelper) StartOutputCannonGameWithCorrectRoot(ctx context.Context, l2Node string, l2BlockNumber uint64, opts ...GameOpt) *OutputCannonGameHelper
type FaultGameHelper ¶
type FaultGameHelper struct {
// contains filtered or unexported fields
}
func (*FaultGameHelper) Addr ¶ added in v1.1.6
func (g *FaultGameHelper) Addr() common.Address
func (*FaultGameHelper) ChallengeRootClaim ¶ added in v1.1.6
func (g *FaultGameHelper) ChallengeRootClaim(ctx context.Context, performMove func(parentClaimIdx int64), attemptStep Stepper)
ChallengeRootClaim uses the supplied Mover and Stepper to perform moves and steps in an attempt to challenge the root claim. It is assumed that the output root being disputed is invalid 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 invalid, it should not be possible for the Stepper to call step successfully.
func (*FaultGameHelper) DefendRootClaim ¶ added in v1.1.6
func (g *FaultGameHelper) DefendRootClaim(ctx context.Context, performMove func(parentClaimIdx int64))
DefendRootClaim uses the supplied Mover to perform moves in an attempt to defend the root claim. It is assumed that the output root being disputed is valid 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.
func (*FaultGameHelper) GameDuration ¶ added in v1.1.4
func (g *FaultGameHelper) GameDuration(ctx context.Context) time.Duration
func (*FaultGameHelper) GetClaimPosition ¶ added in v1.2.0
func (*FaultGameHelper) GetClaimValue ¶ added in v1.1.6
func (*FaultGameHelper) LogGameData ¶ added in v1.1.4
func (g *FaultGameHelper) LogGameData(ctx context.Context)
func (*FaultGameHelper) MaxDepth ¶ added in v1.1.4
func (g *FaultGameHelper) MaxDepth(ctx context.Context) types.Depth
func (*FaultGameHelper) Resolve ¶
func (g *FaultGameHelper) Resolve(ctx context.Context)
func (*FaultGameHelper) ResolveClaim ¶ added in v1.1.6
func (g *FaultGameHelper) ResolveClaim(ctx context.Context, claimIdx int64)
ResolveClaim resolves a single subgame
func (*FaultGameHelper) Status ¶ added in v1.1.6
func (g *FaultGameHelper) Status(ctx context.Context) Status
func (*FaultGameHelper) StepFails ¶ added in v1.1.6
func (g *FaultGameHelper) StepFails(claimIdx int64, isAttack bool, stateData []byte, proof []byte)
StepFails attempts to call step and verifies that it fails with ValidStep()
func (*FaultGameHelper) WaitForAllClaimsCountered ¶ added in v1.1.6
func (g *FaultGameHelper) WaitForAllClaimsCountered(ctx context.Context)
func (*FaultGameHelper) WaitForClaimAtDepth ¶ added in v1.1.6
func (g *FaultGameHelper) WaitForClaimAtDepth(ctx context.Context, depth types.Depth)
func (*FaultGameHelper) WaitForClaimAtMaxDepth ¶
func (g *FaultGameHelper) WaitForClaimAtMaxDepth(ctx context.Context, countered bool)
func (*FaultGameHelper) WaitForClaimCount ¶
func (g *FaultGameHelper) 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 (*FaultGameHelper) WaitForGameStatus ¶
func (g *FaultGameHelper) WaitForGameStatus(ctx context.Context, expected Status)
func (*FaultGameHelper) WaitForInactivity ¶ added in v1.1.6
func (g *FaultGameHelper) WaitForInactivity(ctx context.Context, numInactiveBlocks int, untilGameEnds bool)
func (*FaultGameHelper) WaitForNewClaim ¶ added in v1.1.6
type GameOpt ¶ added in v1.7.2
type GameOpt interface {
Apply(cfg *gameCfg)
}
func WithFutureProposal ¶ added in v1.7.2
func WithFutureProposal() GameOpt
func WithUnsafeProposal ¶ added in v1.7.2
func WithUnsafeProposal() GameOpt
type HonestHelper ¶ added in v1.1.4
type HonestHelper struct {
// contains filtered or unexported fields
}
func (*HonestHelper) Attack ¶ added in v1.1.4
func (h *HonestHelper) Attack(ctx context.Context, claimIdx int64)
type MoveOpt ¶ added in v1.7.2
type MoveOpt interface {
Apply(cfg *moveCfg)
}
func WithIgnoreDuplicates ¶ added in v1.7.2
func WithIgnoreDuplicates() MoveOpt
func WithTransactOpts ¶ added in v1.7.2
func WithTransactOpts(opts *bind.TransactOpts) MoveOpt
type Mover ¶ added in v1.1.6
type Mover func(parent *ClaimHelper) *ClaimHelper
Mover is a function that either attacks or defends the claim at parentClaimIdx
type OutputAlphabetGameHelper ¶ added in v1.4.2
type OutputAlphabetGameHelper struct {
OutputGameHelper
}
func (*OutputAlphabetGameHelper) CreateDishonestHelper ¶ added in v1.4.3
func (g *OutputAlphabetGameHelper) CreateDishonestHelper(ctx context.Context, l2Node string, defender bool) *DishonestHelper
func (*OutputAlphabetGameHelper) CreateHonestActor ¶ added in v1.4.3
func (g *OutputAlphabetGameHelper) CreateHonestActor(ctx context.Context, l2Node string) *OutputHonestHelper
func (*OutputAlphabetGameHelper) StartChallenger ¶ added in v1.4.2
func (g *OutputAlphabetGameHelper) StartChallenger( ctx context.Context, l2Node string, name string, options ...challenger.Option, ) *challenger.Helper
type OutputCannonGameHelper ¶ added in v1.4.2
type OutputCannonGameHelper struct {
OutputGameHelper
}
func (*OutputCannonGameHelper) ChallengeToPreimageLoad ¶ added in v1.5.1
func (g *OutputCannonGameHelper) ChallengeToPreimageLoad(ctx context.Context, outputRootClaim *ClaimHelper, challengerKey *ecdsa.PrivateKey, preimage cannon.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 (*OutputCannonGameHelper) CreateHonestActor ¶ added in v1.4.2
func (g *OutputCannonGameHelper) CreateHonestActor(ctx context.Context, l2Node string, options ...challenger.Option) *OutputHonestHelper
func (*OutputCannonGameHelper) CreateStepLargePreimageLoadCheck ¶ added in v1.5.1
func (g *OutputCannonGameHelper) CreateStepLargePreimageLoadCheck(ctx context.Context, sender common.Address) PreimageLoadCheck
func (*OutputCannonGameHelper) CreateStepPreimageLoadCheck ¶ added in v1.5.1
func (g *OutputCannonGameHelper) CreateStepPreimageLoadCheck(ctx context.Context) PreimageLoadCheck
func (*OutputCannonGameHelper) StartChallenger ¶ added in v1.4.2
func (g *OutputCannonGameHelper) StartChallenger( ctx context.Context, l2Node string, name string, options ...challenger.Option, ) *challenger.Helper
func (*OutputCannonGameHelper) VerifyPreimage ¶ added in v1.7.2
func (g *OutputCannonGameHelper) VerifyPreimage(ctx context.Context, outputRootClaim *ClaimHelper, preimageKey preimage.Key)
type OutputGameHelper ¶ added in v1.4.2
type OutputGameHelper struct {
// contains filtered or unexported fields
}
func (*OutputGameHelper) Addr ¶ added in v1.4.2
func (g *OutputGameHelper) Addr() common.Address
func (*OutputGameHelper) AvailableCredit ¶ added in v1.7.2
func (*OutputGameHelper) ChallengeClaim ¶ added in v1.4.3
func (g *OutputGameHelper) 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 (*OutputGameHelper) ChallengePeriod ¶ added in v1.5.1
func (g *OutputGameHelper) 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 (*OutputGameHelper) ChallengePeriodStartTime ¶ added in v1.5.1
func (g *OutputGameHelper) 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 (*OutputGameHelper) CreditUnlockDuration ¶ added in v1.7.2
func (g *OutputGameHelper) CreditUnlockDuration(ctx context.Context) time.Duration
func (*OutputGameHelper) DefendClaim ¶ added in v1.4.3
func (g *OutputGameHelper) 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 (*OutputGameHelper) DisputeBlock ¶ added in v1.5.1
func (g *OutputGameHelper) 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 (*OutputGameHelper) DisputeLastBlock ¶ added in v1.4.2
func (g *OutputGameHelper) DisputeLastBlock(ctx context.Context) *ClaimHelper
func (*OutputGameHelper) ExecDepth ¶ added in v1.5.0
func (g *OutputGameHelper) ExecDepth(ctx context.Context) types.Depth
func (*OutputGameHelper) GameDuration ¶ added in v1.4.2
func (g *OutputGameHelper) GameDuration(ctx context.Context) time.Duration
func (*OutputGameHelper) GetClaimValue ¶ added in v1.4.2
func (*OutputGameHelper) L2BlockNum ¶ added in v1.4.2
func (g *OutputGameHelper) L2BlockNum(ctx context.Context) uint64
func (*OutputGameHelper) LogGameData ¶ added in v1.4.2
func (g *OutputGameHelper) LogGameData(ctx context.Context)
func (*OutputGameHelper) MaxDepth ¶ added in v1.4.2
func (g *OutputGameHelper) MaxDepth(ctx context.Context) types.Depth
func (*OutputGameHelper) Resolve ¶ added in v1.4.2
func (g *OutputGameHelper) Resolve(ctx context.Context)
func (*OutputGameHelper) ResolveClaim ¶ added in v1.4.2
func (g *OutputGameHelper) ResolveClaim(ctx context.Context, claimIdx int64)
ResolveClaim resolves a single subgame
func (*OutputGameHelper) RootClaim ¶ added in v1.4.2
func (g *OutputGameHelper) RootClaim(ctx context.Context) *ClaimHelper
func (*OutputGameHelper) SplitDepth ¶ added in v1.4.2
func (g *OutputGameHelper) SplitDepth(ctx context.Context) types.Depth
func (*OutputGameHelper) StartingBlockNum ¶ added in v1.7.2
func (g *OutputGameHelper) StartingBlockNum(ctx context.Context) uint64
func (*OutputGameHelper) Status ¶ added in v1.4.2
func (g *OutputGameHelper) Status(ctx context.Context) Status
func (*OutputGameHelper) StepFails ¶ added in v1.4.2
func (g *OutputGameHelper) StepFails(claimIdx int64, isAttack bool, stateData []byte, proof []byte)
StepFails attempts to call step and verifies that it fails with ValidStep()
func (*OutputGameHelper) WaitForAllClaimsCountered ¶ added in v1.4.2
func (g *OutputGameHelper) WaitForAllClaimsCountered(ctx context.Context)
func (*OutputGameHelper) WaitForChallengePeriodStart ¶ added in v1.5.1
func (g *OutputGameHelper) 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 (*OutputGameHelper) WaitForClaimAtDepth ¶ added in v1.4.2
func (g *OutputGameHelper) WaitForClaimAtDepth(ctx context.Context, depth types.Depth)
func (*OutputGameHelper) WaitForClaimAtMaxDepth ¶ added in v1.4.2
func (g *OutputGameHelper) WaitForClaimAtMaxDepth(ctx context.Context, countered bool)
func (*OutputGameHelper) WaitForClaimCount ¶ added in v1.4.2
func (g *OutputGameHelper) 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 (*OutputGameHelper) WaitForCorrectOutputRoot ¶ added in v1.4.2
func (g *OutputGameHelper) WaitForCorrectOutputRoot(ctx context.Context, claimIdx int64)
func (*OutputGameHelper) WaitForGameStatus ¶ added in v1.4.2
func (g *OutputGameHelper) WaitForGameStatus(ctx context.Context, expected Status)
func (*OutputGameHelper) WaitForInactivity ¶ added in v1.4.2
func (g *OutputGameHelper) WaitForInactivity(ctx context.Context, numInactiveBlocks int, untilGameEnds bool)
func (*OutputGameHelper) WaitForNewClaim ¶ added in v1.4.2
func (*OutputGameHelper) WaitForNoAvailableCredit ¶ added in v1.7.2
func (g *OutputGameHelper) WaitForNoAvailableCredit(ctx context.Context, addr common.Address)
func (*OutputGameHelper) WethBalance ¶ added in v1.7.2
type OutputHonestHelper ¶ added in v1.4.2
type OutputHonestHelper struct {
// contains filtered or unexported fields
}
func (*OutputHonestHelper) Attack ¶ added in v1.4.2
func (h *OutputHonestHelper) Attack(ctx context.Context, claimIdx int64, opts ...MoveOpt)
func (*OutputHonestHelper) AttackClaim ¶ added in v1.4.3
func (h *OutputHonestHelper) AttackClaim(ctx context.Context, claim *ClaimHelper, opts ...MoveOpt) *ClaimHelper
func (*OutputHonestHelper) CounterClaim ¶ added in v1.7.2
func (h *OutputHonestHelper) CounterClaim(ctx context.Context, claim *ClaimHelper, opts ...MoveOpt) *ClaimHelper
func (*OutputHonestHelper) Defend ¶ added in v1.4.2
func (h *OutputHonestHelper) Defend(ctx context.Context, claimIdx int64, opts ...MoveOpt)
func (*OutputHonestHelper) DefendClaim ¶ added in v1.4.3
func (h *OutputHonestHelper) DefendClaim(ctx context.Context, claim *ClaimHelper, opts ...MoveOpt) *ClaimHelper
func (*OutputHonestHelper) StepClaimFails ¶ added in v1.4.3
func (h *OutputHonestHelper) StepClaimFails(ctx context.Context, claim *ClaimHelper, isAttack bool)
type PreimageLoadCheck ¶ added in v1.5.1
type PreimageLoadCheck func(types.TraceProvider, uint64) error