Canto contest - fatherOfBlocks's results

Execution layer for original work.

General Information

Platform: Code4rena

Start Date: 14/06/2022

Pot Size: $100,000 USDC

Total HM: 26

Participants: 59

Period: 7 days

Judge: GalloDaSballo

Total Solo HM: 9

Id: 133

League: ETH

Canto

Findings Distribution

Researcher Performance

Rank: 42/59

Findings: 2

Award: $289.02

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

72.5532 USDC - $72.55

687.9945 CANTO - $111.11

Labels

bug
QA (Quality Assurance)

External Links

stableswap/BaseV1-core.sol

  • L4 - The erc20 interface by convention should be written with the letter I in front and in capital letters, that is, like this: IERC20.

  • L123/124/125/126/127/128 - If instead of values ​​1 and 2, to create a custom reentrancyGuard, it is better to use 0 and 1 and not have to initialize zero, generating less gas cost.

  • L204 - It should be validated that granularity is != 0 in quote() function and revert with a message, otherwise it would revert without explaining why.

lending-market/AccountantDelegate.sol

  • L21/22 - It is incorrect to use an address array with a single value, if you can use just one address, this way is simpler and less expensive.

lending-market/CNote.sol

  • L229 - The require does not send an error message, it would be better to send a message because that way the user will know the reason for the error.

lending-market/NoteInterest.sol

  • L85 - There is commented code and documentation that does not belong to anyone, that code should be deleted if it is not used.

unigov/ProposalStore.sol

  • L6/7/9/10 - There is commented code and documentation that does not belong to anyone, that code should be deleted if it is not used.

#0 - GalloDaSballo

2022-08-02T20:21:13Z

IERC20

Ref

L123/124/125/126/127/128 - If instead of values ​​1 and 2, to create a custom reentrancyGuard, it is better to use 0 and 1 and not have to initialize zero, generating less gas cost.

It's actually cheaper to use 1 and 2, see OZ

granularity is != 0 in quote()

NC

21/22 - It is incorrect

Disagree per the function signature

L229 - The require does

Valid NC

lending-market/NoteInterest.sol & unigov/ProposalStore.sol

Valid R

2 R 2 NC

Awards

41.2642 USDC - $41.26

396.9199 CANTO - $64.10

Labels

bug
G (Gas Optimization)

External Links

stableswap/BaseV1-core.sol

  • L46/207/223/224/37/490 - It is not necessary to create a variable with its default value, since it generates an extra gas expense.

  • L123 - Instead of a modifier, it is preferable to use a private view function and not generate gas expense.

  • L136/221/232 - Instead of "variable - 1" or "variable + 1", it is less expensive to use --variable or ++variable.

  • L157/253/272/286/295/296/297/303/465 - Instead of variable > 0, it is less expensive to validate variable != 0 with type uint.

  • L207/337 - Instead of doing i++ in the for loop, you could do unchecked{++i;} generating a lower gas cost.

  • L207 - Instead of querying the length of an array in each iteration of the for loop, you can create a variable with the value of length and use that variable within the loop, this generates less gas cost.

  • L125/253/272/285/286/288/294/303/413/431/465/468/498/503/508/521/523/524 - Instead of using requires you can use custom errors with ifs and a much lower gas expense is generated.

stableswap/BaseV1Router01.sol

  • L71/86/88/104/105/133/210/211/223/228/291/295/296/387/402/415/417/428/430/452/456/459/463/466 - In instead of using requires you can use custom errors with ifs and a much lower gas expense is generated.

  • L104/105/456/463 - Instead of variable > 0, it is less expensive to validate variable != 0 with type uint.

  • L40/364/366/387/402/417/428/430/435/436 - Instead of "variable - 1" or "variable + 1", it is less expensive to use --variable or ++variable.

  • L136/362 - Instead of doing i++ in the for loop, you could do unchecked{++i;} generating a lower gas cost.

  • L136/362 - Instead of querying the length of an array in each iteration of the for loop, you can create a variable with the value of length and use that variable within the loop, this generates less gas cost.

  • L136/158/362 - It is not necessary to create a variable with its default value, since it generates an extra gas expense.

  • L105/223/228/295/296/387/402/417/430 - The message that is returned has more than 32 bytes, it could generate less gas expense if it had 32 letters or less.

lending-market/WETH.sol

  • L29/69/72/96/97 - Instead of using requires you can use custom errors with ifs and a much lower gas cost is generated.

lending-market/GovernorBravoDelegate.sol

  • L25/26/27/42/46/47/53/78/87/115/146/164 - Instead of using requires you can use custom errors with ifs and a much lower gas expense is generated.

  • L57/62/68/90 - It is not necessary to create a variable with its default value, since it generates an extra gas expense.

  • L68/90 - Instead of doing i++ in the for loop, you could do unchecked{++i;} generating a lower gas cost.

  • L68/90 - Instead of querying the length of an array in each iteration of the for loop, you can create a variable with the value of length and use that variable within the loop, this generates less gas cost.

  • L45/78/87/115/133/146/164 - The message that is returned has more than 32 bytes, it could generate less gas expense if it had 32 letters or less.

lending-market/Comptroller

  • L102/104 -It is not necessary to create a variable in memory if it is only going to be used once.

  • L126/206 - It is not necessary to create a variable with its default value, since it generates an extra gas expense.

  • L126/206 - Instead of doing i++ in the for loop, you could do unchecked{++i;} generating a lower gas cost.

  • L149/1053/1063/1072/1081/1350/1357/1456 - It is not necessary to validate that a bool == true within an if, the bool can be returned directly.

  • L218 - Instead of "variable - 1" or "variable + 1", it is less expensive to use --variable or ++variable.

  • L309/329/380/1129/1194/1197/1200/1215/1218/1221/1311/1379 - Instead of variable > 0, it is less expensive to validate variable != 0 with type uint.

  • L178/237/343/351/373/491/556/614/852/960/998/1003/1016/1051/1052/1053/1061/1062/1063/1071/1072/1080/1081/1089/1090 /1095/1096/1097/1158/1349/1395/1397/1408/1411/1424 - Instead of using requires, custom errors can be used with ifs and a much lower gas expense is generated.

  • L735 - Instead of querying the length of an array in each iteration of the for loop, you can create a variable with the value of length and use that variable within the loop, this generates less gas cost.

  • L491/998/1051/1052/1061/1062/1071/1080/1096/1411 - The message that is returned has more than 32 bytes, it could generate less gas expense if it had 32 letters or less.

lending-market/AccountantDelegator.sol

  • L43/44/124 - The message that is returned has more than 32 bytes, it could generate less gas expense if it had 32 letters or less.

  • L43/44/124 - Instead of using requires you can use custom errors with ifs and a much lower gas cost is generated.

lending-market/AccountantDelegate.sol

  • L17/18/29/48/60/83 - The message that is returned has more than 32 bytes, it could generate less gas expense if it had 32 letters or less.

  • L17/18/29/48/60/83 - Instead of using requires you can use custom errors with ifs and a much lower gas cost is generated.

lending-market/TreasuryDelegator.sol

  • L31/32 - The message that is returned has more than 32 bytes, it could generate less gas expense if it had 32 letters or less.

  • L31/32 - Instead of using requires, custom errors can be used with ifs and a much lower gas expense is generated.

  • L45/46/54/55 - It is not necessary to create a variable in memory if it is only going to be used once.

lending-market/TreasuryDelegate.sol

  • L16/17/47 - Instead of using requires you can use custom errors with ifs and a much lower gas cost is generated.

  • L47 - The message that is returned has more than 32 bytes, it could generate less gas expense if it had 32 letters or less.

  • L26/27/35/36 - It is not necessary to create a variable in memory if it is only going to be used once.

lending-market/CNote.sol

  • L16/43/45/77/114/130/146/198/214/264/310/330/353 - Instead of using requires you can use custom errors with ifs and a much lower gas expense is generated.

  • L16/43/45/77/114/130/146/198/214/264/310/330 - The message that is returned has more than 32 bytes, it could generate less gas expense if it had 32 letters or less.

  • L272 - Instead of variable > 0, it is less expensive to validate variable != 0 with type uint.

lending-market/NoteInterest.sol

  • L167 - The message that is returned has more than 32 bytes, it could generate less gas expense if it had 32 letters or less.

  • L141/154/167 - Instead of using requires, custom errors can be used with ifs and a much lower gas cost is generated.

unigov/ProposalStore.sol

  • L31 - Instead of using requires you can use custom errors with ifs and a much lower gas expense is generated.

  • L42/43/48/49 - It is not necessary to create a variable in memory if it is only going to be used once.

unigov/ERC20MinterBurnerDecimals.sol

  • L72/86/100/114 - The message that is returned has more than 32 bytes, it could generate less gas expense if it had 32 letters or less.

  • L72/86/100/114 - Instead of using requires you can use custom errors with ifs and a much lower gas cost is generated.

unigov/ERC20Burnable.sol

  • L37 - The message that is returned has more than 32 bytes, it could generate less gas expense if it had 32 letters or less.

  • L37 - Instead of using requires you can use custom errors with ifs and a much lower gas expense is generated.

#0 - GalloDaSballo

2022-08-04T00:24:25Z

No immutable, no packing, less than 500 gas saved

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter