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

chore(starknet_consensus_manager): add proposal init into validate proposal input #2408

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

ArniStarkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link

codecov bot commented Dec 2, 2024

Codecov Report

Attention: Patch coverage is 74.07407% with 7 lines in your changes missing coverage. Please review.

Project coverage is 32.26%. Comparing base (e3165c4) to head (79d57f2).
Report is 809 commits behind head on main.

Files with missing lines Patch % Lines
...nsus_orchestrator/src/papyrus_consensus_context.rs 53.33% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2408      +/-   ##
==========================================
- Coverage   40.10%   32.26%   -7.85%     
==========================================
  Files          26      119      +93     
  Lines        1895    14085   +12190     
  Branches     1895    14085   +12190     
==========================================
+ Hits          760     4544    +3784     
- Misses       1100     8989    +7889     
- Partials       35      552     +517     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ArniStarkware ArniStarkware force-pushed the arni/batcher/block_builder_factory/set_propser_address_in_build_block_input branch from 0dc1db4 to 9c9aa6c Compare December 2, 2024 15:05
@ArniStarkware ArniStarkware force-pushed the arni/consensus/simplify_validate_proposal_input branch from ce0120e to 73a6ac4 Compare December 2, 2024 15:07
@ArniStarkware ArniStarkware force-pushed the arni/batcher/block_builder_factory/set_propser_address_in_build_block_input branch 2 times, most recently from e104f26 to b6a3940 Compare December 3, 2024 10:59
@ArniStarkware ArniStarkware force-pushed the arni/batcher/block_builder_factory/set_propser_address_in_build_block_input branch 3 times, most recently from 38d7da8 to c2fba98 Compare December 3, 2024 14:15
@ArniStarkware ArniStarkware force-pushed the arni/consensus/simplify_validate_proposal_input branch from 73a6ac4 to df7d345 Compare December 3, 2024 14:15
@ArniStarkware ArniStarkware changed the base branch from arni/batcher/block_builder_factory/set_propser_address_in_build_block_input to graphite-base/2408 December 3, 2024 14:46
@ArniStarkware ArniStarkware force-pushed the arni/consensus/simplify_validate_proposal_input branch from df7d345 to 17966b1 Compare December 3, 2024 14:50
@ArniStarkware ArniStarkware changed the base branch from graphite-base/2408 to main December 3, 2024 14:50
@ArniStarkware ArniStarkware force-pushed the arni/consensus/simplify_validate_proposal_input branch 2 times, most recently from 3b7032c to 5bd0bcd Compare December 3, 2024 15:18
@ArniStarkware ArniStarkware changed the base branch from main to arni/consensus/validator_id/non_zero December 3, 2024 15:19
@ArniStarkware ArniStarkware changed the base branch from arni/consensus/non_zero_validator_id/tests to graphite-base/2408 December 9, 2024 14:56
@ArniStarkware ArniStarkware force-pushed the arni/consensus/simplify_validate_proposal_input branch from ca6a7be to 12b8a52 Compare December 9, 2024 15:16
@ArniStarkware ArniStarkware changed the base branch from graphite-base/2408 to main December 9, 2024 15:17
@ArniStarkware ArniStarkware force-pushed the arni/consensus/simplify_validate_proposal_input branch from 12b8a52 to e4c5d31 Compare December 9, 2024 15:17
Copy link
Collaborator

@alonh5 alonh5 left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r4, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @ArniStarkware and @matan-starkware)


crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context.rs line 184 at r3 (raw file):

Previously, ArniStarkware (Arnon Hod) wrote…

This is consistent with how this variable is handled in a similar function in this file:build_proposal

I didn't understand your response. I'm saying proposal_init.height is used like 7 times in this function so it's probably defining a shorter variable name for it. Same goes for build_proposal in that case.

@ArniStarkware ArniStarkware force-pushed the arni/consensus/simplify_validate_proposal_input branch from e4c5d31 to 11d8683 Compare December 10, 2024 12:49
@ArniStarkware ArniStarkware requested a review from alonh5 December 10, 2024 14:16
Copy link
Contributor Author

@ArniStarkware ArniStarkware 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: 10 of 11 files reviewed, 2 unresolved discussions (waiting on @alonh5 and @matan-starkware)


crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context.rs line 184 at r3 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

I didn't understand your response. I'm saying proposal_init.height is used like 7 times in this function so it's probably defining a shorter variable name for it. Same goes for build_proposal in that case.

Done.

@ArniStarkware ArniStarkware force-pushed the arni/consensus/simplify_validate_proposal_input branch from 11d8683 to 79d57f2 Compare December 10, 2024 14:16
@ArniStarkware ArniStarkware marked this pull request as ready for review December 10, 2024 14:17
@ArniStarkware ArniStarkware force-pushed the arni/consensus/simplify_validate_proposal_input branch from 79d57f2 to 5faeb90 Compare December 15, 2024 09:00
Copy link
Collaborator

@alonh5 alonh5 left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 5 of 5 files at r5, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @matan-starkware)

@ArniStarkware ArniStarkware force-pushed the arni/consensus/simplify_validate_proposal_input branch from 5faeb90 to e460a61 Compare December 16, 2024 15:23
Copy link
Collaborator

@alonh5 alonh5 left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r6, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @matan-starkware)

Copy link
Collaborator

@alonh5 alonh5 left a comment

Choose a reason for hiding this comment

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

Dismissed @matan-starkware from a discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @matan-starkware)

Copy link
Collaborator

@alonh5 alonh5 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 @ArniStarkware and @matan-starkware)


a discussion (no related file):
Make sure with @matan-starkware if he wants this or not, and then merge or close accordingly.

Copy link
Contributor

@matan-starkware matan-starkware left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 9 files at r3, 1 of 2 files at r4, 4 of 5 files at r5, 2 of 2 files at r6, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @ArniStarkware)


crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context_test.rs line 75 at r1 (raw file):

Previously, ArniStarkware (Arnon Hod) wrote…

Also, it is based on the change to the validator ID.

Can you explicitly define Default for ProposalInit and that can have DEFAULT_VALIDATOR_ID. I think that will make usage easier.


crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context_test.rs line 205 at r6 (raw file):

                proposer: ValidatorId::from(DEFAULT_VALIDATOR_ID),
                ..Default::default()
            },

If you don't care about the field's specifics.

Suggestion:

            ProposalInit::default(),

crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context_test.rs line 348 at r6 (raw file):

            content_receiver,
        )
        .await;

Let's refactor to highlight the round change.

Suggestion:

    let mut init = ProposalInit {
        round: 0,
        ..Default::default()
    };
    let fin_receiver_past_round =
        context.validate_proposal(init.clone(), TIMEOUT, content_receiver).await;

crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context_test.rs line 367 at r6 (raw file):

            content_receiver,
        )
        .await;

and for round 2.

Suggestion:

    init.round = 1;
    let fin_receiver_curr_round =
        context.validate_proposal(init.clone(), TIMEOUT, content_receiver).await;

@ArniStarkware ArniStarkware force-pushed the arni/consensus/simplify_validate_proposal_input branch from e460a61 to a57aead Compare December 19, 2024 09:24
Copy link
Contributor Author

@ArniStarkware ArniStarkware 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: 3 of 12 files reviewed, 4 unresolved discussions (waiting on @alonh5 and @matan-starkware)


crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context_test.rs line 75 at r1 (raw file):

Previously, matan-starkware wrote…

Can you explicitly define Default for ProposalInit and that can have DEFAULT_VALIDATOR_ID. I think that will make usage easier.

Done.


crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context_test.rs line 205 at r6 (raw file):

Previously, matan-starkware wrote…

If you don't care about the field's specifics.

Done. Throughout the code.


crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context_test.rs line 348 at r6 (raw file):

Previously, matan-starkware wrote…

Let's refactor to highlight the round change.

Done.


crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context_test.rs line 367 at r6 (raw file):

Previously, matan-starkware wrote…

and for round 2.

Done.

Copy link
Contributor Author

@ArniStarkware ArniStarkware 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: 3 of 12 files reviewed, 4 unresolved discussions (waiting on @alonh5 and @matan-starkware)


crates/papyrus_protobuf/src/consensus.rs line 81 at r7 (raw file):

            round: Default::default(),
            valid_round: Default::default(),
            // TODO(Arni): Use DEFAULT_VALIDATOR_ID instead of 100.

Done. #2812.

Code quote:

// TODO(Arni): Use DEFAULT_VALIDATOR_ID instead of 100.

Copy link
Contributor

@matan-starkware matan-starkware left a comment

Choose a reason for hiding this comment

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

Reviewed 9 of 9 files at r7, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @alonh5 and @ArniStarkware)


crates/papyrus_protobuf/src/consensus.rs line 83 at r7 (raw file):

            // TODO(Arni): Use DEFAULT_VALIDATOR_ID instead of 100.
            proposer: ContractAddress::from(100_u64),
        }

Suggestion:

    fn default() -> Self {
        ProposalInit {
            // TODO(Arni): Use DEFAULT_VALIDATOR_ID instead of 100.
            proposer: ContractAddress::from(100_u64),
            ..Default::default(),
        }

Copy link
Contributor

@matan-starkware matan-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: all files reviewed, 1 unresolved discussion (waiting on @alonh5 and @ArniStarkware)

Copy link
Contributor Author

@ArniStarkware ArniStarkware 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 @alonh5)


crates/papyrus_protobuf/src/consensus.rs line 83 at r7 (raw file):

            // TODO(Arni): Use DEFAULT_VALIDATOR_ID instead of 100.
            proposer: ContractAddress::from(100_u64),
        }

warning: function cannot return without recursing
This is because we are now defining default, so we can not use default to define it.

I suspect your suggestion does not even work.

@ArniStarkware ArniStarkware merged commit 093eb7d into main Dec 19, 2024
14 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 21, 2024
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