-
Notifications
You must be signed in to change notification settings - Fork 284
v0.50.0: Integrate frame-decode, redo storage APIs and break up Error. #2100
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
…s and accept references to them
Collaborator
Author
|
I'm going to merge this to be the base of the v0.50.0 branch for now. This will give something to build on :) |
Member
|
Hey so I actually looked through the PR to get familiar with it, and it looks good to me! Thanks for the progress on this :) |
Collaborator
Author
|
That's amazing, thank you! |
jsdw
added a commit
that referenced
this pull request
Nov 22, 2025
* v0.50.0: Integrate frame-decode, redo storage APIs and break up Error. (#2100) * WIP integrating new frame-decode and working out new storage APIS * WIP: first pass adding new storage things to subxt-core * Second pass over Address type and start impl in Subxt * WIP new storage APIs * WIP New storage APIs roughly completed, lots of errors still * Remove PlainorMap enum; plain and map values now use same struct to simplify usage * Begin 'fixing' errors * WIP splitting errors and tidying payload/address traits * Get subxt-core compiling * Small fixes in subxt-core and remove metadata mod * subxt-core: cargo check --all-targets passes * Fix test * WIP starting to update subxt from subxt-core changes * WIP splitting up subxt errors into smaller variants * WIP errors: add DispatchError errors * Port new Storage APIs to subxt-core * cargo check -p subxt passes * Quick-fix errors in subxt-cli (explore subcommand) * fmt * Finish fixing codegen up and start fixing examples * get Subxt examples compiling and bytes_at for constants * Add some arcs to limit lifetimes in subxt/subxt-core storage APIs * A little Arcing to allow more method chaining in Storage APIs, aligning with Subxt * Update codegen test * cargo check --all-targets passing * cargo check --features 'unstable-light-client' passing * clippy * Remove unused dep in subxt * use published frame-decode * fix wasm-example * Add new tx extension to fix daily tests * Remove unused subxt_core::dynamic::DecodedValue type * Update book to match changes * Update docs to fix more broken bits * Add missing docs * fmt * allow larger result errs for now * Add missing alloc imports in subxt-core * Fix doc tests and fix bug getting constant info * Fix V14 -> Metadata transform for storage & constants * Fix parachain example * Fix FFI example * BlockLength decodes t ostruct, not u128 * use fetch/iter shorthands rather than entry in most storage tests * Fix some integration tests * Fix Runtime codegen tests * Expose the dynamic custom_value selecter and use in a UI test * Update codegen metadata * Tidy CLI storage query and support (str,str) as a storage address * Add (str,str) as valid constant address too * Show string tuple in constants example * Via the magic of traits, avoid needing any clones of queries/addresses and accept references to them * clippy * [v0.50] update scale-info-legacy and frame-decode to latest (#2119) * bump scale-info-legacy and frame-decode to latest * Remove something we don't need in this PR * Fully remove unused for now dep * [v0.50] Convert historic metadata to subxt::Metadata (#2120) * First pass converting historic metadatas to our subxt::Metadata type * use published frame-decode * fmt and rename legacy metadata macro * Enable legacy feature where needed in subxt_metadata so it compiles on its own * Use cargo hack more in CI and fix subxt-metadata features * Add tests for metadata conversion (need to optimise; some too expensive right now * Address performance and equality issues in metadata conversion testing * fmt * fmt all * clippy * Fix a doc link * Test codegen and fixes to make it work * Remove local frame-decode patch * bump frame-decode to latest * [v0.50.0] Allow visiting extrinsic fields in subxt_historic (#2124) * Allow visiting extrinsic fields * fmt * Don't use local scale-decode dep * Clippy and tidy * Extend 'subxt codegen' CLI to work with legacy metadatas * Simplify historic extrinsics example now that AccountId32s have paths/names * clippy * clippy * clippy.. * Allow visiting storage values, too, and clean up extrinsic visiting a little by narrowing lifetime * Try to fix flaky test * Add custom value decode to extrinsics example * Remove useless else branch ra thought I needed * Simplify examples * Prep to release v0.0.5 (#2126)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Intro / Plan
This is the first PR towards integrating subxt and subxt-historic into a single library capable of working well with current and historic blocks.
The main gist of this PR is incorporating new storage APIs into Subxt inspired from
subxt-historic, breaking apart the big Error type returned everywhere into smaller types (while also improving the overall error feedback), and integratingframe-decodeto handle all decoding/encoding logic in subxt_core.I would propose that given the extent of the changes that this merge will bring, that we target a new version—v0.50.0—to signify the extent of the changes.
I would propose the following steps around this:
masterbranch, sov0.4x.xreleases may still occur in the meantime to push out features anf fixes. subxt-historic will be maintained on this branch as needed.Changes in this PR
With that all said, the main changes in this PR:
frame_decodeand traits likeIntoEncodableValuesandIntoDecodableValuesfor easier usage.Erroreverywhere, we now return a more specific error from each function. These more specific errors can all be convetred intoErrorvia?. We do this for more specific / better error reporting while maintaining 99% of the simplicity of a single error type.frame-decodeinto subxt_core and have it handle all encoding / decoding things.Many smaller changes which stem from these:
IntoEncodableValuesetc traits for easier encoding and consistency with storage API redo.subxt::foo::dynamicfunctions so that instead of only accepting/returningscale_value::Values, the user can specify the types. (plan is to make simplestr/(str,str)usage available for that Value type instead, so the dynamic fns become about picking types.frame_decodefor core logic.Yesand()types.scale_value::Valueto returning whatever type the user wants (inc the former) so long as it implsDecodeAsFields. For consistency these are renamed to.decode_as_fields()too.subxt_core::metadatamod to avoid lots of code dupe and lean more onframe_decodetraits instead everywhere; no moreDecodeWithMetadataandDecodedValueThunkas they aren't compatible with usingframe_decodefor things.get_bytesfor constants and custom values to return byutes, now thatDecodedValueThunkis no longer a thing (more efficient anyway).Not done here but I'd like to do / think about doing in followup PRs:
.at/.at_latesthigher up as in subxt-historic, so step 1: create client, step 2:client.at(block)/client.at_latest(), step 3:client_at_latest.storage().entry(..)/client_at_latest.constants()..etc. Submitting TX and subscribing to blocks are exceptions and will not live under this.("Metadata", "metadata_versions")like addresses for easy dynamic access and removing need to use dynamic API unless you want to specify types up front (again like storage APIs).subxt_metadata::Metadataand relying more on frame_decode traits. Less important in the new plan but less functionality exposed here == more flexibility with how metadata is stored.Notes for reviewers
A lot of the changes are just related to
Error->MoreSpecificErroreverywhere, and then additions to imporove the error reporting in many of these places.Main things that are worth looking at:
-
subxt/examples/*- have a look and see the main API changes via the examples here.-
core/src/storage/*- new storage APIs in subxt-core-
subxt/src/storage/*- new storage APIs in subxt proper.-
subxt/src/error/mod.rs- the new errors.-
subxt/src/book/*- documentation updates to accomodate the changes (do they make enough sense for now?)-
codegen/src/api/storage.rs- codegen changes for new storage APIs (other codegen changes may also be worth a glance; generally aiming to ismplify/consistify things here)From the main changes, anything that seems dumb or could be done better or just general questions you have around why things are done in any given way would be very welcome, but ofc anything you want to remark on is :)