Skip to content

Conversation

@asmaastarkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

asmaastarkware commented Nov 23, 2025

Copy link
Collaborator

@matanl-starkware matanl-starkware left a 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);

@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/move_vote_storage_to_sm_dedupe_in_shc branch from aa597f5 to 58777fc Compare November 24, 2025 07:47
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/move_proposal_storage_to_sm_dedupe_in_shc branch 2 times, most recently from 10f3a92 to 0348f1e Compare November 24, 2025 08:20
Copy link
Contributor Author

@asmaastarkware asmaastarkware left a 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

@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/move_proposal_storage_to_sm_dedupe_in_shc branch from 0348f1e to 92e5452 Compare November 24, 2025 08:32
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/move_vote_storage_to_sm_dedupe_in_shc branch 2 times, most recently from 70bd845 to 5b1ab69 Compare November 24, 2025 09:15
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/move_proposal_storage_to_sm_dedupe_in_shc branch from 92e5452 to ebbe724 Compare November 24, 2025 09:15
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/move_proposal_storage_to_sm_dedupe_in_shc branch from ebbe724 to c6ec6fe Compare November 24, 2025 13:18
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/move_vote_storage_to_sm_dedupe_in_shc branch from 5b1ab69 to 582ca7a Compare November 24, 2025 13:18
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/move_proposal_storage_to_sm_dedupe_in_shc branch from c6ec6fe to c1e36f6 Compare November 24, 2025 14:16
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/move_vote_storage_to_sm_dedupe_in_shc branch from 582ca7a to 2f02ca4 Compare November 24, 2025 14:16
Copy link
Collaborator

@matanl-starkware matanl-starkware left a 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: :shipit: 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?

@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/move_vote_storage_to_sm_dedupe_in_shc branch from 2f02ca4 to 4771243 Compare November 25, 2025 08:24
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/move_proposal_storage_to_sm_dedupe_in_shc branch from c1e36f6 to 31bd3d1 Compare November 25, 2025 08:24
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/move_vote_storage_to_sm_dedupe_in_shc branch from 4771243 to b60885b Compare November 25, 2025 09:00
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/move_proposal_storage_to_sm_dedupe_in_shc branch from 31bd3d1 to 8089a74 Compare November 25, 2025 09:00
Copy link
Contributor Author

@asmaastarkware asmaastarkware left a 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

Copy link
Collaborator

@dafnamatsry dafnamatsry left a 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: :shipit: 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()))?;

Copy link
Collaborator

@dafnamatsry dafnamatsry left a 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)

Copy link
Collaborator

@matanl-starkware matanl-starkware left a 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)

@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/move_proposal_storage_to_sm_dedupe_in_shc branch from 8089a74 to eba6d0f Compare November 26, 2025 08:56
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/move_vote_storage_to_sm_dedupe_in_shc branch from b60885b to 9bb3703 Compare November 26, 2025 08:56
Copy link
Contributor Author

@asmaastarkware asmaastarkware left a 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)

Base automatically changed from asmaa/refactor/move_vote_storage_to_sm_dedupe_in_shc to main-v0.14.1 November 26, 2025 09:48
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/move_proposal_storage_to_sm_dedupe_in_shc branch from eba6d0f to d71d92d Compare November 26, 2025 09:49
@asmaastarkware asmaastarkware added this pull request to the merge queue Nov 26, 2025
Merged via the queue into main-v0.14.1 with commit 0c5c7c2 Nov 26, 2025
21 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Nov 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants