Skip to content

Commit 853a39d

Browse files
apollo_node_config,apollo_node: delete CONFIG_POINTERS data and pointer-remap from secrets bin
Pointer resolution was removed in Phase 1 and the equality guarantee is now enforced by the Phase-6 Validate check, so the CONFIG_POINTERS data is dead. Delete CONFIG_POINTERS, CONFIG_NON_POINTERS_WHITELIST, and POINTER_TARGET_VALUE. Rework the secrets-schema bin to collect is_private() params directly from dump() (no pointer-member->target remap); config_secrets_schema.json regenerates byte-identical (no secret param is a pointer member). Remove the transient private_parameters dump-derivation equivalence test (its drift-guard job is done now that the dump-derivation source is gone). The dumping.rs pointer builder fns + combine_config_map_and_pointers are retained for Phase 9 (still exercised by their tests). apollo_config 26/8, apollo_node_config 33, apollo_deployments 8 green; secrets schema sha unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 4e8c344 commit 853a39d

5 files changed

Lines changed: 23 additions & 272 deletions

File tree

crates/apollo_batcher_config/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ pub struct BatcherStaticConfig {
210210
pub first_block_with_partial_block_hash: Option<FirstBlockWithPartialBlockHash>,
211211
pub storage_reader_server_static_config: StorageReaderServerStaticConfig,
212212
/// If true, the batcher only validates proposed blocks and cannot build proposals.
213-
/// Set via the node-level validation_only config pointer.
213+
/// Mirrors the node-level `validation_only`; `validate_node_config` asserts the two are equal.
214214
pub validation_only: bool,
215215
}
216216

crates/apollo_node/src/bin/update_apollo_node_config_schema.rs

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,18 @@ use std::collections::BTreeSet;
33
use apollo_config::dumping::SerializeConfig;
44
use apollo_config::ParamPath;
55
use apollo_infra_utils::dumping::serialize_to_file;
6-
use apollo_node_config::node_config::{
7-
SequencerNodeConfig,
8-
CONFIG_POINTERS,
9-
CONFIG_SECRETS_SCHEMA_PATH,
10-
};
6+
use apollo_node_config::node_config::{SequencerNodeConfig, CONFIG_SECRETS_SCHEMA_PATH};
117

12-
/// Derives the private-parameter set from the config dump: all private non-pointer parameters, plus
13-
/// the pointer targets of any private pointer members. This is the source of truth the committed
14-
/// secrets schema is generated from; `private_parameters()` reads back the committed file.
8+
/// Derives the private-parameter set from the config dump: every private parameter. This is the
9+
/// source of truth the committed secrets schema is generated from; `private_parameters()` reads
10+
/// back the committed file.
1511
fn private_parameters_from_config_dump() -> BTreeSet<ParamPath> {
16-
let dumped_config = SequencerNodeConfig::default().dump();
17-
18-
let mut private_values = BTreeSet::new();
19-
for (param_path, ser_param) in dumped_config.into_iter() {
20-
if !ser_param.is_private() {
21-
continue;
22-
}
23-
let mut included_as_a_pointer = false;
24-
for ((pointer_target_param_path, _ser_param), pointing_params) in CONFIG_POINTERS.iter() {
25-
if pointing_params.contains(&param_path) {
26-
private_values.insert(pointer_target_param_path.clone());
27-
included_as_a_pointer = true;
28-
}
29-
}
30-
if !included_as_a_pointer {
31-
private_values.insert(param_path);
32-
}
33-
}
34-
private_values
12+
SequencerNodeConfig::default()
13+
.dump()
14+
.into_iter()
15+
.filter(|(_param_path, ser_param)| ser_param.is_private())
16+
.map(|(param_path, _ser_param)| param_path)
17+
.collect()
3518
}
3619

3720
/// Updates the committed apollo node secrets schema (`CONFIG_SECRETS_SCHEMA_PATH`), which is the

crates/apollo_node_config/src/config_test.rs

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
use std::collections::BTreeSet;
2-
31
use apollo_config::behavior_mode::BehaviorMode;
4-
use apollo_config::dumping::SerializeConfig;
5-
use apollo_config::ParamPath;
62
use apollo_infra::component_client::RemoteClientConfig;
73
use apollo_infra::component_server::{LocalServerConfig, RemoteServerConfig};
84
use apollo_infra_utils::dumping::serialize_to_file_test;
@@ -23,7 +19,7 @@ use crate::component_execution_config::{
2319
};
2420
use crate::config_utils::{normalize_pointer_groups, private_parameters};
2521
use crate::monitoring::MonitoringConfig;
26-
use crate::node_config::{SequencerNodeConfig, CONFIG_POINTERS, CONFIG_SECRETS_SCHEMA_PATH};
22+
use crate::node_config::{SequencerNodeConfig, CONFIG_SECRETS_SCHEMA_PATH};
2723

2824
const FIX_BINARY_NAME: &str = "update_apollo_node_config_schema";
2925

@@ -82,58 +78,13 @@ fn valid_component_execution_config(
8278
assert_eq!(component_exe_config.validate(), Ok(()));
8379
}
8480

85-
/// Computes the private-parameter set the way it was historically derived: from the config dump
86-
/// (`SequencerNodeConfig::default().dump()`), filtering private params and remapping pointer
87-
/// members to their pointer target. This is the source of truth the committed secrets schema was
88-
/// generated from.
89-
///
90-
/// TRANSIENT: this mirrors the pre-Phase-4 body of `private_parameters()`. It exists only to guard
91-
/// that re-sourcing `private_parameters()` off the committed secrets schema did not drift from the
92-
/// config-derived set. Remove it together with the transient equivalence test.
93-
fn private_parameters_from_config_dump() -> BTreeSet<ParamPath> {
94-
let dumped_config = SequencerNodeConfig::default().dump();
95-
96-
let mut private_values = BTreeSet::new();
97-
for (param_path, ser_param) in dumped_config.into_iter() {
98-
if !ser_param.is_private() {
99-
continue;
100-
}
101-
let mut included_as_a_pointer = false;
102-
for ((pointer_target_param_path, _ser_param), pointing_params) in CONFIG_POINTERS.iter() {
103-
if pointing_params.contains(&param_path) {
104-
private_values.insert(pointer_target_param_path.clone());
105-
included_as_a_pointer = true;
106-
}
107-
}
108-
if !included_as_a_pointer {
109-
private_values.insert(param_path);
110-
}
111-
}
112-
private_values
113-
}
114-
11581
/// Test that the committed secrets schema file is up to date. To update it, run
11682
/// `cargo run --bin <FIX_BINARY_NAME>`.
11783
#[test]
11884
fn default_config_file_is_up_to_date() {
11985
serialize_to_file_test(&private_parameters(), CONFIG_SECRETS_SCHEMA_PATH, FIX_BINARY_NAME);
12086
}
12187

122-
/// TRANSIENT: proves that the file-sourced `private_parameters()` returns the same set as the
123-
/// historical config-dump-derived computation, guarding the Phase-4 re-source against drift. Remove
124-
/// this together with `private_parameters_from_config_dump` once the config-derivation path is
125-
/// gone.
126-
#[test]
127-
fn private_parameters_matches_config_dump_derivation() {
128-
let file_sourced: BTreeSet<ParamPath> = private_parameters();
129-
let config_derived = private_parameters_from_config_dump();
130-
assert_eq!(
131-
file_sourced, config_derived,
132-
"File-sourced private_parameters() drifted from the config-dump derivation. Regenerate \
133-
the secrets schema with `cargo run --bin {FIX_BINARY_NAME}`."
134-
);
135-
}
136-
13788
#[test]
13889
fn validate_config_success() {
13990
let config = SequencerNodeConfig::default();

crates/apollo_node_config/src/config_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ pub fn load_and_validate_config(
165165
Ok(loaded_config)
166166
}
167167

168-
/// Overwrites every present target of each multi-target `CONFIG_POINTERS` group with a single,
169-
/// consistent value, mirroring what pointer resolution does at load time. This lets a config
168+
/// Overwrites every present target of each multi-target pointer group with a single,
169+
/// consistent value, mirroring what pointer resolution did at load time. This lets a config
170170
/// assembled directly from `SequencerNodeConfig::default()` satisfy the cross-component equality
171171
/// invariant enforced by `validate_node_config`.
172172
#[cfg(any(feature = "testing", test))]

crates/apollo_node_config/src/node_config.rs

Lines changed: 9 additions & 192 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
1-
use std::collections::{BTreeMap, HashSet};
2-
use std::sync::LazyLock;
1+
use std::collections::BTreeMap;
32
use std::vec::Vec;
43

54
use apollo_batcher_config::config::{BatcherConfig, BatcherDynamicConfig};
65
use apollo_class_manager_config::config::{ClassManagerDynamicConfig, FsClassManagerConfig};
76
use apollo_committer_config::config::ApolloCommitterConfig;
8-
use apollo_config::behavior_mode::BehaviorMode;
97
use apollo_config::dumping::{
10-
generate_optional_struct_pointer,
11-
generate_struct_pointer,
128
prepend_sub_config_name,
139
ser_optional_sub_config,
1410
ser_param,
15-
ser_pointer_target_param,
16-
set_pointing_param_paths,
17-
ConfigPointers,
18-
Pointers,
1911
SerializeConfig,
2012
};
2113
use apollo_config::loading::load_and_process_config;
@@ -33,12 +25,9 @@ use apollo_mempool_config::config::{MempoolConfig, MempoolDynamicConfig};
3325
use apollo_mempool_p2p_config::config::MempoolP2pConfig;
3426
use apollo_monitoring_endpoint_config::config::MonitoringEndpointConfig;
3527
use apollo_proof_manager_config::config::ProofManagerConfig;
36-
use apollo_reverts::RevertConfig;
3728
use apollo_sierra_compilation_config::config::SierraCompilationConfig;
3829
use apollo_staking_config::config::StakingManagerDynamicConfig;
3930
use apollo_state_sync_config::config::{StateSyncConfig, StateSyncDynamicConfig};
40-
use blockifier::blockifier::config::NativeClassesWhitelist;
41-
use blockifier::blockifier_versioned_constants::VersionedConstantsOverrides;
4231
use clap::Command;
4332
use papyrus_base_layer::ethereum_base_layer_contract::EthereumBaseLayerConfig;
4433
use serde::{Deserialize, Serialize};
@@ -53,181 +42,10 @@ use crate::version::VERSION_FULL;
5342
// the crate.
5443
pub const CONFIG_SECRETS_SCHEMA_PATH: &str =
5544
"crates/apollo_node/resources/config_secrets_schema.json";
56-
pub const POINTER_TARGET_VALUE: &str = "PointerTarget";
5745

5846
// TODO(Tsabary): move metrics recorder to the node level, like tracing, instead of being
5947
// initialized as part of the endpoint.
6048

61-
// Configuration parameters that share the same value across multiple components.
62-
pub static CONFIG_POINTERS: LazyLock<ConfigPointers> = LazyLock::new(|| {
63-
let mut pointers = vec![
64-
(
65-
ser_pointer_target_param(
66-
"chain_id",
67-
&POINTER_TARGET_VALUE.to_string(),
68-
"The chain to follow. For more details see https://docs.starknet.io/learn/cheatsheets/transactions-reference#chain-id.",
69-
),
70-
set_pointing_param_paths(&[
71-
"batcher_config.static_config.block_builder_config.chain_info.chain_id",
72-
"batcher_config.static_config.storage.db_config.chain_id",
73-
"class_manager_config.static_config.class_storage_config.class_hash_storage_config.db_config.chain_id",
74-
"consensus_manager_config.consensus_manager_config.static_config.storage_config.db_config.chain_id",
75-
"consensus_manager_config.context_config.static_config.chain_id",
76-
"consensus_manager_config.network_config.chain_id",
77-
"gateway_config.static_config.chain_info.chain_id",
78-
"l1_events_scraper_config.chain_id",
79-
"l1_gas_price_scraper_config.chain_id",
80-
"mempool_p2p_config.network_config.chain_id",
81-
"state_sync_config.static_config.storage_config.db_config.chain_id",
82-
"state_sync_config.static_config.network_config.chain_id",
83-
"state_sync_config.static_config.rpc_config.chain_id",
84-
]),
85-
),
86-
(
87-
ser_pointer_target_param(
88-
"eth_fee_token_address",
89-
&POINTER_TARGET_VALUE.to_string(),
90-
"Address of the ETH fee token.",
91-
),
92-
set_pointing_param_paths(&[
93-
"batcher_config.static_config.block_builder_config.chain_info.fee_token_addresses.\
94-
eth_fee_token_address",
95-
"gateway_config.static_config.chain_info.fee_token_addresses.eth_fee_token_address",
96-
"state_sync_config.static_config.rpc_config.execution_config.eth_fee_contract_address",
97-
]),
98-
),
99-
(
100-
ser_pointer_target_param(
101-
"native_classes_whitelist",
102-
&"[]".to_string(),
103-
NativeClassesWhitelist::SER_PARAM_DESCRIPTION,
104-
),
105-
set_pointing_param_paths(&[
106-
"batcher_config.dynamic_config.native_classes_whitelist",
107-
"gateway_config.dynamic_config.native_classes_whitelist",
108-
]),
109-
),
110-
(
111-
ser_pointer_target_param(
112-
"starknet_url",
113-
&POINTER_TARGET_VALUE.to_string(),
114-
"URL for communicating with Starknet.",
115-
),
116-
set_pointing_param_paths(&[
117-
"state_sync_config.static_config.central_sync_client_config.central_source_config.starknet_url",
118-
"state_sync_config.static_config.rpc_config.starknet_url",
119-
]),
120-
),
121-
(
122-
ser_pointer_target_param(
123-
"strk_fee_token_address",
124-
&POINTER_TARGET_VALUE.to_string(),
125-
"Address of the STRK fee token.",
126-
),
127-
set_pointing_param_paths(&[
128-
"batcher_config.static_config.block_builder_config.chain_info.fee_token_addresses.\
129-
strk_fee_token_address",
130-
"gateway_config.static_config.chain_info.fee_token_addresses.strk_fee_token_address",
131-
"state_sync_config.static_config.rpc_config.execution_config.strk_fee_contract_address",
132-
]),
133-
),
134-
(
135-
ser_pointer_target_param(
136-
"validator_id",
137-
&POINTER_TARGET_VALUE.to_string(),
138-
"The ID of the validator. \
139-
Also the address of this validator as a starknet contract.",
140-
),
141-
set_pointing_param_paths(&["consensus_manager_config.consensus_manager_config.dynamic_config.validator_id"]),
142-
),
143-
(
144-
ser_pointer_target_param(
145-
"recorder_url",
146-
&POINTER_TARGET_VALUE.to_string(),
147-
"The URL of the Pythonic cende_recorder",
148-
),
149-
set_pointing_param_paths(&[
150-
"consensus_manager_config.cende_config.recorder_url",
151-
"batcher_config.static_config.pre_confirmed_cende_config.recorder_url",
152-
"mempool_config.static_config.recorder_url",
153-
]),
154-
),
155-
(
156-
ser_pointer_target_param(
157-
"validate_resource_bounds",
158-
&true,
159-
"Indicates that validations related to resource bounds are applied. \
160-
It should be set to false during a system bootstrap.",
161-
),
162-
set_pointing_param_paths(&[
163-
"gateway_config.static_config.stateful_tx_validator_config.validate_resource_bounds",
164-
"gateway_config.static_config.stateless_tx_validator_config.validate_resource_bounds",
165-
"mempool_config.static_config.validate_resource_bounds",
166-
]),
167-
),
168-
(
169-
ser_pointer_target_param(
170-
"max_cpu_time",
171-
&600u64,
172-
"Limitation of compilation cpu time (seconds).",
173-
),
174-
set_pointing_param_paths(&[
175-
"sierra_compiler_config.max_cpu_time",
176-
"batcher_config.static_config.contract_class_manager_config.native_compiler_config.\
177-
max_cpu_time",
178-
"gateway_config.static_config.contract_class_manager_config.native_compiler_config.\
179-
max_cpu_time",
180-
]),
181-
),
182-
];
183-
let mut common_execution_config = generate_optional_struct_pointer::<VersionedConstantsOverrides>(
184-
"versioned_constants_overrides".to_owned(),
185-
None,
186-
set_pointing_param_paths(&[
187-
"batcher_config.static_config.block_builder_config.versioned_constants_overrides",
188-
"gateway_config.static_config.stateful_tx_validator_config.\
189-
versioned_constants_overrides",
190-
]),
191-
);
192-
pointers.append(&mut common_execution_config);
193-
194-
let mut common_execution_config = generate_struct_pointer(
195-
"revert_config".to_owned(),
196-
&RevertConfig::default(),
197-
set_pointing_param_paths(&[
198-
"state_sync_config.static_config.revert_config",
199-
"consensus_manager_config.revert_config",
200-
]),
201-
);
202-
pointers.append(&mut common_execution_config);
203-
204-
pointers.push((
205-
ser_pointer_target_param(
206-
"behavior_mode",
207-
&BehaviorMode::Starknet,
208-
"Behavior mode: 'starknet' for production, 'echonet' for test/replay mode.",
209-
),
210-
set_pointing_param_paths(&[
211-
"consensus_manager_config.context_config.static_config.behavior_mode",
212-
"mempool_config.static_config.behavior_mode",
213-
]),
214-
));
215-
pointers.push((
216-
ser_pointer_target_param(
217-
"validation_only",
218-
&false,
219-
"If true, the node validates proposed blocks but does not build proposals. Requires \
220-
gateway, http_server, and mempool to be disabled.",
221-
),
222-
set_pointing_param_paths(&["batcher_config.static_config.validation_only"]),
223-
));
224-
pointers
225-
});
226-
227-
// Parameters that should 1) not be pointers, and 2) have a name matching a pointer target param.
228-
pub static CONFIG_NON_POINTERS_WHITELIST: LazyLock<Pointers> =
229-
LazyLock::new(HashSet::<ParamPath>::new);
230-
23149
/// The configurations of the various components of the node.
23250
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Validate)]
23351
pub struct SequencerNodeConfig {
@@ -610,19 +428,18 @@ impl SequencerNodeConfig {
610428

611429
/// Asserts that the formerly-pointer-resolved values are equal across all present components.
612430
///
613-
/// The `CONFIG_POINTERS` mechanism copies a single source value into many nested component
614-
/// fields at load time. Once those values are baked into the config (e.g. by jsonnet `build()`)
615-
/// nothing re-checks that the copies actually agree. These present-only equality asserts are a
431+
/// The pointer mechanism copied a single source value into many nested component fields at load
432+
/// time. Once those values are baked into the config (e.g. by jsonnet `build()`) nothing
433+
/// re-checks that the copies actually agree. These present-only equality asserts are a
616434
/// defense-in-depth guard for hand-edited, test, or otherwise non-jsonnet-generated configs:
617435
/// for each pointer group with more than one target, every present component must hold the same
618436
/// value. Components that are absent (`None`) are skipped, so partial/distributed deployments
619437
/// that own only a subset of a group still validate. Each group below mirrors one multi-target
620-
/// entry of `CONFIG_POINTERS`, plus `validation_only`: a single-target pointer whose target
621-
/// (the batcher's copy) is checked against the always-present top-level source field, since
622-
/// the node reads the two independently. Two single-target pointers are intentionally not
623-
/// checked here: `starknet_url` (its targets are typed `String` vs `Url` and cannot be
624-
/// compared directly) and `validator_id` (a lone target with no independent source to
625-
/// disagree with).
438+
/// pointer group, plus `validation_only`: a single-target pointer whose target (the batcher's
439+
/// copy) is checked against the always-present top-level source field, since the node reads the
440+
/// two independently. Two single-target pointers are intentionally not checked here:
441+
/// `starknet_url` (its targets are typed `String` vs `Url` and cannot be compared directly) and
442+
/// `validator_id` (a lone target with no independent source to disagree with).
626443
fn validate_pointer_groups_equal(&self) -> Result<(), ConfigError> {
627444
let batcher = self.batcher_config.as_ref();
628445
let class_manager = self.class_manager_config.as_ref();

0 commit comments

Comments
 (0)