Platform: Code4rena
Start Date: 06/09/2022
Pot Size: $90,000 USDC
Total HM: 33
Participants: 168
Period: 9 days
Judge: GalloDaSballo
Total Solo HM: 10
Id: 157
League: ETH
Rank: 85/168
Findings: 2
Award: $106.39
š Selected for report: 0
š Solo Findings: 0
š Selected for report: Lambda
Also found by: 0x1337, 0x1f8b, 0x4non, 0x85102, 0xA5DF, 0xNazgul, 0xSmartContract, 0xbepresent, 0xc0ffEE, 8olidity, Aymen0909, B2, Bnke0x0, CRYP70, Captainkay, CertoraInc, Ch_301, Chom, ChristianKuri, CodingNameKiki, Deivitto, Diana, DimitarDimitrov, ElKu, EthLedger, Franfran, Funen, GimelSec, JansenC, Jeiwan, Jujic, Lead_Belly, MEP, MasterCookie, MiloTruck, Noah3o6, PPrieditis, PaludoX0, Picodes, PwnPatrol, R2, Randyyy, RaymondFam, Respx, ReyAdmirado, Rolezn, Samatak, Tointer, Tomo, V_B, Waze, _Adam, __141345__, a12jmx, ak1, asutorufos, azephiar, ballx, bharg4v, bin2chen, bobirichman, brgltd, bulej93, c3phas, cccz, ch0bu, cloudjunky, cryptonue, cryptostellar5, cryptphi, csanuragjain, d3e4, datapunk, davidbrai, delfin454000, dharma09, dic0de, dipp, djxploit, eierina, erictee, fatherOfBlocks, gogo, hansfriese, hyh, imare, indijanc, izhuer, jonatascm, ladboy233, leosathya, lucacez, lukris02, m9800, martin, minhtrng, ne0n, neumo, oyc_109, p_crypt0, pashov, pauliax, pcarranzav, pedr02b2, peritoflores, pfapostol, rbserver, ret2basic, robee, rvierdiiev, sach1r0, sahar, scaraven, sikorico, simon135, slowmoses, sorrynotsorry, tnevler, tonisives, volky, yixxas, zkhorse, zzzitron
60.7742 USDC - $60.77
emit
function called earlyā There are 3 instances of this issue: ā
File: token/metadata/MetadataRenderer.sol ā 348: emit ContractImageUpdated(settings.contractImage, _newContractImage); 356: emit RendererBaseUpdated(settings.rendererBase, _newRendererBase); 364: emit DescriptionUpdated(settings.description, _newDescription);
indexed
fieldsā There are 32 instances of this issue: ā
File: auction/IAuction.sol ā 22: event AuctionBid(uint256 tokenId, address bidder, uint256 amount, bool extended, uint256 endTime); 28: event AuctionSettled(uint256 tokenId, address winner, uint256 amount); 34: event AuctionCreated(uint256 tokenId, uint256 startTime, uint256 endTime); 38: event DurationUpdated(uint256 duration); 42: event ReservePriceUpdated(uint256 reservePrice); 46: event MinBidIncrementPercentageUpdated(uint256 minBidIncrementPercentage); 50: event TimeBufferUpdated(uint256 timeBuffer);
ā https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/auction/IAuction.sol
File: governance/governor/IGovernor.sol 18: event ProposalCreated(ā 29: event ProposalQueued(bytes32 proposalId, uint256 eta); 33: event ProposalExecuted(bytes32 proposalId); 36: event ProposalCanceled(bytes32 proposalId); 39: event ProposalVetoed(bytes32 proposalId); 42: event VoteCast(address voter, bytes32 proposalId, uint256 support, uint256 weight, string reason); 45: event VotingDelayUpdated(uint256 prevVotingDelay, uint256 newVotingDelay); 48: event VotingPeriodUpdated(uint256 prevVotingPeriod, uint256 newVotingPeriod); 51: event ProposalThresholdBpsUpdated(uint256 prevBps, uint256 newBps); 54: event QuorumVotesBpsUpdated(uint256 prevBps, uint256 newBps); 57: event VetoerUpdated(address prevVetoer, address newVetoer);
ā https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/governance/governor/IGovernor.sol
File: governance/treasury/ITreasury.sol ā 16: event TransactionScheduled(bytes32 proposalId, uint256 timestamp); 19: event TransactionCanceled(bytes32 proposalId); 22: event TransactionExecuted(bytes32 proposalId, address[] targets, uint256[] values, bytes[] payloads); 25: event DelayUpdated(uint256 prevDelay, uint256 newDelay); 28: event GracePeriodUpdated(uint256 prevGracePeriod, uint256 newGracePeriod);
ā https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/governance/treasury/ITreasury.sol
File: manager/IManager.sol ā 21: event DAODeployed(address token, address metadata, address auction, address treasury, address governor); 26: event UpgradeRegistered(address baseImpl, address upgradeImpl); 31: event UpgradeRemoved(address baseImpl, address upgradeImpl);
ā https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/manager/IManager.sol
File: token/metadata/interfaces/IPropertyIPFSMetadataRenderer.sol ā 16: event PropertyAdded(uint256 id, string name); 19: event ItemAdded(uint256 propertyId, uint256 index); 22: event ContractImageUpdated(string prevImage, string newImage); 25: event RendererBaseUpdated(string prevRendererBase, string newRendererBase); 28: event DescriptionUpdated(string prevDescription, string newDescription);
File: token/IToken.sol ā 21: event MintScheduled(uint256 baseTokenId, uint256 founderId, Founder founder);
ā https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/token/IToken.sol
There are 20 instances of this issue:
File: lib/interfaces/IEIP712.sol File: lib/interfaces/IERC1967Upgrade.sol File: lib/interfaces/IERC721.sol File: lib/interfaces/IERC721Votes.sol File: lib/interfaces/IInitializable.sol File: lib/interfaces/IOwnable.sol File: lib/interfaces/IPausable.sol File: lib/proxy/ERC1967Proxy.sol File: lib/proxy/ERC1967Upgrade.sol File: lib/proxy/UUPS.sol File: lib/token/ERC721.sol File: lib/token/ERC721Votes.sol File: lib/utils/Address.sol File: lib/utils/EIP712.sol File: lib/utils/Initializable.sol File: lib/utils/Ownable.sol File: lib/utils/Pausable.sol File: lib/utils/ReentrancyGuard.sol File: lib/utils/SafeCast.sol File: lib/utils/TokenReceiver.sol
#0 - GalloDaSballo
2022-09-27T00:28:18Z
Version -> NC
Rest I disagree / Should be more developed for a report
š Selected for report: pfapostol
Also found by: 0x1f8b, 0x4non, 0x5rings, 0xA5DF, 0xSmartContract, 0xc0ffEE, 0xkatana, Aymen0909, Bnke0x0, CertoraInc, Chandr, CodingNameKiki, Cr4ckM3, Deivitto, DimSon, Franfran, JAGADESH, JC, Jeiwan, Lambda, LeoS, Matin, Metatron, Migue, MiloTruck, PPrieditis, PaludoX0, R2, RaymondFam, Respx, ReyAdmirado, Rolezn, Saintcode_, Samatak, SnowMan, StevenL, Tointer, TomJ, Tomo, WatchDogs, Waze, _Adam, __141345__, ajtra, asutorufos, ballx, brgltd, bulej93, c3phas, ch0bu, dharma09, djxploit, durianSausage, easy_peasy, fatherOfBlocks, gianganhnguyen, gogo, imare, leosathya, lucacez, martin, oyc_109, pauliax, peiw, prasantgupta52, ret2basic, rfa, robee, sikorico, simon135, tofunmi, volky, wagmi, zishansami
45.6207 USDC - $45.62
ā
x <= y
with x < y + 1
, and x >= y
with x > y - 1
In the EVM, there is no opcode for >= or <=. When using greater than or equal, two operations are performed: > and =. Using strict comparison operators hence saves gas ā There are 2 instances of this issue: ā
File: auction/Auction.sol ā 98: if (block.timestamp >= _auction.endTime) revert AUCTION_OVER();
ā https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/auction/Auction.sol
File: governance/treasury/Treasury.sol ā 89: return timestamps[_proposalId] != 0 && block.timestamp >= timestamps[_proposalId];
ā https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/governance/treasury/Treasury.sol
<x> += <y>
costs more gas than <x> = <x> + <y>
for state variablesThere are 6 instances of this issue:
File: governance/governor/Governor.sol 280: proposal.againstVotes += uint32(weight); 285: proposal.forVotes += uint32(weight); 290: proposal.abstainVotes += uint32(weight);
https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/governance/governor/Governor.sol
File: token/metadata/MetadataRenderer.sol 140: _propertyId += numStoredProperties;
File: token/Token.sol 88: if ((totalOwnership += uint8(founderPct)) > 100) revert INVALID_FOUNDER_OWNERSHIP(); 118: (baseTokenId += schedule) % 100;
https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/token/Token.sol
calldata
instead of memory
for function parametersIf a reference type function parameter is read-only, it is cheaper in gas to use calldata instead of memory. Calldata is a non-modifiable, non-persistent area where function arguments are stored, and behaves mostly like memory. Try to use calldata as a data location because it will avoid copies and also makes sure that the data cannot be modified.
There are 9 instances of this issue:
File: governance/governor/Governor.sol 99: address[] memory _targets, 100: uint256[] memory _values, 101: bytes[] memory _calldatas, 117: address[] memory _targets, 118: uint256[] memory _values, 119: bytes[] memory _calldatas, 120: string memory _description 195: string memory _reason 252: string memory _reason
https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/governance/governor/Governor.sol
constant
/non-immutable
variables to zero than to let the default of zero be appliedNot overwriting the default for stack variables saves 8 gas. Storage and memory variables have larger savings
There are 5 instances of this issue:
File: governance/treasury/Treasury.sol 162: for (uint256 i = 0; i < numTargets; ++i) {
https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/governance/treasury/Treasury.sol
File: token/metadata/MetadataRenderer.sol 119: for (uint256 i = 0; i < numNewProperties; ++i) { 133: for (uint256 i = 0; i < numNewItems; ++i) { 189: for (uint256 i = 0; i < numProperties; ++i) { 229: for (uint256 i = 0; i < numProperties; ++i) {
#0 - GalloDaSballo
2022-09-26T20:06:50Z
Calldata -> Memory 500
Rest is negligible