Skip to content

Commit d9bfa9f

Browse files
authored
Merge pull request zcash#516 from zcash/feat/ironwood
Add support for the Ironwood shielded pool.
2 parents 82e0739 + fef2b28 commit d9bfa9f

29 files changed

Lines changed: 34615 additions & 775 deletions

CHANGELOG.md

Lines changed: 302 additions & 1 deletion
Large diffs are not rendered by default.

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "orchard"
3-
version = "0.14.0"
3+
version = "0.15.0"
44
authors = [
55
"Sean Bowe <ewillbefull@gmail.com>",
66
"Jack Grigg <thestr4d@gmail.com>",

benches/circuit.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ use pprof::criterion::{Output, PProfProfiler};
88

99
use orchard::{
1010
builder::{Builder, BundleType},
11-
circuit::{ProvingKey, VerifyingKey},
11+
bundle::BundleVersion,
12+
circuit::{OrchardCircuitVersion, ProvingKey, VerifyingKey},
1213
keys::{FullViewingKey, Scope, SpendingKey},
1314
value::NoteValue,
1415
Anchor, Bundle,
@@ -21,11 +22,17 @@ fn criterion_benchmark(c: &mut Criterion) {
2122
let sk = SpendingKey::from_bytes([7; 32]).unwrap();
2223
let recipient = FullViewingKey::from(&sk).address_at(0u32, Scope::External);
2324

24-
let vk = VerifyingKey::build();
25-
let pk = ProvingKey::build();
25+
let vk = VerifyingKey::build(OrchardCircuitVersion::FixedPostNu6_2);
26+
let pk = ProvingKey::build(OrchardCircuitVersion::FixedPostNu6_2);
2627

2728
let create_bundle = |num_recipients| {
28-
let mut builder = Builder::new(BundleType::DEFAULT, Anchor::from_bytes([0; 32]).unwrap());
29+
let mut builder = Builder::new(
30+
BundleType::DEFAULT,
31+
BundleVersion::orchard_v2(),
32+
BundleVersion::orchard_v2().default_flags(),
33+
Anchor::from_bytes([0; 32]).unwrap(),
34+
)
35+
.unwrap();
2936
for _ in 0..num_recipients {
3037
builder
3138
.add_output(None, recipient, NoteValue::from_raw(10), [0; 512])

benches/note_decryption.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
22
use orchard::{
33
builder::{Builder, BundleType},
4-
circuit::ProvingKey,
4+
bundle::BundleVersion,
5+
circuit::{OrchardCircuitVersion, ProvingKey},
56
keys::{FullViewingKey, PreparedIncomingViewingKey, Scope, SpendingKey},
67
note_encryption::{CompactAction, OrchardDomain},
78
value::NoteValue,
@@ -15,7 +16,7 @@ use pprof::criterion::{Output, PProfProfiler};
1516

1617
fn bench_note_decryption(c: &mut Criterion) {
1718
let rng = OsRng;
18-
let pk = ProvingKey::build();
19+
let pk = ProvingKey::build(OrchardCircuitVersion::FixedPostNu6_2);
1920

2021
let fvk = FullViewingKey::from(&SpendingKey::from_bytes([7; 32]).unwrap());
2122
let valid_ivk = fvk.to_ivk(Scope::External);
@@ -44,7 +45,13 @@ fn bench_note_decryption(c: &mut Criterion) {
4445
.collect();
4546

4647
let bundle = {
47-
let mut builder = Builder::new(BundleType::DEFAULT, Anchor::from_bytes([0; 32]).unwrap());
48+
let mut builder = Builder::new(
49+
BundleType::DEFAULT,
50+
BundleVersion::orchard_v2(),
51+
BundleVersion::orchard_v2().default_flags(),
52+
Anchor::from_bytes([0; 32]).unwrap(),
53+
)
54+
.unwrap();
4855
// The builder pads to two actions, and shuffles their order. Add two recipients
4956
// so the first action is always decryptable.
5057
builder

src/action.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ pub(crate) mod testing {
201201
note_encryption::{OrchardDomain, OrchardNoteEncryption},
202202
primitives::redpallas::{self, testing::arb_valid_spendauth_keypair},
203203
value::{NoteValue, ValueCommitTrapdoor, ValueCommitment},
204-
Note,
204+
Note, NoteVersion,
205205
};
206206

207207
use super::Action;
@@ -228,10 +228,10 @@ pub(crate) mod testing {
228228

229229
prop_compose! {
230230
/// Generate an action without authorization data.
231-
pub fn arb_unauthorized_action(spend_value: NoteValue, output_value: NoteValue)(
231+
pub fn arb_unauthorized_action(note_version: NoteVersion, spend_value: NoteValue, output_value: NoteValue)(
232232
nf in arb_nullifier(),
233233
(_, rk) in arb_valid_spendauth_keypair(),
234-
note in arb_note(output_value),
234+
note in arb_note(output_value, note_version),
235235
rng_seed in prop::array::uniform32(prop::num::u8::ANY),
236236
) -> Action<()> {
237237
let cmx = ExtractedNoteCommitment::from(note.commitment());
@@ -254,10 +254,10 @@ pub(crate) mod testing {
254254

255255
prop_compose! {
256256
/// Generate an action with invalid (random) authorization data.
257-
pub fn arb_action(spend_value: NoteValue, output_value: NoteValue)(
257+
pub fn arb_action(note_version: NoteVersion, spend_value: NoteValue, output_value: NoteValue)(
258258
nf in arb_nullifier(),
259259
(rsk, rk) in arb_valid_spendauth_keypair(),
260-
note in arb_note(output_value),
260+
note in arb_note(output_value, note_version),
261261
enc_rng_seed in prop::array::uniform32(prop::num::u8::ANY),
262262
rng_seed in prop::array::uniform32(prop::num::u8::ANY),
263263
fake_sighash in prop::array::uniform32(prop::num::u8::ANY),

src/address.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ impl Address {
4747
&self.pk_d
4848
}
4949

50+
/// Returns whether `self` and `other` correspond to the same expanded receiver, i.e.
51+
/// have equal `(g_d, pk_d)`.
52+
///
53+
/// This matches the equality notion used by the `disableCrossAddress` circuit
54+
/// constraint, and is intentionally distinct from `PartialEq` on `Address`, which
55+
/// compares the raw diversifier encoding.
56+
pub(crate) fn same_expanded_receiver(&self, other: &Self) -> bool {
57+
self.g_d() == other.g_d() && self.pk_d() == other.pk_d()
58+
}
59+
5060
/// Serializes this address to its "raw" encoding as specified in [Zcash Protocol Spec § 5.6.4.2: Orchard Raw Payment Addresses][orchardpaymentaddrencoding]
5161
///
5262
/// [orchardpaymentaddrencoding]: https://zips.z.cash/protocol/protocol.pdf#orchardpaymentaddrencoding

0 commit comments

Comments
 (0)