Skip to content

starknet_patricia_storage: define gatherable storage trait#13630

Open
nimrod-starkware wants to merge 1 commit intonimrod/parallel-reads/storage-task-traitfrom
nimrod/parallel-reads/gatherable-storage
Open

starknet_patricia_storage: define gatherable storage trait#13630
nimrod-starkware wants to merge 1 commit intonimrod/parallel-reads/storage-task-traitfrom
nimrod/parallel-reads/gatherable-storage

Conversation

@nimrod-starkware
Copy link
Copy Markdown
Contributor

@nimrod-starkware nimrod-starkware commented Mar 31, 2026

Note

Low Risk
Introduces new async/concurrency helper APIs but does not change existing storage read/write semantics unless adopted by callers; main risk is subtle ordering/merge assumptions when tasks are later used.

Overview
Adds a new GatherableStorage extension trait plus a run_tasks_and_collect_reads helper to run multiple StorageTasks concurrently, giving each task its own ReadsCollectorStorage and merging the collected reads.

Updates starknet_patricia_storage dependencies to include futures (used for FuturesUnordered) to drive the concurrent execution.

Written by Cursor Bugbot for commit 7ce467f. This will update automatically on new commits. Configure here.

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

Copy link
Copy Markdown
Contributor Author

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.
Learn more

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

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.

while let Some((reads, output)) = futures.next().await {
collected_reads.extend(reads);
outputs.push(output);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

FuturesUnordered returns outputs in non-deterministic order

High Severity

run_tasks_and_collect_reads uses FuturesUnordered, which yields results in completion order rather than insertion order. The returned Vec<T::Output> will therefore not correspond positionally to the input tasks vector. Any caller of gather or run_tasks_and_collect_reads expecting output i to match task i will experience non-deterministic, hard-to-debug incorrect behavior. Using FuturesOrdered or futures::future::join_all would preserve ordering while still running concurrently.

Fix in Cursor Fix in Web

@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/gatherable-storage branch from d34f602 to 7ce467f Compare March 31, 2026 15:48
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