ElementsProject / ElementsProject/peerswap

[RFC] What to do about Bad Behavior?

Open
#38 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
128
Forks
84
Avg merge
3h 1m
Merged PRs (30d)
1

Description

This is a Request for Comments.

There are some corner cases in which PeerSwap swap requesters can be lied to by swap providers into paying more fees than necessary. Such bad behaviors are easy to detect. The code should be able to detect these cases and notify via logs and maybe also a flag within the swaps database. This could be inputs into a later node reputation tracker or something.

Note: These bad behavior situations are not considered "exploits" per se because they 1) only affect the requester, not automated providers 2) only by a tiny amount per swap 3) and once you know a peer is misbehaving the software can easily stop future swaps with that peer 4) there are potential designs for transferable lie proofs signed by the misbehaving node's pubkey.

Examples of bad behavior:

- [x] #34 the swap provider can lie to the swap-out requester it has sufficient UTXO's available thereby inducing them to pay the LN prepayment invoice only to immediately cancel. The requester's peerswap code should detect this pattern of misbehavior. DONE peerswap prints a warning.
- [ ] This could happen very rarely by a legitimate provider in rare cases like a race condition (?), in which case if it happened by accident there could be an immediate refund invoice. Consider for the next version of the protocol spec.
- [ ] The swap provider could ask for an excessive amount of sats far in excess of the actual after-the-fact on-chain cost. To an extent this is unavoidable due to normal variations in the feerate estimator however the requester's node should log the discrepancy each time it happens in order to detect a pattern of behavior.

Other examples possible?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.