1
0
Fork 0
mirror of synced 2025-09-23 20:28:36 +00:00

rename verify embed, update changelog

This commit is contained in:
dark64 2021-07-05 15:58:53 +02:00
parent b4ebb1f7c1
commit ce3a137432
8 changed files with 31 additions and 17 deletions

View file

@ -1 +1 @@
Add SNARK verification to stdlib
Introduce the `snark_verify_bls12_377` embed for one-layer composition of SNARK proofs (over `BLS12-377`/`BW6-761` pair of curves where `BW6-761` is used as an outer curve to `BLS12-377`)

View file

@ -16,7 +16,7 @@ use std::path::{Path, PathBuf};
use typed_arena::Arena;
use zokrates_common::Resolver;
use zokrates_field::{Bn128Field, Field};
use zokrates_field::{Bn128Field, Bw6_761Field, Field};
#[derive(PartialEq, Debug)]
pub struct Error {
@ -106,8 +106,8 @@ impl Importer {
if T::id() != Bn128Field::id() {
return Err(CompileErrorInner::ImportError(
Error::new(format!(
"Embed sha256round cannot be used with curve {}",
T::name()
"Embed `sha256round` must be used with curve `{}`",
Bn128Field::name()
))
.with_pos(Some(pos)),
)
@ -121,10 +121,24 @@ impl Importer {
}
}
#[cfg(feature = "ark")]
"verify" => SymbolDeclaration {
"snark_verify_bls12_377" => {
if T::id() != Bw6_761Field::id() {
return Err(CompileErrorInner::ImportError(
Error::new(format!(
"Embed `snark_verify_bls12_377` must be used with curve `{}`",
Bw6_761Field::name()
))
.with_pos(Some(pos)),
)
.in_file(location)
.into());
} else {
SymbolDeclaration {
id: symbol.get_alias(),
symbol: Symbol::Flat(FlatEmbed::Verify),
},
}
}
}
"unpack" => SymbolDeclaration {
id: symbol.get_alias(),
symbol: Symbol::Flat(FlatEmbed::Unpack),

View file

@ -1,5 +1,5 @@
{
"entry_point": "./tests/tests/verify/verify_1.zok",
"entry_point": "./tests/tests/snark/snark_verify_bls12_377_1.zok",
"curves": ["Bw6_761"],
"tests": [
{

View file

@ -1,5 +1,5 @@
from "EMBED" import verify
from "EMBED" import snark_verify_bls12_377
def main(private field[1] inputs, private field[8] proof, private field[20] vk) -> bool:
bool result = verify(inputs, proof, vk)
bool result = snark_verify_bls12_377(inputs, proof, vk)
return result

View file

@ -1,5 +1,5 @@
{
"entry_point": "./tests/tests/verify/verify_2.zok",
"entry_point": "./tests/tests/snark/snark_verify_bls12_377_2.zok",
"curves": ["Bw6_761"],
"tests": [
{

View file

@ -1,5 +1,5 @@
from "EMBED" import verify
from "EMBED" import snark_verify_bls12_377
def main(private field[2] inputs, private field[8] proof, private field[22] vk) -> bool:
bool result = verify(inputs, proof, vk)
bool result = snark_verify_bls12_377(inputs, proof, vk)
return result

View file

@ -1,5 +1,5 @@
{
"entry_point": "./tests/tests/verify/verify_5.zok",
"entry_point": "./tests/tests/snark/snark_verify_bls12_377_5.zok",
"curves": ["Bw6_761"],
"tests": [
{

View file

@ -1,5 +1,5 @@
from "EMBED" import verify
from "EMBED" import snark_verify_bls12_377
def main(private field[5] inputs, private field[8] proof, private field[28] vk) -> bool:
bool result = verify(inputs, proof, vk)
bool result = snark_verify_bls12_377(inputs, proof, vk)
return result