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 Dec 2, 2025

@asmaastarkware asmaastarkware marked this pull request as ready for review December 2, 2025 12:36
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 9 of 9 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @asmaastarkware and @dafnamatsry)


crates/apollo_consensus/src/manager_test.rs line 146 at r1 (raw file):

    )
    .await;
    send(&mut sender, prevote(Some(Felt::TWO), BlockNumber(2), 0, *PROPOSER_ID)).await;

Consider adding a utility function for easier conversion:

Code quote (i):

BlockNumber(2)

Code snippet (ii):

impl<T> From<T> for BlockNumber
where
    T: Into<u64>,
{
    fn from(value: T) -> Self {
        BlockNumber(value.into())
    }
}

crates/apollo_consensus/src/manager_test.rs line 146 at r1 (raw file):

    )
    .await;
    send(&mut sender, prevote(Some(Felt::TWO), BlockNumber(2), 0, *PROPOSER_ID)).await;

Consider using a shorter syntax using intermediate vars

Code quote (i):

BlockNumber(2)

Code snippet (ii):

let b1 = BlockNumber(1);
let b2 = BlockNumber(2);

crates/apollo_consensus/src/manager_test.rs line 272 at r1 (raw file):

    send_proposal(
        &mut proposal_receiver_sender,
        vec![TestProposalPart::Init(proposal_init(1, 0, *PROPOSER_ID))],

Fix this function to accept Height as well

Code quote:

proposal_init

crates/apollo_protobuf/src/consensus.rs line 51 at r1 (raw file):

    pub vote_type: VoteType,
    pub height: BlockNumber,
    pub round: u32,

And this is for the next PR...

Code quote:

u32,

crates/apollo_consensus/src/manager.rs line 833 at r1 (raw file):

    ) -> bool {
        let limits = &self.consensus_config.dynamic_config.future_msg_limit;
        let height_diff = msg_height.0.saturating_sub(current_height.0);

Add derive_more::Deref to BlockNumber derives, and make the ".0" syntax obsolete.

Suggestion:

msg_height.saturating_sub

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: all files reviewed, 4 unresolved discussions (waiting on @dafnamatsry and @matanl-starkware)


crates/apollo_consensus/src/manager_test.rs line 272 at r1 (raw file):

Previously, matanl-starkware (Matan Lior) wrote…

Fix this function to accept Height as well

(The function already accepts Height)
This is a good example of why I’d prefer to keep BlockNumber as-is and avoid implementing From<T> for BlockNumber

@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/use_blocknumber_for_vote.height branch from 3100e6a to ea0e09b Compare December 3, 2025 09:55
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/use_blocknumber_for_vote.height branch from ea0e09b to d93f9d6 Compare December 3, 2025 11:45
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/unify_timeout_scheduling_requests branch from 0045f6c to a674f6d Compare December 3, 2025 12:24
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/use_blocknumber_for_vote.height branch 2 times, most recently from 8e22da8 to 7beff96 Compare December 3, 2025 12:29
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/unify_timeout_scheduling_requests branch from a674f6d to a559b67 Compare December 3, 2025 12:29
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 7 of 8 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dafnamatsry)


-- commits line 2 at r3:
I don't think this change effectively impacts the protobuf module.
Consider leaving only "apollo_consensus" here.

Code quote:

,apollo_protobuf

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.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dafnamatsry)


crates/starknet_api/src/block.rs line 280 at r3 (raw file):

    Copy,
    derive_more::Display,
    derive_more::Deref,

Once you have this in place, there are many more places that can be cleaned. For next PR.
Such as:
STORAGE_HEIGHT.set_lossy(storage_height.0);
LAST_PROPOSED_BLOCK_HEIGHT.set_lossy(block_number.0);
let mut up_to = min(state_marker, BlockNumber(from.0 + u64::from(max_stream_size)));

Code quote:

derive_more::Deref,

@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/unify_timeout_scheduling_requests branch from a559b67 to bf6cc66 Compare December 4, 2025 08:01
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/use_blocknumber_for_vote.height branch from 7beff96 to 51ad072 Compare December 4, 2025 08:01
@asmaastarkware asmaastarkware changed the title apollo_consensus,apollo_protobuf: use BlockNumber for Vote.height apollo_consensus: use BlockNumber for Vote.height Dec 4, 2025
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/unify_timeout_scheduling_requests branch from bf6cc66 to 9b240b3 Compare December 8, 2025 07:33
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/use_blocknumber_for_vote.height branch 2 times, most recently from 0dfe0db to dad8c7d Compare December 8, 2025 09:08
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/unify_timeout_scheduling_requests branch 2 times, most recently from b0543e1 to eb935ba Compare December 8, 2025 09:49
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/use_blocknumber_for_vote.height branch from dad8c7d to 0223f0c Compare December 8, 2025 09:50
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/unify_timeout_scheduling_requests branch from eb935ba to d52e421 Compare December 8, 2025 13:14
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/use_blocknumber_for_vote.height branch from 0223f0c to 31f17aa Compare December 8, 2025 13:14
Base automatically changed from asmaa/refactor/unify_timeout_scheduling_requests to main-v0.14.1 December 8, 2025 13:50
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/use_blocknumber_for_vote.height branch from 31f17aa to 09eec94 Compare December 8, 2025 13:51
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 1 of 1 files at r4, 2 of 2 files at r5, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dafnamatsry)

@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/use_blocknumber_for_vote.height branch from 09eec94 to fde8c30 Compare December 8, 2025 14:43
@asmaastarkware asmaastarkware force-pushed the asmaa/refactor/use_blocknumber_for_vote.height branch from fde8c30 to de5d172 Compare December 9, 2025 05:59
@asmaastarkware asmaastarkware added this pull request to the merge queue Dec 9, 2025
Merged via the queue into main-v0.14.1 with commit cc10135 Dec 9, 2025
24 of 25 checks passed
@asmaastarkware asmaastarkware deleted the asmaa/refactor/use_blocknumber_for_vote.height branch December 9, 2025 06:38
@github-actions github-actions bot locked and limited conversation to collaborators Dec 10, 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.

4 participants