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

relay chain selection and dispute-coordinator fixes and improvements #4752

Merged
merged 27 commits into from
Jan 26, 2022

Conversation

sandreim
Copy link
Contributor

@sandreim sandreim commented Jan 20, 2022

Fixes #4748

Work in progress.

Fixes:

  • Dont error in finality_target_with_longest_chain()
  • Track missing session info errors and propagate error to avoid sending incomplete data
  • Implement approach from approval-voting for processing active leaves such that even if we fail to process a block, we will eventually process it through a descendant.

The below items will be taken care of in a subsequent PR.

Import improvements(always import trusted votes):

  • backing
  • approval
  • own votes
  • votes scraped from chain

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Make sure to send errors to subsystems requesting data depending on missing session info

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
@github-actions github-actions bot added the A3-in_progress Pull request is in progress. No review needed at this stage. label Jan 20, 2022
@sandreim sandreim added B0-silent Changes should not be mentioned in any release notes C3-medium PR touches the given topic and has a medium impact on builders. labels Jan 20, 2022
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Copy link
Contributor

@drahnr drahnr left a comment

Choose a reason for hiding this comment

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

A few nits, one conceptual question, the general approach looks good 👍

node/core/dispute-coordinator/src/real/initialized.rs Outdated Show resolved Hide resolved
node/core/dispute-coordinator/src/real/initialized.rs Outdated Show resolved Hide resolved
node/core/dispute-coordinator/src/real/initialized.rs Outdated Show resolved Hide resolved
node/subsystem-util/src/rolling_session_window.rs Outdated Show resolved Hide resolved
node/service/src/relay_chain_selection.rs Show resolved Hide resolved
node/core/dispute-coordinator/src/real/initialized.rs Outdated Show resolved Hide resolved
node/core/dispute-coordinator/src/real/initialized.rs Outdated Show resolved Hide resolved
node/core/dispute-coordinator/src/real/initialized.rs Outdated Show resolved Hide resolved
node/core/dispute-coordinator/src/real/initialized.rs Outdated Show resolved Hide resolved
node/core/dispute-coordinator/src/real/initialized.rs Outdated Show resolved Hide resolved
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
@sandreim sandreim requested a review from eskimor January 21, 2022 13:31
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
@sandreim sandreim marked this pull request as ready for review January 24, 2022 11:51
@github-actions github-actions bot added A0-please_review Pull request needs code review. and removed A3-in_progress Pull request is in progress. No review needed at this stage. labels Jan 24, 2022
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
@sandreim sandreim added C1-low PR touches the given topic and has a low impact on builders. and removed C3-medium PR touches the given topic and has a medium impact on builders. labels Jan 24, 2022
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
node/service/src/relay_chain_selection.rs Outdated Show resolved Hide resolved
node/core/dispute-coordinator/src/real/ordering/mod.rs Outdated Show resolved Hide resolved
node/core/dispute-coordinator/src/real/ordering/mod.rs Outdated Show resolved Hide resolved
node/core/dispute-coordinator/src/real/mod.rs Outdated Show resolved Hide resolved
node/core/dispute-coordinator/src/real/mod.rs Outdated Show resolved Hide resolved
node/core/dispute-coordinator/src/real/mod.rs Outdated Show resolved Hide resolved
node/core/dispute-coordinator/src/real/mod.rs Outdated Show resolved Hide resolved
node/core/dispute-coordinator/src/real/initialized.rs Outdated Show resolved Hide resolved
node/core/dispute-coordinator/src/real/initialized.rs Outdated Show resolved Hide resolved
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
@@ -54,7 +54,7 @@ use std::sync::Arc;
///
/// This is a safety net that should be removed at some point in the future.
// Until it's not, make sure to also update `MAX_HEADS_LOOK_BACK` in `approval-voting`
// when changing its value.
// and `MAX_BATCH_SCRAPE_ANCESTORS` in `dispute-coordinator` when changing its value.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: We should probably add these shared constants to a separate helper crate, and import it, to avoid these manual keep in sync-todos

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, do you have any suggestion on what would be the best place to move this ?

AFAIK we also want to remove this in the near future, so if we were to create a new separate crate just to hold these constants, it won't be a good investment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed this, we now scrape up to and including last finalized block.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's out of s ope for this PR, but a tracking issue would be nice

Copy link
Member

Choose a reason for hiding this comment

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

The reason we have though lookup limits is to avoid a very busy (and wasteful) loop on startup if the node is syncing and is very much behind the tip of the chain. Imagine if we get the first leaf, but not finality notification. The difference between the could be millions of blocks in theory. However, I'm not sure how much of a problem it's in practice.

Copy link
Contributor

@drahnr drahnr Jan 26, 2022

Choose a reason for hiding this comment

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

I meant the const extraction, not the issue you described, sorry about the brevity

Copy link
Contributor Author

@sandreim sandreim Jan 26, 2022

Choose a reason for hiding this comment

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

Looks good other than one concern: #4752 (comment).

Addressed it. We'll look back up to max(last_finalized_block_number, new_leaf -MAX_BATCH_SCRAPE_ANCESTORS);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I meant the const extraction, not the issue you described, sorry about the brevity

#4788 is here

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Copy link
Member

@ordian ordian left a comment

Choose a reason for hiding this comment

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

Looks good other than one concern: #4752 (comment).

max finality lag

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
// Limit our search to last finalized block, or up to max finality lag.
let block_number = std::cmp::max(
block_number,
new_leaf.number.saturating_sub(MAX_BATCH_SCRAPE_ANCESTORS),
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@ordian
Copy link
Member

ordian commented Jan 26, 2022

bot merge

@paritytech-processbot paritytech-processbot bot merged commit 102bc8c into master Jan 26, 2022
@paritytech-processbot paritytech-processbot bot deleted the sandreim/dispute-coordinator-fixes branch January 26, 2022 14:06
@eskimor
Copy link
Member

eskimor commented Jan 27, 2022

The below items will be taken care of in a subsequent PR.

Please create a ticket for those.

@sandreim
Copy link
Contributor Author

The below items will be taken care of in a subsequent PR.

Please create a ticket for those.

#4793

ordian added a commit that referenced this pull request Jan 27, 2022
* master:
  Fix incomplete sorting. (#4795)
  Companion for better way to resolve `Phase::Emergency` via governance #10663 (#4757)
  Refactor and fix usage of `get_session_index()` and `get_session_info_by_index()` (#4735)
  `relay chain selection` and `dispute-coordinator` fixes and improvements (#4752)
  Fix tests (#4787)
  log concluded disputes (#4785)
  availability-distribution: look for leaf ancestors within the same session (#4596)
  Companion for Use proper bounded vector type for nominations #10601 (#4709)
  Fix release profile (#4778)
  [ci] remove publish-s3-release (#4779)
  Companion for substrate#10632 (#4689)
  [ci] pipeline chores (#4775)
  New changelog scripts (#4491)
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve dispute-coordinator error handling
5 participants