Skip to content

Commit

Permalink
Merge pull request #8 from m-kus/fix/poseidon-hash-pair
Browse files Browse the repository at this point in the history
Use optimal poseidon hash impl for two elements
  • Loading branch information
Davidson-Souza authored Dec 17, 2024
2 parents 115fb5f + 4bde819 commit 5547292
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/udata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ pub mod shinigami_udata {
use bitcoin::Txid;
use rustreexo::accumulator::node_hash::AccumulatorHash;
use serde::Serialize;
use starknet_crypto::poseidon_hash;
use starknet_crypto::poseidon_hash_many;
use starknet_crypto::Felt;

Expand Down Expand Up @@ -511,7 +512,7 @@ pub mod shinigami_udata {
// **both** children are not empty.
fn parent_hash(left: &Self, right: &Self) -> Self {
if let (PoseidonHash::Hash(left), PoseidonHash::Hash(right)) = (left, right) {
return PoseidonHash::Hash(poseidon_hash_many(&[*left, *right]));
return PoseidonHash::Hash(poseidon_hash(left, right));
}

// This should never happen, since rustreexo won't call this method unless both children
Expand Down

0 comments on commit 5547292

Please sign in to comment.