Skip to content

Commit

Permalink
feat: removing register recipient in e2e tests as it is unnecessary n…
Browse files Browse the repository at this point in the history
…ow ! (#9499)

We no longer need to register public keys to send notes !

Also dealing w/ some comments that have arisen from a previous PR in the
stack's diffs showing up
  • Loading branch information
sklppy88 authored Oct 31, 2024
1 parent 247e9eb commit 9f52cbb
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class EncryptedLogPayload {
* Produces the same output as `decryptAsOutgoing`.
*
* @param ciphertext - The ciphertext for the log
* @param addressSecret - The incoming viewing secret key, used to decrypt the logs
* @param addressSecret - The address secret, used to decrypt the logs
* @returns The decrypted log payload
*/
public static decryptAsIncoming(
Expand Down
2 changes: 0 additions & 2 deletions yarn-project/end-to-end/src/benchmarks/bench_prover.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ describe('benchmarks/proving', () => {
await pxe.registerContract(initialTestContract);
await pxe.registerContract(initialFpContract);

await pxe.registerRecipient(recipient);

provingPxes.push(pxe);
}
/*TODO(post-honk): We wait 5 seconds for a race condition in setting up 4 nodes.
Expand Down
3 changes: 0 additions & 3 deletions yarn-project/end-to-end/src/composed/e2e_persistence.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,6 @@ describe('Aztec persistence', () => {
});

it('pxe does not know of the deployed contract', async () => {
await context.pxe.registerRecipient(ownerAddress);

const wallet = await getUnsafeSchnorrAccount(context.pxe, Fr.random(), Fr.ZERO).waitSetup();
await expect(TokenBlacklistContract.at(contractAddress, wallet)).rejects.toThrow(/has not been registered/);
});
Expand All @@ -220,7 +218,6 @@ describe('Aztec persistence', () => {
artifact: TokenBlacklistContract.artifact,
instance: contractInstance,
});
await context.pxe.registerRecipient(ownerAddress);

const wallet = await getUnsafeSchnorrAccount(context.pxe, Fr.random(), Fr.ZERO).waitSetup();
const contract = await TokenBlacklistContract.at(contractAddress, wallet);
Expand Down
20 changes: 0 additions & 20 deletions yarn-project/end-to-end/src/e2e_2_pxes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ describe('e2e_2_pxes', () => {

const token = await deployToken(walletA, initialBalance, logger);

// Add account B to wallet A
await pxeA.registerRecipient(walletB.getCompleteAddress());
// Add account A to wallet B
await pxeB.registerRecipient(walletA.getCompleteAddress());

// Add token to PXE B (PXE A already has it because it was deployed through it)
await pxeB.registerContract(token);

Expand Down Expand Up @@ -145,11 +140,6 @@ describe('e2e_2_pxes', () => {

const token = await deployToken(walletA, userABalance, logger);

// Add account B to wallet A
await pxeA.registerRecipient(walletB.getCompleteAddress());
// Add account A to wallet B
await pxeB.registerRecipient(walletA.getCompleteAddress());

// Add token to PXE B (PXE A already has it because it was deployed through it)
await pxeB.registerContract(token);

Expand Down Expand Up @@ -194,11 +184,6 @@ describe('e2e_2_pxes', () => {

const token = await deployToken(walletA, initialBalance, logger);

// Add account B to wallet A
await pxeA.registerRecipient(walletB.getCompleteAddress());
// Add account A to wallet B
await pxeB.registerRecipient(walletA.getCompleteAddress());

// Check initial balances are as expected
await expectTokenBalance(walletA, token, walletA.getAddress(), initialBalance, logger);
// don't check userB yet
Expand Down Expand Up @@ -229,9 +214,6 @@ describe('e2e_2_pxes', () => {
await sharedAccountOnB.register();
const sharedWalletOnB = await sharedAccountOnB.getWallet();

// Register wallet B in the pxe of wallet A
await pxeA.registerRecipient(walletB.getCompleteAddress());

// deploy the contract on PXE A
const token = await deployToken(walletA, initialBalance, logger);

Expand Down Expand Up @@ -304,8 +286,6 @@ describe('e2e_2_pxes', () => {

// 4. Adds the nullified public key note to PXE B
{
// We need to register the recipient to be able to obtain IvpkM for the note
await pxeB.registerRecipient(walletA.getCompleteAddress());
// We need to register the contract to be able to compute the note hash by calling compute_note_hash_and_optionally_a_nullifier(...)
await pxeB.registerContract(testContract);
await pxeB.addNullifiedNote(note);
Expand Down
6 changes: 1 addition & 5 deletions yarn-project/end-to-end/src/e2e_event_logs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
EventType,
Fr,
L1EventPayload,
type PXE,
} from '@aztec/aztec.js';
import { EventSelector } from '@aztec/foundation/abi';
import { makeTuple } from '@aztec/foundation/array';
Expand All @@ -24,18 +23,15 @@ describe('Logs', () => {

let wallets: AccountWalletWithSecretKey[];
let node: AztecNode;
let pxe: PXE;

let teardown: () => Promise<void>;

beforeAll(async () => {
({ teardown, wallets, aztecNode: node, pxe } = await setup(2));
({ teardown, wallets, aztecNode: node } = await setup(2));

await ensureAccountsPubliclyDeployed(wallets[0], wallets.slice(0, 2));

testLogContract = await TestLogContract.deploy(wallets[0]).send().deployed();

await pxe.registerRecipient(wallets[1].getCompleteAddress());
});

afterAll(() => teardown());
Expand Down
3 changes: 0 additions & 3 deletions yarn-project/end-to-end/src/e2e_fees/account_init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,6 @@ describe('e2e_fees account_init', () => {
const bobsSigningPubKey = new Schnorr().computePublicKey(bobsPrivateSigningKey);
const bobsInstance = bobsAccountManager.getInstance();

// alice registers bobs keys in the pxe
await pxe.registerRecipient(bobsCompleteAddress);

// and deploys bob's account, paying the fee from her balance
const paymentMethod = new FeeJuicePaymentMethod(aliceAddress);
const tx = await SchnorrAccountContract.deployWithPublicKeys(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ describe('e2e_token_contract transfer private', () => {
expect(amount).toBeGreaterThan(0n);

const nonDeployed = CompleteAddress.random();
await wallets[0].registerRecipient(nonDeployed);

await asset.methods.transfer(nonDeployed.address, amount).send().wait();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { produceNoteDaosForKey } from './produce_note_daos_for_key.js';
*
* @param simulator - An instance of AcirSimulator.
* @param db - An instance of PxeDatabase.
* @param addressPoint - The public counterpart to the secret key to be used in the decryption of incoming note logs.
* @param addressPoint - The public counterpart to the address secret, which is used in the decryption of incoming note logs.
* @param ovpkM - The public counterpart to the secret key to be used in the decryption of outgoing note logs.
* @param payload - An instance of l1NotePayload.
* @param txHash - The hash of the transaction that created the note. Equivalent to the first nullifier of the transaction.
Expand Down
10 changes: 5 additions & 5 deletions yarn-project/pxe/src/synchronizer/synchronizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,15 +371,15 @@ export class Synchronizer {

async #removeNullifiedNotes(notes: IncomingNoteDao[]) {
// now group the decoded incoming notes by public key
const publicKeyToIncomingNotes: Map<PublicKey, IncomingNoteDao[]> = new Map();
const addressPointToIncomingNotes: Map<PublicKey, IncomingNoteDao[]> = new Map();
for (const noteDao of notes) {
const notesForPublicKey = publicKeyToIncomingNotes.get(noteDao.addressPoint) ?? [];
notesForPublicKey.push(noteDao);
publicKeyToIncomingNotes.set(noteDao.addressPoint, notesForPublicKey);
const notesForAddressPoint = addressPointToIncomingNotes.get(noteDao.addressPoint) ?? [];
notesForAddressPoint.push(noteDao);
addressPointToIncomingNotes.set(noteDao.addressPoint, notesForAddressPoint);
}

// now for each group, look for the nullifiers in the nullifier tree
for (const [publicKey, notes] of publicKeyToIncomingNotes.entries()) {
for (const [publicKey, notes] of addressPointToIncomingNotes.entries()) {
const nullifiers = notes.map(n => n.siloedNullifier);
const relevantNullifiers: Fr[] = [];
for (const nullifier of nullifiers) {
Expand Down

0 comments on commit 9f52cbb

Please sign in to comment.