Skip to content

Commit

Permalink
Integrate PoL into consensus (#721)
Browse files Browse the repository at this point in the history
* Add PoL crate

* promote cl crate to nomos-node repo

* Integrate PoL into consensus

* remove metal feature

* install risc0 on ci

* more risc0 install

* fix da tests

* pass gh token

* fix tests and run in release mode

* clippy allow

* do not run in release mode

* drop windows in CI

* execute heavy tests nightly or accelerated in macos

* fmt

* configurable slot time

* use xlarge workers

* fix workflows

* remove unstable test

* use xlarge runners

* separate integrations tests

* fix features

* add token to ci

* downgrade runners

* fix integration tests

* revert testing changes and use risc0 dev mode

* fix coverage risc0 install

* increase slot time

* use cargo binstall

* clean before coverage
  • Loading branch information
zeegomo committed Sep 10, 2024
1 parent 49ac81b commit f2dfd46
Show file tree
Hide file tree
Showing 26 changed files with 780 additions and 684 deletions.
52 changes: 28 additions & 24 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ jobs:
profile: minimal
toolchain: stable
override: true
- uses: cargo-bins/cargo-binstall@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install risc0
run: cargo binstall -y cargo-risczero && cargo risczero install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/cargo@v1
with:
command: check
Expand All @@ -41,7 +48,7 @@ jobs:
fail-fast: false # all OSes should be tested even if one fails (default: true)
matrix:
feature: [ libp2p, "libp2p,mixnet" ]
os: [ ubuntu-latest, windows-latest, macos-latest ]
os: [ ubuntu-latest, macos-latest ] # drop windows for now as risc0 does not support it
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -70,6 +77,13 @@ jobs:
- name: Setup build environment (Windows)
if: matrix.os == 'windows-latest'
uses: ./.github/actions/mingw-env
- uses: cargo-bins/cargo-binstall@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install risc0
run: cargo binstall -y cargo-risczero && cargo risczero install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cargo build
uses: actions-rs/cargo@v1
with:
Expand All @@ -78,6 +92,9 @@ jobs:
- name: Cargo test (Other OSes)
if: matrix.os != 'windows-latest'
uses: actions-rs/cargo@v1
env:
RISC0_DEV_MODE: true
CONSENSUS_SLOT_TIME: 5
with:
command: test
args: --all --no-default-features --features ${{ matrix.feature }}
Expand All @@ -87,35 +104,16 @@ jobs:
env:
# Because Windows runners in Github Actions tend to be slow.
SLOW_TEST_ENV: true
RISC0_DEV_MODE: true
CONSENSUS_SLOT_TIME: 5
with:
command: test
args: --all --no-default-features --features ${{ matrix.feature }}
args: --no-default-features --features ${{ matrix.feature }}
- uses: actions/upload-artifact@v3
if: failure()
with:
name: integration-test-artifacts
path: tests/.tmp*

risc0:
name: Risc0 tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install risc0
run: cargo install cargo-risczero && cargo risczero install
- name: Cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path proof_of_leadership/risc0/prover/Cargo.toml


lints:
name: Rust lints
Expand All @@ -136,7 +134,13 @@ jobs:
toolchain: stable
override: true
components: rustfmt, clippy

- uses: cargo-bins/cargo-binstall@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install risc0
run: cargo binstall -y cargo-risczero && cargo risczero install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,34 @@ jobs:
toolchain: stable
override: true
components: llvm-tools-preview
- uses: cargo-bins/cargo-binstall@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install risc0
run: cargo binstall -y cargo-risczero && cargo risczero install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/cargo@v1
with:
command: build
args: --all --no-default-features --features libp2p
- uses: actions-rs/cargo@v1
run: |
mkdir bcp
cp ./target/debug/{nomos-cli, nomos-node, rocks} bcp/
cargo clean
mkdir -p target/debug
cp bcp/* ./target/debug/
- uses: actions-rs/cargo@v1
continue-on-error: true
- run: |
cargo install grcov;
cargo binstall -y grcov;
cargo test --no-default-features --features libp2p
mkdir /tmp/cov;
grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o /tmp/cov/tests.lcov;
env:
SLOW_TEST_ENV: true
RISC0_DEV_MODE: true
- uses: actions/upload-artifact@v3
if: failure()
with:
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ members = [
"consensus/cryptarchia-engine",
"ledger/cryptarchia-ledger",
"cl/cl",
"proof_of_leadership/proof_statements",
"tests",
]
exclude = ["proof_of_leadership/risc0/risc0_proofs"]
Expand Down
14 changes: 12 additions & 2 deletions ledger/cryptarchia-ledger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,20 @@ blake2 = "0.10"
rpds = "1"
thiserror = "1"
serde = { version = "1.0", features = ["derive"], optional = true }
serde_test = "1.0.176"
# TODO: we only need types definition from this crate
cryptarchia-engine = { path = "../../consensus/cryptarchia-engine" }
cl = { path = "../../cl/cl" }
risc0-zkvm = { version = "1.0", optional = true }
leader_proof_statements = { path = "../../proof_of_leadership/proof_statements" }
nomos_pol_risc0_proofs = { path = "../../proof_of_leadership/risc0/risc0_proofs", optional = true }
nomos_pol_prover = { path = "../../proof_of_leadership/risc0/prover", optional = true }
rand = "0.8.5"
rand_core = "0.6.0"
sha2 = "0.10"

nomos-utils = { path = "../../nomos-utils", optional = true }

[features]
serde = ["dep:serde", "nomos-utils/serde", "rpds/serde"]
serde = ["dep:serde", "nomos-utils/serde", "rpds/serde"]
risc0_proof = ["risc0-zkvm", "nomos_pol_risc0_proofs"]
prove = ["nomos_pol_prover"]
162 changes: 0 additions & 162 deletions ledger/cryptarchia-ledger/src/coin.rs

This file was deleted.

Loading

0 comments on commit f2dfd46

Please sign in to comment.