change(rpc): Update getblock RPC to more closely match zcashd - #9006
Conversation
e3b050b to
618beb3
Compare
getblock RPC to more closely match zcashd
|
This is looking good! I left some suggestions in #9008.
The new behaviour seems performant enough for lightwalletd to continue using The performance issue before (fixed in #5307) was that it was reading all of the block's transactions, the database queries added here should be quick, and, if they still have a measurable impact on lightwalletd sync performance, can be optimized easily (like by parallelizing or unifying state requests and maybe using an iterator to get the block hashes at (Though we should make sure to cache block sizes by hash in a new column family when adding that field to avoid reading, deserializing, and then serializing the entire block to get its size.) |
…ardroot field, removes unnecessary state request. (#9008)
de1b3a6 to
1d848d7
Compare
oxarbitrage
left a comment
There was a problem hiding this comment.
It looks good, i made a few comments and documentation suggestions.
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
Co-authored-by: Arya <aryasolhi@gmail.com>
|
@mergify update |
✅ Branch has been successfully updated |
|
@Mergifyio update |
✅ Branch has been successfully updated |
|
@Mergifyio queue |
✅ The pull request has been merged automaticallyDetailsThe pull request has been merged automatically at d1ae441 |
Motivation
Currently zebra has partial support for
getblock()and it mostly targets lightwalletd usage. For zcashd deprecation we want it to match zcashd more closely.Specifications & References
zcashd RPC docs
Solution
Based on #8967
Since
getblock()returns basically a superset ofgetblockheader(), I change ourgetblock()to callgetblockheader()for all the shared fields.Work on returning the additional non-header fields will be done in separate PRs.
I also changed
getblockheader()return codes since whatever error it returns is now returned bygetblock(), and we have committed to error codes in our snapshots. I also added the -5 error code which can also be returned by zcashd.Since the previous behaviour can be still useful for performance reasons, I moved it to be carried out when verbosity=3 is used. It would be a simple change to
lightwalletd. I'm not sure about the specific number though, should we use something farther off?This also adds
ZEBRAD_EXTRA_ARGStozcash-rpc-diffbecause I was stubborn and wanted to make it work with cookie authentication 😆 Let me know if you'd prefer it in a separate PR, but it seems simple enough.Tests
I adjusted the existing
vectors.rstests and updated the snapshots. I also tested it manually and withzcash-rpc-diff; the current diff is thatsize, blockcommitments authdataroot, chainhistoryroot, chainwork anchor, chainSupply and valuePoolsare not yet being filled; and verbosity=2 is still the same as 1 (i.e.txis not expanded)Follow-up Work
Additional information to put in Changelog
PR Author's Checklist
PR Reviewer's Checklist