Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2eff08b
refactor: :art: moved runtime apis into their own file
TDemeco Sep 27, 2024
303feb3
fix: :arrow_up: fix upgrade to polkadot-sdk v1.10.0
TDemeco Sep 27, 2024
e5ba5bd
Merge branch 'main' into update/polkadot-sdk-1.10.0
TDemeco Sep 27, 2024
3e4328d
fix: :bug: add removed runtime api `get_worst_case_scenario_slashable…
TDemeco Sep 27, 2024
3605611
fix: :bug: add missing generic in storage providers runtime api
TDemeco Sep 27, 2024
3659377
chore: :label: run typegen
TDemeco Sep 27, 2024
c1219f1
style: :rotating_light: run cargo fmt
TDemeco Sep 27, 2024
5ac0258
fix: :art: fix cargo clippy
TDemeco Sep 28, 2024
e82a113
Merge branch 'main' into update/polkadot-sdk-1.10.0
TDemeco Sep 28, 2024
91ae601
fix: :ambulance: fix mocked relay chain randomness
TDemeco Sep 28, 2024
97c0b64
style: :rotating_light: run cargo fmt
TDemeco Sep 28, 2024
787d1df
chore: :rotating_light: temporary remove unused import (until v1.13.0)
TDemeco Sep 28, 2024
9653a4e
Merge branch 'main' into update/polkadot-sdk-1.10.0
TDemeco Sep 28, 2024
6fb8bd4
fix: :adhesive_bandage: update `query_earliest_file_volunteer_tick` r…
TDemeco Sep 28, 2024
cde6b90
fix: :ambulance: fix issues with merge from main
TDemeco Sep 28, 2024
570e548
style: :rotating_light: run cargo fmt
TDemeco Sep 28, 2024
9bb33cc
feat: :package: initial update to polkadot sdk v1.11.0
TDemeco Sep 30, 2024
e28f09b
feat: :arrow_up: finish upgrade to polkadot sdk v1.11.0
TDemeco Sep 30, 2024
2947b01
Merge branch 'main' into update/polkadot-sdk-1.10.0
TDemeco Sep 30, 2024
5c07140
chore: :label: run typegen
TDemeco Sep 30, 2024
f86f2c1
Merge branch 'update/polkadot-sdk-1.10.0' into update/polkadot-sdk-1.…
TDemeco Sep 30, 2024
f4964fc
chore: :label: run typegen
TDemeco Sep 30, 2024
f85735d
fix: :white_check_mark: fix node tests after rebenchmark of balances …
TDemeco Oct 1, 2024
b7090b5
feat: :arrow_up: update to Polkadot SDK v1.12.0
TDemeco Oct 3, 2024
889fa3c
feat: :arrow_up: update to Polkadot SDK v1.13.0
TDemeco Oct 4, 2024
9587713
fix: :arrow_up: finish upgrading to Polkadot SDK v1.13.0
TDemeco Oct 4, 2024
6bde3e8
Merge branch 'main' into update/polkadot-sdk-1.12.0
TDemeco Oct 4, 2024
d697a9b
merge 'main' into 'update/polkadot-sdk-1.12.0'
TDemeco Oct 4, 2024
22cf3ab
fix: :adhesive_bandage: fix merge from main
TDemeco Oct 4, 2024
a44a169
chore: :rotating_light: run pnpm fmt:fix
TDemeco Oct 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: 📦 initial update to polkadot sdk v1.11.0
  • Loading branch information
TDemeco committed Sep 30, 2024
commit 9bb33cc14a99c792124ce01c7ef8b4f87700d6e8
3,205 changes: 1,556 additions & 1,649 deletions Cargo.lock

Large diffs are not rendered by default.

194 changes: 97 additions & 97 deletions Cargo.toml

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ pub enum Subcommand {
/// The pallet benchmarking moved to the `pallet` sub-command.
#[command(subcommand)]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),

/// Try-runtime has migrated to a standalone
/// [CLI](<https://github.com/paritytech/try-runtime-cli>). The subcommand exists as a stub and
/// deprecation notice. It will be removed entirely some time after January 2024.
TryRuntime,
}

#[derive(ValueEnum, Clone, Debug)]
Expand Down
11 changes: 1 addition & 10 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use sc_cli::{
NetworkParams, Result, SharedParams, SubstrateCli,
};
use sc_service::config::{BasePath, PrometheusConfig};
use sp_runtime::traits::AccountIdConversion;
use storage_hub_runtime::{Block, StorageDataUnit};

use crate::{
Expand Down Expand Up @@ -212,7 +211,7 @@ pub fn run() -> Result<()> {
match cmd {
BenchmarkCmd::Pallet(cmd) =>
if cfg!(feature = "runtime-benchmarks") {
runner.sync_run(|config| cmd.run::<sp_runtime::traits::HashingFor<Block>, ReclaimHostFunctions>(config))
runner.sync_run(|config| cmd.run_with_spec::<sp_runtime::traits::HashingFor<Block>, ReclaimHostFunctions>(Some(config.chain_spec)))
} else {
Err("Benchmarking wasn't enabled when building the node. \
You can enable it with `--features runtime-benchmarks`."
Expand Down Expand Up @@ -245,7 +244,6 @@ pub fn run() -> Result<()> {
_ => Err("Benchmarking sub-command unsupported".into()),
}
},
Some(Subcommand::TryRuntime) => Err("The `try-runtime` subcommand has been migrated to a standalone CLI (https://github.com/paritytech/try-runtime-cli). It is no longer being maintained here and will be removed entirely some time after January 2024. Please remove this subcommand from your runtime and use the standalone CLI.".into()),
None => {
let runner = cli.create_runner(&cli.run.normalize())?;
let provider_options = if cli.provider_config.provider {
Expand Down Expand Up @@ -291,19 +289,12 @@ pub fn run() -> Result<()> {
[RelayChainCli::executable_name()].iter().chain(cli.relay_chain_args.iter()),
);

let parachain_account =
AccountIdConversion::<polkadot_primitives::AccountId>::into_account_truncating(
&id,
);

let tokio_handle = config.tokio_handle.clone();

let polkadot_config =
SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle)
.map_err(|err| format!("Relay chain argument error: {}", err))?;

info!("Parachain Account: {parachain_account}");

crate::service::start_parachain_node(
config,
polkadot_config,
Expand Down
50 changes: 23 additions & 27 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,10 @@ where
));
}

let metrics = Network::register_notification_metrics(
config.prometheus_config.as_ref().map(|cfg| &cfg.registry),
);

let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) =
sc_service::build_network(sc_service::BuildNetworkParams {
config: &config,
Expand All @@ -375,6 +379,7 @@ where
block_announce_validator_builder: None,
warp_sync_params: None,
block_relay: None,
metrics,
})?;

if config.offchain_worker.enabled {
Expand Down Expand Up @@ -923,34 +928,25 @@ fn build_import_queue(
config: &Configuration,
telemetry: Option<TelemetryHandle>,
task_manager: &TaskManager,
) -> Result<sc_consensus::DefaultImportQueue<Block>, sc_service::Error> {
let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;

Ok(
cumulus_client_consensus_aura::equivocation_import_queue::fully_verifying_import_queue::<
sp_consensus_aura::sr25519::AuthorityPair,
_,
_,
_,
_,
>(
client,
block_import,
move |_, _| async move {
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();

let slot = sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
*timestamp,
slot_duration,
);
) -> sc_consensus::DefaultImportQueue<Block> {
cumulus_client_consensus_aura::equivocation_import_queue::fully_verifying_import_queue::<
sp_consensus_aura::sr25519::AuthorityPair,
_,
_,
_,
_,
>(
client,
block_import,
move |_, _| async move {
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();

Ok((slot, timestamp))
},
slot_duration,
&task_manager.spawn_essential_handle(),
config.prometheus_registry(),
telemetry,
),
Ok(timestamp)
},
slot_duration,
&task_manager.spawn_essential_handle(),
config.prometheus_registry(),
telemetry,
)
}

Expand Down
8 changes: 6 additions & 2 deletions pallets/file-system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ pub mod pallet {
pallet_prelude::{ValueQuery, *},
sp_runtime::traits::{CheckEqual, Convert, MaybeDisplay, SimpleBitOps},
traits::{
fungible::*,
nonfungibles_v2::{Create, Inspect as NonFungiblesInspect},
Currency,
},
Blake2_128Concat,
};
Expand Down Expand Up @@ -195,7 +195,11 @@ pub mod pallet {
>;

/// The currency mechanism, used for paying for reserves.
type Currency: Currency<Self::AccountId>;
type Currency: Inspect<Self::AccountId>
+ Mutate<Self::AccountId>
+ hold::Balanced<Self::AccountId>
+ freeze::Inspect<Self::AccountId>
+ freeze::Mutate<Self::AccountId>;

/// Registry for minted NFTs.
type Nfts: NonFungiblesInspect<Self::AccountId>
Expand Down
6 changes: 3 additions & 3 deletions pallets/file-system/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use core::cmp::max;

use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{
traits::{nonfungibles_v2::Inspect as NonFungiblesInspect, Currency, Get},
traits::{fungible::Inspect, nonfungibles_v2::Inspect as NonFungiblesInspect, Get},
BoundedVec,
};
use frame_system::pallet_prelude::BlockNumberFor;
Expand Down Expand Up @@ -275,8 +275,8 @@ pub type MaxMultiAddresses<T> =
pub type MultiAddresses<T> = BoundedVec<MultiAddress<T>, MaxMultiAddresses<T>>;

/// Alias for the `Balance` type used in the FileSystem pallet.
type BalanceOf<T> =
<<T as crate::Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
pub type BalanceOf<T> =
<<T as Config>::Currency as Inspect<<T as frame_system::Config>::AccountId>>::Balance;

/// Alias for the `CollectionId` type used in the Nfts pallet.
pub(super) type CollectionIdFor<T> = <<T as crate::Config>::Nfts as NonFungiblesInspect<
Expand Down
2 changes: 0 additions & 2 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -239,5 +239,3 @@ try-runtime = [
"shp-traits/try-runtime",
"sp-runtime/try-runtime",
]

experimental = ["pallet-aura/experimental"]
14 changes: 9 additions & 5 deletions runtime/src/apis.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::*;
use frame_support::{
genesis_builder_helper::{build_config, create_default_config},
genesis_builder_helper::{build_state, get_preset},
weights::Weight,
};
use pallet_aura::Authorities;
Expand Down Expand Up @@ -255,12 +255,16 @@ impl_runtime_apis! {
}

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

fn build_config(config: Vec<u8>) -> sp_genesis_builder::Result {
build_config::<RuntimeGenesisConfig>(config)
fn get_preset(id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
get_preset::<RuntimeGenesisConfig>(id, |_| None)
}

fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
vec![]
}
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/src/configs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ parameter_types! {

impl pallet_transaction_payment::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
type OnChargeTransaction = pallet_transaction_payment::FungibleAdapter<Balances, ()>;
type WeightToFee = WeightToFee;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
Expand Down
18 changes: 10 additions & 8 deletions runtime/src/configs/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ use polkadot_parachain_primitives::primitives::Sibling;
use polkadot_runtime_common::impls::ToAuthor;
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, DenyReserveTransferToRelayChain,
DenyThenTry, DescribeAllTerminal, DescribeFamily, EnsureXcmOrigin, FixedWeightBounds,
FrameTransactionalProcessor, FungibleAdapter, HashedDescription, IsConcrete, NativeAsset,
ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
WithComputedOrigin, WithUniqueTopic,
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowHrmpNotificationsFromRelayChain,
AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
DenyReserveTransferToRelayChain, DenyThenTry, DescribeAllTerminal, DescribeFamily,
EnsureXcmOrigin, FixedWeightBounds, FrameTransactionalProcessor, FungibleAdapter,
HashedDescription, IsConcrete, NativeAsset, ParentAsSuperuser, ParentIsPreset,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
TrailingSetTopicAsId, UsingComponents, WithComputedOrigin, WithUniqueTopic,
};
use xcm_executor::XcmExecutor;

Expand Down Expand Up @@ -140,6 +140,8 @@ pub type Barrier = TrailingSetTopicAsId<
AllowExplicitUnpaidExecutionFrom<ParentOrParentsExecutivePlurality>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<ParentRelayOrSiblingParachains>,
// HRMP notifications from the relay chain are OK.
AllowHrmpNotificationsFromRelayChain,
),
UniversalLocation,
ConstU32<8>,
Expand Down
2 changes: 0 additions & 2 deletions xcm-simulator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -238,5 +238,3 @@ try-runtime = [
"polkadot-runtime-common/try-runtime",
"sp-runtime/try-runtime",
]

experimental = ["pallet-aura/experimental"]
14 changes: 9 additions & 5 deletions xcm-simulator/src/storagehub/apis.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::storagehub::*;
use crate::*;
use frame_support::{
genesis_builder_helper::{build_config, create_default_config},
genesis_builder_helper::{build_state, get_preset},
weights::Weight,
};
use pallet_aura::Authorities;
Expand Down Expand Up @@ -256,12 +256,16 @@ impl_runtime_apis! {
}

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

fn build_config(config: Vec<u8>) -> sp_genesis_builder::Result {
build_config::<RuntimeGenesisConfig>(config)
fn get_preset(id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
get_preset::<RuntimeGenesisConfig>(id, |_| None)
}

fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
vec![]
}
}

Expand Down
2 changes: 1 addition & 1 deletion xcm-simulator/src/storagehub/configs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ parameter_types! {

impl pallet_transaction_payment::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
type OnChargeTransaction = pallet_transaction_payment::FungibleAdapter<Balances, ()>;
type WeightToFee = WeightToFee;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
Expand Down
17 changes: 10 additions & 7 deletions xcm-simulator/src/storagehub/configs/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ use polkadot_parachain_primitives::primitives::Sibling;
use polkadot_runtime_common::impls::ToAuthor;
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, DenyReserveTransferToRelayChain,
DenyThenTry, DescribeAllTerminal, DescribeFamily, EnsureXcmOrigin, FixedWeightBounds,
FrameTransactionalProcessor, FungibleAdapter, HashedDescription, IsConcrete, ParentAsSuperuser,
ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
TrailingSetTopicAsId, UsingComponents, WithComputedOrigin,
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowHrmpNotificationsFromRelayChain,
AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
DenyReserveTransferToRelayChain, DenyThenTry, DescribeAllTerminal, DescribeFamily,
EnsureXcmOrigin, FixedWeightBounds, FrameTransactionalProcessor, FungibleAdapter,
HashedDescription, IsConcrete, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId,
UsingComponents, WithComputedOrigin,
};
use xcm_executor::XcmExecutor;

Expand Down Expand Up @@ -139,6 +140,8 @@ pub type Barrier = TrailingSetTopicAsId<
AllowExplicitUnpaidExecutionFrom<ParentOrParentsExecutivePlurality>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<ParentRelayOrSiblingParachains>,
// HRMP notifications from the relay chain are OK.
AllowHrmpNotificationsFromRelayChain,
),
UniversalLocation,
ConstU32<8>,
Expand Down