Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
Make some functions const (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashtare authored Apr 19, 2024
1 parent 134b5cd commit 49da955
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl_serialization_traits!(DiffieHellmanPublicKey<CipherSuite>);

impl<C: CipherSuite> DiffieHellmanPublicKey<C> {
/// Instantiates a new [`DiffieHellmanPublicKey`] key.
pub fn new(key: C::G) -> Self {
pub const fn new(key: C::G) -> Self {
Self {
key,
_phantom: PhantomData,
Expand Down Expand Up @@ -204,7 +204,7 @@ impl<C: CipherSuite> IndividualSigningKey<C> {
/// This can be useful for single parties owning a public key for
/// Schnorr signatures outside of an ICE-FROST context and who would
/// like to reshare its corresponding secret key to a set of participants.
pub fn from_single_key(key: <C::G as Group>::ScalarField) -> Self {
pub const fn from_single_key(key: <C::G as Group>::ScalarField) -> Self {
Self { index: 1, key }
}

Expand Down Expand Up @@ -236,7 +236,7 @@ impl_serialization_traits!(GroupVerifyingKey<CipherSuite>);

impl<C: CipherSuite> GroupVerifyingKey<C> {
/// Instantiates a new [`GroupVerifyingKey`] key.
pub fn new(key: C::G) -> Self {
pub const fn new(key: C::G) -> Self {
Self {
key,
_phantom: PhantomData,
Expand Down
2 changes: 1 addition & 1 deletion src/sign/precomputation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl<C: CipherSuite> PartialEq for CommitmentShare<C> {

impl<C: CipherSuite> CommitmentShare<C> {
/// Publish the public commitments in this [`CommitmentShare`].
pub fn publish(&self) -> (C::G, C::G) {
pub const fn publish(&self) -> (C::G, C::G) {
(self.hiding.commit, self.binding.commit)
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/sign/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl_serialization_traits!(ThresholdSignature<CipherSuite>);
struct BindingFactors<C: CipherSuite>(pub(crate) BTreeMap<u32, Scalar<C>>);

impl<C: CipherSuite> BindingFactors<C> {
pub fn new() -> Self {
pub const fn new() -> Self {
Self(BTreeMap::new())
}
}
Expand All @@ -103,7 +103,7 @@ impl<C: CipherSuite> DerefMut for BindingFactors<C> {
pub(crate) struct PartialThresholdSignatures<C: CipherSuite>(pub(crate) BTreeMap<u32, Scalar<C>>);

impl<C: CipherSuite> PartialThresholdSignatures<C> {
pub fn new() -> Self {
pub const fn new() -> Self {
Self(BTreeMap::new())
}
}
Expand All @@ -128,7 +128,7 @@ impl<C: CipherSuite> DerefMut for PartialThresholdSignatures<C> {
pub(crate) struct IndividualPublicKeys<C: CipherSuite>(pub(crate) BTreeMap<u32, C::G>);

impl<C: CipherSuite> IndividualPublicKeys<C> {
pub fn new() -> Self {
pub const fn new() -> Self {
Self(BTreeMap::new())
}
}
Expand Down

0 comments on commit 49da955

Please sign in to comment.