-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Partial EIP1186 eth_getProof implementation #6560
Merged
Merged
Changes from 8 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
f891802
Define the eth_getProof structures in a common location which
mmontour1306 1f5e62f
Stub to return an account proof for latest block, or an error
mmontour1306 8131190
Add functions to request Proof generation, providing an AccountResult
mmontour1306 c9e3023
Stub to tell GenStructStep() that proof generation is needed
mmontour1306 4f25c28
Intercept nodes before they're hashed.
mmontour1306 a4f51ab
Implement the eth_getProof calculation.
mmontour1306 a706f7e
Merge remote-tracking branch 'upstream/devel' into mm/AccountProof
mmontour1306 a7f5e16
Rename "common" to "libcommon" to match upstream change.
mmontour1306 03256a2
Merge remote-tracking branch 'upstream/devel' into mm/AccountProof
mmontour1306 4bfe792
Merge remote-tracking branch 'upstream/devel' into mm/AccountProof
mmontour1306 4a82425
Merge remote-tracking branch 'upstream/devel' into mm/AccountProof
mmontour1306 f723867
Merge remote-tracking branch 'upstream/devel' into mm/AccountProof
mmontour1306 7291c46
Merge remote-tracking branch 'upstream/devel' into mm/AccountProof
mmontour1306 646a9a9
Merge remote-tracking branch 'upstream/devel' into mm/AccountProof
mmontour1306 87df787
Move the code to populate the Account fields of the proof response
mmontour1306 06ad495
Reverts the changes to the function signatures in hashbuilder.go,
mmontour1306 009a85e
Merge remote-tracking branch 'upstream/devel' into mm/AccountProof
mmontour1306 9f2e005
Merge remote-tracking branch 'upstream/devel' into mm/AccountProof
mmontour1306 10e2ef3
Merge remote-tracking branch 'upstream/devel' into mm/AccountProof
mmontour1306 ee505e8
Import "common".
mmontour1306 4f2ef0c
Clean up a couple of debug messages.
mmontour1306 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package accounts | ||
|
||
import ( | ||
libcommon "github.com/ledgerwatch/erigon-lib/common" | ||
"github.com/ledgerwatch/erigon/common/hexutil" | ||
) | ||
|
||
// Result structs for GetProof | ||
type AccProofResult struct { | ||
Address libcommon.Address `json:"address"` | ||
AccountProof []string `json:"accountProof"` | ||
Balance *hexutil.Big `json:"balance"` | ||
CodeHash libcommon.Hash `json:"codeHash"` | ||
Nonce hexutil.Uint64 `json:"nonce"` | ||
StorageHash libcommon.Hash `json:"storageHash"` | ||
StorageProof []StorProofResult `json:"storageProof"` | ||
} | ||
type StorProofResult struct { | ||
Key string `json:"key"` | ||
Value *hexutil.Big `json:"value"` | ||
Proof []string `json:"proof"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
e.TopHashes()
before/aftere.branch()
to get info which you need? (instead of introducinge.branchEx
)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'll look at it. I need the trie nodes before they are hashed and it looked like topHashes() was only giving me the output of that operation.
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.
@mmontour1306 , yes, but it has stack of nodes
HashBuilder.nodeStack
just no method likeTopNodes()
to return top of stack. Also maybe need read it before hashing, not after.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.
Anyway, not very important. I just trying to keep GenStruct step simpler. It's already complex. So, if you have any idea about it - you are welcome.
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.
In my latest version I have removed the "e.branchEx" stuff, restoring the original function signatures. Instead of passing a "doProof" flag into those functions, I have instead introduced a new function which is called ahead of time to set a flag telling hashbuilder that it should collect the proof data the next time it generates a hash (for a branch node or for the account leaf node). This is the least invasive method I can think of.
The various internal stacks do not appear to ever contain the specific data structures I need for the proof. The raw data is there and it would be possible to construct another copy of the node structure elsewhere, but this would involve duplicating a lot of the hashbuilder code in that other location. The data I need is what's fed into the hashing function inside hashbuilder as it constructs the RLP-encoded data structures.