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

Test the getblocktemplate RPC's response as a block template proposal in CI #5685

Closed
Tracked by #5937 ...
arya2 opened this issue Nov 21, 2022 · 5 comments · Fixed by #5963
Closed
Tracked by #5937 ...

Test the getblocktemplate RPC's response as a block template proposal in CI #5685

arya2 opened this issue Nov 21, 2022 · 5 comments · Fixed by #5963
Assignees
Labels
A-rpc Area: Remote Procedure Call interfaces A-rust Area: Updates to Rust code C-enhancement Category: This is an improvement C-testing Category: These are tests

Comments

@arya2
Copy link
Contributor

arya2 commented Nov 21, 2022

Motivation

The acceptance test could confirm that the getblocktemplate response in 'template' mode will be accepted if it has a valid solution by submitting the same data to the getblocktemplate method in 'proposal' mode.

Design

In the acceptance test that syncs until the tip and calls the getblocktemplate RPC method:

  • Deserialize the response
  • Convert the template into a block with empty solution and nonce fields
  • Hex-encode the resulting block
  • Call getblocktemplate in 'proposal' mode
  • Assert a "null" response indicating successful validation (similar to the submitblock test)
@arya2 arya2 added C-enhancement Category: This is an improvement S-needs-triage Status: A bug report needs triage labels Nov 21, 2022
@arya2 arya2 added A-rust Area: Updates to Rust code C-testing Category: These are tests A-rpc Area: Remote Procedure Call interfaces labels Nov 21, 2022
@teor2345
Copy link
Contributor

The acceptance test could confirm that the getblocktemplate response in 'template' mode will be accepted if it has a valid solution by submitting the same data to the getblocktemplate method in 'proposal' mode.

I'm not quite sure how this would work, do we need to mine a valid solution for the proposal to be valid?
Could we use submitblock in the test, rather than adding an extra unused proposal mode to getblocktemplate?

@arya2
Copy link
Contributor Author

arya2 commented Nov 22, 2022

I'm not quite sure how this would work, do we need to mine a valid solution for the proposal to be valid? Could we use submitblock in the test, rather than adding an extra unused proposal mode to getblocktemplate?

It doesn't need a valid solution (it doesn't commit the block, just checks that it would be accepted if submitted with a valid solution), so a new block verifier request would skip the check::equihash_solution_is_valid(&block.header) here and use a CheckContextualValidity request instead of CommitBlock. Then if miners want to modify the template and then check that their modifications are still valid before mining, they could propose the new template.

The block data MUST be validated and checked against the server's usual acceptance rules (excluding the check for a valid proof-of-work) - https://en.bitcoin.it/wiki/BIP_0023#Block_Proposal

@teor2345
Copy link
Contributor

Sounds good, can you update the ticket description with the spec details and your suggested design?

Sometimes they get lost in the comments!

@teor2345 teor2345 changed the title Test the getblocktemplate's response as a block template proposal Test the getblocktemplate RPC's response as a block template proposal Nov 28, 2022
@arya2 arya2 self-assigned this Dec 14, 2022
@teor2345 teor2345 changed the title Test the getblocktemplate RPC's response as a block template proposal Test the getblocktemplate RPC's response as a block template proposal in CI Jan 9, 2023
@mpguerra
Copy link
Contributor

I don't think we should do this in CI until we can confirm it manually

@teor2345 teor2345 linked a pull request Jan 16, 2023 that will close this issue
6 tasks
@mpguerra
Copy link
Contributor

@mpguerra mpguerra moved this to 🛑 Won't Fix in Zebra Jan 19, 2023
@mpguerra mpguerra added this to Zebra Jan 19, 2023
@mpguerra mpguerra moved this from 🛑 Won't Fix to 📋 Sprint Backlog in Zebra Jan 19, 2023
@mpguerra mpguerra moved this from 📋 Sprint Backlog to 👀 In review in Zebra Jan 19, 2023
@mergify mergify bot closed this as completed in #5963 Jan 31, 2023
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Zebra Jan 31, 2023
@mpguerra mpguerra removed the S-needs-triage Status: A bug report needs triage label Mar 16, 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 C-enhancement Category: This is an improvement C-testing Category: These are tests
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants
@mpguerra @arya2 @teor2345 and others