-
Notifications
You must be signed in to change notification settings - Fork 106
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
feat(rpc): Implement z_listunifiedreceivers
#6171
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #6171 +/- ##
==========================================
+ Coverage 77.93% 77.99% +0.05%
==========================================
Files 304 304
Lines 39197 39197
==========================================
+ Hits 30549 30572 +23
+ Misses 8648 8625 -23 |
Some random addresses taken from https://github.com/zcash-hackworks/zcash-test-vectors/blob/master/test-vectors/zcash/unified_address.json#L39 in the zcash diff script:
|
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.
This looks great, and I'm happy it works!
We're adding a lot of new address types in this PR series. We're going to be using them for a long time, in a lot of code (RPCs and other address input code). So it might be worth spending some time designing an easy to use API.
I think we're trying to fight the design of zcash_address
in this PR, rather than follow it. So that's why some of the code has a lot of conversions, and the error handling and formatting is tricky. (Or missing!)
If we follow their API, it will end up looking like this other address RPC:
zebra/zebra-rpc/src/methods/get_block_template_rpcs.rs
Lines 816 to 828 in 3f1d94d
let Ok(address) = raw_address | |
.parse::<zcash_address::ZcashAddress>() else { | |
return Ok(validate_address::Response::invalid()); | |
}; | |
let address = match address | |
.convert::<primitives::Address>() { | |
Ok(address) => address, | |
Err(err) => { | |
tracing::debug!(?err, "conversion error"); | |
return Ok(validate_address::Response::invalid()); | |
} | |
}; |
I have some ideas about how we could design it. What do you think? Did you want to make these changes in this PR, or in another PR?
(@upbqdn you might want to check out this PR to make sure it doesn't have too many conflicts with ticket #6083.)
zebra-rpc/src/methods/tests/snapshot/get_block_template_rpcs.rs
Outdated
Show resolved
Hide resolved
zebra-rpc/src/methods/get_block_template_rpcs/types/unified_address.rs
Outdated
Show resolved
Hide resolved
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.
This seems like a more reliable API.
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.
Thanks, this is great, and thanks for your patience fixing this up!
I think there's just one required check left: our p2sh is the same as zcashd
.
These are some optional changes we could make after PR #6185 merges:
And one we can do at any time:
|
We did some CI failure fixes on the main branch, so I'm going to merge it in here. |
@Mergifyio update |
✅ Branch has been successfully updated |
Motivation
We want to have
z_listunifiedreceivers
as part of the mining pool efforts.Close #6030
Solution
Add support for
z_listunifiedreceivers
Review
Anyone can review, there are some parts of the code that can be improved or refactored. Diff tests seems to work with several test vectors taken from zcash.
Reviewer Checklist