HydraDX - alkrrrrp's results

HydraDX Omnipool - An Ocean of Liquidity for Polkadot Trade an abundance of assets in a single pool. The HydraDX Omnipool is efficient, sustainable and trustless.

General Information

Platform: Code4rena

Start Date: 02/02/2024

Pot Size: $100,000 USDC

Total HM: 11

Participants: 27

Period: 28 days

Judge: Lambda

Total Solo HM: 4

Id: 327

League:

HydraDX

Findings Distribution

Researcher Performance

Rank: 20/27

Findings: 1

Award: $150.19

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

150.1907 USDC - $150.19

Labels

bug
grade-a
QA (Quality Assurance)
sufficient quality report
edited-by-warden
Q-10

External Links

Low / non-critical findings

Omnipool

  1. In the add_token extrinsic, both the amount and reserve variables are the same value query from T::Currency::free_balance(asset, &Self::protocol_account()), the reserve can be replaced by amount to avoid one database read.

  2. In the add_liquidity extrinsic, when calculating the hub_reserve_ratio, the current_hub_asset_liquidity variable can be used to avoid one database read.

  3. Missing MinimumPoolLiquidity check in remove_liquidity

Similar to the remove_liquidity_one_asset in the Stableswap, the user should either withdraw all liquidity or leave >= MinimumPoolLiquidity liquidity in the position, otherwise there may be a lot of small positions occupy the runtime state.

Stableswap

  1. Missing InsufficientLiquidityRemaining check in the withdraw_asset_amount extrinsic.

The user can use withdraw_asset_amount to withdraw shares from a pool and leave the pool with 0 < remaining_liquidity < MinPoolLiquidity.

  1. Missing MinTradingLimit check in the add_liquidity_shares extrinsic.

  2. The added_amounts variable in fn do_add_liquidity is never used.

  3. The InvalidAmplification check in the update_amplification extrinsic can move to the beginning of the function as a short-circuit.

EMA Oracle

  1. The oracle data of a removed token of the Omnipool stays forever in the runtime state.

As a result, the Oracles storage in the ema-oracle pallet will only grow and never decrease. Recommended adding another hook like on_token_remove to remove the oracle date for the removed token.

  1. Unnecessary oracle_entry.clone() in update_oracles_from_accumulator when updating the LastBlock period oracle.

#0 - c4-pre-sort

2024-03-03T08:18:23Z

0xRobocop marked the issue as sufficient quality report

#1 - c4-judge

2024-03-08T19:35:07Z

OpenCoreCH marked the issue as grade-b

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter