Skip to content

Commit

Permalink
Merge pull request #104 from paseo-network/hb-upgrading-ah-1.2.5
Browse files Browse the repository at this point in the history
Adding a few missing steps in AH 1.2.5
  • Loading branch information
hbulgarini authored Jul 25, 2024
2 parents e7265b1 + 2c45e43 commit 15ee4ee
Show file tree
Hide file tree
Showing 6 changed files with 308 additions and 16 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions system-parachains/asset-hub-paseo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pallet-transaction-payment = { workspace = true }
pallet-transaction-payment-rpc-runtime-api = { workspace = true }
pallet-uniques = { workspace = true }
pallet-utility = { workspace = true }
pallet-vesting = { workspace = true }
sp-api = { workspace = true }
sp-block-builder = { workspace = true }
sp-consensus-aura = { workspace = true }
Expand Down Expand Up @@ -131,6 +132,7 @@ runtime-benchmarks = [
"pallet-timestamp/runtime-benchmarks",
"pallet-uniques/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"pallet-vesting/runtime-benchmarks",
"pallet-xcm-benchmarks/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"parachains-common/runtime-benchmarks",
Expand Down Expand Up @@ -168,6 +170,7 @@ try-runtime = [
"pallet-transaction-payment/try-runtime",
"pallet-uniques/try-runtime",
"pallet-utility/try-runtime",
"pallet-vesting/try-runtime",
"pallet-xcm/try-runtime",
"parachain-info/try-runtime",
"polkadot-runtime-common/try-runtime",
Expand Down
52 changes: 39 additions & 13 deletions system-parachains/asset-hub-paseo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, ConstU128, OpaqueMetadata};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, Verify},
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto, Verify},
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, Perbill, Permill,
};
Expand All @@ -95,7 +95,7 @@ use frame_support::{
traits::{
fungible, fungibles, tokens::imbalance::ResolveAssetTo, AsEnsureOriginWithArg, ConstBool,
ConstU32, ConstU64, ConstU8, EitherOfDiverse, InstanceFilter, NeverEnsureOrigin,
TransformOrigin,
TransformOrigin, WithdrawReasons,
},
weights::{ConstantMultiplier, Weight},
PalletId,
Expand All @@ -106,7 +106,7 @@ use frame_system::{
};
use pallet_nfts::PalletFeatures;
use parachains_common::{
message_queue::*, AccountId, AssetHubPolkadotAuraId as AuraId, AssetIdForTrustBackedAssets,
message_queue::*, AccountId, AssetHubPolkadotAuraId as AuraId, AssetIdForTrustBackedAssets,
Balance, BlockNumber, Hash, Header, Nonce, Signature,
};

Expand Down Expand Up @@ -143,10 +143,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("asset-hub-paseo"),
impl_name: create_runtime_str!("asset-hub-paseo"),
authoring_version: 1,
spec_version: 1_001_002,
spec_version: 1_001_005,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 14,
transaction_version: 15,
state_version: 0,
};

Expand Down Expand Up @@ -246,6 +246,26 @@ impl pallet_balances::Config for Runtime {
type MaxFreezes = ConstU32<0>;
}

parameter_types! {
pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons =
WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE);
}

impl pallet_vesting::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type BlockNumberToBalance = ConvertInto;
type MinVestedTransfer = ExistentialDeposit;
type WeightInfo = weights::pallet_vesting::WeightInfo<Runtime>;
type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons;
/// Note for wallets and implementers: This means that vesting schedules are evaluated with the
/// block number of the Relay Chain, not the parachain. This is because with Coretime and Async
/// Backing, parachain block numbers may not be a good proxy for time. Vesting schedules should
/// be set accordingly.
type BlockNumberProvider = cumulus_pallet_parachain_system::RelaychainDataProvider<Runtime>;
const MAX_VESTING_SCHEDULES: u32 = 28;
}

parameter_types! {
/// Relay Chain `TransactionByteFee` / 10
pub const TransactionByteFee: Balance = MILLICENTS;
Expand All @@ -254,11 +274,11 @@ parameter_types! {

impl pallet_transaction_payment::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type OnChargeTransaction = impls::tx_payment::FungiblesAdapter<
NativeAndAssets,
DotLocationV3,
ResolveAssetTo<StakingPot, NativeAndAssets>,
>;
type OnChargeTransaction = impls::tx_payment::FungiblesAdapter<
NativeAndAssets,
DotLocationV3,
ResolveAssetTo<StakingPot, NativeAndAssets>,
>;
type WeightToFee = WeightToFee;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
Expand Down Expand Up @@ -437,7 +457,10 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
RuntimeCall::Balances { .. } |
RuntimeCall::Assets { .. } |
RuntimeCall::Nfts { .. } |
RuntimeCall::Uniques { .. }
RuntimeCall::Uniques { .. } |
// We allow calling `vest` and merging vesting schedules, but obviously not
// vested transfers.
RuntimeCall::Vesting(pallet_vesting::Call::vested_transfer { .. })
),
ProxyType::CancelProxy => matches!(
c,
Expand Down Expand Up @@ -710,7 +733,7 @@ impl pallet_asset_conversion_tx_payment::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Fungibles = LocalAndForeignAssets;
type OnChargeAssetTransaction =
impls::tx_payment::SwapCreditAdapter<DotLocationV3, AssetConversion>;
impls::tx_payment::SwapCreditAdapter<DotLocationV3, AssetConversion>;
}

parameter_types! {
Expand Down Expand Up @@ -884,6 +907,7 @@ construct_runtime!(
Balances: pallet_balances = 10,
TransactionPayment: pallet_transaction_payment = 11,
AssetTxPayment: pallet_asset_conversion_tx_payment = 13,
Vesting: pallet_vesting = 14,

// Collator support. the order of these 5 are important and shall not change.
Authorship: pallet_authorship = 20,
Expand All @@ -896,6 +920,7 @@ construct_runtime!(
XcmpQueue: cumulus_pallet_xcmp_queue = 30,
PolkadotXcm: pallet_xcm = 31,
CumulusXcm: cumulus_pallet_xcm = 32,
// DmpQueue: cumulus_pallet_dmp_queue = 33, removed
MessageQueue: pallet_message_queue = 35,

// Handy utilities.
Expand Down Expand Up @@ -935,7 +960,7 @@ pub type SignedExtra = (
);
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;

parameter_types! {
pub DmpQueueName: &'static str = "DmpQueue";
Expand Down Expand Up @@ -980,6 +1005,7 @@ mod benches {
[pallet_session, SessionBench::<Runtime>]
[pallet_uniques, Uniques]
[pallet_utility, Utility]
[pallet_vesting, Vesting]
[pallet_timestamp, Timestamp]
[pallet_collator_selection, CollatorSelection]
[cumulus_pallet_parachain_system, ParachainSystem]
Expand Down
1 change: 1 addition & 0 deletions system-parachains/asset-hub-paseo/src/weights/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub mod pallet_session;
pub mod pallet_timestamp;
pub mod pallet_uniques;
pub mod pallet_utility;
pub mod pallet_vesting;
pub mod pallet_xcm;
pub mod paritydb_weights;
pub mod rocksdb_weights;
Expand Down
Loading

0 comments on commit 15ee4ee

Please sign in to comment.