Skip to content

Upgrade to frame-decode 0.17: remove extrinsic encode logic and use from there.#2177

Open
jsdw wants to merge 18 commits intomasterfrom
jsdw-extrinsics-to-frame-decode
Open

Upgrade to frame-decode 0.17: remove extrinsic encode logic and use from there.#2177
jsdw wants to merge 18 commits intomasterfrom
jsdw-extrinsics-to-frame-decode

Conversation

@jsdw
Copy link
Collaborator

@jsdw jsdw commented Feb 11, 2026

This PR:

  • Removes the logic for encoding extrinsics, and now relies on frame-decode to provide this. The effect here is that now all of the "heavy lifting" for encoding and decoding things lives in frame-decode.
    • Most APIs are unchanged, but the intermediate SignableTransaction object now has a lifetime and additional generic, and signer_payload and sign methods noq return a result, since we now enable additional checking (and thus potential for errors) here.
    • The subxt::transactions::Payload trait and impls are simplified, removing any encode logic.
  • Simplifies the handling and naming around Transaction Extensions:
    • Previously each transaction extension needed to implement several confusingly named traits (TransactionExtension for decoding and matching on the extension, ExtrinsicParams for being able to instantiate it and provide params, and ExtrinsicParamsEncoder to encode its value or implicit). Now there are just two traits to implement (and only one in Subxt): TransactionExtension to provide the decoding and instantiation logic that Subxt wants, and frame_decode::extrinsics::TransactionExtension to provide the name and encode logic that frame-decode wants.
    • AnyOf is no longer needed as a wrapper to support providing multiple transaction extensions; we instead lean on frame-decode logic and our own TransactionExtensions trait which is much simpler.
    • We no longer need any dynamic Any values 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::ExtrinsicParams is renamed to Config::TransactionExtensions, since it is given a tuple of transaction extensions.
  • Uses EncodeAsType and DecodeAsType a little more; primarily this is noticeable on Config::AccountId, Config::Address and Config::Signature. The default types for these are updated as needed to implement these traits.
    • This adds a layer of safety and ensures that account IDs and signature types that are wrong will lead to more specific errors sooner rather than vague "invalid transaction" errors from the node.
    • A new subxt::utils::eth module is added which noew hosues the old subxt::utils::AccountId20 and has a new Signature type which can be used on eth chains as the Config::Signature type.
  • Removes some unused error variants: some of these became unused as a result of more logic moving into frame-decode and 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

@jsdw jsdw changed the title Use extrinsic encode logic from frame-decode and overhaul transaction extension traits Upgrade to frame-decode 0.17: remove extrinsic encode logic and use from there. Feb 12, 2026
@jsdw jsdw marked this pull request as ready for review February 13, 2026 11:05
@jsdw jsdw requested a review from a team as a code owner February 13, 2026 11:05
@jsdw jsdw requested a review from Copilot February 13, 2026 11:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 return Result and 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::eth and update examples/tests accordingly; bump frame-decode dependency 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 (AllExtrinsicsLenBlockSize).
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.

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.

1 participant