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

Make some functions const #45

Merged
merged 1 commit into from
Apr 19, 2024
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
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
Loading