You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Title: Custom errors from Solidity 0.8.4 are cheaper than revert strings
Impact:
Custom errors from Solidity 0.8.4 are cheaper than revert strings (cheaper deployment cost and runtime cost when the revert condition is met) while providing the same amount of information
Recommended Mitigation Steps:
Replace require statements with custom errors.
Title: Default value initialization
Impact:
If a variable is not set/initialized, it is assumed to have the default value (0, false, 0x0 etc depending on the data type). Explicitly initializing it with its default value is an anti-pattern and wastes gas.
Title: Custom errors from Solidity 0.8.4 are cheaper than revert strings
Impact:
Custom errors from Solidity 0.8.4 are cheaper than revert strings (cheaper deployment cost and runtime cost when the revert condition is met) while providing the same amount of information
Custom errors are defined using the error statement
reference: https://blog.soliditylang.org/2021/04/21/custom-errors/
Proof of Concept:
Tasks.sol#L124
Community.sol (various line)
Recommended Mitigation Steps:
Replace require statements with custom errors.
Title: Default value initialization
Impact:
If a variable is not set/initialized, it is assumed to have the default value (0, false, 0x0 etc depending on the data type). Explicitly initializing it with its default value is an anti-pattern and wastes gas.
Proof of Concept:
Tasks.sol#L181
Community.sol#L624
Project.sol#L412
Recommended Mitigation Steps:
Remove explicit initialization for default values.
Title: Using unchecked and prefix increment is more effective for gas saving:
Proof of Concept:
Tasks.sol#L181
Community.sol#L624
Recommended Mitigation Steps:
Change to:
Title: Gas savings for using solidity 0.8.10
Proof of Concept:
all contract
Recommended Mitigation Steps:
Consider to upgrade pragma to at least 0.8.10.
Solidity 0.8.10 has a useful change which reduced gas costs of external calls
Reference: here
Title: Using multiple
require
instead&&
can save gasProof of Concept:
Community.sol#L353-L357
Disputes.sol#L107
Recommended Mitigation Steps:
Title: Comparison operators
Proof of Concept:
Community.sol#L353-L357
Community.sol#L792
Recommended Mitigation Steps:
Replace
<=
with<
, and>=
with>
for gas optimizationTitle: Using
!=
is more gas efficient inrequire
statementProof of Concept:
Community.sol#L764
Project.sol#L195
Disputes.sol#L107
Recommended Mitigation Steps:
Change to
!=
Title: Use
unchecked
can save gasProof of Concept:
Community.sol#L794 (because of
require()
L#792)Community.sol#L798(because of
if()
L#785)Project.sol#L427(because of
if()
L#425)Project.sol#L616(because of
if()
L#614)Recommended Mitigation Steps:
Use
unchecked
Title: Consider make constant as private to save gas
Proof of Concept:
Project.sol#L60
Recommended Mitigation Steps:
I suggest changing the visibility from
public
tointernal
orprivate
The text was updated successfully, but these errors were encountered: