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

NODE-101, prefix: staking update #46

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
28fbb66
update
SunoukMun Apr 12, 2024
d4978a8
update schedule & test
SunoukMun Apr 16, 2024
3ff8fb4
clean code
SunoukMun Apr 16, 2024
d3fa092
update cancel nomination
SunoukMun Apr 17, 2024
11b2427
update last_nominator
SunoukMun Apr 17, 2024
ad556b1
update comment
SunoukMun Apr 17, 2024
6fa9668
update test code
SunoukMun Apr 18, 2024
a6687ad
fix feedback issue
SunoukMun Apr 22, 2024
5c11240
fix feedback test
SunoukMun Apr 22, 2024
7252af4
Merge pull request #1 from SunoukMun/NODE-105
SunoukMun Apr 22, 2024
7d3e8d8
Revert "Node 105, prefix: multiple withdrawl request"
SunoukMun Apr 22, 2024
3421ccd
Merge pull request #2 from SunoukMun/revert-1-NODE-105
SunoukMun Apr 22, 2024
ca56449
update mint & test
SunoukMun Apr 23, 2024
9e02d6f
fix cancel logic
SunoukMun Apr 23, 2024
434cef1
sync NODE-105 & NODE-101
SunoukMun Apr 22, 2024
0b4abfd
update
SunoukMun Apr 12, 2024
517152d
update schedule & test
SunoukMun Apr 16, 2024
ea37ad7
update cancel nomination
SunoukMun Apr 17, 2024
0d4dc96
fix feedback issue
SunoukMun Apr 22, 2024
bc5bb3c
sync NODE-105 & NODE-101
SunoukMun Apr 22, 2024
7596daf
update
SunoukMun Apr 12, 2024
a0640ff
update schedule & test
SunoukMun Apr 16, 2024
0919d32
update cancel nomination
SunoukMun Apr 17, 2024
aacde01
fix feedback issue
SunoukMun Apr 22, 2024
ec97ee5
Revert "Node 105, prefix: multiple withdrawl request"
SunoukMun Apr 22, 2024
7fa55e6
sync NODE-105 & NODE-101
SunoukMun Apr 22, 2024
1ca7a5e
update
SunoukMun Apr 12, 2024
07b6799
update schedule & test
SunoukMun Apr 16, 2024
d00a0a4
fix feedback issue
SunoukMun Apr 22, 2024
c93fdd7
Revert "Node 105, prefix: multiple withdrawl request"
SunoukMun Apr 22, 2024
e4ec2a8
update mutli request
SunoukMun Apr 23, 2024
e8c5aa5
NODE-105, test: add unit test
SunoukMun Apr 24, 2024
232c518
NODE:105, fix: remove stryker
SunoukMun Apr 24, 2024
add9dc9
NODE-105, fix: fix force merge
SunoukMun Apr 24, 2024
8493629
Merge pull request #3 from SunoukMun/NODE-105
SunoukMun Apr 24, 2024
8a5ae29
NODE-105, fix: change request datatype
SunoukMun Apr 24, 2024
de6b8d9
Merge pull request #4 from SunoukMun/NODE-105
SunoukMun Apr 25, 2024
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
35 changes: 3 additions & 32 deletions pallets/bfc-offences/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,6 @@ use frame_support::{pallet_prelude::*, storage_alias, traits::OnRuntimeUpgrade};
#[storage_alias]
pub type StorageVersion<T: Config> = StorageValue<Pallet<T>, Releases, ValueQuery>;

/// Used to match mainnet pallet version
pub mod v3_update {
use super::*;

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

impl<T: Config> OnRuntimeUpgrade for MigrateToV3Update<T> {
fn on_runtime_upgrade() -> Weight {
let mut weight = Weight::zero();

let current = Pallet::<T>::current_storage_version();
let onchain = Pallet::<T>::on_chain_storage_version();

if current == 3 && onchain == 0 {
current.put::<Pallet<T>>();
log!(info, "bfc-offences storage migration passes v3::update(2) ✅");
weight = weight.saturating_add(T::DbWeight::get().reads_writes(1, 1));
} else {
log!(warn, "Skipping bfc-offences storage migration v3::update(2) 💤");
weight = weight.saturating_add(T::DbWeight::get().reads(1));
}

weight
}
}
}

pub mod v3 {
use super::*;
use frame_support::pallet_prelude::Weight;
Expand All @@ -45,19 +18,17 @@ pub mod v3 {
let mut weight = Weight::zero();

let current = Pallet::<T>::current_storage_version();
// (previous) let onchain = StorageVersion::<T>::get();
let onchain = Pallet::<T>::on_chain_storage_version();
let onchain = StorageVersion::<T>::get();

// (previous: if current == 3 && onchain == Releases::V2_0_0)
if current == 3 && onchain == 2 {
if current == 3 && onchain == Releases::V2_0_0 {
// migrate to new standard storage version
StorageVersion::<T>::kill();
current.put::<Pallet<T>>();

log!(info, "bfc-offences storage migration passes v3 update ✅");
weight = weight.saturating_add(T::DbWeight::get().reads_writes(1, 2));
} else {
log!(warn, "Skipping bfc-offences storage migration v3 ✅");
log!(warn, "Skipping v3, should be removed");
weight = weight.saturating_add(T::DbWeight::get().reads(1));
}

Expand Down
2 changes: 1 addition & 1 deletion pallets/bfc-offences/src/pallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub mod pallet {
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_runtime_upgrade() -> Weight {
migrations::v3_update::MigrateToV3Update::<T>::on_runtime_upgrade()
migrations::v3::MigrateToV3::<T>::on_runtime_upgrade()
}
}

Expand Down
Loading