tangle-network / relayer

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

Masp tx relaying #591

Closed salman01zp closed 1 year ago

salman01zp commented 1 year ago

Summary of changes

Feature flagged masp-tx-relaying, needs some more work with fees and cross-chain tests.

Note

This is a breaking change for the send_private_tx API, here is the updated payload. You just need to wrap the existing payload around vAnchor as following. cc: @AtelyPham

API

/api/v1/send/evm/:chainId/:contractAddress

Payload

{
  "vAnchor": {
    "extData": {
      "recipient": "0x306721211d5404bd9da88e0204360a1a9ab8b87c66c1bc2fcdd37f3c2222cc20",
      "relayer": "0x90b5ab205c6974c9ea841be688864633dc9ca8a357843eeacf2314649965fe22",
      "extAmount": "-32e976941b78c20c6d",
      "fee": "0x00000000000000034c5319aa65ddf393",
      "refund": "0x00000000000000000000000000000000",
      "token": 0,
      "encryptedOutput1": "0x84e190004e5a43dde02d3f172fb54a1171cb04e7599baa4b98666df3ca2a717a626f0828e23f9d84278786034793c5a6ef9fe8b3b6595c2e2224f5baa9dcb170ef79a2c6a5604d7d18995d6758a8140abd71c7cb7dde469b132ea3fedbfd33363672224f2dd7923ae681cab59fb24aa6e1e18edb3b58c48ab32b6fa5c25d5bbde58854945f6fb3d150fb0aeeaa313a54540de6ecc5556d417464df959214956f983e0c399666637c",
      "encryptedOutput2": "0x5aace9d7c642b3a67ed92d266e5b5b4c51581b3cef1d2869ca24a6971752d198624a66e5c456db7e7009b7727980ddc278e82c4287c8e81eebb06a4c13a11669382bfe24253c78bc6919ea5864b2cf3369d90bc8faa618c69a97aeee7ddafbe1f1753c5339face258d129565771ad5681ff76c6fef0586823d307098ea9bea68883fdb33fa11afbb67427bc0014dbcdf01b9498f49b3dd62d613dc09764a2a56df97c903eb68571f"
    },
    "proofData": {
      "proof": "0x107210365314564a7e2cfe0471f8e3a3390b01796c843d7d5f4973d6621654e1246f4ff88fc44c91c392491bd0ba603dd7b6b459664882c6d2a5fa1e4f3f87df2d14edc4999a85755d12f12703544f9b00b964781c086317059a06b07d5906d321cdbb2c9fbd87a87c1de18940c5b2ca9419f80686eb1ea784736e98d995f8371fab9e8b65e0faf6923db10158477fc8d647e049e5e8ecdb0540031f7edbac2426fbaa73bd0bb2a7690a5778301313c17549edbd4fad5c6a65e30c788d681d350b5fd5bdd5ad451f2cdc9ae33a4473cfc697cec2925eb3303e3c33ad6e45d6211ce6d2bbf973bc8a71f74c7a0fdc9327ff45edda4eb8c2f261484121f05568d1",
      "extDataHash": "0x0ba90a0ff6fbb0b35b99f5828bb17a9a90d9d4608973294d2b9d885c411325bd",
      "publicAmount": "0x30644e72e131a029b85045b68181585d2833e84879b9705b0e1847ce11600001",
      "roots": [
        "0x0a10b873a48008d5d39808fab818591815ce2a83b20ad384a6bb26474a4dbc37",
        "0x23ab323453748129f2765f79615022f5bebd6f4096a796300aab049a60b0f187"
      ],
      "extensionRoots": [

      ],
      "outputCommitments": [
        "0x09bcfab435d5e9bbfb3cc5ad879d8354700a0a3aa6d5a5a247c9264e5e03c0b0",
        "0x202fc1611fbb99fcec34ae1362185d9ce1cafc1d9b53a636b3a530a29015f4c6"
      ],
      "inputNullifiers": [
        "0x270ac8f4c30e21372a0b692617788c8d2da0cc6864513f6d5225c57ffcd2062a",
        "0x02ad7bfd630e3965db175940d38f2e8f74b38e387d1daf5aa2d725aef363dd08"
      ]
    }
  }
}

WithdrawTxSuccessResponse

{
  "status": "Sent",
  "message": "Transaction sent successfully",
  "itemKey": "0x65766d5f7472616e73616374696f6e5f71756575655f6974656d5f6b65795f5f653e1f954f5d2b89943baccce52982c71e263da5f2d3a5fea9ea35ec312e00b8"
}

WithdrawTxFailureResponse

{
  "status": "Failed",
  "message": "Transaction request failed",
  "reason": "ClientError(\"(code: -32000, message: VM Exception while processing transaction: revert verifier-gte-snark-scalar-field, data: Some(Object {\\\"hash\\\": Null, \\\"message\\\": String(\\\"revert\\\"), \\\"programCounter\\\": Number(14393), \\\"reason\\\": String(\\\"verifier-gte-snark-scalar-field\\\"), \\\"result\\\": String(\\\"0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001f76657269666965722d6774652d736e61726b2d7363616c61722d6669656c6400\\\")}))\")"
}

Reference issue to close (if applicable)


Code Checklist

salman01zp commented 1 year ago

Some tests with tangle as the backend fails in CI with the following error docker network create --subnet=172.20.0.0/16 tangle exited with code 1.

I will create a task to fix the docker issue separately