-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: provider StateCommitment integration #11867
feat: provider StateCommitment integration #11867
Conversation
StateCommitment
integration
StateCommitment
integration871cbc7
to
cb77bce
Compare
cb77bce
to
03ea70e
Compare
27f08e0
to
6f3498c
Compare
@@ -91,6 +91,13 @@ pub trait TryIntoHistoricalStateProvider { | |||
) -> ProviderResult<StateProviderBox>; | |||
} | |||
|
|||
/// Trait implemented for database providers that can be converted into a latest state provider | |||
/// reference. | |||
pub trait ToLatestStateProviderRef { |
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.
nit: maybe AsLatestStateProviderRef
? When I read To
i thought it was consuming the tx
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 think generally we would use Into
when the tx is being consumed. I chose To
because I believe it best fits the guidelines here as there is a clone of the static_file_provider
. However, I'm not strongly opinionated and happy to change this to AsLatestStateProviderRef
.
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.
Changed to AsLatestStateProviderRef
as suggested.
4ab021d
to
a271400
Compare
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.
this looks a bit invasive, looking at #11872 (review) it appears that we only this to have access to the keyhasher,
are there more use cases where the state provider needs to directly access the State.
I assume eventually all types of the StateCommitment
must be integrated into the XStateProvider
? types?
then we def need to add the phantom type in there, so this makes sense
@@ -41,7 +41,7 @@ use std::fmt::Debug; | |||
/// - [`tables::AccountChangeSets`] | |||
/// - [`tables::StorageChangeSets`] | |||
#[derive(Debug)] | |||
pub struct HistoricalStateProviderRef<'b, TX: DbTx> { | |||
pub struct HistoricalStateProviderRef<'b, TX: DbTx, SC: StateCommitment> { |
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.
this additional generic looks weird to me, because we only use it to capture the type
Yes the idea is that all types of |
a271400
to
133614d
Compare
superseded by #12602 |
Dependencies
This PR builds on #11842 and as such it should be reviewed after #11842 has been merged.
Overview
This PR introduces the
StateCommitment
type inStateProviders
such that the type can be used for state commitment operations. In this PR we do not utilise the types for state commitment operations, that will be implemented in follow up PR's.ToLatestStateProviderRef
traitWe introduce
ToLatestStateProviderRef
trait and implement it onDatabaseProvider
such that we can instantiate aLatestStateProviderRef
from aDatabaseProvider
without leakingStateCommitment
type data. We update components that instantiateLatestStateProviderRef
objects from aDatabaseProvider
to leverage this trait.supports: #11830