Skip to content

Commit

Permalink
chore: clean up the repo (#18)
Browse files Browse the repository at this point in the history
* .github ci

* readme updated

* justfile

* fmt

* lints

* move aes circuits -> circuits/aes directory

* fmt settings

* main refactor

* refactor: main -> lib. mv Witness -> witness mod

* mv witness type aliases to crate root

* witness refactor

* witness minor refactor notes

* refactor proof

* just adjust
  • Loading branch information
thor314 authored Aug 6, 2024
1 parent 10c9990 commit 5e3101a
Show file tree
Hide file tree
Showing 40 changed files with 545 additions and 417 deletions.
42 changes: 42 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# These settings are synced to GitHub by https://probot.github.io/apps/settings/
# Requires sign up, and allowing Probot to manage your repos.

repository:
# name:
description: "circom AES-GCM circuits"
private: true
has_issues: true
has_projects: false
has_wiki: false
has_downloads: false
default_branch: main
allow_squash_merge: true
allow_merge_commit: false
allow_rebase_merge: false

# # Labels: define labels for Issues and Pull Requests
# labels:
# - name: bug
# color: CC0000
# - name: feature
# color: 336699
# - name: first-timers-only
# # include the old name to rename and existing label
# oldname: Help Wanted

# # Collaborators: give specific users access to this repository.
# collaborators:
# - username: bkeepers
# # Note: Only valid on organization-owned repositories.
# # The permission to grant the collaborator. Can be one of:
# # * `pull` - can pull, but not push to or administer this repository.
# # * `push` - can pull and push, but not administer this repository.
# # * `admin` - can pull, push and administer this repository.
# permission: push

# - username: hubot
# permission: pull
# - username:
# permission: pull


53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Rust template: https://github.com/actions/starter-workflows/blob/main/ci/rust.yml
# Resources: https://docs.github.com/en/actions
# Examples: https://github.com/actions/starter-workflows
# Process: make small changes, push them, check the Actions tab on github
# also see templates https://github.com/rust-github/template/tree/main/.github/workflows
name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always # pretty colors

jobs:
lint:
name: lint project
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- nightly
steps:
- uses: actions/checkout@v4
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: rustup component add clippy
- run: cargo clippy -- -Dwarnings
# test:
# name: test project
# runs-on: ubuntu-latest
# strategy:
# matrix:
# toolchain:
# - nightly
# steps:
# - uses: actions/checkout@v4
# - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
# - run: cargo test --all-features --verbose

fmt:
name: fmt project
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- nightly
steps:
- uses: actions/checkout@v4
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: rustup component add rustfmt
- run: cargo fmt --all -- --check

47 changes: 47 additions & 0 deletions .justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# A configuration file for `just`, a command runner and successor to `make`
# https://github.com/casey/just/tree/master
#
# examples:
# https://github.com/casey/just/blob/master/examples/pre-commit.just
# https://github.com/casey/just/blob/master/examples/kitchen-sink.just

# ignore comments in the command area
set ignore-comments := true

# load .env vars
# set dotenv-load := true

# set custom env vars
export RUST_LOG := "info"
# export RUST_BACKTRACE := "1"


@just:
just --list

build:
cargo build -r

check:
cargo check --all --tests
cargo fmt --all --check

format:
cargo fmt --all

fix:
cargo clippy --all --tests --fix

lint:
cargo clippy --all --tests -- -D warnings

run:
cargo run -r

test:
RUST_MIN_STACK=8388608 cargo test --all -- --nocapture

@versions:
rustc --version
cargo fmt -- --version
cargo clippy -- --version
43 changes: 43 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Opinionated whitespace and tabs. The most important of these are imports and width settings.
# Others may want to borrow or change these to their own liking.
# https://rust-lang.github.io/rustfmt

# version-related
edition = "2021" # redundant, fmt will read Cargo.toml for editor edition year
unstable_features = true
use_try_shorthand = true # replace any `try!` (2015 Rust) with `?`

# misc formatting
condense_wildcard_suffixes = true # replace: (a,b,_,_)=(1, 2, 3, 4); -> (a,b,..)=(1, 2, 3, 4);
format_code_in_doc_comments = true # format code blocks in doc comments
format_macro_matchers = true # $a: ident -> $a:ident
format_strings = true # break and insert newlines for long string literals
match_block_trailing_comma = true # include comma in match blocks after '}'
normalize_comments = true # convert /*..*/ to //.. where possible
reorder_impl_items = true # move `type` and `const` declarations to top of impl block
struct_field_align_threshold = 20 # align struct arguments' types vertically
use_field_init_shorthand = true # struct initialization short {x: x} -> {x}

# reduce whitespace
blank_lines_upper_bound = 1 # default: 1. Sometimes useful to change to 0 to condense a file.
brace_style = "PreferSameLine" # prefer starting `{` without inserting extra \n
fn_single_line = true # if it's a short 1-liner, let it be a short 1-liner
match_arm_blocks = false # remove unnecessary {} in match arms
newline_style = "Unix" # not auto, we won the culture war. \n over \r\n
overflow_delimited_expr = true # prefer ]); to ]\n);
where_single_line = true # put where on a single line if possible

# imports preferences
group_imports = "StdExternalCrate" # create import groupings for std, external libs, and internal deps
imports_granularity = "Crate" # aggressively group imports

# width settings: everything to 100
comment_width = 100 # default: 80
inline_attribute_width = 60 # inlines #[cfg(test)]\nmod test -> #[cfg(test)] mod test
max_width = 100 # default: 100
use_small_heuristics = "Max" # don't ever newline short of `max_width`.
wrap_comments = true # wrap comments at `comment_width`
# format_strings = true # wrap strings at `max_length`

# tabs and spaces
hard_tabs = false # (def: false) use spaces over tabs
84 changes: 17 additions & 67 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ ark-groth16 = { version = "=0.4.0", default-features = false, features = ["paral
ark-poly = { version = "0.4.1", default-features = false, features = ["parallel"] }
ark-relations = { version = "=0.4.0", default-features = false }
ark-serialize = { version = "0.4.1", default-features = false }
anyhow = "1.0.86"

[profile.release]
lto = true
opt-level = "z"
opt-level = "z"
Loading

0 comments on commit 5e3101a

Please sign in to comment.