tangle-network / relayer

🕸️ The Webb Relayer Network
https://webb-tools.github.io/relayer/
Apache License 2.0
22 stars 13 forks source link

Substrate Circom proving test #526

Closed salman01zp closed 1 year ago

salman01zp commented 1 year ago

Summary of changes

Reference issue to close (if applicable)


Code Checklist

salman01zp commented 1 year ago

For testing purposes I am using protocol-substrate nodes, once everything works we can update it to tangle and modify the test to work accordingly.

Steps to reproduce

shekohex commented 1 year ago

Okay, I will try that locally.

shekohex commented 1 year ago

Using https://github.com/webb-tools/protocol-substrate/tree/shady/circom and running the tests, result in the following weird error:

Error: invalid address (argument="address", value="0x306721211d5404bd9da88e0204360a1a9ab8b87c66c1bc2fcdd37f3c2222cc20", code=INVALID_ARGUMENT, version=address/5.7.0) (argument="recipient", value="0x306721211d5404bd9da88e0204360a1a9ab8b87c66c1bc2fcdd37f3c2222cc20", code=INVALID_ARGUMENT, version=abi/5.7.0)

From the callstack:

at Logger.makeError (node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
      at Logger.throwError (node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
      at Logger.throwArgumentError (node_modules/@ethersproject/logger/src.ts/index.ts:285:21)
      at AddressCoder.Coder._throwError (node_modules/@ethersproject/abi/src.ts/coders/abstract-coder.ts:68:16)
      at AddressCoder.encode (node_modules/@ethersproject/abi/src.ts/coders/address.ts:22:18)
      at /home/shady/github/webb-tools/relayer/tests/node_modules/@ethersproject/abi/src.ts/coders/array.ts:71:19
      at Array.forEach (<anonymous>)
      at pack (node_modules/@ethersproject/abi/src.ts/coders/array.ts:54:12)
      at TupleCoder.encode (node_modules/@ethersproject/abi/src.ts/coders/tuple.ts:54:20)
      at /home/shady/github/webb-tools/relayer/tests/node_modules/@ethersproject/abi/src.ts/coders/array.ts:62:19
      at Array.forEach (<anonymous>)
      at pack (node_modules/@ethersproject/abi/src.ts/coders/array.ts:54:12)
      at TupleCoder.encode (node_modules/@ethersproject/abi/src.ts/coders/tuple.ts:54:20)
      at AbiCoder.encode (node_modules/@ethersproject/abi/src.ts/abi-coder.ts:111:15)
      at getVAnchorExtDataHash (file:///home/shady/github/webb-tools/relayer/tests/node_modules/@webb-tools/sdk-core/solidity-utils/variable-anchor.js:9:27)
      at CircomProvingManagerThread.prove (file:///home/shady/github/webb-tools/relayer/tests/node_modules/@webb-tools/sdk-core/proving/circom/proving-manager-thread.js:101:24)
      at async CircomProvingManager.prove (file:///home/shady/github/webb-tools/relayer/tests/node_modules/@webb-tools/sdk-core/proving/circom/proving-manager.js:22:102)
      at async setupTransaction (file:///home/shady/github/webb-tools/relayer/tests/test/substrate/substrateCircom.test.ts:646:17)
      at async vanchorDeposit (file:///home/shady/github/webb-tools/relayer/tests/test/substrate/substrateCircom.test.ts:506:16)
      at async Context.<anonymous> (file:///home/shady/github/webb-tools/relayer/tests/test/substrate/substrateCircom.test.ts:149:18)

Looks like it fails here:

  1. https://github.com/webb-tools/webb.js/blob/cd2d44a2290f75d2f026b6e017ca958232b6f95f/packages/sdk-core/src/proving/circom/proving-manager-thread.ts#L118-L127
  2. https://github.com/webb-tools/webb.js/blob/cd2d44a2290f75d2f026b6e017ca958232b6f95f/packages/sdk-core/src/solidity-utils/variable-anchor.ts#L21-L33
shekohex commented 1 year ago

I will be working on a clean-up and finalizing this PR. However, we need https://github.com/webb-tools/protocol-substrate/pull/330 to be merged + need a PR to update tangle with the new changes so that we use the latest tangle image.