Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: zk light client #12

Merged
merged 67 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
9b26fe9
chore: move to workspace structure
dndll Jan 9, 2024
383ee74
refactor!: move proof to protocol
dndll Jan 9, 2024
2397a46
feat: expose protocol as a standalone crate
dndll Jan 9, 2024
ce95072
wip: port over circuits
dndll Jan 9, 2024
53d437a
build: upgrade near primitives and borsh
dndll Jan 9, 2024
e174830
wip: testing
dndll Jan 9, 2024
9f14ecc
wip: testing
dndll Jan 10, 2024
466f3d2
wip: out
dndll Jan 10, 2024
e11f079
wip: block roots
dndll Jan 10, 2024
c2ffa3d
wip: test next bps
dndll Jan 11, 2024
9ea6f65
wip: verify inclusion proof tests
dndll Jan 11, 2024
c616908
wip: full sync
dndll Jan 11, 2024
4b987d4
wip: splitting tests
dndll Jan 11, 2024
0454f7e
test: split up the testss
dndll Jan 12, 2024
1e2ed69
fix: bitmask length
dndll Jan 12, 2024
154041d
wip: testing
dndll Jan 12, 2024
df27178
wip: broken sig verification
dndll Jan 12, 2024
2267615
chore(wip): add max seats to config
dndll Jan 15, 2024
9dbd13b
wip: constraining variables
dndll Jan 15, 2024
264a673
wip: tidy up
dndll Jan 15, 2024
e2cc35c
wip: maybe no hinting for encoding
dndll Jan 16, 2024
a10562d
wip: check next bps
dndll Jan 16, 2024
dc7b740
wip: return a value from syncing as per other lib
dndll Jan 17, 2024
6c8189c
feat: sync circuit
dndll Jan 22, 2024
2466239
wip: batchcircuit
dndll Jan 31, 2024
3eb074e
feat: use a hint for joining instead
dndll Feb 2, 2024
3984c2f
feat: expose to succinctx
dndll Feb 2, 2024
c4acc36
chore: add statelessnet
dndll Feb 5, 2024
1e857f5
feat: reformat and split modules
dndll Feb 5, 2024
7d0c51a
feat: data driven batch test on consumer hardware
dndll Feb 5, 2024
e00916b
wip: contracts
dndll Feb 8, 2024
9750ed9
feat!: only read/write trusted header hashes to the circuit
dndll Feb 8, 2024
360ae8f
chore: forge init
dndll Feb 9, 2024
c9d5eba
forge install: forge-std
dndll Feb 9, 2024
c62c5bd
feat!: reference Ids in the proof verification
dndll Feb 9, 2024
94a4442
chore: test parameters
dndll Feb 9, 2024
4b3015f
wip: use evm IO
dndll Feb 9, 2024
cf3f4a3
fix: dependency hell
dndll Feb 12, 2024
8222174
fix: mapreduce inputs were registering incorrectly in the generator
dndll Feb 13, 2024
5342629
test: pre write inputs to build directory
dndll Feb 13, 2024
bfd57bd
wip: contracts
dndll Feb 13, 2024
771e64b
fix: witness some safety values in headers and add default result to ctx
dndll Feb 14, 2024
9462c9d
wip: test 128x8 batch
dndll Feb 15, 2024
e14fd8f
test: remove redundant verify test
dndll Feb 15, 2024
3ea8254
style: cleanup and lints
dndll Feb 15, 2024
d608435
chore: move operator and ignore the beefy tests
dndll Feb 15, 2024
d76d925
chore: clean up directory structure
dndll Feb 15, 2024
8bcc362
ci: test solidity on PR
dndll Feb 15, 2024
3ac02f5
ci: note on releasing to succinct on tag
dndll Feb 15, 2024
593f3ac
build: update dependencies to latest plonky2x/starkyx
dndll Feb 16, 2024
78e3d06
fix: total stake should only validate this epochs producers
dndll Feb 16, 2024
bdd7e3f
ci: test older ci group
dndll Feb 16, 2024
abccb64
test: use workspace directory for path management
dndll Feb 16, 2024
5fcd9f8
test: promote merkle test to beefy
dndll Feb 16, 2024
a3f3c5c
build: specify nightly since avx/ahash issue cannot handle 1.78
dndll Feb 16, 2024
e2a0be1
ci: remove needless caching
dndll Feb 16, 2024
6b7f690
ci: cancel if multiple jobs
dndll Feb 16, 2024
5b68af2
test: remove dead function
dndll Feb 16, 2024
962f476
ci: add dependency audit
dndll Feb 16, 2024
29bd044
ci: forge install dependencies
dndll Feb 16, 2024
6027ef7
ci: run ignored-only
dndll Feb 16, 2024
afdff1a
ci: foundry caching
dndll Feb 16, 2024
d784a8a
fix: size was not fulfilled for block signatures
dndll Feb 16, 2024
e842e11
ci: parallel debug tests
dndll Feb 16, 2024
a52b8c5
test: disable extremely beefy test
dndll Feb 16, 2024
002092d
ci: download archive
dndll Feb 16, 2024
dda185c
build: fix forge submodules
dndll Feb 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/dependency_audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: "Audit depdencies"

# Midnight each day
on:
schedule:
- cron: '0 0 * * *'

jobs:
security_audit:
name: "Security audit"
runs-on:
group: ubuntu-22.04-8core
steps:
- uses: actions/checkout@v1
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

1 change: 1 addition & 0 deletions .github/workflows/on_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ jobs:
ghcr.io/near/near-light-client/light-client:${{ github.sha }}
ghcr.io/near/near-light-client/light-client:latest

# TODO: releasing to succinct on tag
127 changes: 116 additions & 11 deletions .github/workflows/on_pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
# See workflow runs at https://github.com/nextest-rs/reuse-build-partition-example/actions/workflows/ci.yml.
name: "Check PR is ready for merge"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
branches:
- master
# schedule:
# # Run this every day at 01:00 UTC.
# - cron: 0 1 * * *

env:
CARGO_TERM_COLOR: always

jobs:
lint:
Expand All @@ -13,24 +24,118 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: Swatinem/rust-cache@v2
- name: "Check rust format"
uses: actions-rs/cargo@v1
- uses: actions-rust-lang/[email protected]
with:
cache-workspaces: |-
.
- uses: actions-rust-lang/rustfmt@v1
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features

build-test-artifacts:
name: Build test artifacts
runs-on: ubuntu-20.04-16core
steps:
- uses: actions/checkout@v3
with:
# By default actions/checkout checks out a merge commit. Check out the PR head instead.
# https://github.com/actions/checkout#checkout-pull-request-head-commit-instead-of-merge-commit
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions-rust-lang/[email protected]
with:
cache-workspaces: |-
.
- name: "Install cargo-nextest"
run: cargo install cargo-nextest
- name: Build and archive tests
run: cargo nextest archive -r --workspace --archive-file nextest-archive.tar.zst --locked
- name: Upload archive to workflow
uses: actions/upload-artifact@v3
with:
command: fmt
args: --all -- --check
name: nextest-archive
path: nextest-archive.tar.zst

test-rust:
name: "Test Rust"
runs-on:
group: ubuntu-22.04-16core
group: ubuntu-22.04-8core
needs: build-test-artifacts
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: Swatinem/rust-cache@v2
- uses: actions-rust-lang/[email protected]
with:
cache-workspaces: |-
.
- name: "Install cargo-nextest"
run: cargo install cargo-nextest
- name: "Run tests"
run: cargo nextest run --workspace --locked
- name: Download archive
uses: actions/download-artifact@v3
with:
name: nextest-archive
- name: "Run normal tests"
run: |
cargo nextest run \
--archive-file nextest-archive.tar.zst \
--no-fail-fast

run-tests-partitioned:
name: "Run Beefy tests partitioned"
needs: build-test-artifacts
strategy:
matrix:
os: [ubuntu-22.04-32core, ubuntu-20.04-32core]
include:
- os: ubuntu-22.04-32core
share: 1
- os: ubuntu-20.04-32core
share: 2
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions-rust-lang/[email protected]
with:
cache-workspaces: |-
.
- name: "Install cargo-nextest"
run: cargo install cargo-nextest
- name: Download archive
uses: actions/download-artifact@v3
with:
name: nextest-archive
- name: Run tests
run: |
cargo nextest run \
--run-ignored ignored-only \
--archive-file nextest-archive.tar.zst \
--partition count:${{ matrix.share }}/2

test-solidity-contracts:
name: "Test Solidity Contracts"
runs-on:
group: ubuntu-22.04-16core
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rust-lang/[email protected]
with:
cache-workspaces: |-
.
- name: "Install Foundry"
uses: taiki-e/cache-cargo-install-action@v1
with:
git: https://github.com/foundry-rs/foundry
tool: forge
rev: 6ee3e88d2a48c7df48c85986e67f73cd2e6403d8
- name: "Forge install"
run: cd nearx/contract && forge install
- name: "Run tests"
run: cd nearx/contract && forge test -vv

26 changes: 24 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
/target
**/target

# Nixos Direnv
.direnv

# Light client local config file
local.toml

state.db
# Lightclient DBs
*.db

# ZK Compiler files
build/
wrapped/
nearx/build
nearx/contract/cache
nearx/contract/out
nearx/contract/lib
# Ignores development broadcast logs
!**broadcast
**broadcast/*/31337/
**broadcast/**/dry-run/
nearx/contract/broadcast

# Docs
docs/

# Dotenv file
.env
21 changes: 21 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[submodule "vendor/starkyx"]
path = vendor/starkyx
url = [email protected]:succinctlabs/starkyx.git
[submodule "vendor/succinctx"]
path = vendor/succinctx
url = [email protected]:succinctlabs/succinctx.git
[submodule "nearx/contract/lib/openzeppelin-contracts"]
path = nearx/contract/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "nearx/contract/lib/openzeppelin-contracts-upgradeable"]
path = nearx/contract/lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "nearx/contract/lib/foundry-devops"]
path = nearx/contract/lib/foundry-devops
url = https://github.com/chainaccelorg/foundry-devops
[submodule "nearx/contract/lib/solidity-bytes-utils"]
path = nearx/contract/lib/solidity-bytes-utils
url = https://github.com/GNSPS/solidity-bytes-utils
[submodule "nearx/contract/lib/forge-std"]
path = nearx/contract/lib/forge-std
url = https://github.com/foundry-rs/forge-std
Loading
Loading