Reorder arguments for multiProof functions (#3447)
This commit is contained in:
committed by
GitHub
parent
35090c1bf1
commit
113443470c
@ -78,7 +78,7 @@ contract('MerkleProof', function (accounts) {
|
||||
const proof = merkleTree.getMultiProof(proofLeaves);
|
||||
const proofFlags = merkleTree.getProofFlags(proofLeaves, proof);
|
||||
|
||||
expect(await this.merkleProof.multiProofVerify(root, proofLeaves, proof, proofFlags)).to.equal(true);
|
||||
expect(await this.merkleProof.multiProofVerify(proof, proofFlags, root, proofLeaves)).to.equal(true);
|
||||
});
|
||||
|
||||
it('returns false for an invalid Merkle multi proof', async function () {
|
||||
@ -91,7 +91,7 @@ contract('MerkleProof', function (accounts) {
|
||||
const badProof = badMerkleTree.getMultiProof(badProofLeaves);
|
||||
const badProofFlags = badMerkleTree.getProofFlags(badProofLeaves, badProof);
|
||||
|
||||
expect(await this.merkleProof.multiProofVerify(root, badProofLeaves, badProof, badProofFlags)).to.equal(false);
|
||||
expect(await this.merkleProof.multiProofVerify(badProof, badProofFlags, root, badProofLeaves)).to.equal(false);
|
||||
});
|
||||
|
||||
it('revert with invalid multi proof #1', async function () {
|
||||
@ -104,10 +104,10 @@ contract('MerkleProof', function (accounts) {
|
||||
|
||||
await expectRevert(
|
||||
this.merkleProof.multiProofVerify(
|
||||
root,
|
||||
[ leaves[0], badLeaf ], // A, E
|
||||
[ leaves[1], fill, merkleTree.layers[1][1] ],
|
||||
[ false, false, false ],
|
||||
root,
|
||||
[ leaves[0], badLeaf ], // A, E
|
||||
),
|
||||
'MerkleProof: invalid multiproof',
|
||||
);
|
||||
@ -123,10 +123,10 @@ contract('MerkleProof', function (accounts) {
|
||||
|
||||
await expectRevert(
|
||||
this.merkleProof.multiProofVerify(
|
||||
root,
|
||||
[ badLeaf, leaves[0] ], // A, E
|
||||
[ leaves[1], fill, merkleTree.layers[1][1] ],
|
||||
[ false, false, false, false ],
|
||||
root,
|
||||
[ badLeaf, leaves[0] ], // A, E
|
||||
),
|
||||
'reverted with panic code 0x32',
|
||||
);
|
||||
@ -141,7 +141,7 @@ contract('MerkleProof', function (accounts) {
|
||||
const proof = merkleTree.getMultiProof(proofLeaves);
|
||||
const proofFlags = merkleTree.getProofFlags(proofLeaves, proof);
|
||||
|
||||
expect(await this.merkleProof.multiProofVerify(root, proofLeaves, proof, proofFlags)).to.equal(true);
|
||||
expect(await this.merkleProof.multiProofVerify(proof, proofFlags, root, proofLeaves)).to.equal(true);
|
||||
});
|
||||
|
||||
it('limit case: can prove empty leaves', async function () {
|
||||
@ -149,7 +149,7 @@ contract('MerkleProof', function (accounts) {
|
||||
const merkleTree = new MerkleTree(leaves, keccak256, { sort: true });
|
||||
|
||||
const root = merkleTree.getRoot();
|
||||
expect(await this.merkleProof.multiProofVerify(root, [], [ root ], [])).to.equal(true);
|
||||
expect(await this.merkleProof.multiProofVerify([ root ], [], root, [])).to.equal(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user