-
Notifications
You must be signed in to change notification settings - Fork 871
Add receipt / log reads to cryptosim #3081
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
086caeb
1386543
8ecfba5
6fc55ba
8938c6d
a7d0c54
dc531f4
8674330
e70db1f
9f34024
c8d278a
3e89a72
c12d9ca
61cd8da
d10374e
2cc5efa
e13b1e2
6752582
a2eca9f
2f2e4f9
966935f
13912da
d329019
c600f8a
33e5ba6
200043b
fe39260
7169755
a20def5
4ebeaa7
00f5e88
a3ca540
f3d006d
09a0391
4e13419
d236aac
8d3d34b
da3b85a
e30ae96
184541a
8feda4c
9eaffb3
9e9c00d
dd7b029
7b8ccba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,15 @@ | ||
| { | ||
| "Comment": "For testing with the state store and reciept store both enabled.", | ||
| "Comment": "For testing with the state store and receipt store both enabled, with concurrent reads, pruning, and cache.", | ||
| "DataDir": "data", | ||
| "LogDir": "logs", | ||
| "LogLevel": "info", | ||
| "MinimumNumberOfColdAccounts": 1000000, | ||
| "MinimumNumberOfDormantAccounts": 1000000, | ||
| "GenerateReceipts": true | ||
| "GenerateReceipts": true, | ||
| "ReceiptReadConcurrency": 4, | ||
| "ReceiptReadsPerSecond": 1000, | ||
| "ReceiptColdReadRatio": 0.1, | ||
| "LogFilterReadConcurrency": 4, | ||
| "LogFilterReadsPerSecond": 200, | ||
| "LogFilterColdReadRatio": 0.1 | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,6 +158,41 @@ type CryptoSimConfig struct { | |
| // If greater than 0, the benchmark will throttle the transaction rate to this value, in hertz. | ||
| MaxTPS float64 | ||
|
|
||
| // Number of concurrent reader goroutines issuing receipt lookups. 0 disables reads. | ||
| ReceiptReadConcurrency int | ||
|
|
||
| // Target total receipt reads per second across all reader goroutines. | ||
| // Reads are distributed evenly across readers. | ||
| ReceiptReadsPerSecond int | ||
|
|
||
| // Fraction of single-receipt reads that intentionally target blocks older | ||
| // than the in-memory receipt-cache window (0.0-1.0). | ||
| // These reads should mostly miss cache and fall through to DuckDB. | ||
| ReceiptColdReadRatio float64 | ||
|
|
||
| // Deprecated: ignored when LogFilterReadConcurrency > 0. Previously controlled | ||
| // the fraction of shared reads that were log filters vs receipt lookups. | ||
| ReceiptLogFilterRatio float64 | ||
|
|
||
| // Number of concurrent goroutines issuing log filter (eth_getLogs) queries. 0 disables log filter reads. | ||
| // These goroutines are independent from the receipt reader goroutines. | ||
| LogFilterReadConcurrency int | ||
|
|
||
| // Target total log filter reads per second across all log filter goroutines. | ||
| LogFilterReadsPerSecond int | ||
|
Comment on lines
+181
to
+182
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although I know from context that these new settings are specific to receipt store benchmarking, based on the names of the settings in isolation this fact isn't immediately obvious. I suggest one or more of the following strategies:
|
||
|
|
||
| // Fraction of log filter reads that intentionally target blocks older than | ||
| // the in-memory cache window (0.0-1.0). These cold reads miss the cache | ||
| // and fall through to DuckDB on closed parquet files. The remaining | ||
| // (1 - LogFilterColdReadRatio) reads target recent blocks likely in cache. | ||
| // Default 0.1 yields ~90% cache hit ratio. | ||
| LogFilterColdReadRatio float64 | ||
|
|
||
| // Exponent controlling the recency bias within the chosen hot/cold read range. | ||
| // 1.0 = uniform within that range; higher values skew reads toward the newest | ||
| // blocks in the selected bucket. | ||
| ReceiptReadRecencyExponent float64 | ||
|
|
||
| // Number of recent blocks to keep before pruning parquet files. 0 disables pruning. | ||
| ReceiptKeepRecent int64 | ||
|
|
||
|
|
@@ -215,6 +250,14 @@ func DefaultCryptoSimConfig() *CryptoSimConfig { | |
| RecieptChannelCapacity: 32, | ||
| DisableTransactionExecution: false, | ||
| MaxTPS: 0, | ||
| ReceiptReadConcurrency: 0, | ||
| ReceiptReadsPerSecond: 100, | ||
| ReceiptColdReadRatio: 0.1, | ||
| ReceiptLogFilterRatio: 0, | ||
| LogFilterReadConcurrency: 0, | ||
| LogFilterReadsPerSecond: 100, | ||
| LogFilterColdReadRatio: 0.1, | ||
| ReceiptReadRecencyExponent: 3.0, | ||
| ReceiptKeepRecent: 100_000, | ||
| ReceiptPruneIntervalSeconds: 600, | ||
| LogLevel: "info", | ||
|
|
@@ -302,12 +345,29 @@ func (c *CryptoSimConfig) Validate() error { | |
| if c.MaxTPS < 0 { | ||
| return fmt.Errorf("MaxTPS must be non-negative (got %f)", c.MaxTPS) | ||
| } | ||
| if c.ReceiptColdReadRatio < 0 || c.ReceiptColdReadRatio > 1 { | ||
| return fmt.Errorf("ReceiptColdReadRatio must be in [0, 1] (got %f)", c.ReceiptColdReadRatio) | ||
| } | ||
| if c.ReceiptLogFilterRatio < 0 || c.ReceiptLogFilterRatio > 1 { | ||
| return fmt.Errorf("ReceiptLogFilterRatio must be in [0, 1] (got %f)", c.ReceiptLogFilterRatio) | ||
| } | ||
| if c.LogFilterReadConcurrency < 0 { | ||
| return fmt.Errorf("LogFilterReadConcurrency must be non-negative (got %d)", c.LogFilterReadConcurrency) | ||
| } | ||
| if c.LogFilterColdReadRatio < 0 || c.LogFilterColdReadRatio > 1 { | ||
| return fmt.Errorf("LogFilterColdReadRatio must be in [0, 1] (got %f)", c.LogFilterColdReadRatio) | ||
| } | ||
| if c.ReceiptReadConcurrency < 0 { | ||
| return fmt.Errorf("ReceiptReadConcurrency must be non-negative (got %d)", c.ReceiptReadConcurrency) | ||
| } | ||
| if c.ReceiptReadRecencyExponent < 1 { | ||
| return fmt.Errorf("ReceiptReadRecencyExponent must be >= 1.0 (got %f)", c.ReceiptReadRecencyExponent) | ||
| } | ||
| switch strings.ToLower(c.LogLevel) { | ||
| case "debug", "info", "warn", "error": | ||
| default: | ||
| return fmt.Errorf("LogLevel must be one of debug, info, warn, error (got %q)", c.LogLevel) | ||
| } | ||
|
|
||
| return nil | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this field is deprecated, why add it to the config?