Parity-ethereum: Feature-request: debug_getBadBlocks

Created on 1 Jun 2018  ·  29Comments  ·  Source: openethereum/parity-ethereum

Geth has an endpoint called debug_getBadBlocks, which is very useful for two purposes.

  1. It can be used to detect consensus flaws more quickly, by correlating what one client considers bad blocks and what the other client has in it's chain.
  2. It can be used to analyze consensus flaws more easily, since even if I run a client that does not import a rejected block, it can still provide me with the block for analysis on why it was considered 'bad'.

Geth implementation is here. See UPPDATE below
Response definition here See UPPDATE below

Geth uses an LRU-cache with up to 10 bad blocks, but that's an implementation detail.

F8-enhancement 🎊 M6-rpcapi 📣 P7-nicetohave 🐕 Q3-medium

Most helpful comment

@cpurta Paid this out via tip, although I understand it was closed by another PR! Let me know if you had any issues receiving it on slack.

All 29 comments

Update: Geth returns headers. It would be better to return the complete blocks, so we have all offending transactions aswell. Geth will change that behaviour, and return the full blocks

https://github.com/ethereum/go-ethereum/pull/16902 is now merged. Final format

> debug.getBadBlocks()
[{
    block: {
      difficulty: "0x4098a4680",
      extraData: "0x476574682f76312e302e302d66633739643332642f6c696e75782f676f312e34",
      gasLimit: "0x1388",
      gasUsed: "0x0",
      hash: "0x0cd0deee59ab5b671659a11eec037a6b5c00fb6243c89aa469559b74db35e310",
      logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
      miner: "0x5088d623ba0fcf0131e0897a91734a4d83596aa0",
      mixHash: "0xa7c53c9ab530394ddc67fb4f138d252b289e58dddfe5877a24b0d02ada887c79",
      nonce: "0xedd5b0fa67825ec1",
      number: "0x21",
      parentHash: "0x88be699fe3ea3991e20a614873f2d653f8989ead9f6d6a40ab2e27b51260ae13",
      receiptsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
      sha3Uncles: "0xf5fc6d0bdc19d5450e3f5a82cb6da6c4271afc4e1733ee53b3390cb3b6175810",
      size: "0x43d",
      stateRoot: "0x10b2663d9299d73297ea336b4aa247d3ebbf4ab1e71abcb6dd9ddaec76222640",
      timestamp: "0x55ba4325",
      transactions: [],
      transactionsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
      uncles: ["0x962b18a4fcdd215e11db01308f6818735ea1b33377a82af39cb89fa6d4178204"]
    },
    hash: "0x0cd0deee59ab5b671659a11eec037a6b5c00fb6243c89aa469559b74db35e310",
    rlp: "f9043af90218a088be699fe3ea3991e20a614873f2d653f8989ead9f6d6a40ab2e27b51260ae13a0f5fc6d0bdc19d5450e3f5a82cb6da6c4271afc4e1733ee53b3390cb3b6175810945088d623ba0fcf0131e0897a91734a4d83596aa0a010b2663d9299d73297ea336b4aa247d3ebbf4ab1e71abcb6dd9ddaec76222640a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008504098a468021821388808455ba4325a0476574682f76312e302e302d66633739643332642f6c696e75782f676f312e34a0a7c53c9ab530394ddc67fb4f138d252b289e58dddfe5877a24b0d02ada887c7988edd5b0fa67825ec1c0f9021bf90218a0d1eb5ef56d30f0d773cccd3075c7fcca14ec9013db6b76344c69dbbaffaa9b8ca01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794db312d1d6a2ccc64dd94a3892928bac82b4e8c15a01624d23c380d999ac180022f08f008849ed5a404e50a0a8c704d5a536742e471a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000085040888145a1f821388808455ba4322a0476574682f76312e302e302d30636463373634372f6c696e75782f676f312e34a05870078c7ab1637370a603260f3b25d5f006077df2fa0f868d0970ea32496075883673ed3d817b95bf"
}, {
    block: {
...

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


__This issue now has a funding of 0.75 ETH (343.76 USD @ $458.35/ETH) attached to it.__

Issue Status: 1. Open 2. Cancelled


__Work has been started__.

These users each claimed they can complete the work by 7 months ago.
Please review their action plans below:

1) cpurta has started work.

Looks pretty straight-forward. Getting started on this now and will keep you updated.

Learn more on the Gitcoin Issue Details page.

Oh, thanks @gitcoinbot !

@cpurta Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] warning (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@gitcoinbot still working on it.

@cpurta Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] warning (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

Currently have add some functionality to the blockchain implementation to add/get bad blocks. Currently trying to expose that to the blockchain client for the rpc api to have access. Will try and get a PR open within the next week.

Thanks for the update @cpurta!

I have a pretty rough merge request open https://github.com/paritytech/parity-ethereum/pull/9207. Would appreciate someone from parity to look over the merge and review.

@cpurta Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] warning (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


@cpurta due to inactivity, we have escalated this issue to Gitcoin's moderation team. Let us know if you believe this has been done in error!

  • [x] warning (3 days)
  • [x] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

Still working on this, waiting for the parity team to review the current PR.

@cpurta Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] warning (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

PR still waiting for review

@Tbaut et all, mind taking a look here?

@cpurta Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] warning (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

Cc @folsen, mind helping @cpurta out with claiming this bounty?

@holiman comments were made last week, see PR.

@gitcoinbot working on some of the comments that were made on the PR.

@cpurta Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] warning (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

Working on the last comment made in the PR.

Pushed some changes to address one of the comments made. Requested another review of those changes.

@vs77bb looks like this issue was closed by another PR by @tomusdrw. Not sure how that applies to the bounty on this issue.

Issue Status: 1. Open 2. Cancelled


__The funding of 0.75 ETH (152.74 USD @ $203.66/ETH) attached to this issue has been cancelled by the bounty submitter__

@cpurta Paid this out via tip, although I understand it was closed by another PR! Let me know if you had any issues receiving it on slack.

⚡️ A tip worth 0.75000 ETH (171.51 USD @ $228.68/ETH) has been granted to @cpurta for this issue from @vs77bb. ⚡️

Nice work @cpurta! To redeem your tip, login to Gitcoin at https://gitcoin.co/explorer and select 'Claim Tip' from dropdown menu in the top right, or check your email for a link to the tip redemption page.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vmenond picture vmenond  ·  3Comments

BillSantos picture BillSantos  ·  3Comments

stone212 picture stone212  ·  3Comments

jurijbajzelj picture jurijbajzelj  ·  3Comments

jordipainan picture jordipainan  ·  3Comments