From 934959133124b5be9dc403482be0d23145c69212 Mon Sep 17 00:00:00 2001 From: Arni Hod Date: Thu, 5 Dec 2024 16:39:53 +0200 Subject: [PATCH] chore(consensus): add config pointer of sequencer address to validator id --- config/sequencer/default_config.json | 9 +++++++-- crates/starknet_integration_tests/src/config_utils.rs | 1 + crates/starknet_integration_tests/src/utils.rs | 2 ++ 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(+), 2 deletions(-) diff --git a/config/sequencer/default_config.json b/config/sequencer/default_config.json index 5199edd4b2..93d7005e0d 100644 --- a/config/sequencer/default_config.json +++ b/config/sequencer/default_config.json @@ -726,8 +726,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.", @@ -949,6 +949,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 4891fc28c5..77588c1a3c 100644 --- a/crates/starknet_integration_tests/src/config_utils.rs +++ b/crates/starknet_integration_tests/src/config_utils.rs @@ -58,6 +58,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 2ebdec966a..c040d1a904 100644 --- a/crates/starknet_integration_tests/src/utils.rs +++ b/crates/starknet_integration_tests/src/utils.rs @@ -12,6 +12,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::ContractAddress; use starknet_api::rpc_transaction::RpcTransaction; use starknet_api::transaction::TransactionHash; use starknet_batcher::block_builder::BlockBuilderConfig; @@ -62,6 +63,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), }, consensus_proposals_channels, ) 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), } } }