Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ and this project adheres to Rust's notion of

## [Unreleased]

### Added
- `orchard::constants::{OrchardBaseFieldBases, OrchardShortScalarBases}`
enums adding `SpendAuthG` as a supported fixed-base generator for
base-field scalar multiplication (`SpendAuthGBase`) and short-scalar
multiplication (`SpendAuthGShort`). Both are marked `#[non_exhaustive]`.
`orchard::constants::OrchardFixedBases` now uses
`Base(OrchardBaseFieldBases)` and `Short(OrchardShortScalarBases)`
wrapping variants in place of the previous `NullifierK` and `ValueCommitV`
variants; existing `From<NullifierK>` and `From<ValueCommitV>` conversions
continue to route correctly. Reachable externally only under the
`unstable-voting-circuits` feature.
- `orchard::value::NoteValue::ZERO`, a `const NoteValue` equal to zero.
Replaces the previous crate-private `NoteValue::zero()` constructor at all
internal call sites, and is now exposed to downstream consumers.

## [0.13.0] - 2026-04-22

### Added
Expand Down
8 changes: 4 additions & 4 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ impl SpendInfo {
}

fn has_matching_anchor(&self, anchor: &Anchor) -> bool {
if self.note.value() == NoteValue::zero() {
if self.note.value() == NoteValue::ZERO {
true
} else {
let cm = self.note.commitment();
Expand Down Expand Up @@ -360,7 +360,7 @@ impl OutputInfo {
let fvk: FullViewingKey = (&SpendingKey::random(rng)).into();
let recipient = fvk.address_at(0u32, Scope::External);

Self::new(None, recipient, NoteValue::zero(), [0u8; 512])
Self::new(None, recipient, NoteValue::ZERO, [0u8; 512])
}

/// Builds the output half of an action.
Expand Down Expand Up @@ -639,11 +639,11 @@ impl Builder {
let value_balance = self
.spends
.iter()
.map(|spend| spend.note.value() - NoteValue::zero())
.map(|spend| spend.note.value() - NoteValue::ZERO)
.chain(
self.outputs
.iter()
.map(|output| NoteValue::zero() - output.value),
.map(|output| NoteValue::ZERO - output.value),
)
.try_fold(ValueSum::zero(), |acc, note_value| acc + note_value)
.ok_or(BalanceError::Overflow)?;
Expand Down
8 changes: 4 additions & 4 deletions src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,14 +557,14 @@ pub mod testing {
let spend_value_gen = if flags.spends_enabled {
Strategy::boxed(arb_note_value_bounded(MAX_NOTE_VALUE / n_actions as u64))
} else {
Strategy::boxed(Just(NoteValue::zero()))
Strategy::boxed(Just(NoteValue::ZERO))
};

spend_value_gen.prop_flat_map(move |spend_value| {
let output_value_gen = if flags.outputs_enabled {
Strategy::boxed(arb_note_value_bounded(MAX_NOTE_VALUE / n_actions as u64))
} else {
Strategy::boxed(Just(NoteValue::zero()))
Strategy::boxed(Just(NoteValue::ZERO))
};

output_value_gen.prop_flat_map(move |output_value| {
Expand All @@ -582,14 +582,14 @@ pub mod testing {
let spend_value_gen = if flags.spends_enabled {
Strategy::boxed(arb_note_value_bounded(MAX_NOTE_VALUE / n_actions as u64))
} else {
Strategy::boxed(Just(NoteValue::zero()))
Strategy::boxed(Just(NoteValue::ZERO))
};

spend_value_gen.prop_flat_map(move |spend_value| {
let output_value_gen = if flags.outputs_enabled {
Strategy::boxed(arb_note_value_bounded(MAX_NOTE_VALUE / n_actions as u64))
} else {
Strategy::boxed(Just(NoteValue::zero()))
Strategy::boxed(Just(NoteValue::ZERO))
};

output_value_gen.prop_flat_map(move |output_value| {
Expand Down
5 changes: 2 additions & 3 deletions src/circuit/gadget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ pub(in crate::circuit) fn value_commit_orchard<
) -> Result<Point<pallas::Affine, EccChip>, plonk::Error> {
// commitment = [v] ValueCommitV
let (commitment, _) = {
let value_commit_v = ValueCommitV;
let value_commit_v = FixedPointShort::from_inner(ecc_chip.clone(), value_commit_v);
let value_commit_v = FixedPointShort::from_inner(ecc_chip.clone(), ValueCommitV.into());
value_commit_v.mul(layouter.namespace(|| "[v] ValueCommitV"), v)?
};

Expand Down Expand Up @@ -193,7 +192,7 @@ pub(in crate::circuit) fn derive_nullifier<
// `product` = [poseidon_hash(nk, rho) + psi] NullifierK.
//
let product = {
let nullifier_k = FixedPointBaseField::from_inner(ecc_chip, NullifierK);
let nullifier_k = FixedPointBaseField::from_inner(ecc_chip, NullifierK.into());
nullifier_k.mul(
layouter.namespace(|| "[poseidon_output + psi] NullifierK"),
scalar,
Expand Down
2 changes: 2 additions & 0 deletions src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ pub mod util;
pub use self::sinsemilla::{OrchardCommitDomains, OrchardHashDomains};
#[cfg(feature = "circuit")]
pub use fixed_bases::{NullifierK, OrchardFixedBases, OrchardFixedBasesFull, ValueCommitV};
#[cfg(all(feature = "circuit", feature = "unstable-voting-circuits"))]
pub use fixed_bases::{OrchardBaseFieldBases, OrchardShortScalarBases};

/// $\mathsf{MerkleDepth^{Orchard}}$
pub const MERKLE_DEPTH_ORCHARD: usize = 32;
Expand Down
Loading
Loading