Skip to content
Open
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions sips/mev.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
| Author | Title | Category | Status |
| ------------------------- | ------------------------------- | -------- | ------------------- |
| Moshe Revah (@moshe-blox) | Support externally built blocks | Core | open-for-discussion |

## Summary

Support the production and proposal of blocks built by external entities, allowing operators to access blocks from a marketplace of builders such as [Flashbots](https://boost-relay.flashbots.net/).

## Rational & Design Goals

Block building is a computationally intensive task, and even more so when blockspace utilization and profit maximization are in mind. Additionally, many of the more profitable transactions, so-called MEV, are private and only accessible to validators through external block builders.

Currently, operators wishing to offer competitive returns must be sophisticated block builders with private transaction flows. This SIP aims to change that by allowing them to register with and propose blocks from external builders who comply to [ethereum/builder-specs](https://github.com/ethereum/builder-specs).

## Specification

### Configuration

Operators who wish to propose blinded blocks must configure their SSV node to do so, otherwise it would only propose standard blocks and reject QBFT proposals containing blinded blocks.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't this mean if you mix MEV and non MEV operators it doesn't work?

Copy link
Contributor Author

@moshe-blox moshe-blox May 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, originally I wanted blinded/non-blinded to be a property operators set in the contract with a cooldown period to make them commit to their claim for at least a week or two.

So for example if an operator switches from non-blinded to blinded in the contract, but also switches it in his node before the cooldown period is over, his blocks would be rejected by other operators.

Cooldown period helps validators rest assured that their operators aren't switching modes rapidly.

Eventually, we didn't go this way, so now rejecting blocks sounds less appealing.

Still, I can think of a few reasons for rejections:

  • Relay/operator theft: imagine a scenario where many relays/operators suddenly stop paying the fee & MEV rewards to validators. Validators start panicking and migrating to non-blinded operators, and because we verify the fee recipient in non-blinded blocks, they should be safe. However, if non-blinded operators don't reject blinded blocks, there is nothing to prevent an operator masquerading as non-blinded from spontaneously proposing a single blinded block that steals fees, every once in a while.
  • Regulatory Compliance: Operators who wish to be OPAC-compliant may want to avoid signing blinded blocks, as they could hide non-compliant transactions. However, as @GalRogozinski pointed out, this is only a partial solution. Operators would also need to patch their SSV node to inspect non-blinded blocks, making block rejection a less compelling standalone solution.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@moshe-blox
can you please elaborate on the motivation for cool down period?

Copy link
Contributor Author

@moshe-blox moshe-blox May 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GalRogozinski Cooldown period is a commitment between operators to validators. When validators choose a non-blinded operator, they can rest assured that it would not suddenly change it's mind and start proposing blinded blocks. Validators would know of this change a week in advance (or however long the cooldown period is) and can migrate over to other operators before it takes effect.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe the relay/operator case be added to the SIP?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chiming in here to mention that beacon API specs has changed since this SIP, the separate API calls to the beacon node about getting a full or blinded block have been deprecated, the new V3 api call will get you a blinded block if your beacon node is connected to MEV relays and possible and the blinded block is more profitable than a local one, otherwise it will get you a local full block.
this means its not straight forward anymore to config the SSV operator node to support or not support MEV, this responsibility is now on the beacon node.


Therefore, validators should solely select operators with matching configuration, otherwise consensus might be unreachable.

### Validator registration

Builders require validators to publish a [`builder-specs/SignedValidatorRegistration`](https://ethereum.github.io/builder-specs/#model-SignedValidatorRegistration) to set their `fee_recipient` and `gas_limit` preferences.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how and when do they publish it? should it be in the spec?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section specifies when to publish.

There is no rule in the Ethereum builder-specs regarding when/how often this should be publish, but @lior-blox suggested that we should specify it in the spec so that future SSV implementations would be aligned on it.


When building a block for a validator, builders refer only to the registration with the highest timestamp.

In the wild, some Ethereum validator clients currently publish this message every epoch.

#### Fee recipients

Validators may set their preferred `fee_receipient` address by calling `setFeeRecipientAddress` in the `SSVNetwork` contract. Validators may repeat this call as their preference changes over time.

#### Signing

At the start of every slot, operators select their active validators with `ShouldRegisterValidatorAtSlot`, and for those, produce a [`builder-specs/SignedValidatorRegistration`](https://ethereum.github.io/builder-specs/#model-SignedValidatorRegistration) with their preferred `fee_recipient`.

```go
ValidatorRegistrationSlotInterval = 10 * SlotsPerEpoch

func ShouldRegisterValidatorAtSlot(index phase0.ValidatorIndex, slot phase0.Slot) bool {
return (index + slot) % ValidatorRegistrationSlotInterval == 0
}
```

#### Publishing

Every epoch, operators should publish the most recent successfully signed registration for their entire validator set.

This SIP suggests to spread registrations between slots. For example, at every slot, operators may publish only for a fraction of their validators (corresponding to `1/SlotsPerEpoch`), ensuring a more evenly distributed load on the Beacon node and builder(s).

> Note: Since relays/builders can have some delay with registrations, producing a blinded block before and shortly thereafter publishing the first registration may result in either:
>
> 1. Builder is unfamiliar with the validator yet and doesn't build a block, and Beacon node falls back to locally-built block from it's execution layer.
> 2. Builder doesn't reward the validator's `fee_recipient` because it isn't aware of it yet.
> 3. Builder rewards a potentially different `fee_recipient` from the validator's latest registration (such as a registration prior to onboarding to SSV.)

> Note: Currently, implementation publishes registration differently: right after producing signatures. We're following the performance of that, and will either revise this SIP or the implementation accordingly.

#### Issue: Gas limits

Gas limits are set by operators rather than validators, unlike in standard validator clients.

This SIP proposes to hardcode the gas limit to 30 million (which is the default in Prysm and Lighthouse), but recommends to keep watching it and modify if necessary.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set where?

Copy link
Contributor Author

@moshe-blox moshe-blox May 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In validator clients, it's configurable with a default of 30 million. In SSV it's currently hardcoded to the same value: https://github.com/bloxapp/ssv/blob/38193908b145dbe29186de34a6c60df1085c92e4/beacon/goclient/proposer.go#L27

Copy link
Contributor Author

@moshe-blox moshe-blox May 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it should be configurable? @alonmuroch

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's ethereum dependent so not sure

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can let operators configure this, but if they differ, they will not be able to reconstruct signatures for ValidatorRegistration because it contains this value.

Social consensus on gas limit hasn't changed (at least) since The Merge, and if it does we'd want operators to switch at roughly the same time to avoid differing ValidatorRegistration, so maybe waiting for this to change and then releasing a version with a transition scheduled at a specific epoch/slot is safer?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they configure it differently it can cause consensus issues?

Copy link
Contributor Author

@moshe-blox moshe-blox May 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not QBFT consensus, they will just fail to aggregate signatures in pre-consensus of ValidatorRegistration: https://github.com/nkryuchkov/ssv-spec/blob/d0730a175f4543f325f4e798a047084a28744000/ssv/validator_registration.go#L67

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only reason I can think it is good to have it configurable is for testnets.
Other than that the operator shouldn't touch this value.
But the only reason to test different gas limit, is if ethereum will have a fork.

So I agree with @moshe-blox and have it non-configurable.
If someone disagrees please say so, because the spec will make it a constant.


### Blinded block proposals

When a validator has a proposal duty, their operators:

1. Produce a `BlindedBeaconBlock` from their Beacon node at [/eth/v1/validator/blinded_blocks](https://ethereum.github.io/beacon-APIs/#/Validator/produceBlindedBlock)
2. Reach consensus on and sign the round leader's `BlindedBeaconBlock`
3. Submit the `SignedBlindedBeaconBlock` to their Beacon nodes at [/eth/v1/beacon/blinded_blocks](https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlindedBlock)

Under the hood, each operator's Beacon node would attempt to unblind the block from it's connected builder(s) by revealing the signature to them, which would fail if they haven't built or don't know of this block.

Therefore, for unblinding to succeed, operators' Beacon nodes must share the same builder(s) with the round leader's Beacon node.

Since SSV can't enforce a specific set of builder(s) at the protocol-level, operators would have to reach social consensus on which builder(s) to configure their Beacon nodes with.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if there is a mix of both ssv operators proposing blinded and non blinded blocks in the same cluster?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently nodes with blinded proposals disabled are not rejecting blinded blocks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and viceversa?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we discussed it should be strict.
If Im an operator that doesn't want to support MEV, I should not participate in the Consensus if the leader proposed MEV

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

viceversa should be allowed

Copy link
Contributor Author

@moshe-blox moshe-blox May 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lior-blox
Let say in a 4 node cluster 2 operators don't want to support MEV?
So no block will ever be produced?

Also why would some operators oppose to use MEV? I can only think of idealogical reasons or deep mistrust of relays. In this case, I think it is more of the validator's choice and not the operator.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GalRogozinski
In the scenario, only proposals that the leader is non mev will be successful.
It could be various reasons like ideology or legal etc.

The operators will use metadata to let the validators If they MEV support and which relays

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to have a writeup somewhere on why we are doing this.
When I talked to @lior-blox and @moshe-blox they both gave me different reasons.

This feature may break consensus. Maybe there are good reasons to add the feature despite the risk, but they should be super clear to us!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This discussion can continue here:
#25 (comment)


#### Locally-built blinded blocks

Sometimes, a Beacon node falls back to a locally-built `BlindedBeaconBlock` from it's execution layer, either because it's configured to do so under certain conditions (profitability threshold; chain is unstable) or because the builder(s) are unavailable.

A locally-built blinded block can only be unblinded by the same Beacon node which built it, which unfortunately means that only the round leader would successfully submit the block, thereby reducing the total network outreach of the proposal down to a single Beacon node.

We should consider pushing operators to configure their node for less harsh fallback conditions, so that more of their blocks are externally-built and can be successfully submitted by other operators' Beacon nodes.

#### Blinded block validation

Nowadays, there's no meaningful validation we can do on blinded blocks, but there's [active discussion](https://github.com/flashbots/mev-boost/issues/99) about requiring builders to attach payment proofs on bids so that they can't cheat and reward themselves instead of the validator's `fee_recipient`.

Ideally, payment proof validation should be handled by [mev-boost](https://github.com/flashbots/mev-boost), as it already examines the builders' bids, in which case operators would only have to ensure their Beacon nodes are always updated with the latest [`builder-specs/SignedValidatorRegistration`](https://ethereum.github.io/builder-specs/#model-SignedValidatorRegistration).