Skip to content

Commit 2d8a5be

Browse files
authored
feat(backport): add support for eth_getBlockReceipts (#1823)
* feat: add support for eth_getBlockReceipts (#1817) * add support eth_getBlockReceipts * update go mod * update gomod2nix.toml * add test for blockReceipts * python lint * release: v1.4.8 (#1820) * update changelog
1 parent 5eb4e84 commit 2d8a5be

File tree

11 files changed

+42
-16
lines changed

11 files changed

+42
-16
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66

77
* [#1779](https://github.com/crypto-org-chain/cronos/pull/1779) Upgrade rocksdb to `v9.11.2`.
88

9+
*Jun 20, 2025*
10+
11+
## v1.4.8
12+
13+
### Improvements
14+
15+
* [#1823](https://github.com/crypto-org-chain/cronos/pull/1823) Add support for eth_getBlockReceipts.
916

1017
*Apr 24, 2025*
1118

default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
nativeByteOrder ? true, # nativeByteOrder mode will panic on big endian machines
1212
}:
1313
let
14-
version = "v1.4.7";
14+
version = "v1.4.8";
1515
pname = "cronosd";
1616
tags = [
1717
"ledger"

docs/api/json-rpc/endpoints.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Check the JSON-RPC methods supported on Cronos. {synopsis}
88

99
## Pre-requisite Readings
1010

11-
- [Ethereum JSON-RPC](https://ethereum.github.io/execution-apis/api-documentation) {prereq}
11+
- [Ethereum JSON-RPC](https://ethereum.github.io/execution-apis/docs/reference/json-rpc-api) {prereq}
1212
- [Geth JSON-RPC APIs](https://geth.ethereum.org/docs/interacting-with-geth/rpc) {prereq}
1313

1414
## Endpoints
@@ -38,6 +38,7 @@ Check the JSON-RPC methods supported on Cronos. {synopsis}
3838
| [`eth_estimateGas`](#eth-estimategas) | Eth ||| |
3939
| [`eth_getBlockByNumber`](#eth-getblockbynumber) | Eth ||| |
4040
| [`eth_getBlockByHash`](#eth-getblockbyhash) | Eth ||| |
41+
| [`eth_getBlockReceipts`](#eth-getblockbyhash) | Eth ||| |
4142
| [`eth_getTransactionByHash`](#eth-gettransactionbyhash) | Eth ||| |
4243
| [`eth_getTransactionByBlockHashAndIndex`](#eth-gettransactionbyblockhashandindex) | Eth ||| |
4344
| [`eth_getTransactionReceipt`](#eth-gettransactionreceipt) | Eth ||| |

docs/api/json-rpc/events.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ where `hexAddress` is an Ethereum hex address (eg: `0x11223344556677889900112233
6060

6161
### Ethereum JSON-RPC Events
6262

63-
Cronos also supports the Ethereum [JSON-RPC](https://ethereum.github.io/execution-apis/api-documentation) filters calls to
64-
subscribe to [state logs](https://ethereum.github.io/execution-apis/api-documentation#eth_newfilter),
65-
[blocks](https://ethereum.github.io/execution-apis/api-documentation#eth_newblockfilter) or [pending
66-
transactions](https://ethereum.github.io/execution-apis/api-documentation#eth_newpendingtransactionfilter) changes.
63+
Cronos also supports the Ethereum [JSON-RPC](https://ethereum.github.io/execution-apis/docs/reference/json-rpc-api) filters calls to
64+
subscribe to [state logs](https://ethereum.github.io/execution-apis/docs/reference/eth_newfilter),
65+
[blocks](https://ethereum.github.io/execution-apis/docs/reference/eth_newblockfilter) or [pending
66+
transactions](https://ethereum.github.io/execution-apis/docs/reference/eth_newpendingtransactionfilter) changes.
6767

6868
Under the hood, it uses the Tendermint RPC client's event system to process subscriptions that are
6969
then formatted to Ethereum-compatible events.
@@ -74,7 +74,7 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_newBlockFilter","params":[],
7474
{"jsonrpc":"2.0","id":1,"result":"0x3503de5f0c766c68f78a03a3b05036a5"}
7575
```
7676

77-
Then you can check if the state changes with the [`eth_getFilterChanges`](https://ethereum.github.io/execution-apis/api-documentation#eth_getfilterchanges) call:
77+
Then you can check if the state changes with the [`eth_getFilterChanges`](https://ethereum.github.io/execution-apis/docs/reference/eth_getfilterchanges) call:
7878

7979
```bash
8080
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x3503de5f0c766c68f78a03a3b05036a5"],"id":1}' -H "Content-Type: application/json" http://localhost:8545

docs/api/json-rpc/server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Learn about the JSON-RPC server to interact with the EVM. {synopsis}
88

99
## Pre-requisite Readings
1010

11-
- [EthWiki JSON-RPC API](https://ethereum.github.io/execution-apis/api-documentation) {prereq}
11+
- [EthWiki JSON-RPC API](https://ethereum.github.io/execution-apis/docs/reference/json-rpc-api) {prereq}
1212
- [Geth JSON-RPC Server](https://geth.ethereum.org/docs/interacting-with-geth/rpc) {prereq}
1313

1414
## JSON-RPC API

docs/architecture/adr-001.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ Accepted
6565
* https://github.com/althea-net/cosmos-gravity-bridge/issues/347
6666
* https://github.com/althea-net/cosmos-gravity-bridge/issues/346
6767
* https://github.com/althea-net/cosmos-gravity-bridge/issues/344
68-
* in-place store migrations: https://github.com/cosmos/cosmos-sdk/blob/a47bd592e951d34ebbffca03f85ca98d65b61be8/docs/architecture/adr-041-in-place-store-migrations.md
68+
* in-place store migrations: https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-041-in-place-store-migrations.md

docs/architecture/adr-008.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,5 +170,3 @@ Accepted
170170

171171
## References
172172

173-
### x/erc20 module
174-
- https://github.com/evmos/evmos/tree/main/x/erc20/spec

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ replace (
272272
github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2
273273
github.com/ethereum/go-ethereum => github.com/crypto-org-chain/go-ethereum v1.10.20-0.20240926023215-d2275b4afb9a
274274
// release/v1.4.x-2
275-
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20250409022716-434f46d2a46c
275+
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20250618065241-823fc683e6f0
276276
// Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities.
277277
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
278278
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,8 @@ github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241217090828-cfbca9fe8254
430430
github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241217090828-cfbca9fe8254/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM=
431431
github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241217090828-cfbca9fe8254 h1:JzLOFRiKsDtLJt5h0M0jkEIPDKvFFyja7VEp7gG6O9U=
432432
github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241217090828-cfbca9fe8254/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w=
433-
github.com/crypto-org-chain/ethermint v0.6.1-0.20250409022716-434f46d2a46c h1:ZQvTVbnPBn5G5HGFdUQxVxtJjeEMgkH1tf6kIggzQs0=
434-
github.com/crypto-org-chain/ethermint v0.6.1-0.20250409022716-434f46d2a46c/go.mod h1:X11RkHpz0TlJf5E30HLyvxXJCDGB0XW0CUzdG4MNSWg=
433+
github.com/crypto-org-chain/ethermint v0.6.1-0.20250618065241-823fc683e6f0 h1:Fl0H4Tqwzzkdh6pWDN/zRkDU/4U0+n9BdPL++88nCeA=
434+
github.com/crypto-org-chain/ethermint v0.6.1-0.20250618065241-823fc683e6f0/go.mod h1:X11RkHpz0TlJf5E30HLyvxXJCDGB0XW0CUzdG4MNSWg=
435435
github.com/crypto-org-chain/go-block-stm v0.0.0-20240919080136-6c49aef68716 h1:OvD5Rm0B6LHUJk6z858UgwdP72jU2DuUdXeclRyKpDI=
436436
github.com/crypto-org-chain/go-block-stm v0.0.0-20240919080136-6c49aef68716/go.mod h1:iwQTX9xMX8NV9k3o2BiWXA0SswpsZrDk5q3gA7nWYiE=
437437
github.com/crypto-org-chain/go-ethereum v1.10.20-0.20240926023215-d2275b4afb9a h1:IUPD+dg1YQl8cLocxQ/Mbx/ObTgAgcrZlcBhFjsLO40=

gomod2nix.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ schema = 3
263263
hash = "sha256-ozwVS2BhAoz+OOisAyMhgg+lq8FdQjf90xoOq9cxtGw="
264264
replaced = "github.com/crypto-org-chain/go-ethereum"
265265
[mod."github.com/evmos/ethermint"]
266-
version = "v0.6.1-0.20250409022716-434f46d2a46c"
267-
hash = "sha256-4dIcLX/qbcgSdXwlcWALJFM+BsnmyL3y+ybqDsT14Ls="
266+
version = "v0.6.1-0.20250618065241-823fc683e6f0"
267+
hash = "sha256-y6acm2oaz6NujNAnKYyhPriXUX+zF6SRWZEUsYrn+/0="
268268
replaced = "github.com/crypto-org-chain/ethermint"
269269
[mod."github.com/fatih/color"]
270270
version = "v1.16.0"

integration_tests/test_basic.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ def assert_receipt_transaction_and_block(w3, futures):
547547

548548
block_number = w3.eth.get_block_number()
549549
tx_indexes = [0, 1, 2, 3]
550+
550551
for receipt in receipts:
551552
# check in the same block
552553
assert receipt["blockNumber"] == block_number
@@ -555,6 +556,25 @@ def assert_receipt_transaction_and_block(w3, futures):
555556
assert transaction_index in tx_indexes
556557
tx_indexes.remove(transaction_index)
557558

559+
# check block receipts
560+
561+
receipts.sort(key=lambda receipt: receipt["transactionIndex"])
562+
block_receipts = w3.provider.make_request("eth_getBlockReceipts", [block_number])[
563+
"result"
564+
]
565+
assert len(block_receipts) == 4
566+
for i, block_receipt in enumerate(block_receipts):
567+
assert block_receipt["blockNumber"] == hex(receipts[i]["blockNumber"])
568+
assert block_receipt["transactionHash"] == receipts[i]["transactionHash"].hex()
569+
assert block_receipt["cumulativeGasUsed"] == hex(
570+
receipts[i]["cumulativeGasUsed"]
571+
)
572+
assert block_receipt["effectiveGasPrice"] == hex(
573+
receipts[i]["effectiveGasPrice"]
574+
)
575+
assert block_receipt["from"] == receipts[i]["from"].lower()
576+
assert block_receipt["gasUsed"] == hex(receipts[i]["gasUsed"])
577+
558578
block = w3.eth.get_block(block_number)
559579
# print(block)
560580

0 commit comments

Comments
 (0)