Platform: Code4rena
Start Date: 24/03/2023
Pot Size: $49,200 USDC
Total HM: 20
Participants: 246
Period: 6 days
Judge: Picodes
Total Solo HM: 1
Id: 226
League: ETH
Rank: 199/246
Findings: 1
Award: $13.13
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: brgltd
Also found by: 0x3b, 0xAgro, 0xGusMcCrae, 0xNorman, 0xRajkumar, 0xSmartContract, 0xTraub, 0xWagmi, 0xWaitress, 0xffchain, 0xhacksmithh, 0xkazim, 0xnev, 3dgeville, ArbitraryExecution, Aymen0909, BRONZEDISC, Bason, Bloqarl, BlueAlder, Brenzee, CodeFoxInc, CodingNameKiki, Cryptor, DadeKuma, DevABDee, Diana, Dug, Englave, Gde, Haipls, HollaDieWaldfee, Ignite, Infect3d, Jerry0x, Josiah, Kaysoft, Koko1912, KrisApostolov, Lavishq, LeoGold, Madalad, PNS, Rappie, RaymondFam, RedTiger, Rickard, Rolezn, Sathish9098, SunSec, T1MOH, UdarTeam, Udsen, Viktor_Cortess, Wander, adriro, ak1, alejandrocovrr, alexzoid, arialblack14, ayden, bin2chen, brevis, btk, c3phas, carlitox477, catellatech, ch0bu, chaduke, ck, climber2002, codeslide, descharre, dingo2077, ernestognw, fatherOfBlocks, favelanky, georgits, helios, hl_, inmarelibero, juancito, ks__xxxxx, lopotras, lukris02, m_Rassska, mahdirostami, maxper, nadin, navinavu, nemveer, p_crypt0, peanuts, pipoca, pixpi, qpzm, rbserver, reassor, roelio, rotcivegaf, scokaf, siddhpurakaran, slvDev, smaul, tnevler, tsvetanovv, turvy_fuzz, vagrant, wen, yac, zzzitron
13.1298 USDC - $13.13
Vulnerability details
Contracts should be deployed using the same compiler version/flags with which they have been tested. Locking the floating pragma, i.e. by not using ^ in pragma solidity ^0.8.13, ensures that contracts do not accidentally get deployed using an older compiler version with unfixed bugs.
For reference, see https://swcregistry.io/docs/SWC-103
Manual Analysis
Remove ^ in “pragma solidity ^0.8.13” and change it to “pragma solidity 0.8.13” to be consistent with the rest of the contracts.
Vulnerability details
For better readability, you should name the imports instead of using the regular ones.
Instances - All contracts in scope.
Manual Analysis
import {contract1 , contract2} from "filename.sol";
import {Owned} from "solmate/auth/Owned.sol"; import {ERC721} from "solmate/tokens/ERC721.sol"; import {LibString} from "solmate/utils/LibString.sol"; import {MerkleProofLib} from "solmate/utils/MerkleProofLib.sol"; import {FixedPointMathLib} from "solmate/utils/FixedPointMathLib.sol"; import {ERC1155, ERC1155TokenReceiver} from "solmate/tokens/ERC1155.sol"; import {toWadUnsafe, toDaysWadUnsafe} from "solmate/utils/SignedWadMath.sol";
Vulnerability details
Imports can be grouped together
Manual Analysis
Consider importing OZ first, then all interfaces, then all utils if available.
Vulnerability details
Interchangeable usage of uint and uint256. Below are instances where uint was used rather than uint256 like in the rest of the code.
File: SafEth.sol
File: Reth.sol
Manual Analysis
Consider using only one approach throughout the codebase, e.g. only uint or only uint256.
Vulnerability details
Generate perfect code headers every time
For reference, see https://github.com/transmissions11/headers
/////////////////////////////////////////////////////////////// TESTING 123 ///////////////////////////////////////////////////////////////
Manual Analysis
We recommend using headers for Solidity code layout and readability.
Vulnerability details
Use bytes.concat() instead of abi.encodePacked()
Rather than using abi.encodePacked for appending bytes, since version 0.8.4, bytes.concat() is enabled
File: Reth.sol
Manual Analysis
Since version 0.8.4 for appending bytes, bytes.concat() can be used instead of abi.encodePacked().
Vulnerability details
Move require/validation statements to the top of the function when validating input parameters
File: WstEth.sol
File: SfrxEth.sol
File: SafEth.sol
File: Reth.sol
Manual Analysis
File: WstEth.sol
Consider moving the validation on L66 above the conditional on L57 for withdraw().
Consider moving the validation on L77 above the conditional on L74 for deposit().
File: SfrxEth.sol
Consider moving the validation on L87 above the conditional on L61 for withdraw().
File: SafEth.sol
Consider moving the validation on L127 above the conditional on L110 for unstake().
File: Reth.sol
Consider moving the validation on L113 above the conditional on L108 for withdraw().
Consider moving the validation on L200 above the conditional on L158 for deposit().
Vulnerability details
Order of Functions; ordering helps readers identify which functions they can call and find the constructor and fallback definitions easier. But there are contracts in the project that do not comply with this.
For reference, see https://docs.soliditylang.org/en/v0.8.17/style-guide.html
Functions should be grouped according to their visibility and ordered:
-constructor -receive function (if exists) -fallback function (if exists) -external -public -internal -private -within a grouping, place the view and pure functions last
Manual Analysis
#0 - c4-sponsor
2023-04-07T23:19:16Z
elmutt marked the issue as sponsor confirmed
#1 - c4-judge
2023-04-24T19:03:49Z
Picodes marked the issue as grade-b