Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal V3 #1329

Merged
merged 43 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e837bfd
Enabled BUILDER_PROPOSALS for all nodes
zevzek Feb 19, 2024
ace7c10
deploy to all nodes
y0sher Feb 19, 2024
2bb4291
don't include summary in took, to check real time.
y0sher Feb 20, 2024
a146472
gets blinded and non blinded blocks from beacon node in parallel. pre…
y0sher Feb 20, 2024
053e605
cancel regular block if beacon block succeeded. cleanup
y0sher Feb 21, 2024
61d99c6
second error var not needed
y0sher Feb 21, 2024
d4776fa
blinded error is printed but not returned
y0sher Feb 21, 2024
5944e39
move parallel block fetch to beacon client and remove fallback in pro…
y0sher Feb 21, 2024
afbf17b
Merge branch 'enable-mev-for-all-operators-on-stage' into deploy/para…
y0sher Feb 21, 2024
54db748
deploy
y0sher Feb 21, 2024
3277ae4
add wait for beacon
y0sher Feb 22, 2024
61591d5
just fallback instead of parallel
y0sher Feb 22, 2024
a84d44b
check nodeclient and bring back parallel
y0sher Feb 22, 2024
28edb3e
add parallel check to nimbus as well
y0sher Feb 22, 2024
9e89ced
don't do parallel requests on nimbus
y0sher Feb 22, 2024
40c766e
polish
moshe-blox Feb 22, 2024
a5cdb3b
typo
moshe-blox Feb 22, 2024
287b75a
comment
moshe-blox Feb 22, 2024
5fbce27
debug
moshe-blox Feb 23, 2024
48db44d
deploy parallel refactor + debugging
moshe-blox Feb 23, 2024
117c03b
updated go-eth2-client with more logs
moshe-blox Feb 23, 2024
ec57a57
deploy more logs
moshe-blox Feb 23, 2024
341de22
go mod tidy
moshe-blox Feb 23, 2024
5f312c3
more logs
moshe-blox Feb 23, 2024
9151f12
use v3 block proposal endpoint using custom go-eth2-client
y0sher Feb 24, 2024
0ee536f
updated go-eth2-client, added log
y0sher Feb 24, 2024
2f5ea9e
deploy fake proposal to node 31
moshe-blox Feb 25, 2024
08db1ed
go mod tidy
moshe-blox Feb 25, 2024
9205fc6
logs
moshe-blox Feb 25, 2024
24cc339
logs
moshe-blox Feb 25, 2024
5e18934
deploy only node 31
moshe-blox Feb 25, 2024
94aeb70
deploy stable version to all nodes
moshe-blox Feb 25, 2024
445c337
deploy to prater and holesky prod
moshe-blox Feb 25, 2024
3cb42e5
deploy to mainnet 1
moshe-blox Feb 25, 2024
cb550f4
deploy to mainnet 2
moshe-blox Feb 25, 2024
40e037e
deploy to mainnet 3
moshe-blox Feb 25, 2024
5dc03c5
deploy mainnet 4
moshe-blox Feb 25, 2024
d31f95c
remove parallel code
moshe-blox Feb 25, 2024
54737da
revert deployments
moshe-blox Feb 25, 2024
b1045c6
Update beacon/goclient/goclient.go
moshe-blox Feb 26, 2024
d1102b8
improve v3 err message
y0sher Feb 26, 2024
5489f74
approve differ
moshe-blox Feb 26, 2024
3a1766f
Enabled BUILDER_PROPOSALS for all nodes
zevzek Feb 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions beacon/goclient/goclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ type NodeClient string
const (
NodeLighthouse NodeClient = "lighthouse"
NodePrysm NodeClient = "prysm"
NodeNimbus NodeClient = "nimbus"
NodeUnknown NodeClient = "unknown"
)

Expand All @@ -90,6 +91,8 @@ func ParseNodeClient(version string) NodeClient {
return NodeLighthouse
case strings.Contains(version, "prysm"):
return NodePrysm
case strings.Contains(version, "nimbus"):
return NodeNimbus
default:
return NodeUnknown
}
Expand All @@ -114,6 +117,7 @@ type Client interface {
eth2client.ProposalProvider
eth2client.ProposalSubmitter
eth2client.BlindedProposalProvider
eth2client.V3ProposalProvider
eth2client.BlindedProposalSubmitter
eth2client.DomainProvider
eth2client.SyncCommitteeMessagesSubmitter
Expand Down
99 changes: 98 additions & 1 deletion beacon/goclient/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,16 @@ func (gc *goClient) GetBeaconBlock(slot phase0.Slot, graffitiBytes, randao []byt
}
}

// GetBlindedBeaconBlock returns blinded beacon block by the given slot, graffiti, and randao.
func (gc *goClient) GetBlindedBeaconBlock(slot phase0.Slot, graffitiBytes, randao []byte) (ssz.Marshaler, spec.DataVersion, error) {
if gc.nodeClient == NodePrysm {
gc.log.Debug("using V3 endpoint for prysm blinded block")
return gc.V3Proposal(slot, graffitiBytes, randao)
}
return gc.DefaultGetBlindedBeaconBlock(slot, graffitiBytes, randao)
}

// GetBlindedBeaconBlock returns blinded beacon block by the given slot, graffiti, and randao.
func (gc *goClient) DefaultGetBlindedBeaconBlock(slot phase0.Slot, graffitiBytes, randao []byte) (ssz.Marshaler, spec.DataVersion, error) {
sig := phase0.BLSSignature{}
copy(sig[:], randao[:])

Expand Down Expand Up @@ -157,6 +165,95 @@ func (gc *goClient) GetBlindedBeaconBlock(slot phase0.Slot, graffitiBytes, randa
}
}

func (gc *goClient) V3Proposal(slot phase0.Slot, graffitiBytes, randao []byte) (ssz.Marshaler, spec.DataVersion, error) {
sig := phase0.BLSSignature{}
copy(sig[:], randao[:])

graffiti := [32]byte{}
copy(graffiti[:], graffitiBytes[:])

reqStart := time.Now()
v3ProposalResp, err := gc.client.V3Proposal(gc.ctx, &api.V3ProposalOpts{
Slot: slot,
RandaoReveal: sig,
Graffiti: graffiti,
SkipRandaoVerification: false,
})
if err != nil {
return nil, DataVersionNil, fmt.Errorf("failed to get v3 proposal: %w", err)
}
if v3ProposalResp == nil {
return nil, DataVersionNil, fmt.Errorf("v3 proposal response is nil")
}
if v3ProposalResp.Data == nil {
return nil, DataVersionNil, fmt.Errorf("v3 proposal data is nil")
}

metricsProposerDataRequest.Observe(time.Since(reqStart).Seconds())
beaconBlock := v3ProposalResp.Data

if beaconBlock.ExecutionPayloadBlinded {
switch beaconBlock.Version {
case spec.DataVersionCapella:
if beaconBlock.BlindedCapella == nil {
return nil, DataVersionNil, fmt.Errorf("capella blinded block is nil")
}
if beaconBlock.BlindedCapella.Body == nil {
return nil, DataVersionNil, fmt.Errorf("capella blinded block body is nil")
}
if beaconBlock.BlindedCapella.Body.ExecutionPayloadHeader == nil {
return nil, DataVersionNil, fmt.Errorf("capella blinded block execution payload header is nil")
}
return beaconBlock.BlindedCapella, beaconBlock.Version, nil
case spec.DataVersionDeneb:
if beaconBlock.BlindedDeneb == nil {
return nil, DataVersionNil, fmt.Errorf("deneb blinded block contents is nil")
}
if beaconBlock.BlindedDeneb.Body == nil {
return nil, DataVersionNil, fmt.Errorf("deneb blinded block body is nil")
}
if beaconBlock.BlindedDeneb.Body.ExecutionPayloadHeader == nil {
return nil, DataVersionNil, fmt.Errorf("deneb blinded block execution payload header is nil")
}
return beaconBlock.BlindedDeneb, beaconBlock.Version, nil
default:
return nil, DataVersionNil, fmt.Errorf("beacon blinded block version %s not supported", beaconBlock.Version)
}
}

switch beaconBlock.Version {
case spec.DataVersionCapella:
if beaconBlock.Capella == nil {
return nil, DataVersionNil, fmt.Errorf("capella block is nil")
}
if beaconBlock.Capella.Body == nil {
return nil, DataVersionNil, fmt.Errorf("capella block body is nil")
}
if beaconBlock.Capella.Body.ExecutionPayload == nil {
return nil, DataVersionNil, fmt.Errorf("capella block execution payload is nil")
}
return beaconBlock.Capella, beaconBlock.Version, nil
case spec.DataVersionDeneb:
if beaconBlock.Deneb == nil {
return nil, DataVersionNil, fmt.Errorf("deneb block contents is nil")
}
if beaconBlock.Deneb.Block == nil {
return nil, DataVersionNil, fmt.Errorf("deneb block is nil")
}
if beaconBlock.Deneb.Block.Body == nil {
return nil, DataVersionNil, fmt.Errorf("deneb block body is nil")
}
if beaconBlock.Deneb.Block.Body.ExecutionPayload == nil {
return nil, DataVersionNil, fmt.Errorf("deneb block execution payload is nil")
}
return beaconBlock.Deneb, beaconBlock.Version, nil

default:
return nil, DataVersionNil, fmt.Errorf("beacon block version %s not supported", beaconBlock.Version)
}

}

func (gc *goClient) SubmitBlindedBeaconBlock(block *api.VersionedBlindedProposal, sig phase0.BLSSignature) error {
signedBlock := &api.VersionedSignedBlindedProposal{
Version: block.Version,
Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/bloxapp/eth2-key-manager v1.4.0
github.com/bloxapp/ssv-spec v0.3.6
github.com/btcsuite/btcd/btcec/v2 v2.3.2
github.com/carlmjohnson/requests v0.23.5
github.com/cespare/xxhash/v2 v2.2.0
github.com/cornelk/hashmap v1.0.8
github.com/dgraph-io/badger/v4 v4.1.0
Expand Down Expand Up @@ -207,7 +208,7 @@ require (
go.uber.org/dig v1.17.0 // indirect
go.uber.org/fx v1.19.2 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/time v0.3.0 // indirect
Expand All @@ -227,4 +228,4 @@ replace github.com/google/flatbuffers => github.com/google/flatbuffers v1.11.0

replace github.com/dgraph-io/ristretto => github.com/dgraph-io/ristretto v0.1.1-0.20211108053508-297c39e6640f

replace github.com/attestantio/go-eth2-client => github.com/moshe-blox/go-eth2-client v0.7.2-0.20240204094454-17f5c145f39f
replace github.com/attestantio/go-eth2-client => github.com/y0sher/go-eth2-client v0.0.0-20240225155350-c396641b4956
MatusKysel marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf
github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
github.com/carlmjohnson/requests v0.23.5 h1:NPANcAofwwSuC6SIMwlgmHry2V3pLrSqRiSBKYbNHHA=
github.com/carlmjohnson/requests v0.23.5/go.mod h1:zG9P28thdRnN61aD7iECFhH5iGGKX2jIjKQD9kqYH+o=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/cp v1.1.1 h1:nCb6ZLdB7NRaqsm91JtQTAme2SKJzXVsdPIPkyJr1MU=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
Expand Down Expand Up @@ -542,8 +544,6 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
github.com/moshe-blox/go-eth2-client v0.7.2-0.20240204094454-17f5c145f39f h1:nKkhGuanOtsXIb3o60L89bf9fMLnC/sVO5r37W4GFjQ=
github.com/moshe-blox/go-eth2-client v0.7.2-0.20240204094454-17f5c145f39f/go.mod h1:TTz7YF6w4z6ahvxKiHuGPn6DbQn7gH6HPuWm/DEQeGE=
github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ=
github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
Expand Down Expand Up @@ -828,6 +828,8 @@ github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRT
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
github.com/xtaci/kcp-go v5.4.20+incompatible/go.mod h1:bN6vIwHQbfHaHtFpEssmWsN45a+AZwO7eyRCmEIbtvE=
github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae/go.mod h1:gXtu8J62kEgmN++bm9BVICuT/e8yiLI2KFobd/TRFsE=
github.com/y0sher/go-eth2-client v0.0.0-20240225155350-c396641b4956 h1:YmgOT2TcUkz3SJfPMXwbaumgrmpcYo4OPlR6v2IMRWs=
github.com/y0sher/go-eth2-client v0.0.0-20240225155350-c396641b4956/go.mod h1:TTz7YF6w4z6ahvxKiHuGPn6DbQn7gH6HPuWm/DEQeGE=
github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI=
github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg=
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM=
Expand Down Expand Up @@ -938,8 +940,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT
golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/oauth2 v0.0.0-20170912212905-13449ad91cb2/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand Down
38 changes: 13 additions & 25 deletions protocol/v2/ssv/runner/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (

"github.com/attestantio/go-eth2-client/spec"

"github.com/bloxapp/ssv/beacon/goclient"
"github.com/bloxapp/ssv/logging/fields"
"github.com/bloxapp/ssv/protocol/v2/qbft/controller"
"github.com/bloxapp/ssv/protocol/v2/ssv/runner/metrics"
Expand Down Expand Up @@ -112,19 +111,7 @@ func (r *ProposerRunner) ProcessPreConsensus(logger *zap.Logger, signedMsg *spec
// get block data
obj, ver, err = r.GetBeaconNode().GetBlindedBeaconBlock(duty.Slot, r.GetShare().Graffiti, fullSig)
if err != nil {
// Prysm workaround: when Prysm can't retrieve an MEV block, it responds with an error
// saying the block isn't blinded, implying to request a standard block instead.
// https://github.com/prysmaticlabs/prysm/issues/12103
if nodeClientProvider, ok := r.GetBeaconNode().(goclient.NodeClientProvider); ok &&
nodeClientProvider.NodeClient() == goclient.NodePrysm {
logger.Debug("failed to get blinded beacon block, falling back to standard block")
obj, ver, err = r.GetBeaconNode().GetBeaconBlock(duty.Slot, r.GetShare().Graffiti, fullSig)
if err != nil {
return errors.Wrap(err, "failed falling back from blinded to standard beacon block")
}
} else {
return errors.Wrap(err, "failed to get blinded beacon block")
}
return errors.Wrap(err, "failed to get blinded beacon block")
}
} else {
// get block data
Expand All @@ -133,13 +120,13 @@ func (r *ProposerRunner) ProcessPreConsensus(logger *zap.Logger, signedMsg *spec
return errors.Wrap(err, "failed to get beacon block")
}
}

took := time.Since(start)
// Log essentials about the retrieved block.
blockSummary, summarizeErr := summarizeBlock(obj)
logger.Info("🧊 got beacon block proposal",
zap.String("block_hash", blockSummary.Hash.String()),
zap.Bool("blinded", blockSummary.Blinded),
zap.Duration("took", time.Since(start)),
zap.Duration("took", took),
zap.NamedError("summarize_err", summarizeErr))

byts, err := obj.MarshalSSZ()
Expand Down Expand Up @@ -431,16 +418,17 @@ func summarizeBlock(block any) (summary blockSummary, err error) {
return summary, fmt.Errorf("block is nil")
}
switch b := block.(type) {
case *api.VersionedBlindedProposal:
switch b.Version {
case spec.DataVersionCapella:
return summarizeBlock(b.Capella)
case spec.DataVersionDeneb:
return summarizeBlock(b.Deneb)
default:
return summary, fmt.Errorf("unsupported blinded block version %d", b.Version)
case *api.VersionedV3Proposal:
if b.ExecutionPayloadBlinded {
switch b.Version {
case spec.DataVersionCapella:
return summarizeBlock(b.BlindedCapella)
case spec.DataVersionDeneb:
return summarizeBlock(b.BlindedDeneb)
default:
return summary, fmt.Errorf("unsupported blinded block version %d", b.Version)
}
}
case *api.VersionedProposal:
switch b.Version {
case spec.DataVersionCapella:
return summarizeBlock(b.Capella)
Expand Down
3 changes: 2 additions & 1 deletion scripts/spec-alignment/differ.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ ApprovedChanges: ["256a3dc0f1eb7abf","22b66e9a63ba145b","12c1c3a1622fb7cc","1c44
"ae1b53fc580ce346","c117bd5db3eeabd6","d06552d71b9ca4cd","4cb333a88af66575","2a580187c312c79a","bf8cf93c55c1eadb","6d877e24991465e4",
"b1c8e0148a4a755","2c25abb7c776bd54","a1754e08473bd1fa","4dbab14670fa155d","2a3667a499a23b16","930379d323dd95e8","65efe31656e8814f",
"1270cef2e573f846","aeafb38ca9114f12","2a83e3384b45f2d7","91fbb874b3ce2570","74ad51ca63526e1e","defd8406641d53a5","efa21b9890ec787b",
"6bd22f1a688bbca8","6b29645373ffac35","cfd236570c82c478","e2b0e9c6454c1c08","d5ddc708de23543a","11f8f0ea5709e42e","172a32c59d6f082e"]
"6bd22f1a688bbca8","6b29645373ffac35","cfd236570c82c478","e2b0e9c6454c1c08","d5ddc708de23543a","11f8f0ea5709e42e","172a32c59d6f082e",
"63bbaffe74361d14"]

IgnoredIdentifiers:
- logger
Expand Down
Loading