Platform: Code4rena
Start Date: 03/11/2022
Pot Size: $115,500 USDC
Total HM: 17
Participants: 120
Period: 7 days
Judge: LSDan
Total Solo HM: 1
Id: 174
League: ETH
Rank: 75/120
Findings: 1
Award: $61.35
๐ Selected for report: 0
๐ Solo Findings: 0
๐ Selected for report: IllIllI
Also found by: 0x1f8b, 0xNazgul, 0xRoxas, 0xSmartContract, Awesome, Aymen0909, B2, BClabs, Bnke0x0, Deekshith99, Deivitto, Diana, Dinesh11G, Funen, HE1M, HardlyCodeMan, Josiah, Nyx, Rahoz, RaymondFam, RedOneN, ReyAdmirado, Rolezn, Saintcode_, TomJ, Trust, __141345__, a12jmx, adriro, ajtra, aphak5010, apostle0x01, brgltd, btk, bulej93, c3phas, carlitox477, catwhiskeys, ch0bu, chaduke, chrisdior4, cryptonue, cryptostellar5, csanuragjain, ctf_sec, delfin454000, djxploit, durianSausage, erictee, fatherOfBlocks, gogo, i_got_hacked, immeas, joestakey, jumpdest7d, lukris02, martin, mcwildy, merlin, minhquanym, oyc_109, pashov, peanuts, pedr02b2, rbserver, rotcivegaf, rvierdiiev, sakman, saneryee, seyni, shark, slowmoses, tnevler, trustindistrust, w0Lfrum, yurahod, zaskoh
61.3462 USDC - $61.35
Severity: Low
Context: SpigotLib.sol#L125
, SpigotLib.sol#L143
, SpigotLib.sol#L164
, SpigotLib.sol#L178
, SpigotLib.sol#L187
, SpigotLib.sol#L196
, SpigotLib.sol#L208
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: SpigotLib.sol#L125
, SpigotLib.sol#L143
, SpigotLib.sol#L164
, SpigotLib.sol#L178
, SpigotLib.sol#L187
, SpigotLib.sol#L196
, SpigotLib.sol#L208
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.
receive()
Function Should Emit An EventSeverity: Low
Context: Spigot.sol#L227
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: SecuredLine.sol#L37
, EscrowedLine.sol#L25
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: InterestRateCredit.sol#L74-L86
Description: There is commented code that makes the code messy and unneeded.
Recommendation: Consider removing the commented out code.
Severity: Informational
Context: SecuredLine.sol#L30
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: Spigot.sol#L21
, Escrow.sol#L32
, Oracle.sol#L14
, EscrowLib.sol#L34
, EscrowLib.sol#L51
, SpigotLib.sol#L29
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: SecuredLine.sol#L48
, Spigot.sol#L70
, Escrow.sol#L65
, InterestRateCredit.sol#L25
, EscrowLib.sol#L87
, SpigotLib.sol#L221-L235
, SpigotLib.sol#L61
, SpigotLib.sol#L241-L289
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: InterestRateCredit.sol#L9
, LineFactory.sol#L14
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: LineFactory.sol#L140
, LineFactory.sol#L145
, CreditLib.sol#L27
, CreditListLib.sol#L18
Description: There should never be any TODOs (&& Bob) in the code when deploying.
Recommendation: Consider finishing the TODOs (&& Bob) before deploying.
Severity: Informational
Context: SecuredLine.sol#L58 (dont => do not)
, SecuredLine.sol#L58 (fuly => fully)
, EscrowedLine.sol#L45 (priviliegad => privileged)
, EscrowedLine.sol#L74 (priviliegad => privileged)
, EscrowedLine.sol#L85 (priviliegad => privileged)
, Spigot.sol#L133 (revenu => revenue)
, Escrow.sol#L94 (thdeposits => the deposits)
, Escrow.sol#L95 (forlenders => for lenders)
, InterestRateCredit.sol#L17 (acrrued => accrued)
, CreditLib.sol#L123 (interset => interest)
, CreditLib.sol#L200 (bwithdrawn => withdrawn)
, CreditLib.sol#L221 (seeting => setting)
, CreditLib.sol#L237 (interset => interest)
, CreditLib.sol#L250 (demoninated => denominated)
, LineLib.sol#L56 (sendingtokens => sending tokens)
, SpigotLib.sol#L53 (doesnt => does not)
, SpigotLineLib.sol#L44 (priviliged => privileged)
, SpigotLineLib.sol#L48 (adddress => address)
, SpigotLineLib.sol#L188 (revenuw => revenue)
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: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: <SPDX-License>" to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code.
Recommendation: Consider adding SPDX license identifier.
Severity: Informational
Context: SecuredLine.sol
, Oracle.sol
, InterestRateCredit.sol
Description: Contracts should be deployed with the same compiler version and flags that they have been tested with thoroughly. Locking the pragma helps to ensure that contracts do not accidentally get deployed using, for example, an outdated compiler version that might introduce bugs that affect the contract system negatively.
Recommendation: Consider locking the pragma version.
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.
#0 - c4-judge
2022-12-07T17:54:37Z
dmvt marked the issue as grade-b