Configuration#70
Open
Lynndabel wants to merge 4 commits into
Open
Conversation
- Add FeeExceedsMaximum (329) for fee basis points exceeding 10000 - Add FeeRecipientRequired (330) when fees configured without valid recipient - Replace generic InvalidAmount with specific fee validation errors
- Add validation in set_fee_config to ensure fee_bps <= 10000 - Update set_per_asset_fee to use FeeExceedsMaximum error consistently - Validate both fee_bps and arbiter_bps against maximum
- Add validate_fee_recipient() function to check platform wallet or collector - Integrate validation into route_payout to require recipient for non-zero fees - Prevent fees from remaining in contract without designated recipient
- Test zero fee allows payout without recipient - Test 100% fee with valid recipient - Test rejection of non-zero fee without recipient - Test rotated collector receives fees correctly - Test per-asset override with arbiter split - Test payout + fees equals escrow amount invariant - Test fee config rejects values exceeding maximum
Contributor
|
@Lynndabel |
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.
closes #17
I have successfully implemented comprehensive fee routing validation for your smart contract system. Here's a summary of the changes:
Changes Made
1. Added Specific Error Types ([errors.rs]
InvalidAmountwhen fee basis points exceed 10,000 (100%)2. Validated Global Fee Config ([admin.rs] - Added validation in [set_fee_config]
FeeExceedsMaximumerror instead of genericInvalidAmount3. Updated Per-Asset Fee Validation ([admin.rs]
FeeExceedsMaximumerror for consistencyfee_bpsandarbiter_bpsagainst maximum4. Added Fee Recipient Validation ([fee_router.rs]
5. Comprehensive Invariant Tests ([fee_router_test.rs]
Added 6 new tests:
Test Results
All 11 fee router tests pass successfully, validating: