Documentation
¶
Index ¶
- func Identifier(chain *Chain, tx *types.Transaction, rcpt *types.Receipt) inbox.Identifier
- func WithIdentifier(ident inbox.Identifier) func(opts *ExecuteOpts)
- func WithL1BlockCrossUnsafe() func(*AddL2BlockOpts)
- func WithL2BlockTransactions(mkTxs ...TransactionCreator) func(*AddL2BlockOpts)
- func WithL2BlocksUntilTimestamp(timestamp uint64) func(*AddL2BlockOpts)
- func WithPayload(payload []byte) func(opts *ExecuteOpts)
- type AddL2BlockOpts
- type AdvanceL1Opts
- type Chain
- type ChainOpts
- type DSLUser
- type EmitterContract
- type ExecuteOpts
- type GeneratedTransaction
- type InboxContract
- type InteropActors
- type InteropDSL
- func (d *InteropDSL) AddL2Block(chain *Chain, optionalArgs ...func(*AddL2BlockOpts))
- func (d *InteropDSL) AdvanceL1(optionalArgs ...func(*AdvanceL1Opts))
- func (d *InteropDSL) CreateUser() *DSLUser
- func (d *InteropDSL) ProcessCrossSafe(optionalArgs ...func(*ProcessCrossSafeOpts))
- func (d *InteropDSL) SubmitBatchData(optionalArgs ...func(*SubmitBatchDataOpts))
- type InteropSetup
- type OutputRootSource
- type Outputs
- func (d *Outputs) OptimisticBlockAtTimestamp(chain *Chain, timestamp uint64) types.OptimisticBlock
- func (d *Outputs) OutputRootAtTimestamp(chain *Chain, timestamp uint64) *eth.OutputResponse
- func (d *Outputs) SuperRoot(timestamp uint64) eth.Super
- func (d *Outputs) TransitionState(timestamp uint64, step uint64, pendingProgress ...types.OptimisticBlock) *types.TransitionState
- type ProcessCrossSafeOpts
- type SubmitBatchDataOpts
- type SuperRootSource
- type SupervisorActor
- type TransactionCreator
- type TxIncluder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Identifier ¶
func Identifier(chain *Chain, tx *types.Transaction, rcpt *types.Receipt) inbox.Identifier
func WithIdentifier ¶
func WithIdentifier(ident inbox.Identifier) func(opts *ExecuteOpts)
func WithL1BlockCrossUnsafe ¶
func WithL1BlockCrossUnsafe() func(*AddL2BlockOpts)
func WithL2BlockTransactions ¶
func WithL2BlockTransactions(mkTxs ...TransactionCreator) func(*AddL2BlockOpts)
func WithL2BlocksUntilTimestamp ¶
func WithL2BlocksUntilTimestamp(timestamp uint64) func(*AddL2BlockOpts)
func WithPayload ¶
func WithPayload(payload []byte) func(opts *ExecuteOpts)
Types ¶
type AddL2BlockOpts ¶
type AddL2BlockOpts struct {
BlockIsNotCrossUnsafe bool
TransactionCreators []TransactionCreator
UntilTimestamp uint64
}
type AdvanceL1Opts ¶
type Chain ¶
type Chain struct {
ChainID eth.ChainID
RollupCfg *rollup.Config
L2Genesis *core.Genesis
BatcherAddr common.Address
Sequencer *helpers.L2Sequencer
SequencerEngine *helpers.L2Engine
Batcher *helpers.L2Batcher
}
Chain holds the most common per-chain action-test data and actors
type DSLUser ¶
type DSLUser struct {
// contains filtered or unexported fields
}
func (*DSLUser) TransactOpts ¶
type EmitterContract ¶
type EmitterContract struct {
EmittedMessages []*GeneratedTransaction
// contains filtered or unexported fields
}
func NewEmitterContract ¶
func NewEmitterContract(t helpers.Testing) *EmitterContract
func (*EmitterContract) Deploy ¶
func (c *EmitterContract) Deploy(user *DSLUser) TransactionCreator
func (*EmitterContract) EmitMessage ¶
func (c *EmitterContract) EmitMessage(user *DSLUser, message string) TransactionCreator
func (*EmitterContract) LastEmittedMessage ¶
func (c *EmitterContract) LastEmittedMessage() *GeneratedTransaction
type ExecuteOpts ¶
type ExecuteOpts struct {
Identifier *inbox.Identifier
Payload *[]byte
}
type GeneratedTransaction ¶
type GeneratedTransaction struct {
// contains filtered or unexported fields
}
func NewGeneratedTransaction ¶
func NewGeneratedTransaction(t helpers.Testing, chain *Chain, tx *types.Transaction, from common.Address) *GeneratedTransaction
func (*GeneratedTransaction) CheckIncluded ¶
func (m *GeneratedTransaction) CheckIncluded()
func (*GeneratedTransaction) CheckNotIncluded ¶
func (m *GeneratedTransaction) CheckNotIncluded()
func (*GeneratedTransaction) Identifier ¶
func (m *GeneratedTransaction) Identifier() inbox.Identifier
func (*GeneratedTransaction) Include ¶
func (m *GeneratedTransaction) Include()
func (*GeneratedTransaction) MessagePayload ¶
func (m *GeneratedTransaction) MessagePayload() []byte
type InboxContract ¶
type InboxContract struct {
Transactions []*GeneratedTransaction
// contains filtered or unexported fields
}
func NewInboxContract ¶
func NewInboxContract(t helpers.Testing) *InboxContract
func (*InboxContract) Execute ¶
func (i *InboxContract) Execute(user *DSLUser, initTx *GeneratedTransaction, args ...func(opts *ExecuteOpts)) TransactionCreator
func (*InboxContract) LastTransaction ¶
func (i *InboxContract) LastTransaction() *GeneratedTransaction
type InteropActors ¶
type InteropActors struct {
L1Miner *helpers.L1Miner
Supervisor *SupervisorActor
ChainA *Chain
ChainB *Chain
}
InteropActors holds a bundle of global actors and actors of 2 chains.
type InteropDSL ¶
type InteropDSL struct {
Actors *InteropActors
Outputs *Outputs
InboxContract *InboxContract
// contains filtered or unexported fields
}
InteropDSL provides a high-level API to drive interop action tests so that the actual test reads more declaratively and is separated from the details of how each action is actually executed. DSL methods will typically:
- Check (and if needed, wait) for any required preconditions
- Perform the action, allowing components to fully process the effects of it
- Assert that the action completed. These are intended to be a sanity check to ensure tests fail fast if something doesn't work as expected. Options may be provided to perform more detailed or specific assertions
Optional inputs can be used to control lower level details of the operation. While it is also possible to directly access the Actors and low level actions, this should only be required when specifically testing low level details of that functionality. It is generally preferable to use optional inputs to the DSL methods to achieve the desired result rather than having to use the low level APIs directly.
Methods may also be provided specifically to verify some state. Methods may return some data from the system (e.g. OutputRootAtTimestamp) but it is generally preferred to provide an assertion method rather than a getter where that is viable. Assertion methods allow the DSL to provide more helpful information in failure messages and ensure the comparison is done correctly and consistently across tests rather than duplicating the assertion code in many tests.
Required inputs to methods are specified as normal parameters, so type checking enforces their presence. Optional inputs to methods are specified by a config struct and accept a vararg of functions that can update that struct. This is roughly inline with the typical opts pattern in Golang but with significantly reduced boilerplate code since so many methods wil define their own config. With* methods are only provided for the most common optional args and tests will normally supply a custom function that sets all the optional values they need at once. Common options can be extracted to a reusable struct (e.g. ChainOpts above) which may expose helper methods to aid test readability and reduce boilerplate.
func NewInteropDSL ¶
func NewInteropDSL(t helpers.Testing) *InteropDSL
func (*InteropDSL) AddL2Block ¶
func (d *InteropDSL) AddL2Block(chain *Chain, optionalArgs ...func(*AddL2BlockOpts))
AddL2Block adds a new unsafe block to the specified chain and fully processes it in the supervisor
func (*InteropDSL) AdvanceL1 ¶
func (d *InteropDSL) AdvanceL1(optionalArgs ...func(*AdvanceL1Opts))
AdvanceL1 adds a new L1 block with the specified transactions and ensures it is processed by the specified chains and the supervisor.
func (*InteropDSL) CreateUser ¶
func (d *InteropDSL) CreateUser() *DSLUser
func (*InteropDSL) ProcessCrossSafe ¶
func (d *InteropDSL) ProcessCrossSafe(optionalArgs ...func(*ProcessCrossSafeOpts))
ProcessCrossSafe processes evens in the supervisor and nodes to ensure the cross-safe head is fully updated.
func (*InteropDSL) SubmitBatchData ¶
func (d *InteropDSL) SubmitBatchData(optionalArgs ...func(*SubmitBatchDataOpts))
SubmitBatchData submits batch data to L1 and processes the new L1 blocks, advancing the safe heads. By default, submits all batch data for all chains.
type InteropSetup ¶
type InteropSetup struct {
Log log.Logger
Deployment *interopgen.WorldDeployment
Out *interopgen.WorldOutput
DepSet *depset.StaticConfigDependencySet
Keys devkeys.Keys
T helpers.Testing
}
InteropSetup holds the chain deployment and config contents, before instantiating any services.
func SetupInterop ¶
func SetupInterop(t helpers.Testing) *InteropSetup
SetupInterop creates an InteropSetup to instantiate actors on, with 2 L2 chains.
func (*InteropSetup) CreateActors ¶
func (is *InteropSetup) CreateActors() *InteropActors
type OutputRootSource ¶
type Outputs ¶
type Outputs struct {
// contains filtered or unexported fields
}
func (*Outputs) OptimisticBlockAtTimestamp ¶
func (d *Outputs) OptimisticBlockAtTimestamp(chain *Chain, timestamp uint64) types.OptimisticBlock
func (*Outputs) OutputRootAtTimestamp ¶
func (d *Outputs) OutputRootAtTimestamp(chain *Chain, timestamp uint64) *eth.OutputResponse
func (*Outputs) TransitionState ¶
func (d *Outputs) TransitionState(timestamp uint64, step uint64, pendingProgress ...types.OptimisticBlock) *types.TransitionState
type ProcessCrossSafeOpts ¶
type ProcessCrossSafeOpts struct {
ChainOpts
}
type SubmitBatchDataOpts ¶
type SuperRootSource ¶
type SuperRootSource struct {
// contains filtered or unexported fields
}
SuperRootSource is a testing helper to create a Super Root from a set of rollup clients
func NewSuperRootSource ¶
func NewSuperRootSource(ctx context.Context, sources ...OutputRootSource) (*SuperRootSource, error)
func (*SuperRootSource) CreateSuperRoot ¶
type SupervisorActor ¶
type SupervisorActor struct {
sources.SupervisorClient
// contains filtered or unexported fields
}
SupervisorActor represents a supervisor, instrumented to run synchronously for action-test purposes.
func NewSupervisor ¶
func NewSupervisor(t helpers.Testing, logger log.Logger, depSet depset.DependencySetSource) *SupervisorActor
NewSupervisor creates a new SupervisorActor, to action-test the supervisor with.
func (*SupervisorActor) ProcessFull ¶
func (sa *SupervisorActor) ProcessFull(t helpers.Testing)
func (*SupervisorActor) SignalFinalizedL1 ¶
func (sa *SupervisorActor) SignalFinalizedL1(t helpers.Testing)
func (*SupervisorActor) SignalLatestL1 ¶
func (sa *SupervisorActor) SignalLatestL1(t helpers.Testing)
type TransactionCreator ¶
type TransactionCreator func(chain *Chain) *GeneratedTransaction