fix: update encode data

This commit is contained in:
nikdementev 2021-05-24 20:06:30 +03:00
parent 777a256b5e
commit 5eac964ca8
No known key found for this signature in database
GPG Key ID: 769B05D57CF16FE2
3 changed files with 7 additions and 7 deletions

View File

@ -2,8 +2,7 @@ version: '2'
services:
app:
# image: tornadocash/tornado-root-updater:server
build: .
image: tornadocash/tornado-root-updater:server
depends_on: [redis]
restart: always
env_file: .env

View File

@ -33,7 +33,7 @@ async function updateRedis() {
const txData = await updateTree(committedEvents, pendingEvents, type)
console.log('updateRedis:data', type, JSON.stringify(txData.data))
await redis.set(`${type}:data`, JSON.stringify(txData.data))
await redis.set(`${type}:data`, txData)
}
isActive = false
} catch (err) {

View File

@ -1,10 +1,10 @@
require('dotenv').config()
const { utils, BigNumber } = require('ethers')
const { BigNumber } = require('ethers')
const tornadoTrees = require('tornado-trees')
const MerkleTree = require('fixed-merkle-tree')
const { insertBatchSize, gasPrice } = require('./config')
const { insertBatchSize } = require('./config')
const { getTornadoTrees } = require('./singletons')
const { action, poseidonHash, poseidonHash2, toFixedHex } = require('./utils')
@ -25,9 +25,10 @@ async function updateTree(committedEvents, pendingEvents, type) {
console.log('Sending update tx', type)
const method = type === action.DEPOSIT ? 'updateDepositTree' : 'updateWithdrawalTree'
const txData = await getTornadoTrees().populateTransaction[method](proof, ...args, { gasPrice: utils.parseUnits(gasPrice, 'gwei') })
console.log('txData', txData)
const [argsHash, oldRoot, newRoot, pathIndices, events] = args
const txData = getTornadoTrees().interface.encodeFunctionData(`${method}`, [proof, argsHash, oldRoot, newRoot, pathIndices, events])
return txData
}