FIP Discussion: Flag Actor for use in payment channel protocols
Kubuxu opened this issue · 0 comments
Filecoin Payment Channel protocol supports Hash, Min- and Max-Time locks as well as message execution conditional lock.
The message execution lock is currently limited in usability as there aren't many useful endpoints to call.
Background
Payment Channels in Filecoin operate on vouchers which can be thought of as contracts between two parties agreeing on a balance between them.
These vouchers can have additional validity conditions:
- Minimum time lock - the earliest time the voucher can be redeemed
- Maximum time lock - the latest time the voucher can be redeemed
- Hash lock - voucher is only valid if it is presented in combination with some "secret" value; if the redeemer doesn't know the value, the voucher cannot be redeemed
- Message Execution lock - the voucher is only valid if a send of
(To, Method, Param)
(embedded in the voucher) succeeds.
While the first three are easy to use and fully enabled, the last one is limited by available endpoints of Filecoin actors.
Some Payment Channel Network (PCN) protocols require a global on-chain "flag", which all vouchers in a given voucher chain can refer to. See Blitz. The cleanest way to implement such a flag is the Message Execution lock and new actor type.
Flag Actor
I'm proposing a new Flag Actor, which is capable of the following:
- Retaining a set of flags in the form of RLE+ (run-length encoded bitfield)
- Delaying the act of setting a flag for Y epochs, Y being actor initialisation time constant (this is a requirement of some PCN protocols)
- Checking the given set of flags sum to
x
. This allows checking if all flags are set or unset. - Checking the given set of flags sum to
x mod 2
. This allows for retractable flags. - Setting a set of flags restricted to the creator of the actor.
The action of clearing a flag is explicitly not supported. Most protocols using global flags require that they cannot be retracted.
Flags and flag sets can be expressed as RLE+.
A way of delaying flags needs to be investigated, with the aim of not causing significant misestimations.