Near-One / rainbow-token-connector

ERC-20/NEP-141 Token Connector for Rainbow Bridge
62 stars 18 forks source link

Some ETH->NEAR transfers cannot be finished #55

Closed alexauroradev closed 3 years ago

alexauroradev commented 3 years ago

Here's the finalisation transaction of the transfer with bridge-testing repo script:

% node build/3-finalise-deposit.js 0x18195ed958ef09c3f64830be71a88bef89fcab7900fe6cd3a405a4351628338e                 (master)
Finalising deposit, that was started in Ethereum transaction 0x18195ed958ef09c3f64830be71a88bef89fcab7900fe6cd3a405a4351628338e
--------------------------------------------------------------------------------
The proof was successfully found
Bridged token address is 6b175474e89094c44da98b954eedeac495271d0f.factory.bridge.near
Bridged token balance of as.near before finalisation of the deposit: 3575000000000000000
Receipt: 9BQrTYhujFYfdVHw6XUu2GPQuTzcs95VqmVVBeSMdmgh
        Failure [factory.bridge.near]: Error: Smart contract panicked: panicked at 'assertion failed: `(left == right)`
  left: `[69, 207, 88, 86, 162, 127, 119, 69, 1, 222, 54, 184, 116, 229, 76, 21, 224, 200, 222, 61, 232, 75, 48, 37, 67, 1, 4, 48, 198, 49, 194, 109]`,
 right: `[161, 27, 116, 90, 184, 119, 30, 126, 66, 126, 232, 197, 37, 10, 148, 19, 220, 247, 143, 120, 216, 79, 76, 45, 67, 97, 35, 221, 143, 129, 219, 86]`', eth-prover/src/lib.rs:186:13
Receipts: 7MjMomRWfcAFPG6hPmrH7YT4zYBRY6vuqsCRfPXg7rFi, B3qfEGzpvc8M3ZoASdYjt8QqoUPonVUPKaCveQFqtXeg
        Failure [factory.bridge.near]: Error: Smart contract panicked: panicked at 'Callback computation 0 was not successful', src/lib.rs:107:1
ServerTransactionError: Smart contract panicked: panicked at 'Callback computation 0 was not successful', src/lib.rs:107:1
    at Object.parseResultError (/Users/alexshevchenko/code/bridge-testing/node_modules/near-api-js/lib/utils/rpc_errors.js:48:29)
    at Account.signAndSendTransaction (/Users/alexshevchenko/code/bridge-testing/node_modules/near-api-js/lib/account.js:151:36)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async /Users/alexshevchenko/code/bridge-testing/node_modules/near-api-js/lib/contract.js:49:39
    at async main (/Users/alexshevchenko/code/bridge-testing/build/3-finalise-deposit.js:58:5) {
  type: 'GuestPanic',
  context: undefined,
  index: 0,
  panic_msg: "panicked at 'Callback computation 0 was not successful', src/lib.rs:107:1",
  kind: {
    panic_msg: "panicked at 'Callback computation 0 was not successful', src/lib.rs:107:1"
  },
  transaction_outcome: {
    proof: [ [Object] ],
    block_hash: 'GyCUbUeiXxAvwX6Nbteut2sN1fW2zG3mVzsempoGfnad',
    id: '9niRvsgv43kJ21SmRhcVikeTKQtT3Y7oWcBCYcGVDM6U',
    outcome: {
      logs: [],
      receipt_ids: [Array],
      gas_burnt: 2434700351888,
      tokens_burnt: '243470035188800000000',
      executor_id: 'as.near',
      status: [Object]
    }
  }
}
paouvrard commented 3 years ago

image

When executed from the frontend, this transaction would have failed before the user is redirected to NEAR Wallet. This is the same issue encountered on Ropsten previously where the computed receipts trie is invalid: the computed trie root does not match the receiptsRoot from the block header. https://github.com/aurora-is-near/rainbow-bridge-client/pull/22 This was reproduced with the ethereumjs tree and with the new lite version we are using.

Ideas why this could be happening:

mfornet commented 3 years ago

It seems to be related with: https://github.com/aurora-is-near/rainbow-bridge/issues/557

I'm investigating right now.

mfornet commented 3 years ago

Found the problem, and added a patch: https://github.com/near/eth-object/pull/1

For the moment I used the new code to finalise this tx successfully: https://explorer.near.org/transactions/5T6gJfwucQZdDcpy2Tj1Th5bfJ9t3rCjM5UpRK9wfL4n