Platform: Code4rena
Start Date: 18/10/2022
Pot Size: $75,000 USDC
Total HM: 27
Participants: 144
Period: 7 days
Judge: gzeon
Total Solo HM: 13
Id: 170
League: ETH
Rank: 22/144
Findings: 2
Award: $549.04
π Selected for report: 0
π Solo Findings: 0
π Selected for report: Rolezn
Also found by: 0x1f8b, 0x52, 0x5rings, 0xNazgul, 0xSmartContract, 0xZaharina, 0xhunter, 0xzh, 8olidity, Amithuddar, Aymen0909, B2, Bnke0x0, Chom, Deivitto, Diana, Diraco, Dravee, Franfran, JC, Jeiwan, Josiah, JrNet, Jujic, KingNFT, KoKo, Lambda, Margaret, Migue, Ocean_Sky, PaludoX0, Picodes, Rahoz, RaoulSchaffranek, RaymondFam, RedOneN, ReyAdmirado, Shinchan, Tagir2003, Trust, Waze, Yiko, __141345__, a12jmx, adriro, ajtra, arcoun, aysha, ballx, bin2chen, bobirichman, brgltd, bulej93, catchup, catwhiskeys, caventa, cccz, cdahlheimer, ch0bu, chaduke, chrisdior4, cloudjunky, cryptostellar5, cryptphi, csanuragjain, cylzxje, d3e4, delfin454000, djxploit, durianSausage, erictee, fatherOfBlocks, francoHacker, gianganhnguyen, gogo, hansfriese, i_got_hacked, ignacio, imare, karanctf, kv, leosathya, louhk, lukris02, lyncurion, m_Rassska, malinariy, martin, mcwildy, mics, minhtrng, nicobevi, oyc_109, pashov, peanuts, pedr02b2, peiw, rbserver, ret2basic, rotcivegaf, rvierdiiev, ryshaw, sakman, sakshamguruji, saneryee, securerodd, seyni, sikorico, svskaushik, teawaterwire, tnevler, w0Lfrum
549.0408 USDC - $549.04
Severity Low
Context: HolographOperator.sol#L278
, LayerZeroModule.sol#L441
, LayerZeroModule.sol#L470
Description: These functions doesn't have any checks to ensure that the variables being set is within some kind of value range.
Recommendation: Each variable input parameter updated should have it's own value range checks to ensure their validity.
Severity: Low
Context: HolographBridge.sol#L452
, HolographBridge.sol#L472
, HolographBridge.sol#L502
, HolographBridge.sol#L522
, HolographOperator.sol#L278
, HolographOperator.sol#L949
, HolographOperator.sol#L969
, HolographOperator.sol#L989
, HolographOperator.sol#L1009
, HolographOperator.sol#L1029
, HolographOperator.sol#L1049
, HolographFactory.sol#L280
, HolographFactory.sol#L300
, LayerZeroModule.sol#L320
, LayerZeroModule.sol#L340
, LayerZeroModule.sol#L360
, LayerZeroModule.sol#L380
, LayerZeroModule.sol#L441
, LayerZeroModule.sol#L470
Description: Setter functions are missing checks to validate if the new value being set is the same as the current value already set in the contract. Such checks will showcase mismatches between on-chain and off-chain states.
Recommendation: This may hinder detecting discrepancies between on-chain and off-chain states leading to flawed assumptions of on-chain state and protocol behavior.
Severity: Low
Context: HolographBridge.sol#L452
, HolographBridge.sol#L472
, HolographBridge.sol#L502
, HolographBridge.sol#L522
, HolographOperator.sol#L278
, HolographOperator.sol#L949
, HolographOperator.sol#L969
, HolographOperator.sol#L989
, HolographOperator.sol#L1009
, HolographOperator.sol#L1029
, HolographOperator.sol#L1049
, HolographFactory.sol#L280
, HolographFactory.sol#L300
, LayerZeroModule.sol#L320
, LayerZeroModule.sol#L340
, LayerZeroModule.sol#L360
, LayerZeroModule.sol#L380
, LayerZeroModule.sol#L441
, LayerZeroModule.sol#L470
Description: When critical parameters of systems need to be changed, it is required to broadcast the change via event emission and recommended to enforce the changes after a time-delay. This is to allow system users to be aware of such critical changes and give them an opportunity to exit or adjust their engagement with the system accordingly. None of the onlyOwner functions that change critical protocol addresses/parameters have a timelock for a time-delayed change to alert: (1) users and give them a chance to engage/exit protocol if they are not agreeable to the changes (2) team in case of compromised owner(s) and give them a chance to perform incident response.
Recommendation: Users may be surprised when critical parameters are changed. Furthermore, it can erode users' trust since they canβt be sure the protocol rules wonβt be changed later on. Compromised owner keys may be used to change protocol addresses/parameters to benefit attackers. Without a time-delay, authorised owners have no time for any planned incident response.
Severity: Low
Context: HolographBridge.sol#L452
, HolographBridge.sol#L472
, HolographBridge.sol#L502
, HolographBridge.sol#L522
, HolographOperator.sol#L949
, HolographOperator.sol#L969
, HolographOperator.sol#L989
, HolographOperator.sol#L1009
, HolographOperator.sol#L1029
, HolographOperator.sol#L1049
, HolographFactory.sol#L280
, HolographFactory.sol#L300
, LayerZeroModule.sol#L320
, LayerZeroModule.sol#L340
, LayerZeroModule.sol#L360
, LayerZeroModule.sol#L380
Description: Lack of zero-address validation on address parameters may lead to transaction reverts, waste gas, require resubmission of transactions and may even force contract redeployments in certain cases within the protocol.
Recommendation: Consider adding explicit zero-address validation on input parameters of address type.
Severity: Low
Context: HolographBridge.sol#L452
, HolographBridge.sol#L472
, HolographBridge.sol#L502
, HolographBridge.sol#L522
, HolographOperator.sol#L278
, HolographOperator.sol#L949
, HolographOperator.sol#L969
, HolographOperator.sol#L989
, HolographOperator.sol#L1009
, HolographOperator.sol#L1029
, HolographOperator.sol#L1049
, HolographFactory.sol#L280
, HolographFactory.sol#L300
, LayerZeroModule.sol#L320
, LayerZeroModule.sol#L340
, LayerZeroModule.sol#L360
, LayerZeroModule.sol#L380
, LayerZeroModule.sol#L441
, LayerZeroModule.sol#L470
Description: Several functions update critical parameters that are missing event emission. These should be performed to ensure tracking of changes of such critical parameters.
Recommendation: Consider adding events to functions that change critical parameters.
receive()
Function Should Emit An EventSeverity: Low
Context: HolographOperator.sol#L1209
, Holographer.sol#L223
, HolographERC721.sol#L962
, HolographERC20.sol#L251
, ERC721H.sol#L212
, ERC20H.sol#L212
Description:
Consider emitting an event inside this function with msg.sender
and msg.value
as the parameters. This would make it easier to track incoming ether transfers.
Recommendation:
Consider adding events to the receive()
functions.
Severity: Low
Context: HolographBridge.sol#L162
, HolographOperator.sol#L240
, HolographFactory.sol#L158
, Holographer.sol#L147
, PA1D.sol#L173
, HolographERC721.sol#L238
, HolographERC20.sol#L218
, ERC721H.sol#L144
, ERC20H.sol#L144
Description: None of the initialize functions emit emit init-specific events. They all however have the initializer modifier (from Initializable) so that they can be called only once. Off-chain monitoring of calls to these critical functions is not possible.
Recommendation: It is recommended to emit events in your initialization functions.
Severity: Informational
Context: HolographOperator.sol#L438
, PA1D.sol#L579-L587
, HolographERC721.sol#L524-L570
Description: There is commented code that makes the code messy and unneeded.
Recommendation: Consider removing the commented out code.
Severity Informational
Context: HolographOperator.sol#L804
, HolographOperator.sol#L814
, HolographFactory.sol#L181
Description: The linked function(s) have a named return that is not used. Using both named returns and a return statement isn't necessary.
Recommendation: Removing one of those can improve code clarity.
Severity: Informational
Context: HolographERC20.sol#L563
Description: These fail to perform input validation on arrays to verify the lengths match. A mismatch could lead to an exception or undefined behavior.
Recommendation: Perform input validation on the arrays to verify that the lengths match.
Severity: Informational
Context: HolographBridge.sol#L126-L142
, HolographOperator.sol#L129-L153
, HolographFactory.sol#L127-L131
, LayerZeroModule.sol#L126-L146
, Holographer.sol#L119-L135
, PA1D.sol#L124-L144
, HolographERC721.sol#L136-L140
, HolographERC20.sol#L142-L146
, ERC721H.sol#L110-L114
, ERC20H.sol#L110-L114
Description: All state variables should have explicit visibility.
Recommendation: Consider adding explicit visibility to the listed state variables.
Severity: Informational
Context: HolographBridge.sol#L120
, HolographBridge.sol#L188
, HolographBridge.sol#L212
, HolographBridge.sol#L231
, HolographBridge.sol#L243
, HolographBridge.sol#L268
, HolographBridge.sol#L294
, HolographBridge.sol#L310
, HolographBridge.sol#L339
, HolographOperator.sol#L608
, HolographFactory.sol#L121
, Holographer.sol#L113
, Holographer.sol#L172
, Holographer.sol#L212
, PA1D.sol#L117-L118
, PA1D.sol#L149
, PA1D.sol#L151
, PA1D.sol#L524
, PA1D.sol#L618-L619
, HolographERC721.sol#L723
, HolographERC20.sol#L289
Description: Max line length must be no more than 120 but many lines are extended past this length.
Recommendation: Consider cutting down the line length below 120.
Severity: Informational
Context: HolographBridge.sol#L155
, HolographOperator.sol#L233
, HolographOperator.sol#L1209
, HolographFactory.sol#L136
, LayerZeroModule.sol#L151
, Holographer.sol#L140
, Holographer.sol#L223
, PA1D.sol#L166
, HolographERC721.sol#L231
, HolographERC721.sol#L962
, HolographERC20.sol#L211
, HolographERC20.sol#L251
, ERC721H.sol#L133
, ERC721H.sol#L212
, ERC20H.sol#L133
, ERC20H.sol#L212
Description: It's best practice that when there is an empty block, to add a comment in the block explaining why it's empty.
Recommendation:
Consider adding /* Comment on why */
to the empty blocks.
Severity Informational
Context: PA1D.sol#L205
, HolographERC721.sol#L922
, HolographERC20.sol#L727
, ERC721H.sol#L159
, ERC20H.sol#L159
Description:
The linked variables do not conform to the standard naming convention of Solidity whereby functions and variable names(local and state) utilize the mixedCase
format unless variables are declared as constant
in which case they utilize the UPPER_CASE_WITH_UNDERSCORES
format. Private variables and functions should lead with an _underscore
.
Recommendation: Consider naming conventions utilized by the linked statements are adjusted to reflect the correct type of declaration according to the Solidity style guide.
Severity: Informational
Context: HolographBridge.sol#L452
, HolographOperator.sol#L717
, HolographFactory.sol#L192
, LayerZeroModule.sol#L310
, Holographer.sol#L205
, PA1D.sol#L226
, HolographERC721.sol#L368
, HolographERC20.sol#L251
, ERC721H.sol#L168
, ERC20H.sol#L168
Description: The best-practice layout for a contract should follow the following order: state variables, events, modifiers, constructor and functions. Function ordering helps readers identify which functions they can call and find constructor and fallback functions easier. Functions should be grouped according to their visibility and ordered as: constructor, receive function (if exists), fallback function (if exists), external, public, internal, private. Functions should then further be ordered with view functions coming after the non-view labeled ones.
Recommendation: Consider adopting recommended best-practice for code structure and layout.
Severity: Informational
Context: HolographOperator.sol#L261
, PA1D.sol#L388
, PA1D.sol#L390
, PA1D.sol#L395
, PA1D.sol#L411
, PA1D.sol#L415
, PA1D.sol#L435
, PA1D.sol#L438
, PA1D.sol#L477
, PA1D.sol#L551
, PA1D.sol#L553
, PA1D.sol#L641
, PA1D.sol#L643
Description: There are multiple occasions where certain numbers have been hardcoded, either in variables or in the code itself. Large numbers can become hard to read.
Recommendation: Consider using underscores for number literals to improve its readability.
Severity: Informational
Context: HolographOperator.sol#L701
Description: There should never be any TODOs in the code when deploying.
Recommendation: Consider finishing the TODOs before deploying.
Severity: Informational
Context: HolographBridge.sol#L160 (initilaization => initialization)
, HolographBridge.sol#L415-L416 (destiantion => destination)
, HolographBridge.sol#L575 (transfered => transferred)
, HolographOperator.sol#L238 (initilaization => initialization)
, HolographOperator.sol#L515 (accomodate => accommodate)
, HolographOperator.sol#L553 (rever => revert)
, HolographOperator.sol#L661-L662 (destiantion => destination)
, HolographOperator.sol#L997 (adress => address)
, HolographFactory.sol#L141 (initilaization => initialization)
, HolographFactory.sol#L188 (deployement => deployment)
, HolographFactory.sol#L338 (transfered => transferred)
, LayerZeroModule.sol#L156 (initilaization => initialization)
, LayerZeroModule.sol#L414 (transfered => transferred)
, Holographer.sol#L145 (initilaization => initialization)
, PA1D.sol#L156 (accesible => accessible)
, PA1D.sol#L171 (initilaization => initialization)
, PA1D.sol#L299 (optimizaion => optimization)
, PA1D.sol#L387 (accomodate => accommodate)
, PA1D.sol#L446 (authorised => authorized)
, PA1D.sol#L447 (tranaction => transaction)
, PA1D.sol#L472 (missmatched => mismatched)
, PA1D.sol#L472 (lenghts => lengths)
, HolographERC721.sol#L194 (utilised => utilized)
, HolographERC721.sol#L236 (initilaization => initialization)
, HolographERC721.sol#L263 (coud => could)
, HolographERC721.sol#L543 (missmatch => mismatch)
, HolographERC721.sol#L575 (transfered => transferred)
, HolographERC721.sol#L662 (authorisations => authorization)
, HolographERC721.sol#L900 (usecases => use cases)
, HolographERC20.sol#L216 (initilaization => initialization)
, ERC721H.sol#L138 (initilaization => initialization)
, ERC20H.sol#L138 (initilaization => initialization)
Description: Spelling errors in comments can cause confusion to both users and developers.
Recommendation: Consider checking all misspellings to ensure they are corrected.
Severity: Informational
Context: All Contracts
Description: Some functions are missing @notice/@dev NatSpec comments for the function, @param for all/some of their parameters and @return for return values. Given that NatSpec is an important part of code documentation, this affects code comprehension, auditability and usability.
Recommendation: Consider adding in full NatSpec comments for all functions to have complete code documentation for future use.
Severity: Informational
Context: All Contracts
Description: Using very old versions of Solidity prevents benefits of bug fixes and newer security checks. Using the latest versions might make contracts susceptible to undiscovered compiler bugs.
Recommendation: Consider using the most recent version.
π Selected for report: oyc_109
Also found by: 0x040, 0x1f8b, 0x5rings, 0xNazgul, 0xSmartContract, 0xZaharina, 0xsam, 0xzh, 2997ms, Amithuddar, Aymen0909, B2, Bnke0x0, Deivitto, Diana, Dinesh11G, Franfran, JC, JrNet, Jujic, KingNFT, KoKo, Mathieu, Metatron, Mukund, Olivierdem, PaludoX0, Pheonix, Picodes, RaymondFam, RedOneN, ReyAdmirado, Rolezn, Saintcode_, Satyam_Sharma, Shinchan, Tagir2003, Tomio, Waze, Yiko, __141345__, adriro, ajtra, aysha, ballx, beardofginger, bobirichman, brgltd, bulej93, catchup, catwhiskeys, cdahlheimer, ch0bu, chaduke, chrisdior4, cryptostellar5, cylzxje, d3e4, delfin454000, dharma09, djxploit, durianSausage, emrekocak, erictee, exolorkistis, fatherOfBlocks, gianganhnguyen, gogo, halden, hxzy, i_got_hacked, iepathos, karanctf, leosathya, lucacez, lukris02, lyncurion, m_Rassska, martin, mcwildy, mics, nicobevi, peanuts, peiw, rbserver, ret2basic, rotcivegaf, ryshaw, sakman, sakshamguruji, saneryee, sikorico, skyle, svskaushik, tnevler, vv7, w0Lfrum, zishansami
0 USDC - $0.00
Context: HolographOperator.sol#L781
, PA1D.sol#L307
, PA1D.sol#L323
, PA1D.sol#L340
, PA1D.sol#L356
, PA1D.sol#L394](https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/enforcer/PA1D.sol#L394), [
PA1D.sol#L414](https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/enforcer/PA1D.sol#L414), [
PA1D.sol#L432](https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/enforcer/PA1D.sol#L432), [
PA1D.sol#L437](https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/enforcer/PA1D.sol#L437), [
PA1D.sol#L454](https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/enforcer/PA1D.sol#L454), [
PA1D.sol#L474](https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/enforcer/PA1D.sol#L474), [
HolographERC721.sol#L357](https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/enforcer/HolographERC721.sol#L357), [
HolographERC721.sol#L716](https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/enforcer/HolographERC721.sol#L716), [
HolographERC20.sol#L564`
Description:
(This is only relevant if you are using the default solidity checked arithmetic). i++
involves checked arithmetic, which is not required. This is because the value of i
is always strictly less than length <= 2**256 - 1. Therefore, the theoretical maximum value of i
to enter the for-loop body is 2**256 - 2
. This means that the i++
in the for loop can never overflow. Regardless, the overflow checks are performed by the compiler.
Unfortunately, the Solidity optimizer is not smart enough to detect this and remove the checks. One can manually do this by:
for (uint i = 0; i < length; ) { // do something that doesn't change the value of i unchecked { ++i; } }
Recommendation: Consider doing the increment in the for loop post condition in an unchecked block.