Skip to content

Commit

Permalink
DO NOT MERGE: switch slot derivation to poseidon2 instead of pedersen
Browse files Browse the repository at this point in the history
  • Loading branch information
dbanks12 committed Sep 30, 2024
1 parent ed1e23e commit 48af0f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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<K>(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 {
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/circuits.js/src/hash/map_slot.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { pedersenHash } from '@aztec/foundation/crypto';
import { poseidon2Hash } from '@aztec/foundation/crypto';
import { type Fr } from '@aztec/foundation/fields';

/**
Expand All @@ -14,5 +14,5 @@ export function deriveStorageSlotInMap(
toField: () => Fr;
},
): Fr {
return pedersenHash([mapSlot, key.toField()]);
return poseidon2Hash([mapSlot, key.toField()], 0);
}

0 comments on commit 48af0f5

Please sign in to comment.