Skip to content

Rename sk_iss to imk, the IssuanceKey struct to IssuanceMasterKey, and move to a two key structure#92

Merged
vivek-arte merged 11 commits intozsa1from
rename_to_imk_and_IssuanceMasterKey
Nov 7, 2023
Merged

Rename sk_iss to imk, the IssuanceKey struct to IssuanceMasterKey, and move to a two key structure#92
vivek-arte merged 11 commits intozsa1from
rename_to_imk_and_IssuanceMasterKey

Conversation

@vivek-arte
Copy link

@vivek-arte vivek-arte commented Oct 25, 2023

This PR performs a consistent renaming of the issuance master key to make it consistent with the ZIP.
It also removes the IssuanceAuthorizingKey struct as part of using a two key structure for issuance, as specified in ZIP 227.

@what-the-diff
Copy link

what-the-diff bot commented Oct 25, 2023

PR Summary

  • Renaming and Usage Updates of Key Terms
    • The term IssuanceKey has been renamed to IssuanceMasterKey across multiple source files for improve its representation. This is for better clarity and consistency in the codebase.
    • Alongside renaming, all its usages across the files have been updated to reflect the new term.
  • Change in Key Concept for Determinism
    • In src/bundle/burn_validation.rs, IssuanceMasterKey replaced the old IssuanceKey to introduce more determinism.
  • Change in Key Concept for Randomness
    • Similarly in src/issuance.rs, IssuanceMasterKey has been used instead of IssuanceKey to include more randomness.

The changes aim to improve determinism and randomness in various functions, thereby optimizing the algorithm performance.

Copy link
Collaborator

@PaulLaux PaulLaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Pr seems inconsistent with our current spec and with the previous version of the zips.

We have two options here:

  • Align the number of issuance key components to two. With redpalas as the underling curve. There is no IssuanceAuthorizingKey in the zip, isn't it?
  • Redact this PR and merge as part of your bigger PR.

I prefer the first option since we need the external interface as fast as possible.

let sk_iss = IssuanceKey::from_bytes([0u8; 32]).unwrap();
let isk: IssuanceAuthorizingKey = (&sk_iss).into();
let imk = IssuanceMasterKey::from_bytes([0u8; 32]).unwrap();
let isk: IssuanceAuthorizingKey = (&imk).into();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have no isk in the spec. We need to have only two components: imk and ik.
This PR should reflect it.

src/issuance.rs Outdated
let incorrect_sk_iss = IssuanceKey::random(&mut rng);
let incorrect_isk: IssuanceAuthorizingKey = (&incorrect_sk_iss).into();
let incorrect_imk = IssuanceMasterKey::random(&mut rng);
let incorrect_isk: IssuanceAuthorizingKey = (&incorrect_imk).into();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems inconsistent. In the zip we have imk -> ik.

src/keys.rs Outdated
/// [orchardkeycomponents]: https://zips.z.cash/protocol/nu5.pdf#orchardkeycomponents
#[derive(Debug, Copy, Clone)]
pub struct IssuanceKey([u8; 32]);
pub struct IssuanceMasterKey([u8; 32]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the documentation should point to our version of the spec with the write paragraph link.

Copy link
Collaborator

@PaulLaux PaulLaux Oct 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure that all newly added key components are properly documented.

@vivek-arte vivek-arte changed the title Rename sk_iss to imk and the IssuanceKey struct to IssuanceMasterKey Rename sk_iss to imk, the IssuanceKey struct to IssuanceMasterKey, and move to a two key structure Oct 31, 2023
src/keys.rs Outdated
Comment on lines 263 to 266
/// Checks whether the Orchard-ZSA issuance key is valid //TODO: What are the criteria?
pub fn is_valid(self) -> Choice {
1u8.into()
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's remove is_valid() and use CtOption::new(isk, true.into())

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

@vivek-arte vivek-arte merged commit f38d6b9 into zsa1 Nov 7, 2023
alexeykoren pushed a commit that referenced this pull request Jan 10, 2024
…izingKey`, and move to a two key structure (#92)

This performs a consistent renaming of the issuance authorizing key to make it consistent with the ZIP.
It also reworks the `IssuanceAuthorizingKey` struct in place of the `IssuanceKey` and `IssuanceAuthorizingKey` structs, as part of using a two key structure for issuance, as specified in ZIP 227.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants