Fujicracy / fuji-v2

Cross-chain money market aggregator
https://fuji-v2-frontend.vercel.app
15 stars 10 forks source link

Permissionless connext xReceive #285

Closed 0xdcota closed 1 year ago

0xdcota commented 1 year ago

This PR addresses the fact that previous implementation of the Connext-IReceiver was using authentication to allow call through. The idea is to make call permissionless, however, still preventing 3rd actors to access funds from failed xCalls.

0xdcota commented 1 year ago

This PR is ready for review. My approach to the problem was to attack the root cause directly. We should not allowed failed Connext-xCalls to leave funds at the ConnextRouter. Therefore, the logic sends all funds of failed transferIds to the ConnextHandler. From there we can manage this failed txs. @brozorec please check and let me know of any potential refactor or optimization. Variable renaming too.

brozorec commented 1 year ago

We want to add a beneficiary check on the "XTransferWithCalldata" action as discussed during the weekly.

brozorec commented 1 year ago

@DaigaroCota regarding https://github.com/Fujicracy/fuji-v2/pull/291#issuecomment-1427195326 and as you set a revert if "swap" is a first action, it doesn't make sense anymore _replaceAmountInSwapAction() in _accountForSlippage(), right? If that's true and you want to remove it, then plz also update the comments.

0xdcota commented 1 year ago

@DaigaroCota regarding #291 (comment) and as you set a revert if "swap" is a first action, it doesn't make sense anymore _replaceAmountInSwapAction() in _accountForSlippage(), right? If that's true and you want to remove it, then plz also update the comments.

Removed _replaceAmountInSwapAction() function in _accountForSlippage(). I also updated tests to ensure everything is passing. We should be good to go. @brozorec 👍