proposer

package
v0.0.0-...-4611198 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name                 string
	L1Client             *ethclient.Client
	L2Client             *l2ethclient.Client
	BlockOffset          uint64
	MaxStateRootElements uint64
	MinStateRootElements uint64
	SCCAddr              common.Address
	CTCAddr              common.Address
	ChainID              *big.Int
	PrivKey              *ecdsa.PrivateKey
}

type Driver

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

func NewDriver

func NewDriver(cfg Config) (*Driver, error)

func (*Driver) ClearPendingTx

func (d *Driver) ClearPendingTx(
	ctx context.Context,
	txMgr txmgr.TxManager,
	l1Client *ethclient.Client,
) error

ClearPendingTx a publishes a transaction at the next available nonce in order to clear any transactions in the mempool left over from a prior running instance of the batch submitter.

func (*Driver) CraftBatchTx

func (d *Driver) CraftBatchTx(
	ctx context.Context,
	start, end, nonce *big.Int,
) (*types.Transaction, error)

CraftBatchTx transforms the L2 blocks between start and end into a batch transaction using the given nonce. A dummy gas price is used in the resulting transaction to use for size estimation.

NOTE: This method SHOULD NOT publish the resulting transaction.

func (*Driver) GetBatchBlockRange

func (d *Driver) GetBatchBlockRange(
	ctx context.Context) (*big.Int, *big.Int, error)

GetBatchBlockRange returns the start and end L2 block heights that need to be processed. Note that the end value is *exclusive*, therefore if the returned values are identical nothing needs to be processed.

func (*Driver) Metrics

func (d *Driver) Metrics() metrics.Metrics

Metrics returns the subservice telemetry object.

func (*Driver) Name

func (d *Driver) Name() string

Name is an identifier used to prefix logs for a particular service.

func (*Driver) SendTransaction

func (d *Driver) SendTransaction(
	ctx context.Context,
	tx *types.Transaction,
) error

SendTransaction injects a signed transaction into the pending pool for execution.

func (*Driver) UpdateGasPrice

func (d *Driver) UpdateGasPrice(
	ctx context.Context,
	tx *types.Transaction,
) (*types.Transaction, error)

UpdateGasPrice signs an otherwise identical txn to the one provided but with updated gas prices sampled from the existing network conditions.

NOTE: Thie method SHOULD NOT publish the resulting transaction.

func (*Driver) WalletAddr

func (d *Driver) WalletAddr() common.Address

WalletAddr is the wallet address used to pay for batch transaction fees.

Jump to

Keyboard shortcuts

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