begin setup with enforce, alloc and alloc input

This commit is contained in:
ada
2021-02-01 02:07:20 +01:00
parent f1807fa742
commit b808eba531
2 changed files with 14 additions and 14 deletions

View File

@@ -414,7 +414,7 @@ fn eval(mut ast: MalVal, mut env: Env) -> MalRet {
};
let mut new_vec: Vec<EnforceAllocation> = vec![enforce];
for value in get_enforce_allocs(&env).iter() {
println!("found {:?}", value);
new_vec.push(value.clone());
}
env_set(
&env,
@@ -510,15 +510,15 @@ pub fn setup(_ast: MalVal, env: Env) -> Result<PreparedVerifyingKey<Bls12>, MalE
let start = Instant::now();
// Create parameters for our circuit. In a production deployment these would
// be generated securely using a multiparty computation.
// let allocs_input = get_allocations(&env, "AllocationsInput").to_vec();
// let allocs = get_allocations(&env, "Allocations").to_vec();
// let enforce_allocs = get_enforce_allocs(&env).unwrap().to_vec();
let allocs_input = get_allocations(&env, "AllocationsInput");
let allocs = get_allocations(&env, "Allocations");
let enforce_allocs = get_enforce_allocs(&env);
let c = LispCircuit {
params: vec![],
allocs: vec![],
alloc_inputs: vec![],
constraints: vec![],
allocs: allocs.as_ref().clone(),
alloc_inputs: allocs_input.as_ref().clone(),
constraints: enforce_allocs,
env: env.clone(),
};
// TODO move to another fn
@@ -538,8 +538,8 @@ pub fn prove(_ast: MalVal, env: Env) -> MalRet {
let params = {
let c = LispCircuit {
params: vec![],
allocs: vec![],
alloc_inputs: vec![],
allocs: FnvHashMap::default(),
alloc_inputs: FnvHashMap::default(),
constraints: vec![],
env: env.clone(),
};
@@ -548,8 +548,8 @@ pub fn prove(_ast: MalVal, env: Env) -> MalRet {
let circuit = LispCircuit {
params: vec![],
allocs: vec![],
alloc_inputs: vec![],
allocs: FnvHashMap::default(),
alloc_inputs: FnvHashMap::default(),
constraints: vec![],
env: env.clone(),
};

View File

@@ -28,9 +28,9 @@ pub struct EnforceAllocation {
#[derive(Debug, Clone)]
pub struct LispCircuit {
pub params: Vec<Option<Scalar>>,
pub allocs: Vec<Option<Allocation>>,
pub alloc_inputs: Vec<Option<Allocation>>,
pub constraints: Vec<Option<EnforceAllocation>>,
pub allocs: FnvHashMap<String, MalVal>,
pub alloc_inputs: FnvHashMap<String, MalVal>,
pub constraints: Vec<EnforceAllocation>,
pub env: Env,
}