Feature/b007 zero amount transfer rule - #896
Merged
mijinummi merged 2 commits intoAug 11, 2026
Merged
Conversation
Implements MDTechLabs#842 - Automated Relayer Execution Gas Fee Compensation System - Add GasRefundVault contract with gas tracking using gasleft() - Calculate refund: (gasStart - gasEnd + overhead) * tx.gasprice - Disburse native token compensation to msg.sender (relayer) - Enforce maxRefundPerTx ceiling to prevent over-reimbursement attacks - Add role-based access control (RELAYER_ROLE, GUARDIAN_ROLE) - Add pause/unpause functionality for emergency stops - Add comprehensive accounting and statistics tracking - Add full test suite with 20 test cases - Add MockGasTarget for testing execution calls
Implements Rule B007 - Enforce Minimum Non-Zero Amount Validations - Add ZeroAmountChecker to flag bridge transfer functions without zero-amount checks - Inspects public/external bridge transfer entry points in Solidity source - Flags functions processing token bridging without asserting amount > 0 - Supports custom function patterns and amount parameter names - Add comprehensive test suite with 20 test cases - Fix package.json and tsconfig.json issues - Export new types and checker from exploit-detector module
2 tasks
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.
B007 Rule Implementation Complete
Successfully implemented Rule B007 on branch feature/b007-zero-amount-transfer-rule.
Implementation:
ZeroAmountChecker class in zero-amount-checker.ts
Inspects public/external bridge transfer functions for zero-amount validation
Flags functions missing require(amount > 0) or similar checks
Supports custom function patterns and amount parameter names
Configurable severity levels
Test Coverage:
20 comprehensive test cases in zero-amount-checker.spec.ts
Tests various zero-check patterns (require, if, assert)
Tests custom configurations
All tests passing
Additional Fixes:
Fixed malformed package.json (duplicate keys)
Fixed malformed tsconfig.json (duplicate compilerOptions)
closes #841