fmt stable only features, test all the platforms, cc stable

This commit is contained in:
gluaxspeed 2021-07-14 13:55:01 -07:00
parent 1168354a5c
commit 315dcebb34
60 changed files with 252 additions and 459 deletions

View File

@ -70,7 +70,7 @@ jobs:
args: --all-features --examples --all --benches
test-package-linux:
name: Test Package
name: Test Package Linux
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -93,7 +93,7 @@ jobs:
cargo test-all-features
test-package-windows:
name: Test Package
name: Test Package Windows
runs-on: windows-latest
steps:
- name: Checkout
@ -115,9 +115,65 @@ jobs:
cd package
cargo test-all-features
test-package-macos:
name: Test Package macOS
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust Stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install cargo-all-features
run: |
cargo install cargo-all-features
- name: Test
run: |
cd package
cargo test-all-features
test-package-macos_m1:
name: Test Package macOS M1
runs-on: macos-latest
steps:
- name: Xcode Select
uses: devbotsxyz/xcode-select@v1.1.0
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
target: aarch64-apple-darwin
toolchain: stable
override: true
components: rustfmt
- name: Install cargo-all-features
run: |
SDKROOT=$(xcrun -sdk macosx11.1 --show-sdk-path) \
MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.1 --show-sdk-platform-version) \
cargo install cargo-all-features
- name: Test
run: |
SDKROOT=$(xcrun -sdk macosx11.1 --show-sdk-path) \
MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.1 --show-sdk-platform-version) \
cd package && cargo test-all-features
codecov:
name: Code Coverage
runs-on: ubuntu-latest
env:
RUSTC_BOOTSTRAP=1
steps:
- name: Checkout
uses: actions/checkout@v1
@ -126,7 +182,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
toolchain: stable
override: true
components: rustfmt

View File

@ -8,9 +8,9 @@ use_field_init_shorthand = true
use_try_shorthand = true
# Nightly configurations
imports_layout = "HorizontalVertical"
license_template_path = ".resources/license_header"
imports_granularity = "Crate"
overflow_delimited_expr = true
reorder_impl_items = true
version = "Two"
# imports_layout = "HorizontalVertical"
# license_template_path = ".resources/license_header"
# imports_granularity = "Crate"
# overflow_delimited_expr = true
# reorder_impl_items = true
# version = "Two"

View File

@ -15,14 +15,7 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::{
statement::*,
BoolAnd,
Expression,
Monoid,
MonoidalReducerExpression,
MonoidalReducerStatement,
Node,
Span,
statement::*, BoolAnd, Expression, Monoid, MonoidalReducerExpression, MonoidalReducerStatement, Node, Span,
};
pub struct ReturnPathReducer {

View File

@ -15,19 +15,8 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::{
AsgConvertError,
CircuitMember,
ConstValue,
Expression,
ExpressionNode,
FromAst,
Function,
FunctionQualifier,
Node,
PartialType,
Scope,
Span,
Type,
AsgConvertError, CircuitMember, ConstValue, Expression, ExpressionNode, FromAst, Function, FunctionQualifier, Node,
PartialType, Scope, Span, Type,
};
pub use leo_ast::{BinaryOperation, Node as AstNode};

View File

@ -15,19 +15,8 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::{
AsgConvertError,
Circuit,
CircuitMember,
ConstValue,
Expression,
ExpressionNode,
FromAst,
Identifier,
Node,
PartialType,
Scope,
Span,
Type,
AsgConvertError, Circuit, CircuitMember, ConstValue, Expression, ExpressionNode, FromAst, Identifier, Node,
PartialType, Scope, Span, Type,
};
use std::cell::Cell;

View File

@ -15,19 +15,8 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::{
AsgConvertError,
Circuit,
CircuitMember,
ConstValue,
Expression,
ExpressionNode,
FromAst,
Identifier,
Node,
PartialType,
Scope,
Span,
Type,
AsgConvertError, Circuit, CircuitMember, ConstValue, Expression, ExpressionNode, FromAst, Identifier, Node,
PartialType, Scope, Span, Type,
};
use indexmap::{IndexMap, IndexSet};

View File

@ -15,19 +15,8 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::{
AsgConvertError,
CharValue,
ConstInt,
ConstValue,
Expression,
ExpressionNode,
FromAst,
GroupValue,
Node,
PartialType,
Scope,
Span,
Type,
AsgConvertError, CharValue, ConstInt, ConstValue, Expression, ExpressionNode, FromAst, GroupValue, Node,
PartialType, Scope, Span, Type,
};
use std::cell::Cell;

View File

@ -15,20 +15,8 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::{
AsgConvertError,
ConstValue,
Constant,
DefinitionStatement,
Expression,
ExpressionNode,
FromAst,
Node,
PartialType,
Scope,
Span,
Statement,
Type,
Variable,
AsgConvertError, ConstValue, Constant, DefinitionStatement, Expression, ExpressionNode, FromAst, Node, PartialType,
Scope, Span, Statement, Type, Variable,
};
use std::cell::Cell;

View File

@ -15,16 +15,7 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::{
AsgContextInner,
AsgConvertError,
Circuit,
Expression,
Function,
PartialType,
Scope,
Span,
Statement,
Variable,
AsgContextInner, AsgConvertError, Circuit, Expression, Function, PartialType, Scope, Span, Statement, Variable,
};
/// A node in the abstract semantic graph.

View File

@ -15,18 +15,8 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::{
AsgConvertError,
BlockStatement,
Circuit,
FromAst,
Identifier,
MonoidalDirector,
ReturnPathReducer,
Scope,
Span,
Statement,
Type,
Variable,
AsgConvertError, BlockStatement, Circuit, FromAst, Identifier, MonoidalDirector, ReturnPathReducer, Scope, Span,
Statement, Type, Variable,
};
use indexmap::IndexMap;
pub use leo_ast::Annotation;

View File

@ -25,15 +25,7 @@ mod function;
pub use function::*;
use crate::{
node::FromAst,
ArenaNode,
AsgContext,
AsgConvertError,
DefinitionStatement,
ImportResolver,
Input,
Scope,
Statement,
node::FromAst, ArenaNode, AsgContext, AsgConvertError, DefinitionStatement, ImportResolver, Input, Scope, Statement,
};
use leo_ast::{Identifier, PackageAccess, PackageOrPackages, Span};

View File

@ -15,22 +15,8 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::{
AsgConvertError,
CircuitMember,
ConstInt,
ConstValue,
Expression,
ExpressionNode,
FromAst,
Identifier,
IntegerType,
Node,
PartialType,
Scope,
Span,
Statement,
Type,
Variable,
AsgConvertError, CircuitMember, ConstInt, ConstValue, Expression, ExpressionNode, FromAst, Identifier, IntegerType,
Node, PartialType, Scope, Span, Statement, Type, Variable,
};
pub use leo_ast::AssignOperation;
use leo_ast::AssigneeAccess as AstAssigneeAccess;

View File

@ -15,18 +15,8 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::{
AsgConvertError,
Expression,
ExpressionNode,
FromAst,
InnerVariable,
Node,
PartialType,
Scope,
Span,
Statement,
Type,
Variable,
AsgConvertError, Expression, ExpressionNode, FromAst, InnerVariable, Node, PartialType, Scope, Span, Statement,
Type, Variable,
};
use std::cell::{Cell, RefCell};
@ -44,12 +34,15 @@ impl<'a> DefinitionStatement<'a> {
self.variables
.iter()
.map(|variable| {
(variable.borrow().name.name.to_string(), DefinitionStatement {
parent: self.parent.clone(),
span: self.span.clone(),
variables: vec![variable],
value: self.value.clone(),
})
(
variable.borrow().name.name.to_string(),
DefinitionStatement {
parent: self.parent.clone(),
span: self.span.clone(),
variables: vec![variable],
value: self.value.clone(),
},
)
})
.collect()
}

View File

@ -17,16 +17,7 @@
use leo_ast::IntegerType;
use crate::{
AsgConvertError,
Expression,
ExpressionNode,
FromAst,
InnerVariable,
Node,
PartialType,
Scope,
Span,
Statement,
AsgConvertError, Expression, ExpressionNode, FromAst, InnerVariable, Node, PartialType, Scope, Span, Statement,
Variable,
};

View File

@ -21,13 +21,9 @@ use tendril::StrTendril;
use crate::Node;
use serde::{
de::{
Visitor,
{self},
Visitor, {self},
},
Deserialize,
Deserializer,
Serialize,
Serializer,
Deserialize, Deserializer, Serialize, Serializer,
};
use std::{
collections::BTreeMap,

View File

@ -15,13 +15,7 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::{
ArrayDimensions,
CircuitImpliedVariableDefinition,
GroupValue,
Identifier,
IntegerType,
PositiveNumber,
Span,
ArrayDimensions, CircuitImpliedVariableDefinition, GroupValue, Identifier, IntegerType, PositiveNumber, Span,
SpreadOrExpression,
};

View File

@ -16,11 +16,8 @@
use crate::common::span::Span;
use leo_input::values::{
GroupCoordinate as InputGroupCoordinate,
Inferred as InputInferred,
NumberValue as InputNumberValue,
SignHigh as InputSignHigh,
SignLow as InputSignLow,
GroupCoordinate as InputGroupCoordinate, Inferred as InputInferred, NumberValue as InputNumberValue,
SignHigh as InputSignHigh, SignLow as InputSignLow,
};
use serde::{Deserialize, Serialize};

View File

@ -16,9 +16,7 @@
use crate::{common::span::Span, groups::GroupCoordinate};
use leo_input::values::{
GroupRepresentation as InputGroupRepresentation,
GroupTuple as InputGroupTuple,
GroupValue as InputGroupValue,
GroupRepresentation as InputGroupRepresentation, GroupTuple as InputGroupTuple, GroupValue as InputGroupValue,
};
use serde::{Deserialize, Serialize};

View File

@ -20,15 +20,8 @@ use leo_input::{
expressions::{ArrayInitializerExpression, ArrayInlineExpression, Expression, StringExpression, TupleExpression},
types::{ArrayType, CharType, DataType, IntegerType, TupleType, Type},
values::{
Address,
AddressValue,
BooleanValue,
CharValue as InputCharValue,
FieldValue,
GroupValue as InputGroupValue,
IntegerValue,
NumberValue,
Value,
Address, AddressValue, BooleanValue, CharValue as InputCharValue, FieldValue, GroupValue as InputGroupValue,
IntegerValue, NumberValue, Value,
},
};
use pest::Span;

View File

@ -40,7 +40,11 @@ impl PublicState {
}
pub fn len(&self) -> usize {
if self.state.is_present() { 1usize } else { 0usize }
if self.state.is_present() {
1usize
} else {
0usize
}
}
/// Parse all input variables included in a file and store them in `self`.

View File

@ -15,8 +15,7 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use leo_input::types::{
IntegerType as InputIntegerType,
SignedIntegerType as InputSignedIntegerType,
IntegerType as InputIntegerType, SignedIntegerType as InputSignedIntegerType,
UnsignedIntegerType as InputUnsignedIntegerType,
};

View File

@ -16,10 +16,7 @@
use crate::{ArrayDimensions, Identifier, IntegerType};
use leo_input::types::{
ArrayType as InputArrayType,
DataType as InputDataType,
TupleType as InputTupleType,
Type as InputType,
ArrayType as InputArrayType, DataType as InputDataType, TupleType as InputTupleType, Type as InputType,
};
use serde::{Deserialize, Serialize};

View File

@ -18,12 +18,7 @@
use crate::{
constraints::{generate_constraints, generate_test_constraints},
errors::CompilerError,
CompilerOptions,
GroupType,
Output,
OutputFile,
TheoremOptions,
TypeInferencePhase,
CompilerOptions, GroupType, Output, OutputFile, TheoremOptions, TypeInferencePhase,
};
pub use leo_asg::{new_context, AsgContext as Context, AsgContext};
use leo_asg::{Asg, AsgPass, FormattedError, Program as AsgProgram};

View File

@ -17,11 +17,7 @@
//! Enforces an assert equals statement in a compiled Leo program.
use crate::{
errors::ConsoleError,
get_indicator_value,
program::ConstrainedProgram,
value::ConstrainedValue,
GroupType,
errors::ConsoleError, get_indicator_value, program::ConstrainedProgram, value::ConstrainedValue, GroupType,
};
use leo_asg::{Expression, Span};

View File

@ -15,14 +15,7 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::errors::{
AddressError,
BooleanError,
CharError,
FieldError,
FunctionError,
GroupError,
IntegerError,
ValueError,
AddressError, BooleanError, CharError, FieldError, FunctionError, GroupError, IntegerError, ValueError,
};
use leo_ast::{FormattedError, Identifier, LeoError, Span};
use snarkvm_r1cs::SynthesisError;

View File

@ -15,16 +15,8 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::errors::{
AddressError,
BooleanError,
CharError,
ExpressionError,
FieldError,
GroupError,
IntegerError,
OutputBytesError,
StatementError,
ValueError,
AddressError, BooleanError, CharError, ExpressionError, FieldError, GroupError, IntegerError, OutputBytesError,
StatementError, ValueError,
};
use leo_asg::AsgConvertError;
use leo_ast::{FormattedError, LeoError, Span};

View File

@ -24,8 +24,7 @@ use crate::{
relational::*,
resolve_core_circuit,
value::{Address, Char, CharType, ConstrainedCircuitMember, ConstrainedValue, Integer},
FieldType,
GroupType,
FieldType, GroupType,
};
use leo_asg::{expression::*, ConstValue, Expression, Node, Span};

View File

@ -21,16 +21,10 @@ use crate::{
errors::{FunctionError, IntegerError},
program::ConstrainedProgram,
value::{
boolean::input::bool_from_input,
char::char_from_input,
field::input::field_from_input,
group::input::group_from_input,
ConstrainedValue,
boolean::input::bool_from_input, char::char_from_input, field::input::field_from_input,
group::input::group_from_input, ConstrainedValue,
},
CharType,
FieldType,
GroupType,
Integer,
CharType, FieldType, GroupType, Integer,
};
use leo_asg::{ConstInt, Type};
use leo_ast::{Char, InputValue, Span};

View File

@ -20,16 +20,8 @@ use std::cell::Cell;
use crate::{errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
use leo_asg::{
ArrayAccessExpression,
ArrayRangeAccessExpression,
AssignAccess,
AssignOperation,
AssignStatement,
CircuitAccessExpression,
Expression,
Node,
TupleAccessExpression,
Variable,
ArrayAccessExpression, ArrayRangeAccessExpression, AssignAccess, AssignOperation, AssignStatement,
CircuitAccessExpression, Expression, Node, TupleAccessExpression, Variable,
};
use snarkvm_fields::PrimeField;

View File

@ -17,11 +17,7 @@
//! Enforces that one return value is produced in a compiled Leo program.
use crate::{
errors::StatementError,
get_indicator_value,
program::ConstrainedProgram,
value::ConstrainedValue,
GroupType,
errors::StatementError, get_indicator_value, program::ConstrainedProgram, value::ConstrainedValue, GroupType,
};
use leo_asg::{Span, Type};

View File

@ -158,10 +158,13 @@ impl Output {
_ => value.to_string(),
};
registers.insert(name.to_string(), OutputRegister {
type_: register_type.to_string(),
value,
});
registers.insert(
name.to_string(),
OutputRegister {
type_: register_type.to_string(),
value,
},
);
}
Ok(Output { registers })

View File

@ -21,8 +21,7 @@ use crate::errors::OutputFileError;
use std::{
borrow::Cow,
fs::{
File,
{self},
File, {self},
},
io::Write,
path::Path,

View File

@ -18,87 +18,37 @@
use indexmap::IndexMap;
use leo_asg::{
ArrayAccessExpression as AsgArrayAccessExpression,
ArrayInitExpression as AsgArrayInitExpression,
ArrayInlineExpression as AsgArrayInlineExpression,
ArrayRangeAccessExpression as AsgArrayRangeAccessExpression,
AssignAccess as AsgAssignAccess,
AssignStatement as AsgAssignStatement,
BinaryExpression as AsgBinaryExpression,
BlockStatement as AsgBlockStatement,
CallExpression as AsgCallExpression,
CastExpression as AsgCastExpression,
CharValue as AsgCharValue,
Circuit as AsgCircuit,
CircuitAccessExpression as AsgCircuitAccessExpression,
CircuitInitExpression as AsgCircuitInitExpression,
CircuitMember as AsgCircuitMember,
ConditionalStatement as AsgConditionalStatement,
ConsoleFunction as AsgConsoleFunction,
ConsoleStatement as AsgConsoleStatement,
ConstValue,
Constant as AsgConstant,
DefinitionStatement as AsgDefinitionStatement,
Expression as AsgExpression,
ExpressionStatement as AsgExpressionStatement,
Function as AsgFunction,
GroupValue as AsgGroupValue,
IterationStatement as AsgIterationStatement,
ReturnStatement as AsgReturnStatement,
Statement as AsgStatement,
TernaryExpression as AsgTernaryExpression,
TupleAccessExpression as AsgTupleAccessExpression,
TupleInitExpression as AsgTupleInitExpression,
Type as AsgType,
UnaryExpression as AsgUnaryExpression,
ArrayAccessExpression as AsgArrayAccessExpression, ArrayInitExpression as AsgArrayInitExpression,
ArrayInlineExpression as AsgArrayInlineExpression, ArrayRangeAccessExpression as AsgArrayRangeAccessExpression,
AssignAccess as AsgAssignAccess, AssignStatement as AsgAssignStatement, BinaryExpression as AsgBinaryExpression,
BlockStatement as AsgBlockStatement, CallExpression as AsgCallExpression, CastExpression as AsgCastExpression,
CharValue as AsgCharValue, Circuit as AsgCircuit, CircuitAccessExpression as AsgCircuitAccessExpression,
CircuitInitExpression as AsgCircuitInitExpression, CircuitMember as AsgCircuitMember,
ConditionalStatement as AsgConditionalStatement, ConsoleFunction as AsgConsoleFunction,
ConsoleStatement as AsgConsoleStatement, ConstValue, Constant as AsgConstant,
DefinitionStatement as AsgDefinitionStatement, Expression as AsgExpression,
ExpressionStatement as AsgExpressionStatement, Function as AsgFunction, GroupValue as AsgGroupValue,
IterationStatement as AsgIterationStatement, ReturnStatement as AsgReturnStatement, Statement as AsgStatement,
TernaryExpression as AsgTernaryExpression, TupleAccessExpression as AsgTupleAccessExpression,
TupleInitExpression as AsgTupleInitExpression, Type as AsgType, UnaryExpression as AsgUnaryExpression,
VariableRef as AsgVariableRef,
};
use leo_ast::{
ArrayAccessExpression as AstArrayAccessExpression,
ArrayDimensions,
ArrayInitExpression as AstArrayInitExpression,
ArrayInlineExpression as AstArrayInlineExpression,
ArrayRangeAccessExpression as AstArrayRangeAccessExpression,
AssignStatement as AstAssignStatement,
Assignee,
AssigneeAccess as AstAssignAccess,
BinaryExpression as AstBinaryExpression,
Block as AstBlockStatement,
CallExpression as AstCallExpression,
CastExpression as AstCastExpression,
Char,
CharValue as AstCharValue,
Circuit as AstCircuit,
CircuitImpliedVariableDefinition,
CircuitInitExpression as AstCircuitInitExpression,
CircuitMember as AstCircuitMember,
CircuitMemberAccessExpression,
CircuitStaticFunctionAccessExpression,
CombinerError,
ConditionalStatement as AstConditionalStatement,
ConsoleFunction as AstConsoleFunction,
ConsoleStatement as AstConsoleStatement,
DefinitionStatement as AstDefinitionStatement,
Expression as AstExpression,
ExpressionStatement as AstExpressionStatement,
FormatString,
Function as AstFunction,
GroupTuple,
GroupValue as AstGroupValue,
IterationStatement as AstIterationStatement,
PositiveNumber,
ReconstructingReducer,
ReducerError,
ReturnStatement as AstReturnStatement,
Span,
SpreadOrExpression,
Statement as AstStatement,
TernaryExpression as AstTernaryExpression,
TupleAccessExpression as AstTupleAccessExpression,
TupleInitExpression as AstTupleInitExpression,
Type as AstType,
UnaryExpression as AstUnaryExpression,
ValueExpression,
ArrayAccessExpression as AstArrayAccessExpression, ArrayDimensions, ArrayInitExpression as AstArrayInitExpression,
ArrayInlineExpression as AstArrayInlineExpression, ArrayRangeAccessExpression as AstArrayRangeAccessExpression,
AssignStatement as AstAssignStatement, Assignee, AssigneeAccess as AstAssignAccess,
BinaryExpression as AstBinaryExpression, Block as AstBlockStatement, CallExpression as AstCallExpression,
CastExpression as AstCastExpression, Char, CharValue as AstCharValue, Circuit as AstCircuit,
CircuitImpliedVariableDefinition, CircuitInitExpression as AstCircuitInitExpression,
CircuitMember as AstCircuitMember, CircuitMemberAccessExpression, CircuitStaticFunctionAccessExpression,
CombinerError, ConditionalStatement as AstConditionalStatement, ConsoleFunction as AstConsoleFunction,
ConsoleStatement as AstConsoleStatement, DefinitionStatement as AstDefinitionStatement,
Expression as AstExpression, ExpressionStatement as AstExpressionStatement, FormatString, Function as AstFunction,
GroupTuple, GroupValue as AstGroupValue, IterationStatement as AstIterationStatement, PositiveNumber,
ReconstructingReducer, ReducerError, ReturnStatement as AstReturnStatement, Span, SpreadOrExpression,
Statement as AstStatement, TernaryExpression as AstTernaryExpression,
TupleAccessExpression as AstTupleAccessExpression, TupleInitExpression as AstTupleInitExpression, Type as AstType,
UnaryExpression as AstUnaryExpression, ValueExpression,
};
use tendril::StrTendril;

View File

@ -20,10 +20,7 @@ use leo_asg::{Function, Span};
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::{
algorithms::prf::Blake2sGadget,
bits::ToBytesGadget,
integers::uint::UInt8,
traits::algorithms::PRFGadget,
algorithms::prf::Blake2sGadget, bits::ToBytesGadget, integers::uint::UInt8, traits::algorithms::PRFGadget,
};
use snarkvm_r1cs::ConstraintSystem;

View File

@ -22,8 +22,7 @@ use crate::{
errors::{ExpressionError, StatementError},
program::ConstrainedProgram,
value::ConstrainedValue,
GroupType,
Integer,
GroupType, Integer,
};
use leo_asg::{ConstInt, Expression, Node};

View File

@ -95,15 +95,18 @@ impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
let mut target = self.get(variable.id).unwrap().clone();
let accesses: Vec<_> = assignee.target_accesses.iter().rev().collect();
self.resolve_target_access(cs, ResolverContext {
input: vec![&mut target],
span,
target_value,
remaining_accesses: &accesses[..],
indicator,
operation: assignee.operation,
from_range: false,
})?;
self.resolve_target_access(
cs,
ResolverContext {
input: vec![&mut target],
span,
target_value,
remaining_accesses: &accesses[..],
indicator,
operation: assignee.operation,
from_range: false,
},
)?;
*self.get_mut(variable.id).unwrap() = target;
Ok(())
}

View File

@ -17,12 +17,8 @@
//! Methods to enforce constraints on statements in a compiled Leo program.
use crate::{
errors::StatementError,
program::ConstrainedProgram,
value::ConstrainedValue,
GroupType,
IndicatorAndConstrainedValue,
StatementResult,
errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType,
IndicatorAndConstrainedValue, StatementResult,
};
use leo_asg::ConditionalStatement;

View File

@ -17,14 +17,8 @@
//! Enforces an iteration statement in a compiled Leo program.
use crate::{
errors::StatementError,
program::ConstrainedProgram,
value::ConstrainedValue,
GroupType,
IndicatorAndConstrainedValue,
Integer,
IntegerTrait,
StatementResult,
errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType,
IndicatorAndConstrainedValue, Integer, IntegerTrait, StatementResult,
};
use leo_asg::IterationStatement;

View File

@ -200,7 +200,11 @@ impl<F: PrimeField> ConditionalEqGadget<F> for Address {
}
fn cond_select_helper(first: &Address, second: &Address, cond: bool) -> Address {
if cond { first.clone() } else { second.clone() }
if cond {
first.clone()
} else {
second.clone()
}
}
impl<F: PrimeField> CondSelectGadget<F> for Address {

View File

@ -17,8 +17,7 @@
use crate::{
errors::CharError,
value::{field::input::allocate_field, ConstrainedValue},
FieldType,
GroupType,
FieldType, GroupType,
};
use leo_ast::{InputValue, Span};

View File

@ -20,8 +20,7 @@ use leo_asg::{GroupCoordinate, GroupValue, Span};
use snarkvm_curves::{
edwards_bls12::{EdwardsAffine, EdwardsParameters, Fq},
templates::twisted_edwards_extended::GroupAffine,
AffineCurve,
TEModelParameters,
AffineCurve, TEModelParameters,
};
use snarkvm_fields::{Fp256, One, Zero};
use snarkvm_gadgets::{
@ -479,7 +478,11 @@ impl CondSelectGadget<Fq> for EdwardsGroupType {
second: &Self,
) -> Result<Self, SynthesisError> {
if let Boolean::Constant(cond) = *cond {
if cond { Ok(first.clone()) } else { Ok(second.clone()) }
if cond {
Ok(first.clone())
} else {
Ok(second.clone())
}
} else {
let first_gadget = first.allocated(cs.ns(|| "first"))?;
let second_gadget = second.allocated(cs.ns(|| "second"))?;

View File

@ -23,10 +23,7 @@ pub mod type_inference;
use leo_asg::{new_alloc_context, new_context, AsgContext};
use leo_compiler::{
compiler::Compiler,
errors::CompilerError,
group::targets::edwards_bls12::EdwardsGroupType,
ConstrainedValue,
compiler::Compiler, errors::CompilerError, group::targets::edwards_bls12::EdwardsGroupType, ConstrainedValue,
OutputBytes,
};

View File

@ -17,8 +17,7 @@
use anyhow::{anyhow, Error, Result};
use reqwest::{
blocking::{multipart::Form, Client, Response},
Method,
StatusCode,
Method, StatusCode,
};
use serde::{Deserialize, Serialize};
use std::{collections::HashMap, path::PathBuf};

View File

@ -18,8 +18,7 @@ use crate::{commands::Command, context::Context};
use leo_compiler::{
compiler::{thread_leaked_context, Compiler},
group::targets::edwards_bls12::EdwardsGroupType,
CompilerOptions,
TheoremOptions,
CompilerOptions, TheoremOptions,
};
use leo_package::{
inputs::*,

View File

@ -20,8 +20,7 @@ use anyhow::{anyhow, Result};
use std::{
borrow::Cow,
fs::{
File,
{self},
File, {self},
},
io::{Read, Write},
path::Path,

View File

@ -16,9 +16,7 @@
use std::{
fs::{
create_dir_all,
File,
{self},
create_dir_all, File, {self},
},
io,
io::prelude::*,

View File

@ -23,19 +23,7 @@ pub mod updater;
use commands::{
package::{Add, Clone, Login, Logout, Publish, Remove},
Build,
Clean,
Command,
Deploy,
Init,
Lint,
New,
Prove,
Run,
Setup,
Test,
Update,
Watch,
Build, Clean, Command, Deploy, Init, Lint, New, Prove, Run, Setup, Test, Update, Watch,
};
use anyhow::Result;
@ -188,10 +176,13 @@ fn main() {
fn run_with_args(opt: Opt) -> Result<()> {
if !opt.quiet {
// Init logger with optional debug flag.
logger::init_logger("leo", match opt.debug {
false => 1,
true => 2,
})?;
logger::init_logger(
"leo",
match opt.debug {
false => 1,
true => 2,
},
)?;
}
// Get custom root folder and create context for it.

View File

@ -20,14 +20,7 @@ use std::path::PathBuf;
use crate::{
commands::{
package::{Login, Logout},
Build,
Command,
Prove,
Run,
Setup,
Test,
Update,
UpdateAutomatic,
Build, Command, Prove, Run, Setup, Test, Update, UpdateAutomatic,
},
context::{create_context, Context},
};

View File

@ -22,8 +22,7 @@ use serde::Deserialize;
use std::{
borrow::Cow,
fs::{
File,
{self},
File, {self},
},
io::Write,
path::Path,

View File

@ -22,8 +22,7 @@ use serde::Deserialize;
use std::{
borrow::Cow,
fs::{
File,
{self},
File, {self},
},
io::Write,
path::Path,

View File

@ -22,8 +22,7 @@ use serde::Deserialize;
use std::{
borrow::Cow,
fs::{
File,
{self},
File, {self},
},
io::Write,
path::Path,

View File

@ -22,8 +22,7 @@ use serde::Deserialize;
use std::{
borrow::Cow,
fs::{
File,
{self},
File, {self},
},
io::Write,
path::Path,

View File

@ -22,8 +22,7 @@ use serde::Deserialize;
use std::{
borrow::Cow,
fs::{
File,
{self},
File, {self},
},
io::Write,
path::Path,

View File

@ -22,8 +22,7 @@ use serde::Deserialize;
use std::{
borrow::Cow,
fs::{
File,
{self},
File, {self},
},
io::Write,
path::Path,

View File

@ -22,8 +22,7 @@ use serde::Deserialize;
use std::{
borrow::Cow,
fs::{
File,
{self},
File, {self},
},
io::Write,
path::Path,

View File

@ -21,12 +21,8 @@ use crate::{
imports::IMPORTS_DIRECTORY_NAME,
inputs::{INPUTS_DIRECTORY_NAME, INPUT_FILE_EXTENSION, STATE_FILE_EXTENSION},
outputs::{
CHECKSUM_FILE_EXTENSION,
CIRCUIT_FILE_EXTENSION,
OUTPUTS_DIRECTORY_NAME,
PROOF_FILE_EXTENSION,
PROVING_KEY_FILE_EXTENSION,
VERIFICATION_KEY_FILE_EXTENSION,
CHECKSUM_FILE_EXTENSION, CIRCUIT_FILE_EXTENSION, OUTPUTS_DIRECTORY_NAME, PROOF_FILE_EXTENSION,
PROVING_KEY_FILE_EXTENSION, VERIFICATION_KEY_FILE_EXTENSION,
},
root::{MANIFEST_FILENAME, README_FILENAME},
source::{SOURCE_DIRECTORY_NAME, SOURCE_FILE_EXTENSION},
@ -36,8 +32,7 @@ use serde::Deserialize;
use std::{
borrow::Cow,
fs::{
File,
{self},
File, {self},
},
io::{Read, Write},
path::Path,

View File

@ -22,8 +22,7 @@ pub mod manifest;
use lazy_static::lazy_static;
use std::{
cell::RefCell,
env,
fs,
env, fs,
path::PathBuf,
sync::atomic::{AtomicUsize, Ordering},
};

View File

@ -384,10 +384,13 @@ impl ParserContext {
self.expect(Token::LeftCurly)?;
let members = self.parse_circuit_declaration()?;
Ok((name.clone(), Circuit {
circuit_name: name,
members,
}))
Ok((
name.clone(),
Circuit {
circuit_name: name,
members,
},
))
}
///
@ -464,14 +467,17 @@ impl ParserContext {
None
};
let block = self.parse_block()?;
Ok((name.clone(), Function {
annotations,
identifier: name,
input: inputs,
output,
span: start + block.span.clone(),
block,
}))
Ok((
name.clone(),
Function {
annotations,
identifier: name,
input: inputs,
output,
span: start + block.span.clone(),
block,
},
))
}
///

View File

@ -82,17 +82,20 @@ pub(crate) fn tokenize(path: &str, input: StrTendril) -> Result<Vec<SpannedToken
if token_len == 0 && index == input.len() {
break;
} else if token_len == 0 {
return Err(TokenError::unexpected_token(&input[index..index + 1], &Span {
line_start: line_no,
line_stop: line_no,
col_start: index - line_start + 1,
col_stop: index - line_start + 2,
path,
content: input.subtendril(
line_start as u32,
input[line_start..].find('\n').unwrap_or_else(|| input.len()) as u32,
),
}));
return Err(TokenError::unexpected_token(
&input[index..index + 1],
&Span {
line_start: line_no,
line_stop: line_no,
col_start: index - line_start + 1,
col_stop: index - line_start + 2,
path,
content: input.subtendril(
line_start as u32,
input[line_start..].find('\n').unwrap_or_else(|| input.len()) as u32,
),
},
));
}
if input.as_bytes()[index] == b'\n' {
line_no += 1;

View File

@ -174,11 +174,14 @@ pub fn run_tests<T: Runner>(runner: &T, expectation_category: &str) {
if errors.is_empty() {
if expectations.is_none() {
outputs.push((expectation_path, TestExpectation {
namespace: config.namespace,
expectation: config.expectation,
outputs: new_outputs,
}));
outputs.push((
expectation_path,
TestExpectation {
namespace: config.namespace,
expectation: config.expectation,
outputs: new_outputs,
},
));
}
pass_categories += 1;
} else {