Skip to content

Commit

Permalink
Merge pull request #89 from anoma/tomas/pre-pub
Browse files Browse the repository at this point in the history
prepare to publish on crates.io
  • Loading branch information
tzemanovic authored Jan 13, 2025
2 parents 0d0da35 + 2bcb198 commit 571f123
Show file tree
Hide file tree
Showing 11 changed files with 522 additions and 202 deletions.
672 changes: 497 additions & 175 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ members = [
"masp_primitives"
]


[workspace.package]
version = "1.2.0"

[profile.release]
lto = true
panic = 'abort'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# MASP Rust crates

This repository contains a (work-in-progress) set of Rust crates for
This repository contains a set of Rust crates for
working with the Multi Asset Shielded Pool extensions of the Sapling circuits from Zcash.

## MASP Description
Expand Down
2 changes: 1 addition & 1 deletion masp_note_encryption/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "masp_note_encryption"
description = "Note encryption for MASP transactions"
version = "1.0.0"
version.workspace = true
authors = [
"Jack Grigg <[email protected]>",
"Kris Nuttycombe <[email protected]>",
Expand Down
16 changes: 7 additions & 9 deletions masp_primitives/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "masp_primitives"
description = "Rust implementations of the experimental MASP primitives (derived from zcash_primitives)"
version = "1.0.0"
version.workspace = true
authors = [
"Jack Grigg <[email protected]>",
"Kris Nuttycombe <[email protected]>",
Expand All @@ -21,7 +21,7 @@ categories = ["cryptography::cryptocurrencies"]
all-features = true

[dependencies]
zcash_encoding = { version = "0.2", git = "https://github.com/zcash/librustzcash", rev = "bd7f9d7" }
zcash_encoding = { version = "0.2.2" }

# Dependencies exposed in a public API:
# (Breaking upgrades to these require a breaking upgrade to this crate.)
Expand All @@ -37,20 +37,18 @@ sha2 = "0.10"
memuse = "0.2.1"

# - Checked arithmetic
num-traits = { version = "0.2.19", git = "https://github.com/heliaxdev/num-traits", rev = "3f3657caa34b8e116fdf3f8a3519c4ac29f012fe" }
num-traits = { package = "nam-num-traits", version = "0.2.20-nam.0" }

# - Secret management
subtle = "2.2.3"

# - Shielded protocols
# branch "tomas/arbitrary"
bls12_381 = { git = "https://github.com/heliaxdev/bls12_381.git", rev = "d3ebe9dd6488fac1923db120a7498079e55dd838" }
bls12_381 = { package = "nam-bls12_381", version = "0.8.1-nam.0" }
ff = "0.13"
group = { version = "0.13", features = ["wnaf-memuse"] }
incrementalmerkletree = "0.3"
# branch "tomas/arbitrary"
jubjub = { git = "https://github.com/heliaxdev/jubjub.git", rev = "a373686962f4e9d0edb3b4716f86ff6bbd9aa86c" }
nonempty = "0.7"
jubjub = { package = "nam-jubjub", version = "0.10.1-nam.0" }
nonempty = "0.11"

# - Static constants
lazy_static = "1"
Expand Down Expand Up @@ -85,7 +83,7 @@ features = ["pre-zip-212"]

[dev-dependencies]
chacha20poly1305 = "0.10"
criterion = "0.4"
criterion = "0.5"
proptest = "1.0.0"
assert_matches = "1.3.0"
rand_xorshift = "0.3"
Expand Down
3 changes: 1 addition & 2 deletions masp_primitives/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,7 @@ pub mod testing {
.height_bounds(params)
.map_or(Strategy::boxed(Just(None)), |(lower, upper)| {
Strategy::boxed(
(lower.0..upper.map_or(std::u32::MAX, |u| u.0))
.prop_map(|h| Some(BlockHeight(h))),
(lower.0..upper.map_or(u32::MAX, |u| u.0)).prop_map(|h| Some(BlockHeight(h))),
)
})
}
Expand Down
2 changes: 1 addition & 1 deletion masp_primitives/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ mod tests {
let gh = group_hash(&tag, personalization);

// We don't want to overflow and start reusing generators
assert!(tag[i] != u8::max_value());
assert!(tag[i] != u8::MAX);
tag[i] += 1;

if let Some(gh) = gh {
Expand Down
1 change: 1 addition & 0 deletions masp_primitives/src/test_vectors/note_encryption.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[allow(dead_code)]
pub struct TestVector {
pub ovk: [u8; 32],
pub ivk: [u8; 32],
Expand Down
2 changes: 0 additions & 2 deletions masp_primitives/src/transaction/sighash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ use super::{
};

use crate::asset_type::AssetType;
#[cfg(feature = "zfuture")]
use crate::extensions::transparent::Precondition;

pub const SIGHASH_ALL: u8 = 0x01;
pub const SIGHASH_NONE: u8 = 0x02;
Expand Down
18 changes: 8 additions & 10 deletions masp_proofs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "masp_proofs"
description = "Experimental MASP zk-SNARK circuits and proving APIs, based on zcash_proofs"
version = "1.0.0"
version.workspace = true
authors = ["Jack Grigg <[email protected]>", "joe <[email protected]>"]
homepage = "https://github.com/anoma/masp"
repository = "https://github.com/anoma/masp"
Expand All @@ -20,11 +20,9 @@ masp_primitives = { version = "1.0.0", path = "../masp_primitives" }
# Dependencies exposed in a public API:
# (Breaking upgrades to these require a breaking upgrade to this crate.)
bellman = { version = "0.14", default-features = false, features = ["groth16"] }
# branch "tomas/arbitrary"
bls12_381 = { git = "https://github.com/heliaxdev/bls12_381.git", rev = "d3ebe9dd6488fac1923db120a7498079e55dd838" }
bls12_381 = { package = "nam-bls12_381", version = "0.8.1-nam.0" }
group = "0.13"
# branch "tomas/arbitrary"
jubjub = { git = "https://github.com/heliaxdev/jubjub.git", rev = "a373686962f4e9d0edb3b4716f86ff6bbd9aa86c" }
jubjub = { package = "nam-jubjub", version = "0.10.1-nam.0" }
lazy_static = "1"
minreq = { version = "2.11.0", features = ["https"], optional = true }
rand_core = "0.6"
Expand All @@ -33,19 +31,19 @@ tracing = "0.1"
# Dependencies used internally:
# (Breaking upgrades to these are usually backwards-compatible, but check MSRVs.)
blake2b_simd = "1"
directories = { version = "4", optional = true }
directories = { version = "5.0", optional = true }
# This pulls the reddsa library that contains hardcoded personalizations and basepoints. If you need to work on a new project consider forking `reddsa`, modifying it to your needs and patching it in the root manifest
redjubjub = "0.7"
redjubjub = {package = "nam-redjubjub", version = "0.7.1-nam.0" }
getrandom = { version = "0.2" }
itertools = "0.11"
itertools = "0.14"

[dev-dependencies]
byteorder = "1"
criterion = "0.4"
criterion = "0.5"
rand_xorshift = "0.3"

[target.'cfg(unix)'.dev-dependencies]
pprof = { version = "0.11", features = ["criterion", "flamegraph"] } # MSRV 1.56
pprof = { version = "0.14", features = ["criterion", "flamegraph"] }

[features]
default = ["local-prover", "multicore"]
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.76.0"
channel = "1.81.0"
components = [ "clippy", "rustfmt" ]

0 comments on commit 571f123

Please sign in to comment.