mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-26 04:11:09 +00:00
[Staking] Adds a round check at signed solution submission (#2690)
This PR adds a round check to the `Call::submit` extrinsic to make sure that the solution submission has been prepared for the current election round and avoid penalties for delayed submissions. Related to https://github.com/paritytech-secops/srlabs_findings/issues/329 --------- Co-authored-by: command-bot <>
This commit is contained in:
@@ -1024,6 +1024,7 @@ pub mod pallet {
|
||||
|
||||
// ensure solution is timely.
|
||||
ensure!(Self::current_phase().is_signed(), Error::<T>::PreDispatchEarlySubmission);
|
||||
ensure!(raw_solution.round == Self::round(), Error::<T>::PreDispatchDifferentRound);
|
||||
|
||||
// NOTE: this is the only case where having separate snapshot would have been better
|
||||
// because could do just decode_len. But we can create abstractions to do this.
|
||||
@@ -1197,6 +1198,8 @@ pub mod pallet {
|
||||
BoundNotMet,
|
||||
/// Submitted solution has too many winners
|
||||
TooManyWinners,
|
||||
/// Sumission was prepared for a different round.
|
||||
PreDispatchDifferentRound,
|
||||
}
|
||||
|
||||
#[pallet::validate_unsigned]
|
||||
|
||||
Reference in New Issue
Block a user