juno icon indicating copy to clipboard operation
juno copied to clipboard

RPC08 - starknet_getStorageProof

Open kirugan opened this issue 1 year ago • 3 comments

Specification - https://github.com/starkware-libs/starknet-specs/blob/v0.8.0-rc0/api/starknet_api_openrpc.json#L910

Changes in PR https://github.com/starkware-libs/starknet-specs/pull/232

kirugan avatar Sep 25 '24 11:09 kirugan

@kirugan I am a smart contract and a full stack developer. I would like to handle this issue, please

estherbreath avatar Sep 27 '24 13:09 estherbreath

@estherbreath please consider other issues to implement. This one will be covered by someone from our team.

kirugan avatar Oct 02 '24 12:10 kirugan

In my opinion this method should be defined better or the result maybe be meaningless What is a problem?

TL;DR

Inclusion proofs are linked with a particular state and info about the state is missing in the response

Problem description

  • It requests inclusion proofs to some of the leaves of [class / contract /...] trie but don't specify the state anyhow which assumes current head's state
  • it receives the merkle paths (the inclusion proof) which is strictly linked to some state hence the block, global storage commitment, but there is no information about them.

Imagine you request some class inclusion proof and the result is merkle paths that calculates to the class trie root. Class trie root mean nothing without other informations such as: contracts trie root & global storage commitment and block id which allows to verify the proof.

Therefore I propose that juno will return these (additional to the spec) informations. The specification method's result is here.

Juno should respond with the following:

  "result": {
    "name": "result",
    "description": "The contract's nonce at the requested state",
    "schema": {
      "type": "object",
      "properties": {
        "classes_proof": {
          "$ref": "#/components/schemas/NODE_HASH_TO_NODE_MAPPING"
        },
        "contracts_proof": {
          "$ref": "#/components/schemas/NODE_HASH_TO_NODE_MAPPING"
        },
        "contracts_storage_proofs": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/NODE_HASH_TO_NODE_MAPPING"
         },

  <!-- ADDITIONAL INFORMATIONS STARTS HERE 👇 
        "block_hash": {
          "$ref": "#/components/schemas/FELT"
        },
        "global_state_root": {
          "$ref": "#/components/schemas/FELT"
        },
        "contract_trie_root": {
          "$ref": "#/components/schemas/FELT"
        },
        "class_trie_root": {
          "$ref": "#/components/schemas/FELT"
        },
      }
    }
  }

pnowosie avatar Oct 03 '24 10:10 pnowosie