Skip to content

Commit

Permalink
cargo clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
marcellorigotti authored and dandanlen committed Oct 26, 2023
1 parent 8ab0e26 commit 3d19b3f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions state-chain/pallets/cf-vaults/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,12 @@ pub mod pallet {
}

#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, &'static str> {
fn pre_upgrade() -> Result<Vec<u8>, DispatchError> {
migrations::PalletMigration::<T, I>::pre_upgrade()
}

#[cfg(feature = "try-runtime")]
fn post_upgrade(state: Vec<u8>) -> Result<(), &'static str> {
fn post_upgrade(state: Vec<u8>) -> Result<(), DispatchError> {
migrations::PalletMigration::<T, I>::post_upgrade(state)
}
}
Expand Down
6 changes: 3 additions & 3 deletions state-chain/pallets/cf-vaults/src/migrations/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ impl<T: Config<I>, I: 'static> OnRuntimeUpgrade for Migration<T, I> {
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, DispatchError> {
// just check that the old storage item existed
Ok(KeygenSlashRate::<T, I>::exists().encode())
Ok(old::KeygenSlashRate::<T, I>::exists().encode())
}

#[cfg(feature = "try-runtime")]
fn post_upgrade(state: Vec<u8>) -> Result<(), DispatchError> {
if <bool>::decode(&mut &_state[..]).map_err(|_| "Failed to decode pre-upgrade state.")? {
assert!(!KeygenSlashRate::<T, I>::exist());
if <bool>::decode(&mut &state[..]).map_err(|_| "Failed to decode pre-upgrade state.")? {
assert!(!old::KeygenSlashRate::<T, I>::exists());
assert!(KeygenSlashAmount::<T, I>::exists());
assert!(KeygenSlashAmount::<T, I>::get() == FLIPPERINOS_PER_FLIP)
}
Expand Down

0 comments on commit 3d19b3f

Please sign in to comment.