Skip to content

Commit 02eb3ef

Browse files
committed
Fixed test error
1 parent 71c8441 commit 02eb3ef

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

packages/persistance/src/PrismaDatabaseConnection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class PrismaDatabaseConnection
5858
> {
5959
return {
6060
asyncStateService: {
61-
useFactory: () => new PrismaStateService(this, "batch", this.tracer),
61+
useFactory: () => new PrismaStateService(this, this.tracer, "batch"),
6262
},
6363
batchStorage: {
6464
useClass: PrismaBatchStore,
@@ -70,7 +70,7 @@ export class PrismaDatabaseConnection
7070
useClass: PrismaBlockStorage,
7171
},
7272
unprovenStateService: {
73-
useFactory: () => new PrismaStateService(this, "block", this.tracer),
73+
useFactory: () => new PrismaStateService(this, this.tracer, "block"),
7474
},
7575
settlementStorage: {
7676
useClass: PrismaSettlementStorage,

packages/persistance/src/services/prisma/PrismaStateService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ export class PrismaStateService implements AsyncStateService {
2828
*/
2929
public constructor(
3030
private readonly connection: PrismaConnection,
31-
private readonly mask: string,
32-
public readonly tracer: Tracer
31+
public readonly tracer: Tracer,
32+
private readonly mask: string
3333
) {}
3434

3535
@trace("db.state.commit")

packages/persistance/test/connection.test.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import "reflect-metadata";
22
import { describe } from "@jest/globals";
33
import { Field } from "o1js";
4-
import { CachedMerkleTreeStore } from "@proto-kit/sequencer";
4+
import { CachedMerkleTreeStore, ConsoleTracer } from "@proto-kit/sequencer";
55
import { expectDefined, RollupMerkleTree } from "@proto-kit/common";
66

77
import {
@@ -14,15 +14,17 @@ import {
1414
// TODO Pull apart and test properly
1515
// Needs redis instance
1616
describe.skip("prisma", () => {
17+
const tracer = new ConsoleTracer();
18+
1719
it("merkle store", async () => {
18-
const db = new RedisConnectionModule();
20+
const db = new RedisConnectionModule(tracer);
1921
db.config = {
2022
host: "localhost",
2123
port: 6379,
2224
password: "password",
2325
};
2426
await db.start();
25-
const store = new RedisMerkleTreeStore(db);
27+
const store = new RedisMerkleTreeStore(db, tracer);
2628

2729
const cached = new CachedMerkleTreeStore(store);
2830
const tree = new RollupMerkleTree(cached);
@@ -38,7 +40,7 @@ describe.skip("prisma", () => {
3840

3941
console.log(`Root ${tree.getRoot().toBigInt()}`);
4042

41-
const store2 = new RedisMerkleTreeStore(db);
43+
const store2 = new RedisMerkleTreeStore(db, tracer);
4244

4345
const cached2 = new CachedMerkleTreeStore(store2);
4446
const tree2 = new RollupMerkleTree(cached2);
@@ -57,10 +59,10 @@ describe.skip("prisma", () => {
5759
});
5860

5961
it("fill and get", async () => {
60-
const db = new PrismaDatabaseConnection();
62+
const db = new PrismaDatabaseConnection(tracer);
6163
db.config = {};
6264
await db.start();
63-
const service = new PrismaStateService(db, "testMask");
65+
const service = new PrismaStateService(db, tracer, "testMask");
6466

6567
await service.openTransaction();
6668
service.writeStates([

0 commit comments

Comments
 (0)