Skip to content

Commit

Permalink
uplift to stable2407 (#1372)
Browse files Browse the repository at this point in the history
* uplift to stable2407

* fix integration tests

* update treasury parameters and mark deprecated to specific test instead

* include xcm migrations

* small cleanup

* revert treasury changes

* fix xcm dry run tests

* fork pallet-treasury and revert to upstream polkadot-sdk

* fix check=license and fmt checks

* move treasury from pallets to vendor

* include ingnore treasury pallet

* update frontier port and pull custom fixes on frontier
  • Loading branch information
vedhavyas authored Oct 23, 2024
1 parent 37f9e0b commit 50ed03d
Show file tree
Hide file tree
Showing 26 changed files with 5,317 additions and 2,082 deletions.
3,502 changes: 1,644 additions & 1,858 deletions Cargo.lock

Large diffs are not rendered by default.

312 changes: 157 additions & 155 deletions Cargo.toml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions bin/collator/src/parachain/fake_runtime_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ impl_runtime_apis! {
fn pending_block(_xts: Vec<<Block as BlockT>::Extrinsic>) -> (Option<pallet_ethereum::Block>, Option<Vec<fp_rpc::TransactionStatus>>) {
unimplemented!()
}

fn initialize_pending_block(_header: &<Block as BlockT>::Header) {
unimplemented!()
}
}

impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {
Expand Down
3 changes: 1 addition & 2 deletions bin/collator/src/parachain/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,6 @@ fn start_aura_consensus(
.map(|c| ValidationCode::from(c).hash())
}
},
sync_oracle: sync_oracle.clone(),
keystore,
collator_key,
para_id,
Expand All @@ -634,7 +633,7 @@ fn start_aura_consensus(

let fut = async move {
wait_for_aura(client).await;
aura::run::<Block, AuraPair, _, _, _, _, _, _, _, _, _>(params).await
aura::run::<Block, AuraPair, _, _, _, _, _, _, _, _>(params).await
};

task_manager
Expand Down
2 changes: 1 addition & 1 deletion bin/collator/src/parachain/shell_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ where
Client::Api: AuraApi<Block, AuraId>,
{
async fn verify(
&mut self,
&self,
block_import: BlockImportParams<Block>,
) -> Result<BlockImportParams<Block>, String> {
if self
Expand Down
1 change: 1 addition & 0 deletions chain-extensions/pallet-assets/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ impl pallet_contracts::Config for Test {
type UploadOrigin = EnsureSigned<AccountId32>;
type InstantiateOrigin = EnsureSigned<AccountId32>;
type ApiVersion = ();
type MaxTransientStorageSize = ConstU32<{ 1 * 1024 * 1024 }>;
}

impl RegisteredChainExtension<Test> for AssetsExtension<Test> {
Expand Down
5 changes: 3 additions & 2 deletions pallets/collator-selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,9 @@ pub mod pallet {
.invulnerables
.iter()
.collect::<sp_std::collections::btree_set::BTreeSet<_>>();
assert!(
duplicate_invulnerables.len() == self.invulnerables.len(),
assert_eq!(
duplicate_invulnerables.len(),
self.invulnerables.len(),
"duplicate invulnerables in genesis."
);

Expand Down
12 changes: 6 additions & 6 deletions pallets/vesting-mbm/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ fn migrate_to_new_block_time() {
assert_eq!(Vesting::vesting_balance(&DAVE), Some(300)); // starts vesting at block 5, 20 per block

assert_eq!(
Vesting::vesting(&BOB).unwrap().to_vec(),
Vesting::vesting(BOB).unwrap().to_vec(),
vec![VestingInfo::new(100, 10, 10)]
);
assert_eq!(
Vesting::vesting(&CHARLIE).unwrap().to_vec(),
Vesting::vesting(CHARLIE).unwrap().to_vec(),
vec![VestingInfo::new(1000, 100, 20)]
);
assert_eq!(
Vesting::vesting(&DAVE).unwrap().to_vec(),
Vesting::vesting(DAVE).unwrap().to_vec(),
vec![VestingInfo::new(400, 20, 5)]
);

Expand All @@ -67,15 +67,15 @@ fn migrate_to_new_block_time() {
assert_eq!(Vesting::vesting_balance(&DAVE), Some(290)); // 10 unlocked

assert_eq!(
Vesting::vesting(&BOB).unwrap().to_vec(),
Vesting::vesting(BOB).unwrap().to_vec(),
vec![VestingInfo::new(100, 5, 10)]
);
assert_eq!(
Vesting::vesting(&CHARLIE).unwrap().to_vec(),
Vesting::vesting(CHARLIE).unwrap().to_vec(),
vec![VestingInfo::new(1000, 50, 30)]
);
assert_eq!(
Vesting::vesting(&DAVE).unwrap().to_vec(),
Vesting::vesting(DAVE).unwrap().to_vec(),
vec![VestingInfo::new(300, 10, 10)]
);

Expand Down
9 changes: 5 additions & 4 deletions pallets/xc-asset-config/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ fn register_asset_location_and_units_per_sec_is_ok() {
));
System::assert_last_event(mock::RuntimeEvent::XcAssetConfig(Event::AssetRegistered {
asset_location: asset_location.clone().into_versioned(),
asset_id: asset_id,
asset_id,
}));

// Assert storage state after registering asset
Expand Down Expand Up @@ -182,7 +182,7 @@ fn change_asset_location_is_ok() {
System::assert_last_event(mock::RuntimeEvent::XcAssetConfig(
Event::AssetLocationChanged {
previous_asset_location: asset_location.clone().into_versioned(),
asset_id: asset_id,
asset_id,
new_asset_location: new_asset_location.clone().into_versioned(),
},
));
Expand Down Expand Up @@ -275,7 +275,7 @@ fn remove_asset_is_ok() {
assert_ok!(XcAssetConfig::remove_asset(RuntimeOrigin::root(), asset_id,));
System::assert_last_event(mock::RuntimeEvent::XcAssetConfig(Event::AssetRemoved {
asset_location: asset_location.clone().into_versioned(),
asset_id: asset_id,
asset_id,
}));

// Assert that storage is empty after successful removal
Expand Down Expand Up @@ -351,7 +351,7 @@ fn public_interfaces_are_ok() {
);
assert!(XcAssetConfig::get_units_per_second(asset_location.clone()).is_none());

// Register ups and expect value value to be returned
// Register ups and expect value to be returned
assert_ok!(XcAssetConfig::set_asset_units_per_second(
RuntimeOrigin::root(),
Box::new(asset_location.clone().into_versioned()),
Expand Down Expand Up @@ -388,6 +388,7 @@ fn different_xcm_versions_are_ok() {
}

#[test]
#[allow(deprecated)]
fn incompatible_versioned_multilocations_are_not_ok() {
ExternalityBuilder::build().execute_with(|| {
// Location that cannot be converted from v2 to v4
Expand Down
6 changes: 3 additions & 3 deletions runtime/astar/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ polkadot-runtime-common = { workspace = true }
xcm = { workspace = true }
xcm-builder = { workspace = true }
xcm-executor = { workspace = true }
xcm-fee-payment-runtime-api = { workspace = true }
xcm-runtime-apis = { workspace = true }

# orml dependencies
orml-oracle = { workspace = true }
Expand Down Expand Up @@ -172,7 +172,7 @@ std = [
"pallet-balances/std",
"pallet-proxy/std",
"pallet-dapp-staking/std",
"xcm-fee-payment-runtime-api/std",
"xcm-runtime-apis/std",
"dapp-staking-runtime-api/std",
"pallet-inflation/std",
"pallet-evm-precompile-dapp-staking/std",
Expand Down Expand Up @@ -285,7 +285,7 @@ runtime-benchmarks = [
"polkadot-primitives/runtime-benchmarks",
"polkadot-runtime-common/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-fee-payment-runtime-api/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"cumulus-primitives-core/runtime-benchmarks",
"parachains-common/runtime-benchmarks",
"orml-oracle/runtime-benchmarks",
Expand Down
18 changes: 14 additions & 4 deletions runtime/astar/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ use xcm::{
v4::{AssetId as XcmAssetId, Location as XcmLocation},
IntoVersion, VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm,
};
use xcm_fee_payment_runtime_api::{
use xcm_runtime_apis::{
dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects},
fees::Error as XcmPaymentApiError,
};
Expand Down Expand Up @@ -726,6 +726,7 @@ impl pallet_contracts::Config for Runtime {
type UploadOrigin = EnsureSigned<<Self as frame_system::Config>::AccountId>;
type InstantiateOrigin = EnsureSigned<<Self as frame_system::Config>::AccountId>;
type ApiVersion = ();
type MaxTransientStorageSize = ConstU32<{ 1 * 1024 * 1024 }>;
}

// These values are based on the Astar 2.0 Tokenomics Modeling report.
Expand Down Expand Up @@ -1211,6 +1212,11 @@ impl pallet_migrations::Config for Runtime {
type WeightInfo = pallet_migrations::weights::SubstrateWeight<Runtime>;
}

impl cumulus_pallet_xcmp_queue::migration::v5::V5Config for Runtime {
// This must be the same as the `ChannelInfo` from the `Config`:
type ChannelList = ParachainSystem;
}

construct_runtime!(
pub struct Runtime
{
Expand Down Expand Up @@ -1332,7 +1338,7 @@ parameter_types! {
pub type Migrations = (Unreleased, Permanent);

/// Unreleased migrations. Add new ones here:
pub type Unreleased = ();
pub type Unreleased = (cumulus_pallet_xcmp_queue::migration::v5::MigrateV4ToV5<Runtime>,);

/// Migrations/checks that do not need to be versioned and can run on every upgrade.
pub type Permanent = (pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,);
Expand Down Expand Up @@ -1812,6 +1818,10 @@ impl_runtime_apis! {
pallet_ethereum::CurrentTransactionStatuses::<Runtime>::get()
)
}

fn initialize_pending_block(header: &<Block as BlockT>::Header) {
Executive::initialize_block(header);
}
}

impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {
Expand Down Expand Up @@ -1910,7 +1920,7 @@ impl_runtime_apis! {
}
}

impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi<Block> for Runtime {
impl xcm_runtime_apis::fees::XcmPaymentApi<Block> for Runtime {
fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result<Vec<VersionedAssetId>, XcmPaymentApiError> {
if !matches!(xcm_version, xcm::v3::VERSION | xcm::v4::VERSION) {
return Err(XcmPaymentApiError::UnhandledXcmVersion);
Expand Down Expand Up @@ -1962,7 +1972,7 @@ impl_runtime_apis! {
}
}

impl xcm_fee_payment_runtime_api::dry_run::DryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime {
impl xcm_runtime_apis::dry_run::DryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime {
fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
PolkadotXcm::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call)
}
Expand Down
6 changes: 6 additions & 0 deletions runtime/local/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ pub use pallet_timestamp::Call as TimestampCall;
pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;

#[cfg(feature = "std")]
/// Wasm binary unwrapped. If built with `BUILD_DUMMY_WASM_BINARY`, the function panics.
pub fn wasm_binary_unwrap() -> &'static [u8] {
Expand Down Expand Up @@ -748,6 +749,7 @@ impl pallet_contracts::Config for Runtime {
type UploadOrigin = EnsureSigned<<Self as frame_system::Config>::AccountId>;
type InstantiateOrigin = EnsureSigned<<Self as frame_system::Config>::AccountId>;
type ApiVersion = ();
type MaxTransientStorageSize = ConstU32<{ 1 * 1024 * 1024 }>;
}

impl pallet_sudo::Config for Runtime {
Expand Down Expand Up @@ -1698,6 +1700,10 @@ impl_runtime_apis! {
pallet_ethereum::CurrentTransactionStatuses::<Runtime>::get()
)
}

fn initialize_pending_block(header: &<Block as BlockT>::Header) {
Executive::initialize_block(header);
}
}

impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {
Expand Down
6 changes: 3 additions & 3 deletions runtime/shibuya/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ polkadot-runtime-common = { workspace = true }
xcm = { workspace = true }
xcm-builder = { workspace = true }
xcm-executor = { workspace = true }
xcm-fee-payment-runtime-api = { workspace = true }
xcm-runtime-apis = { workspace = true }

# orml dependencies
orml-oracle = { workspace = true }
Expand Down Expand Up @@ -205,7 +205,7 @@ std = [
"pallet-evm-precompile-assets-erc20/std",
"pallet-evm-precompile-xcm/std",
"pallet-evm-precompile-unified-accounts/std",
"xcm-fee-payment-runtime-api/std",
"xcm-runtime-apis/std",
"pallet-evm-precompile-dispatch-lockdrop/std",
"pallet-dapp-staking/std",
"orml-oracle/std",
Expand Down Expand Up @@ -320,7 +320,7 @@ runtime-benchmarks = [
"polkadot-primitives/runtime-benchmarks",
"polkadot-runtime-common/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-fee-payment-runtime-api/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"cumulus-primitives-core/runtime-benchmarks",
"parachains-common/runtime-benchmarks",
"orml-oracle/runtime-benchmarks",
Expand Down
21 changes: 14 additions & 7 deletions runtime/shibuya/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ use xcm::{
v4::{AssetId as XcmAssetId, Location as XcmLocation},
IntoVersion, VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm,
};
use xcm_fee_payment_runtime_api::{
use xcm_runtime_apis::{
dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects},
fees::Error as XcmPaymentApiError,
};
Expand Down Expand Up @@ -769,6 +769,7 @@ impl pallet_contracts::Config for Runtime {
type UploadOrigin = EnsureSigned<<Self as frame_system::Config>::AccountId>;
type InstantiateOrigin = EnsureSigned<<Self as frame_system::Config>::AccountId>;
type ApiVersion = ();
type MaxTransientStorageSize = ConstU32<{ 1 * 1024 * 1024 }>;
}

// These values are based on the Astar 2.0 Tokenomics Modeling report.
Expand Down Expand Up @@ -1542,6 +1543,11 @@ impl pallet_migrations::Config for Runtime {
#[cfg(feature = "runtime-benchmarks")]
impl vesting_mbm::Config for Runtime {}

impl cumulus_pallet_xcmp_queue::migration::v5::V5Config for Runtime {
// This must be the same as the `ChannelInfo` from the `Config`:
type ChannelList = ParachainSystem;
}

construct_runtime!(
pub struct Runtime
{
Expand Down Expand Up @@ -1655,10 +1661,7 @@ pub type Executive = frame_executive::Executive<
pub type Migrations = (Unreleased, Permanent);

/// Unreleased migrations. Add new ones here:
pub type Unreleased = (
pallet_dapp_staking::migration::AdjustEraMigration<Runtime>,
pallet_inflation::migration::AdjustBlockRewardMigration<Runtime>,
);
pub type Unreleased = (cumulus_pallet_xcmp_queue::migration::v5::MigrateV4ToV5<Runtime>,);

/// Migrations/checks that do not need to be versioned and can run on every upgrade.
pub type Permanent = (pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,);
Expand Down Expand Up @@ -2143,6 +2146,10 @@ impl_runtime_apis! {
pallet_ethereum::CurrentTransactionStatuses::<Runtime>::get()
)
}

fn initialize_pending_block(header: &<Block as BlockT>::Header) {
Executive::initialize_block(header);
}
}

impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {
Expand Down Expand Up @@ -2241,7 +2248,7 @@ impl_runtime_apis! {
}
}

impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi<Block> for Runtime {
impl xcm_runtime_apis::fees::XcmPaymentApi<Block> for Runtime {
fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result<Vec<VersionedAssetId>, XcmPaymentApiError> {
if !matches!(xcm_version, xcm::v3::VERSION | xcm::v4::VERSION) {
return Err(XcmPaymentApiError::UnhandledXcmVersion);
Expand Down Expand Up @@ -2293,7 +2300,7 @@ impl_runtime_apis! {
}
}

impl xcm_fee_payment_runtime_api::dry_run::DryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime {
impl xcm_runtime_apis::dry_run::DryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime {
fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
PolkadotXcm::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call)
}
Expand Down
6 changes: 3 additions & 3 deletions runtime/shiden/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ polkadot-runtime-common = { workspace = true }
xcm = { workspace = true }
xcm-builder = { workspace = true }
xcm-executor = { workspace = true }
xcm-fee-payment-runtime-api = { workspace = true }
xcm-runtime-apis = { workspace = true }

# orml dependencies
orml-oracle = { workspace = true }
Expand Down Expand Up @@ -180,7 +180,7 @@ std = [
"pallet-evm-precompile-dispatch-lockdrop/std",
"pallet-evm-precompile-ed25519/std",
"pallet-evm-precompile-modexp/std",
"xcm-fee-payment-runtime-api/std",
"xcm-runtime-apis/std",
"pallet-evm-precompile-sha3fips/std",
"pallet-dapp-staking/std",
"dapp-staking-runtime-api/std",
Expand Down Expand Up @@ -289,7 +289,7 @@ runtime-benchmarks = [
"polkadot-primitives/runtime-benchmarks",
"polkadot-runtime-common/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-fee-payment-runtime-api/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"cumulus-primitives-core/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"parachains-common/runtime-benchmarks",
Expand Down
Loading

0 comments on commit 50ed03d

Please sign in to comment.