Skip to content

Commit ec57b96

Browse files
Pitasialjo242
andauthored
fix: CometBlockResultByNumber when height is 0 (#416)
* fix TendermintBlockResultByNumber when height is 0 Signed-off-by: Antonio Pitasi <[email protected]> * add changelog entry Signed-off-by: Antonio Pitasi <[email protected]> --------- Signed-off-by: Antonio Pitasi <[email protected]> Co-authored-by: Alex | Interchain Labs <[email protected]>
1 parent 4be8aba commit ec57b96

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- [\#492](https://github.com/cosmos/evm/pull/492) Duplicate case switch to avoid empty execution block
1111
- [\#509](https://github.com/cosmos/evm/pull/509) Allow value with slashes when query token_pairs
1212
- [\#495](https://github.com/cosmos/evm/pull/495) Allow immediate SIGINT interrupt when mempool is not empty
13+
- [\#416](https://github.com/cosmos/evm/pull/416) Fix regression in CometBlockResultByNumber when height is 0 to use the latest block. This fixes eth_getFilterLogs RPC.
1314
- [\#545](https://github.com/cosmos/evm/pull/545) Check if mempool is not nil before accepting nonce gap error tx.
1415

1516
### IMPROVEMENTS

rpc/backend/blocks.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ func (b *Backend) CometHeaderByNumber(blockNum rpctypes.BlockNumber) (*cmtrpctyp
203203
// CometBlockResultByNumber returns a CometBFT-formatted block result
204204
// by block number
205205
func (b *Backend) CometBlockResultByNumber(height *int64) (*cmtrpctypes.ResultBlockResults, error) {
206+
if height != nil && *height == 0 {
207+
height = nil
208+
}
206209
res, err := b.RPCClient.BlockResults(b.Ctx, height)
207210
if err != nil {
208211
return nil, fmt.Errorf("failed to fetch block result from CometBFT %d: %w", *height, err)

0 commit comments

Comments
 (0)