From 79bd65cb064b08f4b4064a2880b22834aa1e84e3 Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Mon, 14 Oct 2024 16:50:53 -0500 Subject: [PATCH] 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