Remove Unnecessary Use of Integer Types in Prysm #9958
Labels
Good First Issue
Good for newcomers
Help Wanted
Extra attention is needed
Priority: Medium
Medium priority item
Security
Security Related Issues
💎 Issue
Background
Thank you @uncdr for bringing this to our attention. As Prysm is becoming a more complex project, we should place a lot of care into how we use primitive types. The danger of using integer types where they are not needed is problematic, as there could be future changes to the codebase that lead to bugs. Artem from our team has mentioned we should only use integers as a type when we really need signed numbers. Otherwise, everything should be unsigned and enforced by the compiler.
Description
This is a tracking issue to refactor all uses of integer types in Prysm into uints (either uint, uint16, 32, or 64) and audit them carefully. Ideally, this should be enforced by a static analyzer or some Github action script which checks for uses of integers, casting of values into integer types, and more. Wherever we need integers, which is rare, we should add exceptions, which can be done via comment pragmas, such as
//ignore:int
which can be parsed by the analyzer.In the meantime, there a few low-hanging fruit we can take of, such as refactoring all uses of
cliCtx.IntFlag
intoclicCtx.Uint64Flag
for flag definitions of uint values.TODOs
int
type in Prysm, running as part of every pull requestint
intouint
with the respective size, typicallyuint64
The text was updated successfully, but these errors were encountered: