Canto Identity Subprotocols contest - caspersolangii'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: 96/98

Findings: 1

Award: $12.03

Gas:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

12.034 USDC - $12.03

Labels

bug
G (Gas Optimization)
grade-b
edited-by-warden
G-30

External Links

The protocol ProfilePicture.sol has the state variable subprotocolName in line number 35. which is a string data type. This result in excessive gas usage when the variable is accessed repeatedly since string variables are expensive to store and manipulate.

contract ProfilePicture is ERC721 { string public subprotocolName; constructor(address _cidNFT, string memory _subprotocolName) ERC721("Profile Picture", "PFP") { cidNFT = ICidNFT(_cidNFT); subprotocolName = _subprotocolName; } function tokenURI(uint256 _id) public view override returns (string memory) { }}

the subprotocolName variable should be changed from a string data type to a bytes32 data type. This will reduce the gas costs of accessing the variable since bytes32 variables are cheaper to store and manipulate. as shown below code snippet.

contract ProfilePicture is ERC721 { byte32 public subprotocolName; constructor(address _cidNFT, string memory _subprotocolName) ERC721("Profile Picture", "PFP") { cidNFT = ICidNFT(_cidNFT); subprotocolName = _subprotocolName; _registerInterface(bytes4(keccak256('tokenURI(uint256)'))); } function tokenURI(uint256 _id) public view override returns (string memory) { }}

#0 - c4-judge

2023-04-11T04:26:54Z

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