Skip to content

Feature/b007 zero amount transfer rule - #896

Merged
mijinummi merged 2 commits into
MDTechLabs:mainfrom
Benedict315:feature/b007-zero-amount-transfer-rule
Aug 11, 2026
Merged

Feature/b007 zero amount transfer rule#896
mijinummi merged 2 commits into
MDTechLabs:mainfrom
Benedict315:feature/b007-zero-amount-transfer-rule

Conversation

@Benedict315

Copy link
Copy Markdown

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

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
@mijinummi
mijinummi merged commit d0471f7 into MDTechLabs:main Aug 11, 2026
1 check failed
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.

[RULE] Rule B007: Enforce Minimum Non-Zero Amount Validations

3 participants