Documentation ¶
Index ¶
- Constants
- Variables
- func BuildOpProgramClient(t *testing.T) string
- func FinalizeWithdrawal(t *testing.T, cfg SystemConfig, l1Client *ethclient.Client, ...) (*types.Receipt, *types.Receipt, *types.Receipt)
- func InitParallel(t e2eutils.TestingBase, args ...func(t e2eutils.TestingBase))
- func ProveAndFinalizeWithdrawal(t *testing.T, cfg SystemConfig, clients ClientProvider, l2NodeName string, ...) (*types.Receipt, *types.Receipt, *types.Receipt, *types.Receipt)
- func ProveWithdrawal(t *testing.T, cfg SystemConfig, clients ClientProvider, l2NodeName string, ...) (withdrawals.ProvenWithdrawalParameters, *types.Receipt)
- func ProveWithdrawalParameters(ctx context.Context, proofCl withdrawals.ProofClient, ...) (withdrawals.ProvenWithdrawalParameters, error)
- func RunWithdrawalsTest(t *testing.T, sys CommonSystem)
- func SendDepositTx(t *testing.T, cfg SystemConfig, l1Client *ethclient.Client, ...) *types.Receipt
- func SendL2Tx(t *testing.T, cfg SystemConfig, l2Client *ethclient.Client, ...) *types.Receipt
- func SendWithdrawal(t *testing.T, cfg SystemConfig, l2Client *ethclient.Client, ...) (*types.Transaction, *types.Receipt)
- func SkipOnFaultProofs(t e2eutils.TestingBase)
- func SkipOnL2OO(t e2eutils.TestingBase)
- func UseHTTP() bool
- func UsesCannon(t e2eutils.TestingBase)
- type ClientProvider
- type CommonSystem
- type DepositContractConfig
- type DepositTxOpts
- type DepositTxOptsFn
- type EthInstance
- type ExternalEthClient
- type ExternalRunner
- type FnTracer
- type GethInstance
- type OpGeth
- func (d *OpGeth) AddL2Block(ctx context.Context, txs ...*types.Transaction) (*eth.ExecutionPayloadEnvelope, error)
- func (d *OpGeth) Close()
- func (d *OpGeth) CreatePayloadAttributes(txs ...*types.Transaction) (*eth.PayloadAttributes, error)
- func (d *OpGeth) StartBlockBuilding(ctx context.Context, attrs *eth.PayloadAttributes) (*eth.ForkchoiceUpdatedResult, error)
- type System
- func (sys *System) AdvanceTime(d time.Duration)
- func (sys *System) BatcherHelper() *batcher.Helper
- func (sys *System) Close()
- func (sys *System) Config() SystemConfig
- func (sys *System) L1BeaconEndpoint() string
- func (sys *System) L1BeaconHTTPClient() *sources.BeaconHTTPClient
- func (sys *System) L1Deployments() *genesis.L1Deployments
- func (sys *System) L1Slot(l1Timestamp uint64) uint64
- func (sys *System) L2Genesis() *core.Genesis
- func (sys *System) NodeClient(name string) *ethclient.Client
- func (sys *System) NodeEndpoint(name string) string
- func (sys *System) RollupCfg() *rollup.Config
- func (sys *System) RollupClient(name string) *sources.RollupClient
- func (sys *System) RollupEndpoint(name string) string
- func (sys *System) TestAccount(idx int) *ecdsa.PrivateKey
- type SystemConfig
- func CanyonSystemConfig(t *testing.T, canyonTimeOffset *hexutil.Uint64) SystemConfig
- func DefaultSystemConfig(t testing.TB) SystemConfig
- func DeltaSystemConfig(t *testing.T, deltaTimeOffset *hexutil.Uint64) SystemConfig
- func EcotoneSystemConfig(t *testing.T, ecotoneTimeOffset *hexutil.Uint64) SystemConfig
- func FjordSystemConfig(t *testing.T, fjordTimeOffset *hexutil.Uint64) SystemConfig
- func GraniteSystemConfig(t *testing.T, graniteTimeOffset *hexutil.Uint64) SystemConfig
- func RegolithSystemConfig(t *testing.T, regolithTimeOffset *hexutil.Uint64) SystemConfig
- type SystemConfigOption
- type SystemConfigOptions
- type TxOpts
- type TxOptsFn
- type WSOrHTTPEndpoint
- type WithdrawalTxOpts
- type WithdrawalTxOptsFn
Constants ¶
const ( Sequencer1Name = "sequencer1" Sequencer2Name = "sequencer2" Sequencer3Name = "sequencer3" VerifierName = "verifier" )
const ( RoleSeq = "sequencer" RoleVerif = "verifier" RoleL1 = "l1" )
const SolErrClaimAlreadyResolved = "0xf1a94581"
Variables ¶
var ( // ErrForkChoiceUpdatedNotValid is returned when a forkChoiceUpdated returns a status other than Valid ErrForkChoiceUpdatedNotValid = errors.New("forkChoiceUpdated status was not valid") // ErrNewPayloadNotValid is returned when a newPayload call returns a status other than Valid, indicating the new block is invalid ErrNewPayloadNotValid = errors.New("newPayload status was not valid") )
Functions ¶
func BuildOpProgramClient ¶ added in v1.0.6
BuildOpProgramClient builds the `op-program` client executable and returns the path to the resulting executable
func FinalizeWithdrawal ¶ added in v1.0.5
func FinalizeWithdrawal(t *testing.T, cfg SystemConfig, l1Client *ethclient.Client, privKey *ecdsa.PrivateKey, withdrawalProofReceipt *types.Receipt, params withdrawals.ProvenWithdrawalParameters) (*types.Receipt, *types.Receipt, *types.Receipt)
func InitParallel ¶ added in v1.0.5
func InitParallel(t e2eutils.TestingBase, args ...func(t e2eutils.TestingBase))
func ProveAndFinalizeWithdrawal ¶ added in v1.0.5
func ProveWithdrawal ¶ added in v1.0.5
func ProveWithdrawal(t *testing.T, cfg SystemConfig, clients ClientProvider, l2NodeName string, ethPrivKey *ecdsa.PrivateKey, l2WithdrawalReceipt *types.Receipt) (withdrawals.ProvenWithdrawalParameters, *types.Receipt)
func ProveWithdrawalParameters ¶ added in v1.7.2
func ProveWithdrawalParameters(ctx context.Context, proofCl withdrawals.ProofClient, l2ReceiptCl withdrawals.ReceiptClient, l2BlockCl withdrawals.BlockClient, txHash common.Hash, header *types.Header, l2OutputOracleContract *bindings.L2OutputOracleCaller, disputeGameFactoryContract *bindings.DisputeGameFactoryCaller, optimismPortal2Contract *bindingspreview.OptimismPortal2Caller) (withdrawals.ProvenWithdrawalParameters, error)
func RunWithdrawalsTest ¶ added in v1.9.0
func RunWithdrawalsTest(t *testing.T, sys CommonSystem)
TestWithdrawals checks that a deposit and then withdrawal execution succeeds. It verifies the balance changes on L1 and L2 and has to include gas fees in the balance checks. It does not check that the withdrawal can be executed prior to the end of the finality period.
func SendDepositTx ¶ added in v1.0.5
func SendDepositTx(t *testing.T, cfg SystemConfig, l1Client *ethclient.Client, l2Client *ethclient.Client, l1Opts *bind.TransactOpts, applyL2Opts DepositTxOptsFn) *types.Receipt
SendDepositTx creates and sends a deposit transaction. The L1 transaction, including sender, is configured by the l1Opts param. The L2 transaction options can be configured by modifying the DepositTxOps value supplied to applyL2Opts Will verify that the transaction is included with the expected status on L1 and L2 Returns the receipt of the L2 transaction
func SendL2Tx ¶ added in v1.0.5
func SendL2Tx(t *testing.T, cfg SystemConfig, l2Client *ethclient.Client, privKey *ecdsa.PrivateKey, applyTxOpts TxOptsFn) *types.Receipt
SendL2Tx creates and sends a transaction. The supplied privKey is used to specify the account to send from and the transaction is sent to the supplied l2Client Transaction options and expected status can be configured in the applyTxOpts function by modifying the supplied TxOpts Will verify that the transaction is included with the expected status on l2Client and any clients added to TxOpts.VerifyClients
func SendWithdrawal ¶ added in v1.0.5
func SendWithdrawal(t *testing.T, cfg SystemConfig, l2Client *ethclient.Client, privKey *ecdsa.PrivateKey, applyOpts WithdrawalTxOptsFn) (*types.Transaction, *types.Receipt)
func SkipOnFaultProofs ¶ added in v1.7.7
func SkipOnFaultProofs(t e2eutils.TestingBase)
func SkipOnL2OO ¶ added in v1.7.7
func SkipOnL2OO(t e2eutils.TestingBase)
func UsesCannon ¶ added in v1.4.2
func UsesCannon(t e2eutils.TestingBase)
Types ¶
type ClientProvider ¶ added in v1.4.2
type CommonSystem ¶ added in v1.9.0
type CommonSystem interface { NodeClient(role string) *ethclient.Client RollupClient(role string) *sources.RollupClient Config() SystemConfig TestAccount(int) *ecdsa.PrivateKey }
type DepositContractConfig ¶
type DepositTxOpts ¶ added in v1.0.5
type DepositTxOptsFn ¶ added in v1.0.5
type DepositTxOptsFn func(l2Opts *DepositTxOpts)
type EthInstance ¶ added in v1.1.6
type EthInstance interface { HTTPEndpoint() string WSEndpoint() string HTTPAuthEndpoint() string WSAuthEndpoint() string Close() error }
EthInstance is either an in process Geth or external process exposing its endpoints over the network
type ExternalEthClient ¶ added in v1.1.6
func (*ExternalEthClient) Close ¶ added in v1.1.6
func (eec *ExternalEthClient) Close() error
func (*ExternalEthClient) HTTPAuthEndpoint ¶ added in v1.1.6
func (eec *ExternalEthClient) HTTPAuthEndpoint() string
func (*ExternalEthClient) HTTPEndpoint ¶ added in v1.1.6
func (eec *ExternalEthClient) HTTPEndpoint() string
func (*ExternalEthClient) WSAuthEndpoint ¶ added in v1.1.6
func (eec *ExternalEthClient) WSAuthEndpoint() string
func (*ExternalEthClient) WSEndpoint ¶ added in v1.1.6
func (eec *ExternalEthClient) WSEndpoint() string
type ExternalRunner ¶ added in v1.1.6
type ExternalRunner struct { Name string BinPath string Genesis *core.Genesis JWTPath string // 4844: a datadir specifically for tx-pool blobs BlobPoolPath string }
func (*ExternalRunner) Run ¶ added in v1.1.6
func (er *ExternalRunner) Run(t testing.TB) *ExternalEthClient
type FnTracer ¶
type FnTracer struct { OnNewL1HeadFn func(ctx context.Context, sig eth.L1BlockRef) OnUnsafeL2PayloadFn func(ctx context.Context, from peer.ID, payload *eth.ExecutionPayloadEnvelope) OnPublishL2PayloadFn func(ctx context.Context, payload *eth.ExecutionPayloadEnvelope) }
func (*FnTracer) OnNewL1Head ¶
func (n *FnTracer) OnNewL1Head(ctx context.Context, sig eth.L1BlockRef)
func (*FnTracer) OnPublishL2Payload ¶
func (n *FnTracer) OnPublishL2Payload(ctx context.Context, payload *eth.ExecutionPayloadEnvelope)
func (*FnTracer) OnUnsafeL2Payload ¶
type GethInstance ¶ added in v1.1.6
func (*GethInstance) Close ¶ added in v1.1.6
func (gi *GethInstance) Close() error
func (*GethInstance) HTTPAuthEndpoint ¶ added in v1.1.6
func (gi *GethInstance) HTTPAuthEndpoint() string
func (*GethInstance) HTTPEndpoint ¶ added in v1.1.6
func (gi *GethInstance) HTTPEndpoint() string
func (*GethInstance) WSAuthEndpoint ¶ added in v1.1.6
func (gi *GethInstance) WSAuthEndpoint() string
func (*GethInstance) WSEndpoint ¶ added in v1.1.6
func (gi *GethInstance) WSEndpoint() string
type OpGeth ¶
type OpGeth struct { L2Client *ethclient.Client SystemConfig eth.SystemConfig L1ChainConfig *params.ChainConfig L2ChainConfig *params.ChainConfig L1Head eth.BlockInfo L2Head *eth.ExecutionPayload // contains filtered or unexported fields }
OpGeth is an actor that functions as a l2 op-geth node It provides useful functions for advancing and querying the chain
func (*OpGeth) AddL2Block ¶
func (d *OpGeth) AddL2Block(ctx context.Context, txs ...*types.Transaction) (*eth.ExecutionPayloadEnvelope, error)
AddL2Block Appends a new L2 block to the current chain including the specified transactions The L1Info transaction is automatically prepended to the created block
func (*OpGeth) CreatePayloadAttributes ¶
func (d *OpGeth) CreatePayloadAttributes(txs ...*types.Transaction) (*eth.PayloadAttributes, error)
CreatePayloadAttributes creates a valid PayloadAttributes containing a L1Info deposit transaction followed by the supplied transactions.
func (*OpGeth) StartBlockBuilding ¶
func (d *OpGeth) StartBlockBuilding(ctx context.Context, attrs *eth.PayloadAttributes) (*eth.ForkchoiceUpdatedResult, error)
StartBlockBuilding begins block building for the specified PayloadAttributes by sending a engine_forkChoiceUpdated call. The current L2Head is used as the parent of the new block. ErrForkChoiceUpdatedNotValid is returned if the forkChoiceUpdate call returns a status other than valid.
type System ¶
type System struct { Cfg SystemConfig RollupConfig *rollup.Config L2GenesisCfg *core.Genesis // Connections to running nodes EthInstances map[string]EthInstance Clients map[string]*ethclient.Client RawClients map[string]*rpc.Client RollupNodes map[string]*rollupNode.OpNode L2OutputSubmitter *l2os.ProposerService BatchSubmitter *bss.BatcherService Mocknet mocknet.Mocknet L1BeaconAPIAddr string // TimeTravelClock is nil unless SystemConfig.SupportL1TimeTravel was set to true // It provides access to the clock instance used by the L1 node. Calling TimeTravelClock.AdvanceBy // allows tests to quickly time travel L1 into the future. // Note that this time travel may occur in a single block, creating a very large difference in the Time // on sequential blocks. TimeTravelClock *clock.AdvancingClock // contains filtered or unexported fields }
func (*System) AdvanceTime ¶ added in v1.5.1
AdvanceTime advances the system clock by the given duration. If the [System.TimeTravelClock] is nil, this is a no-op.
func (*System) BatcherHelper ¶ added in v1.5.1
func (*System) Config ¶ added in v1.9.0
func (sys *System) Config() SystemConfig
func (*System) L1BeaconEndpoint ¶ added in v1.5.1
func (*System) L1BeaconHTTPClient ¶ added in v1.7.2
func (sys *System) L1BeaconHTTPClient() *sources.BeaconHTTPClient
func (*System) L1Deployments ¶ added in v1.4.2
func (sys *System) L1Deployments() *genesis.L1Deployments
func (*System) NodeClient ¶ added in v1.4.2
func (*System) NodeEndpoint ¶ added in v1.0.5
func (*System) RollupClient ¶ added in v1.4.2
func (sys *System) RollupClient(name string) *sources.RollupClient
func (*System) RollupEndpoint ¶ added in v1.4.2
func (*System) TestAccount ¶ added in v1.9.0
func (sys *System) TestAccount(idx int) *ecdsa.PrivateKey
type SystemConfig ¶
type SystemConfig struct { Secrets *e2eutils.Secrets L1InfoPredeployAddress common.Address DeployConfig *genesis.DeployConfig L1Deployments *genesis.L1Deployments JWTFilePath string JWTSecret [32]byte BlobsPath string // L1FinalizedDistance is the distance from the L1 head that L1 blocks will be artificially finalized on. L1FinalizedDistance uint64 Premine map[common.Address]*big.Int Nodes map[string]*rollupNode.Config // Per node config. Don't use populate rollup.Config Loggers map[string]log.Logger GethOptions map[string][]geth.GethOption ProposerLogger log.Logger BatcherLogger log.Logger ExternalL2Shim string // map of outbound connections to other nodes. Node names prefixed with "~" are unconnected but linked. // A nil map disables P2P completely. // Any node name not in the topology will not have p2p enabled. P2PTopology map[string][]string // Enables req-resp sync in the P2P nodes P2PReqRespSync bool // If the proposer can make proposals for L2 blocks derived from L1 blocks which are not finalized on L1 yet. NonFinalizedProposals bool // Explicitly disable batcher, for tests that rely on unsafe L2 payloads DisableBatcher bool // Configure data-availability type that is used by the batcher. DataAvailabilityType batcherFlags.DataAvailabilityType // Max L1 tx size for the batcher transactions BatcherMaxL1TxSizeBytes uint64 // Target number of frames to create per channel. Can be used to create // multi-blob transactions. // Default is 1 if unset. BatcherTargetNumFrames int // whether to actually use BatcherMaxL1TxSizeBytes for blobs, insteaf of max blob size BatcherUseMaxTxSizeForBlobs bool // SupportL1TimeTravel determines if the L1 node supports quickly skipping forward in time SupportL1TimeTravel bool // MaxPendingTransactions determines how many transactions the batcher will try to send // concurrently. 0 means unlimited. MaxPendingTransactions uint64 }
func CanyonSystemConfig ¶ added in v1.9.0
func CanyonSystemConfig(t *testing.T, canyonTimeOffset *hexutil.Uint64) SystemConfig
func DefaultSystemConfig ¶
func DefaultSystemConfig(t testing.TB) SystemConfig
func DeltaSystemConfig ¶ added in v1.9.0
func DeltaSystemConfig(t *testing.T, deltaTimeOffset *hexutil.Uint64) SystemConfig
func EcotoneSystemConfig ¶ added in v1.9.0
func EcotoneSystemConfig(t *testing.T, ecotoneTimeOffset *hexutil.Uint64) SystemConfig
func FjordSystemConfig ¶ added in v1.9.0
func FjordSystemConfig(t *testing.T, fjordTimeOffset *hexutil.Uint64) SystemConfig
func GraniteSystemConfig ¶ added in v1.9.0
func GraniteSystemConfig(t *testing.T, graniteTimeOffset *hexutil.Uint64) SystemConfig
func RegolithSystemConfig ¶ added in v1.9.0
func RegolithSystemConfig(t *testing.T, regolithTimeOffset *hexutil.Uint64) SystemConfig
func (SystemConfig) L1ChainIDBig ¶
func (cfg SystemConfig) L1ChainIDBig() *big.Int
func (SystemConfig) L2ChainIDBig ¶
func (cfg SystemConfig) L2ChainIDBig() *big.Int
func (SystemConfig) Start ¶
func (cfg SystemConfig) Start(t *testing.T, _opts ...SystemConfigOption) (*System, error)
type SystemConfigOption ¶
type SystemConfigOption struct {
// contains filtered or unexported fields
}
type SystemConfigOptions ¶
type SystemConfigOptions struct {
// contains filtered or unexported fields
}
func NewSystemConfigOptions ¶
func NewSystemConfigOptions(_opts []SystemConfigOption) (SystemConfigOptions, error)
func (*SystemConfigOptions) Get ¶
func (s *SystemConfigOptions) Get(key, role string) (systemConfigHook, bool)
type TxOpts ¶ added in v1.0.5
type TxOpts struct { ToAddr *common.Address Nonce uint64 Value *big.Int Gas uint64 GasTipCap *big.Int GasFeeCap *big.Int Data []byte ExpectedStatus uint64 VerifyClients []*ethclient.Client }
func (*TxOpts) VerifyOnClients ¶ added in v1.0.5
VerifyOnClients adds additional l2 clients that should sync the block the tx is included in Checks that the receipt received from these clients is equal to the receipt received from the sequencer
type WSOrHTTPEndpoint ¶ added in v1.1.6
type WithdrawalTxOpts ¶ added in v1.0.5
type WithdrawalTxOpts struct { ToAddr *common.Address Nonce uint64 Value *big.Int Gas uint64 Data []byte ExpectedStatus uint64 VerifyClients []*ethclient.Client }
func (*WithdrawalTxOpts) VerifyOnClients ¶ added in v1.0.5
func (o *WithdrawalTxOpts) VerifyOnClients(clients ...*ethclient.Client)
VerifyOnClients adds additional l2 clients that should sync the block the tx is included in Checks that the receipt received from these clients is equal to the receipt received from the sequencer
type WithdrawalTxOptsFn ¶ added in v1.0.5
type WithdrawalTxOptsFn func(opts *WithdrawalTxOpts)