mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-09-11 05:45:30 +03:00
cargo fmt
This commit is contained in:
parent
f144571530
commit
5db9b043dc
@ -381,8 +381,7 @@ impl<
|
||||
Ok(ConstrainedValue::Integer(result))
|
||||
}
|
||||
(ConstrainedValue::Group(ge_1), ConstrainedValue::Group(ge_2)) => {
|
||||
let result =
|
||||
GType::conditionally_select(cs, &resolved_first, &ge_1, &ge_2)?;
|
||||
let result = GType::conditionally_select(cs, &resolved_first, &ge_1, &ge_2)?;
|
||||
Ok(ConstrainedValue::Group(result))
|
||||
}
|
||||
(_, _) => {
|
||||
|
@ -7,7 +7,7 @@ use snarkos_errors::gadgets::SynthesisError;
|
||||
use snarkos_gadgets::curves::edwards_bls12::EdwardsBlsGadget;
|
||||
use snarkos_models::curves::{AffineCurve, ModelParameters};
|
||||
use snarkos_models::gadgets::curves::{FpGadget, GroupGadget};
|
||||
use snarkos_models::gadgets::r1cs::{ConstraintSystem};
|
||||
use snarkos_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkos_models::gadgets::utilities::alloc::AllocGadget;
|
||||
use snarkos_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkos_models::gadgets::utilities::eq::{ConditionalEqGadget, EqGadget};
|
||||
@ -114,10 +114,12 @@ impl EdwardsGroupType {
|
||||
mut cs: CS,
|
||||
) -> Result<EdwardsBlsGadget, SynthesisError> {
|
||||
match self {
|
||||
EdwardsGroupType::Constant(constant) => <EdwardsBlsGadget as AllocGadget<
|
||||
GroupAffine<EdwardsParameters>,
|
||||
Fq,
|
||||
>>::alloc(&mut cs.ns(|| format!("{:?}", constant)), || Ok(constant)),
|
||||
EdwardsGroupType::Constant(constant) => {
|
||||
<EdwardsBlsGadget as AllocGadget<GroupAffine<EdwardsParameters>, Fq>>::alloc(
|
||||
&mut cs.ns(|| format!("{:?}", constant)),
|
||||
|| Ok(constant),
|
||||
)
|
||||
}
|
||||
EdwardsGroupType::Allocated(allocated) => Ok(allocated.clone()),
|
||||
}
|
||||
}
|
||||
|
@ -8,10 +8,10 @@ use snarkos_models::curves::Group;
|
||||
use crate::boolean::{output_false, output_true};
|
||||
use leo_compiler::errors::{CompilerError, FunctionError, StatementError};
|
||||
use snarkos_gadgets::curves::edwards_bls12::EdwardsBlsGadget;
|
||||
use snarkos_models::gadgets::curves::GroupGadget;
|
||||
use snarkos_models::gadgets::r1cs::TestConstraintSystem;
|
||||
use snarkos_models::gadgets::utilities::alloc::AllocGadget;
|
||||
use std::str::FromStr;
|
||||
use snarkos_models::gadgets::curves::GroupGadget;
|
||||
|
||||
const DIRECTORY_NAME: &str = "tests/group/";
|
||||
|
||||
@ -141,15 +141,14 @@ fn test_ternary() {
|
||||
let point_1 = EdwardsAffine::from_str(TEST_POINT_1).unwrap();
|
||||
let output_1 = get_output(program_1);
|
||||
let actual_1: EdwardsAffine = match output_1 {
|
||||
EdwardsConstrainedValue::Return(vec) => {
|
||||
match vec.as_slice() {
|
||||
[ConstrainedValue::Group(EdwardsGroupType::Allocated(edwards_gadget))] => {
|
||||
<EdwardsBlsGadget as GroupGadget<EdwardsAffine, Fq>>::get_value(edwards_gadget).unwrap()
|
||||
}
|
||||
_ => panic!("program output unknown return value")
|
||||
EdwardsConstrainedValue::Return(vec) => match vec.as_slice() {
|
||||
[ConstrainedValue::Group(EdwardsGroupType::Allocated(edwards_gadget))] => {
|
||||
<EdwardsBlsGadget as GroupGadget<EdwardsAffine, Fq>>::get_value(edwards_gadget)
|
||||
.unwrap()
|
||||
}
|
||||
_ => panic!("program output unknown return value"),
|
||||
},
|
||||
_ => panic!("program output unknown return value")
|
||||
_ => panic!("program output unknown return value"),
|
||||
};
|
||||
|
||||
assert_eq!(point_1, actual_1);
|
||||
@ -160,15 +159,14 @@ fn test_ternary() {
|
||||
let point_2 = EdwardsAffine::from_str(TEST_POINT_2).unwrap();
|
||||
let output_2 = get_output(program_2);
|
||||
let actual_2: EdwardsAffine = match output_2 {
|
||||
EdwardsConstrainedValue::Return(vec) => {
|
||||
match vec.as_slice() {
|
||||
[ConstrainedValue::Group(EdwardsGroupType::Allocated(edwards_gadget))] => {
|
||||
<EdwardsBlsGadget as GroupGadget<EdwardsAffine, Fq>>::get_value(edwards_gadget).unwrap()
|
||||
}
|
||||
_ => panic!("program output unknown return value")
|
||||
EdwardsConstrainedValue::Return(vec) => match vec.as_slice() {
|
||||
[ConstrainedValue::Group(EdwardsGroupType::Allocated(edwards_gadget))] => {
|
||||
<EdwardsBlsGadget as GroupGadget<EdwardsAffine, Fq>>::get_value(edwards_gadget)
|
||||
.unwrap()
|
||||
}
|
||||
_ => panic!("program output unknown return value"),
|
||||
},
|
||||
_ => panic!("program output unknown return value")
|
||||
_ => panic!("program output unknown return value"),
|
||||
};
|
||||
|
||||
assert_eq!(point_2, actual_2);
|
||||
|
Loading…
Reference in New Issue
Block a user