Skip to content

[RTU-03C] Redundant Representation of Literal Constant #17

@dkuppitz

Description

@dkuppitz

RTU-03C: Redundant Representation of Literal Constant

Type Severity Location
Code Style RebaseTokenUpgradeable.sol:L36

Description:

The RebaseTokenStorageLocation variable is declared as a bytes32 literal instead of utilizing its commented-out representation.

Example:

// keccak256(abi.encode(uint256(keccak256("tangible.storage.RebaseToken")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant RebaseTokenStorageLocation =
    0x8a0c9d8ec1d9f8b365393c36404b40a33f47675e34246a2e186fbefd5ecd3b00;

Recommendation:

We advise the commented-out representation to replace the value literal, ensuring that the value can be easily maintained while ensuring that no external verification of equivalence must be performed.

To note, it is possible to perform literal-based calculations in constant declarations and keccak256 evaluations of string values are correctly evaluated during compile-time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions