autonomys / subspace

Subspace Network reference implementation
https://subspace.network
375 stars 242 forks source link

[Low] XDM - Fees are locked away forever if a channel to a destination is not successfully opened #2804

Open vanhauser-thc opened 4 months ago

vanhauser-thc commented 4 months ago

Issue Description

In the current implementation, if an attempt to open a channel to a destination fails, the associated fees are locked away indefinitely. This issue arises because the system does not have a mechanism to refund or reclaim fees for unsuccessful channel openings. As a result, users lose their funds permanently, leading to financial losses and reduced trust in the platform.

Risk

Users permanently lose their fees, leading to direct financial harm to the users (Domain operators).

Mitigation

Currently only an opened channel can be closed. We recommend to also allow closing a channel in ChannelState::Initiated state to allow to recover funds.

vedhavyas commented 4 months ago

Channel can be in init state, if the dst_chain does not have the src_chain in the allowlist. If we allow closing the channels in the init state, then there could be small DDOS. Since user can claim their reserve back, they will open many channels to dst_chain and dst_chain will reject opening channel and then user can close the channel and claim their deposit. Ofcourse there is fee to initiate channel open request but its not that big.

I'm thinking protocol could take a percentage of reserve if the channel is in init state. This is dis-incentivze the user to open many channels to dst_chain that does not allow src_chain. thoughts @dariolina

vanhauser-thc commented 4 months ago

I agree, keeping a percentage when closing a channel that is in init state sounds like a way to dis-incentivze users.

vedhavyas commented 4 months ago

I have a PR open here - https://github.com/subspace/subspace/pull/2829 That should allow closing channels in init state but take a portion of reserve fee