Repository navigation
Commit b34bf7f
perf(evmonlyapp): hash a block's transactions before taking the sender lock (#4364)
Backports #4235 from
`giga-1` to `main` (PLT-1303, part of PLT-1297). `takeSenders` keccaks
every raw transaction while holding the `checkedSenders` lock on the
execute loop, and `CheckTx` writes that same cache constantly, so
admission stalls for the length of a block's worth of hashes (~790 µs
for 1,848 txs on the original measurement).
`takeSenders` now computes all hashes first with `hashRawTxs`, which
splits the block across up to `GOMAXPROCS` workers (at least
`minTxsPerHashWorker` = 64 txs each, so small blocks stay on one
goroutine), and the lock covers only the `senderCache.take` lookups.
Main has since replaced the plain map with the two-generation
`senderCache`, so the port keeps that structure and only moves the
hashing out of the lock. Unlike the `giga-1` version, the fan-out uses
`scope.Parallel` instead of a bare `sync.WaitGroup` + `go func`, per the
sei-tendermint conventions.
No consensus or state impact: lookups still run in block index order, so
a duplicate tx in a block still resolves only the first occurrence.
`TestHashRawTxsMatchesKeccak256Hash` pins `hashRawTxs` to
`crypto.Keccak256Hash` across the single-worker and multi-worker paths;
the evmonlyapp package tests pass under `-race`, and `make lint` / `make
fmtcheck` are clean.
Link to Devin session:
https://app.devin.ai/sessions/d808db90106341278344623de10b92c0
Open in Devin Desktop:
https://app.devin.ai/desktop/session/d808db90106341278344623de10b92c0?variant=devin
Requested by: @bdchatham
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>1 parent b57bd8b commit b34bf7f
2 files changed
Lines changed: 57 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
90 | 94 | | |
91 | 95 | | |
92 | 96 | | |
| |||
381 | 385 | | |
382 | 386 | | |
383 | 387 | | |
| 388 | + | |
| 389 | + | |
384 | 390 | | |
385 | | - | |
386 | | - | |
| 391 | + | |
| 392 | + | |
387 | 393 | | |
388 | 394 | | |
389 | 395 | | |
390 | 396 | | |
391 | 397 | | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
392 | 430 | | |
393 | 431 | | |
394 | 432 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
841 | 841 | | |
842 | 842 | | |
843 | 843 | | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
844 | 861 | | |
845 | 862 | | |
846 | 863 | | |
| |||
0 commit comments