mirror of
https://github.com/tornadocash/tornado-core.git
synced 2025-05-02 06:16:03 -04:00
Generate Hasher artifact upon compile, not migrate
To fix intermittent `truffle test` failures, use Truffle's external compiler system for generating a valid artifact for Hasher at compile-time instead of in migrations/2_deploy_hasher.js. - Define compileHelper.js script, which outputs temporary artifact data to `./build/Hasher.json`. - Configure `external` compiler in truffle-config to run compileHelper and process result - Remove usage of @truffle/artifactor in migration, since the artifact will now already exist
This commit is contained in:
parent
a533ad9ffb
commit
7ceebf48d5
5 changed files with 30 additions and 39 deletions
|
@ -1,21 +1,6 @@
|
|||
/* global artifacts */
|
||||
const path = require('path')
|
||||
const Hasher = artifacts.require('Hasher')
|
||||
|
||||
const genContract = require('circomlib/src/mimcsponge_gencontract.js')
|
||||
const Artifactor = require('@truffle/artifactor')
|
||||
|
||||
module.exports = function(deployer) {
|
||||
return deployer.then( async () => {
|
||||
const contractsDir = path.join(__dirname, '..', 'build/contracts')
|
||||
let artifactor = new Artifactor(contractsDir)
|
||||
let contractName = 'Hasher'
|
||||
await artifactor.save({
|
||||
contractName,
|
||||
abi: genContract.abi,
|
||||
unlinked_binary: genContract.createCode('mimcsponge', 220),
|
||||
}).then(async () => {
|
||||
const hasherContract = artifacts.require(contractName)
|
||||
await deployer.deploy(hasherContract)
|
||||
})
|
||||
})
|
||||
module.exports = async function(deployer) {
|
||||
await deployer.deploy(Hasher)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue