Commit e6382bc
feat(test-cli): add
* feat(fill-stateful): add --extract-opcode-count opcode tracing
Trace each execution-phase block via debug_traceBlockByHash with a JS
opcode-counting tracer and record per-opcode execution counts in the
fixture's _info.metadata.opcode_count, matching the standard fill
benchmark path.
- DebugRPC.trace_block_by_hash wraps debug_traceBlockByHash.
- ClientBackend gains debug_rpc + extract_opcode_count; a JS tracer
constant; extract_block_opcode_count() aggregating per-tx opcode
counts; reset_opcode_count() now zeroes the per-test tally.
- make_stateful_fixture traces execution-phase blocks only (setup
blocks skipped) and accumulates onto the backend, which the filler
already serializes into _info.metadata.opcode_count.
- fill_stateful plugin: --extract-opcode-count flag, debug_rpc wired
into the backend, per-test reset_opcode_count in the t8n override.
* fix(fill-stateful): harden opcode extraction; decouple from verification
Address review of the --extract-opcode-count feature:
- Decouple metadata from benchmark verification: only accumulate onto
the metadata opcode_count, never set benchmark_opcode_count. The
live-client trace is recorded for analysis; it no longer activates
target-opcode verification (which stays a t8n-path concern and could
otherwise fail benchmark tests on >5% trace divergence).
- Make extract_block_opcode_count non-fatal: a debug_traceBlockByHash
RPC error is logged and skipped instead of aborting the fill.
- Normalize opcode names: geth emits 'opcode 0xNN not defined' for
undefined opcodes, which OpcodeCount could not parse and would raise
on. Reduce such names to the bare 0xNN (UndefinedOpcode); drop any
still-unrecognized name with a warning.
* feat(fill-stateful): verify opcode counts against declared targets
With --extract-opcode-count on, feed the live-client traced count to
benchmark opcode verification: a test declaring fixed/expected_opcode_
count now fails the fill when its live-client count diverges >5% from
the target. Stays None (verification skipped) when the flag is off.
* feat(fill-stateful): opcode counting across clients (normalize names + struct-log fallback)
- Normalize tracer opcode names case-insensitively so clients emitting
non-canonical names (nethermind returns calldatasize / pusH1) are counted
instead of dropped as unrecognized.
- Fall back to the universally-supported struct-log tracer
(disableStack/Memory/Storage, counting structLogs[].op) when a client's JS
tracer is unavailable — erroring or empty — so besu (no JS tracer) is
covered. Cached per client to avoid re-probing the JS tracer every block.
- Update the --extract-opcode-count help text accordingly.
Verified against geth (JS), nethermind (JS + normalize) and besu (struct-log
fallback): all three produce identical opcode counts.
* feat(fill-stateful): record per-payload opcode counts as opcode_counts array
Replace the single aggregated _info.metadata.opcode_count with
_info.metadata.opcode_counts — an array with one entry per
engineNewPayloads block (opcode_counts[i] is the count for
engineNewPayloads[i], or null if its trace was unavailable), so
multi-block benchmarks keep per-payload granularity.
The list is emitted via FillResult.metadata (only when
--extract-opcode-count is on); reset_opcode_count is now a no-op so the
filler no longer writes the singular opcode_count for stateful fixtures.
* refactor: add fixture and reduce comment
* refactor: opcode count trace logic
* refactor: error handling for rpc call
---------
Co-authored-by: LouisTsai <q1030176@gmail.com>--extract-opcode-count opcode tracing (#3124)1 parent 56e615e commit e6382bc
5 files changed
Lines changed: 200 additions & 14 deletions
File tree
- docs/filling_tests
- packages/testing/src/execution_testing
- client_clis
- cli/pytest_commands/plugins/fill_stateful
- rpc
- specs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
| |||
135 | 136 | | |
136 | 137 | | |
137 | 138 | | |
138 | | - | |
| 139 | + | |
139 | 140 | | |
140 | 141 | | |
141 | 142 | | |
| |||
Lines changed: 27 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
135 | 150 | | |
136 | 151 | | |
137 | 152 | | |
| |||
475 | 490 | | |
476 | 491 | | |
477 | 492 | | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
478 | 499 | | |
479 | 500 | | |
480 | 501 | | |
| 502 | + | |
| 503 | + | |
481 | 504 | | |
482 | 505 | | |
483 | 506 | | |
| |||
501 | 524 | | |
502 | 525 | | |
503 | 526 | | |
| 527 | + | |
| 528 | + | |
504 | 529 | | |
505 | 530 | | |
506 | 531 | | |
| |||
719 | 744 | | |
720 | 745 | | |
721 | 746 | | |
722 | | - | |
| 747 | + | |
| 748 | + | |
723 | 749 | | |
724 | 750 | | |
725 | 751 | | |
| |||
Lines changed: 138 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
21 | 29 | | |
22 | 30 | | |
23 | 31 | | |
| 32 | + | |
24 | 33 | | |
25 | 34 | | |
26 | 35 | | |
| |||
35 | 44 | | |
36 | 45 | | |
37 | 46 | | |
| 47 | + | |
38 | 48 | | |
39 | 49 | | |
40 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
41 | 132 | | |
42 | 133 | | |
43 | 134 | | |
| |||
89 | 180 | | |
90 | 181 | | |
91 | 182 | | |
| 183 | + | |
| 184 | + | |
92 | 185 | | |
93 | 186 | | |
94 | 187 | | |
95 | 188 | | |
96 | 189 | | |
97 | 190 | | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
98 | 195 | | |
99 | 196 | | |
100 | 197 | | |
| |||
126 | 223 | | |
127 | 224 | | |
128 | 225 | | |
129 | | - | |
| 226 | + | |
130 | 227 | | |
131 | 228 | | |
132 | 229 | | |
| |||
209 | 306 | | |
210 | 307 | | |
211 | 308 | | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
212 | 348 | | |
213 | 349 | | |
214 | 350 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1301 | 1301 | | |
1302 | 1302 | | |
1303 | 1303 | | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
1304 | 1313 | | |
1305 | 1314 | | |
1306 | 1315 | | |
| |||
Lines changed: 23 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1465 | 1465 | | |
1466 | 1466 | | |
1467 | 1467 | | |
| 1468 | + | |
| 1469 | + | |
1468 | 1470 | | |
1469 | 1471 | | |
1470 | 1472 | | |
| |||
1485 | 1487 | | |
1486 | 1488 | | |
1487 | 1489 | | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
1488 | 1495 | | |
1489 | 1496 | | |
1490 | 1497 | | |
1491 | 1498 | | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
1492 | 1507 | | |
1493 | 1508 | | |
1494 | | - | |
1495 | | - | |
1496 | | - | |
1497 | | - | |
1498 | | - | |
1499 | | - | |
1500 | | - | |
1501 | | - | |
1502 | | - | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
1503 | 1513 | | |
1504 | 1514 | | |
1505 | 1515 | | |
| |||
1525 | 1535 | | |
1526 | 1536 | | |
1527 | 1537 | | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
1528 | 1541 | | |
1529 | 1542 | | |
1530 | 1543 | | |
1531 | 1544 | | |
1532 | 1545 | | |
| 1546 | + | |
1533 | 1547 | | |
1534 | 1548 | | |
1535 | 1549 | | |
| |||
0 commit comments