From c2dcbe3aa8e8f7ebf9553f927733181d2cf13b97 Mon Sep 17 00:00:00 2001 From: Shahak Shama Date: Sun, 5 Oct 2025 17:02:57 +0300 Subject: [PATCH] apollo_central_sync: remove store_sierras_and_casms config --- config/papyrus/default_config.json | 5 --- crates/apollo_central_sync/src/lib.rs | 36 ++++++------------- .../src/sources/central_sync_test.rs | 2 -- .../apollo_central_sync_config/src/config.rs | 12 ------- .../app_configs/state_sync_config.json | 1 - crates/papyrus_node/src/config/mod.rs | 2 +- 6 files changed, 11 insertions(+), 47 deletions(-) diff --git a/config/papyrus/default_config.json b/config/papyrus/default_config.json index d0d8d93d32e..cd6a4cee121 100644 --- a/config/papyrus/default_config.json +++ b/config/papyrus/default_config.json @@ -529,11 +529,6 @@ "privacy": "Public", "value": 1000 }, - "sync.store_sierras_and_casms": { - "description": "Whether to persist **Sierra** and **CASM** artifacts to the local storage. This is needed for backward compatibility with the native blockifier. Behavior: \n`true`: Persist Sierra and CASM for all classes.\n`false`: Persist only for **legacy** classes (compiled with a version < `STARKNET_VERSION_TO_COMPILE_FROM`). Newer classes are not persisted.", - "privacy": "Public", - "value": true - }, "sync.verify_blocks": { "description": "Whether to verify incoming blocks.", "privacy": "Public", diff --git a/crates/apollo_central_sync/src/lib.rs b/crates/apollo_central_sync/src/lib.rs index f140ed7faac..10253fee663 100644 --- a/crates/apollo_central_sync/src/lib.rs +++ b/crates/apollo_central_sync/src/lib.rs @@ -287,7 +287,6 @@ impl< self.config.block_propagation_sleep_duration, // TODO(yair): separate config param. self.config.state_updates_max_stream_size, - self.config.store_sierras_and_casms, ) .fuse(); let base_layer_block_stream = match &self.base_layer_source { @@ -302,8 +301,7 @@ impl< }; // TODO(dvir): try use interval instead of stream. // TODO(DvirYo): fix the bug and remove this check. - let check_sync_progress = - check_sync_progress(self.reader.clone(), self.config.store_sierras_and_casms).fuse(); + let check_sync_progress = check_sync_progress(self.reader.clone()).fuse(); pin_mut!( block_stream, state_diff_stream, @@ -513,7 +511,6 @@ impl< } } let has_class_manager = self.class_manager_client.is_some(); - let store_sierras_and_casms = self.config.store_sierras_and_casms; self.perform_storage_writes(move |writer| { if has_class_manager { writer @@ -527,16 +524,10 @@ impl< // Non backwards compatible classes must be stored for later use since we will only be // be adding them to the class manager later, once we have their compiled // classes. - // - // TODO(guy.f): Properly fix handling non backwards compatible classes. - if store_sierras_and_casms || block_contains_non_backwards_compatible_classes { - let store_reason = if store_sierras_and_casms { - "store_sierras_and_casms is true" - } else { - "block_contains_non_backwards_compatible_classes is true" - }; + if block_contains_non_backwards_compatible_classes { debug!( - "Appending classes {:?} to storage since {store_reason}", + "Appending classes {:?} to storage since it contains classes that are not \ + backwards compatible with the compiler", classes.keys().collect::>() ); txn = txn.append_classes( @@ -552,8 +543,8 @@ impl< )?; } else { trace!( - "Skipping appending classes {:?} to storage since store_sierras_and_casms is \ - false and block_contains_non_backwards_compatible_classes is false", + "Skipping appending classes {:?} to storage since its classes are backward \ + compatible with the compiler", classes.keys().collect::>() ); } @@ -602,9 +593,6 @@ impl< .expect("Failed adding class and compiled class to class manager."); } } - if !self.config.store_sierras_and_casms { - return Ok(()); - } let result = self .perform_storage_writes(move |writer| { writer.begin_rw_txn()?.append_casm(&class_hash, &compiled_class)?.commit()?; @@ -937,7 +925,6 @@ fn stream_new_compiled_classes central_source: Arc, block_propagation_sleep_duration: Duration, max_stream_size: u32, - store_sierras_and_casms: bool, ) -> impl Stream> { try_stream! { loop { @@ -973,12 +960,10 @@ fn stream_new_compiled_classes up_to = compiler_backward_compatibility_marker; } - // No point in downloading casms if we don't store them and don't send them to the - // class manager - if are_casms_backward_compatible && !store_sierras_and_casms { + // No point in downloading casms if we don't send them to the class manager + if are_casms_backward_compatible { info!("Compiled classes stream reached a block that has backward compatibility for \ - the compiler, and store_sierras_and_casms is set to false. \ - Finishing the compiled class stream"); + the compiler. Finishing the compiled class stream"); pending::<()>().await; continue; } @@ -1039,7 +1024,6 @@ fn stream_new_base_layer_block( // TODO(dvir): add a test for this scenario. fn check_sync_progress( reader: StorageReader, - store_sierras_and_casms: bool, ) -> impl Stream> { try_stream! { let (mut header_marker, mut state_marker, mut casm_marker) = { @@ -1061,7 +1045,7 @@ fn check_sync_progress( let compiler_backward_compatibility_marker = txn.get_compiler_backward_compatibility_marker()?; (new_header_marker, new_state_marker, new_casm_marker, compiler_backward_compatibility_marker) }; - let is_casm_stuck = casm_marker == new_casm_marker && (new_casm_marker < compiler_backward_compatibility_marker || store_sierras_and_casms); + let is_casm_stuck = casm_marker == new_casm_marker && new_casm_marker < compiler_backward_compatibility_marker; if header_marker==new_header_marker || state_marker==new_state_marker || is_casm_stuck { debug!("No progress in the sync. Return NoProgress event. Header marker: {header_marker}, \ State marker: {state_marker}, Casm marker: {casm_marker}."); diff --git a/crates/apollo_central_sync/src/sources/central_sync_test.rs b/crates/apollo_central_sync/src/sources/central_sync_test.rs index 91f7ae7a281..4ae42caa9b2 100644 --- a/crates/apollo_central_sync/src/sources/central_sync_test.rs +++ b/crates/apollo_central_sync/src/sources/central_sync_test.rs @@ -107,8 +107,6 @@ fn get_test_sync_config(verify_blocks: bool) -> SyncConfig { state_updates_max_stream_size: STREAM_SIZE, verify_blocks, collect_pending_data: false, - // TODO(Shahak): Add test where store_sierras_and_casms is set to false. - store_sierras_and_casms: true, } } diff --git a/crates/apollo_central_sync_config/src/config.rs b/crates/apollo_central_sync_config/src/config.rs index 5c0904f25e1..64584b5b5ad 100644 --- a/crates/apollo_central_sync_config/src/config.rs +++ b/crates/apollo_central_sync_config/src/config.rs @@ -112,7 +112,6 @@ pub struct SyncConfig { pub state_updates_max_stream_size: u32, pub verify_blocks: bool, pub collect_pending_data: bool, - pub store_sierras_and_casms: bool, } impl SerializeConfig for SyncConfig { @@ -161,16 +160,6 @@ impl SerializeConfig for SyncConfig { "Whether to collect data on pending blocks.", ParamPrivacyInput::Public, ), - ser_param( - "store_sierras_and_casms", - &self.store_sierras_and_casms, - "Whether to persist **Sierra** and **CASM** artifacts to the local storage. This \ - is needed for backward compatibility with the native blockifier. Behavior: \ - \n`true`: Persist Sierra and CASM for all classes.\n`false`: Persist only for \ - **legacy** classes (compiled with a version < \ - `STARKNET_VERSION_TO_COMPILE_FROM`). Newer classes are not persisted.", - ParamPrivacyInput::Public, - ), ]) } } @@ -185,7 +174,6 @@ impl Default for SyncConfig { state_updates_max_stream_size: 1000, verify_blocks: true, collect_pending_data: false, - store_sierras_and_casms: false, } } } diff --git a/crates/apollo_deployments/resources/app_configs/state_sync_config.json b/crates/apollo_deployments/resources/app_configs/state_sync_config.json index 30aeb1992e2..6682983b061 100644 --- a/crates/apollo_deployments/resources/app_configs/state_sync_config.json +++ b/crates/apollo_deployments/resources/app_configs/state_sync_config.json @@ -13,7 +13,6 @@ "state_sync_config.central_sync_client_config.sync_config.collect_pending_data": false, "state_sync_config.central_sync_client_config.sync_config.recoverable_error_sleep_duration": 3, "state_sync_config.central_sync_client_config.sync_config.state_updates_max_stream_size": 1000, - "state_sync_config.central_sync_client_config.sync_config.store_sierras_and_casms": false, "state_sync_config.central_sync_client_config.sync_config.verify_blocks": false, "state_sync_config.network_config.advertised_multiaddr": "", "state_sync_config.network_config.advertised_multiaddr.#is_none": true, diff --git a/crates/papyrus_node/src/config/mod.rs b/crates/papyrus_node/src/config/mod.rs index 71c1d042c69..015e07f2af4 100644 --- a/crates/papyrus_node/src/config/mod.rs +++ b/crates/papyrus_node/src/config/mod.rs @@ -84,7 +84,7 @@ impl Default for NodeConfig { rpc: RpcConfig::default(), monitoring_gateway: MonitoringGatewayConfig::default(), storage: StorageConfig::default(), - sync: Some(SyncConfig { store_sierras_and_casms: true, ..Default::default() }), + sync: Some(SyncConfig::default()), p2p_sync: None, consensus: None, context: None,