bsc icon indicating copy to clipboard operation
bsc copied to clipboard

Add slashable case for frontrunning

Open noXi89 opened this issue 4 years ago • 9 comments

Rationale

I propose a new slashing method for jailing potential malicious frontrunning behavior of validator nodes.

Why should this feature exist?

There is currently a case of three validator nodes frontrunning transactions intransparently. The reason for this (as they say) is transaction cost. But transaction costs aren't really that high. The current slashing methods are "DoubleSign;Downtime".

Slashing docs: https://docs.binance.org/guides/concepts/bc-slashing.html

Risks IMHO is chain highjacking or loss of trust in BSC.

What are the use-cases?

A validator that frontruns transactions can be slashed to ensure chain security.

Implementation

Do you have ideas regarding the implementation of this feature?

A smart contract could check a proposal transaction if a specified transaction exists where a validator included a tx that wasn't in the tx pool. Or if a transaction with 0 gasfee was included higher prioritized than other transactions.

Are you willing to implement this feature?

I don't think am able to, with limited time and knowledge.

noXi89 avatar Dec 11 '21 13:12 noXi89

Frontrunning detection and examples: https://github.com/binance-chain/bsc/issues/658

noXi89 avatar Dec 11 '21 14:12 noXi89

@noXi89 smart contracts have no knowledge of txpool. Having some sort of a governing service that monitors txpool and does the slashing would make BSC even more centralised than it already is. And such method would still be susceptible to networking issues and incorrect slashing. And throwing same tx into a public network and routing it through "direct route" service would still be possible, rendering such method useless.

psdlt avatar Dec 11 '21 14:12 psdlt

True. How could we achieve such a thing? Another approach I can think of would be voting on chain.

noXi89 avatar Dec 11 '21 14:12 noXi89

A smart contract could...

check a proposal transaction if a specified transaction exists where a validator included a tx that wasn't in the tx pool

smart contracts do not get visibility into the txpool. plus, the txpool is ephemeral anyway, and txpool contents vary from node to node

Or if a transaction with 0 gasfee was included higher prioritized than other transactions.

smart contracts are not privy to other transactions (that do not call them directly or indirectly)

in any case, flashbots-style services do present applications other than those that are detrimental to other users

for instance, you can have bundles to rescue assets from compromised wallets (e.g. transfer BNB into compromised wallets, then sweep tokens out)

or maybe arbing between exchanges

or maybe just-in-time liquidity attacks on concentrated liquidity dexes

or well, you can even send your own swap transactions through flashbots if you're worried about it being sandwiched

imo MEV is an inevitability on most chains, and attempts to prevent it from happening will largely be futile, or even ripe for abuse

and it's already happening with negative effects, even without flashbots -- eg tx spam, "fake" nodes that only participate in txpool propagation in an attempt to get pending TXes first or propagate TXes faster

building a robust ecosystem around flashbots a la eth mainnet might be a better idea, because trying to fight it is not going to be easy, if at all possible

and flashbots also means that the ability to reorder transactions wouldn't be limited to only validators, and it might also alleviate some of the aforementioned issues

zhongfu avatar Dec 11 '21 14:12 zhongfu

I don't think there's a way to objectively determine that a validator is front-running.

Some other options I can add:

  1. Enforce gas price ordering of transactions within a block
  2. Enforce minimum gas price of transactions within a block

These won't stop validators from front-running, but at the very least it would prevent them from bypassing the bruno burn.

NullQubits avatar Dec 11 '21 15:12 NullQubits

I don't think there's a way to objectively determine that a validator is front-running.

Some other options I can add:

  1. Enforce gas price ordering of transactions within a block
  2. Enforce minimum gas price of transactions within a block

These won't stop validators from front-running, but at the very least it would prevent them from bypassing the bruno burn.

Exactly, 1-2 could be directly built into the rules just like block size.

People running the nodes could also collect and share first seen timestamp for pending transactions to determine if those were ever added to the tx.pool and when. Its not completely fool proof but could help to determine if a validator is inserting private transactions directly into the block.

DeepBorys avatar Dec 13 '21 11:12 DeepBorys

At the end they can also fake a seen tx. The only thing that sustained is voting. Currently it's crystal clear that the community does not support the behavior of 3 validators. A voting about slashing with "active" addresses, that have seen at least... let's say a transaction in the last 3 weeks before the slashing proposal and a balance of at least 2bnb... (or something) could be beneficial.

noXi89 avatar Dec 16 '21 21:12 noXi89

Some mechanism could be implemented to prevent transactions that have not been propagated first by the full nodes from being included in a block. But I think it would be very expensive to implement and it is too big a change, something simpler is needed.

dgdeivid avatar Dec 20 '21 16:12 dgdeivid

Please proceed to join our Discord channel for more discussion at https://discord.com/invite/binancesmartchain

RumeelHussainbnb avatar Jan 04 '22 12:01 RumeelHussainbnb