mirror of
https://github.com/tornadocash/tornado-anonymity-mining.git
synced 2024-11-22 01:37:08 +01:00
fix: optimism poseidon hash for events
This commit is contained in:
parent
18518856ff
commit
6d219e19ee
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "tornado-anonymity-mining",
|
"name": "tornado-anonymity-mining",
|
||||||
"version": "2.1.3",
|
"version": "2.1.4",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"repository": "https://github.com/tornadocash/tornado-anonymity-mining.git",
|
"repository": "https://github.com/tornadocash/tornado-anonymity-mining.git",
|
||||||
"author": "Tornadocash team <hello@tornado.cash>",
|
"author": "Tornadocash team <hello@tornado.cash>",
|
||||||
|
@ -131,7 +131,13 @@ class Controller {
|
|||||||
const newAccount = new Account({ amount: newAmount })
|
const newAccount = new Account({ amount: newAmount })
|
||||||
|
|
||||||
depositDataEvents = depositDataEvents || (await this._fetchDepositDataEvents())
|
depositDataEvents = depositDataEvents || (await this._fetchDepositDataEvents())
|
||||||
const depositLeaves = depositDataEvents.map((x) => poseidonHash([x.instance, x.hash, x.block]))
|
const depositLeaves = depositDataEvents.map((x) => {
|
||||||
|
if (x.poseidon) {
|
||||||
|
return x.poseidon
|
||||||
|
}
|
||||||
|
|
||||||
|
return poseidonHash([x.instance, x.hash, x.block])
|
||||||
|
})
|
||||||
const depositTree = new MerkleTree(this.merkleTreeHeight, depositLeaves, { hashFunction: poseidonHash2 })
|
const depositTree = new MerkleTree(this.merkleTreeHeight, depositLeaves, { hashFunction: poseidonHash2 })
|
||||||
const depositItem = depositDataEvents.filter((x) => x.hash === toFixedHex(note.commitment))
|
const depositItem = depositDataEvents.filter((x) => x.hash === toFixedHex(note.commitment))
|
||||||
if (depositItem.length === 0) {
|
if (depositItem.length === 0) {
|
||||||
@ -140,7 +146,13 @@ class Controller {
|
|||||||
const depositPath = depositTree.path(depositItem[0].index)
|
const depositPath = depositTree.path(depositItem[0].index)
|
||||||
|
|
||||||
withdrawalDataEvents = withdrawalDataEvents || (await this._fetchWithdrawalDataEvents())
|
withdrawalDataEvents = withdrawalDataEvents || (await this._fetchWithdrawalDataEvents())
|
||||||
const withdrawalLeaves = withdrawalDataEvents.map((x) => poseidonHash([x.instance, x.hash, x.block]))
|
const withdrawalLeaves = withdrawalDataEvents.map((x) => {
|
||||||
|
if (x.poseidon) {
|
||||||
|
return x.poseidon
|
||||||
|
}
|
||||||
|
|
||||||
|
return poseidonHash([x.instance, x.hash, x.block])
|
||||||
|
})
|
||||||
const withdrawalTree = new MerkleTree(this.merkleTreeHeight, withdrawalLeaves, {
|
const withdrawalTree = new MerkleTree(this.merkleTreeHeight, withdrawalLeaves, {
|
||||||
hashFunction: poseidonHash2,
|
hashFunction: poseidonHash2,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user