-
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
Support Network Upgrades: Payment Channel #3877
Conversation
build abstraction for paych actor and switch to using it in payment channel manager and state predicates
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.
Some nice simplifications in the code and in the tests, great work Hannah 👍
Just one question about ForEachLaneState
that @Stebalien may be best placed to answer
} | ||
|
||
// Iterate lane states | ||
func (ms *mockState) ForEachLaneState(cb func(idx uint64, dl paych.LaneState) error) 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.
@Stebalien does amt.ForEach break out of the loop when there's an error? Or does it continue anyway, but save the last error like the implementation of ForEachLaneState here?
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.
if !ok { | ||
ls = &paych.LaneState{ | ||
Redeemed: types.NewInt(0), | ||
Nonce: 0, | ||
} | ||
laneStates[v.Voucher.Lane] = ls | ||
} | ||
|
||
if v.Voucher.Nonce < ls.Nonce { | ||
if ok && v.Voucher.Nonce < ls.Nonce() { | ||
continue | ||
} | ||
|
||
ls.Nonce = v.Voucher.Nonce | ||
ls.Redeemed = v.Voucher.Amount | ||
laneStates[v.Voucher.Lane] = laneState{v.Voucher.Amount, v.Voucher.Nonce} |
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.
Nice simplification 👍
@@ -226,7 +221,7 @@ func (pm *Manager) GetChannelInfo(addr address.Address) (*ChannelInfo, error) { | |||
return ca.getChannelInfo(addr) | |||
} | |||
|
|||
func (pm *Manager) CreateVoucher(ctx context.Context, ch address.Address, voucher paych.SignedVoucher) (*api.VoucherCreateResult, error) { | |||
func (pm *Manager) CreateVoucher(ctx context.Context, ch address.Address, voucher v0paych.SignedVoucher) (*api.VoucherCreateResult, 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.
TODO: figure out what to do with the SignedVoucher type
Goals
Support actor upgrades -- specifically the payment channels
This covers only the state access part -- I did not attempt to address message submission cause it's not yet addressed in the larger PR. Of particular concern to pay attention to is the use of SignedVoucher -- a fairly complex data structure which is not stored on chain but appears in message submission for the payment channel state, and is tracked off chain in the payment channel manager. The number of references in the code to this data structure is large
Implementation