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

pm: Fix redeeming tickets with zero block hash #2359

Merged
merged 2 commits into from
Apr 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@
#### Orchestrator
- \#2284 Fix issue with not redeeming tickets by Redeemer (@leszko)
- \#2352 Fix standalone orchestrator not crashing under UnrecoverableError (@leszko)
- \#2359 Fix redeeming tickets with zero block hash (@leszko)

#### Transcoder
7 changes: 5 additions & 2 deletions pm/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,11 @@ func (q *ticketQueue) handleBlockEvent(latestL1Block *big.Int) {
}

func isNonRetryableTicketErr(err error) bool {
// The latter check depends on logic in eth.client.CheckTx()
return err == errIsUsedTicket || strings.Contains(err.Error(), "transaction failed")
return err == errIsUsedTicket ||
// Depends on logic in eth.client.CheckTx()
strings.Contains(err.Error(), "transaction failed") ||
// Arbitrum L2 happens to return zero as the L1 block hash which results in this non-retryable error
strings.Contains(err.Error(), "ticket creationRound does not have a block hash")
}

func (q *ticketQueue) isRecipientActive(addr ethcommon.Address) bool {
Expand Down
10 changes: 10 additions & 0 deletions pm/queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ func TestTicketQueueLoop_IsNonRetryableTicketErr_MarkAsRedeemed(t *testing.T) {
consumeQueue(qc)
assert.True(ts.submitted[fmt.Sprintf("%x", ticket.Sig)])

// Test that ticket is marked as redeemed if it has zero as block hash
ticket = defaultSignedTicket(sender, 1)
addTicket(ticket)

qc = &queueConsumer{
redemptionErr: errors.New("ticket creationRound does not have a block hash"),
}
consumeQueue(qc)
assert.True(ts.submitted[fmt.Sprintf("%x", ticket.Sig)])

// Test that ticket is not marked as redeemed if there is an error checking the tx, but the tx did not fail
ticket = defaultSignedTicket(sender, 2)
addTicket(ticket)
Expand Down