|
| 1 | +//go:build evm |
| 2 | + |
| 3 | +package benchmark |
| 4 | + |
| 5 | +import ( |
| 6 | + "os" |
| 7 | + "time" |
| 8 | + |
| 9 | + "github.com/celestiaorg/tastora/framework/docker/evstack/spamoor" |
| 10 | + e2e "github.com/evstack/ev-node/test/e2e" |
| 11 | +) |
| 12 | + |
| 13 | +// TestSpamoorSmoke spins up reth + sequencer and a Spamoor node, starts a few |
| 14 | +// basic spammers, waits briefly, then validates trace spans and prints a concise |
| 15 | +// metrics summary. |
| 16 | +func (s *SpamoorSuite) TestSpamoorSmoke() { |
| 17 | + t := s.T() |
| 18 | + w := newResultWriter(t, "SpamoorSmoke") |
| 19 | + defer w.flush() |
| 20 | + |
| 21 | + // TODO: temporary hardcoded tag, will be replaced with a proper release tag |
| 22 | + rethTag := os.Getenv("EV_RETH_TAG") |
| 23 | + if rethTag == "" { |
| 24 | + rethTag = "pr-140" |
| 25 | + } |
| 26 | + e := s.setupEnv(config{ |
| 27 | + rethTag: rethTag, |
| 28 | + serviceName: "ev-node-smoke", |
| 29 | + }) |
| 30 | + api := e.spamoorAPI |
| 31 | + |
| 32 | + eoatx := map[string]any{ |
| 33 | + "throughput": 100, |
| 34 | + "total_count": 3000, |
| 35 | + "max_pending": 4000, |
| 36 | + "max_wallets": 300, |
| 37 | + "amount": 100, |
| 38 | + "random_amount": true, |
| 39 | + "random_target": true, |
| 40 | + "base_fee": 20, |
| 41 | + "tip_fee": 2, |
| 42 | + "refill_amount": "1000000000000000000", |
| 43 | + "refill_balance": "500000000000000000", |
| 44 | + "refill_interval": 600, |
| 45 | + } |
| 46 | + |
| 47 | + gasburner := map[string]any{ |
| 48 | + "throughput": 25, |
| 49 | + "total_count": 2000, |
| 50 | + "max_pending": 8000, |
| 51 | + "max_wallets": 500, |
| 52 | + "gas_units_to_burn": 3000000, |
| 53 | + "base_fee": 20, |
| 54 | + "tip_fee": 5, |
| 55 | + "rebroadcast": 5, |
| 56 | + "refill_amount": "5000000000000000000", |
| 57 | + "refill_balance": "2000000000000000000", |
| 58 | + "refill_interval": 300, |
| 59 | + } |
| 60 | + |
| 61 | + var ids []int |
| 62 | + id, err := api.CreateSpammer("smoke-eoatx", spamoor.ScenarioEOATX, eoatx, true) |
| 63 | + s.Require().NoError(err, "failed to create eoatx spammer") |
| 64 | + ids = append(ids, id) |
| 65 | + id, err = api.CreateSpammer("smoke-gasburner", spamoor.ScenarioGasBurnerTX, gasburner, true) |
| 66 | + s.Require().NoError(err, "failed to create gasburner spammer") |
| 67 | + ids = append(ids, id) |
| 68 | + |
| 69 | + for _, id := range ids { |
| 70 | + idToDelete := id |
| 71 | + t.Cleanup(func() { _ = api.DeleteSpammer(idToDelete) }) |
| 72 | + } |
| 73 | + |
| 74 | + // allow spamoor enough time to generate transaction throughput |
| 75 | + // so that the expected tracing spans appear in Jaeger. |
| 76 | + time.Sleep(60 * time.Second) |
| 77 | + |
| 78 | + // fetch parsed metrics and print a concise summary. |
| 79 | + metrics, err := api.GetMetrics() |
| 80 | + s.Require().NoError(err, "failed to get metrics") |
| 81 | + sent := sumCounter(metrics["spamoor_transactions_sent_total"]) |
| 82 | + fail := sumCounter(metrics["spamoor_transactions_failed_total"]) |
| 83 | + |
| 84 | + // collect traces |
| 85 | + evNodeSpans := s.collectServiceTraces(e, "ev-node-smoke") |
| 86 | + evRethSpans := s.collectServiceTraces(e, "ev-reth") |
| 87 | + e2e.PrintTraceReport(t, "ev-node-smoke", evNodeSpans) |
| 88 | + e2e.PrintTraceReport(t, "ev-reth", evRethSpans) |
| 89 | + |
| 90 | + w.addSpans(append(evNodeSpans, evRethSpans...)) |
| 91 | + |
| 92 | + // assert expected ev-node span names |
| 93 | + assertSpanNames(t, evNodeSpans, []string{ |
| 94 | + "BlockExecutor.ProduceBlock", |
| 95 | + "BlockExecutor.ApplyBlock", |
| 96 | + "BlockExecutor.CreateBlock", |
| 97 | + "BlockExecutor.RetrieveBatch", |
| 98 | + "Executor.ExecuteTxs", |
| 99 | + "Executor.SetFinal", |
| 100 | + "Engine.ForkchoiceUpdated", |
| 101 | + "Engine.NewPayload", |
| 102 | + "Engine.GetPayload", |
| 103 | + "Eth.GetBlockByNumber", |
| 104 | + "Sequencer.GetNextBatch", |
| 105 | + "DASubmitter.SubmitHeaders", |
| 106 | + "DASubmitter.SubmitData", |
| 107 | + "DA.Submit", |
| 108 | + }, "ev-node-smoke") |
| 109 | + |
| 110 | + // assert expected ev-reth span names |
| 111 | + assertSpanNames(t, evRethSpans, []string{ |
| 112 | + "build_payload", |
| 113 | + "execute_tx", |
| 114 | + "try_build", |
| 115 | + "validate_transaction", |
| 116 | + }, "ev-reth") |
| 117 | + |
| 118 | + s.Require().Greater(sent, float64(0), "at least one transaction should have been sent") |
| 119 | + s.Require().Zero(fail, "no transactions should have failed") |
| 120 | +} |
0 commit comments