Axis-Fi / axis-core

Axis Protocol
https://axis.finance
Other
3 stars 0 forks source link

EMP: Prevent claimProceeds front-running and allow sellers to refund on bricked settlement #169

Closed Oighty closed 2 months ago

Oighty commented 2 months ago

In reviewing the DTL callback issues, it became apparent that allowing users to claim their payouts before the seller (or their callback) gets proceeds has some downstream affects, specifically with regards to front-running DTL pool creation. This was introduced by splitting up settle and claimProceeds, largely to avoid issues with a blacklisted seller or a reverting callback from bricking settlement. However, this concerns are edge cases and likely represent desired behaviors instead of issues if handled correctly.

In the current implementation, we added a dedicatedSettlePeriod where users cannot claim refunds, but allows them to do so after that period until the private key is submitted for the auction. This allows a seller a reasonable amount of time to decrypt and settle the auction with no refunds being claimed, but also guards against sellers withholding the private key for the auction.

If we recombine settle and claimProceeds, we have the possibility of a blacklisted seller or callback bricking settlement again. In order to allow refunds after a private key is submitted (for both buyer and seller), we can add a new function, callable by anyone, called abort. abort moves the auction to a settled state and refunds the seller their base tokens. It also sets the marginal price of the auction at type(uint256).max so that all bidders can claim their refund via claimBids. This function should only be callable when the auction is not in the Settled state and the dedicatedSettlePeriod has passed. We make this an open function to prevent the seller from freezing everyone's funds.

We also updated the dedicatedSettlePeriod to be 24 hours to allow more time for sellers/others to perform the settlement.

0xJem commented 2 months ago

Dedicated settle period should end when settlement is completed. So that bids can be claimed immediately after. Dedicated settle period to 24 hours? Rename ICallback.onClaimProceeds -> ICallback.onSettle