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

Invert provider access in SparseTrie #14646

Open
Rjected opened this issue Feb 21, 2025 · 3 comments · May be fixed by #14662
Open

Invert provider access in SparseTrie #14646

Rjected opened this issue Feb 21, 2025 · 3 comments · May be fixed by #14662
Assignees
Labels
A-db Related to the database A-trie Related to Merkle Patricia Trie implementation C-enhancement New feature or request

Comments

@Rjected
Copy link
Member

Rjected commented Feb 21, 2025

Right now the SparseTrie takes ownership over a provider, this is used only in reveal / update methods:

/// Blinded node provider.
provider: P,

This is what causes our issues when we try to operate over many storage tries in parallel, the provider under the hood is a tx which gets shared.

This is used in two places:

self.provider.blinded_node(&current)?

self.provider.blinded_node(&child_path)?

Owning the provider is partially for type safety, so that we can give a BlindedProviderFactory to the SparseStateTrie, and have it make sure storage tries are operating over storage tables, but this means we do not have control over where / when database txs are created. If we really needed this type safety, we could probably solve it with some phantomdatas?

We could instead invert provider access, requiring these methods to take in a provider as an argument.

@Rjected Rjected added A-db Related to the database A-trie Related to Merkle Patricia Trie implementation C-enhancement New feature or request labels Feb 21, 2025
@frankudoags
Copy link
Contributor

I'd love to work on this @Rjected

@PoulavBhowmick03
Copy link
Contributor

I have been working on this, implemented the provider as argument. a few stuffs to get cleared on the inverting part. Can I be assigned to this?

@stfnberat
Copy link
Contributor

@Rjected can I do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-db Related to the database A-trie Related to Merkle Patricia Trie implementation C-enhancement New feature or request
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

4 participants