From 2ef1864a386e1ef6da441c34a53cd9a87e948281 Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Thu, 4 Apr 2024 10:02:00 -0500 Subject: [PATCH 01/25] Replace go-*-client deps with electra forks --- go.mod | 14 ++++++++++---- go.sum | 20 ++++++++------------ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index f6d36d87..7c298dd7 100644 --- a/go.mod +++ b/go.mod @@ -61,7 +61,7 @@ require ( github.com/StackExchange/wmi v1.2.1 // indirect github.com/VictoriaMetrics/fastcache v1.12.1 // indirect github.com/attestantio/go-builder-client v0.4.2 - github.com/attestantio/go-eth2-client v0.19.10 + github.com/attestantio/go-eth2-client v0.21.1 github.com/btcsuite/btcd v0.22.0-beta // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect @@ -70,7 +70,7 @@ require ( github.com/ferranbt/fastssz v0.1.3 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect - github.com/klauspost/cpuid/v2 v2.2.6 // indirect + github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/mattn/go-runewidth v0.0.13 // indirect github.com/minio/sha256-simd v1.0.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect @@ -83,8 +83,14 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.25.0 // indirect - golang.org/x/crypto v0.18.0 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/crypto v0.21.0 // indirect + golang.org/x/sys v0.18.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +// git clone git@github.com:jtraglia/go-eth2-client.git -b electra +replace github.com/attestantio/go-eth2-client => ../../jtraglia/go-eth2-client + +// git clone git@github.com:jtraglia/go-builder-client.git -b electra +replace github.com/attestantio/go-builder-client => ../../jtraglia/go-builder-client diff --git a/go.sum b/go.sum index 0aa577d7..2a1a19f9 100644 --- a/go.sum +++ b/go.sum @@ -16,10 +16,6 @@ github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/attestantio/go-builder-client v0.4.2 h1:EycfAFqQV+ooc2z6hmTsbuH4TCLknr0aO0nHLHLMpJM= -github.com/attestantio/go-builder-client v0.4.2/go.mod h1:e02i/WO4fjs3/u9oIZEjiC8CK1Qyxy4cpiMMGKx4VqQ= -github.com/attestantio/go-eth2-client v0.19.10 h1:NLs9mcBvZpBTZ3du7Ey2NHQoj8d3UePY7pFBXX6C6qs= -github.com/attestantio/go-eth2-client v0.19.10/go.mod h1:TTz7YF6w4z6ahvxKiHuGPn6DbQn7gH6HPuWm/DEQeGE= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -223,8 +219,8 @@ github.com/klauspost/compress v1.9.7/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0 github.com/klauspost/compress v1.15.15 h1:EF27CXIuDsYJ6mmvtBRlEuB2UVOqHG1tAXgZ7yIO+lw= github.com/klauspost/compress v1.15.15/go.mod h1:ZcK2JAFqKOpnBlxcLsJzYfrS9X1akm9fHZNnD9+Vo/4= github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc= -github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= +github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -398,8 +394,8 @@ golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= -golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= @@ -431,8 +427,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= -golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -478,8 +474,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= From 46fb36159085047df17565ce81353c161f0d2e62 Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Thu, 4 Apr 2024 10:24:17 -0500 Subject: [PATCH 02/25] Add processElectraPayload --- server/mock_relay.go | 27 ++++++++ server/service.go | 162 ++++++++++++++++++++++++++++++++++++++++--- server/utils.go | 6 ++ 3 files changed, 187 insertions(+), 8 deletions(-) diff --git a/server/mock_relay.go b/server/mock_relay.go index fe6c6daa..6b4b3862 100644 --- a/server/mock_relay.go +++ b/server/mock_relay.go @@ -3,6 +3,7 @@ package server import ( "encoding/json" "fmt" + "github.com/attestantio/go-eth2-client/spec/electra" "net/http" "net/http/httptest" "net/url" @@ -13,6 +14,7 @@ import ( builderApi "github.com/attestantio/go-builder-client/api" builderApiCapella "github.com/attestantio/go-builder-client/api/capella" builderApiDeneb "github.com/attestantio/go-builder-client/api/deneb" + builderApiElectra "github.com/attestantio/go-builder-client/api/electra" builderApiV1 "github.com/attestantio/go-builder-client/api/v1" builderSpec "github.com/attestantio/go-builder-client/spec" "github.com/attestantio/go-eth2-client/spec" @@ -215,6 +217,31 @@ func (m *mockRelay) MakeGetHeaderResponse(value uint64, blockHash, parentHash, p Signature: signature, }, } + case spec.DataVersionElectra: + message := &builderApiElectra.BuilderBid{ + Header: &electra.ExecutionPayloadHeader{ + BlockHash: _HexToHash(blockHash), + ParentHash: _HexToHash(parentHash), + WithdrawalsRoot: phase0.Root{}, + BaseFeePerGas: uint256.NewInt(0), + ExitsRoot: phase0.Root{}, + }, + BlobKZGCommitments: make([]deneb.KZGCommitment, 0), + Value: uint256.NewInt(value), + Pubkey: _HexToPubkey(publicKey), + } + + // Sign the message. + signature, err := ssz.SignMessage(message, ssz.DomainBuilder, m.secretKey) + require.NoError(m.t, err) + + return &builderSpec.VersionedSignedBuilderBid{ + Version: spec.DataVersionElectra, + Electra: &builderApiElectra.SignedBuilderBid{ + Message: message, + Signature: signature, + }, + } case spec.DataVersionUnknown, spec.DataVersionPhase0, spec.DataVersionAltair, spec.DataVersionBellatrix: return nil } diff --git a/server/service.go b/server/service.go index 42a68aa8..34bd95b8 100644 --- a/server/service.go +++ b/server/service.go @@ -20,6 +20,7 @@ import ( builderSpec "github.com/attestantio/go-builder-client/spec" eth2ApiV1Capella "github.com/attestantio/go-eth2-client/api/v1/capella" eth2ApiV1Deneb "github.com/attestantio/go-eth2-client/api/v1/deneb" + eth2ApiV1Electra "github.com/attestantio/go-eth2-client/api/v1/electra" "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/flashbots/go-boost-utils/ssz" "github.com/flashbots/go-boost-utils/types" @@ -765,6 +766,146 @@ func (m *BoostService) processDenebPayload(w http.ResponseWriter, req *http.Requ m.respondOK(w, result) } +func (m *BoostService) processElectraPayload(w http.ResponseWriter, req *http.Request, log *logrus.Entry, blindedBlock *eth2ApiV1Electra.SignedBlindedBeaconBlock) { + // Get the currentSlotUID for this slot + currentSlotUID := "" + m.slotUIDLock.Lock() + if m.slotUID.slot == uint64(blindedBlock.Message.Slot) { + currentSlotUID = m.slotUID.uid.String() + } else { + log.Warnf("latest slotUID is for slot %d rather than payload slot %d", m.slotUID.slot, blindedBlock.Message.Slot) + } + m.slotUIDLock.Unlock() + + // Prepare logger + ua := UserAgent(req.Header.Get("User-Agent")) + log = log.WithFields(logrus.Fields{ + "ua": ua, + "slot": blindedBlock.Message.Slot, + "blockHash": blindedBlock.Message.Body.ExecutionPayloadHeader.BlockHash.String(), + "parentHash": blindedBlock.Message.Body.ExecutionPayloadHeader.ParentHash.String(), + "slotUID": currentSlotUID, + }) + + // Log how late into the slot the request starts + slotStartTimestamp := m.genesisTime + uint64(blindedBlock.Message.Slot)*config.SlotTimeSec + msIntoSlot := uint64(time.Now().UTC().UnixMilli()) - slotStartTimestamp*1000 + log.WithFields(logrus.Fields{ + "genesisTime": m.genesisTime, + "slotTimeSec": config.SlotTimeSec, + "msIntoSlot": msIntoSlot, + }).Infof("submitBlindedBlock request start - %d milliseconds into slot %d", msIntoSlot, blindedBlock.Message.Slot) + + // Get the bid! + bidKey := bidRespKey{slot: uint64(blindedBlock.Message.Slot), blockHash: blindedBlock.Message.Body.ExecutionPayloadHeader.BlockHash.String()} + m.bidsLock.Lock() + originalBid := m.bids[bidKey] + m.bidsLock.Unlock() + if originalBid.response.IsEmpty() { + log.Error("no bid for this getPayload payload found, was getHeader called before?") + } else if len(originalBid.relays) == 0 { + log.Warn("bid found but no associated relays") + } + + // Add request headers + headers := map[string]string{HeaderKeySlotUID: currentSlotUID} + + // Prepare for requests + var wg sync.WaitGroup + var mu sync.Mutex + result := new(builderApi.VersionedSubmitBlindedBlockResponse) + + // Prepare the request context, which will be cancelled after the first successful response from a relay + requestCtx, requestCtxCancel := context.WithCancel(context.Background()) + defer requestCtxCancel() + + for _, relay := range m.relays { + wg.Add(1) + go func(relay RelayEntry) { + defer wg.Done() + url := relay.GetURI(pathGetPayload) + log := log.WithField("url", url) + log.Debug("calling getPayload") + + responsePayload := new(builderApi.VersionedSubmitBlindedBlockResponse) + _, err := SendHTTPRequestWithRetries(requestCtx, m.httpClientGetPayload, http.MethodPost, url, ua, headers, blindedBlock, responsePayload, m.requestMaxRetries, log) + if err != nil { + if errors.Is(requestCtx.Err(), context.Canceled) { + log.Info("request was cancelled") // this is expected, if payload has already been received by another relay + } else { + log.WithError(err).Error("error making request to relay") + } + return + } + + if getPayloadResponseIsEmpty(responsePayload) { + log.Error("response with empty data!") + return + } + + payload := responsePayload.Electra.ExecutionPayload + blobs := responsePayload.Electra.BlobsBundle + + // Ensure the response blockhash matches the request + if blindedBlock.Message.Body.ExecutionPayloadHeader.BlockHash != payload.BlockHash { + log.WithFields(logrus.Fields{ + "responseBlockHash": payload.BlockHash.String(), + }).Error("requestBlockHash does not equal responseBlockHash") + return + } + + commitments := blindedBlock.Message.Body.BlobKZGCommitments + // Ensure that blobs are valid and matches the request + if len(commitments) != len(blobs.Blobs) || len(commitments) != len(blobs.Commitments) || len(commitments) != len(blobs.Proofs) { + log.WithFields(logrus.Fields{ + "requestBlobCommitments": len(commitments), + "responseBlobs": len(blobs.Blobs), + "responseBlobCommitments": len(blobs.Commitments), + "responseBlobProofs": len(blobs.Proofs), + }).Error("block KZG commitment length does not equal responseBlobs length") + return + } + + for i, commitment := range commitments { + if commitment != blobs.Commitments[i] { + log.WithFields(logrus.Fields{ + "requestBlobCommitment": commitment.String(), + "responseBlobCommitment": blobs.Commitments[i].String(), + "index": i, + }).Error("requestBlobCommitment does not equal responseBlobCommitment") + return + } + } + + // Lock before accessing the shared payload + mu.Lock() + defer mu.Unlock() + + if requestCtx.Err() != nil { // request has been cancelled (or deadline exceeded) + return + } + + // Received successful response. Now cancel other requests and return immediately + requestCtxCancel() + *result = *responsePayload + log.Info("received payload from relay") + }(relay) + } + + // Wait for all requests to complete... + wg.Wait() + + // If no payload has been received from relay, log loudly about withholding! + if getPayloadResponseIsEmpty(result) { + originRelays := RelayEntriesToStrings(originalBid.relays) + log.WithField("relaysWithBid", strings.Join(originRelays, ", ")).Error("no payload received from relay!") + m.respondError(w, http.StatusBadGateway, errNoSuccessfulRelayResponse.Error()) + return + } + + m.respondOK(w, result) +} + func (m *BoostService) handleGetPayload(w http.ResponseWriter, req *http.Request) { log := m.log.WithField("method", "getPayload") log.Debug("getPayload request starts") @@ -778,19 +919,24 @@ func (m *BoostService) handleGetPayload(w http.ResponseWriter, req *http.Request } // Decode the body now - payload := new(eth2ApiV1Deneb.SignedBlindedBeaconBlock) + payload := new(eth2ApiV1Electra.SignedBlindedBeaconBlock) if err := DecodeJSON(bytes.NewReader(body), payload); err != nil { - log.Debug("could not decode Deneb request payload, attempting to decode body into Capella payload") - payload := new(eth2ApiV1Capella.SignedBlindedBeaconBlock) + log.Debug("could not decode Electra request payload, attempting to decode body into Deneb payload") + payload := new(eth2ApiV1Deneb.SignedBlindedBeaconBlock) if err := DecodeJSON(bytes.NewReader(body), payload); err != nil { - log.WithError(err).WithField("body", string(body)).Error("could not decode request payload from the beacon-node (signed blinded beacon block)") - m.respondError(w, http.StatusBadRequest, err.Error()) + log.Debug("could not decode Deneb request payload, attempting to decode body into Capella payload") + payload := new(eth2ApiV1Capella.SignedBlindedBeaconBlock) + if err := DecodeJSON(bytes.NewReader(body), payload); err != nil { + log.WithError(err).WithField("body", string(body)).Error("could not decode request payload from the beacon-node (signed blinded beacon block)") + m.respondError(w, http.StatusBadRequest, err.Error()) + return + } + m.processCapellaPayload(w, req, log, payload, body) return } - m.processCapellaPayload(w, req, log, payload, body) - return + m.processDenebPayload(w, req, log, payload) } - m.processDenebPayload(w, req, log, payload) + m.processElectraPayload(w, req, log, payload) } // CheckRelays sends a request to each one of the relays previously registered to get their status diff --git a/server/utils.go b/server/utils.go index fb779d53..5ced008e 100644 --- a/server/utils.go +++ b/server/utils.go @@ -265,6 +265,12 @@ func getPayloadResponseIsEmpty(payload *builderApi.VersionedSubmitBlindedBlockRe payload.Deneb.BlobsBundle == nil { return true } + case spec.DataVersionElectra: + if payload.Electra == nil || payload.Electra.ExecutionPayload == nil || + payload.Electra.ExecutionPayload.BlockHash == nilHash || + payload.Electra.BlobsBundle == nil { + return true + } case spec.DataVersionUnknown, spec.DataVersionPhase0, spec.DataVersionAltair, spec.DataVersionBellatrix: return true } From 2dc7b8dd6028fbc63d54c073bdf21284002aebcb Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Mon, 8 Apr 2024 12:08:36 -0500 Subject: [PATCH 03/25] Run make fmt --- server/mock_relay.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/mock_relay.go b/server/mock_relay.go index 6b4b3862..c216dbe9 100644 --- a/server/mock_relay.go +++ b/server/mock_relay.go @@ -3,7 +3,6 @@ package server import ( "encoding/json" "fmt" - "github.com/attestantio/go-eth2-client/spec/electra" "net/http" "net/http/httptest" "net/url" @@ -20,6 +19,7 @@ import ( "github.com/attestantio/go-eth2-client/spec" "github.com/attestantio/go-eth2-client/spec/capella" "github.com/attestantio/go-eth2-client/spec/deneb" + "github.com/attestantio/go-eth2-client/spec/electra" "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/flashbots/go-boost-utils/bls" From 81bbbe13943bda0ad8fefa5ffc724e082b8c6631 Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Wed, 10 Apr 2024 09:36:24 -0500 Subject: [PATCH 04/25] Replace Exits with WithdrawRequests --- server/mock_relay.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/mock_relay.go b/server/mock_relay.go index c216dbe9..e6049053 100644 --- a/server/mock_relay.go +++ b/server/mock_relay.go @@ -220,11 +220,11 @@ func (m *mockRelay) MakeGetHeaderResponse(value uint64, blockHash, parentHash, p case spec.DataVersionElectra: message := &builderApiElectra.BuilderBid{ Header: &electra.ExecutionPayloadHeader{ - BlockHash: _HexToHash(blockHash), - ParentHash: _HexToHash(parentHash), - WithdrawalsRoot: phase0.Root{}, - BaseFeePerGas: uint256.NewInt(0), - ExitsRoot: phase0.Root{}, + BlockHash: _HexToHash(blockHash), + ParentHash: _HexToHash(parentHash), + WithdrawalsRoot: phase0.Root{}, + BaseFeePerGas: uint256.NewInt(0), + WithdrawRequestsRoot: phase0.Root{}, }, BlobKZGCommitments: make([]deneb.KZGCommitment, 0), Value: uint256.NewInt(value), From 7f03715bf93b99a2ecf5ca4e1cf1c0b7872a1719 Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Sat, 27 Apr 2024 09:03:11 -0500 Subject: [PATCH 05/25] Rename WithdrawRequest to WithdrawalRequest --- server/mock_relay.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/mock_relay.go b/server/mock_relay.go index e6049053..60f1e88a 100644 --- a/server/mock_relay.go +++ b/server/mock_relay.go @@ -220,11 +220,11 @@ func (m *mockRelay) MakeGetHeaderResponse(value uint64, blockHash, parentHash, p case spec.DataVersionElectra: message := &builderApiElectra.BuilderBid{ Header: &electra.ExecutionPayloadHeader{ - BlockHash: _HexToHash(blockHash), - ParentHash: _HexToHash(parentHash), - WithdrawalsRoot: phase0.Root{}, - BaseFeePerGas: uint256.NewInt(0), - WithdrawRequestsRoot: phase0.Root{}, + BlockHash: _HexToHash(blockHash), + ParentHash: _HexToHash(parentHash), + WithdrawalsRoot: phase0.Root{}, + BaseFeePerGas: uint256.NewInt(0), + WithdrawalRequestsRoot: phase0.Root{}, }, BlobKZGCommitments: make([]deneb.KZGCommitment, 0), Value: uint256.NewInt(value), From bbb66c02d2218ae8cdd204565d81b0f2169bd42d Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Mon, 29 Apr 2024 15:25:54 -0500 Subject: [PATCH 06/25] Run go mod tidy --- go.mod | 8 ++++---- go.sum | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 7c298dd7..7744d3b0 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/google/uuid v1.6.0 github.com/gorilla/mux v1.8.1 github.com/holiman/uint256 v1.2.4 - github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7 + github.com/prysmaticlabs/go-bitfield v0.0.0-20240328144219-a1caa50c3a1e github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.8.4 ) @@ -31,7 +31,7 @@ require ( github.com/fatih/color v1.16.0 // indirect github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect github.com/getsentry/sentry-go v0.18.0 // indirect - github.com/goccy/go-yaml v1.11.2 // indirect + github.com/goccy/go-yaml v1.11.3 // indirect github.com/gofrs/flock v0.8.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.3 // indirect @@ -83,8 +83,8 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.25.0 // indirect - golang.org/x/crypto v0.21.0 // indirect - golang.org/x/sys v0.18.0 // indirect + golang.org/x/crypto v0.22.0 // indirect + golang.org/x/sys v0.19.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 2a1a19f9..2c490d4c 100644 --- a/go.sum +++ b/go.sum @@ -132,8 +132,8 @@ github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4 github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= -github.com/goccy/go-yaml v1.11.2 h1:joq77SxuyIs9zzxEjgyLBugMQ9NEgTWxXfz2wVqwAaQ= -github.com/goccy/go-yaml v1.11.2/go.mod h1:wKnAMd44+9JAAnGQpWVEgBzGt3YuTaQ4uXoHvE4m7WU= +github.com/goccy/go-yaml v1.11.3 h1:B3W9IdWbvrUu2OYQGwvU1nZtvMQJPBKgBUuweJjLj6I= +github.com/goccy/go-yaml v1.11.3/go.mod h1:wKnAMd44+9JAAnGQpWVEgBzGt3YuTaQ4uXoHvE4m7WU= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= @@ -310,8 +310,8 @@ github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= -github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7 h1:0tVE4tdWQK9ZpYygoV7+vS6QkDvQVySboMVEIxBJmXw= -github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7/go.mod h1:wmuf/mdK4VMD+jA9ThwcUKjg3a2XWM9cVfFYjDyY4j4= +github.com/prysmaticlabs/go-bitfield v0.0.0-20240328144219-a1caa50c3a1e h1:ATgOe+abbzfx9kCPeXIW4fiWyDdxlwHw07j8UGhdTd4= +github.com/prysmaticlabs/go-bitfield v0.0.0-20240328144219-a1caa50c3a1e/go.mod h1:wmuf/mdK4VMD+jA9ThwcUKjg3a2XWM9cVfFYjDyY4j4= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= @@ -394,8 +394,8 @@ golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= -golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= @@ -474,8 +474,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= From 9442e53756d98270d1923385ad45b4f946c8f9d0 Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Thu, 9 May 2024 08:43:43 -0500 Subject: [PATCH 07/25] Use go-*-client@electra --- go.mod | 10 ++-------- go.sum | 4 ++++ server/mock/mock_relay.go | 6 +++--- server/service.go | 6 +++--- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/go.mod b/go.mod index 5cb04a42..4ed08014 100644 --- a/go.mod +++ b/go.mod @@ -59,8 +59,8 @@ require ( require ( github.com/StackExchange/wmi v1.2.1 // indirect - github.com/attestantio/go-builder-client v0.4.2 - github.com/attestantio/go-eth2-client v0.21.1 + github.com/attestantio/go-builder-client v0.4.6-0.20240508205504-2210689d2f24 + github.com/attestantio/go-eth2-client v0.21.4-0.20240508205406-66fbb02e3c16 github.com/btcsuite/btcd v0.22.0-beta // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect @@ -87,9 +87,3 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) - -// git clone git@github.com:jtraglia/go-eth2-client.git -b electra -replace github.com/attestantio/go-eth2-client => ../../jtraglia/go-eth2-client - -// git clone git@github.com:jtraglia/go-builder-client.git -b electra -replace github.com/attestantio/go-builder-client => ../../jtraglia/go-builder-client diff --git a/go.sum b/go.sum index 80bc000f..01802a67 100644 --- a/go.sum +++ b/go.sum @@ -14,6 +14,10 @@ github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWk github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/attestantio/go-builder-client v0.4.6-0.20240508205504-2210689d2f24 h1:KXWQwsxrrJD1G7rp+18uESZ0BSPmUdady46iAfCgwDY= +github.com/attestantio/go-builder-client v0.4.6-0.20240508205504-2210689d2f24/go.mod h1:bs7HF4beRWCjcvKsHH8nEl3aDzrTqeUjXOfqpfrYTJQ= +github.com/attestantio/go-eth2-client v0.21.4-0.20240508205406-66fbb02e3c16 h1:gwMEOhFdbmCJy5olyRtGPmM4RoIXo6v2HkbKt7YpPr4= +github.com/attestantio/go-eth2-client v0.21.4-0.20240508205406-66fbb02e3c16/go.mod h1:Ht9tN0WlhpgIWWO7Hqfi3/nq2rUGQv/zCd/BMI93a84= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= diff --git a/server/mock/mock_relay.go b/server/mock/mock_relay.go index e6d67aa1..b186da02 100644 --- a/server/mock/mock_relay.go +++ b/server/mock/mock_relay.go @@ -224,15 +224,15 @@ func (m *Relay) MakeGetHeaderResponse(value uint64, blockHash, parentHash, publi case spec.DataVersionElectra: message := &builderApiElectra.BuilderBid{ Header: &electra.ExecutionPayloadHeader{ - BlockHash: _HexToHash(blockHash), - ParentHash: _HexToHash(parentHash), + BlockHash: HexToHash(blockHash), + ParentHash: HexToHash(parentHash), WithdrawalsRoot: phase0.Root{}, BaseFeePerGas: uint256.NewInt(0), WithdrawalRequestsRoot: phase0.Root{}, }, BlobKZGCommitments: make([]deneb.KZGCommitment, 0), Value: uint256.NewInt(value), - Pubkey: _HexToPubkey(publicKey), + Pubkey: HexToPubkey(publicKey), } // Sign the message. diff --git a/server/service.go b/server/service.go index cb717a20..fbcfb67c 100644 --- a/server/service.go +++ b/server/service.go @@ -822,9 +822,9 @@ func (m *BoostService) processElectraPayload(w http.ResponseWriter, req *http.Re for _, relay := range m.relays { wg.Add(1) - go func(relay RelayEntry) { + go func(relay types.RelayEntry) { defer wg.Done() - url := relay.GetURI(pathGetPayload) + url := relay.GetURI(params.PathGetPayload) log := log.WithField("url", url) log.Debug("calling getPayload") @@ -898,7 +898,7 @@ func (m *BoostService) processElectraPayload(w http.ResponseWriter, req *http.Re // If no payload has been received from relay, log loudly about withholding! if getPayloadResponseIsEmpty(result) { - originRelays := RelayEntriesToStrings(originalBid.relays) + originRelays := types.RelayEntriesToStrings(originalBid.relays) log.WithField("relaysWithBid", strings.Join(originRelays, ", ")).Error("no payload received from relay!") m.respondError(w, http.StatusBadGateway, errNoSuccessfulRelayResponse.Error()) return From 3a1b7f6ef204d1c9a4dedf26ee59e19ce8725d04 Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Fri, 17 May 2024 16:10:53 +0300 Subject: [PATCH 08/25] Upgrade go-eth2-client --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 4ed08014..9e45b1e9 100644 --- a/go.mod +++ b/go.mod @@ -60,7 +60,7 @@ require ( require ( github.com/StackExchange/wmi v1.2.1 // indirect github.com/attestantio/go-builder-client v0.4.6-0.20240508205504-2210689d2f24 - github.com/attestantio/go-eth2-client v0.21.4-0.20240508205406-66fbb02e3c16 + github.com/attestantio/go-eth2-client v0.21.4-0.20240517101940-c13fd7112c55 github.com/btcsuite/btcd v0.22.0-beta // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect diff --git a/go.sum b/go.sum index 01802a67..1bcbba6a 100644 --- a/go.sum +++ b/go.sum @@ -16,8 +16,8 @@ github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/attestantio/go-builder-client v0.4.6-0.20240508205504-2210689d2f24 h1:KXWQwsxrrJD1G7rp+18uESZ0BSPmUdady46iAfCgwDY= github.com/attestantio/go-builder-client v0.4.6-0.20240508205504-2210689d2f24/go.mod h1:bs7HF4beRWCjcvKsHH8nEl3aDzrTqeUjXOfqpfrYTJQ= -github.com/attestantio/go-eth2-client v0.21.4-0.20240508205406-66fbb02e3c16 h1:gwMEOhFdbmCJy5olyRtGPmM4RoIXo6v2HkbKt7YpPr4= -github.com/attestantio/go-eth2-client v0.21.4-0.20240508205406-66fbb02e3c16/go.mod h1:Ht9tN0WlhpgIWWO7Hqfi3/nq2rUGQv/zCd/BMI93a84= +github.com/attestantio/go-eth2-client v0.21.4-0.20240517101940-c13fd7112c55 h1:3HjnisE8nFHBhf20H4ya9Q+4HvX1bbV8lCM6LJLLcg0= +github.com/attestantio/go-eth2-client v0.21.4-0.20240517101940-c13fd7112c55/go.mod h1:RssbJ8txdfZ+O7cIjOKCvizcTWHzgPuJNByrwtQ6tBQ= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= From 9c885d1841b1f118a9857791391754a706af2a57 Mon Sep 17 00:00:00 2001 From: avalonche Date: Tue, 6 Aug 2024 10:39:43 +1000 Subject: [PATCH 09/25] update deps --- go.mod | 10 +++++----- go.sum | 20 ++++++++++---------- server/service_test.go | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index 9e45b1e9..b81a16d8 100644 --- a/go.mod +++ b/go.mod @@ -51,7 +51,7 @@ require ( github.com/supranational/blst v0.3.11 // indirect golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect golang.org/x/sync v0.5.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/text v0.15.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/protobuf v1.30.0 // indirect rsc.io/tmplfunc v0.0.3 // indirect @@ -59,8 +59,8 @@ require ( require ( github.com/StackExchange/wmi v1.2.1 // indirect - github.com/attestantio/go-builder-client v0.4.6-0.20240508205504-2210689d2f24 - github.com/attestantio/go-eth2-client v0.21.4-0.20240517101940-c13fd7112c55 + github.com/attestantio/go-builder-client v0.5.1-0.20240804084948-e06dcb494024 + github.com/attestantio/go-eth2-client v0.21.11-0.20240803084815-07eba3e76a14 github.com/btcsuite/btcd v0.22.0-beta // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect @@ -82,8 +82,8 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.25.0 // indirect - golang.org/x/crypto v0.22.0 // indirect - golang.org/x/sys v0.19.0 // indirect + golang.org/x/crypto v0.23.0 // indirect + golang.org/x/sys v0.20.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 1bcbba6a..85b82b0a 100644 --- a/go.sum +++ b/go.sum @@ -14,10 +14,10 @@ github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWk github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/attestantio/go-builder-client v0.4.6-0.20240508205504-2210689d2f24 h1:KXWQwsxrrJD1G7rp+18uESZ0BSPmUdady46iAfCgwDY= -github.com/attestantio/go-builder-client v0.4.6-0.20240508205504-2210689d2f24/go.mod h1:bs7HF4beRWCjcvKsHH8nEl3aDzrTqeUjXOfqpfrYTJQ= -github.com/attestantio/go-eth2-client v0.21.4-0.20240517101940-c13fd7112c55 h1:3HjnisE8nFHBhf20H4ya9Q+4HvX1bbV8lCM6LJLLcg0= -github.com/attestantio/go-eth2-client v0.21.4-0.20240517101940-c13fd7112c55/go.mod h1:RssbJ8txdfZ+O7cIjOKCvizcTWHzgPuJNByrwtQ6tBQ= +github.com/attestantio/go-builder-client v0.5.1-0.20240804084948-e06dcb494024 h1:jJXtY57BeRnwBuEO1VuSUA8lXyG/p91+6pTJissw/Io= +github.com/attestantio/go-builder-client v0.5.1-0.20240804084948-e06dcb494024/go.mod h1:jkCVVMh1l98Vor3JYAAj2Ru+oFwfuZN/UjXw83gI86U= +github.com/attestantio/go-eth2-client v0.21.11-0.20240803084815-07eba3e76a14 h1:4eDRCMSJU+iMwL5I2cYdwha1So20xBG8xD557o5TlD4= +github.com/attestantio/go-eth2-client v0.21.11-0.20240803084815-07eba3e76a14/go.mod h1:vy5jU/uDZ2+RcVzq5BfnG+bQ3/6uu9DGwCrGsPtjJ1A= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -396,8 +396,8 @@ golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= -golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= @@ -477,8 +477,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= -golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -486,8 +486,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/server/service_test.go b/server/service_test.go index 47d418aa..5ba7f616 100644 --- a/server/service_test.go +++ b/server/service_test.go @@ -208,7 +208,7 @@ func TestWebserverMaxHeaderSize(t *testing.T) { backend.boost.listenAddr = addr go func() { err := backend.boost.StartHTTPServer() - require.NoError(t, err) //nolint:testifylint + require.NoError(t, err) }() time.Sleep(time.Millisecond * 100) path := "http://" + addr + "?" + strings.Repeat("abc", 4000) // path with characters of size over 4kb From dc8c351d5fcc22098649d9804f80dc8419be7c9a Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Wed, 25 Sep 2024 12:04:59 -0500 Subject: [PATCH 10/25] Add t.Helper() call --- server/service_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/server/service_test.go b/server/service_test.go index 870faa56..5a47c134 100644 --- a/server/service_test.go +++ b/server/service_test.go @@ -187,6 +187,7 @@ func TestWebserverMaxHeaderSize(t *testing.T) { addr := "localhost:1234" backend.boost.listenAddr = addr go func() { + t.Helper() err := backend.boost.StartHTTPServer() require.NoError(t, err) }() From e5500c0ce2e2df2bafb80069d1574808e8828563 Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Wed, 25 Sep 2024 12:14:11 -0500 Subject: [PATCH 11/25] Add back nolint comment --- server/service_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/service_test.go b/server/service_test.go index 5a47c134..65a20324 100644 --- a/server/service_test.go +++ b/server/service_test.go @@ -187,9 +187,8 @@ func TestWebserverMaxHeaderSize(t *testing.T) { addr := "localhost:1234" backend.boost.listenAddr = addr go func() { - t.Helper() err := backend.boost.StartHTTPServer() - require.NoError(t, err) + require.NoError(t, err) //nolint:testifylint }() time.Sleep(time.Millisecond * 100) path := "http://" + addr + "?" + strings.Repeat("abc", 4000) // path with characters of size over 4kb From b357ec3f9544dcf037e0e4a2432914fcffb2e5cb Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Wed, 25 Sep 2024 14:48:27 -0500 Subject: [PATCH 12/25] Replace attestantio/go-*-client deps --- .golangci.yml | 6 +++++- go.mod | 26 ++++++++++++++--------- go.sum | 44 +++++++++++++++++++-------------------- server/mock/mock_relay.go | 17 +++++++-------- server/service.go | 4 ++-- 5 files changed, 52 insertions(+), 45 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 64a2d5c5..1d4836e0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -62,7 +62,11 @@ linters-settings: enable-all: true disable: - fieldalignment - - shadow + - shadientow + gomoddirectives: + replace-allow-list: + - github.com/attestantio/go-builder-client + - github.com/attestantio/go-eth2-client output: print-issued-lines: true diff --git a/go.mod b/go.mod index 082cf417..4577b782 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,10 @@ module github.com/flashbots/mev-boost -go 1.21 +go 1.22 require ( - github.com/ethereum/go-ethereum v1.14.7 - github.com/flashbots/go-boost-utils v1.8.1 + github.com/ethereum/go-ethereum v1.14.9 + github.com/flashbots/go-boost-utils v1.8.2-0.20240925192624-22f090f9547b github.com/flashbots/go-utils v0.5.0 github.com/google/uuid v1.6.0 github.com/gorilla/mux v1.8.1 @@ -18,11 +18,11 @@ require ( require ( github.com/DataDog/zstd v1.5.2 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/bits-and-blooms/bitset v1.10.0 // indirect + github.com/bits-and-blooms/bitset v1.13.0 // indirect github.com/cockroachdb/errors v1.11.3 // indirect github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/pebble v1.1.1 // indirect + github.com/cockroachdb/pebble v1.1.2 // indirect github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/consensys/bavard v0.1.13 // indirect @@ -30,10 +30,10 @@ require ( github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect github.com/ethereum/c-kzg-4844 v1.0.0 // indirect - github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 // indirect + github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 // indirect github.com/fatih/color v1.16.0 // indirect github.com/getsentry/sentry-go v0.27.0 // indirect - github.com/goccy/go-yaml v1.11.2 // indirect + github.com/goccy/go-yaml v1.11.3 // indirect github.com/gofrs/flock v0.8.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.4 // indirect @@ -56,7 +56,7 @@ require ( golang.org/x/sync v0.7.0 // indirect golang.org/x/text v0.15.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/protobuf v1.34.2 // indirect rsc.io/tmplfunc v0.0.3 // indirect ) @@ -65,7 +65,7 @@ require ( github.com/attestantio/go-builder-client v0.5.1-0.20240804084948-e06dcb494024 github.com/attestantio/go-eth2-client v0.21.11-0.20240803084815-07eba3e76a14 github.com/btcsuite/btcd v0.22.0-beta // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect @@ -86,7 +86,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.25.0 // indirect golang.org/x/crypto v0.23.0 // indirect - golang.org/x/sys v0.20.0 // indirect + golang.org/x/sys v0.22.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +// Remove this when Jim merges pk910's PR. +replace github.com/attestantio/go-eth2-client => github.com/pk910/go-eth2-client v0.0.0-20240923174943-8d64565c83ca + +// Remove this when Jim merge's jtraglia's PR. +replace github.com/attestantio/go-builder-client => github.com/jtraglia/go-builder-client v0.4.6-0.20240925183257-4d86495441b5 diff --git a/go.sum b/go.sum index 345eae44..fd53a98c 100644 --- a/go.sum +++ b/go.sum @@ -5,21 +5,17 @@ github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9 github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/attestantio/go-builder-client v0.5.1-0.20240804084948-e06dcb494024 h1:jJXtY57BeRnwBuEO1VuSUA8lXyG/p91+6pTJissw/Io= -github.com/attestantio/go-builder-client v0.5.1-0.20240804084948-e06dcb494024/go.mod h1:jkCVVMh1l98Vor3JYAAj2Ru+oFwfuZN/UjXw83gI86U= -github.com/attestantio/go-eth2-client v0.21.11-0.20240803084815-07eba3e76a14 h1:4eDRCMSJU+iMwL5I2cYdwha1So20xBG8xD557o5TlD4= -github.com/attestantio/go-eth2-client v0.21.11-0.20240803084815-07eba3e76a14/go.mod h1:vy5jU/uDZ2+RcVzq5BfnG+bQ3/6uu9DGwCrGsPtjJ1A= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bits-and-blooms/bitset v1.10.0 h1:ePXTeiPEazB5+opbv5fr8umg2R/1NlzgDsyepwsSr88= -github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE= +github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta h1:LTDpDKUM5EeOFBPM8IXpinEcmZ6FWfNZbE3lfrfdnWo= github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA= -github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= -github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= +github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= @@ -40,8 +36,8 @@ github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce h1:giXvy4KSc/6g/e github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= -github.com/cockroachdb/pebble v1.1.1 h1:XnKU22oiCLy2Xn8vp1re67cXg4SAasg/WDt1NtcRFaw= -github.com/cockroachdb/pebble v1.1.1/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU= +github.com/cockroachdb/pebble v1.1.2 h1:CUh2IPtR4swHlEj48Rhfzw6l/d0qA31fItcIszQVIsA= +github.com/cockroachdb/pebble v1.1.2/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU= github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= @@ -66,16 +62,16 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3 github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA= github.com/ethereum/c-kzg-4844 v1.0.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= -github.com/ethereum/go-ethereum v1.14.7 h1:EHpv3dE8evQmpVEQ/Ne2ahB06n2mQptdwqaMNhAT29g= -github.com/ethereum/go-ethereum v1.14.7/go.mod h1:Mq0biU2jbdmKSZoqOj29017ygFrMnB5/Rifwp980W4o= -github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 h1:KrE8I4reeVvf7C1tm8elRjj4BdscTYzz/WAbYyf/JI4= -github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0/go.mod h1:D9AJLVXSyZQXJQVk8oh1EwjISE+sJTn2duYIZC0dy3w= +github.com/ethereum/go-ethereum v1.14.9 h1:J7iwXDrtUyE9FUjUYbd4c9tyzwMh6dTJsKzo9i6SrwA= +github.com/ethereum/go-ethereum v1.14.9/go.mod h1:QeW+MtTpRdBEm2pUFoonByee8zfHv7kGp0wK0odvU1I= +github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 h1:8NfxH2iXvJ60YRB8ChToFTUzl8awsc3cJ8CbLjGIl/A= +github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/ferranbt/fastssz v0.1.3 h1:ZI+z3JH05h4kgmFXdHuR1aWYsgrg7o+Fw7/NCzM16Mo= github.com/ferranbt/fastssz v0.1.3/go.mod h1:0Y9TEd/9XuFlh7mskMPfXiI2Dkw4Ddg9EyXt1W7MRvE= -github.com/flashbots/go-boost-utils v1.8.1 h1:AD+1+4oCbBjXLK8IqWHYznD95K6/MmqXhozv5fFOCkU= -github.com/flashbots/go-boost-utils v1.8.1/go.mod h1:jFi2H1el7jGPr2ShkWpYPfKsY9vwsFNmBPJRCO7IPg8= +github.com/flashbots/go-boost-utils v1.8.2-0.20240925192624-22f090f9547b h1:9+UzY/5mZUW+WKVjL9BoxU5pHwkYRjA5vgNupJBo7eo= +github.com/flashbots/go-boost-utils v1.8.2-0.20240925192624-22f090f9547b/go.mod h1:2wQllIWEnjcZLz8VDzVvDcQCYYWIAKXAchWrfNL/ZMQ= github.com/flashbots/go-utils v0.5.0 h1:ldjWta9B9//DJU2QcwRbErez3+1aKhSn6EoFc6d5kPY= github.com/flashbots/go-utils v0.5.0/go.mod h1:LauDwifaRdSK0mS5X34GR59pJtUu1T/lOFNdff1BqtI= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -95,8 +91,8 @@ github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/j github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= -github.com/goccy/go-yaml v1.11.2 h1:joq77SxuyIs9zzxEjgyLBugMQ9NEgTWxXfz2wVqwAaQ= -github.com/goccy/go-yaml v1.11.2/go.mod h1:wKnAMd44+9JAAnGQpWVEgBzGt3YuTaQ4uXoHvE4m7WU= +github.com/goccy/go-yaml v1.11.3 h1:B3W9IdWbvrUu2OYQGwvU1nZtvMQJPBKgBUuweJjLj6I= +github.com/goccy/go-yaml v1.11.3/go.mod h1:wKnAMd44+9JAAnGQpWVEgBzGt3YuTaQ4uXoHvE4m7WU= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= @@ -134,6 +130,8 @@ github.com/huandu/go-clone/generic v1.6.0/go.mod h1:xgd9ZebcMsBWWcBx5mVMCoqMX24g github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/jtraglia/go-builder-client v0.4.6-0.20240925183257-4d86495441b5 h1:1W/Cz544b7FmjTn/5dB8obNDAFuRdRsywWJgOmxz5mU= +github.com/jtraglia/go-builder-client v0.4.6-0.20240925183257-4d86495441b5/go.mod h1:lPd6wgiraLD0umFeiCjYaqoMLeU2b3dMATOJ9B/jnIA= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= @@ -184,6 +182,8 @@ github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pk910/go-eth2-client v0.0.0-20240923174943-8d64565c83ca h1:rc6VVR79GdE58Wx1Arh9QNo+0qmXOfYjWQhrbkSeoI0= +github.com/pk910/go-eth2-client v0.0.0-20240923174943-8d64565c83ca/go.mod h1:vy5jU/uDZ2+RcVzq5BfnG+bQ3/6uu9DGwCrGsPtjJ1A= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -283,8 +283,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -306,8 +306,8 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/server/mock/mock_relay.go b/server/mock/mock_relay.go index c08c7783..e9d5e4cf 100644 --- a/server/mock/mock_relay.go +++ b/server/mock/mock_relay.go @@ -12,13 +12,11 @@ import ( builderApi "github.com/attestantio/go-builder-client/api" builderApiDeneb "github.com/attestantio/go-builder-client/api/deneb" - builderApiElectra "github.com/attestantio/go-builder-client/api/electra" builderApiV1 "github.com/attestantio/go-builder-client/api/v1" builderSpec "github.com/attestantio/go-builder-client/spec" "github.com/attestantio/go-eth2-client/spec" "github.com/attestantio/go-eth2-client/spec/capella" "github.com/attestantio/go-eth2-client/spec/deneb" - "github.com/attestantio/go-eth2-client/spec/electra" "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/flashbots/go-boost-utils/bls" @@ -198,13 +196,12 @@ func (m *Relay) MakeGetHeaderResponse(value uint64, blockHash, parentHash, publi }, } case spec.DataVersionElectra: - message := &builderApiElectra.BuilderBid{ - Header: &electra.ExecutionPayloadHeader{ - BlockHash: HexToHash(blockHash), - ParentHash: HexToHash(parentHash), - WithdrawalsRoot: phase0.Root{}, - BaseFeePerGas: uint256.NewInt(0), - WithdrawalRequestsRoot: phase0.Root{}, + message := &builderApiDeneb.BuilderBid{ + Header: &deneb.ExecutionPayloadHeader{ + BlockHash: HexToHash(blockHash), + ParentHash: HexToHash(parentHash), + WithdrawalsRoot: phase0.Root{}, + BaseFeePerGas: uint256.NewInt(0), }, BlobKZGCommitments: make([]deneb.KZGCommitment, 0), Value: uint256.NewInt(value), @@ -217,7 +214,7 @@ func (m *Relay) MakeGetHeaderResponse(value uint64, blockHash, parentHash, publi return &builderSpec.VersionedSignedBuilderBid{ Version: spec.DataVersionElectra, - Electra: &builderApiElectra.SignedBuilderBid{ + Electra: &builderApiDeneb.SignedBuilderBid{ Message: message, Signature: signature, }, diff --git a/server/service.go b/server/service.go index eef78fcb..6d62b723 100644 --- a/server/service.go +++ b/server/service.go @@ -709,8 +709,8 @@ func (m *BoostService) processElectraPayload(w http.ResponseWriter, req *http.Re return } - payload := responsePayload.Electra.ExecutionPayload - blobs := responsePayload.Electra.BlobsBundle + payload := responsePayload.Deneb.ExecutionPayload + blobs := responsePayload.Deneb.BlobsBundle // Ensure the response blockhash matches the request if blindedBlock.Message.Body.ExecutionPayloadHeader.BlockHash != payload.BlockHash { From bb4a5860b887c240e2addae005dab62f49a60e59 Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Wed, 25 Sep 2024 14:56:50 -0500 Subject: [PATCH 13/25] Fix accidental change --- .golangci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 1d4836e0..16e3adbd 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -62,7 +62,7 @@ linters-settings: enable-all: true disable: - fieldalignment - - shadientow + - shadow gomoddirectives: replace-allow-list: - github.com/attestantio/go-builder-client From c502e85c0c19d5d80fa4f7663d44448424436bae Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Wed, 25 Sep 2024 17:40:57 -0500 Subject: [PATCH 14/25] Update go-boost-utils --- go.mod | 6 +++--- go.sum | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 4577b782..86fbdb0c 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.22 require ( github.com/ethereum/go-ethereum v1.14.9 - github.com/flashbots/go-boost-utils v1.8.2-0.20240925192624-22f090f9547b + github.com/flashbots/go-boost-utils v1.8.2-0.20240925223941-58709124077d github.com/flashbots/go-utils v0.5.0 github.com/google/uuid v1.6.0 github.com/gorilla/mux v1.8.1 @@ -62,8 +62,8 @@ require ( require ( github.com/StackExchange/wmi v1.2.1 // indirect - github.com/attestantio/go-builder-client v0.5.1-0.20240804084948-e06dcb494024 - github.com/attestantio/go-eth2-client v0.21.11-0.20240803084815-07eba3e76a14 + github.com/attestantio/go-builder-client v0.5.1-0.20240925223414-5da8987dd6f3 + github.com/attestantio/go-eth2-client v0.21.12-0.20240925220056-393fff117304 github.com/btcsuite/btcd v0.22.0-beta // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect diff --git a/go.sum b/go.sum index fd53a98c..fb65b33b 100644 --- a/go.sum +++ b/go.sum @@ -70,8 +70,8 @@ github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/ferranbt/fastssz v0.1.3 h1:ZI+z3JH05h4kgmFXdHuR1aWYsgrg7o+Fw7/NCzM16Mo= github.com/ferranbt/fastssz v0.1.3/go.mod h1:0Y9TEd/9XuFlh7mskMPfXiI2Dkw4Ddg9EyXt1W7MRvE= -github.com/flashbots/go-boost-utils v1.8.2-0.20240925192624-22f090f9547b h1:9+UzY/5mZUW+WKVjL9BoxU5pHwkYRjA5vgNupJBo7eo= -github.com/flashbots/go-boost-utils v1.8.2-0.20240925192624-22f090f9547b/go.mod h1:2wQllIWEnjcZLz8VDzVvDcQCYYWIAKXAchWrfNL/ZMQ= +github.com/flashbots/go-boost-utils v1.8.2-0.20240925223941-58709124077d h1:O4iDEwTCD7MaDyccFzmV5yYXfDD99Y2KH284Z4ZR4q0= +github.com/flashbots/go-boost-utils v1.8.2-0.20240925223941-58709124077d/go.mod h1:kU1G5Xk2OBBnYag2RGRuaPuMuuhH2yZx+xHeX91E9Po= github.com/flashbots/go-utils v0.5.0 h1:ldjWta9B9//DJU2QcwRbErez3+1aKhSn6EoFc6d5kPY= github.com/flashbots/go-utils v0.5.0/go.mod h1:LauDwifaRdSK0mS5X34GR59pJtUu1T/lOFNdff1BqtI= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= From e7c0cc7a47b74a695f8d754c3e7b5d72d4c02d0e Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Mon, 7 Oct 2024 12:37:37 -0500 Subject: [PATCH 15/25] Update go-eth2-client for alpha.7 support --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 86fbdb0c..fc07fca3 100644 --- a/go.mod +++ b/go.mod @@ -63,7 +63,7 @@ require ( require ( github.com/StackExchange/wmi v1.2.1 // indirect github.com/attestantio/go-builder-client v0.5.1-0.20240925223414-5da8987dd6f3 - github.com/attestantio/go-eth2-client v0.21.12-0.20240925220056-393fff117304 + github.com/attestantio/go-eth2-client v0.21.12-0.20241006200801-8fa702e3a895 github.com/btcsuite/btcd v0.22.0-beta // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect From 1adf26a4c143baca37bd0560f7e7fafb16bfee6b Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Mon, 14 Oct 2024 15:17:00 -0500 Subject: [PATCH 16/25] Fix mistake --- server/service.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/service.go b/server/service.go index 6d62b723..eef78fcb 100644 --- a/server/service.go +++ b/server/service.go @@ -709,8 +709,8 @@ func (m *BoostService) processElectraPayload(w http.ResponseWriter, req *http.Re return } - payload := responsePayload.Deneb.ExecutionPayload - blobs := responsePayload.Deneb.BlobsBundle + payload := responsePayload.Electra.ExecutionPayload + blobs := responsePayload.Electra.BlobsBundle // Ensure the response blockhash matches the request if blindedBlock.Message.Body.ExecutionPayloadHeader.BlockHash != payload.BlockHash { From 097756d921f81ba2ed8affb526f4c387cafc124d Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Mon, 14 Oct 2024 15:59:00 -0500 Subject: [PATCH 17/25] Update & reverse payload decoding order --- go.mod | 8 +------- go.sum | 12 ++++++------ server/service.go | 27 +++++++++++++++++++++------ 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/go.mod b/go.mod index fc07fca3..019a283a 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.22 require ( github.com/ethereum/go-ethereum v1.14.9 - github.com/flashbots/go-boost-utils v1.8.2-0.20240925223941-58709124077d + github.com/flashbots/go-boost-utils v1.8.2-0.20241014201857-55b15840e530 github.com/flashbots/go-utils v0.5.0 github.com/google/uuid v1.6.0 github.com/gorilla/mux v1.8.1 @@ -90,9 +90,3 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) - -// Remove this when Jim merges pk910's PR. -replace github.com/attestantio/go-eth2-client => github.com/pk910/go-eth2-client v0.0.0-20240923174943-8d64565c83ca - -// Remove this when Jim merge's jtraglia's PR. -replace github.com/attestantio/go-builder-client => github.com/jtraglia/go-builder-client v0.4.6-0.20240925183257-4d86495441b5 diff --git a/go.sum b/go.sum index fb65b33b..1756c201 100644 --- a/go.sum +++ b/go.sum @@ -5,6 +5,10 @@ github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9 github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= +github.com/attestantio/go-builder-client v0.5.1-0.20240925223414-5da8987dd6f3 h1:Ccyc8R6CJbnb5oTwjuYSa2XaYWFSN8R43Gh9V1zN3Dg= +github.com/attestantio/go-builder-client v0.5.1-0.20240925223414-5da8987dd6f3/go.mod h1:qM91NvVG+fepPBN2/MDLpWJ9I/zZtpZAkXa8T9GFOvM= +github.com/attestantio/go-eth2-client v0.21.12-0.20241006200801-8fa702e3a895 h1:3uu4l7TK5PPVBvVUpwxftDpKFddEE3g196BYJbKYq4g= +github.com/attestantio/go-eth2-client v0.21.12-0.20241006200801-8fa702e3a895/go.mod h1:vy5jU/uDZ2+RcVzq5BfnG+bQ3/6uu9DGwCrGsPtjJ1A= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -70,8 +74,8 @@ github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/ferranbt/fastssz v0.1.3 h1:ZI+z3JH05h4kgmFXdHuR1aWYsgrg7o+Fw7/NCzM16Mo= github.com/ferranbt/fastssz v0.1.3/go.mod h1:0Y9TEd/9XuFlh7mskMPfXiI2Dkw4Ddg9EyXt1W7MRvE= -github.com/flashbots/go-boost-utils v1.8.2-0.20240925223941-58709124077d h1:O4iDEwTCD7MaDyccFzmV5yYXfDD99Y2KH284Z4ZR4q0= -github.com/flashbots/go-boost-utils v1.8.2-0.20240925223941-58709124077d/go.mod h1:kU1G5Xk2OBBnYag2RGRuaPuMuuhH2yZx+xHeX91E9Po= +github.com/flashbots/go-boost-utils v1.8.2-0.20241014201857-55b15840e530 h1:8G61JquNZ2f1CXo7jOODKy50zEmR9wC8hi4Za9AFUdA= +github.com/flashbots/go-boost-utils v1.8.2-0.20241014201857-55b15840e530/go.mod h1:CAi7WSr+y5yQhYtluoj/7JlX1yysXPKXJlnH+0DH3V4= github.com/flashbots/go-utils v0.5.0 h1:ldjWta9B9//DJU2QcwRbErez3+1aKhSn6EoFc6d5kPY= github.com/flashbots/go-utils v0.5.0/go.mod h1:LauDwifaRdSK0mS5X34GR59pJtUu1T/lOFNdff1BqtI= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -130,8 +134,6 @@ github.com/huandu/go-clone/generic v1.6.0/go.mod h1:xgd9ZebcMsBWWcBx5mVMCoqMX24g github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/jtraglia/go-builder-client v0.4.6-0.20240925183257-4d86495441b5 h1:1W/Cz544b7FmjTn/5dB8obNDAFuRdRsywWJgOmxz5mU= -github.com/jtraglia/go-builder-client v0.4.6-0.20240925183257-4d86495441b5/go.mod h1:lPd6wgiraLD0umFeiCjYaqoMLeU2b3dMATOJ9B/jnIA= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= @@ -182,8 +184,6 @@ github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= -github.com/pk910/go-eth2-client v0.0.0-20240923174943-8d64565c83ca h1:rc6VVR79GdE58Wx1Arh9QNo+0qmXOfYjWQhrbkSeoI0= -github.com/pk910/go-eth2-client v0.0.0-20240923174943-8d64565c83ca/go.mod h1:vy5jU/uDZ2+RcVzq5BfnG+bQ3/6uu9DGwCrGsPtjJ1A= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/server/service.go b/server/service.go index eef78fcb..c1f8bbb3 100644 --- a/server/service.go +++ b/server/service.go @@ -20,6 +20,7 @@ import ( builderSpec "github.com/attestantio/go-builder-client/spec" eth2ApiV1Deneb "github.com/attestantio/go-eth2-client/api/v1/deneb" eth2ApiV1Electra "github.com/attestantio/go-eth2-client/api/v1/electra" + "github.com/attestantio/go-eth2-client/spec" "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/flashbots/go-boost-utils/ssz" "github.com/flashbots/go-utils/httplogger" @@ -569,6 +570,12 @@ func (m *BoostService) processDenebPayload(w http.ResponseWriter, req *http.Requ return } + if responsePayload.Version != spec.DataVersionDeneb { + log.WithFields(logrus.Fields{ + "version": responsePayload.Version, + }).Error("response version was not deneb") + return + } if getPayloadResponseIsEmpty(responsePayload) { log.Error("response with empty data!") return @@ -704,6 +711,12 @@ func (m *BoostService) processElectraPayload(w http.ResponseWriter, req *http.Re return } + if responsePayload.Version != spec.DataVersionElectra { + log.WithFields(logrus.Fields{ + "version": responsePayload.Version, + }).Error("response version was not electra") + return + } if getPayloadResponseIsEmpty(responsePayload) { log.Error("response with empty data!") return @@ -785,19 +798,21 @@ func (m *BoostService) handleGetPayload(w http.ResponseWriter, req *http.Request } // Decode the body now - payload := new(eth2ApiV1Electra.SignedBlindedBeaconBlock) + payload := new(eth2ApiV1Deneb.SignedBlindedBeaconBlock) + log.Debug("attempting to decode body into Deneb payload") if err := DecodeJSON(bytes.NewReader(body), payload); err != nil { - log.Debug("could not decode Electra request payload, attempting to decode body into Deneb payload") - payload := new(eth2ApiV1Deneb.SignedBlindedBeaconBlock) + log.Debug("could not decode Deneb request payload, attempting to decode body into Electra payload") + payload := new(eth2ApiV1Electra.SignedBlindedBeaconBlock) if err := DecodeJSON(bytes.NewReader(body), payload); err != nil { - log.Debug("could not decode Deneb request payload, attempting to decode body into Capella payload") + log.Debug("could not decode Electra request payload") log.WithError(err).WithField("body", string(body)).Error("could not decode request payload from the beacon-node (signed blinded beacon block)") m.respondError(w, http.StatusBadRequest, err.Error()) return } - m.processDenebPayload(w, req, log, payload) + m.processElectraPayload(w, req, log, payload) + return } - m.processElectraPayload(w, req, log, payload) + m.processDenebPayload(w, req, log, payload) } // CheckRelays sends a request to each one of the relays previously registered to get their status From 79bd65cb064b08f4b4064a2880b22834aa1e84e3 Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Mon, 14 Oct 2024 16:50:53 -0500 Subject: [PATCH 18/25] Revert decoding order & add replacements --- go.mod | 8 +++++++- go.sum | 12 ++++++------ server/mock/mock_relay.go | 7 +++++-- server/service.go | 14 +++++++------- 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index 019a283a..b4ee37ee 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.22 require ( github.com/ethereum/go-ethereum v1.14.9 - github.com/flashbots/go-boost-utils v1.8.2-0.20241014201857-55b15840e530 + github.com/flashbots/go-boost-utils v1.8.2-0.20241014214143-c3fca3d69760 github.com/flashbots/go-utils v0.5.0 github.com/google/uuid v1.6.0 github.com/gorilla/mux v1.8.1 @@ -90,3 +90,9 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +// Remove when go-eth2-client is updated. +replace github.com/attestantio/go-eth2-client => github.com/jtraglia/go-eth2-client v0.21.5-0.20241014213529-c8e71ddfccc4 + +// Remove when go-builder-client is updated. +replace github.com/attestantio/go-builder-client => github.com/jtraglia/go-builder-client v0.4.6-0.20241014193815-df58bba2ab54 diff --git a/go.sum b/go.sum index 1756c201..df4b73d6 100644 --- a/go.sum +++ b/go.sum @@ -5,10 +5,6 @@ github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9 github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/attestantio/go-builder-client v0.5.1-0.20240925223414-5da8987dd6f3 h1:Ccyc8R6CJbnb5oTwjuYSa2XaYWFSN8R43Gh9V1zN3Dg= -github.com/attestantio/go-builder-client v0.5.1-0.20240925223414-5da8987dd6f3/go.mod h1:qM91NvVG+fepPBN2/MDLpWJ9I/zZtpZAkXa8T9GFOvM= -github.com/attestantio/go-eth2-client v0.21.12-0.20241006200801-8fa702e3a895 h1:3uu4l7TK5PPVBvVUpwxftDpKFddEE3g196BYJbKYq4g= -github.com/attestantio/go-eth2-client v0.21.12-0.20241006200801-8fa702e3a895/go.mod h1:vy5jU/uDZ2+RcVzq5BfnG+bQ3/6uu9DGwCrGsPtjJ1A= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -74,8 +70,8 @@ github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/ferranbt/fastssz v0.1.3 h1:ZI+z3JH05h4kgmFXdHuR1aWYsgrg7o+Fw7/NCzM16Mo= github.com/ferranbt/fastssz v0.1.3/go.mod h1:0Y9TEd/9XuFlh7mskMPfXiI2Dkw4Ddg9EyXt1W7MRvE= -github.com/flashbots/go-boost-utils v1.8.2-0.20241014201857-55b15840e530 h1:8G61JquNZ2f1CXo7jOODKy50zEmR9wC8hi4Za9AFUdA= -github.com/flashbots/go-boost-utils v1.8.2-0.20241014201857-55b15840e530/go.mod h1:CAi7WSr+y5yQhYtluoj/7JlX1yysXPKXJlnH+0DH3V4= +github.com/flashbots/go-boost-utils v1.8.2-0.20241014214143-c3fca3d69760 h1:y1VbT0Nbs56kKlSSOzmPN9NEZ/ZWE1yogojh0cOusfY= +github.com/flashbots/go-boost-utils v1.8.2-0.20241014214143-c3fca3d69760/go.mod h1:uU1VYsVItw5cZLDVkBBgSntc80kBc99xsKSRZkY/1jo= github.com/flashbots/go-utils v0.5.0 h1:ldjWta9B9//DJU2QcwRbErez3+1aKhSn6EoFc6d5kPY= github.com/flashbots/go-utils v0.5.0/go.mod h1:LauDwifaRdSK0mS5X34GR59pJtUu1T/lOFNdff1BqtI= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -134,6 +130,10 @@ github.com/huandu/go-clone/generic v1.6.0/go.mod h1:xgd9ZebcMsBWWcBx5mVMCoqMX24g github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/jtraglia/go-builder-client v0.4.6-0.20241014193815-df58bba2ab54 h1:ip/ONBWDWPCGWNGrMXD2vvZH/ABjw5wKfcQ8z7a8MWo= +github.com/jtraglia/go-builder-client v0.4.6-0.20241014193815-df58bba2ab54/go.mod h1:UkqMh+CHZh63XDx3GdBLijRdFQu2Hyqh3n71V4G10Ws= +github.com/jtraglia/go-eth2-client v0.21.5-0.20241014213529-c8e71ddfccc4 h1:gbbca7v+H20HKrOYaMlCAboeAtP93DmM5pXILfVAy4c= +github.com/jtraglia/go-eth2-client v0.21.5-0.20241014213529-c8e71ddfccc4/go.mod h1:vy5jU/uDZ2+RcVzq5BfnG+bQ3/6uu9DGwCrGsPtjJ1A= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= diff --git a/server/mock/mock_relay.go b/server/mock/mock_relay.go index e9d5e4cf..dcb26830 100644 --- a/server/mock/mock_relay.go +++ b/server/mock/mock_relay.go @@ -12,11 +12,13 @@ import ( builderApi "github.com/attestantio/go-builder-client/api" builderApiDeneb "github.com/attestantio/go-builder-client/api/deneb" + builderApiElectra "github.com/attestantio/go-builder-client/api/electra" builderApiV1 "github.com/attestantio/go-builder-client/api/v1" builderSpec "github.com/attestantio/go-builder-client/spec" "github.com/attestantio/go-eth2-client/spec" "github.com/attestantio/go-eth2-client/spec/capella" "github.com/attestantio/go-eth2-client/spec/deneb" + "github.com/attestantio/go-eth2-client/spec/electra" "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/flashbots/go-boost-utils/bls" @@ -196,7 +198,7 @@ func (m *Relay) MakeGetHeaderResponse(value uint64, blockHash, parentHash, publi }, } case spec.DataVersionElectra: - message := &builderApiDeneb.BuilderBid{ + message := &builderApiElectra.BuilderBid{ Header: &deneb.ExecutionPayloadHeader{ BlockHash: HexToHash(blockHash), ParentHash: HexToHash(parentHash), @@ -204,6 +206,7 @@ func (m *Relay) MakeGetHeaderResponse(value uint64, blockHash, parentHash, publi BaseFeePerGas: uint256.NewInt(0), }, BlobKZGCommitments: make([]deneb.KZGCommitment, 0), + ExecutionRequests: &electra.ExecutionRequests{}, Value: uint256.NewInt(value), Pubkey: HexToPubkey(publicKey), } @@ -214,7 +217,7 @@ func (m *Relay) MakeGetHeaderResponse(value uint64, blockHash, parentHash, publi return &builderSpec.VersionedSignedBuilderBid{ Version: spec.DataVersionElectra, - Electra: &builderApiDeneb.SignedBuilderBid{ + Electra: &builderApiElectra.SignedBuilderBid{ Message: message, Signature: signature, }, diff --git a/server/service.go b/server/service.go index c1f8bbb3..3aada647 100644 --- a/server/service.go +++ b/server/service.go @@ -798,21 +798,21 @@ func (m *BoostService) handleGetPayload(w http.ResponseWriter, req *http.Request } // Decode the body now - payload := new(eth2ApiV1Deneb.SignedBlindedBeaconBlock) - log.Debug("attempting to decode body into Deneb payload") + payload := new(eth2ApiV1Electra.SignedBlindedBeaconBlock) + log.Debug("attempting to decode body into Electra payload") if err := DecodeJSON(bytes.NewReader(body), payload); err != nil { - log.Debug("could not decode Deneb request payload, attempting to decode body into Electra payload") - payload := new(eth2ApiV1Electra.SignedBlindedBeaconBlock) + log.Debug("could not decode Electra request payload, attempting to decode body into Deneb payload") + payload := new(eth2ApiV1Deneb.SignedBlindedBeaconBlock) if err := DecodeJSON(bytes.NewReader(body), payload); err != nil { - log.Debug("could not decode Electra request payload") + log.Debug("could not decode Deneb request payload") log.WithError(err).WithField("body", string(body)).Error("could not decode request payload from the beacon-node (signed blinded beacon block)") m.respondError(w, http.StatusBadRequest, err.Error()) return } - m.processElectraPayload(w, req, log, payload) + m.processDenebPayload(w, req, log, payload) return } - m.processDenebPayload(w, req, log, payload) + m.processElectraPayload(w, req, log, payload) } // CheckRelays sends a request to each one of the relays previously registered to get their status From 81d17a9b8816c457d7dc0e4e001762e4c4902bdf Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Mon, 14 Oct 2024 17:00:24 -0500 Subject: [PATCH 19/25] Update go-eth2-client --- go.mod | 5 +---- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index b4ee37ee..6fa52b04 100644 --- a/go.mod +++ b/go.mod @@ -63,7 +63,7 @@ require ( require ( github.com/StackExchange/wmi v1.2.1 // indirect github.com/attestantio/go-builder-client v0.5.1-0.20240925223414-5da8987dd6f3 - github.com/attestantio/go-eth2-client v0.21.12-0.20241006200801-8fa702e3a895 + github.com/attestantio/go-eth2-client v0.21.12-0.20241014214053-759b0ace2e43 github.com/btcsuite/btcd v0.22.0-beta // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect @@ -91,8 +91,5 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect ) -// Remove when go-eth2-client is updated. -replace github.com/attestantio/go-eth2-client => github.com/jtraglia/go-eth2-client v0.21.5-0.20241014213529-c8e71ddfccc4 - // Remove when go-builder-client is updated. replace github.com/attestantio/go-builder-client => github.com/jtraglia/go-builder-client v0.4.6-0.20241014193815-df58bba2ab54 diff --git a/go.sum b/go.sum index df4b73d6..33017baf 100644 --- a/go.sum +++ b/go.sum @@ -5,6 +5,8 @@ github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9 github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= +github.com/attestantio/go-eth2-client v0.21.12-0.20241014214053-759b0ace2e43 h1:Xvkj/3ilNuZgoGnxu/uiXmCDmKjBE0ruygTHZIU1JFs= +github.com/attestantio/go-eth2-client v0.21.12-0.20241014214053-759b0ace2e43/go.mod h1:vy5jU/uDZ2+RcVzq5BfnG+bQ3/6uu9DGwCrGsPtjJ1A= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -132,8 +134,6 @@ github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJS github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/jtraglia/go-builder-client v0.4.6-0.20241014193815-df58bba2ab54 h1:ip/ONBWDWPCGWNGrMXD2vvZH/ABjw5wKfcQ8z7a8MWo= github.com/jtraglia/go-builder-client v0.4.6-0.20241014193815-df58bba2ab54/go.mod h1:UkqMh+CHZh63XDx3GdBLijRdFQu2Hyqh3n71V4G10Ws= -github.com/jtraglia/go-eth2-client v0.21.5-0.20241014213529-c8e71ddfccc4 h1:gbbca7v+H20HKrOYaMlCAboeAtP93DmM5pXILfVAy4c= -github.com/jtraglia/go-eth2-client v0.21.5-0.20241014213529-c8e71ddfccc4/go.mod h1:vy5jU/uDZ2+RcVzq5BfnG+bQ3/6uu9DGwCrGsPtjJ1A= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= From 93501543dfe8e5802e0f3ef8c9526a270198c6e7 Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Mon, 14 Oct 2024 17:03:39 -0500 Subject: [PATCH 20/25] Update go-builder-client --- go.mod | 5 +---- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 6fa52b04..31fb1e20 100644 --- a/go.mod +++ b/go.mod @@ -62,7 +62,7 @@ require ( require ( github.com/StackExchange/wmi v1.2.1 // indirect - github.com/attestantio/go-builder-client v0.5.1-0.20240925223414-5da8987dd6f3 + github.com/attestantio/go-builder-client v0.5.1-0.20241014215920-ba44f1de4249 github.com/attestantio/go-eth2-client v0.21.12-0.20241014214053-759b0ace2e43 github.com/btcsuite/btcd v0.22.0-beta // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect @@ -90,6 +90,3 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) - -// Remove when go-builder-client is updated. -replace github.com/attestantio/go-builder-client => github.com/jtraglia/go-builder-client v0.4.6-0.20241014193815-df58bba2ab54 diff --git a/go.sum b/go.sum index 33017baf..beded7a2 100644 --- a/go.sum +++ b/go.sum @@ -5,6 +5,8 @@ github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9 github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= +github.com/attestantio/go-builder-client v0.5.1-0.20241014215920-ba44f1de4249 h1:y01TZYnM3DDb3nkqA3VaoiqKuWWAgLIfrm63XOQJsFc= +github.com/attestantio/go-builder-client v0.5.1-0.20241014215920-ba44f1de4249/go.mod h1:X31JAUL4q6cY/OGClpBQcwFN7FBixt6Wjrqy7RrlhEc= github.com/attestantio/go-eth2-client v0.21.12-0.20241014214053-759b0ace2e43 h1:Xvkj/3ilNuZgoGnxu/uiXmCDmKjBE0ruygTHZIU1JFs= github.com/attestantio/go-eth2-client v0.21.12-0.20241014214053-759b0ace2e43/go.mod h1:vy5jU/uDZ2+RcVzq5BfnG+bQ3/6uu9DGwCrGsPtjJ1A= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= @@ -132,8 +134,6 @@ github.com/huandu/go-clone/generic v1.6.0/go.mod h1:xgd9ZebcMsBWWcBx5mVMCoqMX24g github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/jtraglia/go-builder-client v0.4.6-0.20241014193815-df58bba2ab54 h1:ip/ONBWDWPCGWNGrMXD2vvZH/ABjw5wKfcQ8z7a8MWo= -github.com/jtraglia/go-builder-client v0.4.6-0.20241014193815-df58bba2ab54/go.mod h1:UkqMh+CHZh63XDx3GdBLijRdFQu2Hyqh3n71V4G10Ws= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= From 4076ad0942ea8a9d1774d28acf85ed9045e53ede Mon Sep 17 00:00:00 2001 From: Tyler <122291810+0xTylerHolmes@users.noreply.github.com> Date: Fri, 22 Nov 2024 18:13:29 -0500 Subject: [PATCH 21/25] Modify processElectraPayload to use a channel (#704) --- server/service.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/service.go b/server/service.go index 3aada647..4c328b3b 100644 --- a/server/service.go +++ b/server/service.go @@ -681,7 +681,10 @@ func (m *BoostService) processElectraPayload(w http.ResponseWriter, req *http.Re } // Add request headers - headers := map[string]string{HeaderKeySlotUID: currentSlotUID} + headers := map[string]string{ + HeaderKeySlotUID: currentSlotUID, + HeaderStartTimeUnixMS: fmt.Sprintf("%d", time.Now().UTC().UnixMilli()), + } // Prepare for requests var wg sync.WaitGroup From c269b4e23a16bc47672137078bc9d14ddd061c0c Mon Sep 17 00:00:00 2001 From: Tyler <122291810+0xTylerHolmes@users.noreply.github.com> Date: Fri, 22 Nov 2024 18:14:47 -0500 Subject: [PATCH 22/25] server: refactor processElectraPayload (#703) --- server/service.go | 35 +++++---- server/service_test.go | 64 +++++++++++++++++ .../signed-blinded-beacon-block-electra.json | 72 +++++++++++++++++++ 3 files changed, 152 insertions(+), 19 deletions(-) create mode 100644 testdata/signed-blinded-beacon-block-electra.json diff --git a/server/service.go b/server/service.go index 4c328b3b..67eebe8e 100644 --- a/server/service.go +++ b/server/service.go @@ -687,18 +687,20 @@ func (m *BoostService) processElectraPayload(w http.ResponseWriter, req *http.Re } // Prepare for requests - var wg sync.WaitGroup - var mu sync.Mutex - result := new(builderApi.VersionedSubmitBlindedBlockResponse) + resultCh := make(chan *builderApi.VersionedSubmitBlindedBlockResponse, len(m.relays)) + var received atomic.Bool + go func() { + // Make sure we receive a response within the timeout + time.Sleep(m.httpClientGetPayload.Timeout) + resultCh <- nil + }() // Prepare the request context, which will be cancelled after the first successful response from a relay requestCtx, requestCtxCancel := context.WithCancel(context.Background()) defer requestCtxCancel() for _, relay := range m.relays { - wg.Add(1) go func(relay types.RelayEntry) { - defer wg.Done() url := relay.GetURI(params.PathGetPayload) log := log.WithField("url", url) log.Debug("calling getPayload") @@ -759,26 +761,21 @@ func (m *BoostService) processElectraPayload(w http.ResponseWriter, req *http.Re } } - // Lock before accessing the shared payload - mu.Lock() - defer mu.Unlock() - - if requestCtx.Err() != nil { // request has been cancelled (or deadline exceeded) - return - } - - // Received successful response. Now cancel other requests and return immediately requestCtxCancel() - *result = *responsePayload - log.Info("received payload from relay") + if received.CompareAndSwap(false, true) { + resultCh <- responsePayload + log.Info("received payload from relay") + } else { + log.Trace("Discarding response, already received a correct response") + } }(relay) } - // Wait for all requests to complete... - wg.Wait() + // Wait for the first request to complete + result := <-resultCh // If no payload has been received from relay, log loudly about withholding! - if getPayloadResponseIsEmpty(result) { + if result == nil || getPayloadResponseIsEmpty(result) { originRelays := types.RelayEntriesToStrings(originalBid.relays) log.WithField("relaysWithBid", strings.Join(originRelays, ", ")).Error("no payload received from relay!") m.respondError(w, http.StatusBadGateway, errNoSuccessfulRelayResponse.Error()) diff --git a/server/service_test.go b/server/service_test.go index 65a20324..771f9126 100644 --- a/server/service_test.go +++ b/server/service_test.go @@ -19,6 +19,7 @@ import ( builderApiV1 "github.com/attestantio/go-builder-client/api/v1" builderSpec "github.com/attestantio/go-builder-client/spec" eth2ApiV1Deneb "github.com/attestantio/go-eth2-client/api/v1/deneb" + eth2ApiV1Electra "github.com/attestantio/go-eth2-client/api/v1/electra" "github.com/attestantio/go-eth2-client/spec" "github.com/attestantio/go-eth2-client/spec/altair" "github.com/attestantio/go-eth2-client/spec/bellatrix" @@ -125,6 +126,41 @@ func blindedBlockContentsToPayloadDeneb(signedBlindedBlockContents *eth2ApiV1Den } } +func blindedBlockContentsToPayloadElectra(signedBlindedBlockContents *eth2ApiV1Electra.SignedBlindedBeaconBlock) *builderApiDeneb.ExecutionPayloadAndBlobsBundle { + header := signedBlindedBlockContents.Message.Body.ExecutionPayloadHeader + numBlobs := len(signedBlindedBlockContents.Message.Body.BlobKZGCommitments) + commitments := make([]deneb.KZGCommitment, numBlobs) + copy(commitments, signedBlindedBlockContents.Message.Body.BlobKZGCommitments) + proofs := make([]deneb.KZGProof, numBlobs) + blobs := make([]deneb.Blob, numBlobs) + return &builderApiDeneb.ExecutionPayloadAndBlobsBundle{ + ExecutionPayload: &deneb.ExecutionPayload{ + ParentHash: header.ParentHash, + FeeRecipient: header.FeeRecipient, + StateRoot: header.StateRoot, + ReceiptsRoot: header.ReceiptsRoot, + LogsBloom: header.LogsBloom, + PrevRandao: header.PrevRandao, + BlockNumber: header.BlockNumber, + GasLimit: header.GasLimit, + GasUsed: header.GasUsed, + Timestamp: header.Timestamp, + ExtraData: header.ExtraData, + BaseFeePerGas: header.BaseFeePerGas, + BlockHash: header.BlockHash, + Transactions: make([]bellatrix.Transaction, 0), + Withdrawals: make([]*capella.Withdrawal, 0), + BlobGasUsed: header.BlobGasUsed, + ExcessBlobGas: header.ExcessBlobGas, + }, + BlobsBundle: &builderApiDeneb.BlobsBundle{ + Commitments: commitments, + Proofs: proofs, + Blobs: blobs, + }, + } +} + func TestNewBoostServiceErrors(t *testing.T) { t.Run("errors when no relays", func(t *testing.T) { _, err := NewBoostService(BoostServiceOpts{ @@ -787,6 +823,34 @@ func TestGetPayloadDeneb(t *testing.T) { require.Equal(t, signedBlindedBlock.Message.Body.ExecutionPayloadHeader.BlockHash, resp.Deneb.ExecutionPayload.BlockHash) } +func TestGetPayloadElectra(t *testing.T) { + // Load the signed blinded beacon block used for getPayload + jsonFile, err := os.Open("../testdata/signed-blinded-beacon-block-electra.json") + require.NoError(t, err) + defer jsonFile.Close() + signedBlindedBlock := new(eth2ApiV1Electra.SignedBlindedBeaconBlock) + require.NoError(t, DecodeJSON(jsonFile, &signedBlindedBlock)) + + backend := newTestBackend(t, 1, time.Second) + + // Prepare getPayload response + backend.relays[0].GetPayloadResponse = &builderApi.VersionedSubmitBlindedBlockResponse{ + Version: spec.DataVersionElectra, + Electra: blindedBlockContentsToPayloadElectra(signedBlindedBlock), + } + + // call getPayload, ensure it's only called on relay 0 (origin of the bid) + getPayloadPath := "/eth/v1/builder/blinded_blocks" + rr := backend.request(t, http.MethodPost, getPayloadPath, signedBlindedBlock) + require.Equal(t, http.StatusOK, rr.Code, rr.Body.String()) + require.Equal(t, 1, backend.relays[0].GetRequestCount(getPayloadPath)) + + resp := new(builderApi.VersionedSubmitBlindedBlockResponse) + err = json.Unmarshal(rr.Body.Bytes(), resp) + require.NoError(t, err) + require.Equal(t, signedBlindedBlock.Message.Body.ExecutionPayloadHeader.BlockHash, resp.Electra.ExecutionPayload.BlockHash) +} + func TestGetPayloadToAllRelays(t *testing.T) { // Load the signed blinded beacon block used for getPayload jsonFile, err := os.Open("../testdata/signed-blinded-beacon-block-deneb.json") diff --git a/testdata/signed-blinded-beacon-block-electra.json b/testdata/signed-blinded-beacon-block-electra.json new file mode 100644 index 00000000..2467a3b6 --- /dev/null +++ b/testdata/signed-blinded-beacon-block-electra.json @@ -0,0 +1,72 @@ +{ + "message": { + "slot": "252288", + "proposer_index": "4295", + "parent_root": "0x9a8eef2096477e645150fee1a2ce13190382179a0ea843f31173715a1a14e074", + "state_root": "0x4c033e0b4a34c0eb8e0caba126fae3ed303a83254fe39f8daaa673125f4042cc", + "body": { + "randao_reveal": "0xa7a74e03d8ef909abc75b9452d167e15869180fb4b19db79a1136b510495f02d6ae480ee4ad6a2a9e41af866a9a54c681601a3a1dee30f676e93e6c6b3eb3e880c2cb8d32bd730ca9e7def92877c70da09bfc52a531f1be15619c8a3bb38bdf6", + "eth1_data": { + "deposit_root": "0x0cacd599c9cdcee8398b40ef045baf2c137bed4d2b02a465a0414b04015f861d", + "deposit_count": "216773", + "block_hash": "0xd75a680056c50b4e339eda2f91ccd33badc5d59feab830526e342c5ec68d8dce" + }, + "graffiti": "0x6c69676874686f7573652d6e65746865726d696e642d33000000000000000000", + "proposer_slashings": [], + "attester_slashings": [], + "attestations": [ + { + "aggregation_bits": "0xf8fbff9093195acfebcff69cdfef71fbd9eaf19777f7dfb1f9233faf08be7e463a675cefef2d9e03", + "data": { + "slot": "252287", + "index": "0", + "beacon_block_root": "0x9a8eef2096477e645150fee1a2ce13190382179a0ea843f31173715a1a14e074", + "source": { + "epoch": "7682", + "root": "0x83900465836d88fbd48a829ca207db86e32aa7797966df1b0c886128c72a1a0b" + }, + "target": { + "epoch": "7883", + "root": "0x6e20c4503b853781327d750ee818651e5493b04f5ea0f2699725eecb1e0c3ddf" + } + }, + "signature": "0xb8fb8248ce16152eb41f88803445ef64c33da86de7bfd398b12e745a449013f9454c38b42a658291e344e3eb11d1c3ec03d692b9ed299aff0f599ea9145596b5195d11ff49f83a573519616c8b76c9459a1ed5f869e1c5c6bad176adbd3b689c", + "committee_bits": "0x0300000000000000" + } + ], + "deposits": [], + "voluntary_exits": [], + "sync_aggregate": { + "sync_committee_bits": "0xde98bcde844ff76e87b94cfff1cbcc3dfbf93fdf3ee9b994764fafe484f762eb1562e7fa28e96f5d7a887bff689ffb932d5eff467e668d137bc565d37e3fa7fd", + "sync_committee_signature": "0x93a611fb577d17674242e42de06958513013b0cb07d1f284e993ed7d63ac43bbc234e54a886ca9cb979e76eabeeb6ee603556234b7d661bdb7a7ac98813028faf8060e5e9271d4f25de199ce5e2ecc2a6762a49c41bf366b1c4c54bc185c62f9" + }, + "execution_payload_header": { + "parent_hash": "0x98b62322edaa4d91ecc0847fe2f7debc89dec5e808d7e369aa9b535543227f60", + "fee_recipient": "0xf97e180c050e5ab072211ad2c213eb5aee4df134", + "state_root": "0x3b6b594d5cbe7ff4c8bdca04f080c57a18fffdaf1c8e700e69b86f7425ed8d73", + "receipts_root": "0x04deb4be6955e1a300123be48007597f67e4229f8ce70f4f10388de6fd3fa267", + "logs_bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "prev_randao": "0x83612b3de54001f74bf36234e373c1fca95dab5e4645bc3faf7108345cf82e34", + "block_number": "220275", + "gas_limit": "30000000", + "gas_used": "84000", + "timestamp": "1732296378", + "extra_data": "0x4e65746865726d696e64", + "base_fee_per_gas": "7", + "block_hash": "0xb65b77e52407ff25f7fcd3f455c991ae67be1bc10cb7ec992a659698cf88870f", + "transactions_root": "0xb1fcd304d8ba402be6e76346395ea7641fbb4c83663b697a0e88ab115d859d3f", + "withdrawals_root": "0x792930bbd5baac43bcc798ee49aa8185ef76bb3b44ba62b91d86ae569e4bb535", + "blob_gas_used": "0", + "excess_blob_gas": "0" + }, + "bls_to_execution_changes": [], + "blob_kzg_commitments": [], + "execution_requests": { + "deposits": [], + "withdrawals": [], + "consolidations": [] + } + } + }, + "signature": "0x94cd72a70a0b424f68145115a9a52f6c8557fb40ec8b67c26cbb9b324b72756624a59e8bbe11b78acbbb8e9c606035d10c0dab9a3f4177d7e6954f8ea1863d0b0b00007fb420b4b4cf52e065bda0ad32af0d3a71bd6938180bab6dd1af754d2f" +} From 285a77d9cf115b4758fe473f42345c96e99db8b9 Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Mon, 13 Jan 2025 08:48:54 -0600 Subject: [PATCH 23/25] Update go-eth2-client to latest electra commit --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 31fb1e20..79c01583 100644 --- a/go.mod +++ b/go.mod @@ -63,7 +63,7 @@ require ( require ( github.com/StackExchange/wmi v1.2.1 // indirect github.com/attestantio/go-builder-client v0.5.1-0.20241014215920-ba44f1de4249 - github.com/attestantio/go-eth2-client v0.21.12-0.20241014214053-759b0ace2e43 + github.com/attestantio/go-eth2-client v0.22.1-0.20250106164842-07b6ce39bb43 github.com/btcsuite/btcd v0.22.0-beta // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect diff --git a/go.sum b/go.sum index beded7a2..3af7b7b8 100644 --- a/go.sum +++ b/go.sum @@ -7,8 +7,8 @@ github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkT github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/attestantio/go-builder-client v0.5.1-0.20241014215920-ba44f1de4249 h1:y01TZYnM3DDb3nkqA3VaoiqKuWWAgLIfrm63XOQJsFc= github.com/attestantio/go-builder-client v0.5.1-0.20241014215920-ba44f1de4249/go.mod h1:X31JAUL4q6cY/OGClpBQcwFN7FBixt6Wjrqy7RrlhEc= -github.com/attestantio/go-eth2-client v0.21.12-0.20241014214053-759b0ace2e43 h1:Xvkj/3ilNuZgoGnxu/uiXmCDmKjBE0ruygTHZIU1JFs= -github.com/attestantio/go-eth2-client v0.21.12-0.20241014214053-759b0ace2e43/go.mod h1:vy5jU/uDZ2+RcVzq5BfnG+bQ3/6uu9DGwCrGsPtjJ1A= +github.com/attestantio/go-eth2-client v0.22.1-0.20250106164842-07b6ce39bb43 h1:lORlCOleRXvVt3H7fan64UaYAK4FJDHdy19uYfe7FKQ= +github.com/attestantio/go-eth2-client v0.22.1-0.20250106164842-07b6ce39bb43/go.mod h1:vy5jU/uDZ2+RcVzq5BfnG+bQ3/6uu9DGwCrGsPtjJ1A= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= From f2c61b0fbf8cb39c1605b8a7c55144f5edf3de68 Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Mon, 13 Jan 2025 09:53:48 -0600 Subject: [PATCH 24/25] Remove nolint:canonicalheader comments --- server/service.go | 2 +- server/service_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/service.go b/server/service.go index bf910d64..67eebe8e 100644 --- a/server/service.go +++ b/server/service.go @@ -232,7 +232,7 @@ func (m *BoostService) handleRoot(w http.ResponseWriter, _ *http.Request) { // handleStatus sends calls to the status endpoint of every relay. // It returns OK if at least one returned OK, and returns error otherwise. func (m *BoostService) handleStatus(w http.ResponseWriter, _ *http.Request) { - w.Header().Set(HeaderKeyVersion, config.Version) //nolint:canonicalheader // we use a non-canonical header + w.Header().Set(HeaderKeyVersion, config.Version) if !m.relayCheck || m.CheckRelays() > 0 { m.respondOK(w, nilResponse) } else { diff --git a/server/service_test.go b/server/service_test.go index ca6e427f..6515904e 100644 --- a/server/service_test.go +++ b/server/service_test.go @@ -242,7 +242,7 @@ func TestStatus(t *testing.T) { rr := backend.request(t, http.MethodGet, path, nil) require.Equal(t, http.StatusOK, rr.Code) - require.NotEmpty(t, rr.Header().Get("X-MEVBoost-Version")) //nolint:canonicalheader // we use a non-canonical header + require.NotEmpty(t, rr.Header().Get("X-MEVBoost-Version")) require.Equal(t, 1, backend.relays[0].GetRequestCount(path)) }) @@ -254,7 +254,7 @@ func TestStatus(t *testing.T) { rr := backend.request(t, http.MethodGet, path, nil) require.Equal(t, http.StatusServiceUnavailable, rr.Code) - require.NotEmpty(t, rr.Header().Get("X-MEVBoost-Version")) //nolint:canonicalheader // we use a non-canonical header + require.NotEmpty(t, rr.Header().Get("X-MEVBoost-Version")) require.Equal(t, 0, backend.relays[0].GetRequestCount(path)) }) } From 445643d069547edcfbcfc4b7b1177a991a952404 Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Mon, 13 Jan 2025 10:08:25 -0600 Subject: [PATCH 25/25] Disable canonicalheader linter --- .golangci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 3a57c1cd..ed23268a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,6 +1,8 @@ linters: enable-all: true disable: + - canonicalheader + - depguard - dupl - exhaustruct - funlen @@ -11,6 +13,7 @@ linters: - godox - lll - mnd + - musttag - nlreturn - nonamedreturns - paralleltest @@ -18,8 +21,6 @@ linters: - varnamelen - wrapcheck - wsl - - musttag - - depguard # # Maybe fix later: