@@ -79,6 +79,7 @@ contract('MerkleProof', function (accounts) {
7979 const proofFlags = merkleTree . getProofFlags ( proofLeaves , proof ) ;
8080
8181 expect ( await this . merkleProof . multiProofVerify ( proof , proofFlags , root , proofLeaves ) ) . to . equal ( true ) ;
82+ expect ( await this . merkleProof . multiProofVerifyCalldata ( proof , proofFlags , root , proofLeaves ) ) . to . equal ( true ) ;
8283 } ) ;
8384
8485 it ( 'returns false for an invalid Merkle multi proof' , async function ( ) {
@@ -91,7 +92,10 @@ contract('MerkleProof', function (accounts) {
9192 const badProof = badMerkleTree . getMultiProof ( badProofLeaves ) ;
9293 const badProofFlags = badMerkleTree . getProofFlags ( badProofLeaves , badProof ) ;
9394
94- expect ( await this . merkleProof . multiProofVerify ( badProof , badProofFlags , root , badProofLeaves ) ) . to . equal ( false ) ;
95+ expect ( await this . merkleProof . multiProofVerify ( badProof , badProofFlags , root , badProofLeaves ) )
96+ . to . equal ( false ) ;
97+ expect ( await this . merkleProof . multiProofVerifyCalldata ( badProof , badProofFlags , root , badProofLeaves ) )
98+ . to . equal ( false ) ;
9599 } ) ;
96100
97101 it ( 'revert with invalid multi proof #1' , async function ( ) {
@@ -111,6 +115,15 @@ contract('MerkleProof', function (accounts) {
111115 ) ,
112116 'MerkleProof: invalid multiproof' ,
113117 ) ;
118+ await expectRevert (
119+ this . merkleProof . multiProofVerifyCalldata (
120+ [ leaves [ 1 ] , fill , merkleTree . layers [ 1 ] [ 1 ] ] ,
121+ [ false , false , false ] ,
122+ root ,
123+ [ leaves [ 0 ] , badLeaf ] , // A, E
124+ ) ,
125+ 'MerkleProof: invalid multiproof' ,
126+ ) ;
114127 } ) ;
115128
116129 it ( 'revert with invalid multi proof #2' , async function ( ) {
@@ -130,6 +143,15 @@ contract('MerkleProof', function (accounts) {
130143 ) ,
131144 'reverted with panic code 0x32' ,
132145 ) ;
146+ await expectRevert (
147+ this . merkleProof . multiProofVerifyCalldata (
148+ [ leaves [ 1 ] , fill , merkleTree . layers [ 1 ] [ 1 ] ] ,
149+ [ false , false , false , false ] ,
150+ root ,
151+ [ badLeaf , leaves [ 0 ] ] , // A, E
152+ ) ,
153+ 'reverted with panic code 0x32' ,
154+ ) ;
133155 } ) ;
134156
135157 it ( 'limit case: works for tree containing a single leaf' , async function ( ) {
@@ -142,6 +164,7 @@ contract('MerkleProof', function (accounts) {
142164 const proofFlags = merkleTree . getProofFlags ( proofLeaves , proof ) ;
143165
144166 expect ( await this . merkleProof . multiProofVerify ( proof , proofFlags , root , proofLeaves ) ) . to . equal ( true ) ;
167+ expect ( await this . merkleProof . multiProofVerifyCalldata ( proof , proofFlags , root , proofLeaves ) ) . to . equal ( true ) ;
145168 } ) ;
146169
147170 it ( 'limit case: can prove empty leaves' , async function ( ) {
@@ -150,6 +173,7 @@ contract('MerkleProof', function (accounts) {
150173
151174 const root = merkleTree . getRoot ( ) ;
152175 expect ( await this . merkleProof . multiProofVerify ( [ root ] , [ ] , root , [ ] ) ) . to . equal ( true ) ;
176+ expect ( await this . merkleProof . multiProofVerifyCalldata ( [ root ] , [ ] , root , [ ] ) ) . to . equal ( true ) ;
153177 } ) ;
154178 } ) ;
155179} ) ;
0 commit comments