fix: eth_getBlockTransactionCountByNumber returns inconsistent count vs eth_getBlockByNumber#3125
Conversation
…vs eth_getBlockByNumber
…mber-returns-inconsistent-count-vs-eth_getBlockByNumber
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
| return &cntHex | ||
| } | ||
|
|
||
| func countBlockTxsLikeEncodeTmBlock( |
There was a problem hiding this comment.
Would exporting this break something as opposed to creating the helper below that delegates?
There was a problem hiding this comment.
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). |
There was a problem hiding this comment.
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.goextension.
You can then use it as an exported function only within test scope (i.e. in evmrpc_test package)
There was a problem hiding this comment.
Good idea. That's a much cleaner approach instead of exporting it only for test pkg. will do it.
There was a problem hiding this comment.
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.
Describe your changes and provide context
Context: PLT-193
Fixes PLT-193
Testing performed to validate your change