Skip to content

evmrpc: remove /block_results dependencies from block trace, sei_getCosmosTx, getHeader (CON-256)#3452

Open
wen-coding wants to merge 8 commits into
mainfrom
wen/derive_fields_from_proper_data_source
Open

evmrpc: remove /block_results dependencies from block trace, sei_getCosmosTx, getHeader (CON-256)#3452
wen-coding wants to merge 8 commits into
mainfrom
wen/derive_fields_from_proper_data_source

Conversation

@wen-coding
Copy link
Copy Markdown
Contributor

@wen-coding wen-coding commented May 16, 2026

Summary

Three eth-side block-scoped RPC paths leaned on /block_results data that isn't populated under Autobahn — they returned empty (or wrong) results regardless of block contents.

  • Block trace backend (debug_traceBlockBy*, sei_traceBlockBy*ExcludeTraceFail) now iterates the block's own tx list.
  • sei_getCosmosTx looks up the cosmos hash directly via receipt.TransactionIndex, no iteration needed.
  • getHeader (trace path's eth-block construction) sources gasLimit from sdkCtx.ConsensusParams(), matching the block.go:489-491 pattern already used by eth_getBlockByNumber. Under legacy this also fixes a latent silent fallback to DefaultBlockGasLimit.

Existing .iox fixtures only asserted response kind, so empty results / early-exit error paths looked indistinguishable from the fix; the trace fixtures now bind to the seeded deploy block and assert non-empty output, and a positive-case getCosmosTx-deploy.iox was added.

Test plan

  • go test ./evmrpc/ (22.3s)
  • go test ./evmrpc/tests/ (27.7s)
  • Full RPC IO suite, docker localnet, Autobahn cluster: 161/161
  • Full RPC IO suite, docker localnet, legacy cluster: 160/160 (run on the earlier 5-fixture state; new fixture additive)
  • Buggy binary (block-trace fix reverted) on Autobahn: 156/160 — exactly the four updated trace fixtures fail
  • Buggy binary (sei_getCosmosTx fix reverted) on Autobahn: 160/161 — exactly the new getCosmosTx-deploy.iox fixture fails
  • gofmt -s -l clean

wen-coding and others added 3 commits May 16, 2026 09:36
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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

Medium Risk
Changes block tracing, sei_getCosmosTx, and header construction logic to avoid /block_results, which can affect correctness of RPC outputs across consensus engines. Risk is moderate due to altered indexing/receipt-based lookups and gas limit derivation impacting downstream clients and tests.

Overview
Fixes block-scoped RPC behavior under Autobahn by removing reliance on Tendermint /block_results data in multiple paths.

debug_traceBlockBy*/sei_traceBlockBy*ExcludeTraceFail now iterate tmBlock.Block.Txs directly, sei_getCosmosTx derives the Cosmos tx hash via the receipt’s TransactionIndex (with bounds checking), and getHeader sources GasLimit from sdkCtx.ConsensusParams() with a default fallback.

Updates unit tests to reflect the new gas-limit source and rewrites RPC IO fixtures to bind trace targets from a seeded deploy receipt and assert non-empty trace output; adds a positive-case fixture for sei_getCosmosTx.

Reviewed by Cursor Bugbot for commit 0d2b1cb. 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 19, 2026, 10:02 PM

@github-actions
Copy link
Copy Markdown

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

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

@wen-coding wen-coding changed the title evmrpc: derive block trace, sei_getCosmosTx, header gasLimit from populated data sources (CON-296) evmrpc: derive block trace, sei_getCosmosTx, header gasLimit from populated data sources (CON-256) May 16, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.36%. Comparing base (80a4364) to head (0d2b1cb).

Files with missing lines Patch % Lines
evmrpc/association.go 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3452      +/-   ##
==========================================
+ Coverage   59.05%   59.36%   +0.30%     
==========================================
  Files        2188     2111      -77     
  Lines      182088   173431    -8657     
==========================================
- Hits       107530   102953    -4577     
+ Misses      64925    61588    -3337     
+ Partials     9633     8890     -743     
Flag Coverage Δ
sei-chain-pr 66.93% <75.00%> (?)
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/simulate.go 74.78% <100.00%> (+0.59%) ⬆️
evmrpc/association.go 40.19% <50.00%> (-4.35%) ⬇️

... and 226 files with indirect coverage changes

🚀 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.

wen-coding and others added 3 commits May 19, 2026 12:53
The bounds check at association.go now produces a self-describing
error rather than the opaque "transaction index out of range".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@wen-coding wen-coding changed the title evmrpc: derive block trace, sei_getCosmosTx, header gasLimit from populated data sources (CON-256) evmrpc: remove /block_results dependencies from block trace, sei_getCosmosTx, getHeader (CON-256) May 19, 2026
Comment thread evmrpc/simulate_test.go Outdated
@@ -24,6 +24,7 @@ import (
sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types"
receipt "github.com/sei-protocol/sei-chain/sei-db/ledger_db/receipt"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we are here, receipt seems to be redundant alias and can be removed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Comment thread evmrpc/simulate_test.go Outdated
sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types"
receipt "github.com/sei-protocol/sei-chain/sei-db/ledger_db/receipt"
"github.com/sei-protocol/sei-chain/sei-tendermint/libs/bytes"
types2 "github.com/sei-protocol/sei-chain/sei-tendermint/proto/tendermint/types"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would tenderminttypes be a better alias name?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

Drop the redundant `receipt` alias (default name matches the path) and
rename `types2` to `tenderminttypes` for readability.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants