Authority Model
Daml removes many low-level smart contract bugs, but it cannot rescue a weak authority model. Start by making consent, signatories, and choice control explicit.
Daml removes many low-level smart contract risks, but it cannot fix a bad security model. The most serious Daml issues usually involve authority, privacy, economic rules, or workflows that look correct but fail in edge cases.
- Write down each party, what it may see, and what it may approve before defining templates.
- Keep
signatory,observer, andcontrollerroles separate; visibility does not automatically grant authority. - Take controllers from trusted contract state, never from a party supplied by the caller.
- Use a proposal-and-acceptance flow when a new obligation needs another party's consent.
- Check whether archival, delegation, or a
nonconsumingchoice lets one party remove rights or repeat authority unexpectedly.
The SCAS guide to common Daml vulnerabilities explains caller-controlled authorization and unsafe delegation. For bilateral consent, use Digital Asset's Propose and Accept pattern.
01choice Withdraw : ()02 with03 requestor : Party04 amount : Decimal05 controller requestor06 do07 pure ()01choice Withdraw : ContractId Vault02 with03 amount : Decimal04 controller owner05 do06 assertMsg "Invalid amount" (amount > 0.0 && amount <= balance)07 create this with balance = balance - amount