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

Upgrade to polkadot-stable2412-1 #448

Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
6,491 changes: 3,913 additions & 2,578 deletions Cargo.lock

Large diffs are not rendered by default.

251 changes: 128 additions & 123 deletions Cargo.toml

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pallet-aura.workspace = true
pallet-session.workspace = true
pallet-proxy-bonding.workspace = true
pallet-skip-feeless-payment.workspace = true
xcm-fee-payment-runtime-api.workspace = true
xcm-runtime-apis.workspace = true
hex-literal.workspace = true
hex.workspace = true
assets-common.workspace = true
Expand Down Expand Up @@ -152,8 +152,9 @@ std = [
"rococo-runtime/std",
"xcm-builder/std",
"xcm-executor/std",
"xcm-fee-payment-runtime-api/std",
"xcm-runtime-apis/std",
"xcm/std",
"assets-common/std"
]
development-settings = [ "polimec-runtime/development-settings" ]
runtime-benchmarks = [
Expand Down Expand Up @@ -195,5 +196,7 @@ runtime-benchmarks = [
"rococo-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-fee-payment-runtime-api/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"assets-common/runtime-benchmarks",
"pallet-transaction-payment/runtime-benchmarks"
]
15 changes: 8 additions & 7 deletions integration-tests/penpal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ sp-session = { workspace = true }
sp-transaction-pool = { workspace = true }
sp-version = { workspace = true }
sp-std = { workspace = true }
sp-storage = { version = "21.0.0", default-features = false }
pallet-collator-selection = { version = "16.0.0", default-features = false }
sp-storage = { workspace = true }
pallet-collator-selection = { workspace = true }
# Polkadot
polkadot-primitives = { workspace = true }
pallet-xcm = { workspace = true }
Expand All @@ -83,9 +83,9 @@ cumulus-primitives-utility = { workspace = true }
parachain-info = { workspace = true }
parachains-common = { workspace = true }
polkadot-runtime-parachains = { workspace = true }
assets-common = { version = "0.14.0", default-features = false }
testnet-parachains-constants = { version = "7.0.0", default-features = false }
xcm-fee-payment-runtime-api = { version = "0.4.0", default-features = false }
assets-common = { workspace = true }
testnet-parachains-constants = { workspace = true }
xcm-runtime-apis = { workspace = true }

[features]
default = [ "std" ]
Expand Down Expand Up @@ -147,7 +147,7 @@ std = [
"testnet-parachains-constants/std",
"xcm-builder/std",
"xcm-executor/std",
"xcm-fee-payment-runtime-api/std",
"xcm-runtime-apis/std",
"xcm/std",
]

Expand Down Expand Up @@ -182,7 +182,8 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-fee-payment-runtime-api/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"pallet-transaction-payment/runtime-benchmarks"
]

try-runtime = [
Expand Down
16 changes: 10 additions & 6 deletions integration-tests/penpal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ use xcm::{
latest::prelude::{AssetId as AssetLocationId, BodyId},
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 @@ -239,7 +239,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
state_version: 1,
system_version: 1,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably be bumped to system_version: 2 (?)

};

/// This determines the average expected block time that we are targeting.
Expand Down Expand Up @@ -398,6 +398,7 @@ impl pallet_balances::Config for Runtime {
type AccountStore = System;
/// The type for recording an account's balance.
type Balance = Balance;
type DoneSlashHandler = ();
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type FreezeIdentifier = ();
Expand All @@ -423,6 +424,7 @@ impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = pallet_transaction_payment::FungibleAdapter<Balances, ()>;
type OperationalFeeMultiplier = ConstU8<5>;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
type WeightToFee = WeightToFee;
}

Expand Down Expand Up @@ -517,6 +519,7 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
type ReservedDmpWeight = ReservedDmpWeight;
type ReservedXcmpWeight = ReservedXcmpWeight;
type RuntimeEvent = RuntimeEvent;
type SelectCore = cumulus_pallet_parachain_system::DefaultCoreSelector<Self>;
type SelfParaId = parachain_info::Pallet<Runtime>;
type WeightInfo = ();
type XcmpMessageHandler = XcmpQueue;
Expand Down Expand Up @@ -634,6 +637,7 @@ impl pallet_asset_tx_payment::Config for Runtime {
AssetsToBlockAuthor<Runtime, pallet_assets::Instance1>,
>;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
}

impl pallet_sudo::Config for Runtime {
Expand Down Expand Up @@ -888,7 +892,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> {
let acceptable_assets = vec![AssetLocationId(xcm_config::RelayLocation::get())];
PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets)
Expand All @@ -901,11 +905,11 @@ impl_runtime_apis! {
Ok(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:?}!");
log::trace!(target: "xcm::xcm_runtime_apis", "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:?}!");
log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!");
Err(XcmPaymentApiError::VersionedConversionFailed)
}
}
Expand All @@ -920,7 +924,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> {
use xcm_builder::InspectMessageQueues;
use xcm_executor::RecordXcm;
Expand Down
15 changes: 7 additions & 8 deletions integration-tests/penpal/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ use parachains_common::{xcm_config::AssetFeeAsExistentialDepositMultiplier, TREA
use polkadot_parachain_primitives::primitives::Sibling;
use polkadot_runtime_common::{impls::ToAuthor, xcm_sender::ExponentialPrice};
use sp_runtime::traits::{AccountIdConversion, ConvertInto, Identity, TryConvertInto};
use xcm::latest::prelude::*;
use xcm::{latest::prelude::*, v5::WESTEND_GENESIS_HASH};
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowHrmpNotificationsFromRelayChain,
AllowKnownQueryResponses, AllowSubscriptionsFrom, AsPrefixedGeneralIndex, ConvertedConcreteId, EnsureXcmOrigin,
FixedWeightBounds, FrameTransactionalProcessor, FungibleAdapter, FungiblesAdapter, IsConcrete, LocalMint,
NativeAsset, NoChecking, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation,
StartsWith, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents, WithComputedOrigin, WithUniqueTopic,
XcmFeeManagerFromComponents, XcmFeeToAccount,
NativeAsset, NoChecking, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SendXcmFeeToAccount,
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, StartsWith, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
WithComputedOrigin, WithUniqueTopic, XcmFeeManagerFromComponents,
};
use xcm_executor::{traits::JustTry, XcmExecutor};

Expand All @@ -60,7 +60,7 @@ parameter_types! {
// The Penpal runtime is utilized for testing with various environment setups.
// This storage item allows us to customize the `NetworkId` where Penpal is deployed.
// By default, it is set to `NetworkId::Rococo` and can be changed using `System::set_storage`.
pub storage RelayNetworkId: NetworkId = NetworkId::Westend;
pub storage RelayNetworkId: NetworkId = NetworkId::ByGenesis(WESTEND_GENESIS_HASH);
pub RelayNetwork: Option<NetworkId> = Some(RelayNetworkId::get());
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
pub UniversalLocation: InteriorLocation = [
Expand Down Expand Up @@ -328,8 +328,7 @@ impl xcm_executor::Config for XcmConfig {
type AssetTrap = PolkadotXcm;
type Barrier = Barrier;
type CallDispatcher = RuntimeCall;
type FeeManager =
XcmFeeManagerFromComponents<(), XcmFeeToAccount<Self::AssetTransactor, AccountId, TreasuryAccount>>;
type FeeManager = XcmFeeManagerFromComponents<(), SendXcmFeeToAccount<Self::AssetTransactor, TreasuryAccount>>;
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type HrmpNewChannelOpenRequestHandler = ();
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ pub mod polkadot {
pub mod penpal {
use super::*;
use crate::{ParaId, Penpal, PolkadotNet};
use xcm::v4::Parent;
use xcm::v5::Parent;
pub const PARA_ID: u32 = 6969;
pub const ED: Balance = penpal_runtime::EXISTENTIAL_DEPOSIT;

Expand Down Expand Up @@ -355,7 +355,7 @@ pub mod polimec {
use super::*;
use crate::{PolimecNet, PolimecOrigin, PolimecRuntime};
use polimec_runtime::{BlockchainOperationTreasury, TreasuryAccount};
use xcm::v4::{Location, Parent};
use xcm::v5::{Location, Parent};
use xcm_emulator::TestExt;

pub const PARA_ID: u32 = 3344;
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/src/tests/ct_migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,12 @@ fn hrmp_functions_weight_is_under_assumed_maximum() {
type WeightInfo = <PolimecRuntime as pallet_funding::Config>::WeightInfo;
type XcmWeigher = <polimec_runtime::xcm_config::XcmConfig as xcm_executor::Config>::Weigher;

let open_channel_message = xcm::v4::Instruction::<PolimecCall>::HrmpNewChannelOpenRequest {
let open_channel_message = xcm::v5::Instruction::<PolimecCall>::HrmpNewChannelOpenRequest {
sender: 6969,
max_message_size: 102_300,
max_capacity: 1000,
};
let channel_accepted_message = xcm::v4::Instruction::<PolimecCall>::HrmpChannelAccepted { recipient: 6969u32 };
let channel_accepted_message = xcm::v5::Instruction::<PolimecCall>::HrmpChannelAccepted { recipient: 6969u32 };

let open_channel_message_real_weight = WeightInfo::do_handle_channel_open_request();
let open_channel_message_deducted_weight = XcmWeigher::instr_weight(&open_channel_message).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/src/tests/evaluator_slash_sideffects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use polimec_common::USD_UNIT;
use polimec_runtime::PLMC;
use sp_arithmetic::Perquintill;
use sp_runtime::{FixedU128, MultiAddress::Id};
use xcm::v4::Junction;
use xcm::v5::Junction;

generate_accounts!(STASH, ALICE, BOB, CHARLIE, DAVE, ISSUER);

Expand Down
4 changes: 2 additions & 2 deletions integration-tests/src/tests/runtime_apis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use frame_support::traits::{
};
use polimec_common::assets::AcceptedFundingAsset;
use sp_arithmetic::FixedU128;
use xcm::v4::Junctions::X3;
use xcm_fee_payment_runtime_api::fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1;
use xcm::v5::Junctions::X3;
use xcm_runtime_apis::fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1;

mod xcm_payment_api {
use super::*;
Expand Down
9 changes: 2 additions & 7 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,7 @@ benchmark-runtime:
cargo run --features runtime-benchmarks --profile=production -p polimec-node benchmark pallet
# Load all pallet names in an array.
pallets=($(
${benchmarkCommand} --list --chain=${chainSpec} |\
tail -n+2 |\
cut -d',' -f1 |\
sort |\
uniq
))
${benchmarkCommand} --list=pallets --chain=${chainSpec}))

echo "[+] Benchmarking ${#pallets[@]} pallets"

Expand All @@ -71,7 +66,7 @@ benchmark-runtime:
--chain=${chainSpec} \
--wasm-execution=compiled \
--pallet=$pallet \
--extrinsic='*' \
--extrinsic="*" \
--steps=$steps \
--repeat=$repeat \
--output=$weightsDir/$output_pallet.rs
Expand Down
2 changes: 2 additions & 0 deletions nodes/parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,14 @@ runtime-benchmarks = [
"polkadot-primitives/runtime-benchmarks",
"sc-service/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"polimec-common/runtime-benchmarks"
]
try-runtime = [
"pallet-funding/try-runtime",
"polimec-runtime/try-runtime",
"polkadot-cli/try-runtime",
"sp-runtime/try-runtime",
"polimec-common/try-runtime"
]
on-chain-release-build = [ "polimec-runtime/on-chain-release-build" ]
development-settings = [ "polimec-runtime/development-settings" ]
2 changes: 1 addition & 1 deletion nodes/parachain/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

use cumulus_primitives_core::ParaId;
use polimec_runtime::{AccountId, Signature};
use polkadot_primitives::v7::LOWEST_PUBLIC_ID;
use polkadot_primitives::v8::LOWEST_PUBLIC_ID;
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use sc_service::Properties;
use serde::{Deserialize, Serialize};
Expand Down
20 changes: 7 additions & 13 deletions nodes/parachain/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use std::{net::SocketAddr, path::PathBuf};
use std::path::PathBuf;

use cumulus_client_service::storage_proof_size::HostFunctions as ReclaimHostFunctions;
use cumulus_primitives_core::ParaId;
use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
use log::info;
use polimec_runtime::Block;
use sc_cli::{
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, NetworkParams, Result,
SharedParams, SubstrateCli,
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, LoggerBuilder,
NetworkParams, Result, SharedParams, SubstrateCli,
};
use sc_service::config::{BasePath, PrometheusConfig};

Expand Down Expand Up @@ -252,7 +252,7 @@ pub fn run() -> Result<()> {
let hwbench = (!cli.no_hardware_benchmarks)
.then_some(config.database.path().map(|database_path| {
let _ = std::fs::create_dir_all(database_path);
sc_sysinfo::gather_hwbench(Some(database_path))
sc_sysinfo::gather_hwbench(Some(database_path), &SUBSTRATE_REFERENCE_HARDWARE)
}))
.flatten();

Expand Down Expand Up @@ -317,7 +317,7 @@ impl CliConfiguration<Self> for RelayChainCli {
Ok(self.shared_params().base_path()?.or_else(|| self.base_path.clone().map(Into::into)))
}

fn rpc_addr(&self, default_listen_port: u16) -> Result<Option<SocketAddr>> {
fn rpc_addr(&self, default_listen_port: u16) -> Result<Option<Vec<sc_cli::RpcEndpoint>>> {
self.base.base.rpc_addr(default_listen_port)
}

Expand All @@ -329,15 +329,9 @@ impl CliConfiguration<Self> for RelayChainCli {
self.base.base.prometheus_config(default_listen_port, chain_spec)
}

fn init<F>(
&self,
_support_url: &String,
_impl_version: &String,
_logger_hook: F,
_config: &sc_service::Configuration,
) -> Result<()>
fn init<F>(&self, _support_url: &String, _impl_version: &String, _logger_hook: F) -> Result<()>
where
F: FnOnce(&mut sc_cli::LoggerBuilder, &sc_service::Configuration),
F: FnOnce(&mut LoggerBuilder),
{
unreachable!("PolkadotCli is never initialized; qed");
}
Expand Down
7 changes: 2 additions & 5 deletions nodes/parachain/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use std::sync::Arc;

use polimec_runtime::{opaque::Block, AccountId, Balance, Nonce};

pub use sc_rpc::DenyUnsafe;
use sc_transaction_pool_api::TransactionPool;
use sp_api::ProvideRuntimeApi;
use sp_block_builder::BlockBuilder;
Expand All @@ -37,8 +36,6 @@ pub struct FullDeps<C, P> {
pub client: Arc<C>,
/// Transaction pool instance.
pub pool: Arc<P>,
/// Whether to deny unsafe calls
pub deny_unsafe: DenyUnsafe,
}

/// Instantiate all RPC extensions.
Expand All @@ -59,9 +56,9 @@ where
use substrate_frame_rpc_system::{System, SystemApiServer};

let mut module = RpcExtension::new(());
let FullDeps { client, pool, deny_unsafe } = deps;
let FullDeps { client, pool } = deps;

module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
module.merge(System::new(client.clone(), pool).into_rpc())?;
module.merge(TransactionPayment::new(client).into_rpc())?;
Ok(module)
}
Loading