Skip to content

Commit 4d3df7f

Browse files
committed
Fix API breakage from polkadot-sdk bump
- Replace sp_core::twox_128 imports with sp_crypto_hashing::twox_128 - Pass TryPendingCode::No to BackendRuntimeCode::new (new required arg)
1 parent ee071d5 commit 4d3df7f

5 files changed

Lines changed: 18 additions & 7 deletions

File tree

core/src/commands/on_runtime_upgrade/mbms.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ use std::{fmt::Debug, ops::DerefMut, str::FromStr, sync::Arc, time::Duration};
33
use log::Level;
44
use parity_scale_codec::{Codec, Encode};
55
use sc_executor::sp_wasm_interface::HostFunctions;
6-
use sp_core::{twox_128, Hasher, H256};
6+
use sp_core::{Hasher, H256};
7+
use sp_crypto_hashing::twox_128;
78
use sp_runtime::{
89
traits::{Block as BlockT, NumberFor},
910
DeserializeOwned, ExtrinsicInclusionMode,

core/src/commands/on_runtime_upgrade/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ use frame_try_runtime::UpgradeCheckSelect;
2525
use log::Level;
2626
use parity_scale_codec::Encode;
2727
use sc_executor::sp_wasm_interface::HostFunctions;
28-
use sp_core::{hexdisplay::HexDisplay, twox_128, Hasher, H256};
28+
use sp_core::{hexdisplay::HexDisplay, Hasher, H256};
29+
use sp_crypto_hashing::twox_128;
2930
use sp_runtime::{
3031
traits::{Block as BlockT, HashingFor, NumberFor},
3132
DeserializeOwned,

core/src/common/empty_block/inherents/custom_idps/para_parachain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use std::{ops::DerefMut, sync::Arc};
2323
use parity_scale_codec::{Decode, Encode};
2424
use polkadot_primitives::HeadData;
2525
use sp_consensus_babe::SlotDuration;
26-
use sp_core::twox_128;
26+
use sp_crypto_hashing::twox_128;
2727
use sp_inherents::InherentIdentifier;
2828
use sp_runtime::traits::{Block as BlockT, HashingFor};
2929
use sp_state_machine::TestExternalities;

core/src/common/empty_block/inherents/pre_apply.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818
use cumulus_primitives_parachain_inherent::MessageQueueChain;
1919
use parity_scale_codec::Encode;
20-
use sp_core::{twox_128, H256};
20+
use sp_core::H256;
21+
use sp_crypto_hashing::twox_128;
2122
use sp_runtime::traits::{Block as BlockT, HashingFor};
2223
use sp_state_machine::TestExternalities;
2324

core/src/common/state.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ use sc_executor::{
2727
};
2828
use sp_api::{CallContext, StorageProof};
2929
use sp_core::{
30-
hexdisplay::HexDisplay, storage::well_known_keys, traits::ReadRuntimeVersion, twox_128, Hasher,
30+
hexdisplay::HexDisplay, storage::well_known_keys, traits::ReadRuntimeVersion, Hasher,
3131
};
32+
use sp_crypto_hashing::twox_128;
3233
use sp_externalities::Extensions;
3334
use sp_runtime::{
3435
traits::{BlakeTwo256, Block as BlockT, HashingFor, Header as HeaderT},
@@ -382,7 +383,11 @@ pub(crate) fn state_machine_call<Block: BlockT, HostFns: HostFunctions>(
382383
method,
383384
data,
384385
&mut extensions,
385-
&sp_state_machine::backend::BackendRuntimeCode::new(&ext.backend).runtime_code()?,
386+
&sp_state_machine::backend::BackendRuntimeCode::new(
387+
&ext.backend,
388+
sp_state_machine::backend::TryPendingCode::No,
389+
)
390+
.runtime_code()?,
386391
CallContext::Offchain,
387392
)
388393
.execute()
@@ -405,7 +410,10 @@ pub(crate) fn state_machine_call_with_proof<Block: BlockT, HostFns: HostFunction
405410
mut extensions: Extensions,
406411
maybe_export_proof: Option<PathBuf>,
407412
) -> sc_cli::Result<(StorageProof, Vec<u8>)> {
408-
let runtime_code_backend = sp_state_machine::backend::BackendRuntimeCode::new(&ext.backend);
413+
let runtime_code_backend = sp_state_machine::backend::BackendRuntimeCode::new(
414+
&ext.backend,
415+
sp_state_machine::backend::TryPendingCode::No,
416+
);
409417
let proving_backend = TrieBackendBuilder::wrap(&ext.backend)
410418
.with_recorder(Default::default())
411419
.build();

0 commit comments

Comments
 (0)