Allow literals in statements (#276)

Implements #229 and #261.
This commit is contained in:
Daniel Gulotta 2025-06-13 10:27:19 -07:00 committed by GitHub
parent 21ab3c2d0d
commit 7d0d3ad769
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 992 additions and 825 deletions

View file

@ -27,7 +27,7 @@ pub fn eth_friend_batch(params: &Params, mock: bool) -> Result<Arc<CustomPredica
// statement templates:
&[
// there is an attestation pod that's a SignedPod
STB::new(NP::ValueOf)
STB::new(NP::Equal)
.arg(("attestation_pod", key(KEY_TYPE)))
.arg(literal(pod_type)),
// the attestation pod is signed by (src_or, src_key)
@ -70,7 +70,7 @@ pub fn eth_dos_batch(params: &Params, mock: bool) -> Result<Arc<CustomPredicateB
STB::new(NP::Equal)
.arg(("SELF", "src_key"))
.arg(("SELF", "dst_key")),
STB::new(NP::ValueOf)
STB::new(NP::Equal)
.arg(("SELF", "distance_key"))
.arg(literal(0)),
],
@ -100,9 +100,7 @@ pub fn eth_dos_batch(params: &Params, mock: bool) -> Result<Arc<CustomPredicateB
.arg("intermed_key")
.arg("shorter_distance_key"),
// distance == shorter_distance + 1
STB::new(NP::ValueOf)
.arg(("SELF", "one_key"))
.arg(literal(1)),
STB::new(NP::Equal).arg(("SELF", "one_key")).arg(literal(1)),
STB::new(NP::SumOf)
.arg(("SELF", "distance_key"))
.arg(("SELF", "shorter_distance_key"))