cosmos / cosmos/evm

EVM RPC Observability of Cosmos Transactions

Open
#482 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
164
Forks
213
Avg merge
3d 58m
Merged PRs (30d)
12

Description

Currently, when transactions happen on the Cosmos side, they are not visible on the EVM side. Critically, a Cosmos transaction that changes balances will not be reflected as a change in the EVM. This affects indexers, block explorers, and queries in general. This has the effect of balances changing silently, making it harder to debug what happened from a pure EVM perspective without also integrating Cosmos infrastructure.

Requirements:

* A general solution to this problem would be ideal. Any time there is a state change on the Cosmos layer that affects balances, there should be a translation made on the EVM layer.
* For any transactions that have corresponding default precompiles (i.e. Staking, Governance, ERC20, etc.), we need to extract the messages and include the same events in the transaction.
* If there are balance changes that do not have a corresponding ERC20, they may be skipped.
* Since Cosmos transactions can contain many messages, and the EVM does not have such a concept, the solution needs to aggregate multiple messages into a single transaction result, which would include the total balance changes and all of the events that occurred in the transaction.
* The solution must work with indexers and block explorers, confirmed by the existence of these transactions in their results and a lack of errors.

Non-Requirements:

* The solution should not include tracing, as we cannot use the EVM to trace Cosmos transactions.

A current, potentially non-exhaustive list of RPC endpoints and functions that would need to be changed to observe Cosmos transactions:

*/rpc/backend/blocks.go*
These need to include the Cosmos transactions alongside the EVM transactions, complete with proper indexes.

* `GetBlockByNumber`
* `GetBlockByHash`
* `GetBlockTransactionCountByHash`
* `GetBlockTransactionCountByNumber`
* `GetBlockTransactionCount`
* `RPCBlockFromCometBlock`

*/rpc/backend/tx_info.go*:
These need to return Cosmos transactions translated into an EVM transaction.

* `GetTransactionByHash`
* `GetTransactionByHashPending`
* `GetTransactionReceipt`
* `GetTransactionLogs`
* `GetTransactionByBlockHashAndIndex`
* `GetTransactionByBlockNumberAndIndex`
* `GetTxByEthHash`
* `GetTxByTxIndex`
* `GetTransactionByBlockAndIndex`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.