Skip to content

Commit ed1dbdc

Browse files
authored
chore: rm unused methods (#12544)
We got rid of `addNullifiedNote` in #11822, I imagine it accidentally came back in the recent refactors. I also got rid of `addNote` since we always use `addNotes` anyway.
1 parent d75ee98 commit ed1dbdc

File tree

2 files changed

+6
-35
lines changed

2 files changed

+6
-35
lines changed

yarn-project/pxe/src/storage/note_data_provider/note_data_provider.test.ts

+6-21
Original file line numberDiff line numberDiff line change
@@ -85,24 +85,13 @@ describe('NoteDataProvider', () => {
8585
}
8686
});
8787

88-
it.each(filteringTests)('stores notes in bulk and retrieves notes', async (getFilter, getExpected) => {
88+
it.each(filteringTests)('stores notes and retrieves notes', async (getFilter, getExpected) => {
8989
await noteDataProvider.addNotes(notes);
9090
const returnedNotes = await noteDataProvider.getNotes(await getFilter());
9191
const expected = await getExpected();
9292
expect(returnedNotes.sort()).toEqual(expected.sort());
9393
});
9494

95-
it.each(filteringTests)('stores notes one by one and retrieves notes', async (getFilter, getExpected) => {
96-
for (const note of notes) {
97-
await noteDataProvider.addNote(note);
98-
}
99-
100-
const returnedNotes = await noteDataProvider.getNotes(await getFilter());
101-
102-
const expected = await getExpected();
103-
expect(returnedNotes.sort()).toEqual(expected.sort());
104-
});
105-
10695
it.each(filteringTests)('retrieves nullified notes', async (getFilter, getExpected) => {
10796
await noteDataProvider.addNotes(notes);
10897

@@ -188,14 +177,10 @@ describe('NoteDataProvider', () => {
188177
expect(result.sort()).toEqual([...notes].sort());
189178
});
190179

191-
it('stores notes one by one and retrieves notes with siloed account', async () => {
192-
for (const note of notes.slice(0, 5)) {
193-
await noteDataProvider.addNote(note, owners[0].address);
194-
}
180+
it('stores notes and retrieves notes with siloed account', async () => {
181+
await noteDataProvider.addNotes(notes.slice(0, 5), owners[0].address);
195182

196-
for (const note of notes.slice(5)) {
197-
await noteDataProvider.addNote(note, owners[1].address);
198-
}
183+
await noteDataProvider.addNotes(notes.slice(5), owners[1].address);
199184

200185
const owner0Notes = await noteDataProvider.getNotes({
201186
scopes: [owners[0].address],
@@ -217,8 +202,8 @@ describe('NoteDataProvider', () => {
217202
});
218203

219204
it('a nullified note removes notes from all accounts in the pxe', async () => {
220-
await noteDataProvider.addNote(notes[0], owners[0].address);
221-
await noteDataProvider.addNote(notes[0], owners[1].address);
205+
await noteDataProvider.addNotes([notes[0]], owners[0].address);
206+
await noteDataProvider.addNotes([notes[0]], owners[1].address);
222207

223208
await expect(
224209
noteDataProvider.getNotes({

yarn-project/pxe/src/storage/note_data_provider/note_data_provider.ts

-14
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ export class NoteDataProvider implements DataProvider {
8484
return true;
8585
}
8686

87-
async addNote(note: NoteDao, scope?: AztecAddress): Promise<void> {
88-
await this.addNotes([note], scope);
89-
}
90-
9187
async addNotes(notes: NoteDao[], scope: AztecAddress = AztecAddress.ZERO): Promise<void> {
9288
if (!(await this.#scopes.hasAsync(scope.toString()))) {
9389
await this.addScope(scope);
@@ -343,16 +339,6 @@ export class NoteDataProvider implements DataProvider {
343339
});
344340
}
345341

346-
async addNullifiedNote(note: NoteDao): Promise<void> {
347-
const noteIndex = toBufferBE(note.index, 32).toString('hex');
348-
349-
await this.#nullifiedNotes.set(noteIndex, note.toBuffer());
350-
await this.#nullifiedNotesByContract.set(note.contractAddress.toString(), noteIndex);
351-
await this.#nullifiedNotesByStorageSlot.set(note.storageSlot.toString(), noteIndex);
352-
await this.#nullifiedNotesByTxHash.set(note.txHash.toString(), noteIndex);
353-
await this.#nullifiedNotesByAddressPoint.set(note.addressPoint.toString(), noteIndex);
354-
}
355-
356342
async getSize() {
357343
return (await this.getNotes({})).reduce((sum, note) => sum + note.getSize(), 0);
358344
}

0 commit comments

Comments
 (0)