Holograph contest - KingNFT's results

Omnichain protocol for deploying, minting, & bridging NFTs between blockchains.

General Information

Platform: Code4rena

Start Date: 18/10/2022

Pot Size: $75,000 USDC

Total HM: 27

Participants: 144

Period: 7 days

Judge: gzeon

Total Solo HM: 13

Id: 170

League: ETH

Holograph

Findings Distribution

Researcher Performance

Rank: 131/144

Findings: 2

Award: $0.00

QA:
grade-c
Gas:
grade-c

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

  1. Redundant statements: the 'array.pop' function will implicitly call delete on the removed element. (1)
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // ... delete _allTokens[lastTokenIndex]; // @audit redundant statements _allTokens.pop(); }

https://github.com/code-423n4/2022-10-holograph/blob/f8c2eae866280a1acfdc8a8352401ed031be1373/contracts/enforcer/HolographERC721.sol#L831

(2) https://github.com/code-423n4/2022-10-holograph/blob/f8c2eae866280a1acfdc8a8352401ed031be1373/contracts/enforcer/HolographERC721.sol#L883

  1. ++i/i++ should be unchecked{++i}/unchecked{i++} when it is not possible for them to overflow, as is the case when used in for- and while-loops (1)
function sourceMintBatch(address[] calldata wallets, uint256[] calldata amounts) external onlySource { for (uint256 i = 0; i < wallets.length; i++) { // @audit gas saving available _mint(wallets[i], amounts[i]); } }

https://github.com/code-423n4/2022-10-holograph/blob/f8c2eae866280a1acfdc8a8352401ed031be1373/contracts/enforcer/HolographERC20.sol#L564

(2)

function _useNonce(address account) private returns (uint256 current) { current = _nonces[account]; _nonces[account]++; // @audit gas saving available }

https://github.com/code-423n4/2022-10-holograph/blob/f8c2eae866280a1acfdc8a8352401ed031be1373/contracts/enforcer/HolographERC20.sol#L713

(3) https://github.com/code-423n4/2022-10-holograph/blob/f8c2eae866280a1acfdc8a8352401ed031be1373/contracts/enforcer/HolographERC721.sol#L357

  1. ++i costs less gas than i++, especially when it’s used in for-loops (--i/i-- too) (1)
function sourceMintBatch(address[] calldata wallets, uint256[] calldata amounts) external onlySource { for (uint256 i = 0; i < wallets.length; i++) { _mint(wallets[i], amounts[i]); } }

https://github.com/code-423n4/2022-10-holograph/blob/f8c2eae866280a1acfdc8a8352401ed031be1373/contracts/enforcer/HolographERC20.sol#L564 (2) https://github.com/code-423n4/2022-10-holograph/blob/f8c2eae866280a1acfdc8a8352401ed031be1373/contracts/enforcer/HolographERC721.sol#L357

  1. State variables should be cached in stack variables rather than re-reading them from storage (1) '_ownedTokensCount[from]' can be cached in stack https://github.com/code-423n4/2022-10-holograph/blob/f8c2eae866280a1acfdc8a8352401ed031be1373/contracts/enforcer/HolographERC721.sol#L778-L779 https://github.com/code-423n4/2022-10-holograph/blob/f8c2eae866280a1acfdc8a8352401ed031be1373/contracts/enforcer/HolographERC721.sol#L842-L843
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