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: 65/175
Findings: 2
Award: $64.29
🌟 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
The _settlementNonce
was not checked if it was valid in ArbitrumBranchBridgeAgent.sol/_performFallbackCall()
.
There was no tracking of the amount going in or out of the root chain in ArbitrumBranchBridgeAgent.sol/withdrawFromPort()
.
There is no check on _recipient
and the _localAddress
address which might lead to token loss in ArbitrumBranchPort.sol/_bridgeIn()
.
There was no check on the localchainId
validity in the BranchBridgeAgent
constructor.
depositNounce
used for core system operations is defined as uint32
in BranchBridgeAgent/callOutSystem()
. If it exceeds 4,294,967,295 it could lead to a DOS attack.
The refundee address was not checked in BranchBridgeAgent/callOutAndBridge
.
The dParams.htokens.length
should be checked before encoding in BranchBridgeAgent/callOutAndBridgeMultiple
. If the length is more than 255 then it will be downcasted and lead to the loss of value.
The recipient and router address were not checked in BranchBridgeAgentExecutor/executeWithSettlementMultiple()
.
There was no address check in BranchPort/withdraw
.
The addresses were not checked in CoreRootRouter/initialize()
and CoreRootRouter/removeBranchBridgeAgent()
.
lzendpointaddress
was not checked in the constructor of the RootBridgeAgentFactory
contract.
No address check on RootBridgeAgentExecutor/executeSystemRequest()
.
Inconsistent use of require
and revert
statements. One of the statements should be used across the board. Revert statements are the recommended approach to save gas, in initialize()
, initializeCore()
, setCoreRouter()
of RootPort.sol
.
Missing events for core system function in BranchPort/addBridgeAgent()
.
Errors should be prefixed with the contract name for better error handling. E.g:
error BranchPort__AlreadyAddedBridgeAgent
instead of error AlreadyAddedBridgeAgent()
.
Please address these issues to improve the security and robustness of your contract.
#0 - c4-pre-sort
2023-10-15T12:14:45Z
0xA5DF marked the issue as low quality report
#1 - c4-pre-sort
2023-10-15T12:16:35Z
0xA5DF marked the issue as sufficient quality report
#2 - 0xA5DF
2023-10-15T12:16:56Z
All the additional checks (1-12) are one finding with many instances imo
#3 - c4-judge
2023-10-20T13:38:48Z
alcueca marked the issue as grade-a
🌟 Selected for report: MrPotatoMagic
Also found by: 0xHelium, 0xSmartContract, 0xbrett8571, 0xsagetony, 33BYTEZZZ, Bauchibred, K42, Littlebeast, LokiThe5th, Oxsadeeq, SAAJ, Sathish9098, ZdravkoHr, albertwh1te, alexxander, catellatech, chaduke, hunter_w3b, ihtishamsudo, invitedtea, jauvany, klau5, kodyvim, lsaudit, pavankv, pfapostol, yongskiws
38.6134 USDC - $38.61
Context was added where it was relevant to aid the judges.
Since this audit was focused on the Ulysses protocol, here are the steps taken to complete this audit.
The current design uses _amount - _deposit
in several parts of the codebase for calculation of the htokens that a user wants to bridge in/out or use in a transaction. This is counter-intuitive in some cases. For instance: If a user has htoken in source chain but only wants to use underlying tokens for a specific transaction, they would have no means to do so. A boolean can be passed as well to indicate if the user wants to use htokens or not before even doing the calculation of htokens for the tx.
Minor but, error handling is good but it could be better if it includes the contract where the error originated from. e.g error BranchPort__InvalidInputArrays();
instead of generic error InvalidInputArrays();
The system is designed to be as decentralized as possible. However, ownership is renounced is some areas of the codebase.
80 hours.
80 hours
#0 - c4-pre-sort
2023-10-15T14:12:43Z
0xA5DF marked the issue as sufficient quality report
#1 - alcueca
2023-10-20T12:04:11Z
Some original content as diagrams (which I believe was reused by others, along with an error). Not much else.
#2 - c4-judge
2023-10-20T12:04:16Z
alcueca marked the issue as grade-b