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 epoch parameter in Membership trait's methods #3751

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

lukaszrzasik
Copy link
Contributor

Closes #<ISSUE_NUMBER>

This PR:

This PR does not:

Key places to review:

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.

left some comments. I think I looked at all the files that had meaningful changes, and looks good overall

Comment on lines +213 to +215
type ViewTime: ConsensusTime + Display;
/// Same as above but for epoch.
type EpochTime: ConsensusTime + Display;
Copy link
Contributor

Choose a reason for hiding this comment

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

not a big deal, but could we call this just View and Epoch? I think the Time part is a bit redundant

@@ -244,7 +246,7 @@ pub trait NodeType:
type InstanceState: InstanceState;

/// The validated state type that this hotshot setup is using.
type ValidatedState: ValidatedState<Self, Instance = Self::InstanceState, Time = Self::Time>;
type ValidatedState: ValidatedState<Self, Instance = Self::InstanceState, Time = Self::ViewTime>;
Copy link
Contributor

Choose a reason for hiding this comment

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

will ValidatedState require an epoch too?

(I guess this is fine to leave as-is for now even if it will)

/// Get all participants in the committee (including their stake) for a specific epoch
fn stake_table(
&self,
epoch: TYPES::EpochTime,
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess all of these functions will now have to return a Result, because we may not have the stake table for a given (future) epoch?

(since this was quite an involved change, I can do it in #3738 after merging this -- just asking for clarification)

@@ -232,6 +232,8 @@ pub struct HotShotConfig<KEY: SignatureKey> {
pub start_voting_time: u64,
/// Unix time in seconds at which we stop voting on an upgrade. To prevent voting on an upgrade, set stop_voting_time <= start_voting_time.
pub stop_voting_time: u64,
/// Number of blocks in an epoch, zero means there are no epochs
pub epoch_height: u64,
Copy link
Contributor

Choose a reason for hiding this comment

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

this might be personal preference, but I feel like this is a protocol-level constant and might be better as an associated constant in the NodeType trait (rather than a configuration value)

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.

2 participants