From cf1042c49fda2f9029ef19166bd4b7f980de04ae Mon Sep 17 00:00:00 2001 From: benesjan Date: Mon, 22 Apr 2024 12:13:01 +0000 Subject: [PATCH] chore: nuking unused keys.nr --- .../private_validation_request_processor.nr | 3 +-- .../crates/types/src/keys.nr | 26 ------------------- .../crates/types/src/lib.nr | 1 - 3 files changed, 1 insertion(+), 29 deletions(-) delete mode 100644 noir-projects/noir-protocol-circuits/crates/types/src/keys.nr diff --git a/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/private_validation_request_processor.nr b/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/private_validation_request_processor.nr index 7fc2e3929d7..8cfa430a8a0 100644 --- a/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/private_validation_request_processor.nr +++ b/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/private_validation_request_processor.nr @@ -5,8 +5,7 @@ use dep::types::{ MAX_NEW_NOTE_HASHES_PER_TX, MAX_NEW_NULLIFIERS_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_TX, GENERATOR_INDEX__NSK_M }, - grumpkin_private_key::GrumpkinPrivateKey, keys::compute_siloed_nullifier_secret_key, - hash::poseidon2_hash, traits::is_empty + grumpkin_private_key::GrumpkinPrivateKey, hash::poseidon2_hash, traits::is_empty }; struct PrivateValidationRequestProcessor { diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/keys.nr b/noir-projects/noir-protocol-circuits/crates/types/src/keys.nr deleted file mode 100644 index 0e93ffe7841..00000000000 --- a/noir-projects/noir-protocol-circuits/crates/types/src/keys.nr +++ /dev/null @@ -1,26 +0,0 @@ -use crate::{address::AztecAddress, grumpkin_private_key::GrumpkinPrivateKey, hash::pedersen_hash}; - -fn field_to_grumpkin_private_key(val: Field) -> GrumpkinPrivateKey { - let bytes = val.to_be_bytes(32); - let mut v = 1; - let mut high = 0; - let mut low = 0; - - for i in 0..16 { - high = high + (bytes[15 - i] as Field) * v; - low = low + (bytes[16 + 15 - i] as Field) * v; - v = v * 256; - } - - GrumpkinPrivateKey { high, low } -} - -pub fn compute_siloed_nullifier_secret_key(secret_key: GrumpkinPrivateKey, contract_address: AztecAddress) -> GrumpkinPrivateKey { - // TODO: Temporary hack. Should replace it with a secure way to derive the secret key. - // Match the way keys are derived in circuits.js/src/keys/index.ts - let hash = pedersen_hash( - [secret_key.high, secret_key.low, contract_address.to_field()], - 0 - ); - field_to_grumpkin_private_key(hash) -} diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/lib.nr b/noir-projects/noir-protocol-circuits/crates/types/src/lib.nr index 5e7a03c0f96..5530e831352 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/lib.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/lib.nr @@ -13,7 +13,6 @@ mod constants; mod contract_class_id; mod merkle_tree; mod contract_instance; -mod keys; mod messaging; mod mocked;