Skip to content

Commit

Permalink
chore(polkadot): upgrade to v1.2.0 (#905)
Browse files Browse the repository at this point in the history
  • Loading branch information
renauter committed Sep 4, 2024
1 parent 84b713d commit 85a8974
Show file tree
Hide file tree
Showing 9 changed files with 296 additions and 264 deletions.
298 changes: 147 additions & 151 deletions substrate-node/Cargo.lock

Large diffs are not rendered by default.

144 changes: 73 additions & 71 deletions substrate-node/Cargo.toml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion substrate-node/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ pub fn run() -> sc_cli::Result<()> {
}
#[cfg(feature = "try-runtime")]
Some(Subcommand::TryRuntime) => Err(try_runtime_cli::DEPRECATION_NOTICE.into()),

#[cfg(not(feature = "try-runtime"))]
Some(Subcommand::TryRuntime) => Err("TryRuntime wasn't enabled when building the node. \
You can enable it with `--features try-runtime`."
Expand Down
1 change: 1 addition & 0 deletions substrate-node/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
import_queue,
block_announce_validator_builder: None,
warp_sync_params: Some(WarpSyncParams::WithProvider(warp_sync)),
block_relay: None,
})?;

if config.offchain_worker.enabled {
Expand Down
4 changes: 2 additions & 2 deletions substrate-node/pallets/pallet-smart-contract/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ pub const EXISTENTIAL_DEPOSIT: u64 = 500;
parameter_types! {
pub const MaxLocks: u32 = 50;
pub const MaxReserves: u32 = 50;
pub const ExistentialDepositBalance: u64 = EXISTENTIAL_DEPOSIT;
pub const ExistentialDeposit: u64 = EXISTENTIAL_DEPOSIT;
}

impl pallet_balances::Config for TestRuntime {
Expand All @@ -162,7 +162,7 @@ impl pallet_balances::Config for TestRuntime {
/// The ubiquitous event type.
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDepositBalance;
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = pallet_balances::weights::SubstrateWeight<TestRuntime>;
type FreezeIdentifier = ();
Expand Down
86 changes: 53 additions & 33 deletions substrate-node/pallets/pallet-smart-contract/src/tests.rs

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions substrate-node/pallets/pallet-tft-bridge/src/migrations/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ impl<T: Config> OnRuntimeUpgrade for MigrateBurnTransactionsV2<T> {
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> {
info!("current pallet version: {:?}", PalletVersion::<T>::get());
if PalletVersion::<T>::get() != types::StorageVersion::V1 {
return Ok(Vec::<u8>::new());
}
ensure!(
PalletVersion::<T>::get() >= types::StorageVersion::V1,
DispatchError::Other("Unexpected pallet version")
);

let burn_transactions_count: u64 =
migrations::types::v1::BurnTransactions::<T>::iter().count() as u64;
Expand All @@ -35,7 +36,7 @@ impl<T: Config> OnRuntimeUpgrade for MigrateBurnTransactionsV2<T> {
executed_burn_transactions_count
);

info!("👥 TFT-BRIDGE pallet to V1 passes PRE migrate checks ✅",);
info!("👥 TFT-BRIDGE pallet to V2 passes PRE migrate checks ✅",);
Ok(Vec::<u8>::new())
}

Expand All @@ -54,7 +55,7 @@ impl<T: Config> OnRuntimeUpgrade for MigrateBurnTransactionsV2<T> {
) -> Result<(), sp_runtime::TryRuntimeError> {
info!("current pallet version: {:?}", PalletVersion::<T>::get());
ensure!(
PalletVersion::<T>::get() == types::StorageVersion::V2,
PalletVersion::<T>::get() >= types::StorageVersion::V2,
DispatchError::Other("Unexpected pallet version")
);

Expand Down
4 changes: 3 additions & 1 deletion substrate-node/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ version.workspace = true
targets = ["x86_64-unknown-linux-gnu"]

[build-dependencies]
substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.1.0" }
substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.2.0" }

[dependencies]
smallvec.workspace = true
Expand Down Expand Up @@ -59,6 +59,7 @@ sp-api.workspace = true
sp-block-builder.workspace = true
sp-consensus-aura.workspace = true
sp-core.workspace = true
sp-genesis-builder.workspace = true
sp-inherents.workspace = true
sp-offchain.workspace = true
sp-runtime.workspace = true
Expand Down Expand Up @@ -99,6 +100,7 @@ std = [
"sp-block-builder/std",
"sp-consensus-aura/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-offchain/std",
"sp-runtime/std",
Expand Down
11 changes: 11 additions & 0 deletions substrate-node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ use tfchain_support::{
types::PublicIP,
};

use frame_support::genesis_builder_helper::{build_config, create_default_config};
// A few exports that help ease life for downstream crates.
pub use frame_support::{
construct_runtime, parameter_types,
Expand Down Expand Up @@ -1054,4 +1055,14 @@ impl_runtime_apis! {
Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap()
}
}

impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
fn create_default_config() -> Vec<u8> {
create_default_config::<RuntimeGenesisConfig>()
}

fn build_config(config: Vec<u8>) -> sp_genesis_builder::Result {
build_config::<RuntimeGenesisConfig>(config)
}
}
}

0 comments on commit 85a8974

Please sign in to comment.