Pricing across asynchronous vault steps, and what to re-check when a function is spammed
We continued the Sukukfi contest on Code4rena, and analyzed the ERC7575 vault contract.
Lesson Summary:
- If the flows are asynchronous (step-wise), how's the price calculated? In the current scenario, after step 2(fulfilling)'s price calculation, is the price also calculated on claiming? If it's the same, what happens if a slashing occurs between these 2 steps? Will the protocol stay solvent? Play with function inputs, try multiple small deposits, splitting, etc.
- Try spamming functions, see if variables are updated correctly every time.
- Check the initializing function: are all the inherited contracts that need initializing actually initialized?
decimals()is not part of EIP-20, so it is not mandatory.- A try/catch can revert without the catch branch being taken.
- Let's say you pick a flow/step, try to remember what variables are being updated there and use this knowledge when approaching other steps/flows.