Repository navigation
fix(sdk-core): send empty recipients for ERC-7984 builds (CHALO-1957) - #10082
Conversation
|
@claude review |
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
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.
|
|
3ac5565 to
2bf2a03
Compare
|
@claude review |
This comment was marked as outdated.
This comment was marked as outdated.
The /tx/build OpenAPI contract requires the recipients KEY on every build body (TransactionBuildRequest.required) - omitting the key 400s with SchemaValidationError before the handler runs (CHALO-1991). An EMPTY array is the documented server-derived shape (see the recipients description: acceleration, token enablement). For the ERC-7984 intent types (wrapApprove/wrap/unwrap/finalizeUnwrap) the real recipients and calldata are derived server-side from the intent, so: - recreateAndSignTransaction forwards an EMPTY recipients array instead of deleting the key; the /tx/build PA-rebuild carve-out re-derives the real inputs from the pendingApprovalId approve() injects. Other PA types keep forwarding their stored recipients unchanged. - prebuildTransaction defaults the OUTGOING body's recipients to [] for direct intent builds (the drawer flow), after the TSS txrequests early-return; the caller's params object is never mutated (a prebuild + prebuildTx sign flow would otherwise trip the prebuildTx check). - the prebuildAndSignTransaction deny-list guard now rejects only a POPULATED recipients list for the intent types; the empty-array shape passes. fillNonce/acceleration behaviour is unchanged. Shared const ERC7984_INTENT_TX_TYPES moves to wallet/BuildParams.ts so the guard, prebuild and PA rebuild agree on the type set. Tests: request-shape assertions flipped to recipients: [] for direct wrapApprove/unwrap (and wrap/finalizeUnwrap) prebuilds and the PA approve rebuilds; guard cases (empty array allowed for wrapApprove, still rejected for fillNonce); no caller-params mutation pinned; transfer-type PA regression unchanged. Ticket: CHALO-1957
2bf2a03 to
816eb19
Compare
|
@claude review |
|
Claude finished @0xPrabh's task in 19s —— View job Review of PR #10082No blocking issues. I read the diff at HEAD ( Earlier findings are fixed at HEAD
What I checked
Non-blocking notes
|
There was a problem hiding this comment.
I re-reviewed the latest push and found no new bugs. The three issues I raised earlier look addressed. This changes the shared wallet build path, so a review from the code owners is still worthwhile.
What was reviewed:
prebuildTransactionnow putsrecipients: []only on the outgoing/tx/buildbody, and it does so aftergetExtraPrebuildParams. The caller's params are no longer mutated, and the ETH hop branch still seesrecipientsas undefined.- The new
callerParamstest now declares an optionalrecipientsfield, so it should type-check. - The
prebuildAndSignTransactionguard: an empty array passes only for the four ERC-7984 types, andfillNonce/accelerationstill reject[]. The pending-approval (PA) rebuild forwards[]for those types and leaves other types' stored recipients unchanged.
Extended reasoning...
The change touches transaction building in sdk-core (wallet.ts prebuildTransaction and prebuildAndSignTransaction, the PendingApproval rebuild) and moves ERC7984_INTENT_TX_TYPES to BuildParams.ts. It does not touch auth, crypto or key handling directly, but it changes the /tx/build request shape for ERC-7984 intent types. Commit 816eb19 fixes the caller-params mutation, the hop interaction and the test type error that were raised earlier. The paths are covered by the wallet-core CODEOWNERS entry, which rules out auto-approval.
Summary
Follow-up to #10063 (CHALO-1957): the PA-rebuild strip deleted the
recipientskey, but the/tx/buildOpenAPI contract requires the key on every build body (TransactionBuildRequest.required: [recipients]) — a recipients-less body 400s withSchemaValidationErrorbefore the handler runs (CHALO-1991, staging-verified). An empty array is the documented server-derived shape — the spec's ownrecipientsdescription already calls it out for acceleration and ERC-7984 token enablement.For the four ERC-7984 intent types (
wrapApprove | wrap | unwrap | finalizeUnwrap) the real recipients/calldata are derived server-side from the intent, so the SDK now always sends the key empty:recreateAndSignTransaction(PA approve rebuild): forwardsrecipients: []instead of deleting the key. The/tx/buildPA-rebuild carve-out re-derives the real inputs from thependingApprovalIdapprove()injects. Other PA types keep forwarding their stored recipients unchanged.prebuildTransaction(direct drawer builds): defaultsrecipientsto[]for intent types, after the TSS/txrequestsearly-return (TSS path untouched).prebuildAndSignTransactiondeny-list guard: now rejects only a populated recipients list for the intent types; the empty-array shape passes.fillNonce/accelerationbehaviour unchanged.Shared const
ERC7984_INTENT_TX_TYPESmoves towallet/BuildParams.tsso the guard, prebuild and PA rebuild agree on the type set.Server pairing
wrapParams/unwrapParamsfrom the journey for thewrapApprove/unwraprebuilds.oneOfbranches for the recipients-less shapes. This SDK change is compatible with both: withrecipients: []present the body matchesTransactionBuildRequest, and the resolver keys onpendingApprovalId, not on recipients absence.Tests
recipients: []: directwrapApprove/unwrapprebuilds and the PA approve rebuilds (wrap + finalizeUnwrap) assert the body now carries the empty key.prebuildAndSignTransaction({ type: 'wrapApprove', recipients: [] })passes the guard (fails later at the passphrase check, never at the deny-list);({ type: 'fillNonce', recipients: [] })still throws (regression).Ticket: CHALO-1957