Skip to content

npm run test failed with "Invalid withdraw proof" #70

Open
mikoto10001 opened this issue Jan 25, 2021 · 1 comment
Open

npm run test failed with "Invalid withdraw proof" #70

mikoto10001 opened this issue Jan 25, 2021 · 1 comment

Comments

@mikoto10001
Copy link

mikoto10001 commented Jan 25, 2021

I am following the readme.md to run test bellows:

npm install
cp .env.example .env
npm run build - this may take 10 minutes or more
npx ganache-cli
npm run test 

but it failed with error: Invalid withdraw proof

The proving_key in verifier sol file and ERC20Tornado.test.js is the same.
but the code returns false in https://github.com/tornadocash/tornado-core/blob/master/test/ETHTornado.test.js#L138

anyone have an idea where is the problem and how to fix this?

logs:

 1) Contract: ERC20Tornado
       #withdraw
         should work:
     Error: Returned error: VM Exception while processing transaction: revert Invalid withdraw proof -- Reason given: Invalid withdraw proof.
     at PromiEvent (node_modules/truffle/build/webpack:/packages/contract/lib/promievent.js:6:1)
      at TruffleContract.withdraw (node_modules/truffle/build/webpack:/packages/contract/lib/execute.js:158:1)
      at Context.<anonymous> (test/ERC20Tornado.test.js:169:86)
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)

  2) Contract: ERC20Tornado
       #withdraw
         should return refund to the relayer is case of fail:
     Error: Returned error: VM Exception while processing transaction: revert Invalid withdraw proof -- Reason given: Invalid withdraw proof.
     at PromiEvent (node_modules/truffle/build/webpack:/packages/contract/lib/promievent.js:6:1)
      at TruffleContract.withdraw (node_modules/truffle/build/webpack:/packages/contract/lib/execute.js:158:1)
      at Context.<anonymous> (test/ERC20Tornado.test.js:248:86)
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)

  3) Contract: ERC20Tornado
       #withdraw
         should reject with wrong refund value:

      AssertionError: expected 'Invalid withdraw proof' to equal 'Incorrect refund amount received by the contract'
      + expected - actual

      -Invalid withdraw proof
      +Incorrect refund amount received by the contract

      at Context.<anonymous> (test/ERC20Tornado.test.js:313:24)
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)

  4) Contract: ETHTornado
       snark proof verification on js side
         should detect tampering:

      AssertionError: expected false to equal true
      + expected - actual

      -false
      +true

      at Context.<anonymous> (test/ETHTornado.test.js:138:24)

  5) Contract: ETHTornado
       #withdraw
         should work:
     Error: Returned error: VM Exception while processing transaction: revert Invalid withdraw proof -- Reason given: Invalid withdraw proof.
     at PromiEvent (node_modules/truffle/build/webpack:/packages/contract/lib/promievent.js:6:1)
      at TruffleContract.withdraw (node_modules/truffle/build/webpack:/packages/contract/lib/execute.js:158:1)
      at Context.<anonymous> (test/ETHTornado.test.js:217:71)
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)

  6) Contract: ETHTornado
       #withdraw
         should prevent double spend:
     AssertionError: expected promise to be fulfilled but it was rejected with 'Error: Returned error: VM Exception while processing transaction: revert Invalid withdraw proof -- Reason given: Invalid withdraw proof.'


  7) Contract: ETHTornado
       #withdraw
         should reject with tampered public inputs:
     AssertionError: expected promise to be fulfilled but it was rejected with 'Error: Returned error: VM Exception while processing transaction: revert Invalid withdraw proof -- Reason given: Invalid withdraw proof.'


  8) Contract: ETHTornado
       #withdraw
         should reject with non zero refund:

      AssertionError: expected 'Invalid withdraw proof' to equal 'Refund value is supposed to be zero for ETH instance'
      + expected - actual

      -Invalid withdraw proof
      +Refund value is supposed to be zero for ETH instance

      at Context.<anonymous> (test/ETHTornado.test.js:482:30)
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)

  9) Contract: ETHTornado
       #isSpent
         should work:
     Error: Returned error: VM Exception while processing transaction: revert Invalid withdraw proof -- Reason given: Invalid withdraw proof.
     at PromiEvent (node_modules/truffle/build/webpack:/packages/contract/lib/promievent.js:6:1)
      at TruffleContract.withdraw (node_modules/truffle/build/webpack:/packages/contract/lib/execute.js:158:1)
      at Context.<anonymous> (test/ETHTornado.test.js:573:54)



npm ERR! code ELIFECYCLE
npm ERR! errno 9
npm ERR! [email protected] test: `npx truffle test`
npm ERR! Exit status 9
npm ERR!
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/hao/.npm/_logs/2021-01-25T07_28_46_486Z-debug.log
@fc976d
Copy link

fc976d commented Jul 1, 2022

In the place of npm run build, put npm run download. So in sequence:

npm install
cp .env.example .env
npm run download
npx ganache-cli
npm run test

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants