feat(examples): canton-token-template admin-layer properties (pause / authorization / supply conservation)#2
Open
peektism wants to merge 1 commit into
Open
Conversation
Add a pure state-machine example modeling the OpenZeppelin
canton-token-template minting-control path (Rules_Mint,
consumeMintAllowance, assertNotPaused). Three admin-layer semantics are
expressed as invariants over random mint/pause/unpause sequences:
* pause — no mint may increase supply while paused
* authorization — only a minter-capability holder can mint
* conservation — cumulative capped minting never exceeds the issued
allowance (CIP supply invariant D3)
Following the Amulet example, each semantic has a fixed executor that
satisfies every invariant and a buggy executor that drops exactly one
guard. Five property tests (two positive AllPassed, three negative
FoundFailure) all pass; each negative test catches the corresponding
bypass with a minimal sequence.
These rows mirror the admin-layer proofs A1-A8 in the companion
daml-verify project, giving the canton-token-template admin layer both
SMT (daml-verify) and property-based (daml-props) coverage.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 a pure state-machine example (
DamlProps/Examples/AdminLayer/) modeling the OpenZeppelin canton-token-template minting-control path —Rules_Mint,consumeMintAllowance, andassertNotPaused. It gives the admin layer (AccessControl / Pausable / per-minter cap) property-based coverage to complement the SMT proofs A1–A8 in the companion daml-verify project.Three admin-layer semantics are expressed as invariants over random
mint/pause/unpausesequences:assertNotPaused(A8)requireRole(A1–A3)consumeMintAllowance(A6–A7)Design
Following the existing Amulet example's buggy/fixed pattern, each semantic has:
executeAdminFixed) that mirrors the real contract guards and satisfies every invariant for all action sequences, andexecuteAdminNoPause,executeAdminNoAllowance,executeAdminNoAuth).This proves the properties have teeth: each negative test catches the corresponding bypass with a minimal sequence.
Tests
Five property tests, all passing (
dpm test):test_adminInvariantsFixed— all five invariants hold under the fixed model (AllPassed)test_adminConsistencyFixed— minted supply always equals consumed allowance (AllPassed)test_adminAllowanceBypassDetected— conservation catches an allowance-cap bypass (FoundFailure)test_adminPauseBypassDetected— pause invariant catches a dropped pause guard (FoundFailure)test_adminAuthBypassDetected— authorization invariant catches a dropped role guard (FoundFailure)README "Dogfooding" section updated to document the new example as a third validated codebase.
🤖 Generated with Claude Code