test: strengthen core issuance, reserve, and DepegGuard coverage - #72
Closed
Pattermesh wants to merge 1 commit into
Closed
Pattermesh wants to merge 1 commit into
Pattermesh wants to merge 1 commit into
Conversation
Adds three focused Foundry suites on the toolkit core. All complement the existing tests rather than replace them; the full suite stays green (145 passed, 0 failed). - MinterIssuance.t.sol (12): mint/burn against reserves — reserve-ratio gate reverts on under-collateralization, exact-ceiling mint, tracked-supply propagation, raised-minimum-ratio gate, authorize/revoke lifecycle, owner-implicit authorization, compliance enforced through the minter (non-KYC + daily-limit), fee/collector routing, and redeem burn accounting. - ReserveManagerPoR.t.sol (16): Chainlink PoR pull path (setPorAdapter, pullPorReserve decimal conversion + idempotent ids + manual coexistence, pullPorReserveAndCheck pass/fail/unset), inactive-asset guard, re-add overwrite without duplicate id, emitted events, and onlyOwner gating. - DepegGuardStateMachine.t.sol (11): direct Normal->Hard escalation, Hard pin in the caution band, hysteresis hold, real Minter authorize/revoke side-effects under guard ownership, emergency-escalate no-op, pending-clear on snap-back to peg, and the remaining tuning setters (durations/staleness/ pegTarget incl. deviation recomputation). Also gitignores forge-out/ build output and package-lock.json. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
Welcome to kcolbchain, @Pattermesh — glad you're here. 🌱 Here's what happens from this PR:
While you wait:
What happens after your first merge
Thanks for writing the code. We're building this to last. |
Contributor
|
This issue/PR has had no activity for 21 days and is being closed automatically by the kcolbchain PR pipeline. If it's still relevant, reopen or leave a comment and we'll re-triage. For the full policy see pipeline docs. |
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
Strengthens the test suite on the three core areas of the toolkit with three new Foundry suites (39 new tests). All are additive — existing tests are untouched and the full suite stays green: 145 passed, 0 failed, 0 skipped (up from 106).
forge-test/MinterIssuance.t.sol— issuance (mint/burn against reserves), 12 testsReserveRatioTooLow), and confirms no tokens were minted.ReserveManager.totalSupplyTracked.authorizeMinter->revokeMinterlifecycle blocks a previously-authorized minter; owner is an implicit authorized minter.recordSpendtripsExceedsDailyLimit.setFeeCollectorreroutes future fees.totalSupplyand tracked supply, queues redemption); redeem without approval reverts.forge-test/ReserveManagerPoR.t.sol— reserve management / PoR, 16 testssetPorAdapterset/emit, zero-address reject, onlyOwner.pullPorReserve: 8->6 decimal conversion + storage under canonical id, idempotent reserve ids on repeated pulls, coexistence with a manual reserve, andPorAdapterNotSetrevert when unset.pullPorReserveAndCheck: reverts when ratio too low, passes when sufficient, reverts when adapter unset.updateReserveon an inactive asset reverts; re-adding an asset id overwrites without duplicating the id.ReserveUpdated,SupplyUpdated,MinimumRatioUpdated,PorReservePulled,PorAdapterSet) and onlyOwner gating on mutators.forge-test/DepegGuardStateMachine.t.sol— DepegGuard state machine, 11 testsrecoveryCeilingBpsandcautionBps).authorize/revokeside-effects observed under guard ownership: revoked in Caution, re-authorized on recovery to Normal; emergency-escalate/reset toggles pause + authorization.emergencyEscalateto the same state is a no-op (no pause, nostateEnteredAtbump).pokeclears the pending observation when price snaps back to peg.setDurations,setStaleness,setPegTarget(valid + invalid), including peg-target drivingcurrentDeviationBpsrecomputation.Also gitignores
forge-out/build output andpackage-lock.json.Test output
forge buildsucceeds (lint warnings only). CI (.github/workflows/forge.yml) already installs forge-std + npm deps and runsforge test -vvv; no CI changes needed since the new suites use the sameforge-std/Test.solimport and OpenZeppelin.🤖 Generated with Claude Code