Skip to content

Commit

Permalink
SuiError::is_retryable cleanup (#16158)
Browse files Browse the repository at this point in the history
## Description 

Should be a no-op

## Test Plan 

How did you test the new or updated feature?

---
If your changes are not user-facing and do not break anything, you can
skip the following section. Otherwise, please briefly describe what has
changed under the Release Notes section.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
  • Loading branch information
halfprice authored Feb 12, 2024
1 parent a23783a commit 98da2c5
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions crates/sui-types/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -748,44 +748,45 @@ impl SuiError {
/// There should be only a handful of retryable errors. For now we list common
/// non-retryable error below to help us find more retryable errors in logs.
pub fn is_retryable(&self) -> (bool, bool) {
match self {
let retryable = match self {
// Network error
SuiError::RpcError { .. } => (true, true),
SuiError::RpcError { .. } => true,

// Reconfig error
SuiError::ValidatorHaltedAtEpochEnd => (true, true),
SuiError::MissingCommitteeAtEpoch(..) => (true, true),
SuiError::WrongEpoch { .. } => (true, true),
SuiError::ValidatorHaltedAtEpochEnd => true,
SuiError::MissingCommitteeAtEpoch(..) => true,
SuiError::WrongEpoch { .. } => true,

SuiError::UserInputError { error } => {
match error {
// Only ObjectNotFound and DependentPackageNotFound is potentially retryable
UserInputError::ObjectNotFound { .. } => (true, true),
UserInputError::DependentPackageNotFound { .. } => (true, true),
_ => (false, true),
UserInputError::ObjectNotFound { .. } => true,
UserInputError::DependentPackageNotFound { .. } => true,
_ => false,
}
}

SuiError::PotentiallyTemporarilyInvalidSignature { .. } => (true, true),
SuiError::PotentiallyTemporarilyInvalidSignature { .. } => true,

// Overload errors
SuiError::TooManyTransactionsPendingExecution { .. } => (true, true),
SuiError::TooManyTransactionsPendingOnObject { .. } => (true, true),
SuiError::TooOldTransactionPendingOnObject { .. } => (true, true),
SuiError::TooManyTransactionsPendingConsensus => (true, true),
SuiError::TooManyTransactionsPendingExecution { .. } => true,
SuiError::TooManyTransactionsPendingOnObject { .. } => true,
SuiError::TooOldTransactionPendingOnObject { .. } => true,
SuiError::TooManyTransactionsPendingConsensus => true,

// Non retryable error
SuiError::ExecutionError(..) => (false, true),
SuiError::ByzantineAuthoritySuspicion { .. } => (false, true),
SuiError::QuorumFailedToGetEffectsQuorumWhenProcessingTransaction { .. } => {
(false, true)
}
SuiError::TxAlreadyFinalizedWithDifferentUserSigs => (false, true),
SuiError::FailedToVerifyTxCertWithExecutedEffects { .. } => (false, true),
SuiError::ObjectLockConflict { .. } => (false, true),

_ => (false, false),
}
SuiError::ExecutionError(..) => false,
SuiError::ByzantineAuthoritySuspicion { .. } => false,
SuiError::QuorumFailedToGetEffectsQuorumWhenProcessingTransaction { .. } => false,
SuiError::TxAlreadyFinalizedWithDifferentUserSigs => false,
SuiError::FailedToVerifyTxCertWithExecutedEffects { .. } => false,
SuiError::ObjectLockConflict { .. } => false,

// For all un-categorized errors, return here with categorized = false.
_ => return (false, false),
};

(retryable, true)
}

pub fn is_object_or_package_not_found(&self) -> bool {
Expand Down

0 comments on commit 98da2c5

Please sign in to comment.