-
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
Hex patricia reader proof #13660
base: hex-patricia-reader
Are you sure you want to change the base?
Hex patricia reader proof #13660
Conversation
5fdba10
to
87d0d4b
Compare
04469c7
to
23b8ccb
Compare
@@ -134,7 +135,7 @@ func NewSharedDomains(tx kv.Tx, logger log.Logger) (*SharedDomains, error) { | |||
} | |||
|
|||
sd.SetTxNum(0) | |||
sd.sdCtx = NewSharedDomainsCommitmentContext(sd, commitment.ModeDirect, commitment.VariantHexPatriciaTrie) | |||
sd.sdCtx = NewSharedDomainsCommitmentContext(sd, commitment.ModeDirect) |
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.
get back option, very soon we will introduce more trie variants
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.
Ok, but based on that option what do I do? I initialise both of the trie types now. How would I use that option? Or should I leave it unused but as one of the available function parameters?
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.
That's the part I was asking. I'm not sure which design would be better. So, if I'm initialising both hex patricia tries then when or in which parameter do I initialise bin trie if passed? 🤔
return rootHash, err | ||
} | ||
|
||
// data accessing functions should be set when domain is opened/shared context updated | ||
sdc.patriciaTrie.SetTrace(sdc.sharedDomains.trace) | ||
sdc.commitmentPatriciaTrie.SetTrace(sdc.sharedDomains.trace) |
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.
its already CommitmentContext, why introduce commitmentPatriciaTrie?
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.
To differentiate. So, now I have two trie structures there. One is commitmentPatriciaTrie
used for commitment building and another proofPatriciaTrie
for just building proofs.
@@ -1434,9 +1465,6 @@ func _decodeTxBlockNums(v []byte) (txNum, blockNum uint64) { | |||
// LatestCommitmentState searches for last encoded state for CommitmentContext. | |||
// Found value does not become current state. | |||
func (sdc *SharedDomainsCommitmentContext) LatestCommitmentState() (blockNum, txNum uint64, state []byte, err error) { | |||
if sdc.patriciaTrie.Variant() != commitment.VariantHexPatriciaTrie { |
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.
|| != commitment.VariantHexPatriciaTrieReader`, eg if binary is given. check needed to happen anyway. for now LatestCommitmentState is supported only for hex patricia but with time support will expand.
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.
The thing is, I never have another type initialised. I only have hex patricia tries as explained above.
23b8ccb
to
c53306d
Compare
Moved proof building into hex patricia READER