Replies: 3 comments 4 replies
-
How do you enforce that at the smart-contract level ? |
Beta Was this translation helpful? Give feedback.
-
I don't understand how you can perform this checks at SC level
Why not redistribute everything? |
Beta Was this translation helpful? Give feedback.
-
I am not fully satisfied with this proposal because even if the op is revealed to a target staker t0/2 before block production, that staker might include MEV ops in other threads using some other staking address. |
Beta Was this translation helpful? Give feedback.
-
Rationale
MEV is a problem: https://ethereum.org/en/developers/docs/mev/
Here we discuss a possible solution for Massa.
General idea
An address A wants to send an operation but needs to hide its contents before execution to prevent reordering.
Prelude: staker registration
Stakers willing to participate in the anti-MEV operation call a "antiMEV" smart contract on-chain to register a public key, and deposit coins.
Step 1: commit
As a first step, A commits the following data to the antiMEV smart contract:
The operation fee is transferred as coins to the smart contract and locked there.
The ordering smart contract sorts the commits by decreasing fee.
If there are too many ops, the least prioritary ones are cancelled, and their fee is reimbursed to their sender.
Step 2: reveal and inclusion
When the operation A arrives in the next batch of the antiMEV contract queue, its sender encrypts the operation with the registered public keys of the upcoming (PoS-selected) few block producers of the operation thread that have put a high enough deposit to cover for potential loss. The encrypted versions of the operation are then propagated.
Only the target stakers can decrypt them, check their hash, and include them in their block.
Step 3: execution
When the antiMEV ops are included in a block by a registered staker, the antiMEV smart contract is called first in the block and checks that:
If an op is not included after 10 blocks produced by participating stakers in that thread, it means it has never been revealed => it is removed from the queue and the fee is half-burned and half split and distributed to the stakers that were not able to include it.
Note that the operation itself needs to ensure that it is currently in the antiMEV queue. Otherwise ops removed from the antiMEV could be included out of the antiMEV context.
Analysis
The general idea is that operation ordering is pre-commited blindly, and the clear version is only later revealed to participating stakers chosen for the amount they deposited, and who need to respect the ordering or lose their deposit.
antiMEV-participating stakers cannot produce blocks that don't start with the antiMEV part or they get slashed and eliminated. antiMEV operations include a check to ensure that they cannot be included outside of that antiMEV part within a block created by one of the selected participating stakers, to prevent participating stakers from including the op using another staking account that does not participate in antiMEV.
The selection of stakers by deposit is important because it creates a market pushing deposit prices up.
Ideally, senders need to wait for their commit to be final before revealing. But if they don't it's also ok because the ops won't be executed if they are not listed in the antiMEV smart contract, even if included.
Anti-MEV operations are opt-in and slower/more expensive than normal operations.
Beta Was this translation helpful? Give feedback.
All reactions