mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-25 02:22:44 +03:00
Merge pull request #1150 from AleoHQ/feature/remove-nightly-support
[Feature] Deprecate Nightly + OS CIs
This commit is contained in:
commit
8e8e3fdf42
@ -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,25 +40,81 @@ commands:
|
||||
paths:
|
||||
- .cache/sccache
|
||||
- .cargo
|
||||
jobs:
|
||||
# orbs:
|
||||
# codecov: codecov/codecov@1.2.3
|
||||
|
||||
rust-stable:
|
||||
jobs:
|
||||
check-style:
|
||||
docker:
|
||||
- image: cimg/rust:1.53
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- checkout
|
||||
- setup_environment:
|
||||
cache_key: leo-stable-cache
|
||||
cache_key: leo-fmt-cache
|
||||
- run:
|
||||
name: Build and run tests
|
||||
no_output_timeout: 30m
|
||||
command: cargo test --all
|
||||
- persist_to_workspace:
|
||||
root: ~/
|
||||
paths: project/
|
||||
name: Check style
|
||||
no_output_timeout: 35m
|
||||
command: cargo fmt --all -- --check
|
||||
- clear_environment:
|
||||
cache_key: leo-stable-cache
|
||||
cache_key: leo-fmt-cache
|
||||
|
||||
clippy:
|
||||
docker:
|
||||
- image: cimg/rust:1.53
|
||||
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
|
||||
|
||||
# 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:
|
||||
@ -199,7 +255,8 @@ workflows:
|
||||
version: 2
|
||||
main-workflow:
|
||||
jobs:
|
||||
- rust-stable
|
||||
- check-style
|
||||
- clippy
|
||||
- leo-executable
|
||||
- leo-new:
|
||||
requires:
|
||||
|
316
.github/workflows/ci.yml
vendored
316
.github/workflows/ci.yml
vendored
@ -1,117 +1,239 @@
|
||||
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
|
||||
|
||||
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:
|
||||
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:
|
||||
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 sccache Ubuntu
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
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 sccache Macos
|
||||
if: matrix.os == 'macos-latest'
|
||||
run: |
|
||||
brew update
|
||||
brew install sccache
|
||||
|
||||
- name: Install sccache Windows
|
||||
if: matrix.os == 'windows-latest'
|
||||
run: |
|
||||
iwr -useb get.scoop.sh | iex
|
||||
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
|
||||
scoop install sccache
|
||||
echo "C:\Users\runneradmin\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||
|
||||
- name: Install Rust Stable
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- name: Cache cargo registry
|
||||
uses: actions/cache@v2
|
||||
continue-on-error: false
|
||||
with:
|
||||
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:
|
||||
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
|
||||
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
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install sccache
|
||||
run: |
|
||||
brew update
|
||||
brew install sccache
|
||||
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
target: aarch64-apple-darwin
|
||||
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: |
|
||||
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
|
||||
|
||||
- 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:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
components: clippy
|
||||
|
||||
- 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:
|
||||
name: Test Package
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
rust:
|
||||
- stable
|
||||
- nightly
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Rust (${{ matrix.rust }})
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: ${{ matrix.rust }}
|
||||
override: true
|
||||
|
||||
- name: Install cargo-all-features
|
||||
run: |
|
||||
cargo install cargo-all-features
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
cd package
|
||||
cargo test-all-features
|
||||
|
||||
codecov:
|
||||
name: Code Coverage
|
||||
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: 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:
|
||||
@ -142,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
|
||||
|
@ -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"
|
||||
|
@ -15,14 +15,7 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{
|
||||
statement::*,
|
||||
BoolAnd,
|
||||
Expression,
|
||||
Monoid,
|
||||
MonoidalReducerExpression,
|
||||
MonoidalReducerStatement,
|
||||
Node,
|
||||
Span,
|
||||
statement::*, BoolAnd, Expression, Monoid, MonoidalReducerExpression, MonoidalReducerStatement, Node, Span,
|
||||
};
|
||||
|
||||
pub struct ReturnPathReducer {
|
||||
|
@ -15,19 +15,8 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{
|
||||
AsgConvertError,
|
||||
CircuitMember,
|
||||
ConstValue,
|
||||
Expression,
|
||||
ExpressionNode,
|
||||
FromAst,
|
||||
Function,
|
||||
FunctionQualifier,
|
||||
Node,
|
||||
PartialType,
|
||||
Scope,
|
||||
Span,
|
||||
Type,
|
||||
AsgConvertError, CircuitMember, ConstValue, Expression, ExpressionNode, FromAst, Function, FunctionQualifier, Node,
|
||||
PartialType, Scope, Span, Type,
|
||||
};
|
||||
pub use leo_ast::{BinaryOperation, Node as AstNode};
|
||||
|
||||
|
@ -15,19 +15,8 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{
|
||||
AsgConvertError,
|
||||
Circuit,
|
||||
CircuitMember,
|
||||
ConstValue,
|
||||
Expression,
|
||||
ExpressionNode,
|
||||
FromAst,
|
||||
Identifier,
|
||||
Node,
|
||||
PartialType,
|
||||
Scope,
|
||||
Span,
|
||||
Type,
|
||||
AsgConvertError, Circuit, CircuitMember, ConstValue, Expression, ExpressionNode, FromAst, Identifier, Node,
|
||||
PartialType, Scope, Span, Type,
|
||||
};
|
||||
|
||||
use std::cell::Cell;
|
||||
|
@ -15,19 +15,8 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{
|
||||
AsgConvertError,
|
||||
Circuit,
|
||||
CircuitMember,
|
||||
ConstValue,
|
||||
Expression,
|
||||
ExpressionNode,
|
||||
FromAst,
|
||||
Identifier,
|
||||
Node,
|
||||
PartialType,
|
||||
Scope,
|
||||
Span,
|
||||
Type,
|
||||
AsgConvertError, Circuit, CircuitMember, ConstValue, Expression, ExpressionNode, FromAst, Identifier, Node,
|
||||
PartialType, Scope, Span, Type,
|
||||
};
|
||||
|
||||
use indexmap::{IndexMap, IndexSet};
|
||||
|
@ -15,19 +15,8 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{
|
||||
AsgConvertError,
|
||||
CharValue,
|
||||
ConstInt,
|
||||
ConstValue,
|
||||
Expression,
|
||||
ExpressionNode,
|
||||
FromAst,
|
||||
GroupValue,
|
||||
Node,
|
||||
PartialType,
|
||||
Scope,
|
||||
Span,
|
||||
Type,
|
||||
AsgConvertError, CharValue, ConstInt, ConstValue, Expression, ExpressionNode, FromAst, GroupValue, Node,
|
||||
PartialType, Scope, Span, Type,
|
||||
};
|
||||
|
||||
use std::cell::Cell;
|
||||
|
@ -15,20 +15,8 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{
|
||||
AsgConvertError,
|
||||
ConstValue,
|
||||
Constant,
|
||||
DefinitionStatement,
|
||||
Expression,
|
||||
ExpressionNode,
|
||||
FromAst,
|
||||
Node,
|
||||
PartialType,
|
||||
Scope,
|
||||
Span,
|
||||
Statement,
|
||||
Type,
|
||||
Variable,
|
||||
AsgConvertError, ConstValue, Constant, DefinitionStatement, Expression, ExpressionNode, FromAst, Node, PartialType,
|
||||
Scope, Span, Statement, Type, Variable,
|
||||
};
|
||||
|
||||
use std::cell::Cell;
|
||||
|
@ -15,16 +15,7 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{
|
||||
AsgContextInner,
|
||||
AsgConvertError,
|
||||
Circuit,
|
||||
Expression,
|
||||
Function,
|
||||
PartialType,
|
||||
Scope,
|
||||
Span,
|
||||
Statement,
|
||||
Variable,
|
||||
AsgContextInner, AsgConvertError, Circuit, Expression, Function, PartialType, Scope, Span, Statement, Variable,
|
||||
};
|
||||
|
||||
/// A node in the abstract semantic graph.
|
||||
|
@ -15,18 +15,8 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{
|
||||
AsgConvertError,
|
||||
BlockStatement,
|
||||
Circuit,
|
||||
FromAst,
|
||||
Identifier,
|
||||
MonoidalDirector,
|
||||
ReturnPathReducer,
|
||||
Scope,
|
||||
Span,
|
||||
Statement,
|
||||
Type,
|
||||
Variable,
|
||||
AsgConvertError, BlockStatement, Circuit, FromAst, Identifier, MonoidalDirector, ReturnPathReducer, Scope, Span,
|
||||
Statement, Type, Variable,
|
||||
};
|
||||
use indexmap::IndexMap;
|
||||
pub use leo_ast::Annotation;
|
||||
|
@ -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};
|
||||
|
||||
|
@ -15,22 +15,8 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{
|
||||
AsgConvertError,
|
||||
CircuitMember,
|
||||
ConstInt,
|
||||
ConstValue,
|
||||
Expression,
|
||||
ExpressionNode,
|
||||
FromAst,
|
||||
Identifier,
|
||||
IntegerType,
|
||||
Node,
|
||||
PartialType,
|
||||
Scope,
|
||||
Span,
|
||||
Statement,
|
||||
Type,
|
||||
Variable,
|
||||
AsgConvertError, CircuitMember, ConstInt, ConstValue, Expression, ExpressionNode, FromAst, Identifier, IntegerType,
|
||||
Node, PartialType, Scope, Span, Statement, Type, Variable,
|
||||
};
|
||||
pub use leo_ast::AssignOperation;
|
||||
use leo_ast::AssigneeAccess as AstAssigneeAccess;
|
||||
|
@ -15,18 +15,8 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{
|
||||
AsgConvertError,
|
||||
Expression,
|
||||
ExpressionNode,
|
||||
FromAst,
|
||||
InnerVariable,
|
||||
Node,
|
||||
PartialType,
|
||||
Scope,
|
||||
Span,
|
||||
Statement,
|
||||
Type,
|
||||
Variable,
|
||||
AsgConvertError, Expression, ExpressionNode, FromAst, InnerVariable, Node, PartialType, Scope, Span, Statement,
|
||||
Type, Variable,
|
||||
};
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
@ -44,12 +34,15 @@ impl<'a> DefinitionStatement<'a> {
|
||||
self.variables
|
||||
.iter()
|
||||
.map(|variable| {
|
||||
(variable.borrow().name.name.to_string(), DefinitionStatement {
|
||||
parent: self.parent.clone(),
|
||||
span: self.span.clone(),
|
||||
variables: vec![variable],
|
||||
value: self.value.clone(),
|
||||
})
|
||||
(
|
||||
variable.borrow().name.name.to_string(),
|
||||
DefinitionStatement {
|
||||
parent: self.parent.clone(),
|
||||
span: self.span.clone(),
|
||||
variables: vec![variable],
|
||||
value: self.value.clone(),
|
||||
},
|
||||
)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
@ -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,
|
||||
};
|
||||
|
||||
|
@ -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,
|
||||
|
@ -15,13 +15,7 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{
|
||||
ArrayDimensions,
|
||||
CircuitImpliedVariableDefinition,
|
||||
GroupValue,
|
||||
Identifier,
|
||||
IntegerType,
|
||||
PositiveNumber,
|
||||
Span,
|
||||
ArrayDimensions, CircuitImpliedVariableDefinition, GroupValue, Identifier, IntegerType, PositiveNumber, Span,
|
||||
SpreadOrExpression,
|
||||
};
|
||||
|
||||
|
@ -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};
|
||||
|
@ -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};
|
||||
|
@ -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;
|
||||
|
@ -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`.
|
||||
|
@ -15,8 +15,7 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_input::types::{
|
||||
IntegerType as InputIntegerType,
|
||||
SignedIntegerType as InputSignedIntegerType,
|
||||
IntegerType as InputIntegerType, SignedIntegerType as InputSignedIntegerType,
|
||||
UnsignedIntegerType as InputUnsignedIntegerType,
|
||||
};
|
||||
|
||||
|
@ -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};
|
||||
|
@ -18,12 +18,7 @@
|
||||
use crate::{
|
||||
constraints::{generate_constraints, generate_test_constraints},
|
||||
errors::CompilerError,
|
||||
AstSnapshotOptions,
|
||||
CompilerOptions,
|
||||
GroupType,
|
||||
Output,
|
||||
OutputFile,
|
||||
TypeInferencePhase,
|
||||
AstSnapshotOptions, CompilerOptions, GroupType, Output, OutputFile, TypeInferencePhase,
|
||||
};
|
||||
pub use leo_asg::{new_context, AsgContext as Context, AsgContext};
|
||||
use leo_asg::{Asg, AsgPass, FormattedError, Program as AsgProgram};
|
||||
|
@ -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};
|
||||
|
||||
|
@ -15,14 +15,7 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::errors::{
|
||||
AddressError,
|
||||
BooleanError,
|
||||
CharError,
|
||||
FieldError,
|
||||
FunctionError,
|
||||
GroupError,
|
||||
IntegerError,
|
||||
ValueError,
|
||||
AddressError, BooleanError, CharError, FieldError, FunctionError, GroupError, IntegerError, ValueError,
|
||||
};
|
||||
use leo_ast::{FormattedError, Identifier, LeoError, Span};
|
||||
use snarkvm_r1cs::SynthesisError;
|
||||
|
@ -15,16 +15,8 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::errors::{
|
||||
AddressError,
|
||||
BooleanError,
|
||||
CharError,
|
||||
ExpressionError,
|
||||
FieldError,
|
||||
GroupError,
|
||||
IntegerError,
|
||||
OutputBytesError,
|
||||
StatementError,
|
||||
ValueError,
|
||||
AddressError, BooleanError, CharError, ExpressionError, FieldError, GroupError, IntegerError, OutputBytesError,
|
||||
StatementError, ValueError,
|
||||
};
|
||||
use leo_asg::AsgConvertError;
|
||||
use leo_ast::{FormattedError, LeoError, Span};
|
||||
|
@ -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};
|
||||
|
||||
|
@ -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};
|
||||
|
@ -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;
|
||||
|
@ -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};
|
||||
|
@ -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 })
|
||||
|
@ -21,8 +21,7 @@ use crate::errors::OutputFileError;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
fs::{
|
||||
File,
|
||||
{self},
|
||||
File, {self},
|
||||
},
|
||||
io::Write,
|
||||
path::Path,
|
||||
|
@ -18,86 +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,
|
||||
ConsoleArgs as AstConsoleArgs,
|
||||
ConsoleFunction as AstConsoleFunction,
|
||||
ConsoleStatement as AstConsoleStatement,
|
||||
DefinitionStatement as AstDefinitionStatement,
|
||||
Expression as AstExpression,
|
||||
ExpressionStatement as AstExpressionStatement,
|
||||
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,
|
||||
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, ConsoleArgs as AstConsoleArgs,
|
||||
ConsoleFunction as AstConsoleFunction, ConsoleStatement as AstConsoleStatement,
|
||||
DefinitionStatement as AstDefinitionStatement, Expression as AstExpression,
|
||||
ExpressionStatement as AstExpressionStatement, 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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -22,8 +22,7 @@ use crate::{
|
||||
errors::{ExpressionError, StatementError},
|
||||
program::ConstrainedProgram,
|
||||
value::ConstrainedValue,
|
||||
GroupType,
|
||||
Integer,
|
||||
GroupType, Integer,
|
||||
};
|
||||
use leo_asg::{ConstInt, Expression, Node};
|
||||
|
||||
|
@ -95,15 +95,18 @@ impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
|
||||
let mut target = self.get(variable.id).unwrap().clone();
|
||||
let accesses: Vec<_> = assignee.target_accesses.iter().rev().collect();
|
||||
self.resolve_target_access(cs, ResolverContext {
|
||||
input: vec![&mut target],
|
||||
span,
|
||||
target_value,
|
||||
remaining_accesses: &accesses[..],
|
||||
indicator,
|
||||
operation: assignee.operation,
|
||||
from_range: false,
|
||||
})?;
|
||||
self.resolve_target_access(
|
||||
cs,
|
||||
ResolverContext {
|
||||
input: vec![&mut target],
|
||||
span,
|
||||
target_value,
|
||||
remaining_accesses: &accesses[..],
|
||||
indicator,
|
||||
operation: assignee.operation,
|
||||
from_range: false,
|
||||
},
|
||||
)?;
|
||||
*self.get_mut(variable.id).unwrap() = target;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -27,11 +27,7 @@ use serde_yaml::Value;
|
||||
use snarkvm_curves::{bls12_377::Bls12_377, edwards_bls12::Fq};
|
||||
|
||||
use crate::{
|
||||
compiler::Compiler,
|
||||
errors::CompilerError,
|
||||
targets::edwards_bls12::EdwardsGroupType,
|
||||
AstSnapshotOptions,
|
||||
Output,
|
||||
compiler::Compiler, errors::CompilerError, targets::edwards_bls12::EdwardsGroupType, AstSnapshotOptions, Output,
|
||||
};
|
||||
|
||||
pub type EdwardsTestCompiler = Compiler<'static, Fq, EdwardsGroupType>;
|
||||
|
@ -224,7 +224,11 @@ impl<F: PrimeField> ConditionalEqGadget<F> for Address {
|
||||
}
|
||||
|
||||
fn cond_select_helper(first: &Address, second: &Address, cond: bool) -> Address {
|
||||
if cond { first.clone() } else { second.clone() }
|
||||
if cond {
|
||||
first.clone()
|
||||
} else {
|
||||
second.clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl<F: PrimeField> CondSelectGadget<F> for Address {
|
||||
|
@ -17,8 +17,7 @@
|
||||
use crate::{
|
||||
errors::CharError,
|
||||
value::{field::input::allocate_field, ConstrainedValue},
|
||||
FieldType,
|
||||
GroupType,
|
||||
FieldType, GroupType,
|
||||
};
|
||||
|
||||
use leo_ast::{InputValue, Span};
|
||||
|
@ -20,8 +20,7 @@ use leo_asg::{GroupCoordinate, GroupValue, Span};
|
||||
use snarkvm_curves::{
|
||||
edwards_bls12::{EdwardsAffine, EdwardsParameters, Fq},
|
||||
templates::twisted_edwards_extended::Affine,
|
||||
AffineCurve,
|
||||
TwistedEdwardsParameters,
|
||||
AffineCurve, TwistedEdwardsParameters,
|
||||
};
|
||||
use snarkvm_fields::{Fp256, One, Zero};
|
||||
use snarkvm_gadgets::{
|
||||
@ -479,7 +478,11 @@ impl CondSelectGadget<Fq> for EdwardsGroupType {
|
||||
second: &Self,
|
||||
) -> Result<Self, SynthesisError> {
|
||||
if let Boolean::Constant(cond) = *cond {
|
||||
if cond { Ok(first.clone()) } else { Ok(second.clone()) }
|
||||
if cond {
|
||||
Ok(first.clone())
|
||||
} else {
|
||||
Ok(second.clone())
|
||||
}
|
||||
} else {
|
||||
let first_gadget = first.allocated(cs.ns(|| "first"))?;
|
||||
let second_gadget = second.allocated(cs.ns(|| "second"))?;
|
||||
|
@ -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};
|
||||
|
@ -18,8 +18,7 @@ use crate::{commands::Command, context::Context};
|
||||
use leo_compiler::{
|
||||
compiler::{thread_leaked_context, Compiler},
|
||||
group::targets::edwards_bls12::EdwardsGroupType,
|
||||
AstSnapshotOptions,
|
||||
CompilerOptions,
|
||||
AstSnapshotOptions, CompilerOptions,
|
||||
};
|
||||
use leo_package::{
|
||||
inputs::*,
|
||||
|
@ -20,8 +20,7 @@ use anyhow::{anyhow, Result};
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
fs::{
|
||||
File,
|
||||
{self},
|
||||
File, {self},
|
||||
},
|
||||
io::{Read, Write},
|
||||
path::Path,
|
||||
|
@ -16,9 +16,7 @@
|
||||
|
||||
use std::{
|
||||
fs::{
|
||||
create_dir_all,
|
||||
File,
|
||||
{self},
|
||||
create_dir_all, File, {self},
|
||||
},
|
||||
io,
|
||||
io::prelude::*,
|
||||
|
25
leo/main.rs
25
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;
|
||||
@ -189,10 +177,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.
|
||||
|
@ -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},
|
||||
};
|
||||
|
@ -22,8 +22,7 @@ use serde::Deserialize;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
fs::{
|
||||
File,
|
||||
{self},
|
||||
File, {self},
|
||||
},
|
||||
io::Write,
|
||||
path::Path,
|
||||
|
@ -22,8 +22,7 @@ use serde::Deserialize;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
fs::{
|
||||
File,
|
||||
{self},
|
||||
File, {self},
|
||||
},
|
||||
io::Write,
|
||||
path::Path,
|
||||
|
@ -22,8 +22,7 @@ use serde::Deserialize;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
fs::{
|
||||
File,
|
||||
{self},
|
||||
File, {self},
|
||||
},
|
||||
io::Write,
|
||||
path::Path,
|
||||
|
@ -22,8 +22,7 @@ use serde::Deserialize;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
fs::{
|
||||
File,
|
||||
{self},
|
||||
File, {self},
|
||||
},
|
||||
io::Write,
|
||||
path::Path,
|
||||
|
@ -22,8 +22,7 @@ use serde::Deserialize;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
fs::{
|
||||
File,
|
||||
{self},
|
||||
File, {self},
|
||||
},
|
||||
io::Write,
|
||||
path::Path,
|
||||
|
@ -22,8 +22,7 @@ use serde::Deserialize;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
fs::{
|
||||
File,
|
||||
{self},
|
||||
File, {self},
|
||||
},
|
||||
io::Write,
|
||||
path::Path,
|
||||
|
@ -22,8 +22,7 @@ use serde::Deserialize;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
fs::{
|
||||
File,
|
||||
{self},
|
||||
File, {self},
|
||||
},
|
||||
io::Write,
|
||||
path::Path,
|
||||
|
@ -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,
|
||||
|
@ -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},
|
||||
};
|
||||
|
@ -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,
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
///
|
||||
|
@ -82,17 +82,20 @@ pub(crate) fn tokenize(path: &str, input: StrTendril) -> Result<Vec<SpannedToken
|
||||
if token_len == 0 && index == input.len() {
|
||||
break;
|
||||
} else if token_len == 0 {
|
||||
return Err(TokenError::unexpected_token(&input[index..index + 1], &Span {
|
||||
line_start: line_no,
|
||||
line_stop: line_no,
|
||||
col_start: index - line_start + 1,
|
||||
col_stop: index - line_start + 2,
|
||||
path,
|
||||
content: input.subtendril(
|
||||
line_start as u32,
|
||||
input[line_start..].find('\n').unwrap_or_else(|| input.len()) as u32,
|
||||
),
|
||||
}));
|
||||
return Err(TokenError::unexpected_token(
|
||||
&input[index..index + 1],
|
||||
&Span {
|
||||
line_start: line_no,
|
||||
line_stop: line_no,
|
||||
col_start: index - line_start + 1,
|
||||
col_stop: index - line_start + 2,
|
||||
path,
|
||||
content: input.subtendril(
|
||||
line_start as u32,
|
||||
input[line_start..].find('\n').unwrap_or_else(|| input.len()) as u32,
|
||||
),
|
||||
},
|
||||
));
|
||||
}
|
||||
if input.as_bytes()[index] == b'\n' {
|
||||
line_no += 1;
|
||||
|
@ -174,11 +174,14 @@ pub fn run_tests<T: Runner>(runner: &T, expectation_category: &str) {
|
||||
|
||||
if errors.is_empty() {
|
||||
if expectations.is_none() {
|
||||
outputs.push((expectation_path, TestExpectation {
|
||||
namespace: config.namespace,
|
||||
expectation: config.expectation,
|
||||
outputs: new_outputs,
|
||||
}));
|
||||
outputs.push((
|
||||
expectation_path,
|
||||
TestExpectation {
|
||||
namespace: config.namespace,
|
||||
expectation: config.expectation,
|
||||
outputs: new_outputs,
|
||||
},
|
||||
));
|
||||
}
|
||||
pass_categories += 1;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user