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: 74/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
This report provides comprehensive analysis of ulysses protocol with analysing the code based for audit purpose. The protocol as a part of Maia ecosystem is developed as a permissionless model to mitigates the downsides of current defi market. The key aspects of benefits provided by ulysses protocol are as under:
Ulysses protocol architecture is centered around below discussed foundational element.
Ports act as repositories of liquidity, managing the capital deposited into ulysses across various chains.
Ports are further divided into two types:
Branch ports are specific to each chain and root ports on the root chain to cater local operations, handling user requests and system responses within a chain.
Root ports are situated on root chain, and act as global state of virtualized tokens and maintain vital registries for token mapping, balances, and actions that involve token addition, removal, or verification.
Virtual liquidity mechanism allows assets locking in different chains to be mirrored within a unified environment which ensure unparalleled composability. Providers of liquidity can offer liquidity by utilizing branch tokens across various pools and protocols like uniswap v3 and aave.
The liquidity mechanism approach not only increases capital efficiency but also educe loss, presenting a lucrative opportunity for liquidity providers to have revenue from diverse chain activities.
Bridge agents they facilitate efficient communication between blockchain networks, acting as pivotal intermediaries within the system. They have a vital role in ensuring smooth connections by handling user requests and managing system responses. There are two types of bridge agents:
Branch bridge agents
Branch bridge agents are deployed to mediate interactions with a branch router, overseeing user deposits, asset transfers, and engagements with virtualized token contracts within a local chain. The flow involves the submission of a swap request by the user, validation and execution of the request across chains, and token transfer to the desired destination chain.
Bridge agents serve as the neural pathways of the ulysses protocol, efficiently relaying information between different chains and acting as intermediaries for user-system interactions. Their role is fundamental in ensuring that transactions and communications between users and the broader system occur seamlessly, embodying the protocol's commitment to facilitating frictionless cross-chain operations.
Root bridge agents
Root bridge agents, are present on root chain to establish connections with multiple branch chains and respective bridge agents. They are crucial in monitoring pending user settlements and interact with ports and virtualized assets while integrating with other dapps on the root chain.
Virtual account functions as an omnichain wallet, providing organised and efficient means to manage user balances across multiple blockchain networks. This cross-chain capability streamlines actions within the arbitrum ecosystem, eliminating the need for users to navigate through various blockchain networks manually.
Virtual account maintains separate accounting for each user without altering existing smart contracts, enhancing security, maintainability, and overall efficiency by improving cross-chain interactions, ensuring a smoother and more secure user experience.
Integration with the ulysses branch chain is another standout feature of the virtual account. This integration ensures that users can access their balances and interact with dapps in the arbitrum environment effortlessly. This ease of use and seamless integration are vital in driving broader adoption of the arbitrum ecosystem, attracting both developers and users alike.
This section focus on some of main contracts that contains main logic and work flow for Ulyssess protocol.
Multicallrootrouter.sol
Corerootrouter.sol
Rootbridgeagentexecutor.sol
corebranchrouter.sol
This smart contract logic for a core branch router within a blockchain that facilitates the integration of various chains, allowing for token management and interactions across these chains.
Functions are token management, enabling the addition of both global and local tokens to different chains. The addglobaltoken
function allows the addition of a global token to a specific branch, while the addlocaltoken
function enables the addition of a local token to the system.
The togglebranchbridgeagentfactory
function handles the addition or removal of a bridge agent factory, and the _removebranchbridgeagent
function allows the removal of a specific bridge agent.
It also supports port strategies, enabling the management of tokens and their associated strategies within the port. The _managestrategytoken
function is used to manage strategy tokens, and the _manageportstrategy
function is responsible for managing port strategies.
rootbridgeagent.sol
ilayerzeroendpoint
, irootbridgeagent
, irootport
, and other custom-defined interfaces.branchport.sol
and
lzreceivenonblocking``` functions handle actions related to layer zero, likely involving interactions with another layer or network.basebranchrouter.sol
ibranchrouter
interface, which defines functions for handling deposits, settlements, and cross-chain interactions.rootport.sol
Systemic risk is based on potential issues and vulnerabilities identified that can create hurdle in smooth processing and working of the Ulysses protocol partially or as a whole.
The core functionality of Ulysses involves cross-chain communication and asset transfers that have a significant risk in the secure and reliable working of these operations. If cross-chain communication are compromised, it could result in unauthorized asset transfers or disruptions in communication between different chains.
Smart contracts can be prone to vulnerabilities like reentrancy attacks and denial of service attacks. Proper measurs should be taken for input validation, state changes, and handling external calls to prevent potential exploits due to activites between different chains.
The presence of governance based functions in Corerootrouter.sol
raises concerns about security and decentralization of governance. If governance mechanisms are not well-designed or become centralized, it could lead to biased decision-making or even control of the protocol by a small group of malicious actors.
Managing tokens across different chains opens the system to risks related to the integrity and security of the tokens. Malicious actors may attempt to manipulate tokens, create fake tokens, or exploit vulnerabilities in the token management mechanisms.
Deposits and settlements risks are related to failure or delays in processing deposits, which could result in financial losses for users. Errors or omission in settlement process could lead to incorrect transfers or loss of assets.
Depending on the implementation, reliance on oracles for cross-chain information could pose risks related to data accuracy, manipulation, or delays. Secure and reliable integration with multiple oracle is crucial to mitigate these risks.
The overall code is well-structured with clear Natspec making it easy to understand many of the contract's functionality and purpose. The code quality also improves by making use of import statements for modularity, importing relevant functionalities from other contracts that enhances it modularity and reusability.
Usage of modifiers enhances reusability and reduces redundancy which is main context of workflow efficiency.
Throughout the codebase logic for updating token debt and withdrawing tokens are repeatedly use in multiple functions like that of replenishReserves
in the BranchPort.sol
contract. This can be avoided in terms of extracting common functionality into a separate helper function to avoid redundancy.
The recommendation is made in area of improving efficient and secure interactions across various chains which lies in the efficient functioning of bridge agents. The improvement can be made in terms of enhancing function of all intermediaries contracts that must effectively act as neural pathways within a vast interconnected system ensuring seamless communication between different chains.
Branch bridge agents focus shold expand from just acting as a mediator of interactions with a router that monitors and analyse user deposits, managing asset transactions at the local branch port and engaging with virtualized token contracts. root bridge in the root chain needs to facilitate connection with all connected branch chains and respective bridge agents. Branch bridge should increase monitoring of pending settlements and maintain integration with other dapps within the root chain.
The main recommendation is made in area of connecting all the branch with each other rather than having a inter connection so that they can work independently if one of the branch stop working. This can be done through create a node structure like that exist in the EVM ecosystem that validates every transaction and resist any type of malicious activity.
The connecting of all branch with each other helps every users to initiate swap request and creating branch bridge agent orchestrates the process by locking the necessary balance and forwarding essential data to the other branch agent which does not require root agent verification as all branch are connected and not rely on a sole root agent. Authentication and validation of the request and deposit data occur instantly improving the working and efficiency of all bridge agent, followed by the actual execution of the swap by the router, ultimately resulting in the transfer of output tokens to the desired destination chain.
It is advised to further enhance the working of inter-chain communication infrastructure for optimising time processing efficiency related with every typr of transaction. The imporvement area exists in continuous monitoring and refining of the communication protocols to reduce latency and enhance response times. Exploring possibilities for parallel processing and load balancing can contribute to increased efficiency, ensuring smooth experience for users conducting transaction across different blockchain ecosystems.
The Ulysses protocol has developed an efficient and promising system that enables cross-chain communication and asset transfers. It should be improved with a well-defined governance model and risk management strategies to mitigate any potential issue.
Note to Judge
30 hours
#0 - c4-pre-sort
2023-10-15T14:07:49Z
0xA5DF marked the issue as sufficient quality report
#1 - alcueca
2023-10-20T12:15:38Z
Good system description, but you donβt need to sell the product. Let MaiaDAO do that.
Contract by contract description is adequate, even though changing the capitalisation of contract names is confusing.
The Systemic risk section is either boilerplate or AI.
Interesting recommendation of changing architecture from well and spoke to mesh. Warden is probably not aware of the complexity of that proposal.
#2 - c4-judge
2023-10-20T12:15:43Z
alcueca marked the issue as grade-b