update docs to use pod lang v1 (#268)
This commit is contained in:
parent
6feff2ae69
commit
6258e52e1a
6 changed files with 185 additions and 177 deletions
|
|
@ -11,17 +11,17 @@ The syntax of a custom operation is best explained with an example.
|
|||
Original example with anchored keys, origins, and keys.
|
||||
| Args | Condition | Output |
|
||||
|------------|-----------------------------------------|----|
|
||||
| pod: Origin, <br> good_boy_issuers: AnchoredKey::MerkleRoot, <br> receiver: AnchoredKey | ValueOf(AK(pod, "_type"), SIGNATURE), <br> Contains(good_boy_issuers, AK(pod,"_signer")), <br> Equals(AK(pod, "friend"), receiver) | GoodBoy(receiver, good_boy_issuers) |
|
||||
| pod: Origin, <br> good_boy_issuers: AnchoredKey::MerkleRoot, <br> receiver: AnchoredKey | ValueOf(?pod["_type"], SIGNATURE), <br> Contains(?good_boy_issuers, ?pod["_signer"]), <br> Equals(?pod["friend"], ?receiver) | GoodBoy(?receiver, ?good_boy_issuers) |
|
||||
|
||||
Compiled example with only origins and keys.
|
||||
| Args | Condition | Output |
|
||||
|------------|-----------------------------------------|----|
|
||||
| pod: Origin, <br> good_boy_issuers_origin: Origin, <br> good_boy_issuers_key: Key::MerkleRoot, <br> receiver_origin: Origin, <br> receiver_key: Key | ValueOf(AK(pod, "_type"), SIGNATURE), <br> Contains(AK(good_boy_issuers_origin, good_boy_issuers_key), AK(pod,"_signer")), <br> Equals(AK(pod, "friend"), AK(receiver_origin, receiver_key)) | GoodBoy(AK(receiver_origin, receiver_key), AK(good_boy_issuers_origin, good_boy_issuers_key)) |
|
||||
| pod: Origin, <br> good_boy_issuers_origin: Origin, <br> good_boy_issuers_key: Key::MerkleRoot, <br> receiver_origin: Origin, <br> receiver_key: Key | ValueOf(pod["_type"]), SIGNATURE), <br> Contains(?good_boy_issuers_origin[?good_boy_issuers_key], ?pod["_signer"]), <br> Equals(?pod["friend"], ?receiver_origin[?receiver_key]) | GoodBoy(?receiver_origin[?receiver_key]), ?good_boy_issuers_origin[?good_boy_issuers_key]) |
|
||||
|
||||
A custom operation accepts as input a number of statements (the `Condition`);
|
||||
each statement has a number of arguments, which may be constants or anchored keys; and an [anchored key](./anchoredkeys.md) in turn can optionally be decomposed as a pair of an Origin and a Key.
|
||||
|
||||
In the "original example" above, the anchored keys `good_boy_issuers` and `receiver` are not broken down, but `AK(pod, "_type"), AK(pod, "_signer"), AK(pod, "friend")` are. The purpose of breaking them down, in this case, is to force the three anchored keys to come from the same pod.
|
||||
In the "original example" above, the anchored keys `good_boy_issuers` and `receiver` are not broken down, but `?pod["_type"], ?pod["_signer"], pod["friend"]` are. The purpose of breaking them down, in this case, is to force the three anchored keys to come from the same pod.
|
||||
|
||||
In the "compiled example", all the anchored keys have been broken down into origins and keys.
|
||||
|
||||
|
|
@ -35,18 +35,18 @@ On the back end the "compiled example" deduction rule is converted to a sort of
|
|||
|
||||
| Args | Condition | Output |
|
||||
|------------|-----------------------------------------|----|
|
||||
| *1 (pod), <br> *2 (good_boy_issuers_origin), <br> *3 (good_boy_issuers_key), <br> *4 (receiver_origin), <br> *5 (receiver_key) | ValueOf(AK(*1, "_type"), SIGNATURE), <br> Contains(AK(*2, *3), AK(*1,"_signer")), <br> Equals(AK(*1, "friend"), AK(*4, *5)) | GoodBoy(AK(*4, *5), AK(*2, *3)) |
|
||||
| ?1 (pod), <br> ?2 (good_boy_issuers_origin), <br> ?3 (good_boy_issuers_key), <br> ?4 (receiver_origin), <br> ?5 (receiver_key) | ValueOf(?1["_type"]), SIGNATURE), <br> Contains(?2[?3], ?1["_signer"]), <br> Equals(?1["friend"], ?4[?5]) | GoodBoy(?4[?5], ?2[?3]) |
|
||||
|
||||
If you want to apply this deduction rule to prove a `GoodBoy` statement,
|
||||
you have to provide the following witnesses in-circuit.
|
||||
|
||||
- Copy of the deduction rule
|
||||
- Values for *1, *2, *3, *4, *5.
|
||||
- Copy of the three statements in the deduction rule with *1, *2, *3, *4, *5 filled in
|
||||
- Values for ?1, ?2, ?3, ?4, ?5.
|
||||
- Copy of the three statements in the deduction rule with ?1, ?2, ?3, ?4, ?5 filled in
|
||||
- Indices of the three statements `ValueOf`, `Contains`, `Equals` in the list of previous statements.
|
||||
|
||||
And the circuit will verify:
|
||||
- *1, *2, *3, *4, *5 were correctly substituted into the statements
|
||||
- ?1, ?2, ?3, ?4, ?5 were correctly substituted into the statements
|
||||
- The three statements `ValueOf`, `Contains`, `Equals` do indeed appear at the claimed indices.
|
||||
|
||||
[^operation]: In previous versions of these docs, "operations" were called "deduction rules".
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue