From 84b87ba8aa0ba33412fac60d54a183f599347aa7 Mon Sep 17 00:00:00 2001 From: nicolas <48695862+merklefruit@users.noreply.github.com> Date: Tue, 6 Aug 2024 10:40:25 +0200 Subject: [PATCH 1/2] chore(mev-boost-relay): set SSZ max constraints per slot to the default max transactions per block --- mev-boost-relay/services/api/constraints.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/mev-boost-relay/services/api/constraints.go b/mev-boost-relay/services/api/constraints.go index bd1f87b3e..230bc9e63 100644 --- a/mev-boost-relay/services/api/constraints.go +++ b/mev-boost-relay/services/api/constraints.go @@ -10,8 +10,13 @@ import ( // These types are taken from https://chainbound.github.io/bolt-docs/ const ( - // NOTE: This is still a work in progress and not documented on the specs - MAX_CONSTRAINTS_PER_SLOT = 256 + // Note: we decided to set max constraints per slot to the same value + // as the max transactions per block in Ethereum. This allows bolt operators + // to decide how many commitments to include in a slot without the protocol + // imposing hard limits that would be really hard to change in the future. + // + // Specs: https://github.com/ethereum/consensus-specs/blob/9515f3e7e1ce893f97ac638d0280ea9026518bad/specs/bellatrix/beacon-chain.md#execution + MAX_CONSTRAINTS_PER_SLOT = 1048576 // 2**20 MAX_BYTES_PER_TRANSACTION = 1073741824 // 2**30 ) @@ -25,7 +30,7 @@ type SignedConstraints struct { type ConstraintsMessage struct { ValidatorIndex uint64 `json:"validator_index"` Slot uint64 `json:"slot"` - Constraints []*Constraint `ssz-max:"256" json:"constraints"` + Constraints []*Constraint `ssz-max:"1048576" json:"constraints"` } type Constraint struct { @@ -33,7 +38,7 @@ type Constraint struct { Index *Index `json:"index"` } -// For SSZ purposes, we consider `Index` as Union[uint64, None] +// Index is the Union[uint64, None] (For SSZ purposes) type Index uint64 func NewIndex(i uint64) *Index { From dcca705b7fa828f70c83a01877444b0fbb1f76a0 Mon Sep 17 00:00:00 2001 From: nicolas <48695862+merklefruit@users.noreply.github.com> Date: Tue, 6 Aug 2024 10:44:36 +0200 Subject: [PATCH 2/2] fix(relay): tx ssz max size --- mev-boost-relay/services/api/constraints.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mev-boost-relay/services/api/constraints.go b/mev-boost-relay/services/api/constraints.go index 230bc9e63..a58a49e99 100644 --- a/mev-boost-relay/services/api/constraints.go +++ b/mev-boost-relay/services/api/constraints.go @@ -34,7 +34,7 @@ type ConstraintsMessage struct { } type Constraint struct { - Tx Transaction `ssz-max:"1048576" json:"tx"` + Tx Transaction `ssz-max:"1073741824" json:"tx"` Index *Index `json:"index"` }