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
[G-01] Avoid using SafeMath on solidity v8 and newer
The SafeMath library validates if an arithmetic operation would result in an integer overflow/underflow. If it would, the library throws an exception, effectively reverting the transaction.
Since Solidity 0.8, the overflow/underflow check is implemented on the language level - it adds the validation to the bytecode during compilation.
You don't need the SafeMath library for Solidity 0.8+
[G-02] On contract DNSSEC.sol the variable anchors should be immutable
[G-03] On BaseRegistrarImplementation ENS and basenode should be immutable
[G-04] Use unchecked in ethregistrar/StringUtils.sol
In the strlen function use unchecked to save gas:
function strlen(string memory s) internal pure returns (uint) {
uint len;
uint i = 0;
uint bytelength = bytes(s).length;
+ unchecked{
for(len = 0; i < bytelength; len++) {
bytes1 b = bytes(s)[i];
if(b < 0x80) {
i += 1;
} else if (b < 0xE0) {
i += 2;
} else if (b < 0xF0) {
i += 3;
} else if (b < 0xF8) {
i += 4;
} else if (b < 0xFC) {
i += 5;
} else {
i += 6;
}
}
+ }
return len;
}
[G-05] Take in mind you shoul only use unchecked when its safe to increment without overflow, like in loops iterator.
Use this pattern;
for (uint256 i; i < length;) {
// code here
unchecked { ++i; }
}
On
ontracts/dnssec-oracle/BytesUtils.sol:266: for(uint i = 0; i < len; i++) {
contracts/dnssec-oracle/BytesUtils.sol:313: for(uint256 idx = off; idx < off + len; idx++) {
contracts/dnssec-oracle/DNSSECImpl.sol:93: for(uint i = 0; i < input.length; i++) {
contracts/dnssec-oracle/algorithms/EllipticCurve.sol:304: for(uint i = 0; i < exp; i++) {
contracts/ethregistrar/BulkRenewal.sol:41: for (uint256 i = 0; i < names.length; i++) {
contracts/ethregistrar/BulkRenewal.sol:56: for (uint256 i = 0; i < names.length; i++) {
contracts/ethregistrar/ETHRegistrarController.sol:256: for (uint256 i = 0; i < data.length; i++) {
contracts/ethregistrar/StringUtils.sol:14: for(len = 0; i < bytelength; len++) {
contracts/resolvers/Multicallable.sol:10: for(uint i = 0; i < data.length; i++) {
contracts/wrapper/ERC1155Fuse.sol:92: for (uint256 i = 0; i < accounts.length; ++i) {
contracts/wrapper/ERC1155Fuse.sol:205: for (uint256 i = 0; i < ids.length; ++i) {
[G-06] Use unchecked in resolvers/profiles/DNSResolver.sol
Gas report
[G-01] Avoid using
SafeMath
on solidity v8 and newerThe SafeMath library validates if an arithmetic operation would result in an integer overflow/underflow. If it would, the library throws an exception, effectively reverting the transaction.
Since Solidity 0.8, the overflow/underflow check is implemented on the language level - it adds the validation to the bytecode during compilation.
You don't need the SafeMath library for Solidity 0.8+
[G-02] On contract
DNSSEC.sol
the variableanchors
should be immutable[G-03] On BaseRegistrarImplementation
ENS
andbasenode
should be immutable[G-04] Use
unchecked
in ethregistrar/StringUtils.solIn the
strlen
function useunchecked
to save gas:[G-05] Take in mind you shoul only use
unchecked
when its safe to increment without overflow, like in loops iterator.Use this pattern;
On
[G-06] Use
unchecked
in resolvers/profiles/DNSResolver.solChange
To
[L-07] The withdraw function should be external
The
withdraw
function of ETHRegistrarController.sol should be external[G-08] There are two contracts with the same funcionality
Avoid using
Owned
onstead of that use the Ownable contract from openzepellin as you do with other contractsThe text was updated successfully, but these errors were encountered: