dsl

package
v1.13.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2025 License: MIT Imports: 30 Imported by: 1

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

View Source
const DefaultTimeout = 30 * time.Second

Variables

This section is empty.

Functions

func CheckAll

func CheckAll(t devtest.T, checks ...CheckFunc)

func WithAllLocalUnsafeHeadsAdvancedBy

func WithAllLocalUnsafeHeadsAdvancedBy(blocks uint64) func(cfg *VerifySyncStatusConfig)

WithAllLocalUnsafeHeadsAdvancedBy verifies that the local unsafe head of every chain advances by at least the specified number of blocks compared to the value when VerifySyncStatus is called.

Types

type CheckFunc

type CheckFunc func() error

type Cluster

type Cluster struct {
	// contains filtered or unexported fields
}

Cluster wraps a stack.Cluster interface for DSL operations

func NewCluster

func NewCluster(inner stack.Cluster) *Cluster

NewCluster creates a new Cluster DSL wrapper

func (*Cluster) Escape

func (c *Cluster) Escape() stack.Cluster

Escape returns the underlying stack.Cluster

func (*Cluster) String

func (c *Cluster) String() string

type ELNode

type ELNode interface {
	ChainID() eth.ChainID
	// contains filtered or unexported methods
}

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 NewEOA

func NewEOA(key *Key, el ELNode) *EOA

func (*EOA) Address

func (u *EOA) Address() common.Address

func (*EOA) ChainID

func (u *EOA) ChainID() eth.ChainID

func (*EOA) DeployEventLogger

func (u *EOA) DeployEventLogger() common.Address

func (*EOA) Key

func (u *EOA) Key() *Key

Key returns the cross-chain user identity/key, i.e. the user but detached it from the EL node.

func (*EOA) Plan

func (u *EOA) Plan() txplan.Option

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

func (u *EOA) PlanTransfer(to common.Address, amount eth.ETH) txplan.Option

PlanTransfer creates the tx-plan options to perform a transfer of the given amount of ETH to the given account.

func (*EOA) String

func (u *EOA) String() string

func (*EOA) Transact

func (u *EOA) Transact(opts ...txplan.Option) *txplan.PlannedTx

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

func (u *EOA) Transfer(to common.Address, amount eth.ETH) *txplan.PlannedTx

Transfer transfers the given amount of ETH to the given account, immediately.

func (*EOA) VerifyBalanceExact

func (u *EOA) VerifyBalanceExact(v eth.ETH)

VerifyBalanceExact verifies balance == v

func (*EOA) VerifyBalanceLessThan

func (u *EOA) VerifyBalanceLessThan(v eth.ETH)

VerifyBalanceLessThan verifies balance < v

type Faucet

type Faucet struct {
	// contains filtered or unexported fields
}

Faucet wraps a stack.Faucet interface for DSL operations. A Faucet is chain-specific. Note: Faucet wraps a stack component, to share faucet operations in kurtosis by hosting it as service, and prevent race-conditions with the account that sends out the faucet funds.

func NewFaucet

func NewFaucet(inner stack.Faucet) *Faucet

NewFaucet creates a new Faucet DSL wrapper

func (*Faucet) Escape

func (f *Faucet) Escape() stack.Faucet

Escape returns the underlying stack.Faucet

func (*Faucet) Fund

func (f *Faucet) Fund(addr common.Address, amount eth.ETH)

Fund funds the given address with the given amount of ETH

func (*Faucet) String

func (f *Faucet) String() string

type Funder

type Funder struct {
	// contains filtered or unexported fields
}

func NewFunder

func NewFunder(w *HDWallet, f *Faucet, el ELNode) *Funder

func (*Funder) NewFundedEOA

func (f *Funder) NewFundedEOA(amount eth.ETH) *EOA

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.

func NewHDWallet

func NewHDWallet(t devtest.T, mnemonic string, startIndex uint64) *HDWallet

func (*HDWallet) NewEOA

func (w *HDWallet) NewEOA(el ELNode) *EOA

NewEOA creates a new Key and wraps it with an EL node into a new EOA

func (*HDWallet) NewKey

func (w *HDWallet) NewKey() *Key

NewKey creates a new chain-agnostic account identity

func (*HDWallet) String

func (w *HDWallet) String() string

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 NewKey

func NewKey(t devtest.T, priv *ecdsa.PrivateKey) *Key

func (*Key) Address

func (a *Key) Address() common.Address

func (*Key) Plan

func (a *Key) Plan() txplan.Option

Plan returns the tx-plan option to use this Key for signing of a transaction.

func (*Key) String

func (a *Key) String() string

func (*Key) User

func (a *Key) User(el ELNode) *EOA

EOA combines this Key with an EL node into a single-chain EOA.

type L1CLNode

type L1CLNode struct {
	// contains filtered or unexported fields
}

L1CLNode wraps a stack.L1CLNode interface for DSL operations

func NewL1CLNode

func NewL1CLNode(inner stack.L1CLNode) *L1CLNode

NewL1CLNode creates a new L1CLNode DSL wrapper

func (*L1CLNode) Escape

func (cl *L1CLNode) Escape() stack.L1CLNode

Escape returns the underlying stack.L1CLNode

func (*L1CLNode) String

func (cl *L1CLNode) String() string

type L1ELNode

type L1ELNode struct {
	// contains filtered or unexported fields
}

L1ELNode wraps a stack.L1ELNode interface for DSL operations

func NewL1ELNode

func NewL1ELNode(inner stack.L1ELNode) *L1ELNode

NewL1ELNode creates a new L1ELNode DSL wrapper

func (L1ELNode) ChainID

func (el L1ELNode) ChainID() eth.ChainID

func (*L1ELNode) Escape

func (el *L1ELNode) Escape() stack.L1ELNode

Escape returns the underlying stack.L1ELNode

func (*L1ELNode) String

func (el *L1ELNode) String() string

func (L1ELNode) WaitForBlock

func (el L1ELNode) WaitForBlock()

type L1Network

type L1Network struct {
	// contains filtered or unexported fields
}

L1Network wraps a stack.L1Network interface for DSL operations

func NewL1Network

func NewL1Network(inner stack.L1Network) *L1Network

NewL1Network creates a new L1Network DSL wrapper

func (*L1Network) ChainID

func (n *L1Network) ChainID() eth.ChainID

func (*L1Network) Escape

func (n *L1Network) Escape() stack.L1Network

Escape returns the underlying stack.L1Network

func (*L1Network) String

func (n *L1Network) String() string

func (*L1Network) WaitForBlock

func (n *L1Network) WaitForBlock()

type L2Batcher

type L2Batcher struct {
	// contains filtered or unexported fields
}

L2Batcher wraps a stack.L2Batcher interface for DSL operations

func NewL2Batcher

func NewL2Batcher(inner stack.L2Batcher) *L2Batcher

NewL2Batcher creates a new L2Batcher DSL wrapper

func (*L2Batcher) ActivityAPI

func (b *L2Batcher) ActivityAPI() apis.BatcherActivity

func (*L2Batcher) Escape

func (b *L2Batcher) Escape() stack.L2Batcher

Escape returns the underlying stack.L2Batcher

func (*L2Batcher) String

func (b *L2Batcher) String() string

type L2CLNode

type L2CLNode struct {
	// contains filtered or unexported fields
}

L2CLNode wraps a stack.L2CLNode interface for DSL operations

func NewL2CLNode

func NewL2CLNode(inner stack.L2CLNode, control stack.ControlPlane, chainID eth.ChainID) *L2CLNode

NewL2CLNode creates a new L2CLNode DSL wrapper

func (*L2CLNode) Advanced

func (cl *L2CLNode) Advanced(lvl types.SafetyLevel, delta uint64, attempts int) CheckFunc

Advanced 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) ChainID

func (cl *L2CLNode) ChainID() eth.ChainID

func (*L2CLNode) DisconnectPeer

func (cl *L2CLNode) DisconnectPeer(peer *L2CLNode)

func (*L2CLNode) Escape

func (cl *L2CLNode) Escape() stack.L2CLNode

Escape returns the underlying stack.L2CLNode

func (*L2CLNode) HeadBlockRef

func (cl *L2CLNode) HeadBlockRef(lvl types.SafetyLevel) eth.L2BlockRef

HeadBlockRef fetches L2CL sync status and returns block ref with given safety level

func (*L2CLNode) PeerInfo

func (cl *L2CLNode) PeerInfo() *apis.PeerInfo

func (*L2CLNode) Peers

func (cl *L2CLNode) Peers() *apis.PeerDump

func (*L2CLNode) Reached

func (cl *L2CLNode) Reached(lvl types.SafetyLevel, target uint64, attempts int) CheckFunc

Reached 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) SafeL2BlockRef

func (cl *L2CLNode) SafeL2BlockRef() eth.L2BlockRef

func (*L2CLNode) Start

func (cl *L2CLNode) Start()

func (*L2CLNode) Stop

func (cl *L2CLNode) Stop()

func (*L2CLNode) String

func (cl *L2CLNode) String() string

func (*L2CLNode) SyncStatus

func (cl *L2CLNode) SyncStatus() *eth.SyncStatus

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

func NewL2ELNode(inner stack.L2ELNode) *L2ELNode

NewL2ELNode creates a new L2ELNode DSL wrapper

func (*L2ELNode) Advance

func (el *L2ELNode) Advance(label eth.BlockLabel, block uint64) CheckFunc

func (*L2ELNode) BlockRefByLabel

func (el *L2ELNode) BlockRefByLabel(label eth.BlockLabel) eth.BlockRef

func (*L2ELNode) BlockRefByNumber

func (el *L2ELNode) BlockRefByNumber(num uint64) eth.BlockRef

func (L2ELNode) ChainID

func (el L2ELNode) ChainID() eth.ChainID

func (*L2ELNode) DoesNotAdvance

func (el *L2ELNode) DoesNotAdvance(label eth.BlockLabel) CheckFunc

func (*L2ELNode) Escape

func (el *L2ELNode) Escape() stack.L2ELNode

Escape returns the underlying stack.L2ELNode

func (*L2ELNode) String

func (el *L2ELNode) String() string

func (L2ELNode) WaitForBlock

func (el L2ELNode) WaitForBlock()

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) *L2Network

NewL2Network creates a new L2Network DSL wrapper

func (*L2Network) AwaitActivation

func (n *L2Network) AwaitActivation(t devtest.T, forkTimestamp *uint64) eth.BlockRef

AwaitActivation awaits the fork activation time, and returns the activation block

func (*L2Network) CatchUpTo

func (n *L2Network) CatchUpTo(o *L2Network)

func (*L2Network) ChainID

func (n *L2Network) ChainID() eth.ChainID

func (*L2Network) Escape

func (n *L2Network) Escape() stack.L2Network

Escape returns the underlying stack.L2Network

func (*L2Network) LatestBlockBeforeTimestamp

func (n *L2Network) LatestBlockBeforeTimestamp(t devtest.T, timestamp uint64) eth.BlockRef

LatestBlockBeforeTimestamp finds the latest block before fork activation

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) String

func (n *L2Network) String() string

func (*L2Network) UnsafeHeadRef

func (n *L2Network) UnsafeHeadRef() eth.BlockRef

func (*L2Network) WaitForBlock

func (n *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 Sequencer

type Sequencer struct {
	// contains filtered or unexported fields
}

func NewSequencer

func NewSequencer(inner stack.Sequencer) *Sequencer

func (*Sequencer) Escape

func (s *Sequencer) Escape() stack.Sequencer

func (*Sequencer) String

func (s *Sequencer) String() string

type Superchain

type Superchain struct {
	// contains filtered or unexported fields
}

Superchain wraps a stack.Superchain interface for DSL operations

func NewSuperchain

func NewSuperchain(inner stack.Superchain) *Superchain

NewSuperchain creates a new Superchain DSL wrapper

func (*Superchain) Escape

func (s *Superchain) Escape() stack.Superchain

Escape returns the underlying stack.Superchain

func (*Superchain) String

func (s *Superchain) String() string

type Supervisor

type Supervisor struct {
	// contains filtered or unexported fields
}

func NewSupervisor

func NewSupervisor(inner stack.Supervisor) *Supervisor

func (*Supervisor) AdvancedL2Head

func (s *Supervisor) AdvancedL2Head(chainID eth.ChainID, delta uint64, lvl types.SafetyLevel, attempts int)

AdvancedL2Head checks the supervisor view of L2CL chain head with given safety level advanced more than delta block number

func (*Supervisor) AdvancedSafeHead

func (s *Supervisor) AdvancedSafeHead(chainID eth.ChainID, block uint64, attempts int)

func (*Supervisor) AdvancedUnsafeHead

func (s *Supervisor) AdvancedUnsafeHead(chainID eth.ChainID, block uint64)

func (*Supervisor) Escape

func (s *Supervisor) Escape() stack.Supervisor

func (*Supervisor) FetchSyncStatus

func (s *Supervisor) FetchSyncStatus() eth.SupervisorSyncStatus

func (*Supervisor) L2HeadBlockID

func (s *Supervisor) L2HeadBlockID(chainID eth.ChainID, lvl types.SafetyLevel) eth.BlockID

L2HeadBlockID fetches supervisor sync status and returns block id with given safety level

func (*Supervisor) SafeBlockID

func (s *Supervisor) SafeBlockID(chainID eth.ChainID) eth.BlockID

func (*Supervisor) String

func (s *Supervisor) String() string

func (*Supervisor) VerifySyncStatus

func (s *Supervisor) VerifySyncStatus(opts ...func(config *VerifySyncStatusConfig))

VerifySyncStatus performs assertions based on the supervisor's SyncStatus endpoint.

type VerifySyncStatusConfig

type VerifySyncStatusConfig struct {
	AllUnsafeHeadsAdvance uint64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL