fix tests

This commit is contained in:
Roman Storm 2019-07-23 13:00:45 -07:00
parent 14e15ba6c0
commit e8fa073caf
2 changed files with 10 additions and 2 deletions

1
.nvmrc Normal file
View File

@ -0,0 +1 @@
11

View File

@ -127,6 +127,7 @@ contract('Mixer', accounts => {
const input = stringifyBigInts({ const input = stringifyBigInts({
root, root,
nullifierHash: pedersenHash(deposit.nullifier.leInt2Buff(32)),
nullifier: deposit.nullifier, nullifier: deposit.nullifier,
receiver, receiver,
fee, fee,
@ -179,16 +180,18 @@ contract('Mixer', accounts => {
const input = stringifyBigInts({ const input = stringifyBigInts({
// public // public
root, root,
nullifier: deposit.nullifier, nullifierHash: pedersenHash(deposit.nullifier.leInt2Buff(32)),
receiver, receiver,
fee, fee,
// private // private
nullifier: deposit.nullifier,
secret: deposit.secret, secret: deposit.secret,
pathElements: path_elements, pathElements: path_elements,
pathIndex: path_index, pathIndex: path_index,
}) })
const proof = await websnarkUtils.genWitnessAndProve(groth16, input, circuit, proving_key) const proof = await websnarkUtils.genWitnessAndProve(groth16, input, circuit, proving_key)
const { pi_a, pi_b, pi_c, publicSignals } = websnarkUtils.toSolidityInput(proof) const { pi_a, pi_b, pi_c, publicSignals } = websnarkUtils.toSolidityInput(proof)
@ -207,7 +210,7 @@ contract('Mixer', accounts => {
balanceRecieverAfter.should.be.eq.BN(toBN(balanceRecieverBefore).add(toBN(value)).sub(feeBN)) balanceRecieverAfter.should.be.eq.BN(toBN(balanceRecieverBefore).add(toBN(value)).sub(feeBN))
logs[0].event.should.be.equal('Withdraw') logs[0].event.should.be.equal('Withdraw')
logs[0].args.nullifier.should.be.eq.BN(toBN(deposit.nullifier.toString())) logs[0].args.nullifier.should.be.eq.BN(toBN(input.nullifierHash.toString()))
logs[0].args.fee.should.be.eq.BN(feeBN) logs[0].args.fee.should.be.eq.BN(feeBN)
}) })
@ -220,6 +223,7 @@ contract('Mixer', accounts => {
const input = stringifyBigInts({ const input = stringifyBigInts({
root, root,
nullifierHash: pedersenHash(deposit.nullifier.leInt2Buff(32)),
nullifier: deposit.nullifier, nullifier: deposit.nullifier,
receiver, receiver,
fee, fee,
@ -244,6 +248,7 @@ contract('Mixer', accounts => {
const oneEtherFee = bigInt(1e18) // 1 ether const oneEtherFee = bigInt(1e18) // 1 ether
const input = stringifyBigInts({ const input = stringifyBigInts({
root, root,
nullifierHash: pedersenHash(deposit.nullifier.leInt2Buff(32)),
nullifier: deposit.nullifier, nullifier: deposit.nullifier,
receiver, receiver,
fee: oneEtherFee, fee: oneEtherFee,
@ -266,6 +271,7 @@ contract('Mixer', accounts => {
const { root, path_elements, path_index } = await tree.path(0) const { root, path_elements, path_index } = await tree.path(0)
const input = stringifyBigInts({ const input = stringifyBigInts({
nullifierHash: pedersenHash(deposit.nullifier.leInt2Buff(32)),
root, root,
nullifier: deposit.nullifier, nullifier: deposit.nullifier,
receiver, receiver,
@ -293,6 +299,7 @@ contract('Mixer', accounts => {
const input = stringifyBigInts({ const input = stringifyBigInts({
root, root,
nullifierHash: pedersenHash(deposit.nullifier.leInt2Buff(32)),
nullifier: deposit.nullifier, nullifier: deposit.nullifier,
receiver, receiver,
fee, fee,