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

add SigningParts getters #433

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ and this project adheres to Rust's notion of
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### added
- Added [Visibility crate](https://crates.io/crates/visibility) to modify
visibility of methods and struct for the `unstable-frost` feature.
- Added `SpendValidatingKey` serialization and deserialization from bytes
visibility under the `unstable-frost` feature
- `orchard::keys::SpendValidatingKey`
- Added `SigningParts::{ak, alpha}` getters under the `unstable-frost` feature

## [0.8.0] - 2024-03-25

Expand Down
12 changes: 12 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ zcash_note_encryption = "0.4"
incrementalmerkletree = "0.5"
zcash_spec = "0.1"
zip32 = "0.1"
visibility = "0.1.0"

# Logging
tracing = "0.1"
Expand All @@ -71,6 +72,7 @@ bench = false

[features]
default = ["multicore"]
unstable-frost = []
multicore = ["halo2_proofs/multicore"]
dev-graph = ["halo2_proofs/dev-graph", "image", "plotters"]
test-dependencies = ["proptest"]
Expand Down
12 changes: 12 additions & 0 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,18 @@ pub struct SigningParts {
alpha: pallas::Scalar,
}

#[cfg(feature = "unstable-frost")]
impl SigningParts {
/// Return the spend validating key for this action.
pub fn ak(&self) -> &SpendValidatingKey {
&self.ak
}
/// Return the randomization for this action.
pub fn alpha(&self) -> pallas::Scalar {
self.alpha
}
}

/// Marker for an unauthorized bundle with no signatures.
#[derive(Clone, Debug)]
pub struct Unauthorized {
Expand Down
5 changes: 5 additions & 0 deletions src/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,17 @@ impl SpendValidatingKey {

/// Converts this spend validating key to its serialized form,
/// I2LEOSP_256(ak).
#[cfg_attr(feature = "unstable-frost", visibility::make(pub))]
pub(crate) fn to_bytes(&self) -> [u8; 32] {
// This is correct because the wrapped point must have ỹ = 0, and
// so the point repr is the same as I2LEOSP of its x-coordinate.
<[u8; 32]>::from(&self.0)
}

/// Attempts to convert these bytes into a spend validating key
/// from its serialized form, I2LEOSP_256(ak). Returns None if
/// it can't be created.
#[cfg_attr(feature = "unstable-frost", visibility::make(pub))]
pub(crate) fn from_bytes(bytes: &[u8]) -> Option<Self> {
<[u8; 32]>::try_from(bytes)
.ok()
Expand Down
Loading