Skip to content

docs(canton): sync the Canton section with canton-contracts and canton-specs - #252

Open
pepebndc wants to merge 7 commits into
mainfrom
docs/canton-current-sources
Open

pepebndc wants to merge 7 commits into
mainfrom
docs/canton-current-sources

Conversation

@pepebndc

@pepebndc pepebndc commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR makes the Canton section match OpenZeppelin/canton-contracts main (1899f7a) and OpenZeppelin/canton-specs main. It includes the commits of #240.

Changes

  • New page: Library > Scoped Authorization Grant. Documents openzeppelin-scoped-authorization-grant-v1: types, grant lifecycle, guards, typed policies, scope and resource identity, disclosure and confirmation requirements, failure statuses, security considerations, and the licensing and treasury RBAC examples.
  • Token (CIP-0112). Documents the three packages under packages/token/ (types-v1, utils, v1): templates, lifecycle (transfer, mint offer, burn, batch and iterated settlement), the utils trust rules for consumers that own their templates, security considerations, data-dependencies on the Splice 0.8.3 interface DARs, and the test gates.
  • Removed pages: Access Control, Ownable, and Settlement. netlify.toml redirects them with 301s: Settlement to Token, Access Control and Ownable to Scoped Authorization Grant.
  • Overview and Library overview. All packages are pre-release. The package table lists the current modules.
  • Get Started. SDK baseline 3.5.8, the current directories and examples, and the separate test package for Daml Script tests.
  • Reference Implementations. The four summaries follow the current design documents. The DEX summary notes that its design document still references the retired Access Control package.

Verification

  • biome check src/navigation/canton.json and the link validator pass.
  • next dev: all Canton pages render with status 200.
  • The Token page's data-dependencies and imports compile against DARs built from canton-contracts main. The Scoped Authorization Grant API on the page compiles against the package DAR.

Add a Token (CIP-0112) library page for openzeppelin-tokenCIP112-v1 and
remove the settlement page. Correct the library, setup, and reference
implementation pages against the current sources. Rewrite the prose to be
shorter and more direct.
…nt sources

Add the Scoped Authorization Grant page and remove the Access Control and
Ownable pages, which canton-contracts no longer contains. Update the SDK
baseline to 3.5.8, the package paths, the token test gates, and the
Reference Implementation summaries to the current design documents.
@pepebndc
pepebndc requested review from a team and stevep0z as code owners October 20, 2026 10:10
@netlify

netlify Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for openzeppelin-docs-v2 ready!

Name Link
🔨 Latest commit f5f9c11
🔍 Latest deploy log https://app.netlify.com/projects/openzeppelin-docs-v2/deploys/6ae3652ac2e4c64e643a8528
😎 Deploy Preview https://deploy-preview-252--openzeppelin-docs-v2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@laurenmxv laurenmxv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Pepe, this is great. The Pausable page in particular is really good, and the SCU retrofit section covers something people get wrong all the time.

Two things outside the line comments:

Token page. canton-contracts#45 (merged 21 Oct) reworked the token package (new paths, three packages, allowances and compliance hooks removed), so the page no longer matches main. I'd suggest pulling it out of this PR so everything else can ship, and doing the token page separately. I'll message you on Slack.

Redirects. This PR deletes /canton/settlement, /canton/library/access-control and /canton/library/ownable. Those URLs are live now, so after merge anyone arriving from search, a forum post or a partner's link lands on a 404. A 301 sends them to the replacement page and carries over most of the old pages' search value. Adding this to netlify.toml covers it:

# Canton

[[redirects]]
from = "/canton/settlement"
to = "/canton/library"
status = 301

[[redirects]]
from = "/canton/library/access-control"
to = "/canton/library/scoped-authorization-grant"
status = 301

[[redirects]]
from = "/canton/library/ownable"
to = "/canton/library/scoped-authorization-grant"
status = 301

Settlement can point to the token page once that lands.

Every scope field must match exactly.

- `resourceInstanceCid = None` matches by logical fields only, so a grant applies to successor contracts.
- `resourceInstanceCid = Some cid` binds the grant to one contract ID. The guard compares IDs; it does not fetch the resource.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't compile as written. resourceInstanceCid is Optional (ContractId ()), so passing a typed ID like Some self is a type error. Both examples and the README wrap it with coerceContractId.

Suggested change
- `resourceInstanceCid = Some cid` binds the grant to one contract ID. The guard compares IDs; it does not fetch the resource.
- `resourceInstanceCid = Some (coerceContractId cid)` binds the grant to one contract ID. The guard compares IDs; it does not fetch the resource.

-- protected effects
```

`requireAuthorization` fetches the grant, checks the authority, the grantee, and the scope, then exercises `AuthorizationGrant_Use`. It returns the grant.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things people will hit the first time they wire this up. Both are in the package README, but they belong here too:

Suggested change
`requireAuthorization` fetches the grant, checks the authority, the grantee, and the scope, then exercises `AuthorizationGrant_Use`. It returns the grant.
`requireAuthorization` fetches the grant, checks the authority, the grantee, and the scope, then exercises `AuthorizationGrant_Use`. It returns the grant.
The grantee is usually not a stakeholder of the protected contract, so a stakeholder has to disclose that contract to the grantee before it can exercise the choice. Each guarded call also brings in the grant's `authority` as a confirming party, so the authority's participant must be online for every protected call. Prefer an authority that already signs the protected contract.

## Test Against a Local Ledger

Daml Script tests run in-memory by default, but you can point the same scripts at a real local Canton ledger over gRPC, which is useful for validating time semantics, party visibility, and DAR uploads before targeting a shared network:
`dpm test` runs Daml Script tests on an in-memory ledger. To check time behavior, party visibility, and DAR upload on a real ledger, run the same scripts against a local Canton sandbox over the Ledger API:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following the page as written, the first test won't build, because the daml.yaml above doesn't include daml-script. Adding it to the app package works but makes damlc warn that templates depend on Daml Script, so a separate test package is the cleaner pattern. That's also how the library does it under test/.

Suggested change
`dpm test` runs Daml Script tests on an in-memory ledger. To check time behavior, party visibility, and DAR upload on a real ledger, run the same scripts against a local Canton sandbox over the Ledger API:
Keep your Daml Script tests in a separate test package: list `daml-script` under `dependencies`, and your application DAR (plus any library DARs the tests import) under `data-dependencies`. Adding `daml-script` to the application package itself makes `damlc` warn that its templates depend on Daml Script. In the commands below, start the sandbox with your application DAR and pass the test package's DAR to `dpm script`.
`dpm test` runs Daml Script tests on an in-memory ledger. To check time behavior, party visibility, and DAR upload on a real ledger, run the same scripts against a local Canton sandbox over the Ledger API:

The DEX settles through the Token Standard V2 interfaces, so it works with any conforming token registry.

## Lending Protocol
**Design document:** [Privacy-Preserving DEX](https://github.com/OpenZeppelin/canton-specs/blob/main/docs/reference-architectures/dex.md)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DEX design doc still lists openzeppelin-access-control-v1 as a component, and this PR removes that package from the docs. A short note would save readers some confusion until the design doc catches up.

Suggested change
**Design document:** [Privacy-Preserving DEX](https://github.com/OpenZeppelin/canton-specs/blob/main/docs/reference-architectures/dex.md)
The design document still references the retired Access Control package. The library now provides [Scoped Authorization Grant](/canton/library/scoped-authorization-grant) instead.
**Design document:** [Privacy-Preserving DEX](https://github.com/OpenZeppelin/canton-specs/blob/main/docs/reference-architectures/dex.md)

…eedback

Rewrite the Token page for the three packages under packages/token. Mark
every package pre-release. Add 301 redirects for the removed Settlement,
Access Control, and Ownable pages. Document grant disclosure and the
authority as a confirming party, the test-package pattern in Get Started,
and the retired package in the DEX design document.
@pepebndc pepebndc changed the title docs(canton): document Scoped Authorization Grant and sync with current sources docs(canton): sync the Canton section with canton-contracts and canton-specs Oct 29, 2026
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.

2 participants