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
10 changes: 6 additions & 4 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,13 @@ impl Builder {
.cloned()
.unwrap();

// TODO: uncomment once the circuit is ready.
// use the first spend to create split spend(s) or create a dummy if empty.
let dummy_spend = spends.first().map_or_else(
|| SpendInfo::dummy(note_type, &mut rng),
|s| s.create_split_spend(),
);
// let dummy_spend = spends.first().map_or_else(
// || SpendInfo::dummy(note_type, &mut rng),
// |s| s.create_split_spend(),
// );
let dummy_spend = SpendInfo::dummy(note_type, &mut rng);

// Extend the spends and recipients with dummy values.
spends.extend(iter::repeat_with(|| dummy_spend.clone()).take(num_actions - num_spends));
Expand Down
10 changes: 6 additions & 4 deletions tests/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ use orchard::{
use rand::rngs::OsRng;
use zcash_note_encryption::try_note_decryption;

pub fn verify_bundle(bundle: &Bundle<Authorized, i64>, _vk: &VerifyingKey) {
// TODO uncomment when circuit can work with split flag - assert!(matches!(bundle.verify_proof(vk), Ok(())));
pub fn verify_bundle(bundle: &Bundle<Authorized, i64>, vk: &VerifyingKey, verify_proof: bool) {
if verify_proof {
assert!(matches!(bundle.verify_proof(vk), Ok(())));
}
let sighash: [u8; 32] = bundle.commitment().into();
let bvk = bundle.binding_validating_key();
for action in bundle.actions() {
Expand Down Expand Up @@ -78,7 +80,7 @@ fn bundle_chain() {
};

// Verify the shielding bundle.
verify_bundle(&shielding_bundle, &vk);
verify_bundle(&shielding_bundle, &vk, true);

// Create a shielded bundle spending the previous output.
let shielded_bundle: Bundle<_, i64> = {
Expand Down Expand Up @@ -115,5 +117,5 @@ fn bundle_chain() {
};

// Verify the shielded bundle.
verify_bundle(&shielded_bundle, &vk);
verify_bundle(&shielded_bundle, &vk, true);
}
4 changes: 2 additions & 2 deletions tests/zsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ fn build_and_verify_bundle(
build_and_sign_bundle(builder, rng, keys.pk(), keys.sk())
};

// Verify the shielded bundle
verify_bundle(&shielded_bundle, &keys.vk);
// Verify the shielded bundle, currently without the proof.
verify_bundle(&shielded_bundle, &keys.vk, false);
assert_eq!(shielded_bundle.actions().len(), expected_num_actions);
}

Expand Down