Skip to content

Commit f8fa22e

Browse files
authored
feat(benchmarking): adding ERC20 benchmarking test (#3114)
* refactor: move spamoor benchmark into testify suite in test/e2e/benchmark - Create test/e2e/benchmark/ subpackage with SpamoorSuite (testify/suite) - Move spamoor smoke test into suite as TestSpamoorSmoke - Split helpers into focused files: traces.go, output.go, metrics.go - Introduce resultWriter for defer-based benchmark JSON output - Export shared symbols from evm_test_common.go for cross-package use - Restructure CI to fan-out benchmark jobs and fan-in publishing - Run benchmarks on PRs only when benchmark-related files change * fix: correct BENCH_JSON_OUTPUT path for spamoor benchmark go test sets the working directory to the package under test, so the env var should be relative to test/e2e/benchmark/, not test/e2e/. * fix: place package pattern before test binary flags in benchmark CI go test treats all arguments after an unknown flag (--evm-binary) as test binary args, so ./benchmark/ was never recognized as a package pattern. * fix: adjust evm-binary path for benchmark subpackage working directory go test sets the cwd to the package directory (test/e2e/benchmark/), so the binary path needs an extra parent traversal. * wip: erc20 benchmark test * fix: exclude benchmark subpackage from make test-e2e The benchmark package doesn't define the --binary flag that test-e2e passes. It has its own CI workflow so it doesn't need to run here. * fix: replace FilterLogs with header iteration and optimize spamoor config collectBlockMetrics hit reth's 20K FilterLogs limit at high tx volumes. Replace with direct header iteration over [startBlock, endBlock] and add Phase 1 metrics: non-empty ratio, block interval p50/p99, gas/block and tx/block p50/p99. Optimize spamoor configuration for 100ms block time: - --slot-duration 100ms, --startup-delay 0 on daemon - throughput=50 per 100ms slot (500 tx/s per spammer) - max_pending=50000 to avoid 3s block poll backpressure - 5 staggered spammers with 50K txs each Results: 55 MGas/s, 1414 TPS, 19.8% non-empty blocks (up from 6%). * fix: improve benchmark measurement window and reliability - Move startBlock capture after spammer creation to exclude warm-up - Replace 20s drain sleep with smart poll (waitForDrain) - Add deleteAllSpammers cleanup to handle stale spamoor DB entries - Lower trace sample rate to 10% to prevent Jaeger OOM * fix: address PR review feedback for benchmark suite - make reth tag configurable via EV_RETH_TAG env var (default pr-140) - fix OTLP config: remove duplicate env vars, use http/protobuf protocol - use require.Eventually for host readiness polling - rename requireHTTP to requireHostUp - use non-fatal logging in resultWriter.flush deferred context - fix stale doc comment (setupCommonEVMEnv -> SetupCommonEVMEnv) - rename loop variable to avoid shadowing testing.TB convention - add block/internal/executing/** to CI path trigger - remove unused require import from output.go * chore: specify http * chore: filter out benchmark tests from test-e2e * refactor: centralize reth config and lower ERC20 spammer count move EV_RETH_TAG resolution and rpc connection limits into setupEnv so all benchmark tests share the same reth configuration. lower ERC20 spammer count from 5 to 2 to reduce resource contention on local hardware while keeping the loop for easy scaling on dedicated infra. * chore: collect all traces at once * chore: self review * refactor: extract benchmark helpers to slim down ERC20 test body - add blockMetricsSummary with summarize(), log(), and entries() methods - add evNodeOverhead() for computing ProduceBlock vs ExecuteTxs overhead - add collectTraces() suite method to deduplicate trace collection pattern - add addEntries() convenience method on resultWriter - slim TestERC20Throughput from ~217 to ~119 lines - reuse collectTraces in TestSpamoorSmoke * docs: add detailed documentation to benchmark helper methods * ci: add ERC20 throughput benchmark job * chore: remove span assertions * fix: guard against drain timeout and zero-duration TPS division - waitForDrain returns an error on timeout instead of silently logging - guard AchievedTPS computation when steady-state duration is zero
1 parent 042b75a commit f8fa22e

File tree

9 files changed

+643
-70
lines changed

9 files changed

+643
-70
lines changed

.github/workflows/benchmark.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,29 @@ jobs:
7777
name: spamoor-benchmark-results
7878
path: test/e2e/benchmark/spamoor_bench.json
7979

80+
# TODO: wire up to publish results once additional tests are in place.
81+
erc20-benchmark:
82+
name: ERC20 Throughput Benchmark
83+
runs-on: ubuntu-latest
84+
timeout-minutes: 20
85+
steps:
86+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
87+
- name: Set up Go
88+
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
89+
with:
90+
go-version-file: ./go.mod
91+
- name: Set up Docker Buildx
92+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
93+
- name: Install just
94+
uses: extractions/setup-just@v3
95+
- name: Build binaries
96+
run: just build-evm build-da
97+
- name: Run ERC20 throughput test
98+
run: |
99+
cd test/e2e && go test -tags evm \
100+
-run='^TestSpamoorSuite$/^TestERC20Throughput$' -v -timeout=15m \
101+
./benchmark/ --evm-binary=../../../build/evm
102+
80103
# single job to push all results to gh-pages sequentially, avoiding race conditions
81104
publish-benchmarks:
82105
name: Publish Benchmark Results

0 commit comments

Comments
 (0)