alberta-buck-contracts 0.1.0 → 0.2.0
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.
- package/README.md +48 -2
- package/compiler.json +39 -2
- package/contracts.json +8249 -2819
- package/index.d.ts +15 -0
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -2,14 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
Compiled ABI and bytecode for the Alberta Buck contracts: the BUCK token
|
|
4
4
|
(`Buck`), the insured asset NFT (`BuckCredit`), the on-chain PID controller
|
|
5
|
-
(`BuckKControllerDirect`), the identity accumulator (`IdentityRegistry`)
|
|
6
|
-
|
|
5
|
+
(`BuckKControllerDirect`), the identity accumulator (`IdentityRegistry`) and
|
|
6
|
+
the Poseidon hashers it takes, the Notes pool (`Notes`) with its verifier
|
|
7
|
+
adapters and Groth16 verifiers, the two baskets, and the simulation helpers.
|
|
7
8
|
|
|
8
9
|
**Unaudited prototype software for a monetary system.** These contracts have
|
|
9
10
|
never been audited. They are published so the research and simulations can be
|
|
10
11
|
reproduced and built on -- not so they can be deployed with other people's
|
|
11
12
|
money behind them.
|
|
12
13
|
|
|
14
|
+
## The Groth16 verifiers come from a DEVELOPMENT trusted setup
|
|
15
|
+
|
|
16
|
+
**Until v1.0.0, every Groth16 verifier in this package -- the batch-mint
|
|
17
|
+
verifiers, the spend verifier, the two folded deposit gates and the B1
|
|
18
|
+
membership verifier -- comes from a development trusted setup.** The setup
|
|
19
|
+
scripts contribute fixed entropy that is published in the repository
|
|
20
|
+
(`scripts/snark/setup*.sh`), so the toxic waste is public: **anyone can forge
|
|
21
|
+
a proof that these verifiers accept.**
|
|
22
|
+
|
|
23
|
+
That is deliberate, and it is why they are published at all: with the
|
|
24
|
+
toxic waste in hand, a simulation can model what an attacker holding a forged
|
|
25
|
+
proof could do, and test the defences around the proof -- the batch
|
|
26
|
+
signatures, the issuer bindings, the nullifier set -- which a production
|
|
27
|
+
setup would make impossible to exercise. It also means none of this may
|
|
28
|
+
guard anything of value. A production release will run a multi-party
|
|
29
|
+
ceremony, and will say so.
|
|
30
|
+
|
|
31
|
+
The bundle carries the same warning as data: every verifier's artifact has
|
|
32
|
+
`"trustedSetup": "development"`, and the compiler record's `trustedSetup`
|
|
33
|
+
names the setup and lists the verifiers.
|
|
34
|
+
|
|
13
35
|
## Nothing here has an address
|
|
14
36
|
|
|
15
37
|
No Alberta Buck contract is deployed at a fixed address, on any chain. Every
|
|
@@ -47,6 +69,30 @@ abi, bytecode = artifact("Buck")
|
|
|
47
69
|
print(compiler()["solc"])
|
|
48
70
|
```
|
|
49
71
|
|
|
72
|
+
## Standing up Notes
|
|
73
|
+
|
|
74
|
+
`Notes` takes its verifiers through adapters, so a world deploys the adapters,
|
|
75
|
+
registers a verifier per batch size, and wires them in:
|
|
76
|
+
|
|
77
|
+
- `MintVerifierAdapter` / `MintVerifierA2Adapter` -- `registerVerifier(n,
|
|
78
|
+
address)` for each `MintBatchN{n}Groth16Verifier` /
|
|
79
|
+
`MintBatchA2N{n}Groth16Verifier` (n = 1, 2, 4, 8, 16, 32); a batch is
|
|
80
|
+
verified by the verifier registered for its size.
|
|
81
|
+
- `SpendVerifierAdapter(SpendGroth16Verifier)`, then
|
|
82
|
+
`Notes(buck, mintAdapter, spendAdapter, governance)`.
|
|
83
|
+
- `setIdentityRegistry`, `setA2MintVerifier(a2Adapter)`,
|
|
84
|
+
`setIdentityMembershipVerifier(IdentityMembershipB1VerifierAdapter())` and
|
|
85
|
+
`setDepositFoldVerifier(DepositFoldVerifierAdapter(registry))`. These two
|
|
86
|
+
adapters deploy their own verifiers in their constructors; the verifier
|
|
87
|
+
artifacts are shipped too, for direct use and inspection.
|
|
88
|
+
- The registry's accumulator hashes with `PoseidonT3` and `PoseidonT4`
|
|
89
|
+
(`setIdentityPoseidon`, `setIdentityPoseidonT4`).
|
|
90
|
+
|
|
91
|
+
`alberta_buck/sim/notes_stack.py` in the repository is the reference wiring.
|
|
92
|
+
Every artifact fits EIP-170: the one verifier snarkjs emits too large
|
|
93
|
+
(`MintBatchA2N32Groth16Verifier`, 228 public inputs) ships in a table-driven
|
|
94
|
+
form with the same verification key.
|
|
95
|
+
|
|
50
96
|
## What is not here
|
|
51
97
|
|
|
52
98
|
A BUCK world also needs Uniswap and WETH. Those are **not** bundled: they
|
package/compiler.json
CHANGED
|
@@ -6,12 +6,49 @@
|
|
|
6
6
|
"runs": 200
|
|
7
7
|
},
|
|
8
8
|
"evmVersion": "cancun",
|
|
9
|
-
"commit": "
|
|
10
|
-
"sha256": "
|
|
9
|
+
"commit": "86b7a59f128b1299dfeeffd8e01e77fdc8c4319a-dirty",
|
|
10
|
+
"sha256": "5d1545d4e51018b51d3e0c1400be0f3ad2a95f2e284f6862cebbb159e50c2718",
|
|
11
11
|
"external": {
|
|
12
12
|
"UniswapV3Factory": "@uniswap/v3-core",
|
|
13
13
|
"UniswapV3Pool": "@uniswap/v3-core",
|
|
14
14
|
"WETH9": "@uniswap/v2-periphery",
|
|
15
15
|
"UniversalRouter": "@uniswap/universal-router"
|
|
16
|
+
},
|
|
17
|
+
"trustedSetup": {
|
|
18
|
+
"kind": "development",
|
|
19
|
+
"until": "1.0.0",
|
|
20
|
+
"entropy": "fixed, published strings in scripts/snark/setup*.sh",
|
|
21
|
+
"consequence": "the toxic waste is public: anyone can forge a proof these verifiers accept",
|
|
22
|
+
"purpose": "simulation of forged-proof attacks and their defences; not for value",
|
|
23
|
+
"verifiers": [
|
|
24
|
+
"MintBatchN1Groth16Verifier",
|
|
25
|
+
"MintBatchN2Groth16Verifier",
|
|
26
|
+
"MintBatchN4Groth16Verifier",
|
|
27
|
+
"MintBatchN8Groth16Verifier",
|
|
28
|
+
"MintBatchN16Groth16Verifier",
|
|
29
|
+
"MintBatchN32Groth16Verifier",
|
|
30
|
+
"MintBatchA2N1Groth16Verifier",
|
|
31
|
+
"MintBatchA2N2Groth16Verifier",
|
|
32
|
+
"MintBatchA2N4Groth16Verifier",
|
|
33
|
+
"MintBatchA2N8Groth16Verifier",
|
|
34
|
+
"MintBatchA2N16Groth16Verifier",
|
|
35
|
+
"MintBatchA2N32Groth16Verifier",
|
|
36
|
+
"SpendGroth16Verifier",
|
|
37
|
+
"DepositFoldA1Verifier",
|
|
38
|
+
"DepositFoldA2Verifier",
|
|
39
|
+
"IdentityMembershipB1Verifier"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"generated": {
|
|
43
|
+
"PoseidonT3": {
|
|
44
|
+
"source": "src/PoseidonT3Bytecode.sol",
|
|
45
|
+
"abi": "IPoseidonT3",
|
|
46
|
+
"generator": "circomlibjs poseidon_gencontract"
|
|
47
|
+
},
|
|
48
|
+
"PoseidonT4": {
|
|
49
|
+
"source": "src/PoseidonT4Bytecode.sol",
|
|
50
|
+
"abi": "IPoseidonT4",
|
|
51
|
+
"generator": "circomlibjs poseidon_gencontract"
|
|
52
|
+
}
|
|
16
53
|
}
|
|
17
54
|
}
|