This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Bound pallet-offences #11585
Closed
Closed
Bound pallet-offences #11585
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
9d27600
Bound pallet-offences
ggwpez 76854e4
Merge remote-tracking branch 'origin/master' into oty-bounded-offences
ggwpez 2417584
Fix traits
ggwpez 8e05856
Use correct nightly
ggwpez a7bcc8e
Unreproducible compile error...
ggwpez 1ddfba4
Merge remote-tracking branch 'origin/master' into oty-bounded-offences
ggwpez da88df6
Compile
ggwpez 130f796
WIP
ggwpez 82ab81d
Fix tests
ggwpez 6524811
Fix tests
ggwpez 3226339
Merge remote-tracking branch 'origin/master' into oty-bounded-offences
b02f13e
Make compile
ggwpez ad08280
Merge remote-tracking branch 'origin/master' into oty-bounded-offences
ggwpez 889898a
Fix CI
ggwpez ee29920
Fix benchmarks
ggwpez 4a904d5
Beauty fixes
ggwpez a4ad15f
Beauty fixes
ggwpez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,9 +48,9 @@ use frame_support::{ | |
WeakBoundedVec, | ||
}; | ||
use scale_info::TypeInfo; | ||
use sp_runtime::{generic::DigestItem, traits::Zero, DispatchResult, KeyTypeId}; | ||
use sp_runtime::{generic::DigestItem, traits::Zero, BoundedVec, DispatchResult, KeyTypeId}; | ||
use sp_session::{GetSessionNumber, GetValidatorCount}; | ||
use sp_staking::SessionIndex; | ||
use sp_staking::{offence::MaxReporters, SessionIndex}; | ||
|
||
mod default_weights; | ||
mod equivocation; | ||
|
@@ -568,9 +568,16 @@ impl<T: Config> Pallet<T> { | |
return Err(Error::<T>::InvalidEquivocationProof.into()) | ||
} | ||
|
||
let reporters: BoundedVec<T::AccountId, MaxReporters> = match reporter { | ||
Some(id) => vec![id], | ||
None => vec![], | ||
} | ||
.try_into() | ||
.expect("MaxReporters must be at least 1;"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where is this ensured? Should be in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its a constant, not a configuration variable, so we only have to ensure it once. |
||
|
||
// report to the offences module rewarding the sender. | ||
T::HandleEquivocation::report_offence( | ||
reporter.into_iter().collect(), | ||
reporters, | ||
<T::HandleEquivocation as HandleEquivocation<T>>::Offence::new( | ||
session_index, | ||
validator_count, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have
defensive_expect
? we should :D