Skip to content

Commit

Permalink
Version old no ticket error
Browse files Browse the repository at this point in the history
  • Loading branch information
PlasmaPower committed Jul 22, 2022
1 parent 76f762e commit cb57b86
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions precompiles/ArbRetryableTx.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ type ArbRetryableTx struct {

var ErrSelfModifyingRetryable = errors.New("retryable cannot modify itself")

func (con ArbRetryableTx) oldNotFoundError(c ctx) error {
if c.State.FormatVersion() >= 3 {
return con.NoTicketWithIDError()
} else {
return errors.New("ticketId not found")
}
}

// Schedule an attempt to redeem the retryable, donating all of the call's gas to the redeem attempt
func (con ArbRetryableTx) Redeem(c ctx, evm mech, ticketId bytes32) (bytes32, error) {
if c.txProcessor.CurrentRetryable != nil && ticketId == *c.txProcessor.CurrentRetryable {
Expand All @@ -58,7 +66,7 @@ func (con ArbRetryableTx) Redeem(c ctx, evm mech, ticketId bytes32) (bytes32, er
return hash{}, err
}
if retryable == nil {
return hash{}, con.NoTicketWithIDError()
return hash{}, con.oldNotFoundError(c)
}
nextNonce, err := retryable.IncrementNumTries()
if err != nil {
Expand Down Expand Up @@ -155,7 +163,7 @@ func (con ArbRetryableTx) Keepalive(c ctx, evm mech, ticketId bytes32) (huge, er
return nil, err
}
if nbytes == 0 {
return nil, con.NoTicketWithIDError()
return nil, con.oldNotFoundError(c)
}
updateCost := arbmath.WordsForBytes(nbytes) * params.SstoreSetGas / 100
if err := c.Burn(updateCost); err != nil {
Expand All @@ -181,7 +189,7 @@ func (con ArbRetryableTx) GetBeneficiary(c ctx, evm mech, ticketId bytes32) (add
return addr{}, err
}
if retryable == nil {
return addr{}, con.NoTicketWithIDError()
return addr{}, con.oldNotFoundError(c)
}
return retryable.Beneficiary()
}
Expand All @@ -197,7 +205,7 @@ func (con ArbRetryableTx) Cancel(c ctx, evm mech, ticketId bytes32) error {
return err
}
if retryable == nil {
return con.NoTicketWithIDError()
return con.oldNotFoundError(c)
}
beneficiary, err := retryable.Beneficiary()
if err != nil {
Expand Down

0 comments on commit cb57b86

Please sign in to comment.