-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Defend against MEV or PEV (Primary Extracted Value) attacks #2504
Comments
@doubiliu @roman-khimov I believe this solution will also solve your concerns about #2456. |
@Liaojinghui that's an interesting discussion. From implementation perspective, as long as this information is attached together with Block signature witness, it could be removed/pruned in the future.
[UPDATE] Example with
In this example, next primary would need to include tx2, tx3 and tx4, all with support |
@igormcoelho a good one, but we can not take all txs from lists, we have to consider the block size to make sure we can reach consensus in time. If too many txs are added, it would be a DOS attack. |
Fully agree @Liaojinghui , given size of B transactions per block, every node list proposal should be limited to B, or even to less than B... it depends on the pressure we want to make on primary node. |
Another possibility, if we are "feeling luck" and want to avoid p2p pressure, is to send not the Transaction Hash list, but some Bloom Filter mapping of the block proposal. This way, information is highly compressed, with possible false positives (but No false negative), and the work of the primary is to propose transactions that match the bloom filters of f+1 other nodes. This way, we can send a heavy list of whitelisted transactions, just spending few bytes each. This approach is nice, because False Positive just implies that next primary node was lucky to have some random tx that "happened to be supported by others", but bad scenario is when next primary has only transactions that fall as Negatives... in this scenario, next primary will be unable to guess which transaction it needs to require from network. But think about, if Next Primary is so poorly provided in its mempool, its really better to just skip turn and view change anyway. Bloom filter size could be adaptive too, if mempool is crowded, it increases size (more bits) to match more tx, if not too crowded, vector gets smaller (less bits) to get more and more faster. I would vote for some proposal like this, but if people prefer clean lists and stronger p2p/MEV pressure that's fine too. |
Furthermore, we can add some more logic to prevent mev attack, such as executing txs in an order which is determined by Block.Nonce. This is to prevent cheating activities by controlling tx execution order by delicately set tx fee. |
In this model there might be still some tasks that speaker next round can perform MEV attack by excluding commits whose tx list contains txs he don't like. An optimization can be performed to prevent such behaviors to some extent like this:
It will work well when traffic is busy and there are more than MaxTransactionsPerBlock transactions in each consensus node's mempool. In such cases a tx would need more than f + 1 votes or even 3/2N votes to get into next preparerequest. Hence whichever commits the speaker next round picks, the probability that it will come up with the same PrepareRequest will be rather high. |
@igormcoelho Don't you think your solution will make it 2X longer to confirm transactions? |
Transaction lists can be quite big to exchange from every CN and any kind of tx list synchronization between CNs will probably seriously affect performance for busy networks. We already have #2188 and I fear these changes will make the situation worse when CNs have slightly differing (legitimate) tx sets in their mempools. Reordering transaction execution based on unknown to Primary nonce seems to be more viable (but conflicting with dependency idea from #1502 (comment) which I think ultimately will be useful). At least it allows to thwart front- and back-running that is quite trivial to do at the moment (with fee-based sorting) for ordinary network users, not involving any primaries. But it still allows Primary to add some transaction not known publicly into the list (it's risky on a big network though, other CNs have to get it anyway before timeout). Maybe there is a set of problems actually that we can call a MEV attack:
|
@Liaojinghui if we are worried about computational time on p2p, and I agree on that, I propose that we follow the Bloom Filter strategy, and submit only a few bytes to represent the whole mempool. If we have lots of false positives, no problem, because we are just weakening the MEV protection (but making p2p faster). If we want to be more strict about MEV, and put more burden on P2P, we can increase the number of bytes (or send the whole list). Checking a proposed Transaction Header against a list of 2f+1 bloom filters may be quite fast, as long as we use a fast hash for Bloom Filter. @roman-khimov I agree with your worries about #2188 and the description of the MEV problem in three points. I also agree in using Nonce or something else to make tx list deterministic. |
@igormcoelho It's not the computing workload. If I did not misunderstand, you need one consensus to add transactions to the commit (or whatever the message), and another consensus to package them into Block, therefore, you need two consensus periods to confirm a transaction. |
@roman-khimov The primary decides the transaction order (No one but the primary knows), which will determine the transaction result, then he can generate tx accordingly. And if a primary has transactions that only exists in the primary mempool, I don't think that primary should be considered as honest, as it is supposed to relay that transaction to other CNs.
The problem is how to safely decide the transaction order.
If a transaction is synchronized to all CN and pays the highest transaction fee (or publicly known), yet the primary chose not to include it, I don't think this primary is an honest node. Here is how I assume an honest CN should be like:
|
Summary or problem description
As is mentioned by many people from the community, I think it is time that we start to consider the threat of MEV attack and start to discuss and come up with a solution to address it.
Do you have any solution you want to propose?
I think the key to the solution should be removing the right of deciding the transaction list from the primary. Therefore, we can ask all consensus node to send their own version of the transaction list to the primary, then we add one extra step to the consensus to collect the transaction list from other consensus nodes. Since we assume the number of dishonest nodes no more than N/3, therefore we only need to collect N/3 +1 transaction lists. The consensus node calculates the final transaction list from the lists it receives. And in the
preparerequest
message, the primary also attaches the transaction lists it collects as proof.Please also share your solution to MEV here if you have one.
Neo Version
Where in the software does this update applies to?
The text was updated successfully, but these errors were encountered: