Compare commits
3 Commits
bulk-inser
...
0.6.1
| Author | SHA1 | Date | |
|---|---|---|---|
| d96a6adc1a | |||
|
|
e3c54ea818 | ||
|
|
d5816e7cf4 |
4340
package-lock.json
generated
4340
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "fixed-merkle-tree",
|
||||
"version": "0.6.0",
|
||||
"name": "@tornado/fixed-merkle-tree",
|
||||
"version": "0.6.1",
|
||||
"description": "Fixed depth merkle tree implementation with sequential inserts",
|
||||
"repository": "https://github.com/tornadocash/fixed-merkle-tree.git",
|
||||
"repository": "https://git.tornado.ws/tornado-packages/fixed-merkle-tree.git",
|
||||
"main": "src/merkleTree.js",
|
||||
"scripts": {
|
||||
"test": "mocha",
|
||||
@@ -19,8 +19,8 @@
|
||||
"src/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"snarkjs": "git+https://github.com/tornadocash/snarkjs.git#869181cfaf7526fe8972073d31655493a04326d5",
|
||||
"circomlib": "git+https://github.com/tornadocash/circomlib.git#5beb6aee94923052faeecea40135d45b6ce6172c"
|
||||
"@tornado/circomlib": "0.0.21",
|
||||
"@tornado/snarkjs": "0.1.20"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-eslint": "^10.1.0",
|
||||
|
||||
@@ -78,6 +78,10 @@ class MerkleTree {
|
||||
* @param {Array} elements Elements to insert
|
||||
*/
|
||||
bulkInsert(elements) {
|
||||
if (!elements.length) {
|
||||
return
|
||||
}
|
||||
|
||||
if (this._layers[0].length + elements.length > this.capacity) {
|
||||
throw new Error('Tree is full')
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
const { mimcsponge } = require('circomlib')
|
||||
const { bigInt } = require('snarkjs')
|
||||
const { mimcsponge } = require('@tornado/circomlib')
|
||||
const { bigInt } = require('@tornado/snarkjs')
|
||||
module.exports = (left, right) => mimcsponge.multiHash([bigInt(left), bigInt(right)]).toString()
|
||||
|
||||
Reference in New Issue
Block a user