mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 03:16:45 +01:00
Integrate purger to node
- Common - Add `IdxNonce` type used to track nonces in accounts to invalidate l2txs in the pool - Config - Update coordinator config will all the new configuration parameters used in the coordinator - Coordinator - Introduce the `Purger` to track how often to purge and do the job when needed according to a configuration. - Implement the methods to invalidate l2txs transactions due to l2txs selection in batches. For now these functions are not used in favour of the `Purger` methods, which check ALL the l2txs in the pool. - Call Invalidation and Purging methods of the purger both when the node is forging (in the pipeline when starting a new batch) and when the node is not forging (in coordinator when being notified about a new synced block) - L2DB: - Implement `GetPendingUniqueFromIdxs` to get all the unique idxs from pending transactions (used to get their nonces and then invalidate txs) - Redo `CheckNonces` with a single SQL query and using `common.IdxNonce` instead of `common.Account` - StateDB: - Expose GetIdx to check errors when invalidating pool txs - Synchronizer: - Test forged L1UserTxs processed by TxProcessor - Improve checks of Effective values - TxSelector: - Expose the internal LocalStateDB in order to check account nonces in the coordinator when not forging.
This commit is contained in:
@@ -35,13 +35,27 @@ type ServerProof struct {
|
||||
|
||||
// Coordinator is the coordinator specific configuration.
|
||||
type Coordinator struct {
|
||||
// ForgerAddress is the address under which this coordinator is forging
|
||||
ForgerAddress ethCommon.Address `validate:"required"`
|
||||
ForgeLoopInterval Duration `validate:"required"`
|
||||
ConfirmBlocks int64 `validate:"required"`
|
||||
L2DB struct {
|
||||
// ConfirmBlocks is the number of confirmation blocks to wait for sent
|
||||
// ethereum transactions before forgetting about them
|
||||
ConfirmBlocks int64 `validate:"required"`
|
||||
// L1BatchTimeoutPerc is the portion of the range before the L1Batch
|
||||
// timeout that will trigger a schedule to forge an L1Batch
|
||||
L1BatchTimeoutPerc float64 `validate:"required"`
|
||||
L2DB struct {
|
||||
SafetyPeriod common.BatchNum `validate:"required"`
|
||||
MaxTxs uint32 `validate:"required"`
|
||||
TTL Duration `validate:"required"`
|
||||
// PurgeBatchDelay is the delay between batches to purge outdated transactions
|
||||
PurgeBatchDelay int64 `validate:"required"`
|
||||
// InvalidateBatchDelay is the delay between batches to mark invalid transactions
|
||||
InvalidateBatchDelay int64 `validate:"required"`
|
||||
// PurgeBlockDelay is the delay between blocks to purge outdated transactions
|
||||
PurgeBlockDelay int64 `validate:"required"`
|
||||
// InvalidateBlockDelay is the delay between blocks to mark invalid transactions
|
||||
InvalidateBlockDelay int64 `validate:"required"`
|
||||
} `validate:"required"`
|
||||
TxSelector struct {
|
||||
Path string `validate:"required"`
|
||||
@@ -56,10 +70,24 @@ type Coordinator struct {
|
||||
GasPriceDiv uint64 `validate:"required"`
|
||||
ReceiptTimeout Duration `validate:"required"`
|
||||
IntervalReceiptLoop Duration `validate:"required"`
|
||||
// IntervalCheckLoop is the waiting interval between receipt
|
||||
// checks of ethereum transactions in the TxManager
|
||||
IntervalCheckLoop Duration `validate:"required"`
|
||||
// Attempts is the number of attempts to do an eth client RPC
|
||||
// call before giving up
|
||||
Attempts int `validate:"required"`
|
||||
// AttemptsDelay is delay between attempts do do an eth client
|
||||
// RPC call
|
||||
AttemptsDelay Duration `validate:"required"`
|
||||
} `validate:"required"`
|
||||
API struct {
|
||||
Coordinator bool
|
||||
} `validate:"required"`
|
||||
Debug struct {
|
||||
// BatchPath if set, specifies the path where batchInfo is stored
|
||||
// in JSON in every step/update of the pipeline
|
||||
BatchPath string
|
||||
}
|
||||
}
|
||||
|
||||
// Node is the hermez node configuration.
|
||||
|
||||
Reference in New Issue
Block a user