Documentation ¶
Index ¶
- Variables
- type AlphabetGameHelper
- func (g *AlphabetGameHelper) CreateDishonestHelper(alphabetTrace string, depth uint64, defender bool) *DishonestHelper
- func (g *AlphabetGameHelper) CreateHonestActor(alphabetTrace string, depth uint64) *HonestHelper
- func (g *AlphabetGameHelper) StartChallenger(ctx context.Context, l1Endpoint string, name string, ...) *challenger.Helper
- type CannonGameHelper
- type ContractClaim
- type DishonestHelper
- func (t *DishonestHelper) Attack(ctx context.Context, claimIndex int64)
- func (t *DishonestHelper) AttackCorrect(ctx context.Context, claimIndex int64)
- func (t *DishonestHelper) Defend(ctx context.Context, claimIndex int64)
- func (t *DishonestHelper) DefendCorrect(ctx context.Context, claimIndex int64)
- func (d *DishonestHelper) ExhaustDishonestClaims(ctx context.Context)
- type ErrWithData
- type FactoryHelper
- func (h *FactoryHelper) StartAlphabetGame(ctx context.Context, claimedAlphabet string) *AlphabetGameHelper
- func (h *FactoryHelper) StartCannonGame(ctx context.Context, rootClaim common.Hash) *CannonGameHelper
- func (h *FactoryHelper) StartCannonGameWithCorrectRoot(ctx context.Context, rollupCfg *rollup.Config, l2Genesis *core.Genesis, ...) (*CannonGameHelper, *HonestHelper)
- func (h *FactoryHelper) StartChallenger(ctx context.Context, l1Endpoint string, name string, ...) *challenger.Helper
- func (h *FactoryHelper) StartOutputCannonGame(ctx context.Context, rollupEndpoint string, rootClaim common.Hash) *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 Mover, attemptStep Stepper)
- func (g *FaultGameHelper) Defend(ctx context.Context, claimIdx int64, claim common.Hash)
- func (g *FaultGameHelper) DefendRootClaim(ctx context.Context, performMove Mover)
- 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) int64
- 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 int)
- 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 HonestHelper
- type Mover
- type OutputCannonGameHelper
- type Status
- type Stepper
Constants ¶
This section is empty.
Variables ¶
var CorrectAlphabet = "abcdefghijklmnop"
Functions ¶
This section is empty.
Types ¶
type AlphabetGameHelper ¶
type AlphabetGameHelper struct { FaultGameHelper // contains filtered or unexported fields }
func (*AlphabetGameHelper) CreateDishonestHelper ¶
func (g *AlphabetGameHelper) CreateDishonestHelper(alphabetTrace string, depth uint64, defender bool) *DishonestHelper
func (*AlphabetGameHelper) CreateHonestActor ¶
func (g *AlphabetGameHelper) CreateHonestActor(alphabetTrace string, depth uint64) *HonestHelper
func (*AlphabetGameHelper) StartChallenger ¶
func (g *AlphabetGameHelper) StartChallenger(ctx context.Context, l1Endpoint string, name string, options ...challenger.Option) *challenger.Helper
type CannonGameHelper ¶
type CannonGameHelper struct {
FaultGameHelper
}
func (*CannonGameHelper) CreateHonestActor ¶
func (g *CannonGameHelper) CreateHonestActor(ctx context.Context, rollupCfg *rollup.Config, l2Genesis *core.Genesis, l1Client *ethclient.Client, l1Endpoint string, l2Endpoint string, options ...challenger.Option) *HonestHelper
func (*CannonGameHelper) StartChallenger ¶
func (g *CannonGameHelper) StartChallenger(ctx context.Context, rollupCfg *rollup.Config, l2Genesis *core.Genesis, l1Endpoint string, l2Endpoint string, name string, options ...challenger.Option) *challenger.Helper
type ContractClaim ¶
type DishonestHelper ¶
type DishonestHelper struct { *FaultGameHelper *HonestHelper // contains filtered or unexported fields }
func (*DishonestHelper) Attack ¶
func (t *DishonestHelper) Attack(ctx context.Context, claimIndex int64)
func (*DishonestHelper) AttackCorrect ¶
func (t *DishonestHelper) AttackCorrect(ctx context.Context, claimIndex int64)
func (*DishonestHelper) Defend ¶
func (t *DishonestHelper) Defend(ctx context.Context, claimIndex int64)
func (*DishonestHelper) DefendCorrect ¶
func (t *DishonestHelper) DefendCorrect(ctx context.Context, claimIndex int64)
func (*DishonestHelper) ExhaustDishonestClaims ¶
func (d *DishonestHelper) ExhaustDishonestClaims(ctx context.Context)
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 ErrWithData ¶
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, deployments *genesis.L1Deployments, client *ethclient.Client) *FactoryHelper
func (*FactoryHelper) StartAlphabetGame ¶
func (h *FactoryHelper) StartAlphabetGame(ctx context.Context, claimedAlphabet string) *AlphabetGameHelper
func (*FactoryHelper) StartCannonGame ¶
func (h *FactoryHelper) StartCannonGame(ctx context.Context, rootClaim common.Hash) *CannonGameHelper
func (*FactoryHelper) StartCannonGameWithCorrectRoot ¶
func (h *FactoryHelper) StartCannonGameWithCorrectRoot(ctx context.Context, rollupCfg *rollup.Config, l2Genesis *core.Genesis, l1Endpoint string, l2Endpoint string, options ...challenger.Option) (*CannonGameHelper, *HonestHelper)
func (*FactoryHelper) StartChallenger ¶
func (h *FactoryHelper) StartChallenger(ctx context.Context, l1Endpoint string, name string, options ...challenger.Option) *challenger.Helper
func (*FactoryHelper) StartOutputCannonGame ¶
func (h *FactoryHelper) StartOutputCannonGame(ctx context.Context, rollupEndpoint string, rootClaim common.Hash) *OutputCannonGameHelper
type FaultGameHelper ¶
type FaultGameHelper struct {
// contains filtered or unexported fields
}
func (*FaultGameHelper) Addr ¶
func (g *FaultGameHelper) Addr() common.Address
func (*FaultGameHelper) ChallengeRootClaim ¶
func (g *FaultGameHelper) ChallengeRootClaim(ctx context.Context, performMove Mover, 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 bl-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 ¶
func (g *FaultGameHelper) DefendRootClaim(ctx context.Context, performMove Mover)
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 bl-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 ¶
func (g *FaultGameHelper) GameDuration(ctx context.Context) time.Duration
func (*FaultGameHelper) GetClaimPosition ¶
func (*FaultGameHelper) GetClaimValue ¶
func (*FaultGameHelper) LogGameData ¶
func (g *FaultGameHelper) LogGameData(ctx context.Context)
func (*FaultGameHelper) Resolve ¶
func (g *FaultGameHelper) Resolve(ctx context.Context)
func (*FaultGameHelper) ResolveClaim ¶
func (g *FaultGameHelper) ResolveClaim(ctx context.Context, claimIdx int64)
ResolveClaim resolves a single subgame
func (*FaultGameHelper) StepFails ¶
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 ¶
func (g *FaultGameHelper) WaitForAllClaimsCountered(ctx context.Context)
func (*FaultGameHelper) WaitForClaimAtDepth ¶
func (g *FaultGameHelper) WaitForClaimAtDepth(ctx context.Context, depth int)
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 ¶
func (g *FaultGameHelper) WaitForInactivity(ctx context.Context, numInactiveBlocks int, untilGameEnds bool)
func (*FaultGameHelper) WaitForNewClaim ¶
type HonestHelper ¶
type HonestHelper struct {
// contains filtered or unexported fields
}
type Mover ¶
type Mover func(parentClaimIdx int64)
Mover is a function that either attacks or defends the claim at parentClaimIdx
type OutputCannonGameHelper ¶
type OutputCannonGameHelper struct { FaultGameHelper // contains filtered or unexported fields }
func (*OutputCannonGameHelper) StartChallenger ¶
func (g *OutputCannonGameHelper) StartChallenger( ctx context.Context, rollupCfg *rollup.Config, l2Genesis *core.Genesis, rollupEndpoint string, l1Endpoint string, l2Endpoint string, name string, options ...challenger.Option, ) *challenger.Helper
func (*OutputCannonGameHelper) WaitForCorrectOutputRoot ¶
func (g *OutputCannonGameHelper) WaitForCorrectOutputRoot(ctx context.Context, claimIdx int64)