Platform: Code4rena
Start Date: 09/02/2024
Pot Size: $60,500 USDC
Total HM: 17
Participants: 283
Period: 12 days
Judge:
Id: 328
League: ETH
Rank: 172/283
Findings: 1
Award: $8.81
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: givn
Also found by: 0x11singh99, 0xAkira, 0xBinChook, 0xDetermination, 0xMosh, 0xStriker, 0xmystery, 14si2o_Flint, 7ashraf, Aamir, AlexCzm, BARW, Bauchibred, BenasVol, BigVeezus, Blank_Space, Bube, DarkTower, DeFiHackLabs, EagleSecurity, KmanOfficial, Krace, McToady, MrPotatoMagic, PetarTolev, Rolezn, SHA_256, SpicyMeatball, Tekken, Timenov, ZanyBonzy, agadzhalov, alexzoid, boredpukar, btk, cartlex_, dimulski, forkforkdog, haxatron, immeas, jesjupyter, juancito, kartik_giri_47538, klau5, lsaudit, merlinboii, nuthan2x, offside0011, oualidpro, peter, radev_sw, rekxor, rspadi, shaflow2, shaka, swizz, vnavascues, yotov721, yovchev_yoan
8.8123 USDC - $8.81
The QA report flags important issues and offers fixes for better project performance and security. It advises against accidentally adding new fighter types and stresses the importance of checking for existing stakeholders. It also notes potential security risks like unbounded loops and missing reentrancy locks. Recommendations include avoiding hardcoded values and simplifying complex functions for clearer code. Following these suggestions will enhance the project's overall quality and security.
Issue Number | Issue Title | Number of Instances |
---|---|---|
L-01 | More Fighter types can be added by mistake | 1 |
L-02 | Check if staker already exists before adding | 1 |
L-03 | Possible dos for unbounded loop | 1 |
L-04 | Require amount to be greater than zero | 1 |
L-05 | Add re-entrance lock | 2 |
N-01 | Empty string is passed to the function, avoid hardcoded empty strings | 1 |
N-02 | Save String as a constant instead of hardcoding it in the function | 3 |
N-03 | Function should be allowed to be called only once | 1 |
N-04 | Avoid on-chain computation | 1 |
N-05 | Function is so clumped | 1 |
The function can possibly add new fighter types if not handled correctly, adding un-wanted logic
function incrementGeneration(uint8 fighterType) external returns (uint8) { require(msg.sender == _ownerAddress); generation[fighterType] += 1; maxRerollsAllowed[fighterType] += 1; return generation[fighterType]; }
function addStaker(address newStaker) external { require(msg.sender == _ownerAddress); hasStakerRole[newStaker] = true; }
function addStaker(address newStaker) external { require(msg.sender == _ownerAddress); hasStakerRole[newStaker] = true; }
for (uint16 i = 0; i < mintpassIdsToBurn.length; i++) { require(msg.sender == _mintpassInstance.ownerOf(mintpassIdsToBurn[i])); _mintpassInstance.burn(mintpassIdsToBurn[i]); _createNewFighter( msg.sender, uint256(keccak256(abi.encode(mintPassDnas[i]))), modelHashes[i], modelTypes[i], fighterTypes[i], iconsTypes[i], [uint256(100), uint256(100)] ); }
amount
to be greater than zeroamount = amountStaked[tokenId];
function reRoll(uint8 tokenId, uint8 fighterType) public
function stakeNRN(uint256 amount, uint256 tokenId) external
_safeTransfer(from, to, tokenId, "");
function contractURI() public pure returns (string memory) { return "ipfs://bafybeifztjs4yuwhqi7bvzhw2ufksynkoiwxss2gnti6j4v25l7iwz7y44"; }
constructor(address ownerAddress, address treasuryAddress_) ERC1155("https://ipfs.io/ipfs/")
function contractURI() public pure returns (string memory) { return "ipfs://bafybeih3witscmml3padf4qxbea5jh4rl2xp67aydqvqsxmyuzipwtpnii"; }
function instantiateNeuronContract(address nrnAddress) external { require(msg.sender == _ownerAddress); _neuronInstance = Neuron(nrnAddress); }
rankedNrnDistribution[0] = 5000 * 10**18;
The function mentioned below is very messy and needs some cleaning
function _addResultPoints( uint8 battleResult, uint256 tokenId, uint256 eloFactor, uint256 mergingPortion, address fighterOwner )
#0 - raymondfam
2024-02-26T04:01:45Z
Adequate amount of L and NC albeit with inadequate elaboration.
#1 - c4-pre-sort
2024-02-26T04:02:15Z
raymondfam marked the issue as sufficient quality report
#2 - c4-judge
2024-03-19T04:17:46Z
HickupHH3 marked the issue as grade-c
#3 - c4-judge
2024-03-19T04:18:48Z
HickupHH3 marked the issue as grade-b