From a8d9bbcb5160a2f14259e27e105a7304001ba1e2 Mon Sep 17 00:00:00 2001 From: benesjan Date: Tue, 9 Jul 2024 10:39:30 +0000 Subject: [PATCH] fixes --- noir-projects/aztec-nr/aztec/src/keys/getters.nr | 6 +++--- .../src/logs/l1_payload/encrypted_log_outgoing_body.ts | 2 +- .../circuits.js/src/barretenberg/crypto/schnorr/index.ts | 1 - .../circuits.js/src/structs/complete_address.test.ts | 2 +- yarn-project/end-to-end/src/shared/browser.ts | 4 ++-- yarn-project/foundation/src/fields/point.ts | 7 ++++++- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/noir-projects/aztec-nr/aztec/src/keys/getters.nr b/noir-projects/aztec-nr/aztec/src/keys/getters.nr index 5911cb14a251..f966b104d0a1 100644 --- a/noir-projects/aztec-nr/aztec/src/keys/getters.nr +++ b/noir-projects/aztec-nr/aztec/src/keys/getters.nr @@ -1,6 +1,7 @@ use dep::protocol_types::{ header::Header, abis::validation_requests::KeyValidationRequest, address::AztecAddress, - constants::CANONICAL_KEY_REGISTRY_ADDRESS, point::Point, storage::map::derive_storage_slot_in_map + constants::CANONICAL_KEY_REGISTRY_ADDRESS, point::Point, storage::map::derive_storage_slot_in_map, + traits::is_empty }; use crate::{ context::PrivateContext, @@ -50,8 +51,7 @@ fn get_master_key( header: Header ) -> Point { let key = fetch_key_from_registry(context, key_index, address, header); - // TODO(benesjan): re-introduce is-zero? - if (key.x == 0) & (key.y == 0) { + if is_empty(key) { // Keys were not registered in registry yet --> fetch key from PXE let keys = fetch_and_constrain_keys(address); // Return the corresponding to index diff --git a/yarn-project/circuit-types/src/logs/l1_payload/encrypted_log_outgoing_body.ts b/yarn-project/circuit-types/src/logs/l1_payload/encrypted_log_outgoing_body.ts index 43e82ddbce4a..bba788dfe52d 100644 --- a/yarn-project/circuit-types/src/logs/l1_payload/encrypted_log_outgoing_body.ts +++ b/yarn-project/circuit-types/src/logs/l1_payload/encrypted_log_outgoing_body.ts @@ -29,7 +29,7 @@ export class EncryptedLogOutgoingBody { const low = reader.readObject(Fr); const ephSk = GrumpkinPrivateKey.fromHighLow(high, low); const recipient = reader.readObject(AztecAddress); - const recipientIvpkApp = reader.readObject(Point); + const recipientIvpkApp = reader.readObject(Point); // PublicKey = Point return new EncryptedLogOutgoingBody(ephSk, recipient, recipientIvpkApp); } diff --git a/yarn-project/circuits.js/src/barretenberg/crypto/schnorr/index.ts b/yarn-project/circuits.js/src/barretenberg/crypto/schnorr/index.ts index c0ae44620932..c0a3ccd0c3e5 100644 --- a/yarn-project/circuits.js/src/barretenberg/crypto/schnorr/index.ts +++ b/yarn-project/circuits.js/src/barretenberg/crypto/schnorr/index.ts @@ -4,7 +4,6 @@ import { numToUInt32BE } from '@aztec/foundation/serialize'; import { type GrumpkinPrivateKey } from '../../../types/grumpkin_private_key.js'; import { type PublicKey } from '../../../types/public_key.js'; -import { Grumpkin } from '../grumpkin/index.js'; import { SchnorrSignature } from './signature.js'; export * from './signature.js'; diff --git a/yarn-project/circuits.js/src/structs/complete_address.test.ts b/yarn-project/circuits.js/src/structs/complete_address.test.ts index 4bda8b01522c..e38634c07592 100644 --- a/yarn-project/circuits.js/src/structs/complete_address.test.ts +++ b/yarn-project/circuits.js/src/structs/complete_address.test.ts @@ -67,4 +67,4 @@ describe('CompleteAddress', () => { expect(completeAddressFromComponents.equals(completeAddressFromString)).toBe(true); }); -}); \ No newline at end of file +}); diff --git a/yarn-project/end-to-end/src/shared/browser.ts b/yarn-project/end-to-end/src/shared/browser.ts index 143698eb9967..e8a50937c571 100644 --- a/yarn-project/end-to-end/src/shared/browser.ts +++ b/yarn-project/end-to-end/src/shared/browser.ts @@ -145,14 +145,14 @@ export const browserTestSuite = ( it('Can access CompleteAddress class in browser', async () => { const result: string = await page.evaluate(() => { const completeAddress = window.AztecJs.CompleteAddress.fromString( - '0x0f4b920040c48062d5cd72f0f1b6f331468940ab8651420de8080dfc7fa0f3dc2c93b9572b35f9c9e07e9003ae1ca444442a165f927bce00e347dab57cc19391148730d0deec722eb6c54747df7345bc2ab3bd8e81f438b17b81ccabd9e6a3ac0708920251ccaf6664d769cbc47c8d767f64912639e13d9f9e441b225066161900c48a65eea83f1dbf217c43daf1be6ba9cefd2754f07e3cc13e81e5432e47f30dfb47c8b1e11368bec638fd9d22c696bf9c323a0fd09050745f4b7cf150bfa529a9f3062ee5f9d0a099ac53b4e1130653fb797ed2b59914a8915951d13ad8252521211957a854707af85ad40e9ab4d474a4fcbdcbe7a47866cae0db4fd86ed2261669d85a9cfbd09365a6db5d7acfe5560104a0cb893a375d6c08ffb9cbb8270be446a16361f271ac11899ee19f990c68035da18703ba00c8e9773dfe6a784a', + '0x1b554ab89034d16274f0043eb2d4d1104f3d6e2b995a9b8f492dfcd881b8469522f7fcddfa3ce3e8f0cc8e82d7b94cdd740afa3e77f8e4a63ea78a239432dcab0471657de2b6216ade6c506d28fbc22ba8b8ed95c871ad9f3e3984e90d9723a7111223493147f6785514b1c195bb37a2589f22a6596d30bb2bb145fdc9ca8f1e273bbffd678edce8fe30e0deafc4f66d58357c06fd4a820285294b9746c3be9509115c96e962322ffed6522f57194627136b8d03ac7469109707f5e44190c4840c49773308a13d740a7f0d4f0e6163b02c5a408b6f965856b6a491002d073d5b00d3d81beb009873eb7116327cf47c612d5758ef083d4fda78e9b63980b2a7622f567d22d2b02fe1f4ad42db9d58a36afd1983e7e2909d1cab61cafedad6193a0a7c585381b10f4666044266a02405bf6e01fa564c8517d4ad5823493abd31de', ); // NOTE: browser does not know how to serialize CompleteAddress for return, so return a string // otherwise returning a CompleteAddress makes result undefined. return completeAddress.toString(); }); expect(result).toBe( - '0x0f4b920040c48062d5cd72f0f1b6f331468940ab8651420de8080dfc7fa0f3dc2c93b9572b35f9c9e07e9003ae1ca444442a165f927bce00e347dab57cc19391148730d0deec722eb6c54747df7345bc2ab3bd8e81f438b17b81ccabd9e6a3ac0708920251ccaf6664d769cbc47c8d767f64912639e13d9f9e441b225066161900c48a65eea83f1dbf217c43daf1be6ba9cefd2754f07e3cc13e81e5432e47f30dfb47c8b1e11368bec638fd9d22c696bf9c323a0fd09050745f4b7cf150bfa529a9f3062ee5f9d0a099ac53b4e1130653fb797ed2b59914a8915951d13ad8252521211957a854707af85ad40e9ab4d474a4fcbdcbe7a47866cae0db4fd86ed2261669d85a9cfbd09365a6db5d7acfe5560104a0cb893a375d6c08ffb9cbb8270be446a16361f271ac11899ee19f990c68035da18703ba00c8e9773dfe6a784a', + '0x1b554ab89034d16274f0043eb2d4d1104f3d6e2b995a9b8f492dfcd881b8469522f7fcddfa3ce3e8f0cc8e82d7b94cdd740afa3e77f8e4a63ea78a239432dcab0471657de2b6216ade6c506d28fbc22ba8b8ed95c871ad9f3e3984e90d9723a7111223493147f6785514b1c195bb37a2589f22a6596d30bb2bb145fdc9ca8f1e273bbffd678edce8fe30e0deafc4f66d58357c06fd4a820285294b9746c3be9509115c96e962322ffed6522f57194627136b8d03ac7469109707f5e44190c4840c49773308a13d740a7f0d4f0e6163b02c5a408b6f965856b6a491002d073d5b00d3d81beb009873eb7116327cf47c612d5758ef083d4fda78e9b63980b2a7622f567d22d2b02fe1f4ad42db9d58a36afd1983e7e2909d1cab61cafedad6193a0a7c585381b10f4666044266a02405bf6e01fa564c8517d4ad5823493abd31de', ); }); diff --git a/yarn-project/foundation/src/fields/point.ts b/yarn-project/foundation/src/fields/point.ts index 523eb44c0ad2..26c84d88ec06 100644 --- a/yarn-project/foundation/src/fields/point.ts +++ b/yarn-project/foundation/src/fields/point.ts @@ -92,8 +92,13 @@ export class Point { /** * Converts the Point instance to a Buffer representation of the coordinates. - * The outputs buffer length will be 65, the length of both coordinates not represented as fields. * @returns A Buffer representation of the Point instance. + * @dev Note that toBuffer does not include the isInfinite flag and other serialization methods do (e.g. toFields). + * This is because currently when we work with point as bytes we don't want to populate the extra bytes for + * isInfinite flag because: + * 1. Our Grumpkin BB API currently does not handle point at infinity, + * 2. we use toBuffer when serializing notes and events and there we only work with public keys and point at infinity + * is not considered a valid public key and the extra byte would raise DA cost. */ toBuffer() { if (this.isInfinite) {