ethtxmanager

package
v0.0.1-RC9 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: GPL-3.0 Imports: 13 Imported by: 3

Documentation

Overview

Package ethtxmanager handles ethereum transactions: It makes calls to send and to aggregate batch, checks possible errors, like wrong nonce or gas limit too low and make correct adjustments to request according to it. Also, it tracks transaction receipt and status of tx in case tx is rejected and send signals to sequencer/aggregator to resend sequence/batch

Index

Constants

This section is empty.

Variables

View Source
var ErrMaxRetriesExceeded = errors.New("Maximum number of retries exceeded")

ErrMaxRetriesExceeded max retries exceeded error.

Functions

This section is empty.

Types

type Client

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

Client for eth tx manager

func New

func New(cfg Config, ethMan etherman, state state) *Client

New creates new eth tx manager

func (*Client) SequenceBatches

func (c *Client) SequenceBatches(ctx context.Context, sequences []ethmanTypes.Sequence) error

SequenceBatches send sequences to the channel

func (*Client) VerifyBatches

func (c *Client) VerifyBatches(ctx context.Context, lastVerifiedBatch uint64, finalBatchNum uint64, inputs *ethmanTypes.FinalProofInputs) (*types.Transaction, error)

VerifyBatches sends the VerifyBatches request to Ethereum. It is also responsible for retrying up to MaxVerifyBatchTxRetries times, increasing the Gas price or Gas limit, depending on the error returned by Ethereum.

type Config

type Config struct {
	// MaxSendBatchTxRetries amount of how many tries for sending sendBatch tx to the ethereum
	MaxSendBatchTxRetries uint32 `mapstructure:"MaxSendBatchTxRetries"`
	// FrequencyForResendingFailedSendBatches frequency of the resending batches
	FrequencyForResendingFailedSendBatches types.Duration `mapstructure:"FrequencyForResendingFailedSendBatches"`

	// MaxVerifyBatchTxRetries amount of how many tries for sending verifyBatch tx to the ethereum
	MaxVerifyBatchTxRetries uint32 `mapstructure:"MaxVerifyBatchTxRetries"`
	// FrequencyForResendingFailedVerifyBatch frequency of the resending verify batch function
	FrequencyForResendingFailedVerifyBatch types.Duration `mapstructure:"FrequencyForResendingFailedVerifyBatch"`
	// WaitTxToBeMined time to wait after transaction was sent to the ethereum
	WaitTxToBeMined types.Duration `mapstructure:"WaitTxToBeMined"`
	// WaitTxToBeSynced time to wait after transaction was sent to the ethereum to get into the state
	WaitTxToBeSynced types.Duration `mapstructure:"WaitTxToBeSynced"`
	// PercentageToIncreaseGasPrice when tx is failed by timeout increase gas price by this percentage
	PercentageToIncreaseGasPrice uint64 `mapstructure:"PercentageToIncreaseGasPrice"`
	// PercentageToIncreaseGasLimit when tx is failed by timeout increase gas price by this percentage
	PercentageToIncreaseGasLimit uint64 `mapstructure:"PercentageToIncreaseGasLimit"`
}

Config is configuration for ethereum transaction manager

Jump to

Keyboard shortcuts

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