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: 78/175
Findings: 1
Award: $38.61
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 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
During this analysis, my main focus was to understand the Virtualized liquidity system and the use of Bridge agents to permissionlessly deploy Multicall Root Routers in the Ulysses platform.
Day 1: I spent time understanding the overall working of the Virtualized liquidity system and getting an overview of the codebase.
Day 2: I read through the documentation to further understand the Virtualized liquidity system and the functioning of bridge agents.
Day 3: I went through the codebase and did a comprehensive review of Mechanism and centralization risks as well as possible optimization issues and proposed recommendations
Day 4: I dedicated this day to preparing the final report and analysis, summarizing the findings and recommendations.
Ulysses protocol’s architecture is well-designed, with clear separation of unified and virtualized liquidity. Non the less, there are a few areas where improvements could be made:
Gas Optimizations
Review data types : Analyze the data types used in Ulysses smart contracts and consider if they can be further optimized. For example, changing uint256 to uint128 or uint94 can save gas and storage slots.
Struct packing : Look for opportunities to pack structs into fewer storage slots. By carefully selecting appropriate data types for struct members, overall storage usage can be reduced.
Use constant values : If certain values in your contracts are constant and do not change, declare them as constants rather than storing them as state variables. This can significantly save gas costs.
Avoid unnecessary storage : Examine your code and eliminate any unnecessary storage of variables or addresses that are not required for contract functionality.
Storage vs. memory usage : When working with arrays or structs, consider whether using storage instead of memory can save gas. Using storage allows direct access to the state variables and avoids unnecessary copying of data.
Replacing the use of memory with calldata for read-only arguments in external functions .
Other recommendations
Analysis of the codebase (What’s unique? What’s using existing patterns?):
Unique: This contract carries out specific governance mechanisms that are uniquely designed for its specific use case.
Existing Patterns: The contract uses standard Solidity and Ethereum patterns. It uses the ERC20 standards and Ownable pattern for ownership management.
The Following are the major parts of Ulysses Protocol:
Virtualized liquidity: is achieved by connecting Ports within a Pool and Spoke architecture, comprising both the Root Chain and multiple Branch Chains. These contracts are responsible for managing token balances and address mappings across environments. In addition, means that an asset deposited from a specific chain, is recognized as a different asset from the "same" asset but from a different chain (ex: arb ETH is different from mainnet ETH).
Arbitrary Cross-Chain Execution: is facilitated by an expandable set of routers such as the Multicall Root Router that can be permissionlessly deployed through the Bridge Agent Factories. For more insight on Bridge Agents, please refer to our documentation here. Our Virtual Account contract simplifies remote asset management and interaction within the Root chain.
External Contract Dependencies: Ulysses relies on the solady, solmate and openzeppelin contracts. If any of these contracts have vulnerabilities, it would affect this contract.
Like any smart contract-based system, Ulysses is exposed to potential coding bugs or vulnerabilities. Exploiting these issues could result in the loss of funds or manipulation of the protocol.
Governance Mechanism Security: Ulysses’s governance mechanism is critical for its operation. A poorly implemented governance mechanism could lead to system-wide issues.
Test Coverage: the test coverage provided by Venus is the 69%, however I recommend 100% of the test coverage.
32 hours
#0 - c4-pre-sort
2023-10-15T14:14:47Z
0xA5DF marked the issue as sufficient quality report
#1 - alcueca
2023-10-20T10:32:41Z
Mostly boilerplate analysis.
#2 - c4-judge
2023-10-20T10:32:46Z
alcueca marked the issue as grade-b