mirror of
https://github.com/tornadocash/tornado-core.git
synced 2025-05-06 16:25:15 -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
21
compileHasher.js
Normal file
21
compileHasher.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Generates Hasher artifact at compile-time using Truffle's external compiler
|
||||
// mechanism
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
const genContract = require('circomlib/src/mimcsponge_gencontract.js')
|
||||
|
||||
// where Truffle will expect to find the results of the external compiler
|
||||
// command
|
||||
const outputPath = path.join(__dirname, 'build', 'Hasher.json')
|
||||
|
||||
function main () {
|
||||
const contract = {
|
||||
contractName: 'Hasher',
|
||||
abi: genContract.abi,
|
||||
bytecode: genContract.createCode('mimcsponge', 220)
|
||||
}
|
||||
|
||||
fs.writeFileSync(outputPath, JSON.stringify(contract))
|
||||
}
|
||||
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue