Skip to content

Commit

Permalink
Feature/post 0.32.0 update (#681)
Browse files Browse the repository at this point in the history
  • Loading branch information
majusko authored Jan 31, 2024
2 parents 1179d22 + a7d9cdd commit c4c986c
Show file tree
Hide file tree
Showing 46 changed files with 1,107 additions and 1,042 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/reusable-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ permissions:
jobs:
build-node-image:
name: Build Docker image
runs-on: [compile-gke]
runs-on: [compile]
container:
image: ${{ inputs.builder_image }}
env:
DOCKER_HOST: "unix:///run/docker/docker.sock"
volumes:
- /run/docker:/run/docker
# env:
# DOCKER_HOST: "unix:///run/docker/docker.sock"
# volumes:
# - /run/docker:/run/docker
steps:
- uses: actions/checkout@v3
- name: Authenticate to Google Cloud
Expand Down Expand Up @@ -150,7 +150,7 @@ jobs:

unit-test:
name: Unit tests
runs-on: [compile-gke]
runs-on: [compile]
container:
image: ${{ inputs.builder_image }}
steps:
Expand Down Expand Up @@ -178,7 +178,7 @@ jobs:

coverage-report:
name: Coverage report
runs-on: [compile-gke]
runs-on: [compile]
container:
image: ${{ inputs.builder_image }}
options: --security-opt seccomp=unconfined
Expand Down Expand Up @@ -243,7 +243,7 @@ jobs:

build-and-run-try-runtime:
name: Run try-runtime checks
runs-on: [compile-gke]
runs-on: [compile]
container:
image: ${{ inputs.builder_image }}
steps:
Expand Down Expand Up @@ -280,7 +280,7 @@ jobs:
run-benchmarks:
name: Run runtime benchmarks
# `performance` self-hosted runners have 8 cores and 16GB of RAM
runs-on: [performance-gke]
runs-on: [compile]
env:
STEPS: 2
REPEATS: 1
Expand Down Expand Up @@ -346,7 +346,7 @@ jobs:

build-wasms:
name: Export wasm artifacts
runs-on: [compile-gke]
runs-on: [compile]
env:
STEPS: 2
REPEATS: 1
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/reusable-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ jobs:
- command: "yarn test-parallel-3rdPartyRewards"
fast: true

runs-on: [e2e-gke]
runs-on: [compile]
timeout-minutes: 180
env:
API_URL: "ws://127.0.0.1:9946"
Expand Down Expand Up @@ -288,6 +288,10 @@ jobs:
run: |
docker kill $(docker ps -q) 2>/dev/null && echo $?
docker-compose down -v
- name: Fix permissions on self-hosted runner
if: always()
run: chown -R 1100:1100 $GITHUB_WORKSPACE

test-complete:
needs: [setup-report, e2e-test-matrix]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-perfomance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
performance-tests:
# Allows to keep e2e tests jobs running even if performance-tests fail
continue-on-error: true
runs-on: [compile-gke]
runs-on: [compile]
timeout-minutes: 180
env:
ENV_REF: ${{ inputs.targetEnv || format('pr-{0}', github.event.number) }}
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

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

11 changes: 0 additions & 11 deletions pallets/bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,17 +270,6 @@ pub mod pallet {
T::DbWeight::get().reads(2)
}
}

fn on_runtime_upgrade() -> Weight {
let onchain = Pallet::<T>::on_chain_storage_version();
if onchain == 0 {
STORAGE_VERSION.put::<Pallet<T>>();
T::DbWeight::get().reads_writes(1, 1)
} else {
log!(warn, "skipping version upgrade, remove migration");
T::DbWeight::get().reads(1)
}
}
}

#[cfg(feature = "runtime-benchmarks")]
Expand Down
109 changes: 94 additions & 15 deletions runtime/common/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,109 @@ use log::info;
use mangata_types::assets::CustomMetadata;
use sp_std::marker::PhantomData;

pub struct AssetRegistryMigration<Runtime>(PhantomData<Runtime>);
pub struct PalletsVersionsAlignment<Runtime>(PhantomData<Runtime>);

impl<T> OnRuntimeUpgrade for AssetRegistryMigration<T>
impl<T> OnRuntimeUpgrade for PalletsVersionsAlignment<T>
where
T: orml_asset_registry::Config<
CustomMetadata = CustomMetadata,
AssetId = TokenId,
Balance = Balance,
StringLimit = StringLimit,
> + orml_tokens::Config<CurrencyId = TokenId>,
T: orml_asset_registry::Config,
T: orml_tokens::Config,
T: pallet_maintenance::Config,
T: orml_unknown_tokens::Config,
T: pallet_xcm::Config,
T: pallet_bootstrap::Config,
T: pallet_crowdloan_rewards::Config,
T: pallet_fee_lock::Config,
T: cumulus_pallet_dmp_queue::Config,
T: cumulus_pallet_xcmp_queue::Config,
{
fn on_runtime_upgrade() -> Weight {
info!(
target: "asset_registry",
target: "migration::versions-alignment",
"on_runtime_upgrade: Attempted to apply AssetRegistry migration"
);

let version = orml_asset_registry::Pallet::<T>::on_chain_storage_version();
if version == 2 {
info!(target: "asset-registry", "No migration applied, remove");
T::DbWeight::get().reads(1)
let mut reads = 0;
let mut writes = 0;

// Maintanance -> 0
// currently set to null that defaults to 0
StorageVersion::new(0).put::<pallet_maintenance::Pallet<T>>();
writes += 1;

// AssetRegistry -> 2
if orml_asset_registry::Pallet::<T>::on_chain_storage_version() == 2 {
info!(target: "migration::asset-registry", "No migration applied, remove");
reads += 1;
} else {
info!(target: "migration::asset-registry", "Migration applied");
StorageVersion::new(2).put::<orml_asset_registry::Pallet<T>>();
T::DbWeight::get().reads_writes(1, 1)
}
reads += 1;
writes += 1;
};

//UnknwonTokens -> 2
if orml_unknown_tokens::Pallet::<T>::on_chain_storage_version() == 2 {
info!(target: "migration::unknown-tokens", "No migration applied, remove");
reads += 1;
} else {
info!(target: "migration::unknown-tokens", "Migration applied");
StorageVersion::new(2).put::<orml_unknown_tokens::Pallet<T>>();
reads += 1;
writes += 1;
};

// PolkadotXcm -> 1
if pallet_xcm::Pallet::<T>::on_chain_storage_version() == 1 {
info!(target: "migration::pallet_xcm", "No migration applied, remove");
reads += 1;
} else {
info!(target: "migration::pallet_xcm", "Migration applied");
StorageVersion::new(1).put::<pallet_xcm::Pallet<T>>();
reads += 1;
writes += 1;
};

// Bootstrap -> 2
if pallet_bootstrap::Pallet::<T>::on_chain_storage_version() == 2 {
info!(target: "migration::pallet_bootstrap", "No migration applied, remove");
reads += 1;
} else {
info!(target: "migration::pallet_bootstrap", "Migration applied");
StorageVersion::new(2).put::<pallet_bootstrap::Pallet<T>>();
reads += 1;
writes += 1;
};

// Crowdloan -> 1
if pallet_crowdloan_rewards::Pallet::<T>::on_chain_storage_version() == 1 {
info!(target: "migration::pallet_crowdloan_rewards", "No migration applied, remove");
reads += 1;
} else {
info!(target: "migration::pallet_crowdloan_rewards", "Migration applied");
StorageVersion::new(1).put::<pallet_crowdloan_rewards::Pallet<T>>();
reads += 1;
writes += 1;
};

// FeeLock -> 0
// currently set to null that defaults to 0
StorageVersion::new(0).put::<pallet_fee_lock::Pallet<T>>();
writes += 1;

T::DbWeight::get().reads_writes(reads, writes)
}

#[cfg(feature = "try-runtime")]
fn post_upgrade(_state: sp_std::vec::Vec<u8>) -> Result<(), sp_runtime::TryRuntimeError> {
assert_eq!(orml_asset_registry::Pallet::<T>::on_chain_storage_version(), 2);
assert_eq!(pallet_maintenance::Pallet::<T>::on_chain_storage_version(), 0);
assert_eq!(orml_unknown_tokens::Pallet::<T>::on_chain_storage_version(), 2);
assert_eq!(pallet_bootstrap::Pallet::<T>::on_chain_storage_version(), 2);
assert_eq!(pallet_crowdloan_rewards::Pallet::<T>::on_chain_storage_version(), 1);
assert_eq!(pallet_fee_lock::Pallet::<T>::on_chain_storage_version(), 0);
assert_eq!(cumulus_pallet_dmp_queue::Pallet::<T>::on_chain_storage_version(), 2);
assert_eq!(cumulus_pallet_xcmp_queue::Pallet::<T>::on_chain_storage_version(), 3);
assert_eq!(pallet_xcm::Pallet::<T>::on_chain_storage_version(), 1);
Ok(())
}
}
6 changes: 1 addition & 5 deletions runtime/mangata-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,7 @@ pub type Executive = frame_executive::Executive<
Migrations,
>;

type Migrations = (
common_runtime::migration::AssetRegistryMigration<Runtime>,
pallet_xcm::migration::v1::VersionUncheckedMigrateToV1<Runtime>,
orml_unknown_tokens::Migration<Runtime>,
);
type Migrations = (common_runtime::migration::PalletsVersionsAlignment<Runtime>,);

/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
/// the specifics of the runtime. They can then be made to be agnostic over specific formats
Expand Down
20 changes: 10 additions & 10 deletions runtime/mangata-kusama/src/weights/block_weights.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-11-29 (Y/M/D)
//! HOSTNAME: `cd63f32c58dd`, CPU: `AMD EPYC 7B12`
//! DATE: 2024-01-09 (Y/M/D)
//! HOSTNAME: `af2cb189db8d`, CPU: `AMD EPYC 7B13`
//!
//! SHORT-NAME: `block`, LONG-NAME: `BlockExecution`, RUNTIME: `Mangata Kusama Local`
//! WARMUPS: `10`, REPEAT: `100`
Expand Down Expand Up @@ -29,17 +29,17 @@ parameter_types! {
/// Calculated by multiplying the *Average* with `1.0` and adding `0`.
///
/// Stats nanoseconds:
/// Min, Max: 24_891_029, 26_810_049
/// Average: 25_377_421
/// Median: 25_276_259
/// Std-Dev: 401027.07
/// Min, Max: 26_916_778, 31_638_388
/// Average: 28_489_486
/// Median: 28_464_418
/// Std-Dev: 976072.11
///
/// Percentiles nanoseconds:
/// 99th: 26_762_049
/// 95th: 26_403_029
/// 75th: 25_427_019
/// 99th: 31_225_878
/// 95th: 30_092_347
/// 75th: 29_178_298
pub const BlockExecutionWeight: Weight =
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(25_377_421), 0);
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(28_489_486), 0);
}

#[cfg(test)]
Expand Down
20 changes: 10 additions & 10 deletions runtime/mangata-kusama/src/weights/extrinsic_weights.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-11-29 (Y/M/D)
//! HOSTNAME: `cd63f32c58dd`, CPU: `AMD EPYC 7B12`
//! DATE: 2024-01-09 (Y/M/D)
//! HOSTNAME: `af2cb189db8d`, CPU: `AMD EPYC 7B13`
//!
//! SHORT-NAME: `extrinsic`, LONG-NAME: `ExtrinsicBase`, RUNTIME: `Mangata Kusama Local`
//! WARMUPS: `10`, REPEAT: `100`
Expand Down Expand Up @@ -29,17 +29,17 @@ parameter_types! {
/// Calculated by multiplying the *Average* with `1.0` and adding `0`.
///
/// Stats nanoseconds:
/// Min, Max: 207_838, 229_040
/// Average: 213_832
/// Median: 213_109
/// Std-Dev: 4058.62
/// Min, Max: 181_689, 199_921
/// Average: 187_355
/// Median: 186_772
/// Std-Dev: 3058.03
///
/// Percentiles nanoseconds:
/// 99th: 225_744
/// 95th: 220_845
/// 75th: 216_205
/// 99th: 195_738
/// 95th: 192_306
/// 75th: 188_874
pub const ExtrinsicBaseWeight: Weight =
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(213_832), 0);
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(187_355), 0);
}

#[cfg(test)]
Expand Down
Loading

0 comments on commit c4c986c

Please sign in to comment.