diff --git a/.circleci/config.yml b/.circleci/config.yml
index 6a45390dc4..dbd8f5495f 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,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:
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/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 8f0d7c2e18..d4d6a4bd8f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -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
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/Cargo.lock b/Cargo.lock
index d18dc2919a..8b40fe9c27 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",
@@ -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]]
@@ -2191,15 +2191,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"
@@ -2319,9 +2310,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",
]
@@ -2338,9 +2329,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",
@@ -2439,9 +2430,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",
@@ -2467,14 +2458,14 @@ dependencies = [
[[package]]
name = "snarkvm-curves"
-version = "0.7.5"
+version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62fdf07998a6e88fce7a8139e8282fb6b2702e49624b6d7e10a5cc1c9f014264"
+checksum = "7cb586a9383563b62120e788f8d9200cfcd5a5b610c2723403a72e6b4cc7ee71"
dependencies = [
"derivative",
"rand 0.8.4",
"rand_xorshift",
- "rustc_version 0.3.3",
+ "rustc_version",
"serde",
"snarkvm-fields",
"snarkvm-utilities",
@@ -2483,9 +2474,9 @@ dependencies = [
[[package]]
name = "snarkvm-derives"
-version = "0.7.5"
+version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d42f4d5abda149130149ce3865aef23d380dfcdd97fea7f75fd79b0aee369b29"
+checksum = "ec9f9134f9b06f279312d39a41c23fcc9ab29e987e74fc1e97a0945d1d169ff0"
dependencies = [
"proc-macro-crate",
"proc-macro-error",
@@ -2496,9 +2487,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",
@@ -2528,9 +2519,9 @@ dependencies = [
[[package]]
name = "snarkvm-fields"
-version = "0.7.5"
+version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2ecd058b3608140610276be1eb1139a032a1bb171969b3ad70550c471d3ae503"
+checksum = "8a0717dbbf3e92e12084c913e53b21534270d2d00584a4344453af1c66952bee"
dependencies = [
"anyhow",
"bincode",
@@ -2544,9 +2535,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",
@@ -2564,9 +2555,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",
@@ -2588,9 +2579,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",
@@ -2601,9 +2592,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",
@@ -2620,15 +2611,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",
@@ -2641,9 +2632,9 @@ dependencies = [
[[package]]
name = "snarkvm-utilities"
-version = "0.7.5"
+version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "15b7ecf6a7afdd60a45cbd5ffab75185c296d8a4bf5eb20f3912384b1d4027c2"
+checksum = "1cc0611d450dfd4e9ad305dd343c0420430f83c73cdb79f6e6e184848dc3e2ee"
dependencies = [
"anyhow",
"bincode",
diff --git a/Cargo.toml b/Cargo.toml
index acdb0c7ea3..9698fec8b4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -74,22 +74,22 @@ path = "./synthesizer"
version = "1.5.3"
[dependencies.snarkvm-algorithms]
-version = "0.7.4"
+version = "0.7.6"
[dependencies.snarkvm-curves]
-version = "0.7.5"
+version = "0.7.7"
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]
-version = "0.7.4"
+version = "0.7.6"
[dependencies.anyhow]
version = "1.0"
@@ -166,7 +166,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"
diff --git a/asg/src/checks/return_path.rs b/asg/src/checks/return_path.rs
index ed8874deb2..31e24e2e52 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/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/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..212df302c1 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;
@@ -115,7 +104,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 +140,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 +177,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/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..6d8f68e68b 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;
@@ -101,7 +91,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..cc2ec02dcc 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};
@@ -127,7 +119,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..3fe02a1928 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;
@@ -79,12 +65,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 +109,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 +123,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 +131,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 +139,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 +157,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..481af198a5 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()
}
@@ -70,7 +63,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/asg/src/statement/iteration.rs b/asg/src/statement/iteration.rs
index 04d327606e..bc38076659 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/reducer/canonicalization.rs b/ast/src/reducer/canonicalization.rs
index edf300ada4..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,
@@ -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());
+ }
+ }
_ => {}
}
@@ -290,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(),
}
}
@@ -313,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/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..bc6f3f8fd0 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};
@@ -70,8 +67,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/compiler/Cargo.toml b/compiler/Cargo.toml
index 5725a5f453..f4613b434b 100644
--- a/compiler/Cargo.toml
+++ b/compiler/Cargo.toml
@@ -57,28 +57,28 @@ version = "1.5.3"
version = "0.4"
[dependencies.snarkvm-curves]
-version = "0.7.5"
+version = "0.7.7"
default-features = false
[dependencies.snarkvm-fields]
-version = "0.7.5"
+version = "0.7.7"
default-features = false
[dependencies.snarkvm-dpc]
-version = "0.7.5"
+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]
-version = "0.7.4"
+version = "0.7.6"
[dependencies.bincode]
version = "1.3"
@@ -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/compiler/src/compiler.rs b/compiler/src/compiler.rs
index b8b507db0d..f2eef8ad70 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,
- 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};
@@ -190,7 +185,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::>()[..],
@@ -198,7 +193,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::>()[..],
@@ -315,14 +310,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