Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Jul 9, 2024
1 parent 2e0b0fa commit a8d9bbc
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
6 changes: 3 additions & 3 deletions noir-projects/aztec-nr/aztec/src/keys/getters.nr
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ describe('CompleteAddress', () => {

expect(completeAddressFromComponents.equals(completeAddressFromString)).toBe(true);
});
});
});
4 changes: 2 additions & 2 deletions yarn-project/end-to-end/src/shared/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
);
});

Expand Down
7 changes: 6 additions & 1 deletion yarn-project/foundation/src/fields/point.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a8d9bbc

Please sign in to comment.