Forgotten Runes Warrior Guild contest - TrungOre'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: 39/93

Findings: 3

Award: $94.36

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

48.5872 USDC - $48.59

Labels

bug
duplicate
2 (Med Risk)
upgraded by judge

External Links

Judge has assessed an item in Issue #91 as Medium risk. The relevant finding follows:

use call instead of send

affected code:

Use of transfer() might render ETH impossible to withdraw because after istanbul hardfork , there is increases in the gas cost of the SLOAD operation and therefore breaks some existing smart contracts.Those contracts will break because their fallback functions used to consume less than 2300 gas, and they’ll now consume more, since 2300 the amount of gas a contract’s fallback function receives if it’s called via Solidity’s transfer() or send() methods. Any smart contract that uses transfer() or send() is taking a hard dependency on gas costs by forwarding a fixed amount of gas: 2300.

https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/

https://blog.openzeppelin.com/opyn-gamma-protocol-audit/

check transfer return true or not

affected code

there are some tokens that won't revert if the transaction failed, instead, it will return a boolean.

Recommend mitigation

  • check the return value of token.transfer(msg.sender, amount);

#0 - gzeoneth

2022-06-18T19:19:15Z

Duplicate of #254

[2022-05-runes] QA report

tags: c4, 2022-05-runes

use call instead of send

affected code:

Use of transfer() might render ETH impossible to withdraw because after istanbul hardfork , there is increases in the gas cost of the SLOAD operation and therefore breaks some existing smart contracts.Those contracts will break because their fallback functions used to consume less than 2300 gas, and they’ll now consume more, since 2300 the amount of gas a contract’s fallback function receives if it’s called via Solidity’s transfer() or send() methods. Any smart contract that uses transfer() or send() is taking a hard dependency on gas costs by forwarding a fixed amount of gas: 2300.

https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/

https://blog.openzeppelin.com/opyn-gamma-protocol-audit/

check transfer return true or not

affected code

there are some tokens that won't revert if the transaction failed, instead, it will return a boolean.

Recommend mitigation

  • check the return value of token.transfer(msg.sender, amount);

not require newDaStartTime <= newMintlistStartTime ??

affected code

As in the timeline, we can see that daStartTime <= minListStartTime. But in the setPhaseTime() function, the function hasn't checked the condition if daStartTime <= minListStartTime or not.

[2022-05-runes] Gas optimization

tags: c4, 2022-05-runes

declare function as external instead of public

All these function described should be declared external, as functions that are never called by the contract should be declared external to save gas. afftected code:

unnecessary requirement (1)

Affected code

Because

==> we can deduce that numSold <= maxDaSupply - numWarriors <= maxDaSupply - 1 < maxDaSupply. So we don't need to check numSold < maxDaSupply.

unnecessary requirement (2)

Affected code

Because

==> we can deduce that numSold <= maxForSale - numWarriors <= maxForSale - 1 < maxForSale. So we don't need to check numSold < maxForSale.

optimize currentPrice calculation

Affected code

Instead of calculating currentPrice like this, we can

if (startPrice < lowestPrice + stepDeduction) {
    return lowestPrice;
}
return startPrice - stepDeduction;
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