Skip to content

Commit

Permalink
node-data: change Fault hash algo to SHA3
Browse files Browse the repository at this point in the history
Resolves #2081
  • Loading branch information
herr-seppia committed Aug 9, 2024
1 parent 904ca44 commit 28dbc2a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion node-data/src/ledger/faults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl Fault {
pub fn hash(&self) -> [u8; 32] {
let mut b = vec![];
self.write(&mut b).expect("Write to a vec shall not fail");
BlsScalar::hash_to_scalar(&b[..]).to_bytes()
sha3::Sha3_256::digest(&b[..]).into()
}

pub fn same(&self, other: &Fault) -> bool {
Expand Down
4 changes: 1 addition & 3 deletions node-data/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ pub mod message;

use std::io::{self, Read, Write};

use ledger::Hash;

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum StepName {
Proposal = 0,
Expand Down Expand Up @@ -77,7 +75,7 @@ pub trait Serializable {
}
}

impl Serializable for Hash {
impl<const N: usize> Serializable for [u8; N] {
fn write<W: Write>(&self, w: &mut W) -> io::Result<()> {
w.write_all(&self[..])
}
Expand Down

0 comments on commit 28dbc2a

Please sign in to comment.