Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing the Issuance Authorization Signature to the BIP 340 Schnorr scheme #93

Merged
merged 39 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
619250d
edit the IssuanceAuthorizingKey::random function to work with the sch…
vivek-arte Nov 6, 2023
c267adb
changing sign function to take schnorr signature
vivek-arte Nov 6, 2023
f7aacfb
making most of the other schnorr signature changes across the code
vivek-arte Nov 7, 2023
6905340
some further changes, start on the tests, attempts with CryptoRngCore…
vivek-arte Nov 12, 2023
9ec7524
fix the tests and the fmt/clippy issues
vivek-arte Nov 13, 2023
7ab170c
ignoring the test vector tests for now, some other improvements
vivek-arte Nov 14, 2023
f06c862
removing unnecessary crypto_bigint dependency
vivek-arte Nov 16, 2023
8a998de
fmt fixes
vivek-arte Nov 16, 2023
7aa7fb7
rewriting random function more appropriately
vivek-arte Nov 17, 2023
2c3d124
refactored to move the PartialEq code for issuance::Error into the te…
vivek-arte Nov 18, 2023
1a7eec5
Further improvements
vivek-arte Nov 20, 2023
81030ec
fixing fmt and clippy issues
vivek-arte Nov 20, 2023
3a13074
updating the test vectors for keys -- this changes many entries since…
vivek-arte Nov 27, 2023
2c0703b
updating the project to not ignore the keys test vectors test
vivek-arte Nov 27, 2023
59f37af
updating the test vectors for asset base -- this changes many entries…
vivek-arte Nov 27, 2023
d770862
refactoring to switch asset_id usages to asset_base where necessary (…
vivek-arte Nov 27, 2023
dd9150f
make changes based on review
vivek-arte Dec 18, 2023
77126df
correction to returned Error value
vivek-arte Dec 21, 2023
5227198
printing the signature output to console
vivek-arte Dec 21, 2023
1d49910
improving readability and fixing documentation
vivek-arte Dec 21, 2023
654f9ba
Merge branch 'zsa1' into switch_issueauthsig_to_schnorr
vivek-arte Dec 21, 2023
01cdd24
Merge branch 'zsa1' into switch_issueauthsig_to_schnorr
vivek-arte Dec 26, 2023
56c16b4
removing unnecessary CryptoRngCore dependency
vivek-arte Dec 26, 2023
6661973
remove unnecessary functions, and compact dependencies list
vivek-arte Dec 26, 2023
4690d4a
WIP: switching IssuanceAuthorizingKey to contain NonZeroScalar, and i…
vivek-arte Jan 3, 2024
3e811a4
WIP: updated from_bytes function
vivek-arte Jan 3, 2024
951d281
switching IssuanceAuthorizingKey to contain NonZeroScalar and Issuanc…
vivek-arte Jan 8, 2024
0885f94
adding test vectors for issuance authorization signature testing
vivek-arte Jan 15, 2024
7e44bbb
further changes
vivek-arte Jan 17, 2024
a76a074
add code to specify behaviour in case of short messages input to issu…
vivek-arte Jan 22, 2024
f9023ed
updates based on review comments
vivek-arte Jan 26, 2024
a93ddfd
updating to use sign_prehash and updating the vectors accordingly
vivek-arte Jan 30, 2024
c1908db
pinning half dependency to allow CI to build
vivek-arte Jan 30, 2024
adc7ec8
further pinning and correction
vivek-arte Jan 30, 2024
2eca0b6
adding comments for the pinning, and using PrehashSigner instead of t…
vivek-arte Jan 31, 2024
246e6d3
fixing comments
vivek-arte Jan 31, 2024
0d20a4b
Updates from review comments
vivek-arte Jan 31, 2024
f03afc2
removing From<SpendingKey> for IssuanceAuthorizingKey, and moving tha…
vivek-arte Jan 31, 2024
242c71f
further edits based on review
vivek-arte Jan 31, 2024
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
9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ group = { version = "0.13", features = ["wnaf-memuse"] }
halo2_gadgets = { git = "https://github.com/QED-it/halo2", branch = "zsa1" }
halo2_proofs = { git = "https://github.com/QED-it/halo2", branch = "zsa1", default-features = false, features = ["batch", "floor-planner-v1-legacy-pdqsort"] }
hex = "0.4"
k256 = { version = "0.13.0", features = ["arithmetic", "schnorr"] }
lazy_static = "1"
memuse = { version = "0.2.1", features = ["nonempty"] }
pasta_curves = "0.5"
Expand All @@ -53,16 +54,18 @@ plotters = { version = "0.3.0", optional = true }

[dev-dependencies]
bridgetree = "0.4"
criterion = "0.4" # 0.5 depends on clap 4 which has MSRV 1.70
criterion = "0.4" #Pinned: 0.5 depends on clap 4 which has MSRV 1.70
halo2_gadgets = { git = "https://github.com/QED-it/halo2", branch = "zsa1", features = ["test-dependencies"] }
hex = "0.4"
proptest = "1.0.0"
zcash_note_encryption_zsa = { package = "zcash_note_encryption", version = "0.4", git = "https://github.com/QED-it/zcash_note_encryption", branch = "zsa1", features = ["pre-zip-212"] }
incrementalmerkletree = { version = "0.5", features = ["test-dependencies"] }
ahash = "=0.8.6" #Pinned: 0.8.7 depends on Rust 1.72
half = "=2.2.1" #Pinned: 2.3.1 requires Rust 1.70

[target.'cfg(unix)'.dev-dependencies]
inferno = "0.11"
clap = "=4.2.0" # Used by inferno. Last version required rust 1.70
inferno = "0.11" #Pinned
clap = "=4.2.0" #Pinned: Used by inferno. Later version requires Rust 1.70
pprof = { version = "0.11", features = ["criterion", "flamegraph"] }

[lib]
Expand Down
6 changes: 3 additions & 3 deletions src/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub(crate) mod testing {

use proptest::prelude::*;

use crate::note::asset_base::testing::arb_asset_id;
use crate::note::asset_base::testing::arb_asset_base;
use crate::{
note::{
commitment::ExtractedNoteCommitment, nullifier::testing::arb_nullifier,
Expand All @@ -147,7 +147,7 @@ pub(crate) mod testing {
nf in arb_nullifier(),
rk in arb_spendauth_verification_key(),
note in arb_note(output_value),
asset in arb_asset_id()
asset in arb_asset_base()
) -> Action<()> {
let cmx = ExtractedNoteCommitment::from(note.commitment());
let cv_net = ValueCommitment::derive(
Expand Down Expand Up @@ -180,7 +180,7 @@ pub(crate) mod testing {
note in arb_note(output_value),
rng_seed in prop::array::uniform32(prop::num::u8::ANY),
fake_sighash in prop::array::uniform32(prop::num::u8::ANY),
asset in arb_asset_id()
asset in arb_asset_base()
) -> Action<redpallas::Signature<SpendAuth>> {
let cmx = ExtractedNoteCommitment::from(note.commitment());
let cv_net = ValueCommitment::derive(
Expand Down
6 changes: 3 additions & 3 deletions src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ pub mod testing {
use super::{Action, Authorization, Authorized, Bundle, Flags};

pub use crate::action::testing::{arb_action, arb_unauthorized_action};
use crate::note::asset_base::testing::arb_zsa_asset_id;
use crate::note::asset_base::testing::arb_zsa_asset_base;
use crate::note::AssetBase;
use crate::value::testing::arb_value_sum;

Expand Down Expand Up @@ -619,10 +619,10 @@ pub mod testing {
/// Create an arbitrary vector of assets to burn.
pub fn arb_asset_to_burn()
(
asset_id in arb_zsa_asset_id(),
asset_base in arb_zsa_asset_base(),
value in arb_value_sum()
) -> (AssetBase, ValueSum) {
(asset_id, value)
(asset_base, value)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/bundle/burn_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ mod tests {
pub fn get_burn_tuple(asset_desc: &str, value: i64) -> (AssetBase, i64) {
use crate::keys::{IssuanceAuthorizingKey, IssuanceValidatingKey};

let isk = IssuanceAuthorizingKey::from_bytes([0u8; 32]).unwrap();
let isk = IssuanceAuthorizingKey::from_bytes([1u8; 32]).unwrap();

(
AssetBase::derive(&IssuanceValidatingKey::from(&isk), asset_desc),
Expand Down
4 changes: 2 additions & 2 deletions src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1486,7 +1486,7 @@ mod tests {
let asset_base = if is_native_asset {
AssetBase::native()
} else {
AssetBase::random(&mut rng)
AssetBase::random()
};

// Create spent_note
Expand Down Expand Up @@ -1578,7 +1578,7 @@ mod tests {
pallas::Point::random(&mut rng).to_affine().to_bytes(),
pallas::Point::random(&mut rng).to_affine().to_bytes(),
NoteValue::from_raw(rng.next_u64()),
AssetBase::random(&mut rng),
AssetBase::random(),
pallas::Base::random(&mut rng),
pallas::Base::random(&mut rng),
NoteCommitTrapdoor(pallas::Scalar::random(&mut rng)),
Expand Down
2 changes: 1 addition & 1 deletion src/circuit/note_commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@
/// ------------------------------------
/// | j | j_0 | j_1 | 1 |
///
/// https://p.z.cash/orchard-0.1:note-commit-decomposition-j?partial

Check warning on line 749 in src/circuit/note_commit.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

this URL is not a hyperlink

Check warning on line 749 in src/circuit/note_commit.rs

View workflow job for this annotation

GitHub Actions / Intra-doc links

this URL is not a hyperlink
#[derive(Clone, Debug)]
struct DecomposeJ {
q_notecommit_j: Selector,
Expand Down Expand Up @@ -2596,7 +2596,7 @@

let two_pow_254 = pallas::Base::from_u128(1 << 127).square();
let mut rng = OsRng;
let random_asset = AssetBase::random(&mut rng);
let random_asset = AssetBase::random();

// Test different values of `ak`, `nk`
let mut circuits = vec![];
Expand Down
2 changes: 1 addition & 1 deletion src/circuit/value_commit_orchard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ mod tests {
let mut circuits = vec![];
let mut instances = vec![];
let native_asset = AssetBase::native();
let random_asset = AssetBase::random(&mut rng);
let random_asset = AssetBase::random();
for split_flag in [false, true] {
for asset in [native_asset, random_asset] {
let v_old = NoteValue::from_raw(rng.next_u64());
Expand Down
Loading
Loading