improve share validation#1966
Conversation
93e2475 to
fb71e65
Compare
| info!("SubmitSharesStandard: {} ✅", success); | ||
| messages.push((downstream_id, Mining::SubmitSharesSuccess(success)).into()); | ||
| } else { | ||
| let share_work = standard_channel.get_target().difficulty_float(); |
There was a problem hiding this comment.
wouldn't share_work be something related to the share and not the channel difficulty?
There was a problem hiding this comment.
a share should be rewarded because it meets the difficulty target established by the server, if the hash has more zeros than necessary, that doesn't make that share more valuable
that's the rationale we have always followed to update ShareAccounting::share_work_sum, which I got from an interaction with Braiins a while ago
btw, that's also the same rationale you're following on #1965, the only difference is that it's being returned inside ShareValidationResult::Valid, which as I pointed out is unnecessary, since that information is already available via get_target
https://github.com/stratum-mining/stratum/pull/1965/files#r2461063936
There was a problem hiding this comment.
please see stratum-mining/sv2-spec#126
for some reason the rendering of images on my fork is messed up, but I think this one summarizes things:
44bf12e to
130a3b3
Compare
the application layer will handling ShareAccounting, so we don't need to inform it whether it's time to acknowledge shares we also start returning the share hash after validation
130a3b3 to
0f73fa8
Compare
@Shourya742 raised some concerns about the direction #1902 is going #1902 (comment)
a proposed alternative is to do all the persistence at the application layer, which is currently missing some information
this PR improves
ShareValidationResultso that the application layer has access to the share hashevery other information relevant for some kind of persistence on the application layer can be retrieved from:
share_workis simply the current channel'sTarget, oruser_identitycan be retrieved viaget_user_identity)validate_share()(e.g.:channel_idandsequence_numberis already available on the share message itself)ShareAccounting, which can be retrieved viaget_share_accounting()this also avoids some redundancies on the proposed solution of #1965