Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Remove unused parent_hash in `OverlayedChanges::into_storage_change…
Browse files Browse the repository at this point in the history
  • Loading branch information
liuchengxu authored Mar 10, 2022
1 parent 3d9361d commit f5f286d
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 13 deletions.
1 change: 0 additions & 1 deletion primitives/api/proc-macro/src/impl_runtime_apis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ fn generate_runtime_api_base_structures() -> Result<TokenStream> {

self.changes.replace(Default::default()).into_storage_changes(
backend,
parent_hash,
self.storage_transaction_cache.replace(Default::default()),
state_version,
)
Expand Down
8 changes: 1 addition & 7 deletions primitives/state-machine/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,6 @@ where
self.overlay
.drain_storage_changes(
self.backend,
Default::default(),
self.storage_transaction_cache,
Default::default(), // using any state
)
Expand All @@ -680,12 +679,7 @@ where
}
let changes = self
.overlay
.drain_storage_changes(
self.backend,
Default::default(),
self.storage_transaction_cache,
state_version,
)
.drain_storage_changes(self.backend, self.storage_transaction_cache, state_version)
.expect(EXT_NOT_ALLOWED_TO_FAIL);
self.backend
.commit(
Expand Down
4 changes: 1 addition & 3 deletions primitives/state-machine/src/overlayed_changes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,21 +500,19 @@ impl OverlayedChanges {
pub fn into_storage_changes<B: Backend<H>, H: Hasher>(
mut self,
backend: &B,
parent_hash: H::Out,
mut cache: StorageTransactionCache<B::Transaction, H>,
state_version: StateVersion,
) -> Result<StorageChanges<B::Transaction, H>, DefaultError>
where
H::Out: Ord + Encode + 'static,
{
self.drain_storage_changes(backend, parent_hash, &mut cache, state_version)
self.drain_storage_changes(backend, &mut cache, state_version)
}

/// Drain all changes into a [`StorageChanges`] instance. Leave empty overlay in place.
pub fn drain_storage_changes<B: Backend<H>, H: Hasher>(
&mut self,
backend: &B,
_parent_hash: H::Out,
mut cache: &mut StorageTransactionCache<B::Transaction, H>,
state_version: StateVersion,
) -> Result<StorageChanges<B::Transaction, H>, DefaultError>
Expand Down
1 change: 0 additions & 1 deletion primitives/state-machine/src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ where
pub fn commit_all(&mut self) -> Result<(), String> {
let changes = self.overlay.drain_storage_changes::<_, _>(
&self.backend,
Default::default(),
&mut Default::default(),
self.state_version,
)?;
Expand Down
1 change: 0 additions & 1 deletion utils/frame/try-runtime/cli/src/commands/follow_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ where
let storage_changes = changes
.drain_storage_changes(
&state_ext.backend,
Default::default(),
&mut Default::default(),
// Note that in case a block contains a runtime upgrade,
// state version could potentially be incorrect here,
Expand Down

0 comments on commit f5f286d

Please sign in to comment.