Skip to content

fix(api): respect versioned signed extension metadata - #755

Open
rossbulat wants to merge 1 commit into
dedotdev:mainfrom
rossbulat:codex/fix-versioned-signed-extensions
Open

rossbulat wants to merge 1 commit into
dedotdev:mainfrom
rossbulat:codex/fix-versioned-signed-extensions

Conversation

@rossbulat

Copy link
Copy Markdown
Contributor

Asset Hub metadata V16 includes multiple transaction-extension sets. ExtraSignedExtension currently initializes every entry in the metadata table, including extensions outside the set used for version 4 transactions. On runtime 2005000, this throws SignedExtension for VerifyMultiSignature requires input but is not implemented before a validator payout can be submitted.

Select and order extensions through signedExtensionsByVersion.get(0), matching PortableRegistry.$Extra() and the existing version 4 transaction encoding. The shared selector also keeps wallet payload processing and additional signed data encoding consistent. Unsupported extensions in the selected set and a missing version-zero mapping still fail.

Regression coverage exercises initialization, wallet payload processing, extension ordering and encoded signing data, older metadata's single-set layout, empty sets, and invalid sets. The existing fallback-extension fixture now includes its version-zero mapping.

Validation on Node 24:

  • yarn workspace @dedot/api test: 445 tests passed.
  • yarn build: all 14 projects passed.
  • Prettier check passed for the implementation and new regression tests.
  • The new tests reproduce the signing error without the fix (4 failures, 2 passes).
  • The equivalent package patch signed a payout-shaped transaction against live Asset Hub V16 metadata using a development key without broadcasting it.
  • With the equivalent patch deployed, the production validator payout batch and all three pool-claim batches reached finalization, with no new service errors.

Copilot AI lite review requested due to automatic review settings September 10, 2026 12:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Version-index selection doesn’t validate index bounds, which can produce undefined defs and fail with a non-actionable runtime error on invalid metadata.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR fixes extrinsic signed-extension selection to respect versioned signed extension metadata (v16+), preventing initialization of extensions that are not part of the version-0 (v4 extrinsic) extension set and avoiding runtime signing failures on Asset Hub V16.

Changes:

  • Update ExtraSignedExtension to select/sequence signed extensions via signedExtensionsByVersion.get(0) (matching PortableRegistry.$Extra() for v4 encoding).
  • Update fallback-extension tests to include a version-0 mapping in mocked metadata.
  • Add regression tests covering selection/ordering, payload processing parity, empty sets, older single-set behavior, and failure modes.
File summaries
File Description
packages/api/src/extrinsic/extensions/ExtraSignedExtension.ts Selects signed extensions from the version-0 extension set (v4) instead of initializing all metadata entries.
packages/api/src/extrinsic/extensions/tests/FallbackSignedExtension.spec.ts Updates mocks to include signedExtensionsByVersion for version-0 selection.
packages/api/src/extrinsic/extensions/tests/ExtraSignedExtension.spec.ts Adds regression coverage for versioned extension selection, ordering, encoding, and failure behavior.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +52 to +56
const { signedExtensions, signedExtensionsByVersion } = this.registry.metadata.extrinsic;
// Match PortableRegistry.$Extra(): version 4 transactions use extension version 0.
const indexes = signedExtensionsByVersion.get(0);
assert(indexes, 'No signed extensions found for extension version 0');
return indexes.map((index) => signedExtensions[index]);
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.

2 participants