-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Starknet's getStorageProof
rpc method
#2194
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2194 +/- ##
==========================================
+ Coverage 74.38% 74.53% +0.15%
==========================================
Files 109 111 +2
Lines 11493 11747 +254
==========================================
+ Hits 8549 8756 +207
- Misses 2278 2318 +40
- Partials 666 673 +7 ☔ View full report in Codecov by Sentry. |
301250f
to
d383531
Compare
1ef09de
to
a33464e
Compare
b292454
to
1e50ea2
Compare
f9089bc
to
f3ded4a
Compare
45a589f
to
7252e10
Compare
Differences / Issues spotted comparing with PF1. Params are not optional (why?)Request
Response 2. Response does not filter out duplicate nodes in hash HashToNode mappingRequest
Response
|
core/trie/proof.go
Outdated
proofHash := proofNode.Hash(hash) | ||
fmt.Println("Proof verification failure", "node", proofHash, "expected", expectedHash) | ||
fmt.Printf("%v\n", proofNode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove these debugging lines
core/trie/proof.go
Outdated
@@ -345,7 +348,8 @@ func VerifyProof(root *felt.Felt, key *Key, value *felt.Felt, proofs []ProofNode | |||
return true | |||
} | |||
|
|||
if !proofNode.Path.Equal(subKey) { | |||
if !proofNode.Path.Equal(subKey) && !subKey.Equal(&Key{}) { | |||
fmt.Println("Proof verification failure", "node", proofNode.Path, "expected", subKey) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove these debugging lines
core/trie/key.go
Outdated
if n == k.len { | ||
return &Key{}, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this check needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a bug in proof-verification here in the test:
Line 166 in 7252e10
require.True(t, trie.VerifyProof(root, &kKey, value, proof, tempTrie.HashFunc())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, that actually doesn't fix the other test cases. It'll be clearer in my VerifyProof
implementation.
So there are 2 approaches we can take:
For the 1st approach, we can agree on the architecture such that a Blockchain For the 2nd approach, the architecture makes sense, the issue is that we have an unsupported feature for historical trie access. It's unsure when we will support historical trie access as it's a huge refactor on the state, trie and db modules. I'd rather go with an unsupported feature and detect it early rather than incur technical debts and make the modules even more coupled and harder to refactor. |
7252e10
to
5200b6d
Compare
getStorageProof
rpc method
e0e6727
to
59ca331
Compare
72d964e
to
82cf7a9
Compare
3af5c47
to
084e874
Compare
aa5534a
to
bef9818
Compare
1b2ed80
to
5df78c4
Compare
5df78c4
to
d4b65b1
Compare
Fixes #2180
Tests are based on proof-refactor PR