Platform: Code4rena
Start Date: 21/08/2023
Pot Size: $36,500 USDC
Total HM: 1
Participants: 43
Period: 7 days
Judge: Dravee
Id: 277
League: ETH
Rank: 25/43
Findings: 1
Award: $31.37
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: 0xSmartContract
Also found by: 0xmystery, Udsen, carrotsmuggler, catellatech, ihtishamsudo, moneyversed, oakcobalt, pfapostol, plainshift, rjs
31.3724 USDC - $31.37
Evolving Proteus is an AMM primitive for Shell Protocol's The Ocean. It complements the Static Proteus AMM primitive.
The principal innovation introduced by Evolving Proteus is a stateless AMM primitive contract that can gas-efficiently passively update liquidity concentrations over time i.e. the bonding curve which maps balances to prices can shift from the specified initial values to final values over a particular duration. This is particularly useful for implementing Dutch auctions and dynamic pools.
An animated Desmos graph of the concept was provided by the Shell Protocol team during the contest.
Day 1 (4 hours)
Day 2 (4 hours)
Day 3 (4 hours)
readme.md
Day 4 & 5 (8 hours)
EvolvingProteus
using echidna
, specifically focusing fuzzing values for py_init_val
, px_init_val
, py_final_val
, px_final_val
-- these were all hardcoded in the forge
fuzz testsThe following attack vectors were pursued:
EvolvingProteus.sol
Complexity
Documentation
readme.md
and that makes the code very challenging to reviewTesting
Dependencies
ABDKMath64x64
, which had no unit tests and minimal documentationABDKMath64x64
has been subject to extensive fuzz testing as part of the echidna
and medusa
communityEvolvingProteus
implements The Ocean primitive interfaces. This is a well thought out interface, but otherwise it is out of scope for further analysis.
One downside of the stateless approach is that it is very difficult to understand the implementation as no logging is possible.
I would recommend a forge script
to run through multiple in-scope scenarios and output curve parameters and prices. This data can be fed into a graphing script so that the algorithm's performance in various scenarios can be visually analyzed and documented.
It was very difficult to do meaningful gas optimization tests due to the heavy reliance on fuzz testing. This is an interesting outcome, because the main selling point of The Ocean's primitives is gas savings.
As this is a stateless contract, there are no centralization risks.
Gas Prices Gas prices are a significant component of an AMM. Evolving Proteus targets Arbitrum, which is a reasonable choice.
Ecosystem Reliance As an AMM primitive in the Shell Protocol's Ocean, there may be vulnerabilities in Ocean which impact Evolving Proteus.
24 hours
#0 - c4-pre-sort
2023-08-31T05:47:45Z
0xRobocop marked the issue as sufficient quality report
#1 - c4-judge
2023-09-11T20:42:03Z
JustDravee marked the issue as grade-b