@@ -21,27 +21,23 @@ import (
2121// Primary metrics: MGas/s, TPS.
2222// Diagnostic metrics: per-span latency breakdown, ev-node overhead %.
2323func (s * SpamoorSuite ) TestDeFiSimulation () {
24- const (
25- numSpammers = 4
26- countPerSpammer = 10000
27- totalCount = numSpammers * countPerSpammer
28- waitTimeout = 10 * time .Minute
29- )
30-
3124 cfg := newBenchConfig ("ev-node-defi" )
3225
3326 t := s .T ()
3427 ctx := t .Context ()
28+ cfg .log (t )
3529 w := newResultWriter (t , "DeFiSimulation" )
3630 defer w .flush ()
3731
3832 e := s .setupEnv (cfg )
3933
4034 uniswapConfig := map [string ]any {
41- "throughput" : 30 , // 30 tx per 100ms slot = 300 tx/s per spammer, 1200 tx/s total
42- "total_count" : countPerSpammer ,
35+ "throughput" : cfg . Throughput ,
36+ "total_count" : cfg . CountPerSpammer ,
4337 "max_pending" : 50000 ,
44- "max_wallets" : 200 ,
38+ "max_wallets" : cfg .MaxWallets ,
39+ "pair_count" : envInt ("BENCH_PAIR_COUNT" , 1 ),
40+ "rebroadcast" : envInt ("BENCH_REBROADCAST" , 0 ),
4541 "base_fee" : 20 ,
4642 "tip_fee" : 2 ,
4743 "refill_amount" : "10000000000000000000" , // 10 ETH (swaps need ETH for WETH wrapping and router approvals)
@@ -55,7 +51,7 @@ func (s *SpamoorSuite) TestDeFiSimulation() {
5551 // (Uniswap contract deploys + liquidity provision + wallet funding)
5652 // is excluded from the measurement window.
5753 var spammerIDs []int
58- for i := range numSpammers {
54+ for i := range cfg . NumSpammers {
5955 name := fmt .Sprintf ("bench-defi-%d" , i )
6056 id , err := e .spamoorAPI .CreateSpammer (name , spamoor .ScenarioUniswapSwaps , uniswapConfig , true )
6157 s .Require ().NoError (err , "failed to create spammer %s" , name )
@@ -66,7 +62,7 @@ func (s *SpamoorSuite) TestDeFiSimulation() {
6662 // give spammers time to deploy contracts and provision liquidity,
6763 // then verify none failed during warmup.
6864 time .Sleep (5 * time .Second )
69- assertSpammersRunning (t , e .spamoorAPI , spammerIDs )
65+ requireSpammersRunning (t , e .spamoorAPI , spammerIDs )
7066
7167 // wait for warmup transactions (contract deploys, liquidity adds) to land
7268 // before recording start block.
@@ -89,7 +85,7 @@ func (s *SpamoorSuite) TestDeFiSimulation() {
8985 t .Logf ("start block: %d (after warmup)" , startBlock )
9086
9187 // wait for all transactions to be sent
92- waitForMetricTarget (t , "spamoor_transactions_sent_total" , pollSentTotal , float64 (totalCount ), cfg .WaitTimeout )
88+ waitForMetricTarget (t , "spamoor_transactions_sent_total" , pollSentTotal , float64 (cfg . totalCount () ), cfg .WaitTimeout )
9389
9490 // wait for pending txs to drain
9591 drainCtx , drainCancel := context .WithTimeout (ctx , 30 * time .Second )
0 commit comments