Skip to content

Commit

Permalink
Added cache.blocklogs (FilterLogCacheSize) flag (#1083)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
pratikspatil024 and MqllR authored Nov 20, 2023
1 parent d345879 commit 923c192
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 16 deletions.
1 change: 1 addition & 0 deletions builder/files/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ syncmode = "full"
# preimages = false
# txlookuplimit = 2350000
# triesinmemory = 128
# blocklogs = 32
# timeout = "1h0m0s"
# fdlimit = 0

Expand Down
1 change: 1 addition & 0 deletions docs/cli/example_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ devfakeauthor = false # Run miner without validator set authorization
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)
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
fdlimit = 0 # Raise the open file descriptor resource limit (default = system fd limit)

Expand Down
10 changes: 5 additions & 5 deletions docs/cli/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ The ```bor server``` command runs the Bor client.

- ```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.gc```: Percentage of cache memory allowance to use for trie pruning (default: 25)
Expand All @@ -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.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)

- ```fdlimit```: Raise the open file descriptor resource limit (default = system fd limit) (default: 0)
Expand Down Expand Up @@ -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.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)

Expand Down Expand Up @@ -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)

- ```v4disc```: Enables the V4 discovery mechanism (default: true)

- ```v5disc```: Enables the experimental RLPx V5 (Topic Discovery) mechanism (default: false)

### Sealer Options
Expand Down
28 changes: 17 additions & 11 deletions internal/cli/server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,10 @@ type CacheConfig struct {

// Number of block states to keep in memory (default = 128)
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
TrieTimeout time.Duration `hcl:"-,optional" toml:"-"`
TrieTimeoutRaw string `hcl:"timeout,optional" toml:"timeout,optional"`
Expand Down Expand Up @@ -734,17 +738,18 @@ func DefaultConfig() *Config {
},
},
Cache: &CacheConfig{
Cache: 1024, // geth's default (suitable for mumbai)
PercDatabase: 50,
PercTrie: 15,
PercGc: 25,
PercSnapshot: 10,
NoPrefetch: false,
Preimages: false,
TxLookupLimit: 2350000,
TriesInMemory: 128,
TrieTimeout: 60 * time.Minute,
FDLimit: 0,
Cache: 1024, // geth's default (suitable for mumbai)
PercDatabase: 50,
PercTrie: 15,
PercGc: 25,
PercSnapshot: 10,
NoPrefetch: false,
Preimages: false,
TxLookupLimit: 2350000,
TriesInMemory: 128,
FilterLogCacheSize: ethconfig.Defaults.FilterLogCacheSize,
TrieTimeout: 60 * time.Minute,
FDLimit: 0,
},
ExtraDB: &ExtraDBConfig{
// These are LevelDB defaults, specifying here for clarity in code and in logging.
Expand Down Expand Up @@ -1108,6 +1113,7 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (*
n.TxLookupLimit = c.Cache.TxLookupLimit
n.TrieTimeout = c.Cache.TrieTimeout
n.TriesInMemory = c.Cache.TriesInMemory
n.FilterLogCacheSize = c.Cache.FilterLogCacheSize
}

// LevelDB
Expand Down
7 changes: 7 additions & 0 deletions internal/cli/server/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,13 @@ func (c *Command) Flags(config *Config) *flagset.Flagset {
Default: c.cliConfig.Cache.TriesInMemory,
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{
Name: "txlookuplimit",
Usage: "Number of recent blocks to maintain transactions index for",
Expand Down
1 change: 1 addition & 0 deletions packaging/templates/mainnet-v1/archive/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ gcmode = "archive"
# noprefetch = false
# preimages = false
# txlookuplimit = 2350000
# blocklogs = 32
# timeout = "1h0m0s"
# fdlimit = 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ syncmode = "full"
# noprefetch = false
# preimages = false
# txlookuplimit = 2350000
# blocklogs = 32
# timeout = "1h0m0s"
# fdlimit = 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ syncmode = "full"
# noprefetch = false
# preimages = false
# txlookuplimit = 2350000
# blocklogs = 32
# timeout = "1h0m0s"
# fdlimit = 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ syncmode = "full"
# noprefetch = false
# preimages = false
# txlookuplimit = 2350000
# blocklogs = 32
# timeout = "1h0m0s"
# fdlimit = 0

Expand Down
1 change: 1 addition & 0 deletions packaging/templates/testnet-v4/archive/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ gcmode = "archive"
# noprefetch = false
# preimages = false
# txlookuplimit = 2350000
# blocklogs = 32
# timeout = "1h0m0s"
# fdlimit = 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ syncmode = "full"
# noprefetch = false
# preimages = false
# txlookuplimit = 2350000
# blocklogs = 32
# timeout = "1h0m0s"
# fdlimit = 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ syncmode = "full"
# noprefetch = false
# preimages = false
# txlookuplimit = 2350000
# blocklogs = 32
# timeout = "1h0m0s"
# fdlimit = 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ syncmode = "full"
# noprefetch = false
# preimages = false
# txlookuplimit = 2350000
# blocklogs = 32
# timeout = "1h0m0s"
# fdlimit = 0

Expand Down

0 comments on commit 923c192

Please sign in to comment.