wamp-proto / wamp-xbr

The XBR Protocol - blockchain protocol for decentralized open data markets
https://xbr.network
Other
11 stars 16 forks source link

anaylze gas attacks surface #19

Open oberstet opened 5 years ago

oberstet commented 5 years ago

Analyze scenarios such as:

Above is the standard process.

Now, when the payment channel is closed (say upon manual trigger from the seller side), the earned amount M (minus transaction fees) is transferred to the seller, and the channel is closed on-chain.

The latter (on-chain clearing) requires (in the market maker driven process) an on-chain transaction - and that consumes G gas (in ETH), which (again, in the regular process) is paid by the market maker.

What if G > M_ETH?

Here, the notation of M_ETH is the value of M XBR as converted to ETH.

sidenote: 2 things come into play here: the on-chain "current gas rate" (in ETH) / the actual gas paid by the market maker, and the conversion rate of XBR=>ETH. both of which are not globally unique rates, but the effective actual rates depend on the actual exchange rates (eg XBR<=>ETH), on the exchange. This is a non-trivial side aspect to follow up ..


So the "attack" here is about the seller tricking the market maker into accepting and processing paying channels and payments in a way that is net negative financially for the market maker.

Obviously, something the market maker would not want to do;)

We do already have a general safeguard in this, simply because there can be a hard minimum amount (in XBR) for payment channels (via the market definition).

That is, if PC_min (in XBR) > M (in XBR) > G (in XBR converted from ETH), everything is fine.

oberstet commented 5 years ago

see also https://github.com/crossbario/xbr-protocol/issues/48