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

Return detailed errors from the submitblock RPC #5487

Closed
3 tasks
teor2345 opened this issue Oct 26, 2022 · 2 comments
Closed
3 tasks

Return detailed errors from the submitblock RPC #5487

teor2345 opened this issue Oct 26, 2022 · 2 comments
Labels
A-rpc Area: Remote Procedure Call interfaces A-rust Area: Updates to Rust code A-state Area: State / database changes C-enhancement Category: This is an improvement S-needs-triage Status: A bug report needs triage

Comments

@teor2345
Copy link
Contributor

teor2345 commented Oct 26, 2022

Motivation

If we find a mining pool that relies on detailed submitblock RPC errors, we should implement them.

Otherwise this ticket is optional.

This depends on #2908, because it changes the errors in the state.

Mining Pool Usage

s-nomp calls submitblock from this code:

Requirements

https://zcash.github.io/rpc/submitblock.html

https://en.bitcoin.it/wiki/BIP_0023

The goals of the submitblock RPC are to:

  • get valid blocks onto the local and network chains as quickly as possible, so miners have the best chance of profiting from their work, and
  • reject invalid blocks as quickly as possible, so miners can start on an updated block template.

Possible Design

Return null if the block is accepted onto the best chain in the non-finalized state. Otherwise, return a detailed error containing the specified text.

See the TODO comments in the submit_block() RPC function for details.

Error handling

We need to check if miners rely on any specific error values.

Return

  • "duplicate": if Zebra has already committed the block to the non-finalized or finalized state
  • "duplicate-invalid": if Zebra already has the block, but it is invalid
    • Zebra will never return this status, because it does not store invalid blocks
  • "duplicate-inconclusive": if Zebra already has the block in the state queue or channel, but has not committed it to the non-finalized state yet. Checking this might not be supported by Zebra's current architecture.
  • "inconclusive": if Zebra has committed the block to the non-finalized state, but it is not on the best chain
  • "rejected": if Zebra rejected the block as invalid
  • Other possible errors listed here, if needed by mining pools: https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki#appendix-example-rejection-reasons

zcashd implementation:

https://github.com/zcash/zcash/blob/6c392dbb0b43d6988283e40ce423242833df2d30/src/rpc/mining.cpp#L869-L905

Testing

We might also want to implement #5015 to make writing tests for this issue quicker.

@teor2345
Copy link
Contributor Author

teor2345 commented Dec 1, 2022

One mining pool has told us that they don't need detailed errors.

@teor2345
Copy link
Contributor Author

We haven't had any user requests for this, and our own tests work fine without it.

We also partially implemented detailed logging it in a much earlier PR.

@teor2345 teor2345 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Area: Remote Procedure Call interfaces A-rust Area: Updates to Rust code A-state Area: State / database changes C-enhancement Category: This is an improvement S-needs-triage Status: A bug report needs triage
Projects
None yet
Development

No branches or pull requests

2 participants