e2e

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 25 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

func Run added in v0.1.4

func Run(
	ctx context.Context,
	env *environment.Env,
	outDir string,
) error

Types

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) ChainID added in v0.1.4

func (m *MonomerClient) ChainID(ctx context.Context) (*big.Int, 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 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
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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