Skip to content
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

chore(mev-boost-relay): set SSZ max constraints per slot to the defau… #185

Merged
merged 2 commits into from
Aug 6, 2024
Merged
Changes from all 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
15 changes: 10 additions & 5 deletions mev-boost-relay/services/api/constraints.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand All @@ -25,15 +30,15 @@ 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 {
Tx Transaction `ssz-max:"1048576" json:"tx"`
Tx Transaction `ssz-max:"1073741824" json:"tx"`
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note: this value was wrong, however we only use JSON for this type currently.
We should either remove SSZ definitions for it or start using it.

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 {
Expand Down
Loading