Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter votes from disabled validators in BackedCandidates in process_inherent_data #1863

Merged
merged 43 commits into from
Nov 30, 2023

Conversation

tdimitrov
Copy link
Contributor

@tdimitrov tdimitrov commented Oct 12, 2023

Fixes #1592

Please refer to the issue for details.


// Filters statements from disabled validators in `BackedCandidate` and `MultiDisputeStatementSet`.
// Returns `true` if at least one statement is removed and `false` otherwise.
fn filter_backed_statements<T: Config>(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ordian can you have a look at this? Does the index arithmetic here make sense?

Copy link
Member

Choose a reason for hiding this comment

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

I just merged #1257 that has a disabled_validators implementation, which could be extracted into a common module. There's a small caveat though, it doesn't work at session boundaries. But maybe that's not really an issue since availability cores are cleared out on session boundaries anyway.

Copy link
Contributor Author

@tdimitrov tdimitrov Oct 17, 2023

Choose a reason for hiding this comment

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

I've moved your implementation in pallet_shared so that we can call it from the api impl and paras_inherent. Quite a lot of boilerplate code for such small change but it is what it is :)

If you have got an idea for a better place - please share.

@@ -480,6 +487,7 @@ impl<T: Config> Pallet<T> {
}

ensure!(all_weight_before.all_lte(max_block_weight), Error::<T>::InherentOverweight);
ensure!(!statements_were_dropped, Error::<T>::InherentOverweight);
Copy link
Member

Choose a reason for hiding this comment

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

do we want to reject blocks where at least one statement is dropped? what do we do with disputes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Afair the else statement is executed during block execution only (right?) and this is a sanity check that we are not importing votes from disabled validators. We discussed this here.

@tdimitrov tdimitrov changed the base branch from master to tsv-disabling October 16, 2023 11:37
@tdimitrov tdimitrov added the A0-needs_burnin Pull request needs to be tested on a live validator node before merge. DevOps is notified via matrix label Oct 16, 2023
@tdimitrov tdimitrov mentioned this pull request Oct 20, 2023
4 tasks
@tdimitrov tdimitrov marked this pull request as ready for review October 26, 2023 13:56
@tdimitrov tdimitrov requested review from a team October 26, 2023 13:56
@tdimitrov tdimitrov requested a review from athei as a code owner October 26, 2023 13:56
@ordian ordian linked an issue Nov 8, 2023 that may be closed by this pull request
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.

Good job! Looking cleaner now, left some tiny nits.

polkadot/runtime/parachains/src/paras_inherent/mod.rs Outdated Show resolved Hide resolved
polkadot/runtime/parachains/src/paras_inherent/mod.rs Outdated Show resolved Hide resolved
polkadot/runtime/parachains/src/paras_inherent/mod.rs Outdated Show resolved Hide resolved
polkadot/runtime/parachains/src/paras_inherent/mod.rs Outdated Show resolved Hide resolved
polkadot/runtime/parachains/src/paras_inherent/mod.rs Outdated Show resolved Hide resolved
@tdimitrov tdimitrov requested a review from Overkillus November 15, 2023 12:02
Copy link
Contributor

@Overkillus Overkillus left a comment

Choose a reason for hiding this comment

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

Overall looking good and nothing blocking code-wise. Noted a few suggestions here and there.

A few bookkeeping issues I'd like to raise:

  1. PR desc / linked issue
  2. Docs (parainherent.md)

  1. PR desc / linked issue
    Firstly edit or post an update to the issue with the current desired behaviour that this PR should fix/add. For instance I don't see any dispute or availability bitfields filtering so either scratch them off the issue, split them into separate issues or add a checklist for the items. In our case I believe both were made redundant so feel free to link to my comment here and simply scratch them.

  2. Docs (parainherent.md)
    There's also a few things I'd like to get fixed around docs. Most logical changes apply to parainherent so I'd like to see that noted in the parainherent.md file. It's not only Rob's sketchpad but something we should maintain and this one should be a low hanging fruit. There's a lit of behaviours around disputes so now we can add one around disabling (filtering votes from disabled and rejecting them in re-execution).

polkadot/runtime/parachains/src/paras_inherent/mod.rs Outdated Show resolved Hide resolved
polkadot/runtime/parachains/src/paras_inherent/mod.rs Outdated Show resolved Hide resolved
polkadot/runtime/parachains/src/paras_inherent/tests.rs Outdated Show resolved Hide resolved
@tdimitrov
Copy link
Contributor Author

Thanks for the feedback @Overkillus. Regarding the issues you've raised:

PR desc / linked issue

The issue was written while disabling strategy was still work in progress. Editing the initial description will remove the context from the rest of the comments. We'd better not touch it. The PR title is rather self-explanatory I think. Let's leave it that way.

Docs (parainherent.md)

Good suggestion! I've added a section regarding data sanitization in the document.

Copy link
Contributor

@Overkillus Overkillus left a comment

Choose a reason for hiding this comment

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

Few nits and looking decent 👍

@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: cargo-clippy
Logs: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/4532515

@tdimitrov tdimitrov merged commit f2d4c48 into tsv-disabling Nov 30, 2023
9 of 10 checks passed
@tdimitrov tdimitrov deleted the tsv-disabling-runtime branch November 30, 2023 11:16
tdimitrov added a commit that referenced this pull request Jan 9, 2024
…s_inherent_data (#1863)

Fixes #1592

Please refer to the issue for details.

---------

Co-authored-by: ordian <[email protected]>
Co-authored-by: ordian <[email protected]>
Co-authored-by: Maciej <[email protected]>
ordian added a commit that referenced this pull request Jan 10, 2024
Closes #1591.

The purpose of this PR is filter out backing statements from the network
signed by disabled validators. This is just an optimization, since we
will do filtering in the runtime in #1863 to avoid nodes to filter
garbage out at block production time.

- [x] Ensure it's ok to fiddle with the mask of manifests
- [x] Write more unit tests
- [x] Test locally
- [x] simple zombienet test
- [x] PRDoc

---------

Co-authored-by: Tsvetomir Dimitrov <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Jan 18, 2024
…s_inherent_data (#2889)

Backport of #1863 to
master

Extend candidate sanitation in paras_inherent by removing backing votes
from disabled validators. Check
#1592 for more details.

This change is related to the disabling strategy implementation
(#2226).

---------

Co-authored-by: ordian <[email protected]>
Co-authored-by: ordian <[email protected]>
Co-authored-by: Maciej <[email protected]>
franciscoaguirre pushed a commit to paritytech/xcm that referenced this pull request Jan 25, 2024
…s_inherent_data (#2889)

Backport of paritytech/polkadot-sdk#1863 to
master

Extend candidate sanitation in paras_inherent by removing backing votes
from disabled validators. Check
paritytech/polkadot-sdk#1592 for more details.

This change is related to the disabling strategy implementation
(paritytech/polkadot-sdk#2226).

---------

Co-authored-by: ordian <[email protected]>
Co-authored-by: ordian <[email protected]>
Co-authored-by: Maciej <[email protected]>
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request Mar 25, 2024
…s_inherent_data (paritytech#2889)

Backport of paritytech#1863 to
master

Extend candidate sanitation in paras_inherent by removing backing votes
from disabled validators. Check
paritytech#1592 for more details.

This change is related to the disabling strategy implementation
(paritytech#2226).

---------

Co-authored-by: ordian <[email protected]>
Co-authored-by: ordian <[email protected]>
Co-authored-by: Maciej <[email protected]>
bkchr pushed a commit that referenced this pull request Apr 10, 2024
* "refund" proof size in GRANDPa pallet

* clippy

* extra_proof_size_bytes_works

* use saturated_into

* fix review comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A0-needs_burnin Pull request needs to be tested on a live validator node before merge. DevOps is notified via matrix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enforce validator disabling in the runtime
4 participants