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

Manually test the getblocktemplate RPC creates valid blocks #5803

Closed
4 tasks done
Tracked by #5937 ...
oxarbitrage opened this issue Dec 6, 2022 · 8 comments
Closed
4 tasks done
Tracked by #5937 ...

Manually test the getblocktemplate RPC creates valid blocks #5803

oxarbitrage opened this issue Dec 6, 2022 · 8 comments
Assignees
Labels
A-consensus Area: Consensus rule updates A-rpc Area: Remote Procedure Call interfaces C-testing Category: These are tests

Comments

@oxarbitrage
Copy link
Contributor

oxarbitrage commented Dec 6, 2022

Our final goal is to support mining pools to use zebra for their operations. This requires multiple rpc methods to be present.

There is a discussion open to exchange ideas on this.

Details

From #5804 (comment)

I think we can do testing using a block proposal, which is a block without a proof of work.

Here's how we could do that:

  • Finish all the required getblocktemplate RPC fields
  • Create a block header from the RPC fields, with a zeroed-out equihash solution, and serialize it
  • Create the block transactions by combining all the coinbasetxn and transaction data fields
  • Send that block to zcashd using `getblocktemplate '{ "mode": "proposal", "data": "(hex data)" }'

zcashd has proposal support, but it's not documented. Here's the spec:
https://en.bitcoin.it/wiki/BIP_0023#Block_Proposal

Related Work

@teor2345 teor2345 added A-rpc Area: Remote Procedure Call interfaces P-Medium ⚡ C-testing Category: These are tests labels Dec 8, 2022
@teor2345
Copy link
Contributor

teor2345 commented Dec 8, 2022

@oxarbitrage please tag your tickets with A-rpc, so we can find them when we're looking for RPC work.

@mpguerra mpguerra added the S-needs-triage Status: A bug report needs triage label Dec 14, 2022
@teor2345 teor2345 changed the title Test getblocktemplate in the zcash testnet Manually test getblocktemplate mining in the zcash testnet Jan 5, 2023
@teor2345 teor2345 changed the title Manually test getblocktemplate mining in the zcash testnet Manually test the getblocktemplate RPC creates valid blocks on the zcash testnet Jan 9, 2023
@teor2345 teor2345 changed the title Manually test the getblocktemplate RPC creates valid blocks on the zcash testnet Manually test the getblocktemplate RPC creates valid blocks Jan 9, 2023
@teor2345 teor2345 self-assigned this Jan 9, 2023
@teor2345 teor2345 added the A-consensus Area: Consensus rule updates label Jan 9, 2023
@teor2345
Copy link
Contributor

teor2345 commented Jan 16, 2023

Please check your box when you have successfully run the zcash-rpc-block-template-to-proposal script from PR #5944, multiple times on mainnet and testnet:

You'll need a synced zcashd instance and a synced Zebra instance. You can also test Zebra template to Zebra proposal if you just have Zebra.

We need to merge a few bug fixes to get the script to work all the time:

@teor2345
Copy link
Contributor

teor2345 commented Jan 17, 2023

I spent some time increasing the coverage of the test script in #5944, and making it easier to use.

I discovered two bugs during my testing:

Bug #5982 is a consensus rule bug that will block finishing off testing. (We can still check for other bugs until it is fixed.)

@teor2345
Copy link
Contributor

I am using these shell scripts to run continuous proposal tests until a test fails:

SUCCESSES=0; while zcash-rpc-block-template-to-proposal 28232 8232 28232; do SUCCESSES=$((SUCCESSES+1)); echo "Successes: $SUCCESSES"; sleep 10; done
SUCCESSES=0; while ZCASH_CLI="zcash-cli -testnet" zcash-rpc-block-template-to-proposal 38232 18232 38232; do SUCCESSES=$((SUCCESSES+1)); echo "Successes: $SUCCESSES"; sleep 10; done

My Zebra nodes are on 28232 and 38232, and my zcashd nodes are on the default ports.

@teor2345
Copy link
Contributor

When there is a chain fork change or a block arrives during proposal creation, a inconclusive-not-best-prevblk error is expected.

@github-project-automation github-project-automation bot moved this to 🆕 New in Zebra Jan 19, 2023
@mpguerra mpguerra added this to Zebra Jan 19, 2023
@mpguerra mpguerra moved this from 🆕 New to 📋 Sprint Backlog in Zebra Jan 19, 2023
@mpguerra mpguerra moved this from 📋 Sprint Backlog to 👀 In review in Zebra Jan 19, 2023
@mpguerra
Copy link
Contributor

What are the next steps here? When can we be satisfied that we have fully tested this?

@arya2
Copy link
Contributor

arya2 commented Jan 20, 2023

What are the next steps here?

We need to fix the known bugs to see if any checks that come after those fail.

When can we be satisfied that we have fully tested this?

It's succeeding consistently for me on the branch that addresses #5982 so that could be the last bug before we can all run this successfully for a few hours and close this issue. We need to fix #5984 too but that bug doesn't seem visible in this test without submitting a transaction that triggers it first.

@mpguerra
Copy link
Contributor

mpguerra commented Feb 2, 2023

I think we're done here! 🎉

@mpguerra mpguerra closed this as completed Feb 2, 2023
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Zebra Feb 2, 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-consensus Area: Consensus rule updates A-rpc Area: Remote Procedure Call interfaces C-testing Category: These are tests
Projects
Archived in project
Development

No branches or pull requests

4 participants