diff --git a/l1-contracts/src/core/libraries/ConstantsGen.sol b/l1-contracts/src/core/libraries/ConstantsGen.sol index 4ef594869b0..9e3bc20bb90 100644 --- a/l1-contracts/src/core/libraries/ConstantsGen.sol +++ b/l1-contracts/src/core/libraries/ConstantsGen.sol @@ -128,7 +128,7 @@ library Constants { uint256 internal constant L2_GAS_PER_NOTE_HASH = 32; uint256 internal constant L2_GAS_PER_NULLIFIER = 64; uint256 internal constant CANONICAL_KEY_REGISTRY_ADDRESS = - 21209182303070804160941065409360795406831433542792830301721453026531461944353; + 9694109890306420370616891858093188542026876097103155811681068343994212062621; uint256 internal constant CANONICAL_AUTH_REGISTRY_ADDRESS = 16522644890256297179255458951626875692461008240031142745359776058397274208468; uint256 internal constant DEPLOYER_CONTRACT_ADDRESS = diff --git a/noir-projects/aztec-nr/aztec/src/encrypted_logs/payload.nr b/noir-projects/aztec-nr/aztec/src/encrypted_logs/payload.nr index 8418d3c6b69..37fc5e3b130 100644 --- a/noir-projects/aztec-nr/aztec/src/encrypted_logs/payload.nr +++ b/noir-projects/aztec-nr/aztec/src/encrypted_logs/payload.nr @@ -176,7 +176,7 @@ mod test { // The following value was generated by `tagged_log.test.ts` // --> Run the test with AZTEC_GENERATE_TEST_DATA=1 flag to update test data. let encrypted_note_log_from_typescript = [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 141, 70, 12, 14, 67, 77, 132, 110, 193, 234, 40, 110, 64, 144, 235, 86, 55, 111, 242, 123, 221, 193, 170, 202, 225, 216, 86, 84, 159, 112, 31, 167, 126, 79, 51, 186, 47, 71, 253, 172, 99, 112, 241, 59, 197, 241, 107, 186, 232, 87, 187, 230, 171, 62, 228, 234, 42, 51, 145, 146, 238, 242, 42, 71, 206, 13, 244, 66, 111, 195, 20, 203, 98, 148, 204, 242, 145, 183, 156, 29, 141, 54, 44, 220, 194, 35, 229, 16, 32, 204, 211, 49, 142, 112, 82, 202, 116, 241, 254, 146, 42, 217, 20, 189, 70, 228, 182, 171, 205, 104, 27, 99, 171, 28, 91, 244, 21, 30, 130, 240, 5, 72, 174, 124, 97, 197, 157, 248, 193, 23, 193, 76, 46, 141, 144, 70, 211, 45, 67, 167, 218, 129, 140, 104, 190, 41, 110, 249, 209, 68, 106, 135, 164, 80, 235, 63, 101, 80, 32, 13, 38, 99, 145, 91, 11, 173, 151, 231, 247, 65, 153, 117, 229, 167, 64, 239, 182, 126, 235, 83, 4, 169, 8, 8, 160, 4, 235, 252, 21, 96, 84, 161, 69, 145, 145, 215, 254, 161, 117, 246, 198, 65, 89, 179, 194, 90, 19, 121, 12, 202, 114, 80, 195, 14, 60, 128, 105, 142, 100, 86, 90, 108, 157, 219, 22, 172, 20, 121, 195, 25, 159, 236, 2, 70, 75, 42, 37, 34, 2, 17, 149, 20, 176, 32, 18, 204, 56, 117, 121, 34, 15, 3, 88, 123, 64, 68, 74, 233, 63, 59, 131, 222, 194, 192, 167, 110, 217, 10, 128, 73, 129, 172, 205, 103, 212, 60, 151, 141, 10, 151, 222, 151, 180, 43, 91, 148, 201, 110, 165, 10, 238, 32, 134, 235, 99, 216, 200, 182, 31, 22, 156, 18, 209, 222, 172, 239, 193, 212, 86, 99, 62, 70, 182, 45, 175, 241, 91, 202, 179, 225, 99, 1, 150, 232, 2, 252, 20, 83, 49, 132, 162, 93, 116, 212, 87, 71, 211, 58, 159, 163, 40, 253, 31, 3, 192, 48, 14, 201, 80, 24, 135, 154, 207, 58, 140, 128, 29, 101, 207, 189, 182, 191, 71, 210, 64, 172, 131, 83, 46, 232, 19, 216, 183, 108, 234, 17, 104, 60, 113, 231, 145, 195, 157, 24 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 141, 70, 12, 14, 67, 77, 132, 110, 193, 234, 40, 110, 64, 144, 235, 86, 55, 111, 242, 123, 221, 193, 170, 202, 225, 216, 86, 84, 159, 112, 31, 167, 126, 79, 51, 186, 47, 71, 253, 172, 99, 112, 241, 59, 197, 241, 107, 186, 232, 87, 187, 230, 171, 62, 228, 234, 42, 51, 145, 146, 238, 242, 42, 71, 206, 13, 244, 66, 111, 195, 20, 203, 98, 148, 204, 242, 145, 183, 156, 29, 141, 54, 44, 220, 194, 35, 229, 16, 32, 204, 211, 49, 142, 112, 82, 202, 116, 241, 254, 146, 42, 217, 20, 189, 70, 228, 182, 171, 205, 104, 27, 99, 171, 28, 91, 244, 21, 30, 130, 240, 5, 72, 174, 124, 97, 197, 157, 248, 193, 23, 193, 76, 46, 141, 144, 70, 211, 45, 67, 167, 218, 129, 140, 104, 190, 41, 110, 249, 209, 68, 106, 135, 164, 80, 235, 63, 101, 80, 32, 13, 38, 99, 145, 91, 11, 173, 151, 231, 247, 65, 153, 117, 229, 167, 64, 239, 182, 126, 235, 83, 4, 169, 8, 8, 160, 4, 235, 252, 21, 96, 84, 161, 69, 145, 145, 215, 254, 161, 117, 246, 198, 65, 89, 179, 194, 90, 19, 121, 12, 202, 114, 80, 195, 14, 60, 128, 105, 142, 100, 86, 90, 108, 157, 219, 22, 172, 20, 121, 195, 25, 159, 236, 2, 70, 75, 42, 37, 34, 2, 17, 149, 20, 176, 32, 18, 204, 56, 117, 121, 34, 15, 3, 88, 123, 64, 68, 74, 233, 63, 59, 131, 222, 194, 192, 167, 110, 217, 10, 128, 73, 129, 172, 205, 103, 212, 60, 151, 141, 10, 151, 222, 151, 180, 43, 91, 148, 201, 110, 165, 10, 238, 32, 134, 235, 99, 216, 200, 182, 31, 22, 156, 18, 209, 222, 172, 239, 193, 212, 86, 99, 62, 70, 182, 45, 175, 241, 91, 202, 179, 225, 236, 95, 71, 66, 151, 225, 203, 53, 216, 85, 102, 130, 6, 8, 25, 180, 86, 58, 140, 198, 105, 102, 177, 42, 94, 115, 247, 145, 147, 24, 231, 39, 73, 27, 10, 219, 130, 115, 188, 74, 114, 5, 177, 199, 83, 183, 106, 87, 204, 238, 231, 72, 45, 240, 39, 174, 25, 98, 53, 187, 156, 159, 244, 38 ]; for i in 0..encrypted_note_log_from_typescript.len() { assert_eq(log[i], encrypted_note_log_from_typescript[i]); diff --git a/noir-projects/aztec-nr/aztec/src/note/utils.nr b/noir-projects/aztec-nr/aztec/src/note/utils.nr index dcc45135411..75cb366afe7 100644 --- a/noir-projects/aztec-nr/aztec/src/note/utils.nr +++ b/noir-projects/aztec-nr/aztec/src/note/utils.nr @@ -1,16 +1,12 @@ -use crate::{ - context::PrivateContext, generators::G_slot, - note::{note_header::NoteHeader, note_interface::NoteInterface} -}; +use crate::{context::PrivateContext, note::{note_header::NoteHeader, note_interface::NoteInterface}}; use dep::protocol_types::{ hash::{ compute_unique_note_hash, compute_siloed_note_hash as compute_siloed_note_hash, compute_siloed_nullifier as compute_siloed_nullifier_from_preimage }, - point::Point, utils::arr_copy_slice + utils::arr_copy_slice }; -use dep::std::{embedded_curve_ops::multi_scalar_mul, hash::from_field_unsafe}; pub fn compute_siloed_nullifier( note_with_header: Note, diff --git a/noir-projects/aztec-nr/aztec/src/test/mocks/mock_note.nr b/noir-projects/aztec-nr/aztec/src/test/mocks/mock_note.nr index 0559ffb41e7..c23a3ac80cb 100644 --- a/noir-projects/aztec-nr/aztec/src/test/mocks/mock_note.nr +++ b/noir-projects/aztec-nr/aztec/src/test/mocks/mock_note.nr @@ -1,6 +1,10 @@ -use crate::{context::PrivateContext, note::{note_header::NoteHeader, note_interface::NoteInterface}}; +use crate::{ + context::PrivateContext, generators::Ga1 as G_val, hash::poseidon2_hash_with_separator, + note::{note_header::NoteHeader, note_interface::NoteInterface, utils::compute_note_hash_for_nullify} +}; -use dep::protocol_types::{address::AztecAddress, point::Point, traits::Eq}; +use dep::protocol_types::{address::AztecAddress, constants::GENERATOR_INDEX__NOTE_NULLIFIER, point::Point, traits::Eq}; +use dep::std::{embedded_curve_ops::multi_scalar_mul, hash::from_field_unsafe}; global MOCK_NOTE_LENGTH = 1; // MOCK_NOTE_LENGTH * 32 + 32(storage_slot as bytes) + 32(note_type_id as bytes) @@ -23,9 +27,11 @@ impl NoteInterface for MockNote { } } - fn compute_note_hiding_point(_self: Self) -> Point { - // TODO(#7636): Properly implement these functions. - crate::generators::Ga1 + fn compute_note_hiding_point(self: Self) -> Point { + assert(self.header.storage_slot != 0, "Storage slot must be set before computing note hiding point"); + // We use the unsafe version because the multi_scalar_mul will constrain the scalars. + let value_scalar = from_field_unsafe(self.value); + multi_scalar_mul([G_val], [value_scalar]) } fn get_header(self) -> NoteHeader { @@ -37,15 +43,21 @@ impl NoteInterface for MockNote { } fn get_note_type_id() -> Field { - 0 + // randomly chose note type id + 4135 } - fn compute_nullifier(_self: Self, _context: &mut PrivateContext, _note_hash_for_nullify: Field) -> Field { - 0 + fn compute_nullifier(self, context: &mut PrivateContext, note_hash_for_nullify: Field) -> Field { + // We don't use any kind of secret here since this is only a mock note and having it here would make tests + // more cumbersome + poseidon2_hash_with_separator([note_hash_for_nullify], GENERATOR_INDEX__NOTE_NULLIFIER as Field) } - fn compute_nullifier_without_context(_self: Self) -> Field { - 0 + fn compute_nullifier_without_context(self) -> Field { + // We don't use any kind of secret here since this is only a mock note and having it here would make tests + // more cumbersome + let note_hash_for_nullify = compute_note_hash_for_nullify(self); + poseidon2_hash_with_separator([note_hash_for_nullify], GENERATOR_INDEX__NOTE_NULLIFIER as Field) } fn to_be_bytes(self, storage_slot: Field) -> [u8; MOCK_NOTE_BYTES_LENGTH] { diff --git a/noir-projects/noir-contracts/Nargo.toml b/noir-projects/noir-contracts/Nargo.toml index c0d18d96b91..1bb0fafff27 100644 --- a/noir-projects/noir-contracts/Nargo.toml +++ b/noir-projects/noir-contracts/Nargo.toml @@ -26,7 +26,6 @@ members = [ "contracts/fee_juice_contract", "contracts/import_test_contract", "contracts/key_registry_contract", - "contracts/new_key_registry_contract", "contracts/inclusion_proofs_contract", "contracts/lending_contract", "contracts/parent_contract", diff --git a/noir-projects/noir-contracts/contracts/key_registry_contract/src/main.nr b/noir-projects/noir-contracts/contracts/key_registry_contract/src/main.nr index 49f0ef0c544..aee3fb26c4e 100644 --- a/noir-projects/noir-contracts/contracts/key_registry_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/key_registry_contract/src/main.nr @@ -2,83 +2,62 @@ contract KeyRegistry { use dep::authwit::auth::assert_current_call_valid_authwit_public; use dep::aztec::{ - keys::PublicKeys, state_vars::{SharedMutable, Map}, + keys::{PublicKeys, stored_keys::StoredKeys}, state_vars::{PublicMutable, Map}, protocol_types::{point::Point, address::{AztecAddress, PartialAddress}} }; - global KEY_ROTATION_DELAY = 5; - #[aztec(storage)] - struct Storage { - // The following stores a hash of individual master public keys - // If you change slots of vars below, you must update the slots in `SharedMutablePrivateGetter` in aztec-nr/keys. - // We store x and y coordinates in individual shared mutables as shared mutable currently supports only 1 field - npk_m_x_registry: Map>, - npk_m_y_registry: Map>, - - ivpk_m_x_registry: Map>, - ivpk_m_y_registry: Map>, - - ovpk_m_x_registry: Map>, - ovpk_m_y_registry: Map>, - - tpk_m_x_registry: Map>, - tpk_m_y_registry: Map>, - } + struct Storage { + current_keys: Map>, + } - #[aztec(public)] - fn rotate_npk_m(address: AztecAddress, new_npk_m: Point, nonce: Field) { - // TODO: (#6137) - if (!address.eq(context.msg_sender())) { - assert_current_call_valid_authwit_public(&mut context, address); - } else { - assert(nonce == 0, "invalid nonce"); + impl Storage { + // The init function is typically automatically generated by the macros - here we implement it manually in order + // to have control over which storage slot is assigned to the current_keys state variable. + fn init(context: Context) -> Self { + Storage { + // Ideally we'd do KEY_REGISTRY_STORAGE_SLOT instead of hardcoding the 1 here, but that is currently + // causing compilation errors. + // TODO(#7829): fix this + current_keys: Map::new( + context, + 1, + |context, slot| { PublicMutable::new(context, slot) } + ) + } } - - let npk_m_x_registry = storage.npk_m_x_registry.at(address); - let npk_m_y_registry = storage.npk_m_y_registry.at(address); - npk_m_x_registry.schedule_value_change(new_npk_m.x); - npk_m_y_registry.schedule_value_change(new_npk_m.y); } - // We need to have two separate register functions because a single one would produce too many storage writes, since - // each SharedMutable.schedule_value_change call results in 5 writes (pre, post, block_of_change, delay and hash), - // totaling 40 writes, while the kernels only accept up to 32 writes. - // Once SharedMutable accepts multi-field values, we can have a single state variable hold all keys, and that way - // also have a single block of change, hash, and delay. - // TODO (#5491): make this be a single function with a single schedule call. + unconstrained fn get_current_keys(account: AztecAddress) -> pub PublicKeys { + // If #7524 were to be implemented, this function could be called by an oracle from an unconstrained function + // in order to produce the preimage of the stored hash, and hence prove the correctness of the keys. + storage.current_keys.at(account).read().public_keys + } #[aztec(public)] - fn register_npk_and_ivpk(address: AztecAddress, partial_address: PartialAddress, keys: PublicKeys) { + fn register_initial_keys(account: AztecAddress, partial_address: PartialAddress, keys: PublicKeys) { let computed_address = AztecAddress::compute(keys.hash(), partial_address); + assert(computed_address.eq(account), "Computed address does not match supplied address"); - assert(computed_address.eq(address), "Computed address does not match supplied address"); - - let npk_m_x_registry = storage.npk_m_x_registry.at(address); - let npk_m_y_registry = storage.npk_m_y_registry.at(address); - let ivpk_m_x_registry = storage.ivpk_m_x_registry.at(address); - let ivpk_m_y_registry = storage.ivpk_m_y_registry.at(address); - - npk_m_x_registry.schedule_value_change(keys.npk_m.x); - npk_m_y_registry.schedule_value_change(keys.npk_m.y); - ivpk_m_x_registry.schedule_value_change(keys.ivpk_m.x); - ivpk_m_y_registry.schedule_value_change(keys.ivpk_m.y); + storage.current_keys.at(account).write(StoredKeys::new(keys)); } #[aztec(public)] - fn register_ovpk_and_tpk(address: AztecAddress, partial_address: PartialAddress, keys: PublicKeys) { - let computed_address = AztecAddress::compute(keys.hash(), partial_address); + fn rotate_npk_m(account: AztecAddress, new_npk_m: Point, nonce: Field) { + if (!account.eq(context.msg_sender())) { + assert_current_call_valid_authwit_public(&mut context, account); + } else { + assert(nonce == 0, "invalid nonce"); + } - assert(computed_address.eq(address), "Computed address does not match supplied address"); + let account_key_storage = storage.current_keys.at(account); - let ovpk_m_x_registry = storage.ovpk_m_x_registry.at(address); - let ovpk_m_y_registry = storage.ovpk_m_y_registry.at(address); - let tpk_m_x_registry = storage.tpk_m_x_registry.at(address); - let tpk_m_y_registry = storage.tpk_m_y_registry.at(address); + // We read all other current keys so that we can compute the new hash - we can't update just the npk. This means + // updating all keys at once costs the same as updating just one (unless setting public storage to its current + // value is cheaper than changing it, e.g. EIP-2200). + let mut current_keys = account_key_storage.read().public_keys; + current_keys.npk_m = new_npk_m; - ovpk_m_x_registry.schedule_value_change(keys.ovpk_m.x); - ovpk_m_y_registry.schedule_value_change(keys.ovpk_m.y); - tpk_m_x_registry.schedule_value_change(keys.tpk_m.x); - tpk_m_y_registry.schedule_value_change(keys.tpk_m.y); + account_key_storage.write(StoredKeys::new(current_keys)); } } diff --git a/noir-projects/noir-contracts/contracts/new_key_registry_contract/Nargo.toml b/noir-projects/noir-contracts/contracts/new_key_registry_contract/Nargo.toml deleted file mode 100644 index 6486c235e1a..00000000000 --- a/noir-projects/noir-contracts/contracts/new_key_registry_contract/Nargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "new_key_registry_contract" -authors = [""] -compiler_version = ">=0.25.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../aztec-nr/aztec" } -authwit = { path = "../../../aztec-nr/authwit" } diff --git a/noir-projects/noir-contracts/contracts/new_key_registry_contract/src/main.nr b/noir-projects/noir-contracts/contracts/new_key_registry_contract/src/main.nr deleted file mode 100644 index 9a4744d2c81..00000000000 --- a/noir-projects/noir-contracts/contracts/new_key_registry_contract/src/main.nr +++ /dev/null @@ -1,63 +0,0 @@ -contract NewKeyRegistry { - use dep::authwit::auth::assert_current_call_valid_authwit_public; - - use dep::aztec::{ - keys::{PublicKeys, stored_keys::StoredKeys}, state_vars::{PublicMutable, Map}, - protocol_types::{point::Point, address::{AztecAddress, PartialAddress}} - }; - - #[aztec(storage)] - struct Storage { - current_keys: Map>, - } - - impl Storage { - // The init function is typically automatically generated by the macros - here we implement it manually in order - // to have control over which storage slot is assigned to the current_keys state variable. - fn init(context: Context) -> Self { - Storage { - // Ideally we'd do KEY_REGISTRY_STORAGE_SLOT instead of hardcoding the 1 here, but that is currently - // causing compilation errors. - // TODO(#7829): fix this - current_keys: Map::new( - context, - 1, - |context, slot| { PublicMutable::new(context, slot) } - ) - } - } - } - - unconstrained fn get_current_keys(account: AztecAddress) -> pub PublicKeys { - // If #7524 were to be implemented, this function could be called by an oracle from an unconstrained function - // in order to produce the preimage of the stored hash, and hence prove the correctness of the keys. - storage.current_keys.at(account).read().public_keys - } - - #[aztec(public)] - fn register_initial_keys(account: AztecAddress, partial_address: PartialAddress, keys: PublicKeys) { - let computed_address = AztecAddress::compute(keys.hash(), partial_address); - assert(computed_address.eq(account), "Computed address does not match supplied address"); - - storage.current_keys.at(account).write(StoredKeys::new(keys)); - } - - #[aztec(public)] - fn rotate_npk_m(account: AztecAddress, new_npk_m: Point, nonce: Field) { - if (!account.eq(context.msg_sender())) { - assert_current_call_valid_authwit_public(&mut context, account); - } else { - assert(nonce == 0, "invalid nonce"); - } - - let account_key_storage = storage.current_keys.at(account); - - // We read all other current keys so that we can compute the new hash - we can't update just the npk. This means - // updating all keys at once costs the same as updating just one (unless setting public storage to its current - // value is cheaper than changing it, e.g. EIP-2200). - let mut current_keys = account_key_storage.read().public_keys; - current_keys.npk_m = new_npk_m; - - account_key_storage.write(StoredKeys::new(current_keys)); - } -} diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr index 14dc49d4220..2a4467f8c37 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr @@ -183,7 +183,7 @@ global L2_GAS_PER_NOTE_HASH: u32 = 32; global L2_GAS_PER_NULLIFIER: u32 = 64; // CANONICAL CONTRACT ADDRESSES -global CANONICAL_KEY_REGISTRY_ADDRESS = AztecAddress::from_field(0x2ee3f8c67efa88f9e6fb44242f1e9dcc0f9a6752ded07af0d9fac3875a61d421); +global CANONICAL_KEY_REGISTRY_ADDRESS = AztecAddress::from_field(0x156eabf84e3ea50d40e3330224f2d2e81648fff8f1f7ec1bc6d2873cca6e959d); global CANONICAL_AUTH_REGISTRY_ADDRESS = AztecAddress::from_field(0x24877c50868f86712240eb535d90d1c97403d074805dd3758c3aecb02958f8d4); global DEPLOYER_CONTRACT_ADDRESS = AztecAddress::from_field(0x2ab1a2bd6d07d8d61ea56d85861446349e52c6b7c0612b702cb1e6db6ad0b089); global REGISTERER_CONTRACT_ADDRESS = AztecAddress::from_field(0x05d15342d76e46e5be07d3cda0d753158431cdc5e39d29ce4e8fe1f5c070564a); diff --git a/yarn-project/circuit-types/src/logs/l1_payload/tagged_log.test.ts b/yarn-project/circuit-types/src/logs/l1_payload/tagged_log.test.ts index 2c3a41cc8e7..05cf0b20921 100644 --- a/yarn-project/circuit-types/src/logs/l1_payload/tagged_log.test.ts +++ b/yarn-project/circuit-types/src/logs/l1_payload/tagged_log.test.ts @@ -61,7 +61,7 @@ describe('L1 Note Payload', () => { const contract = AztecAddress.fromString('0x10f48cd9eff7ae5b209c557c70de2e657ee79166868676b787e9417e19260e04'); const storageSlot = new Fr(0x0fe46be583b71f4ab5b70c2657ff1d05cccf1d292a9369628d1a194f944e6599n); const noteValue = new Fr(0x301640ceea758391b2e161c92c0513f129020f4125256afdae2646ce31099f5cn); - const noteTypeId = new NoteSelector(0); + const noteTypeId = new NoteSelector(4135); // note type id of mock_note.nr const payload = new L1NotePayload(new Note([noteValue]), contract, storageSlot, noteTypeId); @@ -83,7 +83,7 @@ describe('L1 Note Payload', () => { const encrypted = taggedLog.encrypt(ephSk, recipientAddress, ivpk, ovKeys).toString('hex'); expect(encrypted).toMatchInlineSnapshot( - `"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008d460c0e434d846ec1ea286e4090eb56376ff27bddc1aacae1d856549f701fa77e4f33ba2f47fdac6370f13bc5f16bbae857bbe6ab3ee4ea2a339192eef22a47ce0df4426fc314cb6294ccf291b79c1d8d362cdcc223e51020ccd3318e7052ca74f1fe922ad914bd46e4b6abcd681b63ab1c5bf4151e82f00548ae7c61c59df8c117c14c2e8d9046d32d43a7da818c68be296ef9d1446a87a450eb3f6550200d2663915b0bad97e7f7419975e5a740efb67eeb5304a90808a004ebfc156054a1459191d7fea175f6c64159b3c25a13790cca7250c30e3c80698e64565a6c9ddb16ac1479c3199fec02464b2a252202119514b02012cc387579220f03587b40444ae93f3b83dec2c0a76ed90a804981accd67d43c978d0a97de97b42b5b94c96ea50aee2086eb63d8c8b61f169c12d1deacefc1d456633e46b62daff15bcab3e1630196e802fc14533184a25d74d45747d33a9fa328fd1f03c0300ec95018879acf3a8c801d65cfbdb6bf47d240ac83532ee813d8b76cea11683c71e791c39d18"`, + `"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008d460c0e434d846ec1ea286e4090eb56376ff27bddc1aacae1d856549f701fa77e4f33ba2f47fdac6370f13bc5f16bbae857bbe6ab3ee4ea2a339192eef22a47ce0df4426fc314cb6294ccf291b79c1d8d362cdcc223e51020ccd3318e7052ca74f1fe922ad914bd46e4b6abcd681b63ab1c5bf4151e82f00548ae7c61c59df8c117c14c2e8d9046d32d43a7da818c68be296ef9d1446a87a450eb3f6550200d2663915b0bad97e7f7419975e5a740efb67eeb5304a90808a004ebfc156054a1459191d7fea175f6c64159b3c25a13790cca7250c30e3c80698e64565a6c9ddb16ac1479c3199fec02464b2a252202119514b02012cc387579220f03587b40444ae93f3b83dec2c0a76ed90a804981accd67d43c978d0a97de97b42b5b94c96ea50aee2086eb63d8c8b61f169c12d1deacefc1d456633e46b62daff15bcab3e1ec5f474297e1cb35d8556682060819b4563a8cc66966b12a5e73f7919318e727491b0adb8273bc4a7205b1c753b76a57cceee7482df027ae196235bb9c9ff426"`, ); const byteArrayString = `[${encrypted.match(/.{1,2}/g)!.map(byte => parseInt(byte, 16))}]`; diff --git a/yarn-project/circuits.js/src/constants.gen.ts b/yarn-project/circuits.js/src/constants.gen.ts index 2348c3ec7ac..0952b7f1a84 100644 --- a/yarn-project/circuits.js/src/constants.gen.ts +++ b/yarn-project/circuits.js/src/constants.gen.ts @@ -114,7 +114,7 @@ export const L2_GAS_PER_LOG_BYTE = 4; export const L2_GAS_PER_NOTE_HASH = 32; export const L2_GAS_PER_NULLIFIER = 64; export const CANONICAL_KEY_REGISTRY_ADDRESS = - 21209182303070804160941065409360795406831433542792830301721453026531461944353n; + 9694109890306420370616891858093188542026876097103155811681068343994212062621n; export const CANONICAL_AUTH_REGISTRY_ADDRESS = 16522644890256297179255458951626875692461008240031142745359776058397274208468n; export const DEPLOYER_CONTRACT_ADDRESS = 19310994760783330368337163480198602393920956587162708699802190083077641908361n; diff --git a/yarn-project/circuits.js/src/contract/artifact_hash.ts b/yarn-project/circuits.js/src/contract/artifact_hash.ts index 96bafbc6875..a5d6f7673af 100644 --- a/yarn-project/circuits.js/src/contract/artifact_hash.ts +++ b/yarn-project/circuits.js/src/contract/artifact_hash.ts @@ -68,7 +68,7 @@ export function computeArtifactMetadataHash(artifact: ContractArtifact) { const exceptions: string[] = [ 'AuthRegistry', - 'NewKeyRegistry', + 'KeyRegistry', 'FeeJuice', 'ContractInstanceDeployer', 'ContractClassRegisterer', diff --git a/yarn-project/cli/src/cmds/misc/deploy_contracts.ts b/yarn-project/cli/src/cmds/misc/deploy_contracts.ts index 32196437bf8..8aeaed0089e 100644 --- a/yarn-project/cli/src/cmds/misc/deploy_contracts.ts +++ b/yarn-project/cli/src/cmds/misc/deploy_contracts.ts @@ -62,7 +62,7 @@ export async function deployCanonicalL2FeeJuice( export async function deployCanonicalKeyRegistry(deployer: Wallet, waitOpts = DefaultWaitOpts): Promise { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment - const { NewKeyRegistryContract: KeyRegistryContract } = await import('@aztec/noir-contracts.js'); + const { KeyRegistryContract } = await import('@aztec/noir-contracts.js'); const canonicalKeyRegistry = getCanonicalKeyRegistry(); diff --git a/yarn-project/end-to-end/src/e2e_key_registry.test.ts b/yarn-project/end-to-end/src/e2e_key_registry.test.ts index f98c3605b84..c97dadd7d8c 100644 --- a/yarn-project/end-to-end/src/e2e_key_registry.test.ts +++ b/yarn-project/end-to-end/src/e2e_key_registry.test.ts @@ -1,6 +1,6 @@ import { type AccountWallet, AztecAddress, Fr, type PXE } from '@aztec/aztec.js'; import { CompleteAddress, Point, PublicKeys } from '@aztec/circuits.js'; -import { NewKeyRegistryContract, TestContract } from '@aztec/noir-contracts.js'; +import { KeyRegistryContract, TestContract } from '@aztec/noir-contracts.js'; import { getCanonicalKeyRegistryAddress } from '@aztec/protocol-contracts/key-registry'; import { jest } from '@jest/globals'; @@ -10,7 +10,7 @@ import { publicDeployAccounts, setup } from './fixtures/utils.js'; const TIMEOUT = 120_000; describe('Key Registry', () => { - let keyRegistry: NewKeyRegistryContract; + let keyRegistry: KeyRegistryContract; let pxe: PXE; let testContract: TestContract; @@ -24,7 +24,7 @@ describe('Key Registry', () => { beforeAll(async () => { ({ teardown, pxe, wallets } = await setup(2)); - keyRegistry = await NewKeyRegistryContract.at(getCanonicalKeyRegistryAddress(), wallets[0]); + keyRegistry = await KeyRegistryContract.at(getCanonicalKeyRegistryAddress(), wallets[0]); testContract = await TestContract.deploy(wallets[0]).send().deployed(); diff --git a/yarn-project/end-to-end/src/fixtures/utils.ts b/yarn-project/end-to-end/src/fixtures/utils.ts index 160449b6df7..1d9e5a2ec66 100644 --- a/yarn-project/end-to-end/src/fixtures/utils.ts +++ b/yarn-project/end-to-end/src/fixtures/utils.ts @@ -55,7 +55,7 @@ import { RollupAbi, RollupBytecode, } from '@aztec/l1-artifacts'; -import { AuthRegistryContract, NewKeyRegistryContract } from '@aztec/noir-contracts.js'; +import { AuthRegistryContract, KeyRegistryContract } from '@aztec/noir-contracts.js'; import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice'; import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types'; import { getCanonicalAuthRegistry } from '@aztec/protocol-contracts/auth-registry'; @@ -691,7 +691,7 @@ export async function deployCanonicalKeyRegistry(deployer: Wallet) { return; } - const keyRegistry = await NewKeyRegistryContract.deploy(deployer) + const keyRegistry = await KeyRegistryContract.deploy(deployer) .send({ contractAddressSalt: canonicalKeyRegistry.instance.salt, universalDeploy: true }) .deployed(); diff --git a/yarn-project/protocol-contracts/scripts/copy-contracts.sh b/yarn-project/protocol-contracts/scripts/copy-contracts.sh index ca6cba229d5..d9f4a60a25c 100755 --- a/yarn-project/protocol-contracts/scripts/copy-contracts.sh +++ b/yarn-project/protocol-contracts/scripts/copy-contracts.sh @@ -6,7 +6,7 @@ contracts=( contract_class_registerer_contract-ContractClassRegisterer contract_instance_deployer_contract-ContractInstanceDeployer fee_juice_contract-FeeJuice - new_key_registry_contract-NewKeyRegistry + key_registry_contract-KeyRegistry auth_registry_contract-AuthRegistry multi_call_entrypoint_contract-MultiCallEntrypoint ) diff --git a/yarn-project/protocol-contracts/src/key-registry/artifact.ts b/yarn-project/protocol-contracts/src/key-registry/artifact.ts index 72bbe2ebe82..5feb280a624 100644 --- a/yarn-project/protocol-contracts/src/key-registry/artifact.ts +++ b/yarn-project/protocol-contracts/src/key-registry/artifact.ts @@ -1,6 +1,6 @@ import { loadContractArtifact } from '@aztec/types/abi'; import { type NoirCompiledContract } from '@aztec/types/noir'; -import NewKeyRegistryJson from '../../artifacts/NewKeyRegistry.json' assert { type: 'json' }; +import KeyRegistryJson from '../../artifacts/KeyRegistry.json' assert { type: 'json' }; -export const KeyRegistryArtifact = loadContractArtifact(NewKeyRegistryJson as NoirCompiledContract); +export const KeyRegistryArtifact = loadContractArtifact(KeyRegistryJson as NoirCompiledContract);