diff --git a/config/papyrus/default_config.json b/config/papyrus/default_config.json index ab8323e8ad7..0673d4e6b3a 100644 --- a/config/papyrus/default_config.json +++ b/config/papyrus/default_config.json @@ -197,7 +197,7 @@ "consensus.validator_id": { "description": "The validator id of the node.", "privacy": "Public", - "value": "0x0" + "value": "0x7c7" }, "monitoring_gateway.collect_metrics": { "description": "If true, collect and return metrics in the monitoring gateway.", 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 bc2248761a1..1499f60e010 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 @@ -238,7 +238,7 @@ expression: dumped_default_config }, "consensus.validator_id": { "description": "The validator id of the node.", - "value": "0x0", + "value": "0x7c7", "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 97ed7f4656e..0ebeb4ae880 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(1991_u128), network_topic: "consensus".to_string(), start_height: BlockNumber::default(), num_validators: 1, diff --git a/crates/sequencing/papyrus_consensus/src/single_height_consensus.rs b/crates/sequencing/papyrus_consensus/src/single_height_consensus.rs index e4c55f3b730..3495300cdaf 100644 --- a/crates/sequencing/papyrus_consensus/src/single_height_consensus.rs +++ b/crates/sequencing/papyrus_consensus/src/single_height_consensus.rs @@ -184,13 +184,21 @@ impl SingleHeightConsensus { ) -> Result { info!("Starting consensus with validators {:?}", self.validators); context - .set_height_and_round(self.height, self.state_machine.round(), ValidatorId::default()) + .set_height_and_round( + self.height, + self.state_machine.round(), + ValidatorId::from(1991_u32), + ) .await; let leader_fn = |round: Round| -> ValidatorId { context.proposer(self.height, round) }; let events = self.state_machine.start(&leader_fn); let ret = self.handle_state_machine_events(context, events).await; context - .set_height_and_round(self.height, self.state_machine.round(), ValidatorId::default()) + .set_height_and_round( + self.height, + self.state_machine.round(), + ValidatorId::from(1991_u32), + ) .await; ret } @@ -239,7 +247,11 @@ impl SingleHeightConsensus { ) .await; context - .set_height_and_round(self.height, self.state_machine.round(), ValidatorId::default()) + .set_height_and_round( + self.height, + self.state_machine.round(), + ValidatorId::from(1991_u32), + ) .await; Ok(ShcReturn::Tasks(vec![ShcTask::ValidateProposal(init, block_receiver)])) } @@ -272,7 +284,7 @@ impl SingleHeightConsensus { .set_height_and_round( self.height, self.state_machine.round(), - ValidatorId::default(), + ValidatorId::from(1991_u32), ) .await; ret @@ -368,7 +380,11 @@ impl SingleHeightConsensus { _ => unimplemented!("Unexpected event: {:?}", event), }; context - .set_height_and_round(self.height, self.state_machine.round(), ValidatorId::default()) + .set_height_and_round( + self.height, + self.state_machine.round(), + ValidatorId::from(1991_u32), + ) .await; ret } 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 e1db995b78d..b0315be2dfe 100644 --- a/crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs +++ b/crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs @@ -58,7 +58,6 @@ use tokio::task::JoinHandle; use tracing::{debug, debug_span, error, info, trace, warn, Instrument}; // TODO(Dan, Matan): Remove these and replace with real gas prices and real sequencer address. -const TEMPORARY_SEQUENCER_ADDRESS: u16 = 1991; const TEMPORARY_GAS_PRICES: GasPrices = GasPrices { eth_gas_prices: GasPriceVector { l1_gas_price: NonzeroGasPrice::MIN, @@ -180,7 +179,7 @@ impl ConsensusContext for SequencerConsensusContext { now.timestamp().try_into().expect("Failed to convert timestamp"), ), use_kzg_da: true, - sequencer_address: ValidatorId::from(TEMPORARY_SEQUENCER_ADDRESS), + sequencer_address: proposal_init.proposer, }, }; // TODO: Should we be returning an error? @@ -364,7 +363,7 @@ impl SequencerConsensusContext { async fn validate_current_round_proposal( &mut self, height: BlockNumber, - _proposer: ValidatorId, + proposer: ValidatorId, timeout: Duration, content_receiver: mpsc::Receiver, fin_sender: oneshot::Sender<(ProposalContentId, ProposalFin)>, @@ -395,7 +394,7 @@ impl SequencerConsensusContext { now.timestamp().try_into().expect("Failed to convert timestamp"), ), use_kzg_da: true, - sequencer_address: ValidatorId::from(TEMPORARY_SEQUENCER_ADDRESS), + sequencer_address: proposer, }, }; batcher.validate_block(input).await.expect("Failed to initiate proposal validation"); 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 8e2c998cea5..9cceb6c657e 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::{ @@ -65,7 +65,7 @@ async fn listen_to_broadcasted_messages( height: BlockNumber(1), round: 0, valid_round: None, - proposer: ContractAddress::default(), + proposer: ValidatorId::from(1991_u32), }; let expected_proposal_fin = ProposalFin { proposal_content_id: BlockHash(Felt::from_hex_unchecked(