-
Notifications
You must be signed in to change notification settings - Fork 107
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
change(rpc): Match zcashd
's block template exactly
#5867
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #5867 +/- ##
==========================================
+ Coverage 78.11% 78.27% +0.15%
==========================================
Files 310 310
Lines 38838 38838
==========================================
+ Hits 30340 30402 +62
+ Misses 8498 8436 -62 |
When there were differences between the coinbase transactions, I used It is impossible to configure Zebra with the same miner address as I checked if the mempools were in sync using the coinbase fee and transaction diff as quick checks. Once they were in sync, I got pretty similar output. (Only the miner address, coinbase transaction, roots, long poll id, and extra Zebra fields were different.) |
This is odd, I didn't change any of the request code in this PR:
Before the failure I see:
I don't know if this is the normal test output. |
Use |
Thanks, I'm trying this now. I got the output order slightly different from zcashd, so I'll also need to fix that. |
I might also have the transaction order slightly different, I've seen some shielded transactions in a different order, |
31391fa
to
f816c8e
Compare
It seems like But on testnet, and on mainnet when the order matches up, I can get the Zebra and $ ZCASH_CLI="zcash-cli -testnet" zcash-rpc-diff 38232 getblocktemplate Checking first node release info...
Checking second node release info...
Connected to zebrad (port 38232) and zcashd (zcash-cli-testnet zcash.conf port).
Checking zebrad network and tip height...
Checking zcashd network and tip height...
Request:
getblocktemplate
Querying zebrad test chain at height >=2153481...
real 0m0.012s
user 0m0.006s
sys 0m0.005s
Querying zcashd test chain at height >=2153481...
real 0m0.018s
user 0m0.005s
sys 0m0.006s
Response diff between zebrad and zcashd:
--- /run/user/1000/tmp.2HCTThHXya.rpc-diff/zebrad-test-2153481-getblocktemplate.json 2022-12-16 13:44:35.074629890 +1000
+++ /run/user/1000/tmp.2HCTThHXya.rpc-diff/zcashd-test-2153481-getblocktemplate.json 2022-12-16 13:44:35.092629752 +1000
@@ -1,5 +1,6 @@
{
"capabilities": [
+ "proposal"
],
"version": 4,
"previousblockhash": "00357e387d134477dbcdaa721b51cbdcdfda2ddfd792d71d8d413a0868c1a5be",
@@ -24,9 +25,9 @@
"sigops": 1,
"required": true
},
- "longpollid": "000215348150723e951671167237000000000000000000",
+ "longpollid": "00357e387d134477dbcdaa721b51cbdcdfda2ddfd792d71d8d413a0868c1a5be287",
"target": "005fd45000000000000000000000000000000000000000000000000000000000",
- "mintime": 1671160202,
+ "mintime": 1671161838,
"mutable": [
"time",
"transactions",
@@ -37,6 +38,5 @@
"sizelimit": 2000000,
"curtime": 1671162275,
"bits": "1f5fd450",
- "height": 2153482,
- "maxtime": 1671167237
+ "height": 2153482
} There's a weird difference in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it looks good. I think this might became either the default or a configuration option.
The only problem i see on making it the default is the v4 coinbase instead of v5 which i think zcashd should update at some point.
Motivation
It's easier to compare Zebra and
zcashd
's RPC output if we use exactly the same coinbase transaction version, contents, and transaction order.Part of testing #5686.
Depends-On: #5862
Complex Code or Requirements
These changes still obey the consensus rules, but they do it in a way that matches what
zcashd
does.Solution
Add a constant and function argument that makes Zebra's block template match
zcashd
's, and turn it on for now.Like
zcashd
'sgetblocktemplate
RPC responses:u32::MAX
sequence numberUpdate snapshots.
Review
This is an optional change, but it makes testing much easier, because if the mempool is the same, then
zcash-rpc-diff
should match exactly.Reviewer Checklist