mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 02:37:58 +00:00
Panic on invalid unsigned election solution. (#6485)
* Panic on invalid * Fix return * Fix refund
This commit is contained in:
@@ -2194,18 +2194,20 @@ decl_module! {
|
||||
size: ElectionSize,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
ensure_none(origin)?;
|
||||
Self::check_and_replace_solution(
|
||||
let adjustments = Self::check_and_replace_solution(
|
||||
winners,
|
||||
compact,
|
||||
ElectionCompute::Unsigned,
|
||||
score,
|
||||
era,
|
||||
size,
|
||||
)
|
||||
// TODO: instead of returning an error, panic. This makes the entire produced block
|
||||
// invalid.
|
||||
// This ensures that block authors will not ever try and submit a solution which is not
|
||||
// an improvement, since they will lose their authoring points/rewards.
|
||||
).expect(
|
||||
"An unsigned solution can only be submitted by validators; A validator should \
|
||||
always produce correct solutions, else this block should not be imported, thus \
|
||||
effectively depriving the validators from their authoring reward. Hence, this panic
|
||||
is expected."
|
||||
);
|
||||
Ok(adjustments)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user