Documentation
¶
Overview ¶
Package dsl provides DSL (domain specific language) to interact with a devstack system.
Each component in the devstack has a DSL wrapper. The wrapper itself does not have any state, and may be recreated or shallow-copied.
Each DSL wrapper provides an Escape method, in case the DSL is not sufficient for a given use-case. The Escape method is a temporary compromise to allow more incremental development of and migration to the DSL. It should be avoided whenever possible and will be removed in the future.
Index ¶
- Constants
- func CalculateFjordL1Cost(ctx context.Context, client apis.EthClient, ...) (*big.Int, error)
- func CheckAll(t devtest.T, checks ...CheckFunc)
- func CheckForChainFork(ctx context.Context, networks []*L2Network, logger log.Logger) (func(bool) error, error)
- func CreateUnsignedTransactionFromSigned(signedTx *types.Transaction) (*types.Transaction, error)
- func ErrorSelector(signature string) []byte
- func FindSignedTransactionFromReceipt(ctx context.Context, client apis.EthClient, receipt *types.Receipt) (*types.Transaction, error)
- func MakeInvalidBlockNumber(msg messages.Message) messages.Message
- func MakeInvalidChainID(msg messages.Message) messages.Message
- func MakeInvalidLogIndex(msg messages.Message) messages.Message
- func MakeInvalidOrigin(msg messages.Message) messages.Message
- func MakeInvalidPayloadHash(msg messages.Message) messages.Message
- func MakeInvalidTimestamp(msg messages.Message) messages.Message
- func PrecomputeExecEventMessage(referencedMsg messages.Message, execChainID eth.ChainID, ...) messages.Message
- func ReadGasPriceOracleL1FeeAt(ctx context.Context, client apis.EthClient, gpo *bindings.GasPriceOracle, ...) (*big.Int, error)
- func ReadGasPriceOracleL1FeeUpperBoundAt(ctx context.Context, client apis.EthClient, gpo *bindings.GasPriceOracle, ...) (*big.Int, error)
- func RunOperatorFeeTest(t devtest.T, l2Chain *L2Network, l1EL *L1ELNode, funderL1, funderL2 *FunderEOA)
- func SubmitExecForMessage(msg messages.Message, executor *EOA) *txplan.PlannedTx
- func ValidateL1FeeMatches(t devtest.T, calculatedFee, receiptFee *big.Int)
- func WithMinRequiredL2Block(blockNum uint64) func(opts *safeHeadDbMatchOpts)
- type AdvancedOption
- type AnchorStateRegistry
- type BlockRefResult
- type CallFrame
- type ChainBlockProvider
- type CheckFunc
- func InSyncFn(node1, node2 SyncStatusProvider, log log.Logger, ctx context.Context, ...) CheckFunc
- func LaggedFn(baseNode, refNode SyncStatusProvider, log log.Logger, ctx context.Context, ...) CheckFunc
- func MatchedFn(baseNode, refNode SyncStatusProvider, log log.Logger, ctx context.Context, ...) CheckFunc
- func MatchedWithProgressFn(baseNode, refNode SyncStatusProvider, log log.Logger, ctx context.Context, ...) CheckFunc
- type Conductor
- func (c *Conductor) AddServerAsNonvoter(id, addr string, version uint64) error
- func (c *Conductor) AddServerAsVoter(id, addr string, version uint64) error
- func (c *Conductor) AddVoterToCluster(target *Conductor)
- func (c *Conductor) AwaitNotLeader()
- func (c *Conductor) CallProxy(result any, method string, args ...any) error
- func (c *Conductor) Escape() stack.Conductor
- func (c *Conductor) FetchClusterMembership() *consensus.ClusterMembership
- func (c *Conductor) IsLeader() bool
- func (c *Conductor) LeaderOverridden() bool
- func (c *Conductor) OverrideLeader(override bool)
- func (c *Conductor) RemoveFromCluster(target *Conductor)
- func (c *Conductor) RemoveServer(id string, version uint64) error
- func (c *Conductor) Sequencer() *L2CLNode
- func (c *Conductor) Stop()
- func (c *Conductor) String() string
- func (c *Conductor) TransferLeadership(cluster ConductorSet) *Conductor
- type ConductorSet
- type Deposit
- type DepositEOA
- func (d *DepositEOA) DepositTx(to common.Address, calldata []byte, opts ...func(*DepositTxOpts)) *ethtypes.Receipt
- func (d *DepositEOA) DepositTxExpectRevert(to common.Address, calldata []byte, errorSignature string, ...) *ethtypes.Receipt
- func (d *DepositEOA) ExportUndeliveredMessage(exporter common.Address, sourceMessenger common.Address, m SentMessage, ...) (*types.Receipt, uint64)
- func (d *DepositEOA) SendInitMessage(trigger *txintent.InitTrigger) *InitMessage
- func (d *DepositEOA) SendRandomInitMessage(rng *rand.Rand, eventLoggerAddress common.Address) *InitMessage
- type DepositTxOpts
- type ELNode
- type EOA
- func (u *EOA) Address() common.Address
- func (u *EOA) ApproveToken(tokenAddr common.Address, spender common.Address, amount eth.ETH)
- func (u *EOA) AsEL(el ELNode) *EOA
- func (u *EOA) ChainID() eth.ChainID
- func (u *EOA) DeployEventLogger() common.Address
- func (u *EOA) DeployWETH() common.Address
- func (u *EOA) GetBalance() eth.ETH
- func (u *EOA) GetTokenBalance(tokenAddr common.Address) eth.ETH
- func (u *EOA) Key() *Key
- func (u *EOA) PendingNonce() uint64
- func (u *EOA) Plan() txplan.Option
- func (u *EOA) PlanAuth(code common.Address) txplan.Option
- func (u *EOA) PlanTransfer(to common.Address, amount eth.ETH) txplan.Option
- func (u *EOA) PrepareExecTx(initMsg *InitMessage) (rawTx []byte, txHash common.Hash)
- func (u *EOA) PrepareSameTimestampInit(rng *rand.Rand, eventLogger common.Address, expectedBlockNum uint64, ...) *SameTimestampPair
- func (u *EOA) SendExecMessage(initMsg *InitMessage, opts ...ExecMessageOpt) *ExecMessage
- func (u *EOA) SendInitMessage(trigger *txintent.InitTrigger) *InitMessage
- func (u *EOA) SendInvalidExecMessage(initMsg *InitMessage) *ExecMessage
- func (u *EOA) SendPackedExecMessages(dependOn *txintent.IntentTx[*txintent.MultiTrigger, *txintent.InteropOutput]) (*txintent.IntentTx[*txintent.MultiTrigger, *txintent.InteropOutput], ...)
- func (u *EOA) SendPackedRandomInitMessages(rng *rand.Rand, eventLoggerAddress common.Address) (*txintent.IntentTx[*txintent.MultiTrigger, *txintent.InteropOutput], ...)
- func (u *EOA) SendRandomInitMessage(rng *rand.Rand, eventLoggerAddress common.Address, topicCount, dataLen int) *InitMessage
- func (u *EOA) String() string
- func (u *EOA) Transact(opts ...txplan.Option) *txplan.PlannedTx
- func (u *EOA) Transfer(to common.Address, amount eth.ETH) *txplan.PlannedTx
- func (u *EOA) VerifyBalanceAtLeast(v eth.ETH)
- func (u *EOA) VerifyBalanceExact(v eth.ETH)
- func (u *EOA) VerifyBalanceLessThan(v eth.ETH)
- func (u *EOA) VerifyTokenBalance(tokenAddr common.Address, expectedBalance eth.ETH)
- func (u *EOA) ViaDepositTx(l1 *EOA, l2EL *L2ELNode, l2Net *L2Network) *DepositEOA
- func (u *EOA) WaitForBalance(v eth.ETH)
- func (u *EOA) WaitForBalanceAtLeast(v eth.ETH)
- func (u *EOA) WaitForTokenBalance(tokenAddr common.Address, expectedBalance eth.ETH)
- type ETHSend
- type EcotoneFees
- type EcotoneFeesValidationResult
- type ExecMessage
- type ExecMessageOpt
- type ExpireMessageCall
- type FjordFees
- type FjordFeesValidationResult
- type ForkchoiceUpdateResult
- func (r *ForkchoiceUpdateResult) IsForkchoiceUpdatedStatus(status eth.ExecutePayloadStatus) *ForkchoiceUpdateResult
- func (r *ForkchoiceUpdateResult) IsSyncing() *ForkchoiceUpdateResult
- func (r *ForkchoiceUpdateResult) IsValid() *ForkchoiceUpdateResult
- func (r *ForkchoiceUpdateResult) ResultAllSyncing()
- func (r *ForkchoiceUpdateResult) Retry(attempts int) *ForkchoiceUpdateResult
- func (r *ForkchoiceUpdateResult) WaitUntilValid(attempts int) *ForkchoiceUpdateResult
- type FunderEOA
- func (f *FunderEOA) Address() common.Address
- func (f *FunderEOA) AsFunder(el ELNode) *FunderEOA
- func (f *FunderEOA) ChainID() eth.ChainID
- func (f *FunderEOA) Fund(to *EOA, amount eth.ETH) eth.ETH
- func (f *FunderEOA) FundAtLeast(to *EOA, amount eth.ETH) eth.ETH
- func (f *FunderEOA) NewFundedEOA(amount eth.ETH) *EOA
- func (f *FunderEOA) NewFundedEOAs(count int, amount eth.ETH) []*EOA
- func (f *FunderEOA) String() string
- type HDWallet
- type HeaderProvider
- type InitMessage
- type InvalidMsgFn
- type Key
- type L1CLNode
- type L1ELNode
- func (el *L1ELNode) AdvanceTime(timeTravel *clock.AdvancingClock, amount time.Duration)
- func (el L1ELNode) AwaitTime(ctx context.Context, timestamp uint64) error
- func (el *L1ELNode) BlockRefByLabel(label eth.BlockLabel) eth.L1BlockRef
- func (el *L1ELNode) BlockRefByNumber(number uint64) eth.L1BlockRef
- func (el L1ELNode) ChainID() eth.ChainID
- func (el *L1ELNode) Escape() stack.L1ELNode
- func (el *L1ELNode) EstimateBlockTime() time.Duration
- func (el *L1ELNode) EthClient() apis.EthClient
- func (el L1ELNode) IsCanonical(ref eth.BlockID) bool
- func (el *L1ELNode) ReorgTriggered(target eth.L1BlockRef, attempts int)
- func (el *L1ELNode) ReorgTriggeredFn(target eth.L1BlockRef, attempts int) CheckFunc
- func (el *L1ELNode) String() string
- func (el *L1ELNode) TransactionTimeout() time.Duration
- func (el L1ELNode) WaitForBlock() eth.BlockRef
- func (el L1ELNode) WaitForBlockNumber(targetBlock uint64) eth.BlockInfo
- func (el L1ELNode) WaitForFinalization() eth.BlockRef
- func (el L1ELNode) WaitForLabel(label eth.BlockLabel, predicate func(eth.BlockInfo) (bool, error)) eth.BlockInfo
- func (el L1ELNode) WaitForLabelRef(label eth.BlockLabel, predicate func(eth.BlockInfo) (bool, error)) eth.BlockRef
- func (el L1ELNode) WaitForOnline()
- func (el L1ELNode) WaitForTime(timestamp uint64) eth.BlockRef
- func (el L1ELNode) WaitForUnsafe(predicate func(eth.BlockInfo) (bool, error)) eth.BlockInfo
- func (el L1ELNode) WaitForUnsafeRef(predicate func(eth.BlockInfo) (bool, error)) eth.BlockRef
- type L1Network
- func (n *L1Network) ChainID() eth.ChainID
- func (n *L1Network) Escape() stack.L1Network
- func (n *L1Network) PrimaryCL() *L1CLNode
- func (n *L1Network) PrimaryEL() *L1ELNode
- func (n *L1Network) PrintChain()
- func (n *L1Network) String() string
- func (n *L1Network) WaitForBlock() eth.BlockRef
- func (n *L1Network) WaitForFinalization() eth.BlockRef
- func (n *L1Network) WaitForOnline()
- type L2Batcher
- type L2CLNode
- func (cl *L2CLNode) Advanced(lvl safety.Level, delta uint64, attempts int)
- func (cl *L2CLNode) AdvancedFn(lvl safety.Level, delta uint64, attempts int) CheckFunc
- func (cl *L2CLNode) AdvancedUnsafe(delta uint64, attempts int)
- func (cl *L2CLNode) AllHeadsAdvancedFn() CheckFunc
- func (cl *L2CLNode) AllHeadsReachedFn(snap SafetyHeads) CheckFunc
- func (cl *L2CLNode) AppendUnsafePayloadUntilTip(verEL, seqEL *L2ELNode, maxAttempts int)
- func (cl *L2CLNode) AwaitMinL1Processed(minL1 uint64)
- func (cl *L2CLNode) AwaitSequencerActive()
- func (cl *L2CLNode) AwaitSequencerInactive()
- func (cl *L2CLNode) ChainBlockID(chainID eth.ChainID, number uint64) (eth.BlockID, error)
- func (cl *L2CLNode) ChainID() eth.ChainID
- func (cl *L2CLNode) ChainSyncStatus(chainID eth.ChainID, lvl safety.Level) eth.BlockID
- func (cl *L2CLNode) ConnectPeer(peer *L2CLNode)
- func (cl *L2CLNode) CurrentL1MatchedFn(refNode *L2CLNode, attempts int) CheckFunc
- func (cl *L2CLNode) DisconnectPeer(peer *L2CLNode)
- func (cl *L2CLNode) Escape() stack.L2CLNode
- func (cl *L2CLNode) HeadBlockRef(lvl safety.Level) eth.L2BlockRef
- func (cl *L2CLNode) InSync(other SyncStatusProvider, lvl safety.Level, attempts int)
- func (cl *L2CLNode) InSyncFn(other SyncStatusProvider, lvl safety.Level, attempts int) CheckFunc
- func (cl *L2CLNode) IsP2PConnected(peer *L2CLNode)
- func (cl *L2CLNode) Lagged(refNode SyncStatusProvider, lvl safety.Level, attempts int, allowMatch bool)
- func (cl *L2CLNode) LaggedFn(refNode SyncStatusProvider, lvl safety.Level, attempts int, allowMatch bool) CheckFunc
- func (cl *L2CLNode) LocalGameInputs(agreedBlock, claimBlock uint64) *utils.LocalGameInputs
- func (cl *L2CLNode) ManagePeer(peer *L2CLNode)
- func (cl *L2CLNode) Matched(refNode SyncStatusProvider, lvl safety.Level, attempts int)
- func (cl *L2CLNode) MatchedFn(refNode SyncStatusProvider, lvl safety.Level, attempts int) CheckFunc
- func (cl *L2CLNode) MatchedUnsafe(refNode SyncStatusProvider, attempts int)
- func (cl *L2CLNode) MatchedWithProgressFn(refNode SyncStatusProvider, matchLvl, progressLvl safety.Level, ...) CheckFunc
- func (cl *L2CLNode) Name() string
- func (cl *L2CLNode) NotAdvanced(lvl safety.Level, attempts int)
- func (cl *L2CLNode) NotAdvancedFn(lvl safety.Level, attempts int) CheckFunc
- func (cl *L2CLNode) NotAdvancedUnsafe(attempts int)
- func (cl *L2CLNode) OutputAtBlock(blockNumber uint64) *eth.OutputResponse
- func (cl *L2CLNode) OverrideLeader()
- func (cl *L2CLNode) PeerInfo() *apis.PeerInfo
- func (cl *L2CLNode) Peers() *apis.PeerDump
- func (cl *L2CLNode) PostUnsafePayload(payload *eth.ExecutionPayloadEnvelope)
- func (cl *L2CLNode) Reached(lvl safety.Level, target uint64, attempts int)
- func (cl *L2CLNode) ReachedFn(lvl safety.Level, target uint64, attempts int) CheckFunc
- func (cl *L2CLNode) ReachedRef(lvl safety.Level, target eth.BlockID, attempts int)
- func (cl *L2CLNode) ReachedRefFn(lvl safety.Level, target eth.BlockID, attempts int) CheckFunc
- func (cl *L2CLNode) ReachedTimeWithoutRegressionFn(lvl safety.Level, targetTime uint64) CheckFunc
- func (cl *L2CLNode) ReachedUnsafe(target uint64, attempts int)
- func (cl *L2CLNode) ReachedWithProgressFn(lvl, progressLvl safety.Level, target uint64, ...) CheckFunc
- func (cl *L2CLNode) Reset(lvl safety.Level, target eth.L2BlockRef)
- func (cl *L2CLNode) Rewinded(lvl safety.Level, delta uint64, attempts int)
- func (cl *L2CLNode) RewindedFn(lvl safety.Level, delta uint64, attempts int) CheckFunc
- func (cl *L2CLNode) SafeHead() *BlockRefResult
- func (cl *L2CLNode) SafeHeadAtL1Block(l1BlockNum uint64) (*eth.SafeHeadResponse, error)
- func (cl *L2CLNode) SafeHeadDBFloor() uint64
- func (cl *L2CLNode) SafeL2BlockRef() eth.L2BlockRef
- func (cl *L2CLNode) SafetyHeads() SafetyHeads
- func (cl *L2CLNode) SequencerActive() bool
- func (cl *L2CLNode) SetSequencerRecoverMode(b bool) error
- func (cl *L2CLNode) SignalTarget(refNode *L2ELNode, targetNum uint64)
- func (cl *L2CLNode) Start()
- func (cl *L2CLNode) StartSequencer()
- func (cl *L2CLNode) StartSequencerAt(head common.Hash) error
- func (cl *L2CLNode) Stop()
- func (cl *L2CLNode) StopSequencer() common.Hash
- func (cl *L2CLNode) String() string
- func (cl *L2CLNode) SyncStatus() *eth.SyncStatus
- func (cl *L2CLNode) UnsafeHead() *BlockRefResult
- func (cl *L2CLNode) VerifySafeHeadDatabaseMatches(sourceOfTruth *L2CLNode, args ...func(opts *safeHeadDbMatchOpts))
- func (cl *L2CLNode) WaitForNonZeroUnsafeTime(ctx context.Context) *eth.SyncStatus
- func (cl *L2CLNode) WaitForPeerDisconnected(peer *L2CLNode)
- func (cl *L2CLNode) WaitForStall(lvl safety.Level)
- func (cl *L2CLNode) WatchForReset() *ResetWatch
- type L2Challenger
- type L2ELNode
- func (el *L2ELNode) Advanced(label eth.BlockLabel, block uint64)
- func (el *L2ELNode) AdvancedFn(label eth.BlockLabel, block uint64, opts ...AdvancedOption) CheckFunc
- func (el *L2ELNode) AssertExecMessageNotInBlock(execMessage *ExecMessage)
- func (el *L2ELNode) AssertTxInBlock(blockNumber uint64, txHash common.Hash)
- func (el *L2ELNode) AssertTxNotInBlock(blockNumber uint64, txHash common.Hash)
- func (el L2ELNode) AwaitTime(ctx context.Context, timestamp uint64) error
- func (el *L2ELNode) BlockRefByHash(hash common.Hash) eth.L2BlockRef
- func (el *L2ELNode) BlockRefByLabel(label eth.BlockLabel) eth.L2BlockRef
- func (el *L2ELNode) BlockRefByNumber(num uint64) eth.L2BlockRef
- func (el *L2ELNode) ChainBlockID(chainID eth.ChainID, number uint64) (eth.BlockID, error)
- func (el L2ELNode) ChainID() eth.ChainID
- func (el *L2ELNode) ChainSyncStatus(chainID eth.ChainID, lvl safety.Level) eth.BlockID
- func (el *L2ELNode) DisconnectPeerWith(peer *L2ELNode)
- func (el *L2ELNode) Escape() stack.L2ELNode
- func (el *L2ELNode) EthClient() apis.EthClient
- func (el *L2ELNode) ExpireMessageCall(txHash common.Hash) ExpireMessageCall
- func (el *L2ELNode) FinalizedHead() *BlockRefResult
- func (el *L2ELNode) FinishedELSync(refNode *L2ELNode, unsafe, safe, finalized uint64)
- func (el *L2ELNode) ForkchoiceUpdate(refNode *L2ELNode, unsafe, safe, finalized uint64, attr *eth.PayloadAttributes) *ForkchoiceUpdateResult
- func (el *L2ELNode) ForkchoiceUpdateRaw(unsafe, safe, finalized common.Hash, attr *eth.PayloadAttributes) *ForkchoiceUpdateResult
- func (el *L2ELNode) GasLimitAtBlock(num uint64) uint64
- func (el *L2ELNode) InSync(other SyncStatusProvider, lvl safety.Level, attempts int)
- func (el *L2ELNode) InSyncFn(other SyncStatusProvider, lvl safety.Level, attempts int) CheckFunc
- func (el L2ELNode) IsCanonical(ref eth.BlockID) bool
- func (el *L2ELNode) KeptAdvancing(label eth.BlockLabel, observeFor time.Duration, maxGap time.Duration)
- func (el *L2ELNode) KeptAdvancingFn(label eth.BlockLabel, observeFor time.Duration, maxGap time.Duration) CheckFunc
- func (el *L2ELNode) L1OriginReachedFn(label eth.BlockLabel, l1OriginTarget uint64, attempts int) CheckFunc
- func (el *L2ELNode) L2ToL2CrossDomainMessenger() bindings.L2ToL2CrossDomainMessenger
- func (el *L2ELNode) Matched(refNode SyncStatusProvider, lvl safety.Level, attempts int)
- func (el *L2ELNode) MatchedFn(refNode SyncStatusProvider, lvl safety.Level, attempts int) CheckFunc
- func (el *L2ELNode) MatchedUnsafe(refNode SyncStatusProvider, attempts int)
- func (el *L2ELNode) NewPayload(refNode *L2ELNode, number uint64) *NewPayloadResult
- func (el *L2ELNode) NewPayloadRaw(payload *eth.ExecutionPayloadEnvelope) *NewPayloadResult
- func (el *L2ELNode) NotAdvanced(label eth.BlockLabel, attempts int)
- func (el *L2ELNode) NotAdvancedFn(label eth.BlockLabel, attempts int) CheckFunc
- func (el *L2ELNode) NotAdvancedUnsafe(attempts int)
- func (el *L2ELNode) PayloadByNumber(number uint64) *eth.ExecutionPayloadEnvelope
- func (el *L2ELNode) PeerWith(peer *L2ELNode)
- func (el *L2ELNode) Reached(label eth.BlockLabel, block uint64, attempts int)
- func (el *L2ELNode) ReachedFn(label eth.BlockLabel, target uint64, attempts int) CheckFunc
- func (el *L2ELNode) ReachedWithProgressFn(label, progressLabel eth.BlockLabel, target uint64, ...) CheckFunc
- func (el *L2ELNode) ReorgExact(target eth.L2BlockRef, attempts int)
- func (el *L2ELNode) ReorgExactFn(target eth.L2BlockRef, attempts int) CheckFunc
- func (el *L2ELNode) ReorgTriggered(target eth.L2BlockRef, attempts int)
- func (el *L2ELNode) ReorgTriggeredFn(target eth.L2BlockRef, attempts int) CheckFunc
- func (el *L2ELNode) ResendUntilSafe(makeTx func() *txplan.PlannedTx, sendAttempts, pollPerAttempt int) (uint64, common.Hash)
- func (el *L2ELNode) SafeHead() *BlockRefResult
- func (el *L2ELNode) Start()
- func (el *L2ELNode) Stop()
- func (el *L2ELNode) String() string
- func (el *L2ELNode) TraceCalls(txHash common.Hash) CallFrame
- func (el *L2ELNode) TransactionTimeout() time.Duration
- func (el *L2ELNode) UnsafeHead() *BlockRefResult
- func (el *L2ELNode) UserRPC() string
- func (el *L2ELNode) VerifyWithdrawalHashChangedIn(blockHash common.Hash)
- func (el L2ELNode) WaitForBlock() eth.BlockRef
- func (el L2ELNode) WaitForBlockNumber(targetBlock uint64) eth.BlockInfo
- func (el *L2ELNode) WaitForDeposit(portal common.Address, l1Receipt *types.Receipt) *types.Receipt
- func (el L2ELNode) WaitForFinalization() eth.BlockRef
- func (el *L2ELNode) WaitForGasUsed(label eth.BlockLabel, minGasUsed uint64, timeout time.Duration) eth.BlockInfo
- func (el L2ELNode) WaitForLabel(label eth.BlockLabel, predicate func(eth.BlockInfo) (bool, error)) eth.BlockInfo
- func (el L2ELNode) WaitForLabelRef(label eth.BlockLabel, predicate func(eth.BlockInfo) (bool, error)) eth.BlockRef
- func (el L2ELNode) WaitForOnline()
- func (el *L2ELNode) WaitForPendingNonceMatch(account common.Address, nonce uint64, attempts int, duration time.Duration)
- func (el *L2ELNode) WaitForPendingNonceMatchFn(account common.Address, nonce uint64, attempts int, duration time.Duration) CheckFunc
- func (el *L2ELNode) WaitForReceipt(txHash common.Hash) *types.Receipt
- func (el L2ELNode) WaitForTime(timestamp uint64) eth.BlockRef
- func (el L2ELNode) WaitForUnsafe(predicate func(eth.BlockInfo) (bool, error)) eth.BlockInfo
- func (el L2ELNode) WaitForUnsafeRef(predicate func(eth.BlockInfo) (bool, error)) eth.BlockRef
- func (el *L2ELNode) WaitL1OriginHash(label eth.BlockLabel, target eth.BlockID, attempts int)
- func (el *L2ELNode) WaitL1OriginReached(label eth.BlockLabel, l1OriginTarget uint64, attempts int)
- type L2Network
- func (n *L2Network) ArchiveEL() *L2ELNode
- func (n *L2Network) AwaitActivation(t devtest.T, forkName rollup.ForkName) eth.BlockID
- func (n *L2Network) CatchUpTo(o *L2Network)
- func (n *L2Network) ChainID() eth.ChainID
- func (n *L2Network) DepositContractAddr() common.Address
- func (n *L2Network) DeriveData(blocks int) (channels []derive.ChannelID, channelFrames map[derive.ChannelID][]derive.Frame, ...)
- func (n *L2Network) DeriveSpanBatches(blocks int) []*derive.SpanBatch
- func (n *L2Network) DisputeGameFactoryProxyAddr() common.Address
- func (n *L2Network) Escape() stack.L2Network
- func (n *L2Network) IsActivated(timestamp uint64) bool
- func (n *L2Network) IsForkActive(fork forks.Name) bool
- func (n *L2Network) IsForkActiveAt(forkName forks.Name, timestamp uint64) bool
- func (n *L2Network) L1CrossDomainMessengerAddr() common.Address
- func (n *L2Network) L2ELNodes() []*L2ELNode
- func (n *L2Network) LatestBlockBeforeTimestamp(t devtest.T, timestamp uint64) eth.BlockRef
- func (n *L2Network) PrimaryCL() *L2CLNode
- func (n *L2Network) PrimaryEL() *L2ELNode
- func (n *L2Network) PrimaryL1EL() *L1ELNode
- func (n *L2Network) PrintChain()
- func (n *L2Network) PublicRPC() *L2ELNode
- func (n *L2Network) String() string
- func (n *L2Network) TimestampForBlockNum(blockNum uint64) uint64
- func (n *L2Network) WaitForBatchTransaction(afterL1Block uint64) (*ethtypes.Transaction, eth.BlockInfo)
- func (n *L2Network) WaitForBlock() eth.BlockRef
- type L2Proposer
- type LagControlledSuperRootSource
- type MultiClient
- type NewPayloadResult
- type OperatorFee
- func (of *OperatorFee) CheckCompatibility() bool
- func (of *OperatorFee) GetSystemOwner() *EOA
- func (of *OperatorFee) RestoreOriginalConfig()
- func (of *OperatorFee) SetOperatorFee(scalar uint32, constant uint64)
- func (of *OperatorFee) ValidateTransactionFees(from *EOA, to *EOA, amount *big.Int, expectedScalar uint32, ...) OperatorFeeValidationResult
- func (of *OperatorFee) VerifyL2Config(expectedScalar uint32, expectedConstant uint64)
- func (of *OperatorFee) WaitForL2Sync(expectedScalar uint32, expectedConstant uint64)
- func (of *OperatorFee) WaitForL2SyncWithCurrentL1State()
- type OperatorFeeValidationResult
- type ProvenWithdrawalParameters
- type ResetWatch
- type SafetyHeads
- type SafetyHeadsAdvancement
- type SameTimestampPair
- type SentMessage
- type StandardBridge
- func (b *StandardBridge) CreateL2Token(l1TokenAddr common.Address, name string, symbol string, from *EOA) common.Address
- func (b *StandardBridge) Deposit(amount eth.ETH, from *EOA) Deposit
- func (b *StandardBridge) DisputeGameFinalityDelay() time.Duration
- func (b *StandardBridge) ERC20Deposit(l1TokenAddr common.Address, l2TokenAddr common.Address, amount eth.ETH, ...) *Deposit
- func (b *StandardBridge) GameResolutionDelay() time.Duration
- func (b *StandardBridge) InitiateWithdrawal(amount eth.ETH, from *EOA) *Withdrawal
- func (b *StandardBridge) PortalVersion() string
- func (b *StandardBridge) ProveWithFaultProofParams(user *EOA, params withdrawals.ProvenWithdrawalParameters) *types.Receipt
- func (b *StandardBridge) RespectedGameType() uint32
- func (b *StandardBridge) UsesSuperRoots() bool
- func (b *StandardBridge) VerifyRespectedGameType(expected gameTypes.GameType)
- func (b *StandardBridge) WithdrawalDelay() time.Duration
- func (b *StandardBridge) WithdrawalFromReceipt(rcpt *types.Receipt) *Withdrawal
- type SuperRootQuerier
- func (s *SuperRootQuerier) AssertSuperRootAtTimestamp(l2SequenceNumber uint64, rootClaim common.Hash)
- func (s *SuperRootQuerier) AwaitFullyProcessedL1(targetL1 uint64)
- func (s *SuperRootQuerier) AwaitOptimisticBlockAtTimestamp(chainID eth.ChainID, timestamp uint64) eth.OptimisticBlock
- func (s *SuperRootQuerier) AwaitValidatedTimestamp(timestamp uint64)
- func (s *SuperRootQuerier) QueryAPI() apis.SupernodeQueryAPI
- func (s *SuperRootQuerier) SuperRootAtTimestamp(timestamp uint64) eth.SuperRootAtTimestampResponse
- func (s *SuperRootQuerier) UserRPC() string
- type SuperRootSource
- type Supernode
- func (s *Supernode) ActivationTimestamp() uint64
- func (s *Supernode) AssertBackfillCovers(depth time.Duration, blockTime uint64, chains ...eth.ChainID)
- func (s *Supernode) AwaitBackfillAttempts(minAttempts int32)
- func (s *Supernode) AwaitBackfillCompleted()
- func (s *Supernode) AwaitFinalizationAdvanced() uint64
- func (s *Supernode) AwaitVerificationStartsAt(expected uint64)
- func (s *Supernode) BackfillAttempts() int32
- func (s *Supernode) ClientRPC() opclient.RPC
- func (s *Supernode) EnsureInteropPaused(pauseOffset uint64, clNodes ...*L2CLNode) uint64
- func (s *Supernode) Escape() stack.Supernode
- func (s *Supernode) ManageVN(vn *L2CLNode)
- func (s *Supernode) Name() string
- func (s *Supernode) PauseInterop(ts uint64)
- func (s *Supernode) RestartWithFreshDataDir()
- func (s *Supernode) ResumeInterop()
- func (s *Supernode) Start()
- func (s *Supernode) Stop()
- func (s *Supernode) String() string
- func (s *Supernode) SuperRootAt(timestamp uint64, expectedChainIDs ...eth.ChainID) eth.SuperRootAtTimestampResponse
- func (s *Supernode) UserRPC() string
- func (s *Supernode) VerificationStartTimestamp() uint64
- type SyncEOA
- type SyncStatusProvider
- type SyncTester
- func (s *SyncTester) ChainID(sessionID string) eth.ChainID
- func (s *SyncTester) DeleteSession(sessionID string)
- func (s *SyncTester) Escape() stack.SyncTester
- func (s *SyncTester) GetSession(sessionID string) *eth.SyncTesterSession
- func (s *SyncTester) ListSessions() []string
- func (s *SyncTester) ResetAllSessions()
- func (s *SyncTester) ResetSession(sessionID string)
- type TestSequencer
- func (s *TestSequencer) AdvanceToBlockParent(t devtest.T, network *L2Network, timestamp uint64) eth.L2BlockRef
- func (s *TestSequencer) BuildL1UntilSafeOriginPast(t devtest.T, l1ChainID eth.ChainID, l2EL *L2ELNode, startL1 uint64) eth.L2BlockRef
- func (s *TestSequencer) Escape() stack.TestSequencer
- func (s *TestSequencer) SequenceBlock(t devtest.T, chainID eth.ChainID, parent common.Hash)
- func (s *TestSequencer) SequenceBlockWithPlannedTxs(t devtest.T, parent common.Hash, sender *EOA, planned ...*txplan.PlannedTx)
- func (s *TestSequencer) SequenceBlockWithTxs(t devtest.T, chainID eth.ChainID, parent common.Hash, rawTxs [][]byte)
- func (s *TestSequencer) String() string
- type VaultBalances
- type WaitForDisputeGameResolvedOpts
- type Withdrawal
- func (w *Withdrawal) CheckFinalizable(prover *EOA) error
- func (w *Withdrawal) DisputeGameMaxClockDuration() time.Duration
- func (w *Withdrawal) FaultProofProveParams(advanceTime ...func(time.Duration)) withdrawals.ProvenWithdrawalParameters
- func (w *Withdrawal) Finalize(user *EOA)
- func (w *Withdrawal) FinalizeGasCost() eth.ETH
- func (w *Withdrawal) FinalizeReceipt() *types.Receipt
- func (w *Withdrawal) InitiateBlockHash() common.Hash
- func (w *Withdrawal) InitiateGasCost() eth.ETH
- func (w *Withdrawal) InitiateTxHash() common.Hash
- func (w *Withdrawal) Prove(user *EOA)
- func (w *Withdrawal) ProveAndFinalize(user *EOA, maxGameClock time.Duration)
- func (w *Withdrawal) ProveGasCost() eth.ETH
- func (w *Withdrawal) ProvenDisputeGameIndex() *big.Int
- func (w *Withdrawal) WaitForDisputeGameResolved(opts ...func(*WaitForDisputeGameResolvedOpts))
Constants ¶
const DefaultTimeout = 30 * time.Second
const (
SaltEnvVar = "DEVSTACK_KEYS_SALT"
)
Variables ¶
This section is empty.
Functions ¶
func CalculateFjordL1Cost ¶
func CalculateFjordL1Cost(ctx context.Context, client apis.EthClient, rollupCostData types.RollupCostData, blockHash common.Hash) (*big.Int, error)
CalculateFjordL1Cost calculates L1 cost using Fjord formula with block-specific L1 state
func CheckForChainFork ¶
func CheckForChainFork(ctx context.Context, networks []*L2Network, logger log.Logger) (func(bool) error, error)
CheckForChainFork checks that the L2 chain has not forked now, and returns a function that check again (to be called at the end of the test). An error is returned from this function (and the returned function) if a chain fork has been detected.
func CreateUnsignedTransactionFromSigned ¶
func CreateUnsignedTransactionFromSigned(signedTx *types.Transaction) (*types.Transaction, error)
CreateUnsignedTransactionFromSigned creates an unsigned transaction from a signed one
func ErrorSelector ¶ added in v1.19.10
ErrorSelector returns the 4-byte selector of a custom error signature, such as "CrossL2Inbox_NoExecutingDeposits()".
func FindSignedTransactionFromReceipt ¶
func FindSignedTransactionFromReceipt(ctx context.Context, client apis.EthClient, receipt *types.Receipt) (*types.Transaction, error)
FindSignedTransactionFromReceipt finds the signed transaction from a receipt and block
func MakeInvalidBlockNumber ¶
MakeInvalidBlockNumber returns a copy of the message with an incremented block number.
func MakeInvalidChainID ¶
MakeInvalidChainID returns a copy of the message with an incremented chain ID.
func MakeInvalidLogIndex ¶
MakeInvalidLogIndex returns a copy of the message with an incremented log index.
func MakeInvalidOrigin ¶
MakeInvalidOrigin returns a copy of the message with an incremented origin address.
func MakeInvalidPayloadHash ¶
MakeInvalidPayloadHash returns a copy of the message with an incremented payload hash.
func MakeInvalidTimestamp ¶
MakeInvalidTimestamp returns a copy of the message with an incremented timestamp.
func PrecomputeExecEventMessage ¶
func PrecomputeExecEventMessage( referencedMsg messages.Message, execChainID eth.ChainID, expectedBlockNum uint64, expectedLogIdx uint32, expectedTimestamp uint64, ) messages.Message
PrecomputeExecEventMessage computes the messages.Message that a CrossL2Inbox ExecutingMessage event will produce when executing the given referenced message. This allows precomputing exec-referencing-exec chains before any blocks are built.
func ReadGasPriceOracleL1FeeAt ¶
func ReadGasPriceOracleL1FeeAt(ctx context.Context, client apis.EthClient, gpo *bindings.GasPriceOracle, txUnsigned []byte, blockHash common.Hash) (*big.Int, error)
ReadGasPriceOracleL1FeeAt reads the L1 fee from GasPriceOracle for an unsigned transaction evaluated against a specific L2 block hash.
func ReadGasPriceOracleL1FeeUpperBoundAt ¶
func ReadGasPriceOracleL1FeeUpperBoundAt(ctx context.Context, client apis.EthClient, gpo *bindings.GasPriceOracle, txLen int, blockHash common.Hash) (*big.Int, error)
ReadGasPriceOracleL1FeeUpperBoundAt reads the L1 fee upper bound for a tx length pinned to a block hash.
func RunOperatorFeeTest ¶
func SubmitExecForMessage ¶
SubmitExecForMessage returns a planned exec transaction referencing the given message. Unlike SameTimestampPair.SubmitExecTo, this can reference any message including precomputed exec event messages for exec-referencing-exec chains.
See SubmitExecTo for why there is nothing to wait for.
func ValidateL1FeeMatches ¶
ValidateL1FeeMatches checks that the calculated L1 fee matches the actual receipt L1 fee
func WithMinRequiredL2Block ¶
func WithMinRequiredL2Block(blockNum uint64) func(opts *safeHeadDbMatchOpts)
Types ¶
type AdvancedOption ¶ added in v1.19.0
type AdvancedOption func(*advancedOpts)
AdvancedOption configures an AdvancedFn call.
func WithTimeout ¶ added in v1.19.0
func WithTimeout(attempts int) AdvancedOption
WithTimeout overrides AdvancedFn's default polling budget. The argument is the number of attempts; each attempt polls 2 seconds apart, so attempts*2 is the total wall-clock timeout.
type AnchorStateRegistry ¶ added in v1.19.5
type AnchorStateRegistry struct {
// contains filtered or unexported fields
}
func NewAnchorStateRegistry ¶ added in v1.19.5
func NewAnchorStateRegistry(t devtest.T, l2Network *L2Network, l1EL *L1ELNode) *AnchorStateRegistry
func (*AnchorStateRegistry) AnchorRoot ¶ added in v1.19.5
func (a *AnchorStateRegistry) AnchorRoot() (common.Hash, uint64)
func (*AnchorStateRegistry) WaitForAnchorRoot ¶ added in v1.19.5
func (a *AnchorStateRegistry) WaitForAnchorRoot(game interface { RootClaimValue() common.Hash L2SequenceNumber() uint64 })
func (*AnchorStateRegistry) WaitForAnchorRootAtLeast ¶ added in v1.19.5
func (a *AnchorStateRegistry) WaitForAnchorRootAtLeast(game interface { RootClaimValue() common.Hash L2SequenceNumber() uint64 })
type BlockRefResult ¶
type BlockRefResult struct {
T devtest.T
BlockRef eth.L2BlockRef
}
func (*BlockRefResult) IsGenesis ¶
func (r *BlockRefResult) IsGenesis() *BlockRefResult
func (*BlockRefResult) NumEqualTo ¶
func (r *BlockRefResult) NumEqualTo(num uint64) *BlockRefResult
type CallFrame ¶ added in v1.19.10
type CallFrame struct {
From common.Address `json:"from"`
To common.Address `json:"to"`
Input hexutil.Bytes `json:"input"`
Output hexutil.Bytes `json:"output"`
Error string `json:"error"`
Calls []CallFrame `json:"calls"`
}
CallFrame is one call in a callTracer trace of a transaction.
type ChainBlockProvider ¶ added in v1.18.0
type CheckFunc ¶
type CheckFunc func() error
func InSyncFn ¶ added in v1.18.0
func InSyncFn(node1, node2 SyncStatusProvider, log log.Logger, ctx context.Context, lvl safety.Level, chainID eth.ChainID, attempts int) CheckFunc
InSyncFn checks that two peer nodes are converged on the same canonical chain at the given safety level. Before the retry loop it records the higher of the two starting heads as a catch-up target, so the slower node must reach at least where the faster node was when the check began. On each attempt it re-samples both heads live and considers the nodes in sync when:
- the slower head has reached the catch-up target; and
- the two head numbers differ by at most maxInSyncGap; and
- at the lower of the two heights, both nodes agree on the canonical block hash.
The catch-up target prevents falsely passing when both heads sit below a recent divergence point and happen to agree on shared pre-reorg history. Unlike MatchedFn this does not require both live heads to be equal in the same polling tick. Unlike a single-snapshot approach it tolerates either side reorging during the wait, since both heads are re-sampled every attempt.
func LaggedFn ¶
func LaggedFn(baseNode, refNode SyncStatusProvider, log log.Logger, ctx context.Context, lvl safety.Level, chainID eth.ChainID, attempts int, allowMatch bool) CheckFunc
LaggedFn returns a lambda that checks the baseNode head with given safety level is lagged with the refNode chain sync status provider Composable with other lambdas to wait in parallel
func MatchedFn ¶
func MatchedFn(baseNode, refNode SyncStatusProvider, log log.Logger, ctx context.Context, lvl safety.Level, chainID eth.ChainID, attempts int) CheckFunc
MatchedFn returns a lambda that checks the baseNode head with given safety level is matched with the refNode chain sync status provider Composable with other lambdas to wait in parallel
func MatchedWithProgressFn ¶ added in v1.19.0
func MatchedWithProgressFn(baseNode, refNode SyncStatusProvider, log log.Logger, ctx context.Context, matchLvl, progressLvl safety.Level, chainID eth.ChainID, maxWait, stallTimeout time.Duration) CheckFunc
MatchedWithProgressFn returns a lambda that waits for baseNode's head at matchLvl to match refNode's head at matchLvl, while requiring baseNode to make progress on progressLvl. It is intended for sync checks where the matchLvl head can stall behind a slow but progressing pipeline — for example the CrossSafe head behind initial EL-sync, where the CL keeps receiving unsafe payloads (progressLvl == LocalUnsafe) but the safe head cannot advance until the EL completes its initial snap-sync.
The check polls every 2s and succeeds as soon as the matchLvl heads match. It fails when one of:
- the overall maxWait elapses; or
- baseNode's progressLvl head has not advanced for stallTimeout (i.e. the underlying gossip / forward sync has truly stalled).
Using a stall detector lets the budget be generous without papering over genuinely stuck systems. The first sample of progressLvl is taken on entry and the stall clock resets every time the progressLvl head advances.
type Conductor ¶
type Conductor struct {
// contains filtered or unexported fields
}
func (*Conductor) AddServerAsNonvoter ¶ added in v1.19.10
AddServerAsNonvoter adds a server using the given Raft configuration version.
func (*Conductor) AddServerAsVoter ¶ added in v1.19.10
AddServerAsVoter adds a server using the given Raft configuration version.
func (*Conductor) AddVoterToCluster ¶ added in v1.19.10
AddVoterToCluster adds the target conductor to the Raft cluster as a voter, using the current configuration version, and waits for the change to take effect.
func (*Conductor) AwaitNotLeader ¶ added in v1.19.10
func (c *Conductor) AwaitNotLeader()
AwaitNotLeader waits until this conductor no longer reports Raft leadership.
func (*Conductor) CallProxy ¶ added in v1.19.10
CallProxy calls a sequencer API through this conductor's RPC proxy.
func (*Conductor) FetchClusterMembership ¶
func (c *Conductor) FetchClusterMembership() *consensus.ClusterMembership
func (*Conductor) LeaderOverridden ¶ added in v1.19.10
LeaderOverridden reports whether this conductor's leader override is set.
func (*Conductor) OverrideLeader ¶ added in v1.19.10
OverrideLeader forces this conductor to report itself as leader regardless of actual Raft state, or clears the override again with false. This is the disaster-recovery escape hatch used when the cluster cannot form a quorum.
func (*Conductor) RemoveFromCluster ¶ added in v1.19.10
RemoveFromCluster removes the target conductor from the Raft cluster, using the current configuration version, and waits for the change to take effect.
func (*Conductor) RemoveServer ¶ added in v1.19.10
RemoveServer removes a server using the given Raft configuration version.
func (*Conductor) Sequencer ¶ added in v1.19.10
Sequencer returns the L2CL node whose sequencer this conductor manages.
func (*Conductor) Stop ¶ added in v1.19.10
func (c *Conductor) Stop()
Stop shuts down the conductor service via its admin RPC and waits until the conductor stops serving RPC. The service cannot be restarted; tests use this to take cluster members out, e.g. to simulate loss of Raft quorum.
func (*Conductor) TransferLeadership ¶ added in v1.19.10
func (c *Conductor) TransferLeadership(cluster ConductorSet) *Conductor
TransferLeadership transfers Raft leadership to an unspecified eligible voter and waits for the cluster to settle on a different sole active sequencer.
type ConductorSet ¶
type ConductorSet []*Conductor
func (ConductorSet) AwaitLeader ¶ added in v1.19.10
func (s ConductorSet) AwaitLeader() *Conductor
AwaitLeader waits until the cluster agrees on exactly one Raft leader and returns that conductor.
func (ConductorSet) AwaitOneActiveSequencer ¶ added in v1.19.10
func (s ConductorSet) AwaitOneActiveSequencer() *Conductor
AwaitOneActiveSequencer waits until the cluster has exactly one Raft leader, the leader's sequencer is active, and every follower's sequencer is inactive. It returns the leader's conductor.
func (ConductorSet) TransferLeadershipTo ¶ added in v1.19.10
func (s ConductorSet) TransferLeadershipTo(source, target *Conductor)
TransferLeadershipTo safely transfers Raft leadership and sequencing from source to target. It waits for source to be the set's sole active sequencer and for that cluster-wide invariant to move to target before returning.
func (ConductorSet) Without ¶ added in v1.19.10
func (s ConductorSet) Without(exclude *Conductor) ConductorSet
Without returns the set without the given conductor, e.g. the survivors of an injected failure.
type DepositEOA ¶
type DepositEOA struct {
// contains filtered or unexported fields
}
DepositEOA wraps an L2 EOA so that transactions are sent via L1 deposit transactions rather than direct L2 transactions.
func (*DepositEOA) DepositTx ¶
func (d *DepositEOA) DepositTx(to common.Address, calldata []byte, opts ...func(*DepositTxOpts)) *ethtypes.Receipt
DepositTx sends a transaction to the given address with the given calldata via OptimismPortal2 on L1. It waits for L2 derivation and returns the L2 receipt.
func (*DepositEOA) DepositTxExpectRevert ¶ added in v1.19.5
func (d *DepositEOA) DepositTxExpectRevert(to common.Address, calldata []byte, errorSignature string, opts ...func(*DepositTxOpts)) *ethtypes.Receipt
DepositTxExpectRevert sends a transaction to the given address with the given calldata via OptimismPortal2 on L1 and requires that it reverts on L2 with exactly the given error signature (e.g. "CrossL2Inbox_NoExecutingDeposits()"). It waits for L2 derivation and returns the L2 receipt.
func (*DepositEOA) ExportUndeliveredMessage ¶ added in v1.19.10
func (d *DepositEOA) ExportUndeliveredMessage(exporter common.Address, sourceMessenger common.Address, m SentMessage, l1GasLimit uint32, opts ...func(*DepositTxOpts)) (*types.Receipt, uint64)
ExportUndeliveredMessage forces a call to `exporter`, the UndeliveredMessageExporter on this chain, in as a deposit: the exporter tells `sourceMessenger`, the source chain's L1CrossDomainMessenger, through a withdrawal, that `m` has not been relayed on this chain. `l1GasLimit` is the gas the exporter reserves for that call on L1. It requires the export to succeed and to emit UndeliveredMessageExported for the message, and returns the receipt and this chain's timestamp at the export.
func (*DepositEOA) SendInitMessage ¶
func (d *DepositEOA) SendInitMessage(trigger *txintent.InitTrigger) *InitMessage
SendInitMessage sends an initiating message via an L1 deposit transaction. Returns an InitMessage with InteropOutput populated from the L2 receipt, fully compatible with SendExecMessage on the receiving chain.
func (*DepositEOA) SendRandomInitMessage ¶
func (d *DepositEOA) SendRandomInitMessage(rng *rand.Rand, eventLoggerAddress common.Address) *InitMessage
SendRandomInitMessage creates a random initiating message and sends it via L1 deposit.
type DepositTxOpts ¶ added in v1.19.10
type DepositTxOpts struct {
// GasLimit is the deposit's L2 gas limit. Zero uses max(100k, the portal's minimum).
GasLimit uint64
}
DepositTxOpts configures a deposit transaction.
type EOA ¶
type EOA struct {
// contains filtered or unexported fields
}
EOA is an Externally-Owned-Account: an account on a specific chain that is operated by a single private key.
func (*EOA) ApproveToken ¶
ApproveToken approves a spender to spend tokens on behalf of this EOA
func (*EOA) DeployEventLogger ¶
func (*EOA) DeployWETH ¶
func (*EOA) GetBalance ¶
Try to avoid using this method where possible, use the VerifyBalance* methods instead.
func (*EOA) GetTokenBalance ¶
GetTokenBalance returns the token balance for this EOA
func (*EOA) Key ¶
Key returns the cross-chain user identity/key, i.e. the user but detached it from the EL node.
func (*EOA) PendingNonce ¶
PendingNonce looks up the user nonce in the pending state.
func (*EOA) Plan ¶
Plan creates the default tx-planning options, to perform a transaction with this Key, against the connected EL node and its chain.
func (*EOA) PlanTransfer ¶
PlanTransfer creates the tx-plan options to perform a transfer of the given amount of ETH to the given account.
func (*EOA) PrepareExecTx ¶
func (u *EOA) PrepareExecTx(initMsg *InitMessage) (rawTx []byte, txHash common.Hash)
PrepareExecTx builds and signs an executing-message transaction referencing the given init message, but does NOT submit it. Returns the raw signed transaction bytes and tx hash. The raw bytes are suitable for injection via TestSequencer.SequenceBlockWithTxs, bypassing mempool filtering.
func (*EOA) PrepareSameTimestampInit ¶
func (u *EOA) PrepareSameTimestampInit( rng *rand.Rand, eventLogger common.Address, expectedBlockNum uint64, expectedLogIdx uint32, expectedTimestamp uint64, ) *SameTimestampPair
PrepareSameTimestampInit creates a precomputed init message for same-timestamp testing. The message identifier is computed for the expected block position (blockNum, logIdx, timestamp). This allows an exec message on another chain to reference this init before it's included.
Parameters:
- rng: random source for generating topics and data
- eventLogger: address of the EventLogger contract that will emit the init
- expectedBlockNum: the block number where this init is expected to be included
- expectedLogIdx: the log index within the block (0 if first log in block)
- expectedTimestamp: the timestamp of the block
func (*EOA) SendExecMessage ¶
func (u *EOA) SendExecMessage(initMsg *InitMessage, opts ...ExecMessageOpt) *ExecMessage
func (*EOA) SendInitMessage ¶
func (u *EOA) SendInitMessage(trigger *txintent.InitTrigger) *InitMessage
func (*EOA) SendInvalidExecMessage ¶
func (u *EOA) SendInvalidExecMessage(initMsg *InitMessage) *ExecMessage
SendInvalidExecMessage sends an executing message with an invalid identifier. The log index is incremented to reference a non-existent log.
func (*EOA) SendPackedExecMessages ¶
func (u *EOA) SendPackedExecMessages(dependOn *txintent.IntentTx[*txintent.MultiTrigger, *txintent.InteropOutput]) (*txintent.IntentTx[*txintent.MultiTrigger, *txintent.InteropOutput], *types.Receipt, error)
SendPackedExecMessages batches every message and validates them via a single multicall
func (*EOA) SendPackedRandomInitMessages ¶
func (u *EOA) SendPackedRandomInitMessages(rng *rand.Rand, eventLoggerAddress common.Address) (*txintent.IntentTx[*txintent.MultiTrigger, *txintent.InteropOutput], *types.Receipt, error)
SendPackedRandomInitMessages batches random messages and initiates them via a single multicall
func (*EOA) SendRandomInitMessage ¶
func (u *EOA) SendRandomInitMessage(rng *rand.Rand, eventLoggerAddress common.Address, topicCount, dataLen int) *InitMessage
SendRandomInitMessage creates and sends a random initiating message using the given event logger. topicCount specifies the number of topics (clamped to 1-4), dataLen specifies the opaque data length (minimum 1).
func (*EOA) Transact ¶
Transact plans and executes a tx. The success-state, as defined by the tx-plan options, is required. The resulting evaluated tx is returned.
func (*EOA) Transfer ¶
Transfer transfers the given amount of ETH to the given account, immediately.
func (*EOA) VerifyBalanceAtLeast ¶
VerifyBalanceAtLeast verifies balance >= v
func (*EOA) VerifyBalanceExact ¶
VerifyBalanceExact verifies balance == v
func (*EOA) VerifyBalanceLessThan ¶
VerifyBalanceLessThan verifies balance < v
func (*EOA) VerifyTokenBalance ¶
VerifyTokenBalance verifies the token balance matches expected amount
func (*EOA) ViaDepositTx ¶
func (u *EOA) ViaDepositTx(l1 *EOA, l2EL *L2ELNode, l2Net *L2Network) *DepositEOA
ViaDepositTx returns a DepositEOA that sends transactions through L1 deposit transactions. The caller must fund both the L1 and L2 identities.
func (*EOA) WaitForBalance ¶
func (*EOA) WaitForBalanceAtLeast ¶ added in v1.19.5
WaitForBalanceAtLeast waits until the balance is at least v. Prefer this over WaitForBalance when the caller only cares about a lower bound (e.g. funding): an exact wait hangs forever if another credit raises the balance past the target.
type ETHSend ¶ added in v1.19.10
type ETHSend struct {
// Message is the message that relays the ETH on the destination.
Message SentMessage
// Receipt is the receipt of the sendETH transaction.
Receipt *types.Receipt
// BlockTime is the timestamp of the block the send is in.
BlockTime uint64
// contains filtered or unexported fields
}
ETHSend is a SuperchainETHBridge.sendETH.
func SendETH ¶ added in v1.19.10
func SendETH(sender *EOA, recipient common.Address, destination eth.ChainID, amount eth.ETH) *ETHSend
SendETH sends `amount` of the sender's ETH to `recipient` on `destination` through the SuperchainETHBridge. It requires the send to succeed and returns it; its message is not relayed.
func (*ETHSend) Refund ¶ added in v1.19.10
Refund claims this send's refund as `user` on the chain it was sent from, requires the refund to succeed, and returns its receipt.
func (*ETHSend) RefundCall ¶ added in v1.19.10
RefundCall is the source chain's SuperchainETHBridge.refundETH call that returns this send's ETH to its sender once its message has expired. Only the sender can make it.
type EcotoneFees ¶
type EcotoneFees struct {
// contains filtered or unexported fields
}
func NewEcotoneFees ¶
func NewEcotoneFees(t devtest.T, l2Network *L2Network) *EcotoneFees
func (*EcotoneFees) LogResults ¶
func (ef *EcotoneFees) LogResults(result EcotoneFeesValidationResult)
func (*EcotoneFees) ValidateTransaction ¶
func (ef *EcotoneFees) ValidateTransaction(from *EOA, to *EOA, amount *big.Int) EcotoneFeesValidationResult
type ExecMessage ¶
type ExecMessage struct {
Init *InitMessage
Tx *txintent.IntentTx[*txintent.ExecTrigger, *txintent.InteropOutput]
Receipt *types.Receipt
}
ExecMessage represents an executing message that has been sent and included on chain.
func (*ExecMessage) BlockHash ¶
func (m *ExecMessage) BlockHash() common.Hash
BlockHash returns the block hash from the receipt.
func (*ExecMessage) BlockID ¶
func (m *ExecMessage) BlockID() eth.BlockID
BlockID returns the block ID from the receipt.
func (*ExecMessage) BlockNumber ¶
func (m *ExecMessage) BlockNumber() *big.Int
BlockNumber returns the block number from the receipt.
func (*ExecMessage) String ¶
func (m *ExecMessage) String() string
String returns a human-readable representation of the ExecMessage.
func (*ExecMessage) TxHash ¶
func (m *ExecMessage) TxHash() common.Hash
TxHash returns the transaction hash from the receipt.
type ExecMessageOpt ¶
type ExecMessageOpt func(*execMessageConfig)
ExecMessageOpt configures the behavior of SendExecMessage.
func WithExpectRevert ¶
func WithExpectRevert() ExecMessageOpt
WithExpectRevert indicates the transaction should be included but revert. The receipt status is asserted to be failed, and the log-count check is skipped.
func WithFixedGasLimit ¶
func WithFixedGasLimit(limit uint64) ExecMessageOpt
WithFixedGasLimit sets a fixed gas limit, bypassing eth_estimateGas. Use when the transaction is expected to revert (estimation would fail).
type ExpireMessageCall ¶ added in v1.19.10
type ExpireMessageCall struct {
MessageHash common.Hash
UndeliveredAt uint64
// Output is the call's return data, or its revert data if it reverted.
Output []byte
}
ExpireMessageCall is a call to L2ToL2CrossDomainMessenger.expireMessage, read from a trace.
type FjordFees ¶
type FjordFees struct {
// contains filtered or unexported fields
}
func (*FjordFees) ValidateTransaction ¶
func (ff *FjordFees) ValidateTransaction(from *EOA, to *EOA, amount *big.Int) FjordFeesValidationResult
ValidateTransaction validates the transaction and returns the validation result
type FjordFeesValidationResult ¶
type FjordFeesValidationResult struct {
TransactionReceipt *types.Receipt
L1Fee *big.Int
L2Fee *big.Int
BaseFee *big.Int
PriorityFee *big.Int
TotalFee *big.Int
VaultBalances VaultBalances
WalletBalanceDiff *big.Int
TransferAmount *big.Int
FastLzSize uint64
EstimatedBrotliSize *big.Int
OperatorFee *big.Int
CoinbaseDiff *big.Int
}
type ForkchoiceUpdateResult ¶
type ForkchoiceUpdateResult struct {
T devtest.T
Refresh func()
Result *eth.ForkchoiceUpdatedResult
ValidCnt int // count for VALID response
SyncingCnt int // count for SYNCING response
InvalidCnt int // count for INVALID response
RefreshCnt int
Err error
}
func (*ForkchoiceUpdateResult) IsForkchoiceUpdatedStatus ¶
func (r *ForkchoiceUpdateResult) IsForkchoiceUpdatedStatus(status eth.ExecutePayloadStatus) *ForkchoiceUpdateResult
func (*ForkchoiceUpdateResult) IsSyncing ¶
func (r *ForkchoiceUpdateResult) IsSyncing() *ForkchoiceUpdateResult
func (*ForkchoiceUpdateResult) IsValid ¶
func (r *ForkchoiceUpdateResult) IsValid() *ForkchoiceUpdateResult
func (*ForkchoiceUpdateResult) ResultAllSyncing ¶
func (r *ForkchoiceUpdateResult) ResultAllSyncing()
func (*ForkchoiceUpdateResult) Retry ¶
func (r *ForkchoiceUpdateResult) Retry(attempts int) *ForkchoiceUpdateResult
func (*ForkchoiceUpdateResult) WaitUntilValid ¶
func (r *ForkchoiceUpdateResult) WaitUntilValid(attempts int) *ForkchoiceUpdateResult
type FunderEOA ¶ added in v1.19.5
type FunderEOA struct {
// contains filtered or unexported fields
}
FunderEOA is a funded account that hands out ETH to test accounts.
func NewFunderEOA ¶ added in v1.19.5
NewFunderEOA wraps a prefunded EOA as a funder that mints child EOAs from wallet.
func (*FunderEOA) AsFunder ¶ added in v1.19.5
AsFunder returns a view of the same funder bound to a different EL node on the same chain. All views share the account's includer and nonce state, so they are safe to use concurrently. Funded EOAs are created and observed through el; funding transactions continue to use the original funder's EL.
func (*FunderEOA) Fund ¶ added in v1.19.5
Fund transfers amount to the target EOA and waits until its balance reflects it.
func (*FunderEOA) FundAtLeast ¶ added in v1.19.5
FundAtLeast tops the target EOA up so that its balance is at least amount.
func (*FunderEOA) NewFundedEOA ¶ added in v1.19.5
NewFundedEOA mints a fresh child EOA on the funder's chain and funds it with at least the given amount. A zero amount yields a fresh, unfunded EOA.
func (*FunderEOA) NewFundedEOAs ¶ added in v1.19.5
NewFundedEOAs mints and funds count fresh child EOAs concurrently.
type HDWallet ¶
type HDWallet struct {
// contains filtered or unexported fields
}
HDWallet is a collection of deterministic accounts, generated from an underlying devkeys keyring, using the standard cross-chain user identities.
type HeaderProvider ¶
type HeaderProvider interface {
InfoByNumber(ctx context.Context, number uint64) (eth.BlockInfo, error)
InfoByLabel(ctx context.Context, label eth.BlockLabel) (eth.BlockInfo, error)
InfoByHash(ctx context.Context, hash common.Hash) (eth.BlockInfo, error)
}
HeaderProvider interface for multi-client operations
type InitMessage ¶
type InitMessage struct {
Tx *txintent.IntentTx[*txintent.InitTrigger, *txintent.InteropOutput]
Receipt *types.Receipt
}
InitMessage represents an initiating message that has been sent and included on chain.
func (*InitMessage) BlockHash ¶
func (m *InitMessage) BlockHash() common.Hash
BlockHash returns the block hash from the receipt.
func (*InitMessage) BlockID ¶
func (m *InitMessage) BlockID() eth.BlockID
BlockID returns the block ID from the receipt.
func (*InitMessage) BlockNumber ¶
func (m *InitMessage) BlockNumber() *big.Int
BlockNumber returns the block number from the receipt.
func (*InitMessage) String ¶
func (m *InitMessage) String() string
String returns a human-readable representation of the InitMessage.
func (*InitMessage) TxHash ¶
func (m *InitMessage) TxHash() common.Hash
TxHash returns the transaction hash from the receipt.
type InvalidMsgFn ¶
InvalidMsgFn is a function that takes a valid message and returns an invalid copy.
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
Key is an ethereum private key. This is a key with an address identity. The Key may be used on different chains: it is chain-agnostic.
func (*Key) Priv ¶
func (a *Key) Priv() *ecdsa.PrivateKey
type L1CLNode ¶
type L1CLNode struct {
// contains filtered or unexported fields
}
L1CLNode wraps a stack.L1CLNode interface for DSL operations
func NewL1CLNode ¶
NewL1CLNode creates a new L1CLNode DSL wrapper
func (*L1CLNode) BeaconHTTPAddr ¶ added in v1.19.2
type L1ELNode ¶
type L1ELNode struct {
// contains filtered or unexported fields
}
L1ELNode wraps a stack.L1ELNode interface for DSL operations
func NewL1ELNode ¶
NewL1ELNode creates a new L1ELNode DSL wrapper
func (*L1ELNode) AdvanceTime ¶ added in v1.19.5
func (el *L1ELNode) AdvanceTime(timeTravel *clock.AdvancingClock, amount time.Duration)
func (L1ELNode) AwaitTime ¶ added in v1.19.5
AwaitTime is WaitForTime for callers that must handle the failure themselves. See awaitLabel.
func (*L1ELNode) BlockRefByLabel ¶
func (el *L1ELNode) BlockRefByLabel(label eth.BlockLabel) eth.L1BlockRef
func (*L1ELNode) BlockRefByNumber ¶
func (el *L1ELNode) BlockRefByNumber(number uint64) eth.L1BlockRef
func (*L1ELNode) EstimateBlockTime ¶
EstimateBlockTime estimates the L1 block based on the last 1000 blocks (or since genesis, if insufficient blocks).
func (L1ELNode) IsCanonical ¶
func (*L1ELNode) ReorgTriggered ¶
func (el *L1ELNode) ReorgTriggered(target eth.L1BlockRef, attempts int)
func (*L1ELNode) ReorgTriggeredFn ¶
func (el *L1ELNode) ReorgTriggeredFn(target eth.L1BlockRef, attempts int) CheckFunc
ReorgTriggeredFn returns a lambda that checks that a L1 reorg occurred on the expected block Composable with other lambdas to wait in parallel
func (*L1ELNode) TransactionTimeout ¶
func (L1ELNode) WaitForBlock ¶
func (L1ELNode) WaitForBlockNumber ¶
func (L1ELNode) WaitForFinalization ¶
WaitForFinalization waits for the current block height to be finalized. Note that it does not ensure that the finalized block is the same as the current unsafe block (i.e., it is not reorg-aware).
func (L1ELNode) WaitForLabel ¶
func (L1ELNode) WaitForLabelRef ¶
func (L1ELNode) WaitForOnline ¶
func (el L1ELNode) WaitForOnline()
func (L1ELNode) WaitForTime ¶
WaitForTime waits until the chain has reached or surpassed the given timestamp.
func (L1ELNode) WaitForUnsafe ¶
type L1Network ¶
type L1Network struct {
// contains filtered or unexported fields
}
L1Network wraps a stack.L1Network interface for DSL operations
func NewL1Network ¶
NewL1Network creates a new L1Network DSL wrapper
func (*L1Network) PrintChain ¶
func (n *L1Network) PrintChain()
PrintChain is used for testing/debugging, it prints the blockchain hashes and parent hashes to logs, which is useful when developing reorg tests
func (*L1Network) WaitForBlock ¶
func (*L1Network) WaitForFinalization ¶
func (*L1Network) WaitForOnline ¶
func (n *L1Network) WaitForOnline()
type L2Batcher ¶
type L2Batcher struct {
// contains filtered or unexported fields
}
L2Batcher wraps a stack.L2Batcher interface for DSL operations
func NewL2Batcher ¶
NewL2Batcher creates a new L2Batcher DSL wrapper
func (*L2Batcher) ActivityAPI ¶
func (b *L2Batcher) ActivityAPI() apis.BatcherActivity
type L2CLNode ¶
type L2CLNode struct {
// contains filtered or unexported fields
}
L2CLNode wraps a stack.L2CLNode interface for DSL operations
func NewL2CLNode ¶
NewL2CLNode creates a new L2CLNode DSL wrapper
func (*L2CLNode) AdvancedFn ¶
AdvancedFn returns a lambda that checks the L2CL chain head with given safety level advanced more than delta block number Composable with other lambdas to wait in parallel
func (*L2CLNode) AdvancedUnsafe ¶
func (*L2CLNode) AllHeadsAdvancedFn ¶ added in v1.19.0
AllHeadsAdvancedFn asserts every safety head advances from the head observed at call time, using DefaultSafetyHeadsAdvancement.
func (*L2CLNode) AllHeadsReachedFn ¶ added in v1.19.0
func (cl *L2CLNode) AllHeadsReachedFn(snap SafetyHeads) CheckFunc
AllHeadsReachedFn asserts every safety head reaches snap + the default delta. Used to assert catch-up after a resync.
func (*L2CLNode) AppendUnsafePayloadUntilTip ¶
func (*L2CLNode) AwaitMinL1Processed ¶
func (*L2CLNode) AwaitSequencerActive ¶ added in v1.19.10
func (cl *L2CLNode) AwaitSequencerActive()
AwaitSequencerActive waits until this node's sequencer is active.
func (*L2CLNode) AwaitSequencerInactive ¶ added in v1.19.10
func (cl *L2CLNode) AwaitSequencerInactive()
AwaitSequencerInactive waits until this node's sequencer is inactive.
func (*L2CLNode) ChainBlockID ¶ added in v1.18.0
func (*L2CLNode) ChainSyncStatus ¶
ChainSyncStatus satisfies that the L2CLNode can provide sync status per chain
func (*L2CLNode) ConnectPeer ¶
func (*L2CLNode) CurrentL1MatchedFn ¶
func (*L2CLNode) DisconnectPeer ¶
func (*L2CLNode) HeadBlockRef ¶
func (cl *L2CLNode) HeadBlockRef(lvl safety.Level) eth.L2BlockRef
HeadBlockRef fetches L2CL sync status and returns block ref with given safety level
func (*L2CLNode) InSync ¶ added in v1.18.0
func (cl *L2CLNode) InSync(other SyncStatusProvider, lvl safety.Level, attempts int)
func (*L2CLNode) IsP2PConnected ¶
func (*L2CLNode) LaggedFn ¶
func (cl *L2CLNode) LaggedFn(refNode SyncStatusProvider, lvl safety.Level, attempts int, allowMatch bool) CheckFunc
LaggedFn returns a lambda that checks the L2CL chain head with given safety level is lagged with the reference chain sync status provider Composable with other lambdas to wait in parallel
func (*L2CLNode) LocalGameInputs ¶ added in v1.18.0
func (cl *L2CLNode) LocalGameInputs(agreedBlock, claimBlock uint64) *utils.LocalGameInputs
func (*L2CLNode) ManagePeer ¶
func (*L2CLNode) Matched ¶
func (cl *L2CLNode) Matched(refNode SyncStatusProvider, lvl safety.Level, attempts int)
func (*L2CLNode) MatchedFn ¶
MatchedFn returns a lambda that checks the L2CLNode head with given safety level is matched with the refNode chain sync status provider Composable with other lambdas to wait in parallel
func (*L2CLNode) MatchedUnsafe ¶
func (cl *L2CLNode) MatchedUnsafe(refNode SyncStatusProvider, attempts int)
func (*L2CLNode) MatchedWithProgressFn ¶ added in v1.19.0
func (cl *L2CLNode) MatchedWithProgressFn(refNode SyncStatusProvider, matchLvl, progressLvl safety.Level, maxWait, stallTimeout time.Duration) CheckFunc
MatchedWithProgressFn returns a lambda that waits for cl's matchLvl head to match refNode's matchLvl head while requiring cl to keep making progress on progressLvl. See MatchedWithProgressFn in check.go for the precise semantics. Composable with other lambdas to wait in parallel.
func (*L2CLNode) NotAdvancedFn ¶
func (*L2CLNode) NotAdvancedUnsafe ¶
func (*L2CLNode) OutputAtBlock ¶ added in v1.19.10
func (cl *L2CLNode) OutputAtBlock(blockNumber uint64) *eth.OutputResponse
OutputAtBlock returns the output response for a block number.
func (*L2CLNode) OverrideLeader ¶ added in v1.19.10
func (cl *L2CLNode) OverrideLeader()
OverrideLeader disables the node's conductor interactions so its sequencer can run in non-HA mode during disaster recovery. The override cannot be cleared through the node's admin API.
func (*L2CLNode) PostUnsafePayload ¶
func (cl *L2CLNode) PostUnsafePayload(payload *eth.ExecutionPayloadEnvelope)
func (*L2CLNode) ReachedFn ¶
ReachedFn returns a lambda that checks the L2CL chain head with given safety level reaches the target block number Composable with other lambdas to wait in parallel
func (*L2CLNode) ReachedRef ¶
func (*L2CLNode) ReachedRefFn ¶
ReachedRefFn is same as Reached, but has an additional check to ensure that the block referenced is not reorged Composable with other lambdas to wait in parallel
func (*L2CLNode) ReachedTimeWithoutRegressionFn ¶ added in v1.19.0
ReachedTimeWithoutRegressionFn waits for the head's block timestamp to reach targetTime, failing on any regression. Requires a non-zero baseline behind targetTime so a regression to genesis isn't vacuous (0 >= 0). Polls every 100ms; deadline is targetTime + 5min.
Uses an explicit ticker/deadline loop and returns errors through the CheckFunc contract. require.Eventuallyf would call FailNow inside the dsl.CheckAll worker goroutine, which is not safe.
func (*L2CLNode) ReachedUnsafe ¶
func (*L2CLNode) ReachedWithProgressFn ¶ added in v1.19.5
func (cl *L2CLNode) ReachedWithProgressFn(lvl, progressLvl safety.Level, target uint64, maxWait, stallTimeout time.Duration) CheckFunc
ReachedWithProgressFn waits for the head at lvl to reach target, but instead of a fixed attempt budget it distinguishes a self-recovering slowdown from a genuinely stuck pipeline. It succeeds as soon as lvl reaches target. It fails when either:
- progressLvl (a strictly more-live head, e.g. LocalUnsafe) has not advanced for stallTimeout — the node is genuinely wedged, not merely slow; or
- the overall maxWait elapses.
This is the "reach a target" analogue of MatchedWithProgressFn. Use it for a catch-up wait whose target head is gated by a pipeline that can transiently stall under load (e.g. CrossSafe catching up after interop resumes, where the EL can be briefly starved) without masking a permanent hang: as long as the chain keeps producing blocks the budget stays generous, but a chain that stops advancing entirely fails fast. Polls every 2s.
func (*L2CLNode) RewindedFn ¶
RewindedFn returns a lambda that checks the L2CL chain head with given safety level rewinded more than the delta block number Composable with other lambdas to wait in parallel
func (*L2CLNode) SafeHead ¶
func (cl *L2CLNode) SafeHead() *BlockRefResult
func (*L2CLNode) SafeHeadAtL1Block ¶ added in v1.20.1
func (cl *L2CLNode) SafeHeadAtL1Block(l1BlockNum uint64) (*eth.SafeHeadResponse, error)
SafeHeadAtL1Block asks the node which L2 safe head it had reached as of the given L1 block. A "not found" answer is returned as safedb.ErrNotFound; any other error is returned as is.
func (*L2CLNode) SafeHeadDBFloor ¶ added in v1.19.5
SafeHeadDBFloor returns the oldest L2 safe-head block number recorded in this node's safe head db. Prefer this over the live safe head when capturing a no-truncation baseline: the live safe head advances per L2 block while the db resolves per L1 origin, so a live sample may not be satisfiable by the db even without truncation.
func (*L2CLNode) SafeL2BlockRef ¶
func (cl *L2CLNode) SafeL2BlockRef() eth.L2BlockRef
func (*L2CLNode) SafetyHeads ¶ added in v1.19.0
func (cl *L2CLNode) SafetyHeads() SafetyHeads
func (*L2CLNode) SequencerActive ¶ added in v1.19.10
SequencerActive reports whether this node's sequencer is active.
func (*L2CLNode) SetSequencerRecoverMode ¶
func (*L2CLNode) SignalTarget ¶
func (*L2CLNode) StartSequencer ¶
func (cl *L2CLNode) StartSequencer()
func (*L2CLNode) StartSequencerAt ¶ added in v1.19.10
StartSequencerAt starts sequencing from the given unsafe-head hash.
func (*L2CLNode) StopSequencer ¶
func (*L2CLNode) SyncStatus ¶
func (cl *L2CLNode) SyncStatus() *eth.SyncStatus
func (*L2CLNode) UnsafeHead ¶
func (cl *L2CLNode) UnsafeHead() *BlockRefResult
func (*L2CLNode) VerifySafeHeadDatabaseMatches ¶
func (*L2CLNode) WaitForNonZeroUnsafeTime ¶
func (cl *L2CLNode) WaitForNonZeroUnsafeTime(ctx context.Context) *eth.SyncStatus
func (*L2CLNode) WaitForPeerDisconnected ¶
func (*L2CLNode) WaitForStall ¶
awaitSafeHeadsStalled waits until every node's safe head has stopped advancing for at least 10 seconds.
func (*L2CLNode) WatchForReset ¶ added in v1.20.1
func (cl *L2CLNode) WatchForReset() *ResetWatch
WatchForReset starts polling the node's sync status in the background every 100ms, until VerifyNoReset is called. A reset restarts derivation from an L1 block at least a channel timeout behind the safe head's L1 origin, and rewinds or clears the node's L2 heads until the engine is reset. The watch records a reset when one of its polls observes such a regression of CurrentL1 or of the unsafe or local-safe head, so a reset the node recovers from between two polls goes unnoticed.
Use it only while no legitimate unsafe reorg is expected on the node, such as a consolidation conflict that the derived safe chain wins, a sequencer restarted at an older head, or EL sync: those regress the unsafe head without a reset.
type L2Challenger ¶
type L2Challenger struct {
// contains filtered or unexported fields
}
L2Challenger wraps a stack.L2Challenger interface for DSL operations
func NewL2Challenger ¶
func NewL2Challenger(inner stack.L2Challenger) *L2Challenger
NewL2Challenger creates a new L2Challenger DSL wrapper
func (*L2Challenger) Escape ¶
func (c *L2Challenger) Escape() stack.L2Challenger
Escape returns the underlying stack.L2Challenger
func (*L2Challenger) String ¶
func (c *L2Challenger) String() string
type L2ELNode ¶
type L2ELNode struct {
// contains filtered or unexported fields
}
L2ELNode wraps a stack.L2ELNode interface for DSL operations
func NewL2ELNode ¶
NewL2ELNode creates a new L2ELNode DSL wrapper
func (*L2ELNode) AdvancedFn ¶
func (el *L2ELNode) AdvancedFn(label eth.BlockLabel, block uint64, opts ...AdvancedOption) CheckFunc
func (*L2ELNode) AssertExecMessageNotInBlock ¶
func (el *L2ELNode) AssertExecMessageNotInBlock(execMessage *ExecMessage)
func (*L2ELNode) AssertTxInBlock ¶
AssertTxInBlock asserts that a transaction with the given hash does not exist in the block at the given number.
func (*L2ELNode) AssertTxNotInBlock ¶
AssertTxNotInBlock asserts that a transaction with the given hash does not exist in the block at the given number.
func (L2ELNode) AwaitTime ¶ added in v1.19.5
AwaitTime is WaitForTime for callers that must handle the failure themselves. See awaitLabel.
func (*L2ELNode) BlockRefByHash ¶
func (el *L2ELNode) BlockRefByHash(hash common.Hash) eth.L2BlockRef
func (*L2ELNode) BlockRefByLabel ¶
func (el *L2ELNode) BlockRefByLabel(label eth.BlockLabel) eth.L2BlockRef
func (*L2ELNode) BlockRefByNumber ¶
func (el *L2ELNode) BlockRefByNumber(num uint64) eth.L2BlockRef
func (*L2ELNode) ChainBlockID ¶ added in v1.18.0
func (*L2ELNode) ChainSyncStatus ¶
func (*L2ELNode) DisconnectPeerWith ¶
func (*L2ELNode) ExpireMessageCall ¶ added in v1.19.10
func (el *L2ELNode) ExpireMessageCall(txHash common.Hash) ExpireMessageCall
ExpireMessageCall traces a transaction on this chain and returns the first call it made to this chain's L2ToL2CrossDomainMessenger.expireMessage. It requires there to be one.
func (*L2ELNode) FinalizedHead ¶
func (el *L2ELNode) FinalizedHead() *BlockRefResult
func (*L2ELNode) FinishedELSync ¶
func (*L2ELNode) ForkchoiceUpdate ¶
func (el *L2ELNode) ForkchoiceUpdate(refNode *L2ELNode, unsafe, safe, finalized uint64, attr *eth.PayloadAttributes) *ForkchoiceUpdateResult
ForkchoiceUpdate fetches FCU target hashes from the reference EL node, and FCU update with attributes
func (*L2ELNode) ForkchoiceUpdateRaw ¶
func (el *L2ELNode) ForkchoiceUpdateRaw(unsafe, safe, finalized common.Hash, attr *eth.PayloadAttributes) *ForkchoiceUpdateResult
ForkchoiceUpdateRaw calls FCU with block hashes with attributes
func (*L2ELNode) GasLimitAtBlock ¶ added in v1.19.1
GasLimitAtBlock returns the gas limit of the block at the given number.
func (*L2ELNode) InSync ¶ added in v1.18.0
func (el *L2ELNode) InSync(other SyncStatusProvider, lvl safety.Level, attempts int)
func (L2ELNode) IsCanonical ¶
func (*L2ELNode) KeptAdvancing ¶ added in v1.19.5
func (*L2ELNode) KeptAdvancingFn ¶ added in v1.19.5
func (el *L2ELNode) KeptAdvancingFn(label eth.BlockLabel, observeFor time.Duration, maxGap time.Duration) CheckFunc
KeptAdvancingFn returns a CheckFunc that observes the head for the given label over observeFor and fails if the head ever goes longer than maxGap of wall-clock time without advancing to a higher block number. Use it to assert sustained liveness (e.g. continuous block production) rather than eventual progress: AdvancedFn passes as long as the target is reached eventually, while KeptAdvancingFn also fails on a long stall followed by a catch-up burst. Transient lookup errors are tolerated until they persist past maxGap.
func (*L2ELNode) L1OriginReachedFn ¶
func (el *L2ELNode) L1OriginReachedFn(label eth.BlockLabel, l1OriginTarget uint64, attempts int) CheckFunc
L1OriginReachedFn returns a lambda that waits for the L1 origin to reach the target block number.
func (*L2ELNode) L2ToL2CrossDomainMessenger ¶ added in v1.19.10
func (el *L2ELNode) L2ToL2CrossDomainMessenger() bindings.L2ToL2CrossDomainMessenger
L2ToL2CrossDomainMessenger returns a binding of this chain's L2ToL2CrossDomainMessenger.
func (*L2ELNode) Matched ¶
func (el *L2ELNode) Matched(refNode SyncStatusProvider, lvl safety.Level, attempts int)
func (*L2ELNode) MatchedUnsafe ¶
func (el *L2ELNode) MatchedUnsafe(refNode SyncStatusProvider, attempts int)
func (*L2ELNode) NewPayload ¶
func (el *L2ELNode) NewPayload(refNode *L2ELNode, number uint64) *NewPayloadResult
NewPayload fetches payload for target number from the reference EL Node, and inserts the payload
func (*L2ELNode) NewPayloadRaw ¶
func (el *L2ELNode) NewPayloadRaw(payload *eth.ExecutionPayloadEnvelope) *NewPayloadResult
func (*L2ELNode) NotAdvanced ¶
func (el *L2ELNode) NotAdvanced(label eth.BlockLabel, attempts int)
func (*L2ELNode) NotAdvancedFn ¶
func (el *L2ELNode) NotAdvancedFn(label eth.BlockLabel, attempts int) CheckFunc
func (*L2ELNode) NotAdvancedUnsafe ¶
func (*L2ELNode) PayloadByNumber ¶
func (el *L2ELNode) PayloadByNumber(number uint64) *eth.ExecutionPayloadEnvelope
func (*L2ELNode) Reached ¶
func (el *L2ELNode) Reached(label eth.BlockLabel, block uint64, attempts int)
func (*L2ELNode) ReachedWithProgressFn ¶ added in v1.19.5
func (el *L2ELNode) ReachedWithProgressFn(label, progressLabel eth.BlockLabel, target uint64, maxWait, stallTimeout time.Duration) CheckFunc
ReachedWithProgressFn is the progress-aware analogue of ReachedFn: it waits for the head at label to reach target, tolerating a self-recovering slowdown while failing fast on a genuinely stuck node. It succeeds when label reaches target, and fails when either progressLabel (a strictly more-live label, e.g. eth.Unsafe) has not advanced for stallTimeout, or the overall maxWait elapses. Use it for a catch-up wait whose target head is gated by a pipeline that can transiently stall under load (e.g. the EL safe label catching up after interop resumes). Polls every 2s. See L2CLNode.ReachedWithProgressFn.
func (*L2ELNode) ReorgExact ¶
func (el *L2ELNode) ReorgExact(target eth.L2BlockRef, attempts int)
func (*L2ELNode) ReorgExactFn ¶
func (el *L2ELNode) ReorgExactFn(target eth.L2BlockRef, attempts int) CheckFunc
ReorgExactFn returns a lambda that checks that a L2 reorg occurred on the exact target L2 block. If an L2 block prior to target was reorged, this function will block forever. Composable with other lambdas to wait in parallel.
func (*L2ELNode) ReorgTriggered ¶
func (el *L2ELNode) ReorgTriggered(target eth.L2BlockRef, attempts int)
func (*L2ELNode) ReorgTriggeredFn ¶
func (el *L2ELNode) ReorgTriggeredFn(target eth.L2BlockRef, attempts int) CheckFunc
ReorgTriggeredFn returns a lambda that checks that a L2 reorg occurred on or before the expected block Composable with other lambdas to wait in parallel
func (*L2ELNode) ResendUntilSafe ¶ added in v1.19.1
func (el *L2ELNode) ResendUntilSafe(makeTx func() *txplan.PlannedTx, sendAttempts, pollPerAttempt int) (uint64, common.Hash)
ResendUntilSafe broadcasts a transaction from makeTx and waits for it to derive onto this node's irreversible safe chain, retrying with a newly built transaction whenever a broadcast fails to settle. It returns the block number and hash where the transaction landed, and fails the test if nothing settles within sendAttempts broadcasts of pollPerAttempt seconds each.
makeTx is invoked once per send attempt and must return a transaction ready to broadcast. It does not have to build a brand-new transaction every time, but it is responsible for nonce safety across retries: a previous attempt's broadcast may still be pending or have been orphaned, so reusing an account naively can hit "nonce too low" or underpriced-replacement rejections. Returning a transaction from a freshly funded account each call is the simplest way to keep nonce space clean.
func (*L2ELNode) SafeHead ¶
func (el *L2ELNode) SafeHead() *BlockRefResult
func (*L2ELNode) TraceCalls ¶ added in v1.19.10
TraceCalls traces a transaction on this chain with the callTracer, return data included.
func (*L2ELNode) TransactionTimeout ¶
func (*L2ELNode) UnsafeHead ¶
func (el *L2ELNode) UnsafeHead() *BlockRefResult
func (*L2ELNode) UserRPC ¶ added in v1.19.10
UserRPC returns the execution node's user RPC endpoint.
func (*L2ELNode) VerifyWithdrawalHashChangedIn ¶
VerifyWithdrawalHashChangedIn verifies that the withdrawal hash changed between the parent and current block. This is used to verify that the withdrawal hash changed in the block where the withdrawal was initiated.
Some EL backends, such as op-reth, can briefly lag in serving historical proofs for a block that has already been inserted. Retry until the proof backend catches up instead of failing immediately.
func (L2ELNode) WaitForBlock ¶
func (L2ELNode) WaitForBlockNumber ¶
func (*L2ELNode) WaitForDeposit ¶ added in v1.19.10
WaitForDeposit waits until the deposit an L1 transaction made through this chain's portal has executed on this chain, and returns its L2 receipt without asserting its status.
func (L2ELNode) WaitForFinalization ¶
WaitForFinalization waits for the current block height to be finalized. Note that it does not ensure that the finalized block is the same as the current unsafe block (i.e., it is not reorg-aware).
func (*L2ELNode) WaitForGasUsed ¶ added in v1.19.6
func (el *L2ELNode) WaitForGasUsed(label eth.BlockLabel, minGasUsed uint64, timeout time.Duration) eth.BlockInfo
WaitForGasUsed waits for the head at label to use at least minGasUsed gas. Transient block-label lookup failures are retried until timeout.
func (L2ELNode) WaitForLabel ¶
func (L2ELNode) WaitForLabelRef ¶
func (L2ELNode) WaitForOnline ¶
func (el L2ELNode) WaitForOnline()
func (*L2ELNode) WaitForPendingNonceMatch ¶
func (el *L2ELNode) WaitForPendingNonceMatch(account common.Address, nonce uint64, attempts int, duration time.Duration)
WaitForPendingNonceMatch waits for the pending nonce of an account to match the reference nonce
func (*L2ELNode) WaitForPendingNonceMatchFn ¶
func (el *L2ELNode) WaitForPendingNonceMatchFn(account common.Address, nonce uint64, attempts int, duration time.Duration) CheckFunc
WaitForPendingNonceMatchFn returns a lambda that waits for the pending nonce of an account to match the provided reference nonce
func (*L2ELNode) WaitForReceipt ¶
WaitForReceipt waits for a transaction receipt to be available, retrying until found or timeout.
func (L2ELNode) WaitForTime ¶
WaitForTime waits until the chain has reached or surpassed the given timestamp.
func (L2ELNode) WaitForUnsafe ¶
func (L2ELNode) WaitForUnsafeRef ¶
func (*L2ELNode) WaitL1OriginHash ¶
WaitL1OriginHash polls until the L2 chain at the given label references the target L1 block. If the head's L1 origin has advanced past the target number (e.g. due to a large batch), it walks back through L2 blocks to find one with the target L1 origin number and checks its hash.
func (*L2ELNode) WaitL1OriginReached ¶
func (el *L2ELNode) WaitL1OriginReached(label eth.BlockLabel, l1OriginTarget uint64, attempts int)
WaitL1OriginReached waits for the L1 origin to reach the target block number.
type L2Network ¶
type L2Network struct {
// contains filtered or unexported fields
}
L2Network wraps a stack.L2Network interface for DSL operations
func NewL2Network ¶
func NewL2Network(inner stack.L2Network, primaryEL *L2ELNode, primaryCL *L2CLNode, primaryL1 *L1ELNode, archiveEL *L2ELNode, publicRPC *L2ELNode) *L2Network
NewL2Network creates a new L2Network DSL wrapper
func (*L2Network) AwaitActivation ¶
AwaitActivation awaits the fork activation time, and returns the activation block
func (*L2Network) DepositContractAddr ¶
func (*L2Network) DeriveData ¶
func (*L2Network) DeriveSpanBatches ¶ added in v1.19.5
DeriveSpanBatches monitors upcoming L1 blocks and returns the span batches submitted in them.
func (*L2Network) DisputeGameFactoryProxyAddr ¶
func (*L2Network) IsActivated ¶
IsActivated checks if a given fork has been activated
func (*L2Network) IsForkActiveAt ¶
func (*L2Network) L1CrossDomainMessengerAddr ¶ added in v1.19.10
L1CrossDomainMessengerAddr returns this chain's L1CrossDomainMessenger, read from its SystemConfig.
func (*L2Network) LatestBlockBeforeTimestamp ¶
LatestBlockBeforeTimestamp finds the latest block before fork activation
func (*L2Network) PrimaryL1EL ¶
func (*L2Network) PrintChain ¶
func (n *L2Network) PrintChain()
PrintChain is used for testing/debugging, it prints the blockchain hashes and parent hashes to logs, which is useful when developing reorg tests
func (*L2Network) TimestampForBlockNum ¶
TimestampForBlockNum returns the timestamp for the given L2 block number.
func (*L2Network) WaitForBatchTransaction ¶ added in v1.19.10
func (n *L2Network) WaitForBatchTransaction(afterL1Block uint64) (*ethtypes.Transaction, eth.BlockInfo)
WaitForBatchTransaction waits for and returns the first transaction to this network's batch inbox included after the given L1 block number, along with its L1 inclusion block. Transactions are matched by batch-inbox recipient; the sender is not checked.
func (*L2Network) WaitForBlock ¶
type L2Proposer ¶
type L2Proposer struct {
// contains filtered or unexported fields
}
L2Proposer wraps a stack.L2Proposer interface for DSL operations
func NewL2Proposer ¶
func NewL2Proposer(inner stack.L2Proposer) *L2Proposer
NewL2Proposer creates a new L2Proposer DSL wrapper
func (*L2Proposer) Escape ¶
func (p *L2Proposer) Escape() stack.L2Proposer
Escape returns the underlying stack.L2Proposer
func (*L2Proposer) String ¶
func (p *L2Proposer) String() string
type LagControlledSuperRootSource ¶ added in v1.19.6
type LagControlledSuperRootSource struct {
*SuperRootQuerier
// contains filtered or unexported fields
}
LagControlledSuperRootSource wraps a live super-root source with an RPC endpoint whose CurrentL1 can be held back while all other response data keeps updating.
func NewLagControlledSuperRootSource ¶ added in v1.19.6
func NewLagControlledSuperRootSource(t devtest.T, upstream SuperRootSource) *LagControlledSuperRootSource
NewLagControlledSuperRootSource captures and serves the upstream CurrentL1 as the visible progress boundary until Release is called.
func (*LagControlledSuperRootSource) Close ¶ added in v1.19.6
func (s *LagControlledSuperRootSource) Close()
Close shuts down the local RPC client and server. It is safe to call more than once; test cleanup calls it automatically.
func (*LagControlledSuperRootSource) Release ¶ added in v1.19.6
func (s *LagControlledSuperRootSource) Release()
Release waits until the upstream has strictly progressed beyond the held block, then atomically exposes its live CurrentL1.
type MultiClient ¶
type MultiClient struct {
// contains filtered or unexported fields
}
MultiClient is a simple client that checks hash consistency between underlying clients
func MultiClientForL1Network ¶
func MultiClientForL1Network(network *L1Network) (*MultiClient, error)
MultiClientForL1Network creates a MultiClient from an L1Network
func MultiClientForL2Network ¶
func MultiClientForL2Network(network *L2Network) (*MultiClient, error)
MultiClientForL2Network creates a MultiClient from an L2Network
func NewMultiClient ¶
func NewMultiClient(clients []HeaderProvider) *MultiClient
NewMultiClient creates a new MultiClient with the specified underlying clients
func (*MultiClient) InfoByHash ¶
InfoByHash returns block info from the first client while verifying hash consistency
func (*MultiClient) InfoByLabel ¶
func (mc *MultiClient) InfoByLabel(ctx context.Context, label eth.BlockLabel) (eth.BlockInfo, error)
InfoByLabel returns block info from the first client while verifying hash consistency
func (*MultiClient) InfoByNumber ¶
InfoByNumber returns block info from the first client while verifying hash consistency
type NewPayloadResult ¶
type NewPayloadResult struct {
T devtest.T
Status *eth.PayloadStatusV1
Err error
}
func (*NewPayloadResult) IsInvalid ¶
func (r *NewPayloadResult) IsInvalid() *NewPayloadResult
func (*NewPayloadResult) IsPayloadStatus ¶
func (r *NewPayloadResult) IsPayloadStatus(status eth.ExecutePayloadStatus) *NewPayloadResult
func (*NewPayloadResult) IsSyncing ¶
func (r *NewPayloadResult) IsSyncing() *NewPayloadResult
func (*NewPayloadResult) IsValid ¶
func (r *NewPayloadResult) IsValid() *NewPayloadResult
type OperatorFee ¶
type OperatorFee struct {
// contains filtered or unexported fields
}
func NewOperatorFee ¶
func NewOperatorFee(t devtest.T, l2Network *L2Network, l1EL *L1ELNode) *OperatorFee
func (*OperatorFee) CheckCompatibility ¶
func (of *OperatorFee) CheckCompatibility() bool
func (*OperatorFee) GetSystemOwner ¶
func (of *OperatorFee) GetSystemOwner() *EOA
func (*OperatorFee) RestoreOriginalConfig ¶
func (of *OperatorFee) RestoreOriginalConfig()
func (*OperatorFee) SetOperatorFee ¶
func (of *OperatorFee) SetOperatorFee(scalar uint32, constant uint64)
func (*OperatorFee) ValidateTransactionFees ¶
func (of *OperatorFee) ValidateTransactionFees(from *EOA, to *EOA, amount *big.Int, expectedScalar uint32, expectedConstant uint64) OperatorFeeValidationResult
func (*OperatorFee) VerifyL2Config ¶
func (of *OperatorFee) VerifyL2Config(expectedScalar uint32, expectedConstant uint64)
func (*OperatorFee) WaitForL2Sync ¶
func (of *OperatorFee) WaitForL2Sync(expectedScalar uint32, expectedConstant uint64)
func (*OperatorFee) WaitForL2SyncWithCurrentL1State ¶
func (of *OperatorFee) WaitForL2SyncWithCurrentL1State()
type ProvenWithdrawalParameters ¶
type ProvenWithdrawalParameters struct {
Nonce *big.Int
Sender common.Address
Target common.Address
Value *big.Int
GasLimit *big.Int
DisputeGameAddress common.Address
DisputeGameIndex *big.Int
Data []byte
OutputRootProof bindings.OutputRootProof
WithdrawalProof [][]byte // List of trie nodes to prove L2 storage
}
ProvenWithdrawalParameters is the set of parameters to pass to the ProveWithdrawalTransaction and FinalizeWithdrawalTransaction functions
type ResetWatch ¶ added in v1.20.1
type ResetWatch struct {
// contains filtered or unexported fields
}
ResetWatch observes an L2CL node in the background for a reset of its derivation pipeline and engine state. Start one with L2CLNode.WatchForReset and finish it with VerifyNoReset.
func (*ResetWatch) VerifyNoReset ¶ added in v1.20.1
func (w *ResetWatch) VerifyNoReset()
VerifyNoReset stops the watch and fails the test if it observed a reset, or if it could not read the node's sync status even once.
type SafetyHeads ¶ added in v1.19.0
SafetyHeads is a snapshot of an L2 CL's unsafe/safe/cross-safe/finalized block numbers.
type SafetyHeadsAdvancement ¶ added in v1.19.0
type SafetyHeadsAdvancement struct {
UnsafeDelta uint64
UnsafeAttempts int
SafeDelta uint64
SafeAttempts int
CrossSafeDelta uint64
CrossSafeAttempts int
FinalizedDelta uint64
FinalizedAttempts int
}
SafetyHeadsAdvancement is the per-level delta and attempt budget for asserting unsafe + safe + cross-safe + finalized progress together.
func DefaultSafetyHeadsAdvancement ¶ added in v1.19.0
func DefaultSafetyHeadsAdvancement() SafetyHeadsAdvancement
DefaultSafetyHeadsAdvancement: unsafe + safe + cross-safe within ~60s, finalized within ~720s (in-process L1 has FinalizedDistance=20 blocks @ 6s).
type SameTimestampPair ¶
type SameTimestampPair struct {
Trigger *txintent.InitTrigger
Message messages.Message
// contains filtered or unexported fields
}
SameTimestampPair holds a precomputed init message for same-timestamp interop testing. It allows creating exec messages that reference the init before it's actually included on chain. This is necessary for same-timestamp scenarios where the exec needs to reference an init that will be included in a block at the same timestamp.
func (*SameTimestampPair) SubmitExecTo ¶
func (p *SameTimestampPair) SubmitExecTo(executor *EOA) *txplan.PlannedTx
SubmitExecTo returns a planned exec transaction to the given EOA's chain, referencing this init. The test harness assigns deterministic nonces and includes the signed tx directly.
The init is not on chain yet: waiting for it would block the tx that produces it.
func (*SameTimestampPair) SubmitInit ¶
func (p *SameTimestampPair) SubmitInit() *txplan.PlannedTx
SubmitInit returns a planned init transaction for same-timestamp testing. The test harness assigns deterministic nonces and includes the signed tx directly.
func (*SameTimestampPair) SubmitInvalidExecTo ¶
func (p *SameTimestampPair) SubmitInvalidExecTo(executor *EOA) *txplan.PlannedTx
SubmitInvalidExecTo submits an exec message with an invalid log index. This creates an exec that references a non-existent log, which should be detected as invalid. Returns the planned tx; the test harness assigns deterministic nonces and includes the signed tx directly.
type SentMessage ¶ added in v1.19.10
type SentMessage struct {
Hash common.Hash
Source eth.ChainID
Destination eth.ChainID
Nonce *big.Int
Sender common.Address
Target common.Address
Message []byte
// LogIndex is the index of the SentMessage event in its transaction's receipt.
LogIndex int
}
SentMessage is an L2ToL2CrossDomainMessenger message, read from the SentMessage event that initiated it.
func SentMessageFromReceipt ¶ added in v1.19.10
SentMessageFromReceipt decodes the first L2ToL2CrossDomainMessenger SentMessage event in a receipt of a transaction on the chain `source`, and computes the message hash.
type StandardBridge ¶
type StandardBridge struct {
// contains filtered or unexported fields
}
func NewStandardBridge ¶
func NewStandardBridge(t devtest.T, l2Network *L2Network, l1EL *L1ELNode) *StandardBridge
func (*StandardBridge) CreateL2Token ¶
func (b *StandardBridge) CreateL2Token(l1TokenAddr common.Address, name string, symbol string, from *EOA) common.Address
CreateL2Token creates an L2 token using OptimismMintableERC20Factory and returns the token address
func (*StandardBridge) Deposit ¶
func (b *StandardBridge) Deposit(amount eth.ETH, from *EOA) Deposit
func (*StandardBridge) DisputeGameFinalityDelay ¶
func (b *StandardBridge) DisputeGameFinalityDelay() time.Duration
func (*StandardBridge) ERC20Deposit ¶
func (b *StandardBridge) ERC20Deposit(l1TokenAddr common.Address, l2TokenAddr common.Address, amount eth.ETH, from *EOA) *Deposit
ERC20Deposit performs an ERC20 deposit from L1 to L2
func (*StandardBridge) GameResolutionDelay ¶
func (b *StandardBridge) GameResolutionDelay() time.Duration
func (*StandardBridge) InitiateWithdrawal ¶
func (b *StandardBridge) InitiateWithdrawal(amount eth.ETH, from *EOA) *Withdrawal
func (*StandardBridge) PortalVersion ¶
func (b *StandardBridge) PortalVersion() string
func (*StandardBridge) ProveWithFaultProofParams ¶ added in v1.19.1
func (b *StandardBridge) ProveWithFaultProofParams(user *EOA, params withdrawals.ProvenWithdrawalParameters) *types.Receipt
func (*StandardBridge) RespectedGameType ¶
func (b *StandardBridge) RespectedGameType() uint32
func (*StandardBridge) UsesSuperRoots ¶
func (b *StandardBridge) UsesSuperRoots() bool
func (*StandardBridge) VerifyRespectedGameType ¶
func (b *StandardBridge) VerifyRespectedGameType(expected gameTypes.GameType)
func (*StandardBridge) WithdrawalDelay ¶
func (b *StandardBridge) WithdrawalDelay() time.Duration
func (*StandardBridge) WithdrawalFromReceipt ¶ added in v1.19.10
func (b *StandardBridge) WithdrawalFromReceipt(rcpt *types.Receipt) *Withdrawal
WithdrawalFromReceipt adopts an already-included L2 transaction that emitted a MessagePassed event as a Withdrawal (its first, if it emitted more), so it can be proven and finalized like one initiated by InitiateWithdrawal. Use it for withdrawals initiated by a contract call (e.g. an L2CrossDomainMessenger.sendMessage) rather than by a plain transfer to the message passer.
type SuperRootQuerier ¶ added in v1.19.5
type SuperRootQuerier struct {
// contains filtered or unexported fields
}
SuperRootQuerier is a SuperRootSource backed by a fixed apis.SupernodeQueryAPI. It is used directly as the op-node-backed source (see NewOpNodeSuperRoots) and embedded by Supernode, which adds op-supernode-only controls on top.
func NewOpNodeSuperRoots ¶ added in v1.19.5
func NewOpNodeSuperRoots(cl *L2CLNode) *SuperRootQuerier
NewOpNodeSuperRoots wraps a single op-node's superroot_atTimestamp endpoint as a super-root source. Only superroot_atTimestamp is served by op-node; SyncStatus (supernode_syncStatus) is not available on this source.
func (*SuperRootQuerier) AssertSuperRootAtTimestamp ¶ added in v1.19.5
func (s *SuperRootQuerier) AssertSuperRootAtTimestamp(l2SequenceNumber uint64, rootClaim common.Hash)
AssertSuperRootAtTimestamp asserts that the super-root at the given timestamp matches the expected root claim.
func (*SuperRootQuerier) AwaitFullyProcessedL1 ¶ added in v1.19.5
func (s *SuperRootQuerier) AwaitFullyProcessedL1(targetL1 uint64)
AwaitFullyProcessedL1 waits until the source has fully processed the given L1 block number. SuperRootAtTimestamp's CurrentL1 names the block currently being processed (L1[<CurrentL1] is fully processed), so this returns once CurrentL1.Number > targetL1.
func (*SuperRootQuerier) AwaitOptimisticBlockAtTimestamp ¶ added in v1.19.10
func (s *SuperRootQuerier) AwaitOptimisticBlockAtTimestamp( chainID eth.ChainID, timestamp uint64, ) eth.OptimisticBlock
AwaitOptimisticBlockAtTimestamp waits for one chain's optimistic output to become available.
func (*SuperRootQuerier) AwaitValidatedTimestamp ¶ added in v1.19.5
func (s *SuperRootQuerier) AwaitValidatedTimestamp(timestamp uint64)
AwaitValidatedTimestamp waits for the super-root at the given timestamp to be available.
func (*SuperRootQuerier) QueryAPI ¶ added in v1.19.5
func (s *SuperRootQuerier) QueryAPI() apis.SupernodeQueryAPI
QueryAPI returns the super-root query API for this source.
func (*SuperRootQuerier) SuperRootAtTimestamp ¶ added in v1.19.5
func (s *SuperRootQuerier) SuperRootAtTimestamp(timestamp uint64) eth.SuperRootAtTimestampResponse
SuperRootAtTimestamp fetches the super-root at the given timestamp.
func (*SuperRootQuerier) UserRPC ¶ added in v1.19.5
func (s *SuperRootQuerier) UserRPC() string
UserRPC returns the super-root source's RPC endpoint.
type SuperRootSource ¶ added in v1.19.5
type SuperRootSource interface {
QueryAPI() apis.SupernodeQueryAPI
UserRPC() string
SuperRootAtTimestamp(timestamp uint64) eth.SuperRootAtTimestampResponse
AssertSuperRootAtTimestamp(l2SequenceNumber uint64, rootClaim common.Hash)
AwaitValidatedTimestamp(timestamp uint64)
AwaitFullyProcessedL1(targetL1 uint64)
}
SuperRootSource is the super-root query surface the dispute-game DSL needs. It is satisfied by both op-supernode (interop, multi-chain) and op-node (non-interop, single-chain), letting the same dispute-game tests run against either source.
type Supernode ¶
type Supernode struct {
SuperRootQuerier
// contains filtered or unexported fields
}
Supernode wraps a stack.Supernode interface for DSL operations
func NewSupernode ¶
NewSupernode creates a new Supernode DSL wrapper
func NewSupernodeWithTestControl ¶
func NewSupernodeWithTestControl(inner stack.Supernode, testControl stack.SupernodeTestControl) *Supernode
NewSupernodeWithTestControl creates a new Supernode DSL wrapper with test control support. The testControl parameter can be nil if no test control is needed.
func (*Supernode) ActivationTimestamp ¶ added in v1.19.0
ActivationTimestamp returns the configured interop activation timestamp. Requires NewSupernodeWithTestControl.
func (*Supernode) AssertBackfillCovers ¶
func (s *Supernode) AssertBackfillCovers(depth time.Duration, blockTime uint64, chains ...eth.ChainID)
AssertBackfillCovers verifies, for each supplied chain, that the interop logs DB contains blocks spanning from a first-seal at or near the expected T_lo all the way to a latest-seal at or near the safe tip. Specifically it asserts the three invariants log backfill must preserve:
- firstSealed.Timestamp + blockTime > ActivationTimestamp (the first seal is at most one block before activation; when activation is not aligned to a block boundary, the block representing the chain state as of activation is the correct pairing anchor and is sealed).
- firstSealed.Timestamp < FirstVerifiableTimestamp() (the post-backfill handoff happens strictly after the backfilled range)
- firstSealed.Timestamp <= max(ActivationTimestamp, latestSealed.Timestamp - depth) + blockTime (backfill reached ~depth back, or all the way to activation if the chain is younger than depth)
This is the strongest test-side evidence that backfill actually populated the DB, rather than the supernode simply resuming off of existing disk state. Requires the Supernode to be created with NewSupernodeWithTestControl.
func (*Supernode) AwaitBackfillAttempts ¶
AwaitBackfillAttempts blocks until BackfillAttempts() >= minAttempts or the timeout elapses. Fails the test on timeout. Requires the Supernode to be created with NewSupernodeWithTestControl.
func (*Supernode) AwaitBackfillCompleted ¶
func (s *Supernode) AwaitBackfillCompleted()
AwaitBackfillCompleted blocks until the interop activity finishes its log backfill phase, or the timeout elapses. Fails the test on timeout. Requires the Supernode to be created with NewSupernodeWithTestControl.
func (*Supernode) AwaitFinalizationAdvanced ¶ added in v1.19.0
AwaitFinalizationAdvanced reads the supernode's current finalized timestamp from supernode_syncStatus and waits until it strictly advances past that value, then returns the new finalized timestamp. The first call therefore guarantees finalization has progressed past genesis (since genesis is the initial finalized timestamp).
func (*Supernode) AwaitVerificationStartsAt ¶ added in v1.19.0
AwaitVerificationStartsAt blocks until cold-start init completes, then asserts VerificationStartTimestamp equals expected. Requires NewSupernodeWithTestControl.
func (*Supernode) BackfillAttempts ¶
BackfillAttempts returns the number of log-backfill attempts since the running interop activity's most recent (re)start. Requires the Supernode to be created with NewSupernodeWithTestControl.
func (*Supernode) EnsureInteropPaused ¶
EnsureInteropPaused pauses interop after the latest local-safe timestamp. It verifies the last timestamp before the pause and returns the first unverified timestamp. Requires the Supernode to be created with NewSupernodeWithTestControl.
func (*Supernode) ManageVN ¶ added in v1.19.0
ManageVN registers a VN-proxy L2CLNode as hosted by this supernode so that Start() can re-establish its DSL-managed peer connections after a Stop/Start cycle. Initial peering is done by the sysgo runtime; this hook only matters across restarts driven through Supernode.Start.
func (*Supernode) PauseInterop ¶
PauseInterop pauses the interop activity at the given timestamp. When the interop activity attempts to process this timestamp, it returns early. This function is for integration test control only. Requires the Supernode to be created with NewSupernodeWithTestControl.
func (*Supernode) RestartWithFreshDataDir ¶ added in v1.19.0
func (s *Supernode) RestartWithFreshDataDir()
RestartWithFreshDataDir stops the supernode, deletes its on-disk data directory in full, and starts a fresh supernode against the same chain containers, virtual nodes, and externally-visible RPC address. Requires NewSupernodeWithTestControl.
func (*Supernode) ResumeInterop ¶
func (s *Supernode) ResumeInterop()
ResumeInterop clears any pause on the interop activity, allowing normal processing. This function is for integration test control only. Requires the Supernode to be created with NewSupernodeWithTestControl.
func (*Supernode) Start ¶ added in v1.19.0
func (s *Supernode) Start()
Start brings the supernode back up after Stop. Requires NewSupernodeWithTestControl. After the supernode is up, any VNs registered via ManageVN have their DSL-managed peer connections re-established, mirroring L2CLNode.Start.
func (*Supernode) Stop ¶ added in v1.19.0
func (s *Supernode) Stop()
Stop halts the supernode while preserving its data directory and RPC address. Requires NewSupernodeWithTestControl.
func (*Supernode) SuperRootAt ¶ added in v1.19.0
func (s *Supernode) SuperRootAt(timestamp uint64, expectedChainIDs ...eth.ChainID) eth.SuperRootAtTimestampResponse
SuperRootAt returns the validated super-root at the given timestamp, asserting that all expectedChainIDs are present. The timestamp must already be finalized; this method does not wait for finalization.
func (*Supernode) VerificationStartTimestamp ¶ added in v1.19.0
VerificationStartTimestamp returns the L2 timestamp the current interop activity began verifying at. Returns 0 before cold-start init completes. Requires NewSupernodeWithTestControl.
type SyncEOA ¶ added in v1.19.5
type SyncEOA struct {
// contains filtered or unexported fields
}
SyncEOA plans transactions for an account and submits them through a txinclude.Includer. Nonce management, resubmission, and concurrency behavior are provided by the supplied includer.
func NewSyncEOA ¶ added in v1.19.5
NewSyncEOA creates a SyncEOA backed by includer.
type SyncStatusProvider ¶
type SyncTester ¶
type SyncTester struct {
// contains filtered or unexported fields
}
SyncTester wraps a stack.SyncTester interface for DSL operations
func NewSyncTester ¶
func NewSyncTester(inner stack.SyncTester) *SyncTester
NewSyncTester creates a new Sync Tester DSL wrapper
func (*SyncTester) DeleteSession ¶
func (s *SyncTester) DeleteSession(sessionID string)
func (*SyncTester) Escape ¶
func (s *SyncTester) Escape() stack.SyncTester
Escape returns the underlying stack.SyncTester
func (*SyncTester) GetSession ¶
func (s *SyncTester) GetSession(sessionID string) *eth.SyncTesterSession
func (*SyncTester) ListSessions ¶
func (s *SyncTester) ListSessions() []string
func (*SyncTester) ResetAllSessions ¶ added in v1.19.0
func (s *SyncTester) ResetAllSessions()
func (*SyncTester) ResetSession ¶ added in v1.19.0
func (s *SyncTester) ResetSession(sessionID string)
type TestSequencer ¶
type TestSequencer struct {
// contains filtered or unexported fields
}
func NewTestSequencer ¶
func NewTestSequencer(inner stack.TestSequencer) *TestSequencer
func (*TestSequencer) AdvanceToBlockParent ¶ added in v1.19.10
func (s *TestSequencer) AdvanceToBlockParent(t devtest.T, network *L2Network, timestamp uint64) eth.L2BlockRef
AdvanceToBlockParent sequences empty blocks until the next block lands at timestamp. It returns that next block's parent.
func (*TestSequencer) BuildL1UntilSafeOriginPast ¶ added in v1.20.1
func (s *TestSequencer) BuildL1UntilSafeOriginPast(t devtest.T, l1ChainID eth.ChainID, l2EL *L2ELNode, startL1 uint64) eth.L2BlockRef
BuildL1UntilSafeOriginPast sequences L1 blocks one at a time until l2EL's safe head has an L1 origin above startL1, and returns that safe head so a test can reorg the L1 block it was derived from. The caller stops L1's own block production first, so this loop is the only L1 producer.
func (*TestSequencer) Escape ¶
func (s *TestSequencer) Escape() stack.TestSequencer
func (*TestSequencer) SequenceBlock ¶
SequenceBlock builds a block at deterministic timestamp (parent.Time + blockTime). This is useful for tests that need predictable block timestamps.
func (*TestSequencer) SequenceBlockWithPlannedTxs ¶ added in v1.19.10
func (s *TestSequencer) SequenceBlockWithPlannedTxs( t devtest.T, parent common.Hash, sender *EOA, planned ...*txplan.PlannedTx, )
SequenceBlockWithPlannedTxs assigns consecutive nonces and includes the planned transactions in one block.
func (*TestSequencer) SequenceBlockWithTxs ¶
func (s *TestSequencer) SequenceBlockWithTxs(t devtest.T, chainID eth.ChainID, parent common.Hash, rawTxs [][]byte)
SequenceBlockWithTxs builds a block with timestamp parent.Time + blockTime with the supplied transactions (bypassing the mempool). This makes it ideal for same-timestamp interop testing, and avoids the chance that transactions are sequenced into later blocks.
func (*TestSequencer) String ¶
func (s *TestSequencer) String() string
type VaultBalances ¶
type WaitForDisputeGameResolvedOpts ¶ added in v1.19.10
type WaitForDisputeGameResolvedOpts struct {
// Timeout bounds the wait. Tests that wait a game's chess clock out in wall-clock time, rather
// than skipping it with time travel, need more than the game's max clock duration.
Timeout time.Duration
}
WaitForDisputeGameResolvedOpts configures WaitForDisputeGameResolved.
type Withdrawal ¶
type Withdrawal struct {
// contains filtered or unexported fields
}
func (*Withdrawal) CheckFinalizable ¶ added in v1.20.1
func (w *Withdrawal) CheckFinalizable(prover *EOA) error
CheckFinalizable returns nil if the withdrawal proven by prover can be finalized at the latest L1 block, or the portal's checkWithdrawal revert otherwise.
func (*Withdrawal) DisputeGameMaxClockDuration ¶ added in v1.19.10
func (w *Withdrawal) DisputeGameMaxClockDuration() time.Duration
DisputeGameMaxClockDuration returns the max clock duration of the dispute game the withdrawal was proven against, as deployed.
func (*Withdrawal) FaultProofProveParams ¶ added in v1.19.1
func (w *Withdrawal) FaultProofProveParams(advanceTime ...func(time.Duration)) withdrawals.ProvenWithdrawalParameters
func (*Withdrawal) Finalize ¶
func (w *Withdrawal) Finalize(user *EOA)
func (*Withdrawal) FinalizeGasCost ¶
func (w *Withdrawal) FinalizeGasCost() eth.ETH
func (*Withdrawal) FinalizeReceipt ¶ added in v1.19.10
func (w *Withdrawal) FinalizeReceipt() *types.Receipt
FinalizeReceipt returns the receipt of the transaction that finalized the withdrawal.
func (*Withdrawal) InitiateBlockHash ¶
func (w *Withdrawal) InitiateBlockHash() common.Hash
func (*Withdrawal) InitiateGasCost ¶
func (w *Withdrawal) InitiateGasCost() eth.ETH
func (*Withdrawal) InitiateTxHash ¶ added in v1.19.1
func (w *Withdrawal) InitiateTxHash() common.Hash
func (*Withdrawal) Prove ¶
func (w *Withdrawal) Prove(user *EOA)
func (*Withdrawal) ProveAndFinalize ¶ added in v1.19.10
func (w *Withdrawal) ProveAndFinalize(user *EOA, maxGameClock time.Duration)
ProveAndFinalize proves the withdrawal as `user`, waits for the dispute game it was proven against to resolve, and finalizes it. An unchallenged game resolves once the defender's chess clock runs out, so this waits that clock out in wall-clock time: it requires the game to have a max clock duration of at most `maxGameClock` and allows twice the clock plus a minute. Finalize retries only briefly, so the proof maturity and game finality delays must be short too.
func (*Withdrawal) ProveGasCost ¶
func (w *Withdrawal) ProveGasCost() eth.ETH
func (*Withdrawal) ProvenDisputeGameIndex ¶ added in v1.19.5
func (w *Withdrawal) ProvenDisputeGameIndex() *big.Int
func (*Withdrawal) WaitForDisputeGameResolved ¶
func (w *Withdrawal) WaitForDisputeGameResolved(opts ...func(*WaitForDisputeGameResolvedOpts))
WaitForDisputeGameResolved waits for the dispute game the withdrawal was proven against to resolve in the defender's favour, retrying transient RPC errors.
Source Files
¶
- anchor_state_registry.go
- bridge.go
- check.go
- common.go
- conductor.go
- deposit_eoa.go
- doc.go
- ecotone_fees.go
- el.go
- engine.go
- eoa.go
- fjord_fees.go
- funder_eoa.go
- hd_wallet.go
- invalid_msg.go
- key.go
- l1_cl.go
- l1_el.go
- l1_network.go
- l2_batcher.go
- l2_challenger.go
- l2_cl.go
- l2_cl_reset_watch.go
- l2_cl_safety_heads.go
- l2_el.go
- l2_el_tx.go
- l2_network.go
- l2_proposer.go
- l2tol2_messenger.go
- message_expiry.go
- multi_client.go
- operator_fee.go
- opts.go
- params.go
- safedb.go
- sequencer.go
- super_root_source.go
- superchain_eth_bridge.go
- supernode.go
- sync_eoa.go
- sync_tester.go