diff --git a/cl/beacon/handler/format.go b/cl/beacon/handler/format.go index fc938d646..ba734568b 100644 --- a/cl/beacon/handler/format.go +++ b/cl/beacon/handler/format.go @@ -68,51 +68,6 @@ func (r *beaconResponse) withVersion(version clparams.StateVersion) (out *beacon return out } -//// In case of it being a json we need to also expose finalization, version, etc... -//type beaconHandlerFn func(r *http.Request) *beaconResponse -// -//func beaconHandlerWrapper(fn beaconHandlerFn, supportSSZ bool) func(w http.ResponseWriter, r *http.Request) { -// return func(w http.ResponseWriter, r *http.Request) { -// accept := r.Header.Get("Accept") -// isSSZ := !strings.Contains(accept, "application/json") && strings.Contains(accept, "application/stream-octect") -// start := time.Now() -// defer func() { -// log.Debug("[Beacon API] finished", "method", r.Method, "path", r.URL.Path, "duration", time.Since(start)) -// }() -// -// resp := fn(r) -// if resp.internalError != nil { -// http.Error(w, resp.internalError.Error(), http.StatusInternalServerError) -// log.Debug("[Beacon API] failed", "method", r.Method, "err", resp.internalError.Error(), "ssz", isSSZ) -// return -// } -// -// if resp.apiError != nil { -// http.Error(w, resp.apiError.err.Error(), resp.apiError.code) -// log.Debug("[Beacon API] failed", "method", r.Method, "err", resp.apiError.err.Error(), "ssz", isSSZ) -// return -// } -// -// if isSSZ && supportSSZ { -// data := resp.Data -// // SSZ encoding -// encoded, err := data.(ssz.Marshaler).EncodeSSZ(nil) -// if err != nil { -// http.Error(w, err.Error(), http.StatusInternalServerError) -// log.Debug("[Beacon API] failed", "method", r.Method, "err", err, "accepted", accept) -// return -// } -// w.Header().Set("Content-Type", "application/octet-stream") -// w.Write(encoded) -// return -// } -// w.Header().Set("Content-Type", "application/json") -// if err := json.NewEncoder(w).Encode(resp); err != nil { -// log.Warn("[Beacon API] failed", "method", r.Method, "err", err, "ssz", isSSZ) -// } -// } -//} - type chainTag int var ( diff --git a/cl/gossip/gossip.go b/cl/gossip/gossip.go new file mode 100644 index 000000000..05d335273 --- /dev/null +++ b/cl/gossip/gossip.go @@ -0,0 +1,25 @@ +package gossip + +import ( + "strconv" + "strings" +) + +const ( + TopicNameBeaconBlock = "beacon_block" + TopicNameBeaconAggregateAndProof = "beacon_aggregate_and_proof" + TopicNameVoluntaryExit = "voluntary_exit" + TopicNameProposerSlashing = "proposer_slashing" + TopicNameAttesterSlashing = "attester_slashing" + TopicNameBlsToExecutionChange = "bls_to_execution_change" + + TopicNamePrefixBlobSidecar = "blob_sidecar_" +) + +func TopicNameBlobSidecar(d int) string { + return TopicNamePrefixBlobSidecar + strconv.Itoa(d) +} + +func IsTopicBlobSidecar(d string) bool { + return strings.Contains(d, TopicNamePrefixBlobSidecar) +} diff --git a/cl/phase1/network/gossip_manager.go b/cl/phase1/network/gossip_manager.go index abc33f3d6..d7a0543b3 100644 --- a/cl/phase1/network/gossip_manager.go +++ b/cl/phase1/network/gossip_manager.go @@ -3,10 +3,12 @@ package network import ( "context" "fmt" - "github.com/ledgerwatch/erigon-lib/common" "sync" + "github.com/ledgerwatch/erigon-lib/common" + "github.com/ledgerwatch/erigon/cl/freezer" + "github.com/ledgerwatch/erigon/cl/gossip" "github.com/ledgerwatch/erigon/cl/phase1/forkchoice" "github.com/ledgerwatch/erigon/cl/sentinel/peers" @@ -96,8 +98,8 @@ func (g *GossipManager) onRecv(ctx context.Context, data *sentinel.GossipData, l // If the deserialization fails, an error is logged and the loop returns to the next iteration. // If the deserialization is successful, the object is set to the deserialized value and the loop returns to the next iteration. var object ssz.Unmarshaler - switch data.Type { - case sentinel.GossipType_BeaconBlockGossipType: + switch data.Name { + case gossip.TopicNameBeaconBlock: object = cltypes.NewSignedBeaconBlock(g.beaconConfig) if err := object.DecodeSSZ(common.CopyBytes(data.Data), int(version)); err != nil { g.sentinel.BanPeer(ctx, data.Peer) @@ -142,19 +144,19 @@ func (g *GossipManager) onRecv(ctx context.Context, data *sentinel.GossipData, l } g.mu.RUnlock() - case sentinel.GossipType_VoluntaryExitGossipType: + case gossip.TopicNameVoluntaryExit: if err := operationsContract[*cltypes.SignedVoluntaryExit](ctx, g, l, data, int(version), "voluntary exit", g.forkChoice.OnVoluntaryExit); err != nil { return err } - case sentinel.GossipType_ProposerSlashingGossipType: + case gossip.TopicNameProposerSlashing: if err := operationsContract[*cltypes.ProposerSlashing](ctx, g, l, data, int(version), "proposer slashing", g.forkChoice.OnProposerSlashing); err != nil { return err } - case sentinel.GossipType_AttesterSlashingGossipType: + case gossip.TopicNameAttesterSlashing: if err := operationsContract[*cltypes.AttesterSlashing](ctx, g, l, data, int(version), "attester slashing", g.forkChoice.OnAttesterSlashing); err != nil { return err } - case sentinel.GossipType_BlsToExecutionChangeGossipType: + case gossip.TopicNameBlsToExecutionChange: if err := operationsContract[*cltypes.SignedBLSToExecutionChange](ctx, g, l, data, int(version), "bls to execution change", g.forkChoice.OnBlsToExecutionChange); err != nil { return err } diff --git a/cl/rpc/rpc.go b/cl/rpc/rpc.go index 0ada88e81..338edaac3 100644 --- a/cl/rpc/rpc.go +++ b/cl/rpc/rpc.go @@ -186,7 +186,7 @@ func (b *BeaconRpcP2P) PropagateBlock(block *cltypes.SignedBeaconBlock) error { } _, err = b.sentinel.PublishGossip(b.ctx, &sentinel.GossipData{ Data: encoded, - Type: sentinel.GossipType_BeaconBlockGossipType, + Name: "beacon_block", }) return err } diff --git a/cl/sentinel/gossip.go b/cl/sentinel/gossip.go index 4eb2b01e2..7067d79bf 100644 --- a/cl/sentinel/gossip.go +++ b/cl/sentinel/gossip.go @@ -21,6 +21,7 @@ import ( "github.com/ledgerwatch/erigon-lib/common" "github.com/ledgerwatch/erigon/cl/fork" + "github.com/ledgerwatch/erigon/cl/gossip" "github.com/ledgerwatch/log/v3" pubsub "github.com/libp2p/go-libp2p-pubsub" "github.com/libp2p/go-libp2p/core/peer" @@ -36,50 +37,38 @@ var ( const SSZSnappyCodec = "ssz_snappy" -type TopicName string - -const ( - BeaconBlockTopic TopicName = "beacon_block" - BeaconAggregateAndProofTopic TopicName = "beacon_aggregate_and_proof" - VoluntaryExitTopic TopicName = "voluntary_exit" - ProposerSlashingTopic TopicName = "proposer_slashing" - AttesterSlashingTopic TopicName = "attester_slashing" - BlsToExecutionChangeTopic TopicName = "bls_to_execution_change" - BlobSidecarTopic TopicName = "blob_sidecar_%d" // This topic needs an index -) - type GossipTopic struct { - Name TopicName + Name string CodecStr string } var BeaconBlockSsz = GossipTopic{ - Name: BeaconBlockTopic, + Name: gossip.TopicNameBeaconBlock, CodecStr: SSZSnappyCodec, } var BeaconAggregateAndProofSsz = GossipTopic{ - Name: BeaconAggregateAndProofTopic, + Name: gossip.TopicNameBeaconAggregateAndProof, CodecStr: SSZSnappyCodec, } var VoluntaryExitSsz = GossipTopic{ - Name: VoluntaryExitTopic, + Name: gossip.TopicNameVoluntaryExit, CodecStr: SSZSnappyCodec, } var ProposerSlashingSsz = GossipTopic{ - Name: ProposerSlashingTopic, + Name: gossip.TopicNameProposerSlashing, CodecStr: SSZSnappyCodec, } var AttesterSlashingSsz = GossipTopic{ - Name: AttesterSlashingTopic, + Name: gossip.TopicNameAttesterSlashing, CodecStr: SSZSnappyCodec, } var BlsToExecutionChangeSsz = GossipTopic{ - Name: BlsToExecutionChangeTopic, + Name: gossip.TopicNameBlsToExecutionChange, CodecStr: SSZSnappyCodec, } @@ -105,7 +94,7 @@ func NewGossipManager( func GossipSidecarTopics(maxBlobs uint64) (ret []GossipTopic) { for i := uint64(0); i < maxBlobs; i++ { ret = append(ret, GossipTopic{ - Name: TopicName(fmt.Sprintf(string(BlobSidecarTopic), i)), + Name: gossip.TopicNameBlobSidecar(int(i)), CodecStr: SSZSnappyCodec, }) } @@ -204,7 +193,7 @@ func (s *Sentinel) SubscribeGossip(topic GossipTopic, opts ...pubsub.TopicOpt) ( if err != nil { return nil, fmt.Errorf("failed to join topic %s, err=%w", path, err) } - topicScoreParams := s.topicScoreParams(string(topic.Name)) + topicScoreParams := s.topicScoreParams(topic.Name) if topicScoreParams != nil { sub.topic.SetScoreParams(topicScoreParams) } @@ -225,7 +214,7 @@ func (s *Sentinel) Unsubscribe(topic GossipTopic, opts ...pubsub.TopicOpt) (err func (s *Sentinel) topicScoreParams(topic string) *pubsub.TopicScoreParams { switch { - case strings.Contains(topic, string(BeaconBlockTopic)): + case strings.Contains(topic, gossip.TopicNameBeaconBlock): return s.defaultBlockTopicParams() /*case strings.Contains(topic, GossipAggregateAndProofMessage): return defaultAggregateTopicParams(activeValidators), nil @@ -334,14 +323,14 @@ func (s *GossipSubscription) Close() { } type GossipMessage struct { - From peer.ID - Topic TopicName - Data []byte + From peer.ID + TopicName string + Data []byte } // this is a helper to begin running the gossip subscription. // function should not be used outside of the constructor for gossip subscription -func (s *GossipSubscription) run(ctx context.Context, sub *pubsub.Subscription, topic string) { +func (s *GossipSubscription) run(ctx context.Context, sub *pubsub.Subscription, topicName string) { defer func() { if r := recover(); r != nil { log.Error("[Sentinel Gossip] Message Handler Crashed", "err", r) @@ -359,16 +348,16 @@ func (s *GossipSubscription) run(ctx context.Context, sub *pubsub.Subscription, if errors.Is(err, context.Canceled) { return } - log.Warn("[Sentinel] fail to decode gossip packet", "err", err, "topic", topic) + log.Warn("[Sentinel] fail to decode gossip packet", "err", err, "topicName", topicName) return } if msg.GetFrom() == s.host { continue } s.ch <- &GossipMessage{ - From: msg.GetFrom(), - Topic: TopicName(topic), - Data: common.Copy(msg.Data), + From: msg.GetFrom(), + TopicName: topicName, + Data: common.Copy(msg.Data), } } } diff --git a/cl/sentinel/sentinel_gossip_test.go b/cl/sentinel/sentinel_gossip_test.go index a5fcac8a1..5ef8b2082 100644 --- a/cl/sentinel/sentinel_gossip_test.go +++ b/cl/sentinel/sentinel_gossip_test.go @@ -85,7 +85,7 @@ func TestSentinelGossipOnHardFork(t *testing.T) { ans := <-ch require.Equal(t, ans.Data, msg) - previousTopic = string(ans.Topic) + previousTopic = ans.TopicName bcfg.AltairForkEpoch = clparams.MainnetBeaconConfig.AltairForkEpoch bcfg.InitializeForkSchedule() @@ -94,12 +94,12 @@ func TestSentinelGossipOnHardFork(t *testing.T) { msg = []byte("hello1") go func() { // delay to make sure that the connection is established - sub1 = sentinel1.subManager.GetMatchingSubscription(string(BeaconBlockSsz.Name)) + sub1 = sentinel1.subManager.GetMatchingSubscription(BeaconBlockSsz.Name) sub1.Publish(msg) }() ans = <-ch require.Equal(t, ans.Data, msg) - require.NotEqual(t, previousTopic, ans.Topic) + require.NotEqual(t, previousTopic, ans.TopicName) } diff --git a/cl/sentinel/service/notifiers.go b/cl/sentinel/service/notifiers.go index 8af9b991a..7297dc818 100644 --- a/cl/sentinel/service/notifiers.go +++ b/cl/sentinel/service/notifiers.go @@ -4,7 +4,7 @@ import ( "fmt" "sync" - "github.com/ledgerwatch/erigon-lib/gointerfaces/sentinel" + "github.com/ledgerwatch/erigon/cl/gossip" ) const ( @@ -12,10 +12,9 @@ const ( ) type gossipObject struct { - data []byte // gossip data - t sentinel.GossipType // determine which gossip message we are notifying of - pid string // pid is the peer id of the sender - blobIndex *uint32 // index of the blob + data []byte // gossip data + t string // determine which gossip message we are notifying of + pid string // pid is the peer id of the sender } type gossipNotifier struct { @@ -30,7 +29,7 @@ func newGossipNotifier() *gossipNotifier { } } -func (g *gossipNotifier) notify(t sentinel.GossipType, data []byte, pid string) { +func (g *gossipNotifier) notify(t string, data []byte, pid string) { g.mu.Lock() defer g.mu.Unlock() @@ -43,18 +42,15 @@ func (g *gossipNotifier) notify(t sentinel.GossipType, data []byte, pid string) } } -func (g *gossipNotifier) notifyBlob(t sentinel.GossipType, data []byte, pid string, blobIndex int) { +func (g *gossipNotifier) notifyBlob(data []byte, pid string, blobIndex int) { g.mu.Lock() defer g.mu.Unlock() - index := new(uint32) - *index = uint32(blobIndex) for _, ch := range g.notifiers { ch <- gossipObject{ - data: data, - t: t, - pid: pid, - blobIndex: index, + data: data, + t: gossip.TopicNameBlobSidecar(blobIndex), + pid: pid, } } } diff --git a/cl/sentinel/service/service.go b/cl/sentinel/service/service.go index 850157ea0..d43b40cb6 100644 --- a/cl/sentinel/service/service.go +++ b/cl/sentinel/service/service.go @@ -3,7 +3,6 @@ package service import ( "bytes" "context" - "errors" "fmt" "io" "net/http" @@ -13,6 +12,7 @@ import ( "time" "github.com/ledgerwatch/erigon-lib/diagnostics" + "github.com/ledgerwatch/erigon/cl/gossip" "github.com/ledgerwatch/erigon/cl/sentinel" "github.com/ledgerwatch/erigon/cl/sentinel/httpreqresp" @@ -50,7 +50,7 @@ func NewSentinelServer(ctx context.Context, sentinel *sentinel.Sentinel, logger // extractBlobSideCarIndex takes a topic and extract the blob sidecar func extractBlobSideCarIndex(topic string) int { // compute the index prefixless - startIndex := strings.Index(topic, string(sentinel.BlobSidecarTopic)) + len(sentinel.BlobSidecarTopic) + startIndex := strings.Index(topic, gossip.TopicNamePrefixBlobSidecar) + len(gossip.TopicNamePrefixBlobSidecar) endIndex := strings.Index(topic[:startIndex], "/") blobIndex, err := strconv.Atoi(topic[startIndex:endIndex]) if err != nil { @@ -77,28 +77,30 @@ func (s *SentinelServer) PublishGossip(_ context.Context, msg *sentinelrpc.Gossi // Snappify payload before sending it to gossip compressedData := utils.CompressSnappy(msg.Data) - s.trackPeerStatistics(msg.GetPeer().Pid, false, msg.Type.String(), "unknown", len(compressedData)) + s.trackPeerStatistics(msg.GetPeer().Pid, false, msg.Name, "unknown", len(compressedData)) var subscription *sentinel.GossipSubscription - switch msg.Type { - case sentinelrpc.GossipType_BeaconBlockGossipType: - subscription = manager.GetMatchingSubscription(string(sentinel.BeaconBlockTopic)) - case sentinelrpc.GossipType_AggregateAndProofGossipType: - subscription = manager.GetMatchingSubscription(string(sentinel.BeaconAggregateAndProofTopic)) - case sentinelrpc.GossipType_VoluntaryExitGossipType: - subscription = manager.GetMatchingSubscription(string(sentinel.VoluntaryExitTopic)) - case sentinelrpc.GossipType_ProposerSlashingGossipType: - subscription = manager.GetMatchingSubscription(string(sentinel.ProposerSlashingTopic)) - case sentinelrpc.GossipType_AttesterSlashingGossipType: - subscription = manager.GetMatchingSubscription(string(sentinel.AttesterSlashingTopic)) - case sentinelrpc.GossipType_BlobSidecarType: - if msg.BlobIndex == nil { - return &sentinelrpc.EmptyMessage{}, errors.New("cannot publish sidecar blob with no index") - } - subscription = manager.GetMatchingSubscription(fmt.Sprintf(string(sentinel.BlobSidecarTopic), *msg.BlobIndex)) + // TODO: this is still wrong... we should build a subscription here to match exactly, meaning that downstream consumers should be + // in charge of keeping track of fork id. + switch msg.Name { + case gossip.TopicNameBeaconBlock: + subscription = manager.GetMatchingSubscription(msg.Name) + case gossip.TopicNameBeaconAggregateAndProof: + subscription = manager.GetMatchingSubscription(msg.Name) + case gossip.TopicNameVoluntaryExit: + subscription = manager.GetMatchingSubscription(msg.Name) + case gossip.TopicNameProposerSlashing: + subscription = manager.GetMatchingSubscription(msg.Name) + case gossip.TopicNameAttesterSlashing: + subscription = manager.GetMatchingSubscription(msg.Name) default: - return &sentinelrpc.EmptyMessage{}, nil + switch { + case gossip.IsTopicBlobSidecar(msg.Name): + subscription = manager.GetMatchingSubscription(msg.Name) + default: + return &sentinelrpc.EmptyMessage{}, nil + } } if subscription == nil { return &sentinelrpc.EmptyMessage{}, nil @@ -122,11 +124,10 @@ func (s *SentinelServer) SubscribeGossip(_ *sentinelrpc.EmptyMessage, stream sen case packet := <-ch: if err := stream.Send(&sentinelrpc.GossipData{ Data: packet.data, - Type: packet.t, + Name: packet.t, Peer: &sentinelrpc.Peer{ Pid: packet.pid, }, - BlobIndex: packet.blobIndex, }); err != nil { s.logger.Warn("[Sentinel] Could not relay gossip packet", "reason", err) } @@ -274,10 +275,10 @@ func (s *SentinelServer) ListenToGossip() { func (s *SentinelServer) handleGossipPacket(pkt *sentinel.GossipMessage) error { var err error - s.logger.Trace("[Sentinel Gossip] Received Packet", "topic", pkt.Topic) + s.logger.Trace("[Sentinel Gossip] Received Packet", "topic", pkt.TopicName) data := pkt.Data - topic := string(pkt.Topic) + topic := pkt.TopicName // If we use snappy codec then decompress it accordingly. if strings.Contains(topic, sentinel.SSZSnappyCodec) { data, err = utils.DecompressSnappy(data) @@ -294,21 +295,21 @@ func (s *SentinelServer) handleGossipPacket(pkt *sentinel.GossipMessage) error { s.trackPeerStatistics(string(textPid), true, msgType, msgCap, len(data)) // Check to which gossip it belongs to. - if strings.Contains(topic, string(sentinel.BeaconBlockTopic)) { - s.gossipNotifier.notify(sentinelrpc.GossipType_BeaconBlockGossipType, data, string(textPid)) - } else if strings.Contains(topic, string(sentinel.BeaconAggregateAndProofTopic)) { - s.gossipNotifier.notify(sentinelrpc.GossipType_AggregateAndProofGossipType, data, string(textPid)) - } else if strings.Contains(topic, string(sentinel.VoluntaryExitTopic)) { - s.gossipNotifier.notify(sentinelrpc.GossipType_VoluntaryExitGossipType, data, string(textPid)) - } else if strings.Contains(topic, string(sentinel.ProposerSlashingTopic)) { - s.gossipNotifier.notify(sentinelrpc.GossipType_ProposerSlashingGossipType, data, string(textPid)) - } else if strings.Contains(topic, string(sentinel.AttesterSlashingTopic)) { - s.gossipNotifier.notify(sentinelrpc.GossipType_AttesterSlashingGossipType, data, string(textPid)) - } else if strings.Contains(topic, string(sentinel.BlsToExecutionChangeTopic)) { - s.gossipNotifier.notify(sentinelrpc.GossipType_BlsToExecutionChangeGossipType, data, string(textPid)) - } else if strings.Contains(topic, string(sentinel.BlobSidecarTopic)) { + if strings.Contains(topic, string(gossip.TopicNameBeaconBlock)) { + s.gossipNotifier.notify(gossip.TopicNameBeaconBlock, data, string(textPid)) + } else if strings.Contains(topic, string(gossip.TopicNameBeaconAggregateAndProof)) { + s.gossipNotifier.notify(gossip.TopicNameBeaconAggregateAndProof, data, string(textPid)) + } else if strings.Contains(topic, string(gossip.TopicNameVoluntaryExit)) { + s.gossipNotifier.notify(gossip.TopicNameVoluntaryExit, data, string(textPid)) + } else if strings.Contains(topic, string(gossip.TopicNameProposerSlashing)) { + s.gossipNotifier.notify(gossip.TopicNameProposerSlashing, data, string(textPid)) + } else if strings.Contains(topic, string(gossip.TopicNameAttesterSlashing)) { + s.gossipNotifier.notify(gossip.TopicNameAttesterSlashing, data, string(textPid)) + } else if strings.Contains(topic, string(gossip.TopicNameBlsToExecutionChange)) { + s.gossipNotifier.notify(gossip.TopicNameBlsToExecutionChange, data, string(textPid)) + } else if gossip.IsTopicBlobSidecar(topic) { // extract the index - s.gossipNotifier.notifyBlob(sentinelrpc.GossipType_BlobSidecarType, data, string(textPid), extractBlobSideCarIndex(topic)) + s.gossipNotifier.notifyBlob(data, string(textPid), extractBlobSideCarIndex(topic)) } return nil } diff --git a/erigon-lib/gointerfaces/downloader/downloader_grpc.pb.go b/erigon-lib/gointerfaces/downloader/downloader_grpc.pb.go index d3a0468ff..369c9b494 100644 --- a/erigon-lib/gointerfaces/downloader/downloader_grpc.pb.go +++ b/erigon-lib/gointerfaces/downloader/downloader_grpc.pb.go @@ -31,7 +31,7 @@ const ( // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type DownloaderClient interface { - // Erigon "download once" - means restart/upgrade will not download files (and will be fast) + // Erigon "download once" - means restart/upgrade/downgrade will not download files (and will be fast) // After "download once" - Erigon will produce and seed new files // Downloader will able: seed new files (already existing on FS), download uncomplete parts of existing files (if Verify found some bad parts) ProhibitNewDownloads(ctx context.Context, in *ProhibitNewDownloadsRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) @@ -101,7 +101,7 @@ func (c *downloaderClient) Stats(ctx context.Context, in *StatsRequest, opts ... // All implementations must embed UnimplementedDownloaderServer // for forward compatibility type DownloaderServer interface { - // Erigon "download once" - means restart/upgrade will not download files (and will be fast) + // Erigon "download once" - means restart/upgrade/downgrade will not download files (and will be fast) // After "download once" - Erigon will produce and seed new files // Downloader will able: seed new files (already existing on FS), download uncomplete parts of existing files (if Verify found some bad parts) ProhibitNewDownloads(context.Context, *ProhibitNewDownloadsRequest) (*emptypb.Empty, error) diff --git a/erigon-lib/gointerfaces/sentinel/sentinel.pb.go b/erigon-lib/gointerfaces/sentinel/sentinel.pb.go index 0fc32fe89..35477c388 100644 --- a/erigon-lib/gointerfaces/sentinel/sentinel.pb.go +++ b/erigon-lib/gointerfaces/sentinel/sentinel.pb.go @@ -21,68 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type GossipType int32 - -const ( - // Global gossip topics. - GossipType_BeaconBlockGossipType GossipType = 0 - GossipType_AggregateAndProofGossipType GossipType = 1 - GossipType_VoluntaryExitGossipType GossipType = 2 - GossipType_ProposerSlashingGossipType GossipType = 3 - GossipType_AttesterSlashingGossipType GossipType = 4 - GossipType_BlobSidecarType GossipType = 5 - GossipType_BlsToExecutionChangeGossipType GossipType = 6 -) - -// Enum value maps for GossipType. -var ( - GossipType_name = map[int32]string{ - 0: "BeaconBlockGossipType", - 1: "AggregateAndProofGossipType", - 2: "VoluntaryExitGossipType", - 3: "ProposerSlashingGossipType", - 4: "AttesterSlashingGossipType", - 5: "BlobSidecarType", - 6: "BlsToExecutionChangeGossipType", - } - GossipType_value = map[string]int32{ - "BeaconBlockGossipType": 0, - "AggregateAndProofGossipType": 1, - "VoluntaryExitGossipType": 2, - "ProposerSlashingGossipType": 3, - "AttesterSlashingGossipType": 4, - "BlobSidecarType": 5, - "BlsToExecutionChangeGossipType": 6, - } -) - -func (x GossipType) Enum() *GossipType { - p := new(GossipType) - *p = x - return p -} - -func (x GossipType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (GossipType) Descriptor() protoreflect.EnumDescriptor { - return file_p2psentinel_sentinel_proto_enumTypes[0].Descriptor() -} - -func (GossipType) Type() protoreflect.EnumType { - return &file_p2psentinel_sentinel_proto_enumTypes[0] -} - -func (x GossipType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use GossipType.Descriptor instead. -func (GossipType) EnumDescriptor() ([]byte, []int) { - return file_p2psentinel_sentinel_proto_rawDescGZIP(), []int{0} -} - type EmptyMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -173,10 +111,9 @@ type GossipData struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // SSZ encoded data - Type GossipType `protobuf:"varint,2,opt,name=type,proto3,enum=sentinel.GossipType" json:"type,omitempty"` - Peer *Peer `protobuf:"bytes,3,opt,name=peer,proto3,oneof" json:"peer,omitempty"` - BlobIndex *uint32 `protobuf:"varint,4,opt,name=blob_index,json=blobIndex,proto3,oneof" json:"blob_index,omitempty"` // Blob identifier for EIP4844 + Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // SSZ encoded data + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Peer *Peer `protobuf:"bytes,3,opt,name=peer,proto3,oneof" json:"peer,omitempty"` } func (x *GossipData) Reset() { @@ -218,11 +155,11 @@ func (x *GossipData) GetData() []byte { return nil } -func (x *GossipData) GetType() GossipType { +func (x *GossipData) GetName() string { if x != nil { - return x.Type + return x.Name } - return GossipType_BeaconBlockGossipType + return "" } func (x *GossipData) GetPeer() *Peer { @@ -232,13 +169,6 @@ func (x *GossipData) GetPeer() *Peer { return nil } -func (x *GossipData) GetBlobIndex() uint32 { - if x != nil && x.BlobIndex != nil { - return *x.BlobIndex - } - return 0 -} - type Status struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -492,92 +422,73 @@ var file_p2psentinel_sentinel_proto_rawDesc = []byte{ 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x0e, 0x0a, 0x0c, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x18, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x70, 0x69, 0x64, 0x22, 0xaf, 0x01, 0x0a, 0x0a, 0x47, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x44, 0x61, - 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x28, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, - 0x47, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x12, 0x27, 0x0a, 0x04, 0x70, 0x65, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x48, 0x00, - 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 0x22, 0x0a, 0x0a, 0x62, 0x6c, 0x6f, - 0x62, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x09, 0x62, 0x6c, 0x6f, 0x62, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, - 0x05, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x62, 0x6c, 0x6f, 0x62, 0x5f, - 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0xcd, 0x01, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x12, 0x1f, 0x0a, 0x0b, 0x66, 0x6f, 0x72, 0x6b, 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x66, 0x6f, 0x72, 0x6b, 0x44, 0x69, 0x67, 0x65, 0x73, - 0x74, 0x12, 0x32, 0x0a, 0x0e, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x72, - 0x6f, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x48, 0x32, 0x35, 0x36, 0x52, 0x0d, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, - 0x64, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, - 0x65, 0x64, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, - 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x28, - 0x0a, 0x09, 0x68, 0x65, 0x61, 0x64, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x32, 0x35, 0x36, 0x52, 0x08, - 0x68, 0x65, 0x61, 0x64, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x65, 0x61, 0x64, - 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x68, 0x65, 0x61, - 0x64, 0x53, 0x6c, 0x6f, 0x74, 0x22, 0x23, 0x0a, 0x09, 0x50, 0x65, 0x65, 0x72, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x37, 0x0a, 0x0b, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, + 0x70, 0x69, 0x64, 0x22, 0x66, 0x0a, 0x0a, 0x47, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x44, 0x61, 0x74, + 0x61, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x04, 0x70, 0x65, 0x65, + 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, + 0x65, 0x6c, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x48, 0x00, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x88, + 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x22, 0xcd, 0x01, 0x0a, 0x06, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x66, 0x6f, 0x72, 0x6b, 0x5f, 0x64, + 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x66, 0x6f, 0x72, + 0x6b, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x32, 0x0a, 0x0e, 0x66, 0x69, 0x6e, 0x61, 0x6c, + 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x32, 0x35, 0x36, 0x52, 0x0d, 0x66, 0x69, + 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x66, + 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x45, + 0x70, 0x6f, 0x63, 0x68, 0x12, 0x28, 0x0a, 0x09, 0x68, 0x65, 0x61, 0x64, 0x5f, 0x72, 0x6f, 0x6f, + 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x48, 0x32, 0x35, 0x36, 0x52, 0x08, 0x68, 0x65, 0x61, 0x64, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x1b, + 0x0a, 0x09, 0x68, 0x65, 0x61, 0x64, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x08, 0x68, 0x65, 0x61, 0x64, 0x53, 0x6c, 0x6f, 0x74, 0x22, 0x23, 0x0a, 0x09, 0x50, + 0x65, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 0x22, 0x37, 0x0a, 0x0b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x44, 0x61, 0x74, 0x61, 0x12, + 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, + 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x22, 0x5c, 0x0a, 0x0c, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, - 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, - 0x70, 0x69, 0x63, 0x22, 0x5c, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x44, - 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x22, 0x0a, - 0x04, 0x70, 0x65, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x73, 0x65, - 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x70, 0x65, 0x65, - 0x72, 0x2a, 0xde, 0x01, 0x0a, 0x0a, 0x47, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x19, 0x0a, 0x15, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x47, - 0x6f, 0x73, 0x73, 0x69, 0x70, 0x54, 0x79, 0x70, 0x65, 0x10, 0x00, 0x12, 0x1f, 0x0a, 0x1b, 0x41, - 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x41, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x6f, 0x66, - 0x47, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x54, 0x79, 0x70, 0x65, 0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, - 0x56, 0x6f, 0x6c, 0x75, 0x6e, 0x74, 0x61, 0x72, 0x79, 0x45, 0x78, 0x69, 0x74, 0x47, 0x6f, 0x73, - 0x73, 0x69, 0x70, 0x54, 0x79, 0x70, 0x65, 0x10, 0x02, 0x12, 0x1e, 0x0a, 0x1a, 0x50, 0x72, 0x6f, - 0x70, 0x6f, 0x73, 0x65, 0x72, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x47, 0x6f, 0x73, - 0x73, 0x69, 0x70, 0x54, 0x79, 0x70, 0x65, 0x10, 0x03, 0x12, 0x1e, 0x0a, 0x1a, 0x41, 0x74, 0x74, - 0x65, 0x73, 0x74, 0x65, 0x72, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x47, 0x6f, 0x73, - 0x73, 0x69, 0x70, 0x54, 0x79, 0x70, 0x65, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x42, 0x6c, 0x6f, - 0x62, 0x53, 0x69, 0x64, 0x65, 0x63, 0x61, 0x72, 0x54, 0x79, 0x70, 0x65, 0x10, 0x05, 0x12, 0x22, - 0x0a, 0x1e, 0x42, 0x6c, 0x73, 0x54, 0x6f, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, - 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x47, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x54, 0x79, 0x70, 0x65, - 0x10, 0x06, 0x32, 0x90, 0x04, 0x0a, 0x08, 0x53, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x12, - 0x41, 0x0a, 0x0f, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x47, 0x6f, 0x73, 0x73, - 0x69, 0x70, 0x12, 0x16, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x14, 0x2e, 0x73, 0x65, 0x6e, - 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x47, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x44, 0x61, 0x74, 0x61, - 0x30, 0x01, 0x12, 0x3c, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x15, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x44, 0x61, 0x74, 0x61, 0x1a, 0x16, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, - 0x6e, 0x65, 0x6c, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x44, 0x61, 0x74, 0x61, - 0x12, 0x35, 0x0a, 0x09, 0x53, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x10, 0x2e, - 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1a, - 0x16, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x50, 0x65, - 0x65, 0x72, 0x73, 0x12, 0x16, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x13, 0x2e, 0x73, 0x65, - 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x12, 0x31, 0x0a, 0x07, 0x42, 0x61, 0x6e, 0x50, 0x65, 0x65, 0x72, 0x12, 0x0e, 0x2e, 0x73, 0x65, - 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x1a, 0x16, 0x2e, 0x73, 0x65, - 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x12, 0x33, 0x0a, 0x09, 0x55, 0x6e, 0x62, 0x61, 0x6e, 0x50, 0x65, 0x65, 0x72, + 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x65, 0x72, + 0x72, 0x6f, 0x72, 0x12, 0x22, 0x0a, 0x04, 0x70, 0x65, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x0e, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x50, 0x65, 0x65, + 0x72, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x32, 0x90, 0x04, 0x0a, 0x08, 0x53, 0x65, 0x6e, 0x74, + 0x69, 0x6e, 0x65, 0x6c, 0x12, 0x41, 0x0a, 0x0f, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, + 0x65, 0x47, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x12, 0x16, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, + 0x65, 0x6c, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, + 0x14, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x47, 0x6f, 0x73, 0x73, 0x69, + 0x70, 0x44, 0x61, 0x74, 0x61, 0x30, 0x01, 0x12, 0x3c, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, + 0x6c, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x44, 0x61, 0x74, 0x61, 0x1a, 0x16, 0x2e, + 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x35, 0x0a, 0x09, 0x53, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x12, 0x10, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x1a, 0x16, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x37, 0x0a, 0x08, + 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x16, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, + 0x6e, 0x65, 0x6c, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x1a, 0x13, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x50, 0x65, 0x65, 0x72, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x31, 0x0a, 0x07, 0x42, 0x61, 0x6e, 0x50, 0x65, 0x65, 0x72, 0x12, 0x0e, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x1a, 0x16, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x36, 0x0a, 0x0c, 0x50, 0x65, 0x6e, 0x61, - 0x6c, 0x69, 0x7a, 0x65, 0x50, 0x65, 0x65, 0x72, 0x12, 0x0e, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, - 0x6e, 0x65, 0x6c, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x1a, 0x16, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, - 0x6e, 0x65, 0x6c, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x12, 0x34, 0x0a, 0x0a, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x50, 0x65, 0x65, 0x72, 0x12, 0x0e, - 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x1a, 0x16, - 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3d, 0x0a, 0x0d, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, - 0x68, 0x47, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x12, 0x14, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, - 0x65, 0x6c, 0x2e, 0x47, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x44, 0x61, 0x74, 0x61, 0x1a, 0x16, 0x2e, + 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x33, 0x0a, 0x09, 0x55, 0x6e, 0x62, 0x61, + 0x6e, 0x50, 0x65, 0x65, 0x72, 0x12, 0x0e, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, + 0x2e, 0x50, 0x65, 0x65, 0x72, 0x1a, 0x16, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, + 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x36, 0x0a, + 0x0c, 0x50, 0x65, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x50, 0x65, 0x65, 0x72, 0x12, 0x0e, 0x2e, + 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x1a, 0x16, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x15, 0x5a, 0x13, 0x2e, 0x2f, 0x73, 0x65, 0x6e, 0x74, 0x69, - 0x6e, 0x65, 0x6c, 0x3b, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x34, 0x0a, 0x0a, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x50, + 0x65, 0x65, 0x72, 0x12, 0x0e, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x50, + 0x65, 0x65, 0x72, 0x1a, 0x16, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3d, 0x0a, 0x0d, 0x50, + 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x47, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x12, 0x14, 0x2e, 0x73, + 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x47, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x44, 0x61, + 0x74, 0x61, 0x1a, 0x16, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x15, 0x5a, 0x13, 0x2e, 0x2f, + 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x3b, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, + 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -592,48 +503,45 @@ func file_p2psentinel_sentinel_proto_rawDescGZIP() []byte { return file_p2psentinel_sentinel_proto_rawDescData } -var file_p2psentinel_sentinel_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_p2psentinel_sentinel_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_p2psentinel_sentinel_proto_goTypes = []interface{}{ - (GossipType)(0), // 0: sentinel.GossipType - (*EmptyMessage)(nil), // 1: sentinel.EmptyMessage - (*Peer)(nil), // 2: sentinel.Peer - (*GossipData)(nil), // 3: sentinel.GossipData - (*Status)(nil), // 4: sentinel.Status - (*PeerCount)(nil), // 5: sentinel.PeerCount - (*RequestData)(nil), // 6: sentinel.RequestData - (*ResponseData)(nil), // 7: sentinel.ResponseData - (*types.H256)(nil), // 8: types.H256 + (*EmptyMessage)(nil), // 0: sentinel.EmptyMessage + (*Peer)(nil), // 1: sentinel.Peer + (*GossipData)(nil), // 2: sentinel.GossipData + (*Status)(nil), // 3: sentinel.Status + (*PeerCount)(nil), // 4: sentinel.PeerCount + (*RequestData)(nil), // 5: sentinel.RequestData + (*ResponseData)(nil), // 6: sentinel.ResponseData + (*types.H256)(nil), // 7: types.H256 } var file_p2psentinel_sentinel_proto_depIdxs = []int32{ - 0, // 0: sentinel.GossipData.type:type_name -> sentinel.GossipType - 2, // 1: sentinel.GossipData.peer:type_name -> sentinel.Peer - 8, // 2: sentinel.Status.finalized_root:type_name -> types.H256 - 8, // 3: sentinel.Status.head_root:type_name -> types.H256 - 2, // 4: sentinel.ResponseData.peer:type_name -> sentinel.Peer - 1, // 5: sentinel.Sentinel.SubscribeGossip:input_type -> sentinel.EmptyMessage - 6, // 6: sentinel.Sentinel.SendRequest:input_type -> sentinel.RequestData - 4, // 7: sentinel.Sentinel.SetStatus:input_type -> sentinel.Status - 1, // 8: sentinel.Sentinel.GetPeers:input_type -> sentinel.EmptyMessage - 2, // 9: sentinel.Sentinel.BanPeer:input_type -> sentinel.Peer - 2, // 10: sentinel.Sentinel.UnbanPeer:input_type -> sentinel.Peer - 2, // 11: sentinel.Sentinel.PenalizePeer:input_type -> sentinel.Peer - 2, // 12: sentinel.Sentinel.RewardPeer:input_type -> sentinel.Peer - 3, // 13: sentinel.Sentinel.PublishGossip:input_type -> sentinel.GossipData - 3, // 14: sentinel.Sentinel.SubscribeGossip:output_type -> sentinel.GossipData - 7, // 15: sentinel.Sentinel.SendRequest:output_type -> sentinel.ResponseData - 1, // 16: sentinel.Sentinel.SetStatus:output_type -> sentinel.EmptyMessage - 5, // 17: sentinel.Sentinel.GetPeers:output_type -> sentinel.PeerCount - 1, // 18: sentinel.Sentinel.BanPeer:output_type -> sentinel.EmptyMessage - 1, // 19: sentinel.Sentinel.UnbanPeer:output_type -> sentinel.EmptyMessage - 1, // 20: sentinel.Sentinel.PenalizePeer:output_type -> sentinel.EmptyMessage - 1, // 21: sentinel.Sentinel.RewardPeer:output_type -> sentinel.EmptyMessage - 1, // 22: sentinel.Sentinel.PublishGossip:output_type -> sentinel.EmptyMessage - 14, // [14:23] is the sub-list for method output_type - 5, // [5:14] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 1, // 0: sentinel.GossipData.peer:type_name -> sentinel.Peer + 7, // 1: sentinel.Status.finalized_root:type_name -> types.H256 + 7, // 2: sentinel.Status.head_root:type_name -> types.H256 + 1, // 3: sentinel.ResponseData.peer:type_name -> sentinel.Peer + 0, // 4: sentinel.Sentinel.SubscribeGossip:input_type -> sentinel.EmptyMessage + 5, // 5: sentinel.Sentinel.SendRequest:input_type -> sentinel.RequestData + 3, // 6: sentinel.Sentinel.SetStatus:input_type -> sentinel.Status + 0, // 7: sentinel.Sentinel.GetPeers:input_type -> sentinel.EmptyMessage + 1, // 8: sentinel.Sentinel.BanPeer:input_type -> sentinel.Peer + 1, // 9: sentinel.Sentinel.UnbanPeer:input_type -> sentinel.Peer + 1, // 10: sentinel.Sentinel.PenalizePeer:input_type -> sentinel.Peer + 1, // 11: sentinel.Sentinel.RewardPeer:input_type -> sentinel.Peer + 2, // 12: sentinel.Sentinel.PublishGossip:input_type -> sentinel.GossipData + 2, // 13: sentinel.Sentinel.SubscribeGossip:output_type -> sentinel.GossipData + 6, // 14: sentinel.Sentinel.SendRequest:output_type -> sentinel.ResponseData + 0, // 15: sentinel.Sentinel.SetStatus:output_type -> sentinel.EmptyMessage + 4, // 16: sentinel.Sentinel.GetPeers:output_type -> sentinel.PeerCount + 0, // 17: sentinel.Sentinel.BanPeer:output_type -> sentinel.EmptyMessage + 0, // 18: sentinel.Sentinel.UnbanPeer:output_type -> sentinel.EmptyMessage + 0, // 19: sentinel.Sentinel.PenalizePeer:output_type -> sentinel.EmptyMessage + 0, // 20: sentinel.Sentinel.RewardPeer:output_type -> sentinel.EmptyMessage + 0, // 21: sentinel.Sentinel.PublishGossip:output_type -> sentinel.EmptyMessage + 13, // [13:22] is the sub-list for method output_type + 4, // [4:13] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_p2psentinel_sentinel_proto_init() } @@ -733,14 +641,13 @@ func file_p2psentinel_sentinel_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_p2psentinel_sentinel_proto_rawDesc, - NumEnums: 1, + NumEnums: 0, NumMessages: 7, NumExtensions: 0, NumServices: 1, }, GoTypes: file_p2psentinel_sentinel_proto_goTypes, DependencyIndexes: file_p2psentinel_sentinel_proto_depIdxs, - EnumInfos: file_p2psentinel_sentinel_proto_enumTypes, MessageInfos: file_p2psentinel_sentinel_proto_msgTypes, }.Build() File_p2psentinel_sentinel_proto = out.File diff --git a/go.mod b/go.mod index 89c44138b..c27a292f7 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,6 @@ go 1.20 require ( github.com/erigontech/mdbx-go v0.27.21 github.com/erigontech/silkworm-go v0.10.0 - github.com/ledgerwatch/erigon-lib v1.0.0 github.com/ledgerwatch/log/v3 v3.9.0 github.com/ledgerwatch/secp256k1 v1.0.0 ) @@ -58,6 +57,7 @@ require ( github.com/json-iterator/go v1.1.12 github.com/julienschmidt/httprouter v1.3.0 github.com/klauspost/compress v1.17.3 + github.com/ledgerwatch/erigon-lib v1.0.0 github.com/libp2p/go-libp2p v0.31.0 github.com/libp2p/go-libp2p-mplex v0.9.0 github.com/libp2p/go-libp2p-pubsub v0.9.3