Canto contest - AkshaySrivastav's results

Execution layer for original work.

General Information

Platform: Code4rena

Start Date: 23/11/2022

Pot Size: $24,500 CANTO

Total HM: 5

Participants: 37

Period: 5 days

Judge: berndartmueller

Total Solo HM: 2

Id: 185

League: ETH

Canto

Findings Distribution

Researcher Performance

Rank: 26/37

Findings: 1

Award: $13.69

Gas:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

84.7394 CANTO - $13.69

Labels

bug
G (Gas Optimization)
grade-b
G-13

External Links

  1. In the withdraw function, due to Line 135 _amount value can never exceed earnedFees, the Line 137 can be put inside an unchecked block.
135        if (_amount > earnedFees) _amount = earnedFees;
137
137        balances[_tokenId] = earnedFees - _amount;
  1. At L50, L87 and L108 the msg.sender value is stored in an address variable in memory. This value is then read and used at multiple places. It is recommended to use msg.sender directly without storing/reading from memory to save gas.
    function register(address _recipient) public onlyUnregistered returns (uint256 tokenId) {
        address smartContract = msg.sender;

        // code clipped...

        emit Register(smartContract, _recipient, tokenId);

        feeRecipient[smartContract] = NftData({
            tokenId: tokenId,
            registered: true
        });
    }
  1. It is recommended to simply use a uint256 variable instead if Counters library to save gas.

  2. <x> += <y> costs more gas than <x> = <x> + <y> for state variables.

        balances[_tokenId] += msg.value;

#0 - c4-judge

2022-11-29T19:16:00Z

berndartmueller marked the issue as grade-b

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