Upgrade to frame-decode 0.17: remove extrinsic encode logic and use from there.#2177
Open
Upgrade to frame-decode 0.17: remove extrinsic encode logic and use from there.#2177
Conversation
… better tx extension handling
There was a problem hiding this comment.
Pull request overview
This PR upgrades Subxt to frame-decode 0.17 and refactors transaction construction/encoding to rely on frame-decode, while simplifying the transaction extensions API and tightening Config type requirements via EncodeAsType/DecodeAsType.
Changes:
- Move extrinsic call/extrinsic encoding logic from Subxt into
frame-decode, updating signing APIs to returnResultand adjusting transaction types/lifetimes. - Replace the old “extrinsic params / AnyOf” machinery with a simpler transaction-extensions trait setup and default extension tuples.
- Add Ethereum helper types under
subxt::utils::ethand update examples/tests accordingly; bumpframe-decodedependency and lockfiles.
Reviewed changes
Copilot reviewed 28 out of 33 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| testing/integration-tests/src/historic.rs | Refactors historic runtime client instantiation and RPC connection retry logic. |
| testing/integration-tests/src/full_client/transactions.rs | Updates tests for sign() now returning Result. |
| testing/integration-tests/src/full_client/metadata_validation.rs | Updates storage entry name used in validation (AllExtrinsicsLen → BlockSize). |
| testing/integration-tests/src/full_client/client/mod.rs | Updates external signing flow for signer_payload() / signing methods returning Result. |
| testing/integration-tests/src/full_client/client/chain_head_rpcs.rs | Updates chain-head RPC tests for sign() now returning Result. |
| subxt/src/utils/multi_signature.rs | Adds EncodeAsType/DecodeAsType derives to MultiSignature. |
| subxt/src/utils/eth.rs | Introduces eth::Signature and houses AccountId20 under utils::eth. |
| subxt/src/utils.rs | Exposes utils::eth module and adjusts utils exports. |
| subxt/src/transactions/payload.rs | Simplifies Payload trait to expose pallet/call names and typed call data instead of encoding methods. |
| subxt/src/transactions/account_nonce.rs | Improves error mapping for nonce retrieval/decoding. |
| subxt/src/transactions.rs | Switches extrinsic encoding/signing payload construction to frame-decode; updates signing APIs and transaction extension plumbing. |
| subxt/src/extrinsics/extrinsic_transaction_extensions.rs | Renames “signed extension” terminology to “transaction extension” and updates matching/decoding. |
| subxt/src/error.rs | Removes unused error variants; introduces ExtrinsicError::EncodeError and renames extension error type. |
| subxt/src/config/transaction_extensions.rs | Refactors built-in extensions to implement new extension traits and frame-decode encoding. |
| subxt/src/config/transaction_extension_traits.rs | Adds new traits/types for transaction extensions, params injection, and tuple impls. |
| subxt/src/config/substrate.rs | Renames config associated type to TransactionExtensions and updates defaults. |
| subxt/src/config/polkadot.rs | Renames config associated type to TransactionExtensions and updates defaults. |
| subxt/src/config/extrinsic_params.rs | Removes the old extrinsic-params module (replaced by transaction extensions). |
| subxt/src/config/default_transaction_extensions.rs | Replaces AnyOf default params with a default tuple of extensions + updated builder output type. |
| subxt/src/config.rs | Updates Config bounds and public re-exports for new transaction extension APIs. |
| subxt/examples/light_client.rs | Enhances printed block info (adds height). |
| subxt/examples/config_eth.rs | Updates example to use subxt::utils::eth::{AccountId20, Signature} and new TransactionExtensions type. |
| subxt/examples/config_assethub.rs | Updates example to use DefaultTransactionExtensions and new TransactionExtensions type. |
| signer/src/eth.rs | Adds conversions between signer signature and subxt::utils::eth::Signature; updates tests/config. |
| metadata/src/lib.rs | Updates metadata adapter to new frame-decode extrinsics type-info APIs. |
| examples/wasm-example/src/routes/signing.rs | Updates call-data encoding/signing flow to new tx APIs returning Result. |
| examples/wasm-example/Cargo.lock | Bumps lockfile deps for frame-decode 0.17 beta. |
| examples/parachain-example/Cargo.lock | Bumps lockfile deps for frame-decode 0.17 beta. |
| examples/ffi-example/Cargo.lock | Bumps lockfile deps for frame-decode 0.17 beta. |
| README.md | Adds note about offline usage capability. |
| Cargo.toml | Bumps frame-decode to 0.17.0-beta.1. |
| Cargo.lock | Updates workspace lockfile for frame-decode 0.17 beta. |
| .gitignore | Adds .claude to ignored files. |
Comments suppressed due to low confidence (1)
subxt/src/utils/eth.rs:13
- Typo in doc comment: "Ehtereum-compatible" → "Ethereum-compatible".
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…s as KSM nodes super slow
…ch/subxt into jsdw-extrinsics-to-frame-decode
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
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.
This PR:
frame-decodeto provide this. The effect here is that now all of the "heavy lifting" for encoding and decoding things lives inframe-decode.SignableTransactionobject now has a lifetime and additional generic, andsigner_payloadandsignmethods noq return a result, since we now enable additional checking (and thus potential for errors) here.subxt::transactions::Payloadtrait and impls are simplified, removing any encode logic.TransactionExtensionfor decoding and matching on the extension,ExtrinsicParamsfor being able to instantiate it and provide params, andExtrinsicParamsEncoderto encode its value or implicit). Now there are just two traits to implement (and only one in Subxt):TransactionExtensionto provide the decoding and instantiation logic that Subxt wants, andframe_decode::extrinsics::TransactionExtensionto provide the name and encode logic thatframe-decodewants.AnyOfis no longer needed as a wrapper to support providing multiple transaction extensions; we instead lean onframe-decodelogic and our ownTransactionExtensionstrait which is much simpler.Anyvalues and casting when injecting Account ID and Signature: proper types are used. This is possible now because we also no longer need the traits to be object safe.Config::ExtrinsicParamsis renamed toConfig::TransactionExtensions, since it is given a tuple of transaction extensions.Config::AccountId,Config::AddressandConfig::Signature. The default types for these are updated as needed to implement these traits.subxt::utils::ethmodule is added which noew hosues the oldsubxt::utils::AccountId20and has a newSignaturetype which can be used on eth chains as theConfig::Signaturetype.frame-decodeand others were spotted as a result of this pass and removed.This PR is a net negative in loc in Subxt, but more importantly reduces the complexity a bunch and simplifies some bits in the process.
Relies on frame-decode#87