Review `saviourGasLimit` in LiquidationEngine to ensure compatibility with Arbitrum
Closed this issue · 5 comments
- Verify that HAI on Optimism has correctly set the
saviourGasLimit
on the liquidation engine - Determine the appropriate range of values for the saviour gas limit, given network gas limits
- Write tests to ensure the gas usage does not prevent liquidation.
- Add a deployment script step to set saviourGasLimit, to enable saviours.
Poking around this issue.
Arbitrum Block Gas Limit: 32,000,000
Arbitrum Gas speed limit 7,000,000
*
* Over this congestion mechanism activates
10M is the amount in HAI
I know that the SafeSaviour is a whitelisted contract, but overall we can end up in a gas grief situation.
Ideally we should take more control before / after the call.
To know more about 1/64 rule: https://publish.obsidian.md/axe/public/solidity/1_64+Rule
If the external call run out of gas we still have housekeeping to execute
Solution
- ensure that we have the gas to execute the rest of the function in case of
revert
orout of gas revert
inattemptSave
10M => 1/64 ~= minimal gas we have 156,250 gas
To clarify, this is not a problem for liquidation as long we whitelist the saviour contracts.
If we need to open outside contracts we will implement gas controls Before / After the execution.
Overall, I'd like to have more control over this external call, but we need to keep going with the deployments and tests.
There's a risk that a faulty contract might use up all the available gas during liquidation, leaving only a little gas left to finish the operation.
Right now, we're setting a gas limit of 10 million, which should be enough for us to complete the transaction, even if the contract uses up a lot of it.
However, depending on network conditions, there could be a point where the cost of gas makes liquidation unprofitable.
I hadn't considered the gas cost itself being a deterrent. I was only considering exceeding the gas limit, so I'm glad you brought this up.
I think rather than find out the max, we should start from the minimum gas. If people start developing more complex saviours then we can revisit the limit, and update it via governance.
Can you please create a saviour that unwinds the position using camelot DEX? Then lets add 50% safety buffer on top of that.
Complete in #661