Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions test/e2e/benchmark/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ type benchConfig struct {
WarmupTxs int
GasUnitsToBurn int
MaxWallets int
MaxPending int
Rebroadcast int
BaseFee int
TipFee int
WaitTimeout time.Duration
}

Expand All @@ -43,6 +47,10 @@ func newBenchConfig(serviceName string) benchConfig {
WarmupTxs: envInt("BENCH_WARMUP_TXS", 200),
GasUnitsToBurn: envInt("BENCH_GAS_UNITS_TO_BURN", 1_000_000),
MaxWallets: envInt("BENCH_MAX_WALLETS", 500),
MaxPending: envInt("BENCH_MAX_PENDING", 50_000),
Rebroadcast: envInt("BENCH_REBROADCAST", 0),
BaseFee: envInt("BENCH_BASE_FEE", 20),
TipFee: envInt("BENCH_TIP_FEE", 2),
WaitTimeout: envDuration("BENCH_WAIT_TIMEOUT", 10*time.Minute),
}
}
Expand Down
29 changes: 22 additions & 7 deletions test/e2e/benchmark/gasburner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ func (s *SpamoorSuite) TestGasBurner() {

cfg.log(t)

var result *benchmarkResult
var wallClock time.Duration
var spamoorStats *runSpamoorStats
defer func() {
if result != nil {
emitRunResult(t, cfg, result, wallClock, spamoorStats)
}
}()

e := s.setupEnv(cfg)
api := e.spamoorAPI

Expand All @@ -32,11 +41,11 @@ func (s *SpamoorSuite) TestGasBurner() {
"gas_units_to_burn": cfg.GasUnitsToBurn,
"total_count": cfg.CountPerSpammer,
"throughput": cfg.Throughput,
"max_pending": 50000,
"max_pending": cfg.MaxPending,
"max_wallets": cfg.MaxWallets,
"rebroadcast": 5,
"base_fee": 100,
"tip_fee": 50,
"rebroadcast": cfg.Rebroadcast,
"base_fee": cfg.BaseFee,
"tip_fee": cfg.TipFee,
"refill_amount": "500000000000000000000",
"refill_balance": "200000000000000000000",
"refill_interval": 300,
Expand Down Expand Up @@ -83,7 +92,7 @@ func (s *SpamoorSuite) TestGasBurner() {
if err := waitForDrain(drainCtx, t.Logf, e.ethClient, 10); err != nil {
t.Logf("warning: %v", err)
}
wallClock := time.Since(loadStart)
wallClock = time.Since(loadStart)

endHeader, err := e.ethClient.HeaderByNumber(ctx, nil)
s.Require().NoError(err, "failed to get end block header")
Expand All @@ -94,10 +103,16 @@ func (s *SpamoorSuite) TestGasBurner() {
bm, err := collectBlockMetrics(ctx, e.ethClient, startBlock, endBlock)
s.Require().NoError(err, "failed to collect block metrics")

traces := s.collectTraces(e, cfg.ServiceName)
traces := s.collectTraces(e)

result := newBenchmarkResult("GasBurner", bm, traces)
result = newBenchmarkResult("GasBurner", bm, traces)
s.Require().Greater(result.summary.SteadyState, time.Duration(0), "expected non-zero steady-state duration")
result.log(t, wallClock)
w.addEntries(result.entries())

metrics, mErr := api.GetMetrics()
s.Require().NoError(mErr, "failed to get final metrics")
sent := sumCounter(metrics["spamoor_transactions_sent_total"])
failed := sumCounter(metrics["spamoor_transactions_failed_total"])
spamoorStats = &runSpamoorStats{Sent: sent, Failed: failed}
}
44 changes: 22 additions & 22 deletions test/e2e/benchmark/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,23 +382,16 @@ func (s *blockMetricsSummary) entries(prefix string) []entry {
}
}

// evNodeOverhead computes the fraction of block production time spent outside
// EVM execution. It looks up the average durations of BlockExecutor.ProduceBlock
// (the outer span covering the full block lifecycle) and Executor.ExecuteTxs
// (the inner span covering only EVM tx execution), then returns:
// overheadFromStats computes ev-node overhead from pre-aggregated span stats.
//
// overhead% = (avgProduce - avgExecute) / avgProduce * 100
//
// This captures time spent on sequencing, DA submission, header construction,
// and other ev-node orchestration work. Returns false if either span is missing.
func evNodeOverhead(spans []e2e.TraceSpan) (float64, bool) {
stats := e2e.AggregateSpanStats(spans)
func overheadFromStats(stats map[string]*e2e.SpanStats) (float64, bool) {
produce, ok := stats[spanProduceBlock]
if !ok {
if !ok || produce.Count == 0 {
return 0, false
}
execute, ok := stats[spanExecuteTxs]
if !ok {
if !ok || execute.Count == 0 {
return 0, false
}
produceAvg := float64(produce.Total.Microseconds()) / float64(produce.Count)
Expand All @@ -409,20 +402,25 @@ func evNodeOverhead(spans []e2e.TraceSpan) (float64, bool) {
return (produceAvg - executeAvg) / produceAvg * 100, true
}

// rethExecutionRate computes ev-reth's effective execution throughput in GGas/s
// based on the total gas processed and the cumulative Engine.NewPayload duration.
// NewPayload is the engine API call where reth validates and executes all state
// transitions for a block (EVM execution + state root + disk commit).
func rethExecutionRate(spans []e2e.TraceSpan, totalGasUsed uint64) (float64, bool) {
stats := e2e.AggregateSpanStats(spans)
// evNodeOverhead aggregates spans then computes overhead.
func evNodeOverhead(spans []e2e.TraceSpan) (float64, bool) {
return overheadFromStats(e2e.AggregateSpanStats(spans))
}

// rethRateFromStats computes ev-reth GGas/s from pre-aggregated span stats.
func rethRateFromStats(stats map[string]*e2e.SpanStats, totalGasUsed uint64) (float64, bool) {
np, ok := stats[spanNewPayload]
if !ok || np.Total <= 0 || totalGasUsed == 0 {
return 0, false
}
// GGas/s = totalGas / newPayloadSeconds / 1e9
return float64(totalGasUsed) / np.Total.Seconds() / 1e9, true
}

// rethExecutionRate aggregates spans then computes GGas/s.
func rethExecutionRate(spans []e2e.TraceSpan, totalGasUsed uint64) (float64, bool) {
return rethRateFromStats(e2e.AggregateSpanStats(spans), totalGasUsed)
}

// engineSpanEntries extracts ProduceBlock, Engine.GetPayload, and
// Engine.NewPayload timing stats from ev-node spans and returns them as
// result writer entries. these are the key metrics for answering "does block
Expand All @@ -443,11 +441,13 @@ func engineSpanEntries(prefix string, spans []e2e.TraceSpan) []entry {
if !ok || s.Count == 0 {
continue
}
avg := s.Total / time.Duration(s.Count)
avg := float64(s.Total.Microseconds()) / float64(s.Count) / 1000.0
min := float64(s.Min.Microseconds()) / 1000.0
max := float64(s.Max.Microseconds()) / 1000.0
entries = append(entries,
entry{Name: prefix + " - " + k.label + " avg", Unit: "ms", Value: float64(avg.Milliseconds())},
entry{Name: prefix + " - " + k.label + " min", Unit: "ms", Value: float64(s.Min.Milliseconds())},
entry{Name: prefix + " - " + k.label + " max", Unit: "ms", Value: float64(s.Max.Milliseconds())},
entry{Name: prefix + " - " + k.label + " avg", Unit: "ms", Value: avg},
entry{Name: prefix + " - " + k.label + " min", Unit: "ms", Value: min},
entry{Name: prefix + " - " + k.label + " max", Unit: "ms", Value: max},
)
}
return entries
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/benchmark/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ type traceResult struct {
// empty when the trace provider doesn't support rich span collection.
evNodeRich []richSpan
evRethRich []richSpan

// resource attributes extracted from trace spans (OTEL_RESOURCE_ATTRIBUTES).
evNodeAttrs *resourceAttrs
evRethAttrs *resourceAttrs
}

// displayFlowcharts renders ASCII flowcharts from rich spans. Falls back to
Expand Down
Loading
Loading