Forgotten Runes Warrior Guild contest - delfin454000's results

16,000 Warrior NFTs sold in a phased Dutch Auction.

General Information

Platform: Code4rena

Start Date: 03/05/2022

Pot Size: $30,000 USDC

Total HM: 6

Participants: 93

Period: 3 days

Judge: gzeon

Id: 118

League: ETH

Forgotten Runes

Findings Distribution

Researcher Performance

Rank: 58/93

Findings: 2

Award: $45.84

🌟 Selected for report: 0

🚀 Solo Findings: 0

Issue: Missing require message

Explanation: Require message should be included to enable users to understand reason for failure

Recommended mitigation: Add a brief (<= 32 char) message to explain require failure in each of the instances below

https://github.com/code-423n4/2022-05-runes/blob/060b4f82b79c8308fe65674a39a07c44fa586cd3/contracts/ForgottenRunesWarriorsGuild.sol#L164

        require(payable(msg.sender).send(address(this).balance));

https://github.com/code-423n4/2022-05-runes/blob/060b4f82b79c8308fe65674a39a07c44fa586cd3/contracts/ForgottenRunesWarriorsMinter.sol#L628

        require(address(msg.sender) != address(0));					

https://github.com/code-423n4/2022-05-runes/blob/060b4f82b79c8308fe65674a39a07c44fa586cd3/contracts/ForgottenRunesWarriorsMinter.sol#L610

        require(payable(vault).send(_amount));

https://github.com/code-423n4/2022-05-runes/blob/060b4f82b79c8308fe65674a39a07c44fa586cd3/contracts/ForgottenRunesWarriorsMinter.sol#L618

        require(payable(vault).send(address(this).balance));

Issue: Variables should not be initialized to their default values Explanation: Initializing variables to their default values is unnecessary and costs gas

https://github.com/code-423n4/2022-05-runes/blob/060b4f82b79c8308fe65674a39a07c44fa586cd3/contracts/ForgottenRunesWarriorsGuild.sol#L24

    uint256 public numMinted = 0;					

Change 'uint256 public numMinted;' to 'uint256 public numMinted;'

Issue: Require message too long Explanation: The require message below can be shortened to 32 characters or fewer (as shown) to save gas

https://github.com/code-423n4/2022-05-runes/blob/060b4f82b79c8308fe65674a39a07c44fa586cd3/contracts/ForgottenRunesWarriorsMinter.sol#L148

            'Ether value sent is not sufficient'						

Change message to Ether value sent is insufficient

Multiple issues

There are three opportunities to save gas in each of the two identical code blocks below:

  1. Use != 0 instead of > 0 because > 0 costs more gas and numWarriors cannot be < zero (since it is a unit)
  2. Divide the require into two separate require messages instead of using '&&'
  3. Shorten the require message to 32 characters or fewer

https://github.com/code-423n4/2022-05-runes/blob/060b4f82b79c8308fe65674a39a07c44fa586cd3/contracts/ForgottenRunesWarriorsMinter.sol#L140-L143

https://github.com/code-423n4/2022-05-runes/blob/060b4f82b79c8308fe65674a39a07c44fa586cd3/contracts/ForgottenRunesWarriorsMinter.sol#L210-L213

        require(
            numWarriors > 0 && numWarriors <= 20,
            'You can summon no more than 20 Warriors at a time'
        );					

Change to:

       require(numWarriors != 0, 'Number of Warriors must exceed 0');
       require(numWarriors <= 20, 'Summon <= 20 Warriors at a time');
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