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
Rank: 94/98
Findings: 1
Award: $12.03
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: 0xSmartContract
Also found by: 0xdaydream, 0xnev, Aymen0909, Deekshith99, Diana, EvanW, Fanz, JCN, Jerry0x, K42, Kresh, Madalad, MiniGlome, Polaris_tow, Rageur, ReyAdmirado, Rolezn, SAAJ, SaeedAlipoor01988, Sathish9098, Shubham, Udsen, Viktor_Cortess, Walter, anodaram, arialblack14, atharvasama, caspersolangii, codeslide, descharre, fatherOfBlocks, felipe, ginlee, igingu, lukris02, nadin, slvDev, tnevler, turvy_fuzz, viking71
12.034 USDC - $12.03
unoptimized
function updateOwner(address newOwner) public { owner = newOwner; } }
optimized
function assemblyUpdateOwner(address newOwner) public { assembly { sstore(owner.slot, newOwner) } }
revenueAddress = _revenueAddress;
namespaceNFT = _namespaceNFT;
https://github.com/code-423n4/2023-03-canto-identity/blob/main/canto-namespace-protocol/src/Namespace.sol#L206 https://github.com/code-423n4/2023-03-canto-identity/blob/main/canto-namespace-protocol/src/Namespace.sol#L80
Using the addition operator instead of plus-equals saves 113 gas.
Unoptimized struct TileData { uint8 fontClass; uint16 characterIndex; uint8 characterModifier; }
Optimized struct TileData { uint16 characterIndex; uint8 fontClass; uint8 characterModifier; }
contract Contract0 {
function solidityHash(uint256 a, uint256 b) public view {
//unoptimized
keccak256(abi.encodePacked(a, b));
}
contract Contract1 {
function assemblyHash(uint256 a, uint256 b) public view {
//optimized
assembly { mstore(0x00, a) mstore(0x20, b) let hashedVal := keccak256(0x00, 0x40)}
}
#0 - c4-judge
2023-04-11T00:16:55Z
0xleastwood marked the issue as grade-b