fix naming in proof
This commit is contained in:
parent
c81f1fe629
commit
ef2c446895
8 changed files with 16 additions and 18 deletions
|
@ -795,7 +795,7 @@ fn cli() -> Result<(), String> {
|
|||
"json" => {
|
||||
println!("~~~~~~~~ Copy the output below for valid ABIv2 format ~~~~~~~~");
|
||||
println!();
|
||||
print!("{}", proof_object["points"]);
|
||||
print!("{}", proof_object["proof"]);
|
||||
print!(",");
|
||||
println!("{}", proof_object["inputs"]);
|
||||
println!();
|
||||
|
@ -805,7 +805,7 @@ fn cli() -> Result<(), String> {
|
|||
println!("~~~~~~~~ Copy the output below for valid ABIv1 format ~~~~~~~~");
|
||||
println!();
|
||||
|
||||
for (_, value) in proof_object["points"].as_object().unwrap().iter() {
|
||||
for (_, value) in proof_object["proof"].as_object().unwrap().iter() {
|
||||
print!("{}", value);
|
||||
print!(",");
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ let jsonInterface = JSON.parse(solc.compile(jsonContractSource));
|
|||
|
||||
function makeTransaction(account, correct) {
|
||||
let proof = getProof(correct);
|
||||
console.log(proof)
|
||||
|
||||
function handleReceipt(tx) {
|
||||
if (tx.status == true && !correct) {
|
||||
|
|
|
@ -111,7 +111,7 @@ std::string serializeProof(r1cs_se_ppzksnark_proof<libff::alt_bn128_pp>* proof,
|
|||
{
|
||||
std::stringstream ss;
|
||||
ss << "{";
|
||||
ss << "\"points\":{";
|
||||
ss << "\"proof\":{";
|
||||
ss << "\"a\":" << outputPointG1AffineAsHexJson(proof->A) << ",";
|
||||
ss << "\"b\":" << outputPointG2AffineAsHexJson(proof->B) << ",";
|
||||
ss << "\"c\":" << outputPointG1AffineAsHexJson(proof->C);
|
||||
|
|
|
@ -114,7 +114,7 @@ std::string serializeProof(r1cs_ppzksnark_proof<libff::alt_bn128_pp>* proof, con
|
|||
{
|
||||
std::stringstream ss;
|
||||
ss << "{";
|
||||
ss << "\"points\":{";
|
||||
ss << "\"proof\":{";
|
||||
ss << "\"a\":" << outputPointG1AffineAsHexJson(proof->g_A.g) << ",";
|
||||
ss << "\"a_p\":" << outputPointG1AffineAsHexJson(proof->g_A.h) << ",";
|
||||
ss << "\"b\":" << outputPointG2AffineAsHexJson(proof->g_B.g) << ",";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pub mod ffi;
|
||||
mod ffi;
|
||||
pub mod gm17;
|
||||
pub mod pghr13;
|
||||
|
||||
|
|
|
@ -40,18 +40,14 @@ impl SolidityAbi {
|
|||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct Proof<T> {
|
||||
points: T,
|
||||
proof: T,
|
||||
inputs: Vec<String>,
|
||||
raw: String,
|
||||
}
|
||||
|
||||
impl<T: Serialize + DeserializeOwned> Proof<T> {
|
||||
fn new(points: T, inputs: Vec<String>, raw: String) -> Self {
|
||||
Proof {
|
||||
points,
|
||||
inputs,
|
||||
raw,
|
||||
}
|
||||
fn new(proof: T, inputs: Vec<String>, raw: String) -> Self {
|
||||
Proof { proof, inputs, raw }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
4
zokrates_js/index.d.ts
vendored
4
zokrates_js/index.d.ts
vendored
|
@ -20,7 +20,7 @@ declare module 'zokrates-js' {
|
|||
}
|
||||
|
||||
export interface Proof {
|
||||
points: ProofPoints,
|
||||
proof: ProofPoints,
|
||||
inputs: string[],
|
||||
raw: string
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ declare module 'zokrates-js' {
|
|||
}
|
||||
|
||||
export type SolidityAbi = "v1" | "v2";
|
||||
export type ResolveCallback = (location: string, path: string) => ResolverResult;krat
|
||||
export type ResolveCallback = (location: string, path: string) => ResolverResult;
|
||||
|
||||
export interface ZoKratesProvider {
|
||||
compile(source: string, location: string, callback: ResolveCallback): CompilationArtifacts;
|
||||
|
|
|
@ -8,7 +8,8 @@ use zokrates_common::Resolver;
|
|||
use zokrates_core::compile::{compile as core_compile, CompilationArtifacts, CompileError};
|
||||
use zokrates_core::imports::Error;
|
||||
use zokrates_core::ir;
|
||||
use zokrates_core::proof_system::{self, ProofSystem, SolidityAbi};
|
||||
use zokrates_core::proof_system::{ProofSystem, SolidityAbi};
|
||||
use zokrates_core::proof_system::bellman::groth16::G16;
|
||||
use zokrates_core::typed_absy::abi::Abi;
|
||||
use zokrates_core::typed_absy::types::Signature;
|
||||
use zokrates_field::Bn128Field;
|
||||
|
@ -157,7 +158,7 @@ pub fn compute_witness(artifacts: JsValue, args: JsValue) -> Result<JsValue, JsV
|
|||
pub fn setup(program: JsValue) -> Result<JsValue, JsValue> {
|
||||
let input: Vec<u8> = program.into_serde().unwrap();
|
||||
let program_flattened = deserialize_program(&input)?;
|
||||
let keypair = proof_system::G16::setup(program_flattened);
|
||||
let keypair = G16::setup(program_flattened);
|
||||
Ok(JsValue::from_serde(&keypair).unwrap())
|
||||
}
|
||||
|
||||
|
@ -166,7 +167,7 @@ pub fn export_solidity_verifier(vk: JsValue, abi_version: JsValue) -> Result<JsV
|
|||
let abi_version = SolidityAbi::from(abi_version.as_string().unwrap().as_str())
|
||||
.map_err(|err| JsValue::from_str(err))?;
|
||||
|
||||
let verifier = <proof_system::G16 as ProofSystem<Bn128Field>>::export_solidity_verifier(
|
||||
let verifier = <G16 as ProofSystem<Bn128Field>>::export_solidity_verifier(
|
||||
vk.into_serde().unwrap(),
|
||||
abi_version,
|
||||
);
|
||||
|
@ -184,7 +185,7 @@ pub fn generate_proof(program: JsValue, witness: JsValue, pk: JsValue) -> Result
|
|||
.map_err(|err| JsValue::from_str(&format!("Could not read witness: {}", err)))?;
|
||||
|
||||
let proving_key: Vec<u8> = pk.into_serde().unwrap();
|
||||
let proof = proof_system::G16::generate_proof(program_flattened, ir_witness, proving_key);
|
||||
let proof = G16::generate_proof(program_flattened, ir_witness, proving_key);
|
||||
|
||||
Ok(JsValue::from_serde(&proof).unwrap())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue