Skip to content

starknet_patricia_storage: define storage task trait#13629

Open
nimrod-starkware wants to merge 1 commit intonimrod/parallel-reads/single-trie-refactorfrom
nimrod/parallel-reads/storage-task-trait
Open

starknet_patricia_storage: define storage task trait#13629
nimrod-starkware wants to merge 1 commit intonimrod/parallel-reads/single-trie-refactorfrom
nimrod/parallel-reads/storage-task-trait

Conversation

@nimrod-starkware
Copy link
Copy Markdown
Contributor

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

Note

Medium Risk
Adds new public async traits and a new dependency (async-trait), expanding the library API surface and affecting downstream implementors/compile behavior.

Overview
Introduces a new abstraction for batching/concurrently executing storage read work by adding StorageTaskOutput and async StorageTask traits, which run against a ReadsCollectorStorage wrapper.

Updates starknet_patricia_storage dependencies (async-trait) and lockfile entries to support async trait methods.

Written by Cursor Bugbot for commit 2d05567. 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.

#[async_trait]
pub trait StorageTask<'a, S: ImmutableReadOnlyStorage + 'a>: StorageTaskOutput<S> + Send {
async fn run_with_storage(self, storage: &mut ReadsCollectorStorage<'a, S>) -> Self::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.

Inconsistent async pattern adds unnecessary boxing overhead

Low Severity

The StorageTask trait uses #[async_trait] (which boxes the returned future), while every other async trait in this same file deliberately uses RPITIT (-> impl Future<...> + Send) — with seven explicit comments explaining that design choice. This introduces unnecessary heap allocation per task execution, adds a new async-trait proc-macro dependency to the crate, and breaks the file's established convention. The same impl Future desugaring pattern used by ImmutableReadOnlyStorage, ReadOnlyStorage, and Storage works here too.

Additional Locations (1)
Fix in Cursor Fix in Web

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