Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Aug 21, 2024
1 parent 9a4377a commit 0a56bf9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
8 changes: 4 additions & 4 deletions boxes/boxes/react/tests/node.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ describe('BoxReact Contract Tests', () => {
Fr.random(),
accountCompleteAddress.address,
masterNullifierPublicKey.hash(),
{ inner: masterOutgoingViewingPublicKey.toNoirStruct() },
{ inner: masterIncomingViewingPublicKey.toNoirStruct() },
masterOutgoingViewingPublicKey.toWrappedNoirStruct(),
masterIncomingViewingPublicKey.toWrappedNoirStruct(),
)
.send({ contractAddressSalt: salt })
.deployed();
Expand All @@ -39,8 +39,8 @@ describe('BoxReact Contract Tests', () => {
numberToSet,
accountCompleteAddress.address,
masterNullifierPublicKey.hash(),
{ inner: masterOutgoingViewingPublicKey.toNoirStruct() },
{ inner: masterIncomingViewingPublicKey.toNoirStruct() },
masterOutgoingViewingPublicKey.toWrappedNoirStruct(),
masterIncomingViewingPublicKey.toWrappedNoirStruct(),
)
.send()
.wait();
Expand Down
8 changes: 4 additions & 4 deletions boxes/boxes/vanilla/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ document.querySelector('#deploy').addEventListener('click', async ({ target }: a
Fr.random(),
wallet.getCompleteAddress().address,
masterNullifierPublicKey.hash(),
{ inner: masterOutgoingViewingPublicKey.toNoirStruct() },
{ inner: masterIncomingViewingPublicKey.toNoirStruct() },
masterOutgoingViewingPublicKey.toWrappedNoirStruct(),
masterIncomingViewingPublicKey.toWrappedNoirStruct(),
)
.send({ contractAddressSalt: Fr.random() })
.deployed();
Expand All @@ -51,8 +51,8 @@ document.querySelector('#set').addEventListener('submit', async (e: Event) => {
parseInt(value),
owner,
masterNullifierPublicKey.hash(),
{ inner: masterOutgoingViewingPublicKey.toNoirStruct() },
{ inner: masterIncomingViewingPublicKey.toNoirStruct() },
masterOutgoingViewingPublicKey.toWrappedNoirStruct(),
masterIncomingViewingPublicKey.toWrappedNoirStruct(),
)
.send()
.wait();
Expand Down
8 changes: 4 additions & 4 deletions yarn-project/circuits.js/src/types/public_keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ export class PublicKeys {
return {
// TODO(#6337): Directly dump account.publicKeys here
/* eslint-disable camelcase */
npk_m: { inner: this.masterNullifierPublicKey.toNoirStruct() },
ivpk_m: { inner: this.masterIncomingViewingPublicKey.toNoirStruct() },
ovpk_m: { inner: this.masterOutgoingViewingPublicKey.toNoirStruct() },
tpk_m: { inner: this.masterTaggingPublicKey.toNoirStruct() },
npk_m: this.masterNullifierPublicKey.toWrappedNoirStruct(),
ivpk_m: this.masterIncomingViewingPublicKey.toWrappedNoirStruct(),
ovpk_m: this.masterOutgoingViewingPublicKey.toWrappedNoirStruct(),
tpk_m: this.masterTaggingPublicKey.toWrappedNoirStruct(),
/* eslint-enable camelcase */
};
}
Expand Down
10 changes: 3 additions & 7 deletions yarn-project/end-to-end/src/e2e_key_registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('Key Registry', () => {
await expect(
keyRegistry
.withWallet(wallets[0])
.methods.rotate_npk_m(wallets[1].getAddress(), { inner: Point.random().toNoirStruct() }, Fr.ZERO)
.methods.rotate_npk_m(wallets[1].getAddress(), Point.random().toWrappedNoirStruct(), Fr.ZERO)
.simulate(),
).rejects.toThrow(/unauthorized/);
});
Expand Down Expand Up @@ -129,11 +129,7 @@ describe('Key Registry', () => {
// docs:start:key-rotation
await keyRegistry
.withWallet(wallets[0])
.methods.rotate_npk_m(
wallets[0].getAddress(),
{ inner: firstNewMasterNullifierPublicKey.toNoirStruct() },
Fr.ZERO,
)
.methods.rotate_npk_m(wallets[0].getAddress(), firstNewMasterNullifierPublicKey.toWrappedNoirStruct(), Fr.ZERO)
.send()
.wait();
// docs:end:key-rotation
Expand All @@ -149,7 +145,7 @@ describe('Key Registry', () => {
.withWallet(wallets[1])
.methods.rotate_npk_m(
wallets[0].getAddress(),
{ inner: secondNewMasterNullifierPublicKey.toNoirStruct() },
secondNewMasterNullifierPublicKey.toWrappedNoirStruct(),
Fr.ZERO,
);

Expand Down
6 changes: 6 additions & 0 deletions yarn-project/foundation/src/fields/point.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ export class Point {
/* eslint-enable camelcase */
}

toWrappedNoirStruct() {
/* eslint-disable camelcase */
return { inner: this.toNoirStruct() };
/* eslint-enable camelcase */
}

/**
* Check if two Point instances are equal by comparing their buffer values.
* Returns true if the buffer values are the same, and false otherwise.
Expand Down

0 comments on commit 0a56bf9

Please sign in to comment.