rooch-network / rooch

VApp Container with Move Language
https://rooch.network
Apache License 2.0
134 stars 60 forks source link

[rpc] queryObjectStates response bug #1752

Closed jolestar closed 4 weeks ago

jolestar commented 1 month ago

The response Object's value repeats the ObjectEntity.

rooch rpc request --method rooch_queryO
bjectStates --params '[{"object_type":"0x3::coin::CoinInfo"}, null, "10", {"descending": true,"showDisplay":false}]'
{
  "data": [
    {
      "object_id": "0xf81628c3bf85c3fc628f29a3739365d4428101fbbecca0dcc7e3851f34faea6b",
      "owner": "rooch1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpsd68l8x",
      "flag": 0,
      "value": {
        "abilities": 0,
        "type": "0x2::object::ObjectEntity<0x3::coin::CoinInfo<0x3::gas_coin::GasCoin>>",
        "value": {
          "flag": 0,
          "id": "0xf81628c3bf85c3fc628f29a3739365d4428101fbbecca0dcc7e3851f34faea6b",
          "owner": "0x0000000000000000000000000000000000000000000000000000000000000003",
          "size": "0",
          "state_root": "0x5350415253455f4d45524b4c455f504c414345484f4c4445525f484153480000",
          "value": {
            "abilities": 12,
            "type": "0x3::coin::CoinInfo<0x3::gas_coin::GasCoin>",
            "value": {
              "coin_type": "0000000000000000000000000000000000000000000000000000000000000003::gas_coin::GasCoin",
              "decimals": 8,
              "name": "Rooch Gas Coin",
              "supply": "101000000000000",
              "symbol": "RGC"
            }
          }
        }
      },
      "object_type": "0x3::coin::CoinInfo",
      "state_root": "0x5350415253455f4d45524b4c455f504c414345484f4c4445525f484153480000",
      "size": 0,
      "tx_order": 2,
      "state_index": 4,
      "created_at": 0,
      "updated_at": 0,
      "display_fields": null
    }
  ],
  "next_cursor": {
    "tx_order": 2,
    "state_index": 4
  },
  "has_next_page": false
}
pause125 commented 4 weeks ago

Another bug:

  1. run command: rooch move publish -p examples/display/ --named-addresses display=default
  2. then query:
    {
    "id":101,
    "jsonrpc":"2.0",
    "method":"rooch_queryObjectStates",
    "params":[
    {"object_id":["0x2214495c6abca5dd5a2bf0f2a28a74541ff10c89818a1244af24c4874325ebdb"]},
     null, "1", {"descending": true,"showDisplay":false}]
    }

    The output state_root is not consistent:

{
    "jsonrpc": "2.0",
    "result": {
        "data": [
            {
                "object_id": "0x2214495c6abca5dd5a2bf0f2a28a74541ff10c89818a1244af24c4874325ebdb",
                "owner": "rooch1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqcm08j4",
                "flag": 1,
                "value": {
                    "abilities": 0,
                    "type": "0x2::object::ObjectEntity<0x2::module_store::ModuleStore>",
                    "value": {
                        "flag": 1,
                        "id": "0x2214495c6abca5dd5a2bf0f2a28a74541ff10c89818a1244af24c4874325ebdb",
                        "owner": "0x0000000000000000000000000000000000000000000000000000000000000002",
                        "size": "6",
                        "state_root": "0x09eb5df9aae38fd51bc02ab5aab6995ee51eeecd1a0fa7c1fd333bd4678f9a70",
                        "value": {
                            "abilities": 8,
                            "type": "0x2::module_store::ModuleStore",
                            "value": {
                                "dummy_field": false
                            }
                        }
                    }
                },
                "object_type": "0x2::module_store::ModuleStore",
                "state_root": "0x212450168562019bb6566c9f6790dbc84ff83c52f6c900d253331fc1d2533d15",
                "size": 6,
                "tx_order": 1,
                "state_index": 1,
                "created_at": 0,
                "updated_at": 0,
                "display_fields": null
            }
        ],
        "next_cursor": {
            "tx_order": 1,
            "state_index": 1
        },
        "has_next_page": false
    },
    "id": 101
}
pause125 commented 4 weeks ago

Shoud owner be bech32 address?