feat(escrow): bounded admin setter for settlement limit with auth and events - #1204
Open
mimi-esc wants to merge 1 commit into
Open
feat(escrow): bounded admin setter for settlement limit with auth and events#1204mimi-esc wants to merge 1 commit into
mimi-esc wants to merge 1 commit into
Conversation
Add an admin-guarded set_settlement_limit entrypoint that bounds the per-call settlement-batch ceiling to [MIN, MAX] and emits a SettlementLimitUpdated event carrying the old/new values. Expose the current value via get_settlement_limit and the bundled get_settlement_config view, and wire settle_batch to enforce the configured (rather than hard-coded) ceiling. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
Contributor
|
Hi @mimi-esc — this pull request currently has merge conflicts with the latest |
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
Adds an admin-guarded, bounded setter for the escrow's settlement-batch ceiling (
set_settlement_limit) with a typed error, an event carrying old/new values, and a read view.Approach
MIN_SETTLEMENT_LIMIT/MAX_SETTLEMENT_LIMIT/DEFAULT_SETTLEMENT_LIMITreplace the hard-codedMAX_SETTLE_BATCHconstant.set_settlement_limitcallsload_escrow_require_admin, matching the existing admin-only setter pattern (set_protocol_fee_bps,set_storage_limit).EscrowError::SettlementLimitOutOfRange(stable code236) for out-of-range values; no leaked internals.SettlementLimitUpdated { name, invoice_id, old_limit, new_limit }, emitted only when the stored value actually changes.get_settlement_limit()and the existingget_settlement_config()now expose the current ceiling.settle_batchnow enforces the configured ceiling instead of the hard-codedMAX_SETTLE_BATCH(default stays50, so existing behavior is unchanged until an admin tunes it).Edge cases covered (tests)
SettlementLimitOutOfRange.settle_batchenforces the configured limit.Verification
cargo fmt -p liquifact_escrow -- --check✅cargo clippy -p liquifact_escrow --all-targets -- -D warnings✅cargo test -p liquifact_escrow✅ (7 new tests pass)cargo build --target wasm32v1-none --release -p liquifact_escrow✅Closes #1202