stack

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster interface {
	Common
	ID() ClusterID

	DependencySet() depset.DependencySet
}

Cluster represents a set of chains that interop with each other. This may include L1 chains (although potentially not two-way interop due to consensus-layer limitations).

type ClusterID

type ClusterID genericID

ClusterID identifies a Cluster by name, is type-safe, and can be value-copied and used as map key.

func SortClusterIDs

func SortClusterIDs(ids []ClusterID) []ClusterID

func (ClusterID) MarshalText

func (id ClusterID) MarshalText() ([]byte, error)

func (ClusterID) String

func (id ClusterID) String() string

func (*ClusterID) UnmarshalText

func (id *ClusterID) UnmarshalText(data []byte) error

type Common

type Common interface {
	Logger() log.Logger
}

type ELNode

type ELNode interface {
	Common
	ChainID() eth.ChainID
	EthClient() apis.EthClient
}

type ExtensibleL1Network

type ExtensibleL1Network interface {
	ExtensibleNetwork
	L1Network
	AddL1ELNode(v L1ELNode)
	AddL1CLNode(v L1CLNode)
}

type ExtensibleL2Network

type ExtensibleL2Network interface {
	ExtensibleNetwork
	L2Network
	AddL2Batcher(v L2Batcher)
	AddL2Proposer(v L2Proposer)
	AddL2Challenger(v L2Challenger)
	AddL2CLNode(v L2CLNode)
	AddL2ELNode(v L2ELNode)
}

ExtensibleL2Network is an optional extension interface for L2Network, for adding new components to the chain. Used during test-setup, not generally during test execution.

type ExtensibleNetwork

type ExtensibleNetwork interface {
	Network
	AddUser(v User)
}

type ExtensibleSystem

type ExtensibleSystem interface {
	System
	AddSuperchain(v Superchain)
	AddCluster(v Cluster)
	AddL1Network(v L1Network)
	AddL2Network(v L2Network)
	AddSupervisor(v Supervisor)
}

ExtensibleSystem is an extension-interface to add new components to the system. Regular tests should not be modifying the system. Test gates may use this to remediate any shortcomings of an existing system.

type Faucet

type Faucet interface {
	Common
	ID() FaucetID
	// NewUser creates a new pre-funded user account
	NewUser() User
}

type FaucetID

type FaucetID idWithChain

FaucetID identifies a Faucet by name and chainID, is type-safe, and can be value-copied and used as map key.

func SortFaucetIDs

func SortFaucetIDs(ids []FaucetID) []FaucetID

func (FaucetID) MarshalText

func (id FaucetID) MarshalText() ([]byte, error)

func (FaucetID) String

func (id FaucetID) String() string

func (*FaucetID) UnmarshalText

func (id *FaucetID) UnmarshalText(data []byte) error

type Kind

type Kind string

Kind represents a kind of component, this is used to make each ID unique, even when encoded as text.

const ClusterKind Kind = "Cluster"
const FaucetKind Kind = "Faucet"
const L1CLNodeKind Kind = "L1CLNode"
const L1ELNodeKind Kind = "L1ELNode"
const L1NetworkKind Kind = "L1Network"
const L2BatcherKind Kind = "L2Batcher"
const L2CLNodeKind Kind = "L2CLNode"
const L2ChallengerKind Kind = "L2Challenger"
const L2ELNodeKind Kind = "L2ELNode"
const L2NetworkKind Kind = "L2Network"
const L2ProposerKind Kind = "L2Proposer"
const SuperchainKind Kind = "Superchain"
const SupervisorKind Kind = "Supervisor"
const UserKind Kind = "User"

func (Kind) MarshalText

func (k Kind) MarshalText() ([]byte, error)

func (Kind) String

func (k Kind) String() string

func (*Kind) UnmarshalText

func (k *Kind) UnmarshalText(data []byte) error

type L1CLNode

type L1CLNode interface {
	Common
	ID() L1CLNodeID

	BeaconClient() apis.BeaconClient
}

L1CLNode is a L1 ethereum consensus-layer node, aka Beacon node. This node may not be a full beacon node, and instead run a mock L1 consensus node.

type L1CLNodeID

type L1CLNodeID idWithChain

L1CLNodeID identifies a L1CLNode by name and chainID, is type-safe, and can be value-copied and used as map key.

func SortL1CLNodeIDs

func SortL1CLNodeIDs(ids []L1CLNodeID) []L1CLNodeID

func (L1CLNodeID) MarshalText

func (id L1CLNodeID) MarshalText() ([]byte, error)

func (L1CLNodeID) String

func (id L1CLNodeID) String() string

func (*L1CLNodeID) UnmarshalText

func (id *L1CLNodeID) UnmarshalText(data []byte) error

type L1ELNode

type L1ELNode interface {
	ID() L1ELNodeID

	ELNode
}

L1ELNode is a L1 ethereum execution-layer node

type L1ELNodeID

type L1ELNodeID idWithChain

L1ELNodeID identifies a L1ELNode by name and chainID, is type-safe, and can be value-copied and used as map key.

func SortL1ELNodeIDs

func SortL1ELNodeIDs(ids []L1ELNodeID) []L1ELNodeID

func (L1ELNodeID) MarshalText

func (id L1ELNodeID) MarshalText() ([]byte, error)

func (L1ELNodeID) String

func (id L1ELNodeID) String() string

func (*L1ELNodeID) UnmarshalText

func (id *L1ELNodeID) UnmarshalText(data []byte) error

type L1Network

type L1Network interface {
	Network
	ID() L1NetworkID

	L1ELNode(id L1ELNodeID) L1ELNode
	L1CLNode(id L1CLNodeID) L1CLNode

	L1ELNodes() []L1ELNodeID
	L1CLNodes() []L1CLNodeID
}

L1Network represents a L1 chain, a collection of configuration and node resources.

type L1NetworkID

type L1NetworkID idWithChain

L1NetworkID identifies a L1Network by name and chainID, is type-safe, and can be value-copied and used as map key.

func SortL1NetworkIDs

func SortL1NetworkIDs(ids []L1NetworkID) []L1NetworkID

func (L1NetworkID) MarshalText

func (id L1NetworkID) MarshalText() ([]byte, error)

func (L1NetworkID) String

func (id L1NetworkID) String() string

func (*L1NetworkID) UnmarshalText

func (id *L1NetworkID) UnmarshalText(data []byte) error

type L2Batcher

type L2Batcher interface {
	Common
	ID() L2BatcherID
}

L2Batcher represents an L2 batch-submission service, posting L2 data of an L2 to L1.

type L2BatcherID

type L2BatcherID idWithChain

L2BatcherID identifies a L2Batcher by name and chainID, is type-safe, and can be value-copied and used as map key.

func SortL2BatcherIDs

func SortL2BatcherIDs(ids []L2BatcherID) []L2BatcherID

func (L2BatcherID) MarshalText

func (id L2BatcherID) MarshalText() ([]byte, error)

func (L2BatcherID) String

func (id L2BatcherID) String() string

func (*L2BatcherID) UnmarshalText

func (id *L2BatcherID) UnmarshalText(data []byte) error

type L2CLNode

type L2CLNode interface {
	Common
	ID() L2CLNodeID

	RollupAPI() RollupAPI
}

L2CLNode is a L2 ethereum consensus-layer node

type L2CLNodeID

type L2CLNodeID idWithChain

L2CLNodeID identifies a L2CLNode by name and chainID, is type-safe, and can be value-copied and used as map key.

func SortL2CLNodeIDs

func SortL2CLNodeIDs(ids []L2CLNodeID) []L2CLNodeID

func (L2CLNodeID) MarshalText

func (id L2CLNodeID) MarshalText() ([]byte, error)

func (L2CLNodeID) String

func (id L2CLNodeID) String() string

func (*L2CLNodeID) UnmarshalText

func (id *L2CLNodeID) UnmarshalText(data []byte) error

type L2Challenger

type L2Challenger interface {
	Common
	ID() L2ChallengerID
}

type L2ChallengerID

type L2ChallengerID idWithChain

L2ChallengerID identifies a L2Challenger by name and chainID, is type-safe, and can be value-copied and used as map key.

func SortL2ChallengerIDs

func SortL2ChallengerIDs(ids []L2ChallengerID) []L2ChallengerID

func (L2ChallengerID) MarshalText

func (id L2ChallengerID) MarshalText() ([]byte, error)

func (L2ChallengerID) String

func (id L2ChallengerID) String() string

func (*L2ChallengerID) UnmarshalText

func (id *L2ChallengerID) UnmarshalText(data []byte) error

type L2Deployment

type L2Deployment interface {
	SystemConfigProxyAddr() common.Address
	DisputeGameFactoryProxyAddr() common.Address
}

type L2ELNode

type L2ELNode interface {
	ID() L2ELNodeID

	ELNode
}

L2ELNode is a L2 ethereum execution-layer node

type L2ELNodeID

type L2ELNodeID idWithChain

L2ELNodeID identifies a L2ELNode by name and chainID, is type-safe, and can be value-copied and used as map key.

func SortL2ELNodeIDs

func SortL2ELNodeIDs(ids []L2ELNodeID) []L2ELNodeID

func (L2ELNodeID) MarshalText

func (id L2ELNodeID) MarshalText() ([]byte, error)

func (L2ELNodeID) String

func (id L2ELNodeID) String() string

func (*L2ELNodeID) UnmarshalText

func (id *L2ELNodeID) UnmarshalText(data []byte) error

type L2Keys

type L2Keys interface {
	Secret(key devkeys.Key) *ecdsa.PrivateKey
	Address(key devkeys.Key) common.Address
}

type L2Network

type L2Network interface {
	Network
	ID() L2NetworkID
	RollupConfig() *rollup.Config
	Deployment() L2Deployment
	Keys() L2Keys

	Superchain() Superchain
	L1() L1Network
	Cluster() Cluster

	L2Batcher(id L2BatcherID) L2Batcher
	L2Proposer(id L2ProposerID) L2Proposer
	L2Challenger(id L2ChallengerID) L2Challenger
	L2CLNode(id L2CLNodeID) L2CLNode
	L2ELNode(id L2ELNodeID) L2ELNode

	L2Batchers() []L2BatcherID
	L2Proposers() []L2ProposerID
	L2Challengers() []L2ChallengerID
	L2CLNodes() []L2CLNodeID
	L2ELNodes() []L2ELNodeID
}

L2Network represents a L2 chain, a collection of configuration and node resources. There is an extension-interface ExtensibleL2Network for adding new components to the chain.

type L2NetworkID

type L2NetworkID idWithChain

L2NetworkID identifies a L2Network by name and chainID, is type-safe, and can be value-copied and used as map key.

func SortL2NetworkIDs

func SortL2NetworkIDs(ids []L2NetworkID) []L2NetworkID

func (L2NetworkID) MarshalText

func (id L2NetworkID) MarshalText() ([]byte, error)

func (L2NetworkID) String

func (id L2NetworkID) String() string

func (*L2NetworkID) UnmarshalText

func (id *L2NetworkID) UnmarshalText(data []byte) error

type L2Proposer

type L2Proposer interface {
	Common
	ID() L2ProposerID
}

L2Proposer is a L2 output proposer, posting claims of L2 state to L1.

type L2ProposerID

type L2ProposerID idWithChain

L2ProposerID identifies a L2Proposer by name and chainID, is type-safe, and can be value-copied and used as map key.

func SortL2ProposerIDs

func SortL2ProposerIDs(ids []L2ProposerID) []L2ProposerID

func (L2ProposerID) MarshalText

func (id L2ProposerID) MarshalText() ([]byte, error)

func (L2ProposerID) String

func (id L2ProposerID) String() string

func (*L2ProposerID) UnmarshalText

func (id *L2ProposerID) UnmarshalText(data []byte) error

type Network

type Network interface {
	Common

	ChainID() eth.ChainID

	ChainConfig() *params.ChainConfig

	Faucet() Faucet

	User(id UserID) User
	Users() []UserID
}

Network is an interface to an ethereum chain and its resources, with common properties between L1 and L2. For L1 or L2 specifics, see L1Network and L2Network extensions. A network hosts configuration resources and tracks participating nodes.

type Option

type Option func(setup *Setup)

Option is used to define a function that inspects and/or changes a System.

func (*Option) Add

func (fn *Option) Add(other ...Option)

Add changes the option into a new Option that that first applies the receiver, and then the other options. This is a convenience for bundling options together.

type Orchestrator

type Orchestrator interface {

	// T is the test-handle of the orchestrator.
	// This may not be a Go-test handle.
	// Orchestrators may be instantiated by dev-tools or test-package TestMain functions.
	T() T

	// Log is the logger of the orchestrator.
	// Use this logger if the output is not relevant to a specific test,
	// but to the orchestration of the system.
	Log() log.Logger
}

Orchestrator is the base interface for all system orchestrators. It imposes some common things across all orchestrators, but may also haveoptional extensions, that not every type of backend might support.

type RollupAPI

type RollupAPI interface {
	SyncStatus(ctx context.Context) (*eth.SyncStatus, error)
}

type Setup

type Setup struct {
	// Ctx is the context for option execution.
	// The caller of Option should cancel the context after completion of the option.
	// The context may be interrupted if the test is aborted during option execution.
	Ctx context.Context
	// Log is a setup-wide logger, and may be used after setup by the components created by the option.
	Log log.Logger
	// T is a minimal test interface for panic-checks / assertions,
	// and may be passed down into components created by the option.
	T T
	// Require is a helper around the above T, ready to assert against.
	Require *require.Assertions
	// System is the frontend presentation of the system under test,
	// this is where component interfaces are registered to make them available to the test.
	System ExtensibleSystem
	// Orchestrator is the backend responsible for managing components,
	// and providing backend-specific options where needed, e.g. spawning new services.
	Orchestrator Orchestrator
}

Setup provides inputs for Option, to use during system construction. This object is not meant to persist longer than the execution of applicable Option(s). New struct-fields may be added in the future, but existing fields should not be removed for compatibility with Option implementations.

type Superchain

type Superchain interface {
	Common
	ID() SuperchainID

	Deployment() SuperchainDeployment
}

Superchain is a collection of L2 chains with common rules and shared configuration on L1

type SuperchainDeployment

type SuperchainDeployment interface {
	ProtocolVersionsAddr() common.Address
	SuperchainConfigAddr() common.Address
}

type SuperchainID

type SuperchainID genericID

SuperchainID identifies a Superchain by name, is type-safe, and can be value-copied and used as map key.

func SortSuperchainIDs

func SortSuperchainIDs(ids []SuperchainID) []SuperchainID

func (SuperchainID) MarshalText

func (id SuperchainID) MarshalText() ([]byte, error)

func (SuperchainID) String

func (id SuperchainID) String() string

func (*SuperchainID) UnmarshalText

func (id *SuperchainID) UnmarshalText(data []byte) error

type Supervisor

type Supervisor interface {
	Common
	ID() SupervisorID

	AdminAPI() apis.SupervisorAdminAPI
	QueryAPI() apis.SupervisorQueryAPI
}

Supervisor is an interop service, used to cross-verify messages between chains.

type SupervisorID

type SupervisorID genericID

SupervisorID identifies a Supervisor by name and chainID, is type-safe, and can be value-copied and used as map key.

func SortSupervisorIDs

func SortSupervisorIDs(ids []SupervisorID) []SupervisorID

func (SupervisorID) MarshalText

func (id SupervisorID) MarshalText() ([]byte, error)

func (SupervisorID) String

func (id SupervisorID) String() string

func (*SupervisorID) UnmarshalText

func (id *SupervisorID) UnmarshalText(data []byte) error

type System

type System interface {
	Common

	Superchain(id SuperchainID) Superchain
	Cluster(id ClusterID) Cluster
	L1Network(id L1NetworkID) L1Network
	L2Network(id L2NetworkID) L2Network

	Superchains() []SuperchainID
	Clusters() []ClusterID
	L1Networks() []L1NetworkID
	L2Networks() []L2NetworkID

	// L1NetworkID looks up the L1NetworkID (system name) by eth ChainID
	L1NetworkID(id eth.ChainID) L1NetworkID
	// L2NetworkID looks up the L2NetworkID (system name) by eth ChainID
	L2NetworkID(id eth.ChainID) L2NetworkID

	Supervisor(id SupervisorID) Supervisor
	Supervisors() []SupervisorID
}

System represents a collection of L1 and L2 chains, any superchains or clusters, and any peripherals.

type T

type T interface {
	Errorf(format string, args ...interface{})
	FailNow()
	TempDir() string
	Cleanup(fn func())
	Logf(format string, args ...any)
	Helper()
	Name() string
}

T is a minimal subset of testing.T This can be implemented by tooling, or a *testing.T can be used directly. The T interface is only used in the stack package for sanity-checks, where local failure there and then is preferable over bubbling up the error.

type ToolingT

type ToolingT struct {
	// TestName, for t.Name() purposes
	TestName string

	// Errors will be logged here.
	Log log.Logger

	// Fail will be called to register a critical failure.
	// The implementer can choose to panic, crit-log, exit, etc. as preferred.
	Fail func()
	// contains filtered or unexported fields
}

ToolingT is a T implementation that can be used in tooling, when the devnet-SDK is not used in a regular Go test.

func NewToolingT

func NewToolingT(name string, logger log.Logger) *ToolingT

func (*ToolingT) Cleanup

func (t *ToolingT) Cleanup(fn func())

func (*ToolingT) Errorf

func (t *ToolingT) Errorf(format string, args ...interface{})

func (*ToolingT) FailNow

func (t *ToolingT) FailNow()

func (*ToolingT) Helper

func (t *ToolingT) Helper()

func (*ToolingT) Logf

func (t *ToolingT) Logf(format string, args ...any)

func (*ToolingT) Name

func (t *ToolingT) Name() string

func (*ToolingT) RunCleanup

func (t *ToolingT) RunCleanup()

RunCleanup runs the backlog of cleanup functions. It's inspired by the Go cleanup handler, fully cleaning up, even continuing to clean up when panics happen. It does not recover the go-routine from panicking however, that is up to the caller.

func (*ToolingT) TempDir

func (t *ToolingT) TempDir() string

type User

type User interface {
	Common

	ID() UserID

	Key() *ecdsa.PrivateKey
	Address() common.Address

	ChainID() eth.ChainID

	// EL is the default node used to interact with the chain
	EL() ELNode
}

User represents a single user-key, specific to a single chain, with a default connection to interact with the execution-layer of said chain.

type UserID

type UserID idWithChain

UserID identifies a User by name and chainID, is type-safe, and can be value-copied and used as map key.

func SortUserIDs

func SortUserIDs(ids []UserID) []UserID

func (UserID) MarshalText

func (id UserID) MarshalText() ([]byte, error)

func (UserID) String

func (id UserID) String() string

func (*UserID) UnmarshalText

func (id *UserID) UnmarshalText(data []byte) error

Jump to

Keyboard shortcuts

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