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

Fix for the breaking change from polkadot v1.1.0 #10

Merged
merged 6 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 15 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,21 @@ jobs:
CARGO_INCREMENTAL: "0"
SCCACHE_CACHE_SIZE: "100GB"
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.0
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false

# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: true
- name: Checkout
uses: actions/checkout@v3
with:
Expand Down
19 changes: 5 additions & 14 deletions pallets/maintenance-mode/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ use frame_support::{
weights::Weight,
};
use frame_system::pallet_prelude::BlockNumberFor as BlockNumberOf;
use sp_std::marker::PhantomData;
#[cfg(feature = "try-runtime")]
use sp_std::vec::Vec;
use sp_runtime::TryRuntimeError;
use sp_std::marker::PhantomData;

pub struct ExecutiveHooks<T>(PhantomData<T>);

Expand Down Expand Up @@ -94,20 +94,11 @@ where
}

#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::DispatchError> {
if Pallet::<T>::maintenance_mode() {
T::MaintenanceExecutiveHooks::pre_upgrade()
} else {
T::NormalExecutiveHooks::pre_upgrade()
}
}

#[cfg(feature = "try-runtime")]
fn post_upgrade(state: Vec<u8>) -> Result<(), sp_runtime::DispatchError> {
fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, TryRuntimeError> {
if Pallet::<T>::maintenance_mode() {
T::MaintenanceExecutiveHooks::post_upgrade(state)
T::MaintenanceExecutiveHooks::try_on_runtime_upgrade(checks)
} else {
T::NormalExecutiveHooks::post_upgrade(state)
T::NormalExecutiveHooks::try_on_runtime_upgrade(checks)
}
}
}
Expand Down
Loading