[NPoS] Remove better solution threshold for unsigned submissions (#2694)

closes https://github.com/paritytech-secops/srlabs_findings/issues/78.

Removes `BetterUnsignedThreshold` from pallet EPM. This will essentially
mean any solution submitted by the validator that is strictly better
than the current queued solution would be accepted.

The reason for having these thresholds is to limit number of solutions
submitted on-chain. However for unsigned submissions, the number of
solutions that could be submitted on average is limited even without
thresholding (calculation shown in the corresponding issue).
This commit is contained in:
Ankan
2023-12-15 20:59:39 +01:00
committed by GitHub
parent ddd5434e14
commit ffb2125f4a
7 changed files with 92 additions and 36 deletions
@@ -101,9 +101,8 @@
//! unsigned transaction, thus the name _unsigned_ phase. This unsigned transaction can never be
//! valid if propagated, and it acts similar to an inherent.
//!
//! Validators will only submit solutions if the one that they have computed is sufficiently better
//! than the best queued one (see [`pallet::Config::BetterUnsignedThreshold`]) and will limit the
//! weight of the solution to [`MinerConfig::MaxWeight`].
//! Validators will only submit solutions if the one that they have computed is strictly better than
//! the best queued one and will limit the weight of the solution to [`MinerConfig::MaxWeight`].
//!
//! The unsigned phase can be made passive depending on how the previous signed phase went, by
//! setting the first inner value of [`Phase`] to `false`. For now, the signed phase is always
@@ -598,11 +597,6 @@ pub mod pallet {
#[pallet::constant]
type BetterSignedThreshold: Get<Perbill>;
/// The minimum amount of improvement to the solution score that defines a solution as
/// "better" in the Unsigned phase.
#[pallet::constant]
type BetterUnsignedThreshold: Get<Perbill>;
/// The repeat threshold of the offchain worker.
///
/// For example, if it is 5, that means that at least 5 blocks will elapse between attempts