Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Feature-request: debug_getBadBlocks #8761

Closed
holiman opened this issue Jun 1, 2018 · 29 comments
Closed

Feature-request: debug_getBadBlocks #8761

holiman opened this issue Jun 1, 2018 · 29 comments
Assignees
Labels
F8-enhancement 🎊 An additional feature request. M6-rpcapi 📣 RPC API. P7-nicetohave 🐕 Issue is worth doing eventually. Q3-medium A fair chunk of work, not necessarily very hard but not trivial either
Milestone

Comments

@holiman
Copy link
Contributor

holiman commented Jun 1, 2018

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.

@holiman holiman changed the title debug_getBadBlocks Feature-request: debug_getBadBlocks Jun 1, 2018
@folsen folsen added F8-enhancement 🎊 An additional feature request. P7-nicetohave 🐕 Issue is worth doing eventually. M6-rpcapi 📣 RPC API. labels Jun 1, 2018
@holiman
Copy link
Contributor Author

holiman commented Jun 5, 2018

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

@holiman
Copy link
Contributor Author

holiman commented Jun 5, 2018

For reference: ethereum/go-ethereum#16902

@holiman
Copy link
Contributor Author

holiman commented Jun 11, 2018

ethereum/go-ethereum#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: {
...

@5chdn 5chdn added this to the 1.13 milestone Jun 13, 2018
@5chdn 5chdn added the Q3-medium A fair chunk of work, not necessarily very hard but not trivial either label Jun 24, 2018
@gitcoinbot
Copy link

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.

@gitcoinbot
Copy link

gitcoinbot commented Jul 10, 2018

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.

@holiman
Copy link
Contributor Author

holiman commented Jul 10, 2018

Oh, thanks @gitcoinbot !

@gitcoinbot
Copy link

@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!

  • warning (3 days)
  • escalation to mods (6 days)

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

@cpurta
Copy link
Contributor

cpurta commented Jul 14, 2018

@gitcoinbot still working on it.

@5chdn 5chdn modified the milestones: 2.1, 2.2 Jul 17, 2018
@gitcoinbot
Copy link

@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!

  • warning (3 days)
  • escalation to mods (6 days)

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

@cpurta
Copy link
Contributor

cpurta commented Jul 19, 2018

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.

@vs77bb
Copy link

vs77bb commented Jul 20, 2018

Thanks for the update @cpurta!

@cpurta
Copy link
Contributor

cpurta commented Jul 23, 2018

I have a pretty rough merge request open #9207. Would appreciate someone from parity to look over the merge and review.

@gitcoinbot
Copy link

@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!

  • warning (3 days)
  • escalation to mods (6 days)

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

@gitcoinbot
Copy link

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!

  • warning (3 days)
  • escalation to mods (6 days)

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

@cpurta
Copy link
Contributor

cpurta commented Jul 31, 2018

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

@gitcoinbot
Copy link

@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!

  • warning (3 days)
  • escalation to mods (6 days)

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

@cpurta
Copy link
Contributor

cpurta commented Aug 6, 2018

PR still waiting for review

@vs77bb
Copy link

vs77bb commented Aug 6, 2018

@Tbaut et all, mind taking a look here?

@gitcoinbot
Copy link

@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!

  • warning (3 days)
  • escalation to mods (6 days)

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

@holiman
Copy link
Contributor Author

holiman commented Aug 12, 2018

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

@Tbaut
Copy link
Contributor

Tbaut commented Aug 13, 2018

@holiman comments were made last week, see PR.

@cpurta
Copy link
Contributor

cpurta commented Aug 13, 2018

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

@gitcoinbot
Copy link

@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!

  • warning (3 days)
  • escalation to mods (6 days)

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

@cpurta
Copy link
Contributor

cpurta commented Aug 20, 2018

Working on the last comment made in the PR.

@tomusdrw tomusdrw self-assigned this Aug 27, 2018
@cpurta
Copy link
Contributor

cpurta commented Aug 27, 2018

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

@cpurta
Copy link
Contributor

cpurta commented Sep 8, 2018

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

@gitcoinbot
Copy link

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

@vs77bb
Copy link

vs77bb commented Sep 9, 2018

@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.

@5chdn 5chdn added this to the 2.1 milestone Sep 11, 2018
@gitcoinbot
Copy link

⚡️ 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
F8-enhancement 🎊 An additional feature request. M6-rpcapi 📣 RPC API. P7-nicetohave 🐕 Issue is worth doing eventually. Q3-medium A fair chunk of work, not necessarily very hard but not trivial either
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants