Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions config/papyrus/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,16 @@
"privacy": "Public",
"value": 10000
},
"context.validator_ids": {
"description": "Optional explicit set of validator IDs.",
"privacy": "Public",
"value": []
},
"context.validator_ids.#is_none": {
"description": "Flag for an optional field.",
"privacy": "TemporaryValue",
"value": true
},
"monitoring_gateway.collect_metrics": {
"description": "If true, collect and return metrics in the monitoring gateway.",
"pointer_target": "collect_metrics",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,16 @@ impl SequencerConsensusContext {
} else {
L1DataAvailabilityMode::Calldata
};
let validators = if let Some(ids) = config.validator_ids.clone() {
ids.into_iter().collect()
} else {
(0..num_validators).map(|i| ValidatorId::from(DEFAULT_VALIDATOR_ID + i)).collect()
};
Self {
config,
deps,
// TODO(Matan): Set the actual validator IDs (contract addresses).
validators: (0..num_validators)
.map(|i| ValidatorId::from(DEFAULT_VALIDATOR_ID + i))
.collect(),
validators,
valid_proposals: Arc::new(Mutex::new(BuiltProposals::new())),
proposal_id: 0,
current_height: None,
Expand Down
16 changes: 14 additions & 2 deletions crates/apollo_consensus_orchestrator_config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ pub struct ContextConfig {
pub proposal_buffer_size: usize,
/// The number of validators.
pub num_validators: u64,
/// Optional explicit set of validator IDs (contract addresses) to use.
/// If provided, this overrides `num_validators`.
pub validator_ids: Option<Vec<ContractAddress>>,
/// The chain id of the Starknet chain.
pub chain_id: ChainId,
/// Maximum allowed deviation (seconds) of a proposed block's timestamp from the current time.
Expand Down Expand Up @@ -132,7 +135,7 @@ pub struct ContextConfig {

impl SerializeConfig for ContextConfig {
fn dump(&self) -> BTreeMap<ParamPath, SerializedParam> {
BTreeMap::from_iter([
let mut config = BTreeMap::from_iter([
ser_param(
"proposal_buffer_size",
&self.proposal_buffer_size,
Expand Down Expand Up @@ -227,7 +230,15 @@ impl SerializeConfig for ContextConfig {
"If true, sets STRK gas price to its minimum price from the versioned constants.",
ParamPrivacyInput::Public,
),
])
]);
config.extend(ser_optional_param(
&self.validator_ids,
Default::default(),
"validator_ids",
"Optional explicit set of validator IDs.",
ParamPrivacyInput::Public,
));
config
}
}

Expand All @@ -236,6 +247,7 @@ impl Default for ContextConfig {
Self {
proposal_buffer_size: 100,
num_validators: 1,
validator_ids: None,
chain_id: ChainId::Mainnet,
block_timestamp_window_seconds: 1,
l1_da_mode: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"consensus_manager_config.context_config.max_l1_gas_price_wei": 1000000000000,
"consensus_manager_config.context_config.min_l1_data_gas_price_wei": 1,
"consensus_manager_config.context_config.max_l1_data_gas_price_wei": 1000000000000,
"consensus_manager_config.context_config.validator_ids.#is_none": true,
"consensus_manager_config.immediate_active_height": 1,
"consensus_manager_config.assume_no_malicious_validators": true,
"consensus_manager_config.network_config.broadcasted_message_metadata_buffer_size": 100000,
Expand Down
10 changes: 10 additions & 0 deletions crates/apollo_node/resources/config_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1629,6 +1629,16 @@
"privacy": "Public",
"value": 10000
},
"consensus_manager_config.context_config.validator_ids": {
"description": "Optional explicit set of validator IDs.",
"privacy": "Public",
"value": []
},
"consensus_manager_config.context_config.validator_ids.#is_none": {
"description": "Flag for an optional field.",
"privacy": "TemporaryValue",
"value": true
},
"consensus_manager_config.immediate_active_height": {
"description": "The height at which the node may actively participate in consensus.",
"privacy": "Public",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,16 @@ expression: dumped_default_config
},
"privacy": "Public"
},
"context.validator_ids": {
"description": "Optional explicit set of validator IDs.",
"value": [],
"privacy": "Public"
},
"context.validator_ids.#is_none": {
"description": "Flag for an optional field.",
"value": true,
"privacy": "TemporaryValue"
},
"monitoring_gateway.collect_metrics": {
"description": "If true, collect and return metrics in the monitoring gateway.",
"value": false,
Expand Down
Loading