Skip to content

fix(sdk-core): Fix fee deductions in verifyEdOnDestinationInternal - #2451

Open
LBCron wants to merge 1 commit into
paraspell:mainfrom
LBCron:fix/paraspell-bug-bounty-1
Open

LBCron wants to merge 1 commit into
paraspell:mainfrom
LBCron:fix/paraspell-bug-bounty-1

Conversation

@LBCron

@LBCron LBCron commented Nov 7, 2026

Copy link
Copy Markdown

🐞 Bug Fix Pull Request

πŸ“Œ Related Issue

Closes #2450


πŸ› οΈ Description of the Fix

  • Bug description: verifyEdOnDestinationInternal subtracted destFee from the transferred asset even when destFeeAsset was a separate feeAsset, skipped calculateTotalXcmFee for PolkadotXcm.execute (method === 'execute') transfers, and omitted originFee when usesOriginFeeAsset was true.
  • Fix summary:
    • Destructure fee: originFee and asset: originFeeAsset from xcmFeeResult.origin and subtract originFee when usesOriginFeeAsset(api, origin, currency, destAsset, resolvedFeeAsset, originFeeAsset) is true.
    • Gate xcmFeeToSubtract on paysDestFee, use calculateTotalXcmFee(destAsset, xcmFeeResult) when isTypeAndThenMethod || method === 'execute', and check isAssetEqual(destFeeAsset, destAsset) before subtracting destFee for other methods.
    • Add 3 unit tests in packages/sdk-core/src/transfer/verify-ed/verifyEdOnDestinationInternal.test.ts covering separate feeAsset destination fee, execute hop + destination fee deduction, and usesOriginFeeAsset origin fee deduction (13/13 passing in verifyEdOnDestinationInternal.test.ts, 1439/1439 passing across @paraspell/sdk-core).

βœ… Contributor Eligibility

  • My GitHub account's commit history is at least 6 months old.
  • I have set an on-chain identity on the Polkadot People Chain for my AssetHub address and requested a registrar judgement of at least Reasonable (verifiable via Subscan).
  • Every commit in this PR is signed (-S) and includes Signed-off-by and AI-Assisted-By: Claude Code trailers.
  • I disclose any AI tools used to help write this fix (or confirm none were used), and I understand and can explain/defend the resulting code myself.
  • This fix was authored and reviewed by a human β€” not opened autonomously by an AI agent.
  • I will respond to maintainer review questions with specific, on-topic answers within 5 days.
  • I understand πŸ”΄ High complexity fixes may require a brief live chat/call walkthrough before payout.
  • This is the only bug bounty issue I currently have reserved.

βœ… Checklist

  • My code follows the project's code style.
  • I have added tests that prove my fix is effective (if applicable).
  • I have updated the documentation where necessary.
  • I have verified the fix does not introduce new issues.

Only subtract destFee in non-typeAndThen/execute transfers when paysDestFee and isAssetEqual(destFeeAsset, destAsset), include execute transfers in calculateTotalXcmFee, and subtract originFee when usesOriginFeeAsset is true.

Fixes paraspell#2450

Signed-off-by: LBCron <ronan.chenlopes@gmail.com>
AI-Assisted-By: Claude Code
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.

[Bug bounty] verifyEdOnDestinationInternal miscalculates fee deductions for custom feeAsset and PolkadotXcm.execute transfers

1 participant