e2e

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: Apache-2.0 Imports: 64 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWithdrawalTx

func NewWithdrawalTx(nonce int64, sender, target common.Address, value, gasLimit *big.Int) *crossdomain.Withdrawal

func ProveWithdrawalParameters

func ProveWithdrawalParameters(
	stack *StackConfig,
	withdrawalTx crossdomain.Withdrawal,
	l2BlockNumber *big.Int,
) (withdrawals.ProvenWithdrawalParameters, error)

ProveWithdrawalParameters queries L1 & L2 to generate all withdrawal parameters and proof necessary to prove a withdrawal on L1. The l2BlockNumber provided is very important. It should be a block that is greater than or equal to the block where the withdrawal was initiated on L2 and needs to have a submitted output in the L2 Output Oracle contract. If not, the withdrawal will fail since the storage proof cannot be verified if there is no submitted state root.

For example, if a withdrawal was initiated on L2 block 7 and the proposer submits an L2 output to L1 every 5 L2 blocks, then the L2 block number to prove against for the withdrawal would need to be in the following subset: (10, 15, 20, 25, ...)

ProveWithdrawalParameters is heavily inspired by ProveWithdrawalParametersForBlock in the optimism repo. https://github.com/ethereum-optimism/optimism/blob/5b13bad/op-node/withdrawals/utils.go#L75

Types

type EventListener

type EventListener interface {
	OPEventListener
	node.EventListener
}

type L1Client

type L1Client struct {
	*ethclient.Client
	// contains filtered or unexported fields
}

func NewL1Client

func NewL1Client(client *rpc.Client) *L1Client

type MonomerClient

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

func NewMonomerClient

func NewMonomerClient(client *rpc.Client) *MonomerClient

func (*MonomerClient) BlockByNumber

func (m *MonomerClient) BlockByNumber(ctx context.Context, number *big.Int) (*ethtypes.Block, error)

func (*MonomerClient) GenesisHash

func (m *MonomerClient) GenesisHash(ctx context.Context) (common.Hash, error)

func (*MonomerClient) GetProof

func (m *MonomerClient) GetProof(
	ctx context.Context,
	account common.Address,
	keys []string,
	blockNumber *big.Int,
) (*gethclient.AccountResult, error)

GetProof returns the account and storage values of the specified account including the Merkle-proof. The block number can be nil, in which case the value is taken from the latest known block.

type NodeSelectiveListener

type NodeSelectiveListener = node.SelectiveListener

NodeSelectiveListener aliases node.SelectiveListener to avoid name collisions.

type OPEventListener

type OPEventListener interface {
	// Log may be called many times.
	Log(r slog.Record)
}

type OPStack

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

func NewOPStack

func NewOPStack(
	l1URL,
	engineURL,
	nodeURL *url.URL,
	l2OutputOracleProxy common.Address,
	batcherPrivKey *ecdsa.PrivateKey,
	proposerPrivKey *ecdsa.PrivateKey,
	rollupConfig *rollup.Config,
	eventListener OPEventListener,
) *OPStack

func (*OPStack) Run

func (op *OPStack) Run(ctx context.Context, env *environment.Env) error

type SelectiveListener

type SelectiveListener struct {
	*NodeSelectiveListener

	OPLogCb func(slog.Record)
}

func (*SelectiveListener) Log

func (s *SelectiveListener) Log(r slog.Record)

type StackConfig

type StackConfig struct {
	Ctx                  context.Context
	Users                []*ecdsa.PrivateKey
	L1Client             *L1Client
	L1Deployments        *opgenesis.L1Deployments
	OptimismPortal       *bindings.OptimismPortal
	L1StandardBridge     *opbindings.L1StandardBridge
	L2OutputOracleCaller *bindings.L2OutputOracleCaller
	L2Client             *bftclient.HTTP
	MonomerClient        *MonomerClient
	RollupConfig         *rollup.Config
	WaitL1               func(numBlocks int) error
	WaitL2               func(numBlocks int) error
}

func Setup

func Setup(
	ctx context.Context,
	env *environment.Env,
	prometheusCfg *config.InstrumentationConfig,
	eventListener EventListener,
) (*StackConfig, error)

Setup creates and runs a new stack for end-to-end testing.

It assumes availability of hard-coded local URLs for the Monomer engine, Comet, and OP node.

It returns a StackConfig with L1 and L2 clients, the rollup config, and operator and user accounts.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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