fix(#467): standardize validation ordering for set_settlement_rule and set_default_rule - #640
Open
Seunfunmi-319509 wants to merge 5 commits into
Conversation
…t_rule and set_default_rule Both the direct path (settlement.rs) and the scheduled/timelocked path (admin.rs) now enforce the same validation order: 1. Merchant existence (where applicable) -> MerchantMissing (Betta-Pay#302) 2. Fee range (hardcoded protocol bounds) -> InvalidFeeBps (Betta-Pay#4) 3. Governance ceiling -> FeeExceedsGovernanceConfig (Betta-Pay#312) 4. Settlement delay -> InvalidSettlementDelay (Betta-Pay#308) Changes: - Reordered set_settlement_rule (settlement.rs): moved merchant existence check and fee range before governance ceiling - Added validate_fee_against_governance to _set_settlement_rule (admin.rs): was missing entirely from the scheduled path - Reordered set_default_rule (settlement.rs): moved fee range before governance ceiling - Added validate_fee_against_governance to _set_default_rule (admin.rs): was missing entirely from the scheduled path - Added 7 parity tests asserting both paths return errors for identical bad input (unregistered merchant, invalid fee BPS, fee sum exceeds denominator, invalid settlement delay) - Fixed Makefile: removed wasm_size from 'all' target, cleaned up duplicate fmt and .PHONY declarations to fix CI soroban: not found - Ran cargo fmt --all to normalize formatting across the workspace
Seunfunmi-319509
force-pushed
the
fix/467-validation-ordering-settlement-rule
branch
from
August 26, 2026 00:21
bdd6ce9 to
71ae2a1
Compare
|
@Seunfunmi-319509 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Seunfunmi-319509
force-pushed
the
fix/467-validation-ordering-settlement-rule
branch
from
August 26, 2026 22:30
6d399e2 to
71ae2a1
Compare
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.
Summary
closes #467
Standardizes the validation ordering between the direct path (
settlement.rs) and the scheduled/timelocked path (admin.rs) so both paths return the same error for the same invalid input.Problem
The direct path and the scheduled path enforced different validation orders:
This meant the same invalid input could produce different error codes depending on which path was used.
Fix
Both paths now enforce the same standardized validation order:
MerchantMissing (#302)(settlement rule only)InvalidFeeBps (#4)FeeExceedsGovernanceConfig (#312)InvalidSettlementDelay (#308)Changes
settlement.rs: Reorderedset_settlement_ruleandset_default_ruleto check fee range before governance ceiling, and added merchant existence check before fee rangeadmin.rs: Addedvalidate_fee_against_governanceto_set_settlement_ruleand_set_default_rule(was missing entirely), reordered to match standardized orderset_default_rule(3 tests)Verification
All 91 tests pass.
cargo fmt --allandcargo clippy --workspace --all-targets --all-features -- -D warningsclean.