Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rm unused methods #12544

Merged
merged 2 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,24 +85,13 @@ describe('NoteDataProvider', () => {
}
});

it.each(filteringTests)('stores notes in bulk and retrieves notes', async (getFilter, getExpected) => {
it.each(filteringTests)('stores notes and retrieves notes', async (getFilter, getExpected) => {
await noteDataProvider.addNotes(notes);
const returnedNotes = await noteDataProvider.getNotes(await getFilter());
const expected = await getExpected();
expect(returnedNotes.sort()).toEqual(expected.sort());
});

it.each(filteringTests)('stores notes one by one and retrieves notes', async (getFilter, getExpected) => {
for (const note of notes) {
await noteDataProvider.addNote(note);
}

const returnedNotes = await noteDataProvider.getNotes(await getFilter());

const expected = await getExpected();
expect(returnedNotes.sort()).toEqual(expected.sort());
});

it.each(filteringTests)('retrieves nullified notes', async (getFilter, getExpected) => {
await noteDataProvider.addNotes(notes);

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

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

for (const note of notes.slice(5)) {
await noteDataProvider.addNote(note, owners[1].address);
}
await noteDataProvider.addNotes(notes.slice(5), owners[1].address);

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

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

await expect(
noteDataProvider.getNotes({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ export class NoteDataProvider implements DataProvider {
return true;
}

async addNote(note: NoteDao, scope?: AztecAddress): Promise<void> {
await this.addNotes([note], scope);
}

async addNotes(notes: NoteDao[], scope: AztecAddress = AztecAddress.ZERO): Promise<void> {
if (!(await this.#scopes.hasAsync(scope.toString()))) {
await this.addScope(scope);
Expand Down Expand Up @@ -343,16 +339,6 @@ export class NoteDataProvider implements DataProvider {
});
}

async addNullifiedNote(note: NoteDao): Promise<void> {
const noteIndex = toBufferBE(note.index, 32).toString('hex');

await this.#nullifiedNotes.set(noteIndex, note.toBuffer());
await this.#nullifiedNotesByContract.set(note.contractAddress.toString(), noteIndex);
await this.#nullifiedNotesByStorageSlot.set(note.storageSlot.toString(), noteIndex);
await this.#nullifiedNotesByTxHash.set(note.txHash.toString(), noteIndex);
await this.#nullifiedNotesByAddressPoint.set(note.addressPoint.toString(), noteIndex);
}

async getSize() {
return (await this.getNotes({})).reduce((sum, note) => sum + note.getSize(), 0);
}
Expand Down