Remove Offence delay (#8414)

* Removed can_report api from OnOffenceHandler

* Removed DeferredOffences and create a storage migration

* Removed missing comments

* Mock set_deferred_offences and deferred_offences methods

* OnOffenceHandler::on_offence always succeed

* Fix benchmark tests

* Fix runtime-benchmark cfg methods

* Removed 'applied' attribute from Offence event

* refactor deprecated deferred offences getter

* Validate if offences are submited after on_runtime_upgrade

* update changelog

* Remove empty lines

* Fix remove_deferred_storage weights

* Remove Offence::on_runtime_upgrade benchmark

* Revert CHANGELOG.md update

* Deprecate DeferredOffenceOf type

* Update copyright

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Add migration logs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Fix migration log

* Remove unused import

* Add migration tests

* rustfmt

* use generate_storage_alias! macro

* Refactor should_resubmit_deferred_offences test

* Replace spaces by tabs

* Refactor should_resubmit_deferred_offences test

* Removed WeightSoftLimit

* Removed WeightSoftLimit from tests and mocks

* Remove unused imports

* Apply suggestions from code review

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
Lohann Paterno Coutinho Ferreira
2021-05-03 04:53:09 -03:00
committed by GitHub
parent c786fb21a0
commit ffca28ba59
13 changed files with 132 additions and 314 deletions
+3 -11
View File
@@ -159,13 +159,7 @@ pub trait OnOffenceHandler<Reporter, Offender, Res> {
offenders: &[OffenceDetails<Reporter, Offender>],
slash_fraction: &[Perbill],
session: SessionIndex,
) -> Result<Res, ()>;
/// Can an offence be reported now or not. This is an method to short-circuit a call into
/// `on_offence`. Ideally, a correct implementation should return `false` if `on_offence` will
/// return `Err`. Nonetheless, this is up to the implementation and this trait cannot guarantee
/// it.
fn can_report() -> bool;
) -> Res;
}
impl<Reporter, Offender, Res: Default> OnOffenceHandler<Reporter, Offender, Res> for () {
@@ -173,11 +167,9 @@ impl<Reporter, Offender, Res: Default> OnOffenceHandler<Reporter, Offender, Res>
_offenders: &[OffenceDetails<Reporter, Offender>],
_slash_fraction: &[Perbill],
_session: SessionIndex,
) -> Result<Res, ()> {
Ok(Default::default())
) -> Res {
Default::default()
}
fn can_report() -> bool { true }
}
/// A details about an offending authority for a particular kind of offence.