@openzeppelin/compact-contracts 0.3.0-alpha.1 → 0.4.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +10 -4
  2. package/access/AccessControl.compact +2 -2
  3. package/access/Ownable.compact +2 -2
  4. package/access/ShieldedAccessControl.compact +2 -2
  5. package/access/ZOwnablePK.compact +2 -2
  6. package/crypto/EcdhMask.compact +5 -5
  7. package/crypto/Ecdsa.compact +111 -0
  8. package/crypto/ElGamal.compact +33 -66
  9. package/multisig/EcdsaSignerManager.compact +229 -0
  10. package/multisig/ForwarderPrivate.compact +3 -3
  11. package/multisig/ForwarderShielded.compact +3 -3
  12. package/multisig/ForwarderUnshielded.compact +3 -3
  13. package/multisig/ProposalManager.compact +36 -2
  14. package/multisig/ShieldedTreasury.compact +35 -5
  15. package/multisig/ShieldedTreasuryStateless.compact +47 -18
  16. package/multisig/Signer.compact +46 -42
  17. package/multisig/UnshieldedTreasury.compact +45 -18
  18. package/multisig/presets/ShieldedMultiSig.compact +5 -5
  19. package/multisig/presets/ShieldedMultiSigV2.compact +72 -127
  20. package/multisig/presets/ShieldedMultiSigV3.compact +83 -140
  21. package/multisig/presets/forwarder/ForwarderPrivate.compact +2 -2
  22. package/multisig/presets/forwarder/ForwarderShielded.compact +2 -2
  23. package/multisig/presets/forwarder/ForwarderUnshielded.compact +2 -2
  24. package/package.json +22 -20
  25. package/security/Allowlist.compact +2 -2
  26. package/security/Blocklist.compact +2 -2
  27. package/security/Initializable.compact +2 -2
  28. package/security/Pausable.compact +2 -2
  29. package/token/ConfidentialFungibleToken.compact +46 -18
  30. package/token/FungibleToken.compact +2 -2
  31. package/token/MultiToken.compact +2 -2
  32. package/token/NativeShieldedToken.compact +3 -3
  33. package/token/NativeShieldedTokenCore.compact +2 -2
  34. package/token/NativeShieldedTokenFamily.compact +3 -3
  35. package/token/NonFungibleToken.compact +2 -2
  36. package/token/extensions/ConfidentialFungibleTokenPublicSupply.compact +2 -2
  37. package/token/extensions/NativeShieldedTokenDerivedNonce.compact +2 -2
  38. package/token/extensions/{NativeShieldedTokenFamilySupply.compact → NativeShieldedTokenFamilyPublicSupply.compact} +10 -10
  39. package/token/extensions/{NativeShieldedTokenSupply.compact → NativeShieldedTokenPublicSupply.compact} +10 -10
  40. package/token/extensions/{NativeShieldedTokenSupplyCore.compact → NativeShieldedTokenPublicSupplyCore.compact} +10 -10
  41. package/utils/Utils.compact +2 -2
  42. package/multisig/SignerManager.compact +0 -205
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.3.0-alpha.1 (multisig/presets/forwarder/ForwarderPrivate.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (multisig/presets/forwarder/ForwarderPrivate.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
7
  * @title ForwarderPrivate
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.3.0-alpha.1 (multisig/presets/forwarder/ForwarderShielded.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (multisig/presets/forwarder/ForwarderShielded.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
7
  * @title ForwarderShielded
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.3.0-alpha.1 (multisig/presets/forwarder/ForwarderUnshielded.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (multisig/presets/forwarder/ForwarderUnshielded.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
7
  * @title ForwarderUnshielded
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openzeppelin/compact-contracts",
3
- "version": "0.3.0-alpha.1",
3
+ "version": "0.4.0-alpha.1",
4
4
  "description": "OpenZeppelin Compact contract library",
5
5
  "keywords": [
6
6
  "openzeppelin",
@@ -27,12 +27,12 @@
27
27
  "compile": "compact-compiler --exclude '*/archive/*'",
28
28
  "compile:access": "compact-compiler --dir access",
29
29
  "compile:archive": "compact-compiler --dir archive",
30
- "compile:crypto": "compact-compiler --dir crypto",
31
- "compile:multisig": "compact-compiler --dir multisig",
30
+ "compile:crypto": "compact-compiler --dir crypto --feature-zkir-v3",
31
+ "compile:multisig": "compact-compiler --dir multisig --feature-zkir-v3",
32
32
  "compile:security": "compact-compiler --dir security",
33
33
  "compile:token": "compact-compiler --dir token",
34
34
  "compile:utils": "compact-compiler --dir utils",
35
- "compile:integration": "SKIP_ZK=true compact-compiler --src test/integration/_mocks",
35
+ "compile:integration": "compact-compiler --src test/integration/_mocks",
36
36
  "build": "compact-builder --hierarchical --out dist --clean-dist --exclude '*/archive/*' --exclude 'Mock*' --exclude '*.mock.compact' --copy package.json --copy ../README.md && find dist -type d -empty -delete",
37
37
  "test": "vitest run --project unit",
38
38
  "test:coverage": "vitest run --project unit --coverage",
@@ -46,24 +46,26 @@
46
46
  "node": ">=22"
47
47
  },
48
48
  "dependencies": {
49
- "@openzeppelin/compact-cli": "^0.0.2"
49
+ "@openzeppelin/compact-cli": "^0.0.3"
50
50
  },
51
51
  "devDependencies": {
52
- "@midnight-ntwrk/compact-js": "2.5.1",
53
- "@midnight-ntwrk/compact-runtime": "0.16.0",
54
- "@midnight-ntwrk/ledger-v8": "8.1.0",
55
- "@midnight-ntwrk/midnight-js-contracts": "4.1.1",
56
- "@midnight-ntwrk/midnight-js-http-client-proof-provider": "4.1.1",
57
- "@midnight-ntwrk/midnight-js-indexer-public-data-provider": "4.1.1",
58
- "@midnight-ntwrk/midnight-js-network-id": "4.1.1",
59
- "@midnight-ntwrk/midnight-js-node-zk-config-provider": "4.1.1",
60
- "@midnight-ntwrk/midnight-js-protocol": "4.1.1",
61
- "@midnight-ntwrk/midnight-js-types": "4.1.1",
62
- "@midnight-ntwrk/testkit-js": "4.1.1",
63
- "@openzeppelin/compact-simulator": "^0.2.0",
64
- "@tsconfig/node24": "^24.0.4",
65
- "@types/node": "26.1.1",
66
- "@vitest/coverage-v8": "^4.1.10",
52
+ "@midnight-ntwrk/compact-js": "2.5.5-rc.8",
53
+ "@midnight-ntwrk/compact-runtime": "0.19.0",
54
+ "@midnight-ntwrk/midnight-js-contracts": "5.0.0-beta.7",
55
+ "@midnight-ntwrk/midnight-js-http-client-proof-provider": "5.0.0-beta.7",
56
+ "@midnight-ntwrk/midnight-js-indexer-public-data-provider": "5.0.0-beta.7",
57
+ "@midnight-ntwrk/midnight-js-network-id": "5.0.0-beta.7",
58
+ "@midnight-ntwrk/midnight-js-node-zk-config-provider": "5.0.0-beta.7",
59
+ "@midnight-ntwrk/midnight-js-protocol": "5.0.0-beta.7",
60
+ "@midnight-ntwrk/midnight-js-types": "5.0.0-beta.7",
61
+ "@midnight-ntwrk/testkit-js": "5.0.0-beta.7",
62
+ "@midnightntwrk/ledger-v9": "1.0.0-rc.3",
63
+ "@midnightntwrk/wallet-sdk-address-format": "4.0.0-beta.2",
64
+ "@noble/curves": "^2.2.0",
65
+ "@openzeppelin/compact-simulator": "^0.4.0",
66
+ "@tsconfig/node24": "^24.0.5",
67
+ "@types/node": "26.4.0",
68
+ "@vitest/coverage-v8": "^4.1.11",
67
69
  "fast-check": "^4.9.0",
68
70
  "ts-node": "^10.9.2",
69
71
  "typescript": "^6.0.3",
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.3.0-alpha.1 (security/Allowlist.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (security/Allowlist.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
7
  * @module Allowlist
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.3.0-alpha.1 (security/Blocklist.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (security/Blocklist.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
7
  * @module Blocklist
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.3.0-alpha.1 (security/Initializable.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (security/Initializable.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
7
  * @module Initializable
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.3.0-alpha.1 (security/Pausable.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (security/Pausable.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
7
  * @module Pausable
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.3.0-alpha.1 (token/ConfidentialFungibleToken.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (token/ConfidentialFungibleToken.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
7
  * @module ConfidentialFungibleToken
@@ -70,6 +70,14 @@ pragma language_version >= 0.23.0;
70
70
  * depth), but that counter RESETS on `clearMemos`, so it is an in-epoch
71
71
  * backstop only, never a substitute for freshness.
72
72
  *
73
+ * Seed generation is a WALLET responsibility and OUT OF SCOPE for this
74
+ * contract, which cannot enforce it. The witness shipped in this repo
75
+ * (`test/witnesses/ConfidentialFungibleTokenWitnesses.ts`) is TEST-ONLY and
76
+ * returns a FIXED seed for reproducibility; it is NOT a production wallet. A
77
+ * production integration MUST supply a fresh, high-entropy, secret 32-byte seed
78
+ * per invocation from a CSPRNG; there is no production reference witness here, so
79
+ * confidentiality is only as strong as that external, not-yet-built wallet layer.
80
+ *
73
81
  * @dev Plaintext disclosures (what reaches the public ledger):
74
82
  * - This base discloses no amounts; supply accounting lives in a layer.
75
83
  * - A public-supply layer reveals each mint/burn amount via the totalSupply
@@ -119,6 +127,17 @@ pragma language_version >= 0.23.0;
119
127
  * calls dominate the credit-path row counts; there is currently no cheaper,
120
128
  * upgrade-safe hasher available.
121
129
  *
130
+ * @dev Runtime trust boundary. Confidentiality and integrity rest on the
131
+ * Midnight runtime enforcing two curve invariants this module does NOT re-check:
132
+ * every JubjubPoint reaching a curve op is cofactor-cleared into the prime-order
133
+ * subgroup (so off-curve, low-order, or mixed-order points make the circuit
134
+ * unsatisfiable), and a scalar >= the subgroup order is rejected. These are
135
+ * regression-pinned with adversarial inputs in
136
+ * `crypto/test/CurveRuntimeInvariants.test.ts`, which fails loudly if a future
137
+ * runtime stops enforcing them. That is behavioral verification of the shipped
138
+ * runtime, NOT a formal audit of its circuit implementation (`midnight-circuits`),
139
+ * which remains an external trust assumption.
140
+ *
122
141
  * @dev Caller-identity gating (composability). This module is unopinionated
123
142
  * about compliance policy (freeze, KYC, pause); a composing contract layers
124
143
  * that on top. Gating a circuit on an EXPLICIT argument (e.g. the recipient
@@ -147,18 +166,27 @@ pragma language_version >= 0.23.0;
147
166
  * conflict. Documented limitation; acceptable for the v1 target use case
148
167
  * (tokenized deposits).
149
168
  *
169
+ * Domain separation. The memo KDF and per-operation randomness are
170
+ * domain-separated by a version tag but NOT bound to a chain id or
171
+ * contract-instance identifier, so cross-DEPLOYMENT isolation (the same wallet
172
+ * seed reused against two instances or two chains) relies on the seed-freshness
173
+ * requirement above rather than on the derivation itself. Binding `kernel.self()`
174
+ * into the derivations is a possible defense-in-depth hardening; under review, deferred.
175
+ *
150
176
  * Block weight. A deploy bundles every exported entry point's on-chain IR into
151
177
  * one transaction, and the value circuits are SHA256-heavy (k=16), so a
152
- * full-surface deployment can exceed the node's per-transaction block byte
153
- * budget and be rejected (`1010: Transaction would exhaust the block limits`).
154
- * The full token surface exceeds it; a reduced surface (e.g. receive +
155
- * transfer, dropping allowances and supply accounting) fits, as measured on the
156
- * local ledger-8 dev stack. The lever is dropping the k=16 value operations a
157
- * deployment does not need, not just trimming getters. The limit is a
158
- * governance-configurable, node-side ledger parameter, so confirm against the
159
- * target network. Keep the deployed circuit surface small (drop
160
- * unused getters, split oversized composites); raising the limit is a
161
- * node-side change which is tracked upstream:
178
+ * full-surface deployment is byte-heavy. Whether it fits is a property of the
179
+ * target network, not the contract: the per-transaction block byte budget is a
180
+ * governance-configurable, node-side ledger parameter. On the local ledger-8 dev
181
+ * stack the full surface exceeded it and was rejected (`1010: Transaction would
182
+ * exhaust the block limits`), while a reduced surface (e.g. receive + transfer,
183
+ * dropping allowances and supply accounting) fit. So confirm deployability
184
+ * against the target network; if a deployment is over budget there, the lever is
185
+ * exposing only the k=16 value operations it needs, not just trimming getters.
186
+ * A deployed contract can also be upgraded by its Contract Maintenance Authority
187
+ * (CMA), so an over-budget deployment can start with a lean surface and add
188
+ * operations by upgrade instead of fitting the whole surface into one deploy.
189
+ * Raising the limit itself is a node-side change, tracked upstream:
162
190
  * https://github.com/midnightntwrk/midnight-node/issues/1202.
163
191
  *
164
192
  * Residual griefing. The dual-balance split (see `sweep`) stops dust
@@ -625,9 +653,9 @@ module ConfidentialFungibleToken {
625
653
  const seed = wit_RandomnessSeed();
626
654
 
627
655
  // Randomness must be a VALID Jubjub scalar. `transientHash`'s raw Field output
628
- // can exceed the Jubjub scalar-field order and fault `ecMulGenerator`, so each
629
- // scalar is derived via `degradeToTransient(persistentHash(...))`, which
630
- // truncates into the scalar field. The per-recipient count, folded into a
656
+ // can exceed the Jubjub scalar-field order, so each scalar is derived via
657
+ // `degradeToTransient(persistentHash(...))`, which truncates into the scalar
658
+ // field. The per-recipient count, folded into a
631
659
  // Bytes<32> nonce, keeps each credit's randomness unique even if the seed
632
660
  // repeats (essential for the memo OTP). This inlines the tag + expansion into
633
661
  // a single hash per scalar. The residual persistentHash cost is poseidon-gated
@@ -641,10 +669,10 @@ module ConfidentialFungibleToken {
641
669
  const countHash = persistentHash<Field>(count);
642
670
  const rBalance = degradeToTransient(
643
671
  persistentHash<Vector<4, Bytes<32>>>([seed, pad(32, "credit_balance"), account, countHash])
644
- );
672
+ ) as JubjubScalar;
645
673
  const e = degradeToTransient(
646
674
  persistentHash<Vector<4, Bytes<32>>>([seed, pad(32, "credit_memo"), account, countHash])
647
- );
675
+ ) as JubjubScalar;
648
676
 
649
677
  // Credit lands in the recipient's PENDING pool (not spendable), so incoming
650
678
  // value never churns their spendable ciphertext; they sweep it when ready.
@@ -1139,7 +1167,7 @@ module ConfidentialFungibleToken {
1139
1167
  // never decrypted. Use an on-curve identity point (never a `default`,
1140
1168
  // which is off-curve).
1141
1169
  ownerMemo: EcdhMask_Ciphertext {
1142
- ephemeralPk: ecMulGenerator(0 as Field),
1170
+ ephemeralPk: ecMulGenerator(0 as JubjubScalar),
1143
1171
  ct: 0 as Field
1144
1172
  }
1145
1173
  })
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.3.0-alpha.1 (token/FungibleToken.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (token/FungibleToken.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
7
  * @module FungibleToken
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.3.0-alpha.1 (token/MultiToken.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (token/MultiToken.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
7
  * @module MultiToken
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.3.0-alpha.1 (token/NativeShieldedToken.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (token/NativeShieldedToken.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
7
  * @module NativeShieldedToken
@@ -45,7 +45,7 @@ pragma language_version >= 0.23.0;
45
45
  * recipient-public.
46
46
  *
47
47
  * @notice Supply accounting is opt-in: this module tracks NO supply totals.
48
- * Compose the optional `NativeShieldedTokenSupply` extension only if you need an
48
+ * Compose the optional `NativeShieldedTokenPublicSupply` extension only if you need an
49
49
  * on-chain `totalSupply()`; see it for the privacy trade-off it introduces (it
50
50
  * makes contract-mediated burn amounts public).
51
51
  *
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.3.0-alpha.1 (token/NativeShieldedTokenCore.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (token/NativeShieldedTokenCore.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
7
  * @module NativeShieldedTokenCore
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.3.0-alpha.1 (token/NativeShieldedTokenFamily.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (token/NativeShieldedTokenFamily.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
7
  * @module NativeShieldedTokenFamily
@@ -53,7 +53,7 @@ pragma language_version >= 0.23.0;
53
53
  * output, at the cost of making those mints recipient-public.
54
54
  *
55
55
  * @notice Supply accounting is opt-in: this module tracks NO supply totals.
56
- * Compose the optional `NativeShieldedTokenFamilySupply` extension only if you
56
+ * Compose the optional `NativeShieldedTokenFamilyPublicSupply` extension only if you
57
57
  * need an on-chain `totalSupply(domain)`; see it for the privacy trade-off it
58
58
  * introduces (it makes contract-mediated burn amounts public).
59
59
  *
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.3.0-alpha.1 (token/NonFungibleToken.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (token/NonFungibleToken.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
7
  * @module NonFungibleToken
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.3.0-alpha.1 (token/extensions/ConfidentialFungibleTokenPublicSupply.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (token/extensions/ConfidentialFungibleTokenPublicSupply.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
7
  * @module ConfidentialFungibleTokenPublicSupply
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.3.0-alpha.1 (token/extensions/NativeShieldedTokenDerivedNonce.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (token/extensions/NativeShieldedTokenDerivedNonce.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
7
  * @module NativeShieldedTokenDerivedNonce
@@ -1,16 +1,16 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.2.0 (token/extensions/NativeShieldedTokenFamilySupply.compact)
2
+ // OpenZeppelin Compact Contracts v0.2.0 (token/extensions/NativeShieldedTokenFamilyPublicSupply.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
- * @module NativeShieldedTokenFamilySupply
7
+ * @module NativeShieldedTokenFamilyPublicSupply
8
8
  * @description Optional standalone extension that adds per-domain on-chain
9
9
  * supply accounting to a `NativeShieldedTokenFamily`. It exposes `_addMinted` /
10
10
  * `_addBurned` building blocks plus the `totalMinted` / `totalBurned` /
11
11
  * `totalSupply` getters, each keyed by domain. It imports no token module.
12
12
  *
13
- * It is a thin wrapper over `NativeShieldedTokenSupplyCore`, forwarding the
13
+ * It is a thin wrapper over `NativeShieldedTokenPublicSupplyCore`, forwarding the
14
14
  * caller's per-call `domain`, so the accounting logic and guarantees live in
15
15
  * the shared core.
16
16
  *
@@ -51,25 +51,25 @@ pragma language_version >= 0.23.0;
51
51
  *
52
52
  * @dev Mint amounts are already public via the protocol's `shieldedMints`
53
53
  * effect, so `_addMinted` adds accounting, not disclosure. See
54
- * `NativeShieldedTokenSupplyCore` for the exact / lower-bound / upper-bound
54
+ * `NativeShieldedTokenPublicSupplyCore` for the exact / lower-bound / upper-bound
55
55
  * guarantees, the per-domain `burned <= minted` invariant, and the mint-side
56
56
  * drift caveat.
57
57
  *
58
58
  * @warning Pair every mint with `_addMinted` and every burn with `_addBurned` on
59
59
  * every path, under the matching domain; mis-wiring is a security-critical,
60
60
  * undetectable error (e.g. an undercounted mint makes `_addBurned` reject
61
- * legitimate burns). See `NativeShieldedTokenSupplyCore`.
61
+ * legitimate burns). See `NativeShieldedTokenPublicSupplyCore`.
62
62
  */
63
- module NativeShieldedTokenFamilySupply {
63
+ module NativeShieldedTokenFamilyPublicSupply {
64
64
  import CompactStandardLibrary;
65
- import "./NativeShieldedTokenSupplyCore" prefix Core_;
65
+ import "./NativeShieldedTokenPublicSupplyCore" prefix Core_;
66
66
 
67
67
  // Circuits use the `Core_` prefix above. The named import/re-export below is
68
68
  // only for the core supply ledger keys, so the implementing contract's ledger
69
69
  // keys read as `_totalMinted` / `_totalBurned` rather than
70
- // `NativeShieldedTokenSupplyCore__totalMinted`. The circuit names are
70
+ // `NativeShieldedTokenPublicSupplyCore__totalMinted`. The circuit names are
71
71
  // intentionally NOT imported unprefixed, to avoid potential clashes.
72
- import { _totalMinted, _totalBurned } from "./NativeShieldedTokenSupplyCore";
72
+ import { _totalMinted, _totalBurned } from "./NativeShieldedTokenPublicSupplyCore";
73
73
  export { _totalMinted, _totalBurned };
74
74
 
75
75
  /**
@@ -1,16 +1,16 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.2.0 (token/extensions/NativeShieldedTokenSupply.compact)
2
+ // OpenZeppelin Compact Contracts v0.2.0 (token/extensions/NativeShieldedTokenPublicSupply.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
- * @module NativeShieldedTokenSupply
7
+ * @module NativeShieldedTokenPublicSupply
8
8
  * @description Optional standalone extension that adds on-chain supply
9
9
  * accounting to a `NativeShieldedToken`. It exposes scalar `_addMinted` /
10
10
  * `_addBurned` building blocks plus the `totalMinted` / `totalBurned` /
11
11
  * `totalSupply` getters. It imports no token module.
12
12
  *
13
- * It is a thin wrapper over `NativeShieldedTokenSupplyCore`, forwarding a
13
+ * It is a thin wrapper over `NativeShieldedTokenPublicSupplyCore`, forwarding a
14
14
  * single fixed key (the paired contract has exactly one token type), so the
15
15
  * accounting logic and guarantees live in the shared core.
16
16
  *
@@ -48,24 +48,24 @@ pragma language_version >= 0.23.0;
48
48
  *
49
49
  * @dev Mint amounts are already public via the protocol's `shieldedMints`
50
50
  * effect, so `_addMinted` adds accounting, not disclosure. See
51
- * `NativeShieldedTokenSupplyCore` for the exact / lower-bound / upper-bound
51
+ * `NativeShieldedTokenPublicSupplyCore` for the exact / lower-bound / upper-bound
52
52
  * guarantees, the `burned <= minted` invariant, and the mint-side drift caveat.
53
53
  *
54
54
  * @warning Pair every mint with `_addMinted` and every burn with `_addBurned` on
55
55
  * every path; mis-wiring is a security-critical, undetectable error (e.g. an
56
56
  * undercounted mint makes `_addBurned` reject legitimate burns). See
57
- * `NativeShieldedTokenSupplyCore`.
57
+ * `NativeShieldedTokenPublicSupplyCore`.
58
58
  */
59
- module NativeShieldedTokenSupply {
59
+ module NativeShieldedTokenPublicSupply {
60
60
  import CompactStandardLibrary;
61
- import "./NativeShieldedTokenSupplyCore" prefix Core_;
61
+ import "./NativeShieldedTokenPublicSupplyCore" prefix Core_;
62
62
 
63
63
  // Circuits use the `Core_` prefix above. The named import/re-export below is
64
64
  // only for the core supply ledger keys, so the implementing contract's ledger
65
65
  // keys read as `_totalMinted` / `_totalBurned` rather than
66
- // `NativeShieldedTokenSupplyCore__totalMinted`. The circuit names are
66
+ // `NativeShieldedTokenPublicSupplyCore__totalMinted`. The circuit names are
67
67
  // intentionally NOT imported unprefixed, to avoid potential clashes.
68
- import { _totalMinted, _totalBurned } from "./NativeShieldedTokenSupplyCore";
68
+ import { _totalMinted, _totalBurned } from "./NativeShieldedTokenPublicSupplyCore";
69
69
  export { _totalMinted, _totalBurned };
70
70
 
71
71
  /**
@@ -1,10 +1,10 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.2.0 (token/extensions/NativeShieldedTokenSupplyCore.compact)
2
+ // OpenZeppelin Compact Contracts v0.2.0 (token/extensions/NativeShieldedTokenPublicSupplyCore.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
- * @module NativeShieldedTokenSupplyCore
7
+ * @module NativeShieldedTokenPublicSupplyCore
8
8
  * @description Shared, domain-keyed core of the optional supply-accounting
9
9
  * extension. It owns the per-domain minted/burned maps and exposes the
10
10
  * `_addMinted` / `_addBurned` building blocks plus the `totalMinted` /
@@ -13,12 +13,12 @@ pragma language_version >= 0.23.0;
13
13
  * This module is NOT meant to be composed directly. It is the de-duplicated
14
14
  * base behind the two user-facing flavors:
15
15
  *
16
- * - `NativeShieldedTokenSupply` — pairs with `NativeShieldedToken`; forwards a
16
+ * - `NativeShieldedTokenPublicSupply` — pairs with `NativeShieldedToken`; forwards a
17
17
  * single fixed key (the contract has one token type).
18
- * - `NativeShieldedTokenFamilySupply` — pairs with `NativeShieldedTokenFamily`;
18
+ * - `NativeShieldedTokenFamilyPublicSupply` — pairs with `NativeShieldedTokenFamily`;
19
19
  * forwards the caller's per-call `domain`.
20
20
  *
21
- * @dev Assertion messages use the generic `NativeShieldedTokenSupply:` prefix
21
+ * @dev Assertion messages use the generic `NativeShieldedTokenPublicSupply:` prefix
22
22
  * so they read sensibly from either flavor. There is no initialization: an
23
23
  * absent domain key reads as 0, and the getters do not gate on the paired token
24
24
  * module's init flag (a counter reading 0 before init is correct), so init
@@ -51,7 +51,7 @@ pragma language_version >= 0.23.0;
51
51
  * overstates circulating supply.
52
52
  * Call the matching accounting block on every mint and burn path, same domain.
53
53
  */
54
- module NativeShieldedTokenSupplyCore {
54
+ module NativeShieldedTokenPublicSupplyCore {
55
55
  import CompactStandardLibrary;
56
56
  import "../../utils/Utils" prefix Utils_;
57
57
 
@@ -79,7 +79,7 @@ module NativeShieldedTokenSupplyCore {
79
79
  */
80
80
  export circuit _addMinted(domain: Bytes<32>, amount: Uint<64>): [] {
81
81
  const current = totalMinted(domain);
82
- assert(Utils_UINT128_MAX() - current >= amount, "NativeShieldedTokenSupply: arithmetic overflow");
82
+ assert(Utils_UINT128_MAX() - current >= amount, "NativeShieldedTokenPublicSupply: arithmetic overflow");
83
83
  _totalMinted.insert(disclose(domain), disclose((current + amount) as Uint<128>));
84
84
  }
85
85
 
@@ -103,8 +103,8 @@ module NativeShieldedTokenSupplyCore {
103
103
  // First guards the subtraction below from underflowing on an already-corrupt
104
104
  // state (stored burned past minted); the second is the reachable per-call
105
105
  // check that this burn does not push the domain past its minted total.
106
- assert(minted >= current, "NativeShieldedTokenSupply: burned total exceeds minted");
107
- assert(minted - current >= amount, "NativeShieldedTokenSupply: burn exceeds available supply");
106
+ assert(minted >= current, "NativeShieldedTokenPublicSupply: burned total exceeds minted");
107
+ assert(minted - current >= amount, "NativeShieldedTokenPublicSupply: burn exceeds available supply");
108
108
  _totalBurned.insert(disclose(domain), disclose((current + amount) as Uint<128>));
109
109
  }
110
110
 
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.3.0-alpha.1 (utils/Utils.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (utils/Utils.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
7
  * @module Utils.