Skip to content

fix: decode v4 extrinsics with transaction extension version 0 - #2277

Merged
pgherveou merged 1 commit into
masterfrom
fix/v4-transaction-extension-version
Sep 11, 2026
Merged

fix: decode v4 extrinsics with transaction extension version 0#2277
pgherveou merged 1 commit into
masterfrom
fix/v4-transaction-extension-version

Conversation

@TarikGul

Copy link
Copy Markdown
Member

Addresses the v4 half of #1998.

Description

A v4 extrinsic encodes no transaction extension version and is defined to use version 0. transaction_extension_version_to_use_for_decoding instead returned the highest version in the metadata, which was harmless while chains only exposed version 0.

Polkadot Asset Hub spec 2005000 exposes [0, 1], and version 1 prepends UnitTransactionExtension and VerifyMultiSignature. V4 extras were read against that set, so the era bytes were interpreted as enum variant indexes and decoding failed with VariantNotFound. Reproduced on Polkadot Asset Hub block 20487777, where extrinsics().iter() yielded errors for the two v4 signed extrinsics and decoded 2 of 4. With this change it decodes 4 of 4, and block 20494727, whose signed extrinsic is a v5 General declaring version 1, still decodes 3 of 3.

Downstream report: paritytech/polkadot-rest-api#405.

Changes

transaction_extension_version_to_use_for_decoding now returns 0, matching what its doc comment already described. Metadata below V16 only ever populates version 0, so this is a no op for V14, V15 and legacy metadata, and only changes behaviour on V16 runtimes exposing more than one version.

V5 extrinsics are untouched: they carry an explicit version, which is passed through extrinsic_extension_info and used as given. transaction_extension_version_to_use_for_encoding still prefers the newest version.

Not in scope

The other half of #1998, picking the matching rather than the newest extension set when encoding v5, needs to reconcile the configured extensions against the metadata and is left alone here.

A v4 extrinsic encodes no transaction extension version and is defined to
use version 0, but transaction_extension_version_to_use_for_decoding
returned the highest version in the metadata. That was harmless while
chains only exposed version 0. Polkadot Asset Hub spec 2005000 exposes
[0, 1], where version 1 prepends UnitTransactionExtension and
VerifyMultiSignature, so the v4 extras were read against the wrong
extension set and decoding failed with VariantNotFound.

V5 extrinsics are unaffected, since they carry an explicit version that is
passed through and used as given. Encoding still prefers the newest
version, which is a separate decision.

Metadata below V16 only ever populates version 0, so this is a no op for
V14, V15 and legacy metadata.

Addresses the v4 half of #1998.

@lexnv lexnv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM! Thanks Tarik! 🙏

@pgherveou
pgherveou merged commit 16e1150 into master Sep 11, 2026
23 checks passed
@pgherveou
pgherveou deleted the fix/v4-transaction-extension-version branch September 11, 2026 08:12
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.

4 participants