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

feat(consensus): add config to Context #3268

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

guy-starkware
Copy link
Contributor

@guy-starkware guy-starkware commented Jan 13, 2025

Adds a ContextConfig struct that is used by the two context structs.

@reviewable-StarkWare
Copy link

This change is Reviewable

@guy-starkware guy-starkware force-pushed the guyn/config/add_context_config branch from 83fa23c to 4afa386 Compare January 14, 2025 13:14
@guy-starkware guy-starkware changed the base branch from guyn/config/remove_consensus_network_topic to guyn/config/remove_some_defaults January 14, 2025 13:15
@guy-starkware guy-starkware force-pushed the guyn/config/remove_some_defaults branch from 147811a to f6cb2c3 Compare January 14, 2025 13:23
@guy-starkware guy-starkware force-pushed the guyn/config/add_context_config branch 2 times, most recently from 160be43 to 56db437 Compare January 14, 2025 13:36
@guy-starkware guy-starkware force-pushed the guyn/config/remove_some_defaults branch from f6cb2c3 to d94f865 Compare January 15, 2025 09:12
@guy-starkware guy-starkware force-pushed the guyn/config/add_context_config branch from 56db437 to 53b29cd Compare January 15, 2025 09:12
@guy-starkware guy-starkware force-pushed the guyn/config/remove_some_defaults branch from d94f865 to 174e78f Compare January 15, 2025 10:06
@guy-starkware guy-starkware force-pushed the guyn/config/add_context_config branch from 53b29cd to 14cc693 Compare January 15, 2025 10:07
@guy-starkware guy-starkware force-pushed the guyn/config/remove_some_defaults branch from 174e78f to 6df7549 Compare January 15, 2025 13:07
@guy-starkware guy-starkware force-pushed the guyn/config/add_context_config branch 2 times, most recently from 3010128 to 4c6ccd6 Compare January 16, 2025 09:43
@guy-starkware guy-starkware changed the base branch from guyn/config/remove_some_defaults to main January 16, 2025 09:43
Copy link

github-actions bot commented Jan 16, 2025

Artifacts upload workflows:

Copy link
Contributor

@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.

Reviewed 8 of 8 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @dan-starkware, @giladchase, and @guy-starkware)


crates/papyrus_node/src/config/mod.rs line 12 at r1 (raw file):

use std::ops::IndexMut;
use std::path::{Path, PathBuf};
use std::task::Context;

unused right?


crates/papyrus_node/src/config/mod.rs line 69 at r1 (raw file):

    pub p2p_sync: Option<P2pSyncClientConfig>,
    pub consensus: Option<ConsensusConfig>,
    pub context: ContextConfig,

make it optional, and apply the relevant changes

Suggestion:

pub context: Option<ContextConfig>,

crates/sequencing/papyrus_consensus/src/types.rs line 35 at r1 (raw file):

/// Configuration for the Context struct.
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Validate)]
pub struct ContextConfig {

why not adding it to the context dir?


crates/sequencing/papyrus_consensus/src/types.rs line 41 at r1 (raw file):

    pub num_validators: u64,
    /// The chain id of the Starknet chain.
    pub chain_id: ChainId,

both num_validators and chain_id are part of the consensus config and are passed to the context. I suggest either removing them now or adding a TODO to complete the concept within the PR.
also to add batcher_build_buffer when its used (if we still want to add it to the config since the papyrus context doesn't interact with the batcher)


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

    let papyrus_context = PapyrusConsensusContext::new(
        ContextConfig::default(),

by default its 1 not 4.. tests are safe :)

@guy-starkware guy-starkware force-pushed the guyn/config/add_context_config branch from 7878ee6 to 41718f0 Compare January 16, 2025 14:59
Copy link
Contributor Author

@guy-starkware guy-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: 3 of 9 files reviewed, 4 unresolved discussions (waiting on @asmaastarkware, @dan-starkware, and @giladchase)


crates/papyrus_node/src/config/mod.rs line 12 at r1 (raw file):

Previously, asmaastarkware (asmaa-starkware) wrote…

unused right?

yes! I wonder why clippy didn't see that...


crates/papyrus_node/src/config/mod.rs line 69 at r1 (raw file):

Previously, asmaastarkware (asmaa-starkware) wrote…

make it optional, and apply the relevant changes

Done.


crates/sequencing/papyrus_consensus/src/types.rs line 35 at r1 (raw file):

Previously, asmaastarkware (asmaa-starkware) wrote…

why not adding it to the context dir?

I'm not really happy about having it in types.rs either.

I think I should do a PR at the end of the stack where I move the ContextConfig to another place. I'm not sure where it will be, if you have a place you think is right, let me know.


crates/sequencing/papyrus_consensus/src/types.rs line 41 at r1 (raw file):

Previously, asmaastarkware (asmaa-starkware) wrote…

both num_validators and chain_id are part of the consensus config and are passed to the context. I suggest either removing them now or adding a TODO to complete the concept within the PR.
also to add batcher_build_buffer when its used (if we still want to add it to the config since the papyrus context doesn't interact with the batcher)

I added a TODO. This happens in another PR on this stack.


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

Previously, asmaastarkware (asmaa-starkware) wrote…

by default its 1 not 4.. tests are safe :)

I think I had an issue with the number of validators in one of the tests in the next PRs. I don't remember exactly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants