Allow literals in statement templates (#287)
This PR is a continuation of the work done in #276 - Fix PodType in MainPod (we were using `MockMain` instead of `Main`) - Update anchored keys in statement template arguments to only support wildcards in the origin and literal keys as the key. - Update the pest grammar accordingly - Update the parser accordingly - Rewrite the eth_dos example in a recursive manner so that we use one recursive pod for every distance increment of 1. - I've also used the podlang to define the eth_dos custom predicates. Currently all predicates are in a single batch (previously `eth_friend` was in a different batch). With #286 we could define `eth_friend` in a different batch again. - I was feeling a bit creative and used a format macro to pass `Value`s from rust to the podlang code. - The eth_dos is now written using literals. This resolves https://github.com/0xPARC/pod2/issues/255 - Remove `StatementArg::WildcardValue` in favor of `StatementArg::Literal`. The `WildcardValue` was just a way to have some kind of typing for values that would be used as arguments in custom predicates. Now that we can have literals in any statement this value can be anything, so I just removed the `WildcardValue` and use `Literal` instead. On the backend it was already the case that both cases were treated the same way (after all, `WildcardValue` and `Literal` were 4 fields in the backend). - Added a new type for Value: `PodId` so that we can use it for custom predicates that take a pod id to be used in a wildcard - Add a mock vd_set that is empty for tests that don't use plonky2; this allows running those tests individually without paying for the expensive work of calculating the vd for various circuits. - rename StatementTmplArg::WildcardValue to StatementTmplArg::Wildcard
This commit is contained in:
parent
7d0d3ad769
commit
3c6930dfe6
20 changed files with 659 additions and 1111 deletions
|
|
@ -1,134 +1,70 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use StatementTmplBuilder as STB;
|
||||
|
||||
use crate::{
|
||||
frontend::{key, literal, CustomPredicateBatchBuilder, Result, StatementTmplBuilder},
|
||||
middleware::{
|
||||
CustomPredicateBatch, CustomPredicateRef, NativePredicate as NP, Params, PodType,
|
||||
Predicate, KEY_SIGNER, KEY_TYPE,
|
||||
},
|
||||
frontend::Result,
|
||||
lang::parse,
|
||||
middleware::{CustomPredicateBatch, Params, PodType, Value, KEY_SIGNER, KEY_TYPE},
|
||||
};
|
||||
|
||||
/// Instantiates an ETH friend batch
|
||||
pub fn eth_friend_batch(params: &Params, mock: bool) -> Result<Arc<CustomPredicateBatch>> {
|
||||
let pod_type = if mock {
|
||||
macro_rules! render {
|
||||
($tmpl: expr, $($arg:tt)*) => {{
|
||||
format!(
|
||||
$tmpl,
|
||||
KEY_TYPE = Value::from(KEY_TYPE),
|
||||
KEY_SIGNER = Value::from(KEY_SIGNER),
|
||||
$($arg)*
|
||||
)
|
||||
}};
|
||||
}
|
||||
|
||||
/// Instantiates an ETHDos batch
|
||||
pub fn eth_dos_batch(params: &Params, mock: bool) -> Result<Arc<CustomPredicateBatch>> {
|
||||
let pod_type = Value::from(if mock {
|
||||
PodType::MockSigned
|
||||
} else {
|
||||
PodType::Signed
|
||||
};
|
||||
let mut builder = CustomPredicateBatchBuilder::new(params.clone(), "eth_friend".into());
|
||||
let _eth_friend = builder.predicate_and(
|
||||
"eth_friend",
|
||||
// arguments:
|
||||
&["src_key", "dst_key"],
|
||||
// private arguments:
|
||||
&["attestation_pod"],
|
||||
// statement templates:
|
||||
&[
|
||||
// there is an attestation pod that's a SignedPod
|
||||
STB::new(NP::Equal)
|
||||
.arg(("attestation_pod", key(KEY_TYPE)))
|
||||
.arg(literal(pod_type)),
|
||||
// the attestation pod is signed by (src_or, src_key)
|
||||
STB::new(NP::Equal)
|
||||
.arg(("attestation_pod", key(KEY_SIGNER)))
|
||||
.arg(("SELF", "src_key")),
|
||||
// that same attestation pod has an "attestation"
|
||||
STB::new(NP::Equal)
|
||||
.arg(("attestation_pod", key("attestation")))
|
||||
.arg(("SELF", "dst_key")),
|
||||
],
|
||||
)?;
|
||||
});
|
||||
let input = render!(
|
||||
r#"
|
||||
eth_friend(src, dst, private: attestation_pod) = AND(
|
||||
Equal(?attestation_pod[{KEY_TYPE}], {pod_type})
|
||||
Equal(?attestation_pod[{KEY_SIGNER}], ?src)
|
||||
Equal(?attestation_pod["attestation"], ?dst)
|
||||
)
|
||||
|
||||
println!("a.0. {}", builder.predicates.last().unwrap());
|
||||
Ok(builder.finish())
|
||||
eth_dos_base(src, dst, distance) = AND(
|
||||
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, dst, distance) = OR(
|
||||
eth_dos_base(?src, ?dst, ?distance)
|
||||
eth_dos_ind(?src, ?dst, ?distance)
|
||||
)
|
||||
"#,
|
||||
pod_type = pod_type,
|
||||
);
|
||||
let batch = parse(&input, params, &[]).expect("lang parse").custom_batch;
|
||||
println!("a.0. {}", batch.predicates[0]);
|
||||
println!("a.1. {}", batch.predicates[1]);
|
||||
println!("a.2. {}", batch.predicates[2]);
|
||||
println!("a.3. {}", batch.predicates[3]);
|
||||
Ok(batch)
|
||||
}
|
||||
|
||||
/// Instantiates an ETHDoS batch
|
||||
pub fn eth_dos_batch(params: &Params, mock: bool) -> Result<Arc<CustomPredicateBatch>> {
|
||||
let eth_friend = Predicate::Custom(CustomPredicateRef::new(eth_friend_batch(params, mock)?, 0));
|
||||
let mut builder =
|
||||
CustomPredicateBatchBuilder::new(params.clone(), "eth_dos_distance_base".into());
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
// eth_dos_distance_base(src_or, src_key, dst_or, dst_key, distance_or, distance_key) = and<
|
||||
// eq(src_or, src_key, dst_or, dst_key),
|
||||
// ValueOf(distance_or, distance_key, 0)
|
||||
// >
|
||||
let eth_dos_distance_base = builder.predicate_and(
|
||||
"eth_dos_distance_base",
|
||||
&[
|
||||
// arguments:
|
||||
"src_key",
|
||||
"dst_key",
|
||||
"distance_key",
|
||||
],
|
||||
&[ // private arguments:
|
||||
],
|
||||
&[
|
||||
// statement templates:
|
||||
STB::new(NP::Equal)
|
||||
.arg(("SELF", "src_key"))
|
||||
.arg(("SELF", "dst_key")),
|
||||
STB::new(NP::Equal)
|
||||
.arg(("SELF", "distance_key"))
|
||||
.arg(literal(0)),
|
||||
],
|
||||
)?;
|
||||
println!("b.0. {}", builder.predicates.last().unwrap());
|
||||
|
||||
let eth_dos_distance = Predicate::BatchSelf(2);
|
||||
|
||||
let eth_dos_distance_ind = builder.predicate_and(
|
||||
"eth_dos_distance_ind",
|
||||
&[
|
||||
// arguments:
|
||||
"src_key",
|
||||
"dst_key",
|
||||
"distance_key",
|
||||
],
|
||||
&[
|
||||
// private arguments:
|
||||
"one_key",
|
||||
"shorter_distance_key",
|
||||
"intermed_key",
|
||||
],
|
||||
&[
|
||||
// statement templates:
|
||||
STB::new(eth_dos_distance)
|
||||
.arg("src_key")
|
||||
.arg("intermed_key")
|
||||
.arg("shorter_distance_key"),
|
||||
// distance == shorter_distance + 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"))
|
||||
.arg(("SELF", "one_key")),
|
||||
// intermed is a friend of dst
|
||||
STB::new(eth_friend).arg("intermed_key").arg("dst_key"),
|
||||
],
|
||||
)?;
|
||||
|
||||
println!("b.1. {}", builder.predicates.last().unwrap());
|
||||
|
||||
let _eth_dos_distance = builder.predicate_or(
|
||||
"eth_dos_distance",
|
||||
&["src_key", "dst_key", "distance_key"],
|
||||
&[],
|
||||
&[
|
||||
STB::new(eth_dos_distance_base)
|
||||
.arg("src_key")
|
||||
.arg("dst_key")
|
||||
.arg("distance_key"),
|
||||
STB::new(eth_dos_distance_ind)
|
||||
.arg("src_key")
|
||||
.arg("dst_key")
|
||||
.arg("distance_key"),
|
||||
],
|
||||
)?;
|
||||
|
||||
println!("b.2. {}", builder.predicates.last().unwrap());
|
||||
|
||||
Ok(builder.finish())
|
||||
#[test]
|
||||
fn test_eth_friend_batch() {
|
||||
let params = Params::default();
|
||||
eth_dos_batch(¶ms, true).unwrap();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,17 @@
|
|||
pub mod custom;
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::{collections::HashSet, sync::LazyLock};
|
||||
|
||||
use custom::{eth_dos_batch, eth_friend_batch};
|
||||
use custom::eth_dos_batch;
|
||||
|
||||
pub const MOCK_VD_SET: LazyLock<VDSet> = LazyLock::new(|| VDSet::new(6, &[]).unwrap());
|
||||
|
||||
use crate::{
|
||||
backends::plonky2::mock::signedpod::MockSigner,
|
||||
frontend::{MainPodBuilder, Result, SignedPod, SignedPodBuilder},
|
||||
frontend::{MainPod, MainPodBuilder, Result, SignedPod, SignedPodBuilder},
|
||||
middleware::{
|
||||
containers::Set, CustomPredicateRef, Params, PodType, Statement, TypedValue, VDSet, Value,
|
||||
DEFAULT_VD_SET, KEY_SIGNER, KEY_TYPE,
|
||||
containers::Set, CustomPredicateRef, Params, PodSigner, PodType, Predicate, Statement,
|
||||
StatementArg, TypedValue, VDSet, Value, KEY_SIGNER, KEY_TYPE,
|
||||
},
|
||||
op,
|
||||
};
|
||||
|
|
@ -71,146 +73,167 @@ pub fn zu_kyc_pod_builder(
|
|||
|
||||
// ETHDoS
|
||||
|
||||
pub fn eth_friend_signed_pod_builder(params: &Params, friend_pubkey: Value) -> SignedPodBuilder {
|
||||
pub fn attest_eth_friend(params: &Params, src: &mut impl PodSigner, dst: Value) -> SignedPod {
|
||||
let mut attestation = SignedPodBuilder::new(params);
|
||||
attestation.insert("attestation", friend_pubkey);
|
||||
|
||||
attestation
|
||||
attestation.insert("attestation", dst);
|
||||
attestation.sign(src).unwrap()
|
||||
}
|
||||
|
||||
pub fn eth_dos_pod_builder(
|
||||
params: &Params,
|
||||
vd_set: &VDSet,
|
||||
pub struct EthDosHelper {
|
||||
params: Params,
|
||||
vd_set: VDSet,
|
||||
mock: bool,
|
||||
alice_attestation: &SignedPod,
|
||||
charlie_attestation: &SignedPod,
|
||||
bob_pubkey: Value,
|
||||
) -> Result<MainPodBuilder> {
|
||||
// Will need ETH friend and ETH DoS custom predicate batches.
|
||||
let eth_friend = CustomPredicateRef::new(eth_friend_batch(params, mock)?, 0);
|
||||
let eth_dos_batch = eth_dos_batch(params, mock)?;
|
||||
let eth_dos_base = CustomPredicateRef::new(eth_dos_batch.clone(), 0);
|
||||
let eth_dos_ind = CustomPredicateRef::new(eth_dos_batch.clone(), 1);
|
||||
let eth_dos = CustomPredicateRef::new(eth_dos_batch.clone(), 2);
|
||||
eth_friend: CustomPredicateRef,
|
||||
eth_dos_base: CustomPredicateRef,
|
||||
eth_dos_ind: CustomPredicateRef,
|
||||
eth_dos: CustomPredicateRef,
|
||||
src: Value,
|
||||
}
|
||||
|
||||
// ETHDoS POD builder
|
||||
let mut alice_bob_ethdos = MainPodBuilder::new(params, vd_set);
|
||||
alice_bob_ethdos.add_signed_pod(alice_attestation);
|
||||
alice_bob_ethdos.add_signed_pod(charlie_attestation);
|
||||
impl EthDosHelper {
|
||||
pub fn new(params: &Params, vd_set: &VDSet, mock: bool, src: Value) -> Result<Self> {
|
||||
let eth_dos_batch = eth_dos_batch(params, mock)?;
|
||||
let eth_friend = eth_dos_batch.predicate_ref_by_name("eth_friend").unwrap();
|
||||
let eth_dos_base = eth_dos_batch.predicate_ref_by_name("eth_dos_base").unwrap();
|
||||
let eth_dos_ind = eth_dos_batch.predicate_ref_by_name("eth_dos_ind").unwrap();
|
||||
let eth_dos = eth_dos_batch.predicate_ref_by_name("eth_dos").unwrap();
|
||||
Ok(Self {
|
||||
params: params.clone(),
|
||||
vd_set: vd_set.clone(),
|
||||
mock,
|
||||
eth_friend,
|
||||
eth_dos_base,
|
||||
eth_dos_ind,
|
||||
eth_dos,
|
||||
src,
|
||||
})
|
||||
}
|
||||
|
||||
// Attestation POD entries
|
||||
let alice_pubkey = alice_attestation
|
||||
.get(KEY_SIGNER)
|
||||
.expect("Could not find Alice's public key!")
|
||||
.clone();
|
||||
let charlie_pubkey = charlie_attestation
|
||||
.get(KEY_SIGNER)
|
||||
.expect("Could not find Charlie's public key!")
|
||||
.clone();
|
||||
pub fn dist_1(&self, src_attestation: &SignedPod) -> Result<MainPodBuilder> {
|
||||
assert_eq!(
|
||||
&self.src,
|
||||
src_attestation.get(KEY_SIGNER).expect("get KEY_SIGNER")
|
||||
);
|
||||
|
||||
// Include Alice and Bob's keys as public statements. We don't
|
||||
// want to reveal the middleman.
|
||||
let alice_pubkey_copy = alice_bob_ethdos.pub_op(op!(new_entry, ("Alice", alice_pubkey)))?;
|
||||
let bob_pubkey_copy = alice_bob_ethdos.pub_op(op!(new_entry, ("Bob", bob_pubkey.clone())))?;
|
||||
let charlie_pubkey = alice_bob_ethdos.priv_op(op!(new_entry, ("Charlie", charlie_pubkey)))?;
|
||||
let mut pod = MainPodBuilder::new(&self.params, &self.vd_set);
|
||||
pod.add_signed_pod(src_attestation);
|
||||
|
||||
// The ETHDoS distance from Alice to Alice is 0.
|
||||
let zero = alice_bob_ethdos.priv_literal(0)?;
|
||||
let alice_equals_alice = alice_bob_ethdos.priv_op(op!(
|
||||
eq,
|
||||
alice_pubkey_copy.clone(),
|
||||
alice_pubkey_copy.clone()
|
||||
))?;
|
||||
let ethdos_alice_alice_is_zero_base = alice_bob_ethdos.priv_op(op!(
|
||||
custom,
|
||||
eth_dos_base.clone(),
|
||||
alice_equals_alice,
|
||||
zero.clone()
|
||||
))?;
|
||||
let ethdos_alice_alice_is_zero = alice_bob_ethdos.priv_op(op!(
|
||||
custom,
|
||||
eth_dos.clone(),
|
||||
ethdos_alice_alice_is_zero_base,
|
||||
Statement::None
|
||||
))?;
|
||||
let src_eq_src = pod.priv_op(op!(eq, self.src.clone(), self.src.clone()))?;
|
||||
let distance_eq_zero = pod.priv_op(op!(eq, 0, 0))?;
|
||||
let eth_dos_src_to_src_base = pod.priv_op(op!(
|
||||
custom,
|
||||
self.eth_dos_base.clone(),
|
||||
src_eq_src,
|
||||
distance_eq_zero
|
||||
))?;
|
||||
let eth_dos_src_to_src = pod.priv_op(op!(
|
||||
custom,
|
||||
self.eth_dos.clone(),
|
||||
eth_dos_src_to_src_base,
|
||||
Statement::None
|
||||
))?;
|
||||
|
||||
// Alice and Charlie are ETH friends.
|
||||
let attestation_is_signed_pod = alice_attestation.get_statement(KEY_TYPE).unwrap();
|
||||
let attestation_signed_by_alice =
|
||||
alice_bob_ethdos.priv_op(op!(eq, (alice_attestation, KEY_SIGNER), alice_pubkey_copy))?;
|
||||
let alice_attests_to_charlie = alice_bob_ethdos.priv_op(op!(
|
||||
eq,
|
||||
(alice_attestation, "attestation"),
|
||||
charlie_pubkey.clone()
|
||||
))?;
|
||||
let ethfriends_alice_charlie = alice_bob_ethdos.priv_op(op!(
|
||||
custom,
|
||||
eth_friend.clone(),
|
||||
attestation_is_signed_pod,
|
||||
attestation_signed_by_alice,
|
||||
alice_attests_to_charlie
|
||||
))?;
|
||||
// eth_dos src->dst dist=1
|
||||
self.n_plus_1(&mut pod, eth_dos_src_to_src, src_attestation, 0)?;
|
||||
|
||||
// ...and so are Chuck and Bob.
|
||||
let attestation_is_signed_pod = charlie_attestation.get_statement(KEY_TYPE).unwrap();
|
||||
let attestation_signed_by_charlie =
|
||||
alice_bob_ethdos.priv_op(op!(eq, (charlie_attestation, KEY_SIGNER), charlie_pubkey))?;
|
||||
let charlie_attests_to_bob = alice_bob_ethdos.priv_op(op!(
|
||||
eq,
|
||||
(charlie_attestation, "attestation"),
|
||||
bob_pubkey_copy
|
||||
))?;
|
||||
let ethfriends_charlie_bob = alice_bob_ethdos.priv_op(op!(
|
||||
custom,
|
||||
eth_friend.clone(),
|
||||
attestation_is_signed_pod,
|
||||
attestation_signed_by_charlie,
|
||||
charlie_attests_to_bob
|
||||
))?;
|
||||
Ok(pod)
|
||||
}
|
||||
|
||||
// The ETHDoS distance from Alice to Charlie is 1.
|
||||
let one = alice_bob_ethdos.priv_literal(1)?;
|
||||
// 1 = 0 + 1
|
||||
let ethdos_sum =
|
||||
alice_bob_ethdos.priv_op(op!(sum_of, one.clone(), zero.clone(), one.clone()))?;
|
||||
let ethdos_alice_charlie_is_one_ind = alice_bob_ethdos.priv_op(op!(
|
||||
custom,
|
||||
eth_dos_ind.clone(),
|
||||
ethdos_alice_alice_is_zero,
|
||||
one.clone(),
|
||||
ethdos_sum,
|
||||
ethfriends_alice_charlie
|
||||
))?;
|
||||
let ethdos_alice_charlie_is_one = alice_bob_ethdos.priv_op(op!(
|
||||
custom,
|
||||
eth_dos.clone(),
|
||||
Statement::None,
|
||||
ethdos_alice_charlie_is_one_ind
|
||||
))?;
|
||||
pub fn dist_n_plus_1(
|
||||
&self,
|
||||
eth_dos_src_to_int_pod: &MainPod,
|
||||
int_attestation: &SignedPod, // int signs dst
|
||||
) -> Result<MainPodBuilder> {
|
||||
assert_eq!(
|
||||
Value::from(if self.mock {
|
||||
PodType::MockMain
|
||||
} else {
|
||||
PodType::Main
|
||||
}),
|
||||
eth_dos_src_to_int_pod.get(KEY_TYPE).expect("get KEY_TYPE")
|
||||
);
|
||||
|
||||
// The ETHDoS distance from Alice to Bob is 2.
|
||||
// The constant "TWO" and the final statement are both to be
|
||||
// public.
|
||||
let two = alice_bob_ethdos.pub_literal(2)?;
|
||||
// 2 = 1 + 1
|
||||
let ethdos_sum =
|
||||
alice_bob_ethdos.priv_op(op!(sum_of, two.clone(), one.clone(), one.clone()))?;
|
||||
let ethdos_alice_bob_is_two_ind = alice_bob_ethdos.priv_op(op!(
|
||||
custom,
|
||||
eth_dos_ind.clone(),
|
||||
ethdos_alice_charlie_is_one,
|
||||
one.clone(),
|
||||
ethdos_sum,
|
||||
ethfriends_charlie_bob
|
||||
))?;
|
||||
let _ethdos_alice_bob_is_two = alice_bob_ethdos.pub_op(op!(
|
||||
custom,
|
||||
eth_dos.clone(),
|
||||
Statement::None,
|
||||
ethdos_alice_bob_is_two_ind
|
||||
))?;
|
||||
let mut pod = MainPodBuilder::new(&self.params, &self.vd_set);
|
||||
pod.add_signed_pod(int_attestation);
|
||||
pod.add_main_pod(eth_dos_src_to_int_pod.clone());
|
||||
|
||||
Ok(alice_bob_ethdos)
|
||||
let eth_dos_int_to_dst = eth_dos_src_to_int_pod
|
||||
.pod
|
||||
.pub_statements()
|
||||
.into_iter()
|
||||
.rev() // Find the last predicate because dist_1 has two: dist=0, dist=1
|
||||
.find(|st| st.predicate() == Predicate::Custom(self.eth_dos.clone()))
|
||||
.expect("eth_dos custom predicate");
|
||||
let [_src, int, n] = {
|
||||
let args: [_; 3] = eth_dos_int_to_dst.args().try_into().expect("Vec::len=3");
|
||||
args.map(|arg| match arg {
|
||||
StatementArg::Literal(v) => v,
|
||||
_ => panic!("expected StatementArg::Literal"),
|
||||
})
|
||||
};
|
||||
assert_eq!(
|
||||
&int,
|
||||
int_attestation.get(KEY_SIGNER).expect("get KEY_SIGNER")
|
||||
);
|
||||
|
||||
let n_i64 = if let TypedValue::Int(x) = n.typed() {
|
||||
*x
|
||||
} else {
|
||||
panic!("distance value is not Int")
|
||||
};
|
||||
|
||||
// eth_dos src->dst dist=n+1
|
||||
self.n_plus_1(&mut pod, eth_dos_int_to_dst, int_attestation, n_i64)?;
|
||||
|
||||
Ok(pod)
|
||||
}
|
||||
|
||||
fn n_plus_1(
|
||||
&self,
|
||||
pod: &mut MainPodBuilder,
|
||||
eth_dos_int_to_dst: Statement,
|
||||
int_attestation: &SignedPod,
|
||||
n: i64,
|
||||
) -> Result<()> {
|
||||
assert_eq!(
|
||||
&Value::from(if self.mock {
|
||||
PodType::MockSigned
|
||||
} else {
|
||||
PodType::Signed
|
||||
}),
|
||||
int_attestation.get(KEY_TYPE).expect("get KEY_TYPE")
|
||||
);
|
||||
|
||||
// eth_friend statement
|
||||
let attestation_is_signed_pod = int_attestation.get_statement(KEY_TYPE).unwrap();
|
||||
let attestation_signed_by_int = int_attestation.get_statement(KEY_SIGNER).unwrap();
|
||||
let int_attests_to_dst = int_attestation.get_statement("attestation").unwrap();
|
||||
let ethfriends_int_dst = pod.priv_op(op!(
|
||||
custom,
|
||||
self.eth_friend.clone(),
|
||||
attestation_is_signed_pod,
|
||||
attestation_signed_by_int,
|
||||
int_attests_to_dst
|
||||
))?;
|
||||
|
||||
// distance = n + 1
|
||||
let ethdos_sum = pod.priv_op(op!(sum_of, n + 1, n, 1))?;
|
||||
let eth_dos_src_to_dst_ind = pod.priv_op(op!(
|
||||
custom,
|
||||
self.eth_dos_ind.clone(),
|
||||
eth_dos_int_to_dst,
|
||||
ethdos_sum,
|
||||
ethfriends_int_dst
|
||||
))?;
|
||||
let _eth_dos_src_dst = pod.pub_op(op!(
|
||||
custom,
|
||||
self.eth_dos.clone(),
|
||||
Statement::None,
|
||||
eth_dos_src_to_dst_ind
|
||||
))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
// GreatBoy
|
||||
|
|
@ -309,7 +332,7 @@ pub fn great_boy_pod_full_flow() -> Result<(Params, MainPodBuilder)> {
|
|||
num_public_statements_id: 50,
|
||||
..Default::default()
|
||||
};
|
||||
let vd_set = &*DEFAULT_VD_SET;
|
||||
let vd_set = &*MOCK_VD_SET;
|
||||
|
||||
let good_boy_issuers = ["Giggles", "Macrosoft", "FaeBook"];
|
||||
let mut giggles_signer = MockSigner {
|
||||
|
|
@ -413,7 +436,7 @@ pub fn tickets_pod_builder(
|
|||
|
||||
pub fn tickets_pod_full_flow() -> Result<MainPodBuilder> {
|
||||
let params = Params::default();
|
||||
let vd_set = &*DEFAULT_VD_SET;
|
||||
let vd_set = &*MOCK_VD_SET;
|
||||
let builder = tickets_sign_pod_builder(¶ms);
|
||||
let signed_pod = builder.sign(&mut MockSigner { pk: "test".into() }).unwrap();
|
||||
tickets_pod_builder(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue