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 ¶
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 (*Client) SequenceBatches ¶
SequenceBatches send sequences to the channel
func (*Client) VerifyBatches ¶
func (c *Client) VerifyBatches(ctx context.Context, lastVerifiedBatch uint64, finalBatchNum uint64, resGetProof *pb.FinalProof) (*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