Skip to content

Commit 397341d

Browse files
apollo_config,workspace: remove SerializeConfig trait and preset-dump machinery
Final teardown of the preset config path. The native loader is the sole load path, so the dump()/SerializeConfig apparatus has no remaining consumers. - Delete the SerializeConfig trait, dump()/dump_to_file(), combine_config_map_and_pointers, the ser_*/prepend_sub_config_name builders, and IS_NONE_MARK (apollo_config/src/dumping.rs deleted; lib.rs trimmed, keeping ParamPath/FIELD_SEPARATOR/SerializationType/ConfigError). - Delete all ~107 impl SerializeConfig blocks across ~50 crates. - Remove the SerializeConfig supertrait bound from StorageConfigTrait (trait kept) and the storage/committer config impls. - Delete config_to_preset/prune_by_is_none defs (config_utils.rs) and the orphaned inherent NativeClassesWhitelist::ser_param (blockifier). - Retire the update_apollo_node_config_schema bin: config_secrets_schema.json is now the hand-maintained source of truth (Option A). Replace the dump()-derived secrets guard with a type-based guard that serializes default() and asserts the Sensitive-redacted paths are a subset of the committed schema (documented gap: None-default secrets emit no sentinel). - config_secrets_schema.json is byte-unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent ec4e92b commit 397341d

58 files changed

Lines changed: 106 additions & 4298 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

crates/apollo_batcher_config/src/config.rs

Lines changed: 0 additions & 228 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
use std::collections::BTreeMap;
21
use std::time::Duration;
32

43
use apollo_config::converters::{
54
deserialize_milliseconds_to_duration,
65
serialize_duration_as_milliseconds,
76
};
8-
use apollo_config::dumping::{
9-
prepend_sub_config_name,
10-
ser_optional_sub_config,
11-
ser_param,
12-
SerializeConfig,
13-
};
14-
use apollo_config::{ParamPath, ParamPrivacyInput, SerializedParam};
157
use apollo_storage::db::DbConfig;
168
use apollo_storage::storage_reader_server::{
179
StorageReaderServerDynamicConfig,
@@ -43,19 +35,6 @@ pub struct BlockBuilderConfig {
4335
pub versioned_constants_overrides: Option<VersionedConstantsOverrides>,
4436
}
4537

46-
impl SerializeConfig for BlockBuilderConfig {
47-
fn dump(&self) -> BTreeMap<ParamPath, SerializedParam> {
48-
let mut dump = prepend_sub_config_name(self.chain_info.dump(), "chain_info");
49-
dump.append(&mut prepend_sub_config_name(self.execute_config.dump(), "execute_config"));
50-
dump.append(&mut prepend_sub_config_name(self.bouncer_config.dump(), "bouncer_config"));
51-
dump.append(&mut ser_optional_sub_config(
52-
&self.versioned_constants_overrides,
53-
"versioned_constants_overrides",
54-
));
55-
dump
56-
}
57-
}
58-
5938
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
6039
pub struct CommitmentManagerConfig {
6140
pub tasks_channel_size: usize,
@@ -73,32 +52,6 @@ impl Default for CommitmentManagerConfig {
7352
}
7453
}
7554

76-
impl SerializeConfig for CommitmentManagerConfig {
77-
fn dump(&self) -> BTreeMap<ParamPath, SerializedParam> {
78-
BTreeMap::from([
79-
ser_param(
80-
"tasks_channel_size",
81-
&self.tasks_channel_size,
82-
"The size of the channel for sending tasks to the commitment manager.",
83-
ParamPrivacyInput::Public,
84-
),
85-
ser_param(
86-
"results_channel_size",
87-
&self.results_channel_size,
88-
"The size of the channel for receiving results from the commitment manager.",
89-
ParamPrivacyInput::Public,
90-
),
91-
ser_param(
92-
"panic_if_task_channel_full",
93-
&self.panic_if_task_channel_full,
94-
"If the task channel is full: if true, will panic. If false, will wait for the \
95-
tasks channel to be available.",
96-
ParamPrivacyInput::Public,
97-
),
98-
])
99-
}
100-
}
101-
10255
/// Configuration for the preconfirmed block writer component of the batcher.
10356
#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq)]
10457
pub struct PreconfirmedBlockWriterConfig {
@@ -112,26 +65,6 @@ impl Default for PreconfirmedBlockWriterConfig {
11265
}
11366
}
11467

115-
impl SerializeConfig for PreconfirmedBlockWriterConfig {
116-
fn dump(&self) -> BTreeMap<ParamPath, SerializedParam> {
117-
BTreeMap::from_iter([
118-
ser_param(
119-
"channel_buffer_capacity",
120-
&self.channel_buffer_capacity,
121-
"The capacity of the channel buffer for receiving pre-confirmed transactions.",
122-
ParamPrivacyInput::Public,
123-
),
124-
ser_param(
125-
"write_block_interval_millis",
126-
&self.write_block_interval_millis,
127-
"Time interval (ms) between writing pre-confirmed blocks. Writes occur only when \
128-
block data changes.",
129-
ParamPrivacyInput::Public,
130-
),
131-
])
132-
}
133-
}
134-
13568
/// Configuration for the preconfirmed Cende client component of the batcher.
13669
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
13770
pub struct PreconfirmedCendeConfig {
@@ -148,50 +81,13 @@ impl Default for PreconfirmedCendeConfig {
14881
}
14982
}
15083

151-
impl SerializeConfig for PreconfirmedCendeConfig {
152-
fn dump(&self) -> BTreeMap<ParamPath, SerializedParam> {
153-
BTreeMap::from([ser_param(
154-
"recorder_url",
155-
&self.recorder_url,
156-
"The URL of the Pythonic cende_recorder",
157-
ParamPrivacyInput::Public,
158-
)])
159-
}
160-
}
161-
16284
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Default)]
16385
pub struct FirstBlockWithPartialBlockHash {
16486
pub block_number: BlockNumber,
16587
pub block_hash: BlockHash,
16688
pub parent_block_hash: BlockHash,
16789
}
16890

169-
impl SerializeConfig for FirstBlockWithPartialBlockHash {
170-
fn dump(&self) -> BTreeMap<ParamPath, SerializedParam> {
171-
BTreeMap::from([
172-
ser_param(
173-
"block_number",
174-
&self.block_number,
175-
"The number of the first block with a partial block hash components.",
176-
ParamPrivacyInput::Public,
177-
),
178-
ser_param(
179-
"block_hash",
180-
&self.block_hash,
181-
"The hash of the first block with a partial block hash components.",
182-
ParamPrivacyInput::Public,
183-
),
184-
ser_param(
185-
"parent_block_hash",
186-
&self.parent_block_hash,
187-
"The hash of the parent block of the first block with a partial block hash \
188-
components.",
189-
ParamPrivacyInput::Public,
190-
),
191-
])
192-
}
193-
}
194-
19591
#[derive(Clone, Debug, Serialize, Deserialize, Validate, PartialEq)]
19692
pub struct BatcherStaticConfig {
19793
#[validate(nested)]
@@ -214,76 +110,6 @@ pub struct BatcherStaticConfig {
214110
pub validation_only: bool,
215111
}
216112

217-
impl SerializeConfig for BatcherStaticConfig {
218-
fn dump(&self) -> BTreeMap<ParamPath, SerializedParam> {
219-
// TODO(yair): create nicer function to append sub configs.
220-
let mut dump = BTreeMap::from([
221-
ser_param(
222-
"outstream_content_buffer_size",
223-
&self.outstream_content_buffer_size,
224-
"The maximum number of items to include in a single get_proposal_content response.",
225-
ParamPrivacyInput::Public,
226-
),
227-
ser_param(
228-
"input_stream_content_buffer_size",
229-
&self.input_stream_content_buffer_size,
230-
"Sets the buffer size for the input transaction channel. Adding more transactions \
231-
beyond this limit will block until space is available.",
232-
ParamPrivacyInput::Public,
233-
),
234-
ser_param(
235-
"max_l1_handler_txs_per_block_proposal",
236-
&self.max_l1_handler_txs_per_block_proposal,
237-
"The maximum number of L1 handler transactions to include in a block proposal.",
238-
ParamPrivacyInput::Public,
239-
),
240-
ser_param(
241-
"propose_l1_txs_every",
242-
&self.propose_l1_txs_every,
243-
"Only propose L1 transactions every N proposals.",
244-
ParamPrivacyInput::Public,
245-
),
246-
]);
247-
dump.append(&mut prepend_sub_config_name(self.storage.dump(), "storage"));
248-
dump.append(&mut prepend_sub_config_name(
249-
self.block_builder_config.dump(),
250-
"block_builder_config",
251-
));
252-
dump.append(&mut prepend_sub_config_name(
253-
self.pre_confirmed_block_writer_config.dump(),
254-
"pre_confirmed_block_writer_config",
255-
));
256-
dump.append(&mut prepend_sub_config_name(
257-
self.contract_class_manager_config.dump(),
258-
"contract_class_manager_config",
259-
));
260-
dump.append(&mut prepend_sub_config_name(
261-
self.commitment_manager_config.dump(),
262-
"commitment_manager_config",
263-
));
264-
dump.append(&mut prepend_sub_config_name(
265-
self.pre_confirmed_cende_config.dump(),
266-
"pre_confirmed_cende_config",
267-
));
268-
dump.extend(ser_optional_sub_config(
269-
&self.first_block_with_partial_block_hash,
270-
"first_block_with_partial_block_hash",
271-
));
272-
dump.append(&mut prepend_sub_config_name(
273-
self.storage_reader_server_static_config.dump(),
274-
"storage_reader_server_static_config",
275-
));
276-
dump.append(&mut BTreeMap::from([ser_param(
277-
"validation_only",
278-
&self.validation_only,
279-
"If true, the batcher only validates proposed blocks and cannot build proposals. Set \
280-
via the node-level validation_only config pointer.",
281-
ParamPrivacyInput::Public,
282-
)]));
283-
dump
284-
}
285-
}
286-
287113
impl Default for BatcherStaticConfig {
288114
fn default() -> Self {
289115
Self {
@@ -354,51 +180,6 @@ impl Default for BatcherDynamicConfig {
354180
}
355181
}
356182

357-
impl SerializeConfig for BatcherDynamicConfig {
358-
fn dump(&self) -> BTreeMap<ParamPath, SerializedParam> {
359-
let mut dump = BTreeMap::from([
360-
self.native_classes_whitelist.ser_param(),
361-
ser_param(
362-
"n_concurrent_txs",
363-
&self.n_concurrent_txs,
364-
"Number of transactions in each request from the tx_provider.",
365-
ParamPrivacyInput::Public,
366-
),
367-
ser_param(
368-
"tx_polling_interval_millis",
369-
&self.tx_polling_interval_millis,
370-
"Time to wait (in milliseconds) between transaction requests when the previous \
371-
request returned no transactions. Applies when proposing (polls the mempool). \
372-
Kept intentionally high so txs accumulate between polls and ordering is decided \
373-
by tip/priority fee rather than by arrival latency (geographic proximity).",
374-
ParamPrivacyInput::Public,
375-
),
376-
ser_param(
377-
"validate_tx_polling_interval_millis",
378-
&self.validate_tx_polling_interval_millis,
379-
"Time to wait (in milliseconds) between transaction requests when the previous \
380-
request returned no transactions. Applies when validating a proposal, where the \
381-
tx order is already fixed; a short interval reduces the delay before streamed \
382-
txs are executed.",
383-
ParamPrivacyInput::Public,
384-
),
385-
ser_param(
386-
"proposer_idle_detection_delay_millis",
387-
&self.proposer_idle_detection_delay_millis.as_millis(),
388-
"Minimum time (in milliseconds) that must pass since block creation started \
389-
before checking for idle state. If this delay has passed AND no transactions are \
390-
currently being executed, the proposer will finish building the current block.",
391-
ParamPrivacyInput::Public,
392-
),
393-
]);
394-
dump.append(&mut prepend_sub_config_name(
395-
self.storage_reader_server_dynamic_config.dump(),
396-
"storage_reader_server_dynamic_config",
397-
));
398-
dump
399-
}
400-
}
401-
402183
/// The batcher related configuration.
403184
#[derive(Clone, Debug, Default, Serialize, Deserialize, Validate, PartialEq)]
404185
#[validate(schema(function = "validate_batcher_config"))]
@@ -409,15 +190,6 @@ pub struct BatcherConfig {
409190
pub dynamic_config: BatcherDynamicConfig,
410191
}
411192

412-
impl SerializeConfig for BatcherConfig {
413-
fn dump(&self) -> BTreeMap<ParamPath, SerializedParam> {
414-
let mut config = BTreeMap::new();
415-
config.extend(prepend_sub_config_name(self.static_config.dump(), "static_config"));
416-
config.extend(prepend_sub_config_name(self.dynamic_config.dump(), "dynamic_config"));
417-
config
418-
}
419-
}
420-
421193
fn validate_batcher_dynamic_config(
422194
dynamic_config: &BatcherDynamicConfig,
423195
) -> Result<(), ValidationError> {

0 commit comments

Comments
 (0)