From 1168354a5ce7b1ea707cb5fce135e7c86ff93fc7 Mon Sep 17 00:00:00 2001 From: gluaxspeed Date: Wed, 14 Jul 2021 13:26:32 -0700 Subject: [PATCH 01/19] ci changes remove nightly asides from fmt --- .circleci/config.yml | 16 --------------- .github/workflows/ci.yml | 42 +++++++++++++++++++++++++--------------- 2 files changed, 26 insertions(+), 32 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 602894ba20..759eb649b6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -60,21 +60,6 @@ jobs: - clear_environment: cache_key: leo-stable-cache - rust-nightly: - docker: - - image: howardwu/snarkos-ci:2021-03-25 - resource_class: xlarge - steps: - - checkout - - setup_environment: - cache_key: leo-nightly-cache - - run: - name: Build and test - no_output_timeout: 30m - command: cargo test --all - - clear_environment: - cache_key: leo-nightly-cache - leo-executable: docker: - image: cimg/rust:1.52.1 @@ -215,7 +200,6 @@ workflows: main-workflow: jobs: - rust-stable - - rust-nightly - leo-executable - leo-new: requires: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f0d7c2e18..f6cde15d66 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,23 +69,41 @@ jobs: command: clippy args: --all-features --examples --all --benches - test-package: + test-package-linux: name: Test Package runs-on: ubuntu-latest - strategy: - matrix: - rust: - - stable - - nightly steps: - name: Checkout uses: actions/checkout@v2 - - name: Install Rust (${{ matrix.rust }}) + - name: Install Rust Stable uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: ${{ matrix.rust }} + 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-windows: + name: Test Package + runs-on: windows-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 @@ -112,14 +130,6 @@ jobs: override: true components: rustfmt - - name: Test - uses: actions-rs/cargo@v1 - with: - command: test - args: --all --features ci_skip - env: - CARGO_INCREMENTAL: "0" - - name: Install dependencies for code coverage run: | sudo apt-get update From 315dcebb34dca64dd54f8ea974ac44b45016e571 Mon Sep 17 00:00:00 2001 From: gluaxspeed Date: Wed, 14 Jul 2021 13:55:01 -0700 Subject: [PATCH 02/19] fmt stable only features, test all the platforms, cc stable --- .github/workflows/ci.yml | 62 +++++++++- .rustfmt.toml | 12 +- asg/src/checks/return_path.rs | 9 +- asg/src/expression/call.rs | 15 +-- asg/src/expression/circuit_access.rs | 15 +-- asg/src/expression/circuit_init.rs | 15 +-- asg/src/expression/constant.rs | 15 +-- asg/src/expression/variable_ref.rs | 16 +-- asg/src/node.rs | 11 +- asg/src/program/function.rs | 14 +-- asg/src/program/mod.rs | 10 +- asg/src/statement/assign.rs | 18 +-- asg/src/statement/definition.rs | 29 ++--- asg/src/statement/iteration.rs | 11 +- ast/src/common/identifier.rs | 8 +- ast/src/expression/mod.rs | 8 +- ast/src/groups/group_coordinate.rs | 7 +- ast/src/groups/group_value.rs | 4 +- ast/src/input/input_value.rs | 11 +- .../public_state/public_state.rs | 6 +- ast/src/types/integer_type.rs | 3 +- ast/src/types/type_.rs | 5 +- compiler/src/compiler.rs | 7 +- compiler/src/console/assert.rs | 6 +- compiler/src/errors/expression.rs | 9 +- compiler/src/errors/function.rs | 12 +- compiler/src/expression/expression.rs | 3 +- .../src/function/input/main_function_input.rs | 12 +- compiler/src/function/mut_target.rs | 12 +- compiler/src/function/result/result.rs | 6 +- compiler/src/output/mod.rs | 11 +- compiler/src/output/output_file.rs | 3 +- compiler/src/phases/reducing_director.rs | 106 +++++------------- compiler/src/prelude/blake2s.rs | 5 +- .../statement/assign/assignee/array_index.rs | 3 +- compiler/src/statement/assign/assignee/mod.rs | 21 ++-- .../src/statement/conditional/conditional.rs | 8 +- compiler/src/statement/iteration/iteration.rs | 10 +- compiler/src/value/address/address.rs | 6 +- compiler/src/value/char/char.rs | 3 +- .../src/value/group/targets/edwards_bls12.rs | 9 +- compiler/tests/mod.rs | 5 +- leo/api.rs | 3 +- leo/commands/build.rs | 3 +- leo/commands/package/clone.rs | 3 +- leo/config.rs | 4 +- leo/main.rs | 25 ++--- leo/tests/mod.rs | 9 +- package/src/inputs/input.rs | 3 +- package/src/inputs/state.rs | 3 +- package/src/outputs/checksum.rs | 3 +- package/src/outputs/circuit.rs | 3 +- package/src/outputs/proof.rs | 3 +- package/src/outputs/proving_key.rs | 3 +- package/src/outputs/verification_key.rs | 3 +- package/src/root/zip.rs | 11 +- package/tests/mod.rs | 3 +- parser/src/parser/file.rs | 30 +++-- parser/src/tokenizer/mod.rs | 25 +++-- test-framework/src/runner.rs | 13 ++- 60 files changed, 252 insertions(+), 459 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6cde15d66..8742cdfff6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.rustfmt.toml b/.rustfmt.toml index 39028b1340..4cca92e79e 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -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" diff --git a/asg/src/checks/return_path.rs b/asg/src/checks/return_path.rs index e0f73d3c0d..986b4319c7 100644 --- a/asg/src/checks/return_path.rs +++ b/asg/src/checks/return_path.rs @@ -15,14 +15,7 @@ // along with the Leo library. If not, see . use crate::{ - statement::*, - BoolAnd, - Expression, - Monoid, - MonoidalReducerExpression, - MonoidalReducerStatement, - Node, - Span, + statement::*, BoolAnd, Expression, Monoid, MonoidalReducerExpression, MonoidalReducerStatement, Node, Span, }; pub struct ReturnPathReducer { diff --git a/asg/src/expression/call.rs b/asg/src/expression/call.rs index d0ae36f32e..41b7cb0660 100644 --- a/asg/src/expression/call.rs +++ b/asg/src/expression/call.rs @@ -15,19 +15,8 @@ // along with the Leo library. If not, see . 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}; diff --git a/asg/src/expression/circuit_access.rs b/asg/src/expression/circuit_access.rs index 37af4e17bc..e945c8f902 100644 --- a/asg/src/expression/circuit_access.rs +++ b/asg/src/expression/circuit_access.rs @@ -15,19 +15,8 @@ // along with the Leo library. If not, see . 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; diff --git a/asg/src/expression/circuit_init.rs b/asg/src/expression/circuit_init.rs index 7c26aa25e3..4da91ea8b6 100644 --- a/asg/src/expression/circuit_init.rs +++ b/asg/src/expression/circuit_init.rs @@ -15,19 +15,8 @@ // along with the Leo library. If not, see . 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}; diff --git a/asg/src/expression/constant.rs b/asg/src/expression/constant.rs index 8fb638974a..5cff2578f4 100644 --- a/asg/src/expression/constant.rs +++ b/asg/src/expression/constant.rs @@ -15,19 +15,8 @@ // along with the Leo library. If not, see . 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; diff --git a/asg/src/expression/variable_ref.rs b/asg/src/expression/variable_ref.rs index 4a4e209223..ba8b59221b 100644 --- a/asg/src/expression/variable_ref.rs +++ b/asg/src/expression/variable_ref.rs @@ -15,20 +15,8 @@ // along with the Leo library. If not, see . 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; diff --git a/asg/src/node.rs b/asg/src/node.rs index 4272c5669a..b7e5a2c3e5 100644 --- a/asg/src/node.rs +++ b/asg/src/node.rs @@ -15,16 +15,7 @@ // along with the Leo library. If not, see . 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. diff --git a/asg/src/program/function.rs b/asg/src/program/function.rs index bf89b0020f..ae0bdcc5ce 100644 --- a/asg/src/program/function.rs +++ b/asg/src/program/function.rs @@ -15,18 +15,8 @@ // along with the Leo library. If not, see . 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; diff --git a/asg/src/program/mod.rs b/asg/src/program/mod.rs index d6c00ef7e3..74b93d5226 100644 --- a/asg/src/program/mod.rs +++ b/asg/src/program/mod.rs @@ -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}; diff --git a/asg/src/statement/assign.rs b/asg/src/statement/assign.rs index e1f44b8210..046a5bb98f 100644 --- a/asg/src/statement/assign.rs +++ b/asg/src/statement/assign.rs @@ -15,22 +15,8 @@ // along with the Leo library. If not, see . 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; diff --git a/asg/src/statement/definition.rs b/asg/src/statement/definition.rs index 4e2ce3cd83..cda4b32502 100644 --- a/asg/src/statement/definition.rs +++ b/asg/src/statement/definition.rs @@ -15,18 +15,8 @@ // along with the Leo library. If not, see . 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() } diff --git a/asg/src/statement/iteration.rs b/asg/src/statement/iteration.rs index 5e080acc75..8225ef7fbe 100644 --- a/asg/src/statement/iteration.rs +++ b/asg/src/statement/iteration.rs @@ -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, }; diff --git a/ast/src/common/identifier.rs b/ast/src/common/identifier.rs index f4a571bbb8..6728212c77 100644 --- a/ast/src/common/identifier.rs +++ b/ast/src/common/identifier.rs @@ -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, diff --git a/ast/src/expression/mod.rs b/ast/src/expression/mod.rs index 701efc50bc..2d2389d0ac 100644 --- a/ast/src/expression/mod.rs +++ b/ast/src/expression/mod.rs @@ -15,13 +15,7 @@ // along with the Leo library. If not, see . use crate::{ - ArrayDimensions, - CircuitImpliedVariableDefinition, - GroupValue, - Identifier, - IntegerType, - PositiveNumber, - Span, + ArrayDimensions, CircuitImpliedVariableDefinition, GroupValue, Identifier, IntegerType, PositiveNumber, Span, SpreadOrExpression, }; diff --git a/ast/src/groups/group_coordinate.rs b/ast/src/groups/group_coordinate.rs index 7f3e8a4666..b8d05ee786 100644 --- a/ast/src/groups/group_coordinate.rs +++ b/ast/src/groups/group_coordinate.rs @@ -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}; diff --git a/ast/src/groups/group_value.rs b/ast/src/groups/group_value.rs index f7e26069c7..e3bff066dc 100644 --- a/ast/src/groups/group_value.rs +++ b/ast/src/groups/group_value.rs @@ -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}; diff --git a/ast/src/input/input_value.rs b/ast/src/input/input_value.rs index d12a8b8990..735bba7222 100644 --- a/ast/src/input/input_value.rs +++ b/ast/src/input/input_value.rs @@ -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; diff --git a/ast/src/input/program_state/public_state/public_state.rs b/ast/src/input/program_state/public_state/public_state.rs index 995aa06759..7de8b04691 100644 --- a/ast/src/input/program_state/public_state/public_state.rs +++ b/ast/src/input/program_state/public_state/public_state.rs @@ -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`. diff --git a/ast/src/types/integer_type.rs b/ast/src/types/integer_type.rs index e2f3cab5bc..a7768a3512 100644 --- a/ast/src/types/integer_type.rs +++ b/ast/src/types/integer_type.rs @@ -15,8 +15,7 @@ // along with the Leo library. If not, see . use leo_input::types::{ - IntegerType as InputIntegerType, - SignedIntegerType as InputSignedIntegerType, + IntegerType as InputIntegerType, SignedIntegerType as InputSignedIntegerType, UnsignedIntegerType as InputUnsignedIntegerType, }; diff --git a/ast/src/types/type_.rs b/ast/src/types/type_.rs index fb4ad87522..edb769b865 100644 --- a/ast/src/types/type_.rs +++ b/ast/src/types/type_.rs @@ -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}; diff --git a/compiler/src/compiler.rs b/compiler/src/compiler.rs index a3f3475593..4e60db9ad1 100644 --- a/compiler/src/compiler.rs +++ b/compiler/src/compiler.rs @@ -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}; diff --git a/compiler/src/console/assert.rs b/compiler/src/console/assert.rs index e850829f40..ef9ef8cebc 100644 --- a/compiler/src/console/assert.rs +++ b/compiler/src/console/assert.rs @@ -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}; diff --git a/compiler/src/errors/expression.rs b/compiler/src/errors/expression.rs index 3f360438e5..0ceeed1fe5 100644 --- a/compiler/src/errors/expression.rs +++ b/compiler/src/errors/expression.rs @@ -15,14 +15,7 @@ // along with the Leo library. If not, see . 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; diff --git a/compiler/src/errors/function.rs b/compiler/src/errors/function.rs index 3ec7f66a6f..17c9ff07ba 100644 --- a/compiler/src/errors/function.rs +++ b/compiler/src/errors/function.rs @@ -15,16 +15,8 @@ // along with the Leo library. If not, see . 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}; diff --git a/compiler/src/expression/expression.rs b/compiler/src/expression/expression.rs index cc55b6d1d7..da22053fd1 100644 --- a/compiler/src/expression/expression.rs +++ b/compiler/src/expression/expression.rs @@ -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}; diff --git a/compiler/src/function/input/main_function_input.rs b/compiler/src/function/input/main_function_input.rs index 75379676fe..4215798057 100644 --- a/compiler/src/function/input/main_function_input.rs +++ b/compiler/src/function/input/main_function_input.rs @@ -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}; diff --git a/compiler/src/function/mut_target.rs b/compiler/src/function/mut_target.rs index f9ecd96351..5ab48dade7 100644 --- a/compiler/src/function/mut_target.rs +++ b/compiler/src/function/mut_target.rs @@ -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; diff --git a/compiler/src/function/result/result.rs b/compiler/src/function/result/result.rs index be09a87c69..2041d923f8 100644 --- a/compiler/src/function/result/result.rs +++ b/compiler/src/function/result/result.rs @@ -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}; diff --git a/compiler/src/output/mod.rs b/compiler/src/output/mod.rs index 89d09e6823..2030b12764 100644 --- a/compiler/src/output/mod.rs +++ b/compiler/src/output/mod.rs @@ -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 }) diff --git a/compiler/src/output/output_file.rs b/compiler/src/output/output_file.rs index b9b2570baf..4731c290f3 100644 --- a/compiler/src/output/output_file.rs +++ b/compiler/src/output/output_file.rs @@ -21,8 +21,7 @@ use crate::errors::OutputFileError; use std::{ borrow::Cow, fs::{ - File, - {self}, + File, {self}, }, io::Write, path::Path, diff --git a/compiler/src/phases/reducing_director.rs b/compiler/src/phases/reducing_director.rs index 5063774993..18c82612c8 100644 --- a/compiler/src/phases/reducing_director.rs +++ b/compiler/src/phases/reducing_director.rs @@ -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; diff --git a/compiler/src/prelude/blake2s.rs b/compiler/src/prelude/blake2s.rs index e22ac21f14..1b27e9267e 100644 --- a/compiler/src/prelude/blake2s.rs +++ b/compiler/src/prelude/blake2s.rs @@ -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; diff --git a/compiler/src/statement/assign/assignee/array_index.rs b/compiler/src/statement/assign/assignee/array_index.rs index 0ef0007a0b..a7b63d1859 100644 --- a/compiler/src/statement/assign/assignee/array_index.rs +++ b/compiler/src/statement/assign/assignee/array_index.rs @@ -22,8 +22,7 @@ use crate::{ errors::{ExpressionError, StatementError}, program::ConstrainedProgram, value::ConstrainedValue, - GroupType, - Integer, + GroupType, Integer, }; use leo_asg::{ConstInt, Expression, Node}; diff --git a/compiler/src/statement/assign/assignee/mod.rs b/compiler/src/statement/assign/assignee/mod.rs index d6e5a67f70..1072c4039b 100644 --- a/compiler/src/statement/assign/assignee/mod.rs +++ b/compiler/src/statement/assign/assignee/mod.rs @@ -95,15 +95,18 @@ impl<'a, F: PrimeField, G: GroupType> 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(()) } diff --git a/compiler/src/statement/conditional/conditional.rs b/compiler/src/statement/conditional/conditional.rs index 3fe7469209..1266dd904b 100644 --- a/compiler/src/statement/conditional/conditional.rs +++ b/compiler/src/statement/conditional/conditional.rs @@ -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; diff --git a/compiler/src/statement/iteration/iteration.rs b/compiler/src/statement/iteration/iteration.rs index fb3750c451..5f0720c9cf 100644 --- a/compiler/src/statement/iteration/iteration.rs +++ b/compiler/src/statement/iteration/iteration.rs @@ -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; diff --git a/compiler/src/value/address/address.rs b/compiler/src/value/address/address.rs index 05ef09accd..1f753cc8c2 100644 --- a/compiler/src/value/address/address.rs +++ b/compiler/src/value/address/address.rs @@ -200,7 +200,11 @@ impl ConditionalEqGadget 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 CondSelectGadget for Address { diff --git a/compiler/src/value/char/char.rs b/compiler/src/value/char/char.rs index 9ff0f782c9..7f8fa4e51a 100644 --- a/compiler/src/value/char/char.rs +++ b/compiler/src/value/char/char.rs @@ -17,8 +17,7 @@ use crate::{ errors::CharError, value::{field::input::allocate_field, ConstrainedValue}, - FieldType, - GroupType, + FieldType, GroupType, }; use leo_ast::{InputValue, Span}; diff --git a/compiler/src/value/group/targets/edwards_bls12.rs b/compiler/src/value/group/targets/edwards_bls12.rs index 815e095e85..38bf4cd88c 100644 --- a/compiler/src/value/group/targets/edwards_bls12.rs +++ b/compiler/src/value/group/targets/edwards_bls12.rs @@ -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 for EdwardsGroupType { second: &Self, ) -> Result { 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"))?; diff --git a/compiler/tests/mod.rs b/compiler/tests/mod.rs index b488ea9f00..10b1bad9d9 100644 --- a/compiler/tests/mod.rs +++ b/compiler/tests/mod.rs @@ -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, }; diff --git a/leo/api.rs b/leo/api.rs index 53b6157d09..124f68b182 100644 --- a/leo/api.rs +++ b/leo/api.rs @@ -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}; diff --git a/leo/commands/build.rs b/leo/commands/build.rs index c7909dc0fb..4d7b55aba7 100644 --- a/leo/commands/build.rs +++ b/leo/commands/build.rs @@ -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::*, diff --git a/leo/commands/package/clone.rs b/leo/commands/package/clone.rs index 92cad951cd..3daf00897a 100644 --- a/leo/commands/package/clone.rs +++ b/leo/commands/package/clone.rs @@ -20,8 +20,7 @@ use anyhow::{anyhow, Result}; use std::{ borrow::Cow, fs::{ - File, - {self}, + File, {self}, }, io::{Read, Write}, path::Path, diff --git a/leo/config.rs b/leo/config.rs index ae85bc3d2c..fcde460052 100644 --- a/leo/config.rs +++ b/leo/config.rs @@ -16,9 +16,7 @@ use std::{ fs::{ - create_dir_all, - File, - {self}, + create_dir_all, File, {self}, }, io, io::prelude::*, diff --git a/leo/main.rs b/leo/main.rs index d20347160f..3ebd95c765 100644 --- a/leo/main.rs +++ b/leo/main.rs @@ -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. diff --git a/leo/tests/mod.rs b/leo/tests/mod.rs index 12e4e63eb8..3281fb71a4 100644 --- a/leo/tests/mod.rs +++ b/leo/tests/mod.rs @@ -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}, }; diff --git a/package/src/inputs/input.rs b/package/src/inputs/input.rs index 3e01cbbe5d..74ca67484a 100644 --- a/package/src/inputs/input.rs +++ b/package/src/inputs/input.rs @@ -22,8 +22,7 @@ use serde::Deserialize; use std::{ borrow::Cow, fs::{ - File, - {self}, + File, {self}, }, io::Write, path::Path, diff --git a/package/src/inputs/state.rs b/package/src/inputs/state.rs index 7bda80ceb7..4c7994291e 100644 --- a/package/src/inputs/state.rs +++ b/package/src/inputs/state.rs @@ -22,8 +22,7 @@ use serde::Deserialize; use std::{ borrow::Cow, fs::{ - File, - {self}, + File, {self}, }, io::Write, path::Path, diff --git a/package/src/outputs/checksum.rs b/package/src/outputs/checksum.rs index 9352429973..3f56c22a76 100644 --- a/package/src/outputs/checksum.rs +++ b/package/src/outputs/checksum.rs @@ -22,8 +22,7 @@ use serde::Deserialize; use std::{ borrow::Cow, fs::{ - File, - {self}, + File, {self}, }, io::Write, path::Path, diff --git a/package/src/outputs/circuit.rs b/package/src/outputs/circuit.rs index d9d0e8cced..81a528f310 100644 --- a/package/src/outputs/circuit.rs +++ b/package/src/outputs/circuit.rs @@ -22,8 +22,7 @@ use serde::Deserialize; use std::{ borrow::Cow, fs::{ - File, - {self}, + File, {self}, }, io::Write, path::Path, diff --git a/package/src/outputs/proof.rs b/package/src/outputs/proof.rs index 815d6048be..6a9419b889 100644 --- a/package/src/outputs/proof.rs +++ b/package/src/outputs/proof.rs @@ -22,8 +22,7 @@ use serde::Deserialize; use std::{ borrow::Cow, fs::{ - File, - {self}, + File, {self}, }, io::Write, path::Path, diff --git a/package/src/outputs/proving_key.rs b/package/src/outputs/proving_key.rs index 7e2d938bd7..35f054554d 100644 --- a/package/src/outputs/proving_key.rs +++ b/package/src/outputs/proving_key.rs @@ -22,8 +22,7 @@ use serde::Deserialize; use std::{ borrow::Cow, fs::{ - File, - {self}, + File, {self}, }, io::Write, path::Path, diff --git a/package/src/outputs/verification_key.rs b/package/src/outputs/verification_key.rs index 6f7fca8797..9acfe62fc4 100644 --- a/package/src/outputs/verification_key.rs +++ b/package/src/outputs/verification_key.rs @@ -22,8 +22,7 @@ use serde::Deserialize; use std::{ borrow::Cow, fs::{ - File, - {self}, + File, {self}, }, io::Write, path::Path, diff --git a/package/src/root/zip.rs b/package/src/root/zip.rs index 6286b125d0..13a4336a65 100644 --- a/package/src/root/zip.rs +++ b/package/src/root/zip.rs @@ -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, diff --git a/package/tests/mod.rs b/package/tests/mod.rs index 8f72a16b3e..c04bfade1f 100644 --- a/package/tests/mod.rs +++ b/package/tests/mod.rs @@ -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}, }; diff --git a/parser/src/parser/file.rs b/parser/src/parser/file.rs index 80abacaddb..8615d3cb19 100644 --- a/parser/src/parser/file.rs +++ b/parser/src/parser/file.rs @@ -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, + }, + )) } /// diff --git a/parser/src/tokenizer/mod.rs b/parser/src/tokenizer/mod.rs index 5da374e575..46547d481a 100644 --- a/parser/src/tokenizer/mod.rs +++ b/parser/src/tokenizer/mod.rs @@ -82,17 +82,20 @@ pub(crate) fn tokenize(path: &str, input: StrTendril) -> Result(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 { From b8dcad44cc370c7057d4f3783154fda770cf2312 Mon Sep 17 00:00:00 2001 From: gluaxspeed Date: Wed, 14 Jul 2021 13:59:51 -0700 Subject: [PATCH 03/19] tests on github actions its easier cache platforms --- .circleci/config.yml | 61 +++++++++++--- .github/workflows/ci.yml | 176 +++++++++++++++++---------------------- 2 files changed, 123 insertions(+), 114 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 759eb649b6..463de16bd8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,7 @@ commands: parameters: cache_key: type: string - default: leo-stable-cache + default: leo-stable-linux-cache steps: - run: set -e - setup_remote_docker @@ -31,7 +31,7 @@ commands: parameters: cache_key: type: string - default: leo-stable-cache + default: leo-stable-linux-cache steps: - run: (sccache -s||true) - run: set +e @@ -40,11 +40,44 @@ commands: paths: - .cache/sccache - .cargo -jobs: +orbs: + win: circleci/windows@2.4.0 + +jobs: + fmt: + docker: + - image: cimg/rust:1.53.0 + resource_class: xlarge + steps: + - checkout + - setup_environment: + cache_key: leo-fmt-cache + - run: + name: Check style + no_output_timeout: 35m + command: cargo fmt --all -- --check + - clear_environment: + cache_key: leo-fmt-cache + + clippy: + docker: + - image: cimg/rust:1.53.0 + resource_class: xlarge + steps: + - checkout + - setup_environment: + cache_key: leo-clippy-cache + - run: + name: Clippy + no_output_timeout: 35m + command: cargo clippy --all-features --examples --all --benches + - clear_environment: + cache_key: leo-clippy-cache + rust-stable: docker: - - image: cimg/rust:1.52.1 + - image: cimg/rust:1.53.0 resource_class: xlarge steps: - checkout @@ -62,7 +95,7 @@ jobs: leo-executable: docker: - - image: cimg/rust:1.52.1 + - image: cimg/rust:1.53.0 resource_class: xlarge steps: - checkout @@ -80,7 +113,7 @@ jobs: leo-new: docker: - - image: cimg/rust:1.52.1 + - image: cimg/rust:1.53.0 resource_class: xlarge steps: - attach_workspace: @@ -93,7 +126,7 @@ jobs: leo-init: docker: - - image: cimg/rust:1.52.1 + - image: cimg/rust:1.53.0 resource_class: xlarge steps: - attach_workspace: @@ -106,7 +139,7 @@ jobs: leo-clean: docker: - - image: cimg/rust:1.52.1 + - image: cimg/rust:1.53.0 resource_class: xlarge steps: - attach_workspace: @@ -119,7 +152,7 @@ jobs: leo-setup: docker: - - image: cimg/rust:1.52.1 + - image: cimg/rust:1.53.0 resource_class: xlarge steps: - attach_workspace: @@ -132,7 +165,7 @@ jobs: leo-add-remove: docker: - - image: cimg/rust:1.52.1 + - image: cimg/rust:1.53.0 resource_class: xlarge steps: - attach_workspace: @@ -158,7 +191,7 @@ jobs: leo-login-logout: docker: - - image: cimg/rust:1.52.1 + - image: cimg/rust:1.53.0 resource_class: xlarge steps: - attach_workspace: @@ -171,7 +204,7 @@ jobs: leo-clone: docker: - - image: cimg/rust:1.52.1 + - image: cimg/rust:1.53.0 resource_class: xlarge steps: - attach_workspace: @@ -184,7 +217,7 @@ jobs: leo-publish: docker: - - image: cimg/rust:1.52.1 + - image: cimg/rust:1.53.0 resource_class: xlarge steps: - attach_workspace: @@ -199,6 +232,8 @@ workflows: version: 2 main-workflow: jobs: + - fmt + - clippy - rust-stable - leo-executable - leo-new: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8742cdfff6..21a3461d25 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,68 +13,51 @@ env: RUST_BACKTRACE: 1 jobs: - style: - name: Check Style - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v1 - - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - override: true - components: rustfmt - - - name: cargo fmt --check - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - - clippy: - name: Clippy - runs-on: ubuntu-latest + test-package: + name: Test Package ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + os: [macOS-latest, windows-latest, ubuntu-latest] + include: + - os: ubuntu-latest + sccache-path: /home/runner/.cache/sccache + - os: macos-latest + sccache-path: /Users/runner/Library/Caches/Mozilla.sccache + - os: windows-latest + sccache-path: "C:\\Users\\runneradmin\\AppData\\Local\\Mozilla\\sccache" env: - RUSTFLAGS: -Dwarnings + RUSTC_WRAPPER: sccache + SCCACHE_CACHE_SIZE: 2G + SCCACHE_DIR: ${{ matrix.sccache-path }} + # SCCACHE_RECACHE: 1 # Uncomment this to clear cache, then comment it back out steps: - name: Checkout uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - components: clippy + - name: Install sccache Ubuntu + if: matrix.os == 'ubuntu-latest' + env: + LINK: https://github.com/mozilla/sccache/releases/download + SCCACHE_VERSION: 0.2.15 + run: | + SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl + mkdir -p $HOME/.local/bin + curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz + mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache + echo "$HOME/.local/bin" >> $GITHUB_PATH + + - name: Install sccache Macos + if: matrix.os == 'macos-latest' + run: | + brew update + brew install sccache - - name: Check examples - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --examples --all - - - name: Check examples with all features on stable - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --examples --all-features --all - - - name: Check benchmarks on nightly - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --all-features --examples --all --benches - - test-package-linux: - name: Test Package Linux - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 + - name: Install sccache Windows + if: matrix.os == 'windows-latest' + run: | + iwr -useb get.scoop.sh | iex + Set-ExecutionPolicy RemoteSigned -scope CurrentUser + scoop install sccache - name: Install Rust Stable uses: actions-rs/toolchain@v1 @@ -83,61 +66,44 @@ jobs: 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-windows: - name: Test Package Windows - runs-on: windows-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Rust Stable - uses: actions-rs/toolchain@v1 + - name: Cache cargo registry + uses: actions/cache@v2 + continue-on-error: false 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: - name: Test Package macOS - runs-on: macos-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Rust Stable - uses: actions-rs/toolchain@v1 + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Save sccache + uses: actions/cache@v2 + continue-on-error: false with: - profile: minimal - toolchain: stable - override: true + path: ${{ matrix.sccache-path }} + key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-sccache- + + - name: Start sccache server + run: sccache --start-server - name: Install cargo-all-features run: | cargo install cargo-all-features - + - name: Test run: | cd package cargo test-all-features + - name: Print sccache stats + run: sccache --show-stats + + - name: Stop sccache server + run: sccache --stop-server || true + test-package-macos_m1: name: Test Package macOS M1 runs-on: macos-latest @@ -173,7 +139,7 @@ jobs: name: Code Coverage runs-on: ubuntu-latest env: - RUSTC_BOOTSTRAP=1 + RUSTC_BOOTSTRAP: 1 steps: - name: Checkout uses: actions/checkout@v1 @@ -186,6 +152,14 @@ jobs: override: true components: rustfmt + - name: Test + uses: actions-rs/cargo@v1 + with: + command: test + args: --all --features ci_skip + env: + CARGO_INCREMENTAL: "0" + - name: Install dependencies for code coverage run: | sudo apt-get update From 8596e2cd1fd3664ba87a3c76b279b7ba11186676 Mon Sep 17 00:00:00 2001 From: gluaxspeed Date: Wed, 14 Jul 2021 16:35:20 -0700 Subject: [PATCH 04/19] Fix some github-actions yaml syntax --- .github/workflows/ci.yml | 43 +++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21a3461d25..abb5b48710 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,14 +1,14 @@ name: CI on: pull_request: - push: - branches: - - master - - staging - - trying - paths-ignore: - - 'docs/**' - - 'documentation/**' + push: + branches: + - master + - staging + - trying + paths-ignore: + - 'docs/**' + - 'documentation/**' env: RUST_BACKTRACE: 1 @@ -17,14 +17,15 @@ jobs: name: Test Package ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: - os: [macOS-latest, windows-latest, ubuntu-latest] - include: - - os: ubuntu-latest - sccache-path: /home/runner/.cache/sccache - - os: macos-latest - sccache-path: /Users/runner/Library/Caches/Mozilla.sccache - - os: windows-latest - sccache-path: "C:\\Users\\runneradmin\\AppData\\Local\\Mozilla\\sccache" + matrix: + os: [macOS-latest, windows-latest, ubuntu-latest] + include: + - os: ubuntu-latest + sccache-path: /home/runner/.cache/sccache + - os: macos-latest + sccache-path: /Users/runner/Library/Caches/Mozilla.sccache + - os: windows-latest + sccache-path: "C:\\Users\\runneradmin\\AppData\\Local\\Mozilla\\sccache" env: RUSTC_WRAPPER: sccache SCCACHE_CACHE_SIZE: 2G @@ -38,12 +39,13 @@ jobs: if: matrix.os == 'ubuntu-latest' env: LINK: https://github.com/mozilla/sccache/releases/download - SCCACHE_VERSION: 0.2.15 + SCCACHE_VERSION: v0.2.15 run: | SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl mkdir -p $HOME/.local/bin curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache + chmod +x $HOME/.local/bin/sccache echo "$HOME/.local/bin" >> $GITHUB_PATH - name: Install sccache Macos @@ -58,6 +60,9 @@ jobs: iwr -useb get.scoop.sh | iex Set-ExecutionPolicy RemoteSigned -scope CurrentUser scoop install sccache + Get-ChildItem C:\Users\runneradmin\scoop\shims + echo "C:\Users\runneradmin\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + echo "$GITHUB_PATH" - name: Install Rust Stable uses: actions-rs/toolchain@v1 @@ -87,7 +92,9 @@ jobs: ${{ runner.os }}-sccache- - name: Start sccache server - run: sccache --start-server + run: | + echo "$GITHUB_PATH" + sccache --start-server - name: Install cargo-all-features run: | From dc37ef37f2d588cec9ada2043143abbdc8640601 Mon Sep 17 00:00:00 2001 From: gluaxspeed Date: Wed, 14 Jul 2021 17:52:57 -0700 Subject: [PATCH 05/19] cache codecov and m1 --- .github/workflows/ci.yml | 87 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 84 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index abb5b48710..d4d6a4bd8f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,9 +60,7 @@ jobs: iwr -useb get.scoop.sh | iex Set-ExecutionPolicy RemoteSigned -scope CurrentUser scoop install sccache - Get-ChildItem C:\Users\runneradmin\scoop\shims echo "C:\Users\runneradmin\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - echo "$GITHUB_PATH" - name: Install Rust Stable uses: actions-rs/toolchain@v1 @@ -93,7 +91,6 @@ jobs: - name: Start sccache server run: | - echo "$GITHUB_PATH" sccache --start-server - name: Install cargo-all-features @@ -114,6 +111,10 @@ jobs: test-package-macos_m1: name: Test Package macOS M1 runs-on: macos-latest + env: + RUSTC_WRAPPER: sccache + SCCACHE_CACHE_SIZE: 2G + SCCACHE_DIR: /Users/runner/Library/Caches/Mozilla.sccache steps: - name: Xcode Select uses: devbotsxyz/xcode-select@v1.1.0 @@ -121,6 +122,11 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Install sccache + run: | + brew update + brew install sccache + - name: Install Rust uses: actions-rs/toolchain@v1 with: @@ -129,6 +135,30 @@ jobs: toolchain: stable override: true components: rustfmt + + - name: Cache cargo registry + uses: actions/cache@v2 + continue-on-error: false + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: m1-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + m1-cargo- + + - name: Save sccache + uses: actions/cache@v2 + continue-on-error: false + with: + path: /Users/runner/Library/Caches/Mozilla.sccache + key: m1-sccache-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + m1-sccache- + + - name: Start sccache server + run: | + sccache --start-server - name: Install cargo-all-features run: | @@ -142,15 +172,36 @@ jobs: MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.1 --show-sdk-platform-version) \ cd package && cargo test-all-features + - name: Print sccache stats + run: sccache --show-stats + + - name: Stop sccache server + run: sccache --stop-server || true + codecov: name: Code Coverage runs-on: ubuntu-latest env: RUSTC_BOOTSTRAP: 1 + RUSTC_WRAPPER: sccache + SCCACHE_CACHE_SIZE: 2G + SCCACHE_DIR: /home/runner/.cache/sccache steps: - name: Checkout uses: actions/checkout@v1 + - name: Install sccache Ubuntu + env: + LINK: https://github.com/mozilla/sccache/releases/download + SCCACHE_VERSION: v0.2.15 + run: | + SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl + mkdir -p $HOME/.local/bin + curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz + mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache + chmod +x $HOME/.local/bin/sccache + echo "$HOME/.local/bin" >> $GITHUB_PATH + - name: Install Rust uses: actions-rs/toolchain@v1 with: @@ -159,6 +210,30 @@ jobs: override: true components: rustfmt + - name: Cache cargo registry + uses: actions/cache@v2 + continue-on-error: false + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: codecov-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + codecov-cargo- + + - name: Save sccache + uses: actions/cache@v2 + continue-on-error: false + with: + path: /Users/runner/Library/Caches/Mozilla.sccache + key: codecov-sccache-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + codecov-sccache- + + - name: Start sccache server + run: | + sccache --start-server + - name: Test uses: actions-rs/cargo@v1 with: @@ -189,3 +264,9 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }} + + - name: Print sccache stats + run: sccache --show-stats + + - name: Stop sccache server + run: sccache --stop-server || true From 6f9682724e779def3ead1aa986c80a60f2376974 Mon Sep 17 00:00:00 2001 From: gluaxspeed Date: Fri, 16 Jul 2021 02:19:11 -0700 Subject: [PATCH 06/19] I don't know our code-coverage secrets or how to get it --- .circleci/config.yml | 68 +++++++++++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 23 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 463de16bd8..4927f1faad 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,12 +40,11 @@ commands: paths: - .cache/sccache - .cargo +# orbs: +# codecov: codecov/codecov@1.2.3 -orbs: - win: circleci/windows@2.4.0 - jobs: - fmt: + check-style: docker: - image: cimg/rust:1.53.0 resource_class: xlarge @@ -75,23 +74,47 @@ jobs: - clear_environment: cache_key: leo-clippy-cache - rust-stable: - docker: - - image: cimg/rust:1.53.0 - resource_class: xlarge - steps: - - checkout - - setup_environment: - cache_key: leo-stable-cache - - run: - name: Build and run tests - no_output_timeout: 30m - command: cargo test --all - - persist_to_workspace: - root: ~/ - paths: project/ - - clear_environment: - cache_key: leo-stable-cache + # code-cov: + # docker: + # - image: cimg/rust:1.53.0 + # resource_class: xlarge + # environment: + # RUSTC_BOOTSTRAP: 1 + # steps: + # - checkout + # - setup_environment: + # cache_key: leo-codecov-cache + # - run: + # name: Build and run tests + # no_output_timeout: 30m + # command: cargo test --all + # - run: + # name: Install Code Cov Deps + # no_output_timeout: 30m + # command: | + # sudo apt-get update + # sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev + # - run: + # name: Generate Coverage Report + # no_output_timeout: 30m + # command: | + # wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz + # tar xzf master.tar.gz + # cd kcov-master + # mkdir build && cd build + # cmake .. && make + # make install DESTDIR=../../kcov-build + # cd ../.. + # rm -rf kcov-master + # for file in target/debug/deps/*-*; do if [[ "$file" != *\.* ]]; then mkdir -p "target/cov/$(basename $file)"; ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --exclude-region='@kcov_skip(start):@kcov_skip(end)' --verify "target/cov/$(basename $file)" "$file"; fi done + # steps: + # - codecov/upload: + # file: {{}} + # - persist_to_workspace: + # root: ~/ + # paths: project/ + # - clear_environment: + # cache_key: leo-codecov-cache leo-executable: docker: @@ -232,9 +255,8 @@ workflows: version: 2 main-workflow: jobs: - - fmt + - check-style - clippy - - rust-stable - leo-executable - leo-new: requires: From 80126aa5e2f585f4bd31236a91443808d945d409 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Aug 2021 10:17:46 +0000 Subject: [PATCH 07/19] Bump assert_cmd from 1.0.7 to 1.0.8 Bumps [assert_cmd](https://github.com/assert-rs/assert_cmd) from 1.0.7 to 1.0.8. - [Release notes](https://github.com/assert-rs/assert_cmd/releases) - [Changelog](https://github.com/assert-rs/assert_cmd/blob/master/CHANGELOG.md) - [Commits](https://github.com/assert-rs/assert_cmd/compare/v1.0.7...v1.0.8) --- updated-dependencies: - dependency-name: assert_cmd dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1fc8200b29..710d748bf0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -88,9 +88,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "assert_cmd" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d20831bd004dda4c7c372c19cdabff369f794a95e955b3f13fe460e3e1ae95f" +checksum = "c98233c6673d8601ab23e77eb38f999c51100d46c5703b17288c57fddf3a1ffe" dependencies = [ "bstr", "doc-comment", diff --git a/Cargo.toml b/Cargo.toml index e7187b0020..573fee8d9a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -162,7 +162,7 @@ version = "0.12.1" version = "0.11.2" [dev-dependencies.assert_cmd] -version = "1.0.7" +version = "1.0.8" [dev-dependencies.test_dir] version = "0.1.0" From a9a684ef2b4541fcf6ae430c766597f9706ff069 Mon Sep 17 00:00:00 2001 From: damirka Date: Mon, 2 Aug 2021 18:25:12 +0300 Subject: [PATCH 08/19] adds self canonicalization for static calls --- ast/src/reducer/canonicalization.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ast/src/reducer/canonicalization.rs b/ast/src/reducer/canonicalization.rs index edf300ada4..76aca34838 100644 --- a/ast/src/reducer/canonicalization.rs +++ b/ast/src/reducer/canonicalization.rs @@ -276,6 +276,11 @@ impl Canonicalizer { span: call.span.clone(), }); } + Expression::Identifier(identifier) => { + if identifier.name.as_ref() == "Self" && self.circuit_name.is_some() { + return Expression::Identifier(self.circuit_name.as_ref().unwrap().clone()); + } + } _ => {} } From 34f1c00da27504ebc47c5376636fb482c03b42ec Mon Sep 17 00:00:00 2001 From: damirka Date: Mon, 2 Aug 2021 23:45:33 +0300 Subject: [PATCH 09/19] clippy & test fixes --- ast/src/reducer/canonicalization.rs | 6 +- ast/src/reducer/reconstructing_director.rs | 70 +++++++++---------- ast/src/types/type_.rs | 4 +- input/src/errors/parser.rs | 2 +- input/src/values/group_coordinate.rs | 2 +- input/src/values/value.rs | 6 +- parser/examples/parser.rs | 2 +- parser/src/parser/file.rs | 2 +- parser/src/parser/statement.rs | 2 +- parser/src/tokenizer/lexer.rs | 4 +- .../member_static_function_nested.leo.out | 4 +- 11 files changed, 50 insertions(+), 54 deletions(-) diff --git a/ast/src/reducer/canonicalization.rs b/ast/src/reducer/canonicalization.rs index 76aca34838..0e14208fc1 100644 --- a/ast/src/reducer/canonicalization.rs +++ b/ast/src/reducer/canonicalization.rs @@ -47,7 +47,7 @@ impl Canonicalizer { let mut left = Box::new(start); for access in accesses.iter() { - match self.canonicalize_assignee_access(&access) { + match self.canonicalize_assignee_access(access) { AssigneeAccess::ArrayIndex(index) => { left = Box::new(Expression::ArrayAccess(ArrayAccessExpression { array: left, @@ -295,7 +295,7 @@ impl Canonicalizer { AssigneeAccess::ArrayRange(left, right) } - AssigneeAccess::ArrayIndex(index) => AssigneeAccess::ArrayIndex(self.canonicalize_expression(&index)), + AssigneeAccess::ArrayIndex(index) => AssigneeAccess::ArrayIndex(self.canonicalize_expression(index)), _ => access.clone(), } } @@ -318,7 +318,7 @@ impl Canonicalizer { let statements = block .statements .iter() - .map(|block_statement| self.canonicalize_statement(&block_statement)) + .map(|block_statement| self.canonicalize_statement(block_statement)) .collect(); Block { diff --git a/ast/src/reducer/reconstructing_director.rs b/ast/src/reducer/reconstructing_director.rs index cf5a409d06..d7710df122 100644 --- a/ast/src/reducer/reconstructing_director.rs +++ b/ast/src/reducer/reconstructing_director.rs @@ -50,34 +50,32 @@ impl ReconstructingDirector { // Expressions pub fn reduce_expression(&mut self, expression: &Expression) -> Result { let new = match expression { - Expression::Identifier(identifier) => Expression::Identifier(self.reduce_identifier(&identifier)?), - Expression::Value(value) => self.reduce_value(&value)?, - Expression::Binary(binary) => Expression::Binary(self.reduce_binary(&binary)?), - Expression::Unary(unary) => Expression::Unary(self.reduce_unary(&unary)?), - Expression::Ternary(ternary) => Expression::Ternary(self.reduce_ternary(&ternary)?), - Expression::Cast(cast) => Expression::Cast(self.reduce_cast(&cast)?), + Expression::Identifier(identifier) => Expression::Identifier(self.reduce_identifier(identifier)?), + Expression::Value(value) => self.reduce_value(value)?, + Expression::Binary(binary) => Expression::Binary(self.reduce_binary(binary)?), + Expression::Unary(unary) => Expression::Unary(self.reduce_unary(unary)?), + Expression::Ternary(ternary) => Expression::Ternary(self.reduce_ternary(ternary)?), + Expression::Cast(cast) => Expression::Cast(self.reduce_cast(cast)?), - Expression::ArrayInline(array_inline) => Expression::ArrayInline(self.reduce_array_inline(&array_inline)?), - Expression::ArrayInit(array_init) => Expression::ArrayInit(self.reduce_array_init(&array_init)?), - Expression::ArrayAccess(array_access) => Expression::ArrayAccess(self.reduce_array_access(&array_access)?), + Expression::ArrayInline(array_inline) => Expression::ArrayInline(self.reduce_array_inline(array_inline)?), + Expression::ArrayInit(array_init) => Expression::ArrayInit(self.reduce_array_init(array_init)?), + Expression::ArrayAccess(array_access) => Expression::ArrayAccess(self.reduce_array_access(array_access)?), Expression::ArrayRangeAccess(array_range_access) => { - Expression::ArrayRangeAccess(self.reduce_array_range_access(&array_range_access)?) + Expression::ArrayRangeAccess(self.reduce_array_range_access(array_range_access)?) } - Expression::TupleInit(tuple_init) => Expression::TupleInit(self.reduce_tuple_init(&tuple_init)?), - Expression::TupleAccess(tuple_access) => Expression::TupleAccess(self.reduce_tuple_access(&tuple_access)?), + Expression::TupleInit(tuple_init) => Expression::TupleInit(self.reduce_tuple_init(tuple_init)?), + Expression::TupleAccess(tuple_access) => Expression::TupleAccess(self.reduce_tuple_access(tuple_access)?), - Expression::CircuitInit(circuit_init) => Expression::CircuitInit(self.reduce_circuit_init(&circuit_init)?), + Expression::CircuitInit(circuit_init) => Expression::CircuitInit(self.reduce_circuit_init(circuit_init)?), Expression::CircuitMemberAccess(circuit_member_access) => { - Expression::CircuitMemberAccess(self.reduce_circuit_member_access(&circuit_member_access)?) + Expression::CircuitMemberAccess(self.reduce_circuit_member_access(circuit_member_access)?) } Expression::CircuitStaticFunctionAccess(circuit_static_fn_access) => { - Expression::CircuitStaticFunctionAccess( - self.reduce_circuit_static_fn_access(&circuit_static_fn_access)?, - ) + Expression::CircuitStaticFunctionAccess(self.reduce_circuit_static_fn_access(circuit_static_fn_access)?) } - Expression::Call(call) => Expression::Call(self.reduce_call(&call)?), + Expression::Call(call) => Expression::Call(self.reduce_call(call)?), }; self.reducer.reduce_expression(expression, new) @@ -93,7 +91,7 @@ impl ReconstructingDirector { pub fn reduce_group_value(&mut self, group_value: &GroupValue) -> Result { let new = match group_value { - GroupValue::Tuple(group_tuple) => GroupValue::Tuple(self.reduce_group_tuple(&group_tuple)?), + GroupValue::Tuple(group_tuple) => GroupValue::Tuple(self.reduce_group_tuple(group_tuple)?), _ => group_value.clone(), }; @@ -107,9 +105,9 @@ impl ReconstructingDirector { pub fn reduce_value(&mut self, value: &ValueExpression) -> Result { let new = match value { ValueExpression::Group(group_value) => { - Expression::Value(ValueExpression::Group(Box::new(self.reduce_group_value(&group_value)?))) + Expression::Value(ValueExpression::Group(Box::new(self.reduce_group_value(group_value)?))) } - ValueExpression::String(string, span) => self.reduce_string(string, &span)?, + ValueExpression::String(string, span) => self.reduce_string(string, span)?, _ => Expression::Value(value.clone()), }; @@ -284,14 +282,14 @@ impl ReconstructingDirector { // Statements pub fn reduce_statement(&mut self, statement: &Statement) -> Result { let new = match statement { - Statement::Return(return_statement) => Statement::Return(self.reduce_return(&return_statement)?), - Statement::Definition(definition) => Statement::Definition(self.reduce_definition(&definition)?), - Statement::Assign(assign) => Statement::Assign(self.reduce_assign(&assign)?), - Statement::Conditional(conditional) => Statement::Conditional(self.reduce_conditional(&conditional)?), - Statement::Iteration(iteration) => Statement::Iteration(self.reduce_iteration(&iteration)?), - Statement::Console(console) => Statement::Console(self.reduce_console(&console)?), - Statement::Expression(expression) => Statement::Expression(self.reduce_expression_statement(&expression)?), - Statement::Block(block) => Statement::Block(self.reduce_block(&block)?), + Statement::Return(return_statement) => Statement::Return(self.reduce_return(return_statement)?), + Statement::Definition(definition) => Statement::Definition(self.reduce_definition(definition)?), + Statement::Assign(assign) => Statement::Assign(self.reduce_assign(assign)?), + Statement::Conditional(conditional) => Statement::Conditional(self.reduce_conditional(conditional)?), + Statement::Iteration(iteration) => Statement::Iteration(self.reduce_iteration(iteration)?), + Statement::Console(console) => Statement::Console(self.reduce_console(console)?), + Statement::Expression(expression) => Statement::Expression(self.reduce_expression_statement(expression)?), + Statement::Block(block) => Statement::Block(self.reduce_block(block)?), }; self.reducer.reduce_statement(statement, new) @@ -334,8 +332,8 @@ impl ReconstructingDirector { AssigneeAccess::ArrayRange(left, right) } - AssigneeAccess::ArrayIndex(index) => AssigneeAccess::ArrayIndex(self.reduce_expression(&index)?), - AssigneeAccess::Member(identifier) => AssigneeAccess::Member(self.reduce_identifier(&identifier)?), + AssigneeAccess::ArrayIndex(index) => AssigneeAccess::ArrayIndex(self.reduce_expression(index)?), + AssigneeAccess::Member(identifier) => AssigneeAccess::Member(self.reduce_identifier(identifier)?), _ => access.clone(), }; @@ -456,7 +454,7 @@ impl ReconstructingDirector { let mut global_consts = IndexMap::new(); for (name, definition) in program.global_consts.iter() { - global_consts.insert(name.clone(), self.reduce_definition(&definition)?); + global_consts.insert(name.clone(), self.reduce_definition(definition)?); } self.reducer @@ -513,12 +511,10 @@ impl ReconstructingDirector { pub fn reduce_circuit_member(&mut self, circuit_member: &CircuitMember) -> Result { let new = match circuit_member { CircuitMember::CircuitVariable(identifier, type_) => CircuitMember::CircuitVariable( - self.reduce_identifier(&identifier)?, - self.reduce_type(&type_, &identifier.span)?, + self.reduce_identifier(identifier)?, + self.reduce_type(type_, &identifier.span)?, ), - CircuitMember::CircuitFunction(function) => { - CircuitMember::CircuitFunction(self.reduce_function(&function)?) - } + CircuitMember::CircuitFunction(function) => CircuitMember::CircuitFunction(self.reduce_function(function)?), }; self.reducer.reduce_circuit_member(circuit_member, new) diff --git a/ast/src/types/type_.rs b/ast/src/types/type_.rs index fb4ad87522..abc29f475f 100644 --- a/ast/src/types/type_.rs +++ b/ast/src/types/type_.rs @@ -70,8 +70,8 @@ impl Type { (Type::Char, Type::Char) => true, (Type::Field, Type::Field) => true, (Type::Group, Type::Group) => true, - (Type::IntegerType(left), Type::IntegerType(right)) => left.eq(&right), - (Type::Circuit(left), Type::Circuit(right)) => left.eq(&right), + (Type::IntegerType(left), Type::IntegerType(right)) => left.eq(right), + (Type::Circuit(left), Type::Circuit(right)) => left.eq(right), (Type::SelfType, Type::SelfType) => true, (Type::Array(left_type, left_dim), Type::Array(right_type, right_dim)) => { // Convert array dimensions to owned. diff --git a/input/src/errors/parser.rs b/input/src/errors/parser.rs index 215dd7382c..cca4dc850a 100644 --- a/input/src/errors/parser.rs +++ b/input/src/errors/parser.rs @@ -191,7 +191,7 @@ impl InputParserError { expected, actual ); - Self::new_from_span(message, &span) + Self::new_from_span(message, span) } pub fn section(header: Header) -> Self { diff --git a/input/src/values/group_coordinate.rs b/input/src/values/group_coordinate.rs index 8a4882c39c..70217b85cf 100644 --- a/input/src/values/group_coordinate.rs +++ b/input/src/values/group_coordinate.rs @@ -32,7 +32,7 @@ pub enum GroupCoordinate<'ast> { impl<'ast> GroupCoordinate<'ast> { pub fn span(&self) -> &Span<'ast> { match self { - GroupCoordinate::Number(number) => &number.span(), + GroupCoordinate::Number(number) => number.span(), GroupCoordinate::SignHigh(sign_high) => &sign_high.span, GroupCoordinate::SignLow(sign_low) => &sign_low.span, GroupCoordinate::Inferred(inferred) => &inferred.span, diff --git a/input/src/values/value.rs b/input/src/values/value.rs index 0c3ccfe5e9..993d5ee04b 100644 --- a/input/src/values/value.rs +++ b/input/src/values/value.rs @@ -39,13 +39,13 @@ pub enum Value<'ast> { impl<'ast> Value<'ast> { pub fn span(&self) -> &Span<'ast> { match self { - Value::Address(value) => &value.span(), + Value::Address(value) => value.span(), Value::Boolean(value) => &value.span, Value::Char(value) => &value.span, Value::Field(value) => &value.span, Value::Group(value) => &value.span, - Value::Implicit(value) => &value.span(), - Value::Integer(value) => &value.span(), + Value::Implicit(value) => value.span(), + Value::Integer(value) => value.span(), } } } diff --git a/parser/examples/parser.rs b/parser/examples/parser.rs index bd6c8f477a..2c7788f49c 100644 --- a/parser/examples/parser.rs +++ b/parser/examples/parser.rs @@ -48,7 +48,7 @@ fn main() -> Result<(), SyntaxError> { let input_filepath = Path::new(&cli_arguments[1]); // Construct the serialized syntax tree. - let serialized_leo_tree = to_leo_tree(&input_filepath)?; + let serialized_leo_tree = to_leo_tree(input_filepath)?; println!("{}", serialized_leo_tree); // Determine the output directory. diff --git a/parser/src/parser/file.rs b/parser/src/parser/file.rs index 80abacaddb..8b15b09f39 100644 --- a/parser/src/parser/file.rs +++ b/parser/src/parser/file.rs @@ -227,7 +227,7 @@ impl ParserContext { base.name = format_tendril!("{}{}", base.name, next.name); base.span = base.span + next.span; } - x if KEYWORD_TOKENS.contains(&x) => { + x if KEYWORD_TOKENS.contains(x) => { let next = self.expect_loose_identifier()?; base.name = format_tendril!("{}{}", base.name, next.name); base.span = base.span + next.span; diff --git a/parser/src/parser/statement.rs b/parser/src/parser/statement.rs index 1b82145f43..1448dad6bc 100644 --- a/parser/src/parser/statement.rs +++ b/parser/src/parser/statement.rs @@ -281,7 +281,7 @@ impl ParserContext { "log" => ConsoleFunction::Log(self.parse_console_args()?), x => { return Err(SyntaxError::unexpected_ident( - &x, + x, &["assert", "error", "log"], &function.span, )); diff --git a/parser/src/tokenizer/lexer.rs b/parser/src/tokenizer/lexer.rs index cf9b452e9b..0b573409bb 100644 --- a/parser/src/tokenizer/lexer.rs +++ b/parser/src/tokenizer/lexer.rs @@ -101,7 +101,7 @@ impl Token { return None; } - if let Ok(ascii_number) = u8::from_str_radix(&hex_string, 16) { + if let Ok(ascii_number) = u8::from_str_radix(hex_string, 16) { // According to RFC, we allow only values less than 128. if ascii_number > 127 { return None; @@ -123,7 +123,7 @@ impl Token { return None; } - if let Ok(hex) = u32::from_str_radix(&unicode_number, 16) { + if let Ok(hex) = u32::from_str_radix(unicode_number, 16) { if let Some(character) = std::char::from_u32(hex) { // scalar return Some(Char::Scalar(character)); diff --git a/tests/expectations/compiler/compiler/circuits/member_static_function_nested.leo.out b/tests/expectations/compiler/compiler/circuits/member_static_function_nested.leo.out index 8e891e6ac9..14f7a27016 100644 --- a/tests/expectations/compiler/compiler/circuits/member_static_function_nested.leo.out +++ b/tests/expectations/compiler/compiler/circuits/member_static_function_nested.leo.out @@ -17,5 +17,5 @@ outputs: type: bool value: "true" initial_ast: 4c74b65863cddde8ce523495358ab619ec48645dcb8409658a3fb3d7a3821d6d - canonicalized_ast: b5697d5884139da5a68861213ff3c7660f694e682078e1bd350856206e0289b8 - type_inferenced_ast: ff4b8f91f014277d6bb2d8d82c31361e5a5c5a46ed87a1e61f0c2e2e8d5fd254 + canonicalized_ast: 45dc35a683e14503f8a1fc40280f05e7d096b49896f115ffa649e76b9cd80941 + type_inferenced_ast: 11af72cfc90adc12c3412e3067ad285a2279de0f4f12af5081dbe27c58b5a3bf From 82f8e8a5cab0c3cc41af1df78ec2caa112d33630 Mon Sep 17 00:00:00 2001 From: damirka Date: Tue, 3 Aug 2021 01:46:18 +0300 Subject: [PATCH 10/19] clippy fixes --- asg/src/const_value.rs | 20 ++++---- asg/src/expression/constant.rs | 6 +-- asg/src/expression/mod.rs | 2 +- asg/src/program/function.rs | 2 +- asg/src/program/mod.rs | 2 +- asg/src/reducer/monoidal_director.rs | 2 +- asg/src/statement/assign.rs | 18 ++++---- asg/src/statement/block.rs | 2 +- asg/src/statement/definition.rs | 2 +- compiler/src/compiler.rs | 8 ++-- compiler/src/constraints/constraints.rs | 2 +- compiler/src/expression/array/access.rs | 2 +- compiler/src/expression/function/function.rs | 2 +- .../src/function/input/main_function_input.rs | 2 +- compiler/src/function/main_function.rs | 2 +- compiler/src/function/result/result.rs | 4 +- compiler/src/phases/reducing_director.rs | 46 +++++++++---------- .../statement/assign/assignee/array_index.rs | 8 ++-- .../src/statement/conditional/conditional.rs | 2 +- compiler/src/value/value.rs | 2 +- imports/src/parser/parse_symbol.rs | 2 +- leo/config.rs | 4 +- leo/updater.rs | 4 +- package/src/package.rs | 36 +++++++-------- 24 files changed, 91 insertions(+), 91 deletions(-) diff --git a/asg/src/const_value.rs b/asg/src/const_value.rs index d430f0bbc4..cfe091f749 100644 --- a/asg/src/const_value.rs +++ b/asg/src/const_value.rs @@ -315,16 +315,16 @@ impl ConstInt { pub fn parse(int_type: &IntegerType, value: &str, span: &Span) -> Result { Ok(match int_type { - IntegerType::I8 => ConstInt::I8(value.parse().map_err(|_| AsgConvertError::invalid_int(&value, span))?), - IntegerType::I16 => ConstInt::I16(value.parse().map_err(|_| AsgConvertError::invalid_int(&value, span))?), - IntegerType::I32 => ConstInt::I32(value.parse().map_err(|_| AsgConvertError::invalid_int(&value, span))?), - IntegerType::I64 => ConstInt::I64(value.parse().map_err(|_| AsgConvertError::invalid_int(&value, span))?), - IntegerType::I128 => ConstInt::I128(value.parse().map_err(|_| AsgConvertError::invalid_int(&value, span))?), - IntegerType::U8 => ConstInt::U8(value.parse().map_err(|_| AsgConvertError::invalid_int(&value, span))?), - IntegerType::U16 => ConstInt::U16(value.parse().map_err(|_| AsgConvertError::invalid_int(&value, span))?), - IntegerType::U32 => ConstInt::U32(value.parse().map_err(|_| AsgConvertError::invalid_int(&value, span))?), - IntegerType::U64 => ConstInt::U64(value.parse().map_err(|_| AsgConvertError::invalid_int(&value, span))?), - IntegerType::U128 => ConstInt::U128(value.parse().map_err(|_| AsgConvertError::invalid_int(&value, span))?), + IntegerType::I8 => ConstInt::I8(value.parse().map_err(|_| AsgConvertError::invalid_int(value, span))?), + IntegerType::I16 => ConstInt::I16(value.parse().map_err(|_| AsgConvertError::invalid_int(value, span))?), + IntegerType::I32 => ConstInt::I32(value.parse().map_err(|_| AsgConvertError::invalid_int(value, span))?), + IntegerType::I64 => ConstInt::I64(value.parse().map_err(|_| AsgConvertError::invalid_int(value, span))?), + IntegerType::I128 => ConstInt::I128(value.parse().map_err(|_| AsgConvertError::invalid_int(value, span))?), + IntegerType::U8 => ConstInt::U8(value.parse().map_err(|_| AsgConvertError::invalid_int(value, span))?), + IntegerType::U16 => ConstInt::U16(value.parse().map_err(|_| AsgConvertError::invalid_int(value, span))?), + IntegerType::U32 => ConstInt::U32(value.parse().map_err(|_| AsgConvertError::invalid_int(value, span))?), + IntegerType::U64 => ConstInt::U64(value.parse().map_err(|_| AsgConvertError::invalid_int(value, span))?), + IntegerType::U128 => ConstInt::U128(value.parse().map_err(|_| AsgConvertError::invalid_int(value, span))?), }) } } diff --git a/asg/src/expression/constant.rs b/asg/src/expression/constant.rs index 8fb638974a..ae50b01071 100644 --- a/asg/src/expression/constant.rs +++ b/asg/src/expression/constant.rs @@ -115,7 +115,7 @@ impl<'a> FromAst<'a, leo_ast::ValueExpression> for Constant<'a> { value: ConstValue::Boolean( value .parse::() - .map_err(|_| AsgConvertError::invalid_boolean(&value, span))?, + .map_err(|_| AsgConvertError::invalid_boolean(value, span))?, ), } } @@ -151,7 +151,7 @@ impl<'a> FromAst<'a, leo_ast::ValueExpression> for Constant<'a> { Constant { parent: Cell::new(None), span: Some(span.clone()), - value: ConstValue::Field(value.parse().map_err(|_| AsgConvertError::invalid_int(&value, span))?), + value: ConstValue::Field(value.parse().map_err(|_| AsgConvertError::invalid_int(value, span))?), } } Group(value) => { @@ -188,7 +188,7 @@ impl<'a> FromAst<'a, leo_ast::ValueExpression> for Constant<'a> { Some(PartialType::Type(Type::Field)) => Constant { parent: Cell::new(None), span: Some(span.clone()), - value: ConstValue::Field(value.parse().map_err(|_| AsgConvertError::invalid_int(&value, span))?), + value: ConstValue::Field(value.parse().map_err(|_| AsgConvertError::invalid_int(value, span))?), }, Some(PartialType::Type(Type::Group)) => Constant { parent: Cell::new(None), diff --git a/asg/src/expression/mod.rs b/asg/src/expression/mod.rs index 4778e3b6a6..60c9d3f47c 100644 --- a/asg/src/expression/mod.rs +++ b/asg/src/expression/mod.rs @@ -341,7 +341,7 @@ impl<'a> FromAst<'a, leo_ast::Expression> for &'a Expression<'a> { .context .alloc_expression(CallExpression::from_ast(scope, call, expected_type).map(Expression::Call)?), }; - expression.enforce_parents(&expression); + expression.enforce_parents(expression); Ok(expression) } } diff --git a/asg/src/program/function.rs b/asg/src/program/function.rs index bf89b0020f..91b8a223f3 100644 --- a/asg/src/program/function.rs +++ b/asg/src/program/function.rs @@ -101,7 +101,7 @@ impl<'a> Function<'a> { let variable = scope.context.alloc_variable(RefCell::new(crate::InnerVariable { id: scope.context.get_id(), name: identifier.clone(), - type_: scope.resolve_ast_type(&type_)?, + type_: scope.resolve_ast_type(type_)?, mutable: *mutable, const_: *const_, declaration: crate::VariableDeclaration::Parameter, diff --git a/asg/src/program/mod.rs b/asg/src/program/mod.rs index d6c00ef7e3..998f5928c5 100644 --- a/asg/src/program/mod.rs +++ b/asg/src/program/mod.rs @@ -127,7 +127,7 @@ fn resolve_import_package_access( PackageAccess::Multiple(packages) => { package_segments.push(packages.name.name.to_string()); for subaccess in packages.accesses.iter() { - resolve_import_package_access(output, package_segments.clone(), &subaccess); + resolve_import_package_access(output, package_segments.clone(), subaccess); } } } diff --git a/asg/src/reducer/monoidal_director.rs b/asg/src/reducer/monoidal_director.rs index 161183a19b..858a1bb256 100644 --- a/asg/src/reducer/monoidal_director.rs +++ b/asg/src/reducer/monoidal_director.rs @@ -308,6 +308,6 @@ impl<'a, T: Monoid, R: MonoidalReducerProgram<'a, T>> MonoidalDirector<'a, T, R> let circuits = input.circuits.iter().map(|(_, c)| self.reduce_circuit(c)).collect(); self.reducer - .reduce_program(&input, imported_modules, functions, circuits) + .reduce_program(input, imported_modules, functions, circuits) } } diff --git a/asg/src/statement/assign.rs b/asg/src/statement/assign.rs index e1f44b8210..1f3357d884 100644 --- a/asg/src/statement/assign.rs +++ b/asg/src/statement/assign.rs @@ -79,12 +79,12 @@ impl<'a> FromAst<'a, leo_ast::AssignStatement> for &'a Statement<'a> { } } else { scope - .resolve_variable(&name) - .ok_or_else(|| AsgConvertError::unresolved_reference(name, &span))? + .resolve_variable(name) + .ok_or_else(|| AsgConvertError::unresolved_reference(name, span))? }; if !variable.borrow().mutable { - return Err(AsgConvertError::immutable_assignment(&name, &statement.span)); + return Err(AsgConvertError::immutable_assignment(name, &statement.span)); } let mut target_type: Option = Some(variable.borrow().type_.clone().into()); @@ -123,13 +123,13 @@ impl<'a> FromAst<'a, leo_ast::AssignStatement> for &'a Statement<'a> { ) { let left = match left { ConstValue::Int(x) => x.to_usize().ok_or_else(|| { - AsgConvertError::invalid_assign_index(&name, &x.to_string(), &statement.span) + AsgConvertError::invalid_assign_index(name, &x.to_string(), &statement.span) })?, _ => unimplemented!(), }; let right = match right { ConstValue::Int(x) => x.to_usize().ok_or_else(|| { - AsgConvertError::invalid_assign_index(&name, &x.to_string(), &statement.span) + AsgConvertError::invalid_assign_index(name, &x.to_string(), &statement.span) })?, _ => unimplemented!(), }; @@ -137,7 +137,7 @@ impl<'a> FromAst<'a, leo_ast::AssignStatement> for &'a Statement<'a> { target_type = Some(PartialType::Array(item.clone(), Some((right - left) as usize))) } else { return Err(AsgConvertError::invalid_backwards_assignment( - &name, + name, left, right, &statement.span, @@ -145,7 +145,7 @@ impl<'a> FromAst<'a, leo_ast::AssignStatement> for &'a Statement<'a> { } } } - _ => return Err(AsgConvertError::index_into_non_array(&name, &statement.span)), + _ => return Err(AsgConvertError::index_into_non_array(name, &statement.span)), } AssignAccess::ArrayRange(Cell::new(left), Cell::new(right)) @@ -153,7 +153,7 @@ impl<'a> FromAst<'a, leo_ast::AssignStatement> for &'a Statement<'a> { AstAssigneeAccess::ArrayIndex(index) => { target_type = match target_type.clone() { Some(PartialType::Array(item, _)) => item.map(|x| *x), - _ => return Err(AsgConvertError::index_into_non_array(&name, &statement.span)), + _ => return Err(AsgConvertError::index_into_non_array(name, &statement.span)), }; AssignAccess::ArrayIndex(Cell::new(<&Expression<'a>>::from_ast( scope, @@ -171,7 +171,7 @@ impl<'a> FromAst<'a, leo_ast::AssignStatement> for &'a Statement<'a> { .get(index) .cloned() .ok_or_else(|| AsgConvertError::tuple_index_out_of_bounds(index, &statement.span))?, - _ => return Err(AsgConvertError::index_into_non_tuple(&name, &statement.span)), + _ => return Err(AsgConvertError::index_into_non_tuple(name, &statement.span)), }; AssignAccess::Tuple(index) } diff --git a/asg/src/statement/block.rs b/asg/src/statement/block.rs index 9a64fcdfb9..2b50d0c3df 100644 --- a/asg/src/statement/block.rs +++ b/asg/src/statement/block.rs @@ -42,7 +42,7 @@ impl<'a> FromAst<'a, leo_ast::Block> for BlockStatement<'a> { let mut output = vec![]; for item in statement.statements.iter() { - output.push(Cell::new(<&'a Statement<'a>>::from_ast(&new_scope, item, None)?)); + output.push(Cell::new(<&'a Statement<'a>>::from_ast(new_scope, item, None)?)); } Ok(BlockStatement { parent: Cell::new(None), diff --git a/asg/src/statement/definition.rs b/asg/src/statement/definition.rs index f340052409..54bdf50b4f 100644 --- a/asg/src/statement/definition.rs +++ b/asg/src/statement/definition.rs @@ -70,7 +70,7 @@ impl<'a> FromAst<'a, leo_ast::DefinitionStatement> for &'a Statement<'a> { let type_ = statement .type_ .as_ref() - .map(|x| scope.resolve_ast_type(&x)) + .map(|x| scope.resolve_ast_type(x)) .transpose()?; let value = <&Expression<'a>>::from_ast(scope, &statement.value, type_.clone().map(Into::into))?; diff --git a/compiler/src/compiler.rs b/compiler/src/compiler.rs index 34e55b7a7f..5efb919e2a 100644 --- a/compiler/src/compiler.rs +++ b/compiler/src/compiler.rs @@ -181,7 +181,7 @@ impl<'a, F: PrimeField, G: GroupType> Compiler<'a, F, G> { state_string: &str, state_path: &Path, ) -> Result<(), CompilerError> { - let input_syntax_tree = LeoInputParser::parse_file(&input_string).map_err(|mut e| { + let input_syntax_tree = LeoInputParser::parse_file(input_string).map_err(|mut e| { e.set_path( input_path.to_str().unwrap_or_default(), &input_string.lines().map(|x| x.to_string()).collect::>()[..], @@ -189,7 +189,7 @@ impl<'a, F: PrimeField, G: GroupType> Compiler<'a, F, G> { e })?; - let state_syntax_tree = LeoInputParser::parse_file(&state_string).map_err(|mut e| { + let state_syntax_tree = LeoInputParser::parse_file(state_string).map_err(|mut e| { e.set_path( state_path.to_str().unwrap_or_default(), &state_string.lines().map(|x| x.to_string()).collect::>()[..], @@ -308,14 +308,14 @@ impl<'a, F: PrimeField, G: GroupType> Compiler<'a, F, G> { /// Synthesizes the circuit with program input to verify correctness. /// pub fn compile_constraints>(&self, cs: &mut CS) -> Result { - generate_constraints::(cs, &self.asg.as_ref().unwrap(), &self.program_input) + generate_constraints::(cs, self.asg.as_ref().unwrap(), &self.program_input) } /// /// Synthesizes the circuit for test functions with program input. /// pub fn compile_test_constraints(self, input_pairs: InputPairs) -> Result<(u32, u32), CompilerError> { - generate_test_constraints::(&self.asg.as_ref().unwrap(), input_pairs, &self.output_directory) + generate_test_constraints::(self.asg.as_ref().unwrap(), input_pairs, &self.output_directory) } /// diff --git a/compiler/src/constraints/constraints.rs b/compiler/src/constraints/constraints.rs index 6d256dea96..4e34b4c096 100644 --- a/compiler/src/constraints/constraints.rs +++ b/compiler/src/constraints/constraints.rs @@ -44,7 +44,7 @@ pub fn generate_constraints<'a, F: PrimeField, G: GroupType, CS: ConstraintSy match main { Some(function) => { - let result = resolved_program.enforce_main_function(cs, &function, input)?; + let result = resolved_program.enforce_main_function(cs, function, input)?; Ok(result) } _ => Err(CompilerError::NoMainFunction), diff --git a/compiler/src/expression/array/access.rs b/compiler/src/expression/array/access.rs index 11009dbd64..0fd6e7f5fb 100644 --- a/compiler/src/expression/array/access.rs +++ b/compiler/src/expression/array/access.rs @@ -94,7 +94,7 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { .len() .try_into() .map_err(|_| ExpressionError::array_length_out_of_bounds(span))?; - self.array_bounds_check(cs, &&index_resolved, array_len, span)?; + self.array_bounds_check(cs, &index_resolved, array_len, span)?; } let mut current_value = array.pop().unwrap(); diff --git a/compiler/src/expression/function/function.rs b/compiler/src/expression/function/function.rs index e67700d7a8..58f2f0b3d4 100644 --- a/compiler/src/expression/function/function.rs +++ b/compiler/src/expression/function/function.rs @@ -44,7 +44,7 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { }; let return_value = self - .enforce_function(&mut cs.ns(name_unique), &function, target, arguments) + .enforce_function(&mut cs.ns(name_unique), function, target, arguments) .map_err(|error| ExpressionError::from(Box::new(error)))?; Ok(return_value) diff --git a/compiler/src/function/input/main_function_input.rs b/compiler/src/function/input/main_function_input.rs index 75379676fe..ec55db0a92 100644 --- a/compiler/src/function/input/main_function_input.rs +++ b/compiler/src/function/input/main_function_input.rs @@ -62,7 +62,7 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { span, )?)), Type::Array(type_, len) => self.allocate_array(cs, name, &*type_, *len, input_option, span), - Type::Tuple(types) => self.allocate_tuple(cs, &name, types, input_option, span), + Type::Tuple(types) => self.allocate_tuple(cs, name, types, input_option, span), _ => unimplemented!("main function input not implemented for type {}", type_), // Should not happen. } } diff --git a/compiler/src/function/main_function.rs b/compiler/src/function/main_function.rs index 8fe7e3a635..2e615924dc 100644 --- a/compiler/src/function/main_function.rs +++ b/compiler/src/function/main_function.rs @@ -39,7 +39,7 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { if let Some(asg_input) = asg_input { let value = - self.allocate_input_keyword(cs, &function.name.borrow().span, &asg_input.container_circuit, input)?; + self.allocate_input_keyword(cs, &function.name.borrow().span, asg_input.container_circuit, input)?; self.store(asg_input.container.borrow().id, value); } diff --git a/compiler/src/function/result/result.rs b/compiler/src/function/result/result.rs index a0f71b896c..395cf39adb 100644 --- a/compiler/src/function/result/result.rs +++ b/compiler/src/function/result/result.rs @@ -82,7 +82,7 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { cs.ns(|| format!("select result {} {}:{}", i, span.line_start, span.col_start)), &indicator, &result, - &value, + value, ) .map_err(|_| StatementError::select_fail(result.to_string(), value.to_string(), span))?, ); @@ -94,7 +94,7 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { if expected_return.is_unit() { Ok(ConstrainedValue::Tuple(vec![])) } else { - return_value.ok_or_else(|| StatementError::no_returns(&expected_return, span)) + return_value.ok_or_else(|| StatementError::no_returns(expected_return, span)) } } } diff --git a/compiler/src/phases/reducing_director.rs b/compiler/src/phases/reducing_director.rs index 2a934909a8..6cec43764d 100644 --- a/compiler/src/phases/reducing_director.rs +++ b/compiler/src/phases/reducing_director.rs @@ -155,49 +155,49 @@ impl CombineAstAsgDirector { asg: &AsgExpression, ) -> Result { let new = match (ast, asg) { - (AstExpression::Value(value), AsgExpression::Constant(const_)) => self.reduce_value(&value, &const_)?, + (AstExpression::Value(value), AsgExpression::Constant(const_)) => self.reduce_value(value, const_)?, (AstExpression::Binary(ast), AsgExpression::Binary(asg)) => { - AstExpression::Binary(self.reduce_binary(&ast, &asg)?) + AstExpression::Binary(self.reduce_binary(ast, asg)?) } (AstExpression::Unary(ast), AsgExpression::Unary(asg)) => { - AstExpression::Unary(self.reduce_unary(&ast, &asg)?) + AstExpression::Unary(self.reduce_unary(ast, asg)?) } (AstExpression::Ternary(ast), AsgExpression::Ternary(asg)) => { - AstExpression::Ternary(self.reduce_ternary(&ast, &asg)?) + AstExpression::Ternary(self.reduce_ternary(ast, asg)?) } - (AstExpression::Cast(ast), AsgExpression::Cast(asg)) => AstExpression::Cast(self.reduce_cast(&ast, &asg)?), + (AstExpression::Cast(ast), AsgExpression::Cast(asg)) => AstExpression::Cast(self.reduce_cast(ast, asg)?), (AstExpression::ArrayInline(ast), AsgExpression::ArrayInline(asg)) => { - AstExpression::ArrayInline(self.reduce_array_inline(&ast, &asg)?) + AstExpression::ArrayInline(self.reduce_array_inline(ast, asg)?) } (AstExpression::ArrayInit(ast), AsgExpression::ArrayInit(asg)) => { - AstExpression::ArrayInit(self.reduce_array_init(&ast, &asg)?) + AstExpression::ArrayInit(self.reduce_array_init(ast, asg)?) } (AstExpression::ArrayAccess(ast), AsgExpression::ArrayAccess(asg)) => { - AstExpression::ArrayAccess(self.reduce_array_access(&ast, &asg)?) + AstExpression::ArrayAccess(self.reduce_array_access(ast, asg)?) } (AstExpression::ArrayRangeAccess(ast), AsgExpression::ArrayRangeAccess(asg)) => { - AstExpression::ArrayRangeAccess(self.reduce_array_range_access(&ast, &asg)?) + AstExpression::ArrayRangeAccess(self.reduce_array_range_access(ast, asg)?) } (AstExpression::TupleInit(ast), AsgExpression::TupleInit(asg)) => { - AstExpression::TupleInit(self.reduce_tuple_init(&ast, &asg)?) + AstExpression::TupleInit(self.reduce_tuple_init(ast, asg)?) } (AstExpression::TupleAccess(ast), AsgExpression::TupleAccess(asg)) => { - AstExpression::TupleAccess(self.reduce_tuple_access(&ast, &asg)?) + AstExpression::TupleAccess(self.reduce_tuple_access(ast, asg)?) } (AstExpression::CircuitInit(ast), AsgExpression::CircuitInit(asg)) => { - AstExpression::CircuitInit(self.reduce_circuit_init(&ast, &asg)?) + AstExpression::CircuitInit(self.reduce_circuit_init(ast, asg)?) } (AstExpression::CircuitMemberAccess(ast), AsgExpression::CircuitAccess(asg)) => { - AstExpression::CircuitMemberAccess(self.reduce_circuit_member_access(&ast, &asg)?) + AstExpression::CircuitMemberAccess(self.reduce_circuit_member_access(ast, asg)?) } (AstExpression::CircuitStaticFunctionAccess(ast), AsgExpression::CircuitAccess(asg)) => { - AstExpression::CircuitStaticFunctionAccess(self.reduce_circuit_static_fn_access(&ast, &asg)?) + AstExpression::CircuitStaticFunctionAccess(self.reduce_circuit_static_fn_access(ast, asg)?) } - (AstExpression::Call(ast), AsgExpression::Call(asg)) => AstExpression::Call(self.reduce_call(&ast, &asg)?), + (AstExpression::Call(ast), AsgExpression::Call(asg)) => AstExpression::Call(self.reduce_call(ast, asg)?), _ => ast.clone(), }; @@ -299,7 +299,7 @@ impl CombineAstAsgDirector { ast: &AstCastExpression, asg: &AsgCastExpression, ) -> Result { - let inner = self.reduce_expression(&ast.inner, &asg.inner.get())?; + let inner = self.reduce_expression(&ast.inner, asg.inner.get())?; let target_type = self.reduce_type(&ast.target_type, &asg.target_type, &ast.span)?; self.ast_reducer.reduce_cast(ast, inner, target_type) @@ -524,7 +524,7 @@ impl CombineAstAsgDirector { AstAssignAccess::ArrayRange(left, right) } (AstAssignAccess::ArrayIndex(ast_index), AsgAssignAccess::ArrayIndex(asg_index)) => { - let index = self.reduce_expression(&ast_index, asg_index.get())?; + let index = self.reduce_expression(ast_index, asg_index.get())?; AstAssignAccess::ArrayIndex(index) } _ => ast.clone(), @@ -577,7 +577,7 @@ impl CombineAstAsgDirector { block = self.reduce_block(&ast.block, asg_block)?; } else { return Err(ReducerError::from(CombinerError::asg_statement_not_block( - &asg.span.as_ref().unwrap(), + asg.span.as_ref().unwrap(), ))); } let next = match (ast.next.as_ref(), asg.next.get()) { @@ -595,7 +595,7 @@ impl CombineAstAsgDirector { ) -> Result { let function = match (&ast.function, &asg.function) { (AstConsoleFunction::Assert(ast_expression), AsgConsoleFunction::Assert(asg_expression)) => { - AstConsoleFunction::Assert(self.reduce_expression(&ast_expression, asg_expression.get())?) + AstConsoleFunction::Assert(self.reduce_expression(ast_expression, asg_expression.get())?) } (AstConsoleFunction::Error(ast_console_args), AsgConsoleFunction::Error(asg_format)) | (AstConsoleFunction::Log(ast_console_args), AsgConsoleFunction::Log(asg_format)) => { @@ -603,7 +603,7 @@ impl CombineAstAsgDirector { for (ast_parameter, asg_parameter) in ast_console_args.parameters.iter().zip(asg_format.parameters.iter()) { - parameters.push(self.reduce_expression(&ast_parameter, asg_parameter.get())?); + parameters.push(self.reduce_expression(ast_parameter, asg_parameter.get())?); } let args = AstConsoleArgs { @@ -640,14 +640,14 @@ impl CombineAstAsgDirector { let asg_type = AsgType::Tuple(types); type_ = match &ast.type_ { - Some(ast_type) => Some(self.reduce_type(&ast_type, &asg_type, &ast.span)?), + Some(ast_type) => Some(self.reduce_type(ast_type, &asg_type, &ast.span)?), None if self.options.type_inference_enabled() => Some((&asg_type).into()), _ => None, }; } else { type_ = match &ast.type_ { Some(ast_type) => { - Some(self.reduce_type(&ast_type, &asg.variables.first().unwrap().borrow().type_, &ast.span)?) + Some(self.reduce_type(ast_type, &asg.variables.first().unwrap().borrow().type_, &ast.span)?) } None if self.options.type_inference_enabled() => { Some((&asg.variables.first().unwrap().borrow().type_).into()) @@ -683,7 +683,7 @@ impl CombineAstAsgDirector { block = self.reduce_block(&ast.block, asg_block)?; } else { return Err(ReducerError::from(CombinerError::asg_statement_not_block( - &asg.span.as_ref().unwrap(), + asg.span.as_ref().unwrap(), ))); } diff --git a/compiler/src/statement/assign/assignee/array_index.rs b/compiler/src/statement/assign/assignee/array_index.rs index 4b7fc6f3b0..4a463fe3cf 100644 --- a/compiler/src/statement/assign/assignee/array_index.rs +++ b/compiler/src/statement/assign/assignee/array_index.rs @@ -69,7 +69,7 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { .len() .try_into() .map_err(|_| ExpressionError::array_length_out_of_bounds(&span))?; - self.array_bounds_check(cs, &&index_resolved, array_len, &span)?; + self.array_bounds_check(cs, &index_resolved, array_len, &span)?; } for (i, item) in input.iter_mut().enumerate() { @@ -116,7 +116,7 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { unique_namespace, &index_comparison, &temp_item, - &item, + item, ) .map_err(|e| ExpressionError::cannot_enforce("conditional select".to_string(), e, &span))?; *item = value; @@ -153,7 +153,7 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { .len() .try_into() .map_err(|_| ExpressionError::array_length_out_of_bounds(&span))?; - self.array_bounds_check(cs, &&index_resolved, array_len, &span)?; + self.array_bounds_check(cs, &index_resolved, array_len, &span)?; } for (i, item) in context.input.iter_mut().enumerate() { @@ -197,7 +197,7 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { item }; let value = - ConstrainedValue::conditionally_select(unique_namespace, &index_comparison, &temp_item, &item) + ConstrainedValue::conditionally_select(unique_namespace, &index_comparison, &temp_item, item) .map_err(|e| ExpressionError::cannot_enforce("conditional select".to_string(), e, &span))?; **item = value; } diff --git a/compiler/src/statement/conditional/conditional.rs b/compiler/src/statement/conditional/conditional.rs index 3fe7469209..79b032c0e5 100644 --- a/compiler/src/statement/conditional/conditional.rs +++ b/compiler/src/statement/conditional/conditional.rs @@ -91,7 +91,7 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { ); let branch_2_indicator = Boolean::and( &mut cs.ns(|| format!("branch 2 {}:{}", &span.line_start, &span.col_start)), - &outer_indicator, + outer_indicator, &inner_indicator, ) .map_err(|_| StatementError::indicator_calculation(branch_2_name, &span))?; diff --git a/compiler/src/value/value.rs b/compiler/src/value/value.rs index eb23ec9843..158879d57a 100644 --- a/compiler/src/value/value.rs +++ b/compiler/src/value/value.rs @@ -124,7 +124,7 @@ impl<'a, F: PrimeField, G: GroupType> fmt::Display for ConstrainedValue<'a, F write!(f, "({})", values) } - ConstrainedValue::CircuitExpression(ref circuit, ref members) => { + ConstrainedValue::CircuitExpression(circuit, ref members) => { write!(f, "{} {{", circuit.name.borrow())?; for (i, member) in members.iter().enumerate() { write!(f, "{}: {}", member.0, member.1)?; diff --git a/imports/src/parser/parse_symbol.rs b/imports/src/parser/parse_symbol.rs index ce1f391f60..1b8183f7b0 100644 --- a/imports/src/parser/parse_symbol.rs +++ b/imports/src/parser/parse_symbol.rs @@ -54,7 +54,7 @@ impl<'a> ImportParser<'a> { // Build the package abstract syntax tree. let program_string = &std::fs::read_to_string(&file_path).map_err(|x| ImportParserError::io_error(span, file_path_str, x))?; - let mut program = leo_parser::parse(&file_path_str, &program_string)?; + let mut program = leo_parser::parse(file_path_str, program_string)?; program.name = file_name; let mut ast = leo_ast::Ast::new(program); ast.canonicalize()?; diff --git a/leo/config.rs b/leo/config.rs index ae85bc3d2c..ccba67ef0b 100644 --- a/leo/config.rs +++ b/leo/config.rs @@ -144,10 +144,10 @@ pub fn write_token_and_username(token: &str, username: &str) -> Result<(), io::E } let mut credentials = File::create(&LEO_CREDENTIALS_PATH.to_path_buf())?; - credentials.write_all(&token.as_bytes())?; + credentials.write_all(token.as_bytes())?; let mut username_file = File::create(&LEO_USERNAME_PATH.to_path_buf())?; - username_file.write_all(&username.as_bytes())?; + username_file.write_all(username.as_bytes())?; Ok(()) } diff --git a/leo/updater.rs b/leo/updater.rs index cc5c8972da..a5e5b7668a 100644 --- a/leo/updater.rs +++ b/leo/updater.rs @@ -53,7 +53,7 @@ impl Updater { .repo_owner(Self::LEO_REPO_OWNER) .repo_name(Self::LEO_REPO_NAME) .bin_name(Self::LEO_BIN_NAME) - .current_version(&env!("CARGO_PKG_VERSION")) + .current_version(env!("CARGO_PKG_VERSION")) .show_download_progress(show_output) .no_confirm(true) .show_output(show_output) @@ -69,7 +69,7 @@ impl Updater { .repo_owner(Self::LEO_REPO_OWNER) .repo_name(Self::LEO_REPO_NAME) .bin_name(Self::LEO_BIN_NAME) - .current_version(&env!("CARGO_PKG_VERSION")) + .current_version(env!("CARGO_PKG_VERSION")) .build()?; let current_version = updater.current_version(); diff --git a/package/src/package.rs b/package/src/package.rs index 8a7fb861e7..1a6b8273de 100644 --- a/package/src/package.rs +++ b/package/src/package.rs @@ -123,14 +123,14 @@ impl Package { } // Check if the input file already exists. - let input_file = InputFile::new(&package_name); + let input_file = InputFile::new(package_name); if input_file.exists_at(path) { existing_files.push(input_file.filename()); result = false; } // Check if the state file already exists. - let state_file = StateFile::new(&package_name); + let state_file = StateFile::new(package_name); if state_file.exists_at(path) { existing_files.push(state_file.filename()); result = false; @@ -157,24 +157,24 @@ impl Package { } // Check if the manifest file exists. - if !Manifest::exists_at(&path) { + if !Manifest::exists_at(path) { return false; } // Check if the input file exists. - let input_file = InputFile::new(&package_name); - if !input_file.exists_at(&path) { + let input_file = InputFile::new(package_name); + if !input_file.exists_at(path) { return false; } // Check if the state file exists. - let state_file = StateFile::new(&package_name); - if !state_file.exists_at(&path) { + let state_file = StateFile::new(package_name); + if !state_file.exists_at(path) { return false; } // Check if the main file exists. - if !MainFile::exists_at(&path) { + if !MainFile::exists_at(path) { return false; } @@ -195,34 +195,34 @@ impl Package { // Next, initialize this directory as a Leo package. { // Create the manifest file. - Manifest::new(&package_name, author)?.write_to(&path)?; + Manifest::new(package_name, author)?.write_to(path)?; // Verify that the .gitignore file does not exist. - if !Gitignore::exists_at(&path) { + if !Gitignore::exists_at(path) { // Create the .gitignore file. - Gitignore::new().write_to(&path)?; + Gitignore::new().write_to(path)?; } // Verify that the README.md file does not exist. - if !README::exists_at(&path) { + if !README::exists_at(path) { // Create the README.md file. - README::new(package_name).write_to(&path)?; + README::new(package_name).write_to(path)?; } // Create the source directory. - SourceDirectory::create(&path)?; + SourceDirectory::create(path)?; // Create the input directory. - InputsDirectory::create(&path)?; + InputsDirectory::create(path)?; // Create the input file in the inputs directory. - InputFile::new(&package_name).write_to(&path)?; + InputFile::new(package_name).write_to(path)?; // Create the state file in the inputs directory. - StateFile::new(&package_name).write_to(&path)?; + StateFile::new(package_name).write_to(path)?; // Create the main file in the source directory. - MainFile::new(&package_name).write_to(&path)?; + MainFile::new(package_name).write_to(path)?; } // Next, verify that a valid Leo package has been initialized in this directory { From 36423caaafa9760ef665e165c4468f3d5ff4d1cf Mon Sep 17 00:00:00 2001 From: damirka Date: Tue, 3 Aug 2021 02:05:38 +0300 Subject: [PATCH 11/19] bump snarkvm to 0.7.6 --- Cargo.lock | 29 ++++++++++------------------- Cargo.toml | 4 ++-- compiler/Cargo.toml | 6 +++--- state/Cargo.toml | 4 ++-- synthesizer/Cargo.toml | 4 ++-- 5 files changed, 19 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1fc8200b29..d7c2ebc726 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -281,7 +281,7 @@ version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c24dab4283a142afa2fdca129b80ad2c6284e073930f964c3a1293c225ee39a" dependencies = [ - "rustc_version 0.4.0", + "rustc_version", ] [[package]] @@ -2189,15 +2189,6 @@ version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" -[[package]] -name = "rustc_version" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" -dependencies = [ - "semver 0.11.0", -] - [[package]] name = "rustc_version" version = "0.4.0" @@ -2465,14 +2456,14 @@ dependencies = [ [[package]] name = "snarkvm-curves" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62fdf07998a6e88fce7a8139e8282fb6b2702e49624b6d7e10a5cc1c9f014264" +checksum = "6a67bf9f77ce8db3e88fd58241ec7d0a0ad80097c42d0bd4e53b123106605249" dependencies = [ "derivative", "rand 0.8.4", "rand_xorshift", - "rustc_version 0.3.3", + "rustc_version", "serde", "snarkvm-fields", "snarkvm-utilities", @@ -2481,9 +2472,9 @@ dependencies = [ [[package]] name = "snarkvm-derives" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d42f4d5abda149130149ce3865aef23d380dfcdd97fea7f75fd79b0aee369b29" +checksum = "3cbe69096a11cdc3f0b069e0313d47fbcabf45532d58435ef0a03d35d2805dc5" dependencies = [ "proc-macro-crate", "proc-macro-error", @@ -2526,9 +2517,9 @@ dependencies = [ [[package]] name = "snarkvm-fields" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ecd058b3608140610276be1eb1139a032a1bb171969b3ad70550c471d3ae503" +checksum = "502d750651111b5d399a3b29b770fe821fdac87614335b4814ab5a0d014634bc" dependencies = [ "anyhow", "bincode", @@ -2639,9 +2630,9 @@ dependencies = [ [[package]] name = "snarkvm-utilities" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15b7ecf6a7afdd60a45cbd5ffab75185c296d8a4bf5eb20f3912384b1d4027c2" +checksum = "fcb1462993e1d189c75f88f2482f18ae4bcccb5ea5a7a93a25de92907305af8f" dependencies = [ "anyhow", "bincode", diff --git a/Cargo.toml b/Cargo.toml index e7187b0020..9095674d1b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -77,7 +77,7 @@ version = "1.5.3" version = "0.7.4" [dependencies.snarkvm-curves] -version = "0.7.5" +version = "0.7.6" default-features = false [dependencies.snarkvm-gadgets] @@ -89,7 +89,7 @@ version = "0.7.5" default-features = false [dependencies.snarkvm-utilities] -version = "0.7.4" +version = "0.7.6" [dependencies.anyhow] version = "1.0" diff --git a/compiler/Cargo.toml b/compiler/Cargo.toml index 5725a5f453..77244c15e3 100644 --- a/compiler/Cargo.toml +++ b/compiler/Cargo.toml @@ -57,11 +57,11 @@ version = "1.5.3" version = "0.4" [dependencies.snarkvm-curves] -version = "0.7.5" +version = "0.7.6" default-features = false [dependencies.snarkvm-fields] -version = "0.7.5" +version = "0.7.6" default-features = false [dependencies.snarkvm-dpc] @@ -78,7 +78,7 @@ version = "0.7.5" default-features = false [dependencies.snarkvm-utilities] -version = "0.7.4" +version = "0.7.6" [dependencies.bincode] version = "1.3" diff --git a/state/Cargo.toml b/state/Cargo.toml index 13a4c99a12..a5047aa21e 100644 --- a/state/Cargo.toml +++ b/state/Cargo.toml @@ -29,7 +29,7 @@ version = "1.5.3" version = "0.7.4" [dependencies.snarkvm-curves] -version = "0.7.5" +version = "0.7.6" default-features = false [dependencies.snarkvm-dpc] @@ -37,7 +37,7 @@ version = "0.7.5" features = [ "testnet1" ] [dependencies.snarkvm-utilities] -version = "0.7.4" +version = "0.7.6" [dependencies.indexmap] version = "1.7.0" diff --git a/synthesizer/Cargo.toml b/synthesizer/Cargo.toml index 4a84f46cb7..c8c37e2ca4 100644 --- a/synthesizer/Cargo.toml +++ b/synthesizer/Cargo.toml @@ -18,11 +18,11 @@ license = "GPL-3.0" edition = "2018" [dependencies.snarkvm-curves] -version = "0.7.5" +version = "0.7.6" default-features = false [dependencies.snarkvm-fields] -version = "0.7.5" +version = "0.7.6" default-features = false [dependencies.snarkvm-gadgets] From 14a5fbb33e82a2dca6c036e50908fd18d208c0aa Mon Sep 17 00:00:00 2001 From: damirka Date: Tue, 3 Aug 2021 02:16:51 +0300 Subject: [PATCH 12/19] bump snarkvm-dpc to 0.7.6 --- .github/dependabot.yml | 2 +- Cargo.lock | 32 ++++++++++++++++---------------- compiler/Cargo.toml | 2 +- state/Cargo.toml | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d88ec80da1..b5ec31d537 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,7 +5,7 @@ updates: schedule: interval: daily time: "10:00" - open-pull-requests-limit: 10 + open-pull-requests-limit: 20 ignore: - dependency-name: snarkvm-curves versions: diff --git a/Cargo.lock b/Cargo.lock index d7c2ebc726..454b64ae97 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2428,9 +2428,9 @@ checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" [[package]] name = "snarkvm-algorithms" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8bbefe6252ed85bb073f8ecbc402830e3d119b1aaadcea5a9c9e7a21a99cd2" +checksum = "d8db2338bd30c4f5f08f27cae89bccd9ba48b06166e1cddcc4e845de0390229f" dependencies = [ "anyhow", "bitvec", @@ -2485,9 +2485,9 @@ dependencies = [ [[package]] name = "snarkvm-dpc" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af8dd1b815a1101c4014c17cbdffadecb1032e8662fdf5fd4bd67a3c149d8449" +checksum = "c65b21cece03e1191989230062d8773d5dd7b848099fd0380e35d3f920b7c77e" dependencies = [ "anyhow", "base58", @@ -2533,9 +2533,9 @@ dependencies = [ [[package]] name = "snarkvm-gadgets" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b462bb5e5ac219eafd1a828c73c181e7b23692ade5c49fd72d71bfe4250a6b1" +checksum = "753400eccfb80757e90daaf077c37ce8988bf163816ded6eb884e725290a78f1" dependencies = [ "derivative", "digest 0.9.0", @@ -2553,9 +2553,9 @@ dependencies = [ [[package]] name = "snarkvm-marlin" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e5b1bb7923a757053c0a544072ec6b298585f83c9f4a3ae777ca048bb6e5589" +checksum = "abcc01851cf4cee0de8c4fda76f8096789cab813c738703ec67fe2d19d89a204" dependencies = [ "blake2", "derivative", @@ -2577,9 +2577,9 @@ dependencies = [ [[package]] name = "snarkvm-parameters" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14356edda788a3e52ac6e809e6fdbfd5cf7558249bf6051525843b045a73d12a" +checksum = "7f21f3b1fc09bff0e3a352a2e30927a3fbfbe183ef658cbb42bd2805db7d6420" dependencies = [ "curl", "hex", @@ -2590,9 +2590,9 @@ dependencies = [ [[package]] name = "snarkvm-polycommit" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28fac50de72680316fe57fbbbde2874ae28de7191a3f23ff9e541119951ddaa8" +checksum = "920e188506d5036cca0fdae46d63ad1779d3f49c671ea2339b9cda0c0ab8751a" dependencies = [ "derivative", "digest 0.9.0", @@ -2609,15 +2609,15 @@ dependencies = [ [[package]] name = "snarkvm-profiler" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ebfa546f0376a1348b857a9defdb3f4505a0420d82f8caa2b0cebbe197245fa" +checksum = "1a060c67f5c11015465721bdbbaf71f8c5132fdc885cb2e7307f8c936dd43ca1" [[package]] name = "snarkvm-r1cs" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aca9bb7105244ebc91f964b11a1ae63f173a77181307d1fa94f04e15dbde137" +checksum = "8b87182d37dc6665816e1dcd480820f6c6494d1d9604c481b756eb0771956265" dependencies = [ "cfg-if 1.0.0", "fxhash", diff --git a/compiler/Cargo.toml b/compiler/Cargo.toml index 77244c15e3..9c5b698d7f 100644 --- a/compiler/Cargo.toml +++ b/compiler/Cargo.toml @@ -65,7 +65,7 @@ version = "0.7.6" default-features = false [dependencies.snarkvm-dpc] -version = "0.7.5" +version = "0.7.6" default-features = false [dependencies.snarkvm-gadgets] diff --git a/state/Cargo.toml b/state/Cargo.toml index a5047aa21e..4f50ef0efa 100644 --- a/state/Cargo.toml +++ b/state/Cargo.toml @@ -33,7 +33,7 @@ version = "0.7.6" default-features = false [dependencies.snarkvm-dpc] -version = "0.7.5" +version = "0.7.6" features = [ "testnet1" ] [dependencies.snarkvm-utilities] From da9f65ba4a045c7bdfac6204fdb12c9897027462 Mon Sep 17 00:00:00 2001 From: damirka Date: Tue, 3 Aug 2021 02:39:44 +0300 Subject: [PATCH 13/19] bump all snarkvm dependencies to 0.7.6 --- Cargo.toml | 6 +++--- compiler/Cargo.toml | 6 +++--- state/Cargo.toml | 2 +- synthesizer/Cargo.toml | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9095674d1b..23d481f279 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -74,18 +74,18 @@ path = "./synthesizer" version = "1.5.3" [dependencies.snarkvm-algorithms] -version = "0.7.4" +version = "0.7.6" [dependencies.snarkvm-curves] version = "0.7.6" default-features = false [dependencies.snarkvm-gadgets] -version = "0.7.5" +version = "0.7.6" default-features = false [dependencies.snarkvm-r1cs] -version = "0.7.5" +version = "0.7.6" default-features = false [dependencies.snarkvm-utilities] diff --git a/compiler/Cargo.toml b/compiler/Cargo.toml index 9c5b698d7f..abf943007a 100644 --- a/compiler/Cargo.toml +++ b/compiler/Cargo.toml @@ -69,12 +69,12 @@ version = "0.7.6" default-features = false [dependencies.snarkvm-gadgets] -version = "0.7.5" +version = "0.7.6" default-features = false features = [ "curves" ] [dependencies.snarkvm-r1cs] -version = "0.7.5" +version = "0.7.6" default-features = false [dependencies.snarkvm-utilities] @@ -119,7 +119,7 @@ version = "0.3" default-features = false [dev-dependencies.snarkvm-algorithms] -version = "0.7.4" +version = "0.7.6" default-features = false [dev-dependencies.tempfile] diff --git a/state/Cargo.toml b/state/Cargo.toml index 4f50ef0efa..a641a33f5e 100644 --- a/state/Cargo.toml +++ b/state/Cargo.toml @@ -26,7 +26,7 @@ path = "../ast" version = "1.5.3" [dependencies.snarkvm-algorithms] -version = "0.7.4" +version = "0.7.6" [dependencies.snarkvm-curves] version = "0.7.6" diff --git a/synthesizer/Cargo.toml b/synthesizer/Cargo.toml index c8c37e2ca4..aa7f2a3543 100644 --- a/synthesizer/Cargo.toml +++ b/synthesizer/Cargo.toml @@ -26,10 +26,10 @@ version = "0.7.6" default-features = false [dependencies.snarkvm-gadgets] -version = "0.7.5" +version = "0.7.6" [dependencies.snarkvm-r1cs] -version = "0.7.5" +version = "0.7.6" default-features = false [dependencies.num-bigint] From 14f0163d2c2c47be33edd0edaa7ad46bfe052794 Mon Sep 17 00:00:00 2001 From: Alessandro Coglio Date: Mon, 2 Aug 2021 17:56:47 -0700 Subject: [PATCH 14/19] [ABNF] Move a rule and update some comments. Move the rule for 'digit' just before the ones for 'octal-digit' and 'hexadecimal-digit'. Update the comments accordingly. No real change to the grammar here. --- grammar/abnf-grammar.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/grammar/abnf-grammar.txt b/grammar/abnf-grammar.txt index ee4dc083fa..364dc923f2 100644 --- a/grammar/abnf-grammar.txt +++ b/grammar/abnf-grammar.txt @@ -421,10 +421,7 @@ keyword = %s"address" / %s"u64" / %s"u128" -; The following rules define (ASCII) -; digits and (uppercase and lowercase) letters. - -digit = %x30-39 ; 0-9 +; The following rules define (ASCII) letters. uppercase-letter = %x41-5A ; A-Z @@ -432,9 +429,11 @@ lowercase-letter = %x61-7A ; a-z letter = uppercase-letter / lowercase-letter -; The following rules defines (ASCII) octal and hexadecimal digits. +; The following rules defines (ASCII) decimal, octal, and hexadecimal digits. ; Note that the latter are case-insensitive. +digit = %x30-39 ; 0-9 + octal-digit = %x30-37 ; 0-7 hexadecimal-digit = digit / "a" / "b" / "c" / "d" / "e" / "f" From 33831779c7dac7a8470500d901fa6d4695d07cfa Mon Sep 17 00:00:00 2001 From: Alessandro Coglio Date: Mon, 2 Aug 2021 17:59:13 -0700 Subject: [PATCH 15/19] [ABNF] Rename digit => decimal-digit. Since, with the introduction of (ASCII and Unicode escapes for) characters, we now have digits in base 10, 8, and 16, it seems worth being more explicit in the naming of decimal digits in the grammar. Just a nonterminal name change, not a structural change to the grammar. --- grammar/abnf-grammar.txt | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/grammar/abnf-grammar.txt b/grammar/abnf-grammar.txt index 364dc923f2..e25a8aef02 100644 --- a/grammar/abnf-grammar.txt +++ b/grammar/abnf-grammar.txt @@ -432,29 +432,31 @@ letter = uppercase-letter / lowercase-letter ; The following rules defines (ASCII) decimal, octal, and hexadecimal digits. ; Note that the latter are case-insensitive. -digit = %x30-39 ; 0-9 +decimal-digit = %x30-39 ; 0-9 octal-digit = %x30-37 ; 0-7 -hexadecimal-digit = digit / "a" / "b" / "c" / "d" / "e" / "f" +hexadecimal-digit = decimal-digit / "a" / "b" / "c" / "d" / "e" / "f" -; An identifier is a non-empty sequence of letters, digits, and underscores, +; An identifier is a non-empty sequence of +; letters, (decimal) digits, and underscores, ; starting with a letter. ; It must not be a keyword: this is an extra-grammatical requirement. ; It must also not be or start with `aleo1`, ; because that is used for address literals: ; this is another extra-grammatical requirement. -identifier = letter *( letter / digit / "_" ) +identifier = letter *( letter / decimal-digit / "_" ) ; but not a keyword or a boolean literal or aleo1... ; A package name consists of one or more segments separated by single dashes, -; where each segment is a non-empty sequence of lowercase letters and digits. +; where each segment is a non-empty sequence of +; lowercase letters and (decimal) digits. ; Similarly to an identifier, a package name must not be a keyword ; and must not be or start with `aleo1`. -package-name = lowercase-letter *( lowercase-letter / digit ) - *( "-" 1*( lowercase-letter / digit ) ) +package-name = lowercase-letter *( lowercase-letter / decimal-digit ) + *( "-" 1*( lowercase-letter / decimal-digit ) ) ; but not a keyword or a boolean literal or aleo1... ; Note that, grammatically, identifiers are also package names. @@ -464,10 +466,10 @@ package-name = lowercase-letter *( lowercase-letter / digit ) annotation-name = "@" identifier -; A natural (number) is a sequence of one or more digits. +; A natural (number) is a sequence of one or more decimal digits. ; We allow leading zeros, e.g. `007`. -natural = 1*digit +natural = 1*decimal-digit ; An integer (number) is either a natural or its negation. ; We allow leading zeros also in negative numbers, e.g. `-007`. @@ -503,10 +505,10 @@ product-group-literal = integer %s"group" boolean-literal = %s"true" / %s"false" ; An address literal starts with `aleo1` -; and continues with exactly 58 lowercase letters and digits. +; and continues with exactly 58 lowercase letters and (decimal) digits. ; Thus an address always consists of 63 characters. -address-literal = %s"aleo1" 58( lowercase-letter / digit ) +address-literal = %s"aleo1" 58( lowercase-letter / decimal-digit ) ; A character literal consists of an element surrounded by single quotes. ; The element is any character other than single quote or backslash, From a2919e9dd7cb52745bf5fdc9cdad37e4722bb7d7 Mon Sep 17 00:00:00 2001 From: Alessandro Coglio Date: Mon, 2 Aug 2021 18:01:22 -0700 Subject: [PATCH 16/19] [ABNF] Re-generate the markdown. --- grammar/README.md | 109 +++++++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 54 deletions(-) diff --git a/grammar/README.md b/grammar/README.md index 364002f1eb..13bbc6de82 100644 --- a/grammar/README.md +++ b/grammar/README.md @@ -476,7 +476,7 @@ Line terminators form whitespace, along with spaces and horizontal tabs. whitespace = space / horizontal-tab / newline ``` -Go to: _[space](#user-content-space), [newline](#user-content-newline), [horizontal-tab](#user-content-horizontal-tab)_; +Go to: _[horizontal-tab](#user-content-horizontal-tab), [newline](#user-content-newline), [space](#user-content-space)_; There are two kinds of comments in Leo, as in other languages. @@ -511,7 +511,7 @@ rest-of-block-comment = "*" rest-of-block-comment-after-star / not-star rest-of-block-comment ``` -Go to: _[not-star](#user-content-not-star), [rest-of-block-comment](#user-content-rest-of-block-comment), [rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star)_; +Go to: _[rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star), [not-star](#user-content-not-star), [rest-of-block-comment](#user-content-rest-of-block-comment)_; @@ -521,7 +521,7 @@ rest-of-block-comment-after-star = "/" / not-star-or-slash rest-of-block-comment ``` -Go to: _[rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star), [not-star-or-slash](#user-content-not-star-or-slash), [rest-of-block-comment](#user-content-rest-of-block-comment)_; +Go to: _[not-star-or-slash](#user-content-not-star-or-slash), [rest-of-block-comment](#user-content-rest-of-block-comment), [rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star)_; @@ -572,13 +572,7 @@ keyword = %s"address" / %s"u128" ``` -The following rules define (ASCII) -digits and (uppercase and lowercase) letters. - - -```abnf -digit = %x30-39 ; 0-9 -``` +The following rules define (ASCII) letters. ```abnf @@ -595,12 +589,17 @@ lowercase-letter = %x61-7A ; a-z letter = uppercase-letter / lowercase-letter ``` -Go to: _[lowercase-letter](#user-content-lowercase-letter), [uppercase-letter](#user-content-uppercase-letter)_; +Go to: _[uppercase-letter](#user-content-uppercase-letter), [lowercase-letter](#user-content-lowercase-letter)_; -The following rules defines (ASCII) octal and hexadecimal digits. +The following rules defines (ASCII) decimal, octal, and hexadecimal digits. Note that the latter are case-insensitive. + +```abnf +decimal-digit = %x30-39 ; 0-9 +``` + ```abnf octal-digit = %x30-37 ; 0-7 @@ -608,13 +607,14 @@ octal-digit = %x30-37 ; 0-7 ```abnf -hexadecimal-digit = digit / "a" / "b" / "c" / "d" / "e" / "f" +hexadecimal-digit = decimal-digit / "a" / "b" / "c" / "d" / "e" / "f" ``` -Go to: _[digit](#user-content-digit)_; +Go to: _[decimal-digit](#user-content-decimal-digit)_; -An identifier is a non-empty sequence of letters, digits, and underscores, +An identifier is a non-empty sequence of +letters, (decimal) digits, and underscores, starting with a letter. It must not be a keyword: this is an extra-grammatical requirement. It must also not be or start with `aleo1`, @@ -623,7 +623,7 @@ this is another extra-grammatical requirement. ```abnf -identifier = letter *( letter / digit / "_" ) +identifier = letter *( letter / decimal-digit / "_" ) ; but not a keyword or a boolean literal or aleo1... ``` @@ -631,14 +631,15 @@ Go to: _[letter](#user-content-letter)_; A package name consists of one or more segments separated by single dashes, -where each segment is a non-empty sequence of lowercase letters and digits. +where each segment is a non-empty sequence of +lowercase letters and (decimal) digits. Similarly to an identifier, a package name must not be a keyword and must not be or start with `aleo1`. ```abnf -package-name = lowercase-letter *( lowercase-letter / digit ) - *( "-" 1*( lowercase-letter / digit ) ) +package-name = lowercase-letter *( lowercase-letter / decimal-digit ) + *( "-" 1*( lowercase-letter / decimal-digit ) ) ; but not a keyword or a boolean literal or aleo1... ``` @@ -658,12 +659,12 @@ annotation-name = "@" identifier Go to: _[identifier](#user-content-identifier)_; -A natural (number) is a sequence of one or more digits. +A natural (number) is a sequence of one or more decimal digits. We allow leading zeros, e.g. `007`. ```abnf -natural = 1*digit +natural = 1*decimal-digit ``` An integer (number) is either a natural or its negation. @@ -739,12 +740,12 @@ boolean-literal = %s"true" / %s"false" ``` An address literal starts with `aleo1` -and continues with exactly 58 lowercase letters and digits. +and continues with exactly 58 lowercase letters and (decimal) digits. Thus an address always consists of 63 characters. ```abnf -address-literal = %s"aleo1" 58( lowercase-letter / digit ) +address-literal = %s"aleo1" 58( lowercase-letter / decimal-digit ) ``` A character literal consists of an element surrounded by single quotes. @@ -772,7 +773,7 @@ character-literal-element = not-single-quote-or-backslash / unicode-character-escape ``` -Go to: _[unicode-character-escape](#user-content-unicode-character-escape), [simple-character-escape](#user-content-simple-character-escape), [not-single-quote-or-backslash](#user-content-not-single-quote-or-backslash), [ascii-character-escape](#user-content-ascii-character-escape)_; +Go to: _[not-single-quote-or-backslash](#user-content-not-single-quote-or-backslash), [ascii-character-escape](#user-content-ascii-character-escape), [unicode-character-escape](#user-content-unicode-character-escape), [simple-character-escape](#user-content-simple-character-escape)_; @@ -827,7 +828,7 @@ simple-character-escape = single-quote-escape / null-character-escape ``` -Go to: _[horizontal-tab-escape](#user-content-horizontal-tab-escape), [backslash-escape](#user-content-backslash-escape), [null-character-escape](#user-content-null-character-escape), [line-feed-escape](#user-content-line-feed-escape), [single-quote-escape](#user-content-single-quote-escape), [double-quote-escape](#user-content-double-quote-escape), [carriage-return-escape](#user-content-carriage-return-escape)_; +Go to: _[carriage-return-escape](#user-content-carriage-return-escape), [horizontal-tab-escape](#user-content-horizontal-tab-escape), [null-character-escape](#user-content-null-character-escape), [double-quote-escape](#user-content-double-quote-escape), [single-quote-escape](#user-content-single-quote-escape), [backslash-escape](#user-content-backslash-escape), [line-feed-escape](#user-content-line-feed-escape)_; @@ -863,7 +864,7 @@ string-literal-element = not-double-quote-or-backslash / unicode-character-escape ``` -Go to: _[not-double-quote-or-backslash](#user-content-not-double-quote-or-backslash), [simple-character-escape](#user-content-simple-character-escape), [ascii-character-escape](#user-content-ascii-character-escape), [unicode-character-escape](#user-content-unicode-character-escape)_; +Go to: _[ascii-character-escape](#user-content-ascii-character-escape), [unicode-character-escape](#user-content-unicode-character-escape), [simple-character-escape](#user-content-simple-character-escape), [not-double-quote-or-backslash](#user-content-not-double-quote-or-backslash)_; The ones above are all the atomic literals @@ -883,7 +884,7 @@ atomic-literal = untyped-literal / string-literal ``` -Go to: _[signed-literal](#user-content-signed-literal), [unsigned-literal](#user-content-unsigned-literal), [field-literal](#user-content-field-literal), [product-group-literal](#user-content-product-group-literal), [boolean-literal](#user-content-boolean-literal), [address-literal](#user-content-address-literal), [string-literal](#user-content-string-literal), [untyped-literal](#user-content-untyped-literal), [character-literal](#user-content-character-literal)_; +Go to: _[signed-literal](#user-content-signed-literal), [untyped-literal](#user-content-untyped-literal), [product-group-literal](#user-content-product-group-literal), [unsigned-literal](#user-content-unsigned-literal), [character-literal](#user-content-character-literal), [string-literal](#user-content-string-literal), [field-literal](#user-content-field-literal), [boolean-literal](#user-content-boolean-literal), [address-literal](#user-content-address-literal)_; After defining the (mostly) alphanumeric tokens above, @@ -927,7 +928,7 @@ token = keyword / symbol ``` -Go to: _[atomic-literal](#user-content-atomic-literal), [package-name](#user-content-package-name), [annotation-name](#user-content-annotation-name), [symbol](#user-content-symbol), [identifier](#user-content-identifier), [keyword](#user-content-keyword)_; +Go to: _[identifier](#user-content-identifier), [keyword](#user-content-keyword), [symbol](#user-content-symbol), [package-name](#user-content-package-name), [annotation-name](#user-content-annotation-name), [atomic-literal](#user-content-atomic-literal)_; Tokens, comments, and whitespace are lexemes, i.e. lexical units. @@ -937,7 +938,7 @@ Tokens, comments, and whitespace are lexemes, i.e. lexical units. lexeme = token / comment / whitespace ``` -Go to: _[whitespace](#user-content-whitespace), [comment](#user-content-comment), [token](#user-content-token)_; +Go to: _[whitespace](#user-content-whitespace), [token](#user-content-token), [comment](#user-content-comment)_; @@ -973,7 +974,7 @@ signed-type = %s"i8" / %s"i16" / %s"i32" / %s"i64" / %s"i128" integer-type = unsigned-type / signed-type ``` -Go to: _[unsigned-type](#user-content-unsigned-type), [signed-type](#user-content-signed-type)_; +Go to: _[signed-type](#user-content-signed-type), [unsigned-type](#user-content-unsigned-type)_; The integer types, along with the field and group types, @@ -1020,7 +1021,7 @@ character-type = %s"char" scalar-type = boolean-type / arithmetic-type / address-type / character-type ``` -Go to: _[address-type](#user-content-address-type), [boolean-type](#user-content-boolean-type), [character-type](#user-content-character-type), [arithmetic-type](#user-content-arithmetic-type)_; +Go to: _[character-type](#user-content-character-type), [arithmetic-type](#user-content-arithmetic-type), [boolean-type](#user-content-boolean-type), [address-type](#user-content-address-type)_; Circuit types are denoted by identifiers and the keyword `Self`. @@ -1060,7 +1061,7 @@ or a tuple of one or more dimensions. array-type = "[" type ";" array-dimensions "]" ``` -Go to: _[type](#user-content-type), [array-dimensions](#user-content-array-dimensions)_; +Go to: _[array-dimensions](#user-content-array-dimensions), [type](#user-content-type)_; @@ -1127,7 +1128,7 @@ A literal is either an atomic one or an affine group literal. literal = atomic-literal / affine-group-literal ``` -Go to: _[atomic-literal](#user-content-atomic-literal), [affine-group-literal](#user-content-affine-group-literal)_; +Go to: _[affine-group-literal](#user-content-affine-group-literal), [atomic-literal](#user-content-atomic-literal)_; The following rule is not directly referenced in the rules for expressions @@ -1140,7 +1141,7 @@ a group literal is either a product group literal or an affine group literal. group-literal = product-group-literal / affine-group-literal ``` -Go to: _[affine-group-literal](#user-content-affine-group-literal), [product-group-literal](#user-content-product-group-literal)_; +Go to: _[product-group-literal](#user-content-product-group-literal), [affine-group-literal](#user-content-affine-group-literal)_; As often done in grammatical language syntax specifications, @@ -1169,7 +1170,7 @@ primary-expression = identifier / circuit-expression ``` -Go to: _[expression](#user-content-expression), [array-expression](#user-content-array-expression), [literal](#user-content-literal), [identifier](#user-content-identifier), [circuit-expression](#user-content-circuit-expression), [tuple-expression](#user-content-tuple-expression)_; +Go to: _[array-expression](#user-content-array-expression), [expression](#user-content-expression), [circuit-expression](#user-content-circuit-expression), [identifier](#user-content-identifier), [tuple-expression](#user-content-tuple-expression), [literal](#user-content-literal)_; Tuple expressions construct tuples. @@ -1230,7 +1231,7 @@ Go to: _[expression](#user-content-expression), [array-dimensions](#user-content array-construction = array-inline-construction / array-repeat-construction ``` -Go to: _[array-inline-construction](#user-content-array-inline-construction), [array-repeat-construction](#user-content-array-repeat-construction)_; +Go to: _[array-repeat-construction](#user-content-array-repeat-construction), [array-inline-construction](#user-content-array-inline-construction)_; @@ -1317,7 +1318,7 @@ postfix-expression = primary-expression / postfix-expression "[" [expression] ".." [expression] "]" ``` -Go to: _[natural](#user-content-natural), [identifier](#user-content-identifier), [circuit-type](#user-content-circuit-type), [primary-expression](#user-content-primary-expression), [function-arguments](#user-content-function-arguments), [postfix-expression](#user-content-postfix-expression), [expression](#user-content-expression)_; +Go to: _[identifier](#user-content-identifier), [circuit-type](#user-content-circuit-type), [function-arguments](#user-content-function-arguments), [natural](#user-content-natural), [primary-expression](#user-content-primary-expression), [expression](#user-content-expression), [postfix-expression](#user-content-postfix-expression)_; Unary operators have the highest operator precedence. @@ -1331,7 +1332,7 @@ unary-expression = postfix-expression / "-" unary-expression ``` -Go to: _[postfix-expression](#user-content-postfix-expression), [unary-expression](#user-content-unary-expression)_; +Go to: _[unary-expression](#user-content-unary-expression), [postfix-expression](#user-content-postfix-expression)_; Next in the operator precedence is exponentiation, @@ -1357,7 +1358,7 @@ multiplicative-expression = exponential-expression / multiplicative-expression "/" exponential-expression ``` -Go to: _[exponential-expression](#user-content-exponential-expression), [multiplicative-expression](#user-content-multiplicative-expression)_; +Go to: _[multiplicative-expression](#user-content-multiplicative-expression), [exponential-expression](#user-content-exponential-expression)_; Then there are addition and subtraction, both left-assocative. @@ -1408,7 +1409,7 @@ conjunctive-expression = equality-expression / conjunctive-expression "&&" equality-expression ``` -Go to: _[equality-expression](#user-content-equality-expression), [conjunctive-expression](#user-content-conjunctive-expression)_; +Go to: _[conjunctive-expression](#user-content-conjunctive-expression), [equality-expression](#user-content-equality-expression)_; Next come disjunctive expressions, left-associative. @@ -1419,7 +1420,7 @@ disjunctive-expression = conjunctive-expression / disjunctive-expression "||" conjunctive-expression ``` -Go to: _[conjunctive-expression](#user-content-conjunctive-expression), [disjunctive-expression](#user-content-disjunctive-expression)_; +Go to: _[disjunctive-expression](#user-content-disjunctive-expression), [conjunctive-expression](#user-content-conjunctive-expression)_; Finally we have conditional expressions. @@ -1432,7 +1433,7 @@ conditional-expression = disjunctive-expression ":" conditional-expression ``` -Go to: _[expression](#user-content-expression), [disjunctive-expression](#user-content-disjunctive-expression), [conditional-expression](#user-content-conditional-expression)_; +Go to: _[disjunctive-expression](#user-content-disjunctive-expression), [expression](#user-content-expression), [conditional-expression](#user-content-conditional-expression)_; Those above are all the expressions. @@ -1465,7 +1466,7 @@ statement = expression-statement / block ``` -Go to: _[constant-declaration](#user-content-constant-declaration), [block](#user-content-block), [variable-declaration](#user-content-variable-declaration), [conditional-statement](#user-content-conditional-statement), [return-statement](#user-content-return-statement), [assignment-statement](#user-content-assignment-statement), [expression-statement](#user-content-expression-statement), [loop-statement](#user-content-loop-statement), [console-statement](#user-content-console-statement)_; +Go to: _[loop-statement](#user-content-loop-statement), [assignment-statement](#user-content-assignment-statement), [variable-declaration](#user-content-variable-declaration), [expression-statement](#user-content-expression-statement), [conditional-statement](#user-content-conditional-statement), [block](#user-content-block), [console-statement](#user-content-console-statement), [return-statement](#user-content-return-statement), [constant-declaration](#user-content-constant-declaration)_; @@ -1508,7 +1509,7 @@ variable-declaration = %s"let" identifier-or-identifiers [ ":" type ] "=" expression ";" ``` -Go to: _[type](#user-content-type), [expression](#user-content-expression), [identifier-or-identifiers](#user-content-identifier-or-identifiers)_; +Go to: _[type](#user-content-type), [identifier-or-identifiers](#user-content-identifier-or-identifiers), [expression](#user-content-expression)_; @@ -1517,7 +1518,7 @@ constant-declaration = %s"const" identifier-or-identifiers [ ":" type ] "=" expression ";" ``` -Go to: _[identifier-or-identifiers](#user-content-identifier-or-identifiers), [type](#user-content-type), [expression](#user-content-expression)_; +Go to: _[type](#user-content-type), [expression](#user-content-expression), [identifier-or-identifiers](#user-content-identifier-or-identifiers)_; @@ -1540,7 +1541,7 @@ Note that blocks are required in all branches, not merely statements. branch = %s"if" expression block ``` -Go to: _[block](#user-content-block), [expression](#user-content-expression)_; +Go to: _[expression](#user-content-expression), [block](#user-content-block)_; @@ -1550,7 +1551,7 @@ conditional-statement = branch / branch %s"else" conditional-statement ``` -Go to: _[branch](#user-content-branch), [conditional-statement](#user-content-conditional-statement), [block](#user-content-block)_; +Go to: _[branch](#user-content-branch), [block](#user-content-block), [conditional-statement](#user-content-conditional-statement)_; A loop statement implicitly defines a loop variable @@ -1606,7 +1607,7 @@ console-call = assert-call / print-call ``` -Go to: _[assert-call](#user-content-assert-call), [print-call](#user-content-print-call)_; +Go to: _[print-call](#user-content-print-call), [assert-call](#user-content-assert-call)_; @@ -1665,7 +1666,7 @@ function-declaration = *annotation %s"function" identifier block ``` -Go to: _[block](#user-content-block), [identifier](#user-content-identifier), [function-parameters](#user-content-function-parameters), [type](#user-content-type)_; +Go to: _[identifier](#user-content-identifier), [function-parameters](#user-content-function-parameters), [type](#user-content-type), [block](#user-content-block)_; @@ -1675,7 +1676,7 @@ function-parameters = self-parameter / function-inputs ``` -Go to: _[function-inputs](#user-content-function-inputs), [self-parameter](#user-content-self-parameter)_; +Go to: _[self-parameter](#user-content-self-parameter), [function-inputs](#user-content-function-inputs)_; @@ -1744,7 +1745,7 @@ circuit-declaration = %s"circuit" identifier *member-function-declaration "}" ``` -Go to: _[identifier](#user-content-identifier), [member-variable-declarations](#user-content-member-variable-declarations)_; +Go to: _[member-variable-declarations](#user-content-member-variable-declarations), [identifier](#user-content-identifier)_; An import declaration consists of the `import` keyword @@ -1766,7 +1767,7 @@ by using an explicit package name before the package path. import-declaration = %s"import" package-name "." package-path ";" ``` -Go to: _[package-path](#user-content-package-path), [package-name](#user-content-package-name)_; +Go to: _[package-name](#user-content-package-name), [package-path](#user-content-package-path)_; @@ -1777,7 +1778,7 @@ package-path = "*" / "(" package-path *( "," package-path ) [","] ")" ``` -Go to: _[package-name](#user-content-package-name), [identifier](#user-content-identifier), [package-path](#user-content-package-path)_; +Go to: _[identifier](#user-content-identifier), [package-path](#user-content-package-path), [package-name](#user-content-package-name)_; Finally, we define a file as a sequence of zero or more declarations. @@ -1792,7 +1793,7 @@ declaration = import-declaration / constant-declaration ``` -Go to: _[function-declaration](#user-content-function-declaration), [circuit-declaration](#user-content-circuit-declaration), [constant-declaration](#user-content-constant-declaration), [import-declaration](#user-content-import-declaration)_; +Go to: _[function-declaration](#user-content-function-declaration), [constant-declaration](#user-content-constant-declaration), [import-declaration](#user-content-import-declaration), [circuit-declaration](#user-content-circuit-declaration)_; From 4373ce980daa5bb6100288eaebc8828969247ef1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Aug 2021 18:04:19 +0000 Subject: [PATCH 17/19] Bump snarkvm-fields from 0.7.6 to 0.7.7 Bumps [snarkvm-fields](https://github.com/AleoHQ/snarkVM) from 0.7.6 to 0.7.7. - [Release notes](https://github.com/AleoHQ/snarkVM/releases) - [Commits](https://github.com/AleoHQ/snarkVM/commits) --- updated-dependencies: - dependency-name: snarkvm-fields dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 12 ++++++------ compiler/Cargo.toml | 2 +- synthesizer/Cargo.toml | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 454b64ae97..e65ff0b9ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2472,9 +2472,9 @@ dependencies = [ [[package]] name = "snarkvm-derives" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cbe69096a11cdc3f0b069e0313d47fbcabf45532d58435ef0a03d35d2805dc5" +checksum = "ec9f9134f9b06f279312d39a41c23fcc9ab29e987e74fc1e97a0945d1d169ff0" dependencies = [ "proc-macro-crate", "proc-macro-error", @@ -2517,9 +2517,9 @@ dependencies = [ [[package]] name = "snarkvm-fields" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "502d750651111b5d399a3b29b770fe821fdac87614335b4814ab5a0d014634bc" +checksum = "8a0717dbbf3e92e12084c913e53b21534270d2d00584a4344453af1c66952bee" dependencies = [ "anyhow", "bincode", @@ -2630,9 +2630,9 @@ dependencies = [ [[package]] name = "snarkvm-utilities" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb1462993e1d189c75f88f2482f18ae4bcccb5ea5a7a93a25de92907305af8f" +checksum = "1cc0611d450dfd4e9ad305dd343c0420430f83c73cdb79f6e6e184848dc3e2ee" dependencies = [ "anyhow", "bincode", diff --git a/compiler/Cargo.toml b/compiler/Cargo.toml index abf943007a..7804e2667d 100644 --- a/compiler/Cargo.toml +++ b/compiler/Cargo.toml @@ -61,7 +61,7 @@ version = "0.7.6" default-features = false [dependencies.snarkvm-fields] -version = "0.7.6" +version = "0.7.7" default-features = false [dependencies.snarkvm-dpc] diff --git a/synthesizer/Cargo.toml b/synthesizer/Cargo.toml index aa7f2a3543..10ca186305 100644 --- a/synthesizer/Cargo.toml +++ b/synthesizer/Cargo.toml @@ -22,7 +22,7 @@ version = "0.7.6" default-features = false [dependencies.snarkvm-fields] -version = "0.7.6" +version = "0.7.7" default-features = false [dependencies.snarkvm-gadgets] From 7f0c0f0b7aa28f39ec681a86377e37ea6784c6e7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Aug 2021 18:04:29 +0000 Subject: [PATCH 18/19] Bump snarkvm-curves from 0.7.6 to 0.7.7 Bumps [snarkvm-curves](https://github.com/AleoHQ/snarkVM) from 0.7.6 to 0.7.7. - [Release notes](https://github.com/AleoHQ/snarkVM/releases) - [Commits](https://github.com/AleoHQ/snarkVM/commits) --- updated-dependencies: - dependency-name: snarkvm-curves dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 16 ++++++++-------- Cargo.toml | 2 +- compiler/Cargo.toml | 2 +- state/Cargo.toml | 2 +- synthesizer/Cargo.toml | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 454b64ae97..86e88679aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2456,9 +2456,9 @@ dependencies = [ [[package]] name = "snarkvm-curves" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a67bf9f77ce8db3e88fd58241ec7d0a0ad80097c42d0bd4e53b123106605249" +checksum = "7cb586a9383563b62120e788f8d9200cfcd5a5b610c2723403a72e6b4cc7ee71" dependencies = [ "derivative", "rand 0.8.4", @@ -2472,9 +2472,9 @@ dependencies = [ [[package]] name = "snarkvm-derives" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cbe69096a11cdc3f0b069e0313d47fbcabf45532d58435ef0a03d35d2805dc5" +checksum = "ec9f9134f9b06f279312d39a41c23fcc9ab29e987e74fc1e97a0945d1d169ff0" dependencies = [ "proc-macro-crate", "proc-macro-error", @@ -2517,9 +2517,9 @@ dependencies = [ [[package]] name = "snarkvm-fields" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "502d750651111b5d399a3b29b770fe821fdac87614335b4814ab5a0d014634bc" +checksum = "8a0717dbbf3e92e12084c913e53b21534270d2d00584a4344453af1c66952bee" dependencies = [ "anyhow", "bincode", @@ -2630,9 +2630,9 @@ dependencies = [ [[package]] name = "snarkvm-utilities" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb1462993e1d189c75f88f2482f18ae4bcccb5ea5a7a93a25de92907305af8f" +checksum = "1cc0611d450dfd4e9ad305dd343c0420430f83c73cdb79f6e6e184848dc3e2ee" dependencies = [ "anyhow", "bincode", diff --git a/Cargo.toml b/Cargo.toml index 23d481f279..338faab93d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -77,7 +77,7 @@ version = "1.5.3" version = "0.7.6" [dependencies.snarkvm-curves] -version = "0.7.6" +version = "0.7.7" default-features = false [dependencies.snarkvm-gadgets] diff --git a/compiler/Cargo.toml b/compiler/Cargo.toml index abf943007a..0edf3f3522 100644 --- a/compiler/Cargo.toml +++ b/compiler/Cargo.toml @@ -57,7 +57,7 @@ version = "1.5.3" version = "0.4" [dependencies.snarkvm-curves] -version = "0.7.6" +version = "0.7.7" default-features = false [dependencies.snarkvm-fields] diff --git a/state/Cargo.toml b/state/Cargo.toml index a641a33f5e..a5dca6e6b9 100644 --- a/state/Cargo.toml +++ b/state/Cargo.toml @@ -29,7 +29,7 @@ version = "1.5.3" version = "0.7.6" [dependencies.snarkvm-curves] -version = "0.7.6" +version = "0.7.7" default-features = false [dependencies.snarkvm-dpc] diff --git a/synthesizer/Cargo.toml b/synthesizer/Cargo.toml index aa7f2a3543..b21a68a5b2 100644 --- a/synthesizer/Cargo.toml +++ b/synthesizer/Cargo.toml @@ -18,7 +18,7 @@ license = "GPL-3.0" edition = "2018" [dependencies.snarkvm-curves] -version = "0.7.6" +version = "0.7.7" default-features = false [dependencies.snarkvm-fields] From ab1880e6f39e9175a1af391509cb8ab0c8a6960b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Aug 2021 18:04:43 +0000 Subject: [PATCH 19/19] Bump serde from 1.0.126 to 1.0.127 Bumps [serde](https://github.com/serde-rs/serde) from 1.0.126 to 1.0.127. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.126...v1.0.127) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 454b64ae97..a8793d4a9a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2308,9 +2308,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.126" +version = "1.0.127" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03" +checksum = "f03b9878abf6d14e6779d3f24f07b2cfa90352cfec4acc5aab8f1ac7f146fae8" dependencies = [ "serde_derive", ] @@ -2327,9 +2327,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.126" +version = "1.0.127" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43" +checksum = "a024926d3432516606328597e0f224a51355a493b49fdd67e9209187cbe55ecc" dependencies = [ "proc-macro2 1.0.27", "quote 1.0.9",