Platform: Code4rena
Start Date: 22/09/2023
Pot Size: $100,000 USDC
Total HM: 15
Participants: 175
Period: 14 days
Judge: alcueca
Total Solo HM: 4
Id: 287
League: ETH
Rank: 107/175
Findings: 1
Award: $25.68
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: MrPotatoMagic
Also found by: 0xAadi, 0xDING99YA, 0xDemon, 0xRstStn, 0xSmartContract, 0xStriker, 0xWaitress, 0xbrett8571, 0xfuje, 0xsagetony, 0xsurena, 33BYTEZZZ, 3docSec, 7ashraf, ABA, ABAIKUNANBAEV, Aamir, Audinarey, Bauchibred, Black_Box_DD, Daniel526, DanielArmstrong, DanielTan_MetaTrust, Dinesh11G, Eurovickk, Franklin, Inspecktor, John, Jorgect, Joshuajee, K42, Kek, Koolex, LokiThe5th, MIQUINHO, Myd, NoTechBG, QiuhaoLi, SanketKogekar, Sathish9098, Sentry, Soul22, SovaSlava, Stormreckson, Tendency, Topmark, Udsen, V1235816, Viktor_Cortess, Viraz, Yanchuan, ZdravkoHr, Zims, albahaca, albertwh1te, alexweb3, alexxander, ast3ros, audityourcontracts, bareli, bin2chen, bronze_pickaxe, c0pp3rscr3w3r, cartlex_, castle_chain, chaduke, debo, ether_sky, gumgumzum, imare, its_basu, jaraxxus, jasonxiale, josephdara, kodyvim, ladboy233, lanrebayode77, lsaudit, mert_eren, minhtrng, n1punp, nadin, niroh, nmirchev8, orion, peakbolt, perseverancesuccess, pfapostol, ptsanev, rvierdiiev, saneryee, shaflow2, te_aut, terrancrypt, twcctop, unsafesol, ustas, versiyonbir, windhustler, yongskiws, zhaojie, ziyou-
25.6785 USDC - $25.68
setCoreRouter
in Branchport.sol can be removedsetCoreRouter
in Branchport.sol appears to be dead code. Although it requires the CoreRouter to call it using the modifier requiresCoreRouter
there is no reference to this in any of the router contracts. The functionality seems to have been migrated to setCoreBranchRouter
in Branchport.sol.
File: src/BranchPort.sol 331 function setCoreRouter(address _newCoreRouter) external override requiresCoreRouter { 332 require(coreBranchRouterAddress != address(0), "CoreRouter address is zero"); 333 require(_newCoreRouter != address(0), "New CoreRouter address is zero"); 334 coreBranchRouterAddress = _newCoreRouter; 335: }
The setCoreRouter
function can be removed from Branchport.sol and the function can also be removed from the interface IBranchPort.sol.
strategyTokens
and bridgeAgents
in BranchPort are appended to arrays that are never used.
Remove these arrays as storage variables and remove the .push
functions so they are not appended to.
manageStrategyToken
doesn't check value is within rangemanageStrategyToken
allows the _minimumReservesRatio
to be set for new strategy tokens that are added to a Branch Port. This is passed to a branch and eventually executes addStrategyToken()
where the _minimumReservesRatio
is required to be <= the DIVISIONER
(1e4) and >= MIN_RESERVE_RATIO
(3e3) otherwise the function will revert.
This check could be performed at the source manageStrategyToken
avoiding a cross chain call to set a value that may end up reverting, costing gas and then needing to be called again.
#0 - c4-pre-sort
2023-10-14T09:50:21Z
0xA5DF marked the issue as sufficient quality report
#1 - c4-judge
2023-10-21T05:28:56Z
alcueca marked the issue as grade-b
#2 - c4-judge
2023-10-21T05:29:04Z
alcueca marked the issue as grade-a
#3 - alcueca
2023-10-21T05:29:17Z
Actually, original thinking is rewarded.