Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
df1fab54
Unverified
Commit
df1fab54
authored
Sep 06, 2018
by
Francisco Giordano
Committed by
GitHub
Sep 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename MerkleProof.verifyProof to MerkleProof.verify (#1294)
parent
a7ee54e1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
MerkleProof.sol
contracts/cryptography/MerkleProof.sol
+1
-1
MerkleProofWrapper.sol
contracts/mocks/MerkleProofWrapper.sol
+2
-2
MerkleProof.test.js
test/library/MerkleProof.test.js
+4
-4
No files found.
contracts/cryptography/MerkleProof.sol
View file @
df1fab54
...
...
@@ -14,7 +14,7 @@ library MerkleProof {
* @param _root Merkle root
* @param _leaf Leaf of Merkle tree
*/
function verify
Proof
(
function verify(
bytes32[] _proof,
bytes32 _root,
bytes32 _leaf
...
...
contracts/mocks/MerkleProofWrapper.sol
View file @
df1fab54
...
...
@@ -5,7 +5,7 @@ import { MerkleProof } from "../cryptography/MerkleProof.sol";
contract MerkleProofWrapper {
function verify
Proof
(
function verify(
bytes32[] _proof,
bytes32 _root,
bytes32 _leaf
...
...
@@ -14,6 +14,6 @@ contract MerkleProofWrapper {
pure
returns (bool)
{
return MerkleProof.verify
Proof
(_proof, _root, _leaf);
return MerkleProof.verify(_proof, _root, _leaf);
}
}
test/library/MerkleProof.test.js
View file @
df1fab54
...
...
@@ -13,7 +13,7 @@ contract('MerkleProof', function () {
merkleProof
=
await
MerkleProofWrapper
.
new
();
});
describe
(
'verify
Proof
'
,
function
()
{
describe
(
'verify'
,
function
()
{
it
(
'should return true for a valid Merkle proof'
,
async
function
()
{
const
elements
=
[
'a'
,
'b'
,
'c'
,
'd'
];
const
merkleTree
=
new
MerkleTree
(
elements
);
...
...
@@ -24,7 +24,7 @@ contract('MerkleProof', function () {
const
leaf
=
bufferToHex
(
sha3
(
elements
[
0
]));
(
await
merkleProof
.
verify
Proof
(
proof
,
root
,
leaf
)).
should
.
equal
(
true
);
(
await
merkleProof
.
verify
(
proof
,
root
,
leaf
)).
should
.
equal
(
true
);
});
it
(
'should return false for an invalid Merkle proof'
,
async
function
()
{
...
...
@@ -40,7 +40,7 @@ contract('MerkleProof', function () {
const
badProof
=
badMerkleTree
.
getHexProof
(
badElements
[
0
]);
(
await
merkleProof
.
verify
Proof
(
badProof
,
correctRoot
,
correctLeaf
)).
should
.
equal
(
false
);
(
await
merkleProof
.
verify
(
badProof
,
correctRoot
,
correctLeaf
)).
should
.
equal
(
false
);
});
it
(
'should return false for a Merkle proof of invalid length'
,
async
function
()
{
...
...
@@ -54,7 +54,7 @@ contract('MerkleProof', function () {
const
leaf
=
bufferToHex
(
sha3
(
elements
[
0
]));
(
await
merkleProof
.
verify
Proof
(
badProof
,
root
,
leaf
)).
should
.
equal
(
false
);
(
await
merkleProof
.
verify
(
badProof
,
root
,
leaf
)).
should
.
equal
(
false
);
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment