Skip to content

Commit

Permalink
Revert "fix: report status of note processor catching up"
Browse files Browse the repository at this point in the history
This reverts commit 676c083.
  • Loading branch information
alexghr committed Nov 6, 2023
1 parent 676c083 commit 0026b7e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
20 changes: 3 additions & 17 deletions yarn-project/pxe/src/synchronizer/synchronizer.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CompleteAddress, Fr, GrumpkinScalar, HistoricBlockData } from '@aztec/circuits.js';
import { Grumpkin } from '@aztec/circuits.js/barretenberg';
import { TestKeyStore } from '@aztec/key-store';
import { AztecNode, L2Block, MerkleTreeId } from '@aztec/types';
import { AztecNode, INITIAL_L2_BLOCK_NUM, L2Block, MerkleTreeId } from '@aztec/types';

import { MockProxy, mock } from 'jest-mock-extended';
import omit from 'lodash.omit';
Expand Down Expand Up @@ -99,7 +99,7 @@ describe('Synchronizer', () => {
await synchronizer.work();

// Used in synchronizer.isAccountStateSynchronized
aztecNode.getBlockNumber.mockResolvedValue(1);
aztecNode.getBlockNumber.mockResolvedValueOnce(1);

// Manually adding account to database so that we can call synchronizer.isAccountStateSynchronized
const keyStore = new TestKeyStore(await Grumpkin.new());
Expand All @@ -109,25 +109,11 @@ describe('Synchronizer', () => {
await database.addCompleteAddress(completeAddress);

// Add the account which will add the note processor to the synchronizer
synchronizer.addAccount(completeAddress.publicKey, keyStore, 1);

expect(await synchronizer.isAccountStateSynchronized(completeAddress.address)).toBe(false);
expect(synchronizer.getSyncStatus()).toEqual({
blocks: 1,
notes: {
[completeAddress.publicKey.toString()]: 0,
},
});
synchronizer.addAccount(completeAddress.publicKey, keyStore, INITIAL_L2_BLOCK_NUM);

await synchronizer.workNoteProcessorCatchUp();

expect(await synchronizer.isAccountStateSynchronized(completeAddress.address)).toBe(true);
expect(synchronizer.getSyncStatus()).toEqual({
blocks: 1,
notes: {
[completeAddress.publicKey.toString()]: 1,
},
});
});
});

Expand Down
7 changes: 1 addition & 6 deletions yarn-project/pxe/src/synchronizer/synchronizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,7 @@ export class Synchronizer {
public getSyncStatus() {
return {
blocks: this.synchedToBlock,
notes: Object.fromEntries(
[...this.noteProcessors, ...this.noteProcessorsToCatchUp].map(n => [
n.publicKey.toString(),
n.status.syncedToBlock,
]),
),
notes: Object.fromEntries(this.noteProcessors.map(n => [n.publicKey.toString(), n.status.syncedToBlock])),
};
}
}

0 comments on commit 0026b7e

Please sign in to comment.