diff --git a/builder/files/config.toml b/builder/files/config.toml index 1e78f44def..8d2279b330 100644 --- a/builder/files/config.toml +++ b/builder/files/config.toml @@ -8,7 +8,7 @@ chain = "mainnet" # vmdebug = false datadir = "/var/lib/bor/data" # ancient = "" -# db.engine = "leveldb" +# "db.engine" = "leveldb" # keystore = "/var/lib/bor/keystore" # "rpc.batchlimit" = 100 # "rpc.returndatalimit" = 100000 @@ -37,6 +37,7 @@ syncmode = "full" # nodekey = "" # nodekeyhex = "" [p2p.discovery] + # v4disc = true # v5disc = false bootnodes = ["enode://76316d1cb93c8ed407d3332d595233401250d48f8fbb1d9c65bd18c0495eca1b43ec38ee0ea1c257c0abb7d1f25d649d359cdfe5a805842159cfe36c5f66b7e8@52.78.36.216:30303", "enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303", "enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303", "enode://681ebac58d8dd2d8a6eef15329dfbad0ab960561524cf2dfde40ad646736fe5c244020f20b87e7c1520820bc625cfb487dd71d63a3a3bf0baea2dbb8ec7c79f1@34.240.245.39:30303"] # Uncomment below `bootnodes` field for Mumbai bootnode @@ -150,8 +151,6 @@ syncmode = "full" # snapshot = 10 # database = 50 # trie = 15 - # journal = "triecache" - # rejournal = "1h0m0s" # noprefetch = false # preimages = false # txlookuplimit = 2350000 diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index a068db5104..db4af0ee8d 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -1666,9 +1666,18 @@ func (pool *LegacyPool) demoteUnexecutables() { // Internal shuffle shouldn't touch the lookup set. pool.enqueueTx(hash, tx, false, false) } - pendingGauge.Dec(int64(len(olds) + len(drops) + len(invalids))) + // Drop all transactions that no longer have valid TxOptions + txConditionalsRemoved := list.FilterTxConditional(pool.currentState) + + for _, tx := range txConditionalsRemoved { + hash := tx.Hash() + pool.all.Remove(hash) + log.Trace("Removed invalid conditional transaction", "hash", hash) + } + + pendingGauge.Dec(int64(len(olds) + len(drops) + len(invalids) + len(txConditionalsRemoved))) if pool.locals.contains(addr) { - localGauge.Dec(int64(len(olds) + len(drops) + len(invalids))) + localGauge.Dec(int64(len(olds) + len(drops) + len(invalids) + len(txConditionalsRemoved))) } // If there's a gap in front, alert (should never happen) and postpone all transactions if list.Len() > 0 && list.txs.Get(nonce) == nil { diff --git a/docs/cli/example_config.toml b/docs/cli/example_config.toml index 2dd03caccd..fb9def8e1f 100644 --- a/docs/cli/example_config.toml +++ b/docs/cli/example_config.toml @@ -8,7 +8,7 @@ verbosity = 3 # Logging verbosity for the server (5=trace|4=de vmdebug = false # Record information useful for VM and contract debugging datadir = "var/lib/bor" # Path of the data directory to store information ancient = "" # Data directory for ancient chain segments (default = inside chaindata) -db.engine = "leveldb" # Used to select leveldb or pebble as database (default = leveldb) +"db.engine" = "leveldb" # Used to select leveldb or pebble as database (default = leveldb) keystore = "" # Path of the directory where keystores are located "rpc.batchlimit" = 100 # Maximum number of messages in a batch (default=100, use 0 for no limits) "rpc.returndatalimit" = 100000 # Maximum size (in bytes) a result of an rpc request could have (default=100000, use 0 for no limits) @@ -41,6 +41,7 @@ devfakeauthor = false # Run miner without validator set authorization nodekeyhex = "" # P2P node key as hex txarrivalwait = "500ms" # Maximum duration to wait before requesting an announced transaction [p2p.discovery] + v4disc = true # Enables the V4 discovery mechanism v5disc = false # Enables the experimental RLPx V5 (Topic Discovery) mechanism bootnodes = [] # Comma separated enode URLs for P2P discovery bootstrap bootnodesv4 = [] # List of initial v4 bootnodes @@ -155,8 +156,6 @@ devfakeauthor = false # Run miner without validator set authorization snapshot = 10 # Percentage of cache memory allowance to use for snapshot caching (default = 10% full mode, 20% archive mode) database = 50 # Percentage of cache memory allowance to use for database io trie = 15 # Percentage of cache memory allowance to use for trie caching (default = 15% full mode, 30% archive mode) - journal = "triecache" # Disk journal directory for trie cache to survive node restarts - rejournal = "1h0m0s" # Time interval to regenerate the trie cache journal noprefetch = false # Disable heuristic state prefetch during block import (less CPU and disk IO, more time waiting for data) preimages = false # Enable recording the SHA3/keccak preimages of trie keys txlookuplimit = 2350000 # Number of recent blocks to maintain transactions index for (default = about 56 days, 0 = entire chain) diff --git a/internal/cli/dumpconfig.go b/internal/cli/dumpconfig.go index c735f040fa..f01adef628 100644 --- a/internal/cli/dumpconfig.go +++ b/internal/cli/dumpconfig.go @@ -64,7 +64,6 @@ func (c *DumpconfigCommand) Run(args []string) int { userConfig.Sealer.RecommitRaw = userConfig.Sealer.Recommit.String() userConfig.Gpo.MaxPriceRaw = userConfig.Gpo.MaxPrice.String() userConfig.Gpo.IgnorePriceRaw = userConfig.Gpo.IgnorePrice.String() - userConfig.Cache.RejournalRaw = userConfig.Cache.Rejournal.String() userConfig.Cache.TrieTimeoutRaw = userConfig.Cache.TrieTimeout.String() userConfig.P2P.TxArrivalWaitRaw = userConfig.P2P.TxArrivalWait.String() diff --git a/internal/cli/server/config.go b/internal/cli/server/config.go index 563df7ab4e..4a46ba0d1e 100644 --- a/internal/cli/server/config.go +++ b/internal/cli/server/config.go @@ -219,6 +219,9 @@ type P2PConfig struct { } type P2PDiscovery struct { + // DiscoveryV4 specifies whether V4 discovery should be started. + DiscoveryV4 bool `hcl:"v4disc,optional" toml:"v4disc,optional"` + // V5Enabled is used to enable disc v5 discovery mode V5Enabled bool `hcl:"v5disc,optional" toml:"v5disc,optional"` @@ -526,13 +529,6 @@ type CacheConfig struct { // PercTrie is percentage of cache used for the trie PercTrie uint64 `hcl:"trie,optional" toml:"trie,optional"` - // Journal is the disk journal directory for trie cache to survive node restarts - Journal string `hcl:"journal,optional" toml:"journal,optional"` - - // Rejournal is the time interval to regenerate the journal for clean cache - Rejournal time.Duration `hcl:"-,optional" toml:"-"` - RejournalRaw string `hcl:"rejournal,optional" toml:"rejournal,optional"` - // NoPrefetch is used to disable prefetch of tries NoPrefetch bool `hcl:"noprefetch,optional" toml:"noprefetch,optional"` @@ -623,6 +619,7 @@ func DefaultConfig() *Config { NetRestrict: "", TxArrivalWait: 500 * time.Millisecond, Discovery: &P2PDiscovery{ + DiscoveryV4: true, V5Enabled: false, Bootnodes: []string{}, BootnodesV4: []string{}, @@ -742,8 +739,6 @@ func DefaultConfig() *Config { PercTrie: 15, PercGc: 25, PercSnapshot: 10, - Journal: "triecache", - Rejournal: 60 * time.Minute, NoPrefetch: false, Preimages: false, TxLookupLimit: 2350000, @@ -840,7 +835,6 @@ func (c *Config) fillTimeDurations() error { {"jsonrpc.http.ep-requesttimeout", &c.JsonRPC.Http.ExecutionPoolRequestTimeout, &c.JsonRPC.Http.ExecutionPoolRequestTimeoutRaw}, {"txpool.lifetime", &c.TxPool.LifeTime, &c.TxPool.LifeTimeRaw}, {"txpool.rejournal", &c.TxPool.Rejournal, &c.TxPool.RejournalRaw}, - {"cache.rejournal", &c.Cache.Rejournal, &c.Cache.RejournalRaw}, {"cache.timeout", &c.Cache.TrieTimeout, &c.Cache.TrieTimeoutRaw}, {"p2p.txarrivalwait", &c.P2P.TxArrivalWait, &c.P2P.TxArrivalWaitRaw}, } @@ -1317,6 +1311,7 @@ func (c *Config) buildNode() (*node.Config, error) { MaxPeers: int(c.P2P.MaxPeers), MaxPendingPeers: int(c.P2P.MaxPendPeers), ListenAddr: c.P2P.Bind + ":" + strconv.Itoa(int(c.P2P.Port)), + DiscoveryV4: c.P2P.Discovery.DiscoveryV4, DiscoveryV5: c.P2P.Discovery.V5Enabled, TxArrivalWait: c.P2P.TxArrivalWait, }, diff --git a/internal/cli/server/flags.go b/internal/cli/server/flags.go index 35150d5a48..48813fdfbe 100644 --- a/internal/cli/server/flags.go +++ b/internal/cli/server/flags.go @@ -389,20 +389,6 @@ func (c *Command) Flags(config *Config) *flagset.Flagset { Default: c.cliConfig.Cache.PercTrie, Group: "Cache", }) - f.StringFlag(&flagset.StringFlag{ - Name: "cache.trie.journal", - Usage: "Disk journal directory for trie cache to survive node restarts", - Value: &c.cliConfig.Cache.Journal, - Default: c.cliConfig.Cache.Journal, - Group: "Cache", - }) - f.DurationFlag(&flagset.DurationFlag{ - Name: "cache.trie.rejournal", - Usage: "Time interval to regenerate the trie cache journal", - Value: &c.cliConfig.Cache.Rejournal, - Default: c.cliConfig.Cache.Rejournal, - Group: "Cache", - }) f.Uint64Flag(&flagset.Uint64Flag{ Name: "cache.gc", Usage: "Percentage of cache memory allowance to use for trie pruning", @@ -779,6 +765,13 @@ func (c *Command) Flags(config *Config) *flagset.Flagset { Default: c.cliConfig.P2P.NoDiscover, Group: "P2P", }) + f.BoolFlag(&flagset.BoolFlag{ + Name: "v4disc", + Usage: "Enables the V4 discovery mechanism", + Value: &c.cliConfig.P2P.Discovery.DiscoveryV4, + Default: c.cliConfig.P2P.Discovery.DiscoveryV4, + Group: "P2P", + }) f.BoolFlag(&flagset.BoolFlag{ Name: "v5disc", Usage: "Enables the experimental RLPx V5 (Topic Discovery) mechanism", diff --git a/packaging/templates/mainnet-v1/archive/config.toml b/packaging/templates/mainnet-v1/archive/config.toml index ab16db7194..bdbe8edc8f 100644 --- a/packaging/templates/mainnet-v1/archive/config.toml +++ b/packaging/templates/mainnet-v1/archive/config.toml @@ -4,7 +4,7 @@ chain = "mainnet" # vmdebug = false datadir = "/var/lib/bor/data" # ancient = "" -# db.engine = "leveldb" +# "db.engine" = "leveldb" # keystore = "" # "rpc.batchlimit" = 100 # "rpc.returndatalimit" = 100000 @@ -34,6 +34,7 @@ gcmode = "archive" # nodekeyhex = "" # txarrivalwait = "500ms" # [p2p.discovery] + # v4disc = true # v5disc = false # bootnodes = ["enode://76316d1cb93c8ed407d3332d595233401250d48f8fbb1d9c65bd18c0495eca1b43ec38ee0ea1c257c0abb7d1f25d649d359cdfe5a805842159cfe36c5f66b7e8@52.78.36.216:30303", "enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303", "enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303", "enode://681ebac58d8dd2d8a6eef15329dfbad0ab960561524cf2dfde40ad646736fe5c244020f20b87e7c1520820bc625cfb487dd71d63a3a3bf0baea2dbb8ec7c79f1@34.240.245.39:30303"] # bootnodesv4 = [] @@ -144,8 +145,6 @@ gcmode = "archive" snapshot = 20 # database = 50 trie = 30 - # journal = "triecache" - # rejournal = "1h0m0s" # noprefetch = false # preimages = false # txlookuplimit = 2350000 diff --git a/packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml b/packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml index d2bc5bd988..af9cb26113 100644 --- a/packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml +++ b/packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml @@ -4,7 +4,7 @@ chain = "mainnet" # vmdebug = false datadir = "/var/lib/bor/data" # ancient = "" -# db.engine = "leveldb" +# "db.engine" = "leveldb" # keystore = "" # "rpc.batchlimit" = 100 # "rpc.returndatalimit" = 100000 @@ -34,6 +34,7 @@ syncmode = "full" # nodekeyhex = "" # txarrivalwait = "500ms" # [p2p.discovery] + # v4disc = true # v5disc = false # bootnodes = [] # bootnodesv4 = [] @@ -144,8 +145,6 @@ syncmode = "full" # snapshot = 10 # database = 50 # trie = 15 - # journal = "triecache" - # rejournal = "1h0m0s" # noprefetch = false # preimages = false # txlookuplimit = 2350000 diff --git a/packaging/templates/mainnet-v1/sentry/validator/bor/config.toml b/packaging/templates/mainnet-v1/sentry/validator/bor/config.toml index fb3713764d..e01d1fb331 100644 --- a/packaging/templates/mainnet-v1/sentry/validator/bor/config.toml +++ b/packaging/templates/mainnet-v1/sentry/validator/bor/config.toml @@ -6,7 +6,7 @@ chain = "mainnet" # vmdebug = false datadir = "/var/lib/bor/data" # ancient = "" -# db.engine = "leveldb" +# "db.engine" = "leveldb" # keystore = "$BOR_DIR/keystore" # "rpc.batchlimit" = 100 # "rpc.returndatalimit" = 100000 @@ -36,6 +36,7 @@ syncmode = "full" # nodekeyhex = "" # txarrivalwait = "500ms" # [p2p.discovery] + # v4disc = true # v5disc = false # bootnodes = ["enode://76316d1cb93c8ed407d3332d595233401250d48f8fbb1d9c65bd18c0495eca1b43ec38ee0ea1c257c0abb7d1f25d649d359cdfe5a805842159cfe36c5f66b7e8@52.78.36.216:30303", "enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303", "enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303", "enode://681ebac58d8dd2d8a6eef15329dfbad0ab960561524cf2dfde40ad646736fe5c244020f20b87e7c1520820bc625cfb487dd71d63a3a3bf0baea2dbb8ec7c79f1@34.240.245.39:30303"] # bootnodesv4 = [] @@ -146,8 +147,6 @@ syncmode = "full" # snapshot = 10 # database = 50 # trie = 15 - # journal = "triecache" - # rejournal = "1h0m0s" # noprefetch = false # preimages = false # txlookuplimit = 2350000 diff --git a/packaging/templates/mainnet-v1/without-sentry/bor/config.toml b/packaging/templates/mainnet-v1/without-sentry/bor/config.toml index 52975db775..87dfaf54f2 100644 --- a/packaging/templates/mainnet-v1/without-sentry/bor/config.toml +++ b/packaging/templates/mainnet-v1/without-sentry/bor/config.toml @@ -6,7 +6,7 @@ chain = "mainnet" # vmdebug = false datadir = "/var/lib/bor/data" # ancient = "" -# db.engine = "leveldb" +# "db.engine" = "leveldb" # keystore = "$BOR_DIR/keystore" # "rpc.batchlimit" = 100 # "rpc.returndatalimit" = 100000 @@ -36,6 +36,7 @@ syncmode = "full" # nodekeyhex = "" # txarrivalwait = "500ms" # [p2p.discovery] + # v4disc = true # v5disc = false # bootnodes = [] # bootnodesv4 = [] @@ -146,8 +147,6 @@ syncmode = "full" # snapshot = 10 # database = 50 # trie = 15 -# journal = "triecache" -# rejournal = "1h0m0s" # noprefetch = false # preimages = false # txlookuplimit = 2350000 diff --git a/packaging/templates/testnet-v4/archive/config.toml b/packaging/templates/testnet-v4/archive/config.toml index e6ad0ea920..b581a687e2 100644 --- a/packaging/templates/testnet-v4/archive/config.toml +++ b/packaging/templates/testnet-v4/archive/config.toml @@ -4,7 +4,7 @@ chain = "mumbai" # vmdebug = false datadir = "/var/lib/bor/data" # ancient = "" -# db.engine = "leveldb" +# "db.engine" = "leveldb" # keystore = "" # "rpc.batchlimit" = 100 # "rpc.returndatalimit" = 100000 @@ -34,6 +34,7 @@ gcmode = "archive" # nodekeyhex = "" # txarrivalwait = "500ms" # [p2p.discovery] + # v4disc = true # v5disc = false # bootnodes = [] # bootnodesv4 = [] @@ -144,8 +145,6 @@ gcmode = "archive" snapshot = 20 # database = 50 trie = 30 - # journal = "triecache" - # rejournal = "1h0m0s" # noprefetch = false # preimages = false # txlookuplimit = 2350000 diff --git a/packaging/templates/testnet-v4/sentry/sentry/bor/config.toml b/packaging/templates/testnet-v4/sentry/sentry/bor/config.toml index 7ec7dc639a..0778310d8e 100644 --- a/packaging/templates/testnet-v4/sentry/sentry/bor/config.toml +++ b/packaging/templates/testnet-v4/sentry/sentry/bor/config.toml @@ -4,7 +4,7 @@ chain = "mumbai" # vmdebug = false datadir = "/var/lib/bor/data" # ancient = "" -# db.engine = "leveldb" +# "db.engine" = "leveldb" # keystore = "" # "rpc.batchlimit" = 100 # "rpc.returndatalimit" = 100000 @@ -34,6 +34,7 @@ syncmode = "full" # nodekeyhex = "" # txarrivalwait = "500ms" # [p2p.discovery] + # v4disc = true # v5disc = false # bootnodes = [] # bootnodesv4 = [] @@ -144,8 +145,6 @@ syncmode = "full" # snapshot = 10 # database = 50 # trie = 15 - # journal = "triecache" - # rejournal = "1h0m0s" # noprefetch = false # preimages = false # txlookuplimit = 2350000 diff --git a/packaging/templates/testnet-v4/sentry/validator/bor/config.toml b/packaging/templates/testnet-v4/sentry/validator/bor/config.toml index ffc6ef8633..9c0133d7a5 100644 --- a/packaging/templates/testnet-v4/sentry/validator/bor/config.toml +++ b/packaging/templates/testnet-v4/sentry/validator/bor/config.toml @@ -6,7 +6,7 @@ chain = "mumbai" # vmdebug = false datadir = "/var/lib/bor/data" # ancient = "" -# db.engine = "leveldb" +# "db.engine" = "leveldb" # keystore = "$BOR_DIR/keystore" # "rpc.batchlimit" = 100 # "rpc.returndatalimit" = 100000 @@ -36,6 +36,7 @@ syncmode = "full" # nodekeyhex = "" # txarrivalwait = "500ms" # [p2p.discovery] + # v4disc = true # v5disc = false # bootnodes = [] # bootnodesv4 = [] @@ -146,8 +147,6 @@ syncmode = "full" # snapshot = 10 # database = 50 # trie = 15 - # journal = "triecache" - # rejournal = "1h0m0s" # noprefetch = false # preimages = false # txlookuplimit = 2350000 diff --git a/packaging/templates/testnet-v4/without-sentry/bor/config.toml b/packaging/templates/testnet-v4/without-sentry/bor/config.toml index 00d26c52cc..6bcb8c59fc 100644 --- a/packaging/templates/testnet-v4/without-sentry/bor/config.toml +++ b/packaging/templates/testnet-v4/without-sentry/bor/config.toml @@ -6,7 +6,7 @@ chain = "mumbai" # vmdebug = false datadir = "/var/lib/bor/data" # ancient = "" -# db.engine = "leveldb" +# "db.engine" = "leveldb" # keystore = "$BOR_DIR/keystore" # "rpc.batchlimit" = 100 # "rpc.returndatalimit" = 100000 @@ -36,6 +36,7 @@ syncmode = "full" # nodekeyhex = "" # txarrivalwait = "500ms" # [p2p.discovery] + # v4disc = true # v5disc = false # bootnodes = [] # bootnodesv4 = [] @@ -146,8 +147,6 @@ syncmode = "full" # snapshot = 10 # database = 50 # trie = 15 -# journal = "triecache" -# rejournal = "1h0m0s" # noprefetch = false # preimages = false # txlookuplimit = 2350000