Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ⏫ upgrade to Polkadot SDK stable2407 #222

Merged
merged 71 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
71 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
5142fdd
Merge branch 'main' into update/polkadot-sdk-v1.13.0
TDemeco Oct 4, 2024
4eb7f24
fix: :bug: add missing imports (and run typegen)
TDemeco Oct 4, 2024
73a343f
fix: :arrow_down: rollback polkadotjs api dependencies
TDemeco Oct 4, 2024
090bfa6
chore: :label: rerun pnpm typegen
TDemeco Oct 4, 2024
ff67efb
feat: :construction: start upgrade to Polkadot SDK 1.14.0
TDemeco Oct 7, 2024
b857c6d
fix: :rotating_light: format and lint
TDemeco Oct 7, 2024
c6157a0
fix: :rotating_light: remove trailing whitespace
TDemeco Oct 7, 2024
91d7b73
Merge branch 'update/polkadot-sdk-v1.13.0' into update/polkadot-sdk-v…
TDemeco Oct 7, 2024
550ccd0
feat: :arrow_up: upgrade to Polkadot SDK v1.14.0
TDemeco Oct 7, 2024
d2b13b2
Merge branch 'main' into update/polkadot-sdk-v1.14.0
TDemeco Oct 7, 2024
830357a
Merge branch 'main' into update/polkadot-sdk-v1.14.0
TDemeco Oct 7, 2024
3ff32ca
chore: :label: run typegen
TDemeco Oct 7, 2024
79435a7
fix: :rotating_light: run cargo fmt
TDemeco Oct 7, 2024
9c320c8
docs: :fire: remove wrong license docs
TDemeco Oct 7, 2024
a9e2dc9
feat: :arrow_up: update Polkadot SDK to stable2407
TDemeco Oct 7, 2024
a6fc3b1
Merge branch 'main' into update/polkadot-sdk-stable2407
TDemeco Oct 7, 2024
5c6a849
chore: :label: run typegen
TDemeco Oct 7, 2024
23ad7e9
Merge branch 'main' into update/polkadot-sdk-stable2407
TDemeco Oct 8, 2024
7b55ca3
chore: :label: run typegen
TDemeco Oct 8, 2024
db2fb69
fix: :white_check_mark: fix bsp-threshold test
TDemeco Oct 8, 2024
b59cf44
fix: :green_heart: try to fix tests in CI
TDemeco Oct 8, 2024
39439f7
fix: :white_check_mark: try again to fix the integration tests in the CI
TDemeco Oct 8, 2024
be86ef7
test: :test_tube: fix batch file confirm storing test
TDemeco Oct 9, 2024
d099669
fix: :white_check_mark: remove unused imports from volunteer test
TDemeco Oct 9, 2024
3224437
fix: :white_check_mark: add wait for file in file storage success and…
TDemeco Oct 9, 2024
70dde30
fix: :white_check_mark: wait more time for bsp volunteering
TDemeco Oct 9, 2024
c9744a3
test: :test_tube: fix a few issues
TDemeco Oct 9, 2024
e2d8a3f
fix: :white_check_mark: maybe (hopefully) finish fixing tests
TDemeco Oct 9, 2024
cc9d406
fix: :white_check_mark: fix new bsps not catching up to the tip of th…
TDemeco Oct 9, 2024
ad40421
test: :white_check_mark: disconnect api
TDemeco Oct 9, 2024
a225b39
test: :bug: fix timeout bug
TDemeco Oct 10, 2024
77b8978
test: :white_check_mark: add initialization wait + fix single bsp ini…
TDemeco Oct 10, 2024
31bed63
chore: :rotating_light: removed unused variables
TDemeco Oct 10, 2024
fb316e5
test: :bug: initialised bsp net now correctly waits for bsp to store …
TDemeco Oct 10, 2024
200cf20
test: :bug: add missing wait for chain tip sync on test
TDemeco Oct 10, 2024
be63330
fix: :adhesive_bandage: Remove sleeps from single tests, in favour of…
ffarall Oct 10, 2024
5b48a67
fix: :rotating_light: Fix TS typecheck
ffarall Oct 10, 2024
a9c766c
fix: :bug: Wait for sync in onboard tests
ffarall Oct 10, 2024
cf60ca1
fix: :rotating_light: Remove unused `sleep` import
ffarall Oct 10, 2024
065235e
test: :white_check_mark: Remove second sealBlock after file deletion …
ffarall Oct 10, 2024
6dbd4a6
fix: :bug: Make blockchain service check pending forest root writes w…
ffarall Oct 10, 2024
7d6feb6
test: :white_check_mark: add `bspFileDeletionCompleted` wait using po…
TDemeco Oct 10, 2024
4e7f5e7
test: :white_check_mark: Fix volunteer test which after recent optims…
ffarall Oct 10, 2024
30c56ea
fix: :fire: remove leftover condition from payment stream deletion
TDemeco Oct 10, 2024
26fc867
fix: :bug: Delete payment stream when executing stop storing for inso…
ffarall Oct 10, 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: ⬆️ update to Polkadot SDK v1.12.0
  • Loading branch information
TDemeco committed Oct 3, 2024
commit b7090b530a732ad89218686f712c779b3bcaeef3
7,288 changes: 5,062 additions & 2,226 deletions Cargo.lock

Large diffs are not rendered by default.

201 changes: 101 additions & 100 deletions Cargo.toml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use codec::Encode;
use cumulus_client_cli::CollatorOptions;
use cumulus_client_parachain_inherent::{MockValidationDataInherentDataProvider, MockXcmConfig};

use polkadot_primitives::{BlakeTwo256, HashT, HeadData, ValidationCode};
use polkadot_primitives::{BlakeTwo256, HashT, HeadData};
use sc_consensus_manual_seal::consensus::aura::AuraConsensusDataProvider;
use shc_actors_framework::actor::TaskSpawner;
use shc_common::types::{BlockHash, OpaqueBlock, BCSV_KEY_TYPE};
Expand All @@ -34,7 +34,7 @@ use cumulus_client_service::{
BuildNetworkParams, CollatorSybilResistance, DARecoveryProfile, StartRelayChainTasksParams,
};
use cumulus_primitives_core::{
relay_chain::{well_known_keys as RelayChainWellKnownKeys, CollatorPair},
relay_chain::{well_known_keys as RelayChainWellKnownKeys, CollatorPair, ValidationCode},
ParaId,
};
use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface};
Expand Down
4 changes: 4 additions & 0 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ sp-std = { workspace = true }
sp-transaction-pool = { workspace = true }
sp-trie = { workspace = true }
sp-version = { workspace = true }
sp-weights = { workspace = true }

# Polkadot
pallet-xcm = { workspace = true }
Expand All @@ -84,6 +85,7 @@ polkadot-runtime-common = { workspace = true }
xcm = { workspace = true }
xcm-builder = { workspace = true }
xcm-executor = { workspace = true }
xcm-fee-payment-runtime-api = { workspace = true }

# Cumulus
cumulus-pallet-aura-ext = { workspace = true }
Expand Down Expand Up @@ -168,6 +170,7 @@ std = [
"substrate-wasm-builder",
"xcm-builder/std",
"xcm-executor/std",
"xcm-fee-payment-runtime-api/std",
"xcm/std",
]

Expand Down Expand Up @@ -206,6 +209,7 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-fee-payment-runtime-api/runtime-benchmarks",
]

try-runtime = [
Expand Down
108 changes: 108 additions & 0 deletions runtime/src/apis.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::*;
use codec::Encode;
use frame_support::{
genesis_builder_helper::{build_state, get_preset},
weights::Weight,
Expand All @@ -24,6 +25,14 @@ use sp_runtime::{
};
use sp_std::prelude::Vec;
use sp_version::RuntimeVersion;
use xcm::{
latest::prelude::AssetId, IntoVersion, VersionedAssetId, VersionedAssets, VersionedLocation,
VersionedXcm,
};
use xcm_fee_payment_runtime_api::{
dry_run::{Error as XcmDryRunApiError, ExtrinsicDryRunEffects, XcmDryRunEffects},
fees::Error as XcmPaymentApiError,
};

// Local module imports
use super::{
Expand Down Expand Up @@ -179,6 +188,105 @@ impl_runtime_apis! {
}
}

impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi<Block> for Runtime {
fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result<Vec<VersionedAssetId>, XcmPaymentApiError> {
let acceptable = vec![
// native token
VersionedAssetId::from(AssetId(configs::xcm_config::RelayLocation::get()))
];
Ok(acceptable
.into_iter()
.filter_map(|asset| asset.into_version(xcm_version).ok())
.collect())
}
fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result<u128, XcmPaymentApiError> {
match asset.try_as::<AssetId>() {
Ok(asset_id) if asset_id.0 == configs::xcm_config::RelayLocation::get() => {
// for native token
Ok(<WeightToFee as sp_weights::WeightToFee>::weight_to_fee(&weight))
},
Ok(asset_id) => {
log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!");
Err(XcmPaymentApiError::AssetNotFound)
},
Err(_) => {
log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!");
Err(XcmPaymentApiError::VersionedConversionFailed)
}
}
}
fn query_xcm_weight(message: VersionedXcm<()>) -> Result<Weight, XcmPaymentApiError> {
PolkadotXcm::query_xcm_weight(message)
}
fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>) -> Result<VersionedAssets, XcmPaymentApiError> {
PolkadotXcm::query_delivery_fees(destination, message)
}
}

impl xcm_fee_payment_runtime_api::dry_run::XcmDryRunApi<Block, RuntimeCall, RuntimeEvent> for Runtime {
fn dry_run_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> Result<ExtrinsicDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
use xcm_builder::InspectMessageQueues;
use xcm_executor::RecordXcm;
use xcm::prelude::*;

pallet_xcm::Pallet::<Runtime>::set_record_xcm(true);
let result = Executive::apply_extrinsic(extrinsic).map_err(|error| {
log::error!(
target: "xcm::XcmDryRunApi::dry_run_extrinsic",
"Applying extrinsic failed with error {:?}",
error,
);
XcmDryRunApiError::InvalidExtrinsic
})?;
let local_xcm = pallet_xcm::Pallet::<Runtime>::recorded_xcm();
let forwarded_xcms = configs::xcm_config::XcmRouter::get_messages();
let events: Vec<RuntimeEvent> = System::read_events_no_consensus().map(|record| record.event.clone()).collect();
Ok(ExtrinsicDryRunEffects {
local_xcm: local_xcm.map(VersionedXcm::<()>::V4),
forwarded_xcms,
emitted_events: events,
execution_result: result,
})
}

fn dry_run_xcm(origin_location: VersionedLocation, program: VersionedXcm<RuntimeCall>) -> Result<XcmDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
use xcm_builder::InspectMessageQueues;
use xcm::prelude::*;

let origin_location: Location = origin_location.try_into().map_err(|error| {
log::error!(
target: "xcm::XcmDryRunApi::dry_run_xcm",
"Location version conversion failed with error: {:?}",
error,
);
XcmDryRunApiError::VersionedConversionFailed
})?;
let program: Xcm<RuntimeCall> = program.try_into().map_err(|error| {
log::error!(
target: "xcm::XcmDryRunApi::dry_run_xcm",
"Xcm version conversion failed with error {:?}",
error,
);
XcmDryRunApiError::VersionedConversionFailed
})?;
let mut hash = program.using_encoded(sp_core::hashing::blake2_256);
let result = xcm_executor::XcmExecutor::<configs::xcm_config::XcmConfig>::prepare_and_execute(
origin_location,
program,
&mut hash,
Weight::MAX, // Max limit available for execution.
Weight::zero(),
);
let forwarded_xcms = configs::xcm_config::XcmRouter::get_messages();
let events: Vec<RuntimeEvent> = System::read_events_no_consensus().map(|record| record.event.clone()).collect();
Ok(XcmDryRunEffects {
forwarded_xcms,
emitted_events: events,
execution_result: result,
})
}
}

impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
ParachainSystem::collect_collation_info(header)
Expand Down
4 changes: 2 additions & 2 deletions runtime/src/configs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
//
// For more information, please refer to <http://unlicense.org>

mod xcm_config;
pub mod xcm_config;

// Substrate and Polkadot dependencies
use core::marker::PhantomData;
Expand Down Expand Up @@ -152,7 +152,7 @@ impl frame_system::Config for Runtime {
impl pallet_timestamp::Config for Runtime {
type Moment = u64;
type OnTimestampSet = Aura;
type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>;
type MinimumPeriod = ConstU64<0>;
type WeightInfo = ();
}

Expand Down
1 change: 1 addition & 0 deletions runtime/src/configs/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = ();
}

/// Converts a local signed origin into an XCM location.
Expand Down
13 changes: 2 additions & 11 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));

pub mod apis;
mod configs;
pub mod configs;
mod weights;

use smallvec::smallvec;
Expand Down Expand Up @@ -39,7 +39,7 @@ pub use sp_runtime::BuildStorage;

use weights::ExtrinsicBaseWeight;

pub use crate::configs::{StorageDataUnit, StorageProofsMerkleTrieLayout};
pub use crate::configs::{xcm_config, StorageDataUnit, StorageProofsMerkleTrieLayout};

/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
pub type Signature = MultiSignature;
Expand Down Expand Up @@ -210,15 +210,6 @@ const BLOCK_PROCESSING_VELOCITY: u32 = 1;
/// Relay chain slot duration, in milliseconds.
const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;

/// The version information used to identify this runtime when compiled natively.
#[cfg(feature = "std")]
pub fn native_version() -> NativeVersion {
NativeVersion {
runtime_version: VERSION,
can_author_with: Default::default(),
}
}

// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime {
Expand Down
1 change: 1 addition & 0 deletions xcm-simulator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ xcm = { workspace = true }
xcm-builder = { workspace = true }
xcm-executor = { workspace = true }
xcm-simulator = { workspace = true }
xcm-fee-payment-runtime-api = { workspace = true }
runtime-constants = { workspace = true }

# Cumulus
Expand Down
1 change: 1 addition & 0 deletions xcm-simulator/src/parachain/xcm_config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,5 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = ();
}
1 change: 1 addition & 0 deletions xcm-simulator/src/relay_chain/xcm_config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,5 @@ impl Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = ();
}
1 change: 1 addition & 0 deletions xcm-simulator/src/storagehub/configs/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = ();
}

/// Converts a local signed origin into an XCM location.
Expand Down
11 changes: 0 additions & 11 deletions xcm-simulator/src/storagehub/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ use sp_runtime::{
};

use sp_std::prelude::*;
#[cfg(feature = "std")]
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;

use frame_support::{
Expand Down Expand Up @@ -199,15 +197,6 @@ const BLOCK_PROCESSING_VELOCITY: u32 = 1;
/// Relay chain slot duration, in milliseconds.
const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;

/// The version information used to identify this runtime when compiled natively.
#[cfg(feature = "std")]
pub fn native_version() -> NativeVersion {
NativeVersion {
runtime_version: VERSION,
can_author_with: Default::default(),
}
}

// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime {
Expand Down
1 change: 1 addition & 0 deletions xcm-simulator/src/system_chain/xcm_config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,5 @@ impl xcm_executor::Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = ();
}