defer channels_sv2::client share acceptance to upstream acknowledgement#2090
Conversation
6ccce40 to
b3dc8e9
Compare
b3dc8e9 to
89e5841
Compare
Shourya742
left a comment
There was a problem hiding this comment.
Rest of the changes look good
| pub fn on_share_acknowledgement( | ||
| &mut self, | ||
| new_submits_accepted_count: u32, | ||
| new_shares_sum: f64, |
There was a problem hiding this comment.
Yeah, we can make new_share_sum a u64, based on the comments in the sv2-apps PR: stratum-mining/sv2-apps#283 (comment) . There’s no real need to keep it as an f64, it looks like an inaccuracy that slipped through during the initial iteration.
There was a problem hiding this comment.
IIRC, the new_shares_sum represent the amount of work acknowledged by the server in a specific SubmitSharesSuccess, that's why it's a f64.
But I might be wrong here.
There was a problem hiding this comment.
I remember seeing work being reported as floating point on Braiins UI, and also contemplating the fact that strictly speaking, work is a unit of difficulty, and therefore it can (and maybe should) be tracked as floating point numbers (like rust bitcoin does)
this is specially true when we're operating at diff ranges 0 < diff < 1, where we have no relevant data unless we're working with floating point numbers
but as @Shourya742 correctly points out, this was kind of a failed attempt at retaining granular data, because SubmitSharesSuccess.new_shares_sum is U64, which forces everyone to truncate and makes an internal representation based on f64 pretty much useless
FWIW there's some extra context on stratum-mining/sv2-spec#126
with that said, I'd like to avoid expanding the scope of this PR to also cover for this, because that's not the problem #2089 we're trying to solve
created #2092 to keep track of it
There was a problem hiding this comment.
Acc to spec, its the sum of share acknowledged in the batch,
There was a problem hiding this comment.
I was not aware of that PR. Thanks for mentioning that.
There was a problem hiding this comment.
Acc to spec, its the sum of share acknowledged in the batch,
no, you're confusing it with new_submits_accepted_count
please see stratum-mining/sv2-spec#126, I drafted this while interacting with Braiins
There was a problem hiding this comment.
we need to bump PATCH here to publish it on our next release
Shourya742
left a comment
There was a problem hiding this comment.
Green from me, once Gitgab's comments are addressed.
close #2089
breaking change on
channels_sv2, bumps major versionwe replace
channels_sv2::client::ShareAccounting::update_share_accountingwith:track_validated_share(still called fromvalidate_share)on_share_acknowledgement(called from theon_share_acknowledgementintroduced into the channels layer)application layer calls
on_share_acknowledgementon channels every time aSubmitSharesSuccessarrivescompanion stratum-mining/sv2-apps#283