Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
serban300 committed Nov 9, 2024
1 parent 0e09ad4 commit 9467672
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ impl<H: Hasher> CacheProvider<H> {
}

impl<H: Hasher> TrieCacheProvider<H> for CacheProvider<H> {
type Cache<'a> = TrieCache<'a, H> where H: 'a;
type Cache<'a>
= TrieCache<'a, H>
where
H: 'a;

fn as_trie_db_cache(&self, storage_root: <H as Hasher>::Out) -> Self::Cache<'_> {
TrieCache {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ impl<H: Hasher> SizeOnlyRecorderProvider<H> {
}

impl<H: trie_db::Hasher> sp_trie::TrieRecorderProvider<H> for SizeOnlyRecorderProvider<H> {
type Recorder<'a> = SizeOnlyRecorder<'a, H> where H: 'a;
type Recorder<'a>
= SizeOnlyRecorder<'a, H>
where
H: 'a;

fn drain_storage_proof(self) -> Option<StorageProof> {
None
Expand Down
1 change: 1 addition & 0 deletions substrate/frame/grandpa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ where
I: Iterator<Item = (&'a T::AccountId, AuthorityId)>,
{
let authorities = validators.map(|(_, k)| (k, 1)).collect::<Vec<_>>();
log::error!("Grandpa: on_genesis_session()");
Self::initialize(authorities);
}

Expand Down
20 changes: 16 additions & 4 deletions substrate/primitives/state-machine/src/trie_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ pub trait TrieCacheProvider<H: Hasher> {

#[cfg(feature = "std")]
impl<H: Hasher> TrieCacheProvider<H> for LocalTrieCache<H> {
type Cache<'a> = TrieCache<'a, H> where H: 'a;
type Cache<'a>
= TrieCache<'a, H>
where
H: 'a;

fn as_trie_db_cache(&self, storage_root: H::Out) -> Self::Cache<'_> {
self.as_trie_db_cache(storage_root)
Expand All @@ -90,7 +93,10 @@ impl<H: Hasher> TrieCacheProvider<H> for LocalTrieCache<H> {

#[cfg(feature = "std")]
impl<H: Hasher> TrieCacheProvider<H> for &LocalTrieCache<H> {
type Cache<'a> = TrieCache<'a, H> where Self: 'a;
type Cache<'a>
= TrieCache<'a, H>
where
Self: 'a;

fn as_trie_db_cache(&self, storage_root: H::Out) -> Self::Cache<'_> {
(*self).as_trie_db_cache(storage_root)
Expand Down Expand Up @@ -139,7 +145,10 @@ impl<H: Hasher> trie_db::TrieCache<NodeCodec<H>> for UnimplementedCacheProvider<

#[cfg(not(feature = "std"))]
impl<H: Hasher> TrieCacheProvider<H> for UnimplementedCacheProvider<H> {
type Cache<'a> = UnimplementedCacheProvider<H> where H: 'a;
type Cache<'a>
= UnimplementedCacheProvider<H>
where
H: 'a;

fn as_trie_db_cache(&self, _storage_root: <H as Hasher>::Out) -> Self::Cache<'_> {
unimplemented!()
Expand Down Expand Up @@ -176,7 +185,10 @@ impl<H: Hasher> trie_db::TrieRecorder<H::Out> for UnimplementedRecorderProvider<

#[cfg(not(feature = "std"))]
impl<H: Hasher> TrieRecorderProvider<H> for UnimplementedRecorderProvider<H> {
type Recorder<'a> = UnimplementedRecorderProvider<H> where H: 'a;
type Recorder<'a>
= UnimplementedRecorderProvider<H>
where
H: 'a;

fn drain_storage_proof(self) -> Option<StorageProof> {
unimplemented!()
Expand Down
5 changes: 4 additions & 1 deletion substrate/primitives/trie/src/recorder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,10 @@ pub struct TrieRecorder<'a, H: Hasher> {
}

impl<H: Hasher> crate::TrieRecorderProvider<H> for Recorder<H> {
type Recorder<'a> = TrieRecorder<'a, H> where H: 'a;
type Recorder<'a>
= TrieRecorder<'a, H>
where
H: 'a;

fn drain_storage_proof(self) -> Option<StorageProof> {
Some(Recorder::drain_storage_proof(self))
Expand Down

0 comments on commit 9467672

Please sign in to comment.