NethermindEth / juno

Starknet client implementation.
https://juno.nethermind.io
Apache License 2.0
401 stars 170 forks source link

RPC08 - starknet_getStorageProof #2180

Open kirugan opened 1 month ago

kirugan commented 1 month ago

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

estherbreath commented 1 month ago

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

kirugan commented 1 month ago

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

pnowosie commented 1 month ago

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

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"
        },
      }
    }
  }