This commit is contained in:
poma 2021-03-25 17:44:52 +03:00
parent a18cc18e91
commit 17fc574af3
No known key found for this signature in database
GPG Key ID: BA20CB01FE165657

@ -64,6 +64,14 @@ function prove(input, keyBasePath) {
}) })
} }
/**
* Generates inputs for a snark and tornado trees smart contract.
* This function updates MerkleTree argument
*
* @param tree Merkle tree with current smart contract state. This object is mutated during function execution.
* @param events New batch of events to insert.
* @returns {{args: [string, string, string, string, *], input: {pathElements: *, instances: *, blocks: *, newRoot: *, hashes: *, oldRoot: *, pathIndices: string}}}
*/
function batchTreeUpdate(tree, events) { function batchTreeUpdate(tree, events) {
const batchHeight = Math.log2(events.length) const batchHeight = Math.log2(events.length)
if (!Number.isInteger(batchHeight)) { if (!Number.isInteger(batchHeight)) {