Skip to content

apollo_central_sync: sending non-bc casms to class manager gets them from state update stream#12704

Open
ShahakShama wants to merge 1 commit intonoam.s/apollo_central_sync_get_non_bc_casms_in_stream_new_state_diffsfrom
shahak/sync_gets_non_bc_casms_from_state_stream
Open

apollo_central_sync: sending non-bc casms to class manager gets them from state update stream#12704
ShahakShama wants to merge 1 commit intonoam.s/apollo_central_sync_get_non_bc_casms_in_stream_new_state_diffsfrom
shahak/sync_gets_non_bc_casms_from_state_stream

Conversation

@ShahakShama
Copy link
Copy Markdown
Collaborator

@ShahakShama ShahakShama commented Feb 18, 2026

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_0 blocks.

Overview
State sync no longer runs a separate stream_new_compiled_classes loop or processes CompiledClassAvailable events; compiled-class storage/backfill logic tied to store_sierras_and_casms_block_threshold is removed from the main sync path.

For blocks with starknet_version < STARKNET_VERSION_TO_COMPILE_FROM, the state update stream now fetches CASMs via CentralSourceTrait::get_compiled_class and passes them alongside the state diff, so store_state_diff can send non-BC classes to the class manager using add_class_and_executable_unsafe while continuing to use add_class for 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.

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

Copy link
Copy Markdown
Collaborator Author

ShahakShama commented Feb 18, 2026

Comment thread crates/apollo_rpc/src/syncing_state.rs Outdated
@ShahakShama ShahakShama force-pushed the shahak/central_state_stream_has_non_bc_casms branch from 774f352 to fa79fa7 Compare February 18, 2026 13:41
@ShahakShama ShahakShama force-pushed the shahak/sync_gets_non_bc_casms_from_state_stream branch from d2e693b to 094110f Compare February 18, 2026 13:41
Copy link
Copy Markdown
Collaborator Author

@ShahakShama ShahakShama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ShahakShama resolved 1 discussion.
Reviewable status: 0 of 5 files reviewed, all discussions resolved.

@ShahakShama ShahakShama force-pushed the shahak/sync_gets_non_bc_casms_from_state_stream branch from 094110f to fa05363 Compare February 18, 2026 14:48
@ShahakShama ShahakShama force-pushed the shahak/central_state_stream_has_non_bc_casms branch from fa79fa7 to 91e7d1e Compare February 18, 2026 14:48
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Comment thread crates/apollo_central_sync/src/sources/central_sync_test.rs Outdated
@ShahakShama ShahakShama force-pushed the shahak/sync_gets_non_bc_casms_from_state_stream branch from fa05363 to e897c62 Compare February 19, 2026 09:59
@ShahakShama ShahakShama force-pushed the shahak/central_state_stream_has_non_bc_casms branch from 91e7d1e to 0fffb5d Compare February 19, 2026 09:59
Copy link
Copy Markdown
Contributor

@noamsp-starkware noamsp-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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?

@noamsp-starkware noamsp-starkware changed the base branch from shahak/central_state_stream_has_non_bc_casms to graphite-base/12704 February 23, 2026 11:12
@noamsp-starkware noamsp-starkware force-pushed the shahak/sync_gets_non_bc_casms_from_state_stream branch from e897c62 to 891a99c Compare February 23, 2026 11:12
Copy link
Copy Markdown
Collaborator Author

@ShahakShama ShahakShama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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)

Copy link
Copy Markdown
Contributor

@noamsp-starkware noamsp-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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 continue above this and removing else

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.

@noamsp-starkware noamsp-starkware force-pushed the shahak/sync_gets_non_bc_casms_from_state_stream branch from 891a99c to f36cbae Compare March 12, 2026 13:33
@noamsp-starkware noamsp-starkware changed the base branch from graphite-base/12704 to noam.s/apollo_central_sync_get_non_bc_casms_in_stream_new_state_diffs March 12, 2026 13:33
Copy link
Copy Markdown
Collaborator Author

@ShahakShama ShahakShama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

@github-actions
Copy link
Copy Markdown

There hasn't been any activity on this pull request recently, and in order to prioritize active work, it has been marked as stale.
This PR will be closed and locked in 7 days if no further activity occurs.
Thank you for your contributions!

@github-actions github-actions Bot added the stale label Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants