helpers

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const SolErrClaimAlreadyResolved = "0xf1a94581"

Variables

This section is empty.

Functions

func CalcGasFees

func CalcGasFees(gasUsed uint64, gasTipCap *big.Int, gasFeeCap *big.Int, baseFee *big.Int) *big.Int

CalcGasFees determines the actual cost of the transaction given a specific base fee This does not include the L1 data fee charged from L2 transactions.

func FinalizeWithdrawal

func FinalizeWithdrawal(t *testing.T, cfg e2esys.SystemConfig, l1Client *ethclient.Client, privKey *ecdsa.PrivateKey, withdrawalProofReceipt *types.Receipt, params withdrawals.ProvenWithdrawalParameters) (*types.Receipt, *types.Receipt, *types.Receipt)

func ProveAndFinalizeWithdrawal

func ProveAndFinalizeWithdrawal(
	t *testing.T,
	cfg e2esys.SystemConfig,
	clients ClientProvider,
	l2NodeName string,
	ethPrivKey *ecdsa.PrivateKey,
	l2WithdrawalReceipt *types.Receipt,
) (*types.Receipt, *types.Receipt, *types.Receipt, *types.Receipt)

func ProveWithdrawal

func ProveWithdrawal(t *testing.T, cfg e2esys.SystemConfig, clients ClientProvider, l2NodeName string, ethPrivKey *ecdsa.PrivateKey, l2WithdrawalReceipt *types.Receipt) (withdrawals.ProvenWithdrawalParameters, *types.Receipt)

func ProveWithdrawalParameters

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, allocType config.AllocType) (withdrawals.ProvenWithdrawalParameters, error)

func SendDepositTx

func SendDepositTx(t *testing.T, cfg e2esys.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

func SendL2Tx(t *testing.T, cfg e2esys.SystemConfig, l2Client *ethclient.Client, privKey *ecdsa.PrivateKey, applyTxOpts TxOptsFn) *types.Receipt

func SendL2TxWithID

func SendL2TxWithID(t *testing.T, chainID *big.Int, 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

func SendWithdrawal(t *testing.T, cfg e2esys.SystemConfig, l2Client *ethclient.Client, privKey *ecdsa.PrivateKey, applyOpts WithdrawalTxOptsFn) (*types.Transaction, *types.Receipt)

Types

type ClientProvider

type ClientProvider interface {
	NodeClient(name string) *ethclient.Client
}

type DepositTxOpts

type DepositTxOpts struct {
	ToAddr         common.Address
	Value          *big.Int
	GasLimit       uint64
	IsCreation     bool
	Data           []byte
	ExpectedStatus uint64
}

type DepositTxOptsFn

type DepositTxOptsFn func(l2Opts *DepositTxOpts)

type TxOpts

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

func (o *TxOpts) 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 TxOptsFn

type TxOptsFn func(opts *TxOpts)

type WithdrawalTxOpts

type WithdrawalTxOpts struct {
	ToAddr         *common.Address
	Nonce          uint64
	Value          *big.Int
	Gas            uint64
	Data           []byte
	ExpectedStatus uint64
	VerifyClients  []*ethclient.Client
}

func (*WithdrawalTxOpts) VerifyOnClients

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

type WithdrawalTxOptsFn func(opts *WithdrawalTxOpts)

Jump to

Keyboard shortcuts

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