Skip to content

Commit

Permalink
sync
Browse files Browse the repository at this point in the history
  • Loading branch information
zpoken committed Mar 21, 2024
1 parent 3a1847e commit bb17d9a
Show file tree
Hide file tree
Showing 63 changed files with 7,677 additions and 884 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Backend

on:
push:
branches:
- main
- master
pull_request:
branches:
- main

jobs:
fmt:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: '18.x'

- name: Install packages
working-directory: ./backend
run: yarn install

- name: Run fmt check
working-directory: ./backend
run: yarn format-check

lint:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: '18.x'

- name: Install packages
working-directory: ./backend
run: yarn install

- name: Run lint
working-directory: ./backend
run: yarn lint
48 changes: 48 additions & 0 deletions .github/workflows/crypto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Crypto

on:
push:
branches:
- main
- master
pull_request:
branches:
- main

env:
RUST_VERSION_NIGHTLY: nightly-2023-10-24
CARGO_TERM_COLOR: always

jobs:
lint-rust:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: ${{ env.RUST_VERSION_NIGHTLY }}
components: clippy

- name: Run clippy
run: cargo clippy --all-targets --all-features

lint-generic:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install other dependencies
run: sudo apt-get install moreutils dos2unix

- name: Check encoding
run: |
find . -name '*.rs' -exec isutf8 {} +
- name: Check line endings
run: bash .github/workflows/scripts/check_line_endings.sh
54 changes: 54 additions & 0 deletions .github/workflows/foundry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Foundry

on:
push:
branches:
- main
- master
pull_request:
branches:
- main

env:
FOUNDRY_PROFILE: ci

jobs:
fmt:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Run fmt check
working-directory: ./contracts/foundry/verifier
run: forge fmt --check

test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Install OpenZeppelin lib
working-directory: ./contracts/foundry/verifier
run: forge install OpenZeppelin/openzeppelin-contracts-upgradeable --no-commit

- name: Run tests
working-directory: ./contracts/foundry/verifier
run: forge test
73 changes: 73 additions & 0 deletions .github/workflows/gnark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Gnark

on:
push:
branches:
- main
- master
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22

- name: Verify dependencies
working-directory: ./gnark-plonky2-verifier
run: go mod verify

- name: Build
working-directory: ./gnark-plonky2-verifier
run: go build -v ./...

check:
runs-on: ubuntu-latest
needs: build

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22

- name: Install staticcheck
working-directory: ./gnark-plonky2-verifier
run: go install honnef.co/go/tools/cmd/staticcheck@latest

- name: Run staticcheck
working-directory: ./gnark-plonky2-verifier
run: staticcheck ./...

lint:
runs-on: ubuntu-latest
needs: build

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22

- name: Install golint
working-directory: ./gnark-plonky2-verifier
run: go install golang.org/x/lint/golint@latest

- name: Run golint
working-directory: ./gnark-plonky2-verifier
run: golint ./...
59 changes: 59 additions & 0 deletions .github/workflows/hardhat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Hardhat

on:
push:
branches:
- main
- master
pull_request:
branches:
- main

jobs:
check:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: '18.x'

- name: Install yarn
working-directory: ./contracts/hardhat
run: npm install --global yarn

- name: Install packages
working-directory: ./contracts/hardhat
run: yarn

- name: Run check
working-directory: ./contracts/hardhat
run: npm_config_yes=true npm run check

test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: '18.x'

- name: Install yarn
working-directory: ./contracts/hardhat
run: npm install --global yarn

- name: Install packages
working-directory: ./contracts/hardhat
run: yarn

- name: Run tests
working-directory: ./contracts/hardhat
run: npm_config_yes=true npm run test
12 changes: 12 additions & 0 deletions .github/workflows/scripts/check_line_endings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -xeu

check_file_has_lf_endings() {
if [ -f "$1" ]; then
dos2unix < "$1" | cmp - "$1"
fi
}

for file in **/*.rs; do
check_file_has_lf_endings "$file"
done
29 changes: 29 additions & 0 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Sonarqube

on:
push:
branches:
- master


jobs:
build:
name: Check
runs-on: sonarqube
permissions: read-all
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Dependency check
env:
NVDAPIKEY: ${{ secrets.NVDAPIKEY }}
run: dependency-check.sh --exclude .sonar/ --exclude .scannerwork/ --exclude .git/ --out . --scan . --nvdApiKey "$NVDAPIKEY"

- name: Sonar scanner
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
run: NODE_OPTIONS="--max-old-space-size=4096" NODE_ENV=production sonar-scanner
49 changes: 49 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Contribution Guidelines

Hello! Thank you for your interest in joining the mission to improve zero-knowledge protocols.
We welcome contributions from anyone online.

Note, however, that all the contributions are subject to review, and not every contribution is guaranteed to be merged.
It is highly advised to reach out to developers (for example, by creating an issue) before preparing a significant
change in the codebase, and explicitly confirm that this contribution will be considered for merge. Otherwise, it is
possible to discover that a feature you have spent some time on does not align with the core team vision or capacity to
maintain a high quality of given submission long term.

## Ways to contribute

There are many ways to contribute to the Near ZK light client:

1. Open issues: if you find a bug, have something you believe needs to be fixed, or have an idea for a feature, please
open an issue.
2. Add color to existing issues: provide screenshots, code snippets, and whatever you think would be helpful to resolve
issues.
3. Resolve issues: either by showing an issue isn't a problem and the current state is ok as is or by fixing the problem
and opening a PR.

## Fixing issues

To contribute code fixing issues, please fork the repo, fix an issue, commit, add documentation as per the PR template,
and the repo's maintainers will review the PR.
[here](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork)
for guidance how to work with PRs created from a fork.

## Licenses

If you contribute to this project, your contributions will be made to the project under both Apache 2.0 and the MIT
license.


## Code of Conduct

Be polite and respectful.

## FAQ

**Q**: I have a small contribution that's not getting traction/being merged?

**A**: Due to capacity, contributions that are simple renames of variables or stylistic/minor text improvements, one-off
typo fix will not be merged. If you do find any typos or grammar errors, the preferred avenue is to improve the existing
spellchecker. Given you have no technical prowess to do so, please create an issue. Please note that issues will be
resolved on a best effort basis.

### Thank you
7 changes: 7 additions & 0 deletions backend/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"singleQuote": true,
"jsxSingleQuote": true,
"printWidth": 100,
"trailingComma": "all",
"arrowParens": "avoid"
}
Loading

0 comments on commit bb17d9a

Please sign in to comment.