Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
Prepare Trappist v1.3.0 release (#323)
Browse files Browse the repository at this point in the history
Co-authored-by: command-bot <>
Co-authored-by: Steve Degosserie <[email protected]>
  • Loading branch information
metricaez and Steve Degosserie authored Dec 31, 2023
1 parent 1887ad9 commit 9e39a7e
Show file tree
Hide file tree
Showing 30 changed files with 1,629 additions and 1,349 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/try-runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

- name: Setup worker
uses: "./.github/templates/setup-worker"

- name: Cache Build artefacts
uses: actions/cache/restore@v3
id: cargo-cache
Expand All @@ -32,13 +32,16 @@ jobs:
restore-keys: ${{ runner.os }}-cargo-release-${{ env.POLKA_VERSION }}

- name: Install try-runtime
run: cargo install --git https://github.com/paritytech/try-runtime-cli --locked
run: |
echo "---------- Downloading try-runtime CLI ----------"
curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/v0.4.0/try-runtime-x86_64-unknown-linux-musl -o try-runtime
chmod +x ./try-runtime
- run: |
echo "Found label runtime_migration. Running tests"
echo "---------- Running try-runtime for Trappist ----------"
cargo build -p trappist --locked --release --no-default-features --features trappist/trappist-runtime,try-runtime && \
try-runtime --runtime ./target/release/wbuild/trappist-runtime/target/wasm32-unknown-unknown/release/trappist_runtime.wasm \
on-runtime-upgrade --checks pre-and-post --disable-idempotency-checks live --uri wss://rococo-trappist-try-runtime-node.parity-chains.parity.io:443
./try-runtime --runtime ./target/release/wbuild/trappist-runtime/target/wasm32-unknown-unknown/release/trappist_runtime.wasm \
on-runtime-upgrade --checks pre-and-post --no-idempotency-checks live --uri wss://rococo-trappist-try-runtime-node.parity-chains.parity.io:443
env:
RUST_LOG: remote-ext=debug,runtime=debug
2 changes: 1 addition & 1 deletion runtime/stout/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("stout-rococo"),
impl_name: create_runtime_str!("stout-rococo"),
authoring_version: 1,
spec_version: 11000,
spec_version: 13000,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 3,
Expand Down
88 changes: 63 additions & 25 deletions runtime/trappist/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ use frame_support::{
dispatch::DispatchClass,
parameter_types,
traits::{
tokens::UnityAssetBalanceConversion, AsEnsureOriginWithArg, ConstU128, ConstU16, ConstU32,
ConstU64, Contains, EitherOfDiverse, EqualPrivilegeOnly, InsideBoth,
tokens::{PayFromAccount, UnityAssetBalanceConversion},
AsEnsureOriginWithArg, ConstU128, ConstU16, ConstU32, ConstU64, Contains, EitherOfDiverse,
EqualPrivilegeOnly, InsideBoth,
},
weights::{constants::RocksDbWeight, ConstantMultiplier, Weight},
PalletId,
Expand All @@ -48,9 +49,6 @@ pub use parachains_common::{
BlockNumber, Hash, Header, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS,
MAXIMUM_BLOCK_WEIGHT, MINUTES, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
};
use polkadot_runtime_common::impls::{
LocatableAssetConverter, VersionedLocatableAsset, VersionedMultiLocationConverter,
};
pub use polkadot_runtime_common::BlockHashCount;
use polkadot_runtime_common::{prod_or_fast, SlowAdjustingFeeUpdate};
use sp_api::impl_runtime_apis;
Expand All @@ -69,8 +67,6 @@ use sp_std::prelude::*;
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;
use xcm::latest::{prelude::BodyId, InteriorMultiLocation, Junction::PalletInstance};
use xcm::VersionedMultiLocation;
use xcm_builder::PayOverXcm;

use constants::{currency::*, fee::WeightToFee};
use impls::DealWithFees;
Expand Down Expand Up @@ -126,14 +122,36 @@ type EventRecord = frame_system::EventRecord<
<Runtime as frame_system::Config>::Hash,
>;

pub struct FixStorageVersions;

impl frame_support::traits::OnRuntimeUpgrade for FixStorageVersions {
fn on_runtime_upgrade() -> Weight {
use frame_support::traits::{GetStorageVersion, StorageVersion};
use sp_runtime::traits::Saturating;

let mut writes = 0;

/// trappist-rococo runtime v.11000 has an incorrect on-chain storage version of 0 for the Uniques pallet
/// Set the Uniques pallet's storage version to 1 as expected.
if Uniques::on_chain_storage_version() == StorageVersion::new(0) {
Uniques::current_storage_version().put::<Uniques>();
writes.saturating_inc();
}

<Runtime as frame_system::Config>::DbWeight::get().reads_writes(4, writes)
}
}

pub type Migrations = (FixStorageVersions);

/// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive<
Runtime,
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
pallet_contracts::Migration<Runtime>,
Migrations,
>;

impl_opaque_keys! {
Expand All @@ -147,7 +165,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("trappist-rococo"),
impl_name: create_runtime_str!("trappist-rococo"),
authoring_version: 1,
spec_version: 11000,
spec_version: 13000,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 3,
Expand Down Expand Up @@ -644,9 +662,37 @@ parameter_types! {
// The asset's interior location for the paying account. This is the Treasury
// pallet instance (which sits at index 61).
pub TreasuryInteriorLocation: InteriorMultiLocation = PalletInstance(61).into();
pub TreasuryAccount: AccountId = Treasury::account_id();
pub const MaxBalance: Balance = Balance::max_value();
}

#[cfg(feature = "runtime-benchmarks")]
pub mod treasury_benchmark_helper {
use crate::constants::currency::EXISTENTIAL_DEPOSIT;
use crate::{Balances, RuntimeOrigin};
use pallet_treasury::ArgumentsFactory;
use parachains_common::AccountId;
use sp_core::crypto::FromEntropy;

pub struct TreasuryBenchmarkHelper;
impl ArgumentsFactory<(), AccountId> for TreasuryBenchmarkHelper {
fn create_asset_kind(_seed: u32) -> () {
()
}
fn create_beneficiary(seed: [u8; 32]) -> AccountId {
let beneficiary = AccountId::from_entropy(&mut seed.as_slice()).unwrap();
// make sure the account has enough funds
Balances::force_set_balance(
RuntimeOrigin::root(),
sp_runtime::MultiAddress::Id(beneficiary.clone()),
EXISTENTIAL_DEPOSIT,
)
.expect("Failure transferring the existential deposit");
beneficiary
}
}
}

impl pallet_treasury::Config for Runtime {
type Currency = Balances;
type ApproveOrigin = TreasuryApproveCancelOrigin;
Expand All @@ -660,27 +706,18 @@ impl pallet_treasury::Config for Runtime {
type Burn = ();
type PalletId = TreasuryPalletId;
type BurnDestination = ();
type WeightInfo = pallet_treasury::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_treasury::WeightInfo<Runtime>;
type SpendFunds = ();
type MaxApprovals = MaxApprovals;
type SpendOrigin = EnsureWithSuccess<EnsureRoot<AccountId>, AccountId, MaxBalance>;
type AssetKind = VersionedLocatableAsset;
type Beneficiary = VersionedMultiLocation;
type AssetKind = ();
type Beneficiary = Self::AccountId;
type BeneficiaryLookup = IdentityLookup<Self::Beneficiary>;
type Paymaster = PayOverXcm<
TreasuryInteriorLocation,
crate::xcm_config::XcmRouter,
PolkadotXcm,
ConstU32<{ 6 * HOURS }>,
Self::Beneficiary,
Self::AssetKind,
LocatableAssetConverter,
VersionedMultiLocationConverter,
>;
type Paymaster = PayFromAccount<Balances, TreasuryAccount>;
type BalanceConverter = UnityAssetBalanceConversion;
type PayoutPeriod = PayoutSpendPeriod;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = polkadot_runtime_common::impls::benchmarks::TreasuryArguments;
type BenchmarkHelper = treasury_benchmark_helper::TreasuryBenchmarkHelper;
}

impl pallet_withdraw_teleport::Config for Runtime {
Expand Down Expand Up @@ -834,7 +871,8 @@ mod benches {
// XCM
// NOTE: Make sure you point to the individual modules below.
[pallet_xcm_benchmarks::fungible, XcmBalances]
[pallet_xcm_benchmarks::generic, XcmGeneric]
// TODO: Temp comment out due to known bug fixed on v1.5 #2288 on polkadot-sdk
//[pallet_xcm_benchmarks::generic, XcmGeneric]
);
}

Expand Down Expand Up @@ -1134,7 +1172,7 @@ impl_runtime_apis! {

parameter_types! {
pub ExistentialDepositMultiAsset: Option<MultiAsset> = Some((
RelayLocation::get(),
SelfReserve::get(),
ExistentialDeposit::get()
).into());
}
Expand Down
22 changes: 11 additions & 11 deletions runtime/trappist/src/weights/block_weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-11-23 (Y/M/D)
//! HOSTNAME: `runner-yprdrvc7-project-647-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 29.0.0
//! DATE: 2023-12-21 (Y/M/D)
//! HOSTNAME: `runner-q7z7ruxr-project-647-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//!
//! SHORT-NAME: `block`, LONG-NAME: `BlockExecution`, RUNTIME: `Trappist Development`
//! WARMUPS: `10`, REPEAT: `100`
Expand All @@ -43,17 +43,17 @@ parameter_types! {
/// Calculated by multiplying the *Average* with `1.0` and adding `0`.
///
/// Stats nanoseconds:
/// Min, Max: 441_980, 611_195
/// Average: 453_516
/// Median: 450_655
/// Std-Dev: 17529.75
/// Min, Max: 403_476, 436_793
/// Average: 412_480
/// Median: 411_095
/// Std-Dev: 6537.8
///
/// Percentiles nanoseconds:
/// 99th: 476_316
/// 95th: 468_094
/// 75th: 455_104
/// 99th: 430_157
/// 95th: 427_203
/// 75th: 414_337
pub const BlockExecutionWeight: Weight =
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(453_516), 0);
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(412_480), 0);
}

#[cfg(test)]
Expand Down
14 changes: 7 additions & 7 deletions runtime/trappist/src/weights/cumulus_pallet_xcmp_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

//! Autogenerated weights for `cumulus_pallet_xcmp_queue`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-11-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 29.0.0
//! DATE: 2023-12-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-yprdrvc7-project-647-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-q7z7ruxr-project-647-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("trappist-dev")`, DB CACHE: 1024

// Executed Command:
Expand Down Expand Up @@ -56,8 +56,8 @@ impl<T: frame_system::Config> cumulus_pallet_xcmp_queue::WeightInfo for WeightIn
// Proof Size summary in bytes:
// Measured: `76`
// Estimated: `1561`
// Minimum execution time: 5_791_000 picoseconds.
Weight::from_parts(6_211_000, 0)
// Minimum execution time: 5_060_000 picoseconds.
Weight::from_parts(5_393_000, 0)
.saturating_add(Weight::from_parts(0, 1561))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -68,8 +68,8 @@ impl<T: frame_system::Config> cumulus_pallet_xcmp_queue::WeightInfo for WeightIn
// Proof Size summary in bytes:
// Measured: `76`
// Estimated: `1561`
// Minimum execution time: 5_878_000 picoseconds.
Weight::from_parts(6_112_000, 0)
// Minimum execution time: 4_991_000 picoseconds.
Weight::from_parts(5_248_000, 0)
.saturating_add(Weight::from_parts(0, 1561))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand Down
22 changes: 11 additions & 11 deletions runtime/trappist/src/weights/extrinsic_weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-11-23 (Y/M/D)
//! HOSTNAME: `runner-yprdrvc7-project-647-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 29.0.0
//! DATE: 2023-12-21 (Y/M/D)
//! HOSTNAME: `runner-q7z7ruxr-project-647-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//!
//! SHORT-NAME: `extrinsic`, LONG-NAME: `ExtrinsicBase`, RUNTIME: `Trappist Development`
//! WARMUPS: `10`, REPEAT: `100`
Expand All @@ -43,17 +43,17 @@ parameter_types! {
/// Calculated by multiplying the *Average* with `1.0` and adding `0`.
///
/// Stats nanoseconds:
/// Min, Max: 130_591, 132_299
/// Average: 131_374
/// Median: 131_351
/// Std-Dev: 369.27
/// Min, Max: 118_370, 119_984
/// Average: 118_916
/// Median: 118_877
/// Std-Dev: 287.98
///
/// Percentiles nanoseconds:
/// 99th: 132_205
/// 95th: 132_034
/// 75th: 131_614
/// 99th: 119_710
/// 95th: 119_478
/// 75th: 119_102
pub const ExtrinsicBaseWeight: Weight =
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(131_374), 0);
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(118_916), 0);
}

#[cfg(test)]
Expand Down
Loading

0 comments on commit 9e39a7e

Please sign in to comment.