Versions in this module Expand all Collapse all v0 v0.0.5 Feb 29, 2024 v0.0.4 Feb 28, 2024 Changes in this version + var ErrDecodeBatchL2Data = errors.New("decoding BatchL2Data error") + var ErrDuplicatedNonce = errors.New("duplicated nonce") + var ErrEffectiveGasPriceReprocess = errors.New("effective gas price requires reprocessing the transaction") + var ErrExecutorError = errors.New("executor error") + var ErrExpiredTransaction = errors.New("transaction expired") + var ErrGetBatchByNumber = errors.New("get batch by number error") + var ErrProcessBatch = errors.New("processing batch error") + var ErrProcessBatchOOC = errors.New("processing batch OOC") + var ErrReplacedTransaction = errors.New("replaced transaction") + var ErrStateRootNoMatch = errors.New("state root no match") + type ClosingBatchParameters struct + AccInputHash common.Hash + BatchNumber uint64 + BatchResources state.BatchResources + ClosingReason state.ClosingReason + EffectivePercentages []uint8 + LocalExitRoot common.Hash + StateRoot common.Hash + Txs []types.Transaction + type ClosingSignalCh struct + ForcedBatchCh chan state.ForcedBatch + GERCh chan common.Hash + L2ReorgCh chan L2ReorgEvent + type Config struct + BlocksAmountForTxsToBeDeleted uint64 + DBManager DBManagerCfg + Finalizer FinalizerCfg + FrequencyToCheckTxsForDelete types.Duration + MaxTxLifetime types.Duration + StreamServer StreamServerCfg + TxLifetimeCheckTimeout types.Duration + WaitPeriodPoolIsEmpty types.Duration + type DBManagerCfg struct + L2ReorgRetrievalInterval types.Duration + PoolRetrievalInterval types.Duration + type DbManagerMock struct + func NewDbManagerMock(t interface{ ... }) *DbManagerMock + func (_m *DbManagerMock) BeginStateTransaction(ctx context.Context) (pgx.Tx, error) + func (_m *DbManagerMock) CloseBatch(ctx context.Context, params ClosingBatchParameters) error + func (_m *DbManagerMock) CountReorgs(ctx context.Context, dbTx pgx.Tx) (uint64, error) + func (_m *DbManagerMock) CreateFirstBatch(ctx context.Context, sequencerAddress common.Address) state.ProcessingContext + func (_m *DbManagerMock) DeleteTransactionFromPool(ctx context.Context, txHash common.Hash) error + func (_m *DbManagerMock) FlushMerkleTree(ctx context.Context) error + func (_m *DbManagerMock) GetBalanceByStateRoot(ctx context.Context, address common.Address, root common.Hash) (*big.Int, error) + func (_m *DbManagerMock) GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error) + func (_m *DbManagerMock) GetDefaultMinGasPriceAllowed() uint64 + func (_m *DbManagerMock) GetForcedBatch(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) (*state.ForcedBatch, error) + func (_m *DbManagerMock) GetForcedBatchesSince(ctx context.Context, forcedBatchNumber uint64, maxBlockNumber uint64, ...) ([]*state.ForcedBatch, error) + func (_m *DbManagerMock) GetForkIDByBatchNumber(batchNumber uint64) uint64 + func (_m *DbManagerMock) GetGasPrices(ctx context.Context) (pool.GasPrices, error) + func (_m *DbManagerMock) GetL1AndL2GasPrice() (uint64, uint64) + func (_m *DbManagerMock) GetLastBatch(ctx context.Context) (*state.Batch, error) + func (_m *DbManagerMock) GetLastBatchNumber(ctx context.Context) (uint64, error) + func (_m *DbManagerMock) GetLastBlock(ctx context.Context, dbTx pgx.Tx) (*state.Block, error) + func (_m *DbManagerMock) GetLastClosedBatch(ctx context.Context) (*state.Batch, error) + func (_m *DbManagerMock) GetLastL2BlockHeader(ctx context.Context, dbTx pgx.Tx) (*types.Header, error) + func (_m *DbManagerMock) GetLastNBatches(ctx context.Context, numBatches uint) ([]*state.Batch, error) + func (_m *DbManagerMock) GetLastTrustedForcedBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error) + func (_m *DbManagerMock) GetLatestGer(ctx context.Context, maxBlockNumber uint64) (state.GlobalExitRoot, time.Time, error) + func (_m *DbManagerMock) GetLatestVirtualBatchTimestamp(ctx context.Context, dbTx pgx.Tx) (time.Time, error) + func (_m *DbManagerMock) GetStoredFlushID(ctx context.Context) (uint64, string, error) + func (_m *DbManagerMock) GetTransactionsByBatchNumber(ctx context.Context, batchNumber uint64) ([]types.Transaction, []uint8, error) + func (_m *DbManagerMock) GetWIPBatch(ctx context.Context) (*WipBatch, error) + func (_m *DbManagerMock) IsBatchClosed(ctx context.Context, batchNum uint64) (bool, error) + func (_m *DbManagerMock) OpenBatch(ctx context.Context, processingContext state.ProcessingContext, dbTx pgx.Tx) error + func (_m *DbManagerMock) ProcessForcedBatch(ForcedBatchNumber uint64, request state.ProcessRequest) (*state.ProcessBatchResponse, error) + func (_m *DbManagerMock) StoreProcessedTxAndDeleteFromPool(ctx context.Context, tx transactionToStore) error + func (_m *DbManagerMock) UpdateTxStatus(ctx context.Context, hash common.Hash, newStatus pool.TxStatus, isWIP bool, ...) error + type DbTxMock struct + func NewDbTxMock(t interface{ ... }) *DbTxMock + func (_m *DbTxMock) Begin(ctx context.Context) (pgx.Tx, error) + func (_m *DbTxMock) BeginFunc(ctx context.Context, f func(pgx.Tx) error) error + func (_m *DbTxMock) Commit(ctx context.Context) error + func (_m *DbTxMock) Conn() *pgx.Conn + func (_m *DbTxMock) CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, ...) (int64, error) + func (_m *DbTxMock) Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error) + func (_m *DbTxMock) LargeObjects() pgx.LargeObjects + func (_m *DbTxMock) Prepare(ctx context.Context, name string, sql string) (*pgconn.StatementDescription, error) + func (_m *DbTxMock) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error) + func (_m *DbTxMock) QueryFunc(ctx context.Context, sql string, args []interface{}, scans []interface{}, ...) (pgconn.CommandTag, error) + func (_m *DbTxMock) QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row + func (_m *DbTxMock) Rollback(ctx context.Context) error + func (_m *DbTxMock) SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults + type EthermanMock struct + func NewEthermanMock(t interface{ ... }) *EthermanMock + func (_m *EthermanMock) GetLastBatchTimestamp() (uint64, error) + func (_m *EthermanMock) GetLatestBatchNumber() (uint64, error) + func (_m *EthermanMock) GetLatestBlockNumber(ctx context.Context) (uint64, error) + func (_m *EthermanMock) GetLatestBlockTimestamp(ctx context.Context) (uint64, error) + func (_m *EthermanMock) GetSendSequenceFee(numBatches uint64) (*big.Int, error) + func (_m *EthermanMock) TrustedSequencer() (common.Address, error) + type FinalizerCfg struct + ClosingSignalsManagerWaitForCheckingForcedBatches types.Duration + ClosingSignalsManagerWaitForCheckingGER types.Duration + ClosingSignalsManagerWaitForCheckingL1Timeout types.Duration + ForcedBatchDeadlineTimeout types.Duration + ForcedBatchesFinalityNumberOfBlocks uint64 + GERDeadlineTimeout types.Duration + GERFinalityNumberOfBlocks uint64 + ResourcePercentageToCloseBatch uint32 + SequentialReprocessFullBatch bool + SleepDuration types.Duration + StopSequencerOnBatchNum uint64 + TimestampResolution types.Duration + type L2ReorgEvent struct + TxHashes []common.Hash + type PoolMock struct + func NewPoolMock(t interface{ ... }) *PoolMock + func (_m *PoolMock) DeleteFailedTransactionsOlderThan(ctx context.Context, date time.Time) error + func (_m *PoolMock) DeleteTransactionByHash(ctx context.Context, hash common.Hash) error + func (_m *PoolMock) DeleteTransactionsByHashes(ctx context.Context, hashes []common.Hash) error + func (_m *PoolMock) GetDefaultMinGasPriceAllowed() uint64 + func (_m *PoolMock) GetGasPrices(ctx context.Context) (pool.GasPrices, error) + func (_m *PoolMock) GetL1AndL2GasPrice() (uint64, uint64) + func (_m *PoolMock) GetNonWIPPendingTxs(ctx context.Context) ([]pool.Transaction, error) + func (_m *PoolMock) GetTxZkCountersByHash(ctx context.Context, hash common.Hash) (*state.ZKCounters, error) + func (_m *PoolMock) MarkWIPTxsAsPending(ctx context.Context) error + func (_m *PoolMock) UpdateTxStatus(ctx context.Context, hash common.Hash, newStatus pool.TxStatus, isWIP bool, ...) error + func (_m *PoolMock) UpdateTxWIPStatus(ctx context.Context, hash common.Hash, isWIP bool) error + type Sequencer struct + func New(cfg Config, batchCfg state.BatchConfig, poolCfg pool.Config, txPool txPool, ...) (*Sequencer, error) + func (s *Sequencer) Start(ctx context.Context) + type StateMock struct + func NewStateMock(t interface{ ... }) *StateMock + func (_m *StateMock) Begin(ctx context.Context) (pgx.Tx, error) + func (_m *StateMock) BeginStateTransaction(ctx context.Context) (pgx.Tx, error) + func (_m *StateMock) CloseBatch(ctx context.Context, receipt state.ProcessingReceipt, dbTx pgx.Tx) error + func (_m *StateMock) CountReorgs(ctx context.Context, dbTx pgx.Tx) (uint64, error) + func (_m *StateMock) ExecuteBatch(ctx context.Context, batch state.Batch, updateMerkleTree bool, dbTx pgx.Tx) (*executor.ProcessBatchResponse, error) + func (_m *StateMock) FlushMerkleTree(ctx context.Context) error + func (_m *StateMock) GetBalanceByStateRoot(ctx context.Context, address common.Address, root common.Hash) (*big.Int, error) + func (_m *StateMock) GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error) + func (_m *StateMock) GetDSBatches(ctx context.Context, firstBatchNumber uint64, lastBatchNumber uint64, ...) ([]*state.DSBatch, error) + func (_m *StateMock) GetDSGenesisBlock(ctx context.Context, dbTx pgx.Tx) (*state.DSL2Block, error) + func (_m *StateMock) GetDSL2Blocks(ctx context.Context, firstBatchNumber uint64, lastBatchNumber uint64, ...) ([]*state.DSL2Block, error) + func (_m *StateMock) GetDSL2Transactions(ctx context.Context, firstL2Block uint64, lastL2Block uint64, dbTx pgx.Tx) ([]*state.DSL2Transaction, error) + func (_m *StateMock) GetForcedBatch(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) (*state.ForcedBatch, error) + func (_m *StateMock) GetForcedBatchesSince(ctx context.Context, forcedBatchNumber uint64, maxBlockNumber uint64, ...) ([]*state.ForcedBatch, error) + func (_m *StateMock) GetForkIDByBatchNumber(batchNumber uint64) uint64 + func (_m *StateMock) GetLastBatch(ctx context.Context, dbTx pgx.Tx) (*state.Batch, error) + func (_m *StateMock) GetLastBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error) + func (_m *StateMock) GetLastBlock(ctx context.Context, dbTx pgx.Tx) (*state.Block, error) + func (_m *StateMock) GetLastClosedBatch(ctx context.Context, dbTx pgx.Tx) (*state.Batch, error) + func (_m *StateMock) GetLastL2Block(ctx context.Context, dbTx pgx.Tx) (*types.Block, error) + func (_m *StateMock) GetLastL2BlockHeader(ctx context.Context, dbTx pgx.Tx) (*types.Header, error) + func (_m *StateMock) GetLastNBatches(ctx context.Context, numBatches uint, dbTx pgx.Tx) ([]*state.Batch, error) + func (_m *StateMock) GetLastStateRoot(ctx context.Context, dbTx pgx.Tx) (common.Hash, error) + func (_m *StateMock) GetLastTrustedForcedBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error) + func (_m *StateMock) GetLastVirtualBatchNum(ctx context.Context, dbTx pgx.Tx) (uint64, error) + func (_m *StateMock) GetLatestGer(ctx context.Context, maxBlockNumber uint64) (state.GlobalExitRoot, time.Time, error) + func (_m *StateMock) GetLatestGlobalExitRoot(ctx context.Context, maxBlockNumber uint64, dbTx pgx.Tx) (state.GlobalExitRoot, time.Time, error) + func (_m *StateMock) GetLatestVirtualBatchTimestamp(ctx context.Context, dbTx pgx.Tx) (time.Time, error) + func (_m *StateMock) GetNonceByStateRoot(ctx context.Context, address common.Address, root common.Hash) (*big.Int, error) + func (_m *StateMock) GetStoredFlushID(ctx context.Context) (uint64, string, error) + func (_m *StateMock) GetTimeForLatestBatchVirtualization(ctx context.Context, dbTx pgx.Tx) (time.Time, error) + func (_m *StateMock) GetTransactionsByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]types.Transaction, []uint8, error) + func (_m *StateMock) GetTxsOlderThanNL1Blocks(ctx context.Context, nL1Blocks uint64, dbTx pgx.Tx) ([]common.Hash, error) + func (_m *StateMock) IsBatchClosed(ctx context.Context, batchNum uint64, dbTx pgx.Tx) (bool, error) + func (_m *StateMock) OpenBatch(ctx context.Context, processingContext state.ProcessingContext, dbTx pgx.Tx) error + func (_m *StateMock) ProcessBatch(ctx context.Context, request state.ProcessRequest, updateMerkleTree bool) (*state.ProcessBatchResponse, error) + func (_m *StateMock) ProcessSequencerBatch(ctx context.Context, batchNumber uint64, batchL2Data []byte, ...) (*state.ProcessBatchResponse, error) + func (_m *StateMock) StoreTransaction(ctx context.Context, batchNumber uint64, ...) (*types.Header, error) + func (_m *StateMock) UpdateBatchL2Data(ctx context.Context, batchNumber uint64, batchL2Data []byte, dbTx pgx.Tx) error + type StreamServerCfg struct + Enabled bool + Filename string + Log log.Config + Port uint16 + type TxTracker struct + BatchResources state.BatchResources + Cost *big.Int + EGPLog state.EffectiveGasPriceLog + EffectiveGasPrice *big.Int + FailedReason *string + From common.Address + FromStr string + Gas uint64 + GasPrice *big.Int + Hash common.Hash + HashStr string + IP string + IsLastExecution bool + L1GasPrice uint64 + L2GasPrice uint64 + Nonce uint64 + RawTx []byte + ReceivedAt time.Time + type WipBatch struct + type Worker struct + func NewWorker(state stateInterface, constraints state.BatchConstraintsCfg) *Worker + func (w *Worker) AddForcedTx(txHash common.Hash, addr common.Address) + func (w *Worker) AddPendingTxToStore(txHash common.Hash, addr common.Address) + func (w *Worker) AddTxTracker(ctx context.Context, tx *TxTracker) (replacedTx *TxTracker, dropReason error) + func (w *Worker) DeleteForcedTx(txHash common.Hash, addr common.Address) + func (w *Worker) DeletePendingTxToStore(txHash common.Hash, addr common.Address) + func (w *Worker) DeleteTx(txHash common.Hash, addr common.Address) + func (w *Worker) ExpireTransactions(maxTime time.Duration) []*TxTracker + func (w *Worker) GetBestFittingTx(resources state.BatchResources) *TxTracker + func (w *Worker) HandleL2Reorg(txHashes []common.Hash) + func (w *Worker) MoveTxToNotReady(txHash common.Hash, from common.Address, actualNonce *uint64, ...) []*TxTracker + func (w *Worker) NewTxTracker(tx types.Transaction, counters state.ZKCounters, ip string) (*TxTracker, error) + func (w *Worker) UpdateAfterSingleSuccessfulTxExecution(from common.Address, touchedAddresses map[common.Address]*state.InfoReadWrite) []*TxTracker + func (w *Worker) UpdateTxZKCounters(txHash common.Hash, addr common.Address, counters state.ZKCounters) + type WorkerMock struct + func NewWorkerMock(t interface{ ... }) *WorkerMock + func (_m *WorkerMock) AddForcedTx(txHash common.Hash, addr common.Address) + func (_m *WorkerMock) AddPendingTxToStore(txHash common.Hash, addr common.Address) + func (_m *WorkerMock) AddTxTracker(ctx context.Context, txTracker *TxTracker) (*TxTracker, error) + func (_m *WorkerMock) DeleteForcedTx(txHash common.Hash, addr common.Address) + func (_m *WorkerMock) DeletePendingTxToStore(txHash common.Hash, addr common.Address) + func (_m *WorkerMock) DeleteTx(txHash common.Hash, from common.Address) + func (_m *WorkerMock) GetBestFittingTx(resources state.BatchResources) *TxTracker + func (_m *WorkerMock) HandleL2Reorg(txHashes []common.Hash) + func (_m *WorkerMock) MoveTxToNotReady(txHash common.Hash, from common.Address, actualNonce *uint64, ...) []*TxTracker + func (_m *WorkerMock) NewTxTracker(tx types.Transaction, counters state.ZKCounters, ip string) (*TxTracker, error) + func (_m *WorkerMock) UpdateAfterSingleSuccessfulTxExecution(from common.Address, touchedAddresses map[common.Address]*state.InfoReadWrite) []*TxTracker + func (_m *WorkerMock) UpdateTxZKCounters(txHash common.Hash, from common.Address, ZKCounters state.ZKCounters)