Compare commits

...

3 Commits

Author SHA1 Message Date
Tomoaki Imai d95b53862f arg explanation update for _currentRoot for updateDepositTree 2022-03-08 11:18:53 +07:00
Tomoaki Imai f6bfbf09be arg explanation update for _currentRoot 2022-03-08 11:18:53 +07:00
poma 17fc574af3
docs 2021-03-25 17:44:52 +03:00
2 changed files with 10 additions and 2 deletions

View File

@ -121,7 +121,7 @@ contract TornadoTrees is Initializable {
/// @dev Insert a full batch of queued deposits into a merkle tree
/// @param _proof A snark proof that elements were inserted correctly
/// @param _argsHash A hash of snark inputs
/// @param _argsHash Current merkle tree root
/// @param _currentRoot Current merkle tree root
/// @param _newRoot Updated merkle tree root
/// @param _pathIndices Merkle path to inserted batch
/// @param _events A batch of inserted events (leaves)
@ -173,7 +173,7 @@ contract TornadoTrees is Initializable {
/// @dev Insert a full batch of queued withdrawals into a merkle tree
/// @param _proof A snark proof that elements were inserted correctly
/// @param _argsHash A hash of snark inputs
/// @param _argsHash Current merkle tree root
/// @param _currentRoot Current merkle tree root
/// @param _newRoot Updated merkle tree root
/// @param _pathIndices Merkle path to inserted batch
/// @param _events A batch of inserted events (leaves)

View File

@ -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) {
const batchHeight = Math.log2(events.length)
if (!Number.isInteger(batchHeight)) {