evmos / ethermint

Ethermint is a Cosmos SDK library for running scalable and interoperable EVM chains
https://docs.evmos.org/
GNU Lesser General Public License v3.0
1.82k stars 562 forks source link

Event-based indexing tools such as thegraph are unable to retrieve the balance of tokens from IBCs #1719

Closed alberthuang24 closed 1 year ago

alberthuang24 commented 1 year ago

Steps to reproduce:

  1. Start the chain
  2. Send Cosmos Transaction to simulate IBC transaction mint erc20 to 0x4fc6f808c465030ebeb361140df77f543bcd9b99
  3. Index blocks using thegraph, substreams or blackout

Expected behavior: [What you expected to happen]

The actual events sent by evm can be indexed by tools such as thegraph

Actual behavior: [What actually happened]

Cannot query any user balance or events

Additional info: [Include gist of relevant config, logs, etc.]

This is because the current queries eth_blocks, eth_getBlockByHash, eth_transactionByHash, eth_transactionReceipt only support the query MsgEthereumTx.

Can we abstract it to an interface.

This way, partially executed evm cosmos transactions can be converted to ethereum transactions

For example:

type EthereumTxCompatible interface {
    // evm.MsgEthereumTx
    AsTransaction() *ethtypes.Transaction
    TxHash() common.Hash
    TxData() (TxData, error)
    GetGas() uint64
    GetSender(chainID *big.Int) (common.Address, error)

    // Cosmos sdk.Msg
    ValidateBasic() error
    GetSigners() []sdk.AccAddress
}

https://github.com/evmos/ethermint/blob/main/rpc/backend/blocks.go#L273

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 45 days with no activity. Remove Status: Stale label or comment or this will be closed in 7 days.