From 324bdea3364ffaa45b33effc93a54f31e367b31a Mon Sep 17 00:00:00 2001 From: Arnon Hod Date: Tue, 10 Dec 2024 16:09:40 +0200 Subject: [PATCH] chore(consensus): add config pointer of sequencer address to validator id (#2494) --- config/sequencer/default_config.json | 9 +++++++-- crates/starknet_integration_tests/src/config_utils.rs | 1 + crates/starknet_integration_tests/src/utils.rs | 3 ++- crates/starknet_sequencer_node/src/config/node_config.rs | 9 +++++++++ crates/starknet_sequencer_node/src/config/test_utils.rs | 2 ++ 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/config/sequencer/default_config.json b/config/sequencer/default_config.json index 0ecd1752eb..b38c5e587f 100644 --- a/config/sequencer/default_config.json +++ b/config/sequencer/default_config.json @@ -671,8 +671,8 @@ }, "consensus_manager_config.consensus_config.validator_id": { "description": "The validator id of the node.", - "privacy": "Public", - "value": "0x64" + "pointer_target": "validator_id", + "privacy": "Public" }, "eth_fee_token_address": { "description": "A required param! Address of the ETH fee token.", @@ -899,6 +899,11 @@ "param_type": "String", "privacy": "TemporaryValue" }, + "validator_id": { + "description": "A required param! The ID of the validator. Also the address of this validator as a starknet contract.", + "param_type": "String", + "privacy": "TemporaryValue" + }, "versioned_constants_overrides.invoke_tx_max_n_steps": { "description": "Maximum number of steps the invoke function is allowed to run.", "privacy": "TemporaryValue", diff --git a/crates/starknet_integration_tests/src/config_utils.rs b/crates/starknet_integration_tests/src/config_utils.rs index 18e23179c0..c684cc4f59 100644 --- a/crates/starknet_integration_tests/src/config_utils.rs +++ b/crates/starknet_integration_tests/src/config_utils.rs @@ -59,6 +59,7 @@ pub(crate) fn dump_config_file_changes( required_params.chain_id, required_params.eth_fee_token_address, required_params.strk_fee_token_address, + required_params.validator_id, config.rpc_state_reader_config.json_rpc_version, config.rpc_state_reader_config.url, config.batcher_config.storage.db_config.path_prefix, diff --git a/crates/starknet_integration_tests/src/utils.rs b/crates/starknet_integration_tests/src/utils.rs index 4adda594ef..e9c92d3809 100644 --- a/crates/starknet_integration_tests/src/utils.rs +++ b/crates/starknet_integration_tests/src/utils.rs @@ -13,7 +13,7 @@ use papyrus_network::network_manager::BroadcastTopicChannels; use papyrus_protobuf::consensus::{ProposalPart, StreamMessage}; use papyrus_storage::StorageConfig; use starknet_api::block::BlockNumber; -use starknet_api::core::ChainId; +use starknet_api::core::{ChainId, ContractAddress}; use starknet_api::rpc_transaction::RpcTransaction; use starknet_api::transaction::TransactionHash; use starknet_batcher::block_builder::BlockBuilderConfig; @@ -75,6 +75,7 @@ pub async fn create_config( chain_id: chain_info.chain_id, eth_fee_token_address: fee_token_addresses.eth_fee_token_address, strk_fee_token_address: fee_token_addresses.strk_fee_token_address, + validator_id: ContractAddress::from(100_u128), }, ) } diff --git a/crates/starknet_sequencer_node/src/config/node_config.rs b/crates/starknet_sequencer_node/src/config/node_config.rs index e0b5112b4f..412b5d9c7d 100644 --- a/crates/starknet_sequencer_node/src/config/node_config.rs +++ b/crates/starknet_sequencer_node/src/config/node_config.rs @@ -76,6 +76,15 @@ pub static CONFIG_POINTERS: LazyLock = LazyLock::new(|| { "gateway_config.chain_info.fee_token_addresses.strk_fee_token_address", ]), ), + ( + ser_pointer_target_required_param( + "validator_id", + SerializationType::String, + "The ID of the validator. \ + Also the address of this validator as a starknet contract.", + ), + set_pointing_param_paths(&["consensus_manager_config.consensus_config.validator_id"]), + ), ]; let mut common_execution_config = generate_struct_pointer( "versioned_constants_overrides".to_owned(), diff --git a/crates/starknet_sequencer_node/src/config/test_utils.rs b/crates/starknet_sequencer_node/src/config/test_utils.rs index ecbe6027a4..cf34e52152 100644 --- a/crates/starknet_sequencer_node/src/config/test_utils.rs +++ b/crates/starknet_sequencer_node/src/config/test_utils.rs @@ -11,6 +11,7 @@ pub struct RequiredParams { pub chain_id: ChainId, pub eth_fee_token_address: ContractAddress, pub strk_fee_token_address: ContractAddress, + pub validator_id: ContractAddress, } impl RequiredParams { @@ -19,6 +20,7 @@ impl RequiredParams { chain_id: ChainId::create_for_testing(), eth_fee_token_address: ContractAddress::from(2_u128), strk_fee_token_address: ContractAddress::from(3_u128), + validator_id: ContractAddress::from(100_u128), } } }