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:
Rank: 20/27
Findings: 1
Award: $150.19
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: castle_chain
Also found by: 3docSec, Aymen0909, Franfran, J4X, Ocean_Sky, QiuhaoLi, TheSchnilch, ZanyBonzy, alix40, alkrrrrp, bin2chen, carrotsmuggler, ihtishamsudo, oakcobalt, peachtea, tsvetanovv, zhaojie
150.1907 USDC - $150.19
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.
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.
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.
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
.
Missing MinTradingLimit
check in the add_liquidity_shares
extrinsic.
The added_amounts
variable in fn do_add_liquidity
is never used.
The InvalidAmplification
check in the update_amplification
extrinsic can move to the beginning of the function as a short-circuit.
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.
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