starknet_patricia_storage: define gatherable storage trait#13630
starknet_patricia_storage: define gatherable storage trait#13630nimrod-starkware wants to merge 1 commit intonimrod/parallel-reads/storage-task-traitfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
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); | ||
| } |
There was a problem hiding this comment.
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.
d34f602 to
7ce467f
Compare



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
GatherableStorageextension trait plus arun_tasks_and_collect_readshelper to run multipleStorageTasks concurrently, giving each task its ownReadsCollectorStorageand merging the collected reads.Updates
starknet_patricia_storagedependencies to includefutures(used forFuturesUnordered) to drive the concurrent execution.Written by Cursor Bugbot for commit 7ce467f. This will update automatically on new commits. Configure here.