celestia-node icon indicating copy to clipboard operation
celestia-node copied to clipboard

fix: precedence to avoid masking Byzantine errors in SharesAvailable

Open ANtutov opened this issue 1 month ago • 0 comments

The error handling in share/availability/full/availability.go used a disjunction combined with a conjunction without explicit parentheses, relying on Go’s operator precedence where && binds tighter than ||. As a result, shwap.ErrNotFound was always mapped to share.ErrNotAvailable even when the same error chain also contained a *byzantine.ErrByzantine via errors.Join, which could mask Byzantine faults as mere unavailability. This change groups the NotFound and DeadlineExceeded checks together and only maps to ErrNotAvailable if neither condition is accompanied by a Byzantine error. The intended behavior aligns with tests expecting NotFound and DeadlineExceeded to map to ErrNotAvailable while propagating Byzantine errors distinctly.

ANtutov avatar Nov 22 '25 13:11 ANtutov