update payloads rust code

This commit is contained in:
Alfredo Garcia 2021-05-11 09:06:58 -03:00 committed by Deirdre Connolly
parent 8fcbb44908
commit e9ca8ee99e
1 changed files with 32 additions and 38 deletions

View File

@ -85,70 +85,64 @@ Each payload defines a new message:
```rust ```rust
/// Dealer must send this message with initial data to each participant involved. /// Dealer must send this message with initial data to each participant involved.
/// With this, the participant should be able to build a `SharePackage` and use /// With this, the participant should be able to build a `SharePackage` and use
/// the `sign()` function. /// the `sign()` function.
/// `public_key` can be calculated from the `secret_key`. ///
/// Note: `frost::SharePackage.public` can be calculated from `secret_share`.
struct MsgDealerBroadcast { struct MsgDealerBroadcast {
/// The secret key as a frost::Scalar. /// This participant's secret key share: `frost::Share.value`.
secret_key: frost::Scalar, secret_share: frost::Scalar,
/// Commitment for the signer as a single jubjub::AffinePoint. /// Commitment for the signer as a single jubjub::AffinePoint.
commitment: jubjub::AffinePoint, /// A set of commitments to the coefficients (which themselves are scalars)
/// The public signing key that represents the entire group. /// for a secret polynomial _f_: `frost::SharePackage.share.commitment`
group_public: GroupPublic, share_commitment: Vec<jubjub::AffinePoint>,
} /// The public signing key that represents the entire group:
/// `frost::SharePackage.group_public`.
/// The point and verification bytes needed to generate the group public key group_public: jubjub::AffinePoint,
struct GroupPublic {
/// The point
point: jubjub::AffinePoint,
/// The verification bytes
bytes: [u8; 32],
} }
/// Each signer participant send to the aggregator the 2 points /// Each signer participant send to the aggregator the 2 points
/// needed for commitment building. /// needed for commitment building.
struct MsgCommitments { struct MsgCommitments {
/// The commitment the signer is sending. /// A commitment to a single signature by this signer:
commitment: Commitment, /// `frost::SigningPackage.signing_commitments`
signing_commitments: SigningCommitments,
} }
/// A commitment specified by two AffinePoints. /// A signing commitment from the first round of the signing protocol.
struct Commitment { struct SigningCommitments {
/// The hiding Point. /// The hiding point: `frost::SigningCommitments.hiding`
hiding: jubjub::AffinePoint, hiding: jubjub::AffinePoint,
/// The binding Point. /// The binding point: `frost::SigningCommitments.binding`
binding: jubjub::AffinePoint, binding: jubjub::AffinePoint,
} }
/// The aggregator decides what message is going to be signed and /// The aggregator decides what message is going to be signed and
/// sends it to each participant with all the commitments collected. /// sends it to each participant with all the commitments collected.
struct MsgSigningPackage { struct MsgSigningPackage {
/// The collected commitments for each signer as a hashmap of /// The message to be signed: `frost::SigningPackage.message`
/// unique participant identifiers
commitments: HashMap<ParticipantID, Commitment>,
/// The message to be signed as a vector of bytes
message: Vec<u8>, message: Vec<u8>,
/// The collected commitments for each signer as a hashmap of
/// unique participant identifiers: `frost::SigningPackage.signing_commitments`
///
/// Signing packages that contain duplicate or missing `ParticipantID`s are invalid.
signing_commitments: HashMap<ParticipantID, SigningCommitments>,
} }
/// Each signer sends their signatures to the aggregator who is going to collect them /// Each signer sends their signatures to the aggregator who is going to collect them
/// and generate a final spend signature. /// and generate a final spend signature.
struct MsgSignatureShare { struct MsgSignatureShare {
/// The signature to be shared as a Scalar /// This participant's signature over the message:
/// `frost::SignatureShare.signature`
signature: frost::Scalar, signature: frost::Scalar,
} }
/// The final signature is broadcasted by the aggregator /// The final signature is broadcasted by the aggregator to any participant.
/// to any participant.
struct MsgFinalSignature { struct MsgFinalSignature {
/// Bytes needed to build the frost::Signature /// The aggregated group commitment: `Signature<SpendAuth>.r_bytes` returned by `frost::aggregate`
final_signature: FinalSignature, group_commitment: jubjub::AffinePoint,
} /// A plain Schnorr signature created by summing all the signature shares:
/// `Signature<SpendAuth>.s_bytes` returned by `frost::aggregate`
/// Final RedJubJub signature the aggregator has created. schnorr_signature: frost::Scalar,
struct FinalSignature {
///
r_bytes: [u8; 32],
///
s_bytes: [u8; 32],
} }
``` ```