Skip to content

Commit

Permalink
resolve hash conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
curiecrypt committed Aug 15, 2023
1 parent 6824cbe commit 22972f7
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions mithril-stm/src/stm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ use crate::merkle_tree::{BatchPath, MTLeaf, MerkleTreeCommitmentBatchCompat};
use crate::multi_sig::{Signature, SigningKey, VerificationKey, VerificationKeyPoP};
use blake2::digest::{Digest, FixedOutput};
use rand_core::{CryptoRng, RngCore};
use serde::{Deserialize, Serialize};
use serde::ser::SerializeTuple;
use serde::{Deserialize, Serialize, Serializer};
use std::cmp::Ordering;
use std::collections::{BTreeMap, HashMap, HashSet};
use std::convert::{From, TryFrom, TryInto};
Expand Down Expand Up @@ -217,14 +218,26 @@ pub struct StmAggrVerificationKey<D: Clone + Digest + FixedOutput> {
}

/// Signature with its registered party.
#[derive(Debug, Clone, Serialize, Deserialize, Hash, Eq, PartialEq, Ord, PartialOrd)]
#[derive(Debug, Clone, Hash, Deserialize, Eq, PartialEq, Ord, PartialOrd)]
pub struct StmSigRegParty {
/// Stm signature
pub sig: StmSig,
/// Registered party
pub reg_party: RegParty,
}

impl Serialize for StmSigRegParty {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
let mut tuple = serializer.serialize_tuple(2)?;
tuple.serialize_element(&self.sig)?;
tuple.serialize_element(&self.reg_party)?;
tuple.end()
}
}

/// `StmMultiSig` uses the "concatenation" proving system (as described in Section 4.3 of the original paper.)
/// This means that the aggregated signature contains a vector with all individual signatures.
/// BatchPath is also a part of the aggregate signature which covers path for all signatures.
Expand Down

0 comments on commit 22972f7

Please sign in to comment.