diff --git a/config/papyrus/default_config.json b/config/papyrus/default_config.json index 050c4dde26..3f64074ca4 100644 --- a/config/papyrus/default_config.json +++ b/config/papyrus/default_config.json @@ -202,7 +202,7 @@ "consensus.validator_id": { "description": "The validator id of the node.", "privacy": "Public", - "value": "0x0" + "value": "0x64" }, "monitoring_gateway.collect_metrics": { "description": "If true, collect and return metrics in the monitoring gateway.", @@ -514,4 +514,4 @@ "privacy": "Public", "value": true } -} \ No newline at end of file +} diff --git a/config/sequencer/default_config.json b/config/sequencer/default_config.json index 4a76fe3dc2..1514a6498c 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": "0x64" }, "eth_fee_token_address": { "description": "A required param! Address of the ETH fee token.", diff --git a/crates/papyrus_node/src/config/snapshots/papyrus_node__config__config_test__dump_default_config.snap b/crates/papyrus_node/src/config/snapshots/papyrus_node__config__config_test__dump_default_config.snap index e173e2d63c..2049ef5521 100644 --- a/crates/papyrus_node/src/config/snapshots/papyrus_node__config__config_test__dump_default_config.snap +++ b/crates/papyrus_node/src/config/snapshots/papyrus_node__config__config_test__dump_default_config.snap @@ -1,6 +1,7 @@ --- source: crates/papyrus_node/src/config/config_test.rs expression: dumped_default_config +snapshot_kind: text --- { "base_layer.node_url": { @@ -243,7 +244,7 @@ expression: dumped_default_config }, "consensus.validator_id": { "description": "The validator id of the node.", - "value": "0x0", + "value": "0x64", "privacy": "Public" }, "monitoring_gateway.collect_metrics": { diff --git a/crates/sequencing/papyrus_consensus/src/config.rs b/crates/sequencing/papyrus_consensus/src/config.rs index 771f502572..843cc206bf 100644 --- a/crates/sequencing/papyrus_consensus/src/config.rs +++ b/crates/sequencing/papyrus_consensus/src/config.rs @@ -100,7 +100,7 @@ impl Default for ConsensusConfig { }; Self { chain_id: ChainId::Other("0x0".to_string()), - 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 10f98ca2df..d393627ac9 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_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 27113437fb..60a9251f1a 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 87400efbcb..680a4224f0 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 87ff7fc421..ed3acb19b7 100644 --- a/crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context.rs +++ b/crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context.rs @@ -69,7 +69,8 @@ impl PapyrusConsensusContext { storage_reader, network_broadcast_client, network_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(), sync_broadcast_sender, valid_proposals: Arc::new(Mutex::new(BTreeMap::new())), } diff --git a/crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context_test.rs b/crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context_test.rs index 0b6aa4feb4..d5cc473555 100644 --- a/crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context_test.rs +++ b/crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context_test.rs @@ -39,7 +39,7 @@ async fn build_proposal() { let proposal_init = ProposalInit { height: block_number, round: 0, - proposer: ValidatorId::default(), + proposer: ValidatorId::from(100_u32), valid_round: None, }; // TODO(Asmaa): Test proposal content. 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 5687a4d9f4..75ee9e2db0 100644 --- a/crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs +++ b/crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs @@ -122,7 +122,8 @@ impl SequencerConsensusContext { _proposal_streaming_client, outbound_proposal_sender, vote_broadcast_client, - 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) };