Skip to content

Commit

Permalink
naming fix
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed May 10, 2024
1 parent c16b9c3 commit 6b1282c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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");
Expand All @@ -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);
}
}
6 changes: 3 additions & 3 deletions yarn-project/end-to-end/src/e2e_key_registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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();

Expand All @@ -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)
Expand Down

0 comments on commit 6b1282c

Please sign in to comment.