From f6b26c1be186df6faeece93e14e889d42b79fefe Mon Sep 17 00:00:00 2001 From: shailu-s Date: Mon, 23 Dec 2024 13:20:29 +0530 Subject: [PATCH] fixed issue after merging --- sequencer/cfg.toml | 19 +++++++++++++ sequencer/config/config.go | 56 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/sequencer/cfg.toml b/sequencer/cfg.toml index 7b5d685..09f090c 100644 --- a/sequencer/cfg.toml +++ b/sequencer/cfg.toml @@ -114,6 +114,25 @@ Address = "0x56232B1c5B10038125Bc7345664B4AFD745bcF8E" ## BJJ is the baby jub jub public key of the account that will receive the fees BJJ = "0x130c5c7f294792559f469220274f3d3b2dca6e89f4c5ec88d3a08bf73262171b" +[Coordinator.L2DB] +### Number of batches after which non-pending L2Txs are deleted from the pool +SafetyPeriod = 10 +### Maximum number of pending L2Txs that can be stored in the pool +MaxTxs = 1000000 +### Minimum fee in USD that a tx must pay in order to be accepted into the pool +MinFeeUSD = 0.10 +### Maximum fee in USD that a tx must pay in order to be accepted into the pool +MaxFeeUSD = 10.00 +### Time To Live for L2Txs in the pool. L2Txs older than TTL will be deleted. +TTL = "24h" +### Delay between batches to purge outdated transactions. Outdated L2Txs are those that have been forged or marked as invalid for longer than the SafetyPeriod and pending L2Txs that have been in the pool for longer than TTL once there are MaxTxs +PurgeBatchDelay = 10 +### Delay between batches to mark invalid transactions due to nonce lower than the account nonce +InvalidateBatchDelay = 20 +### Delay between blocks to purge outdated transactions. Outdated L2Txs are those that have been forged or marked as invalid for longer than the SafetyPeriod and pending L2Txs that have been in the pool for longer than TTL once there are MaxTxs. +PurgeBlockDelay = 10 +### Delay between blocks to mark invalid transactions due to nonce lower than the account nonce +InvalidateBlockDelay = 20 [Coordinator.TxSelector] ### Path where the TxSelector StateDB is stored diff --git a/sequencer/config/config.go b/sequencer/config/config.go index 6a6d90b..a1df97b 100644 --- a/sequencer/config/config.go +++ b/sequencer/config/config.go @@ -111,6 +111,47 @@ type Coordinator struct { SyncRetryInterval Duration `validate:"required" env:"TONNODE_COORDINATOR_SYNCRETRYINTERVAL"` // ProverWaitReadTimeout ProverWaitReadTimeout Duration `env:"TONNODE_COORDINATOR_PROVERWAITREADTIMEOUT"` + L2DB struct { + // SafetyPeriod is the number of batches after which + // non-pending L2Txs are deleted from the pool + SafetyPeriod common.BatchNum `validate:"required" env:"TONNODE_L2DB_SAFETYPERIOD"` + // MaxTxs is the maximum number of pending L2Txs that can be + // stored in the pool. Once this number of pending L2Txs is + // reached, inserts to the pool will be denied until some of + // the pending txs are forged. + MaxTxs uint32 `validate:"required" env:"TONNODE_L2DB_MAXTXS"` + // MinFeeUSD is the minimum fee in USD that a tx must pay in + // order to be accepted into the pool. Txs with lower than + // minimum fee will be rejected at the API level. + MinFeeUSD float64 `validate:"gte=0" env:"TONNODE_L2DB_MINFEEUSD"` + // MaxFeeUSD is the maximum fee in USD that a tx must pay in + // order to be accepted into the pool. Txs with greater than + // maximum fee will be rejected at the API level. + MaxFeeUSD float64 `validate:"required,gte=0" env:"TONNODE_L2DB_MAXFEEUSD"` + // TTL is the Time To Live for L2Txs in the pool. L2Txs older + // than TTL will be deleted. + TTL Duration `validate:"required" env:"TONNODE_L2DB_TTL"` + // PurgeBatchDelay is the delay between batches to purge + // outdated transactions. Outdated L2Txs are those that have + // been forged or marked as invalid for longer than the + // SafetyPeriod and pending L2Txs that have been in the pool + // for longer than TTL once there are MaxTxs. + PurgeBatchDelay int64 `validate:"required,gte=0" env:"TONNODE_L2DB_PURGEBATCHDELAY"` + // InvalidateBatchDelay is the delay between batches to mark + // invalid transactions due to nonce lower than the account + // nonce. + InvalidateBatchDelay int64 `validate:"required" env:"TONNODE_L2DB_INVALIDATEBATCHDELAY"` + // PurgeBlockDelay is the delay between blocks to purge + // outdated transactions. Outdated L2Txs are those that have + // been forged or marked as invalid for longer than the + // SafetyPeriod and pending L2Txs that have been in the pool + // for longer than TTL once there are MaxTxs. + PurgeBlockDelay int64 `validate:"required,gte=0" env:"TONNODE_L2DB_PURGEBLOCKDELAY"` + // InvalidateBlockDelay is the delay between blocks to mark + // invalid transactions due to nonce lower than the account + // nonce. + InvalidateBlockDelay int64 `validate:"required,gte=0" env:"TONNODE_L2DB_INVALIDATEBLOCKDELAY"` + } `validate:"required"` TxSelector struct { // Path where the TxSelector StateDB is stored Path string `validate:"required" env:"TONNODE_TXSELECTOR_PATH"` @@ -308,6 +349,21 @@ type APIServer struct { // Coordinator enables the coordinator API endpoints Coordinator bool `env:"TONNODE_COORDINATORAPI_COORDINATOR"` } `validate:"required"` + L2DB struct { + // MaxTxs is the maximum number of pending L2Txs that can be + // stored in the pool. Once this number of pending L2Txs is + // reached, inserts to the pool will be denied until some of + // the pending txs are forged. + MaxTxs uint32 `validate:"required" env:"TONNODE_L2DB_MAXTXS"` + // MinFeeUSD is the minimum fee in USD that a tx must pay in + // order to be accepted into the pool. Txs with lower than + // minimum fee will be rejected at the API level. + MinFeeUSD float64 `validate:"gte=0" env:"TONNODE_L2DB_MINFEEUSD"` + // MaxFeeUSD is the maximum fee in USD that a tx must pay in + // order to be accepted into the pool. Txs with greater than + // maximum fee will be rejected at the API level. + MaxFeeUSD float64 `validate:"required,gte=0" env:"TONNODE_L2DB_MAXFEEUSD"` + } `validate:"required"` // Keystore is the ethereum keystore where private keys are kept. // Required if API.CoordinatorNetwork == true Keystore struct {