mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 04:01:10 +00:00
make spellcheck green again (#6059)
* make spellcheck green again * remove the comment * Fix a comment in `provisioner` Co-authored-by: Tsvetomir Dimitrov <tsvetomir@parity.io>
This commit is contained in:
@@ -17,8 +17,8 @@
|
||||
//! The disputes module is responsible for selecting dispute votes to be sent with the inherent data. It contains two
|
||||
//! different implementations, extracted in two separate modules - `random_selection` and `prioritized_selection`. Which
|
||||
//! implementation will be executed depends on the version of the runtime. Runtime v2 supports `random_selection`. Runtime
|
||||
//! v3 and above - `prioritized_selection`. The entrypoint to these implementations is the `select_disputes` function.
|
||||
//! prioritized_selection` is considered superior and will be the default one in the future. Refer to the documentation of
|
||||
//! `v3` and above - `prioritized_selection`. The entrypoint to these implementations is the `select_disputes` function.
|
||||
//! `prioritized_selection` is considered superior and will be the default one in the future. Refer to the documentation of
|
||||
//! the modules for more details about each implementation.
|
||||
|
||||
use crate::LOG_TARGET;
|
||||
|
||||
@@ -45,23 +45,17 @@ pub const MAX_DISPUTE_VOTES_FORWARDED_TO_RUNTIME: usize = 200_000;
|
||||
#[cfg(test)]
|
||||
pub const MAX_DISPUTE_VOTES_FORWARDED_TO_RUNTIME: usize = 200;
|
||||
|
||||
/// Controls how much dispute votes to be fetched from the runtime per iteration in `fn vote_selection`.
|
||||
/// The purpose is to fetch the votes in batches until `MAX_DISPUTE_VOTES_FORWARDED_TO_RUNTIME` is
|
||||
/// reached. This value should definitely be less than `MAX_DISPUTE_VOTES_FORWARDED_TO_RUNTIME`.
|
||||
/// Controls how much dispute votes to be fetched from the `dispute-coordinator` per iteration in
|
||||
/// `fn vote_selection`. The purpose is to fetch the votes in batches until
|
||||
/// `MAX_DISPUTE_VOTES_FORWARDED_TO_RUNTIME` is reached. If all votes are fetched in single call
|
||||
/// we might fetch votes which we never use. This will create unnecessary load on `dispute-coordinator`.
|
||||
///
|
||||
/// The ratio `MAX_DISPUTE_VOTES_FORWARDED_TO_RUNTIME` / `VOTES_SELECTION_BATCH_SIZE` gives an
|
||||
/// approximation about how many runtime requests will be issued to fetch votes from the runtime in
|
||||
/// a single `select_disputes` call. Ideally we don't want to make more than 2-3 calls. In practice
|
||||
/// it's hard to predict this number because we can't guess how many new votes (for the runtime) a
|
||||
/// batch will contain.
|
||||
///
|
||||
/// The value below is reached by: `MAX_DISPUTE_VOTES_FORWARDED_TO_RUNTIME` / 2 + 10%
|
||||
/// The 10% makes approximately means '10% new votes'. Tweak this if provisioner makes excessive
|
||||
/// number of runtime calls.
|
||||
/// This value should be less than `MAX_DISPUTE_VOTES_FORWARDED_TO_RUNTIME`. Increase it in case
|
||||
/// `provisioner` sends too many `QueryCandidateVotes` messages to `dispite-coordinator`.
|
||||
#[cfg(not(test))]
|
||||
const VOTES_SELECTION_BATCH_SIZE: usize = 1_100;
|
||||
#[cfg(test)]
|
||||
const VOTES_SELECTION_BATCH_SIZE: usize = 11; // Just a small value for tests. Doesn't follow the rules above
|
||||
const VOTES_SELECTION_BATCH_SIZE: usize = 11;
|
||||
|
||||
/// Implements the `select_disputes` function which selects dispute votes which should
|
||||
/// be sent to the Runtime.
|
||||
@@ -89,7 +83,7 @@ const VOTES_SELECTION_BATCH_SIZE: usize = 11; // Just a small value for tests. D
|
||||
///
|
||||
/// The logic outlined above relies on `RuntimeApiRequest::Disputes` message from the Runtime. The user
|
||||
/// check the Runtime version before calling `select_disputes`. If the function is used with old runtime
|
||||
/// an error is logged and the logic will continue with empty onchain votes HashMap.
|
||||
/// an error is logged and the logic will continue with empty onchain votes `HashMap`.
|
||||
pub async fn select_disputes<Sender>(
|
||||
sender: &mut Sender,
|
||||
metrics: &metrics::Metrics,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! This module selects all RECENT disputes, fetches the votes for them from dispute-coordinator and
|
||||
//! returns them as MultiDisputeStatementSet. If the RECENT disputes are more than
|
||||
//! returns them as `MultiDisputeStatementSet`. If the RECENT disputes are more than
|
||||
//! `MAX_DISPUTES_FORWARDED_TO_RUNTIME` constant - the ACTIVE disputes plus a random selection of
|
||||
//! RECENT disputes (up to `MAX_DISPUTES_FORWARDED_TO_RUNTIME`) are returned instead.
|
||||
//! If the ACTIVE disputes are also above `MAX_DISPUTES_FORWARDED_TO_RUNTIME` limit - a random selection
|
||||
|
||||
Reference in New Issue
Block a user