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

Fix transaction getter being removed when cloning object #202

Merged
merged 2 commits into from
Nov 7, 2023

Conversation

stwiname
Copy link

@stwiname stwiname commented Nov 7, 2023

Description

Fixes transaction missing on log object because it was cloning the object and removing the getter function

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

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 Nov 7, 2023

Coverage report

❌ An unexpected error occurred. For more details, check console

Error: The process '/usr/local/bin/yarn' failed with exit code 1
St.
Category Percentage Covered / Total
🔴 Statements 53.32% 3296/6181
🟡 Branches 65.87% 305/463
🔴 Functions 39.33% 94/239
🔴 Lines 53.32% 3296/6181

Test suite run failed

Failed tests: 8/56. Failed suites: 6/10.
  ● CeloJsonRpcProvider › should not set gasLimit to zero for blocks after the hard fork

    expect(received).toEqual(expected) // deep equality

    - Expected  - 1
    + Received  + 1

      Object {
    -   "hex": "0x01e84800",
    +   "hex": "0x02faf080",
        "type": "BigNumber",
      }

      31 |       await provider.send('eth_getBlockByNumber', ['latest', true]),
      32 |     );
    > 33 |     expect(BigNumber.from(block.gasLimit)).toEqual(BigNumber.from(0x01e84800));
         |                                            ^
      34 |   });
      35 | });
      36 |

      at Object.<anonymous> (packages/node/src/ethereum/ethers/celo/celo-json-rpc-batch-provider.spec.ts:33:44)


  ● CeloJsonRpcProvider › should not set gasLimit to zero for blocks after the hard fork

    expect(received).toEqual(expected) // deep equality

    - Expected  - 1
    + Received  + 1

      Object {
    -   "hex": "0x01e84800",
    +   "hex": "0x02faf080",
        "type": "BigNumber",
      }

      29 |       await provider.send('eth_getBlockByNumber', ['latest', true]),
      30 |     );
    > 31 |     expect(BigNumber.from(block.gasLimit)).toEqual(BigNumber.from(0x01e84800));
         |                                            ^
      32 |   });
      33 | });
      34 |

      at Object.<anonymous> (packages/node/src/ethereum/ethers/celo/celo-json-rpc-provider.spec.ts:31:44)


  ● CeloJsonRpcProvider › should not set gasLimit to zero for blocks after the hard fork

    expect(received).toEqual(expected) // deep equality

    - Expected  - 1
    + Received  + 1

      Object {
    -   "hex": "0x01e84800",
    +   "hex": "0x02faf080",
        "type": "BigNumber",
      }

      29 |       await provider.send('eth_getBlockByNumber', ['latest', true]),
      30 |     );
    > 31 |     expect(BigNumber.from(block.gasLimit)).toEqual(BigNumber.from(0x01e84800));
         |                                            ^
      32 |   });
      33 | });
      34 |

      at Object.<anonymous> (packages/node/src/ethereum/ethers/celo/celo-ws-provider.spec.ts:31:44)


  ● ProjectService › can get a block timestamps

    thrown: "Exceeded timeout of 5000 ms for a test.
    Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."

      40 |   });
      41 |
    > 42 |   it('can get a block timestamps', async () => {
         |   ^
      43 |     const timestamp = await (projectService as any).getBlockTimestamp(
      44 |       4_000_000,
      45 |     );

      at packages/node/src/indexer/project.service.test.ts:42:3
      at Object.<anonymous> (packages/node/src/indexer/project.service.test.ts:20:1)


  ● ApiService › can instantiate api

    All endpoints failed to initialize. Please add healthier endpoints

      64 |     }
      65 |
    > 66 |     await this.createConnections(
         |     ^
      67 |       network,
      68 |       (endpoint) =>
      69 |         EthereumApiConnection.create(

      at EthereumApiService.createConnections (node_modules/@subql/node-core/src/api.service.ts:124:13)
      at EthereumApiService.init (packages/node/src/ethereum/api.service.ethereum.ts:66:5)
      at prepareApiService (packages/node/src/ethereum/api.service.ethereum.test.ts:59:3)
      at Object.<anonymous> (packages/node/src/ethereum/api.service.ethereum.test.ts:69:25)


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

    bad response (status=504, headers={"server":"awselb/2.0","date":"Tue, 07 Nov 2023 21:58:01 GMT","content-type":"text/html","content-length":"132","connection":"keep-alive","set-cookie":"AWSALB=Nji9hgUZeefZk6ouuBgcSXqGPMGlmmOm2oVaQkC86xaucqDZu73b8ysAUJoxz3JiYsla3tL615xcQ58Mj+FDEcGiVTDuNQ8bgxqMmPq47viGIqVTgMVAMxOznr7N; Expires=Tue, 14 Nov 2023 21:57:01 GMT; Path=/, AWSALBCORS=Nji9hgUZeefZk6ouuBgcSXqGPMGlmmOm2oVaQkC86xaucqDZu73b8ysAUJoxz3JiYsla3tL615xcQ58Mj+FDEcGiVTDuNQ8bgxqMmPq47viGIqVTgMVAMxOznr7N; Expires=Tue, 14 Nov 2023 21:57:01 GMT; Path=/; SameSite=None; Secure"}, body="<html>\r\n<head><title>504 Gateway Time-out</title></head>\r\n<body>\r\n<center><h1>504 Gateway Time-out</h1></center>\r\n</body>\r\n</html>\r\n", 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://eth.llamarpc.com", code=SERVER_ERROR, version=web/5.7.1)

      388 |       ) {
      389 |         runningTimeout.cancel();
    > 390 |         logger.throwError('bad response', Logger.errors.SERVER_ERROR, {
          |                ^
      391 |           status: response.statusCode,
      392 |           headers: response.headers,
      393 |           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:390:16

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

    bad response (status=504, headers={"server":"awselb/2.0","date":"Tue, 07 Nov 2023 21:59:01 GMT","content-type":"text/html","content-length":"132","connection":"keep-alive","set-cookie":"AWSALB=YENEFtbQkwR0W2jGbcFd/MYxr8RCMP51gdIaY0i9SEARENETYKN1nNeLwVd1VQw6gJPJQb/aexpw4Wlz6XUsIgPFCdtZBWh69ttKggQw3r/VFFLgYgznnK8qLNDg; Expires=Tue, 14 Nov 2023 21:58:01 GMT; Path=/, AWSALBCORS=YENEFtbQkwR0W2jGbcFd/MYxr8RCMP51gdIaY0i9SEARENETYKN1nNeLwVd1VQw6gJPJQb/aexpw4Wlz6XUsIgPFCdtZBWh69ttKggQw3r/VFFLgYgznnK8qLNDg; Expires=Tue, 14 Nov 2023 21:58:01 GMT; Path=/; SameSite=None; Secure"}, body="<html>\r\n<head><title>504 Gateway Time-out</title></head>\r\n<body>\r\n<center><h1>504 Gateway Time-out</h1></center>\r\n</body>\r\n</html>\r\n", 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://eth.llamarpc.com", code=SERVER_ERROR, version=web/5.7.1)

      388 |       ) {
      389 |         runningTimeout.cancel();
    > 390 |         logger.throwError('bad response', Logger.errors.SERVER_ERROR, {
          |                ^
      391 |           status: response.statusCode,
      392 |           headers: response.headers,
      393 |           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:390:16

  ● Api.ethereum › Resolves the correct tags for finalization

    expect(received).toBeTruthy()

    Received: false

      271 |   it('Resolves the correct tags for finalization', async () => {
      272 |     // Ethereum
    > 273 |     expect((ethApi as any).supportsFinalization).toBeTruthy();
          |                                                  ^
      274 |
      275 |     // Moonbeam
      276 |     ethApi = new EthereumApi(

      at Object.<anonymous> (packages/node/src/ethereum/api.ethereum.test.ts:273:50)

Report generated by 🧪jest coverage report action from 441bc4c

@jiqiang90 jiqiang90 merged commit cff6e8f into main Nov 7, 2023
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