-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] implement CompleteMerkleTree (#12)
* checkpoint * checkpoint≈ * checkpoint with initial assembly getRoot func * initial implementation of CompleteMerkle.sol * remove unused file * remove diff testing file for another PR * update to complete merkle tests * initial optimization pass at getProof * implement differential and unit tests for complete merkle * clean up old and dev comments * rename tests to be very explicit * make CompleteMerkle a MurkyBase; differential documentation updates * add natspec to CompleteMerkle.sol * rely on MurkyBase for verifyProof; update testing dependencies; --via-ir, optimize in pipeline * README update for CompleteMerkle * final clean up
- Loading branch information
Showing
22 changed files
with
1,409 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { StandardMerkleTree } from "@openzeppelin/merkle-tree"; | ||
import { ethers } from 'ethers'; | ||
|
||
const fs = require('fs'); | ||
const input_file = process.argv[2]; | ||
const input = JSON.parse(fs.readFileSync(input_file, 'utf8')); | ||
const one_word = "0x0000000000000000000000000000000000000000000000000000000000000001" | ||
const leafs = input['leafs'].map((bytes32) => [bytes32, one_word]); | ||
const indexToProve = input['index']; | ||
const tree = StandardMerkleTree.of(leafs, ["bytes32", "bytes32"], { sortLeaves: false }); // NO DEFAULT SORTING LEAVES | ||
const proof = tree.getProof(indexToProve); | ||
process.stdout.write(ethers.utils.defaultAbiCoder.encode(['bytes32[]'], [proof])); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { StandardMerkleTree } from "@openzeppelin/merkle-tree"; | ||
const fs = require('fs'); | ||
const input_file = process.argv[2]; | ||
const input = JSON.parse(fs.readFileSync(input_file, 'utf8')); | ||
const one_word = "0x0000000000000000000000000000000000000000000000000000000000000001" | ||
const leafs = input['leafs'].map((bytes32) => [bytes32, one_word]); | ||
const tree = StandardMerkleTree.of(leafs, ["bytes32", "bytes32"], { sortLeaves: false }); // NO DEFAULT SORTING LEAVES | ||
process.stdout.write(tree.root); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.