diff --git a/beacon-chain/main.go b/beacon-chain/main.go index 362405fe1c4..075b4c03839 100644 --- a/beacon-chain/main.go +++ b/beacon-chain/main.go @@ -59,6 +59,7 @@ var appFlags = []cli.Flag{ cmd.P2PHostDNS, cmd.P2PMaxPeers, cmd.P2PPrivKey, + cmd.P2PMetadata, cmd.P2PWhitelist, cmd.P2PEncoding, cmd.DataDirFlag, diff --git a/beacon-chain/node/node.go b/beacon-chain/node/node.go index 692e2f39b98..c59fe6f31c4 100644 --- a/beacon-chain/node/node.go +++ b/beacon-chain/node/node.go @@ -299,6 +299,7 @@ func (b *BeaconNode) registerP2P(ctx *cli.Context) error { HostAddress: ctx.String(cmd.P2PHost.Name), HostDNS: ctx.String(cmd.P2PHostDNS.Name), PrivateKey: ctx.String(cmd.P2PPrivKey.Name), + MetaDataDir: ctx.String(cmd.P2PMetadata.Name), TCPPort: ctx.Uint(cmd.P2PTCPPort.Name), UDPPort: ctx.Uint(cmd.P2PUDPPort.Name), MaxPeers: ctx.Uint(cmd.P2PMaxPeers.Name), diff --git a/beacon-chain/p2p/config.go b/beacon-chain/p2p/config.go index bf680eb8883..ccfcf35d5b6 100644 --- a/beacon-chain/p2p/config.go +++ b/beacon-chain/p2p/config.go @@ -19,6 +19,7 @@ type Config struct { HostDNS string PrivateKey string DataDir string + MetaDataDir string TCPPort uint UDPPort uint MaxPeers uint diff --git a/beacon-chain/p2p/interfaces.go b/beacon-chain/p2p/interfaces.go index f2ab18c441a..8de65adf4e4 100644 --- a/beacon-chain/p2p/interfaces.go +++ b/beacon-chain/p2p/interfaces.go @@ -9,6 +9,7 @@ import ( pubsub "github.com/libp2p/go-libp2p-pubsub" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/encoder" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers" + pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" ) // P2P represents the full p2p interface composed of all of the sub-interfaces. @@ -21,6 +22,7 @@ type P2P interface { Sender ConnectionHandler PeersProvider + MetadataProvider } // Broadcaster broadcasts messages to peers over the p2p pubsub protocol. @@ -60,10 +62,16 @@ type PeerManager interface { // Sender abstracts the sending functionality from libp2p. type Sender interface { - Send(context.Context, interface{}, peer.ID) (network.Stream, error) + Send(context.Context, interface{}, string, peer.ID) (network.Stream, error) } // PeersProvider abstracts obtaining our current list of known peers status. type PeersProvider interface { Peers() *peers.Status } + +// MetadataProvider returns the metadata related information for the local peer. +type MetadataProvider interface { + Metadata() *pb.MetaData + MetadataSeq() uint64 +} diff --git a/beacon-chain/p2p/rpc_topic_mappings.go b/beacon-chain/p2p/rpc_topic_mappings.go index 7cfa5f3d5b3..e918998a65f 100644 --- a/beacon-chain/p2p/rpc_topic_mappings.go +++ b/beacon-chain/p2p/rpc_topic_mappings.go @@ -1,27 +1,32 @@ package p2p import ( - "reflect" - p2ppb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" ) +const ( + // RPCStatusTopic defines the topic for the status rpc method. + RPCStatusTopic = "/eth2/beacon_chain/req/status/1" + // RPCGoodByeTopic defines the topic for the goodbye rpc method. + RPCGoodByeTopic = "/eth2/beacon_chain/req/goodbye/1" + // RPCBlocksByRangeTopic defines the topic for the blocks by range rpc method. + RPCBlocksByRangeTopic = "/eth2/beacon_chain/req/beacon_blocks_by_range/1" + // RPCBlocksByRootTopic defines the topic for the blocks by root rpc method. + RPCBlocksByRootTopic = "/eth2/beacon_chain/req/beacon_blocks_by_root/1" + // RPCPingTopic defines the topic for the ping rpc method. + RPCPingTopic = "/eth2/beacon_chain/req/ping/1" + // RPCMetaDataTopic defines the topic for the metadata rpc method. + RPCMetaDataTopic = "/eth2/beacon_chain/req/metadata/1" +) + // RPCTopicMappings represent the protocol ID to protobuf message type map for easy // lookup. These mappings should be used for outbound sending only. Peers may respond // with a different message type as defined by the p2p protocol. var RPCTopicMappings = map[string]interface{}{ - "/eth2/beacon_chain/req/status/1": &p2ppb.Status{}, - "/eth2/beacon_chain/req/goodbye/1": new(uint64), - "/eth2/beacon_chain/req/beacon_blocks_by_range/1": &p2ppb.BeaconBlocksByRangeRequest{}, - "/eth2/beacon_chain/req/beacon_blocks_by_root/1": [][32]byte{}, -} - -// RPCTypeMapping is the inverse of RPCTopicMappings so that an arbitrary protobuf message -// can be mapped to a protocol ID string. -var RPCTypeMapping = make(map[reflect.Type]string) - -func init() { - for k, v := range RPCTopicMappings { - RPCTypeMapping[reflect.TypeOf(v)] = k - } + RPCStatusTopic: &p2ppb.Status{}, + RPCGoodByeTopic: new(uint64), + RPCBlocksByRangeTopic: &p2ppb.BeaconBlocksByRangeRequest{}, + RPCBlocksByRootTopic: [][32]byte{}, + RPCPingTopic: new(uint64), + RPCMetaDataTopic: new(interface{}), } diff --git a/beacon-chain/p2p/sender.go b/beacon-chain/p2p/sender.go index 8a7ea8e9f96..89677e61752 100644 --- a/beacon-chain/p2p/sender.go +++ b/beacon-chain/p2p/sender.go @@ -2,7 +2,6 @@ package p2p import ( "context" - "reflect" "time" "github.com/libp2p/go-libp2p-core/network" @@ -14,10 +13,10 @@ import ( // Send a message to a specific peer. The returned stream may be used for reading, but has been // closed for writing. -func (s *Service) Send(ctx context.Context, message interface{}, pid peer.ID) (network.Stream, error) { +func (s *Service) Send(ctx context.Context, message interface{}, topic string, pid peer.ID) (network.Stream, error) { ctx, span := trace.StartSpan(ctx, "p2p.Send") defer span.End() - topic := RPCTypeMapping[reflect.TypeOf(message)] + s.Encoding().ProtocolSuffix() + topic = topic + s.Encoding().ProtocolSuffix() span.AddAttributes(trace.StringAttribute("topic", topic)) // TTFB_TIME (5s) + RESP_TIMEOUT (10s). @@ -38,9 +37,12 @@ func (s *Service) Send(ctx context.Context, message interface{}, pid peer.ID) (n traceutil.AnnotateError(span, err) return nil, err } - if _, err := s.Encoding().EncodeWithLength(stream, message); err != nil { - traceutil.AnnotateError(span, err) - return nil, err + // do not encode anything if we are sending a metadata request + if topic != RPCMetaDataTopic { + if _, err := s.Encoding().EncodeWithLength(stream, message); err != nil { + traceutil.AnnotateError(span, err) + return nil, err + } } // Close stream for writing. diff --git a/beacon-chain/p2p/sender_test.go b/beacon-chain/p2p/sender_test.go index cef2ee98028..9a7e4eb4795 100644 --- a/beacon-chain/p2p/sender_test.go +++ b/beacon-chain/p2p/sender_test.go @@ -2,7 +2,6 @@ package p2p import ( "context" - "reflect" "sync" "testing" "time" @@ -29,9 +28,6 @@ func TestService_Send(t *testing.T) { Bar: 55, } - // Register testing topic. - RPCTypeMapping[reflect.TypeOf(msg)] = "/testing/1" - // Register external listener which will repeat the message back. var wg sync.WaitGroup wg.Add(1) @@ -50,7 +46,7 @@ func TestService_Send(t *testing.T) { wg.Done() }) - stream, err := svc.Send(context.Background(), msg, p2.Host.ID()) + stream, err := svc.Send(context.Background(), msg, "/testing/1", p2.Host.ID()) if err != nil { t.Fatal(err) } diff --git a/beacon-chain/p2p/service.go b/beacon-chain/p2p/service.go index 0c3f9acbe53..189cf196f5a 100644 --- a/beacon-chain/p2p/service.go +++ b/beacon-chain/p2p/service.go @@ -7,11 +7,10 @@ import ( "strings" "time" - "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" - "github.com/prysmaticlabs/prysm/shared/params" "github.com/dgraph-io/ristretto" "github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/gogo/protobuf/proto" ds "github.com/ipfs/go-datastore" dsync "github.com/ipfs/go-datastore/sync" "github.com/libp2p/go-libp2p" @@ -27,10 +26,13 @@ import ( "github.com/pkg/errors" "github.com/prysmaticlabs/go-bitfield" "github.com/prysmaticlabs/prysm/beacon-chain/cache" + "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" "github.com/prysmaticlabs/prysm/beacon-chain/db" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/encoder" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers" + pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/prysmaticlabs/prysm/shared" + "github.com/prysmaticlabs/prysm/shared/params" "github.com/prysmaticlabs/prysm/shared/runutil" "github.com/sirupsen/logrus" ) @@ -69,6 +71,7 @@ type Service struct { peers *peers.Status genesisTime time.Time genesisValidatorsRoot []byte + metaData *pb.MetaData } // NewService initializes a new p2p service compatible with shared.Service interface. No @@ -101,6 +104,11 @@ func NewService(cfg *Config) (*Service, error) { log.WithError(err).Error("Failed to generate p2p private key") return nil, err } + s.metaData, err = metaDataFromConfig(s.cfg) + if err != nil { + log.WithError(err).Error("Failed to create peer metadata") + return nil, err + } opts := buildOptions(s.cfg, ipAddr, s.privKey) h, err := libp2p.New(s.ctx, opts...) @@ -327,6 +335,16 @@ func (s *Service) Peers() *peers.Status { return s.peers } +// Metadata returns a copy of the peer's metadata. +func (s *Service) Metadata() *pb.MetaData { + return proto.Clone(s.metaData).(*pb.MetaData) +} + +// MetadataSeq returns the metadata sequence number. +func (s *Service) MetadataSeq() uint64 { + return s.metaData.SeqNumber +} + // RefreshENR uses an epoch to refresh the enr entry for our node // with the tracked committee id's for the epoch, allowing our node // to be dynamically discoverable by others given our tracked committee id's. diff --git a/beacon-chain/p2p/testing/p2p.go b/beacon-chain/p2p/testing/p2p.go index 6507da72a52..5f41a7f5e37 100644 --- a/beacon-chain/p2p/testing/p2p.go +++ b/beacon-chain/p2p/testing/p2p.go @@ -29,6 +29,7 @@ var TopicMappings = map[reflect.Type]string{ reflect.TypeOf(new(uint64)): "/eth2/beacon_chain/req/goodbye/1", reflect.TypeOf(&pb.BeaconBlocksByRangeRequest{}): "/eth2/beacon_chain/req/beacon_blocks_by_range/1", reflect.TypeOf([][32]byte{}): "/eth2/beacon_chain/req/beacon_blocks_by_root/1", + reflect.TypeOf(new(uint64)): "/eth2/beacon_chain/req/ping/1/", } // TestP2P represents a p2p implementation that can be used for testing. @@ -39,6 +40,7 @@ type TestP2P struct { BroadcastCalled bool DelaySend bool peers *peers.Status + LocalMetadata *pb.MetaData } // NewTestP2P initializes a new p2p test service. @@ -198,8 +200,8 @@ func (p *TestP2P) AddDisconnectionHandler(f func(ctx context.Context, id peer.ID } // Send a message to a specific peer. -func (p *TestP2P) Send(ctx context.Context, msg interface{}, pid peer.ID) (network.Stream, error) { - protocol := TopicMappings[reflect.TypeOf(msg)] +func (p *TestP2P) Send(ctx context.Context, msg interface{}, topic string, pid peer.ID) (network.Stream, error) { + protocol := topic if protocol == "" { return nil, fmt.Errorf("protocol doesnt exist for proto message: %v", msg) } @@ -208,8 +210,10 @@ func (p *TestP2P) Send(ctx context.Context, msg interface{}, pid peer.ID) (netwo return nil, err } - if _, err := p.Encoding().EncodeWithLength(stream, msg); err != nil { - return nil, err + if topic != "/eth2/beacon_chain/req/metadata/1" { + if _, err := p.Encoding().EncodeWithLength(stream, msg); err != nil { + return nil, err + } } // Close stream for writing. @@ -248,3 +252,13 @@ func (p *TestP2P) RefreshENR(epoch uint64) { func (p *TestP2P) ForkDigest() ([4]byte, error) { return [4]byte{}, nil } + +// Metadata mocks the peer's metadata. +func (p *TestP2P) Metadata() *pb.MetaData { + return proto.Clone(p.LocalMetadata).(*pb.MetaData) +} + +// MetadataSeq mocks metadata sequence number. +func (p *TestP2P) MetadataSeq() uint64 { + return p.LocalMetadata.SeqNumber +} diff --git a/beacon-chain/p2p/utils.go b/beacon-chain/p2p/utils.go index 742f071975a..2d632170aa7 100644 --- a/beacon-chain/p2p/utils.go +++ b/beacon-chain/p2p/utils.go @@ -12,10 +12,13 @@ import ( "github.com/btcsuite/btcd/btcec" "github.com/libp2p/go-libp2p-core/crypto" "github.com/pkg/errors" + "github.com/prysmaticlabs/go-bitfield" + pbp2p "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/prysmaticlabs/prysm/shared/iputils" ) const keyPath = "network-keys" +const metaDataPath = "metaData" func convertFromInterfacePrivKey(privkey crypto.PrivKey) *ecdsa.PrivateKey { typeAssertedKey := (*ecdsa.PrivateKey)((*btcec.PrivateKey)(privkey.(*crypto.Secp256k1PrivateKey))) @@ -83,6 +86,44 @@ func retrievePrivKeyFromFile(path string) (*ecdsa.PrivateKey, error) { return convertFromInterfacePrivKey(unmarshalledKey), nil } +func metaDataFromConfig(cfg *Config) (*pbp2p.MetaData, error) { + defaultKeyPath := path.Join(cfg.DataDir, metaDataPath) + metaDataPath := cfg.MetaDataDir + + _, err := os.Stat(defaultKeyPath) + defaultMetadataExist := !os.IsNotExist(err) + if err != nil && defaultMetadataExist { + return nil, err + } + if metaDataPath == "" && !defaultMetadataExist { + metaData := &pbp2p.MetaData{ + SeqNumber: 0, + Attnets: bitfield.NewBitvector64(), + } + dst, err := metaData.Marshal() + if err != nil { + return nil, err + } + if err = ioutil.WriteFile(defaultKeyPath, dst, 0600); err != nil { + return nil, err + } + return metaData, nil + } + if defaultMetadataExist && metaDataPath == "" { + metaDataPath = defaultKeyPath + } + src, err := ioutil.ReadFile(metaDataPath) + if err != nil { + log.WithError(err).Error("Error reading metadata from file") + return nil, err + } + metaData := &pbp2p.MetaData{} + if err := metaData.Unmarshal(src); err != nil { + return nil, err + } + return metaData, nil +} + func ipAddr() net.IP { ip, err := iputils.ExternalIPv4() if err != nil { diff --git a/beacon-chain/state/stateutil/blocks_test.go b/beacon-chain/state/stateutil/blocks_test.go index a9b700e2c98..72bacf46717 100644 --- a/beacon-chain/state/stateutil/blocks_test.go +++ b/beacon-chain/state/stateutil/blocks_test.go @@ -3,9 +3,9 @@ package stateutil_test import ( "testing" - "github.com/prysmaticlabs/prysm/shared/featureconfig" "github.com/prysmaticlabs/go-ssz" "github.com/prysmaticlabs/prysm/beacon-chain/state/stateutil" + "github.com/prysmaticlabs/prysm/shared/featureconfig" "github.com/prysmaticlabs/prysm/shared/testutil" ) diff --git a/beacon-chain/sync/BUILD.bazel b/beacon-chain/sync/BUILD.bazel index 61b139f8bc1..9aa3b1143ee 100644 --- a/beacon-chain/sync/BUILD.bazel +++ b/beacon-chain/sync/BUILD.bazel @@ -16,6 +16,8 @@ go_library( "rpc_beacon_blocks_by_root.go", "rpc_chunked_response.go", "rpc_goodbye.go", + "rpc_metadata.go", + "rpc_ping.go", "rpc_status.go", "service.go", "subscriber.go", @@ -93,6 +95,8 @@ go_test( "rpc_beacon_blocks_by_range_test.go", "rpc_beacon_blocks_by_root_test.go", "rpc_goodbye_test.go", + "rpc_metadata_test.go", + "rpc_ping_test.go", "rpc_status_test.go", "rpc_test.go", "subscriber_beacon_aggregate_proof_test.go", diff --git a/beacon-chain/sync/initial-sync-old/round_robin.go b/beacon-chain/sync/initial-sync-old/round_robin.go index 383f172eea1..c5bbc148bfe 100644 --- a/beacon-chain/sync/initial-sync-old/round_robin.go +++ b/beacon-chain/sync/initial-sync-old/round_robin.go @@ -18,6 +18,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" "github.com/prysmaticlabs/prysm/beacon-chain/core/state" "github.com/prysmaticlabs/prysm/beacon-chain/flags" + "github.com/prysmaticlabs/prysm/beacon-chain/p2p" prysmsync "github.com/prysmaticlabs/prysm/beacon-chain/sync" p2ppb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/prysmaticlabs/prysm/shared/bytesutil" @@ -304,7 +305,7 @@ func (s *Service) requestBlocks(ctx context.Context, req *p2ppb.BeaconBlocksByRa "count": req.Count, "step": req.Step, }).Debug("Requesting blocks") - stream, err := s.p2p.Send(ctx, req, pid) + stream, err := s.p2p.Send(ctx, req, p2p.RPCBlocksByRangeTopic, pid) if err != nil { return nil, errors.Wrap(err, "failed to send request to peer") } diff --git a/beacon-chain/sync/initial-sync/blocks_fetcher.go b/beacon-chain/sync/initial-sync/blocks_fetcher.go index c373bc62fc5..6c21e7433f0 100644 --- a/beacon-chain/sync/initial-sync/blocks_fetcher.go +++ b/beacon-chain/sync/initial-sync/blocks_fetcher.go @@ -375,7 +375,7 @@ func (f *blocksFetcher) requestBlocks( "step": req.Step, }).Debug("Requesting blocks") f.Unlock() - stream, err := f.p2p.Send(ctx, req, pid) + stream, err := f.p2p.Send(ctx, req, p2p.RPCBlocksByRangeTopic, pid) if err != nil { return nil, err } diff --git a/beacon-chain/sync/initial-sync/round_robin.go b/beacon-chain/sync/initial-sync/round_robin.go index cd53aea5bc2..1e6e0da4001 100644 --- a/beacon-chain/sync/initial-sync/round_robin.go +++ b/beacon-chain/sync/initial-sync/round_robin.go @@ -14,6 +14,7 @@ import ( blockfeed "github.com/prysmaticlabs/prysm/beacon-chain/core/feed/block" "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" "github.com/prysmaticlabs/prysm/beacon-chain/core/state" + "github.com/prysmaticlabs/prysm/beacon-chain/p2p" prysmsync "github.com/prysmaticlabs/prysm/beacon-chain/sync" p2ppb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/prysmaticlabs/prysm/shared/bytesutil" @@ -131,7 +132,7 @@ func (s *Service) requestBlocks(ctx context.Context, req *p2ppb.BeaconBlocksByRa "count": req.Count, "step": req.Step, }).Debug("Requesting blocks") - stream, err := s.p2p.Send(ctx, req, pid) + stream, err := s.p2p.Send(ctx, req, p2p.RPCBlocksByRangeTopic, pid) if err != nil { return nil, errors.Wrap(err, "failed to send request to peer") } diff --git a/beacon-chain/sync/rpc.go b/beacon-chain/sync/rpc.go index 915a5de1d61..4d0090bc250 100644 --- a/beacon-chain/sync/rpc.go +++ b/beacon-chain/sync/rpc.go @@ -3,10 +3,12 @@ package sync import ( "context" "reflect" + "strings" "time" libp2pcore "github.com/libp2p/go-libp2p-core" "github.com/libp2p/go-libp2p-core/network" + "github.com/prysmaticlabs/prysm/beacon-chain/p2p" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/prysmaticlabs/prysm/shared/roughtime" "github.com/prysmaticlabs/prysm/shared/traceutil" @@ -31,25 +33,35 @@ type rpcHandler func(context.Context, interface{}, libp2pcore.Stream) error // registerRPCHandlers for p2p RPC. func (r *Service) registerRPCHandlers() { r.registerRPC( - "/eth2/beacon_chain/req/status/1", + p2p.RPCStatusTopic, &pb.Status{}, r.statusRPCHandler, ) r.registerRPC( - "/eth2/beacon_chain/req/goodbye/1", + p2p.RPCGoodByeTopic, new(uint64), r.goodbyeRPCHandler, ) r.registerRPC( - "/eth2/beacon_chain/req/beacon_blocks_by_range/1", + p2p.RPCBlocksByRangeTopic, &pb.BeaconBlocksByRangeRequest{}, r.beaconBlocksByRangeRPCHandler, ) r.registerRPC( - "/eth2/beacon_chain/req/beacon_blocks_by_root/1", + p2p.RPCBlocksByRootTopic, [][32]byte{}, r.beaconBlocksRootRPCHandler, ) + r.registerRPC( + p2p.RPCPingTopic, + new(uint64), + r.pingHandler, + ) + r.registerRPC( + p2p.RPCMetaDataTopic, + new(interface{}), + r.metaDataHandler, + ) } // registerRPC for a given topic with an expected protobuf message type. @@ -74,6 +86,19 @@ func (r *Service) registerRPC(topic string, base interface{}, handle rpcHandler) // Increment message received counter. messageReceivedCounter.WithLabelValues(topic).Inc() + // since metadata requests do not have any data in the payload, we + // do not decode anything. + if strings.Contains(topic, p2p.RPCMetaDataTopic) { + if err := handle(ctx, new(interface{}), stream); err != nil { + messageFailedProcessingCounter.WithLabelValues(topic).Inc() + if err != errWrongForkDigestVersion { + log.WithError(err).Warn("Failed to handle p2p RPC") + } + traceutil.AnnotateError(span, err) + } + return + } + // Given we have an input argument that can be pointer or [][32]byte, this gives us // a way to check for its reflect.Kind and based on the result, we can decode // accordingly. diff --git a/beacon-chain/sync/rpc_beacon_blocks_by_root.go b/beacon-chain/sync/rpc_beacon_blocks_by_root.go index cbeaa1dc885..9affc222074 100644 --- a/beacon-chain/sync/rpc_beacon_blocks_by_root.go +++ b/beacon-chain/sync/rpc_beacon_blocks_by_root.go @@ -9,6 +9,7 @@ import ( "github.com/libp2p/go-libp2p-core/peer" "github.com/pkg/errors" "github.com/prysmaticlabs/go-ssz" + "github.com/prysmaticlabs/prysm/beacon-chain/p2p" ) // sendRecentBeaconBlocksRequest sends a recent beacon blocks request to a peer to get @@ -17,7 +18,7 @@ func (r *Service) sendRecentBeaconBlocksRequest(ctx context.Context, blockRoots ctx, cancel := context.WithTimeout(ctx, 10*time.Second) defer cancel() - stream, err := r.p2p.Send(ctx, blockRoots, id) + stream, err := r.p2p.Send(ctx, blockRoots, p2p.RPCBlocksByRootTopic, id) if err != nil { return err } diff --git a/beacon-chain/sync/rpc_metadata.go b/beacon-chain/sync/rpc_metadata.go new file mode 100644 index 00000000000..634d5403b0f --- /dev/null +++ b/beacon-chain/sync/rpc_metadata.go @@ -0,0 +1,50 @@ +package sync + +import ( + "context" + "time" + + libp2pcore "github.com/libp2p/go-libp2p-core" + "github.com/libp2p/go-libp2p-core/peer" + "github.com/pkg/errors" + "github.com/prysmaticlabs/prysm/beacon-chain/p2p" + pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" +) + +// metaDataHandler reads the incoming metadata rpc request from the peer. +func (r *Service) metaDataHandler(ctx context.Context, msg interface{}, stream libp2pcore.Stream) error { + defer stream.Close() + ctx, cancel := context.WithTimeout(ctx, 5*time.Second) + defer cancel() + setRPCStreamDeadlines(stream) + + if _, err := stream.Write([]byte{responseCodeSuccess}); err != nil { + return err + } + _, err := r.p2p.Encoding().EncodeWithLength(stream, r.p2p.Metadata()) + return err +} + +func (r *Service) sendMetaDataRequest(ctx context.Context, id peer.ID) (*pb.MetaData, error) { + ctx, cancel := context.WithTimeout(ctx, 10*time.Second) + defer cancel() + + stream, err := r.p2p.Send(ctx, new(interface{}), p2p.RPCMetaDataTopic, id) + if err != nil { + return nil, err + } + code, errMsg, err := ReadStatusCode(stream, r.p2p.Encoding()) + if err != nil { + return nil, err + } + if code != 0 { + r.p2p.Peers().IncrementBadResponses(stream.Conn().RemotePeer()) + return nil, errors.New(errMsg) + } + msg := new(pb.MetaData) + if err := r.p2p.Encoding().DecodeWithLength(stream, msg); err != nil { + r.p2p.Peers().IncrementBadResponses(stream.Conn().RemotePeer()) + return nil, err + } + return msg, nil +} diff --git a/beacon-chain/sync/rpc_metadata_test.go b/beacon-chain/sync/rpc_metadata_test.go new file mode 100644 index 00000000000..9cb25618da9 --- /dev/null +++ b/beacon-chain/sync/rpc_metadata_test.go @@ -0,0 +1,133 @@ +package sync + +import ( + "context" + "sync" + "testing" + "time" + + "github.com/libp2p/go-libp2p-core/network" + "github.com/libp2p/go-libp2p-core/protocol" + "github.com/prysmaticlabs/go-ssz" + db "github.com/prysmaticlabs/prysm/beacon-chain/db/testing" + "github.com/prysmaticlabs/prysm/beacon-chain/p2p" + p2ptest "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing" + pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" + "github.com/prysmaticlabs/prysm/shared/testutil" +) + +func TestMetaDataRPCHandler_ReceivesMetadata(t *testing.T) { + p1 := p2ptest.NewTestP2P(t) + p2 := p2ptest.NewTestP2P(t) + p1.Connect(p2) + if len(p1.Host.Network().Peers()) != 1 { + t.Error("Expected peers to be connected") + } + bitfield := [64]byte{'A', 'B'} + p1.LocalMetadata = &pb.MetaData{ + SeqNumber: 2, + Attnets: bitfield[:], + } + + // Set up a head state in the database with data we expect. + d := db.SetupDB(t) + defer db.TeardownDB(t, d) + + r := &Service{ + db: d, + p2p: p1, + } + + // Setup streams + pcl := protocol.ID("/testing") + var wg sync.WaitGroup + wg.Add(1) + p2.Host.SetStreamHandler(pcl, func(stream network.Stream) { + defer wg.Done() + expectSuccess(t, r, stream) + out := new(pb.MetaData) + if err := r.p2p.Encoding().DecodeWithLength(stream, out); err != nil { + t.Fatal(err) + } + if !ssz.DeepEqual(p1.LocalMetadata, out) { + t.Fatalf("Metadata unequal, received %v but wanted %v", out, p1.LocalMetadata) + } + }) + stream1, err := p1.Host.NewStream(context.Background(), p2.Host.ID(), pcl) + if err != nil { + t.Fatal(err) + } + + err = r.metaDataHandler(context.Background(), new(interface{}), stream1) + if err != nil { + t.Errorf("Unxpected error: %v", err) + } + + if testutil.WaitTimeout(&wg, 1*time.Second) { + t.Fatal("Did not receive stream within 1 sec") + } + + conns := p1.Host.Network().ConnsToPeer(p2.Host.ID()) + if len(conns) == 0 { + t.Error("Peer is disconnected despite receiving a valid ping") + } +} + +func TestMetadataRPCHandler_SendsMetadata(t *testing.T) { + p1 := p2ptest.NewTestP2P(t) + p2 := p2ptest.NewTestP2P(t) + p1.Connect(p2) + if len(p1.Host.Network().Peers()) != 1 { + t.Error("Expected peers to be connected") + } + bitfield := [64]byte{'A', 'B'} + p2.LocalMetadata = &pb.MetaData{ + SeqNumber: 2, + Attnets: bitfield[:], + } + + // Set up a head state in the database with data we expect. + d := db.SetupDB(t) + defer db.TeardownDB(t, d) + + r := &Service{ + db: d, + p2p: p1, + } + + r2 := &Service{ + db: d, + p2p: p2, + } + + // Setup streams + pcl := protocol.ID(p2p.RPCMetaDataTopic + r.p2p.Encoding().ProtocolSuffix()) + var wg sync.WaitGroup + wg.Add(1) + p2.Host.SetStreamHandler(pcl, func(stream network.Stream) { + defer wg.Done() + + err := r2.metaDataHandler(context.Background(), new(interface{}), stream) + if err != nil { + t.Fatal(err) + } + }) + + metadata, err := r.sendMetaDataRequest(context.Background(), p2.Host.ID()) + if err != nil { + t.Errorf("Unxpected error: %v", err) + } + + if !ssz.DeepEqual(metadata, p2.LocalMetadata) { + t.Fatalf("Metadata unequal, received %v but wanted %v", metadata, p2.LocalMetadata) + } + + if testutil.WaitTimeout(&wg, 1*time.Second) { + t.Fatal("Did not receive stream within 1 sec") + } + + conns := p1.Host.Network().ConnsToPeer(p2.Host.ID()) + if len(conns) == 0 { + t.Error("Peer is disconnected despite receiving a valid ping") + } +} diff --git a/beacon-chain/sync/rpc_ping.go b/beacon-chain/sync/rpc_ping.go new file mode 100644 index 00000000000..277d66c2782 --- /dev/null +++ b/beacon-chain/sync/rpc_ping.go @@ -0,0 +1,70 @@ +package sync + +import ( + "context" + "errors" + "fmt" + "time" + + libp2pcore "github.com/libp2p/go-libp2p-core" + "github.com/libp2p/go-libp2p-core/peer" + "github.com/prysmaticlabs/prysm/beacon-chain/p2p" +) + +// pingHandler reads the incoming ping rpc message from the peer. +func (r *Service) pingHandler(ctx context.Context, msg interface{}, stream libp2pcore.Stream) error { + defer stream.Close() + ctx, cancel := context.WithTimeout(ctx, 5*time.Second) + defer cancel() + setRPCStreamDeadlines(stream) + + m, ok := msg.(*uint64) + if !ok { + return fmt.Errorf("wrong message type for ping, got %T, wanted *uint64", msg) + } + if err := r.validateSequenceNum(*m, stream.Conn().RemotePeer()); err != nil { + return err + } + if _, err := stream.Write([]byte{responseCodeSuccess}); err != nil { + return err + } + _, err := r.p2p.Encoding().EncodeWithLength(stream, r.p2p.MetadataSeq()) + return err +} + +func (r *Service) sendPingRequest(ctx context.Context, id peer.ID) error { + ctx, cancel := context.WithTimeout(ctx, 10*time.Second) + defer cancel() + + metadataSeq := r.p2p.MetadataSeq() + stream, err := r.p2p.Send(ctx, &metadataSeq, p2p.RPCPingTopic, id) + if err != nil { + return err + } + + code, errMsg, err := ReadStatusCode(stream, r.p2p.Encoding()) + if err != nil { + return err + } + + if code != 0 { + r.p2p.Peers().IncrementBadResponses(stream.Conn().RemotePeer()) + return errors.New(errMsg) + } + msg := new(uint64) + if err := r.p2p.Encoding().DecodeWithLength(stream, msg); err != nil { + r.p2p.Peers().IncrementBadResponses(stream.Conn().RemotePeer()) + return err + } + err = r.validateSequenceNum(*msg, stream.Conn().RemotePeer()) + if err != nil { + r.p2p.Peers().IncrementBadResponses(stream.Conn().RemotePeer()) + } + return err +} + +// validates the peer's sequence number. +func (r *Service) validateSequenceNum(seq uint64, id peer.ID) error { + // no-op + return nil +} diff --git a/beacon-chain/sync/rpc_ping_test.go b/beacon-chain/sync/rpc_ping_test.go new file mode 100644 index 00000000000..bc4b3863ecc --- /dev/null +++ b/beacon-chain/sync/rpc_ping_test.go @@ -0,0 +1,127 @@ +package sync + +import ( + "context" + "sync" + "testing" + "time" + + "github.com/libp2p/go-libp2p-core/network" + "github.com/libp2p/go-libp2p-core/protocol" + db "github.com/prysmaticlabs/prysm/beacon-chain/db/testing" + p2ptest "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing" + pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" + "github.com/prysmaticlabs/prysm/shared/testutil" +) + +func TestPingRPCHandler_ReceivesPing(t *testing.T) { + p1 := p2ptest.NewTestP2P(t) + p2 := p2ptest.NewTestP2P(t) + p1.Connect(p2) + if len(p1.Host.Network().Peers()) != 1 { + t.Error("Expected peers to be connected") + } + p1.LocalMetadata = &pb.MetaData{ + SeqNumber: 2, + Attnets: []byte{'A', 'B'}, + } + + // Set up a head state in the database with data we expect. + d := db.SetupDB(t) + defer db.TeardownDB(t, d) + + r := &Service{ + db: d, + p2p: p1, + } + + // Setup streams + pcl := protocol.ID("/testing") + var wg sync.WaitGroup + wg.Add(1) + p2.Host.SetStreamHandler(pcl, func(stream network.Stream) { + defer wg.Done() + expectSuccess(t, r, stream) + out := new(uint64) + if err := r.p2p.Encoding().DecodeWithLength(stream, out); err != nil { + t.Fatal(err) + } + if *out != 2 { + t.Fatalf("Wanted 2 but got %d as our sequence number", *out) + } + }) + stream1, err := p1.Host.NewStream(context.Background(), p2.Host.ID(), pcl) + if err != nil { + t.Fatal(err) + } + seqNumber := uint64(1) + + err = r.pingHandler(context.Background(), &seqNumber, stream1) + if err != nil { + t.Errorf("Unxpected error: %v", err) + } + + if testutil.WaitTimeout(&wg, 1*time.Second) { + t.Fatal("Did not receive stream within 1 sec") + } + + conns := p1.Host.Network().ConnsToPeer(p2.Host.ID()) + if len(conns) == 0 { + t.Error("Peer is disconnected despite receiving a valid ping") + } +} + +func TestPingRPCHandler_SendsPing(t *testing.T) { + p1 := p2ptest.NewTestP2P(t) + p2 := p2ptest.NewTestP2P(t) + p1.Connect(p2) + if len(p1.Host.Network().Peers()) != 1 { + t.Error("Expected peers to be connected") + } + p1.LocalMetadata = &pb.MetaData{ + SeqNumber: 2, + Attnets: []byte{'A', 'B'}, + } + + // Set up a head state in the database with data we expect. + d := db.SetupDB(t) + defer db.TeardownDB(t, d) + + r := &Service{ + db: d, + p2p: p1, + } + + // Setup streams + pcl := protocol.ID("/eth2/beacon_chain/req/ping/1/ssz") + var wg sync.WaitGroup + wg.Add(1) + p2.Host.SetStreamHandler(pcl, func(stream network.Stream) { + defer wg.Done() + out := new(uint64) + if err := r.p2p.Encoding().DecodeWithLength(stream, out); err != nil { + t.Fatal(err) + } + if *out != 2 { + t.Fatalf("Wanted 2 but got %d as our sequence number", *out) + } + err := r.pingHandler(context.Background(), out, stream) + if err != nil { + t.Fatal(err) + } + }) + + err := r.sendPingRequest(context.Background(), p2.Host.ID()) + if err != nil { + t.Errorf("Unxpected error: %v", err) + } + + if testutil.WaitTimeout(&wg, 1*time.Second) { + t.Fatal("Did not receive stream within 1 sec") + } + + conns := p1.Host.Network().ConnsToPeer(p2.Host.ID()) + if len(conns) == 0 { + t.Error("Peer is disconnected despite receiving a valid ping") + } +} diff --git a/beacon-chain/sync/rpc_status.go b/beacon-chain/sync/rpc_status.go index 63c208fea22..8813e4633a5 100644 --- a/beacon-chain/sync/rpc_status.go +++ b/beacon-chain/sync/rpc_status.go @@ -10,6 +10,7 @@ import ( "github.com/libp2p/go-libp2p-core/peer" "github.com/pkg/errors" "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" + "github.com/prysmaticlabs/prysm/beacon-chain/p2p" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/prysmaticlabs/prysm/shared/params" "github.com/prysmaticlabs/prysm/shared/roughtime" @@ -88,7 +89,7 @@ func (r *Service) sendRPCStatusRequest(ctx context.Context, id peer.ID) error { HeadRoot: headRoot, HeadSlot: r.chain.HeadSlot(), } - stream, err := r.p2p.Send(ctx, resp, id) + stream, err := r.p2p.Send(ctx, resp, p2p.RPCStatusTopic, id) if err != nil { return err } diff --git a/beacon-chain/usage.go b/beacon-chain/usage.go index 83501f4ad34..5d0b8794291 100644 --- a/beacon-chain/usage.go +++ b/beacon-chain/usage.go @@ -103,6 +103,7 @@ var appHelpFlagGroups = []flagGroup{ cmd.P2PHostDNS, cmd.P2PMaxPeers, cmd.P2PPrivKey, + cmd.P2PMetadata, cmd.P2PWhitelist, cmd.StaticPeers, cmd.EnableUPnPFlag, diff --git a/proto/beacon/p2p/v1/messages.pb.go b/proto/beacon/p2p/v1/messages.pb.go index 67b12338acf..32cbfbf048d 100755 --- a/proto/beacon/p2p/v1/messages.pb.go +++ b/proto/beacon/p2p/v1/messages.pb.go @@ -7,6 +7,7 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" + github_com_prysmaticlabs_go_bitfield "github.com/prysmaticlabs/go-bitfield" io "io" math "math" math_bits "math/bits" @@ -165,9 +166,129 @@ func (m *BeaconBlocksByRangeRequest) GetStep() uint64 { return 0 } +type ENRForkID struct { + CurrentForkDigest []byte `protobuf:"bytes,1,opt,name=current_fork_digest,json=currentForkDigest,proto3" json:"current_fork_digest,omitempty" ssz-size:"4"` + NextForkVersion []byte `protobuf:"bytes,2,opt,name=next_fork_version,json=nextForkVersion,proto3" json:"next_fork_version,omitempty" ssz-size:"4"` + NextForkEpoch uint64 `protobuf:"varint,3,opt,name=next_fork_epoch,json=nextForkEpoch,proto3" json:"next_fork_epoch,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ENRForkID) Reset() { *m = ENRForkID{} } +func (m *ENRForkID) String() string { return proto.CompactTextString(m) } +func (*ENRForkID) ProtoMessage() {} +func (*ENRForkID) Descriptor() ([]byte, []int) { + return fileDescriptor_a1d590cda035b632, []int{2} +} +func (m *ENRForkID) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ENRForkID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ENRForkID.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ENRForkID) XXX_Merge(src proto.Message) { + xxx_messageInfo_ENRForkID.Merge(m, src) +} +func (m *ENRForkID) XXX_Size() int { + return m.Size() +} +func (m *ENRForkID) XXX_DiscardUnknown() { + xxx_messageInfo_ENRForkID.DiscardUnknown(m) +} + +var xxx_messageInfo_ENRForkID proto.InternalMessageInfo + +func (m *ENRForkID) GetCurrentForkDigest() []byte { + if m != nil { + return m.CurrentForkDigest + } + return nil +} + +func (m *ENRForkID) GetNextForkVersion() []byte { + if m != nil { + return m.NextForkVersion + } + return nil +} + +func (m *ENRForkID) GetNextForkEpoch() uint64 { + if m != nil { + return m.NextForkEpoch + } + return 0 +} + +type MetaData struct { + SeqNumber uint64 `protobuf:"varint,1,opt,name=seq_number,json=seqNumber,proto3" json:"seq_number,omitempty"` + Attnets github_com_prysmaticlabs_go_bitfield.Bitvector64 `protobuf:"bytes,2,opt,name=attnets,proto3,casttype=github.com/prysmaticlabs/go-bitfield.Bitvector64" json:"attnets,omitempty" ssz-size:"64"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MetaData) Reset() { *m = MetaData{} } +func (m *MetaData) String() string { return proto.CompactTextString(m) } +func (*MetaData) ProtoMessage() {} +func (*MetaData) Descriptor() ([]byte, []int) { + return fileDescriptor_a1d590cda035b632, []int{3} +} +func (m *MetaData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MetaData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MetaData.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MetaData) XXX_Merge(src proto.Message) { + xxx_messageInfo_MetaData.Merge(m, src) +} +func (m *MetaData) XXX_Size() int { + return m.Size() +} +func (m *MetaData) XXX_DiscardUnknown() { + xxx_messageInfo_MetaData.DiscardUnknown(m) +} + +var xxx_messageInfo_MetaData proto.InternalMessageInfo + +func (m *MetaData) GetSeqNumber() uint64 { + if m != nil { + return m.SeqNumber + } + return 0 +} + +func (m *MetaData) GetAttnets() github_com_prysmaticlabs_go_bitfield.Bitvector64 { + if m != nil { + return m.Attnets + } + return nil +} + func init() { proto.RegisterType((*Status)(nil), "ethereum.beacon.p2p.v1.Status") proto.RegisterType((*BeaconBlocksByRangeRequest)(nil), "ethereum.beacon.p2p.v1.BeaconBlocksByRangeRequest") + proto.RegisterType((*ENRForkID)(nil), "ethereum.beacon.p2p.v1.ENRForkID") + proto.RegisterType((*MetaData)(nil), "ethereum.beacon.p2p.v1.MetaData") } func init() { @@ -175,28 +296,38 @@ func init() { } var fileDescriptor_a1d590cda035b632 = []byte{ - // 334 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0xcf, 0x4e, 0xfa, 0x40, - 0x10, 0xc7, 0xb3, 0xbf, 0x5f, 0x21, 0xb2, 0x82, 0x7f, 0x36, 0xc6, 0x34, 0x18, 0x81, 0xf4, 0x22, - 0x17, 0xda, 0x00, 0x1e, 0x8c, 0xc7, 0x46, 0x5f, 0xa0, 0x3c, 0x00, 0xd9, 0x96, 0xa1, 0x6d, 0x28, - 0x9d, 0xb5, 0xbb, 0x25, 0x91, 0x27, 0xf4, 0xe8, 0x13, 0x10, 0xc3, 0xd5, 0x1b, 0x4f, 0x60, 0x3a, - 0x25, 0x72, 0xf2, 0xb6, 0x33, 0xf3, 0xf9, 0x7e, 0xb2, 0x33, 0xdc, 0x51, 0x05, 0x1a, 0xf4, 0x42, - 0x90, 0x11, 0xe6, 0x9e, 0x9a, 0x28, 0x6f, 0x33, 0xf6, 0xd6, 0xa0, 0xb5, 0x8c, 0x41, 0xbb, 0x34, - 0x14, 0xb7, 0x60, 0x12, 0x28, 0xa0, 0x5c, 0xbb, 0x35, 0xe6, 0xaa, 0x89, 0x72, 0x37, 0xe3, 0xee, - 0x28, 0x4e, 0x4d, 0x52, 0x86, 0x6e, 0x84, 0x6b, 0x2f, 0xc6, 0x18, 0x3d, 0xc2, 0xc3, 0x72, 0x49, - 0x55, 0x2d, 0xae, 0x5e, 0xb5, 0xc6, 0xf9, 0x66, 0xbc, 0x39, 0x33, 0xd2, 0x94, 0x5a, 0x8c, 0xf9, - 0xf9, 0x12, 0x8b, 0xd5, 0x7c, 0x91, 0xc6, 0xa0, 0x8d, 0xcd, 0x06, 0x6c, 0xd8, 0xf6, 0xaf, 0x0e, - 0xbb, 0x7e, 0x5b, 0xeb, 0xed, 0x48, 0xa7, 0x5b, 0x78, 0x76, 0x1e, 0x9d, 0x80, 0x57, 0xd0, 0x0b, - 0x31, 0xe2, 0x89, 0x5f, 0x2c, 0xd3, 0x5c, 0x66, 0xe9, 0x16, 0x16, 0xf3, 0x02, 0xd1, 0xd8, 0xff, - 0x28, 0x75, 0x7d, 0xd8, 0xf5, 0x3b, 0xa7, 0xd4, 0x74, 0xe2, 0x04, 0x9d, 0x5f, 0x30, 0x40, 0x34, - 0xe2, 0x81, 0x5f, 0x9e, 0x92, 0xa0, 0x30, 0x4a, 0xec, 0xff, 0x03, 0x36, 0xb4, 0x82, 0x93, 0xf0, - 0xb5, 0xea, 0x0a, 0x97, 0xb7, 0x12, 0x90, 0x47, 0xbb, 0xf5, 0x97, 0xfd, 0xac, 0x62, 0x48, 0x7c, - 0x77, 0xe4, 0x75, 0x86, 0xc6, 0x6e, 0x90, 0x92, 0x86, 0xb3, 0x0c, 0x8d, 0x03, 0xbc, 0xeb, 0xd3, - 0xb5, 0xfc, 0x0c, 0xa3, 0x95, 0xf6, 0xdf, 0x03, 0x99, 0xc7, 0x10, 0xc0, 0x5b, 0x59, 0x6d, 0x73, - 0xcf, 0xb9, 0x36, 0xb2, 0x30, 0x75, 0x96, 0x51, 0xb6, 0x45, 0x9d, 0x2a, 0x2c, 0x6e, 0x78, 0x23, - 0xc2, 0x32, 0xaf, 0x77, 0xb4, 0x82, 0xba, 0x10, 0x82, 0x5b, 0xda, 0x80, 0x3a, 0xfe, 0x9e, 0xde, - 0x7e, 0xfb, 0x63, 0xdf, 0x63, 0x9f, 0xfb, 0x1e, 0xfb, 0xda, 0xf7, 0x58, 0xd8, 0xa4, 0x4b, 0x4f, - 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x4b, 0xb5, 0x3a, 0xe7, 0xd6, 0x01, 0x00, 0x00, + // 490 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xb1, 0x6e, 0xd3, 0x40, + 0x18, 0xc7, 0x65, 0x48, 0x4b, 0x7b, 0x24, 0x84, 0x1c, 0x08, 0x45, 0x45, 0x24, 0x95, 0x07, 0xe8, + 0x12, 0x9b, 0xa4, 0x51, 0x85, 0x10, 0x03, 0xb2, 0x92, 0x4a, 0x0c, 0x74, 0x70, 0x25, 0xd6, 0xe8, + 0xec, 0x7c, 0x71, 0x4e, 0x71, 0xfc, 0x39, 0x77, 0x9f, 0x23, 0x9a, 0x47, 0xe0, 0x75, 0x78, 0x09, + 0x46, 0x9e, 0x20, 0x42, 0x59, 0xd9, 0x3a, 0x32, 0x21, 0x9f, 0xdd, 0xba, 0x08, 0x21, 0xb1, 0xf9, + 0xbe, 0xfb, 0xfd, 0xfe, 0xba, 0xfb, 0xfb, 0x98, 0x9d, 0x2a, 0x24, 0x74, 0x03, 0x10, 0x21, 0x26, + 0x6e, 0x3a, 0x48, 0xdd, 0x75, 0xdf, 0x5d, 0x82, 0xd6, 0x22, 0x02, 0xed, 0x98, 0x4d, 0xfe, 0x0c, + 0x68, 0x0e, 0x0a, 0xb2, 0xa5, 0x53, 0x60, 0x4e, 0x3a, 0x48, 0x9d, 0x75, 0xff, 0xa8, 0x17, 0x49, + 0x9a, 0x67, 0x81, 0x13, 0xe2, 0xd2, 0x8d, 0x30, 0x42, 0xd7, 0xe0, 0x41, 0x36, 0x33, 0xab, 0x22, + 0x38, 0xff, 0x2a, 0x62, 0xec, 0x9f, 0x16, 0xdb, 0xbf, 0x24, 0x41, 0x99, 0xe6, 0x7d, 0xf6, 0x70, + 0x86, 0x6a, 0x31, 0x99, 0xca, 0x08, 0x34, 0xb5, 0xad, 0x63, 0xeb, 0xa4, 0xee, 0x3d, 0xbe, 0xde, + 0x76, 0xeb, 0x5a, 0x6f, 0x7a, 0x5a, 0x6e, 0xe0, 0xad, 0x3d, 0xb4, 0x7d, 0x96, 0x43, 0x23, 0xc3, + 0xf0, 0x37, 0xec, 0xd1, 0x4c, 0x26, 0x22, 0x96, 0x1b, 0x98, 0x4e, 0x14, 0x22, 0xb5, 0xef, 0x19, + 0xab, 0x75, 0xbd, 0xed, 0x36, 0x2a, 0xeb, 0x74, 0x60, 0xfb, 0x8d, 0x5b, 0xd0, 0x47, 0x24, 0xfe, + 0x8a, 0x35, 0x2b, 0x13, 0x52, 0x0c, 0xe7, 0xed, 0xfb, 0xc7, 0xd6, 0x49, 0xcd, 0xaf, 0x02, 0xc7, + 0xf9, 0x94, 0x3b, 0xec, 0x70, 0x0e, 0xa2, 0x4c, 0xaf, 0xfd, 0x2b, 0xfd, 0x20, 0x67, 0x4c, 0xf0, + 0xf3, 0x92, 0xd7, 0x31, 0x52, 0x7b, 0xcf, 0x44, 0x9a, 0xcd, 0xcb, 0x18, 0xc9, 0x06, 0x76, 0xe4, + 0x99, 0xb6, 0xbc, 0x18, 0xc3, 0x85, 0xf6, 0xae, 0x7c, 0x91, 0x44, 0xe0, 0xc3, 0x2a, 0xcb, 0x6f, + 0xf3, 0x82, 0x31, 0x4d, 0x42, 0x51, 0xe1, 0x5a, 0xc6, 0x3d, 0x34, 0x93, 0x5c, 0xe6, 0x4f, 0xd9, + 0x5e, 0x88, 0x59, 0x52, 0xdc, 0xb1, 0xe6, 0x17, 0x0b, 0xce, 0x59, 0x4d, 0x13, 0xa4, 0xe5, 0xe9, + 0xcd, 0xb7, 0xfd, 0xd5, 0x62, 0x87, 0xe3, 0x0b, 0xff, 0x1c, 0xd5, 0xe2, 0xc3, 0x88, 0xbf, 0x67, + 0x4f, 0xc2, 0x4c, 0x29, 0x48, 0x68, 0xf2, 0x3f, 0xfd, 0xb6, 0x4a, 0xf8, 0xbc, 0xaa, 0xf9, 0x1d, + 0x6b, 0x25, 0xf0, 0xb9, 0xd4, 0xd7, 0xa0, 0xb4, 0xc4, 0xa4, 0x6c, 0xfa, 0x6f, 0xbf, 0x99, 0xa3, + 0xb9, 0xfc, 0xa9, 0x00, 0xf9, 0x4b, 0xd6, 0xac, 0xec, 0xbb, 0x55, 0x37, 0x6e, 0x48, 0xd3, 0xb4, + 0xfd, 0xc5, 0x62, 0x07, 0x1f, 0x81, 0xc4, 0x48, 0x90, 0x30, 0x5d, 0xc0, 0x6a, 0x92, 0x64, 0xcb, + 0x00, 0xd4, 0x6d, 0x17, 0xb0, 0xba, 0x30, 0x03, 0x3e, 0x61, 0x0f, 0x04, 0x51, 0x02, 0xa4, 0xcb, + 0x73, 0x8c, 0xff, 0xfc, 0x27, 0x67, 0x43, 0xfb, 0xd7, 0xb6, 0xfb, 0xfa, 0xce, 0x5b, 0x4c, 0xd5, + 0x95, 0x5e, 0x0a, 0x92, 0x61, 0x2c, 0x02, 0xed, 0x46, 0xd8, 0x0b, 0x24, 0xcd, 0x24, 0xc4, 0x53, + 0xc7, 0x93, 0xb4, 0x86, 0x90, 0x50, 0x9d, 0x0d, 0xfd, 0x9b, 0x54, 0xaf, 0xfe, 0x6d, 0xd7, 0xb1, + 0xbe, 0xef, 0x3a, 0xd6, 0x8f, 0x5d, 0xc7, 0x0a, 0xf6, 0xcd, 0x63, 0x3d, 0xfd, 0x1d, 0x00, 0x00, + 0xff, 0xff, 0xd5, 0xcc, 0x55, 0xef, 0x19, 0x03, 0x00, 0x00, } func (m *Status) Marshal() (dAtA []byte, err error) { @@ -299,6 +430,91 @@ func (m *BeaconBlocksByRangeRequest) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } +func (m *ENRForkID) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ENRForkID) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ENRForkID) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.NextForkEpoch != 0 { + i = encodeVarintMessages(dAtA, i, uint64(m.NextForkEpoch)) + i-- + dAtA[i] = 0x18 + } + if len(m.NextForkVersion) > 0 { + i -= len(m.NextForkVersion) + copy(dAtA[i:], m.NextForkVersion) + i = encodeVarintMessages(dAtA, i, uint64(len(m.NextForkVersion))) + i-- + dAtA[i] = 0x12 + } + if len(m.CurrentForkDigest) > 0 { + i -= len(m.CurrentForkDigest) + copy(dAtA[i:], m.CurrentForkDigest) + i = encodeVarintMessages(dAtA, i, uint64(len(m.CurrentForkDigest))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MetaData) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MetaData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MetaData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Attnets) > 0 { + i -= len(m.Attnets) + copy(dAtA[i:], m.Attnets) + i = encodeVarintMessages(dAtA, i, uint64(len(m.Attnets))) + i-- + dAtA[i] = 0x12 + } + if m.SeqNumber != 0 { + i = encodeVarintMessages(dAtA, i, uint64(m.SeqNumber)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintMessages(dAtA []byte, offset int, v uint64) int { offset -= sovMessages(v) base := offset @@ -361,6 +577,48 @@ func (m *BeaconBlocksByRangeRequest) Size() (n int) { return n } +func (m *ENRForkID) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.CurrentForkDigest) + if l > 0 { + n += 1 + l + sovMessages(uint64(l)) + } + l = len(m.NextForkVersion) + if l > 0 { + n += 1 + l + sovMessages(uint64(l)) + } + if m.NextForkEpoch != 0 { + n += 1 + sovMessages(uint64(m.NextForkEpoch)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *MetaData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SeqNumber != 0 { + n += 1 + sovMessages(uint64(m.SeqNumber)) + } + l = len(m.Attnets) + if l > 0 { + n += 1 + l + sovMessages(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func sovMessages(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -672,6 +930,254 @@ func (m *BeaconBlocksByRangeRequest) Unmarshal(dAtA []byte) error { } return nil } +func (m *ENRForkID) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ENRForkID: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ENRForkID: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentForkDigest", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthMessages + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthMessages + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CurrentForkDigest = append(m.CurrentForkDigest[:0], dAtA[iNdEx:postIndex]...) + if m.CurrentForkDigest == nil { + m.CurrentForkDigest = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NextForkVersion", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthMessages + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthMessages + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NextForkVersion = append(m.NextForkVersion[:0], dAtA[iNdEx:postIndex]...) + if m.NextForkVersion == nil { + m.NextForkVersion = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NextForkEpoch", wireType) + } + m.NextForkEpoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NextForkEpoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipMessages(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMessages + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMessages + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MetaData) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MetaData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MetaData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SeqNumber", wireType) + } + m.SeqNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SeqNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Attnets", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthMessages + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthMessages + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Attnets = append(m.Attnets[:0], dAtA[iNdEx:postIndex]...) + if m.Attnets == nil { + m.Attnets = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMessages(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMessages + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMessages + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipMessages(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/proto/beacon/p2p/v1/messages.proto b/proto/beacon/p2p/v1/messages.proto index af17e74f555..99007d74f81 100644 --- a/proto/beacon/p2p/v1/messages.proto +++ b/proto/beacon/p2p/v1/messages.proto @@ -22,4 +22,16 @@ message ENRForkID { bytes current_fork_digest = 1 [(gogoproto.moretags) = "ssz-size:\"4\""]; bytes next_fork_version = 2 [(gogoproto.moretags) = "ssz-size:\"4\""]; uint64 next_fork_epoch = 3; +} +/* + Spec Definition: + MetaData + ( + seq_number: uint64 + attnets: Bitvector[ATTESTATION_SUBNET_COUNT] + ) +*/ +message MetaData { + uint64 seq_number =1; + bytes attnets = 2 [(gogoproto.moretags) = "ssz-size:\"64\"", (gogoproto.casttype) = "github.com/prysmaticlabs/go-bitfield.Bitvector64"]; } \ No newline at end of file diff --git a/proto/beacon/p2p/v1/types.pb.go b/proto/beacon/p2p/v1/types.pb.go new file mode 100755 index 00000000000..a666ce0d0e8 --- /dev/null +++ b/proto/beacon/p2p/v1/types.pb.go @@ -0,0 +1,3672 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: proto/beacon/p2p/v1/types.proto + +package ethereum_beacon_p2p_v1 + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + v1alpha1 "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" + github_com_prysmaticlabs_go_bitfield "github.com/prysmaticlabs/go-bitfield" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type BeaconState struct { + GenesisTime uint64 `protobuf:"varint,1001,opt,name=genesis_time,json=genesisTime,proto3" json:"genesis_time,omitempty"` + GenesisValidatorsRoot []byte `protobuf:"bytes,1002,opt,name=genesis_validators_root,json=genesisValidatorsRoot,proto3" json:"genesis_validators_root,omitempty" ssz-size:"32"` + Slot uint64 `protobuf:"varint,1003,opt,name=slot,proto3" json:"slot,omitempty"` + Fork *Fork `protobuf:"bytes,1004,opt,name=fork,proto3" json:"fork,omitempty"` + LatestBlockHeader *v1alpha1.BeaconBlockHeader `protobuf:"bytes,2001,opt,name=latest_block_header,json=latestBlockHeader,proto3" json:"latest_block_header,omitempty"` + BlockRoots [][]byte `protobuf:"bytes,2002,rep,name=block_roots,json=blockRoots,proto3" json:"block_roots,omitempty" ssz-size:"8192,32"` + StateRoots [][]byte `protobuf:"bytes,2003,rep,name=state_roots,json=stateRoots,proto3" json:"state_roots,omitempty" ssz-size:"8192,32"` + HistoricalRoots [][]byte `protobuf:"bytes,2004,rep,name=historical_roots,json=historicalRoots,proto3" json:"historical_roots,omitempty" ssz-size:"?,32" ssz-max:"16777216"` + Eth1Data *v1alpha1.Eth1Data `protobuf:"bytes,3001,opt,name=eth1_data,json=eth1Data,proto3" json:"eth1_data,omitempty"` + Eth1DataVotes []*v1alpha1.Eth1Data `protobuf:"bytes,3002,rep,name=eth1_data_votes,json=eth1DataVotes,proto3" json:"eth1_data_votes,omitempty" ssz-max:"1024"` + Eth1DepositIndex uint64 `protobuf:"varint,3003,opt,name=eth1_deposit_index,json=eth1DepositIndex,proto3" json:"eth1_deposit_index,omitempty"` + Validators []*v1alpha1.Validator `protobuf:"bytes,4001,rep,name=validators,proto3" json:"validators,omitempty" ssz-max:"1099511627776"` + Balances []uint64 `protobuf:"varint,4002,rep,packed,name=balances,proto3" json:"balances,omitempty" ssz-max:"1099511627776"` + RandaoMixes [][]byte `protobuf:"bytes,5001,rep,name=randao_mixes,json=randaoMixes,proto3" json:"randao_mixes,omitempty" ssz-size:"65536,32"` + Slashings []uint64 `protobuf:"varint,6001,rep,packed,name=slashings,proto3" json:"slashings,omitempty" ssz-size:"8192"` + PreviousEpochAttestations []*PendingAttestation `protobuf:"bytes,7001,rep,name=previous_epoch_attestations,json=previousEpochAttestations,proto3" json:"previous_epoch_attestations,omitempty" ssz-max:"4096"` + CurrentEpochAttestations []*PendingAttestation `protobuf:"bytes,7002,rep,name=current_epoch_attestations,json=currentEpochAttestations,proto3" json:"current_epoch_attestations,omitempty" ssz-max:"4096"` + JustificationBits github_com_prysmaticlabs_go_bitfield.Bitvector4 `protobuf:"bytes,8001,opt,name=justification_bits,json=justificationBits,proto3,casttype=github.com/prysmaticlabs/go-bitfield.Bitvector4" json:"justification_bits,omitempty" ssz-size:"1"` + PreviousJustifiedCheckpoint *v1alpha1.Checkpoint `protobuf:"bytes,8002,opt,name=previous_justified_checkpoint,json=previousJustifiedCheckpoint,proto3" json:"previous_justified_checkpoint,omitempty"` + CurrentJustifiedCheckpoint *v1alpha1.Checkpoint `protobuf:"bytes,8003,opt,name=current_justified_checkpoint,json=currentJustifiedCheckpoint,proto3" json:"current_justified_checkpoint,omitempty"` + FinalizedCheckpoint *v1alpha1.Checkpoint `protobuf:"bytes,8004,opt,name=finalized_checkpoint,json=finalizedCheckpoint,proto3" json:"finalized_checkpoint,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BeaconState) Reset() { *m = BeaconState{} } +func (m *BeaconState) String() string { return proto.CompactTextString(m) } +func (*BeaconState) ProtoMessage() {} +func (*BeaconState) Descriptor() ([]byte, []int) { + return fileDescriptor_e719e7d82cfa7b0d, []int{0} +} +func (m *BeaconState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BeaconState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BeaconState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BeaconState) XXX_Merge(src proto.Message) { + xxx_messageInfo_BeaconState.Merge(m, src) +} +func (m *BeaconState) XXX_Size() int { + return m.Size() +} +func (m *BeaconState) XXX_DiscardUnknown() { + xxx_messageInfo_BeaconState.DiscardUnknown(m) +} + +var xxx_messageInfo_BeaconState proto.InternalMessageInfo + +func (m *BeaconState) GetGenesisTime() uint64 { + if m != nil { + return m.GenesisTime + } + return 0 +} + +func (m *BeaconState) GetGenesisValidatorsRoot() []byte { + if m != nil { + return m.GenesisValidatorsRoot + } + return nil +} + +func (m *BeaconState) GetSlot() uint64 { + if m != nil { + return m.Slot + } + return 0 +} + +func (m *BeaconState) GetFork() *Fork { + if m != nil { + return m.Fork + } + return nil +} + +func (m *BeaconState) GetLatestBlockHeader() *v1alpha1.BeaconBlockHeader { + if m != nil { + return m.LatestBlockHeader + } + return nil +} + +func (m *BeaconState) GetBlockRoots() [][]byte { + if m != nil { + return m.BlockRoots + } + return nil +} + +func (m *BeaconState) GetStateRoots() [][]byte { + if m != nil { + return m.StateRoots + } + return nil +} + +func (m *BeaconState) GetHistoricalRoots() [][]byte { + if m != nil { + return m.HistoricalRoots + } + return nil +} + +func (m *BeaconState) GetEth1Data() *v1alpha1.Eth1Data { + if m != nil { + return m.Eth1Data + } + return nil +} + +func (m *BeaconState) GetEth1DataVotes() []*v1alpha1.Eth1Data { + if m != nil { + return m.Eth1DataVotes + } + return nil +} + +func (m *BeaconState) GetEth1DepositIndex() uint64 { + if m != nil { + return m.Eth1DepositIndex + } + return 0 +} + +func (m *BeaconState) GetValidators() []*v1alpha1.Validator { + if m != nil { + return m.Validators + } + return nil +} + +func (m *BeaconState) GetBalances() []uint64 { + if m != nil { + return m.Balances + } + return nil +} + +func (m *BeaconState) GetRandaoMixes() [][]byte { + if m != nil { + return m.RandaoMixes + } + return nil +} + +func (m *BeaconState) GetSlashings() []uint64 { + if m != nil { + return m.Slashings + } + return nil +} + +func (m *BeaconState) GetPreviousEpochAttestations() []*PendingAttestation { + if m != nil { + return m.PreviousEpochAttestations + } + return nil +} + +func (m *BeaconState) GetCurrentEpochAttestations() []*PendingAttestation { + if m != nil { + return m.CurrentEpochAttestations + } + return nil +} + +func (m *BeaconState) GetJustificationBits() github_com_prysmaticlabs_go_bitfield.Bitvector4 { + if m != nil { + return m.JustificationBits + } + return nil +} + +func (m *BeaconState) GetPreviousJustifiedCheckpoint() *v1alpha1.Checkpoint { + if m != nil { + return m.PreviousJustifiedCheckpoint + } + return nil +} + +func (m *BeaconState) GetCurrentJustifiedCheckpoint() *v1alpha1.Checkpoint { + if m != nil { + return m.CurrentJustifiedCheckpoint + } + return nil +} + +func (m *BeaconState) GetFinalizedCheckpoint() *v1alpha1.Checkpoint { + if m != nil { + return m.FinalizedCheckpoint + } + return nil +} + +type Fork struct { + PreviousVersion []byte `protobuf:"bytes,1,opt,name=previous_version,json=previousVersion,proto3" json:"previous_version,omitempty" ssz-size:"4"` + CurrentVersion []byte `protobuf:"bytes,2,opt,name=current_version,json=currentVersion,proto3" json:"current_version,omitempty" ssz-size:"4"` + Epoch uint64 `protobuf:"varint,3,opt,name=epoch,proto3" json:"epoch,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Fork) Reset() { *m = Fork{} } +func (m *Fork) String() string { return proto.CompactTextString(m) } +func (*Fork) ProtoMessage() {} +func (*Fork) Descriptor() ([]byte, []int) { + return fileDescriptor_e719e7d82cfa7b0d, []int{1} +} +func (m *Fork) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Fork) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Fork.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Fork) XXX_Merge(src proto.Message) { + xxx_messageInfo_Fork.Merge(m, src) +} +func (m *Fork) XXX_Size() int { + return m.Size() +} +func (m *Fork) XXX_DiscardUnknown() { + xxx_messageInfo_Fork.DiscardUnknown(m) +} + +var xxx_messageInfo_Fork proto.InternalMessageInfo + +func (m *Fork) GetPreviousVersion() []byte { + if m != nil { + return m.PreviousVersion + } + return nil +} + +func (m *Fork) GetCurrentVersion() []byte { + if m != nil { + return m.CurrentVersion + } + return nil +} + +func (m *Fork) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +type PendingAttestation struct { + AggregationBits github_com_prysmaticlabs_go_bitfield.Bitlist `protobuf:"bytes,1,opt,name=aggregation_bits,json=aggregationBits,proto3,casttype=github.com/prysmaticlabs/go-bitfield.Bitlist" json:"aggregation_bits,omitempty" ssz-max:"2048"` + Data *v1alpha1.AttestationData `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + InclusionDelay uint64 `protobuf:"varint,3,opt,name=inclusion_delay,json=inclusionDelay,proto3" json:"inclusion_delay,omitempty"` + ProposerIndex uint64 `protobuf:"varint,4,opt,name=proposer_index,json=proposerIndex,proto3" json:"proposer_index,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PendingAttestation) Reset() { *m = PendingAttestation{} } +func (m *PendingAttestation) String() string { return proto.CompactTextString(m) } +func (*PendingAttestation) ProtoMessage() {} +func (*PendingAttestation) Descriptor() ([]byte, []int) { + return fileDescriptor_e719e7d82cfa7b0d, []int{2} +} +func (m *PendingAttestation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PendingAttestation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PendingAttestation.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PendingAttestation) XXX_Merge(src proto.Message) { + xxx_messageInfo_PendingAttestation.Merge(m, src) +} +func (m *PendingAttestation) XXX_Size() int { + return m.Size() +} +func (m *PendingAttestation) XXX_DiscardUnknown() { + xxx_messageInfo_PendingAttestation.DiscardUnknown(m) +} + +var xxx_messageInfo_PendingAttestation proto.InternalMessageInfo + +func (m *PendingAttestation) GetAggregationBits() github_com_prysmaticlabs_go_bitfield.Bitlist { + if m != nil { + return m.AggregationBits + } + return nil +} + +func (m *PendingAttestation) GetData() *v1alpha1.AttestationData { + if m != nil { + return m.Data + } + return nil +} + +func (m *PendingAttestation) GetInclusionDelay() uint64 { + if m != nil { + return m.InclusionDelay + } + return 0 +} + +func (m *PendingAttestation) GetProposerIndex() uint64 { + if m != nil { + return m.ProposerIndex + } + return 0 +} + +type ValidatorLatestVote struct { + Epoch uint64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` + Root []byte `protobuf:"bytes,2,opt,name=root,proto3" json:"root,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ValidatorLatestVote) Reset() { *m = ValidatorLatestVote{} } +func (m *ValidatorLatestVote) String() string { return proto.CompactTextString(m) } +func (*ValidatorLatestVote) ProtoMessage() {} +func (*ValidatorLatestVote) Descriptor() ([]byte, []int) { + return fileDescriptor_e719e7d82cfa7b0d, []int{3} +} +func (m *ValidatorLatestVote) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValidatorLatestVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValidatorLatestVote.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ValidatorLatestVote) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorLatestVote.Merge(m, src) +} +func (m *ValidatorLatestVote) XXX_Size() int { + return m.Size() +} +func (m *ValidatorLatestVote) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorLatestVote.DiscardUnknown(m) +} + +var xxx_messageInfo_ValidatorLatestVote proto.InternalMessageInfo + +func (m *ValidatorLatestVote) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *ValidatorLatestVote) GetRoot() []byte { + if m != nil { + return m.Root + } + return nil +} + +type HistoricalBatch struct { + BlockRoots [][]byte `protobuf:"bytes,1,rep,name=block_roots,json=blockRoots,proto3" json:"block_roots,omitempty" ssz-size:"8192,32"` + StateRoots [][]byte `protobuf:"bytes,2,rep,name=state_roots,json=stateRoots,proto3" json:"state_roots,omitempty" ssz-size:"8192,32"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HistoricalBatch) Reset() { *m = HistoricalBatch{} } +func (m *HistoricalBatch) String() string { return proto.CompactTextString(m) } +func (*HistoricalBatch) ProtoMessage() {} +func (*HistoricalBatch) Descriptor() ([]byte, []int) { + return fileDescriptor_e719e7d82cfa7b0d, []int{4} +} +func (m *HistoricalBatch) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HistoricalBatch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HistoricalBatch.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *HistoricalBatch) XXX_Merge(src proto.Message) { + xxx_messageInfo_HistoricalBatch.Merge(m, src) +} +func (m *HistoricalBatch) XXX_Size() int { + return m.Size() +} +func (m *HistoricalBatch) XXX_DiscardUnknown() { + xxx_messageInfo_HistoricalBatch.DiscardUnknown(m) +} + +var xxx_messageInfo_HistoricalBatch proto.InternalMessageInfo + +func (m *HistoricalBatch) GetBlockRoots() [][]byte { + if m != nil { + return m.BlockRoots + } + return nil +} + +func (m *HistoricalBatch) GetStateRoots() [][]byte { + if m != nil { + return m.StateRoots + } + return nil +} + +type StateSummary struct { + Slot uint64 `protobuf:"varint,1,opt,name=slot,proto3" json:"slot,omitempty"` + Root []byte `protobuf:"bytes,2,opt,name=root,proto3" json:"root,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StateSummary) Reset() { *m = StateSummary{} } +func (m *StateSummary) String() string { return proto.CompactTextString(m) } +func (*StateSummary) ProtoMessage() {} +func (*StateSummary) Descriptor() ([]byte, []int) { + return fileDescriptor_e719e7d82cfa7b0d, []int{5} +} +func (m *StateSummary) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StateSummary) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StateSummary.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StateSummary) XXX_Merge(src proto.Message) { + xxx_messageInfo_StateSummary.Merge(m, src) +} +func (m *StateSummary) XXX_Size() int { + return m.Size() +} +func (m *StateSummary) XXX_DiscardUnknown() { + xxx_messageInfo_StateSummary.DiscardUnknown(m) +} + +var xxx_messageInfo_StateSummary proto.InternalMessageInfo + +func (m *StateSummary) GetSlot() uint64 { + if m != nil { + return m.Slot + } + return 0 +} + +func (m *StateSummary) GetRoot() []byte { + if m != nil { + return m.Root + } + return nil +} + +type SigningRoot struct { + ObjectRoot []byte `protobuf:"bytes,1,opt,name=object_root,json=objectRoot,proto3" json:"object_root,omitempty" ssz-size:"32"` + Domain []byte `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty" ssz-size:"32"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SigningRoot) Reset() { *m = SigningRoot{} } +func (m *SigningRoot) String() string { return proto.CompactTextString(m) } +func (*SigningRoot) ProtoMessage() {} +func (*SigningRoot) Descriptor() ([]byte, []int) { + return fileDescriptor_e719e7d82cfa7b0d, []int{6} +} +func (m *SigningRoot) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SigningRoot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SigningRoot.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SigningRoot) XXX_Merge(src proto.Message) { + xxx_messageInfo_SigningRoot.Merge(m, src) +} +func (m *SigningRoot) XXX_Size() int { + return m.Size() +} +func (m *SigningRoot) XXX_DiscardUnknown() { + xxx_messageInfo_SigningRoot.DiscardUnknown(m) +} + +var xxx_messageInfo_SigningRoot proto.InternalMessageInfo + +func (m *SigningRoot) GetObjectRoot() []byte { + if m != nil { + return m.ObjectRoot + } + return nil +} + +func (m *SigningRoot) GetDomain() []byte { + if m != nil { + return m.Domain + } + return nil +} + +type ForkData struct { + CurrentVersion []byte `protobuf:"bytes,4,opt,name=current_version,json=currentVersion,proto3" json:"current_version,omitempty" ssz-size:"4"` + GenesisValidatorsRoot []byte `protobuf:"bytes,2,opt,name=genesis_validators_root,json=genesisValidatorsRoot,proto3" json:"genesis_validators_root,omitempty" ssz-size:"32"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ForkData) Reset() { *m = ForkData{} } +func (m *ForkData) String() string { return proto.CompactTextString(m) } +func (*ForkData) ProtoMessage() {} +func (*ForkData) Descriptor() ([]byte, []int) { + return fileDescriptor_e719e7d82cfa7b0d, []int{7} +} +func (m *ForkData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ForkData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ForkData.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ForkData) XXX_Merge(src proto.Message) { + xxx_messageInfo_ForkData.Merge(m, src) +} +func (m *ForkData) XXX_Size() int { + return m.Size() +} +func (m *ForkData) XXX_DiscardUnknown() { + xxx_messageInfo_ForkData.DiscardUnknown(m) +} + +var xxx_messageInfo_ForkData proto.InternalMessageInfo + +func (m *ForkData) GetCurrentVersion() []byte { + if m != nil { + return m.CurrentVersion + } + return nil +} + +func (m *ForkData) GetGenesisValidatorsRoot() []byte { + if m != nil { + return m.GenesisValidatorsRoot + } + return nil +} + +type SignedAggregateAndProof struct { + Message *v1alpha1.AggregateAttestationAndProof `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty" ssz-size:"96"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SignedAggregateAndProof) Reset() { *m = SignedAggregateAndProof{} } +func (m *SignedAggregateAndProof) String() string { return proto.CompactTextString(m) } +func (*SignedAggregateAndProof) ProtoMessage() {} +func (*SignedAggregateAndProof) Descriptor() ([]byte, []int) { + return fileDescriptor_e719e7d82cfa7b0d, []int{8} +} +func (m *SignedAggregateAndProof) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SignedAggregateAndProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SignedAggregateAndProof.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SignedAggregateAndProof) XXX_Merge(src proto.Message) { + xxx_messageInfo_SignedAggregateAndProof.Merge(m, src) +} +func (m *SignedAggregateAndProof) XXX_Size() int { + return m.Size() +} +func (m *SignedAggregateAndProof) XXX_DiscardUnknown() { + xxx_messageInfo_SignedAggregateAndProof.DiscardUnknown(m) +} + +var xxx_messageInfo_SignedAggregateAndProof proto.InternalMessageInfo + +func (m *SignedAggregateAndProof) GetMessage() *v1alpha1.AggregateAttestationAndProof { + if m != nil { + return m.Message + } + return nil +} + +func (m *SignedAggregateAndProof) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +func init() { + proto.RegisterType((*BeaconState)(nil), "ethereum.beacon.p2p.v1.BeaconState") + proto.RegisterType((*Fork)(nil), "ethereum.beacon.p2p.v1.Fork") + proto.RegisterType((*PendingAttestation)(nil), "ethereum.beacon.p2p.v1.PendingAttestation") + proto.RegisterType((*ValidatorLatestVote)(nil), "ethereum.beacon.p2p.v1.ValidatorLatestVote") + proto.RegisterType((*HistoricalBatch)(nil), "ethereum.beacon.p2p.v1.HistoricalBatch") + proto.RegisterType((*StateSummary)(nil), "ethereum.beacon.p2p.v1.StateSummary") + proto.RegisterType((*SigningRoot)(nil), "ethereum.beacon.p2p.v1.SigningRoot") + proto.RegisterType((*ForkData)(nil), "ethereum.beacon.p2p.v1.ForkData") + proto.RegisterType((*SignedAggregateAndProof)(nil), "ethereum.beacon.p2p.v1.SignedAggregateAndProof") +} + +func init() { proto.RegisterFile("proto/beacon/p2p/v1/types.proto", fileDescriptor_e719e7d82cfa7b0d) } + +var fileDescriptor_e719e7d82cfa7b0d = []byte{ + // 1243 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcd, 0x8f, 0xdb, 0xc4, + 0x1b, 0x96, 0xb7, 0xf9, 0xf5, 0x63, 0x92, 0x6e, 0xb6, 0xb3, 0xfd, 0x35, 0xa6, 0x2d, 0xeb, 0xc5, + 0x12, 0x6d, 0x41, 0xdd, 0xa4, 0xf6, 0x6e, 0x93, 0xdd, 0x56, 0xb4, 0x6a, 0xda, 0xa2, 0xb6, 0xa2, + 0x52, 0xe5, 0x42, 0x25, 0x24, 0x84, 0x35, 0xb1, 0x27, 0xf6, 0x74, 0x6d, 0x8f, 0xe5, 0x99, 0x44, + 0xdd, 0x4a, 0x88, 0x03, 0x27, 0x4e, 0x70, 0xe0, 0xc2, 0x11, 0xfe, 0x0b, 0xe0, 0xc4, 0xc7, 0x81, + 0x23, 0x5f, 0x97, 0x72, 0x88, 0xd0, 0xde, 0xf8, 0xb8, 0x90, 0x23, 0x27, 0x34, 0xe3, 0xaf, 0x84, + 0x26, 0x10, 0x24, 0x6e, 0x9e, 0x99, 0xe7, 0x79, 0xde, 0x77, 0xde, 0xf7, 0xf5, 0x3b, 0x2f, 0xd0, + 0xe2, 0x84, 0x72, 0xda, 0xea, 0x61, 0xe4, 0xd0, 0xa8, 0x15, 0x9b, 0x71, 0x6b, 0x68, 0xb4, 0xf8, + 0x5e, 0x8c, 0x59, 0x53, 0x9e, 0xc0, 0x13, 0x98, 0xfb, 0x38, 0xc1, 0x83, 0xb0, 0x99, 0x62, 0x9a, + 0xb1, 0x19, 0x37, 0x87, 0xc6, 0xc9, 0x35, 0xcc, 0xfd, 0xd6, 0xd0, 0x40, 0x41, 0xec, 0x23, 0xa3, + 0x85, 0x38, 0xc7, 0x8c, 0x23, 0x4e, 0x04, 0x40, 0xf0, 0x4e, 0x6a, 0x53, 0xe7, 0x29, 0xd7, 0xee, + 0x05, 0xd4, 0xd9, 0xcd, 0x00, 0xa7, 0xa7, 0x00, 0x43, 0x14, 0x10, 0x17, 0x71, 0x9a, 0x64, 0xa7, + 0x1b, 0x1e, 0xe1, 0xfe, 0xa0, 0xd7, 0x74, 0x68, 0xd8, 0xf2, 0xa8, 0x47, 0x5b, 0x72, 0xbb, 0x37, + 0xe8, 0xcb, 0x55, 0xea, 0xb4, 0xf8, 0x4a, 0xe1, 0xfa, 0x93, 0x1a, 0xa8, 0x76, 0xa5, 0x8d, 0xfb, + 0x1c, 0x71, 0x0c, 0x75, 0x50, 0xf3, 0x70, 0x84, 0x19, 0x61, 0x36, 0x27, 0x21, 0x56, 0x7f, 0x3e, + 0xb4, 0xae, 0x9c, 0xab, 0x58, 0xd5, 0x6c, 0xf3, 0x55, 0x12, 0x62, 0x78, 0x07, 0x34, 0x72, 0x4c, + 0x61, 0x9d, 0xd9, 0x09, 0xa5, 0x5c, 0xfd, 0x45, 0xc0, 0x6b, 0xdd, 0x63, 0xe3, 0x91, 0x76, 0x94, + 0xb1, 0xc7, 0x1b, 0x8c, 0x3c, 0xc6, 0x97, 0xf4, 0x4d, 0x53, 0xb7, 0xfe, 0x9f, 0x51, 0x1e, 0x14, + 0x0c, 0x8b, 0x52, 0x0e, 0x57, 0x41, 0x85, 0x05, 0x94, 0xab, 0xbf, 0xa6, 0x76, 0xe4, 0x02, 0x1a, + 0xa0, 0xd2, 0xa7, 0xc9, 0xae, 0xfa, 0x9b, 0xd8, 0xac, 0x9a, 0xa7, 0x9b, 0xb3, 0x43, 0xd9, 0x7c, + 0x99, 0x26, 0xbb, 0x96, 0x84, 0xc2, 0xd7, 0xc1, 0x6a, 0x80, 0x44, 0x28, 0xd3, 0x50, 0xd9, 0x3e, + 0x46, 0x2e, 0x4e, 0xd4, 0x6f, 0xeb, 0x52, 0xe1, 0x5c, 0xa9, 0x80, 0xb9, 0xdf, 0xcc, 0x83, 0xd7, + 0x4c, 0x6f, 0xde, 0x15, 0x8c, 0x5b, 0x92, 0x60, 0x1d, 0x4b, 0x55, 0x26, 0xb6, 0xe0, 0x36, 0xa8, + 0xa6, 0x9a, 0xe2, 0x86, 0x4c, 0xfd, 0xae, 0xbe, 0x7e, 0xe0, 0x5c, 0xad, 0x7b, 0x62, 0x3c, 0xd2, + 0x60, 0x79, 0xc5, 0x6d, 0x63, 0xc7, 0x3c, 0x2f, 0xee, 0x09, 0x24, 0x56, 0xdc, 0x8d, 0x09, 0xa6, + 0xc8, 0x2d, 0xce, 0x98, 0xdf, 0xff, 0x03, 0x53, 0x62, 0x53, 0xa6, 0x05, 0x56, 0x7c, 0xc2, 0x38, + 0x4d, 0x88, 0x83, 0x82, 0x8c, 0xfe, 0x43, 0x4a, 0x3f, 0x33, 0x1e, 0x69, 0x7a, 0x49, 0xbf, 0x2a, + 0xb8, 0xeb, 0x62, 0x1d, 0xa2, 0x47, 0x97, 0x74, 0xa3, 0xdd, 0xe9, 0x74, 0x4c, 0xa3, 0xad, 0x5b, + 0xf5, 0x52, 0x20, 0xd5, 0x7c, 0x09, 0x1c, 0xc1, 0xdc, 0x37, 0x6c, 0x17, 0x71, 0xa4, 0x7e, 0xd2, + 0x90, 0x81, 0xd1, 0xe6, 0x04, 0xe6, 0x26, 0xf7, 0x8d, 0x1b, 0x88, 0x23, 0xeb, 0x30, 0xce, 0xbe, + 0xe0, 0x1b, 0xa0, 0x5e, 0xd0, 0xed, 0x21, 0xe5, 0x98, 0xa9, 0x9f, 0x36, 0xd6, 0x0f, 0x2c, 0x20, + 0xd2, 0x85, 0xe3, 0x91, 0xb6, 0x5c, 0xba, 0x78, 0xc1, 0xdc, 0xd2, 0xad, 0xa3, 0xb9, 0xf0, 0x03, + 0x21, 0x05, 0x37, 0x00, 0x4c, 0xd5, 0x71, 0x4c, 0x19, 0xe1, 0x36, 0x89, 0x5c, 0xfc, 0x48, 0xfd, + 0xac, 0x21, 0xab, 0x62, 0x45, 0x62, 0xd3, 0x93, 0xdb, 0xe2, 0x00, 0xbe, 0x09, 0x40, 0x59, 0x7a, + 0xea, 0x47, 0x9a, 0xf4, 0x63, 0x7d, 0x8e, 0x1f, 0x45, 0xc9, 0x75, 0x4f, 0x8d, 0x47, 0x5a, 0x63, + 0xc2, 0x91, 0x9d, 0x9d, 0x8b, 0x86, 0xd1, 0x36, 0x3b, 0x9d, 0x4e, 0x5b, 0xb7, 0x26, 0x14, 0xe1, + 0x36, 0x38, 0xdc, 0x43, 0x01, 0x8a, 0x1c, 0xcc, 0xd4, 0x8f, 0x85, 0x7a, 0xe5, 0xef, 0xb9, 0x05, + 0x1a, 0x5e, 0x06, 0xb5, 0x04, 0x45, 0x2e, 0xa2, 0x76, 0x48, 0x1e, 0x61, 0xa6, 0xbe, 0x7b, 0x56, + 0x66, 0xad, 0x31, 0x1e, 0x69, 0xab, 0x65, 0xd6, 0xda, 0x17, 0x2f, 0x6e, 0xb6, 0x65, 0xd6, 0xab, + 0x29, 0xfa, 0xae, 0x00, 0x43, 0x13, 0x1c, 0x61, 0x01, 0x62, 0x3e, 0x89, 0x3c, 0xa6, 0xfe, 0xde, + 0x94, 0x76, 0x57, 0xc7, 0x23, 0xad, 0x3e, 0x5d, 0x2e, 0xba, 0x55, 0xc2, 0xe0, 0xdb, 0xe0, 0x54, + 0x9c, 0xe0, 0x21, 0xa1, 0x03, 0x66, 0xe3, 0x98, 0x3a, 0xbe, 0x3d, 0xd1, 0x53, 0x98, 0xfa, 0xa4, + 0x2d, 0x63, 0xf3, 0xe2, 0xbc, 0x7f, 0xe8, 0x1e, 0x8e, 0x5c, 0x12, 0x79, 0xd7, 0x4a, 0xce, 0x5f, + 0xd2, 0xb5, 0x75, 0x61, 0xa7, 0xad, 0x5b, 0xcf, 0xe4, 0x36, 0x6e, 0x0a, 0x13, 0x13, 0x68, 0x06, + 0xdf, 0x02, 0x27, 0x9d, 0x41, 0x92, 0xe0, 0x88, 0xcf, 0xb2, 0xff, 0xe3, 0x7f, 0x63, 0x5f, 0xcd, + 0x4c, 0x3c, 0x6d, 0x9e, 0x01, 0xf8, 0x70, 0xc0, 0x38, 0xe9, 0x13, 0x47, 0xee, 0xd8, 0x3d, 0xc2, + 0x99, 0xfa, 0xf9, 0x15, 0xd9, 0x88, 0xae, 0x8f, 0x47, 0x5a, 0xad, 0x0c, 0x9e, 0xa1, 0xff, 0x31, + 0xd2, 0x5a, 0x13, 0x1d, 0x32, 0x4e, 0xf6, 0x58, 0x88, 0x38, 0x71, 0x02, 0xd4, 0x63, 0x2d, 0x8f, + 0x6e, 0xf4, 0x08, 0xef, 0x13, 0x1c, 0xb8, 0xcd, 0x2e, 0xe1, 0x43, 0xec, 0x70, 0x9a, 0x6c, 0x59, + 0xc7, 0xa6, 0xf4, 0xbb, 0x84, 0x33, 0xd8, 0x07, 0xcf, 0x16, 0x41, 0xcf, 0x4e, 0xb1, 0x6b, 0x3b, + 0x3e, 0x76, 0x76, 0x63, 0x4a, 0x22, 0xae, 0x7e, 0x71, 0x45, 0xfe, 0x5f, 0xcf, 0xcd, 0x29, 0xc9, + 0xeb, 0x05, 0xd2, 0x2a, 0xb2, 0x77, 0x27, 0xd7, 0x29, 0x0f, 0xa1, 0x0b, 0x4e, 0xe7, 0xb1, 0x9d, + 0x69, 0xe6, 0xcb, 0x85, 0xcd, 0xe4, 0x39, 0x9a, 0x65, 0xe5, 0x35, 0x70, 0xbc, 0x4f, 0x22, 0x14, + 0x90, 0xc7, 0xd3, 0xea, 0x5f, 0x2d, 0xac, 0xbe, 0x5a, 0xf0, 0xcb, 0x4d, 0xfd, 0x03, 0x05, 0x54, + 0x44, 0x8b, 0x86, 0x97, 0xc1, 0x4a, 0x11, 0xad, 0x21, 0x4e, 0x18, 0xa1, 0x91, 0xaa, 0xc8, 0xfc, + 0xac, 0x4c, 0xe7, 0x67, 0x4b, 0xb7, 0xea, 0x39, 0xf2, 0x41, 0x0a, 0x84, 0x3b, 0xa0, 0x9e, 0x87, + 0x20, 0xe7, 0x2e, 0xcd, 0xe1, 0x2e, 0x67, 0xc0, 0x9c, 0x7a, 0x1c, 0xfc, 0x4f, 0x56, 0xa4, 0x7a, + 0x40, 0xb6, 0x91, 0x74, 0xa1, 0xbf, 0xb7, 0x04, 0xe0, 0xd3, 0x55, 0x07, 0x43, 0xb0, 0x82, 0x3c, + 0x2f, 0xc1, 0xde, 0x44, 0x15, 0xa5, 0x4e, 0x76, 0xa7, 0xea, 0xd1, 0xbc, 0xb0, 0xb5, 0x2d, 0xca, + 0xe8, 0xfc, 0xa2, 0x65, 0x14, 0x10, 0xc6, 0xad, 0xfa, 0x84, 0xb6, 0xac, 0xa0, 0x4b, 0xa0, 0x22, + 0x1b, 0xf1, 0x92, 0x0c, 0xf1, 0x99, 0x39, 0x21, 0x9e, 0x70, 0x50, 0xb6, 0x63, 0xc9, 0x81, 0x67, + 0x41, 0x9d, 0x44, 0x4e, 0x30, 0x10, 0x97, 0xb4, 0x5d, 0x1c, 0xa0, 0xbd, 0xec, 0x86, 0xcb, 0xc5, + 0xf6, 0x0d, 0xb1, 0x0b, 0x9f, 0x07, 0xcb, 0x71, 0x42, 0x63, 0xca, 0x70, 0x92, 0x75, 0xd4, 0x8a, + 0xc4, 0x1d, 0xcd, 0x77, 0x65, 0x37, 0xd5, 0xaf, 0x82, 0xd5, 0xa2, 0x47, 0xbe, 0x22, 0xdf, 0x3f, + 0xd1, 0x94, 0xcb, 0xf0, 0x29, 0x13, 0xe1, 0x83, 0x10, 0x54, 0xe4, 0x53, 0x2f, 0x93, 0x60, 0xc9, + 0x6f, 0xfd, 0x1d, 0x05, 0xd4, 0x6f, 0x15, 0xcf, 0x4d, 0x17, 0x71, 0xc7, 0x87, 0x9d, 0xe9, 0x67, + 0x53, 0x59, 0xf8, 0xd5, 0xec, 0x4c, 0xbf, 0x9a, 0x4b, 0x8b, 0x3e, 0x9a, 0x7a, 0x1b, 0xd4, 0xe4, + 0x10, 0x73, 0x7f, 0x10, 0x86, 0x28, 0xd9, 0x13, 0x9e, 0xca, 0xd9, 0x42, 0x99, 0x18, 0x2d, 0x66, + 0x79, 0x1f, 0x80, 0xea, 0x7d, 0xe2, 0x45, 0x24, 0xf2, 0xe4, 0x48, 0x62, 0x82, 0x2a, 0xed, 0x3d, + 0xc4, 0x0e, 0x4f, 0x47, 0x1a, 0x65, 0xde, 0x44, 0x03, 0x52, 0x94, 0xe4, 0xbc, 0x00, 0x0e, 0xba, + 0x34, 0x44, 0x24, 0xaf, 0xcd, 0x19, 0xf0, 0x0c, 0xa0, 0xbf, 0xaf, 0x80, 0xc3, 0xe2, 0xaf, 0x90, + 0x8f, 0xea, 0x8c, 0xe2, 0xae, 0x2c, 0x58, 0xdc, 0xb7, 0xe7, 0x4f, 0x61, 0x4b, 0xff, 0x6e, 0x08, + 0xd3, 0x3f, 0x54, 0x40, 0x43, 0x44, 0x00, 0xbb, 0xd7, 0xb2, 0x2a, 0xc5, 0xd7, 0x22, 0xf7, 0x5e, + 0x42, 0x69, 0x1f, 0xde, 0x05, 0x87, 0x42, 0xcc, 0x18, 0xf2, 0xb0, 0x8c, 0x44, 0xd5, 0xdc, 0x9c, + 0x57, 0xaa, 0x05, 0xb5, 0xac, 0xd9, 0x5c, 0xc5, 0xca, 0x35, 0x60, 0x0b, 0x1c, 0x61, 0xc4, 0x8b, + 0x10, 0x1f, 0x24, 0x78, 0xb6, 0x9f, 0xa2, 0xdb, 0x97, 0x98, 0x6e, 0xed, 0xeb, 0xfd, 0x35, 0xe5, + 0x9b, 0xfd, 0x35, 0xe5, 0xa7, 0xfd, 0x35, 0xa5, 0x77, 0x50, 0x4e, 0xad, 0x9b, 0x7f, 0x06, 0x00, + 0x00, 0xff, 0xff, 0x5d, 0x05, 0xc0, 0x7f, 0x7e, 0x0b, 0x00, 0x00, +} + +func (m *BeaconState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BeaconState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BeaconState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.FinalizedCheckpoint != nil { + { + size, err := m.FinalizedCheckpoint.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3 + i-- + dAtA[i] = 0xf4 + i-- + dAtA[i] = 0xa2 + } + if m.CurrentJustifiedCheckpoint != nil { + { + size, err := m.CurrentJustifiedCheckpoint.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3 + i-- + dAtA[i] = 0xf4 + i-- + dAtA[i] = 0x9a + } + if m.PreviousJustifiedCheckpoint != nil { + { + size, err := m.PreviousJustifiedCheckpoint.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3 + i-- + dAtA[i] = 0xf4 + i-- + dAtA[i] = 0x92 + } + if len(m.JustificationBits) > 0 { + i -= len(m.JustificationBits) + copy(dAtA[i:], m.JustificationBits) + i = encodeVarintTypes(dAtA, i, uint64(len(m.JustificationBits))) + i-- + dAtA[i] = 0x3 + i-- + dAtA[i] = 0xf4 + i-- + dAtA[i] = 0x8a + } + if len(m.CurrentEpochAttestations) > 0 { + for iNdEx := len(m.CurrentEpochAttestations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CurrentEpochAttestations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3 + i-- + dAtA[i] = 0xb5 + i-- + dAtA[i] = 0xd2 + } + } + if len(m.PreviousEpochAttestations) > 0 { + for iNdEx := len(m.PreviousEpochAttestations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PreviousEpochAttestations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3 + i-- + dAtA[i] = 0xb5 + i-- + dAtA[i] = 0xca + } + } + if len(m.Slashings) > 0 { + dAtA5 := make([]byte, len(m.Slashings)*10) + var j4 int + for _, num := range m.Slashings { + for num >= 1<<7 { + dAtA5[j4] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j4++ + } + dAtA5[j4] = uint8(num) + j4++ + } + i -= j4 + copy(dAtA[i:], dAtA5[:j4]) + i = encodeVarintTypes(dAtA, i, uint64(j4)) + i-- + dAtA[i] = 0x2 + i-- + dAtA[i] = 0xf7 + i-- + dAtA[i] = 0x8a + } + if len(m.RandaoMixes) > 0 { + for iNdEx := len(m.RandaoMixes) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.RandaoMixes[iNdEx]) + copy(dAtA[i:], m.RandaoMixes[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.RandaoMixes[iNdEx]))) + i-- + dAtA[i] = 0x2 + i-- + dAtA[i] = 0xb8 + i-- + dAtA[i] = 0xca + } + } + if len(m.Balances) > 0 { + dAtA7 := make([]byte, len(m.Balances)*10) + var j6 int + for _, num := range m.Balances { + for num >= 1<<7 { + dAtA7[j6] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j6++ + } + dAtA7[j6] = uint8(num) + j6++ + } + i -= j6 + copy(dAtA[i:], dAtA7[:j6]) + i = encodeVarintTypes(dAtA, i, uint64(j6)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xfa + i-- + dAtA[i] = 0x92 + } + if len(m.Validators) > 0 { + for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Validators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xfa + i-- + dAtA[i] = 0x8a + } + } + if m.Eth1DepositIndex != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Eth1DepositIndex)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xbb + i-- + dAtA[i] = 0xd8 + } + if len(m.Eth1DataVotes) > 0 { + for iNdEx := len(m.Eth1DataVotes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Eth1DataVotes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xbb + i-- + dAtA[i] = 0xd2 + } + } + if m.Eth1Data != nil { + { + size, err := m.Eth1Data.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xbb + i-- + dAtA[i] = 0xca + } + if len(m.HistoricalRoots) > 0 { + for iNdEx := len(m.HistoricalRoots) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.HistoricalRoots[iNdEx]) + copy(dAtA[i:], m.HistoricalRoots[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.HistoricalRoots[iNdEx]))) + i-- + dAtA[i] = 0x7d + i-- + dAtA[i] = 0xa2 + } + } + if len(m.StateRoots) > 0 { + for iNdEx := len(m.StateRoots) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.StateRoots[iNdEx]) + copy(dAtA[i:], m.StateRoots[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.StateRoots[iNdEx]))) + i-- + dAtA[i] = 0x7d + i-- + dAtA[i] = 0x9a + } + } + if len(m.BlockRoots) > 0 { + for iNdEx := len(m.BlockRoots) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.BlockRoots[iNdEx]) + copy(dAtA[i:], m.BlockRoots[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.BlockRoots[iNdEx]))) + i-- + dAtA[i] = 0x7d + i-- + dAtA[i] = 0x92 + } + } + if m.LatestBlockHeader != nil { + { + size, err := m.LatestBlockHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x7d + i-- + dAtA[i] = 0x8a + } + if m.Fork != nil { + { + size, err := m.Fork.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3e + i-- + dAtA[i] = 0xe2 + } + if m.Slot != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Slot)) + i-- + dAtA[i] = 0x3e + i-- + dAtA[i] = 0xd8 + } + if len(m.GenesisValidatorsRoot) > 0 { + i -= len(m.GenesisValidatorsRoot) + copy(dAtA[i:], m.GenesisValidatorsRoot) + i = encodeVarintTypes(dAtA, i, uint64(len(m.GenesisValidatorsRoot))) + i-- + dAtA[i] = 0x3e + i-- + dAtA[i] = 0xd2 + } + if m.GenesisTime != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.GenesisTime)) + i-- + dAtA[i] = 0x3e + i-- + dAtA[i] = 0xc8 + } + return len(dAtA) - i, nil +} + +func (m *Fork) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Fork) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Fork) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Epoch != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x18 + } + if len(m.CurrentVersion) > 0 { + i -= len(m.CurrentVersion) + copy(dAtA[i:], m.CurrentVersion) + i = encodeVarintTypes(dAtA, i, uint64(len(m.CurrentVersion))) + i-- + dAtA[i] = 0x12 + } + if len(m.PreviousVersion) > 0 { + i -= len(m.PreviousVersion) + copy(dAtA[i:], m.PreviousVersion) + i = encodeVarintTypes(dAtA, i, uint64(len(m.PreviousVersion))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PendingAttestation) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PendingAttestation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PendingAttestation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.ProposerIndex != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ProposerIndex)) + i-- + dAtA[i] = 0x20 + } + if m.InclusionDelay != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.InclusionDelay)) + i-- + dAtA[i] = 0x18 + } + if m.Data != nil { + { + size, err := m.Data.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.AggregationBits) > 0 { + i -= len(m.AggregationBits) + copy(dAtA[i:], m.AggregationBits) + i = encodeVarintTypes(dAtA, i, uint64(len(m.AggregationBits))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ValidatorLatestVote) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ValidatorLatestVote) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorLatestVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Root) > 0 { + i -= len(m.Root) + copy(dAtA[i:], m.Root) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Root))) + i-- + dAtA[i] = 0x12 + } + if m.Epoch != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *HistoricalBatch) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HistoricalBatch) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HistoricalBatch) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.StateRoots) > 0 { + for iNdEx := len(m.StateRoots) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.StateRoots[iNdEx]) + copy(dAtA[i:], m.StateRoots[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.StateRoots[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.BlockRoots) > 0 { + for iNdEx := len(m.BlockRoots) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.BlockRoots[iNdEx]) + copy(dAtA[i:], m.BlockRoots[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.BlockRoots[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *StateSummary) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StateSummary) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StateSummary) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Root) > 0 { + i -= len(m.Root) + copy(dAtA[i:], m.Root) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Root))) + i-- + dAtA[i] = 0x12 + } + if m.Slot != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Slot)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *SigningRoot) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SigningRoot) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SigningRoot) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Domain) > 0 { + i -= len(m.Domain) + copy(dAtA[i:], m.Domain) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Domain))) + i-- + dAtA[i] = 0x12 + } + if len(m.ObjectRoot) > 0 { + i -= len(m.ObjectRoot) + copy(dAtA[i:], m.ObjectRoot) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ObjectRoot))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ForkData) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ForkData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ForkData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.CurrentVersion) > 0 { + i -= len(m.CurrentVersion) + copy(dAtA[i:], m.CurrentVersion) + i = encodeVarintTypes(dAtA, i, uint64(len(m.CurrentVersion))) + i-- + dAtA[i] = 0x22 + } + if len(m.GenesisValidatorsRoot) > 0 { + i -= len(m.GenesisValidatorsRoot) + copy(dAtA[i:], m.GenesisValidatorsRoot) + i = encodeVarintTypes(dAtA, i, uint64(len(m.GenesisValidatorsRoot))) + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} + +func (m *SignedAggregateAndProof) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SignedAggregateAndProof) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SignedAggregateAndProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if m.Message != nil { + { + size, err := m.Message.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *BeaconState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.GenesisTime != 0 { + n += 2 + sovTypes(uint64(m.GenesisTime)) + } + l = len(m.GenesisValidatorsRoot) + if l > 0 { + n += 2 + l + sovTypes(uint64(l)) + } + if m.Slot != 0 { + n += 2 + sovTypes(uint64(m.Slot)) + } + if m.Fork != nil { + l = m.Fork.Size() + n += 2 + l + sovTypes(uint64(l)) + } + if m.LatestBlockHeader != nil { + l = m.LatestBlockHeader.Size() + n += 2 + l + sovTypes(uint64(l)) + } + if len(m.BlockRoots) > 0 { + for _, b := range m.BlockRoots { + l = len(b) + n += 2 + l + sovTypes(uint64(l)) + } + } + if len(m.StateRoots) > 0 { + for _, b := range m.StateRoots { + l = len(b) + n += 2 + l + sovTypes(uint64(l)) + } + } + if len(m.HistoricalRoots) > 0 { + for _, b := range m.HistoricalRoots { + l = len(b) + n += 2 + l + sovTypes(uint64(l)) + } + } + if m.Eth1Data != nil { + l = m.Eth1Data.Size() + n += 3 + l + sovTypes(uint64(l)) + } + if len(m.Eth1DataVotes) > 0 { + for _, e := range m.Eth1DataVotes { + l = e.Size() + n += 3 + l + sovTypes(uint64(l)) + } + } + if m.Eth1DepositIndex != 0 { + n += 3 + sovTypes(uint64(m.Eth1DepositIndex)) + } + if len(m.Validators) > 0 { + for _, e := range m.Validators { + l = e.Size() + n += 3 + l + sovTypes(uint64(l)) + } + } + if len(m.Balances) > 0 { + l = 0 + for _, e := range m.Balances { + l += sovTypes(uint64(e)) + } + n += 3 + sovTypes(uint64(l)) + l + } + if len(m.RandaoMixes) > 0 { + for _, b := range m.RandaoMixes { + l = len(b) + n += 3 + l + sovTypes(uint64(l)) + } + } + if len(m.Slashings) > 0 { + l = 0 + for _, e := range m.Slashings { + l += sovTypes(uint64(e)) + } + n += 3 + sovTypes(uint64(l)) + l + } + if len(m.PreviousEpochAttestations) > 0 { + for _, e := range m.PreviousEpochAttestations { + l = e.Size() + n += 3 + l + sovTypes(uint64(l)) + } + } + if len(m.CurrentEpochAttestations) > 0 { + for _, e := range m.CurrentEpochAttestations { + l = e.Size() + n += 3 + l + sovTypes(uint64(l)) + } + } + l = len(m.JustificationBits) + if l > 0 { + n += 3 + l + sovTypes(uint64(l)) + } + if m.PreviousJustifiedCheckpoint != nil { + l = m.PreviousJustifiedCheckpoint.Size() + n += 3 + l + sovTypes(uint64(l)) + } + if m.CurrentJustifiedCheckpoint != nil { + l = m.CurrentJustifiedCheckpoint.Size() + n += 3 + l + sovTypes(uint64(l)) + } + if m.FinalizedCheckpoint != nil { + l = m.FinalizedCheckpoint.Size() + n += 3 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Fork) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PreviousVersion) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.CurrentVersion) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.Epoch != 0 { + n += 1 + sovTypes(uint64(m.Epoch)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PendingAttestation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AggregationBits) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.Data != nil { + l = m.Data.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.InclusionDelay != 0 { + n += 1 + sovTypes(uint64(m.InclusionDelay)) + } + if m.ProposerIndex != 0 { + n += 1 + sovTypes(uint64(m.ProposerIndex)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ValidatorLatestVote) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovTypes(uint64(m.Epoch)) + } + l = len(m.Root) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HistoricalBatch) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.BlockRoots) > 0 { + for _, b := range m.BlockRoots { + l = len(b) + n += 1 + l + sovTypes(uint64(l)) + } + } + if len(m.StateRoots) > 0 { + for _, b := range m.StateRoots { + l = len(b) + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StateSummary) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Slot != 0 { + n += 1 + sovTypes(uint64(m.Slot)) + } + l = len(m.Root) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SigningRoot) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ObjectRoot) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Domain) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ForkData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.GenesisValidatorsRoot) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.CurrentVersion) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SignedAggregateAndProof) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Message != nil { + l = m.Message.Size() + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *BeaconState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BeaconState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BeaconState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1001: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GenesisTime", wireType) + } + m.GenesisTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GenesisTime |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 1002: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GenesisValidatorsRoot", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GenesisValidatorsRoot = append(m.GenesisValidatorsRoot[:0], dAtA[iNdEx:postIndex]...) + if m.GenesisValidatorsRoot == nil { + m.GenesisValidatorsRoot = []byte{} + } + iNdEx = postIndex + case 1003: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Slot", wireType) + } + m.Slot = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Slot |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 1004: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fork", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Fork == nil { + m.Fork = &Fork{} + } + if err := m.Fork.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2001: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestBlockHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LatestBlockHeader == nil { + m.LatestBlockHeader = &v1alpha1.BeaconBlockHeader{} + } + if err := m.LatestBlockHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2002: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockRoots", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlockRoots = append(m.BlockRoots, make([]byte, postIndex-iNdEx)) + copy(m.BlockRoots[len(m.BlockRoots)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2003: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateRoots", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StateRoots = append(m.StateRoots, make([]byte, postIndex-iNdEx)) + copy(m.StateRoots[len(m.StateRoots)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2004: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HistoricalRoots", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HistoricalRoots = append(m.HistoricalRoots, make([]byte, postIndex-iNdEx)) + copy(m.HistoricalRoots[len(m.HistoricalRoots)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3001: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Eth1Data", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Eth1Data == nil { + m.Eth1Data = &v1alpha1.Eth1Data{} + } + if err := m.Eth1Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3002: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Eth1DataVotes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Eth1DataVotes = append(m.Eth1DataVotes, &v1alpha1.Eth1Data{}) + if err := m.Eth1DataVotes[len(m.Eth1DataVotes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3003: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Eth1DepositIndex", wireType) + } + m.Eth1DepositIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Eth1DepositIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4001: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Validators = append(m.Validators, &v1alpha1.Validator{}) + if err := m.Validators[len(m.Validators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4002: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Balances = append(m.Balances, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.Balances) == 0 { + m.Balances = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Balances = append(m.Balances, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Balances", wireType) + } + case 5001: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RandaoMixes", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RandaoMixes = append(m.RandaoMixes, make([]byte, postIndex-iNdEx)) + copy(m.RandaoMixes[len(m.RandaoMixes)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6001: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Slashings = append(m.Slashings, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.Slashings) == 0 { + m.Slashings = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Slashings = append(m.Slashings, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Slashings", wireType) + } + case 7001: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PreviousEpochAttestations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PreviousEpochAttestations = append(m.PreviousEpochAttestations, &PendingAttestation{}) + if err := m.PreviousEpochAttestations[len(m.PreviousEpochAttestations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7002: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentEpochAttestations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CurrentEpochAttestations = append(m.CurrentEpochAttestations, &PendingAttestation{}) + if err := m.CurrentEpochAttestations[len(m.CurrentEpochAttestations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8001: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field JustificationBits", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.JustificationBits = append(m.JustificationBits[:0], dAtA[iNdEx:postIndex]...) + if m.JustificationBits == nil { + m.JustificationBits = []byte{} + } + iNdEx = postIndex + case 8002: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PreviousJustifiedCheckpoint", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PreviousJustifiedCheckpoint == nil { + m.PreviousJustifiedCheckpoint = &v1alpha1.Checkpoint{} + } + if err := m.PreviousJustifiedCheckpoint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8003: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentJustifiedCheckpoint", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CurrentJustifiedCheckpoint == nil { + m.CurrentJustifiedCheckpoint = &v1alpha1.Checkpoint{} + } + if err := m.CurrentJustifiedCheckpoint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8004: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FinalizedCheckpoint", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.FinalizedCheckpoint == nil { + m.FinalizedCheckpoint = &v1alpha1.Checkpoint{} + } + if err := m.FinalizedCheckpoint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Fork) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Fork: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Fork: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PreviousVersion", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PreviousVersion = append(m.PreviousVersion[:0], dAtA[iNdEx:postIndex]...) + if m.PreviousVersion == nil { + m.PreviousVersion = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentVersion", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CurrentVersion = append(m.CurrentVersion[:0], dAtA[iNdEx:postIndex]...) + if m.CurrentVersion == nil { + m.CurrentVersion = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PendingAttestation) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PendingAttestation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PendingAttestation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AggregationBits", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AggregationBits = append(m.AggregationBits[:0], dAtA[iNdEx:postIndex]...) + if m.AggregationBits == nil { + m.AggregationBits = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Data == nil { + m.Data = &v1alpha1.AttestationData{} + } + if err := m.Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InclusionDelay", wireType) + } + m.InclusionDelay = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.InclusionDelay |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposerIndex", wireType) + } + m.ProposerIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposerIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ValidatorLatestVote) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ValidatorLatestVote: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValidatorLatestVote: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Root", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Root = append(m.Root[:0], dAtA[iNdEx:postIndex]...) + if m.Root == nil { + m.Root = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HistoricalBatch) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HistoricalBatch: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HistoricalBatch: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockRoots", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlockRoots = append(m.BlockRoots, make([]byte, postIndex-iNdEx)) + copy(m.BlockRoots[len(m.BlockRoots)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateRoots", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StateRoots = append(m.StateRoots, make([]byte, postIndex-iNdEx)) + copy(m.StateRoots[len(m.StateRoots)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StateSummary) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StateSummary: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StateSummary: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Slot", wireType) + } + m.Slot = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Slot |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Root", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Root = append(m.Root[:0], dAtA[iNdEx:postIndex]...) + if m.Root == nil { + m.Root = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SigningRoot) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SigningRoot: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SigningRoot: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectRoot", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ObjectRoot = append(m.ObjectRoot[:0], dAtA[iNdEx:postIndex]...) + if m.ObjectRoot == nil { + m.ObjectRoot = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Domain", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Domain = append(m.Domain[:0], dAtA[iNdEx:postIndex]...) + if m.Domain == nil { + m.Domain = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ForkData) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ForkData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ForkData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GenesisValidatorsRoot", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GenesisValidatorsRoot = append(m.GenesisValidatorsRoot[:0], dAtA[iNdEx:postIndex]...) + if m.GenesisValidatorsRoot == nil { + m.GenesisValidatorsRoot = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentVersion", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CurrentVersion = append(m.CurrentVersion[:0], dAtA[iNdEx:postIndex]...) + if m.CurrentVersion == nil { + m.CurrentVersion = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SignedAggregateAndProof) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SignedAggregateAndProof: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SignedAggregateAndProof: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Message == nil { + m.Message = &v1alpha1.AggregateAttestationAndProof{} + } + if err := m.Message.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/shared/cmd/flags.go b/shared/cmd/flags.go index deefe9f1241..1dafdc6e4d7 100644 --- a/shared/cmd/flags.go +++ b/shared/cmd/flags.go @@ -112,6 +112,12 @@ var ( Usage: "The file containing the private key to use in communications with other peers.", Value: "", } + // P2PMetadata defines a flag to specify the location of the peer metadata file. + P2PMetadata = &cli.StringFlag{ + Name: "p2p-metadata", + Usage: "The file containing the metadata to communicate with other peers.", + Value: "", + } // P2PMaxPeers defines a flag to specify the max number of peers in libp2p. P2PMaxPeers = &cli.Int64Flag{ Name: "p2p-max-peers", diff --git a/shared/featureconfig/flags.go b/shared/featureconfig/flags.go index af90be5f722..f09bb17c77e 100644 --- a/shared/featureconfig/flags.go +++ b/shared/featureconfig/flags.go @@ -144,9 +144,9 @@ const deprecatedUsage = "DEPRECATED. DO NOT USE." var ( deprecatedEnableNoiseHandshake = &cli.BoolFlag{ Name: "enable-noise", - Usage: deprecatedUsage, + Usage: deprecatedUsage, Hidden: true, - } + } deprecatedEnableInitSyncQueue = &cli.BoolFlag{ Name: "enable-initial-sync-queue", Usage: deprecatedUsage,