-
Notifications
You must be signed in to change notification settings - Fork 65
apollo_consensus: move proposal storage to SM; dedupe in SHC #10337
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
apollo_consensus: move proposal storage to SM; dedupe in SHC #10337
Conversation
0891466 to
d873f92
Compare
10cf82e to
1630329
Compare
d873f92 to
aa597f5
Compare
1630329 to
14d84a6
Compare
matanl-starkware
left a comment
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.
@matanl-starkware reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @dafnamatsry)
crates/apollo_consensus/src/state_machine.rs line 158 at r1 (raw file):
pub(crate) fn proposals_ref( &self, ) -> &HashMap<Round, (Option<ProposalCommitment>, Option<Round>)> {
I'm not sure if this function is needed; if you accept my suggestions to have more fine-tuned getter functions for StateMachine.
Code quote:
&HashMap<Round, (Option<ProposalCommitment>, Option<Round>)>crates/apollo_consensus/src/single_height_consensus.rs line 210 at r1 (raw file):
// - If SM already has an entry for this round, a (re)proposal was already recorded. // - If we already started validating this round, ignore repeats. if self.state_machine.proposals_ref().get(&init.round).is_some()
Add fn to state_machine to check whether a round exists (-> bool)
Code quote:
.proposals_ref().get(&init.round).is_some()crates/apollo_consensus/src/single_height_consensus.rs line 296 at r1 (raw file):
// Validation for this round finished; clear the pending marker. self.pending_validation_rounds.remove(&round);
Didn't understand why this is done here
Code quote:
self.pending_validation_rounds.remove(&round);crates/apollo_consensus/src/single_height_consensus.rs line 478 at r1 (raw file):
// Make sure there is an existing proposal for the valid round and it matches the proposal // ID. let existing = self.state_machine.proposals_ref().get(&valid_round).and_then(|(id, _)| *id);
Create a fn for this
Code quote:
proposals_ref().get(&valid_round).and_then(|(id, _)| *id);aa597f5 to
58777fc
Compare
10f3a92 to
0348f1e
Compare
asmaastarkware
left a comment
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.
Reviewable status: 0 of 2 files reviewed, 4 unresolved discussions (waiting on @dafnamatsry and @matanl-starkware)
crates/apollo_consensus/src/single_height_consensus.rs line 296 at r1 (raw file):
Previously, matanl-starkware (Matan Lior) wrote…
Didn't understand why this is done here
just for clean up, deleting it won't change the behaviour
0348f1e to
92e5452
Compare
70bd845 to
5b1ab69
Compare
92e5452 to
ebbe724
Compare
ebbe724 to
c6ec6fe
Compare
5b1ab69 to
582ca7a
Compare
c6ec6fe to
c1e36f6
Compare
582ca7a to
2f02ca4
Compare
matanl-starkware
left a comment
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.
@matanl-starkware reviewed 1 of 2 files at r2, 1 of 1 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @dafnamatsry)
crates/apollo_consensus/src/single_height_consensus.rs line 296 at r1 (raw file):
Previously, asmaastarkware (asmaa-starkware) wrote…
just for clean up, deleting it won't change the behaviour
So maybe make the comment a little bit more clear?
Is it possible that we ran validation for this round and now it's our turn to propose?
2f02ca4 to
4771243
Compare
c1e36f6 to
31bd3d1
Compare
4771243 to
b60885b
Compare
31bd3d1 to
8089a74
Compare
asmaastarkware
left a comment
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.
Reviewable status: 1 of 2 files reviewed, all discussions resolved (waiting on @dafnamatsry and @matanl-starkware)
crates/apollo_consensus/src/single_height_consensus.rs line 296 at r1 (raw file):
Previously, matanl-starkware (Matan Lior) wrote…
So maybe make the comment a little bit more clear?
Is it possible that we ran validation for this round and now it's our turn to propose?
No, when we receive a proposal, we verify the proposer matches the expected one for that round. if we are the proposer for round R, any proposal from someone else for round R would fail this check and be rejected before validation starts
dafnamatsry
left a comment
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.
@dafnamatsry reviewed 2 of 2 files at r5, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @asmaastarkware)
crates/apollo_consensus/src/single_height_consensus.rs line 565 at r5 (raw file):
.state_machine .proposal_id_for_round(round) .ok_or_else(|| invalid_decision("No proposal entry for this round".to_string()))?;
Not sure we need this check (and also the one in handle_state_machine_proposal).
This data is coming from the state machine to begin with.
Code quote:
let block = self
.state_machine
.proposal_id_for_round(round)
.ok_or_else(|| invalid_decision("No proposal entry for this round".to_string()))?;
dafnamatsry
left a comment
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @asmaastarkware)
matanl-starkware
left a comment
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.
@matanl-starkware reviewed all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @asmaastarkware)
8089a74 to
eba6d0f
Compare
b60885b to
9bb3703
Compare
asmaastarkware
left a comment
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.
@asmaastarkware reviewed 2 of 2 files at r5, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @asmaastarkware)
eba6d0f to
d71d92d
Compare

No description provided.