Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpc-v2: Implement archive_unstable_storageDiff #5997

Merged
merged 60 commits into from
Nov 27, 2024
Merged

Conversation

lexnv
Copy link
Contributor

@lexnv lexnv commented Oct 9, 2024

This PR implements the archive_unstable_storageDiff.

The implementation follows the rpc-v2 spec from:

cc @paritytech/subxt-team

@lexnv lexnv added I5-enhancement An additional feature request. T3-RPC_API This PR/Issue is related to RPC APIs. D1-medium Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase. labels Oct 9, 2024
@lexnv lexnv self-assigned this Oct 9, 2024
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Copy link
Member

@niklasad1 niklasad1 left a comment

Choose a reason for hiding this comment

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

LGTM, good stuff

(None, None) => break,
};

let Some(fetch_type) = Self::belongs_to_query(&key, &items) else {
Copy link
Contributor

@jsdw jsdw Nov 21, 2024

Choose a reason for hiding this comment

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

Aah ok I didn't notice until now: so the code iterates over all keys in storage, and then for each key it gets the added/removed/same diff compared to keys of other block and then removes any key that isn't actually something we care about, iiuc!

I was wondering about filtering the iters to contain only items which match belong_to_query before doing the diff, but then you'd have to do it twice, so it's a tradeoff! Prob how you've done it is better in case the query passed from the user is quite big!

Copy link
Contributor

@jsdw jsdw left a comment

Choose a reason for hiding this comment

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

A few comments but overall looks great!

@paritytech-workflow-stopper
Copy link

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/12053348230
Failed job name: cargo-clippy

@lexnv lexnv added this pull request to the merge queue Nov 27, 2024
Merged via the queue into master with commit afd065f Nov 27, 2024
194 of 198 checks passed
@lexnv lexnv deleted the lexnv/storage-diff branch November 27, 2024 19:04
github-merge-queue bot pushed a commit that referenced this pull request Nov 29, 2024
This PR adapts the `archive_storage` implementation from a method to a
subscription.

This keeps the archive APIs uniform and consistent.

Builds on: #5997

cc @paritytech/subxt-team

---------

Signed-off-by: Alexandru Vasile <[email protected]>
Co-authored-by: James Wilson <[email protected]>
lexnv added a commit that referenced this pull request Nov 29, 2024
This PR implements the `archive_unstable_storageDiff`.

The implementation follows the rpc-v2 spec from:
-  paritytech/json-rpc-interface-spec#159.
- builds on top of
paritytech/json-rpc-interface-spec#161

cc @paritytech/subxt-team

---------

Signed-off-by: Alexandru Vasile <[email protected]>
Co-authored-by: James Wilson <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
lexnv added a commit that referenced this pull request Nov 29, 2024
This PR adapts the `archive_storage` implementation from a method to a
subscription.

This keeps the archive APIs uniform and consistent.

Builds on: #5997

cc @paritytech/subxt-team

---------

Signed-off-by: Alexandru Vasile <[email protected]>
Co-authored-by: James Wilson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D1-medium Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase. I5-enhancement An additional feature request. T3-RPC_API This PR/Issue is related to RPC APIs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants