Skip to content

Gbi 2875/2 make transferred amount check strict#361

Merged
Hakob23 merged 6 commits intolbc-splitfrom
GBI-2875/2-make-transferred-amount-check-strict
Oct 14, 2025
Merged

Gbi 2875/2 make transferred amount check strict#361
Hakob23 merged 6 commits intolbc-splitfrom
GBI-2875/2-make-transferred-amount-check-strict

Conversation

@Hakob23
Copy link
Copy Markdown
Collaborator

@Hakob23 Hakob23 commented Sep 21, 2025

The Task

What

Make transferred amount check strict as recommended per audit

Why

If a calling contract uses checkAgreedAmount function to check the incoming amount (msg.value) and then proceeds to distribute funds based on the individual values in the quote (which sum up to agreedAmount), a transaction can pass the check but fail during the fund distribution phase due to insufficient balance. This creates a gas grieving vulnerability, especially in a system that uses relayers (as suggested by the presence of a gasFee in the quote), where a malicious user can make a relayer submit a transaction that is guaranteed to fail, causing the relayer to lose the gas fees.

How to Test

npm run test test/pegin/register-pegin.test.ts

- Fix tests after removing delta tolerance from checkAgreedAmount
- First test now expects AmountTooLow revert instead of successful refund
- Second test now expects exact agreed amount as target instead of delta-adjusted amount
- All 21 registerPegIn tests now pass
@Hakob23 Hakob23 self-assigned this Sep 21, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Sep 21, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Files

@Hakob23 Hakob23 marked this pull request as ready for review September 21, 2025 18:38
@Hakob23 Hakob23 requested a review from Luisfc68 October 8, 2025 23:46
@Hakob23 Hakob23 merged commit 3318fcb into lbc-split Oct 14, 2025
5 checks passed
@Hakob23 Hakob23 deleted the GBI-2875/2-make-transferred-amount-check-strict branch October 14, 2025 14:21
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