gno icon indicating copy to clipboard operation
gno copied to clipboard

`block_results` result.devlier_tx[i].ResponseBase.Data does not identify msg

Open r3v4s opened this issue 1 year ago • 0 comments

block_results result.devlier_tx[i].ResponseBase.Data` does not identify msg

Description

deploy contract

package restest

func FuncNo() {}

func Func2() (string, string) {
	return "1", "2"
}

func Func3() (string, string, uint64) {
	return "3", "4", 5
}

multi-msg call via adena

await adena.DoContract({
  messages: [{
  "type": "/vm.m_call",
  "value": {
    "caller": "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5",
    "send": "",
    "pkg_path": "gno.land/r/demo/restest",
    "func": "FuncNo",
    "args": []
  }
  },{
    "type": "/vm.m_call",
    "value": {
      "caller": "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5",
      "send": "",
      "pkg_path": "gno.land/r/demo/restest",
      "func": "Func2",
      "args": []
    }
  },{
    "type": "/vm.m_call",
    "value": {
      "caller": "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5",
      "send": "",
      "pkg_path": "gno.land/r/demo/restest",
      "func": "FuncNo",
      "args": []
    }
    },{
    "type": "/vm.m_call",
    "value": {
      "caller": "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5",
      "send": "",
      "pkg_path": "gno.land/r/demo/restest",
      "func": "Func3",
      "args": []
    }
  },{
    "type": "/vm.m_call",
    "value": {
      "caller": "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5",
      "send": "",
      "pkg_path": "gno.land/r/demo/restest",
      "func": "FuncNo",
      "args": []
    }
  }],
send: "",
gasFee: 1, 
gasWanted: 2000000
});

result from rpc block_results

https://rpc.gno.land/block_results?height=8924

{
  "jsonrpc": "2.0",
  "id": "",
  "result": {
    "height": "8924",
    "results": {
      "deliver_tx": [
        {
          "ResponseBase": {
            "Error": null,
            "Data": "KCIxIiBzdHJpbmcpCigiMiIgc3RyaW5nKSgiMyIgc3RyaW5nKQooIjQiIHN0cmluZykKKDUgdWludDY0KQ==",
            "Events": null,
            "Log": "msg:0,success:true,log:,events:[]\nmsg:1,success:true,log:,events:[]\nmsg:2,success:true,log:,events:[]\nmsg:3,success:true,log:,events:[]\nmsg:4,success:true,log:,events:[]",
            "Info": ""
          },
          "GasWanted": "2000000",
          "GasUsed": "168550"
        }
      ],
      "end_block": {
        "ResponseBase": {
          "Error": null,
          "Data": null,
          "Events": null,
          "Log": "",
          "Info": ""
        },
        "ValidatorUpdates": null,
        "ConsensusParams": null,
        "Events": null
      },
      "begin_block": {
        "ResponseBase": {
          "Error": null,
          "Data": null,
          "Events": null,
          "Log": "",
          "Info": ""
        }
      }
    }
  }
}

decoded data

("2" string)("3" string)
("4" string)
(5 uint64)

Problem

  1. unable to identify which msg(i.e which function) returned which response

Proposed solution

  1. return response with array
[ [], [("1" string),("2" string)], [], [("3" string),("4" string),(5 uint64)] ]
  1. return response with certain identifier(for example, use \n\n) // doesn't like it looks bit dirty
\n\n("1" string)\n("2" string)\n\n\n\n("3" string)\n("4" string)\n(5 uint64)\n\n

r3v4s avatar May 08 '24 07:05 r3v4s