-
Notifications
You must be signed in to change notification settings - Fork 103
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
Stake Table Catchup in Hotshot #2623
base: main
Are you sure you want to change the base?
Conversation
Unable to build without Cargo.lock file. This means that after this change 3rd party projects may have For the first failing build see: https://github.com/EspressoSystems/espresso-sequencer/actions/runs/13426683855 To reproduce locally run
This PR can still be merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just leaving some initial comments about the swap in the Membership
object internally in hotshot. I think overall it makes sense, but I'm really concerned about some of the uses of next_epoch
and prev_epoch
and would feel much better if we explicitly passed the full EpochMembershipCoordinator
to query for a specific epoch in those places (though in some other places, like where we e.g. check to see if we're the leader for the next epoch I think next_epoch
makes complete sense)
I haven't yet looked into the actual catchup logic, I'll try to do that tomorrow
let we_are_leader = task_state | ||
.membership | ||
.read() | ||
let mem = task_state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: it might be nice if we had a pattern of calling this epoch_membership
or something to emphasize that it's the object for one specific epoch
let prev_epoch = qc.data.epoch; | ||
let mem = if prev_epoch < self.membership.epoch() { | ||
&self.membership.prev_epoch().await.ok()? | ||
} else { | ||
&self.membership |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems suspicious, is there not a better way to deal with this? e.g. I feel like we might rather just pass in the EpochMembershipCoordinator
so we can specifically get the EpochMembership
for prev_epoch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really know what a realistic attack might be but you can imagine e.g. someone puts in a fake epoch
into qc.data.epoch
but tricks you into only validating against prev_epoch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah agree with this point, I had some debugging issues with other places with this pattern as well. I think we should maybe just eplicitly checking that the epoch is for the next or prev epoch rather than <
or >
the one in the membership would work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some more comments on the actual catchup logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks fine to me overall, though I admittedly didn't check the details of every membership replacement
I still have some concerns about a few things, but they could be addressed separately. maybe they're not a big deal either
Closes #<ISSUE_NUMBER>
This PR:
Recreates: EspressoSystems/HotShot#4109
This PR does not:
Key places to review: