From a367bfebe37cb656f2dec97bdb884839e5990ab9 Mon Sep 17 00:00:00 2001 From: gluax <16431709+gluax@users.noreply.github.com> Date: Fri, 21 Jan 2022 12:15:10 -0800 Subject: [PATCH 1/5] forgot we needed to update the ci's as well. --- .circleci/config.yml | 26 +++++------ .github/workflows/ci.yml | 93 -------------------------------------- .github/workflows/wasm.yml | 3 -- 3 files changed, 13 insertions(+), 109 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5ce58312b2..496911c5c7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -46,7 +46,7 @@ commands: jobs: check-style: docker: - - image: cimg/rust:1.54.0 + - image: cimg/rust:1.56.1 resource_class: xlarge steps: - checkout @@ -61,7 +61,7 @@ jobs: clippy: docker: - - image: cimg/rust:1.54.0 + - image: cimg/rust:1.56.1 resource_class: xlarge steps: - checkout @@ -76,7 +76,7 @@ jobs: # code-cov: # docker: - # - image: cimg/rust:1.54.0 + # - image: cimg/rust:1.56.1 # resource_class: xlarge # environment: # RUSTC_BOOTSTRAP: 1 @@ -118,7 +118,7 @@ jobs: leo-executable: docker: - - image: cimg/rust:1.54.0 + - image: cimg/rust:1.56.1 resource_class: xlarge steps: - checkout @@ -136,7 +136,7 @@ jobs: leo-new: docker: - - image: cimg/rust:1.54.0 + - image: cimg/rust:1.56.1 resource_class: xlarge steps: - attach_workspace: @@ -149,7 +149,7 @@ jobs: leo-init: docker: - - image: cimg/rust:1.54.0 + - image: cimg/rust:1.56.1 resource_class: xlarge steps: - attach_workspace: @@ -162,7 +162,7 @@ jobs: leo-clean: docker: - - image: cimg/rust:1.54.0 + - image: cimg/rust:1.56.1 resource_class: xlarge steps: - attach_workspace: @@ -175,7 +175,7 @@ jobs: leo-setup: docker: - - image: cimg/rust:1.54.0 + - image: cimg/rust:1.56.1 resource_class: xlarge steps: - attach_workspace: @@ -188,7 +188,7 @@ jobs: # leo-add-remove: # docker: - # - image: cimg/rust:1.54.0 + # - image: cimg/rust:1.56.1 # resource_class: xlarge # steps: # - attach_workspace: @@ -201,7 +201,7 @@ jobs: leo-check-constraints: docker: - - image: cimg/rust:1.54.0 + - image: cimg/rust:1.56.1 resource_class: xlarge steps: - attach_workspace: @@ -214,7 +214,7 @@ jobs: leo-login-logout: docker: - - image: cimg/rust:1.54.0 + - image: cimg/rust:1.56.1 resource_class: xlarge steps: - attach_workspace: @@ -227,7 +227,7 @@ jobs: leo-clone: docker: - - image: cimg/rust:1.54.0 + - image: cimg/rust:1.56.1 resource_class: xlarge steps: - attach_workspace: @@ -240,7 +240,7 @@ jobs: leo-publish: docker: - - image: cimg/rust:1.54.0 + - image: cimg/rust:1.56.1 resource_class: xlarge steps: - attach_workspace: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f4438219e..74ca431314 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -236,96 +236,3 @@ jobs: - 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: 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: - command: test - args: --all - env: - CARGO_INCREMENTAL: "0" - - - name: Install dependencies for code coverage - run: | - sudo apt-get update - sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev - - - name: Generate coverage report - run: | - 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 - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 - 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/.github/workflows/wasm.yml b/.github/workflows/wasm.yml index e5dcd69d1d..c2363ac026 100644 --- a/.github/workflows/wasm.yml +++ b/.github/workflows/wasm.yml @@ -37,6 +37,3 @@ jobs: run: wasm-pack build --dev --target nodejs - name: Install dependencies and run tests run: cd tests && npm ci && npm test - - - \ No newline at end of file From 30302c12c6144bbd1db61be61cdab112783cd5ad Mon Sep 17 00:00:00 2001 From: collin <16715212+collinc97@users.noreply.github.com> Date: Fri, 21 Jan 2022 13:04:57 -0800 Subject: [PATCH 2/5] CI: remove constraint check for refactor --- .circleci/config.yml | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5ce58312b2..1d22cc76f1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -199,18 +199,19 @@ jobs: # export LEO=/home/circleci/project/project/bin/leo # ./project/.circleci/leo-add-remove.sh - leo-check-constraints: - docker: - - image: cimg/rust:1.54.0 - resource_class: xlarge - steps: - - attach_workspace: - at: /home/circleci/project/ - - run: - name: leo check constraints for Pedersen Hash - command: | - export LEO=/home/circleci/project/project/bin/leo - ./project/.circleci/leo-check-constraints.sh +# todo (collin): uncomment after compiler refactor +# leo-check-constraints: +# docker: +# - image: cimg/rust:1.54.0 +# resource_class: xlarge +# steps: +# - attach_workspace: +# at: /home/circleci/project/ +# - run: +# name: leo check constraints for Pedersen Hash +# command: | +# export LEO=/home/circleci/project/project/bin/leo +# ./project/.circleci/leo-check-constraints.sh leo-login-logout: docker: @@ -270,12 +271,12 @@ workflows: - leo-setup: requires: - leo-executable - # - leo-add-remove: - # requires: - # - leo-executable - - leo-check-constraints: - requires: - - leo-executable +# - leo-add-remove: +# requires: +# - leo-executable +# - leo-check-constraints: +# requires: +# - leo-executable - leo-login-logout: requires: - leo-executable From 64075cfd31622a1e47fe085dd77a5947301af18d Mon Sep 17 00:00:00 2001 From: gluax <16431709+gluax@users.noreply.github.com> Date: Fri, 21 Jan 2022 13:13:15 -0800 Subject: [PATCH 3/5] fix spelling mistake, re-add codecov --- .github/workflows/ci.yml | 93 ++++++++++++++++++++++++++++++++++++++++ span/src/symbol.rs | 2 +- 2 files changed, 94 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74ca431314..310558c013 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -236,3 +236,96 @@ jobs: - 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: 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: + command: test + args: --all + env: + CARGO_INCREMENTAL: "0" + + - name: Install dependencies for code coverage + run: | + sudo apt-get update + sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev + + - name: Generate coverage report + run: | + 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 + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + 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 \ No newline at end of file diff --git a/span/src/symbol.rs b/span/src/symbol.rs index 7509249fea..3e99ae8674 100644 --- a/span/src/symbol.rs +++ b/span/src/symbol.rs @@ -29,7 +29,7 @@ use std::intrinsics::transmute; use std::marker::PhantomData; /// A helper for `symbols` defined below. -/// The macro's job is to bind conventiently usable `const` items to the symbol names provided. +/// The macro's job is to bind conveniently usable `const` items to the symbol names provided. /// For example, with `symbol { a, b }` you'd have `sym::a` and `sym::b`. macro_rules! consts { ($val: expr, $sym:ident $(,)?) => { From 0473949632272840014ae30ea21cf9156d1c1306 Mon Sep 17 00:00:00 2001 From: gluax <16431709+gluax@users.noreply.github.com> Date: Mon, 24 Jan 2022 10:02:15 -0800 Subject: [PATCH 4/5] merge upstream testnet2 --- .rusty-hook.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rusty-hook.toml b/.rusty-hook.toml index 5572d62389..d5623f4620 100644 --- a/.rusty-hook.toml +++ b/.rusty-hook.toml @@ -1,5 +1,5 @@ [hooks] -pre-commit = "cargo clippy && cargo +nightly fmt --all -- --check" +# pre-commit = "cargo clippy && cargo +nightly fmt --all -- --check" # temp disable for this branch [logging] verbose = true From 7b54423b412041026d04d947ecd1eb9d523dcf7a Mon Sep 17 00:00:00 2001 From: gluax <16431709+gluax@users.noreply.github.com> Date: Wed, 26 Jan 2022 11:21:33 -0800 Subject: [PATCH 5/5] merge more ast changes from staging --- ast/README.md | 64 +++++++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/ast/README.md b/ast/README.md index 99d41e65c6..1b391cdb07 100644 --- a/ast/README.md +++ b/ast/README.md @@ -28,10 +28,10 @@ It stores the path to an import and what is being imported. #### [Circuits](./src/circuits/circuit.rs) A circuit node represents a defined Circuit in a Leo Program. -A order preserving map of these are stored on the Program. -Contains the Circuit's name, as well as it's members. -The members are a function, or a variable. -For both of them the Circuit preserves their names. +An order-preserving map of these are stored on the Program. +Contains the Circuit's name, as well as its members. +The members are a function, or a variable, or a constant. +For all of them the Circuit preserves their names. #### [Decorators](./src/annotation.rs) @@ -42,7 +42,7 @@ The node stores the name of the annotation, as well as any args passed to it. #### [Functions](./src/functions/function.rs) A function node represents a defined function in a Leo Program. -A order preserving map of these are stored on the Program. +An order-preserving map of these are stored on the Program. A function node stores the following information: - The annotations applied to the function. @@ -54,7 +54,7 @@ A function node stores the following information: #### [Global Consts](./src/program.rs) A global const is a bit special and has no special node for itself, but rather is a definition statement. -A order preserving map of these are stored on the Program. +An order-preserving map of these are stored on the Program. ### [Types](./src/types/type_.rs) @@ -75,7 +75,7 @@ The char type resents a character from the inclusive range [0, 10FFFF]. #### Field -The field type an unsigned number up to the modulus length of the field. +The field type an unsigned number less than the modulus of the field. #### Group @@ -127,15 +127,20 @@ A integer in the inclusive range [-170141183460469231731687303715884105728, 1701 #### Array -The array type contains another type, then the number of elements of that type greater than 0. +The array type contains another type, +then the number of elements of that type greater than 0 +for monodimensional arrays, +or a list of such numbers of elements +for multidimensional arrays. #### Tuple The tuple type contains n types, where n is greater than or equal to 0. -#### Circuit +#### Identifier -The circuit type, every circuit represents a different type. +An identifier type is either a circuit type or a type alias; +every circuit type represents a different type. #### SelfType @@ -153,9 +158,9 @@ An assignment statement node stores the following: - **=** - **+=** - **-=** - - **=** + - **\*=** - **/=** - - **=** + - **\*\*=** - **&&=** - **||=** - The assignee which is a variable that has context of any access expressions on it. @@ -188,7 +193,7 @@ A definition statement node stores the following: - The declaration type: - `let` for mutable definitions. - `const` for cosntant definitions. -- The names of the varaibles defined. +- The names of the variables defined. - The optional type. - The values to be assigned to the varaibles. @@ -204,7 +209,8 @@ A iteration statement node stores the following: - The loop iterator variable name. - The expression to define the starting loop value. -- The expression to define the stoping loop value. +- The expression to define the stopping loop value. +- A flag indicating whether the stopping value is inclusive or not. - The block to run for the loop. #### [Return Statements](./src/statements/return_statement.rs) @@ -213,11 +219,11 @@ A return statement node stores the following: - The expression that is being returned. -### Expressions +### [Expressions](./src/expressions/mod.rs) The expression nodes in a Leo Program. -#### [ArrayAccess Expressions](./src/expression/array_acces.rs) +#### [ArrayAccess Expressions](./src/accesses/array_access.rs) An array access expression node stores the following: @@ -235,9 +241,9 @@ An array init expression node stores the following: An array inline expression node stores the following: -- The elments of an array which is either an spread or an expression. +- The elements of an array, each of which is either a spread or an expression. -#### [ArrayRangeAccess Expressions](./src/expression/array_range_access.rs) +#### [ArrayRangeAccess Expressions](./src/accesses/array_range_access.rs) An array range access expression node stores the following: @@ -278,21 +284,23 @@ A call expression node stores the following: A circuit init expression node stores the following: - The name of the circuit expression being initialized. -- The aruments a list of expressions. +- The arguments a list of expressions. -#### [CircuitMemberAccess Expressions](./src/expression/circuit_member_access.rs) +#### [MemberAccess Expressions](./src/accesses/member_access.rs) -A circuit member access expression node stores the following: +A member access expression node stores the following: -- The circut expression being accessed. -- The name of the expression being accessed from the circuit. +- The expression being accessed. +- The name of the member being accessed. +- The optional inferred type. -#### [CircuitStaticFunctionAccess Expressions](./src/expression/circuit_static_function_access.rs) +#### [StaticAccess Expressions](./src/accesses/static_access.rs) -A circuit static function access expression node stores the following: +A static function access expression node stores the following: -- The circut expression being accessed. -- The name of the expression being statically accessed from the circuit. +- The expression being accessed. +- The name of the member being statically accessed. +- The optional inferred type. #### [Identifier Expressions](./src/common/identifier.rs) @@ -308,7 +316,7 @@ A ternary expression node stores the following: - The expression returned if the condition is true. - The expression returned if the condition is false. -#### [TupleAccess Expressions](./src/expression/tuple_access.rs) +#### [TupleAccess Expressions](./src/accesses/tuple_access.rs) A tuple access expression node stores the following: