Omniscia Astrolab DAO Audit

AsMaths Code Style Findings

AsMaths Code Style Findings

AMS-01C: Generic Typographic Mistakes

TypeSeverityLocation
Code StyleAsMaths.sol:L22, L23, L24

Description:

The referenced lines contain typographical mistakes (i.e. private variable without an underscore prefix) or generic documentational errors (i.e. copy-paste) that should be corrected.

Example:

src/libs/AsMaths.sol
22uint256 internal constant BP_BASIS = 10_000; // 50% == 5_000 == 5e3

Recommendation:

We advise them to be corrected enhancing the legibility of the codebase.

Alleviation (59b75fbee1d8f3dee807c928f18be41c58b904e1):

The referenced variables remain without an underscore prefix despite their internal visibility specification, rendering this exhibit acknowledged.

AMS-02C: Ineffectual Usage of Safe Arithmetics

Description:

The linked mathematical operation is guaranteed to be performed safely by surrounding conditionals evaluated in either require checks or if-else constructs.

Example:

src/libs/AsMaths.sol
149return a > b ? a - b : b - a;

Recommendation:

Given that safe arithmetics are toggled on by default in pragma versions of 0.8.X, we advise the linked statement to be wrapped in an unchecked code block thereby optimizing its execution cost.

Alleviation (cf5194da53ebf026da6c8efa74daada96719cc71):

The referenced subtractions have been wrapped in an unchecked code block, optimizing their gas cost.

AMS-03C: Inexistent Error Messages

TypeSeverityLocation
Code StyleAsMaths.sol:L514, L862

Description:

The linked require checks have no error messages explicitly defined.

Example:

src/libs/AsMaths.sol
514require(denominator > prod1);

Recommendation:

We advise each to be set so to increase the legibility of the codebase and aid in validating the require checks' conditions.

Alleviation (59b75fbee1d8f3dee807c928f18be41c58b904e1):

While the former of the two require checks is accompanied by descriptive in-line documentation, the latter is not thus rendering this exhibit acknowledged.

AMS-04C: Redundant Parenthesis Statements

Description:

The referenced statements are redundantly wrapped in parenthesis' (()).

Example:

src/libs/AsMaths.sol
129return (diff(a, b) <= val);

Recommendation:

We advise them to be safely omitted, increasing the legibility of the codebase.

Alleviation (cf5194da53ebf026da6c8efa74daada96719cc71):

The redundant parenthesis in the referenced statements have been safely omitted.