mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-11-03 09:21:08 +00:00
Fetch runtime code from storage cache when using proofing backend (#9611)
Before we fetched the runtime code from the `TrieBackend` and this lead to not using the storage cache. Thus, we recalculated the storage hash for the runtime code on every call into the runtime and this killed the performance on parachains block authoring. The solution is to fetch the runtime code from the storage cache, to make sure we use the cached storage cache.
This commit is contained in:
1 parent
ac9c3259bf
commit
30ce8bbc8c
11 files changed
+31
-41
No files matched your search
@@ -454,12 +454,6 @@ impl<B: BlockT> StateBackend<HashFor<B>> for BenchmarkingState<B> {
|
||||
.map_or(Default::default(), |s| s.child_keys(child_info, prefix))
|
||||
}
|
||||
|
||||
fn as_trie_backend(
|
||||
&mut self,
|
||||
) -> Option<&sp_state_machine::TrieBackend<Self::TrieBackendStorage, HashFor<B>>> {
|
||||
None
|
||||
}
|
||||
|
||||
fn commit(
|
||||
&self,
|
||||
storage_root: <HashFor<B> as Hasher>::Out,
|
||||
|
||||
@@ -274,7 +274,7 @@ impl<B: BlockT> StateBackend<HashFor<B>> for RefTrackingState<B> {
|
||||
}
|
||||
|
||||
fn as_trie_backend(
|
||||
&mut self,
|
||||
&self,
|
||||
) -> Option<&sp_state_machine::TrieBackend<Self::TrieBackendStorage, HashFor<B>>> {
|
||||
self.state.as_trie_backend()
|
||||
}
|
||||
|
||||
@@ -703,7 +703,7 @@ impl<S: StateBackend<HashFor<B>>, B: BlockT> StateBackend<HashFor<B>> for Cachin
|
||||
self.state.child_keys(child_info, prefix)
|
||||
}
|
||||
|
||||
fn as_trie_backend(&mut self) -> Option<&TrieBackend<Self::TrieBackendStorage, HashFor<B>>> {
|
||||
fn as_trie_backend(&self) -> Option<&TrieBackend<Self::TrieBackendStorage, HashFor<B>>> {
|
||||
self.state.as_trie_backend()
|
||||
}
|
||||
|
||||
@@ -901,9 +901,9 @@ impl<S: StateBackend<HashFor<B>>, B: BlockT> StateBackend<HashFor<B>>
|
||||
self.caching_state().child_keys(child_info, prefix)
|
||||
}
|
||||
|
||||
fn as_trie_backend(&mut self) -> Option<&TrieBackend<Self::TrieBackendStorage, HashFor<B>>> {
|
||||
fn as_trie_backend(&self) -> Option<&TrieBackend<Self::TrieBackendStorage, HashFor<B>>> {
|
||||
self.caching_state
|
||||
.as_mut()
|
||||
.as_ref()
|
||||
.expect("`caching_state` is valid for the lifetime of the object; qed")
|
||||
.as_trie_backend()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user