Skip to content

Commit

Permalink
fix: bigint corruption in lmdb
Browse files Browse the repository at this point in the history
  • Loading branch information
alexghr committed Apr 25, 2024
1 parent 7eb164f commit 4316ebe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ describe('e2e_2_pxes', () => {
let walletB: Wallet;
let logger: DebugLogger;
let teardownA: () => Promise<void>;
let teardownB: () => Promise<void>;

beforeEach(async () => {
({
Expand All @@ -42,14 +43,13 @@ describe('e2e_2_pxes', () => {
({
pxe: pxeB,
wallets: [walletB],
teardown: teardownB,
} = await setupPXEService(1, aztecNode!, {}, undefined, true));
}, 100_000);

afterEach(async () => {
await teardownB();
await teardownA();
if ((pxeB as any).stop) {
await (pxeB as any).stop();
}
});

const awaitUserSynchronized = async (wallet: Wallet, owner: AztecAddress) => {
Expand Down
9 changes: 9 additions & 0 deletions yarn-project/end-to-end/src/fixtures/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,25 @@ export async function setupPXEService(
* Logger instance named as the current test.
*/
logger: DebugLogger;
/**
* Teardown function
*/
teardown: () => Promise<void>;
}> {
const pxeServiceConfig = { ...getPXEServiceConfig(), ...opts };
const pxe = await createPXEService(aztecNode, pxeServiceConfig, useLogSuffix);

const wallets = await createAccounts(pxe, numberOfAccounts);

const teardown = async () => {
await pxe.stop();
};

return {
pxe,
wallets,
logger,
teardown,
};
}

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/pxe/src/database/kv_pxe_database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class KVPxeDatabase implements PxeDatabase {
removeDeferredNotesByContract(contractAddress: AztecAddress): Promise<DeferredNoteDao[]> {
return this.#db.transaction(() => {
const deferredNotes: DeferredNoteDao[] = [];
const indices = this.#deferredNotesByContract.getValues(contractAddress.toString());
const indices = Array.from(this.#deferredNotesByContract.getValues(contractAddress.toString()));

for (const index of indices) {
const deferredNoteBuffer = this.#deferredNotes.at(index);
Expand Down

0 comments on commit 4316ebe

Please sign in to comment.