-
Notifications
You must be signed in to change notification settings - Fork 17
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
Refactor revalidators v2 #322
Conversation
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.
looks OK from a superficial perspective and the rationale makes sense
it's just a dramatic change; I'll have to take these two big refactors into account in my work which has already diverged quite a bit from master
8d028dc
to
8b01cdb
Compare
Codecov Report
@@ Coverage Diff @@
## v2 #322 +/- ##
==========================================
- Coverage 65.26% 64.88% -0.39%
==========================================
Files 30 30
Lines 3501 3528 +27
==========================================
+ Hits 2285 2289 +4
- Misses 850 868 +18
- Partials 366 371 +5
|
86b6976
to
1601129
Compare
move to all revalidation being asynchronous
causes datalimit exceeded and requires finalization to leave request paused, regardless of where LeaveRequestPaused is set
reorder validation events so all get record when transfer finishes
Co-authored-by: Rod Vagg <rod@vagg.org>
6f23c82
to
4cffb16
Compare
* refactor(validators): remove revalidation move to all revalidation being asynchronous * feat(validators): implied pauses causes datalimit exceeded and requires finalization to leave request paused, regardless of where LeaveRequestPaused is set * refactor(events): reorder events reorder validation events so all get record when transfer finishes * Update impl/impl.go Co-authored-by: Rod Vagg <rod@vagg.org> Co-authored-by: Rod Vagg <rod@vagg.org>
* chore(v2): setup the v2 release given the expected breaking changes, it's time to setup the v2 release BREAKING CHANGE: v2 modules * Refactor revalidators (#308) * feat(revalidators): initial refactor refactor revalidation process -- removing independent revalidations, making validations results more clear * refactor(rename): RevalidateToComplete -> RequiresFinalization * refactor(datatransfer): enhance validator comments * refactor(message): revert message response changes * refactor(impl): comment and refactor on events add comments to event processing and also extract functions for receiving requests to a new file * refactor(message): s/IsVoucherResult/IsValidationResult rename the IsVoucherResult to is 'IsValidationResult' also add a method for generating messages from validation results * feat(events): only dispatch events on change Only dispatch Pause, Resume, SetDataLimit, and RequiresFinalization on change * style(imports): fix imports * feat(events): add DataLimitExceeded event * Update channels/channel_state.go Co-authored-by: dirkmc <dirkmdev@gmail.com> * Update manager.go Co-authored-by: dirkmc <dirkmdev@gmail.com> * Update manager.go Co-authored-by: dirkmc <dirkmdev@gmail.com> * Update statuses.go Co-authored-by: Rod Vagg <rod@vagg.org> Co-authored-by: dirkmc <dirkmdev@gmail.com> Co-authored-by: Rod Vagg <rod@vagg.org> * Refactor revalidators v2 (#322) * refactor(validators): remove revalidation move to all revalidation being asynchronous * feat(validators): implied pauses causes datalimit exceeded and requires finalization to leave request paused, regardless of where LeaveRequestPaused is set * refactor(events): reorder events reorder validation events so all get record when transfer finishes * Update impl/impl.go Co-authored-by: Rod Vagg <rod@vagg.org> Co-authored-by: Rod Vagg <rod@vagg.org> * chore(message): delete old message format code (#330) * feat(ipld): vouchers as plain ipld.Node (#325) * feat(ipld): vouchers as plain ipld.Node * feat: add ValidationResult#Equals() utility * feat(ipld): introduce TypedVoucher tuple type * chore(ipld): ipld.Node -> datamodel.Node * chore: remove RegisterVoucherResultType * fix: minor staticcheck fixes * refactor(channelstate): use cborgencompatiblenode (#336) use cborgencomptaiblenode to simply channelstate interface * feat(ipld): use bindnode/registry (#340) * chore(deps): update libp2p v0.19.4 (#341) * feat(ipld): use bindnode/registry Co-authored-by: Hannah Howard <hannah@hannahhoward.net> * refactor(v2): port graphsync w/o transport refactor Ports state machine and graphsync changes without the big transport refactor * fix(pr): respond to pr comments * chore(deps): upgrade libp2p v0.22 also upgrades graphsync and removes go-libp2p-core paths * fix(deps): use tagged go-ipld-prime Co-authored-by: dirkmc <dirkmdev@gmail.com> Co-authored-by: Rod Vagg <rod@vagg.org>
Goals
This PR was written during the course of implementing the voucher refactor in go-fil-markets.
Implementation
The main goal in refactoring the go-fil-markets retrieval provider was to drive towards clear, easy to reason about logic with very clear event structure and idempotent code that restarts easily.
What became clear is that fundamentally, voucher revalidation needs to happen asynchronously. So now, the consuming library simply monitors data transfer events and updates validation status as new vouchers come in. We changed Revalidate to ValidateRestart -- so that it only covers restarts, while removing synchronous revalidation entirely. Now, we simply save new vouchers, and we've added an UpdateValidationStatus method to change validation parameters when the markets software processes all vouchers.
Moreover, the idea of Pausing in validation needs to be separated from DataLimits and Finalization. The way to unpause a request held on a data limit is to increase the data limit. The way to end finalization is to set RequiresFinalization to false. The pause property is renamed from LeaveRequestPaused to ForcePause, clearly identifying that the markets library is explicitly applying it's own logic around pausing -- in this case, pausing to Unseal.
Finally I did a minor reorderng of validation events to promote more predictable behavior near the end of a transfer (not accidentally completing the channel before events get processed)