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

Add randomized Membership impls for testing #3863

Merged
merged 10 commits into from
Dec 2, 2024
Merged

Conversation

pls148
Copy link
Contributor

@pls148 pls148 commented Nov 6, 2024

Closes #3826

This branch has been rebased against another PR (#3867) which introduces a bunch of other changes to Memberships

A separate branch pre-rebase has been saved off here, if that helps with reviewing: https://github.com/EspressoSystems/HotShot/tree/ps/test-randomized-committee-premerge

This PR:

  • Adds additional parser work for cross_tests! to enable template parameters in test types
  • Creates two new types of Membership (StableQuorumIterator and RandomOverlapQuorumIterator)
  • Adds additional test type test_epoch_success which use StableQuorumIterator and RandomOverlapQuorumIterator

This PR does not:

Key places to review:

The implementations in hotshot/traits/election/helpers.rs, make sure those are commented well enough to be understood
Review the way I'm passing filter configs into TestTypesRandomizedCommitteeMembers (*FilterConfig)

CI

@pls148 pls148 requested a review from ss-es November 6, 2024 22:32
@pls148 pls148 requested a review from bfish713 as a code owner November 6, 2024 22:32
@pls148 pls148 marked this pull request as draft November 6, 2024 22:33
@pls148 pls148 force-pushed the ps/test-randomized-committee branch 19 times, most recently from 9adfb1c to 2bb7f99 Compare November 13, 2024 00:00
@pls148 pls148 changed the title Add randomized committees for testing Add randomized Membership impls for testing Nov 13, 2024
@pls148 pls148 marked this pull request as ready for review November 13, 2024 01:21
@pls148 pls148 force-pushed the ps/test-randomized-committee branch 2 times, most recently from 8693058 to 3464b81 Compare November 13, 2024 20:23
Copy link
Contributor

@lukaszrzasik lukaszrzasik left a comment

Choose a reason for hiding this comment

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

I haven't managed to review the whole PR yet.
The things I've noticed don't necessarily make the PR incorrect. I think what confused me the most is that for the even round (e.g. 2) we get odd numbers and vice versa.

crates/hotshot/src/traits/election/helpers.rs Outdated Show resolved Hide resolved
crates/hotshot/src/traits/election/helpers.rs Outdated Show resolved Hide resolved
crates/hotshot/src/traits/election/helpers.rs Outdated Show resolved Hide resolved
crates/hotshot/src/traits/election/helpers.rs Outdated Show resolved Hide resolved
@pls148 pls148 force-pushed the ps/test-randomized-committee branch from 3464b81 to 462d05e Compare November 14, 2024 18:16
@pls148 pls148 force-pushed the ps/test-randomized-committee branch from 8be316a to 3c2b7c5 Compare November 20, 2024 21:09
@pls148 pls148 requested review from rob-maron and ss-es November 21, 2024 16:37
@pls148 pls148 force-pushed the ps/test-randomized-committee branch 3 times, most recently from 1dc6185 to 6533334 Compare November 21, 2024 18:59
@pls148 pls148 requested a review from tbro November 22, 2024 21:18
@pls148 pls148 assigned tbro and ss-es Nov 22, 2024
@pls148 pls148 force-pushed the ps/test-randomized-committee branch 2 times, most recently from 4d25a34 to f190b5c Compare November 23, 2024 01:27
Copy link
Contributor

@lukaszrzasik lukaszrzasik left a comment

Choose a reason for hiding this comment

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

Just a nit about possible typo.

@@ -24,6 +24,9 @@ use crate::{
vote::{HasViewNumber, Vote},
};

/// Marker that data should use the quorum cert type
pub(crate) trait QuorumMaker {}
Copy link
Contributor

Choose a reason for hiding this comment

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

typo? Marker vs Maker?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if that's a typo, @tbro let me know if it is. I've amended this PR to rename QuorumMaker->QuorumMarker but not positive that's your intent

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure either. Just noticed a discrepancy between the trait name and the comment above.

Copy link
Contributor

Choose a reason for hiding this comment

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

from context I think it's meant to be QuorumMarker (it looks like it indicates that things need to be signed by the full quorum rather than DA)

@pls148 pls148 force-pushed the ps/test-randomized-committee branch from f190b5c to 44456f9 Compare November 26, 2024 02:37
tbro and others added 9 commits December 2, 2024 10:01
Delete Memberships and replace functionality. Add some methods to
`Membership` trait to deal w/ collapsing into one type both kinds of
memberships (stake and DA).

  * avoid passing membership into `is_valid_cert
  * for DA, avoid proxying threshold through `Threshold` trait
  * remove `Topic` param from `Membership::new
  * Split cert impls by marker (#3891)
  * add membership methods to Cert trait
  * remove non-existent tests from justfile
We can keep the old name where we only have one membership type to
keep the diff smaller.
Always use quorum for leader selection
@pls148 pls148 force-pushed the ps/test-randomized-committee branch 3 times, most recently from 00e6acd to ca4e339 Compare December 2, 2024 18:28
@pls148 pls148 force-pushed the ps/test-randomized-committee branch from ca4e339 to 77a88f1 Compare December 2, 2024 19:46
Copy link
Contributor

@ss-es ss-es 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 to me, not sure if the test was meant to be commented out or not

Comment on lines +44 to +62
// cross_tests!(
// TestName: test_epoch_success,
// Impls: [MemoryImpl, Libp2pImpl, PushCdnImpl],
// Types: [TestTypes, TestTypesRandomizedLeader, TestTypesRandomizedCommitteeMembers<StableQuorumFilterConfig<123, 2>>, TestTypesRandomizedCommitteeMembers<RandomOverlapQuorumFilterConfig<123, 4, 5, 0, 2>>],
// Versions: [EpochsTestVersions],
// Ignore: false,
// Metadata: {
// TestDescription {
// // allow more time to pass in CI
// completion_task_description: CompletionTaskDescription::TimeBasedCompletionTaskBuilder(
// TimeBasedCompletionTaskDescription {
// duration: Duration::from_secs(60),
// },
// ),
// ..TestDescription::default()
// }
// },
// );

Copy link
Contributor

Choose a reason for hiding this comment

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

is this meant to be commented out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, that's for once the epoch change actually works

@pls148 pls148 merged commit 437d9c8 into main Dec 2, 2024
17 checks passed
@pls148 pls148 deleted the ps/test-randomized-committee branch December 2, 2024 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Membership impl with differing stake table for testing
5 participants