apollo_central_sync: sending non-bc casms to class manager gets them from state update stream#12704
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
774f352 to
fa79fa7
Compare
d2e693b to
094110f
Compare
ShahakShama
left a comment
There was a problem hiding this comment.
@ShahakShama resolved 1 discussion.
Reviewable status: 0 of 5 files reviewed, all discussions resolved.
094110f to
fa05363
Compare
fa79fa7 to
91e7d1e
Compare
fa05363 to
e897c62
Compare
91e7d1e to
0fffb5d
Compare
noamsp-starkware
left a comment
There was a problem hiding this comment.
@noamsp-starkware reviewed 5 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on ShahakShama).
crates/apollo_rpc/src/syncing_state.rs line 52 at r3 (raw file):
) -> StorageResult<BlockHashAndNumber> { let txn = storage_reader.begin_ro_txn()?; // TODO(shahak): This marker is no longer advanced. Use the real marker.
Does keeping this (even temporarily) break anything?
e897c62 to
891a99c
Compare
0fffb5d to
0133a72
Compare
ShahakShama
left a comment
There was a problem hiding this comment.
@ShahakShama made 5 comments.
Reviewable status: 2 of 5 files reviewed, 5 unresolved discussions (waiting on noamsp-starkware).
crates/apollo_rpc/src/syncing_state.rs line 52 at r3 (raw file):
Previously, noamsp-starkware wrote…
Does keeping this (even temporarily) break anything?
Yes. No one uses this endpoint
crates/apollo_central_sync/src/lib.rs line 451 at r4 (raw file):
for (expected_class_hash, class) in &classes { if let Some(casm) = non_backward_compatible_casms.get(expected_class_hash) { let compiled_class_hash_v2 = casm.hash(&HashVersion::V2);
Add some log here
crates/apollo_central_sync/src/lib.rs line 464 at r4 (raw file):
) .await?; } else {
Consider adding continue above this and removing else
crates/apollo_central_sync/src/sources/central_sync_test.rs line 229 at r4 (raw file):
})) }); // Block 0 is non-BC (starknet_version < V0_12_0) to exercise get_compiled_class +
I don't understand what does exercise mean in this context
crates/apollo_central_sync/src/sources/central_sync_test.rs line 240 at r4 (raw file):
StarknetVersion::V0_11_0 } else { StarknetVersion::default()
Use an explicit version. Specifically, the constant the source code uses (first version something)
…from state update stream
noamsp-starkware
left a comment
There was a problem hiding this comment.
@noamsp-starkware made 5 comments and resolved 3 discussions.
Reviewable status: 2 of 5 files reviewed, 2 unresolved discussions (waiting on ShahakShama).
crates/apollo_central_sync/src/lib.rs line 451 at r4 (raw file):
Previously, ShahakShama wrote…
Add some log here
Done.
crates/apollo_central_sync/src/lib.rs line 464 at r4 (raw file):
Previously, ShahakShama wrote…
Consider adding
continueabove this and removingelse
Done.
crates/apollo_central_sync/src/sources/central_sync_test.rs line 229 at r4 (raw file):
Previously, ShahakShama wrote…
I don't understand what does exercise mean in this context
fixed.
crates/apollo_central_sync/src/sources/central_sync_test.rs line 240 at r4 (raw file):
Previously, ShahakShama wrote…
Use an explicit version. Specifically, the constant the source code uses (first version something)
Done.
crates/apollo_rpc/src/syncing_state.rs line 52 at r3 (raw file):
Previously, ShahakShama wrote…
Yes. No one uses this endpoint
switched to state marker.
891a99c to
f36cbae
Compare
0133a72 to
5cbd6a2
Compare
ShahakShama
left a comment
There was a problem hiding this comment.
@ShahakShama made 2 comments and resolved 1 discussion.
Reviewable status: 1 of 5 files reviewed, 2 unresolved discussions (waiting on noamsp-starkware).
crates/apollo_rpc/src/syncing_state.rs line 52 at r3 (raw file):
Previously, noamsp-starkware wrote…
switched to state marker.
I meant no when I wrote yes 😅
Anyway, sure
but you should use the class manager marker instead
crates/apollo_central_sync/src/lib.rs line 451 at r5 (raw file):
for (expected_class_hash, class) in &classes { if let Some(casm) = non_backward_compatible_casms.get(expected_class_hash) { trace!(
debug
|
There hasn't been any activity on this pull request recently, and in order to prioritize active work, it has been marked as stale. |

Note
Medium Risk
Changes the core sync event flow and when/how compiled classes are fetched and sent to the class manager, which could affect historical sync correctness and performance for pre-
V0_12_0blocks.Overview
State sync no longer runs a separate
stream_new_compiled_classesloop or processesCompiledClassAvailableevents; compiled-class storage/backfill logic tied tostore_sierras_and_casms_block_thresholdis removed from the main sync path.For blocks with
starknet_version < STARKNET_VERSION_TO_COMPILE_FROM, the state update stream now fetches CASMs viaCentralSourceTrait::get_compiled_classand passes them alongside the state diff, sostore_state_diffcan send non-BC classes to the class manager usingadd_class_and_executable_unsafewhile continuing to useadd_classfor backward-compatible blocks.Progress checking and RPC syncing status are simplified to use the state marker (
get_state_marker) rather than the compiled-class marker, and tests are updated to reflect the new non-BC CASM fetch/send behavior.Written by Cursor Bugbot for commit f36cbae. This will update automatically on new commits. Configure here.