Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Strange hash in transaction obj #176

Closed
LikoIlya opened this issue Feb 14, 2020 · 2 comments · Fixed by #250
Closed

Strange hash in transaction obj #176

LikoIlya opened this issue Feb 14, 2020 · 2 comments · Fixed by #250

Comments

@LikoIlya
Copy link

System info: MacOS Catalina
commit 3ac6359

Steps to reproduce:

  1. run eth_getTransaction with params:
    "0xca93358f027c5e79fbc00290ddb96c03c1d4f3fda9a0394c8d637aff5b17b9e5" (or some present tx in your ethermint chain)

Expected behavior: Hash in transaction obj is the same as hash in parameters

Actual behavior: result of request:

{
      blockHash: '0xbb9d1d20f0027f16f8d520611527f6ced36e3d6a019eccccc9e570e389f5c14a',
      blockNumber: 3335,
      from: '0xCC46DC7b409E96c4601228401D8C5Bd74a6951D5',
      gas: 62291,
      gasPrice: '20',
      hash: '0xa74649e1055ba3707910b118bedf999042a82647a8c81052d0ae0c05bddf8d19',
      input: '0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675',
      nonce: 3,
      to: '0xC4B817c2495FdAF1033e80BF59F2da753400Dbbd',
      transactionIndex: 0,
      value: '145',
      v: '0xe0',
      r: '0x93b9e90f5e8d4e6bd4503539feeb8d80dbc3a42bc8bfa42993db812c084872fc',
      s: '0x3ac6e14db8dcd42a240e23a13e5eb264853421b10ed8fef919c52db601a0c854'
}

Additional info: When i go through debug into code, i saw that in func bytesToEthTx
eth_api.go#590
return ethTx with nil hash and seems like result hash eth_api.go#611 does not calculating correctly

@austinabell
Copy link

Ah so here's the reason, it's the difference between rlp and amino hashes. You query this transaction with the amino hash because that is how it is internally processed and indexed. The hash that is returned in this response is actually the rlp hash (Ethereum style) for any dev tooling that may wan't to verify this hash for the data returned.

I agree this isn't ideal and I will try to find out later which of the two hashes is better to return in this response. My intuition previously was that this was better to pass any sanity checks for the tx data in dev tooling but I can see that if this hash was used again another time to requery this tx it would fail for unexpected reasons. Is this the case you ran into?

I am happy to switch it over to always return the amino hash (one used to actually index the tx) but I would have to verify no core dev tooling does that rlp hash check on this data. This is the cost of having to mix the encoding protocols of Ethereum and Cosmos' default.

@LikoIlya
Copy link
Author

Is this the case you ran into?

Yes i can't query tx by response hash.
Thanks for your reply!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants