Skip to content

fix: eth_getBlockTransactionCountByNumber returns inconsistent count vs eth_getBlockByNumber#3125

Open
mojtaba-esk wants to merge 3 commits intomainfrom
mojtaba/fix-eth_getBlockTransactionCountByNumber-returns-inconsistent-count-vs-eth_getBlockByNumber
Open

fix: eth_getBlockTransactionCountByNumber returns inconsistent count vs eth_getBlockByNumber#3125
mojtaba-esk wants to merge 3 commits intomainfrom
mojtaba/fix-eth_getBlockTransactionCountByNumber-returns-inconsistent-count-vs-eth_getBlockByNumber

Conversation

@mojtaba-esk
Copy link
Copy Markdown
Contributor

Describe your changes and provide context

Context: PLT-193

Fixes PLT-193

Testing performed to validate your change

…mber-returns-inconsistent-count-vs-eth_getBlockByNumber
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 27, 2026

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMar 27, 2026, 2:47 PM

@mojtaba-esk mojtaba-esk requested a review from monty-sei March 27, 2026 12:03
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

❌ Patch coverage is 77.41935% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.73%. Comparing base (82751c6) to head (d198d9f).
⚠️ Report is 2 commits behind head on main.

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

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3125      +/-   ##
==========================================
- Coverage   58.75%   58.73%   -0.02%     
==========================================
  Files        2094     2094              
  Lines      173084   173105      +21     
==========================================
- Hits       101696   101680      -16     
- Misses      62333    62354      +21     
- Partials     9055     9071      +16     
Flag Coverage Δ
sei-chain-pr 67.83% <77.41%> (?)
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/block.go 81.76% <77.41%> (+2.86%) ⬆️

... and 15 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.

return &cntHex
}

func countBlockTxsLikeEncodeTmBlock(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Would exporting this break something as opposed to creating the helper below that delegates?

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.

Not at all. just trying to hide the logic in an unexported func. and that exported is also to serve the evm_test which is another pkg.

evmrpc/block.go Outdated
return n
}

// CountEncodeTmBlockVisibleTransactions matches getEvmTxCount (exported for external tests).
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If this is exported only for testing purposes, this way of doing it will expose the function to production scope code.

The way to do this effectively in go, where it is exposed for testing but not in production scope code is to:

  • move this exported function to a seprate file in the same package (evmrpc), but with _test.go extension.

You can then use it as an exported function only within test scope (i.e. in evmrpc_test package)

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.

Good idea. That's a much cleaner approach instead of exporting it only for test pkg. will do it.

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.

checked it there is import cycle issue. so tried another way, removed that exported completely and use the actual API for the test purpose which I think it is even better.

@mojtaba-esk mojtaba-esk requested a review from masih March 27, 2026 14:47
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.

4 participants