mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-24 14:45:42 +00:00
Improved dispute votes import in provisioner (#5567)
* Add `DisputeState` to `DisputeCoordinatorMessage::RecentDisputes` The new signature of the message is: ``` RecentDisputes(oneshot::Sender<Vec<(SessionIndex, CandidateHash, DisputeStatus)>>), ``` As part of the change also add `DispiteStatus` to `polkadot_node_primitives`. * Move dummy_signature() in primitives/test-helpers * Enable staging runtime api on Rococo * Implementation * Move disputes to separate module * Vote prioritisation * Duplicates handling * Double vote handling * Unit tests * Logs and metrics * Code review feedback * Fix ACTIVE/INACTIVE separation and update partition names * Add `fn dispute_is_inactive` to node primitives and refactor `fn get_active_with_status()` logic * Keep the 'old' logic if the staging api is not enabled * Fix some comments in tests * Add warning message if there are any inactive_unknown_onchain disputes * Add file headers and remove `use super::*;` usage outside tests * Adding doc comments * Fix test methods names * Fix staging api usage * Fix `get_disputes` runtime function implementation * Fix compilation error * Fix arithmetic operations in tests * Use smaller test data * Rename `RuntimeApiRequest::StagingDisputes` to `RuntimeApiRequest::Disputes` * Remove `staging-client` feature flag * fmt * Remove `vstaging` feature flag * Some comments regarding the staging api * Rename dispute selection modules in provisioner with_staging_api -> prioritized_selection without_staging_api -> random_selection * Comments for staging api * Comments * Additional logging * Code review feedback process_selected_disputes -> into_multi_dispute_statement_set typo In trait VoteType: vote_value -> is_valid * Code review feedback * Fix metrics * get_disputes -> disputes * Get time only once during partitioning * Fix partitioning * Comments * Reduce the number of hardcoded api versions * Code review feedback * Unused import * Comments * More precise log messages * Code review feedback * Code review feedback * Code review feedback - remove `trait VoteType` * Code review feedback * Trace log for DisputeCoordinatorMessage::QueryCandidateVotes counter in vote_selection
This commit is contained in:
committed by
GitHub
parent
bbb713521e
commit
6ae9720c36
@@ -35,8 +35,8 @@ use polkadot_node_network_protocol::{
|
||||
use polkadot_node_primitives::{
|
||||
approval::{BlockApprovalMeta, IndirectAssignmentCert, IndirectSignedApprovalVote},
|
||||
AvailableData, BabeEpoch, BlockWeight, CandidateVotes, CollationGenerationConfig,
|
||||
CollationSecondedSignal, DisputeMessage, ErasureChunk, PoV, SignedDisputeStatement,
|
||||
SignedFullStatement, ValidationResult,
|
||||
CollationSecondedSignal, DisputeMessage, DisputeStatus, ErasureChunk, PoV,
|
||||
SignedDisputeStatement, SignedFullStatement, ValidationResult,
|
||||
};
|
||||
use polkadot_primitives::v2::{
|
||||
AuthorityDiscoveryId, BackedCandidate, BlockNumber, CandidateEvent, CandidateHash,
|
||||
@@ -271,7 +271,7 @@ pub enum DisputeCoordinatorMessage {
|
||||
/// Fetch a list of all recent disputes the co-ordinator is aware of.
|
||||
/// These are disputes which have occurred any time in recent sessions,
|
||||
/// and which may have already concluded.
|
||||
RecentDisputes(oneshot::Sender<Vec<(SessionIndex, CandidateHash)>>),
|
||||
RecentDisputes(oneshot::Sender<Vec<(SessionIndex, CandidateHash, DisputeStatus)>>),
|
||||
/// Fetch a list of all active disputes that the coordinator is aware of.
|
||||
/// These disputes are either not yet concluded or recently concluded.
|
||||
ActiveDisputes(oneshot::Sender<Vec<(SessionIndex, CandidateHash)>>),
|
||||
@@ -699,10 +699,15 @@ pub enum RuntimeApiRequest {
|
||||
OccupiedCoreAssumption,
|
||||
RuntimeApiSender<Option<ValidationCodeHash>>,
|
||||
),
|
||||
/// Returns all on-chain disputes at given block number.
|
||||
StagingDisputes(
|
||||
RuntimeApiSender<Vec<(SessionIndex, CandidateHash, DisputeState<BlockNumber>)>>,
|
||||
),
|
||||
/// Returns all on-chain disputes at given block number. Available in v3.
|
||||
Disputes(RuntimeApiSender<Vec<(SessionIndex, CandidateHash, DisputeState<BlockNumber>)>>),
|
||||
}
|
||||
|
||||
impl RuntimeApiRequest {
|
||||
/// Runtime version requirements for each message
|
||||
|
||||
/// `Disputes`
|
||||
pub const DISPUTES_RUNTIME_REQUIREMENT: u32 = 3;
|
||||
}
|
||||
|
||||
/// A message to the Runtime API subsystem.
|
||||
|
||||
@@ -186,7 +186,7 @@ pub trait RuntimeApiSubsystemClient {
|
||||
|
||||
/// Returns all onchain disputes.
|
||||
/// This is a staging method! Do not use on production runtimes!
|
||||
async fn staging_get_disputes(
|
||||
async fn disputes(
|
||||
&self,
|
||||
at: Hash,
|
||||
) -> Result<Vec<(SessionIndex, CandidateHash, DisputeState<BlockNumber>)>, ApiError>;
|
||||
@@ -375,10 +375,10 @@ where
|
||||
self.runtime_api().session_info_before_version_2(&BlockId::Hash(at), index)
|
||||
}
|
||||
|
||||
async fn staging_get_disputes(
|
||||
async fn disputes(
|
||||
&self,
|
||||
at: Hash,
|
||||
) -> Result<Vec<(SessionIndex, CandidateHash, DisputeState<BlockNumber>)>, ApiError> {
|
||||
self.runtime_api().staging_get_disputes(&BlockId::Hash(at))
|
||||
self.runtime_api().disputes(&BlockId::Hash(at))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user