Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Subquery Project from node core #331

Merged
merged 2 commits into from
Jul 25, 2024
Merged

Conversation

stwiname
Copy link

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • I have tested locally
  • I have performed a self review of my changes
  • Updated any relevant documentation
  • Linked to any relevant issues
  • I have added tests relevant to my changes
  • Any dependent changes have been merged and published in downstream modules
  • My code is up to date with the base branch
  • I have updated relevant changelogs. We suggest using chan

Copy link

github-actions bot commented Jul 25, 2024

Coverage report

Caution

Test run failed

St.
Category Percentage Covered / Total
🔴 Statements 55.59% 3459/6222
🟡 Branches 69.44% 418/602
🔴 Functions 55.52% 156/281
🔴 Lines 55.59% 3459/6222

Test suite run failed

Failed tests: 12/91. Failed suites: 2/14.
  ● ApiService › can get the finalized height

    expect(received).toBeGreaterThan(expected)

    Expected: > 16000000
    Received:   0

      87 |
      88 |     console.log('Finalized height', height);
    > 89 |     expect(height).toBeGreaterThan(16_000_000);
         |                    ^
      90 |   });
      91 |
      92 |   it('ensure api errorCode is exposed when throwing', async () => {

      at Object.<anonymous> (packages/node/src/ethereum/api.service.ethereum.test.ts:89:20)


  ● Api.ethereum › Should format transaction in logs, and the transaction gas should be bigInt type

    bad response (status=504, headers={"content-type":"text/plain; charset=utf-8","content-length":"121","connection":"keep-alive","date":"Thu, 25 Jul 2024 23:10:08 GMT","x-continent":"NA","x-cluster":"dc","x-kong-upstream-latency":"8748","x-kong-proxy-latency":"1","via":"kong/2.5.2"}, body="dial tcp 10.102.3.125:3030: i/o timeout. The gateway cannot get a response, please try again or contact the administrator", requestBody="[{\"method\":\"eth_getBlockByNumber\",\"params\":[\"0xf81649\",true],\"id\":46,\"jsonrpc\":\"2.0\"}]", requestMethod="POST", url="https://ethereum.rpc.subquery.network/public", code=SERVER_ERROR, version=web/5.7.1)

      392 |       ) {
      393 |         runningTimeout.cancel();
    > 394 |         throw logger.throwError('bad response', Logger.errors.SERVER_ERROR, {
          |                      ^
      395 |           status: response.statusCode,
      396 |           headers: response.headers,
      397 |           body: bodyify(

      at Logger.Object.<anonymous>.Logger.makeError (node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
      at Logger.Object.<anonymous>.Logger.throwError (node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
      at packages/node/src/ethereum/ethers/web/index.ts:394:22

  ● Api.ethereum › should have the ability to get receipts via transactions from all types

    bad response (status=504, headers={"content-type":"text/plain; charset=utf-8","content-length":"121","connection":"keep-alive","date":"Thu, 25 Jul 2024 23:10:17 GMT","x-continent":"NA","x-cluster":"dc","x-kong-upstream-latency":"6046","x-kong-proxy-latency":"1","via":"kong/2.5.2"}, body="dial tcp 10.102.3.125:3030: i/o timeout. The gateway cannot get a response, please try again or contact the administrator", requestBody="[{\"method\":\"eth_getBlockByNumber\",\"params\":[\"0xf81649\",true],\"id\":46,\"jsonrpc\":\"2.0\"}]", requestMethod="POST", url="https://ethereum.rpc.subquery.network/public", code=SERVER_ERROR, version=web/5.7.1)

      392 |       ) {
      393 |         runningTimeout.cancel();
    > 394 |         throw logger.throwError('bad response', Logger.errors.SERVER_ERROR, {
          |                      ^
      395 |           status: response.statusCode,
      396 |           headers: response.headers,
      397 |           body: bodyify(

      at Logger.Object.<anonymous>.Logger.makeError (node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
      at Logger.Object.<anonymous>.Logger.throwError (node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
      at packages/node/src/ethereum/ethers/web/index.ts:394:22

  ● Api.ethereum › Decode nested logs in transactions

    bad response (status=504, headers={"content-type":"text/plain; charset=utf-8","content-length":"121","connection":"keep-alive","date":"Thu, 25 Jul 2024 23:10:26 GMT","x-continent":"NA","x-cluster":"dc","x-kong-upstream-latency":"6054","x-kong-proxy-latency":"0","via":"kong/2.5.2"}, body="dial tcp 10.102.3.125:3030: i/o timeout. The gateway cannot get a response, please try again or contact the administrator", requestBody="[{\"method\":\"eth_getLogs\",\"params\":[{\"blockHash\":\"0x65bcd860a13664944fcc5fb1bf564a67021076c4470f2bc570a07a60add2c8d6\"}],\"id\":47,\"jsonrpc\":\"2.0\"}]", requestMethod="POST", url="https://ethereum.rpc.subquery.network/public", code=SERVER_ERROR, version=web/5.7.1)

      392 |       ) {
      393 |         runningTimeout.cancel();
    > 394 |         throw logger.throwError('bad response', Logger.errors.SERVER_ERROR, {
          |                      ^
      395 |           status: response.statusCode,
      396 |           headers: response.headers,
      397 |           body: bodyify(

      at Logger.Object.<anonymous>.Logger.makeError (node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
      at Logger.Object.<anonymous>.Logger.throwError (node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
      at packages/node/src/ethereum/ethers/web/index.ts:394:22

  ● Api.ethereum › Should decode transaction data and not clone object

    bad response (status=500, headers={"content-type":"application/json; charset=utf-8","content-length":"104","connection":"keep-alive","access-control-allow-origin":"*","date":"Thu, 25 Jul 2024 23:10:38 GMT","etag":"W/\"68-urGuALY5hurmusg4llLOHQkiw64\"","x-powered-by":"Express","x-continent":"NA","x-cluster":"dc","x-kong-upstream-latency":"10013","x-kong-proxy-latency":"1","via":"kong/2.5.2"}, body="{\"code\":2000,\"error\":\"Request failed: FetchError: reach max retries. error: The operation was aborted.\"}", requestBody="[{\"method\":\"eth_getBlockByNumber\",\"params\":[\"0x0\",false],\"id\":43,\"jsonrpc\":\"2.0\"},{\"method\":\"eth_getBlockByNumber\",\"params\":[\"finalized\",false],\"id\":44,\"jsonrpc\":\"2.0\"}]", requestMethod="POST", url="https://ethereum.rpc.subquery.network/public", code=SERVER_ERROR, version=web/5.7.1)

      392 |       ) {
      393 |         runningTimeout.cancel();
    > 394 |         throw logger.throwError('bad response', Logger.errors.SERVER_ERROR, {
          |                      ^
      395 |           status: response.statusCode,
      396 |           headers: response.headers,
      397 |           body: bodyify(

      at Logger.Object.<anonymous>.Logger.makeError (node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
      at Logger.Object.<anonymous>.Logger.throwError (node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
      at packages/node/src/ethereum/ethers/web/index.ts:394:22

  ● Api.ethereum › Should not clone logs when parsing args

    bad response (status=500, headers={"content-type":"application/json; charset=utf-8","content-length":"104","connection":"keep-alive","access-control-allow-origin":"*","date":"Thu, 25 Jul 2024 23:10:58 GMT","etag":"W/\"68-urGuALY5hurmusg4llLOHQkiw64\"","x-powered-by":"Express","x-continent":"NA","x-cluster":"dc","x-kong-upstream-latency":"10010","x-kong-proxy-latency":"0","via":"kong/2.5.2"}, body="{\"code\":2000,\"error\":\"Request failed: FetchError: reach max retries. error: The operation was aborted.\"}", requestBody="[{\"method\":\"eth_getBlockByNumber\",\"params\":[\"0xf81649\",true],\"id\":48,\"jsonrpc\":\"2.0\"}]", requestMethod="POST", url="https://ethereum.rpc.subquery.network/public", code=SERVER_ERROR, version=web/5.7.1)

      392 |       ) {
      393 |         runningTimeout.cancel();
    > 394 |         throw logger.throwError('bad response', Logger.errors.SERVER_ERROR, {
          |                      ^
      395 |           status: response.statusCode,
      396 |           headers: response.headers,
      397 |           body: bodyify(

      at Logger.Object.<anonymous>.Logger.makeError (node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
      at Logger.Object.<anonymous>.Logger.throwError (node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
      at packages/node/src/ethereum/ethers/web/index.ts:394:22

  ● Api.ethereum › !null filter support for logs, expect to filter out

    bad response (status=504, headers={"content-type":"text/plain; charset=utf-8","content-length":"121","connection":"keep-alive","date":"Thu, 25 Jul 2024 23:11:13 GMT","x-continent":"NA","x-cluster":"dc","x-kong-upstream-latency":"6051","x-kong-proxy-latency":"1","via":"kong/2.5.2"}, body="dial tcp 10.102.3.125:3030: i/o timeout. The gateway cannot get a response, please try again or contact the administrator", requestBody="[{\"method\":\"eth_getLogs\",\"params\":[{\"blockHash\":\"0x65bcd860a13664944fcc5fb1bf564a67021076c4470f2bc570a07a60add2c8d6\"}],\"id\":47,\"jsonrpc\":\"2.0\"}]", requestMethod="POST", url="https://ethereum.rpc.subquery.network/public", code=SERVER_ERROR, version=web/5.7.1)

      392 |       ) {
      393 |         runningTimeout.cancel();
    > 394 |         throw logger.throwError('bad response', Logger.errors.SERVER_ERROR, {
          |                      ^
      395 |           status: response.statusCode,
      396 |           headers: response.headers,
      397 |           body: bodyify(

      at Logger.Object.<anonymous>.Logger.makeError (node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
      at Logger.Object.<anonymous>.Logger.throwError (node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
      at packages/node/src/ethereum/ethers/web/index.ts:394:22

  ● Api.ethereum › Null filter support, for undefined transaction.to

    bad response (status=504, headers={"content-type":"text/plain; charset=utf-8","content-length":"121","connection":"keep-alive","date":"Thu, 25 Jul 2024 23:11:24 GMT","x-continent":"NA","x-cluster":"dc","x-kong-upstream-latency":"6040","x-kong-proxy-latency":"0","via":"kong/2.5.2"}, body="dial tcp 10.102.3.125:3030: i/o timeout. The gateway cannot get a response, please try again or contact the administrator", requestBody="[{\"method\":\"eth_getBlockByNumber\",\"params\":[\"0xf81649\",true],\"id\":46,\"jsonrpc\":\"2.0\"}]", requestMethod="POST", url="https://ethereum.rpc.subquery.network/public", code=SERVER_ERROR, version=web/5.7.1)

      392 |       ) {
      393 |         runningTimeout.cancel();
    > 394 |         throw logger.throwError('bad response', Logger.errors.SERVER_ERROR, {
          |                      ^
      395 |           status: response.statusCode,
      396 |           headers: response.headers,
      397 |           body: bodyify(

      at Logger.Object.<anonymous>.Logger.makeError (node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
      at Logger.Object.<anonymous>.Logger.throwError (node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
      at packages/node/src/ethereum/ethers/web/index.ts:394:22

  ● Api.ethereum › filter.to Should support only null not undefined

    bad response (status=504, headers={"content-type":"text/plain; charset=utf-8","content-length":"121","connection":"keep-alive","date":"Thu, 25 Jul 2024 23:11:39 GMT","x-continent":"NA","x-cluster":"dc","x-kong-upstream-latency":"6037","x-kong-proxy-latency":"1","via":"kong/2.5.2"}, body="dial tcp 10.102.3.125:3030: i/o timeout. The gateway cannot get a response, please try again or contact the administrator", requestBody="[{\"method\":\"eth_getLogs\",\"params\":[{\"blockHash\":\"0x65bcd860a13664944fcc5fb1bf564a67021076c4470f2bc570a07a60add2c8d6\"}],\"id\":47,\"jsonrpc\":\"2.0\"}]", requestMethod="POST", url="https://ethereum.rpc.subquery.network/public", code=SERVER_ERROR, version=web/5.7.1)

      392 |       ) {
      393 |         runningTimeout.cancel();
    > 394 |         throw logger.throwError('bad response', Logger.errors.SERVER_ERROR, {
          |                      ^
      395 |           status: response.statusCode,
      396 |           headers: response.headers,
      397 |           body: bodyify(

      at Logger.Object.<anonymous>.Logger.makeError (node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
      at Logger.Object.<anonymous>.Logger.throwError (node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
      at packages/node/src/ethereum/ethers/web/index.ts:394:22

  ● Api.ethereum › If transaction is undefined, with null filter, should be supported

    bad response (status=504, headers={"content-type":"text/plain; charset=utf-8","content-length":"121","connection":"keep-alive","date":"Thu, 25 Jul 2024 23:11:46 GMT","x-continent":"NA","x-cluster":"dc","x-kong-upstream-latency":"10545","x-kong-proxy-latency":"1","via":"kong/2.5.2"}, body="dial tcp 10.102.3.125:3030: i/o timeout. The gateway cannot get a response, please try again or contact the administrator", requestBody="[{\"method\":\"eth_getBlockByNumber\",\"params\":[\"0x0\",false],\"id\":43,\"jsonrpc\":\"2.0\"},{\"method\":\"eth_getBlockByNumber\",\"params\":[\"finalized\",false],\"id\":44,\"jsonrpc\":\"2.0\"}]", requestMethod="POST", url="https://ethereum.rpc.subquery.network/public", code=SERVER_ERROR, version=web/5.7.1)

      392 |       ) {
      393 |         runningTimeout.cancel();
    > 394 |         throw logger.throwError('bad response', Logger.errors.SERVER_ERROR, {
          |                      ^
      395 |           status: response.statusCode,
      396 |           headers: response.headers,
      397 |           body: bodyify(

      at Logger.Object.<anonymous>.Logger.makeError (node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
      at Logger.Object.<anonymous>.Logger.throwError (node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
      at packages/node/src/ethereum/ethers/web/index.ts:394:22

  ● Api.ethereum › Resolves the correct tags for finalization

    no response

      173 |             );
      174 |           } else if (payload.error) {
    > 175 |             const error = new Error(payload.error.message);
          |                           ^
      176 |             (<any>error).code = payload.error.code;
      177 |             (<any>error).data = payload.error.data;
      178 |             if (

      at packages/node/src/ethereum/ethers/json-rpc-batch-provider.ts:175:27
          at Array.forEach (<anonymous>)
      at packages/node/src/ethereum/ethers/json-rpc-batch-provider.ts:166:15

  ● Api.ethereum › Should able to check is fullBlock

    bad response (status=504, headers={"content-type":"text/plain; charset=utf-8","content-length":"121","connection":"keep-alive","date":"Thu, 25 Jul 2024 23:12:34 GMT","x-continent":"NA","x-cluster":"dc","x-kong-upstream-latency":"6050","x-kong-proxy-latency":"0","via":"kong/2.5.2"}, body="dial tcp 10.102.3.125:3030: i/o timeout. The gateway cannot get a response, please try again or contact the administrator", requestBody="[{\"method\":\"eth_getLogs\",\"params\":[{\"blockHash\":\"0x65bcd860a13664944fcc5fb1bf564a67021076c4470f2bc570a07a60add2c8d6\"}],\"id\":47,\"jsonrpc\":\"2.0\"}]", requestMethod="POST", url="https://ethereum.rpc.subquery.network/public", code=SERVER_ERROR, version=web/5.7.1)

      392 |       ) {
      393 |         runningTimeout.cancel();
    > 394 |         throw logger.throwError('bad response', Logger.errors.SERVER_ERROR, {
          |                      ^
      395 |           status: response.statusCode,
      396 |           headers: response.headers,
      397 |           body: bodyify(

      at Logger.Object.<anonymous>.Logger.makeError (node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
      at Logger.Object.<anonymous>.Logger.throwError (node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
      at packages/node/src/ethereum/ethers/web/index.ts:394:22

Report generated by 🧪jest coverage report action from 034ba51

@stwiname stwiname merged commit 73175a0 into main Jul 25, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants