Skip to content

apollo_central_sync,apollo_starknet_client: collapse three feeder calls into one per block#14186

Open
dafnamatsry wants to merge 1 commit into
mainfrom
dafna/merge_block_state_update_feeder_calls
Open

apollo_central_sync,apollo_starknet_client: collapse three feeder calls into one per block#14186
dafnamatsry wants to merge 1 commit into
mainfrom
dafna/merge_block_state_update_feeder_calls

Conversation

@dafnamatsry
Copy link
Copy Markdown
Collaborator

No description provided.

@cursor
Copy link
Copy Markdown

cursor Bot commented May 25, 2026

PR Summary

High Risk
Changes the core central-sync download and storage path; incorrect handling could break block ingestion or marker consistency despite the intentional atomic commit fix.

Overview
Central sync now fetches each block with one feeder get_state_update call (includeBlock=true, includeSignature=true) instead of separate block, signature, and state-update requests. The central source exposes a unified CentralStateUpdate stream via stream_new_blocks; stream_state_updates and the old parallel block/signature download path are removed.

The sync loop merges the former block and state-diff pipelines into a single StateUpdateAvailable event handled by store_state_update. Persistence uses one read-write transaction for header, signature, body, and state diff (plus related class-manager updates), so header_marker and state_marker advance together and avoid a recoverable failure leaving mismatched markers.

apollo_starknet_client adds BlockStateUpdate and StarknetReader::block_state_update_and_signature; StateUpdateStream schedules that call and maps the response into API types. Tests and mocks are updated accordingly.

Reviewed by Cursor Bugbot for commit 45aea34. Bugbot is set up for automated code reviews on this repo. Configure here.

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

Copy link
Copy Markdown
Collaborator Author

dafnamatsry commented May 25, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

Comment thread crates/apollo_central_sync/src/lib.rs
@dafnamatsry dafnamatsry force-pushed the dafna/merge_block_state_update_feeder_calls branch 3 times, most recently from a60cbb8 to b63e826 Compare May 26, 2026 09:46
@dafnamatsry dafnamatsry force-pushed the dafna/merge_block_state_update_feeder_calls branch from b63e826 to 45aea34 Compare May 26, 2026 10:34
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.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 45aea34. Configure here.

&mut self,
block_number: BlockNumber,
block_hash: BlockHash,
mut state_diff: StateDiff,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale marker read causes incorrect backward-compatibility classification

Medium Severity

The compiler_backward_compatibility_marker is read at line 435 (before the storage transaction), but is updated at line 495 (inside the transaction). In the old code, the header stream always ran ahead of the state diff stream, so the marker was already updated when store_state_diff read it. Now that both are combined, for a block N with old starknet version where the marker equals N, the check compiler_backward_compatibility_marker <= block_number is incorrectly TRUE, causing the block to be treated as backwards-compatible when it isn't. The stale comment at line 426–428 ("this stream is behind the header stream") confirms this ordering assumption was not updated.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 45aea34. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants