Skip to content

feat(examples): canton-token-template admin-layer properties (pause / authorization / supply conservation)#2

Open
peektism wants to merge 1 commit into
mainfrom
feat/admin-layer-properties
Open

feat(examples): canton-token-template admin-layer properties (pause / authorization / supply conservation)#2
peektism wants to merge 1 commit into
mainfrom
feat/admin-layer-properties

Conversation

@peektism
Copy link
Copy Markdown
Collaborator

@peektism peektism commented Jun 5, 2026

Summary

Adds a pure state-machine example (DamlProps/Examples/AdminLayer/) modeling the OpenZeppelin canton-token-template minting-control path — Rules_Mint, consumeMintAllowance, and assertNotPaused. 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 / unpause sequences:

Semantic Invariant Mirrors
Pause no mint may increase supply while paused assertNotPaused (A8)
Authorization only a minter-capability holder can mint requireRole (A1–A3)
Conservation (D3) cumulative capped minting never exceeds the issued allowance consumeMintAllowance (A6–A7)

Design

Following the existing Amulet example's buggy/fixed pattern, each semantic has:

  • a fixed executor (executeAdminFixed) that mirrors the real contract guards and satisfies every invariant for all action sequences, and
  • a buggy executor that drops exactly one guard (executeAdminNoPause, 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

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant