-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Trusted Setup Ceremony Primitives (#238)
* feat: trusted setup client and server * wip: server and message * wip: save point * wip: fix compilation issues * wip: serde * feat: serde * chore: fix comments * feat: server * wip: server * wip: server checkpoint * feat: serde * wip: fix comments * feat: fix comments * chore: fix comments * feat: finish server * wip: client * fix: clean up interfaces and add abstract priority * feat: use macro for dalek byte conversions * wip: client * chore: clean up ceremony size * feat: client * chore: fix clippy errors * chore: fix docs * chore: move AsBytes into macro * chore: fix issues * chore: fix issues * chore: changelog * chore: fix a typo * chore: fix ci issue * chore: fix a ci issue * chore: typo * chore: clean up signature abstraction layers * chore: start restructuring signature/message schemes * chore: fix abstraction layers * fix: remove extra gitignore * feat: priority, participant, record for ppot * chore: nit * chore: fix client * chore: fix `generate_keys` * fix: ci * chore: finalize APIs * fix: address some review comments * Apply suggestions from code review * fix: address comments * chore: update workspace Signed-off-by: Brandon H. Gomes <bhgomes@pm.me> Co-authored-by: Boyuan Feng <bfeng9@wisc.edu> Co-authored-by: Brandon H. Gomes <bhgomes@pm.me> Co-authored-by: Todd Norton <93260651+GhostOfGauss@users.noreply.github.com>
- Loading branch information
1 parent
f511813
commit d653f87
Showing
36 changed files
with
2,503 additions
and
364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright 2019-2022 Manta Network. | ||
// This file is part of manta-rs. | ||
// | ||
// manta-rs is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// manta-rs is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with manta-rs. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
//! Arkworks Canonical Serialize and Deserialize Backend | ||
#[cfg(feature = "serde")] | ||
use { | ||
alloc::vec::Vec, | ||
manta_util::serde::{de, ser, Deserialize, Deserializer, Serialize, Serializer}, | ||
}; | ||
|
||
#[doc(inline)] | ||
pub use ark_serialize::*; | ||
|
||
/// Serializes `data` using the [`CanonicalSerialize`] format with `S` as the [`Serializer`]. | ||
#[cfg(feature = "serde")] | ||
#[cfg_attr(doc_cfg, doc(cfg(feature = "serde")))] | ||
#[inline] | ||
pub fn canonical_serialize<T, S>(data: &T, serializer: S) -> Result<S::Ok, S::Error> | ||
where | ||
T: CanonicalSerialize, | ||
S: Serializer, | ||
{ | ||
let mut bytes = Vec::new(); | ||
data.serialize(&mut bytes).map_err(ser::Error::custom)?; | ||
Serialize::serialize(&bytes, serializer) | ||
} | ||
|
||
/// Deserializes data of type `T` using the [`CanonicalDeserialize`] format with `D` as the | ||
/// [`Deserializer`]. | ||
#[cfg(feature = "serde")] | ||
#[cfg_attr(doc_cfg, doc(cfg(feature = "serde")))] | ||
#[inline] | ||
pub fn canonical_deserialize<'de, D, T>(deserializer: D) -> Result<T, D::Error> | ||
where | ||
D: Deserializer<'de>, | ||
T: CanonicalDeserialize, | ||
{ | ||
let bytes: Vec<u8> = Deserialize::deserialize(deserializer)?; | ||
CanonicalDeserialize::deserialize(bytes.as_slice()).map_err(de::Error::custom) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2019-2022 Manta Network. | ||
// This file is part of manta-rs. | ||
// | ||
// manta-rs is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// manta-rs is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with manta-rs. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
//! Trusted Setup Ceremonies | ||
pub mod participant; | ||
pub mod registry; | ||
pub mod signature; | ||
|
||
#[cfg(all(feature = "bincode", feature = "std"))] | ||
#[cfg_attr(doc_cfg, doc(cfg(all(feature = "bincode", feature = "std"))))] | ||
pub mod util; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright 2019-2022 Manta Network. | ||
// This file is part of manta-rs. | ||
// | ||
// manta-rs is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// manta-rs is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with manta-rs. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
//! Trusted Setup Ceremony Participants | ||
/// Participant | ||
pub trait Participant { | ||
/// Identifier Type | ||
type Identifier; | ||
|
||
/// Verifying Key Type | ||
type VerifyingKey; | ||
|
||
/// Nonce Type | ||
type Nonce; | ||
|
||
/// Returns the [`Identifier`](Self::Identifier) for `self`. | ||
fn id(&self) -> &Self::Identifier; | ||
|
||
/// Returns the [`VerifyingKey`](Self::VerifyingKey) for `self`. | ||
fn verifying_key(&self) -> &Self::VerifyingKey; | ||
|
||
/// Checks if the participant has contributed. | ||
fn has_contributed(&self) -> bool; | ||
|
||
/// Sets contributed. | ||
fn set_contributed(&mut self); | ||
|
||
/// Returns the current nonce for `self`. | ||
fn nonce(&self) -> &Self::Nonce; | ||
|
||
/// Increments the current nonce of `self` by one. | ||
fn increment_nonce(&mut self); | ||
} | ||
|
||
/// Priority | ||
pub trait Priority { | ||
/// Priority Type | ||
type Priority; | ||
|
||
/// Returns the priority level for `self`. | ||
fn priority(&self) -> Self::Priority; | ||
|
||
/// Reduces the priority. | ||
fn reduce_priority(&mut self); | ||
} |
Oops, something went wrong.