Skip to content

Commit

Permalink
fix: drop unnecessary double hashing in keys (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
Farhad-Shabani authored Jan 14, 2025
1 parent e64a8ec commit 06cb758
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cairo-contracts/packages/apps/src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub mod transfer {

/// The poseidon hash of the transfer port id.
pub const TRANSFER_PORT_ID_HASH: felt252 =
506076466176013583354797631368330115868609515147080483618120063858966368900;
2995820167282656942975737886806038093312338834792943615550274240157014157818;

pub fn TRANSFER_PORT_ID() -> starknet_ibc_core::host::PortId {
starknet_ibc_core::host::PortId { port_id: "transfer" }
Expand Down
5 changes: 2 additions & 3 deletions cairo-contracts/packages/utils/src/utils.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use core::hash::HashStateTrait;
use core::poseidon::{PoseidonTrait, poseidon_hash_span};
use core::poseidon::poseidon_hash_span;

pub trait ValidateBasic<T> {
fn validate_basic(self: @T);
Expand Down Expand Up @@ -33,7 +32,7 @@ pub impl LocalKeyBuilderImpl of LocalKeyBuilderTrait {
}

fn key(self: @LocalKeyBuilder) -> felt252 {
PoseidonTrait::new().update(poseidon_hash_span(self.data.span())).finalize()
poseidon_hash_span(self.data.span())
}
}

Expand Down

0 comments on commit 06cb758

Please sign in to comment.