Skip to content
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

Open
wants to merge 2 commits into
base: hex-patricia-reader
Choose a base branch
from

Conversation

shotasilagadze
Copy link
Contributor

@shotasilagadze shotasilagadze commented Feb 2, 2025

Moved proof building into hex patricia READER

@shotasilagadze shotasilagadze force-pushed the hex-patricia-reader-proof branch 5 times, most recently from 5fdba10 to 87d0d4b Compare February 2, 2025 19:58
@shotasilagadze shotasilagadze requested a review from awskii February 2, 2025 19:58
@shotasilagadze shotasilagadze force-pushed the hex-patricia-reader-proof branch 14 times, most recently from 04469c7 to 23b8ccb Compare February 4, 2025 06:14
@@ -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)
Copy link
Member

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

Copy link
Contributor Author

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?

Copy link
Contributor Author

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)
Copy link
Member

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?

Copy link
Contributor Author

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 {
Copy link
Member

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.

Copy link
Contributor Author

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.

turbo/jsonrpc/eth_call.go Outdated Show resolved Hide resolved
@shotasilagadze shotasilagadze force-pushed the hex-patricia-reader-proof branch from 23b8ccb to c53306d Compare February 4, 2025 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants