Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions config/papyrus/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
36 changes: 10 additions & 26 deletions crates/apollo_central_sync/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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::<Vec<_>>()
);
txn = txn.append_classes(
Expand All @@ -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::<Vec<_>>()
);
}
Expand Down Expand Up @@ -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()?;
Expand Down Expand Up @@ -937,7 +925,6 @@ fn stream_new_compiled_classes<TCentralSource: CentralSourceTrait + Sync + Send>
central_source: Arc<TCentralSource>,
block_propagation_sleep_duration: Duration,
max_stream_size: u32,
store_sierras_and_casms: bool,
) -> impl Stream<Item = Result<SyncEvent, StateSyncError>> {
try_stream! {
loop {
Expand Down Expand Up @@ -973,12 +960,10 @@ fn stream_new_compiled_classes<TCentralSource: CentralSourceTrait + Sync + Send>
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;
}
Expand Down Expand Up @@ -1039,7 +1024,6 @@ fn stream_new_base_layer_block<TBaseLayerSource: BaseLayerSourceTrait + Sync>(
// TODO(dvir): add a test for this scenario.
fn check_sync_progress(
reader: StorageReader,
store_sierras_and_casms: bool,
) -> impl Stream<Item = Result<SyncEvent, StateSyncError>> {
try_stream! {
let (mut header_marker, mut state_marker, mut casm_marker) = {
Expand All @@ -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}.");
Expand Down
2 changes: 0 additions & 2 deletions crates/apollo_central_sync/src/sources/central_sync_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down
12 changes: 0 additions & 12 deletions crates/apollo_central_sync_config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
),
])
}
}
Expand All @@ -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,
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion crates/papyrus_node/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading