Skip to content
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

Redeem tickets only when recipient is active #2253

Merged
merged 1 commit into from
Feb 11, 2022

Conversation

leszko
Copy link
Contributor

@leszko leszko commented Feb 10, 2022

What does this pull request do? Explain your changes. (required)

Check if the recipient is active before redeeming the ticket.

Specific updates (required)

How did you test each of these updates (required)

The same testing as described here.

This time, when the orchestrator was inactive, this was the message (only with debug logs enabled):

I0210 15:34:23.237192   26302 queue.go:134] Ticket recipient is not active in this round, cannot redeem ticket recipientRandHash=59c006119dccedb68bff820c2754ad7662f6ceb7f23310cad52c272b74872bcb senderNonce=1

When the orchestrator became active, it redeemed the ticket.

******************************Eth Transaction******************************

Invoking transaction: "redeemWinningTicket". Inputs: "_ticket: { Recipient: 0x7E71B5087bc14abd6aF3Bbe2d87Ea0ADC14Ce56F  Sender: 0x7E71B5087bc14abd6aF3Bbe2d87Ea0ADC14Ce56F  FaceValue: 34782608695652173  WinProb: 33290225655728407058145081652868458784123513979168705244586300000000000000000  SenderNonce: 1  RecipientRandHash: 0x59c006119dccedb68bff820c2754ad7662f6ceb7f23310cad52c272b74872bcb  AuxData: 0x0000000000000000000000000000000000000000000000000000000000008414ecc7d83d923df7611fcda8bd67cc2aca904939e4b8417a1bc5f91e0d8487119d }  _sig: 0x27f8f5a6a08a5e3caac9bae27851d79ae69a67c9d7b63c080a138d846100f4d56970305363598c24994e7d84a1293437af869bc896948e19b89c2a5eb9a6199c1b  _recipientRand: 33683099207914901971858567325965190760487315520271124299464254139206992337416"  Hash: "0xf161f1db583a99d40efdaff72400f8f8e35590103ccd8dba36564eb425f4dcff". 

***************************************************************************

Does this pull request close any open issues?

fix #2250

Checklist:

@leszko leszko requested a review from yondonfu February 10, 2022 15:17
pm/ticketstore.go Outdated Show resolved Hide resolved
pm/queue.go Outdated Show resolved Hide resolved
isActive, err := q.store.IsOrchActive(addr, q.tm.LastInitializedRound())
if err != nil {
glog.Errorf("Unable to select an active orchestrator")
// In the case of error, assume recipient is active in order to try to redeem the ticket
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the idea here to bias towards trying to redeem if there is an error with the DB because that's preferable to not redeeming since gas estimation for the tx should still prevent the tx from going on-chain even if the recipient actually happens to not be active?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's a corner case that the DB returns an error, but still...

I think it makes more sense in uncertain scenarios to try to redeem the ticket because it may expire.

@leszko leszko requested a review from yondonfu February 11, 2022 08:15
@leszko leszko force-pushed the 2250-redeem-tickets-only-if-active branch from 768b225 to 7def274 Compare February 11, 2022 08:34
Copy link
Member

@yondonfu yondonfu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@leszko leszko merged commit 4a8b8bd into livepeer:master Feb 11, 2022
@leszko leszko deleted the 2250-redeem-tickets-only-if-active branch February 11, 2022 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redeem tickets only by active orchestrators
2 participants