Closed m-Peter closed 2 months ago
The recent changes enhance the BlockChainAPI to calculate and return the size of blocks and transactions in JSON-RPC calls. This update improves how transaction sizes are determined, ensuring better accuracy and completeness of the returned data. By incorporating these size metrics, clients gain deeper insights into the resource requirements associated with blocks and transactions.
File | Change Summary |
---|---|
api/api.go | Modified prepareBlockResponse to calculate and include block size; added rlp import. |
tests/web3js/eth_non_interactive_test.js | Added assertion to validate block size in the get block test case. |
sequenceDiagram
participant Client
participant BlockChainAPI
participant TransactionModel
Client->>BlockChainAPI: Request Block Info
BlockChainAPI->>TransactionModel: Prepare Block Response
TransactionModel->>TransactionModel: Calculate Transaction Sizes
TransactionModel-->>BlockChainAPI: Return Sizes
BlockChainAPI-->>Client: Response with Block Info and Sizes
Objective | Addressed | Explanation |
---|---|---|
Calculate size field on JSON-RPC calls that return block info (#375) |
β | |
Ensure accurate size representation in transactions (#375) | β | No changes made to transaction size calculations in the code. |
Update tests for new size calculations (#375) | β |
In the code where rabbits play,
Sizes grow with each new day.
Blocks and transactions now align,
Metrics bright, oh how they shine!
Hopping high with data clear,
Knowledge blooms, letβs give a cheer! πβ¨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Closes: https://github.com/onflow/flow-evm-gateway/issues/375
Description
This is needed for endpoints such as
eth_getBlockByNumber
ð_getBlockByHash
.For contributor use:
master
branchFiles changed
in the Github PR explorerSummary by CodeRabbit
New Features
Tests
size
property of blocks, increasing test coverage for block attributes.