From e4bbd3ecfca51765e37028704fdd73bada53ef64 Mon Sep 17 00:00:00 2001 From: Zhang Junyu Date: Sun, 28 Nov 2021 12:03:42 +0800 Subject: [PATCH] bugfix: command should be runned through proof exists Signed-off-by: Zhang Junyu --- src/substrate/handler/l1sync.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/substrate/handler/l1sync.ts b/src/substrate/handler/l1sync.ts index 0102a8d..688aae3 100644 --- a/src/substrate/handler/l1sync.ts +++ b/src/substrate/handler/l1sync.ts @@ -121,11 +121,19 @@ async function l1SyncHandler(rid: string, op: CommandOp, args: any[]) { await storage.startSnapshot(rid); let proof = await tryReadCachedProof(rid); - if (!proof) { + if (proof) { + await runZkp( + new Field(op), + args.map((x) => new Field(dataToBN(x))), + storage, + false + ); + } else { proof = await runZkp( new Field(op), args.map((x) => new Field(dataToBN(x))), - storage + storage, + true ); /* proof cannot be undefined since the default argument `runProof` of `runZkp` is true */