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

Try to fix out of view statements #5177

Merged
merged 16 commits into from
Mar 24, 2022
Merged

Conversation

vstakhov
Copy link
Contributor

This issue happens when some peer sends a good but already known Seconded statement and the statement-distribution code does not update the statements_received field in the peer_knowledge structure. Subsequently, a Valid statement causes out-of-view message that is incorrectly emitted and causes reputation lose.

@github-actions github-actions bot added the A0-please_review Pull request needs code review. label Mar 22, 2022
@vstakhov vstakhov added 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 Mar 22, 2022
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.

Soundness of the fix checks out.

The test case itself needs attention.

Since modifying the subsystem in it's entirety is not feasible, there are a few things to do:

  • add modification functions guarded behind #[cfg(test)] to modify the internal state as needed
  • modify util::choose_random_subset to consume an impl Rng such that in test cases this can be modified as desired

With these changes in place the leading head comment of the test case can be removed in favor of the to be created issue link besides a few more notes inline, where the state is modified with the yet to be created functions.

An alternative approach would be, to not instantiate the full subsystem but only test the incoming messages, and update the view explicitly. The state is too complex though to do so imho.

@vstakhov vstakhov requested a review from drahnr March 23, 2022 12:09
Copy link
Contributor

@tdimitrov tdimitrov left a comment

Choose a reason for hiding this comment

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

Good catch @vstakhov!
The change makes sense to me after following your explanation and commits but it does look tricky to catch,

@vstakhov
Copy link
Contributor Author

bot merge

@paritytech-processbot
Copy link

Error: Checks failed for 9850839

@vstakhov vstakhov merged commit 6997169 into master Mar 24, 2022
@vstakhov vstakhov deleted the vstakhov-statement-distribution-oov branch March 24, 2022 20:18
ordian added a commit that referenced this pull request Mar 24, 2022
* master:
  Try to fix out of view statements (#5177)
  Companion for Substrate#11107 (#5197)
  paras: `include_pvf_check_statement` rt bench (#4938)
  [ci] Run short benchmarks only in PR pipelines (#5200)
  Companion for paritytech/substrate#10242 (#4862)
  [ci] Add short benchmarks to the pipeline (#5188)
  upgrade coarsetime to 0.1.22 to fix a potential panic (#5193)
  Update docs and enable DOT-over-XCM (#4809)
  enable disputes on all chains (#5182)
  companion for validator self-vote in bags (#5088)
  Extract MAX_FINALITY_LAG constant from relay_chain_selection (#5159)
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.

3 participants