Skip to content

Commit

Permalink
define explicit property
Browse files Browse the repository at this point in the history
  • Loading branch information
Trivo25 committed Sep 4, 2024
1 parent 99bd508 commit fc8f8d8
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/lib/proof-system/zkprogram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -615,12 +615,6 @@ function ZkProgram<

let selfTag = {
name: config.name,
get proofsEnabled() {
return doProving;
},
setProofsEnabled(proofsEnabled: boolean) {
doProving = proofsEnabled;
},
};
type PublicInput = InferProvableOrUndefined<
Get<StatementType, 'publicInput'>
Expand Down Expand Up @@ -798,9 +792,8 @@ function ZkProgram<
return hashConstant(digests).toBigInt().toString(16);
}

return Object.assign(
const program = Object.assign(
selfTag,

{
compile,
verify,
Expand All @@ -818,9 +811,19 @@ function ZkProgram<
rawMethods: Object.fromEntries(
methodKeys.map((key) => [key, methods[key].method])
) as any,
setProofsEnabled(proofsEnabled: boolean) {
doProving = proofsEnabled;
},
},
provers
);

// Object.assign only shallow-copies, hence we cant use this getter and have to define it explicitly
Object.defineProperty(program, 'proofsEnabled', {
get: () => doProving,
});

return program as ZkProgram<StatementType, Types>;
}

type ZkProgram<
Expand Down

0 comments on commit fc8f8d8

Please sign in to comment.