Browse Source

light: handle too high errors correctly (#6346)

pull/6265/head
Callum Waters 4 years ago
committed by GitHub
parent
commit
d4d2b66067
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions
  1. +1
    -0
      CHANGELOG_PENDING.md
  2. +3
    -3
      light/client.go

+ 1
- 0
CHANGELOG_PENDING.md View File

@ -87,3 +87,4 @@ Friendly reminder: We have a [bug bounty program](https://hackerone.com/tendermi
- [privval] \#5638 Increase read/write timeout to 5s and calculate ping interval based on it (@JoeKash) - [privval] \#5638 Increase read/write timeout to 5s and calculate ping interval based on it (@JoeKash)
- [blockchain/v1] [\#5701](https://github.com/tendermint/tendermint/pull/5701) Handle peers without blocks (@melekes) - [blockchain/v1] [\#5701](https://github.com/tendermint/tendermint/pull/5701) Handle peers without blocks (@melekes)
- [blockchain/v1] \#5711 Fix deadlock (@melekes) - [blockchain/v1] \#5711 Fix deadlock (@melekes)
- [light] \#6346 Correctly handle too high errors to improve client robustness (@cmwaters)

+ 3
- 3
light/client.go View File

@ -731,7 +731,7 @@ func (c *Client) verifySkipping(
blockCache = append(blockCache, interimBlock) blockCache = append(blockCache, interimBlock)
// if the error is benign, the client does not need to replace the primary // if the error is benign, the client does not need to replace the primary
case provider.ErrLightBlockNotFound, provider.ErrNoResponse:
case provider.ErrLightBlockNotFound, provider.ErrNoResponse, provider.ErrHeightTooHigh:
return nil, err return nil, err
// all other errors such as ErrBadLightBlock or ErrUnreliableProvider are seen as malevolent and the // all other errors such as ErrBadLightBlock or ErrUnreliableProvider are seen as malevolent and the
@ -969,7 +969,7 @@ func (c *Client) lightBlockFromPrimary(ctx context.Context, height int64) (*type
// Everything went smoothly. We reset the lightBlockRequests and return the light block // Everything went smoothly. We reset the lightBlockRequests and return the light block
return l, nil return l, nil
case provider.ErrNoResponse, provider.ErrLightBlockNotFound:
case provider.ErrNoResponse, provider.ErrLightBlockNotFound, provider.ErrHeightTooHigh:
// we find a new witness to replace the primary // we find a new witness to replace the primary
c.logger.Debug("error from light block request from primary, replacing...", c.logger.Debug("error from light block request from primary, replacing...",
"error", err, "height", height, "primary", c.primary) "error", err, "height", height, "primary", c.primary)
@ -1072,7 +1072,7 @@ func (c *Client) findNewPrimary(ctx context.Context, height int64, remove bool)
return response.lb, nil return response.lb, nil
// process benign errors by logging them only // process benign errors by logging them only
case provider.ErrNoResponse, provider.ErrLightBlockNotFound:
case provider.ErrNoResponse, provider.ErrLightBlockNotFound, provider.ErrHeightTooHigh:
lastError = response.err lastError = response.err
c.logger.Debug("error on light block request from witness", c.logger.Debug("error on light block request from witness",
"error", response.err, "primary", c.witnesses[response.witnessIndex]) "error", response.err, "primary", c.witnesses[response.witnessIndex])


Loading…
Cancel
Save