Skip to content

Commit

Permalink
Merge branch 'main' into simon/subgroup-check
Browse files Browse the repository at this point in the history
  • Loading branch information
joe committed Aug 11, 2023
2 parents ef4a716 + d130e70 commit b60f95b
Show file tree
Hide file tree
Showing 79 changed files with 15,917 additions and 3,180 deletions.
155 changes: 29 additions & 126 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@ jobs:
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v3
with:
toolchain: 1.56.1
override: true

lfs: true
- name: Checkout LFS objects
run: git lfs checkout
- name: Fetch path to MASP parameters
working-directory: ./masp_proofs
shell: bash
run: echo "MASP_PARAMS=$(cargo run --release --example get-params-path --features directories)" >> $GITHUB_ENV
- name: Cache MASP parameters
id: cache-params
uses: actions/cache@v2
uses: actions/cache@v3.2.4
with:
path: ${{ env.MASP_PARAMS }}
key: ${{ runner.os }}-params
Expand All @@ -33,16 +32,9 @@ jobs:
run: cargo run --release --example download-params --features download-params

- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --verbose --release --all
run: cargo test --all-features --verbose --release --all
- name: Run slow tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --verbose --release --all -- --ignored

run: cargo test --all-features --verbose --release --all -- --ignored
build:
name: Build target ${{ matrix.target }}
runs-on: ubuntu-latest
Expand All @@ -53,17 +45,14 @@ jobs:
- wasm32-wasi

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v3
with:
toolchain: 1.56.1
override: true
lfs: true
- name: Checkout LFS objects
run: git lfs checkout
- name: Add target
run: rustup target add ${{ matrix.target }}
- name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch
- run: cargo fetch
- name: Build masp_proofs for target
working-directory: ./masp_proofs
run: cargo build --verbose --no-default-features --target ${{ matrix.target }}
Expand All @@ -72,35 +61,22 @@ jobs:
bitrot:
name: Bitrot check
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.56.1
override: true
- uses: actions/checkout@v3
# Build benchmarks to prevent bitrot
- name: Build benchmarks
uses: actions-rs/cargo@v1
with:
command: build
args: --all --benches
run: cargo build --all --benches

clippy:
name: Lint #Clippy (1.56.1)
name: Lint #Clippy (MSRV)
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.56.1
components: clippy
override: true
- uses: actions/checkout@v3
- name: Run clippy
uses: actions-rs/clippy-check@v1
with:
name: Clippy (1.56.1)
name: Clippy (MSRV)
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -D warnings

Expand All @@ -110,12 +86,10 @@ jobs:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: beta
components: clippy
override: true
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@beta
id: toolchain
- run: rustup override set ${{steps.toolchain.outputs.name}}
- name: Run Clippy (beta)
uses: actions-rs/clippy-check@v1
continue-on-error: true
Expand All @@ -124,104 +98,33 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -W clippy::all

codecov:
name: Code coverage
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
# Use stable for this to ensure that cargo-tarpaulin can be built.
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install cargo-tarpaulin
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-tarpaulin

- name: Fetch path to MASP parameters
working-directory: ./masp_proofs
shell: bash
run: echo "MASP_PARAMS=$(cargo run --release --example get-params-path --features directories)" >> $GITHUB_ENV
- name: Cache MASP parameters
id: cache-params
uses: actions/cache@v2
with:
path: ${{ env.MASP_PARAMS }}
key: ${{ runner.os }}-params
- name: Fetch MASP parameters
if: steps.cache-params.outputs.cache-hit != 'true'
working-directory: ./masp_proofs
run: cargo run --release --example download-params --features download-params

- name: Generate coverage report
uses: actions-rs/cargo@v1
with:
command: tarpaulin
args: --all-features --release --timeout 600 --out Xml
- name: Upload coverage to Codecov
uses: codecov/[email protected]

doc-links:
name: Intra-doc links
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.56.1
override: true
- name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch

# Ensure intra-documentation links all resolve correctly
# Requires #![deny(intra_doc_link_resolution_failure)] in crates.
- uses: actions/checkout@v3
- run: cargo fetch
# Requires #![deny(rustdoc::broken_intra_doc_links)] in crates.
- name: Check intra-doc links
uses: actions-rs/cargo@v1
with:
command: doc
args: --all --document-private-items
run: cargo doc --all --document-private-items

fmt:
name: Rustfmt
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.56.1
override: true

# cargo fmt does not build the code, and running it in a fresh clone of
# the codebase will fail because the protobuf code has not been generated.
- name: cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: --all

# Ensure all code has been formatted with rustfmt
- run: rustup component add rustfmt
- uses: actions/checkout@v3
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
run: cargo fmt --all -- --check

security:
name: Security - Cargo Audit
runs-on: ubuntu-latest
container:
image: rustlang/rust:nightly
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install cargo-audit
run: cargo install cargo-audit
- name: Cargo Audit
run: cargo audit
run: cargo audit
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[workspace]
members = [
"masp_note_encryption",
"masp_proofs",
"masp_primitives"
]
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ This Rust repository, by itself, is not a complete implementation of the MASP, a

The `masp_proofs` crate contains the modified Spend and Output circuits to support multiple assets.

Much of the code that supports the original Sapling circuits can be shared and reused with the MASP circuits. Therefore, the Zcash code is reused in two ways:

1. Some code can be reused unmodified from `zcash_primitives` and `zcash_proofs` crates from `librustzcash`, which are directly imported from `librustzcash`'s GitHub repository.
2. Code from `zcash_primitives` and `zcash_proofs` that cannot be reused without modifications, or due to Rust import visibility rules, is placed in `masp_primitives` and `masp_proofs`.
Much of the code that supports the original Sapling circuits can be shared and reused with the MASP circuits. Therefore, certain code from `zcash_primitives` and `zcash_proofs` is placed in `masp_primitives` and `masp_proofs`.

New code related to asset types is included in `masp_primitives`.

Expand Down Expand Up @@ -68,7 +65,7 @@ These libraries are currently under development and have not been fully-reviewed

The following audits have been done on the MASP protocol:

* [Inference AG](https://github.com/anoma/namada-audit/blob/main/audits/report-anoma-inference.pdf)
* [Inference AG](https://github.com/anoma/namada/blob/main/audits/report-anoma-inference.pdf)
* [Least Authority](https://leastauthority.com/static/publications/LeastAuthority_Tezos_Foundation_Multi_Asset_Shielded_Pool_Audit_Report.pdf)

In addition, the original Zcash Sapling protocol was audited without the MASP extensions:
Expand Down
1 change: 1 addition & 0 deletions cobertura.xml

Large diffs are not rendered by default.

Empty file added docs/Makefile.uptodate
Empty file.
Binary file added docs/protocol.pdf
Binary file not shown.
2 changes: 2 additions & 0 deletions docs/protocol.ver
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
\toggletrue{issapling}
\renewcommand{\docversion}{Version [\SaplingSpec]}
14 changes: 14 additions & 0 deletions masp_note_encryption/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Changelog
All notable changes to this library will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this library adheres to Rust's notion of
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed
- MSRV is now 1.56.1.

## [0.1.0] - 2021-12-17
Initial release (of `zcash_note_encryption`).
35 changes: 35 additions & 0 deletions masp_note_encryption/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[package]
name = "masp_note_encryption"
description = "Note encryption for MASP transactions"
version = "0.2.0"
authors = [
"Jack Grigg <[email protected]>",
"Kris Nuttycombe <[email protected]>",
"[email protected]"
]
homepage = "https://github.com/anoma/masp"
repository = "https://github.com/anoma/masp"
readme = "README.md"
license = "MIT OR Apache-2.0"
edition = "2021"
categories = ["cryptography::cryptocurrencies"]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
cipher = { version = "0.4", default-features = false }
chacha20 = { version = "0.9", default-features = false }
chacha20poly1305 = { version = "0.10", default-features = false }
rand_core = { version = "0.6", default-features = false }
subtle = { version = "2.3", default-features = false }
borsh = {version = "0.9", features = ["const-generics"]}

[features]
default = ["alloc"]
alloc = []
pre-zip-212 = []

[lib]
bench = false
Loading

0 comments on commit b60f95b

Please sign in to comment.