mirror of
https://github.com/tornadocash/tornado-root-updater.git
synced 2024-12-04 23:15:05 +01:00
fix: update encode data
This commit is contained in:
parent
777a256b5e
commit
5eac964ca8
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user