Skip to content

fix(sdk-core): allow PA-approved DeFi legs to sign without txParams - #10225

Open
mullapudipruthvik wants to merge 1 commit into
masterfrom
pruthvikpruthvik/DEFI-1356-defi-earn-bitgojs
Open

mullapudipruthvik wants to merge 1 commit into
masterfrom
pruthvikpruthvik/DEFI-1356-defi-earn-bitgojs

Conversation

@mullapudipruthvik

@mullapudipruthvik mullapudipruthvik commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

WP persists DeFi intentTypes kebab-case while wallet.sendMany signs with the camelCase txParams.type, and the pendingApproval.approve() re-sign path carries no txParams at all — so the recipients guard fell back to the persisted kebab-case intentType (defi-approve etc.) and every DeFi approval re-sign threw Recipient details are required.

The fix bridges the two spellings in resolveEffectiveTxParams: it normalizes the kebab-case intentType to the camelCase txParams.type and reconstructs txParams.defiParams from the flattened intent fields (vaultId/amount, shareTokenAmount for defi-withdraw), mirroring the existing wrapApprove → wrapParams reconstruction. The re-sign therefore both passes the recipients guard and reaches the coin verifier's dedicated DeFi calldata checks, which key on the camelCase type — a plain NO_RECIPIENT_TX_TYPES registration would only have avoided the throw while downgrading verification to a warn. TransactionParams gains the defiParams field; a malformed intent reconstructs nothing and the verifier fails closed with missing required intent parameters.

Note: the set keeps only the camelCase DeFi spellings — the normalization is the single bridge for the persisted kebab spelling, pinned by wiring tests through the real sign pipeline. (The wrap-native/unwrap-native dual registration is the older pattern; canonicalizing it is tracked separately.)

Verification

  • Unit: recipientUtils suite (54 passing) incl. fail-closed malformed-intent test; 3 wiring regressions through the real signRequestBase → resolveEffectiveTxParams → verifyTransaction path asserting the verifier receives the camelCase type + reconstructed defiParams on the no-txParams PA path.
  • Live (DEFI-1362): the identical no-txParams signing call fails on the published SDK (reproduced from the retail UI) and succeeds on this branch — approve leg signed and broadcast on test env.

Stack

Base of stack PRs #10225–#10230. Stacked-PR order: this PR merges first; the rest rebase onto master.

Ticket: DEFI-1356

@linear-code

linear-code Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

DEFI-1356

DEFI-1422

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Compatibility checks are failing on Node.js 27-nightly (experimental, non-blocking). This does not block merge, but it signals an incompatibility to fix before this release becomes supported.

View run

@mullapudipruthvik
mullapudipruthvik force-pushed the pruthvikpruthvik/DEFI-1356-defi-earn-bitgojs branch from f646af8 to 80b81b6 Compare November 24, 2026 11:12
WP persists DeFi intentTypes kebab-case while wallet.sendMany signs with
the camelCase txParams.type, and the pendingApproval.approve() re-sign
path carries no txParams at all — so the recipients guard fell back to
the persisted kebab-case intentType and threw 'Recipient details are
required'. resolveEffectiveTxParams now normalizes the kebab intentType
to the camelCase txParams.type and reconstructs txParams.defiParams from
the flattened intent fields (vaultId/amount, shareTokenAmount for
defi-withdraw), mirroring the wrapApprove wrapParams reconstruction.
The re-sign therefore both passes the guard and reaches the coin
verifier's dedicated DeFi calldata checks, which key on the camelCase
type — plain set registration would only have avoided the throw while
downgrading verification to a warn. TransactionParams gains the
defiParams field; a malformed intent reconstructs nothing and the
verifier fails closed.

Ticket: DEFI-1356
@mullapudipruthvik
mullapudipruthvik force-pushed the pruthvikpruthvik/DEFI-1356-defi-earn-bitgojs branch from 80b81b6 to 8afaa59 Compare November 25, 2026 17:02
@mullapudipruthvik
mullapudipruthvik marked this pull request as ready for review November 25, 2026 17:58
@mullapudipruthvik
mullapudipruthvik requested review from a team as code owners November 25, 2026 17:58

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

This branch has not been deployed

No deployments
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