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

feat: update api debug_traceInternalsAndAccountsByBlockHash response type #230

Merged
merged 1 commit into from
Mar 7, 2023

Conversation

linh-1
Copy link
Contributor

@linh-1 linh-1 commented Mar 7, 2023

Why

This PR changed the API debug_traceInternalsAndAccountsByBlockHash response type from internalTxs: Array<Object> into Map<TransactionHash, Object> to add more information.

Old Response

{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "internalTxs": [
      {
        "result": {
          "type": "CALL",
          "from": "0x968d0cd7343f711216817e617d3f92a23dc91c07",
          "to": "0xbddfb67348e0c8ef371d0d87e286d7d6ab918dd9",
          "value": "0x0",
          "gas": "0x53a0",
          "gasUsed": "0x535c",
          "input": "0x876e5861000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000359aef78ffa9807889258d0dd398172ca3b77eb100000000000000000000000045f60b415111e3e7abb4c79fc659d3dee430dff5",
          "output": "0x",
          "calls": [
            {
              "type": "CALL",
              "from": "0xbddfb67348e0c8ef371d0d87e286d7d6ab918dd9",
              "to": "0x359aef78ffa9807889258d0dd398172ca3b77eb1",
              "value": "0x1",
              "gas": "0x8fc",
              "gasUsed": "0x0",
              "input": "0x",
              "output": "0x"
            },
            {
              "type": "CALL",
              "from": "0xbddfb67348e0c8ef371d0d87e286d7d6ab918dd9",
              "to": "0x45f60b415111e3e7abb4c79fc659d3dee430dff5",
              "value": "0x1",
              "gas": "0x8fc",
              "gasUsed": "0x0",
              "input": "0x",
              "output": "0x"
            }
          ]
        }
      }
    ],
    "dirtyAccounts": [
      {
        "address": "0xb6bc5bc0410773a3f86b1537ce7495c52e38f88b",
        "nonce": 0,
        "balance": 1713610971000000000,
        "root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
        "blockNumber": 82015,
        "blockHash": "0x565db29cdfadff8d5d4b40e97f726f2ee1768268a571f8655679070675813b66",
        "deleted": false,
        "suicided": false,
        "dirtyCode": false
      },
      {
        "address": "0x968d0cd7343f711216817e617d3f92a23dc91c07",
        "nonce": 1222,
        "balance": 9.999998962977396e+28,
        "root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
        "blockNumber": 82015,
        "blockHash": "0x565db29cdfadff8d5d4b40e97f726f2ee1768268a571f8655679070675813b66",
        "deleted": false,
        "suicided": false,
        "dirtyCode": false
      },
      {
        "address": "0xbddfb67348e0c8ef371d0d87e286d7d6ab918dd9",
        "nonce": 1,
        "balance": 10000000000000000000,
        "root": "0x85cdfd6328e179265af2232ce2d12ad9aae96b9a6bb237aa6dc24e64a9aa56c8",
        "codeHash": "0x728039315a78449e5a599b35550ddfa2c1dea9fa3e9934e1a7f1dbbd0891c1f4",
        "blockNumber": 82015,
        "blockHash": "0x565db29cdfadff8d5d4b40e97f726f2ee1768268a571f8655679070675813b66",
        "deleted": false,
        "suicided": false,
        "dirtyCode": false
      },
      {
        "address": "0x359aef78ffa9807889258d0dd398172ca3b77eb1",
        "nonce": 0,
        "balance": 129,
        "root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
        "blockNumber": 82015,
        "blockHash": "0x565db29cdfadff8d5d4b40e97f726f2ee1768268a571f8655679070675813b66",
        "deleted": false,
        "suicided": false,
        "dirtyCode": false
      },
      {
        "address": "0x45f60b415111e3e7abb4c79fc659d3dee430dff5",
        "nonce": 0,
        "balance": 108,
        "root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
        "blockNumber": 82015,
        "blockHash": "0x565db29cdfadff8d5d4b40e97f726f2ee1768268a571f8655679070675813b66",
        "deleted": false,
        "suicided": false,
        "dirtyCode": false
      }
    ]
  }
}

New Response

{
    "jsonrpc": "2.0",
    "id": "1",
    "result": {
        "internalTxs": {
            "0x494649af49369af750061340bc1a66c68c4eb7bc4d2600373665f2b02b155671": {
                "result": {
                    "type": "CALL",
                    "from": "0x968d0cd7343f711216817e617d3f92a23dc91c07",
                    "to": "0xbddfb67348e0c8ef371d0d87e286d7d6ab918dd9",
                    "value": "0x0",
                    "gas": "0x53a0",
                    "gasUsed": "0x535c",
                    "input": "0x876e5861000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000359aef78ffa9807889258d0dd398172ca3b77eb100000000000000000000000045f60b415111e3e7abb4c79fc659d3dee430dff5",
                    "output": "0x",
                    "calls": [
                        {
                            "type": "CALL",
                            "from": "0xbddfb67348e0c8ef371d0d87e286d7d6ab918dd9",
                            "to": "0x359aef78ffa9807889258d0dd398172ca3b77eb1",
                            "value": "0x1",
                            "gas": "0x8fc",
                            "gasUsed": "0x0",
                            "input": "0x",
                            "output": "0x"
                        },
                        {
                            "type": "CALL",
                            "from": "0xbddfb67348e0c8ef371d0d87e286d7d6ab918dd9",
                            "to": "0x45f60b415111e3e7abb4c79fc659d3dee430dff5",
                            "value": "0x1",
                            "gas": "0x8fc",
                            "gasUsed": "0x0",
                            "input": "0x",
                            "output": "0x"
                        }
                    ]
                }
            }
        },
        "dirtyAccounts": [
            {
                "address": "0xb6bc5bc0410773a3f86b1537ce7495c52e38f88b",
                "nonce": 0,
                "balance": 1713610971000000000,
                "root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
                "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
                "blockNumber": 82015,
                "blockHash": "0x565db29cdfadff8d5d4b40e97f726f2ee1768268a571f8655679070675813b66",
                "deleted": false,
                "suicided": false,
                "dirtyCode": false
            },
            {
                "address": "0x968d0cd7343f711216817e617d3f92a23dc91c07",
                "nonce": 1222,
                "balance": 99999989629773965226999999493,
                "root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
                "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
                "blockNumber": 82015,
                "blockHash": "0x565db29cdfadff8d5d4b40e97f726f2ee1768268a571f8655679070675813b66",
                "deleted": false,
                "suicided": false,
                "dirtyCode": false
            },
            {
                "address": "0xbddfb67348e0c8ef371d0d87e286d7d6ab918dd9",
                "nonce": 1,
                "balance": 9999999999999999619,
                "root": "0x85cdfd6328e179265af2232ce2d12ad9aae96b9a6bb237aa6dc24e64a9aa56c8",
                "codeHash": "0x728039315a78449e5a599b35550ddfa2c1dea9fa3e9934e1a7f1dbbd0891c1f4",
                "blockNumber": 82015,
                "blockHash": "0x565db29cdfadff8d5d4b40e97f726f2ee1768268a571f8655679070675813b66",
                "deleted": false,
                "suicided": false,
                "dirtyCode": false
            },
            {
                "address": "0x359aef78ffa9807889258d0dd398172ca3b77eb1",
                "nonce": 0,
                "balance": 129,
                "root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
                "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
                "blockNumber": 82015,
                "blockHash": "0x565db29cdfadff8d5d4b40e97f726f2ee1768268a571f8655679070675813b66",
                "deleted": false,
                "suicided": false,
                "dirtyCode": false
            },
            {
                "address": "0x45f60b415111e3e7abb4c79fc659d3dee430dff5",
                "nonce": 0,
                "balance": 108,
                "root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
                "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
                "blockNumber": 82015,
                "blockHash": "0x565db29cdfadff8d5d4b40e97f726f2ee1768268a571f8655679070675813b66",
                "deleted": false,
                "suicided": false,
                "dirtyCode": false
            }
        ]
    }
}

@linh-1 linh-1 merged commit b0064fd into master Mar 7, 2023
@linh-1 linh-1 deleted the feat/update-traceInternalsAndAccounts-res-type branch March 7, 2023 06:51
minh-bq added a commit to minh-bq/ronin that referenced this pull request Mar 8, 2023
This PR: axieinfinity#230 changes the internalTxs
in the response from slice to map which causes panic in CI test because map is
not safe for concurrent use. In order to do this safely, we create a mutex for
synchronization but this may become the bottleneck that defeats the benefit of
multiple concurrent goroutines run in this function.
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.

3 participants