@@ -940,14 +940,14 @@ type CE<G> = <G as Group>::CE;
940
940
#[ cfg( test) ]
941
941
mod tests {
942
942
use crate :: provider:: bn256_grumpkin:: { bn256, grumpkin} ;
943
- use crate :: provider:: pedersen:: CommitmentKeyExtTrait ;
944
943
use crate :: provider:: secp_secq:: { secp256k1, secq256k1} ;
944
+ use crate :: traits:: evaluation:: EvaluationEngineTrait ;
945
945
use core:: fmt:: Write ;
946
946
947
947
use super :: * ;
948
948
type EE < G > = provider:: ipa_pc:: EvaluationEngine < G > ;
949
- type S < G1 > = spartan:: snark:: RelaxedR1CSSNARK < G1 , EE < G1 > > ;
950
- type SPrime < G1 > = spartan:: ppsnark:: RelaxedR1CSSNARK < G1 , EE < G1 > > ;
949
+ type S < G , EE > = spartan:: snark:: RelaxedR1CSSNARK < G , EE > ;
950
+ type SPrime < G , EE > = spartan:: ppsnark:: RelaxedR1CSSNARK < G , EE > ;
951
951
952
952
use :: bellpepper_core:: { num:: AllocatedNum , ConstraintSystem , SynthesisError } ;
953
953
use core:: marker:: PhantomData ;
@@ -1008,20 +1008,20 @@ mod tests {
1008
1008
}
1009
1009
}
1010
1010
1011
- fn test_pp_digest_with < G1 , G2 , T1 , T2 > ( circuit1 : & T1 , circuit2 : & T2 , _expected : & str )
1011
+ fn test_pp_digest_with < G1 , G2 , T1 , T2 , E1 , E2 > ( circuit1 : & T1 , circuit2 : & T2 , _expected : & str )
1012
1012
where
1013
1013
G1 : Group < Base = <G2 as Group >:: Scalar > ,
1014
1014
G2 : Group < Base = <G1 as Group >:: Scalar > ,
1015
1015
T1 : StepCircuit < G1 :: Scalar > ,
1016
1016
T2 : StepCircuit < G2 :: Scalar > ,
1017
- < G1 :: CE as CommitmentEngineTrait < G1 > > :: CommitmentKey : CommitmentKeyExtTrait < G1 > ,
1018
- < G2 :: CE as CommitmentEngineTrait < G2 > > :: CommitmentKey : CommitmentKeyExtTrait < G2 > ,
1017
+ E1 : EvaluationEngineTrait < G1 > ,
1018
+ E2 : EvaluationEngineTrait < G2 > ,
1019
1019
<G1 :: Scalar as PrimeField >:: Repr : Abomonation ,
1020
1020
<G2 :: Scalar as PrimeField >:: Repr : Abomonation ,
1021
1021
{
1022
1022
// this tests public parameters with a size specifically intended for a spark-compressed SNARK
1023
- let pp_hint1 = Some ( SPrime :: < G1 > :: commitment_key_floor ( ) ) ;
1024
- let pp_hint2 = Some ( SPrime :: < G2 > :: commitment_key_floor ( ) ) ;
1023
+ let pp_hint1 = Some ( SPrime :: < G1 , E1 > :: commitment_key_floor ( ) ) ;
1024
+ let pp_hint2 = Some ( SPrime :: < G2 , E2 > :: commitment_key_floor ( ) ) ;
1025
1025
let pp = PublicParams :: < G1 , G2 , T1 , T2 > :: new ( circuit1, circuit2, pp_hint1, pp_hint2) ;
1026
1026
1027
1027
let digest_str = pp
@@ -1045,13 +1045,13 @@ mod tests {
1045
1045
let trivial_circuit2 = TrivialCircuit :: < <G2 as Group >:: Scalar > :: default ( ) ;
1046
1046
let cubic_circuit1 = CubicCircuit :: < <G1 as Group >:: Scalar > :: default ( ) ;
1047
1047
1048
- test_pp_digest_with :: < G1 , G2 , _ , _ > (
1048
+ test_pp_digest_with :: < G1 , G2 , _ , _ , EE < _ > , EE < _ > > (
1049
1049
& trivial_circuit1,
1050
1050
& trivial_circuit2,
1051
1051
"fd9cafd3d142c3ab694e35384293211fcf377fa484343d0d6889e6664103c802" ,
1052
1052
) ;
1053
1053
1054
- test_pp_digest_with :: < G1 , G2 , _ , _ > (
1054
+ test_pp_digest_with :: < G1 , G2 , _ , _ , EE < _ > , EE < _ > > (
1055
1055
& cubic_circuit1,
1056
1056
& trivial_circuit2,
1057
1057
"6701f6db5a6e3f0e0002740913d6f465ec432cdf59a0dcc68152904a9a4f9d00" ,
@@ -1061,12 +1061,12 @@ mod tests {
1061
1061
let trivial_circuit2_grumpkin = TrivialCircuit :: < <grumpkin:: Point as Group >:: Scalar > :: default ( ) ;
1062
1062
let cubic_circuit1_grumpkin = CubicCircuit :: < <bn256:: Point as Group >:: Scalar > :: default ( ) ;
1063
1063
1064
- test_pp_digest_with :: < bn256:: Point , grumpkin:: Point , _ , _ > (
1064
+ test_pp_digest_with :: < bn256:: Point , grumpkin:: Point , _ , _ , EE < _ > , EE < _ > > (
1065
1065
& trivial_circuit1_grumpkin,
1066
1066
& trivial_circuit2_grumpkin,
1067
1067
"184d05f08dca260f010cb48c6cf8c5eb61dedfc270e5a18226eb622cf7da0203" ,
1068
1068
) ;
1069
- test_pp_digest_with :: < bn256:: Point , grumpkin:: Point , _ , _ > (
1069
+ test_pp_digest_with :: < bn256:: Point , grumpkin:: Point , _ , _ , EE < _ > , EE < _ > > (
1070
1070
& cubic_circuit1_grumpkin,
1071
1071
& trivial_circuit2_grumpkin,
1072
1072
"2fb992932b2a642b4ce8f52646a7ef6a5a486682716cf969df50021107afff03" ,
@@ -1076,12 +1076,12 @@ mod tests {
1076
1076
let trivial_circuit2_secp = TrivialCircuit :: < <secq256k1:: Point as Group >:: Scalar > :: default ( ) ;
1077
1077
let cubic_circuit1_secp = CubicCircuit :: < <secp256k1:: Point as Group >:: Scalar > :: default ( ) ;
1078
1078
1079
- test_pp_digest_with :: < secp256k1:: Point , secq256k1:: Point , _ , _ > (
1079
+ test_pp_digest_with :: < secp256k1:: Point , secq256k1:: Point , _ , _ , EE < _ > , EE < _ > > (
1080
1080
& trivial_circuit1_secp,
1081
1081
& trivial_circuit2_secp,
1082
1082
"da68dde1bb88f9a342fe7facedf14ab5e7f3d9afc2777697606ff3de061d1601" ,
1083
1083
) ;
1084
- test_pp_digest_with :: < secp256k1:: Point , secq256k1:: Point , _ , _ > (
1084
+ test_pp_digest_with :: < secp256k1:: Point , secq256k1:: Point , _ , _ , EE < _ > , EE < _ > > (
1085
1085
& cubic_circuit1_secp,
1086
1086
& trivial_circuit2_secp,
1087
1087
"4a7d379403a99a46592b70c8446206542ce09e08dc96c0ba57f36efce8b0fa00" ,
@@ -1227,13 +1227,12 @@ mod tests {
1227
1227
test_ivc_nontrivial_with :: < secp256k1:: Point , secq256k1:: Point > ( ) ;
1228
1228
}
1229
1229
1230
- fn test_ivc_nontrivial_with_compression_with < G1 , G2 > ( )
1230
+ fn test_ivc_nontrivial_with_compression_with < G1 , G2 , E1 , E2 > ( )
1231
1231
where
1232
1232
G1 : Group < Base = <G2 as Group >:: Scalar > ,
1233
1233
G2 : Group < Base = <G1 as Group >:: Scalar > ,
1234
- // this is due to the reliance on CommitmentKeyExtTrait as a bound in ipa_pc
1235
- <G1 :: CE as CommitmentEngineTrait < G1 > >:: CommitmentKey : CommitmentKeyExtTrait < G1 > ,
1236
- <G2 :: CE as CommitmentEngineTrait < G2 > >:: CommitmentKey : CommitmentKeyExtTrait < G2 > ,
1234
+ E1 : EvaluationEngineTrait < G1 > ,
1235
+ E2 : EvaluationEngineTrait < G2 > ,
1237
1236
// this is due to the reliance on Abomonation
1238
1237
<<G1 as Group >:: Scalar as PrimeField >:: Repr : Abomonation ,
1239
1238
<<G2 as Group >:: Scalar as PrimeField >:: Repr : Abomonation ,
@@ -1297,10 +1296,11 @@ mod tests {
1297
1296
assert_eq ! ( zn_secondary, vec![ <G2 as Group >:: Scalar :: from( 2460515u64 ) ] ) ;
1298
1297
1299
1298
// produce the prover and verifier keys for compressed snark
1300
- let ( pk, vk) = CompressedSNARK :: < _ , _ , _ , _ , S < G1 > , S < G2 > > :: setup ( & pp) . unwrap ( ) ;
1299
+ let ( pk, vk) = CompressedSNARK :: < _ , _ , _ , _ , S < G1 , E1 > , S < G2 , E2 > > :: setup ( & pp) . unwrap ( ) ;
1301
1300
1302
1301
// produce a compressed SNARK
1303
- let res = CompressedSNARK :: < _ , _ , _ , _ , S < G1 > , S < G2 > > :: prove ( & pp, & pk, & recursive_snark) ;
1302
+ let res =
1303
+ CompressedSNARK :: < _ , _ , _ , _ , S < G1 , E1 > , S < G2 , E2 > > :: prove ( & pp, & pk, & recursive_snark) ;
1304
1304
assert ! ( res. is_ok( ) ) ;
1305
1305
let compressed_snark = res. unwrap ( ) ;
1306
1306
@@ -1319,18 +1319,17 @@ mod tests {
1319
1319
type G1 = pasta_curves:: pallas:: Point ;
1320
1320
type G2 = pasta_curves:: vesta:: Point ;
1321
1321
1322
- test_ivc_nontrivial_with_compression_with :: < G1 , G2 > ( ) ;
1323
- test_ivc_nontrivial_with_compression_with :: < bn256:: Point , grumpkin:: Point > ( ) ;
1324
- test_ivc_nontrivial_with_compression_with :: < secp256k1:: Point , secq256k1:: Point > ( ) ;
1322
+ test_ivc_nontrivial_with_compression_with :: < G1 , G2 , EE < _ > , EE < _ > > ( ) ;
1323
+ test_ivc_nontrivial_with_compression_with :: < bn256:: Point , grumpkin:: Point , EE < _ > , EE < _ > > ( ) ;
1324
+ test_ivc_nontrivial_with_compression_with :: < secp256k1:: Point , secq256k1:: Point , EE < _ > , EE < _ > > ( ) ;
1325
1325
}
1326
1326
1327
- fn test_ivc_nontrivial_with_spark_compression_with < G1 , G2 > ( )
1327
+ fn test_ivc_nontrivial_with_spark_compression_with < G1 , G2 , E1 , E2 > ( )
1328
1328
where
1329
1329
G1 : Group < Base = <G2 as Group >:: Scalar > ,
1330
1330
G2 : Group < Base = <G1 as Group >:: Scalar > ,
1331
- // this is due to the reliance on CommitmentKeyExtTrait as a bound in ipa_pc
1332
- <G1 :: CE as CommitmentEngineTrait < G1 > >:: CommitmentKey : CommitmentKeyExtTrait < G1 > ,
1333
- <G2 :: CE as CommitmentEngineTrait < G2 > >:: CommitmentKey : CommitmentKeyExtTrait < G2 > ,
1331
+ E1 : EvaluationEngineTrait < G1 > ,
1332
+ E2 : EvaluationEngineTrait < G2 > ,
1334
1333
// this is due to the reliance on Abomonation
1335
1334
<<G1 as Group >:: Scalar as PrimeField >:: Repr : Abomonation ,
1336
1335
<<G2 as Group >:: Scalar as PrimeField >:: Repr : Abomonation ,
@@ -1347,8 +1346,8 @@ mod tests {
1347
1346
> :: new (
1348
1347
& circuit_primary,
1349
1348
& circuit_secondary,
1350
- Some ( SPrime :: commitment_key_floor ( ) ) ,
1351
- Some ( SPrime :: commitment_key_floor ( ) ) ,
1349
+ Some ( SPrime :: < _ , E1 > :: commitment_key_floor ( ) ) ,
1350
+ Some ( SPrime :: < _ , E2 > :: commitment_key_floor ( ) ) ,
1352
1351
) ;
1353
1352
1354
1353
let num_steps = 3 ;
@@ -1401,11 +1400,15 @@ mod tests {
1401
1400
// run the compressed snark with Spark compiler
1402
1401
1403
1402
// produce the prover and verifier keys for compressed snark
1404
- let ( pk, vk) = CompressedSNARK :: < _ , _ , _ , _ , SPrime < G1 > , SPrime < G2 > > :: setup ( & pp) . unwrap ( ) ;
1403
+ let ( pk, vk) =
1404
+ CompressedSNARK :: < _ , _ , _ , _ , SPrime < G1 , E1 > , SPrime < G2 , E2 > > :: setup ( & pp) . unwrap ( ) ;
1405
1405
1406
1406
// produce a compressed SNARK
1407
- let res =
1408
- CompressedSNARK :: < _ , _ , _ , _ , SPrime < G1 > , SPrime < G2 > > :: prove ( & pp, & pk, & recursive_snark) ;
1407
+ let res = CompressedSNARK :: < _ , _ , _ , _ , SPrime < G1 , E1 > , SPrime < G2 , E2 > > :: prove (
1408
+ & pp,
1409
+ & pk,
1410
+ & recursive_snark,
1411
+ ) ;
1409
1412
assert ! ( res. is_ok( ) ) ;
1410
1413
let compressed_snark = res. unwrap ( ) ;
1411
1414
@@ -1424,18 +1427,23 @@ mod tests {
1424
1427
type G1 = pasta_curves:: pallas:: Point ;
1425
1428
type G2 = pasta_curves:: vesta:: Point ;
1426
1429
1427
- test_ivc_nontrivial_with_spark_compression_with :: < G1 , G2 > ( ) ;
1428
- test_ivc_nontrivial_with_spark_compression_with :: < bn256:: Point , grumpkin:: Point > ( ) ;
1429
- test_ivc_nontrivial_with_spark_compression_with :: < secp256k1:: Point , secq256k1:: Point > ( ) ;
1430
+ test_ivc_nontrivial_with_spark_compression_with :: < G1 , G2 , EE < _ > , EE < _ > > ( ) ;
1431
+ test_ivc_nontrivial_with_spark_compression_with :: < bn256:: Point , grumpkin:: Point , EE < _ > , EE < _ > > (
1432
+ ) ;
1433
+ test_ivc_nontrivial_with_spark_compression_with :: <
1434
+ secp256k1:: Point ,
1435
+ secq256k1:: Point ,
1436
+ EE < _ > ,
1437
+ EE < _ > ,
1438
+ > ( ) ;
1430
1439
}
1431
1440
1432
- fn test_ivc_nondet_with_compression_with < G1 , G2 > ( )
1441
+ fn test_ivc_nondet_with_compression_with < G1 , G2 , E1 , E2 > ( )
1433
1442
where
1434
1443
G1 : Group < Base = <G2 as Group >:: Scalar > ,
1435
1444
G2 : Group < Base = <G1 as Group >:: Scalar > ,
1436
- // this is due to the reliance on CommitmentKeyExtTrait as a bound in ipa_pc
1437
- <G1 :: CE as CommitmentEngineTrait < G1 > >:: CommitmentKey : CommitmentKeyExtTrait < G1 > ,
1438
- <G2 :: CE as CommitmentEngineTrait < G2 > >:: CommitmentKey : CommitmentKeyExtTrait < G2 > ,
1445
+ E1 : EvaluationEngineTrait < G1 > ,
1446
+ E2 : EvaluationEngineTrait < G2 > ,
1439
1447
// this is due to the reliance on Abomonation
1440
1448
<<G1 as Group >:: Scalar as PrimeField >:: Repr : Abomonation ,
1441
1449
<<G2 as Group >:: Scalar as PrimeField >:: Repr : Abomonation ,
@@ -1555,10 +1563,11 @@ mod tests {
1555
1563
assert ! ( res. is_ok( ) ) ;
1556
1564
1557
1565
// produce the prover and verifier keys for compressed snark
1558
- let ( pk, vk) = CompressedSNARK :: < _ , _ , _ , _ , S < G1 > , S < G2 > > :: setup ( & pp) . unwrap ( ) ;
1566
+ let ( pk, vk) = CompressedSNARK :: < _ , _ , _ , _ , S < G1 , E1 > , S < G2 , E2 > > :: setup ( & pp) . unwrap ( ) ;
1559
1567
1560
1568
// produce a compressed SNARK
1561
- let res = CompressedSNARK :: < _ , _ , _ , _ , S < G1 > , S < G2 > > :: prove ( & pp, & pk, & recursive_snark) ;
1569
+ let res =
1570
+ CompressedSNARK :: < _ , _ , _ , _ , S < G1 , E1 > , S < G2 , E2 > > :: prove ( & pp, & pk, & recursive_snark) ;
1562
1571
assert ! ( res. is_ok( ) ) ;
1563
1572
let compressed_snark = res. unwrap ( ) ;
1564
1573
@@ -1572,9 +1581,9 @@ mod tests {
1572
1581
type G1 = pasta_curves:: pallas:: Point ;
1573
1582
type G2 = pasta_curves:: vesta:: Point ;
1574
1583
1575
- test_ivc_nondet_with_compression_with :: < G1 , G2 > ( ) ;
1576
- test_ivc_nondet_with_compression_with :: < bn256:: Point , grumpkin:: Point > ( ) ;
1577
- test_ivc_nondet_with_compression_with :: < secp256k1:: Point , secq256k1:: Point > ( ) ;
1584
+ test_ivc_nondet_with_compression_with :: < G1 , G2 , EE < _ > , EE < _ > > ( ) ;
1585
+ test_ivc_nondet_with_compression_with :: < bn256:: Point , grumpkin:: Point , EE < _ > , EE < _ > > ( ) ;
1586
+ test_ivc_nondet_with_compression_with :: < secp256k1:: Point , secq256k1:: Point , EE < _ > , EE < _ > > ( ) ;
1578
1587
}
1579
1588
1580
1589
fn test_ivc_base_with < G1 , G2 > ( )
0 commit comments