Skip to content

Commit 2c8d407

Browse files
committed
Fixed serialization bug leading to failing tests
1 parent e5fc5fa commit 2c8d407

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

packages/sequencer/src/protocol/production/tasks/CircuitCompilerTask.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ import { TaskSerializer } from "../../../worker/flow/Task";
77
import { VKRecord } from "../../runtime/RuntimeVerificationKeyService";
88
import { UnpreparingTask } from "../../../worker/flow/UnpreparingTask";
99

10-
type VKRecordLite = Record<string, { vk: string; index: string }>;
10+
type VKRecordLite = Record<
11+
string,
12+
{ vk: { hash: string; data: string }; index: string }
13+
>;
1114

1215
export class DefaultSerializer implements TaskSerializer<undefined> {
1316
public toJSON(parameters: undefined): string {
@@ -30,10 +33,10 @@ export class VKResultSerializer implements TaskSerializer<VKRecord> {
3033
return {
3134
...accum,
3235
[key]: {
33-
vk:
34-
input[key].vk.data === "mock-verification-key"
35-
? JSON.stringify(input[key].vk)
36-
: VerificationKey.toJSON(input[key].vk).toString(),
36+
vk: {
37+
hash: input[key].vk.hash.toString(),
38+
data: input[key].vk.data,
39+
},
3740
index: input[key].index.toString(),
3841
},
3942
};
@@ -50,11 +53,10 @@ export class VKResultSerializer implements TaskSerializer<VKRecord> {
5053
return {
5154
...accum,
5255
[key]: {
53-
vk:
54-
JSON.parse(temp[key].vk).data === "mock-verification-key"
55-
? // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
56-
vkMaker(JSON.parse(temp[key].vk))
57-
: VerificationKey.fromJSON(temp[key].vk),
56+
vk: new VerificationKey({
57+
data: temp[key].vk.data,
58+
hash: Field(temp[key].vk.hash),
59+
}),
5860
index: BigInt(temp[key].index),
5961
},
6062
};

0 commit comments

Comments
 (0)