Skip to content

feat(backport): add support for eth_getBlockReceipts #1823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@

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

*Jun 20, 2025*

## v1.4.8

### Improvements

* [#1817](https://github.com/crypto-org-chain/cronos/pull/1817) Add support for eth_getBlockReceipts.

*Apr 24, 2025*

Expand All @@ -15,7 +22,6 @@

* [#1797](https://github.com/crypto-org-chain/cronos/pull/1797) Upgrade cosmos sdk to latest to include bug fix


*Apr 9, 2025*

## v1.4.6
Expand Down
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
nativeByteOrder ? true, # nativeByteOrder mode will panic on big endian machines
}:
let
version = "v1.4.7";
version = "v1.4.8";
pname = "cronosd";
tags = [
"ledger"
Expand Down
3 changes: 2 additions & 1 deletion docs/api/json-rpc/endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Check the JSON-RPC methods supported on Cronos. {synopsis}

## Pre-requisite Readings

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

## Endpoints
Expand Down Expand Up @@ -38,6 +38,7 @@ Check the JSON-RPC methods supported on Cronos. {synopsis}
| [`eth_estimateGas`](#eth-estimategas) | Eth | ✔ | ✔ | |
| [`eth_getBlockByNumber`](#eth-getblockbynumber) | Eth | ✔ | ✔ | |
| [`eth_getBlockByHash`](#eth-getblockbyhash) | Eth | ✔ | ✔ | |
| [`eth_getBlockReceipts`](#eth-getblockbyhash) | Eth | ✔ | ✔ | |
| [`eth_getTransactionByHash`](#eth-gettransactionbyhash) | Eth | ✔ | ✔ | |
| [`eth_getTransactionByBlockHashAndIndex`](#eth-gettransactionbyblockhashandindex) | Eth | ✔ | ✔ | |
| [`eth_getTransactionReceipt`](#eth-gettransactionreceipt) | Eth | ✔ | ✔ | |
Expand Down
10 changes: 5 additions & 5 deletions docs/api/json-rpc/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ where `hexAddress` is an Ethereum hex address (eg: `0x11223344556677889900112233

### Ethereum JSON-RPC Events

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

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

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

```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x3503de5f0c766c68f78a03a3b05036a5"],"id":1}' -H "Content-Type: application/json" http://localhost:8545
Expand Down
2 changes: 1 addition & 1 deletion docs/api/json-rpc/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Learn about the JSON-RPC server to interact with the EVM. {synopsis}

## Pre-requisite Readings

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

## JSON-RPC API
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/adr-001.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ Accepted
* https://github.com/althea-net/cosmos-gravity-bridge/issues/347
* https://github.com/althea-net/cosmos-gravity-bridge/issues/346
* https://github.com/althea-net/cosmos-gravity-bridge/issues/344
* in-place store migrations: https://github.com/cosmos/cosmos-sdk/blob/a47bd592e951d34ebbffca03f85ca98d65b61be8/docs/architecture/adr-041-in-place-store-migrations.md
* in-place store migrations: https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-041-in-place-store-migrations.md
2 changes: 0 additions & 2 deletions docs/architecture/adr-008.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,3 @@ Accepted

## References

### x/erc20 module
- https://github.com/evmos/evmos/tree/main/x/erc20/spec
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ replace (
github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2
github.com/ethereum/go-ethereum => github.com/crypto-org-chain/go-ethereum v1.10.20-0.20240926023215-d2275b4afb9a
// release/v1.4.x-2
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20250409022716-434f46d2a46c
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20250618065241-823fc683e6f0
// Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities.
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,8 @@ github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241217090828-cfbca9fe8254
github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241217090828-cfbca9fe8254/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM=
github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241217090828-cfbca9fe8254 h1:JzLOFRiKsDtLJt5h0M0jkEIPDKvFFyja7VEp7gG6O9U=
github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241217090828-cfbca9fe8254/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w=
github.com/crypto-org-chain/ethermint v0.6.1-0.20250409022716-434f46d2a46c h1:ZQvTVbnPBn5G5HGFdUQxVxtJjeEMgkH1tf6kIggzQs0=
github.com/crypto-org-chain/ethermint v0.6.1-0.20250409022716-434f46d2a46c/go.mod h1:X11RkHpz0TlJf5E30HLyvxXJCDGB0XW0CUzdG4MNSWg=
github.com/crypto-org-chain/ethermint v0.6.1-0.20250618065241-823fc683e6f0 h1:Fl0H4Tqwzzkdh6pWDN/zRkDU/4U0+n9BdPL++88nCeA=
github.com/crypto-org-chain/ethermint v0.6.1-0.20250618065241-823fc683e6f0/go.mod h1:X11RkHpz0TlJf5E30HLyvxXJCDGB0XW0CUzdG4MNSWg=
github.com/crypto-org-chain/go-block-stm v0.0.0-20240919080136-6c49aef68716 h1:OvD5Rm0B6LHUJk6z858UgwdP72jU2DuUdXeclRyKpDI=
github.com/crypto-org-chain/go-block-stm v0.0.0-20240919080136-6c49aef68716/go.mod h1:iwQTX9xMX8NV9k3o2BiWXA0SswpsZrDk5q3gA7nWYiE=
github.com/crypto-org-chain/go-ethereum v1.10.20-0.20240926023215-d2275b4afb9a h1:IUPD+dg1YQl8cLocxQ/Mbx/ObTgAgcrZlcBhFjsLO40=
Expand Down
4 changes: 2 additions & 2 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ schema = 3
hash = "sha256-ozwVS2BhAoz+OOisAyMhgg+lq8FdQjf90xoOq9cxtGw="
replaced = "github.com/crypto-org-chain/go-ethereum"
[mod."github.com/evmos/ethermint"]
version = "v0.6.1-0.20250409022716-434f46d2a46c"
hash = "sha256-4dIcLX/qbcgSdXwlcWALJFM+BsnmyL3y+ybqDsT14Ls="
version = "v0.6.1-0.20250618065241-823fc683e6f0"
hash = "sha256-y6acm2oaz6NujNAnKYyhPriXUX+zF6SRWZEUsYrn+/0="
replaced = "github.com/crypto-org-chain/ethermint"
[mod."github.com/fatih/color"]
version = "v1.16.0"
Expand Down
20 changes: 20 additions & 0 deletions integration_tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ def assert_receipt_transaction_and_block(w3, futures):

block_number = w3.eth.get_block_number()
tx_indexes = [0, 1, 2, 3]

for receipt in receipts:
# check in the same block
assert receipt["blockNumber"] == block_number
Expand All @@ -555,6 +556,25 @@ def assert_receipt_transaction_and_block(w3, futures):
assert transaction_index in tx_indexes
tx_indexes.remove(transaction_index)

# check block receipts

receipts.sort(key=lambda receipt: receipt["transactionIndex"])
block_receipts = w3.provider.make_request("eth_getBlockReceipts", [block_number])[
"result"
]
assert len(block_receipts) == 4
for i, block_receipt in enumerate(block_receipts):
assert block_receipt["blockNumber"] == hex(receipts[i]["blockNumber"])
assert block_receipt["transactionHash"] == receipts[i]["transactionHash"].hex()
assert block_receipt["cumulativeGasUsed"] == hex(
receipts[i]["cumulativeGasUsed"]
)
assert block_receipt["effectiveGasPrice"] == hex(
receipts[i]["effectiveGasPrice"]
)
assert block_receipt["from"] == receipts[i]["from"].lower()
assert block_receipt["gasUsed"] == hex(receipts[i]["gasUsed"])

block = w3.eth.get_block(block_number)
# print(block)

Expand Down
Loading