Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

dispute-coordinator: Cleanup + Bug fixes #5323

Merged
merged 13 commits into from
Apr 19, 2022
Merged

Conversation

eskimor
Copy link
Member

@eskimor eskimor commented Apr 13, 2022

First batch of dispute-coordinator improvements, mostly cleanup + one bug fix. Signature check from on chain vote import would not actually succeed previously, as the wrong relay parent was used.

Next up: Some more metrics to better understand where time is spent.

@eskimor eskimor added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit. labels Apr 13, 2022
@@ -118,7 +118,7 @@ impl JfyiError {
pub fn log(self) {
match self {
// don't spam the log with spurious errors
Self::Runtime(_) | Self::Oneshot(_) | Self::DisputeImportOneshotSend => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can warn again, because senders who don't care will pass in None now for pending_confirmation

@@ -84,14 +76,12 @@ pub struct Initialized {
highest_session: SessionIndex,
spam_slots: SpamSlots,
participation: Participation,
ordering_provider: OrderingProvider,
scraper: ChainScraper,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scraper now also takes care of on chain vote scraping.

/// the first place.
#[derive(Copy, Clone)]
#[cfg_attr(test, derive(Debug))]
struct CandidateComparator {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This got moved here, because scraper no longer cares about the actual comparator. All it does, is provide info on whether a candidate has been included anywhere.

///
/// Returns: On chain vote for the leaf and any ancestors we might not yet have seen.
#[must_use]
pub async fn process_active_leaves_update<Sender: SubsystemSender>(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return value is scraped votes, for further processing.

@@ -376,60 +319,17 @@ impl Initialized {

/// Scrapes on-chain votes (backing votes and concluded disputes) for a active leaf of the
/// relay chain.
async fn scrape_on_chain_votes(
async fn process_on_chain_votes(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actual scraping is now done by scraper, we only need to process the votes.

.await?;
let is_included = comparator.is_some();

let is_included = self.scraper.is_candidate_included(&candidate_receipt.hash());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scraper tells us whether or not a candidate has been seen included.

@@ -927,13 +829,14 @@ impl Initialized {
// Participate in dispute if the imported vote was not local, we did not vote before either
// and we actually have keys to issue a local vote.
if !is_local && !voted_already && is_disputed && !controlled_indices.is_empty() {
let priority = ParticipationPriority::with_priority_if(is_included);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is included - make it priority.

@eskimor eskimor requested a review from sandreim April 13, 2022 14:52
@eskimor eskimor changed the title Cleanup + Bug fixes dispute-coordinator: Cleanup + Bug fixes Apr 13, 2022
@eskimor eskimor requested a review from tdimitrov April 13, 2022 18:05
@eskimor eskimor added this to the v0.9.20 milestone Apr 13, 2022
@@ -0,0 +1,300 @@
// Copyright 2021 Parity Technologies (UK) Ltd.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: 2022

@eskimor eskimor merged commit c254e59 into master Apr 19, 2022
@eskimor eskimor deleted the rk-better-on-chain-scraping branch April 19, 2022 12:51
@coderobe coderobe mentioned this pull request Apr 21, 2022
29 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants