-
Notifications
You must be signed in to change notification settings - Fork 467
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
Store Condition in Payment Channel #2677
Comments
@acruikshank, would the |
For anyone reading this issue, my previous question was resolved offline. |
@acruikshank, how should we handle acceptance criteria #1 when no condition is provided to the redeem method? |
@rosalinekarr and I discussed in another channel. A nil condition passed into redeem should both allow the redeem to execute without checking a condition and clear the existing condition. This permits a last payment that requires a minimal information on chain if the target is willing to wait and the payer does not cancel the payment channel. |
Description
The redeemer of a payment channel voucher will sometimes need to supply a significant amount of data as additional parameters to a condition, and generally speaking, that data will be the same from one voucher to the next. The payment broker should store the full condition in the payment channel.
In the case of miner payments, this means storing the
verifyPieceInclusion
condition including the sector id and piece inclusion proof. These should not change from one redeem to the next (but the condition must be replayed, because the miner's LastPoSt could go out of date).Acceptance criteria
Redeem
is successful, the payment broker sets aredeemed
flag on the payment channel and stores acondition
predicate with the concatenation of condition andredeemerSuppliedParams
(the parameters actually sent in the message) ascondition
in the payment channel.Redeem
orClose
is called, and a condition exists in the voucher, and the redeemed flag is true, andpaymentchannel.condition
exists, andredeemerConditionParams
is empty, the payment broker will construct the condition message from the cached condition.condition
.NOTE There is potential problem here that the payer could provide some vouchers with a condition that requires additional params, and then later vouchers that have conditions that require no parameters. If the target redeems one of the earlier vouchers successfully, and then attempts to redeem a no parameter voucher, we will try to use the old parameters and the voucher will fail.
This is not a problem for the existing storage client, storage miner scenario, and any valid case where this might happen is far fetched. If we do feel like we need to solve this, we should store a hash of the condition and only reuse parameters if the hashes match. For now this extra data on chain isn't worth it.
The text was updated successfully, but these errors were encountered: