-
Notifications
You must be signed in to change notification settings - Fork 176
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
pm: recipient redeems old valid winning tickets on start up #632
Comments
Keeping a historical list of winning tickets seems useful; I like using the confirmation block number to indicate rows that have completed processing. Just curious: are we implementing ticket DB persistence for MVS? I was under the impression that would come in during SS or later. Cool if that can get in sooner though. |
Agreed.
The thought was that it would be nice to add it sooner rather than later especially once we start testing with more realistic blockchain conditions (i.e. dealing with on-chain transactions that do not confirm within pre-defined period of time). Although adding persistence is lower on the MVS priority list with the higher priority items being getting the happy ticket flow working (i.e. very quick on-chain transaction confirmation) |
Update: we think it makes the most sense to exclude winning ticket disk persistence as well as this specific issue from MVS, and move it to SS instead. Any objections? cc @ericxtang @dob Update on update: We're going for winning ticket persistence because we actually want to redeem tickets only upon end of stream, so that we can avoid the complexities that come with changing |
Will the validation logic in the smart contract allow you to cash multiple different winning tickets with the same recipient rand? |
Also related, what constitutes the "end of the stream?" Again, I'm imaging a world of segment independence, where you don't know if the stream ended since B may switch to another O at any point if you weren't fast enough with the response, and then switch back to you at any point in the future. If we're punting these ideas beyond MVS into SS though, that's ok. |
As a first approximation, it could be the expiration of the transcode loop that the orchestrator maintains. We still want to preserve this stateful transcode loop for a variety of reasons: load control, backpressure and related prioritization/QoS issues, transcode result caching, etc. For the v1 protocol, the loop times out 10 minutes after the last segment (as not to submit too many claims), but we probably should make this shorter for Streamflow, perhaps even as short as 1 minute. The overall flow would look something like this:
|
Re-opening because while O currently persists winning tickets it will not automatically redeem them at start up unless it has a ticket queue for the ticket's sender and a ticket queue is only constructed (backed by the DB) if the O has received a ticket from the sender recently. |
We could add a function on startup that tries to redeem all non-expired , non-used tickets (omit the sender from the queries) |
Is your feature request related to a problem? Please describe.
If O crashes prior to a redeeming a winning ticket on-chain, it will lose out on the pay out from the ticket unless O has a way to persist the ticket data such that it can try to redeem the ticket at a later point in time.
Describe the solution you'd like
Once #621 is implemented, O will always store winning ticket data in its DB at least until the ticket is successfully redeemed on-chain.
On start up, O can do the following:
[1] After observing a successful on-chain tx we can either clear the winning ticket from the DB or mark the winning ticket as redeemed by storing the confirmation block number in the relevant row of the winning tickets table. If we do the former, we can just query for all rows in the table here. If we do the latter, we can query for rows that do not have a confirmation block number.
Describe alternatives you've considered
O does not necessarily need to redeem the old valid winning tickets on start up, but it is unclear if there is a better time to do so at least in the MVS setting where we are not yet implementing any smarter strategy ticket redemption timing (i.e. O could only redeem tickets when the average gas price is at some level and if that level is not met by
X
blocks prior to the ticket's expiration O will redeem the ticket on-chain). Since we are leaving alternative ticket redemption strategies for the future, redeeming old valid winning tickets on start up seems like the simplest solution for now.The text was updated successfully, but these errors were encountered: