mirror of https://github.com/zcash/orchard.git
commit
0bc40d8c70
|
@ -14,7 +14,7 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: 1.56.1
|
||||
toolchain: 1.60.0
|
||||
override: true
|
||||
- name: Run tests
|
||||
uses: actions-rs/cargo@v1
|
||||
|
@ -30,7 +30,7 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: 1.56.1
|
||||
toolchain: 1.60.0
|
||||
override: true
|
||||
# Build benchmarks to prevent bitrot
|
||||
- name: Build benchmarks
|
||||
|
@ -46,7 +46,7 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: 1.56.1
|
||||
toolchain: 1.60.0
|
||||
override: true
|
||||
- name: Setup mdBook
|
||||
uses: peaceiris/actions-mdbook@v1
|
||||
|
@ -89,7 +89,7 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: 1.56.1
|
||||
toolchain: 1.60.0
|
||||
override: true
|
||||
- name: cargo fetch
|
||||
uses: actions-rs/cargo@v1
|
||||
|
@ -112,7 +112,7 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: 1.56.1
|
||||
toolchain: 1.60.0
|
||||
override: true
|
||||
- run: rustup component add rustfmt
|
||||
- uses: actions-rs/cargo@v1
|
||||
|
|
|
@ -5,19 +5,19 @@ on: pull_request
|
|||
|
||||
jobs:
|
||||
clippy:
|
||||
name: Clippy (1.56.1)
|
||||
name: Clippy (1.60.0)
|
||||
timeout-minutes: 30
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: 1.56.1
|
||||
toolchain: 1.60.0
|
||||
components: clippy
|
||||
override: true
|
||||
- name: Run Clippy
|
||||
uses: actions-rs/clippy-check@v1
|
||||
with:
|
||||
name: Clippy (1.56.1)
|
||||
name: Clippy (1.60.0)
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
args: --all-features --all-targets -- -D warnings
|
||||
|
|
|
@ -14,6 +14,9 @@ and this project adheres to Rust's notion of
|
|||
- `OutputError`
|
||||
|
||||
### Changed
|
||||
- MSRV is now 1.60.0.
|
||||
- Migrated to `ff 0.13`, `group 0.13`, `pasta_curves 0.5`, `halo2_proofs 0.3`,
|
||||
`reddsa 0.5`.
|
||||
- `orchard::builder`:
|
||||
- `Builder::{add_spend, add_output}` now use concrete error types instead of
|
||||
`&'static str`s.
|
||||
|
|
18
Cargo.toml
18
Cargo.toml
|
@ -9,7 +9,7 @@ authors = [
|
|||
"Kris Nuttycombe <kris@electriccoin.co>",
|
||||
]
|
||||
edition = "2021"
|
||||
rust-version = "1.56.1"
|
||||
rust-version = "1.60"
|
||||
description = "The Orchard shielded transaction protocol"
|
||||
license-file = "LICENSE-BOSL"
|
||||
repository = "https://github.com/zcash/orchard"
|
||||
|
@ -26,18 +26,18 @@ rustdoc-args = ["--cfg", "docsrs", "--html-in-header", "katex-header.html"]
|
|||
aes = "0.7"
|
||||
bitvec = "1"
|
||||
blake2b_simd = "1"
|
||||
ff = "0.12"
|
||||
ff = "0.13"
|
||||
fpe = "0.5"
|
||||
group = { version = "0.12.1", features = ["wnaf-memuse"] }
|
||||
group = { version = "0.13", features = ["wnaf-memuse"] }
|
||||
halo2_gadgets = "0.2"
|
||||
halo2_proofs = "0.2"
|
||||
hex = "0.4"
|
||||
lazy_static = "1"
|
||||
memuse = { version = "0.2.1", features = ["nonempty"] }
|
||||
pasta_curves = "0.4"
|
||||
pasta_curves = "0.5"
|
||||
proptest = { version = "1.0.0", optional = true }
|
||||
rand = "0.8"
|
||||
reddsa = "0.3"
|
||||
reddsa = "0.5"
|
||||
nonempty = "0.7"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
subtle = "2.3"
|
||||
|
@ -48,6 +48,7 @@ incrementalmerkletree = "0.3"
|
|||
tracing = "0.1"
|
||||
|
||||
# Developer tooling dependencies
|
||||
image = { version = ">= 0.24, < 0.24.5", optional = true } # 0.24.5 has MSRV 1.61
|
||||
plotters = { version = "0.3.0", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
|
@ -58,13 +59,14 @@ proptest = "1.0.0"
|
|||
zcash_note_encryption = { version = "0.2", features = ["pre-zip-212"] }
|
||||
|
||||
[target.'cfg(unix)'.dev-dependencies]
|
||||
inferno = ">= 0.11, < 0.11.15"
|
||||
pprof = { version = "0.9", features = ["criterion", "flamegraph"] } # MSRV 1.56
|
||||
|
||||
[lib]
|
||||
bench = false
|
||||
|
||||
[features]
|
||||
dev-graph = ["halo2_proofs/dev-graph", "plotters"]
|
||||
dev-graph = ["halo2_proofs/dev-graph", "image", "plotters"]
|
||||
test-dependencies = ["proptest"]
|
||||
|
||||
[[bench]]
|
||||
|
@ -84,3 +86,7 @@ debug = true
|
|||
|
||||
[profile.bench]
|
||||
debug = true
|
||||
|
||||
[patch.crates-io]
|
||||
halo2_gadgets = { git = "https://github.com/zcash/halo2.git", rev = "35eb268e202d76721abde3d6e50e719ae9140605" }
|
||||
halo2_proofs = { git = "https://github.com/zcash/halo2.git", rev = "35eb268e202d76721abde3d6e50e719ae9140605" }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# orchard [![Crates.io](https://img.shields.io/crates/v/orchard.svg)](https://crates.io/crates/orchard) #
|
||||
|
||||
Requires Rust 1.56.1+.
|
||||
Requires Rust 1.60+.
|
||||
|
||||
## Documentation
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
1.56.1
|
|
@ -0,0 +1,3 @@
|
|||
[toolchain]
|
||||
channel = "1.60.0"
|
||||
components = [ "clippy", "rustfmt" ]
|
|
@ -49,7 +49,7 @@ impl Display for BuildError {
|
|||
use BuildError::*;
|
||||
match self {
|
||||
MissingSignatures => f.write_str("Required signatures were missing during build"),
|
||||
Proof(e) => f.write_str(&format!("Could not create proof: {}", e.to_string())),
|
||||
Proof(e) => f.write_str(&format!("Could not create proof: {}", e)),
|
||||
ValueSum(_) => f.write_str("Overflow occurred during value construction"),
|
||||
InvalidExternalSignature => f.write_str("External signature was invalid"),
|
||||
DuplicateSignature => f.write_str("Signature valid for more than one input"),
|
||||
|
|
|
@ -483,8 +483,9 @@ pub struct BundleAuthorizingCommitment(pub Blake2bHash);
|
|||
#[cfg(any(test, feature = "test-dependencies"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "test-dependencies")))]
|
||||
pub mod testing {
|
||||
use group::ff::FromUniformBytes;
|
||||
use nonempty::NonEmpty;
|
||||
use pasta_curves::{arithmetic::FieldExt, pallas};
|
||||
use pasta_curves::pallas;
|
||||
use rand::{rngs::StdRng, SeedableRng};
|
||||
use reddsa::orchard::SpendAuth;
|
||||
|
||||
|
@ -572,7 +573,7 @@ pub mod testing {
|
|||
// Instead of rejecting out-of-range bytes, let's reduce them.
|
||||
let mut buf = [0; 64];
|
||||
buf[..32].copy_from_slice(&bytes);
|
||||
pallas::Base::from_bytes_wide(&buf)
|
||||
pallas::Base::from_uniform_bytes(&buf)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1055,7 +1055,7 @@ mod tests {
|
|||
let expected_proof_size = {
|
||||
let circuit_cost =
|
||||
halo2_proofs::dev::CircuitCost::<pasta_curves::vesta::Point, _>::measure(
|
||||
K as usize,
|
||||
K,
|
||||
&circuits[0],
|
||||
);
|
||||
assert_eq!(usize::from(circuit_cost.proof_size(1)), 4992);
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
use core::iter;
|
||||
|
||||
use group::ff::{Field, PrimeField};
|
||||
use halo2_proofs::{
|
||||
circuit::{AssignedCell, Layouter, Value},
|
||||
plonk::{Advice, Column, ConstraintSystem, Constraints, Error, Expression, Selector},
|
||||
poly::Rotation,
|
||||
};
|
||||
use pasta_curves::{arithmetic::FieldExt, pallas};
|
||||
use pasta_curves::pallas;
|
||||
|
||||
use crate::constants::{OrchardCommitDomains, OrchardFixedBases, OrchardHashDomains, T_P};
|
||||
use halo2_gadgets::{
|
||||
|
@ -667,7 +668,7 @@ mod tests {
|
|||
fixed_bases::COMMIT_IVK_PERSONALIZATION, OrchardCommitDomains, OrchardFixedBases,
|
||||
OrchardHashDomains, L_ORCHARD_BASE, T_Q,
|
||||
};
|
||||
use group::ff::{Field, PrimeFieldBits};
|
||||
use group::ff::{Field, PrimeField, PrimeFieldBits};
|
||||
use halo2_gadgets::{
|
||||
ecc::{
|
||||
chip::{EccChip, EccConfig},
|
||||
|
@ -684,7 +685,7 @@ mod tests {
|
|||
dev::MockProver,
|
||||
plonk::{Circuit, ConstraintSystem, Error},
|
||||
};
|
||||
use pasta_curves::{arithmetic::FieldExt, pallas};
|
||||
use pasta_curves::pallas;
|
||||
use rand::rngs::OsRng;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -20,7 +20,6 @@ use halo2_gadgets::{
|
|||
sinsemilla::{chip::SinsemillaChip, merkle::chip::MerkleChip},
|
||||
};
|
||||
use halo2_proofs::{
|
||||
arithmetic::FieldExt,
|
||||
circuit::{AssignedCell, Chip, Layouter, Value},
|
||||
plonk::{self, Advice, Assigned, Column},
|
||||
};
|
||||
|
@ -78,7 +77,7 @@ impl super::Config {
|
|||
}
|
||||
|
||||
/// An instruction set for adding two circuit words (field elements).
|
||||
pub(in crate::circuit) trait AddInstruction<F: FieldExt>: Chip<F> {
|
||||
pub(in crate::circuit) trait AddInstruction<F: Field>: Chip<F> {
|
||||
/// Constraints `a + b` and returns the sum.
|
||||
fn add(
|
||||
&self,
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
use core::iter;
|
||||
|
||||
use group::ff::PrimeField;
|
||||
use halo2_proofs::{
|
||||
circuit::{AssignedCell, Layouter, Value},
|
||||
plonk::{Advice, Column, ConstraintSystem, Constraints, Error, Expression, Selector},
|
||||
poly::Rotation,
|
||||
};
|
||||
use pasta_curves::{arithmetic::FieldExt, pallas};
|
||||
use pasta_curves::pallas;
|
||||
|
||||
use crate::{
|
||||
constants::{OrchardCommitDomains, OrchardFixedBases, OrchardHashDomains, T_P},
|
||||
|
@ -2043,10 +2044,7 @@ mod tests {
|
|||
dev::MockProver,
|
||||
plonk::{Circuit, ConstraintSystem, Error},
|
||||
};
|
||||
use pasta_curves::{
|
||||
arithmetic::{CurveAffine, FieldExt},
|
||||
pallas,
|
||||
};
|
||||
use pasta_curves::{arithmetic::CurveAffine, pallas};
|
||||
|
||||
use rand::{rngs::OsRng, RngCore};
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ pub const KEY_DIVERSIFICATION_PERSONALIZATION: &str = "z.cash:Orchard-gd";
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use ff::PrimeField;
|
||||
use pasta_curves::{arithmetic::FieldExt, pallas};
|
||||
use pasta_curves::pallas;
|
||||
|
||||
#[test]
|
||||
// Orchard uses the Pallas base field as its base field.
|
||||
|
|
|
@ -66,8 +66,8 @@ impl Nullifier {
|
|||
#[cfg(any(test, feature = "test-dependencies"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "test-dependencies")))]
|
||||
pub mod testing {
|
||||
use group::Group;
|
||||
use pasta_curves::{arithmetic::FieldExt, pallas};
|
||||
use group::{ff::FromUniformBytes, Group};
|
||||
use pasta_curves::pallas;
|
||||
use proptest::collection::vec;
|
||||
use proptest::prelude::*;
|
||||
|
||||
|
@ -79,7 +79,7 @@ pub mod testing {
|
|||
pub fn arb_nullifier()(
|
||||
bytes in vec(any::<u8>(), 64)
|
||||
) -> Nullifier {
|
||||
let point = pallas::Point::generator() * pallas::Scalar::from_bytes_wide(&<[u8; 64]>::try_from(bytes).unwrap());
|
||||
let point = pallas::Point::generator() * pallas::Scalar::from_uniform_bytes(&<[u8; 64]>::try_from(bytes).unwrap());
|
||||
Nullifier(extract_p(&point))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
use core::iter;
|
||||
use core::ops::Deref;
|
||||
|
||||
use ff::{Field, PrimeField, PrimeFieldBits};
|
||||
use ff::{Field, FromUniformBytes, PrimeField, PrimeFieldBits};
|
||||
use group::{Curve, Group, GroupEncoding, WnafBase, WnafScalar};
|
||||
use halo2_gadgets::{poseidon::primitives as poseidon, sinsemilla::primitives as sinsemilla};
|
||||
use halo2_proofs::arithmetic::{CurveAffine, CurveExt, FieldExt};
|
||||
use halo2_proofs::arithmetic::{CurveAffine, CurveExt};
|
||||
use memuse::DynamicUsage;
|
||||
use pasta_curves::pallas;
|
||||
use subtle::{ConditionallySelectable, CtOption};
|
||||
|
@ -176,7 +176,7 @@ impl PreparedNonZeroScalar {
|
|||
///
|
||||
/// [orchardkeycomponents]: https://zips.z.cash/protocol/nu5.pdf#orchardkeycomponents
|
||||
pub(crate) fn to_base(x: [u8; 64]) -> pallas::Base {
|
||||
pallas::Base::from_bytes_wide(&x)
|
||||
pallas::Base::from_uniform_bytes(&x)
|
||||
}
|
||||
|
||||
/// $\mathsf{ToScalar}^\mathsf{Orchard}(x) := LEOS2IP_{\ell_\mathsf{PRFexpand}}(x) (mod r_P)$
|
||||
|
@ -185,7 +185,7 @@ pub(crate) fn to_base(x: [u8; 64]) -> pallas::Base {
|
|||
///
|
||||
/// [orchardkeycomponents]: https://zips.z.cash/protocol/nu5.pdf#orchardkeycomponents
|
||||
pub(crate) fn to_scalar(x: [u8; 64]) -> pallas::Scalar {
|
||||
pallas::Scalar::from_bytes_wide(&x)
|
||||
pallas::Scalar::from_uniform_bytes(&x)
|
||||
}
|
||||
|
||||
/// Converts from pallas::Base to pallas::Scalar (aka $x \pmod{r_\mathbb{P}}$).
|
||||
|
|
|
@ -361,7 +361,8 @@ impl ValueCommitment {
|
|||
#[cfg(any(test, feature = "test-dependencies"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "test-dependencies")))]
|
||||
pub mod testing {
|
||||
use pasta_curves::{arithmetic::FieldExt, pallas};
|
||||
use group::ff::FromUniformBytes;
|
||||
use pasta_curves::pallas;
|
||||
use proptest::prelude::*;
|
||||
|
||||
use super::{NoteValue, ValueCommitTrapdoor, ValueSum, MAX_NOTE_VALUE, VALUE_SUM_RANGE};
|
||||
|
@ -372,7 +373,7 @@ pub mod testing {
|
|||
// Instead of rejecting out-of-range bytes, let's reduce them.
|
||||
let mut buf = [0; 64];
|
||||
buf[..32].copy_from_slice(&bytes);
|
||||
pallas::Scalar::from_bytes_wide(&buf)
|
||||
pallas::Scalar::from_uniform_bytes(&buf)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue