From de2c09139b67d7fdb392a12a4524b3a8bc240e5d Mon Sep 17 00:00:00 2001 From: Martin Minkov Date: Sat, 21 Oct 2023 17:16:56 -0700 Subject: [PATCH] refactor(gadgets.ts): simplify witness creation and rotation operations --- src/examples/gadgets.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/examples/gadgets.ts b/src/examples/gadgets.ts index 345d5b9d71..78800439ca 100644 --- a/src/examples/gadgets.ts +++ b/src/examples/gadgets.ts @@ -1,14 +1,10 @@ import { Field, Provable, Experimental, Gadgets } from 'o1js'; let cs = Provable.constraintSystem(() => { - let res1 = Provable.witness(Field, () => { - let f = Field(12); - return Gadgets.rot(f, 2, 'left'); - }); - let res2 = Provable.witness(Field, () => { - let f = Field(12); - return Gadgets.rot(f, 2, 'right'); - }); + let f = Provable.witness(Field, () => Field(12)); + + let res1 = Gadgets.rot(f, 2, 'left'); + let res2 = Gadgets.rot(f, 2, 'right'); res1.assertEquals(Field(48)); res2.assertEquals(Field(3));