Documentation ¶
Index ¶
- Variables
- func NewBatchRemainingResourcesUnderflowError(err error, resourceName string) error
- type BatchRemainingResourcesUnderflowError
- type ClosingBatchParameters
- type ClosingSignalCh
- type Config
- type DbManagerMock
- func (_m *DbManagerMock) BeginStateTransaction(ctx context.Context) (pgx.Tx, error)
- func (_m *DbManagerMock) CloseBatch(ctx context.Context, params ClosingBatchParameters) 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) 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) GetForcedBatchesSince(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) ([]*state.ForcedBatch, error)
- 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, gerFinalityNumberOfBlocks uint64) (state.GlobalExitRoot, time.Time, error)
- func (_m *DbManagerMock) GetLatestVirtualBatchTimestamp(ctx context.Context, dbTx pgx.Tx) (time.Time, error)
- func (_m *DbManagerMock) GetTransactionsByBatchNumber(ctx context.Context, batchNumber uint64) ([]types.Transaction, error)
- func (_m *DbManagerMock) GetWIPBatch(ctx context.Context) (*WipBatch, error)
- func (_m *DbManagerMock) IsBatchClosed(ctx context.Context, batchNum uint64) (bool, error)
- func (_m *DbManagerMock) MarkReorgedTxsAsPending(ctx context.Context)
- func (_m *DbManagerMock) OpenBatch(ctx context.Context, processingContext state.ProcessingContext, dbTx pgx.Tx) error
- func (_m *DbManagerMock) ProcessForcedBatch(forcedBatchNum uint64, request state.ProcessRequest) (*state.ProcessBatchResponse, error)
- func (_m *DbManagerMock) StoreProcessedTransaction(ctx context.Context, batchNumber uint64, ...) error
- func (_m *DbManagerMock) UpdateTxStatus(ctx context.Context, hash common.Hash, newStatus pool.TxStatus) error
- type 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 FinalizerCfg
- type L2ReorgEvent
- type MaxSequenceSize
- type PoolMock
- func (_m *PoolMock) DeleteTransactionByHash(ctx context.Context, hash common.Hash) error
- func (_m *PoolMock) DeleteTxsByHashes(ctx context.Context, hashes []common.Hash) error
- func (_m *PoolMock) GetPendingTxs(ctx context.Context, isClaims bool, limit uint64) ([]pool.Transaction, error)
- func (_m *PoolMock) GetTxZkCountersByHash(ctx context.Context, hash common.Hash) (*state.ZKCounters, error)
- func (_m *PoolMock) MarkReorgedTxsAsPending(ctx context.Context) error
- func (_m *PoolMock) MarkWIPTxsAsPending(ctx context.Context) error
- func (_m *PoolMock) UpdateTxStatus(ctx context.Context, hash common.Hash, newStatus pool.TxStatus) error
- type Sequencer
- type 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) ExecuteBatch(ctx context.Context, batch state.Batch, dbTx pgx.Tx) (*pb.ProcessBatchResponse, 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) GetForcedBatch(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) (*state.ForcedBatch, error)
- func (_m *StateMock) GetForcedBatchesSince(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) ([]*state.ForcedBatch, error)
- 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) 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) GetTimeForLatestBatchVirtualization(ctx context.Context, dbTx pgx.Tx) (time.Time, error)
- func (_m *StateMock) GetTransactionsByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]types.Transaction, 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) (*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, ...) error
- func (_m *StateMock) UpdateBatchL2Data(ctx context.Context, batchNumber uint64, batchL2Data []byte, dbTx pgx.Tx) error
- type TxTracker
- type TxsStore
- type WipBatch
- type Worker
- func (w *Worker) AddTx(ctx context.Context, tx *TxTracker)
- func (w *Worker) DeleteTx(txHash common.Hash, addr common.Address)
- func (w *Worker) GetBestFittingTx(resources batchResources) *TxTracker
- func (w *Worker) HandleL2Reorg(txHashes []common.Hash)
- func (w *Worker) MoveTxToNotReady(txHash common.Hash, from common.Address, actualNonce *uint64, ...)
- func (w *Worker) NewTxTracker(tx types.Transaction, isClaim bool, counters state.ZKCounters) (*TxTracker, error)
- func (w *Worker) UpdateAfterSingleSuccessfulTxExecution(from common.Address, touchedAddresses map[common.Address]*state.InfoReadWrite)
- func (w *Worker) UpdateTx(txHash common.Hash, addr common.Address, counters state.ZKCounters)
- type WorkerMock
- func (_m *WorkerMock) AddTx(ctx context.Context, txTracker *TxTracker)
- func (_m *WorkerMock) DeleteTx(txHash common.Hash, from common.Address)
- func (_m *WorkerMock) GetBestFittingTx(resources batchResources) *TxTracker
- func (_m *WorkerMock) HandleL2Reorg(txHashes []common.Hash)
- func (_m *WorkerMock) MoveTxToNotReady(txHash common.Hash, from common.Address, actualNonce *uint64, ...)
- func (_m *WorkerMock) NewTxTracker(tx types.Transaction, isClaim bool, counters state.ZKCounters) (*TxTracker, error)
- func (_m *WorkerMock) UpdateAfterSingleSuccessfulTxExecution(from common.Address, touchedAddresses map[common.Address]*state.InfoReadWrite)
- func (_m *WorkerMock) UpdateTx(txHash common.Hash, from common.Address, ZKCounters state.ZKCounters)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBatchResourceBytesUnderflow happens when the batch runs out of bytes ErrBatchResourceBytesUnderflow = NewBatchRemainingResourcesUnderflowError(nil, "Bytes") )
Functions ¶
func NewBatchRemainingResourcesUnderflowError ¶
NewBatchRemainingResourcesUnderflowError creates a new BatchRemainingResourcesUnderflowError
Types ¶
type BatchRemainingResourcesUnderflowError ¶
type BatchRemainingResourcesUnderflowError struct { Message string Code int Err error ResourceName string }
BatchRemainingResourcesUnderflowError happens when the execution of a batch runs out of counters
func (BatchRemainingResourcesUnderflowError) Error ¶
func (b BatchRemainingResourcesUnderflowError) Error() string
Error returns the error message
type ClosingBatchParameters ¶
type ClosingBatchParameters struct { BatchNumber uint64 StateRoot common.Hash LocalExitRoot common.Hash AccInputHash common.Hash Txs []types.Transaction }
ClosingBatchParameters contains the necessary parameters to close a batch
type ClosingSignalCh ¶
type ClosingSignalCh struct { ForcedBatchCh chan state.ForcedBatch GERCh chan common.Hash L2ReorgCh chan L2ReorgEvent SendingToL1TimeoutCh chan bool }
ClosingSignalCh is a struct that contains all the channels that are used to receive batch closing signals
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"` // WaitPeriodPoolIsEmpty is the time the sequencer waits until // trying to add new txs to the state WaitPeriodPoolIsEmpty types.Duration `mapstructure:"WaitPeriodPoolIsEmpty"` // LastBatchVirtualizationTimeMaxWaitPeriod is time since sequences should be sent LastBatchVirtualizationTimeMaxWaitPeriod types.Duration `mapstructure:"LastBatchVirtualizationTimeMaxWaitPeriod"` // BlocksAmountForTxsToBeDeleted is blocks amount after which txs will be deleted from the pool BlocksAmountForTxsToBeDeleted uint64 `mapstructure:"BlocksAmountForTxsToBeDeleted"` // FrequencyToCheckTxsForDelete is frequency with which txs will be checked for deleting FrequencyToCheckTxsForDelete types.Duration `mapstructure:"FrequencyToCheckTxsForDelete"` // MaxTxsPerBatch is the maximum amount of transactions in the batch MaxTxsPerBatch uint64 `mapstructure:"MaxTxsPerBatch"` // MaxBatchBytesSize is the maximum batch size in bytes MaxBatchBytesSize uint64 `mapstructure:"MaxBatchBytesSize"` // MaxCumulativeGasUsed is max gas amount used by batch MaxCumulativeGasUsed uint64 `mapstructure:"MaxCumulativeGasUsed"` // MaxKeccakHashes is max keccak hashes used by batch MaxKeccakHashes uint32 `mapstructure:"MaxKeccakHashes"` // MaxPoseidonHashes is max poseidon hashes batch can handle MaxPoseidonHashes uint32 `mapstructure:"MaxPoseidonHashes"` // MaxPoseidonPaddings is max poseidon paddings batch can handle MaxPoseidonPaddings uint32 `mapstructure:"MaxPoseidonPaddings"` // MaxMemAligns is max mem aligns batch can handle MaxMemAligns uint32 `mapstructure:"MaxMemAligns"` // MaxArithmetics is max arithmetics batch can handle MaxArithmetics uint32 `mapstructure:"MaxArithmetics"` // MaxBinaries is max binaries batch can handle MaxBinaries uint32 `mapstructure:"MaxBinaries"` // MaxSteps is max steps batch can handle MaxSteps uint32 `mapstructure:"MaxSteps"` // Maximum size, in gas size, a sequence can reach MaxSequenceSize MaxSequenceSize `mapstructure:"MaxSequenceSize"` // Maximum allowed failed counter for the tx before it becomes invalid MaxAllowedFailedCounter uint64 `mapstructure:"MaxAllowedFailedCounter"` // WeightBatchBytesSize is the cost weight for the BatchBytesSize batch resource WeightBatchBytesSize int `mapstructure:"WeightBatchBytesSize"` // WeightCumulativeGasUsed is the cost weight for the CumulativeGasUsed batch resource WeightCumulativeGasUsed int `mapstructure:"WeightCumulativeGasUsed"` // WeightKeccakHashes is the cost weight for the KeccakHashes batch resource WeightKeccakHashes int `mapstructure:"WeightKeccakHashes"` // WeightPoseidonHashes is the cost weight for the PoseidonHashes batch resource WeightPoseidonHashes int `mapstructure:"WeightPoseidonHashes"` // WeightPoseidonPaddings is the cost weight for the PoseidonPaddings batch resource WeightPoseidonPaddings int `mapstructure:"WeightPoseidonPaddings"` // WeightMemAligns is the cost weight for the MemAligns batch resource WeightMemAligns int `mapstructure:"WeightMemAligns"` // WeightArithmetics is the cost weight for the Arithmetics batch resource WeightArithmetics int `mapstructure:"WeightArithmetics"` // WeightBinaries is the cost weight for the Binaries batch resource WeightBinaries int `mapstructure:"WeightBinaries"` // WeightSteps is the cost weight for the Steps batch resource WeightSteps int `mapstructure:"WeightSteps"` // Finalizer's specific config properties Finalizer FinalizerCfg `mapstructure:"Finalizer"` }
Config represents the configuration of a sequencer
type DbManagerMock ¶
DbManagerMock is an autogenerated mock type for the dbManagerInterface type
func NewDbManagerMock ¶
func NewDbManagerMock(t mockConstructorTestingTNewDbManagerMock) *DbManagerMock
NewDbManagerMock creates a new instance of DbManagerMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*DbManagerMock) BeginStateTransaction ¶
BeginStateTransaction provides a mock function with given fields: ctx
func (*DbManagerMock) CloseBatch ¶
func (_m *DbManagerMock) CloseBatch(ctx context.Context, params ClosingBatchParameters) error
CloseBatch provides a mock function with given fields: ctx, params
func (*DbManagerMock) CreateFirstBatch ¶
func (_m *DbManagerMock) CreateFirstBatch(ctx context.Context, sequencerAddress common.Address) state.ProcessingContext
CreateFirstBatch provides a mock function with given fields: ctx, sequencerAddress
func (*DbManagerMock) DeleteTransactionFromPool ¶
DeleteTransactionFromPool provides a mock function with given fields: ctx, txHash
func (*DbManagerMock) GetBalanceByStateRoot ¶
func (_m *DbManagerMock) GetBalanceByStateRoot(ctx context.Context, address common.Address, root common.Hash) (*big.Int, error)
GetBalanceByStateRoot provides a mock function with given fields: ctx, address, root
func (*DbManagerMock) GetBatchByNumber ¶
func (_m *DbManagerMock) GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error)
GetBatchByNumber provides a mock function with given fields: ctx, batchNumber, dbTx
func (*DbManagerMock) GetForcedBatchesSince ¶
func (_m *DbManagerMock) GetForcedBatchesSince(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) ([]*state.ForcedBatch, error)
GetForcedBatchesSince provides a mock function with given fields: ctx, forcedBatchNumber, dbTx
func (*DbManagerMock) GetLastBatch ¶
GetLastBatch provides a mock function with given fields: ctx
func (*DbManagerMock) GetLastBatchNumber ¶
func (_m *DbManagerMock) GetLastBatchNumber(ctx context.Context) (uint64, error)
GetLastBatchNumber provides a mock function with given fields: ctx
func (*DbManagerMock) GetLastBlock ¶
GetLastBlock provides a mock function with given fields: ctx, dbTx
func (*DbManagerMock) GetLastClosedBatch ¶
GetLastClosedBatch provides a mock function with given fields: ctx
func (*DbManagerMock) GetLastL2BlockHeader ¶
func (_m *DbManagerMock) GetLastL2BlockHeader(ctx context.Context, dbTx pgx.Tx) (*types.Header, error)
GetLastL2BlockHeader provides a mock function with given fields: ctx, dbTx
func (*DbManagerMock) GetLastNBatches ¶
func (_m *DbManagerMock) GetLastNBatches(ctx context.Context, numBatches uint) ([]*state.Batch, error)
GetLastNBatches provides a mock function with given fields: ctx, numBatches
func (*DbManagerMock) GetLastTrustedForcedBatchNumber ¶
func (_m *DbManagerMock) GetLastTrustedForcedBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error)
GetLastTrustedForcedBatchNumber provides a mock function with given fields: ctx, dbTx
func (*DbManagerMock) GetLatestGer ¶
func (_m *DbManagerMock) GetLatestGer(ctx context.Context, gerFinalityNumberOfBlocks uint64) (state.GlobalExitRoot, time.Time, error)
GetLatestGer provides a mock function with given fields: ctx, gerFinalityNumberOfBlocks
func (*DbManagerMock) GetLatestVirtualBatchTimestamp ¶
func (_m *DbManagerMock) GetLatestVirtualBatchTimestamp(ctx context.Context, dbTx pgx.Tx) (time.Time, error)
GetLatestVirtualBatchTimestamp provides a mock function with given fields: ctx, dbTx
func (*DbManagerMock) GetTransactionsByBatchNumber ¶
func (_m *DbManagerMock) GetTransactionsByBatchNumber(ctx context.Context, batchNumber uint64) ([]types.Transaction, error)
GetTransactionsByBatchNumber provides a mock function with given fields: ctx, batchNumber
func (*DbManagerMock) GetWIPBatch ¶
func (_m *DbManagerMock) GetWIPBatch(ctx context.Context) (*WipBatch, error)
GetWIPBatch provides a mock function with given fields: ctx
func (*DbManagerMock) IsBatchClosed ¶
IsBatchClosed provides a mock function with given fields: ctx, batchNum
func (*DbManagerMock) MarkReorgedTxsAsPending ¶
func (_m *DbManagerMock) MarkReorgedTxsAsPending(ctx context.Context)
MarkReorgedTxsAsPending provides a mock function with given fields: ctx
func (*DbManagerMock) OpenBatch ¶
func (_m *DbManagerMock) OpenBatch(ctx context.Context, processingContext state.ProcessingContext, dbTx pgx.Tx) error
OpenBatch provides a mock function with given fields: ctx, processingContext, dbTx
func (*DbManagerMock) ProcessForcedBatch ¶
func (_m *DbManagerMock) ProcessForcedBatch(forcedBatchNum uint64, request state.ProcessRequest) (*state.ProcessBatchResponse, error)
ProcessForcedBatch provides a mock function with given fields: forcedBatchNum, request
func (*DbManagerMock) StoreProcessedTransaction ¶
func (_m *DbManagerMock) StoreProcessedTransaction(ctx context.Context, batchNumber uint64, processedTx *state.ProcessTransactionResponse, coinbase common.Address, timestamp uint64, dbTx pgx.Tx) error
StoreProcessedTransaction provides a mock function with given fields: ctx, batchNumber, processedTx, coinbase, timestamp, dbTx
func (*DbManagerMock) UpdateTxStatus ¶
func (_m *DbManagerMock) UpdateTxStatus(ctx context.Context, hash common.Hash, newStatus pool.TxStatus) error
UpdateTxStatus provides a mock function with given fields: ctx, hash, newStatus
type DbTxMock ¶
DbTxMock is an autogenerated mock type for the Tx type
func NewDbTxMock ¶
func NewDbTxMock(t mockConstructorTestingTNewDbTxMock) *DbTxMock
NewDbTxMock creates a new instance of DbTxMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*DbTxMock) CopyFrom ¶
func (_m *DbTxMock) CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
CopyFrom provides a mock function with given fields: ctx, tableName, columnNames, rowSrc
func (*DbTxMock) Exec ¶
func (_m *DbTxMock) Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)
Exec provides a mock function with given fields: ctx, sql, arguments
func (*DbTxMock) LargeObjects ¶
func (_m *DbTxMock) LargeObjects() pgx.LargeObjects
LargeObjects provides a mock function with given fields:
func (*DbTxMock) Prepare ¶
func (_m *DbTxMock) Prepare(ctx context.Context, name string, sql string) (*pgconn.StatementDescription, error)
Prepare provides a mock function with given fields: ctx, name, sql
func (*DbTxMock) QueryFunc ¶
func (_m *DbTxMock) QueryFunc(ctx context.Context, sql string, args []interface{}, scans []interface{}, f func(pgx.QueryFuncRow) error) (pgconn.CommandTag, error)
QueryFunc provides a mock function with given fields: ctx, sql, args, scans, f
type FinalizerCfg ¶
type FinalizerCfg struct { // GERDeadlineTimeoutInSec is the time the finalizer waits after receiving closing signal to update Global Exit Root GERDeadlineTimeoutInSec types.Duration `mapstructure:"GERDeadlineTimeoutInSec"` // SendingToL1DeadlineTimeoutInSec is the time the finalizer waits after receiving closing signal to process Forced Batches ForcedBatchDeadlineTimeoutInSec types.Duration `mapstructure:"ForcedBatchDeadlineTimeoutInSec"` // SendingToL1DeadlineTimeoutInSec is the time the finalizer waits after receiving closing signal to sends a batch to L1 SendingToL1DeadlineTimeoutInSec types.Duration `mapstructure:"SendingToL1DeadlineTimeoutInSec"` // SleepDurationInMs is the time the finalizer sleeps between each iteration, if there are no transactions to be processed SleepDurationInMs types.Duration `mapstructure:"SleepDurationInMs"` // ResourcePercentageToCloseBatch is the percentage window of the resource left out for the batch to be closed ResourcePercentageToCloseBatch uint32 `mapstructure:"ResourcePercentageToCloseBatch"` // GERFinalityNumberOfBlocks is number of blocks to consider GER final GERFinalityNumberOfBlocks uint64 `mapstructure:"GERFinalityNumberOfBlocks"` // ClosingSignalsManagerWaitForL1OperationsInSec is used by the closing signals manager to wait for its operation ClosingSignalsManagerWaitForL1OperationsInSec types.Duration `mapstructure:"ClosingSignalsManagerWaitForL1OperationsInSec"` // SenderAddress defines which private key the eth tx manager needs to use // to sign the L1 txs SenderAddress string `mapstructure:"SenderAddress"` // PrivateKeys defines all the key store files that are going // to be read in order to provide the private keys to sign the L1 txs PrivateKeys []types.KeystoreFileConfig `mapstructure:"PrivateKeys"` }
FinalizerCfg contains the finalizer's configuration properties
type L2ReorgEvent ¶
L2ReorgEvent is the event that is triggered when a reorg happens in the L2
type MaxSequenceSize ¶
MaxSequenceSize is a wrapper type that parses token amount to big int
func (*MaxSequenceSize) UnmarshalText ¶
func (m *MaxSequenceSize) UnmarshalText(data []byte) error
UnmarshalText unmarshal token amount from float string to big int
type PoolMock ¶
PoolMock is an autogenerated mock type for the txPool type
func NewPoolMock ¶
func NewPoolMock(t mockConstructorTestingTNewPoolMock) *PoolMock
NewPoolMock creates a new instance of PoolMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*PoolMock) DeleteTransactionByHash ¶
DeleteTransactionByHash provides a mock function with given fields: ctx, hash
func (*PoolMock) DeleteTxsByHashes ¶
DeleteTxsByHashes provides a mock function with given fields: ctx, hashes
func (*PoolMock) GetPendingTxs ¶
func (_m *PoolMock) GetPendingTxs(ctx context.Context, isClaims bool, limit uint64) ([]pool.Transaction, error)
GetPendingTxs provides a mock function with given fields: ctx, isClaims, limit
func (*PoolMock) GetTxZkCountersByHash ¶
func (_m *PoolMock) GetTxZkCountersByHash(ctx context.Context, hash common.Hash) (*state.ZKCounters, error)
GetTxZkCountersByHash provides a mock function with given fields: ctx, hash
func (*PoolMock) MarkReorgedTxsAsPending ¶
MarkReorgedTxsAsPending provides a mock function with given fields: ctx
func (*PoolMock) MarkWIPTxsAsPending ¶
MarkWIPTxsAsPending provides a mock function with given fields: ctx
type Sequencer ¶
type Sequencer struct {
// contains filtered or unexported fields
}
Sequencer represents a sequencer
type StateMock ¶
StateMock is an autogenerated mock type for the stateInterface type
func NewStateMock ¶
func NewStateMock(t mockConstructorTestingTNewStateMock) *StateMock
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.
func (*StateMock) BeginStateTransaction ¶
BeginStateTransaction provides a mock function with given fields: ctx
func (*StateMock) CloseBatch ¶
func (_m *StateMock) CloseBatch(ctx context.Context, receipt state.ProcessingReceipt, dbTx pgx.Tx) error
CloseBatch provides a mock function with given fields: ctx, receipt, dbTx
func (*StateMock) ExecuteBatch ¶
func (_m *StateMock) ExecuteBatch(ctx context.Context, batch state.Batch, dbTx pgx.Tx) (*pb.ProcessBatchResponse, error)
ExecuteBatch provides a mock function with given fields: ctx, batch, dbTx
func (*StateMock) GetBalanceByStateRoot ¶
func (_m *StateMock) GetBalanceByStateRoot(ctx context.Context, address common.Address, root common.Hash) (*big.Int, error)
GetBalanceByStateRoot provides a mock function with given fields: ctx, address, root
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) 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) GetForcedBatchesSince ¶
func (_m *StateMock) GetForcedBatchesSince(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) ([]*state.ForcedBatch, error)
GetForcedBatchesSince provides a mock function with given fields: ctx, forcedBatchNumber, dbTx
func (*StateMock) GetLastBatch ¶
GetLastBatch provides a mock function with given fields: ctx, dbTx
func (*StateMock) GetLastBatchNumber ¶
GetLastBatchNumber provides a mock function with given fields: ctx, dbTx
func (*StateMock) GetLastBlock ¶
GetLastBlock provides a mock function with given fields: ctx, dbTx
func (*StateMock) GetLastClosedBatch ¶
GetLastClosedBatch provides a mock function with given fields: ctx, dbTx
func (*StateMock) GetLastL2Block ¶
GetLastL2Block provides a mock function with given fields: ctx, dbTx
func (*StateMock) GetLastL2BlockHeader ¶
GetLastL2BlockHeader provides a mock function with given fields: ctx, dbTx
func (*StateMock) GetLastNBatches ¶
func (_m *StateMock) GetLastNBatches(ctx context.Context, numBatches uint, dbTx pgx.Tx) ([]*state.Batch, error)
GetLastNBatches provides a mock function with given fields: ctx, numBatches, dbTx
func (*StateMock) GetLastStateRoot ¶
GetLastStateRoot provides a mock function with given fields: ctx, dbTx
func (*StateMock) GetLastTrustedForcedBatchNumber ¶
func (_m *StateMock) GetLastTrustedForcedBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error)
GetLastTrustedForcedBatchNumber provides a mock function with given fields: ctx, dbTx
func (*StateMock) GetLastVirtualBatchNum ¶
GetLastVirtualBatchNum provides a mock function with given fields: ctx, dbTx
func (*StateMock) GetLatestGlobalExitRoot ¶
func (_m *StateMock) GetLatestGlobalExitRoot(ctx context.Context, maxBlockNumber uint64, dbTx pgx.Tx) (state.GlobalExitRoot, time.Time, error)
GetLatestGlobalExitRoot provides a mock function with given fields: ctx, maxBlockNumber, dbTx
func (*StateMock) GetLatestVirtualBatchTimestamp ¶
func (_m *StateMock) GetLatestVirtualBatchTimestamp(ctx context.Context, dbTx pgx.Tx) (time.Time, error)
GetLatestVirtualBatchTimestamp provides a mock function with given fields: ctx, dbTx
func (*StateMock) GetNonceByStateRoot ¶
func (_m *StateMock) GetNonceByStateRoot(ctx context.Context, address common.Address, root common.Hash) (*big.Int, error)
GetNonceByStateRoot provides a mock function with given fields: ctx, address, root
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
func (*StateMock) GetTransactionsByBatchNumber ¶
func (_m *StateMock) GetTransactionsByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]types.Transaction, error)
GetTransactionsByBatchNumber provides a mock function with given fields: ctx, batchNumber, dbTx
func (*StateMock) GetTxsOlderThanNL1Blocks ¶
func (_m *StateMock) GetTxsOlderThanNL1Blocks(ctx context.Context, nL1Blocks uint64, dbTx pgx.Tx) ([]common.Hash, error)
GetTxsOlderThanNL1Blocks provides a mock function with given fields: ctx, nL1Blocks, dbTx
func (*StateMock) IsBatchClosed ¶
IsBatchClosed provides a mock function with given fields: ctx, batchNum, dbTx
func (*StateMock) OpenBatch ¶
func (_m *StateMock) OpenBatch(ctx context.Context, processingContext state.ProcessingContext, dbTx pgx.Tx) error
OpenBatch provides a mock function with given fields: ctx, processingContext, dbTx
func (*StateMock) ProcessBatch ¶
func (_m *StateMock) ProcessBatch(ctx context.Context, request state.ProcessRequest) (*state.ProcessBatchResponse, error)
ProcessBatch provides a mock function with given fields: ctx, request
func (*StateMock) ProcessSequencerBatch ¶
func (_m *StateMock) ProcessSequencerBatch(ctx context.Context, batchNumber uint64, batchL2Data []byte, caller state.CallerLabel, dbTx pgx.Tx) (*state.ProcessBatchResponse, error)
ProcessSequencerBatch provides a mock function with given fields: ctx, batchNumber, batchL2Data, caller, dbTx
func (*StateMock) StoreTransaction ¶
func (_m *StateMock) StoreTransaction(ctx context.Context, batchNumber uint64, processedTx *state.ProcessTransactionResponse, coinbase common.Address, timestamp uint64, dbTx pgx.Tx) error
StoreTransaction provides a mock function with given fields: ctx, batchNumber, processedTx, coinbase, timestamp, dbTx
type TxTracker ¶
type TxTracker struct { Hash common.Hash HashStr string From common.Address FromStr string Nonce uint64 Gas uint64 // To check if it fits into a batch GasPrice *big.Int Cost *big.Int // Cost = Amount + Benefit Benefit *big.Int // GasLimit * GasPrice IsClaim bool // Needed to calculate efficiency BatchResources batchResources // To check if it fits into a batch Efficiency float64 RawTx []byte }
TxTracker is a struct that contains all the tx data needed to be managed by the worker
type TxsStore ¶
TxsStore is a struct that contains the channel and the wait group for the txs to be stored in order
type WipBatch ¶
type WipBatch struct {
// contains filtered or unexported fields
}
WipBatch represents a work-in-progress batch.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker represents the worker component of the sequencer
func NewWorker ¶
func NewWorker(state stateInterface, constraints batchConstraints, weights batchResourceWeights) *Worker
NewWorker creates an init a worker
func (*Worker) GetBestFittingTx ¶
GetBestFittingTx gets the most efficient tx that fits in the available batch resources
func (*Worker) HandleL2Reorg ¶
HandleL2Reorg handles the L2 reorg signal
func (*Worker) MoveTxToNotReady ¶
func (w *Worker) MoveTxToNotReady(txHash common.Hash, from common.Address, actualNonce *uint64, actualBalance *big.Int)
MoveTxToNotReady move a tx to not ready after it fails to execute
func (*Worker) NewTxTracker ¶
func (w *Worker) NewTxTracker(tx types.Transaction, isClaim bool, counters state.ZKCounters) (*TxTracker, error)
NewTxTracker creates and inits a TxTracker
func (*Worker) UpdateAfterSingleSuccessfulTxExecution ¶
func (w *Worker) UpdateAfterSingleSuccessfulTxExecution(from common.Address, touchedAddresses map[common.Address]*state.InfoReadWrite)
UpdateAfterSingleSuccessfulTxExecution updates the touched addresses after execute on Executor a successfully tx
type WorkerMock ¶
WorkerMock is an autogenerated mock type for the workerInterface type
func NewWorkerMock ¶
func NewWorkerMock(t mockConstructorTestingTNewWorkerMock) *WorkerMock
NewWorkerMock creates a new instance of WorkerMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*WorkerMock) AddTx ¶
func (_m *WorkerMock) AddTx(ctx context.Context, txTracker *TxTracker)
AddTx provides a mock function with given fields: ctx, txTracker
func (*WorkerMock) DeleteTx ¶
func (_m *WorkerMock) DeleteTx(txHash common.Hash, from common.Address)
DeleteTx provides a mock function with given fields: txHash, from
func (*WorkerMock) GetBestFittingTx ¶
func (_m *WorkerMock) GetBestFittingTx(resources batchResources) *TxTracker
GetBestFittingTx provides a mock function with given fields: resources
func (*WorkerMock) HandleL2Reorg ¶
func (_m *WorkerMock) HandleL2Reorg(txHashes []common.Hash)
HandleL2Reorg provides a mock function with given fields: txHashes
func (*WorkerMock) MoveTxToNotReady ¶
func (_m *WorkerMock) MoveTxToNotReady(txHash common.Hash, from common.Address, actualNonce *uint64, actualBalance *big.Int)
MoveTxToNotReady provides a mock function with given fields: txHash, from, actualNonce, actualBalance
func (*WorkerMock) NewTxTracker ¶
func (_m *WorkerMock) NewTxTracker(tx types.Transaction, isClaim bool, counters state.ZKCounters) (*TxTracker, error)
NewTxTracker provides a mock function with given fields: tx, isClaim, counters
func (*WorkerMock) UpdateAfterSingleSuccessfulTxExecution ¶
func (_m *WorkerMock) UpdateAfterSingleSuccessfulTxExecution(from common.Address, touchedAddresses map[common.Address]*state.InfoReadWrite)
UpdateAfterSingleSuccessfulTxExecution provides a mock function with given fields: from, touchedAddresses
func (*WorkerMock) UpdateTx ¶
func (_m *WorkerMock) UpdateTx(txHash common.Hash, from common.Address, ZKCounters state.ZKCounters)
UpdateTx provides a mock function with given fields: txHash, from, ZKCounters