gnolang / gno

Gno: An interpreted, stack-based Go virtual machine to build succinct and composable apps + Gno.land: a blockchain for timeless code and fair open-source.
https://gno.land/
Other
882 stars 367 forks source link

[gnoland] `/tx?hash=` endpoint not usable #2489

Open gfant opened 3 months ago

gfant commented 3 months ago

Tx Hash not usable in the node RPC

Description

When you make a tx:

Your environment

Steps to reproduce

Expected behaviour

The output when accessing that path should be the content of this tx.

Actual behaviour

{
  "jsonrpc": "2.0",
  "id": "",
  "error": {
    "code": -32603,
    "message": "Internal error",
    "data": "Could not find tx result for hash #[hash in hex format]"
  }
}

Proposed solution

I'm currently checking how is this done to give an alternative. Will add an alternative once I understand where it appears

leohhhn commented 3 months ago

cc @thehowl @zivkovicmilos

linhpn99 commented 3 months ago

From a comment of Milos : https://github.com/gnolang/gno/pull/2309#discussion_r1636749456

leohhhn commented 3 months ago

From some testing & discussions, the current state is this.

If you pass in the following request body to the root endpoint, ie localhost:26657/, via a POST request:

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tx",
  "params": [
    "dX+7ubf0tsbzQ1zPPh+1Op607o/kj6goWzbrnclR8CE="
  ]
}

It will work. However, using the/tx endpoint while providing it the hash, either wrapped in quotes or not, does not work.

On top of this, when you receive a proper response, the transaction data is actually base64 encoded, so it is not readable. Also, when you do decode the data from base64, you're left with an amino representation that is not fully readable.

linhpn99 commented 3 months ago

I found the root cause and fixed it : https://github.com/gnolang/gno/pull/2518