Gbi 2875/2 make transferred amount check strict#361
Merged
Conversation
- 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
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files |
Luisfc68
requested changes
Oct 6, 2025
Luisfc68
approved these changes
Oct 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Task
What
Make transferred amount check strict as recommended per audit
Why
If a calling contract uses
checkAgreedAmountfunction to check the incoming amount (msg.value) and then proceeds to distribute funds based on the individual values in the quote (which sum up toagreedAmount), 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 agasFeein 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