Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Use Chain ID from process.env in E2E tests #51

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lalexgap
Copy link
Contributor

@lalexgap lalexgap commented Feb 18, 2021

Description

Consistently set the chainId to process.env.CHAIN_NETWORK_ID .

I noticed this error in the logs:

RuntimeError: VM Exception while processing transaction: revert Incorrect chainId\

Upon investigation, I confirmed that we're not actually setting the networkChainID properly in various wallet configurations used for e2e-testing.

This PR fixes that (and works around this issue).

Testing

This branch includes this change and has a chain e2e test enabled. By viewing the logs I've verified that we now see the correct chainNetworkId of 9002 .


Checklist:

Code quality

  • I have written clear commit messages
  • I have performed a self-review of my own code
  • This change does not have an unduly wide scope
  • I have separated logic changes from refactor changes (formatting, renames, etc.)
  • I have commented my code wherever necessary (can be 0)
  • I have added tests that prove my fix is effective or that my feature works, if necessary

Project management

  • I have applied the appropriate labels
  • I have linked to all relevant issues (can be 0)
  • I have added all dependent tickets (can be 0)
  • I have assigned myself to this PR
  • I have chosen the appropriate pipeline on zenhub for the linked issue

@lalexgap lalexgap self-assigned this Feb 18, 2021
@lalexgap lalexgap added the 🐛 bug non-breaking change which fixes an issue label Feb 18, 2021
@lalexgap lalexgap marked this pull request as ready for review February 18, 2021 22:34
@lalexgap lalexgap changed the title Use Chain ID from process.env Use Chain ID from process.env in E2E tests Feb 18, 2021
Copy link
Contributor

@andrewgordstewart andrewgordstewart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This branch includes this change and has a chain e2e test enabled. By viewing the logs I've verified that we now see the correct chainNetworkId of 9002 .

Should the test fail when the following error is logged?

RuntimeError: VM Exception while processing transaction: revert Incorrect chainId\

If no, why not?

If yes, why didn't it fail? Should we do this?

  1. Address the test issue, exhibiting a test failure when the VM Exception is raised
  2. Address the chainId issue, and observe that the failing test now passes

Comment on lines +34 to +36
10_000, // timeout
10_00_000_000, // gasLimit
1 // gasPrice
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops this was copied from the chain-setup in server-wallet. The important bit is that we don't use 1337 as the chain id.

@lalexgap
Copy link
Contributor Author

lalexgap commented Feb 19, 2021

So this is what is happening:

  • evm validation is disabled for the e2e test (you can see in the logs. This is because we use defaultTestConfig which has it disabled.
  • Things work until we attempt to send a transaction to conclude.
  • Ganache returns an error when ethers tries to estimateGas. This is due to it trying to run the transaction through a vm and it failing with an invalid chainId. (See errow below)
  • The chainService assumes the transaction failed due to the opponent submitting it.

Some takeaways:

  • The chainService should probably check for this kind of error and throw it instead of swallowing it.
  • Our chain e2e test in this repo should probably be checking that the funds end up getting withdrawn. This would have caught this right away.
  • we should probably disable skipEvmValidation
[2021-02-18 00:52:00.554 +0000] DEBUG (1439): [ChainService] Submitting transaction to the blockchain
    dbName: "payer"
    walletVersion: "@statechannels/server-wallet@1.22.0"
    module: "ChainService"
    data: "0xeb026514000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000e062219fff9e1e777c197e6cfd136c3f9d848439d08993c1edf7e0c1124fb3ca1000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000460000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036ee800000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b9adc9f8c69a8865776d2381bc3317a9e7f97f46000000000000000000000000333356f625259653a2b6d7da44162631dcbdf93f00000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000116090efec8a6c176a094d3094c58811a7ea39c0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000011115faf6f1bf263e81956f0cc68aec8426607cf000000000000000000000000000000000000000000000000000000e8d4a510000000000000000000000000009f7ffcb016b0f7b142529bf27ef1ec5b0039c32c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001bde3f26e3223293c9302593d51f62eff5e9308424e2112bc8c6b36da7b690d7980b0f8bb05ab1abb2ecfdc97d7fd07ebbd1698c818615982e7ce2e2df9e2dda9d000000000000000000000000000000000000000000000000000000000000001b03f41d304614fce883698cbfd47968b197357c7c5a20cc322b181db4d23b9beb1a8295c4efec17e5c16f1771d5740ad49c597d8f68b59c9819842b5d5bc085bf"
    to: "0xc9707E1e496C12f1Fa83AFbbA8735DA697cdBf64"
[2021-02-18 00:52:00.589 +0000] ERROR (1439): [ChainService] Transaction submission failed
    dbName: "payer"
    walletVersion: "@statechannels/server-wallet@1.22.0"
    module: "ChainService"
    err: {
      "type": "Error",
      "message": "cannot estimate gas; transaction may fail or may require manual gas limit (error={\"reason\":\"processing response error\",\"code\":\"SERVER_ERROR\",\"body\":\"{\\\"id\\\":225,\\\"jsonrpc\\\":\\\"2.0\\\",\\\"error\\\":{\\\"message\\\":\\\"VM Exception while processing transaction: revert Incorrect chainId\\\",\\\"code\\\":-32000,\\\"data\\\":{\\\"stack\\\":\\\"RuntimeError: VM Exception while processing transaction: revert Incorrect chainId\\\\n    at Function.RuntimeError.fromResults (/root/project/node_modules/ganache-core/lib/utils/runtimeerror.js:94:13)\\\\n    at module.exports (/root/project/node_modules/ganache-core/lib/utils/gas/guestimation.js:142:32)\\\",\\\"name\\\":\\\"RuntimeError\\\"}}}\",\"error\":{\"code\":-32000,\"data\":{\"stack\":\"RuntimeError: VM Exception while processing transaction: revert Incorrect chainId\\n    at Function.RuntimeError.fromResults (/root/project/node_modules/ganache-core/lib/utils/runtimeerror.js:94:13)\\n    at module.exports (/root/project/node_modules/ganache-core/lib/utils/gas/guestimation.js:142:32)\",\"name\":\"RuntimeError\"}},\"requestBody\":\"{\\\"method\\\":\\\"eth_estimateGas\\\",\\\"params\\\":[{\\\"gasPrice\\\":\\\"0x1\\\",\\\"from\\\":\\\"0xd9995bae12fee327256ffec1e3184d492bd94c31\\\",\\\"to\\\":\\\"0xc9707e1e496c12f1fa83afbba8735da697cdbf64\\\",\\\"data\\\":\\\"0xeb026514000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000e062219fff9e1e777c197e6cfd136c3f9d848439d08993c1edf7e0c1124fb3ca1000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000460000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036ee800000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b9adc9f8c69a8865776d2381bc3317a9e7f97f46000000000000000000000000333356f625259653a2b6d7da44162631dcbdf93f00000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000116090efec8a6c176a094d3094c58811a7ea39c0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000011115faf6f1bf263e81956f0cc68aec8426607cf000000000000000000000000000000000000000000000000000000e8d4a510000000000000000000000000009f7ffcb016b0f7b142529bf27ef1ec5b0039c32c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001bde3f26e3223293c9302593d51f62eff5e9308424e2112bc8c6b36da7b690d7980b0f8bb05ab1abb2ecfdc97d7fd07ebbd1698c818615982e7ce2e2df9e2dda9d000000000000000000000000000000000000000000000000000000000000001b03f41d304614fce883698cbfd47968b197357c7c5a20cc322b181db4d23b9beb1a8295c4efec17e5c16f1771d5740ad49c597d8f68b59c9819842b5d5bc085bf\\\"}],\\\"id\\\":225,\\\"jsonrpc\\\":\\\"2.0\\\"}\",\"requestMethod\":\"POST\",\"url\":\"http://0.0.0.0:8545\"}, tx={\"data\":\"0xeb026514000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000e062219fff9e1e777c197e6cfd136c3f9d848439d08993c1edf7e0c1124fb3ca1000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000460000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036ee800000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b9adc9f8c69a8865776d2381bc3317a9e7f97f46000000000000000000000000333356f625259653a2b6d7da44162631dcbdf93f00000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000116090efec8a6c176a094d3094c58811a7ea39c0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000011115faf6f1bf263e81956f0cc68aec8426607cf000000000000000000000000000000000000000000000000000000e8d4a510000000000000000000000000009f7ffcb016b0f7b142529bf27ef1ec5b0039c32c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001bde3f26e3223293c9302593d51f62eff5e9308424e2112bc8c6b36da7b690d7980b0f8bb05ab1abb2ecfdc97d7fd07ebbd1698c818615982e7ce2e2df9e2dda9d000000000000000000000000000000000000000000000000000000000000001b03f41d304614fce883698cbfd47968b197357c7c5a20cc322b181db4d23b9beb1a8295c4efec17e5c16f1771d5740ad49c597d8f68b59c9819842b5d5bc085bf\",\"to\":{},\"nonce\":9,\"from\":\"0xD9995BAE12FEe327256FFec1e3184d492bD94C31\",\"gasPrice\":{},\"gasLimit\":{},\"chainId\":{}}, code=UNPREDICTABLE_GAS_LIMIT, version=abstract-signer/5.0.7)",
      "stack":
          Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={"reason":"processing response error","code":"SERVER_ERROR","body":"{\"id\":225,\"jsonrpc\":\"2.0\",\"error\":{\"message\":\"VM Exception while processing transaction: revert Incorrect chainId\",\"code\":-32000,\"data\":{\"stack\":\"RuntimeError: VM Exception while processing transaction: revert Incorrect chainId\\n    at Function.RuntimeError.fromResults (/root/project/node_modules/ganache-core/lib/utils/runtimeerror.js:94:13)\\n    at module.exports (/root/project/node_modules/ganache-core/lib/utils/gas/guestimation.js:142:32)\",\"name\":\"RuntimeError\"}}}","error":{"code":-32000,"data":{"stack":"RuntimeError: VM Exception while processing transaction: revert Incorrect chainId\n    at Function.RuntimeError.fromResults (/root/project/node_modules/ganache-core/lib/utils/runtimeerror.js:94:13)\n    at module.exports (/root/project/node_modules/ganache-core/lib/utils/gas/guestimation.js:142:32)","name":"RuntimeError"}},"requestBody":"{\"method\":\"eth_estimateGas\",\"params\":[{\"gasPrice\":\"0x1\",\"from\":\"0xd9995bae12fee327256ffec1e3184d492bd94c31\",\"to\":\"0xc9707e1e496c12f1fa83afbba8735da697cdbf64\",\"data\":\"0xeb026514000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000e062219fff9e1e777c197e6cfd136c3f9d848439d08993c1edf7e0c1124fb3ca1000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000460000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036ee800000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b9adc9f8c69a8865776d2381bc3317a9e7f97f46000000000000000000000000333356f625259653a2b6d7da44162631dcbdf93f00000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000116090efec8a6c176a094d3094c58811a7ea39c0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000011115faf6f1bf263e81956f0cc68aec8426607cf000000000000000000000000000000000000000000000000000000e8d4a510000000000000000000000000009f7ffcb016b0f7b142529bf27ef1ec5b0039c32c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001bde3f26e3223293c9302593d51f62eff5e9308424e2112bc8c6b36da7b690d7980b0f8bb05ab1abb2ecfdc97d7fd07ebbd1698c818615982e7ce2e2df9e2dda9d000000000000000000000000000000000000000000000000000000000000001b03f41d304614fce883698cbfd47968b197357c7c5a20cc322b181db4d23b9beb1a8295c4efec17e5c16f1771d5740ad49c597d8f68b59c9819842b5d5bc085bf\"}],\"id\":225,\"jsonrpc\":\"2.0\"}","requestMethod":"POST","url":"http://0.0.0.0:8545"}, tx={"data":"0xeb026514000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000e062219fff9e1e777c197e6cfd136c3f9d848439d08993c1edf7e0c1124fb3ca1000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000460000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036ee800000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b9adc9f8c69a8865776d2381bc3317a9e7f97f46000000000000000000000000333356f625259653a2b6d7da44162631dcbdf93f00000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000116090efec8a6c176a094d3094c58811a7ea39c0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000011115faf6f1bf263e81956f0cc68aec8426607cf000000000000000000000000000000000000000000000000000000e8d4a510000000000000000000000000009f7ffcb016b0f7b142529bf27ef1ec5b0039c32c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001bde3f26e3223293c9302593d51f62eff5e9308424e2112bc8c6b36da7b690d7980b0f8bb05ab1abb2ecfdc97d7fd07ebbd1698c818615982e7ce2e2df9e2dda9d000000000000000000000000000000000000000000000000000000000000001b03f41d304614fce883698cbfd47968b197357c7c5a20cc322b181db4d23b9beb1a8295c4efec17e5c16f1771d5740ad49c597d8f68b59c9819842b5d5bc085bf","to":{},"nonce":9,"from":"0xD9995BAE12FEe327256FFec1e3184d492bD94C31","gasPrice":{},"gasLimit":{},"chainId":{}}, code=UNPREDICTABLE_GAS_LIMIT, version=abstract-signer/5.0.7)
              at Logger.makeError (/root/project/node_modules/@ethersproject/logger/src.ts/index.ts:205:28)
              at Logger.throwError (/root/project/node_modules/@ethersproject/logger/src.ts/index.ts:217:20)
              at /root/project/node_modules/@ethersproject/abstract-signer/src.ts/index.ts:204:31
              at runMicrotasks (<anonymous>)
              at processTicksAndRejections (internal/process/task_queues.js:97:5)
              at async Promise.all (index 5)
      "reason": "cannot estimate gas; transaction may fail or may require manual gas limit",
      "code": "UNPREDICTABLE_GAS_LIMIT",
      "error": {
        "type": "Error",
        "message": "processing response error (body=\"{\\\"id\\\":225,\\\"jsonrpc\\\":\\\"2.0\\\",\\\"error\\\":{\\\"message\\\":\\\"VM Exception while processing transaction: revert Incorrect chainId\\\",\\\"code\\\":-32000,\\\"data\\\":{\\\"stack\\\":\\\"RuntimeError: VM Exception while processing transaction: revert Incorrect chainId\\\\n    at Function.RuntimeError.fromResults (/root/project/node_modules/ganache-core/lib/utils/runtimeerror.js:94:13)\\\\n    at module.exports (/root/project/node_modules/ganache-core/lib/utils/gas/guestimation.js:142:32)\\\",\\\"name\\\":\\\"RuntimeError\\\"}}}\", error={\"code\":-32000,\"data\":{\"stack\":\"RuntimeError: VM Exception while processing transaction: revert Incorrect chainId\\n    at Function.RuntimeError.fromResults (/root/project/node_modules/ganache-core/lib/utils/runtimeerror.js:94:13)\\n    at module.exports (/root/project/node_modules/ganache-core/lib/utils/gas/guestimation.js:142:32)\",\"name\":\"RuntimeError\"}}, requestBody=\"{\\\"method\\\":\\\"eth_estimateGas\\\",\\\"params\\\":[{\\\"gasPrice\\\":\\\"0x1\\\",\\\"from\\\":\\\"0xd9995bae12fee327256ffec1e3184d492bd94c31\\\",\\\"to\\\":\\\"0xc9707e1e496c12f1fa83afbba8735da697cdbf64\\\",\\\"data\\\":\\\"0xeb026514000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000e062219fff9e1e777c197e6cfd136c3f9d848439d08993c1edf7e0c1124fb3ca1000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000460000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036ee800000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b9adc9f8c69a8865776d2381bc3317a9e7f97f46000000000000000000000000333356f625259653a2b6d7da44162631dcbdf93f00000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000116090efec8a6c176a094d3094c58811a7ea39c0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000011115faf6f1bf263e81956f0cc68aec8426607cf000000000000000000000000000000000000000000000000000000e8d4a510000000000000000000000000009f7ffcb016b0f7b142529bf27ef1ec5b0039c32c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001bde3f26e3223293c9302593d51f62eff5e9308424e2112bc8c6b36da7b690d7980b0f8bb05ab1abb2ecfdc97d7fd07ebbd1698c818615982e7ce2e2df9e2dda9d000000000000000000000000000000000000000000000000000000000000001b03f41d304614fce883698cbfd47968b197357c7c5a20cc322b181db4d23b9beb1a8295c4efec17e5c16f1771d5740ad49c597d8f68b59c9819842b5d5bc085bf\\\"}],\\\"id\\\":225,\\\"jsonrpc\\\":\\\"2.0\\\"}\", requestMethod=\"POST\", url=\"http://0.0.0.0:8545\", code=SERVER_ERROR, version=web/5.0.9)",
        "stack":
            Error: processing response error (body="{\"id\":225,\"jsonrpc\":\"2.0\",\"error\":{\"message\":\"VM Exception while processing transaction: revert Incorrect chainId\",\"code\":-32000,\"data\":{\"stack\":\"RuntimeError: VM Exception while processing transaction: revert Incorrect chainId\\n    at Function.RuntimeError.fromResults (/root/project/node_modules/ganache-core/lib/utils/runtimeerror.js:94:13)\\n    at module.exports (/root/project/node_modules/ganache-core/lib/utils/gas/guestimation.js:142:32)\",\"name\":\"RuntimeError\"}}}", error={"code":-32000,"data":{"stack":"RuntimeError: VM Exception while processing transaction: revert Incorrect chainId\n    at Function.RuntimeError.fromResults (/root/project/node_modules/ganache-core/lib/utils/runtimeerror.js:94:13)\n    at module.exports (/root/project/node_modules/ganache-core/lib/utils/gas/guestimation.js:142:32)","name":"RuntimeError"}}, requestBody="{\"method\":\"eth_estimateGas\",\"params\":[{\"gasPrice\":\"0x1\",\"from\":\"0xd9995bae12fee327256ffec1e3184d492bd94c31\",\"to\":\"0xc9707e1e496c12f1fa83afbba8735da697cdbf64\",\"data\":\"0xeb026514000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000e062219fff9e1e777c197e6cfd136c3f9d848439d08993c1edf7e0c1124fb3ca1000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000460000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036ee800000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b9adc9f8c69a8865776d2381bc3317a9e7f97f46000000000000000000000000333356f625259653a2b6d7da44162631dcbdf93f00000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000116090efec8a6c176a094d3094c58811a7ea39c0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000011115faf6f1bf263e81956f0cc68aec8426607cf000000000000000000000000000000000000000000000000000000e8d4a510000000000000000000000000009f7ffcb016b0f7b142529bf27ef1ec5b0039c32c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001bde3f26e3223293c9302593d51f62eff5e9308424e2112bc8c6b36da7b690d7980b0f8bb05ab1abb2ecfdc97d7fd07ebbd1698c818615982e7ce2e2df9e2dda9d000000000000000000000000000000000000000000000000000000000000001b03f41d304614fce883698cbfd47968b197357c7c5a20cc322b181db4d23b9beb1a8295c4efec17e5c16f1771d5740ad49c597d8f68b59c9819842b5d5bc085bf\"}],\"id\":225,\"jsonrpc\":\"2.0\"}", requestMethod="POST", url="http://0.0.0.0:8545", code=SERVER_ERROR, version=web/5.0.9)
                at Logger.makeError (/root/project/node_modules/@ethersproject/logger/src.ts/index.ts:205:28)
                at Logger.throwError (/root/project/node_modules/@ethersproject/logger/src.ts/index.ts:217:20)
                at /root/project/node_modules/@ethersproject/web/src.ts/index.ts:284:28
                at step (/root/project/node_modules/@ethersproject/web/lib/index.js:33:23)
                at Object.next (/root/project/node_modules/@ethersproject/web/lib/index.js:14:53)
                at fulfilled (/root/project/node_modules/@ethersproject/web/lib/index.js:5:58)
                at runMicrotasks (<anonymous>)
                at processTicksAndRejections (internal/process/task_queues.js:97:5)
        "reason": "processing response error",
        "code": "SERVER_ERROR",
        "body": "{\"id\":225,\"jsonrpc\":\"2.0\",\"error\":{\"message\":\"VM Exception while processing transaction: revert Incorrect chainId\",\"code\":-32000,\"data\":{\"stack\":\"RuntimeError: VM Exception while processing transaction: revert Incorrect chainId\\n    at Function.RuntimeError.fromResults (/root/project/node_modules/ganache-core/lib/utils/runtimeerror.js:94:13)\\n    at module.exports (/root/project/node_modules/ganache-core/lib/utils/gas/guestimation.js:142:32)\",\"name\":\"RuntimeError\"}}}",
        "error": {
          "type": "Error",
          "message": "VM Exception while processing transaction: revert Incorrect chainId",
          "stack":
              Error: VM Exception while processing transaction: revert Incorrect chainId
                  at getResult (/root/project/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:76:28)
                  at processJsonFunc (/root/project/node_modules/@ethersproject/web/src.ts/index.ts:326:22)
                  at /root/project/node_modules/@ethersproject/web/src.ts/index.ts:263:42
                  at step (/root/project/node_modules/@ethersproject/web/lib/index.js:33:23)
                  at Object.next (/root/project/node_modules/@ethersproject/web/lib/index.js:14:53)
                  at fulfilled (/root/project/node_modules/@ethersproject/web/lib/index.js:5:58)
                  at runMicrotasks (<anonymous>)
                  at processTicksAndRejections (internal/process/task_queues.js:97:5)
          "code": -32000,
          "data": {
            "stack":
                RuntimeError: VM Exception while processing transaction: revert Incorrect chainId
                    at Function.RuntimeError.fromResults (/root/project/node_modules/ganache-core/lib/utils/runtimeerror.js:94:13)
                    at module.exports (/root/project/node_modules/ganache-core/lib/utils/gas/guestimation.js:142:32)
            "name": "RuntimeError"
          }
        },
        "requestBody": "{\"method\":\"eth_estimateGas\",\"params\":[{\"gasPrice\":\"0x1\",\"from\":\"0xd9995bae12fee327256ffec1e3184d492bd94c31\",\"to\":\"0xc9707e1e496c12f1fa83afbba8735da697cdbf64\",\"data\":\"0xeb026514000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000e062219fff9e1e777c197e6cfd136c3f9d848439d08993c1edf7e0c1124fb3ca1000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000460000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036ee800000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b9adc9f8c69a8865776d2381bc3317a9e7f97f46000000000000000000000000333356f625259653a2b6d7da44162631dcbdf93f00000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000116090efec8a6c176a094d3094c58811a7ea39c0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000011115faf6f1bf263e81956f0cc68aec8426607cf000000000000000000000000000000000000000000000000000000e8d4a510000000000000000000000000009f7ffcb016b0f7b142529bf27ef1ec5b0039c32c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001bde3f26e3223293c9302593d51f62eff5e9308424e2112bc8c6b36da7b690d7980b0f8bb05ab1abb2ecfdc97d7fd07ebbd1698c818615982e7ce2e2df9e2dda9d000000000000000000000000000000000000000000000000000000000000001b03f41d304614fce883698cbfd47968b197357c7c5a20cc322b181db4d23b9beb1a8295c4efec17e5c16f1771d5740ad49c597d8f68b59c9819842b5d5bc085bf\"}],\"id\":225,\"jsonrpc\":\"2.0\"}",
        "requestMethod": "POST",
        "url": "http://0.0.0.0:8545"
      },
      "tx": {
        "data": "0xeb026514000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000e062219fff9e1e777c197e6cfd136c3f9d848439d08993c1edf7e0c1124fb3ca1000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000460000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036ee800000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b9adc9f8c69a8865776d2381bc3317a9e7f97f46000000000000000000000000333356f625259653a2b6d7da44162631dcbdf93f00000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000116090efec8a6c176a094d3094c58811a7ea39c0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000011115faf6f1bf263e81956f0cc68aec8426607cf000000000000000000000000000000000000000000000000000000e8d4a510000000000000000000000000009f7ffcb016b0f7b142529bf27ef1ec5b0039c32c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001bde3f26e3223293c9302593d51f62eff5e9308424e2112bc8c6b36da7b690d7980b0f8bb05ab1abb2ecfdc97d7fd07ebbd1698c818615982e7ce2e2df9e2dda9d000000000000000000000000000000000000000000000000000000000000001b03f41d304614fce883698cbfd47968b197357c7c5a20cc322b181db4d23b9beb1a8295c4efec17e5c16f1771d5740ad49c597d8f68b59c9819842b5d5bc085bf",
        "to": {},
        "nonce": 9,
        "from": "0xD9995BAE12FEe327256FFec1e3184d492bD94C31",
        "gasPrice": {},
        "gasLimit": {},
        "chainId": {}
      }
    }
[2021-02-18 00:52:00.663 +0000] WARN (1439): [ChainService] Transaction to conclude channel failed: channel is already finalized
    dbName: "payer"
    walletVersion: "@statechannels/server-wallet@1.22.0"
    module: "ChainService"
    channelId: "0x42e9fa43a169c888bc4bff08db67df77268675ccb4d3af371889ca9f0eabd657"
    determinedBy: "Javascript check"

@lalexgap
Copy link
Contributor Author

Since the chainId only gets checked when we submit a transaction we only run into an issue when submitting the conclude transaction.

@geoknee
Copy link
Contributor

geoknee commented Feb 22, 2021

I remember we had much discussion in the past about configuration via environment variables. I think we should certainly not be doing that in the server wallet code itself (since we have a configuration object that we pass in that specifies the config). Does it make sense to do it in the e2e tests in this repo? (genuine question)

@lalexgap
Copy link
Contributor Author

I remember we had much discussion in the past about configuration via environment variables. I think we should certainly not be doing that in the server wallet code itself (since we have a configuration object that we pass in that specifies the config). Does it make sense to do it in the e2e tests in this repo? (genuine question)

I think this is ok because we're only using it in the context of tests. It's just a convenient way to pass a value from the chain-setup to the test.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐛 bug non-breaking change which fixes an issue 🥕 conventional
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants