-
Notifications
You must be signed in to change notification settings - Fork 108
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): Return from long polling immediately when the chain tip changes #5862
Conversation
I need to write tests before we merge this PR. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #5862 +/- ##
==========================================
- Coverage 78.47% 78.32% -0.16%
==========================================
Files 308 308
Lines 38709 38757 +48
==========================================
- Hits 30378 30355 -23
- Misses 8331 8402 +71 |
The test failures are in the snapshots:
https://github.com/ZcashFoundation/zebra/actions/runs/3691441568/jobs/6249438736#step:14:2473
I think I need to add |
Can we evaluate this change in terms of how it will affect the code to be audited? We had talked about keeping the getblocktemplate work self contained as much as possible so it didn't affect the stable release candidate series. This change might be fine as it's just making additions and not changing existing functionality in zebra-state and zebra-chain but I would just like us to be mindful of this. |
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.
Good call adding submitold
and the mark_as_seen
method on ChainTip
.
We should mark all of the new code here with |
There are only around 30 lines of added production code in this PR. The rest is comments, code that's already inside the feature, or tests. I'm happy to put that code behind the feature after I write some tests. Just in case the API needs to change for the tests. But I just wanted to let you know that it won't impact a significant amount of code. (A single hex serialisation implementation is larger, and we've been leaving them outside the feature.) |
In 9a34243 I fixed the field serialization, made a separate snapshot that includes a submit old field, and changed the deserialized coinbase transaction format to RON. (Using JSON was a bit confusing due to the |
Arya made a suggestion, and we're now down to around 20 lines of added production code. At this point, I don't think it matters if it is behind a feature. (But I'm happy to do that.) |
I don't think so either. This looks good to me if it's ready for review. |
zebra-rpc/src/methods/get_block_template_rpcs/types/get_block_template.rs
Outdated
Show resolved
Hide resolved
I think it still needs more tests, even if they have to be manual tests, I want to do them. |
e72d0eb
to
7ac98eb
Compare
Motivation
Miners want to start mining on the new tip immediately, to avoid wasted hash power and chain forks.
Closes #5720
Depends-On: #5843
Complex Code or Requirements
This PR uses the block consensus rules - changing the previous block hash or block time makes previous work invalid.
It also changes the tokio watch channel API, and does some complex future implementations. (But mainly for testing.)
Solution
Related changes:
Review
Anyone can review this PR, it's mostly changes to trait implementations and a
select!{}
loop.Reviewer Checklist
Follow Up Work
I think we're done here, we're doing what miners have told us is their top priority.