NethermindEth / juno

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

Perform impact analysis of juno_getContractStorageProof method #1946

Closed wojciechos closed 6 days ago

wojciechos commented 1 month ago

Add method similar to pathfinder one to get proof:


"name": "pathfinder_getProof",
"summary": "Returns merkle proofs of a contract's storage state",
"description": "This method returns merkle proofs for a contract's storage. This allows you to verify a contract's state for a specific Starknet block."
rianhughes commented 1 month ago

Context Pathfinder has implemented a pathfinder_getProof endpoint, that lets anyone retrieve a merkle proof for the contract storage trie given (contract address, key, block id). Pathfinder can serve this data for any historical state. Kakarot have asked the Juno team if they plan to support such a method as well, as they want to implement a modified version of eth_getProof.

Impact on Juno To support this method Juno would need to be able to generate merkle-proofs for the contract storage trie at any point in history. Juno can retrieve historical values of the trie at any point, but not the entire historical trie. Also, given a trie, Juno does have logic to generate the merkle-proofs. So the main task would be to implement some logic to generate the entire historical contract storage trie at any point. Once we have this, we can generate proofs for the trie, and expose it over rpc.

Other factors to consider There is no agreed upon spec for this endpoint, which might cause issues if users expect consistent behaviour between the different clients. Juno would presumably use pathfinders endpoint as a reference, but pathfinder are planning to make significant modifications to their pathfinder_getProof endpoint. An agreed upon spec would also be useful here. This will overlap with the Snapsync feature, since it will need to serve historical contract storage tries.

stranger80 commented 6 days ago

Equivelant method being added to RPC v0.8.0. Closing this issue.