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: EthAPI: Make newEthBlockFromFilecoinTipSet faster and correct #10380

Merged
merged 1 commit into from
Mar 4, 2023

Conversation

arajasek
Copy link
Contributor

@arajasek arajasek commented Mar 2, 2023

Related Issues

Wany on Slack reported that trying to eth_getBlockByNumber on hyperspace #124390 incorrectly returned empty values. This was because we have silent failures in newEthBlockFromFilecoinTipSet, which gives up and returns empty blocks with no errors if message lookups fail.

Proposed Changes

  • Use StateCompute on the relevant tipset, instead of StateSearchMsging every message which would be very slow and potentially fail
  • Stop silently succeeding on any error case

Additional Info

Checklist

Before you mark the PR ready for review, please make sure that:

  • Commits have a clear commit message.
  • PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, test
    • area, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps
  • New features have usage guidelines and / or documentation updates in
  • Tests exist for new functionality or change in behavior
  • CI is green

@jennijuju jennijuju merged commit d3dfb5c into master Mar 4, 2023
@jennijuju jennijuju deleted the asr/fix-eth-api branch March 4, 2023 02:10
@jennijuju jennijuju mentioned this pull request Mar 6, 2023

for txIdx, msg := range compOutput.Trace {
// skip system messages like reward application and cron
if msg.Msg.From == builtintypes.SystemActorAddr {
Copy link

Choose a reason for hiding this comment

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

@arajasek, there is still an issue. The transactionIndex returns different results in the eth_getBlockByNumber and eth_getTransactionReceipt interfaces. The reason is that txIdx did not ignore system messages, and this is not as expected.

Example in hyperspace:

 curl -s --location 'http://localhost:8839/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
    "jsonrpc":"2.0",
    "method":"eth_getTransactionReceipt",
    "params":["0xcc502ba55e9d312349c647783964c7edb00c3890b96842bd53e718475dc8c71e"],
    "id":1
}' |gojq
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "blockHash": "0x52206698ebadc31c0e3e211a9cd3f02dc81603f74e8a604dc460fa3cab1f597b",
    "blockNumber": "0x1f302",
    "contractAddress": null,
    "cumulativeGasUsed": "0x0",
    "effectiveGasPrice": "0x48724a74",
    "from": "0xff000000000000000000000000000000000005e4",
    "gasUsed": "0x135482a",
    "logs": [],
    "logsBloom": "0x09000c0000085003840012000100102008204100010000002105018000100000040000400024000100800000003000000010001002001110500000020016a0048880004040800081488100088e80400208048011010410000120000180002086200000280a022004000000812068490000002004000400000a01001000420800010000440400000002410100000004045800200500b000a0800140024001000060081000008109000000001800020800000420008083800060888044000040000200840a00002010600000000010d0800400000000080048081408000800600028400800048000400000400000a1000108000020001003440504088000026000",
    "root": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "status": "0x1",
    "to": "0xff0000000000000000000000000000000000088a",
    "transactionHash": "0xcc502ba55e9d312349c647783964c7edb00c3890b96842bd53e718475dc8c71e",
    "transactionIndex": "0x0",
    "type": "0x2"
  }
}
curl -s --location 'http://localhost:8839/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "eth_getBlockByNumber",
"id": 1,
"params": ["0x1f302", true]
}
' |gojq
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "baseFeePerGas": "0x64",
    "difficulty": "0x0",
    "extraData": "0x",
    "gasLimit": "0x2540be400",
    "gasUsed": "0x135482a",
    "hash": "0x52206698ebadc31c0e3e211a9cd3f02dc81603f74e8a604dc460fa3cab1f597b",
    "logsBloom": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
    "miner": "0x0000000000000000000000000000000000000000",
    "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "nonce": "0x0000000000000000",
    "number": "0x1f302",
    "parentHash": "0xef02f6d94ef93a9755fcfa001708a45f058569e5a871b9b0ed574a2ee79501c6",
    "receiptsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "size": "0x0",
    "stateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "timestamp": "0x63ff621c",
    "totalDifficulty": "0x0",
    "transactions": [
      {
        "accessList": [],
        "blockHash": "0x52206698ebadc31c0e3e211a9cd3f02dc81603f74e8a604dc460fa3cab1f597b",
        "blockNumber": "0x1f302",
        "chainId": "0xc45",
        "from": "0xff000000000000000000000000000000000005e4",
        "gas": "0x18149c7",
        "hash": "0xcc502ba55e9d312349c647783964c7edb00c3890b96842bd53e718475dc8c71e",
        "input": "0x",
        "maxFeePerGas": "0x3a27a7a0",
        "maxPriorityFeePerGas": "0x3a27a382",
        "nonce": "0x113f",
        "r": "0x0",
        "s": "0x0",
        "to": "0xff0000000000000000000000000000000000088a",
        "transactionIndex": "0x1",
        "type": "0x2",
        "v": "0x0",
        "value": "0x0"
      }
    ],
    "transactionsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "uncles": []
  }
}

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.

5 participants