-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: paychmgr: Support paych funding (a.k.a. fast paid retrieval) #7883
Conversation
@@ -492,6 +567,8 @@ func (ca *channelAccessor) addFunds(ctx context.Context, channelInfo *ChannelInf | |||
return &mcid, nil | |||
} | |||
|
|||
// TODO func (ca *channelAccessor) freeFunds(ctx context.Context, channelInfo *ChannelInfo, amt, avail types.BigInt) (*cid.Cid, error) { |
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.
Want before landing, needed for stuff to work well with how we fund partial retrievals (which we fund like a full retrieval)
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.
((apparently we don't have good market hooks for this; can be done later))
28de5d1
to
103bc53
Compare
Codecov Report
@@ Coverage Diff @@
## master #7883 +/- ##
==========================================
+ Coverage 40.28% 40.40% +0.12%
==========================================
Files 666 666
Lines 72756 72887 +131
==========================================
+ Hits 29309 29452 +143
+ Misses 38310 38293 -17
- Partials 5137 5142 +5
Continue to review full report at Codecov.
|
103bc53
to
550e274
Compare
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 is awesome and much needed.
Various suggestions and changes, though I'm not sure whether any of them are truly blocking.
I do think it would be good possibly to incorporate the markets change.
channelInfo.CreateMsg = nil | ||
}) | ||
|
||
return nil | ||
} | ||
|
||
// completeAvailable fills reserving fund requests using already available funds, without interacting with the chain | ||
func (ca *channelAccessor) completeAvailable(ctx context.Context, merged *mergedFundsReq, channelInfo *ChannelInfo, amt, av types.BigInt) (*paychFundsRes, types.BigInt) { | ||
toReserve := types.BigSub(amt, av) |
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.
as I read this code, if we have available funds already confirmed, but we also have a no-reserve request ready to go that could supply the available funds, we don't use the available funds. I'm curious about the rationale here. Why not just grab the available funds and then let the no-reserve request complete on its own time?
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.
The call to completeAmount
below should be doing this.
return ps.findChan(ctx, func(ci *ChannelInfo) bool { | ||
if ci.Direction != DirOutbound { | ||
return false | ||
} | ||
if ci.Settling { | ||
return false | ||
} | ||
|
||
if ci.Channel != nil { |
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.
Is this just an unrelated bug fix?
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.
Yes, this would break your paychmgr after the channel got settled on-chain
failed = types.BigAdd(failed, r.amt) | ||
r.onComplete(&paychFundsRes{ | ||
channel: *channelInfo.Channel, | ||
err: xerrors.Errorf("not enough funds available in the payment channel %s; add funds with 'lotus paych add-funds %s %s %s'", channelInfo.Channel, channelInfo.from(), channelInfo.to(), types.FIL(r.amt).Unitless()), |
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.
Suggest simplifying this error message - the message only makes sense if people are calling the API from the command line
I get : ERROR: Remote API version didn't match (expected 1.5.0, remote 1.4.0) when I start lotus-miner when I have compiled lotus with this version as well. Even tried compiling Lotus with the master branch. Anyway to get this to work, testing paid retrieval with Elijah. Thanks |
Co-authored-by: Hannah Howard <[email protected]> Co-authored-by: dirkmc <[email protected]>
Co-authored-by: dirkmc <[email protected]>
…lotus into feat/paych-avail-reuse
…-updated-markets feat(markets): update markets to simplify client adapter
Note that this is client-side only change. You don't need to update anything on the miner side to get fast paid retrievals to work. |
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.
LGTM -- this hasn't changed much since i last looked but the changes look good
Closes #7876