This commit is contained in:
poma 2021-02-02 14:38:11 +03:00
parent 4d6a05a88b
commit a4a6b92e6b
No known key found for this signature in database
GPG Key ID: BA20CB01FE165657
7 changed files with 17 additions and 22 deletions

@ -2,5 +2,4 @@
artifacts
cache
circuits
scripts
contracts/verifiers

@ -1,3 +1,4 @@
/* global task, ethers */
require('@nomiclabs/hardhat-waffle')
// This is a sample Hardhat task. To learn how to create your own go to

@ -3,7 +3,7 @@
//
// When running the script with `hardhat run <script>` you'll find the Hardhat
// Runtime Environment's members available in the global scope.
const hre = require("hardhat");
const hre = require('hardhat')
async function main() {
// Hardhat always runs the compile task when running scripts with its command
@ -14,19 +14,19 @@ async function main() {
// await hre.run('compile');
// We get the contract to deploy
const Greeter = await hre.ethers.getContractFactory("Greeter");
const greeter = await Greeter.deploy("Hello, Hardhat!");
const Greeter = await hre.ethers.getContractFactory('Greeter')
const greeter = await Greeter.deploy('Hello, Hardhat!')
await greeter.deployed();
await greeter.deployed()
console.log("Greeter deployed to:", greeter.address);
console.log('Greeter deployed to:', greeter.address)
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});
.catch((error) => {
console.error(error)
process.exit(1)
})

@ -1,7 +1,7 @@
const ethers = require('ethers')
const BigNumber = ethers.BigNumber
const { bitsToNumber, toFixedHex, toBuffer, poseidonHash, poseidonHash2 } = require('./utils')
const { bitsToNumber, toBuffer, poseidonHash } = require('./utils')
const jsSHA = require('jssha')

@ -1,9 +1,4 @@
/* global artifacts, web3, contract */
const { expect } = require('chai')
const MerkleTree = require('fixed-merkle-tree')
const jsSHA = require('jssha')
const { poseidonHash2 } = require('../src/utils')
const { batchTreeUpdate, prove } = require('../src/controller')
/* global ethers */
const instances = [
'0xc6325fa78E0764993Bf2997116A3771bCbcb3fa9',
@ -18,11 +13,9 @@ const hashes = [
'0x57f7b90a3cb4ea6860e6dd5fa44ac4f53ebe6ae3948af577a01ef51738313246',
]
const levels = 20
const CHUNK_TREE_HEIGHT = 7
describe.skip('Pack', () => {
it('should work', async () => {
const tree = new MerkleTree(levels, [], { hashFunction: poseidonHash2 })
const Pack = await ethers.getContractFactory('Pack')
const pack = await Pack.deploy()

@ -1,4 +1,3 @@
/* global artifacts, web3, contract */
const { expect } = require('chai')
const MerkleTree = require('fixed-merkle-tree')
const { poseidonHash2, randomBN } = require('../src/utils')
@ -19,5 +18,7 @@ describe('Snark', () => {
}
const data = await batchTreeUpdate(tree, events)
const proof = await prove(data, './artifacts/circuits/BatchTreeUpdate')
expect(proof.length).to.be.gt(0)
})
})

@ -1,3 +1,4 @@
/* global ethers */
const { expect } = require('chai')
const { toFixedHex, poseidonHash2, randomBN } = require('../src/utils')
const MerkleTree = require('fixed-merkle-tree')