@@ -68,9 +68,7 @@ describe("SparseMerkleTree", () => {
6868 isExclusion : 0 ,
6969 } ) ;
7070
71- const [ pA , pB , pC , publicSignals ] = await smtCircuit . generateCalldata ( proofStruct ) ;
72-
73- expect ( await smtVerifier . verifyProof ( pA , pB , pC , publicSignals ) ) . to . be . true ;
71+ await expect ( smtCircuit ) . to . useSolidityVerifier ( smtVerifier ) . and . verifyProof ( proofStruct ) ;
7472 } ) ;
7573
7674 it ( "should prove the tree inclusion for each depth of bamboo" , async ( ) => {
@@ -92,9 +90,7 @@ describe("SparseMerkleTree", () => {
9290 isExclusion : 0 ,
9391 } ) ;
9492
95- const [ pA , pB , pC , publicSignals ] = await smtCircuit . generateCalldata ( proofStruct ) ;
96-
97- expect ( await smtVerifier . verifyProof ( pA , pB , pC , publicSignals ) ) . to . be . true ;
93+ await expect ( smtCircuit ) . to . useSolidityVerifier ( smtVerifier ) . and . verifyProof ( proofStruct ) ;
9894 }
9995 } ) ;
10096
@@ -115,9 +111,7 @@ describe("SparseMerkleTree", () => {
115111 isExclusion : 0 ,
116112 } ) ;
117113
118- const [ pA , pB , pC , publicSignals ] = await smtCircuit . generateCalldata ( proofStruct ) ;
119-
120- expect ( await smtVerifier . verifyProof ( pA , pB , pC , publicSignals ) ) . to . be . true ;
114+ await expect ( smtCircuit ) . to . useSolidityVerifier ( smtVerifier ) . and . verifyProof ( proofStruct ) ;
121115 } ) ;
122116
123117 it ( "should prove the tree exclusion" , async ( ) => {
@@ -140,9 +134,7 @@ describe("SparseMerkleTree", () => {
140134 isExclusion : 1 ,
141135 } ) ;
142136
143- const [ pA , pB , pC , publicSignals ] = await smtCircuit . generateCalldata ( proofStruct ) ;
144-
145- expect ( await smtVerifier . verifyProof ( pA , pB , pC , publicSignals ) ) . to . be . true ;
137+ await expect ( smtCircuit ) . to . useSolidityVerifier ( smtVerifier ) . and . verifyProof ( proofStruct ) ;
146138 } ) ;
147139
148140 it ( "should prove the tree exclusion for each depth of bamboo" , async ( ) => {
@@ -166,9 +158,7 @@ describe("SparseMerkleTree", () => {
166158 isExclusion : 1 ,
167159 } ) ;
168160
169- const [ pA , pB , pC , publicSignals ] = await smtCircuit . generateCalldata ( proofStruct ) ;
170-
171- expect ( await smtVerifier . verifyProof ( pA , pB , pC , publicSignals ) ) . to . be . true ;
161+ await expect ( smtCircuit ) . to . useSolidityVerifier ( smtVerifier ) . and . verifyProof ( proofStruct ) ;
172162 }
173163 } ) ;
174164
@@ -188,9 +178,7 @@ describe("SparseMerkleTree", () => {
188178 isExclusion : 1 ,
189179 } ) ;
190180
191- const [ pA , pB , pC , publicSignals ] = await smtCircuit . generateCalldata ( proofStruct ) ;
192-
193- expect ( await smtVerifier . verifyProof ( pA , pB , pC , publicSignals ) ) . to . be . true ;
181+ await expect ( smtCircuit ) . to . useSolidityVerifier ( smtVerifier ) . and . verifyProof ( proofStruct ) ;
194182 } ) ;
195183
196184 describe ( "when data is incorrect" , ( ) => {
@@ -213,18 +201,16 @@ describe("SparseMerkleTree", () => {
213201
214202 const incorrectValue = merkleProof . value + 1n ;
215203
216- await expect (
217- smtCircuit . generateProof ( {
218- root : BigInt ( merkleProof . root ) ,
219- siblings : merkleProof . siblings . map ( ( e ) => BigInt ( e ) ) ,
220- key : BigInt ( merkleProof . key ) ,
221- value : BigInt ( incorrectValue ) ,
222- auxKey : 0 ,
223- auxValue : 0 ,
224- auxIsEmpty : 0 ,
225- isExclusion : 0 ,
226- } ) ,
227- ) . to . be . rejected ;
204+ await expect ( smtCircuit ) . to . not . generateProof ( {
205+ root : BigInt ( merkleProof . root ) ,
206+ siblings : merkleProof . siblings . map ( ( e ) => BigInt ( e ) ) ,
207+ key : BigInt ( merkleProof . key ) ,
208+ value : BigInt ( incorrectValue ) ,
209+ auxKey : 0 ,
210+ auxValue : 0 ,
211+ auxIsEmpty : 0 ,
212+ isExclusion : 0 ,
213+ } ) ;
228214 } ) ;
229215
230216 it ( "should revert an incorrect tree exclusion" , async ( ) => {
@@ -238,18 +224,16 @@ describe("SparseMerkleTree", () => {
238224
239225 auxIsEmpty = auxIsEmpty == 0 ? 1 : 0 ;
240226
241- await expect (
242- smtCircuit . generateProof ( {
243- root : BigInt ( merkleProof . root ) ,
244- siblings : merkleProof . siblings . map ( ( e ) => BigInt ( e ) ) ,
245- key : BigInt ( merkleProof . key ) ,
246- value : 0 ,
247- auxKey : BigInt ( merkleProof . auxKey ) ,
248- auxValue : BigInt ( merkleProof . auxValue ) ,
249- auxIsEmpty : auxIsEmpty ,
250- isExclusion : 1 ,
251- } ) ,
252- ) . to . be . rejected ;
227+ await expect ( smtCircuit ) . to . not . generateProof ( {
228+ root : BigInt ( merkleProof . root ) ,
229+ siblings : merkleProof . siblings . map ( ( e ) => BigInt ( e ) ) ,
230+ key : BigInt ( merkleProof . key ) ,
231+ value : 0 ,
232+ auxKey : BigInt ( merkleProof . auxKey ) ,
233+ auxValue : BigInt ( merkleProof . auxValue ) ,
234+ auxIsEmpty : auxIsEmpty ,
235+ isExclusion : 1 ,
236+ } ) ;
253237 } ) ;
254238 } ) ;
255239} ) ;
0 commit comments