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

Regarding the latest chain headers response format change #3660

Open
gupadhyaya opened this issue Apr 13, 2021 · 4 comments
Open

Regarding the latest chain headers response format change #3660

gupadhyaya opened this issue Apr 13, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@gupadhyaya
Copy link
Contributor

gupadhyaya commented Apr 13, 2021

I wanted to give a heads-up on the upcoming change to latest chain headers rpc response format change. The change is currently deployed to testnet and will soon be pushed to mainnet. This is required to make ethereum tooling compatible (e.g., chainlink). I am aware that many validator tools rely on this, hence asking if there any concerns in updating your tooling.

Before:

./hmy -n https://api.s0.t.hmny.io blockchain latest-headers
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "beacon-chain-header": {
      "block-header-hash": "0x3db1639202e5333bac1e635796f307ebc8ae4a9d7791f89624de768823123d70",
      "block-number": 11711625,
      "epoch": 530,
      "shard-id": 0,
      "view-id": 11711962
    },
    "shard-chain-header": {
      "block-header-hash": "0x3db1639202e5333bac1e635796f307ebc8ae4a9d7791f89624de768823123d70",
      "block-number": 11711625,
      "epoch": 530,
      "shard-id": 0,
      "view-id": 11711962
    }
  }
}

After:

./hmy -n https://api.s0.b.hmny.io blockchain latest-headers
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "beacon-chain-header": {
      "difficulty": "0x0",
      "epoch": 73679,
      "extraData": "0x",
      "gasLimit": "0x4c4b400",
      "gasUsed": "0x0",
      "hash": "0xec767a28f8002c0d30b3198010924f88096fd213c2b4831a8809ca0492528282",
      "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
      "miner": "0x3f6e680ec5456f540a833e77df4c8ed20a20f274",
      "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
      "nonce": "0x0000000000000000",
      "number": "0x7f3832",
      "parentHash": "0x52a577e98dd73f0cc186d5a423e6d5e7d8c26b74986b54106790180a3588a860",
      "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
      "sha3Uncles": "0x0000000000000000000000000000000000000000000000000000000000000000",
      "shardID": 0,
      "stateRoot": "0x1808695162c90c02743aa47cea077ab7977275e8a4b3993ae2a6fa6bc445dcb3",
      "timestamp": "0x6076178f",
      "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
      "viewID": 8337804
    },
    "shard-chain-header": {
      "difficulty": "0x0",
      "epoch": 73679,
      "extraData": "0x",
      "gasLimit": "0x4c4b400",
      "gasUsed": "0x0",
      "hash": "0xec767a28f8002c0d30b3198010924f88096fd213c2b4831a8809ca0492528282",
      "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
      "miner": "0x3f6e680ec5456f540a833e77df4c8ed20a20f274",
      "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
      "nonce": "0x0000000000000000",
      "number": "0x7f3832",
      "parentHash": "0x52a577e98dd73f0cc186d5a423e6d5e7d8c26b74986b54106790180a3588a860",
      "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
      "sha3Uncles": "0x0000000000000000000000000000000000000000000000000000000000000000",
      "shardID": 0,
      "stateRoot": "0x1808695162c90c02743aa47cea077ab7977275e8a4b3993ae2a6fa6bc445dcb3",
      "timestamp": "0x6076178f",
      "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
      "viewID": 8337804
    }
  }
}

Also the rpcs impacted are:

curl --location --request POST 'https://api.s0.b.hmny.io' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "hmyv2_getLatestChainHeaders",
    "params": []
}'

and

curl --location --request POST 'https://rpc.s0.b.hmny.io' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "hmy_getLatestChainHeaders",
    "params": []
}'

Also, the newBlockHeaders subscription:

web3.eth
  .subscribe("newBlockHeaders", function (error, result) {
    if (!error) {
        console.log(result);
      return;
    }

    console.error(error);
  })
  .on("connected", function (subscriptionId) {
    console.log(subscriptionId);
  })
  .on("data", function (blockHeader) {
      console.log(blockHeader);
  })
  .on("error", console.error);

PRs responsible for this change: #3655, #3658, and #3659

@gupadhyaya gupadhyaya added the enhancement New feature or request label Apr 13, 2021
@sophoah
Copy link
Contributor

sophoah commented Apr 14, 2021

@gupadhyaya can you see if #3662 could be related to that change ? cc @mirrormirage0

@LeoHChen
Copy link
Contributor

LeoHChen commented Apr 14, 2021

@gupadhyaya , is this change only impact RPC hmyv2_getLatestChainHeaders? how about the old hmy_getLatestChainHeaders api?

@gupadhyaya
Copy link
Contributor Author

@gupadhyaya , is this change only impact RPC hmyv2_getLatestChainHeaders? how about the old hmy_getLatestChainHeaders api?

yes. updated.

@rlan35
Copy link
Contributor

rlan35 commented Aug 18, 2021

is this issue fixed now? we can close if fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants