Skip to content

evmrpc: drop dead isPanicOrSynthetic param from EncodeTmBlock (CON-296)#3451

Open
wen-coding wants to merge 1 commit into
mainfrom
wen/drop_dead_panic_param_in_encode_tm_block
Open

evmrpc: drop dead isPanicOrSynthetic param from EncodeTmBlock (CON-296)#3451
wen-coding wants to merge 1 commit into
mainfrom
wen/drop_dead_panic_param_in_encode_tm_block

Conversation

@wen-coding
Copy link
Copy Markdown
Contributor

Summary

EncodeTmBlock has carried an isPanicOrSynthetic func(...) parameter since PR #2058 (Jan 2025). PR #2388 (Sep 2025)'s cherry-pick refactored the loop to source msgs from filterTransactions and dropped the in-loop call to isPanicOrSynthetic, but kept the parameter and the entire wiring chain that feeds it (SeiBlockAPI.isPanicTx, NewSeiBlockAPI/NewSei2BlockAPI constructor params, getBlockByHash/getBlockByNumber signatures, the closure in server.go).

This PR removes the dead parameter and its plumbing. No replacement check is added.

Why no replacement check

The relevant intent statement is in evmrpc/README.md's "Tracing Failure Management Endpoints" section:

Due to Sei's unique mempool implementation and the absence of transaction simulation, some transactions may fail pre-state checks. These failures can occur due to:

  • Nonce mismatches ("nonce too low" or "nonce too high")
  • Insufficient funds
  • Other panic conditions

These transactions are included in blocks but not executed. The following endpoints help filter out these failed transactions.

So *ExcludeTraceFail should exclude:

Class Already filtered by
Chain-generated synthetic (TxType == ShellEVMTxType) filterTransactions(includeSyntheticTxs=false) — explicit check at utils.go:262
Ante / pre-state failures (EffectiveGasPrice==0 + nonce VmError) filterTransactions via isReceiptFromAnteError at utils.go:249

What's not in scope per the README: in-VM failures like reverts. Those have valid traces (the REVERT path is rendered inside the trace output, trace.Error stays empty), and the legacy trace-based implementation included them. So EncodeTmBlock doesn't need any additional per-tx panic filter — the two classes the README cares about are both already dropped before they reach the loop body.

PR #2058's original logic (re-trace the block, filter on trace.Error) was consistent with this — trace.Error is set for ante failures (no execution to trace) but empty for reverts. PR #2388's silent regression (dead param) didn't change visible behavior on the block side, because filterTransactions's isReceiptFromAnteError already covered the same set. So this PR is a no-op for behavior: it just removes the orphaned plumbing.

Scope

  • Removes EncodeTmBlock's isPanicOrSynthetic parameter
  • Removes getBlockByHash / getBlockByNumber's isPanicTx parameter
  • Removes SeiBlockAPI.isPanicTx field
  • Removes isPanicTx from NewSeiBlockAPI / NewSei2BlockAPI constructor signatures
  • Drops the isPanicOrSyntheticTxFunc arguments at server.go's NewSeiBlockAPI / NewSei2BlockAPI call sites
  • Drops the inline stub at evmrpc/height_availability_test.go
  • Updates three test call sites of EncodeTmBlock to drop the nil argument

The tx-side SeiTransactionAPI.isPanicTx (used by sei_getTransactionReceiptExcludeTraceFail) is kept. That endpoint checks before fetching the receipt so it can return ErrPanicTx to the client — a different shape from the block path. The tx-side discriminator itself is being corrected separately in #3450.

Test plan

  • gofmt -s -l clean on all modified files
  • go build ./... clean
  • go test ./evmrpc/ -count=1 passes (22s)
  • go test ./evmrpc/tests/ -count=1 passes (27s)

🤖 Generated with Claude Code

The parameter has been plumbed through EncodeTmBlock since PR #2058
but unused inside the function body since PR #2388's cherry-pick (Sep
2025) refactored the loop to source msgs from filterTransactions. The
plumbing covers SeiBlockAPI.isPanicTx, NewSeiBlockAPI/NewSei2BlockAPI
constructor params, getBlockByHash/getBlockByNumber signatures, and
the server.go wiring — drop them all.

No replacement check. Per evmrpc/README.md's "Tracing Failure
Management Endpoints" section, the *ExcludeTraceFail block endpoints
should filter out txs "included in blocks but not executed" — synthetic
and pre-state-check failures. filterTransactions already drops both:
synthetic via the includeSyntheticTxs=false path, ante failures via
isReceiptFromAnteError. Reverts ran in the VM and produce valid
traces; the README's intent does not exclude them.

PR #2058's original logic (re-trace and filter on trace.Error) caught
ante failures but kept reverts — consistent with the README. PR #2388
dropped the call when refactoring to filterTransactions; the dead
param was a silent regression at the time but it didn't change visible
behavior because filterTransactions's isReceiptFromAnteError already
covered the same set for the block path. So removing the param now is
purely a cleanup: behavior is unchanged.

The tx-side panic check (SeiTransactionAPI.isPanicTx, used by
sei_getTransactionReceiptExcludeTraceFail) is kept — that endpoint
checks before fetching the receipt so it can return ErrPanicTx to the
client, a different shape from the block path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cursor
Copy link
Copy Markdown

cursor Bot commented May 16, 2026

PR Summary

Low Risk
Low risk refactor that removes an unused function parameter and its wiring across constructors and helpers; behavior should be unchanged but requires careful review of all call sites due to signature changes.

Overview
Removes the unused isPanicOrSynthetic/isPanicTx callback plumbing from block encoding and block RPC paths by dropping the parameter from EncodeTmBlock, getBlockByNumber/getBlockByHash, and SeiBlockAPI constructors, and updating the server wiring accordingly.

Updates *ExcludeTraceFail block endpoints to rely solely on existing filterTransactions logic (synthetic-tx exclusion and ante-failure filtering) rather than any additional per-tx callback, and adjusts affected tests to match the new function signatures.

Reviewed by Cursor Bugbot for commit 6bc4bff. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 16, 2026

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMay 16, 2026, 10:12 PM

@codecov
Copy link
Copy Markdown

codecov Bot commented May 16, 2026

Codecov Report

❌ Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.29%. Comparing base (823a78d) to head (6bc4bff).

Files with missing lines Patch % Lines
evmrpc/block.go 77.77% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3451      +/-   ##
==========================================
- Coverage   59.29%   59.29%   -0.01%     
==========================================
  Files        2125     2125              
  Lines      175629   175628       -1     
==========================================
- Hits       104144   104143       -1     
  Misses      62404    62404              
  Partials     9081     9081              
Flag Coverage Δ
sei-chain-pr 66.19% <81.81%> (?)
sei-db 70.41% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
evmrpc/server.go 88.62% <100.00%> (ø)
evmrpc/block.go 82.44% <77.77%> (-0.06%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant