babe, grandpa: cleanup stale equivocation reports (#8041)

* grandpa: check equivocation report staleness on `validate_unsigned`

* babe: check equivocation report staleness on `validate_unsigned`

* node: bump spec_version

* babe, grandpa: remove duplicate call destructuring
This commit is contained in:
André Silva
2021-02-04 15:22:11 +00:00
committed by GitHub
parent a32f2b9271
commit 6dea5494f3
5 changed files with 81 additions and 49 deletions
+10 -1
View File
@@ -676,7 +676,16 @@ fn report_equivocation_validate_unsigned_prevents_duplicates() {
Babe::report_equivocation_unsigned(Origin::none(), equivocation_proof, key_owner_proof)
.unwrap();
// the report should now be considered stale and the transaction is invalid
// the report should now be considered stale and the transaction is invalid.
// the check for staleness should be done on both `validate_unsigned` and on `pre_dispatch`
assert_err!(
<Babe as sp_runtime::traits::ValidateUnsigned>::validate_unsigned(
TransactionSource::Local,
&inner,
),
InvalidTransaction::Stale,
);
assert_err!(
<Babe as sp_runtime::traits::ValidateUnsigned>::pre_dispatch(&inner),
InvalidTransaction::Stale,