Skip to content

Comments

fix: tada withdrawal failure caused due to strict conditions#8186

Draft
dgm003 wants to merge 1 commit intomasterfrom
WIN-9022-fix-ada-gas-tank-verify-transaction
Draft

fix: tada withdrawal failure caused due to strict conditions#8186
dgm003 wants to merge 1 commit intomasterfrom
WIN-9022-fix-ada-gas-tank-verify-transaction

Conversation

@dgm003
Copy link
Contributor

@dgm003 dgm003 commented Feb 20, 2026

TICKET: CSHLD-34

@dgm003 dgm003 force-pushed the WIN-9022-fix-ada-gas-tank-verify-transaction branch from f35f20b to 19938af Compare February 20, 2026 07:14
@dgm003 dgm003 changed the title fix: TADA withdrawal failure caused due to strict conditions fix: tada withdrawal failure caused due to strict conditions Feb 20, 2026
@dgm003 dgm003 force-pushed the WIN-9022-fix-ada-gas-tank-verify-transaction branch from 19938af to 3661c2b Compare February 20, 2026 08:45
@dgm003 dgm003 marked this pull request as ready for review February 20, 2026 10:49
@dgm003 dgm003 requested a review from a team as a code owner February 20, 2026 10:49
@dgm003 dgm003 marked this pull request as draft February 20, 2026 12:10
if (recipient.address === output.address && recipient.amount === output.amount) {
if (
recipient.address === output.address &&
(recipient.amount === 'max' || BigInt(output.amount) >= BigInt(recipient.amount))
Copy link
Contributor

Choose a reason for hiding this comment

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

recipient.amount is the withdrawal amount. Max is a flag that we use internally to find out if it is a max withdrawal. amount can never be max. Please remove this condition

if (recipient.address === output.address && recipient.amount === output.amount) {
if (
recipient.address === output.address &&
(recipient.amount === 'max' || BigInt(output.amount) >= BigInt(recipient.amount))
Copy link
Contributor

Choose a reason for hiding this comment

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

BigInt(output.amount) >= BigInt(recipient.amount) this condition will allow withdrawals exceeding the expected amount and will not flag any buggy behaviour in build. As the issue is with the fee address deposits from the same enterprise as the fee address, let's check if the certs from the tx is 2 (one for sender and the other for gas tank), if so, BigInt(output.amount) >= BigInt(recipient.amount) can be validated

const multiAssets = output.multiAssets as CardanoWasm.MultiAsset;
const tokenQty = multiAssets.get_asset(policyScriptHash, assetName);
return tokenQty && tokenQty.to_str() === recipient.amount;
return tokenQty && (recipient.amount === 'max' || BigInt(tokenQty.to_str()) >= BigInt(recipient.amount));
Copy link
Contributor

Choose a reason for hiding this comment

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

Given the issue is with the fee address deposits which does not include tokens, this change is not required

});

it('should succeed when recipient amount is max', async () => {
const txPrebuild = newTxPrebuild();
Copy link
Contributor

Choose a reason for hiding this comment

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

Please fix/add test cases with new changes

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