Skip to content

[WIP] EVM RPC read benchmark script for state store load testing#3004

Open
Kbhat1 wants to merge 6 commits intomainfrom
kartik/ss-read-benchmark
Open

[WIP] EVM RPC read benchmark script for state store load testing#3004
Kbhat1 wants to merge 6 commits intomainfrom
kartik/ss-read-benchmark

Conversation

@Kbhat1
Copy link
Contributor

@Kbhat1 Kbhat1 commented Mar 3, 2026

Describe your changes and provide context

Testing performed to validate your change

Hammers a node endpoint with debug_traceBlockByNumber,
debug_traceTransaction, eth_getBalance, eth_getStorageAt, eth_getCode,
and eth_getTransactionCount across 5 phases (sequential, concurrent,
per-method, mixed workload). Reports p50/p95/p99 latencies and rps.

Made-with: Cursor
@github-actions
Copy link

github-actions bot commented Mar 3, 2026

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMar 9, 2026, 4:29 PM

@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

❌ Patch coverage is 0% with 335 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.05%. Comparing base (1c2910c) to head (8aa3054).
⚠️ Report is 41 commits behind head on main.

Files with missing lines Patch % Lines
sei-db/tools/rpc_bench/main.go 0.00% 335 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3004      +/-   ##
==========================================
- Coverage   58.17%   58.05%   -0.12%     
==========================================
  Files        2113     2114       +1     
  Lines      173688   174023     +335     
==========================================
  Hits       101037   101037              
- Misses      63622    63957     +335     
  Partials     9029     9029              
Flag Coverage Δ
sei-chain-pr 0.00% <0.00%> (?)
sei-db 70.41% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sei-db/tools/rpc_bench/main.go 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +222 to +224
for _, s := range stats {
s.Duration = elapsed
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
if len(s.Latencies) == 0 {
return 0
}
idx := int(float64(len(s.Latencies)) * pct)

Check notice

Code scanning / CodeQL

Floating point arithmetic Note

Floating point arithmetic operations are not associative and a possible source of non-determinism
}
return s.Latencies[idx]
}
rps := float64(s.Total) / s.Duration.Seconds()

Check notice

Code scanning / CodeQL

Floating point arithmetic Note

Floating point arithmetic operations are not associative and a possible source of non-determinism
Comment on lines +205 to +211
go func() {
defer wg.Done()
for idx := range work {
method, lat, err := workFn(idx)
record(method, lat, err)
}
}()

Check notice

Code scanning / CodeQL

Spawning a Go routine Note

Spawning a Go routine may be a possible source of non-determinism
totalDuration = stats[k].Duration
}
}
rps := float64(totalReqs) / totalDuration.Seconds()

Check notice

Code scanning / CodeQL

Floating point arithmetic Note

Floating point arithmetic operations are not associative and a possible source of non-determinism
Kbhat1 added 2 commits March 3, 2026 08:52
Each RPC method is defined once in a single registry slice. Phases
derive from heavy/light classification. Adding a new method is one
line. Use -methods flag to run a subset.

Made-with: Cursor
Traces a configurable number of txs (-trace-discover, default 5) during
discovery to extract real (address, slot) pairs. eth_getStorageAt now
queries actual populated slots instead of random ones. Falls back to
random slots when discovery is disabled or finds nothing.

Made-with: Cursor
Comment on lines +179 to +181
for addr := range addrSet {
info.Addresses = append(info.Addresses, addr)
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
Comment on lines +441 to +443
for k, v := range s {
lightStats[k] = v
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
Comment on lines +161 to +169
for addr, acct := range prestate {
for slot := range acct.Storage {
key := addr + "|" + slot
if !seen[key] {
seen[key] = true
slots = append(slots, storageSlot{Address: addr, Slot: slot})
}
}
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
Comment on lines +162 to +168
for slot := range acct.Storage {
key := addr + "|" + slot
if !seen[key] {
seen[key] = true
slots = append(slots, storageSlot{Address: addr, Slot: slot})
}
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
if err != nil {
return nil, elapsed, err
}
defer resp.Body.Close()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: fix lint

{"eth_getTransactionCount", func() []interface{} { return []interface{}{randAddr(), latestHex} }, 15, false},
{"eth_getCode", func() []interface{} { return []interface{}{randAddr(), latestHex} }, 15, false},
{"eth_getStorageAt", func() []interface{} { return randStorageParams() }, 25, false},
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add eth_getLogs? I feel only debug_traceBlockByNumber and debug_traceTransaction and eth_getLogs are really useful, others are optional

Kbhat1 added 2 commits March 4, 2026 08:05
Phase 1 now traces every discovered block once and prints a table:
  BLOCK         TXS     LATENCY
  196571121     97      2.5s
  196571111     1       120ms

Made-with: Cursor
}
avgGasPerTx := 0.0
if len(info.Transactions) > 0 {
avgGasPerTx = float64(info.GasUsed) / float64(len(info.Transactions))

Check notice

Code scanning / CodeQL

Floating point arithmetic Note

Floating point arithmetic operations are not associative and a possible source of non-determinism
}
avgGasPerTx := 0.0
if len(b.Transactions) > 0 {
avgGasPerTx = float64(b.GasUsed) / float64(len(b.Transactions))

Check notice

Code scanning / CodeQL

Floating point arithmetic Note

Floating point arithmetic operations are not associative and a possible source of non-determinism
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants