Wildcards without the ? prefix (#422)

This commit is contained in:
Andrew Twyman 2025-09-12 13:08:17 -07:00 committed by GitHub
parent 7e04eb51ff
commit 5de08da32c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 287 additions and 262 deletions

View file

@ -12,24 +12,24 @@ use crate::{
pub fn eth_dos_batch(params: &Params) -> Result<Arc<CustomPredicateBatch>> {
let input = r#"
eth_friend(src, dst, private: attestation) = AND(
SignedBy(?attestation, ?src)
Contains(?attestation, "attestation", ?dst)
SignedBy(attestation, src)
Contains(attestation, "attestation", dst)
)
eth_dos_base(src, dst, distance) = AND(
Equal(?src, ?dst)
Equal(?distance, 0)
Equal(src, dst)
Equal(distance, 0)
)
eth_dos_ind(src, dst, distance, private: shorter_distance, intermed) = AND(
eth_dos(?src, ?intermed, ?shorter_distance)
SumOf(?distance, ?shorter_distance, 1)
eth_friend(?intermed, ?dst)
eth_dos(src, intermed, shorter_distance)
SumOf(distance, shorter_distance, 1)
eth_friend(intermed, dst)
)
eth_dos(src, dst, distance) = OR(
eth_dos_base(?src, ?dst, ?distance)
eth_dos_ind(?src, ?dst, ?distance)
eth_dos_base(src, dst, distance)
eth_dos_ind(src, dst, distance)
)
"#;
let batch = parse(input, params, &[]).expect("lang parse").custom_batch;
@ -47,7 +47,7 @@ pub fn eth_dos_request() -> Result<PodRequest> {
r#"
use _, _, _, eth_dos from 0x{batch_id}
REQUEST(
eth_dos(?src, ?dst, ?distance)
eth_dos(src, dst, distance)
)
"#,
);

View file

@ -82,12 +82,12 @@ pub fn zu_kyc_pod_request(gov_signer: &Value, pay_signer: &Value) -> Result<PodR
let input = format!(
r#"
REQUEST(
SetNotContains({sanction_set}, ?gov.idNumber)
Lt(?gov.dateOfBirth, {ZU_KYC_NOW_MINUS_18Y})
Equal(?pay.startDate, {ZU_KYC_NOW_MINUS_1Y})
Equal(?gov.socialSecurityNumber, ?pay.socialSecurityNumber)
SignedBy(?gov, {gov_signer})
SignedBy(?pay, {pay_signer})
SetNotContains({sanction_set}, gov.idNumber)
Lt(gov.dateOfBirth, {ZU_KYC_NOW_MINUS_18Y})
Equal(pay.startDate, {ZU_KYC_NOW_MINUS_1Y})
Equal(gov.socialSecurityNumber, pay.socialSecurityNumber)
SignedBy(gov, {gov_signer})
SignedBy(pay, {pay_signer})
// TODO: Ownership check and watermarking
// Depends partly on https://github.com/0xPARC/pod2/issues/351
)