Canto Identity Subprotocols contest - felipe's results

Subprotocols for Canto Identity Protocol.

General Information

Platform: Code4rena

Start Date: 17/03/2023

Pot Size: $36,500 USDC

Total HM: 10

Participants: 98

Period: 3 days

Judge: leastwood

Total Solo HM: 5

Id: 223

League: ETH

Canto Identity Subprotocols

Findings Distribution

Researcher Performance

Rank: 95/98

Findings: 1

Award: $12.03

Gas:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Report

Gas Optimizations

IssueInstances
GAS-1Use the payable modifier on constructor4
GAS-2Use immutable on state variables updated only in the constructor1

[GAS-1] Use the payable modifier on constructor

Adding the payable modifier on constructor will simplify the initialization bytecode by removing the 'revert if msg.sender is not zero' check, resulting in cheaper contract deployment.

Saves 204 gas per instance

Instances (4):

File: canto-pfp-protocol/src/ProfilePicture.sol

57:    constructor(address _cidNFT, string memory _subprotocolName) ERC721("Profile Picture", "PFP") {
File: canto-bio-protocol/src/Bio.sol

32:    constructor() ERC721("Biography", "Bio") {
File: canto-namespace-protocol/src/Namespace.sol

73:    constructor(
74:        address _tray,
75:        address _note,
76:        address _revenueAddress
77:    ) ERC721("Namespace", "NS") Owned(msg.sender) {
File: canto-namespace-protocol/src/Tray.sol

 98:    constructor(
 99:        bytes32 _initHash,
100:        uint256 _trayPrice,
101:        address _revenueAddress,
102:        address _note,
103:        address _namespaceNFT
104:    ) ERC721A("Namespace Tray", "NSTRAY") Owned(msg.sender) {

[GAS-2] Use immutable on state variables updated only on the constructor

Immutable variables are compiled into the contract's runtime bytecode, being interpreted by the EVM the same way as constants. This change removes the need for the SLOAD instruction when reading the variable and will save 2100 gas when variable is cold and 100 when it's warm.

File: canto-pfp-protocol/src/ProfilePicture.sol

 35:    string public subprotocolName;

#0 - c4-judge

2023-04-11T04:22:24Z

0xleastwood 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