|
1 | 1 |
|
2 | | -# Ethdos custom predicate, using binary AND and OR: example of a direct definition and a recursive group |
3 | | - |
4 | | -## Direct definition |
5 | | -(DEPRECATED: All predicates must be defined as part of a group.) |
6 | | -``` |
7 | | -eth_friend(src_or, src_key, dst_or, dst_key) = and< |
8 | | - // there is an attestation pod that's a SIGNATURE POD |
9 | | - ValueOf(attestation_pod, "type", SIGNATURE) |
10 | | - |
11 | | - // the attestation pod is signed by (src_or, src_key) |
12 | | - Equal((attestation_pod, "signer"), (src_or, src_key)) |
13 | | -
|
14 | | - // that same attestation pod has an "attestation" |
15 | | - Equal((attestation_pod, "attestation"), (dst_or, dst_key)) |
16 | | -> |
17 | | -
|
18 | | -On the backend, this is converted to a rule where all the arguments are either wildcards or literals: |
19 | | -eth_friend(*1, *2, *3, *4) = and< |
20 | | - // there is an attestation pod that's a SIGNATURE POD |
21 | | - ValueOf(*5, "type", SIGNATURE) |
22 | | - |
23 | | - // the attestation pod is signed by (src_or, src_key) |
24 | | - Equal((*5, "signer"), (*1, *2)) |
25 | | -
|
26 | | - // that same attestation pod has an "attestation" |
27 | | - Equal((*5, "attestation"), (*3, *4)) |
28 | | -> |
29 | | -
|
30 | | -This backend definition is then hashed in the obvious way. |
31 | | -
|
32 | | -``` |
33 | | - |
34 | | -## Recursive group definition |
| 2 | +# Ethdos custom predicate, using binary AND and OR: example of a recursive group |
35 | 3 |
|
36 | 4 | ``` |
37 | 5 | eth_dos_distance(src_or, src_key, dst_or, dst_key, distance_or, distance_key) = or< |
|
0 commit comments