Skip to content

Commit 018ea3c

Browse files
committed
refactor: use benchConfig for TestStatePressure spamoor parameters
1 parent ca73b30 commit 018ea3c

1 file changed

Lines changed: 8 additions & 14 deletions

File tree

test/e2e/benchmark/spamoor_state_pressure_test.go

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,22 @@ import (
2121
// Primary metrics: MGas/s.
2222
// Diagnostic metrics: Engine.NewPayload latency, ev-node overhead %.
2323
func (s *SpamoorSuite) TestStatePressure() {
24-
const (
25-
numSpammers = 4
26-
countPerSpammer = 5000
27-
totalCount = numSpammers * countPerSpammer
28-
waitTimeout = 10 * time.Minute
29-
)
30-
3124
cfg := newBenchConfig("ev-node-state-pressure")
3225

3326
t := s.T()
3427
ctx := t.Context()
28+
cfg.log(t)
3529
w := newResultWriter(t, "StatePressure")
3630
defer w.flush()
3731

3832
e := s.setupEnv(cfg)
3933

4034
storageSpamConfig := map[string]any{
41-
"throughput": 20, // 20 tx per 100ms slot = 200 tx/s per spammer, 800 tx/s total
42-
"total_count": countPerSpammer,
43-
"gas_units_to_burn": 2000000, // 2M gas per tx via SSTORE. 100M / 2M = 50 txs to fill block
35+
"throughput": cfg.Throughput,
36+
"total_count": cfg.CountPerSpammer,
37+
"gas_units_to_burn": envInt("BENCH_GAS_UNITS_TO_BURN", 2000000),
4438
"max_pending": 50000,
45-
"max_wallets": 100,
39+
"max_wallets": cfg.MaxWallets,
4640
"base_fee": 20,
4741
"tip_fee": 2,
4842
"refill_amount": "5000000000000000000", // 5 ETH
@@ -53,7 +47,7 @@ func (s *SpamoorSuite) TestStatePressure() {
5347
s.Require().NoError(deleteAllSpammers(e.spamoorAPI), "failed to delete stale spammers")
5448

5549
var spammerIDs []int
56-
for i := range numSpammers {
50+
for i := range cfg.NumSpammers {
5751
name := fmt.Sprintf("bench-storage-%d", i)
5852
id, err := e.spamoorAPI.CreateSpammer(name, spamoor.ScenarioStorageSpam, storageSpamConfig, true)
5953
s.Require().NoError(err, "failed to create spammer %s", name)
@@ -62,7 +56,7 @@ func (s *SpamoorSuite) TestStatePressure() {
6256
}
6357

6458
time.Sleep(3 * time.Second)
65-
assertSpammersRunning(t, e.spamoorAPI, spammerIDs)
59+
requireSpammersRunning(t, e.spamoorAPI, spammerIDs)
6660

6761
// wait for wallet funding to finish before recording start block
6862
pollSentTotal := func() (float64, error) {
@@ -84,7 +78,7 @@ func (s *SpamoorSuite) TestStatePressure() {
8478
t.Logf("start block: %d (after warmup)", startBlock)
8579

8680
// wait for all transactions to be sent
87-
waitForMetricTarget(t, "spamoor_transactions_sent_total", pollSentTotal, float64(totalCount), cfg.WaitTimeout)
81+
waitForMetricTarget(t, "spamoor_transactions_sent_total", pollSentTotal, float64(cfg.totalCount()), cfg.WaitTimeout)
8882

8983
// wait for pending txs to drain
9084
drainCtx, drainCancel := context.WithTimeout(ctx, 30*time.Second)

0 commit comments

Comments
 (0)