Skip to content

Commit

Permalink
feat: ⏫ upgrade to Polkadot SDK v1.14.0 (#218)
Browse files Browse the repository at this point in the history
* refactor: 🎨 moved runtime apis into their own file

* fix: ⬆️ fix upgrade to polkadot-sdk v1.10.0

* fix: 🐛 add removed runtime api `get_worst_case_scenario_slashable_amount`

* fix: 🐛 add missing generic in storage providers runtime api

* chore: 🏷️ run typegen

* style: 🚨 run cargo fmt

* fix: 🎨 fix cargo clippy

* fix: 🚑 fix mocked relay chain randomness

* style: 🚨 run cargo fmt

* chore: 🚨 temporary remove unused import (until v1.13.0)

* fix: 🩹 update `query_earliest_file_volunteer_tick` runtime api

* fix: 🚑 fix issues with merge from main

* style: 🚨 run cargo fmt

* feat: 📦 initial update to polkadot sdk v1.11.0

* feat: ⬆️ finish upgrade to polkadot sdk v1.11.0

* chore: 🏷️ run typegen

* chore: 🏷️ run typegen

* fix: ✅ fix node tests after rebenchmark of balances pallet in v1.11.0

* feat: ⬆️ update to Polkadot SDK v1.12.0

* feat: ⬆️ update to Polkadot SDK v1.13.0

* fix: ⬆️ finish upgrading to Polkadot SDK v1.13.0

* fix: 🐛 add missing imports (and run typegen)

* fix: ⬇️ rollback polkadotjs api dependencies

* chore: 🏷️ rerun pnpm typegen

* feat: 🚧 start upgrade to Polkadot SDK 1.14.0

* fix: 🚨 format and lint

* fix: 🚨 remove trailing whitespace

* feat: ⬆️ upgrade to Polkadot SDK v1.14.0

* chore: 🏷️ run typegen

* fix: 🚨 run cargo fmt

* docs: 🔥 remove wrong license docs

* chore: 🏷️ run typegen
  • Loading branch information
TDemeco authored Oct 7, 2024
1 parent f7aa2a6 commit 93e424a
Show file tree
Hide file tree
Showing 35 changed files with 2,027 additions and 1,487 deletions.
2,381 changes: 1,287 additions & 1,094 deletions Cargo.lock

Large diffs are not rendered by default.

206 changes: 103 additions & 103 deletions Cargo.toml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions api-augment/dist/interfaces/lookup.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api-augment/dist/interfaces/lookup.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions api-augment/dist/types/interfaces/augment-api-query.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ import type {
CumulusPalletXcmpQueueQueueConfigData,
CumulusPrimitivesCoreAggregateMessageOrigin,
FrameSupportDispatchPerDispatchClassWeight,
FrameSupportTokensMiscIdAmount,
FrameSystemAccountInfo,
FrameSystemCodeUpgradeAuthorization,
FrameSystemEventRecord,
FrameSystemLastRuntimeUpgradeInfo,
FrameSystemPhase,
PalletBalancesAccountData,
PalletBalancesBalanceLock,
PalletBalancesIdAmount,
PalletBalancesReserveData,
PalletCollatorSelectionCandidateInfo,
PalletFileSystemMoveBucketRequestMetadata,
Expand Down Expand Up @@ -181,7 +181,7 @@ declare module "@polkadot/api-base/types/storage" {
**/
freezes: AugmentedQuery<
ApiType,
(arg: AccountId32 | string | Uint8Array) => Observable<Vec<PalletBalancesIdAmount>>,
(arg: AccountId32 | string | Uint8Array) => Observable<Vec<FrameSupportTokensMiscIdAmount>>,
[AccountId32]
> &
QueryableStorageEntry<ApiType, [AccountId32]>;
Expand Down
35 changes: 34 additions & 1 deletion api-augment/dist/types/interfaces/augment-api-runtime.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ import type { RuntimeVersion } from "@polkadot/types/interfaces/state";
import type { ApplyExtrinsicResult, Key } from "@polkadot/types/interfaces/system";
import type { TransactionSource, TransactionValidity } from "@polkadot/types/interfaces/txqueue";
import type { XcmPaymentApiError } from "@polkadot/types/interfaces/xcmPaymentApi";
import type { XcmVersionedAssetId, XcmVersionedXcm } from "@polkadot/types/lookup";
import type { Error } from "@polkadot/types/interfaces/xcmRuntimeApi";
import type {
XcmVersionedAssetId,
XcmVersionedLocation,
XcmVersionedXcm
} from "@polkadot/types/lookup";
import type { IExtrinsic, Observable } from "@polkadot/types/types";
import type {
BackupStorageProvider,
Expand Down Expand Up @@ -294,6 +299,34 @@ declare module "@polkadot/api-base/types/calls" {
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x9ffb505aa738d69c/1 */
locationToAccountApi: {
/**
* Converts `Location` to `AccountId`
**/
convertLocation: AugmentedCall<
ApiType,
(
location:
| XcmVersionedLocation
| {
V2: any;
}
| {
V3: any;
}
| {
V4: any;
}
| string
| Uint8Array
) => Observable<Result<AccountId, Error>>
>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x37e397fc7c91f5e4/2 */
metadata: {
/**
Expand Down
2 changes: 1 addition & 1 deletion api-augment/dist/types/interfaces/augment-api-tx.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3157,7 +3157,7 @@ declare module "@polkadot/api-base/types/submittable" {
* - `assets`: The assets to be withdrawn. This should include the assets used to pay the
* fee on the `dest` (and possibly reserve) chains.
* - `assets_transfer_type`: The XCM `TransferType` used to transfer the `assets`.
* - `remote_fees_id`: One of the included `assets` to be be used to pay fees.
* - `remote_fees_id`: One of the included `assets` to be used to pay fees.
* - `fees_transfer_type`: The XCM `TransferType` used to transfer the `fees` assets.
* - `custom_xcm_on_dest`: The XCM to be executed on `dest` chain as the last step of the
* transfer, which also determines what happens to the assets on the destination chain.
Expand Down
4 changes: 2 additions & 2 deletions api-augment/dist/types/interfaces/lookup.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2448,9 +2448,9 @@ declare const _default: {
_enum: string[];
};
/**
* Lookup270: pallet_balances::types::IdAmount<Id, Balance>
* Lookup270: frame_support::traits::tokens::misc::IdAmount<Id, Balance>
**/
PalletBalancesIdAmount: {
FrameSupportTokensMiscIdAmount: {
id: string;
amount: string;
};
Expand Down
4 changes: 2 additions & 2 deletions api-augment/dist/types/interfaces/registry.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import type {
FrameSupportDispatchPerDispatchClassWeightsPerClass,
FrameSupportMessagesProcessMessageError,
FrameSupportTokensMiscBalanceStatus,
FrameSupportTokensMiscIdAmount,
FrameSystemAccountInfo,
FrameSystemCall,
FrameSystemCodeUpgradeAuthorization,
Expand All @@ -53,7 +54,6 @@ import type {
PalletBalancesCall,
PalletBalancesError,
PalletBalancesEvent,
PalletBalancesIdAmount,
PalletBalancesReasons,
PalletBalancesReserveData,
PalletBucketNftsCall,
Expand Down Expand Up @@ -299,6 +299,7 @@ declare module "@polkadot/types/types/registry" {
FrameSupportDispatchPerDispatchClassWeightsPerClass: FrameSupportDispatchPerDispatchClassWeightsPerClass;
FrameSupportMessagesProcessMessageError: FrameSupportMessagesProcessMessageError;
FrameSupportTokensMiscBalanceStatus: FrameSupportTokensMiscBalanceStatus;
FrameSupportTokensMiscIdAmount: FrameSupportTokensMiscIdAmount;
FrameSystemAccountInfo: FrameSystemAccountInfo;
FrameSystemCall: FrameSystemCall;
FrameSystemCodeUpgradeAuthorization: FrameSystemCodeUpgradeAuthorization;
Expand All @@ -322,7 +323,6 @@ declare module "@polkadot/types/types/registry" {
PalletBalancesCall: PalletBalancesCall;
PalletBalancesError: PalletBalancesError;
PalletBalancesEvent: PalletBalancesEvent;
PalletBalancesIdAmount: PalletBalancesIdAmount;
PalletBalancesReasons: PalletBalancesReasons;
PalletBalancesReserveData: PalletBalancesReserveData;
PalletBucketNftsCall: PalletBucketNftsCall;
Expand Down
4 changes: 2 additions & 2 deletions api-augment/dist/types/interfaces/types-lookup.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2917,8 +2917,8 @@ declare module "@polkadot/types/lookup" {
readonly isPaymentStreamDeposit: boolean;
readonly type: "PaymentStreamDeposit";
}
/** @name PalletBalancesIdAmount (270) */
interface PalletBalancesIdAmount extends Struct {
/** @name FrameSupportTokensMiscIdAmount (270) */
interface FrameSupportTokensMiscIdAmount extends Struct {
readonly id: Null;
readonly amount: u128;
}
Expand Down
4 changes: 2 additions & 2 deletions api-augment/src/interfaces/augment-api-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ import type {
CumulusPalletXcmpQueueQueueConfigData,
CumulusPrimitivesCoreAggregateMessageOrigin,
FrameSupportDispatchPerDispatchClassWeight,
FrameSupportTokensMiscIdAmount,
FrameSystemAccountInfo,
FrameSystemCodeUpgradeAuthorization,
FrameSystemEventRecord,
FrameSystemLastRuntimeUpgradeInfo,
FrameSystemPhase,
PalletBalancesAccountData,
PalletBalancesBalanceLock,
PalletBalancesIdAmount,
PalletBalancesReserveData,
PalletCollatorSelectionCandidateInfo,
PalletFileSystemMoveBucketRequestMetadata,
Expand Down Expand Up @@ -190,7 +190,7 @@ declare module "@polkadot/api-base/types/storage" {
**/
freezes: AugmentedQuery<
ApiType,
(arg: AccountId32 | string | Uint8Array) => Observable<Vec<PalletBalancesIdAmount>>,
(arg: AccountId32 | string | Uint8Array) => Observable<Vec<FrameSupportTokensMiscIdAmount>>,
[AccountId32]
> &
QueryableStorageEntry<ApiType, [AccountId32]>;
Expand Down
29 changes: 28 additions & 1 deletion api-augment/src/interfaces/augment-api-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ import type { RuntimeVersion } from "@polkadot/types/interfaces/state";
import type { ApplyExtrinsicResult, Key } from "@polkadot/types/interfaces/system";
import type { TransactionSource, TransactionValidity } from "@polkadot/types/interfaces/txqueue";
import type { XcmPaymentApiError } from "@polkadot/types/interfaces/xcmPaymentApi";
import type { XcmVersionedAssetId, XcmVersionedXcm } from "@polkadot/types/lookup";
import type { Error } from "@polkadot/types/interfaces/xcmRuntimeApi";
import type {
XcmVersionedAssetId,
XcmVersionedLocation,
XcmVersionedXcm
} from "@polkadot/types/lookup";
import type { IExtrinsic, Observable } from "@polkadot/types/types";
import type {
BackupStorageProvider,
Expand Down Expand Up @@ -276,6 +281,28 @@ declare module "@polkadot/api-base/types/calls" {
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x9ffb505aa738d69c/1 */
locationToAccountApi: {
/**
* Converts `Location` to `AccountId`
**/
convertLocation: AugmentedCall<
ApiType,
(
location:
| XcmVersionedLocation
| { V2: any }
| { V3: any }
| { V4: any }
| string
| Uint8Array
) => Observable<Result<AccountId, Error>>
>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x37e397fc7c91f5e4/2 */
metadata: {
/**
Expand Down
2 changes: 1 addition & 1 deletion api-augment/src/interfaces/augment-api-tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2650,7 +2650,7 @@ declare module "@polkadot/api-base/types/submittable" {
* - `assets`: The assets to be withdrawn. This should include the assets used to pay the
* fee on the `dest` (and possibly reserve) chains.
* - `assets_transfer_type`: The XCM `TransferType` used to transfer the `assets`.
* - `remote_fees_id`: One of the included `assets` to be be used to pay fees.
* - `remote_fees_id`: One of the included `assets` to be used to pay fees.
* - `fees_transfer_type`: The XCM `TransferType` used to transfer the `fees` assets.
* - `custom_xcm_on_dest`: The XCM to be executed on `dest` chain as the last step of the
* transfer, which also determines what happens to the assets on the destination chain.
Expand Down
4 changes: 2 additions & 2 deletions api-augment/src/interfaces/lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2490,9 +2490,9 @@ export default {
_enum: ["PaymentStreamDeposit"]
},
/**
* Lookup270: pallet_balances::types::IdAmount<Id, Balance>
* Lookup270: frame_support::traits::tokens::misc::IdAmount<Id, Balance>
**/
PalletBalancesIdAmount: {
FrameSupportTokensMiscIdAmount: {
id: "Null",
amount: "u128"
},
Expand Down
4 changes: 2 additions & 2 deletions api-augment/src/interfaces/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import type {
FrameSupportDispatchPerDispatchClassWeightsPerClass,
FrameSupportMessagesProcessMessageError,
FrameSupportTokensMiscBalanceStatus,
FrameSupportTokensMiscIdAmount,
FrameSystemAccountInfo,
FrameSystemCall,
FrameSystemCodeUpgradeAuthorization,
Expand All @@ -59,7 +60,6 @@ import type {
PalletBalancesCall,
PalletBalancesError,
PalletBalancesEvent,
PalletBalancesIdAmount,
PalletBalancesReasons,
PalletBalancesReserveData,
PalletBucketNftsCall,
Expand Down Expand Up @@ -306,6 +306,7 @@ declare module "@polkadot/types/types/registry" {
FrameSupportDispatchPerDispatchClassWeightsPerClass: FrameSupportDispatchPerDispatchClassWeightsPerClass;
FrameSupportMessagesProcessMessageError: FrameSupportMessagesProcessMessageError;
FrameSupportTokensMiscBalanceStatus: FrameSupportTokensMiscBalanceStatus;
FrameSupportTokensMiscIdAmount: FrameSupportTokensMiscIdAmount;
FrameSystemAccountInfo: FrameSystemAccountInfo;
FrameSystemCall: FrameSystemCall;
FrameSystemCodeUpgradeAuthorization: FrameSystemCodeUpgradeAuthorization;
Expand All @@ -329,7 +330,6 @@ declare module "@polkadot/types/types/registry" {
PalletBalancesCall: PalletBalancesCall;
PalletBalancesError: PalletBalancesError;
PalletBalancesEvent: PalletBalancesEvent;
PalletBalancesIdAmount: PalletBalancesIdAmount;
PalletBalancesReasons: PalletBalancesReasons;
PalletBalancesReserveData: PalletBalancesReserveData;
PalletBucketNftsCall: PalletBucketNftsCall;
Expand Down
4 changes: 2 additions & 2 deletions api-augment/src/interfaces/types-lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3075,8 +3075,8 @@ declare module "@polkadot/types/lookup" {
readonly type: "PaymentStreamDeposit";
}

/** @name PalletBalancesIdAmount (270) */
interface PalletBalancesIdAmount extends Struct {
/** @name FrameSupportTokensMiscIdAmount (270) */
interface FrameSupportTokensMiscIdAmount extends Struct {
readonly id: Null;
readonly amount: u128;
}
Expand Down
2 changes: 1 addition & 1 deletion api-augment/storagehub.json

Large diffs are not rendered by default.

52 changes: 35 additions & 17 deletions pallets/bucket-nfts/src/mock.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use core::marker::PhantomData;
use frame_support::{
construct_runtime, derive_impl, parameter_types,
derive_impl, parameter_types,
traits::{AsEnsureOriginWithArg, Everything, Randomness},
weights::constants::RocksDbWeight,
BoundedBTreeSet,
};
use frame_system as system;
use frame_system::pallet_prelude::BlockNumberFor;
use num_bigint::BigUint;
use pallet_nfts::PalletFeatures;
use shp_file_metadata::{ChunkId, FileMetadata};
Expand All @@ -21,7 +21,6 @@ use sp_runtime::{
};
use sp_std::collections::btree_set::BTreeSet;
use sp_trie::{LayoutV1, TrieConfiguration, TrieLayout};
use system::pallet_prelude::BlockNumberFor;

type Block = frame_system::mocking::MockBlock<Test>;
pub(crate) type BlockNumber = u64;
Expand Down Expand Up @@ -57,18 +56,37 @@ impl Randomness<H256, BlockNumber> for MockRandomness {
}

// Configure a mock runtime to test the pallet.
construct_runtime!(
pub enum Test
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Providers: pallet_storage_providers::{Pallet, Call, Storage, Event<T>, HoldReason},
BucketNfts: crate::{Pallet, Call, Storage, Event<T>},
Nfts: pallet_nfts::{Pallet, Call, Storage, Event<T>},
FileSystem: pallet_file_system::{Pallet, Call, Storage, Event<T>},
PaymentStreams: pallet_payment_streams::{Pallet, Call, Storage, Event<T>, HoldReason},
}
);
#[frame_support::runtime]
mod test_runtime {
#[runtime::runtime]
#[runtime::derive(
RuntimeCall,
RuntimeEvent,
RuntimeError,
RuntimeOrigin,
RuntimeFreezeReason,
RuntimeHoldReason,
RuntimeSlashReason,
RuntimeLockId,
RuntimeTask
)]
pub struct Test;

#[runtime::pallet_index(0)]
pub type System = frame_system;
#[runtime::pallet_index(1)]
pub type Balances = pallet_balances;
#[runtime::pallet_index(2)]
pub type Providers = pallet_storage_providers;
#[runtime::pallet_index(3)]
pub type BucketNfts = crate;
#[runtime::pallet_index(4)]
pub type Nfts = pallet_nfts;
#[runtime::pallet_index(5)]
pub type FileSystem = pallet_file_system;
#[runtime::pallet_index(6)]
pub type PaymentStreams = pallet_payment_streams;
}

parameter_types! {
pub const BlockHashCount: u64 = 250;
Expand All @@ -77,7 +95,7 @@ parameter_types! {
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl system::Config for Test {
impl frame_system::Config for Test {
type BaseCallFilter = Everything;
type BlockWeights = ();
type BlockLength = ();
Expand Down Expand Up @@ -388,7 +406,7 @@ impl crate::Config for Test {

// Build genesis storage according to the mock runtime.
pub fn new_test_ext() -> sp_io::TestExternalities {
let mut t = system::GenesisConfig::<Test>::default()
let mut t = frame_system::GenesisConfig::<Test>::default()
.build_storage()
.unwrap();

Expand Down
Loading

0 comments on commit 93e424a

Please sign in to comment.