Skip to content

Commit

Permalink
chore: added ci and certain miscellaneous updates
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaMasych committed Nov 7, 2024
1 parent 1632f0a commit 3c03c64
Show file tree
Hide file tree
Showing 10 changed files with 329 additions and 37 deletions.
14 changes: 14 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Engineering code of conduct 🤝

### Linter

Use `clippy` to lint your rust code:

```bash
cargo clippy
```

### Documentation

We publish dev docs on every push to `GitBook`.
Check them out at https://distributed-lab.github.io/plonky2-verifier/.
41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "🐛 Bug Report"
description: Create a new ticket for a bug.
title: "🐛 [BUG] - <title>"
labels: ["bug"]
body:
- type: markdown
attributes:
value: "## Thanks for filing this out ❤️!"
- type: textarea
id: description
attributes:
label: "Description"
placeholder: Short and explicit description of your incident...
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: "Reproduction steps"
placeholder: How can we reproduce the issue?
validations:
required: false
- type: dropdown
id: os
attributes:
label: "OS"
description: What is the impacted environment?
multiple: true
options:
- Windows
- Linux
- Mac
validations:
required: false
- type: textarea
id: additional_context
attributes:
label: "Additional context"
placeholder: Provide any additional information.
validations:
required: false
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: true
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "💡 Feature Request"
description: Create a new ticket for a new feature request
title: "💡 [REQUEST] - <title>"
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: "## Thanks for filing this out ❤️!"
- type: textarea
id: summary
attributes:
label: "Summary"
placeholder: Provide a brief explanation of the feature...
validations:
required: true
- type: textarea
id: basic_example
attributes:
label: "Basic Example"
placeholder: Provide a basic example of how the feature would work...
validations:
required: false
- type: textarea
id: additional_context
attributes:
label: "Additional context"
placeholder: Provide any additional information.
validations:
required: false
55 changes: 55 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Deploy Dev Rust Docs to GitHub Pages

on:
push:
paths:
- "**/*.rs" # Any Rust source code files
- Cargo.toml # Cargo.toml file
- Cargo.lock # Cargo.lock file
workflow_dispatch:

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest

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

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Build Rust Documentation
run: |
cargo doc --no-deps --document-private-items
echo "<meta http-equiv=\"refresh\" content=\"0; url=plonky2-verifier\">" > target/doc/index.html
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./target/doc

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

permissions:
pages: write
id-token: write

environment:
name: dev-docs
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
135 changes: 135 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Rust CI

on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:

permissions:
contents: read

env:
CARGO_TERM_COLOR: always

jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache Cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Run cargo check
uses: actions-rs/cargo@v1
continue-on-error: false
with:
command: check

test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache Cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-
- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly

- name: Install Nextest
uses: taiki-e/install-action@v2
with:
tool: nextest

- name: Run Nextest
run: cargo nextest run --all-features

lints:
name: Lints
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache Cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy

- name: Run cargo fmt
uses: actions-rs/cargo@v1
continue-on-error: false
with:
command: fmt
args: --all -- --check

- name: Run cargo clippy
uses: actions-rs/cargo@v1
continue-on-error: false
with:
command: clippy
args: --all-targets --all-features -- -D warnings
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Plonky2 Verifier

[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Rust CI🌌](https://github.com/distributed-lab/plonky2-verifier/actions/workflows/rust.yml/badge.svg)](https://github.com/distributed-lab/plonky2-verifier/actions/workflows/rust.yml)
[![Docs 🌌](https://github.com/distributed-lab/plonky2-verifier/actions/workflows/docs.yml/badge.svg)](https://github.com/distributed-lab/plonky2-verifier/actions/workflows/docs.yml)

> A verifier for [plonky2](https://github.com/0xPolygonZero/plonky2/) proofs.
Expand Down
5 changes: 0 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ impl From<DeserializeError> for VerifyError {

/// Verify the given proof `proof` and public inputs `pubs` using verification key `vk`.
/// Use the given verification key `vk` to verify the proof `proof` against the public inputs `pubs`.
/// Can fail if:
/// - the proof, the pubs or the vk are not deserializable respectively as a `plonky2::plonk::proof::Proof`,
/// a `plonky2::hash::hash_types::RichField + plonky2_field::extension::Extendable`
/// and `plonky2::plonk::circuit_data::VerifierCircuitData`.
/// - the proof is not valid.
pub fn verify<F, C, const D: usize>(
vk: &[u8],
proof: &[u8],
Expand Down
7 changes: 3 additions & 4 deletions tests/artifacts_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ use plonky2::plonk::circuit_data::CircuitConfig;
use plonky2::plonk::config::{GenericConfig, PoseidonGoldilocksConfig};
use plonky2::util::serialization::{DefaultGateSerializer, Write};

/// An example of using Plonky2 to prove a statement of the form
/// "I know the 100th element of the Fibonacci sequence, starting with constants a and b."
/// When a == 0 and b == 1, this is proving knowledge of the 100th (standard) Fibonacci number.
/// This example also serializes the proof, public inputs and vk to files.
/// Fibonacci circuit, taken from plonky2 examples:
/// https://github.com/0xPolygonZero/plonky2/blob/v0.2.3/plonky2/examples/fibonacci.rs
/// Saves proof, public inputs and verification key to artifacts.
pub fn gen_factorial() {
const D: usize = 2;
type C = PoseidonGoldilocksConfig;
Expand Down
Loading

0 comments on commit 3c03c64

Please sign in to comment.