Added cache.blocklogs (FilterLogCacheSize) flag (#1083)

* added cache.blocklogs (FilterLogCacheSize) flag

* updated docs

* minor fix

Co-authored-by: Mael Regnery <mael@mqli.fr>

---------

Co-authored-by: Mael Regnery <mael@mqli.fr>
This commit is contained in:
Pratik Patil 2023-11-20 10:18:11 +05:30 committed by GitHub
parent d345879437
commit 923c192c7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 39 additions and 16 deletions

View file

@ -155,6 +155,7 @@ syncmode = "full"
# preimages = false # preimages = false
# txlookuplimit = 2350000 # txlookuplimit = 2350000
# triesinmemory = 128 # triesinmemory = 128
# blocklogs = 32
# timeout = "1h0m0s" # timeout = "1h0m0s"
# fdlimit = 0 # fdlimit = 0

View file

@ -160,6 +160,7 @@ devfakeauthor = false # Run miner without validator set authorization
preimages = false # Enable recording the SHA3/keccak preimages of trie keys 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) txlookuplimit = 2350000 # Number of recent blocks to maintain transactions index for (default = about 56 days, 0 = entire chain)
triesinmemory = 128 # Number of block states (tries) to keep in memory triesinmemory = 128 # Number of block states (tries) to keep in memory
blocklogs = 32 # Size (in number of blocks) of the log cache for filtering
timeout = "1h0m0s" # Time after which the Merkle Patricia Trie is stored to disc from memory timeout = "1h0m0s" # Time after which the Merkle Patricia Trie is stored to disc from memory
fdlimit = 0 # Raise the open file descriptor resource limit (default = system fd limit) fdlimit = 0 # Raise the open file descriptor resource limit (default = system fd limit)

View file

@ -104,6 +104,8 @@ The ```bor server``` command runs the Bor client.
- ```cache```: Megabytes of memory allocated to internal caching (default: 1024) - ```cache```: Megabytes of memory allocated to internal caching (default: 1024)
- ```cache.blocklogs```: Size (in number of blocks) of the log cache for filtering (default: 32)
- ```cache.database```: Percentage of cache memory allowance to use for database io (default: 50) - ```cache.database```: Percentage of cache memory allowance to use for database io (default: 50)
- ```cache.gc```: Percentage of cache memory allowance to use for trie pruning (default: 25) - ```cache.gc```: Percentage of cache memory allowance to use for trie pruning (default: 25)
@ -116,10 +118,6 @@ The ```bor server``` command runs the Bor client.
- ```cache.trie```: Percentage of cache memory allowance to use for trie caching (default: 15) - ```cache.trie```: Percentage of cache memory allowance to use for trie caching (default: 15)
- ```cache.trie.journal```: Disk journal directory for trie cache to survive node restarts (default: triecache)
- ```cache.trie.rejournal```: Time interval to regenerate the trie cache journal (default: 1h0m0s)
- ```cache.triesinmemory```: Number of block states (tries) to keep in memory (default: 128) - ```cache.triesinmemory```: Number of block states (tries) to keep in memory (default: 128)
- ```fdlimit```: Raise the open file descriptor resource limit (default = system fd limit) (default: 0) - ```fdlimit```: Raise the open file descriptor resource limit (default = system fd limit) (default: 0)
@ -182,7 +180,7 @@ The ```bor server``` command runs the Bor client.
- ```rpc.gascap```: Sets a cap on gas that can be used in eth_call/estimateGas (0=infinite) (default: 50000000) - ```rpc.gascap```: Sets a cap on gas that can be used in eth_call/estimateGas (0=infinite) (default: 50000000)
- ```rpc.txfeecap```: Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap) (default: 5) - ```rpc.txfeecap```: Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap) (default: 1)
- ```ws```: Enable the WS-RPC server (default: false) - ```ws```: Enable the WS-RPC server (default: false)
@ -234,6 +232,8 @@ The ```bor server``` command runs the Bor client.
- ```txarrivalwait```: Maximum duration to wait for a transaction before explicitly requesting it (default: 500ms) - ```txarrivalwait```: Maximum duration to wait for a transaction before explicitly requesting it (default: 500ms)
- ```v4disc```: Enables the V4 discovery mechanism (default: true)
- ```v5disc```: Enables the experimental RLPx V5 (Topic Discovery) mechanism (default: false) - ```v5disc```: Enables the experimental RLPx V5 (Topic Discovery) mechanism (default: false)
### Sealer Options ### Sealer Options

View file

@ -540,6 +540,10 @@ type CacheConfig struct {
// Number of block states to keep in memory (default = 128) // Number of block states to keep in memory (default = 128)
TriesInMemory uint64 `hcl:"triesinmemory,optional" toml:"triesinmemory,optional"` TriesInMemory uint64 `hcl:"triesinmemory,optional" toml:"triesinmemory,optional"`
// This is the number of blocks for which logs will be cached in the filter system.
FilterLogCacheSize int `hcl:"blocklogs,optional" toml:"blocklogs,optional"`
// Time after which the Merkle Patricia Trie is stored to disc from memory // Time after which the Merkle Patricia Trie is stored to disc from memory
TrieTimeout time.Duration `hcl:"-,optional" toml:"-"` TrieTimeout time.Duration `hcl:"-,optional" toml:"-"`
TrieTimeoutRaw string `hcl:"timeout,optional" toml:"timeout,optional"` TrieTimeoutRaw string `hcl:"timeout,optional" toml:"timeout,optional"`
@ -734,17 +738,18 @@ func DefaultConfig() *Config {
}, },
}, },
Cache: &CacheConfig{ Cache: &CacheConfig{
Cache: 1024, // geth's default (suitable for mumbai) Cache: 1024, // geth's default (suitable for mumbai)
PercDatabase: 50, PercDatabase: 50,
PercTrie: 15, PercTrie: 15,
PercGc: 25, PercGc: 25,
PercSnapshot: 10, PercSnapshot: 10,
NoPrefetch: false, NoPrefetch: false,
Preimages: false, Preimages: false,
TxLookupLimit: 2350000, TxLookupLimit: 2350000,
TriesInMemory: 128, TriesInMemory: 128,
TrieTimeout: 60 * time.Minute, FilterLogCacheSize: ethconfig.Defaults.FilterLogCacheSize,
FDLimit: 0, TrieTimeout: 60 * time.Minute,
FDLimit: 0,
}, },
ExtraDB: &ExtraDBConfig{ ExtraDB: &ExtraDBConfig{
// These are LevelDB defaults, specifying here for clarity in code and in logging. // These are LevelDB defaults, specifying here for clarity in code and in logging.
@ -1108,6 +1113,7 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (*
n.TxLookupLimit = c.Cache.TxLookupLimit n.TxLookupLimit = c.Cache.TxLookupLimit
n.TrieTimeout = c.Cache.TrieTimeout n.TrieTimeout = c.Cache.TrieTimeout
n.TriesInMemory = c.Cache.TriesInMemory n.TriesInMemory = c.Cache.TriesInMemory
n.FilterLogCacheSize = c.Cache.FilterLogCacheSize
} }
// LevelDB // LevelDB

View file

@ -424,6 +424,13 @@ func (c *Command) Flags(config *Config) *flagset.Flagset {
Default: c.cliConfig.Cache.TriesInMemory, Default: c.cliConfig.Cache.TriesInMemory,
Group: "Cache", Group: "Cache",
}) })
f.IntFlag(&flagset.IntFlag{
Name: "cache.blocklogs",
Usage: "Size (in number of blocks) of the log cache for filtering",
Value: &c.cliConfig.Cache.FilterLogCacheSize,
Default: c.cliConfig.Cache.FilterLogCacheSize,
Group: "Cache",
})
f.Uint64Flag(&flagset.Uint64Flag{ f.Uint64Flag(&flagset.Uint64Flag{
Name: "txlookuplimit", Name: "txlookuplimit",
Usage: "Number of recent blocks to maintain transactions index for", Usage: "Number of recent blocks to maintain transactions index for",

View file

@ -148,6 +148,7 @@ gcmode = "archive"
# noprefetch = false # noprefetch = false
# preimages = false # preimages = false
# txlookuplimit = 2350000 # txlookuplimit = 2350000
# blocklogs = 32
# timeout = "1h0m0s" # timeout = "1h0m0s"
# fdlimit = 0 # fdlimit = 0

View file

@ -148,6 +148,7 @@ syncmode = "full"
# noprefetch = false # noprefetch = false
# preimages = false # preimages = false
# txlookuplimit = 2350000 # txlookuplimit = 2350000
# blocklogs = 32
# timeout = "1h0m0s" # timeout = "1h0m0s"
# fdlimit = 0 # fdlimit = 0

View file

@ -150,6 +150,7 @@ syncmode = "full"
# noprefetch = false # noprefetch = false
# preimages = false # preimages = false
# txlookuplimit = 2350000 # txlookuplimit = 2350000
# blocklogs = 32
# timeout = "1h0m0s" # timeout = "1h0m0s"
# fdlimit = 0 # fdlimit = 0

View file

@ -150,6 +150,7 @@ syncmode = "full"
# noprefetch = false # noprefetch = false
# preimages = false # preimages = false
# txlookuplimit = 2350000 # txlookuplimit = 2350000
# blocklogs = 32
# timeout = "1h0m0s" # timeout = "1h0m0s"
# fdlimit = 0 # fdlimit = 0

View file

@ -148,6 +148,7 @@ gcmode = "archive"
# noprefetch = false # noprefetch = false
# preimages = false # preimages = false
# txlookuplimit = 2350000 # txlookuplimit = 2350000
# blocklogs = 32
# timeout = "1h0m0s" # timeout = "1h0m0s"
# fdlimit = 0 # fdlimit = 0

View file

@ -148,6 +148,7 @@ syncmode = "full"
# noprefetch = false # noprefetch = false
# preimages = false # preimages = false
# txlookuplimit = 2350000 # txlookuplimit = 2350000
# blocklogs = 32
# timeout = "1h0m0s" # timeout = "1h0m0s"
# fdlimit = 0 # fdlimit = 0

View file

@ -150,6 +150,7 @@ syncmode = "full"
# noprefetch = false # noprefetch = false
# preimages = false # preimages = false
# txlookuplimit = 2350000 # txlookuplimit = 2350000
# blocklogs = 32
# timeout = "1h0m0s" # timeout = "1h0m0s"
# fdlimit = 0 # fdlimit = 0

View file

@ -150,6 +150,7 @@ syncmode = "full"
# noprefetch = false # noprefetch = false
# preimages = false # preimages = false
# txlookuplimit = 2350000 # txlookuplimit = 2350000
# blocklogs = 32
# timeout = "1h0m0s" # timeout = "1h0m0s"
# fdlimit = 0 # fdlimit = 0