From 6b1282c61844bb593d049ebf27ffbf0eef8974f9 Mon Sep 17 00:00:00 2001 From: benesjan Date: Fri, 10 May 2024 09:32:40 +0000 Subject: [PATCH] naming fix --- .../key_registry_contract/src/main.nr | 41 ++++++++----------- .../end-to-end/src/e2e_key_registry.test.ts | 6 +-- 2 files changed, 19 insertions(+), 28 deletions(-) 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 9c07a53865ec..ca63a68aba32 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 @@ -27,11 +27,7 @@ contract KeyRegistry { } #[aztec(public)] - fn rotate_nullifier_public_key( - address: AztecAddress, - new_nullifier_public_key: GrumpkinPoint, - nonce: Field - ) { + fn rotate_npk_m(address: AztecAddress, new_npk_m: GrumpkinPoint, nonce: Field) { // TODO: (#6137) if (!address.eq(context.msg_sender())) { assert_current_call_valid_authwit_public(&mut context, address); @@ -41,25 +37,20 @@ contract KeyRegistry { 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_nullifier_public_key.x); - npk_m_y_registry.schedule_value_change(new_nullifier_public_key.y); + npk_m_x_registry.schedule_value_change(new_npk_m.x); + npk_m_y_registry.schedule_value_change(new_npk_m.y); } #[aztec(public)] fn register( address: AztecAddress, partial_address: PartialAddress, - nullifier_public_key: GrumpkinPoint, - incoming_public_key: GrumpkinPoint, - outgoing_public_key: GrumpkinPoint, - tagging_public_key: GrumpkinPoint + npk_m: GrumpkinPoint, + ivpk_m: GrumpkinPoint, + ovpk_m: GrumpkinPoint, + tpk_m: GrumpkinPoint ) { - let public_keys_hash = PublicKeysHash::compute( - nullifier_public_key, - incoming_public_key, - outgoing_public_key, - tagging_public_key - ); + let public_keys_hash = PublicKeysHash::compute(npk_m, ivpk_m, ovpk_m, tpk_m); let computed_address = AztecAddress::compute(public_keys_hash, partial_address); assert(computed_address.eq(address), "Computed address does not match supplied address"); @@ -73,14 +64,14 @@ contract KeyRegistry { // let tpk_m_x_registry = storage.tpk_m_x_registry.at(address); // let tpk_m_y_registry = storage.tpk_m_y_registry.at(address); - npk_m_x_registry.schedule_value_change(nullifier_public_key.x); - npk_m_y_registry.schedule_value_change(nullifier_public_key.y); - ivpk_m_x_registry.schedule_value_change(incoming_public_key.x); - ivpk_m_y_registry.schedule_value_change(incoming_public_key.y); + npk_m_x_registry.schedule_value_change(npk_m.x); + npk_m_y_registry.schedule_value_change(npk_m.y); + ivpk_m_x_registry.schedule_value_change(ivpk_m.x); + ivpk_m_y_registry.schedule_value_change(ivpk_m.y); // Commented out as we hit the max enqueued public calls limit when not done so - // ovpk_m_x_registry.schedule_value_change(outgoing_public_key.x); - // ovpk_m_y_registry.schedule_value_change(outgoing_public_key.y); - // tpk_m_x_registry.schedule_value_change(tagging_public_key.x); - // tpk_m_y_registry.schedule_value_change(tagging_public_key.y); + // ovpk_m_x_registry.schedule_value_change(ovpk_m.x); + // ovpk_m_y_registry.schedule_value_change(ovpk_m.y); + // tpk_m_x_registry.schedule_value_change(tpk_m.x); + // tpk_m_y_registry.schedule_value_change(tpk_m.y); } } 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 d187fb7cfc5c..88d65a5037a8 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 @@ -67,7 +67,7 @@ describe('Key Registry', () => { await expect( keyRegistry .withWallet(wallets[0]) - .methods.rotate_nullifier_public_key(wallets[1].getAddress(), Point.random(), Fr.ZERO) + .methods.rotate_npk_m(wallets[1].getAddress(), Point.random(), Fr.ZERO) .send() .wait(), ).rejects.toThrow('Assertion failed: Message not authorized by account'); @@ -146,7 +146,7 @@ describe('Key Registry', () => { it('rotates npk_m', async () => { await keyRegistry .withWallet(wallets[0]) - .methods.rotate_nullifier_public_key(wallets[0].getAddress(), firstNewMasterNullifierPublicKey, Fr.ZERO) + .methods.rotate_npk_m(wallets[0].getAddress(), firstNewMasterNullifierPublicKey, Fr.ZERO) .send() .wait(); @@ -171,7 +171,7 @@ describe('Key Registry', () => { it(`rotates npk_m with authwit`, async () => { const action = keyRegistry .withWallet(wallets[1]) - .methods.rotate_nullifier_public_key(wallets[0].getAddress(), secondNewMasterNullifierPublicKey, Fr.ZERO); + .methods.rotate_npk_m(wallets[0].getAddress(), secondNewMasterNullifierPublicKey, Fr.ZERO); await wallets[0] .setPublicAuthWit({ caller: wallets[1].getCompleteAddress().address, action }, true)