diff --git a/config/sequencer/default_config.json b/config/sequencer/default_config.json index dfbb72e416..a2e662a21a 100644 --- a/config/sequencer/default_config.json +++ b/config/sequencer/default_config.json @@ -732,7 +732,7 @@ "consensus_manager_config.consensus_config.validator_id": { "description": "The validator id of the node.", "privacy": "Public", - "value": "0x0" + "value": "0x100" }, "eth_fee_token_address": { "description": "A required param! Address of the ETH fee token.", diff --git a/crates/sequencing/papyrus_consensus/src/config.rs b/crates/sequencing/papyrus_consensus/src/config.rs index 97ed7f4656..9567df8d70 100644 --- a/crates/sequencing/papyrus_consensus/src/config.rs +++ b/crates/sequencing/papyrus_consensus/src/config.rs @@ -90,7 +90,7 @@ impl Default for ConsensusConfig { ..Default::default() }; Self { - validator_id: ValidatorId::default(), + validator_id: ValidatorId::from(100_u32), network_topic: "consensus".to_string(), start_height: BlockNumber::default(), num_validators: 1, diff --git a/crates/sequencing/papyrus_consensus/src/manager_test.rs b/crates/sequencing/papyrus_consensus/src/manager_test.rs index 4f03cc0a8a..a38c05fc34 100644 --- a/crates/sequencing/papyrus_consensus/src/manager_test.rs +++ b/crates/sequencing/papyrus_consensus/src/manager_test.rs @@ -31,10 +31,10 @@ use crate::test_utils::{precommit, prevote, proposal, proposal_init}; use crate::types::{ConsensusContext, ConsensusError, ProposalContentId, Round, ValidatorId}; lazy_static! { - static ref PROPOSER_ID: ValidatorId = 0_u32.into(); - static ref VALIDATOR_ID: ValidatorId = 1_u32.into(); - static ref VALIDATOR_ID_2: ValidatorId = 2_u32.into(); - static ref VALIDATOR_ID_3: ValidatorId = 3_u32.into(); + static ref PROPOSER_ID: ValidatorId = 100_u32.into(); + static ref VALIDATOR_ID: ValidatorId = 101_u32.into(); + static ref VALIDATOR_ID_2: ValidatorId = 102_u32.into(); + static ref VALIDATOR_ID_3: ValidatorId = 103_u32.into(); static ref TIMEOUTS: TimeoutsConfig = TimeoutsConfig::default(); } diff --git a/crates/sequencing/papyrus_consensus/src/single_height_consensus_test.rs b/crates/sequencing/papyrus_consensus/src/single_height_consensus_test.rs index 2d3d14fac4..2128b0862c 100644 --- a/crates/sequencing/papyrus_consensus/src/single_height_consensus_test.rs +++ b/crates/sequencing/papyrus_consensus/src/single_height_consensus_test.rs @@ -15,10 +15,10 @@ use crate::test_utils::{precommit, prevote, MockProposalPart, MockTestContext, T use crate::types::{ConsensusError, ValidatorId}; lazy_static! { - static ref PROPOSER_ID: ValidatorId = 0_u32.into(); - static ref VALIDATOR_ID_1: ValidatorId = 1_u32.into(); - static ref VALIDATOR_ID_2: ValidatorId = 2_u32.into(); - static ref VALIDATOR_ID_3: ValidatorId = 3_u32.into(); + static ref PROPOSER_ID: ValidatorId = 100_u32.into(); + static ref VALIDATOR_ID_1: ValidatorId = 101_u32.into(); + static ref VALIDATOR_ID_2: ValidatorId = 102_u32.into(); + static ref VALIDATOR_ID_3: ValidatorId = 103_u32.into(); static ref VALIDATORS: Vec = vec![*PROPOSER_ID, *VALIDATOR_ID_1, *VALIDATOR_ID_2, *VALIDATOR_ID_3]; static ref BLOCK: TestBlock = TestBlock { content: vec![1, 2, 3], id: BlockHash(Felt::ONE) }; diff --git a/crates/sequencing/papyrus_consensus/src/state_machine_test.rs b/crates/sequencing/papyrus_consensus/src/state_machine_test.rs index 03d76b17a5..bdd530e41e 100644 --- a/crates/sequencing/papyrus_consensus/src/state_machine_test.rs +++ b/crates/sequencing/papyrus_consensus/src/state_machine_test.rs @@ -10,8 +10,8 @@ use crate::state_machine::{StateMachine, StateMachineEvent}; use crate::types::{ProposalContentId, ValidatorId}; lazy_static! { - static ref PROPOSER_ID: ValidatorId = 0_u32.into(); - static ref VALIDATOR_ID: ValidatorId = 1_u32.into(); + static ref PROPOSER_ID: ValidatorId = 100_u32.into(); + static ref VALIDATOR_ID: ValidatorId = 101_u32.into(); } const PROPOSAL_ID: Option = Some(BlockHash(Felt::ONE)); diff --git a/crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context.rs b/crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context.rs index ad3f6fa0ec..e812d784af 100644 --- a/crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context.rs +++ b/crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context.rs @@ -36,7 +36,6 @@ use papyrus_storage::body::BodyStorageReader; use papyrus_storage::header::HeaderStorageReader; use papyrus_storage::{StorageError, StorageReader}; use starknet_api::block::BlockNumber; -use starknet_api::core::ContractAddress; use starknet_api::transaction::Transaction; use tracing::{debug, debug_span, info, warn, Instrument}; @@ -70,7 +69,8 @@ impl PapyrusConsensusContext { storage_reader, network_broadcast_client, network_proposal_sender, - validators: (0..num_validators).map(ContractAddress::from).collect(), + // TODO(Matan): Set the actual validator IDs (contract addresses). + validators: (100..100 + num_validators).map(ValidatorId::from).collect(), sync_broadcast_sender, valid_proposals: Arc::new(Mutex::new(BTreeMap::new())), } diff --git a/crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs b/crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs index 7ffe207133..be74945524 100644 --- a/crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs +++ b/crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs @@ -118,7 +118,8 @@ impl SequencerConsensusContext { batcher, _proposal_streaming_client, outbound_proposal_sender, - validators: (0..num_validators).map(ValidatorId::from).collect(), + // TODO(Matan): Set the actual validator IDs (contract addresses). + validators: (100..100 + num_validators).map(ValidatorId::from).collect(), valid_proposals: Arc::new(Mutex::new(HeightToIdToContent::new())), proposal_id: 0, current_height: None, diff --git a/crates/starknet_integration_tests/src/utils.rs b/crates/starknet_integration_tests/src/utils.rs index 663b118b3d..26d3382960 100644 --- a/crates/starknet_integration_tests/src/utils.rs +++ b/crates/starknet_integration_tests/src/utils.rs @@ -85,6 +85,7 @@ fn create_consensus_manager_configs_and_channels( let consensus_manager_configs = network_configs .into_iter() + // TODO(Matan): Get config from default config file. .map(|network_config| ConsensusManagerConfig { consensus_config: ConsensusConfig { start_height: BlockNumber(1), diff --git a/crates/starknet_integration_tests/tests/end_to_end_flow_test.rs b/crates/starknet_integration_tests/tests/end_to_end_flow_test.rs index 2a808996ce..406071b590 100644 --- a/crates/starknet_integration_tests/tests/end_to_end_flow_test.rs +++ b/crates/starknet_integration_tests/tests/end_to_end_flow_test.rs @@ -2,6 +2,7 @@ use std::collections::HashSet; use futures::StreamExt; use mempool_test_utils::starknet_api_test_utils::MultiAccountTransactionGenerator; +use papyrus_consensus::types::ValidatorId; use papyrus_network::network_manager::BroadcastTopicChannels; use papyrus_protobuf::consensus::{ ProposalFin, @@ -14,7 +15,6 @@ use papyrus_storage::test_utils::CHAIN_ID_FOR_TESTS; use pretty_assertions::assert_eq; use rstest::{fixture, rstest}; use starknet_api::block::{BlockHash, BlockNumber}; -use starknet_api::core::ContractAddress; use starknet_api::transaction::TransactionHash; use starknet_integration_tests::flow_test_setup::FlowTestSetup; use starknet_integration_tests::utils::{ @@ -89,7 +89,7 @@ async fn listen_to_broadcasted_messages( height: expected_height, round: 0, valid_round: None, - proposer: ContractAddress::default(), + proposer: ValidatorId::from(100_u32), }; let expected_proposal_fin = ProposalFin { proposal_content_id: BlockHash(expected_content_id) };