From 20447bc25975bf975dac632870c148fef934f18f Mon Sep 17 00:00:00 2001 From: dbanks12 Date: Wed, 25 Sep 2024 21:13:21 +0000 Subject: [PATCH] DO NOT MERGE: switch slot derivation to poseidon2 instead of pedersen --- .../noir-protocol-circuits/crates/types/src/storage/map.nr | 4 ++-- yarn-project/circuits.js/src/hash/map_slot.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/storage/map.nr b/noir-projects/noir-protocol-circuits/crates/types/src/storage/map.nr index 13a82bc58b58..33b7c4443eda 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/storage/map.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/storage/map.nr @@ -1,7 +1,7 @@ -use crate::{hash::pedersen_hash, traits::ToField}; +use crate::{hash::poseidon2_hash, traits::ToField}; pub fn derive_storage_slot_in_map(storage_slot: Field, key: K) -> Field where K: ToField { - pedersen_hash([storage_slot, key.to_field()], 0) + poseidon2_hash([storage_slot, key.to_field()]) } mod test { diff --git a/yarn-project/circuits.js/src/hash/map_slot.ts b/yarn-project/circuits.js/src/hash/map_slot.ts index d14b85b0ea9f..8ffed794039d 100644 --- a/yarn-project/circuits.js/src/hash/map_slot.ts +++ b/yarn-project/circuits.js/src/hash/map_slot.ts @@ -1,4 +1,4 @@ -import { pedersenHash } from '@aztec/foundation/crypto'; +import { poseidon2Hash } from '@aztec/foundation/crypto'; import { type Fr } from '@aztec/foundation/fields'; /** @@ -14,5 +14,5 @@ export function deriveStorageSlotInMap( toField: () => Fr; }, ): Fr { - return pedersenHash([mapSlot, key.toField()]); + return poseidon2Hash([mapSlot, key.toField()]); }