Skip to content
This repository was archived by the owner on Dec 7, 2023. It is now read-only.
This repository was archived by the owner on Dec 7, 2023. It is now read-only.

Potential User-Defined Value Type #311

@thedavidmeister

Description

@thedavidmeister

TCE-01C: Potential User-Defined Value Type

Type Severity Location
Code Style Informational TierwiseCombine.sol:L39, L40

Description:

Given that the "report" type is a special purpose uint256 value, the legibility of the codebase and library usages can be optimized by defining a custom user-value type.

Example:

uint256 newerBlock_ = TierReport.tierBlock(newerReport_, tier_);
uint256 olderBlock_ = TierReport.tierBlock(olderReport_, tier_);
uint256 diff_ = newerBlock_.saturatingSub(olderBlock_);
ret_ = TierReport.updateBlockAtTier(ret_, tier_ - 1, diff_);

Recommendation:

We advise one to be defined for the "report" data type (i.e. type Report is uint256;) to optimize library usages and permit statements such as using TierReport for Report; without affecting the functions exposed by the "basic" data types (i.e. avoid using TierReport for uint256;). This finding will not be replicated across the codebase, however, it is applicable to many instances.

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