Documentation
¶
Index ¶
- Variables
- type Config
- type EthTxManagerMock
- type EthermanMock
- func (_m *EthermanMock) BuildSequenceBatchesTxData(sender common.Address, sequences []types.Sequence, maxSequenceTimestamp uint64, ...) (*common.Address, []byte, error)
- func (_m *EthermanMock) EstimateGasSequenceBatches(sender common.Address, sequences []types.Sequence, maxSequenceTimestamp uint64, ...) (*coretypes.Transaction, error)
- func (_m *EthermanMock) GetLatestBatchNumber() (uint64, error)
- func (_m *EthermanMock) GetLatestBlockHeader(ctx context.Context) (*coretypes.Header, error)
- type SequenceSender
- type StateMock
- func (_m *StateMock) GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error)
- func (_m *StateMock) GetBlockByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*state.Block, error)
- func (_m *StateMock) GetForcedBatch(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) (*state.ForcedBatch, error)
- func (_m *StateMock) GetLastBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error)
- func (_m *StateMock) GetLastClosedBatch(ctx context.Context, dbTx pgx.Tx) (*state.Batch, error)
- func (_m *StateMock) GetLastL2BlockByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.L2Block, error)
- func (_m *StateMock) GetLastVirtualBatchNum(ctx context.Context, dbTx pgx.Tx) (uint64, error)
- func (_m *StateMock) GetTimeForLatestBatchVirtualization(ctx context.Context, dbTx pgx.Tx) (time.Time, error)
- func (_m *StateMock) IsBatchChecked(ctx context.Context, batchNum uint64, dbTx pgx.Tx) (bool, error)
- func (_m *StateMock) IsBatchClosed(ctx context.Context, batchNum uint64, dbTx pgx.Tx) (bool, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrOversizedData is returned if the input data of a transaction is greater // than some meaningful limit a user might use. This is not a consensus error // making the transaction invalid, rather a DOS protection. ErrOversizedData = errors.New("oversized data") // ErrSyncVirtualGreaterSequenced is returned by the isSynced function when the last virtual batch is greater that the last SC sequenced batch ErrSyncVirtualGreaterSequenced = errors.New("last virtual batch is greater than last SC sequenced batch") // ErrSyncVirtualGreaterTrusted is returned by the isSynced function when the last virtual batch is greater that the last trusted batch closed ErrSyncVirtualGreaterTrusted = errors.New("last virtual batch is greater than last trusted batch closed") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// WaitPeriodSendSequence is the time the sequencer waits until
// trying to send a sequence to L1
WaitPeriodSendSequence types.Duration `mapstructure:"WaitPeriodSendSequence"`
// LastBatchVirtualizationTimeMaxWaitPeriod is time since sequences should be sent
LastBatchVirtualizationTimeMaxWaitPeriod types.Duration `mapstructure:"LastBatchVirtualizationTimeMaxWaitPeriod"`
// L1BlockTimestampMargin is the time difference (margin) that must exists between last L1 block and last L2 block in the sequence before
// to send the sequence to L1. If the difference is lower than this value then sequencesender will wait until the difference is equal or greater
L1BlockTimestampMargin types.Duration `mapstructure:"L1BlockTimestampMargin"`
// MaxTxSizeForL1 is the maximum size a single transaction can have. This field has
// non-trivial consequences: larger transactions than 128KB are significantly harder and
// more expensive to propagate; larger transactions also take more resources
// to validate whether they fit into the pool or not.
MaxTxSizeForL1 uint64 `mapstructure:"MaxTxSizeForL1"`
// SenderAddress defines which private key the eth tx manager needs to use
// to sign the L1 txs
SenderAddress common.Address
// L2Coinbase defines which address is going to receive the fees
L2Coinbase common.Address `mapstructure:"L2Coinbase"`
// PrivateKey defines all the key store files that are going
// to be read in order to provide the private keys to sign the L1 txs
PrivateKey types.KeystoreFileConfig `mapstructure:"PrivateKey"`
// Batch number where there is a forkid change (fork upgrade)
ForkUpgradeBatchNumber uint64
// GasOffset is the amount of gas to be added to the gas estimation in order
// to provide an amount that is higher than the estimated one. This is used
// to avoid the TX getting reverted in case something has changed in the network
// state after the estimation which can cause the TX to require more gas to be
// executed.
//
// ex:
// gas estimation: 1000
// gas offset: 100
// final gas: 1100
GasOffset uint64 `mapstructure:"GasOffset"`
}
Config represents the configuration of a sequence sender
type EthTxManagerMock ¶
EthTxManagerMock is an autogenerated mock type for the ethTxManager type
func NewEthTxManagerMock ¶
func NewEthTxManagerMock(t interface {
mock.TestingT
Cleanup(func())
}) *EthTxManagerMock
NewEthTxManagerMock creates a new instance of EthTxManagerMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*EthTxManagerMock) Add ¶
func (_m *EthTxManagerMock) Add(ctx context.Context, owner string, id string, from common.Address, to *common.Address, value *big.Int, data []byte, gasOffset uint64, dbTx pgx.Tx) error
Add provides a mock function with given fields: ctx, owner, id, from, to, value, data, gasOffset, dbTx
func (*EthTxManagerMock) ProcessPendingMonitoredTxs ¶
func (_m *EthTxManagerMock) ProcessPendingMonitoredTxs(ctx context.Context, owner string, failedResultHandler ethtxmanager.ResultHandler, dbTx pgx.Tx)
ProcessPendingMonitoredTxs provides a mock function with given fields: ctx, owner, failedResultHandler, dbTx
type EthermanMock ¶
EthermanMock is an autogenerated mock type for the etherman type
func NewEthermanMock ¶
func NewEthermanMock(t interface {
mock.TestingT
Cleanup(func())
}) *EthermanMock
NewEthermanMock creates a new instance of EthermanMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*EthermanMock) BuildSequenceBatchesTxData ¶
func (_m *EthermanMock) BuildSequenceBatchesTxData(sender common.Address, sequences []types.Sequence, maxSequenceTimestamp uint64, initSequenceBatchNumber uint64, l2Coinbase common.Address) (*common.Address, []byte, error)
BuildSequenceBatchesTxData provides a mock function with given fields: sender, sequences, maxSequenceTimestamp, initSequenceBatchNumber, l2Coinbase
func (*EthermanMock) EstimateGasSequenceBatches ¶
func (_m *EthermanMock) EstimateGasSequenceBatches(sender common.Address, sequences []types.Sequence, maxSequenceTimestamp uint64, initSequenceBatchNumber uint64, l2Coinbase common.Address) (*coretypes.Transaction, error)
EstimateGasSequenceBatches provides a mock function with given fields: sender, sequences, maxSequenceTimestamp, initSequenceBatchNumber, l2Coinbase
func (*EthermanMock) GetLatestBatchNumber ¶
func (_m *EthermanMock) GetLatestBatchNumber() (uint64, error)
GetLatestBatchNumber provides a mock function with given fields:
func (*EthermanMock) GetLatestBlockHeader ¶
GetLatestBlockHeader provides a mock function with given fields: ctx
type SequenceSender ¶
type SequenceSender struct {
// contains filtered or unexported fields
}
SequenceSender represents a sequence sender
func New ¶
func New(cfg Config, state stateInterface, etherman etherman, manager ethTxManager, eventLog *event.EventLog) (*SequenceSender, error)
New inits sequence sender
func (*SequenceSender) Start ¶
func (s *SequenceSender) Start(ctx context.Context)
Start starts the sequence sender
type StateMock ¶
StateMock is an autogenerated mock type for the stateInterface type
func NewStateMock ¶
NewStateMock creates a new instance of StateMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*StateMock) GetBatchByNumber ¶
func (_m *StateMock) GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error)
GetBatchByNumber provides a mock function with given fields: ctx, batchNumber, dbTx
func (*StateMock) GetBlockByNumber ¶
func (_m *StateMock) GetBlockByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*state.Block, error)
GetBlockByNumber provides a mock function with given fields: ctx, blockNumber, dbTx
func (*StateMock) GetForcedBatch ¶
func (_m *StateMock) GetForcedBatch(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) (*state.ForcedBatch, error)
GetForcedBatch provides a mock function with given fields: ctx, forcedBatchNumber, dbTx
func (*StateMock) GetLastBatchNumber ¶
GetLastBatchNumber provides a mock function with given fields: ctx, dbTx
func (*StateMock) GetLastClosedBatch ¶
GetLastClosedBatch provides a mock function with given fields: ctx, dbTx
func (*StateMock) GetLastL2BlockByBatchNumber ¶
func (_m *StateMock) GetLastL2BlockByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.L2Block, error)
GetLastL2BlockByBatchNumber provides a mock function with given fields: ctx, batchNumber, dbTx
func (*StateMock) GetLastVirtualBatchNum ¶
GetLastVirtualBatchNum provides a mock function with given fields: ctx, dbTx
func (*StateMock) GetTimeForLatestBatchVirtualization ¶
func (_m *StateMock) GetTimeForLatestBatchVirtualization(ctx context.Context, dbTx pgx.Tx) (time.Time, error)
GetTimeForLatestBatchVirtualization provides a mock function with given fields: ctx, dbTx