Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
".git/.scripts/commands/fmt/fmt.sh"
  • Loading branch information
command-bot committed Apr 25, 2023
commit 4d4a31dde07f48ca88a438f81eadca8b29d2b106
19 changes: 15 additions & 4 deletions frame/offences/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use super::{LOG_TARGET, Pallet, Config, Kind, OffenceDetails, Perbill, SessionIndex};
use frame_support::{Twox64Concat, dispatch::GetStorageVersion, traits::OnRuntimeUpgrade, pallet_prelude::ValueQuery, storage_alias, traits::Get, weights::Weight};
use super::{Config, Kind, OffenceDetails, Pallet, Perbill, SessionIndex, LOG_TARGET};
use frame_support::{
dispatch::GetStorageVersion,
pallet_prelude::ValueQuery,
storage_alias,
traits::{Get, OnRuntimeUpgrade},
weights::Weight,
Twox64Concat,
};
use sp_staking::offence::{DisableStrategy, OnOffenceHandler};
use sp_std::vec::Vec;

Expand Down Expand Up @@ -46,7 +53,11 @@ pub mod v1 {
let onchain = Pallet::<T>::on_chain_storage_version();
ensure!(onchain < 1, "pallet_offences::MigrateToV1 migration can be deleted");

log::info!(target: LOG_TARGET, "Number of reports to refund and delete: {}", ReportsByKindIndex::<T>::iter().count());
log::info!(
target: LOG_TARGET,
"Number of reports to refund and delete: {}",
ReportsByKindIndex::<T>::iter().count()
);

Ok(Vec::new())
}
Expand Down Expand Up @@ -115,9 +126,9 @@ pub fn remove_deferred_storage<T: Config>() -> Weight {
mod test {
use super::*;
use crate::mock::{new_test_ext, with_on_offence_fractions, Runtime as T, KIND};
use codec::Encode;
use sp_runtime::Perbill;
use sp_staking::offence::OffenceDetails;
use codec::Encode;

#[test]
fn migration_to_v1_works() {
Expand Down
6 changes: 3 additions & 3 deletions frame/offences/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

use super::*;
use crate::mock::{
new_test_ext, offence_reports, with_on_offence_fractions, Offence, Offences,
RuntimeEvent, System, KIND,
new_test_ext, offence_reports, with_on_offence_fractions, Offence, Offences, RuntimeEvent,
System, KIND,
};
use frame_system::{EventRecord, Phase};
use sp_runtime::Perbill;
Expand Down Expand Up @@ -244,4 +244,4 @@ fn should_properly_count_offences() {
]
);
});
}
}