Skip to content

Latest commit

 

History

History
20 lines (12 loc) · 944 Bytes

014.md

File metadata and controls

20 lines (12 loc) · 944 Bytes

Curved Glossy Dragonfly

Medium

Custom modules not supposed to used error code of value one, as it is reserved for internal errors in cosmos

Vulnerability Details

The Epoching module utilize the error code 1, which is the reserved code value for the internal errors in cosmos sdk, https://docs.cosmos.network/main/build/building-modules/errors#registration

Impact

Allowing custom modules to define errors with code 1 could lead to vagueness, If two different parts of the system (the core SDK and a module) were both allowed to use code 1, then it wouldn’t be clear whether an error with that code came from a fundamental problem in the SDK or from a module’s custom logic. Keeping code 1 off-limits for modules prevents such conflicts.

Code Snippet

https://github.com/babylonlabs-io/babylon/blob/81d89be18d9dd063a6a94786dc09e43df9dbdc37/x/epoching/types/errors.go#L10-L13

Mitigation

Avoid using error code 1