Documentation ¶
Index ¶
- Variables
- func NewAlphabetWithProofProvider(t *testing.T, startingL2BlockNumber *big.Int, maxDepth types.Depth, ...) *alphabetWithProofProvider
- type ClaimBuilder
- func (c *ClaimBuilder) AttackClaim(claim types.Claim, opts ...ClaimOpt) types.Claim
- func (c *ClaimBuilder) CorrectClaimAtPosition(pos types.Position) common.Hash
- func (c *ClaimBuilder) CorrectOracleData(idx *big.Int) *types.PreimageOracleData
- func (c *ClaimBuilder) CorrectPreState(idx *big.Int) []byte
- func (c *ClaimBuilder) CorrectProofData(idx *big.Int) []byte
- func (c *ClaimBuilder) CorrectTraceProvider() types.TraceProvider
- func (c *ClaimBuilder) CreateLeafClaim(traceIndex *big.Int, opts ...ClaimOpt) types.Claim
- func (c *ClaimBuilder) CreateRootClaim(opts ...ClaimOpt) types.Claim
- func (c *ClaimBuilder) DefendClaim(claim types.Claim, opts ...ClaimOpt) types.Claim
- func (c *ClaimBuilder) GameBuilder(rootOpts ...ClaimOpt) *GameBuilder
- func (c *ClaimBuilder) Seq(rootOpts ...ClaimOpt) *SequenceBuilder
- type ClaimOpt
- type GameBuilder
- type GameBuilderSeq
- func (s *GameBuilderSeq) Attack(opts ...ClaimOpt) *GameBuilderSeq
- func (s *GameBuilderSeq) Defend(opts ...ClaimOpt) *GameBuilderSeq
- func (s *GameBuilderSeq) ExpectAttack() *GameBuilderSeq
- func (s *GameBuilderSeq) ExpectDefend() *GameBuilderSeq
- func (s *GameBuilderSeq) ExpectStepAttack() *GameBuilderSeq
- func (s *GameBuilderSeq) ExpectStepDefend() *GameBuilderSeq
- func (g *GameBuilderSeq) IsMaxDepth() bool
- func (g *GameBuilderSeq) IsRoot() bool
- func (s *GameBuilderSeq) Step(opts ...ClaimOpt)
- type SequenceBuilder
Constants ¶
This section is empty.
Variables ¶
var DefaultClaimant = common.Address{0xba, 0xdb, 0xad, 0xba, 0xdb, 0xad}
Functions ¶
Types ¶
type ClaimBuilder ¶
type ClaimBuilder struct {
// contains filtered or unexported fields
}
ClaimBuilder is a test utility to enable creating claims in a wide range of situations
func NewAlphabetClaimBuilder ¶
func NewClaimBuilder ¶
func NewClaimBuilder(t *testing.T, maxDepth types.Depth, provider types.TraceProvider) *ClaimBuilder
NewClaimBuilder creates a new ClaimBuilder.
func (*ClaimBuilder) AttackClaim ¶
func (*ClaimBuilder) CorrectClaimAtPosition ¶
func (c *ClaimBuilder) CorrectClaimAtPosition(pos types.Position) common.Hash
CorrectClaimAtPosition returns the canonical claim at a specified position
func (*ClaimBuilder) CorrectOracleData ¶
func (c *ClaimBuilder) CorrectOracleData(idx *big.Int) *types.PreimageOracleData
func (*ClaimBuilder) CorrectPreState ¶
func (c *ClaimBuilder) CorrectPreState(idx *big.Int) []byte
CorrectPreState returns the pre-state (not hashed) required to execute the valid step at the specified trace index
func (*ClaimBuilder) CorrectProofData ¶
func (c *ClaimBuilder) CorrectProofData(idx *big.Int) []byte
CorrectProofData returns the proof-data required to execute the valid step at the specified trace index
func (*ClaimBuilder) CorrectTraceProvider ¶
func (c *ClaimBuilder) CorrectTraceProvider() types.TraceProvider
CorrectTraceProvider returns a types.TraceProvider that provides the canonical trace.
func (*ClaimBuilder) CreateLeafClaim ¶
func (*ClaimBuilder) CreateRootClaim ¶
func (c *ClaimBuilder) CreateRootClaim(opts ...ClaimOpt) types.Claim
func (*ClaimBuilder) DefendClaim ¶
func (*ClaimBuilder) GameBuilder ¶
func (c *ClaimBuilder) GameBuilder(rootOpts ...ClaimOpt) *GameBuilder
func (*ClaimBuilder) Seq ¶
func (c *ClaimBuilder) Seq(rootOpts ...ClaimOpt) *SequenceBuilder
Seq starts building a claim by following a sequence of attack and defend moves from the root The returned SequenceBuilder can be used to add additional moves. e.g: claim := Seq(true).Attack(false).Attack(true).Defend(true).Get()
type ClaimOpt ¶ added in v1.7.2
type ClaimOpt interface {
Apply(cfg *claimCfg)
}
func WithClaimant ¶ added in v1.7.2
func WithInvalidValue ¶ added in v1.7.2
func WithParent ¶ added in v1.7.2
type GameBuilder ¶
type GameBuilder struct { Game types.Game ExpectedActions []types.Action // contains filtered or unexported fields }
func NewGameBuilderFromGame ¶ added in v1.7.2
func NewGameBuilderFromGame(t *testing.T, provider types.TraceProvider, game types.Game) *GameBuilder
func (*GameBuilder) Seq ¶
func (g *GameBuilder) Seq() *GameBuilderSeq
func (*GameBuilder) SeqFrom ¶ added in v1.4.2
func (g *GameBuilder) SeqFrom(claim types.Claim) *GameBuilderSeq
type GameBuilderSeq ¶
type GameBuilderSeq struct {
// contains filtered or unexported fields
}
func (*GameBuilderSeq) Attack ¶
func (s *GameBuilderSeq) Attack(opts ...ClaimOpt) *GameBuilderSeq
func (*GameBuilderSeq) Defend ¶
func (s *GameBuilderSeq) Defend(opts ...ClaimOpt) *GameBuilderSeq
func (*GameBuilderSeq) ExpectAttack ¶
func (s *GameBuilderSeq) ExpectAttack() *GameBuilderSeq
func (*GameBuilderSeq) ExpectDefend ¶
func (s *GameBuilderSeq) ExpectDefend() *GameBuilderSeq
func (*GameBuilderSeq) ExpectStepAttack ¶
func (s *GameBuilderSeq) ExpectStepAttack() *GameBuilderSeq
func (*GameBuilderSeq) ExpectStepDefend ¶
func (s *GameBuilderSeq) ExpectStepDefend() *GameBuilderSeq
func (*GameBuilderSeq) IsMaxDepth ¶ added in v1.7.2
func (g *GameBuilderSeq) IsMaxDepth() bool
func (*GameBuilderSeq) IsRoot ¶ added in v1.7.2
func (g *GameBuilderSeq) IsRoot() bool
func (*GameBuilderSeq) Step ¶ added in v1.7.2
func (s *GameBuilderSeq) Step(opts ...ClaimOpt)
type SequenceBuilder ¶
type SequenceBuilder struct {
// contains filtered or unexported fields
}
func (*SequenceBuilder) Attack ¶
func (s *SequenceBuilder) Attack(opts ...ClaimOpt) *SequenceBuilder
func (*SequenceBuilder) Defend ¶
func (s *SequenceBuilder) Defend(opts ...ClaimOpt) *SequenceBuilder
func (*SequenceBuilder) Get ¶
func (s *SequenceBuilder) Get() types.Claim