diff --git a/beacon-chain/blockchain/BUILD.bazel b/beacon-chain/blockchain/BUILD.bazel index 18da2e68c..3acc78d65 100644 --- a/beacon-chain/blockchain/BUILD.bazel +++ b/beacon-chain/blockchain/BUILD.bazel @@ -13,7 +13,7 @@ go_library( "//beacon-chain/powchain:go_default_library", "//beacon-chain/types:go_default_library", "//beacon-chain/utils:go_default_library", - "//proto/sharding/v1:go_default_library", + "//proto/beacon/p2p/v1:go_default_library", "//shared/database:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_ethereum_go_ethereum//ethdb:go_default_library", @@ -34,7 +34,7 @@ go_test( "//beacon-chain/powchain:go_default_library", "//beacon-chain/types:go_default_library", "//beacon-chain/utils:go_default_library", - "//proto/sharding/v1:go_default_library", + "//proto/beacon/p2p/v1:go_default_library", "//shared/database:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_ethereum_go_ethereum//core/types:go_default_library", diff --git a/beacon-chain/blockchain/core.go b/beacon-chain/blockchain/core.go index 58eed4255..915d10f93 100644 --- a/beacon-chain/blockchain/core.go +++ b/beacon-chain/blockchain/core.go @@ -14,7 +14,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/params" "github.com/prysmaticlabs/prysm/beacon-chain/types" "github.com/prysmaticlabs/prysm/beacon-chain/utils" - pb "github.com/prysmaticlabs/prysm/proto/sharding/v1" + pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/sirupsen/logrus" ) diff --git a/beacon-chain/blockchain/core_test.go b/beacon-chain/blockchain/core_test.go index bdf337110..b5ee9621b 100644 --- a/beacon-chain/blockchain/core_test.go +++ b/beacon-chain/blockchain/core_test.go @@ -14,7 +14,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/params" "github.com/prysmaticlabs/prysm/beacon-chain/types" "github.com/prysmaticlabs/prysm/beacon-chain/utils" - pb "github.com/prysmaticlabs/prysm/proto/sharding/v1" + pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/prysmaticlabs/prysm/shared/database" logTest "github.com/sirupsen/logrus/hooks/test" ) diff --git a/beacon-chain/simulator/BUILD.bazel b/beacon-chain/simulator/BUILD.bazel index 1a8f9dc33..e7374bd09 100644 --- a/beacon-chain/simulator/BUILD.bazel +++ b/beacon-chain/simulator/BUILD.bazel @@ -7,7 +7,7 @@ go_library( visibility = ["//beacon-chain:__subpackages__"], deps = [ "//beacon-chain/types:go_default_library", - "//proto/sharding/v1:go_default_library", + "//proto/beacon/p2p/v1:go_default_library", "//shared/p2p:go_default_library", "@com_github_golang_protobuf//ptypes:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", @@ -20,7 +20,7 @@ go_test( embed = [":go_default_library"], deps = [ "//beacon-chain/types:go_default_library", - "//proto/sharding/v1:go_default_library", + "//proto/beacon/p2p/v1:go_default_library", "//shared/p2p:go_default_library", "//shared/testutil:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", diff --git a/beacon-chain/simulator/service.go b/beacon-chain/simulator/service.go index b94e290d3..44c1cdb35 100644 --- a/beacon-chain/simulator/service.go +++ b/beacon-chain/simulator/service.go @@ -10,7 +10,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/types" "github.com/prysmaticlabs/prysm/shared/p2p" - pb "github.com/prysmaticlabs/prysm/proto/sharding/v1" + pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/sirupsen/logrus" ) diff --git a/beacon-chain/simulator/service_test.go b/beacon-chain/simulator/service_test.go index f25ba56cb..c30d4d3cb 100644 --- a/beacon-chain/simulator/service_test.go +++ b/beacon-chain/simulator/service_test.go @@ -9,7 +9,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/event" "github.com/prysmaticlabs/prysm/beacon-chain/types" - pb "github.com/prysmaticlabs/prysm/proto/sharding/v1" + pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/prysmaticlabs/prysm/shared/p2p" "github.com/prysmaticlabs/prysm/shared/testutil" logTest "github.com/sirupsen/logrus/hooks/test" diff --git a/beacon-chain/sync/BUILD.bazel b/beacon-chain/sync/BUILD.bazel index 8c9daeb3e..f388870b1 100644 --- a/beacon-chain/sync/BUILD.bazel +++ b/beacon-chain/sync/BUILD.bazel @@ -7,7 +7,7 @@ go_library( visibility = ["//beacon-chain:__subpackages__"], deps = [ "//beacon-chain/types:go_default_library", - "//proto/sharding/v1:go_default_library", + "//proto/beacon/p2p/v1:go_default_library", "//shared/p2p:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", ], @@ -19,7 +19,7 @@ go_test( embed = [":go_default_library"], deps = [ "//beacon-chain/types:go_default_library", - "//proto/sharding/v1:go_default_library", + "//proto/beacon/p2p/v1:go_default_library", "//shared/p2p:go_default_library", "//shared/testutil:go_default_library", "@com_github_ethereum_go_ethereum//event:go_default_library", diff --git a/beacon-chain/sync/service.go b/beacon-chain/sync/service.go index 7e04b8f5e..7c846284e 100644 --- a/beacon-chain/sync/service.go +++ b/beacon-chain/sync/service.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/prysmaticlabs/prysm/beacon-chain/types" - pb "github.com/prysmaticlabs/prysm/proto/sharding/v1" + pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/prysmaticlabs/prysm/shared/p2p" "github.com/sirupsen/logrus" ) diff --git a/beacon-chain/sync/service_test.go b/beacon-chain/sync/service_test.go index bc97312e0..032aaa42d 100644 --- a/beacon-chain/sync/service_test.go +++ b/beacon-chain/sync/service_test.go @@ -6,7 +6,7 @@ import ( "github.com/ethereum/go-ethereum/event" "github.com/prysmaticlabs/prysm/beacon-chain/types" - pb "github.com/prysmaticlabs/prysm/proto/sharding/v1" + pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/prysmaticlabs/prysm/shared/p2p" "github.com/prysmaticlabs/prysm/shared/testutil" logTest "github.com/sirupsen/logrus/hooks/test" diff --git a/beacon-chain/types/BUILD.bazel b/beacon-chain/types/BUILD.bazel index 0827ff1ac..9bfbbd541 100644 --- a/beacon-chain/types/BUILD.bazel +++ b/beacon-chain/types/BUILD.bazel @@ -10,7 +10,7 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/beacon-chain/types", visibility = ["//beacon-chain:__subpackages__"], deps = [ - "//proto/sharding/v1:go_default_library", + "//proto/beacon/p2p/v1:go_default_library", "//shared/p2p:go_default_library", "@com_github_ethereum_go_ethereum//:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", diff --git a/beacon-chain/types/block.go b/beacon-chain/types/block.go index 464878e79..74d7acb12 100644 --- a/beacon-chain/types/block.go +++ b/beacon-chain/types/block.go @@ -8,7 +8,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" - pb "github.com/prysmaticlabs/prysm/proto/sharding/v1" + pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "golang.org/x/crypto/blake2b" ) diff --git a/beacon-chain/types/state.go b/beacon-chain/types/state.go index 59daabdcf..0edddcfc6 100644 --- a/beacon-chain/types/state.go +++ b/beacon-chain/types/state.go @@ -3,7 +3,7 @@ package types import ( "github.com/ethereum/go-ethereum/common" "github.com/gogo/protobuf/proto" - pb "github.com/prysmaticlabs/prysm/proto/sharding/v1" + pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "golang.org/x/crypto/blake2b" ) diff --git a/client/proposer/BUILD.bazel b/client/proposer/BUILD.bazel index 412dbfbe4..cd5cd82b1 100644 --- a/client/proposer/BUILD.bazel +++ b/client/proposer/BUILD.bazel @@ -14,7 +14,7 @@ go_library( "//client/syncer:go_default_library", "//client/txpool:go_default_library", "//client/types:go_default_library", - "//proto/sharding/v1:go_default_library", + "//proto/sharding/p2p/v1:go_default_library", "//shared/database:go_default_library", "//shared/legacyutil:go_default_library", "//shared/p2p:go_default_library", @@ -37,7 +37,7 @@ go_test( "//client/params:go_default_library", "//client/syncer:go_default_library", "//client/txpool:go_default_library", - "//proto/sharding/v1:go_default_library", + "//proto/sharding/p2p/v1:go_default_library", "//shared/database:go_default_library", "//shared/p2p:go_default_library", "@com_github_ethereum_go_ethereum//accounts/abi/bind:go_default_library", diff --git a/client/proposer/service.go b/client/proposer/service.go index de42ec69b..57b402f42 100644 --- a/client/proposer/service.go +++ b/client/proposer/service.go @@ -13,7 +13,7 @@ import ( "github.com/prysmaticlabs/prysm/client/syncer" "github.com/prysmaticlabs/prysm/client/txpool" "github.com/prysmaticlabs/prysm/client/types" - pb "github.com/prysmaticlabs/prysm/proto/sharding/v1" + pb "github.com/prysmaticlabs/prysm/proto/sharding/p2p/v1" "github.com/prysmaticlabs/prysm/shared/database" "github.com/prysmaticlabs/prysm/shared/legacyutil" "github.com/prysmaticlabs/prysm/shared/p2p" diff --git a/client/proposer/service_test.go b/client/proposer/service_test.go index a6cb78cd2..cba98293f 100644 --- a/client/proposer/service_test.go +++ b/client/proposer/service_test.go @@ -5,6 +5,7 @@ import ( "fmt" "math" "time" + //"math" "math/big" "testing" @@ -17,7 +18,7 @@ import ( "github.com/prysmaticlabs/prysm/client/params" "github.com/prysmaticlabs/prysm/client/syncer" "github.com/prysmaticlabs/prysm/client/txpool" - pb "github.com/prysmaticlabs/prysm/proto/sharding/v1" + pb "github.com/prysmaticlabs/prysm/proto/sharding/p2p/v1" "github.com/prysmaticlabs/prysm/shared/database" "github.com/prysmaticlabs/prysm/shared/p2p" logTest "github.com/sirupsen/logrus/hooks/test" diff --git a/client/simulator/BUILD.bazel b/client/simulator/BUILD.bazel index c19be9b46..3d96732d1 100644 --- a/client/simulator/BUILD.bazel +++ b/client/simulator/BUILD.bazel @@ -9,7 +9,7 @@ go_library( "//client/mainchain:go_default_library", "//client/params:go_default_library", "//client/syncer:go_default_library", - "//proto/sharding/v1:go_default_library", + "//proto/sharding/p2p/v1:go_default_library", "//shared/p2p:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", ], diff --git a/client/simulator/service.go b/client/simulator/service.go index 85485f371..31206e71e 100644 --- a/client/simulator/service.go +++ b/client/simulator/service.go @@ -12,7 +12,7 @@ import ( "github.com/prysmaticlabs/prysm/client/syncer" "github.com/prysmaticlabs/prysm/shared/p2p" - pb "github.com/prysmaticlabs/prysm/proto/sharding/v1" + pb "github.com/prysmaticlabs/prysm/proto/sharding/p2p/v1" "github.com/sirupsen/logrus" ) diff --git a/client/syncer/BUILD.bazel b/client/syncer/BUILD.bazel index edf30c486..817766fb0 100644 --- a/client/syncer/BUILD.bazel +++ b/client/syncer/BUILD.bazel @@ -12,7 +12,7 @@ go_library( "//client/mainchain:go_default_library", "//client/params:go_default_library", "//client/types:go_default_library", - "//proto/sharding/v1:go_default_library", + "//proto/sharding/p2p/v1:go_default_library", "//shared/database:go_default_library", "//shared/p2p:go_default_library", "@com_github_ethereum_go_ethereum//accounts/abi/bind:go_default_library", @@ -35,7 +35,7 @@ go_test( "//client/mainchain:go_default_library", "//client/params:go_default_library", "//client/types:go_default_library", - "//proto/sharding/v1:go_default_library", + "//proto/sharding/p2p/v1:go_default_library", "//shared:go_default_library", "//shared/database:go_default_library", "//shared/p2p:go_default_library", diff --git a/client/syncer/handlers.go b/client/syncer/handlers.go index 3c78f075f..a058b7c6f 100644 --- a/client/syncer/handlers.go +++ b/client/syncer/handlers.go @@ -8,7 +8,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/prysmaticlabs/prysm/client/mainchain" "github.com/prysmaticlabs/prysm/client/types" - pb "github.com/prysmaticlabs/prysm/proto/sharding/v1" + pb "github.com/prysmaticlabs/prysm/proto/sharding/p2p/v1" "github.com/prysmaticlabs/prysm/shared/p2p" "github.com/sirupsen/logrus" ) diff --git a/client/syncer/handlers_test.go b/client/syncer/handlers_test.go index 4a7283479..bfec798e6 100644 --- a/client/syncer/handlers_test.go +++ b/client/syncer/handlers_test.go @@ -18,7 +18,7 @@ import ( "github.com/prysmaticlabs/prysm/client/contracts" shardparams "github.com/prysmaticlabs/prysm/client/params" shardingTypes "github.com/prysmaticlabs/prysm/client/types" - pb "github.com/prysmaticlabs/prysm/proto/sharding/v1" + pb "github.com/prysmaticlabs/prysm/proto/sharding/p2p/v1" "github.com/prysmaticlabs/prysm/shared/p2p" ) diff --git a/client/syncer/service.go b/client/syncer/service.go index 035448687..b6e43bd21 100644 --- a/client/syncer/service.go +++ b/client/syncer/service.go @@ -10,7 +10,7 @@ import ( "github.com/prysmaticlabs/prysm/client/mainchain" "github.com/prysmaticlabs/prysm/client/params" "github.com/prysmaticlabs/prysm/client/types" - pb "github.com/prysmaticlabs/prysm/proto/sharding/v1" + pb "github.com/prysmaticlabs/prysm/proto/sharding/p2p/v1" "github.com/prysmaticlabs/prysm/shared/database" "github.com/prysmaticlabs/prysm/shared/p2p" "github.com/sirupsen/logrus" diff --git a/client/syncer/service_test.go b/client/syncer/service_test.go index 39dfecf4c..90c13537d 100644 --- a/client/syncer/service_test.go +++ b/client/syncer/service_test.go @@ -11,7 +11,7 @@ import ( "github.com/prysmaticlabs/prysm/client/mainchain" "github.com/prysmaticlabs/prysm/client/params" "github.com/prysmaticlabs/prysm/client/types" - pb "github.com/prysmaticlabs/prysm/proto/sharding/v1" + pb "github.com/prysmaticlabs/prysm/proto/sharding/p2p/v1" "github.com/prysmaticlabs/prysm/shared" "github.com/prysmaticlabs/prysm/shared/database" "github.com/prysmaticlabs/prysm/shared/p2p" diff --git a/proto/README.md b/proto/README.md new file mode 100644 index 000000000..14b6695b5 --- /dev/null +++ b/proto/README.md @@ -0,0 +1,17 @@ +# Ethereum 2.0 Protocol Buffers + +This package defines common protobuf messages and services used by Ethereum 2.0 clients. Following the structure of: + +``` +proto/ + beacon/ + p2p/ + v1/ + rpc/ + v1/ + sharding/ + p2p/ + v1/ +``` + +We specify messages available for p2p communication common to beacon chain nodes and sharding clients. \ No newline at end of file diff --git a/proto/beacon/p2p/v1/BUILD.bazel b/proto/beacon/p2p/v1/BUILD.bazel new file mode 100644 index 000000000..b549de18c --- /dev/null +++ b/proto/beacon/p2p/v1/BUILD.bazel @@ -0,0 +1,23 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") +load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") + +proto_library( + name = "ethereum_beacon_p2p_v1_proto", + srcs = ["messages.proto"], + visibility = ["//visibility:public"], + deps = ["@com_google_protobuf//:timestamp_proto"], +) + +go_proto_library( + name = "ethereum_beacon_p2p_v1_go_proto", + importpath = "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1", + proto = ":ethereum_beacon_p2p_v1_proto", + visibility = ["//visibility:public"], +) + +go_library( + name = "go_default_library", + embed = [":ethereum_beacon_p2p_v1_go_proto"], + importpath = "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1", + visibility = ["//visibility:public"], +) diff --git a/proto/sharding/v1/messages.pb.go b/proto/beacon/p2p/v1/messages.pb.go similarity index 56% rename from proto/sharding/v1/messages.pb.go rename to proto/beacon/p2p/v1/messages.pb.go index d1bc578ed..25398f58e 100644 --- a/proto/sharding/v1/messages.pb.go +++ b/proto/beacon/p2p/v1/messages.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: messages.proto +// source: proto/beacon/p2p/v1/messages.proto -package ethereum_messages_v1 +package ethereum_beacon_p2p_v1 import proto "github.com/golang/protobuf/proto" import fmt "fmt" @@ -19,44 +19,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package -type Topic int32 - -const ( - Topic_UNKNOWN Topic = 0 - Topic_COLLATION_BODY_REQUEST Topic = 1 - Topic_COLLATION_BODY_RESPONSE Topic = 2 - Topic_TRANSACTIONS Topic = 3 - Topic_BEACON_BLOCK_HASH_ANNOUNCE Topic = 4 - Topic_BEACON_BLOCK_REQUEST Topic = 5 - Topic_BEACON_BLOCK_RESPONSE Topic = 6 -) - -var Topic_name = map[int32]string{ - 0: "UNKNOWN", - 1: "COLLATION_BODY_REQUEST", - 2: "COLLATION_BODY_RESPONSE", - 3: "TRANSACTIONS", - 4: "BEACON_BLOCK_HASH_ANNOUNCE", - 5: "BEACON_BLOCK_REQUEST", - 6: "BEACON_BLOCK_RESPONSE", -} -var Topic_value = map[string]int32{ - "UNKNOWN": 0, - "COLLATION_BODY_REQUEST": 1, - "COLLATION_BODY_RESPONSE": 2, - "TRANSACTIONS": 3, - "BEACON_BLOCK_HASH_ANNOUNCE": 4, - "BEACON_BLOCK_REQUEST": 5, - "BEACON_BLOCK_RESPONSE": 6, -} - -func (x Topic) String() string { - return proto.EnumName(Topic_name, int32(x)) -} -func (Topic) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_messages_7e3c5d5de878ef23, []int{0} -} - type BeaconBlockHashAnnounce struct { Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -68,7 +30,7 @@ func (m *BeaconBlockHashAnnounce) Reset() { *m = BeaconBlockHashAnnounce func (m *BeaconBlockHashAnnounce) String() string { return proto.CompactTextString(m) } func (*BeaconBlockHashAnnounce) ProtoMessage() {} func (*BeaconBlockHashAnnounce) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_7e3c5d5de878ef23, []int{0} + return fileDescriptor_messages_e1d33f8757fc0f25, []int{0} } func (m *BeaconBlockHashAnnounce) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BeaconBlockHashAnnounce.Unmarshal(m, b) @@ -106,7 +68,7 @@ func (m *BeaconBlockRequest) Reset() { *m = BeaconBlockRequest{} } func (m *BeaconBlockRequest) String() string { return proto.CompactTextString(m) } func (*BeaconBlockRequest) ProtoMessage() {} func (*BeaconBlockRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_7e3c5d5de878ef23, []int{1} + return fileDescriptor_messages_e1d33f8757fc0f25, []int{1} } func (m *BeaconBlockRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BeaconBlockRequest.Unmarshal(m, b) @@ -153,7 +115,7 @@ func (m *BeaconBlockResponse) Reset() { *m = BeaconBlockResponse{} } func (m *BeaconBlockResponse) String() string { return proto.CompactTextString(m) } func (*BeaconBlockResponse) ProtoMessage() {} func (*BeaconBlockResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_7e3c5d5de878ef23, []int{2} + return fileDescriptor_messages_e1d33f8757fc0f25, []int{2} } func (m *BeaconBlockResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BeaconBlockResponse.Unmarshal(m, b) @@ -254,7 +216,7 @@ func (m *CrystallizedStateHashAnnounce) Reset() { *m = CrystallizedState func (m *CrystallizedStateHashAnnounce) String() string { return proto.CompactTextString(m) } func (*CrystallizedStateHashAnnounce) ProtoMessage() {} func (*CrystallizedStateHashAnnounce) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_7e3c5d5de878ef23, []int{3} + return fileDescriptor_messages_e1d33f8757fc0f25, []int{3} } func (m *CrystallizedStateHashAnnounce) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CrystallizedStateHashAnnounce.Unmarshal(m, b) @@ -292,7 +254,7 @@ func (m *CrystallizedStateRequest) Reset() { *m = CrystallizedStateReque func (m *CrystallizedStateRequest) String() string { return proto.CompactTextString(m) } func (*CrystallizedStateRequest) ProtoMessage() {} func (*CrystallizedStateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_7e3c5d5de878ef23, []int{4} + return fileDescriptor_messages_e1d33f8757fc0f25, []int{4} } func (m *CrystallizedStateRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CrystallizedStateRequest.Unmarshal(m, b) @@ -342,7 +304,7 @@ func (m *CrystallizedStateResponse) Reset() { *m = CrystallizedStateResp func (m *CrystallizedStateResponse) String() string { return proto.CompactTextString(m) } func (*CrystallizedStateResponse) ProtoMessage() {} func (*CrystallizedStateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_7e3c5d5de878ef23, []int{5} + return fileDescriptor_messages_e1d33f8757fc0f25, []int{5} } func (m *CrystallizedStateResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CrystallizedStateResponse.Unmarshal(m, b) @@ -464,7 +426,7 @@ func (m *ActiveStateHashAnnounce) Reset() { *m = ActiveStateHashAnnounce func (m *ActiveStateHashAnnounce) String() string { return proto.CompactTextString(m) } func (*ActiveStateHashAnnounce) ProtoMessage() {} func (*ActiveStateHashAnnounce) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_7e3c5d5de878ef23, []int{6} + return fileDescriptor_messages_e1d33f8757fc0f25, []int{6} } func (m *ActiveStateHashAnnounce) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ActiveStateHashAnnounce.Unmarshal(m, b) @@ -502,7 +464,7 @@ func (m *ActiveStateRequest) Reset() { *m = ActiveStateRequest{} } func (m *ActiveStateRequest) String() string { return proto.CompactTextString(m) } func (*ActiveStateRequest) ProtoMessage() {} func (*ActiveStateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_7e3c5d5de878ef23, []int{7} + return fileDescriptor_messages_e1d33f8757fc0f25, []int{7} } func (m *ActiveStateRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ActiveStateRequest.Unmarshal(m, b) @@ -541,7 +503,7 @@ func (m *ActiveStateResponse) Reset() { *m = ActiveStateResponse{} } func (m *ActiveStateResponse) String() string { return proto.CompactTextString(m) } func (*ActiveStateResponse) ProtoMessage() {} func (*ActiveStateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_7e3c5d5de878ef23, []int{8} + return fileDescriptor_messages_e1d33f8757fc0f25, []int{8} } func (m *ActiveStateResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ActiveStateResponse.Unmarshal(m, b) @@ -589,7 +551,7 @@ func (m *AggregateVote) Reset() { *m = AggregateVote{} } func (m *AggregateVote) String() string { return proto.CompactTextString(m) } func (*AggregateVote) ProtoMessage() {} func (*AggregateVote) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_7e3c5d5de878ef23, []int{9} + return fileDescriptor_messages_e1d33f8757fc0f25, []int{9} } func (m *AggregateVote) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AggregateVote.Unmarshal(m, b) @@ -637,76 +599,6 @@ func (m *AggregateVote) GetAggregateSig() []uint32 { return nil } -type CollationBodyRequest struct { - ShardId uint64 `protobuf:"varint,1,opt,name=shard_id,json=shardId,proto3" json:"shard_id,omitempty"` - Period uint64 `protobuf:"varint,2,opt,name=period,proto3" json:"period,omitempty"` - ChunkRoot []byte `protobuf:"bytes,3,opt,name=chunk_root,json=chunkRoot,proto3" json:"chunk_root,omitempty"` - ProposerAddress []byte `protobuf:"bytes,4,opt,name=proposer_address,json=proposerAddress,proto3" json:"proposer_address,omitempty"` - Signature []byte `protobuf:"bytes,5,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CollationBodyRequest) Reset() { *m = CollationBodyRequest{} } -func (m *CollationBodyRequest) String() string { return proto.CompactTextString(m) } -func (*CollationBodyRequest) ProtoMessage() {} -func (*CollationBodyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_7e3c5d5de878ef23, []int{10} -} -func (m *CollationBodyRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CollationBodyRequest.Unmarshal(m, b) -} -func (m *CollationBodyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CollationBodyRequest.Marshal(b, m, deterministic) -} -func (dst *CollationBodyRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CollationBodyRequest.Merge(dst, src) -} -func (m *CollationBodyRequest) XXX_Size() int { - return xxx_messageInfo_CollationBodyRequest.Size(m) -} -func (m *CollationBodyRequest) XXX_DiscardUnknown() { - xxx_messageInfo_CollationBodyRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_CollationBodyRequest proto.InternalMessageInfo - -func (m *CollationBodyRequest) GetShardId() uint64 { - if m != nil { - return m.ShardId - } - return 0 -} - -func (m *CollationBodyRequest) GetPeriod() uint64 { - if m != nil { - return m.Period - } - return 0 -} - -func (m *CollationBodyRequest) GetChunkRoot() []byte { - if m != nil { - return m.ChunkRoot - } - return nil -} - -func (m *CollationBodyRequest) GetProposerAddress() []byte { - if m != nil { - return m.ProposerAddress - } - return nil -} - -func (m *CollationBodyRequest) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - type ValidatorRecord struct { PublicKey uint64 `protobuf:"varint,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` WithdrawalShard uint64 `protobuf:"varint,2,opt,name=withdrawal_shard,json=withdrawalShard,proto3" json:"withdrawal_shard,omitempty"` @@ -723,7 +615,7 @@ func (m *ValidatorRecord) Reset() { *m = ValidatorRecord{} } func (m *ValidatorRecord) String() string { return proto.CompactTextString(m) } func (*ValidatorRecord) ProtoMessage() {} func (*ValidatorRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_7e3c5d5de878ef23, []int{11} + return fileDescriptor_messages_e1d33f8757fc0f25, []int{10} } func (m *ValidatorRecord) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ValidatorRecord.Unmarshal(m, b) @@ -785,294 +677,84 @@ func (m *ValidatorRecord) GetSwitchDynasty() uint64 { return 0 } -type CollationBodyResponse struct { - HeaderHash []byte `protobuf:"bytes,1,opt,name=header_hash,json=headerHash,proto3" json:"header_hash,omitempty"` - Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CollationBodyResponse) Reset() { *m = CollationBodyResponse{} } -func (m *CollationBodyResponse) String() string { return proto.CompactTextString(m) } -func (*CollationBodyResponse) ProtoMessage() {} -func (*CollationBodyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_7e3c5d5de878ef23, []int{12} -} -func (m *CollationBodyResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CollationBodyResponse.Unmarshal(m, b) -} -func (m *CollationBodyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CollationBodyResponse.Marshal(b, m, deterministic) -} -func (dst *CollationBodyResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_CollationBodyResponse.Merge(dst, src) -} -func (m *CollationBodyResponse) XXX_Size() int { - return xxx_messageInfo_CollationBodyResponse.Size(m) -} -func (m *CollationBodyResponse) XXX_DiscardUnknown() { - xxx_messageInfo_CollationBodyResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_CollationBodyResponse proto.InternalMessageInfo - -func (m *CollationBodyResponse) GetHeaderHash() []byte { - if m != nil { - return m.HeaderHash - } - return nil -} - -func (m *CollationBodyResponse) GetBody() []byte { - if m != nil { - return m.Body - } - return nil -} - -type Transaction struct { - Nonce uint64 `protobuf:"varint,1,opt,name=nonce,proto3" json:"nonce,omitempty"` - GasPrice uint64 `protobuf:"varint,2,opt,name=gas_price,json=gasPrice,proto3" json:"gas_price,omitempty"` - GasLimit uint64 `protobuf:"varint,3,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` - Recipient []byte `protobuf:"bytes,4,opt,name=recipient,proto3" json:"recipient,omitempty"` - Value uint64 `protobuf:"varint,5,opt,name=value,proto3" json:"value,omitempty"` - Input []byte `protobuf:"bytes,6,opt,name=input,proto3" json:"input,omitempty"` - Signature *Signature `protobuf:"bytes,7,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Transaction) Reset() { *m = Transaction{} } -func (m *Transaction) String() string { return proto.CompactTextString(m) } -func (*Transaction) ProtoMessage() {} -func (*Transaction) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_7e3c5d5de878ef23, []int{13} -} -func (m *Transaction) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Transaction.Unmarshal(m, b) -} -func (m *Transaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Transaction.Marshal(b, m, deterministic) -} -func (dst *Transaction) XXX_Merge(src proto.Message) { - xxx_messageInfo_Transaction.Merge(dst, src) -} -func (m *Transaction) XXX_Size() int { - return xxx_messageInfo_Transaction.Size(m) -} -func (m *Transaction) XXX_DiscardUnknown() { - xxx_messageInfo_Transaction.DiscardUnknown(m) -} - -var xxx_messageInfo_Transaction proto.InternalMessageInfo - -func (m *Transaction) GetNonce() uint64 { - if m != nil { - return m.Nonce - } - return 0 -} - -func (m *Transaction) GetGasPrice() uint64 { - if m != nil { - return m.GasPrice - } - return 0 -} - -func (m *Transaction) GetGasLimit() uint64 { - if m != nil { - return m.GasLimit - } - return 0 -} - -func (m *Transaction) GetRecipient() []byte { - if m != nil { - return m.Recipient - } - return nil -} - -func (m *Transaction) GetValue() uint64 { - if m != nil { - return m.Value - } - return 0 -} - -func (m *Transaction) GetInput() []byte { - if m != nil { - return m.Input - } - return nil -} - -func (m *Transaction) GetSignature() *Signature { - if m != nil { - return m.Signature - } - return nil -} - -type Signature struct { - V uint64 `protobuf:"varint,1,opt,name=v,proto3" json:"v,omitempty"` - R uint64 `protobuf:"varint,2,opt,name=r,proto3" json:"r,omitempty"` - S uint64 `protobuf:"varint,3,opt,name=s,proto3" json:"s,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Signature) Reset() { *m = Signature{} } -func (m *Signature) String() string { return proto.CompactTextString(m) } -func (*Signature) ProtoMessage() {} -func (*Signature) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_7e3c5d5de878ef23, []int{14} -} -func (m *Signature) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Signature.Unmarshal(m, b) -} -func (m *Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Signature.Marshal(b, m, deterministic) -} -func (dst *Signature) XXX_Merge(src proto.Message) { - xxx_messageInfo_Signature.Merge(dst, src) -} -func (m *Signature) XXX_Size() int { - return xxx_messageInfo_Signature.Size(m) -} -func (m *Signature) XXX_DiscardUnknown() { - xxx_messageInfo_Signature.DiscardUnknown(m) -} - -var xxx_messageInfo_Signature proto.InternalMessageInfo - -func (m *Signature) GetV() uint64 { - if m != nil { - return m.V - } - return 0 -} - -func (m *Signature) GetR() uint64 { - if m != nil { - return m.R - } - return 0 -} - -func (m *Signature) GetS() uint64 { - if m != nil { - return m.S - } - return 0 +func init() { + proto.RegisterType((*BeaconBlockHashAnnounce)(nil), "ethereum.beacon.p2p.v1.BeaconBlockHashAnnounce") + proto.RegisterType((*BeaconBlockRequest)(nil), "ethereum.beacon.p2p.v1.BeaconBlockRequest") + proto.RegisterType((*BeaconBlockResponse)(nil), "ethereum.beacon.p2p.v1.BeaconBlockResponse") + proto.RegisterType((*CrystallizedStateHashAnnounce)(nil), "ethereum.beacon.p2p.v1.CrystallizedStateHashAnnounce") + proto.RegisterType((*CrystallizedStateRequest)(nil), "ethereum.beacon.p2p.v1.CrystallizedStateRequest") + proto.RegisterType((*CrystallizedStateResponse)(nil), "ethereum.beacon.p2p.v1.CrystallizedStateResponse") + proto.RegisterType((*ActiveStateHashAnnounce)(nil), "ethereum.beacon.p2p.v1.ActiveStateHashAnnounce") + proto.RegisterType((*ActiveStateRequest)(nil), "ethereum.beacon.p2p.v1.ActiveStateRequest") + proto.RegisterType((*ActiveStateResponse)(nil), "ethereum.beacon.p2p.v1.ActiveStateResponse") + proto.RegisterType((*AggregateVote)(nil), "ethereum.beacon.p2p.v1.AggregateVote") + proto.RegisterType((*ValidatorRecord)(nil), "ethereum.beacon.p2p.v1.ValidatorRecord") } func init() { - proto.RegisterType((*BeaconBlockHashAnnounce)(nil), "ethereum.messages.v1.BeaconBlockHashAnnounce") - proto.RegisterType((*BeaconBlockRequest)(nil), "ethereum.messages.v1.BeaconBlockRequest") - proto.RegisterType((*BeaconBlockResponse)(nil), "ethereum.messages.v1.BeaconBlockResponse") - proto.RegisterType((*CrystallizedStateHashAnnounce)(nil), "ethereum.messages.v1.CrystallizedStateHashAnnounce") - proto.RegisterType((*CrystallizedStateRequest)(nil), "ethereum.messages.v1.CrystallizedStateRequest") - proto.RegisterType((*CrystallizedStateResponse)(nil), "ethereum.messages.v1.CrystallizedStateResponse") - proto.RegisterType((*ActiveStateHashAnnounce)(nil), "ethereum.messages.v1.ActiveStateHashAnnounce") - proto.RegisterType((*ActiveStateRequest)(nil), "ethereum.messages.v1.ActiveStateRequest") - proto.RegisterType((*ActiveStateResponse)(nil), "ethereum.messages.v1.ActiveStateResponse") - proto.RegisterType((*AggregateVote)(nil), "ethereum.messages.v1.AggregateVote") - proto.RegisterType((*CollationBodyRequest)(nil), "ethereum.messages.v1.CollationBodyRequest") - proto.RegisterType((*ValidatorRecord)(nil), "ethereum.messages.v1.ValidatorRecord") - proto.RegisterType((*CollationBodyResponse)(nil), "ethereum.messages.v1.CollationBodyResponse") - proto.RegisterType((*Transaction)(nil), "ethereum.messages.v1.Transaction") - proto.RegisterType((*Signature)(nil), "ethereum.messages.v1.Signature") - proto.RegisterEnum("ethereum.messages.v1.Topic", Topic_name, Topic_value) + proto.RegisterFile("proto/beacon/p2p/v1/messages.proto", fileDescriptor_messages_e1d33f8757fc0f25) } -func init() { proto.RegisterFile("messages.proto", fileDescriptor_messages_7e3c5d5de878ef23) } - -var fileDescriptor_messages_7e3c5d5de878ef23 = []byte{ - // 1284 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xe1, 0x6e, 0x13, 0x47, - 0x10, 0xee, 0x11, 0x27, 0xc1, 0x13, 0x3b, 0x71, 0x36, 0x09, 0xb9, 0x84, 0x52, 0x52, 0x53, 0x54, - 0x17, 0x84, 0x69, 0x41, 0xa0, 0xaa, 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a9, 0x81, 0x33, 0xcd, 0x4f, - 0xe8, 0x4c, 0xf5, 0xaa, 0xf8, 0xee, 0x72, 0x84, 0x5e, 0xc9, 0xfc, 0x18, 0x8e, 0xbc, 0xf3, 0x97, - 0x03, 0xab, 0x67, 0x3c, 0x65, 0x01, 0xd9, 0x80, 0xf5, 0x97, 0xbd, 0xe7, 0xbd, 0xfe, 0xeb, 0x5e, - 0xe3, 0x33, 0x72, 0x08, 0xd7, 0xba, 0xfd, 0xd3, 0xd3, 0xce, 0xd9, 0xb3, 0x7e, 0xcf, 0x3f, 0xee, - 0x3f, 0xf9, 0xd5, 0xf7, 0x4e, 0x7e, 0x79, 0x79, 0x32, 0x38, 0x6b, 0x38, 0xe4, 0x3a, 0xec, 0x7f, - 0xc0, 0x0d, 0x5e, 0xf4, 0x7b, 0x83, 0x93, 0xc6, 0x15, 0xd2, 0x80, 0xda, 0x99, 0xd7, 0xe9, 0x0d, - 0x3a, 0x5d, 0x4d, 0x0f, 0x1a, 0x2b, 0xe4, 0x0b, 0x38, 0x3c, 0x3e, 0xe9, 0x74, 0xb5, 0xf6, 0xb4, - 0xdf, 0x7d, 0xee, 0x3f, 0xed, 0x0c, 0x9e, 0xfa, 0x9d, 0x5e, 0xaf, 0xff, 0xb2, 0xd7, 0x3d, 0x69, - 0x54, 0x88, 0x0b, 0xbb, 0x4b, 0x7c, 0xb1, 0xd1, 0x2a, 0x39, 0x80, 0xbd, 0x0b, 0x4c, 0xbe, 0xcd, - 0xda, 0x70, 0xcd, 0x7c, 0xa3, 0x3c, 0xfc, 0x2f, 0x00, 0x00, 0xff, 0xff, 0xf1, 0xef, 0x31, 0x67, - 0x36, 0x0b, 0x00, 0x00, +var fileDescriptor_messages_e1d33f8757fc0f25 = []byte{ + // 948 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xdb, 0x6e, 0xdb, 0x46, + 0x10, 0x85, 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ea, 0xf1, 0xdd, 0xf3, + 0x06, 0x15, 0x71, 0x61, 0xf1, 0xc9, 0x1f, 0x2d, 0xe8, 0x37, 0x46, 0x1d, 0x39, 0x83, 0xfb, 0x66, + 0x88, 0xb2, 0x50, 0x7f, 0xa7, 0xef, 0x1d, 0xe8, 0xdf, 0xdf, 0x87, 0x64, 0x0a, 0x03, 0x43, 0x2d, + 0xd5, 0x53, 0x62, 0x66, 0x95, 0x09, 0x3e, 0xd2, 0xf8, 0xf6, 0xed, 0x52, 0x97, 0x25, 0x58, 0x94, + 0x99, 0x15, 0xe8, 0x89, 0x6f, 0x1e, 0x87, 0xbe, 0x41, 0xab, 0x61, 0xff, 0x04, 0xfa, 0xcd, 0x01, + 0xdf, 0xd1, 0x03, 0xbe, 0x47, 0x6b, 0x53, 0x7d, 0xf2, 0x57, 0x0b, 0x8e, 0xff, 0xd1, 0x57, 0xaa, + 0xb6, 0xf2, 0x72, 0x99, 0xb0, 0xc0, 0xbf, 0xc2, 0x8d, 0x3d, 0x8e, 0x43, 0x83, 0xfc, 0x88, 0x1b, + 0xf2, 0x29, 0x0c, 0xae, 0x99, 0x8c, 0xc3, 0x82, 0x5e, 0xd3, 0xc4, 0x16, 0xa0, 0x79, 0xc0, 0x8e, + 0x77, 0xb8, 0x29, 0xc3, 0xe7, 0x40, 0x6a, 0x52, 0x1a, 0x86, 0x05, 0x0a, 0x61, 0x57, 0x7b, 0xb2, + 0x63, 0xe6, 0x86, 0x50, 0x87, 0x6b, 0x1f, 0xbd, 0x80, 0xa7, 0x29, 0x93, 0x29, 0x66, 0xd2, 0xbe, + 0x66, 0x03, 0x43, 0x5c, 0x6e, 0x71, 0xe2, 0xc0, 0xc1, 0x92, 0x26, 0x34, 0x0b, 0xd0, 0x76, 0x6b, + 0xf5, 0x53, 0x9f, 0xcf, 0x35, 0x93, 0x41, 0xbc, 0xed, 0x21, 0xd3, 0xa2, 0x7d, 0x83, 0xda, 0x16, + 0x5a, 0xee, 0xeb, 0x81, 0xfe, 0xf2, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfe, 0x1a, 0x39, 0xcc, + 0x7b, 0x08, 0x00, 0x00, } diff --git a/proto/sharding/v1/messages.proto b/proto/beacon/p2p/v1/messages.proto similarity index 69% rename from proto/sharding/v1/messages.proto rename to proto/beacon/p2p/v1/messages.proto index 85764d2bb..af7f04cc0 100644 --- a/proto/sharding/v1/messages.proto +++ b/proto/beacon/p2p/v1/messages.proto @@ -1,19 +1,9 @@ syntax = "proto3"; -package ethereum.messages.v1; +package ethereum.beacon.p2p.v1; import "google/protobuf/timestamp.proto"; -enum Topic { - UNKNOWN = 0; - COLLATION_BODY_REQUEST = 1; - COLLATION_BODY_RESPONSE = 2; - TRANSACTIONS = 3; - BEACON_BLOCK_HASH_ANNOUNCE = 4; - BEACON_BLOCK_REQUEST = 5; - BEACON_BLOCK_RESPONSE = 6; -} - message BeaconBlockHashAnnounce { bytes hash = 1; } @@ -79,40 +69,11 @@ message AggregateVote { repeated uint32 aggregate_sig = 4; } -message CollationBodyRequest { - uint64 shard_id = 1; - uint64 period = 2; - bytes chunk_root = 3; - bytes proposer_address = 4; - bytes signature = 5; -} - message ValidatorRecord { - uint64 public_key = 1; + uint64 public_key = 1; uint64 withdrawal_shard = 2; bytes withdrawal_address = 3; bytes randao_commitment = 4; uint64 balance = 5; uint64 switch_dynasty = 6; -} - -message CollationBodyResponse { - bytes header_hash = 1; - bytes body = 2; -} - -message Transaction { - uint64 nonce = 1; - uint64 gas_price = 2; - uint64 gas_limit = 3; - bytes recipient = 4; - uint64 value = 5; - bytes input = 6; - Signature signature = 7; -} - -message Signature { - uint64 v = 1; - uint64 r = 2; - uint64 s = 3; -} +} \ No newline at end of file diff --git a/proto/sharding/v1/BUILD.bazel b/proto/sharding/p2p/v1/BUILD.bazel similarity index 69% rename from proto/sharding/v1/BUILD.bazel rename to proto/sharding/p2p/v1/BUILD.bazel index 0e93c1911..70c0bcfd2 100644 --- a/proto/sharding/v1/BUILD.bazel +++ b/proto/sharding/p2p/v1/BUILD.bazel @@ -1,23 +1,22 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") +proto_library( + name = "ethereum_sharding_p2p_v1_proto", + srcs = ["messages.proto"], + visibility = ["//visibility:public"], +) + go_proto_library( - name = "messages_go_proto", - importpath = "github.com/prysmaticlabs/prysm/proto/sharding/v1", - proto = ":ethereum_messages_v1_proto", + name = "ethereum_sharding_p2p_v1_go_proto", + importpath = "github.com/prysmaticlabs/prysm/proto/sharding/p2p/v1", + proto = ":ethereum_sharding_p2p_v1_proto", visibility = ["//visibility:public"], ) go_library( name = "go_default_library", - embed = [":messages_go_proto"], - importpath = "github.com/prysmaticlabs/prysm/proto/sharding/v1", + embed = [":ethereum_sharding_p2p_v1_go_proto"], + importpath = "github.com/prysmaticlabs/prysm/proto/sharding/p2p/v1", visibility = ["//visibility:public"], ) - -proto_library( - name = "ethereum_messages_v1_proto", - srcs = ["messages.proto"], - visibility = ["//visibility:public"], - deps = ["@com_google_protobuf//:timestamp_proto"], -) diff --git a/proto/sharding/p2p/v1/messages.pb.go b/proto/sharding/p2p/v1/messages.pb.go new file mode 100644 index 000000000..687666d3b --- /dev/null +++ b/proto/sharding/p2p/v1/messages.pb.go @@ -0,0 +1,361 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: proto/sharding/p2p/v1/messages.proto + +package ethereum_sharding_p2p_v1 + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// 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.ProtoPackageIsVersion2 // please upgrade the proto package + +type Topic int32 + +const ( + Topic_UNKNOWN Topic = 0 + Topic_COLLATION_BODY_REQUEST Topic = 1 + Topic_COLLATION_BODY_RESPONSE Topic = 2 + Topic_TRANSACTIONS Topic = 3 + Topic_BEACON_BLOCK_HASH_ANNOUNCE Topic = 4 + Topic_BEACON_BLOCK_REQUEST Topic = 5 + Topic_BEACON_BLOCK_RESPONSE Topic = 6 +) + +var Topic_name = map[int32]string{ + 0: "UNKNOWN", + 1: "COLLATION_BODY_REQUEST", + 2: "COLLATION_BODY_RESPONSE", + 3: "TRANSACTIONS", + 4: "BEACON_BLOCK_HASH_ANNOUNCE", + 5: "BEACON_BLOCK_REQUEST", + 6: "BEACON_BLOCK_RESPONSE", +} +var Topic_value = map[string]int32{ + "UNKNOWN": 0, + "COLLATION_BODY_REQUEST": 1, + "COLLATION_BODY_RESPONSE": 2, + "TRANSACTIONS": 3, + "BEACON_BLOCK_HASH_ANNOUNCE": 4, + "BEACON_BLOCK_REQUEST": 5, + "BEACON_BLOCK_RESPONSE": 6, +} + +func (x Topic) String() string { + return proto.EnumName(Topic_name, int32(x)) +} +func (Topic) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_messages_a2b5338ab8a3879b, []int{0} +} + +type CollationBodyRequest struct { + ShardId uint64 `protobuf:"varint,1,opt,name=shard_id,json=shardId,proto3" json:"shard_id,omitempty"` + Period uint64 `protobuf:"varint,2,opt,name=period,proto3" json:"period,omitempty"` + ChunkRoot []byte `protobuf:"bytes,3,opt,name=chunk_root,json=chunkRoot,proto3" json:"chunk_root,omitempty"` + ProposerAddress []byte `protobuf:"bytes,4,opt,name=proposer_address,json=proposerAddress,proto3" json:"proposer_address,omitempty"` + Signature []byte `protobuf:"bytes,5,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CollationBodyRequest) Reset() { *m = CollationBodyRequest{} } +func (m *CollationBodyRequest) String() string { return proto.CompactTextString(m) } +func (*CollationBodyRequest) ProtoMessage() {} +func (*CollationBodyRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_messages_a2b5338ab8a3879b, []int{0} +} +func (m *CollationBodyRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CollationBodyRequest.Unmarshal(m, b) +} +func (m *CollationBodyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CollationBodyRequest.Marshal(b, m, deterministic) +} +func (dst *CollationBodyRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CollationBodyRequest.Merge(dst, src) +} +func (m *CollationBodyRequest) XXX_Size() int { + return xxx_messageInfo_CollationBodyRequest.Size(m) +} +func (m *CollationBodyRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CollationBodyRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CollationBodyRequest proto.InternalMessageInfo + +func (m *CollationBodyRequest) GetShardId() uint64 { + if m != nil { + return m.ShardId + } + return 0 +} + +func (m *CollationBodyRequest) GetPeriod() uint64 { + if m != nil { + return m.Period + } + return 0 +} + +func (m *CollationBodyRequest) GetChunkRoot() []byte { + if m != nil { + return m.ChunkRoot + } + return nil +} + +func (m *CollationBodyRequest) GetProposerAddress() []byte { + if m != nil { + return m.ProposerAddress + } + return nil +} + +func (m *CollationBodyRequest) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +type CollationBodyResponse struct { + HeaderHash []byte `protobuf:"bytes,1,opt,name=header_hash,json=headerHash,proto3" json:"header_hash,omitempty"` + Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CollationBodyResponse) Reset() { *m = CollationBodyResponse{} } +func (m *CollationBodyResponse) String() string { return proto.CompactTextString(m) } +func (*CollationBodyResponse) ProtoMessage() {} +func (*CollationBodyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_messages_a2b5338ab8a3879b, []int{1} +} +func (m *CollationBodyResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CollationBodyResponse.Unmarshal(m, b) +} +func (m *CollationBodyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CollationBodyResponse.Marshal(b, m, deterministic) +} +func (dst *CollationBodyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CollationBodyResponse.Merge(dst, src) +} +func (m *CollationBodyResponse) XXX_Size() int { + return xxx_messageInfo_CollationBodyResponse.Size(m) +} +func (m *CollationBodyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CollationBodyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_CollationBodyResponse proto.InternalMessageInfo + +func (m *CollationBodyResponse) GetHeaderHash() []byte { + if m != nil { + return m.HeaderHash + } + return nil +} + +func (m *CollationBodyResponse) GetBody() []byte { + if m != nil { + return m.Body + } + return nil +} + +type Transaction struct { + Nonce uint64 `protobuf:"varint,1,opt,name=nonce,proto3" json:"nonce,omitempty"` + GasPrice uint64 `protobuf:"varint,2,opt,name=gas_price,json=gasPrice,proto3" json:"gas_price,omitempty"` + GasLimit uint64 `protobuf:"varint,3,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` + Recipient []byte `protobuf:"bytes,4,opt,name=recipient,proto3" json:"recipient,omitempty"` + Value uint64 `protobuf:"varint,5,opt,name=value,proto3" json:"value,omitempty"` + Input []byte `protobuf:"bytes,6,opt,name=input,proto3" json:"input,omitempty"` + Signature *Signature `protobuf:"bytes,7,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Transaction) Reset() { *m = Transaction{} } +func (m *Transaction) String() string { return proto.CompactTextString(m) } +func (*Transaction) ProtoMessage() {} +func (*Transaction) Descriptor() ([]byte, []int) { + return fileDescriptor_messages_a2b5338ab8a3879b, []int{2} +} +func (m *Transaction) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Transaction.Unmarshal(m, b) +} +func (m *Transaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Transaction.Marshal(b, m, deterministic) +} +func (dst *Transaction) XXX_Merge(src proto.Message) { + xxx_messageInfo_Transaction.Merge(dst, src) +} +func (m *Transaction) XXX_Size() int { + return xxx_messageInfo_Transaction.Size(m) +} +func (m *Transaction) XXX_DiscardUnknown() { + xxx_messageInfo_Transaction.DiscardUnknown(m) +} + +var xxx_messageInfo_Transaction proto.InternalMessageInfo + +func (m *Transaction) GetNonce() uint64 { + if m != nil { + return m.Nonce + } + return 0 +} + +func (m *Transaction) GetGasPrice() uint64 { + if m != nil { + return m.GasPrice + } + return 0 +} + +func (m *Transaction) GetGasLimit() uint64 { + if m != nil { + return m.GasLimit + } + return 0 +} + +func (m *Transaction) GetRecipient() []byte { + if m != nil { + return m.Recipient + } + return nil +} + +func (m *Transaction) GetValue() uint64 { + if m != nil { + return m.Value + } + return 0 +} + +func (m *Transaction) GetInput() []byte { + if m != nil { + return m.Input + } + return nil +} + +func (m *Transaction) GetSignature() *Signature { + if m != nil { + return m.Signature + } + return nil +} + +type Signature struct { + V uint64 `protobuf:"varint,1,opt,name=v,proto3" json:"v,omitempty"` + R uint64 `protobuf:"varint,2,opt,name=r,proto3" json:"r,omitempty"` + S uint64 `protobuf:"varint,3,opt,name=s,proto3" json:"s,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Signature) Reset() { *m = Signature{} } +func (m *Signature) String() string { return proto.CompactTextString(m) } +func (*Signature) ProtoMessage() {} +func (*Signature) Descriptor() ([]byte, []int) { + return fileDescriptor_messages_a2b5338ab8a3879b, []int{3} +} +func (m *Signature) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Signature.Unmarshal(m, b) +} +func (m *Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Signature.Marshal(b, m, deterministic) +} +func (dst *Signature) XXX_Merge(src proto.Message) { + xxx_messageInfo_Signature.Merge(dst, src) +} +func (m *Signature) XXX_Size() int { + return xxx_messageInfo_Signature.Size(m) +} +func (m *Signature) XXX_DiscardUnknown() { + xxx_messageInfo_Signature.DiscardUnknown(m) +} + +var xxx_messageInfo_Signature proto.InternalMessageInfo + +func (m *Signature) GetV() uint64 { + if m != nil { + return m.V + } + return 0 +} + +func (m *Signature) GetR() uint64 { + if m != nil { + return m.R + } + return 0 +} + +func (m *Signature) GetS() uint64 { + if m != nil { + return m.S + } + return 0 +} + +func init() { + proto.RegisterType((*CollationBodyRequest)(nil), "ethereum.sharding.p2p.v1.CollationBodyRequest") + proto.RegisterType((*CollationBodyResponse)(nil), "ethereum.sharding.p2p.v1.CollationBodyResponse") + proto.RegisterType((*Transaction)(nil), "ethereum.sharding.p2p.v1.Transaction") + proto.RegisterType((*Signature)(nil), "ethereum.sharding.p2p.v1.Signature") + proto.RegisterEnum("ethereum.sharding.p2p.v1.Topic", Topic_name, Topic_value) +} + +func init() { + proto.RegisterFile("proto/sharding/p2p/v1/messages.proto", fileDescriptor_messages_a2b5338ab8a3879b) +} + +var fileDescriptor_messages_a2b5338ab8a3879b = []byte{ + // 503 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xdd, 0x6a, 0xdb, 0x3c, + 0x18, 0xc7, 0x5f, 0xb5, 0xf9, 0x68, 0x9e, 0x04, 0x5e, 0x23, 0xd2, 0xce, 0x6d, 0xf7, 0x11, 0xb2, + 0x1d, 0x64, 0x3b, 0x70, 0x68, 0xc6, 0x2e, 0xc0, 0xf1, 0x02, 0x29, 0x0d, 0x76, 0x67, 0x27, 0x8c, + 0x1d, 0x19, 0xd5, 0x16, 0xb1, 0x58, 0x62, 0x69, 0x92, 0x1d, 0xe8, 0x65, 0x0d, 0x76, 0x55, 0xbb, + 0x8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, 0x1d, + 0x61, 0x0b, 0x06, 0xeb, 0xd0, 0xf5, 0x23, 0xd7, 0xd3, 0x71, 0x64, 0x1d, 0xe3, 0x97, 0x70, 0x31, + 0x5f, 0xb8, 0x9e, 0xee, 0xae, 0x02, 0xef, 0x26, 0x5e, 0xba, 0xd1, 0x32, 0x76, 0x7d, 0x3f, 0xd8, + 0xf8, 0xde, 0xc2, 0x6a, 0x61, 0x1b, 0x86, 0x7f, 0xe4, 0xcd, 0xa0, 0x36, 0x3e, 0x87, 0xd3, 0x27, + 0x49, 0x3d, 0xa6, 0x73, 0xd7, 0x31, 0xaf, 0xff, 0xfd, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x01, + 0x09, 0x20, 0xaf, 0x25, 0x03, 0x00, 0x00, +} diff --git a/proto/sharding/p2p/v1/messages.proto b/proto/sharding/p2p/v1/messages.proto new file mode 100644 index 000000000..0103dc4af --- /dev/null +++ b/proto/sharding/p2p/v1/messages.proto @@ -0,0 +1,42 @@ +syntax = "proto3"; + +package ethereum.sharding.p2p.v1; + +enum Topic { + UNKNOWN = 0; + COLLATION_BODY_REQUEST = 1; + COLLATION_BODY_RESPONSE = 2; + TRANSACTIONS = 3; + BEACON_BLOCK_HASH_ANNOUNCE = 4; + BEACON_BLOCK_REQUEST = 5; + BEACON_BLOCK_RESPONSE = 6; +} + +message CollationBodyRequest { + uint64 shard_id = 1; + uint64 period = 2; + bytes chunk_root = 3; + bytes proposer_address = 4; + bytes signature = 5; +} + +message CollationBodyResponse { + bytes header_hash = 1; + bytes body = 2; +} + +message Transaction { + uint64 nonce = 1; + uint64 gas_price = 2; + uint64 gas_limit = 3; + bytes recipient = 4; + uint64 value = 5; + bytes input = 6; + Signature signature = 7; +} + +message Signature { + uint64 v = 1; + uint64 r = 2; + uint64 s = 3; +} diff --git a/shared/legacyutil/BUILD.bazel b/shared/legacyutil/BUILD.bazel index 4db551024..52c5d6aa5 100644 --- a/shared/legacyutil/BUILD.bazel +++ b/shared/legacyutil/BUILD.bazel @@ -6,7 +6,7 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/shared/legacyutil", visibility = ["//visibility:public"], deps = [ - "//proto/sharding/v1:go_default_library", + "//proto/sharding/p2p/v1:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_ethereum_go_ethereum//core/types:go_default_library", ], diff --git a/shared/legacyutil/convert_transaction.go b/shared/legacyutil/convert_transaction.go index 4e9fb5c6b..ae1e51b5b 100644 --- a/shared/legacyutil/convert_transaction.go +++ b/shared/legacyutil/convert_transaction.go @@ -7,7 +7,7 @@ import ( "github.com/ethereum/go-ethereum/common" gethTypes "github.com/ethereum/go-ethereum/core/types" - pb "github.com/prysmaticlabs/prysm/proto/sharding/v1" + pb "github.com/prysmaticlabs/prysm/proto/sharding/p2p/v1" ) // TransformTransaction of proto transaction to geth's transction. diff --git a/shared/p2p/BUILD.bazel b/shared/p2p/BUILD.bazel index 0117fd588..de87fb0e7 100644 --- a/shared/p2p/BUILD.bazel +++ b/shared/p2p/BUILD.bazel @@ -14,7 +14,8 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/shared/p2p", visibility = ["//visibility:public"], deps = [ - "//proto/sharding/v1:go_default_library", + "//proto/beacon/p2p/v1:go_default_library", + "//proto/sharding/p2p/v1:go_default_library", "@com_github_ethereum_go_ethereum//event:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", "@com_github_libp2p_go_floodsub//:go_default_library", @@ -41,7 +42,7 @@ go_test( ], embed = [":go_default_library"], deps = [ - "//proto/sharding/v1:go_default_library", + "//proto/sharding/p2p/v1:go_default_library", "//shared:go_default_library", "@com_github_ethereum_go_ethereum//event:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", diff --git a/shared/p2p/discovery.go b/shared/p2p/discovery.go index 4ce0097c9..d7a85ed5e 100644 --- a/shared/p2p/discovery.go +++ b/shared/p2p/discovery.go @@ -8,7 +8,7 @@ import ( peer "github.com/libp2p/go-libp2p-peer" ps "github.com/libp2p/go-libp2p-peerstore" mdns "github.com/libp2p/go-libp2p/p2p/discovery" - pb "github.com/prysmaticlabs/prysm/proto/sharding/v1" + shardpb "github.com/prysmaticlabs/prysm/proto/sharding/p2p/v1" "github.com/sirupsen/logrus" ) @@ -68,8 +68,8 @@ func (d *discovery) HandlePeerFound(pi ps.PeerInfo) { // topicPeerMap helper function for inspecting which peers are available for // the p2p topics. -func (d *discovery) topicPeerMap() map[pb.Topic][]peer.ID { - m := make(map[pb.Topic][]peer.ID) +func (d *discovery) topicPeerMap() map[shardpb.Topic][]peer.ID { + m := make(map[shardpb.Topic][]peer.ID) for topic := range topicTypeMapping { peers := d.gsub.ListPeers(topic.String()) m[topic] = peers diff --git a/shared/p2p/service.go b/shared/p2p/service.go index f1b7a224b..21155e511 100644 --- a/shared/p2p/service.go +++ b/shared/p2p/service.go @@ -21,7 +21,7 @@ import ( floodsub "github.com/libp2p/go-floodsub" libp2p "github.com/libp2p/go-libp2p" host "github.com/libp2p/go-libp2p-host" - pb "github.com/prysmaticlabs/prysm/proto/sharding/v1" + shardpb "github.com/prysmaticlabs/prysm/proto/sharding/p2p/v1" ) // Sender represents a struct that is able to relay information via p2p. @@ -117,7 +117,7 @@ func (s *Server) Broadcast(msg interface{}) { "topic": topic, }).Debugf("Broadcasting msg %T", msg) - if topic == pb.Topic_UNKNOWN { + if topic == shardpb.Topic_UNKNOWN { log.Warnf("Topic is unknown for message type %T. %v", msg, msg) } @@ -138,7 +138,7 @@ func (s *Server) Broadcast(msg interface{}) { } } -func (s *Server) subscribeToTopic(topic pb.Topic, msgType reflect.Type) { +func (s *Server) subscribeToTopic(topic shardpb.Topic, msgType reflect.Type) { sub, err := s.gsub.Subscribe(topic.String()) if err != nil { log.Errorf("Failed to subscribe to topic: %v", err) diff --git a/shared/p2p/service_test.go b/shared/p2p/service_test.go index 33df573fc..0c0ce5682 100644 --- a/shared/p2p/service_test.go +++ b/shared/p2p/service_test.go @@ -15,7 +15,7 @@ import ( floodsub "github.com/libp2p/go-floodsub" swarmt "github.com/libp2p/go-libp2p-swarm/testing" bhost "github.com/libp2p/go-libp2p/p2p/host/basic" - pb "github.com/prysmaticlabs/prysm/proto/sharding/v1" + shardpb "github.com/prysmaticlabs/prysm/proto/sharding/p2p/v1" "github.com/sirupsen/logrus" logTest "github.com/sirupsen/logrus/hooks/test" ) @@ -62,7 +62,7 @@ func TestBroadcast(t *testing.T) { t.Fatalf("Could not start a new server: %v", err) } - msg := &pb.CollationBodyRequest{} + msg := &shardpb.CollationBodyRequest{} s.Broadcast(msg) // TODO: test that topic was published @@ -86,7 +86,7 @@ func TestSubscribeToTopic(t *testing.T) { mutex: &sync.Mutex{}, } - feed := s.Feed(pb.CollationBodyRequest{}) + feed := s.Feed(shardpb.CollationBodyRequest{}) ch := make(chan Message) sub := feed.Subscribe(ch) defer sub.Unsubscribe() @@ -113,14 +113,14 @@ func TestSubscribe(t *testing.T) { } ch := make(chan Message) - sub := s.Subscribe(pb.CollationBodyRequest{}, ch) + sub := s.Subscribe(shardpb.CollationBodyRequest{}, ch) defer sub.Unsubscribe() testSubscribe(ctx, t, s, gsub, ch) } func testSubscribe(ctx context.Context, t *testing.T, s Server, gsub *floodsub.PubSub, ch chan Message) { - topic := pb.Topic_COLLATION_BODY_REQUEST + topic := shardpb.Topic_COLLATION_BODY_REQUEST msgType := topicTypeMapping[topic] go s.subscribeToTopic(topic, msgType) @@ -133,7 +133,7 @@ func testSubscribe(ctx context.Context, t *testing.T, s Server, gsub *floodsub.P t.Errorf("Unexpected subscribed topics: %v. Wanted %s", topics, topic) } - pbMsg := &pb.CollationBodyRequest{ShardId: 5} + pbMsg := &shardpb.CollationBodyRequest{ShardId: 5} done := make(chan bool) go func() { diff --git a/shared/p2p/topics.go b/shared/p2p/topics.go index 3297bb46f..3a38dd198 100644 --- a/shared/p2p/topics.go +++ b/shared/p2p/topics.go @@ -3,35 +3,36 @@ package p2p import ( "reflect" - pb "github.com/prysmaticlabs/prysm/proto/sharding/v1" + beaconpb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" + shardpb "github.com/prysmaticlabs/prysm/proto/sharding/p2p/v1" ) // Mapping of message topic enums to protobuf types. -var topicTypeMapping = map[pb.Topic]reflect.Type{ - pb.Topic_BEACON_BLOCK_HASH_ANNOUNCE: reflect.TypeOf(pb.BeaconBlockHashAnnounce{}), - pb.Topic_BEACON_BLOCK_REQUEST: reflect.TypeOf(pb.BeaconBlockRequest{}), - pb.Topic_BEACON_BLOCK_RESPONSE: reflect.TypeOf(pb.BeaconBlockResponse{}), - pb.Topic_COLLATION_BODY_REQUEST: reflect.TypeOf(pb.CollationBodyRequest{}), - pb.Topic_COLLATION_BODY_RESPONSE: reflect.TypeOf(pb.CollationBodyResponse{}), - pb.Topic_TRANSACTIONS: reflect.TypeOf(pb.Transaction{}), +var topicTypeMapping = map[shardpb.Topic]reflect.Type{ + shardpb.Topic_COLLATION_BODY_REQUEST: reflect.TypeOf(shardpb.CollationBodyRequest{}), + shardpb.Topic_COLLATION_BODY_RESPONSE: reflect.TypeOf(shardpb.CollationBodyResponse{}), + shardpb.Topic_TRANSACTIONS: reflect.TypeOf(shardpb.Transaction{}), + shardpb.Topic_BEACON_BLOCK_HASH_ANNOUNCE: reflect.TypeOf(beaconpb.BeaconBlockHashAnnounce{}), + shardpb.Topic_BEACON_BLOCK_REQUEST: reflect.TypeOf(beaconpb.BeaconBlockRequest{}), + shardpb.Topic_BEACON_BLOCK_RESPONSE: reflect.TypeOf(beaconpb.BeaconBlockResponse{}), } // Mapping of message types to topic enums. var typeTopicMapping = reverseMapping(topicTypeMapping) // ReverseMapping from K,V to V,K -func reverseMapping(m map[pb.Topic]reflect.Type) map[reflect.Type]pb.Topic { - n := make(map[reflect.Type]pb.Topic) +func reverseMapping(m map[shardpb.Topic]reflect.Type) map[reflect.Type]shardpb.Topic { + n := make(map[reflect.Type]shardpb.Topic) for k, v := range m { n[v] = k } return n } -// Topic returns the given topic for a given interface. This is the preferred +// These functions return the given topic for a given interface. This is the preferred // way to resolve a topic from an value. The msg could be a pointer or value // argument to resolve to the correct topic. -func topic(msg interface{}) pb.Topic { +func topic(msg interface{}) shardpb.Topic { msgType := reflect.TypeOf(msg) if msgType.Kind() == reflect.Ptr { msgType = reflect.Indirect(reflect.ValueOf(msg)).Type() diff --git a/shared/p2p/topics_test.go b/shared/p2p/topics_test.go index 38e43ebe5..ca2962d50 100644 --- a/shared/p2p/topics_test.go +++ b/shared/p2p/topics_test.go @@ -4,22 +4,22 @@ import ( "reflect" "testing" - pb "github.com/prysmaticlabs/prysm/proto/sharding/v1" + shardpb "github.com/prysmaticlabs/prysm/proto/sharding/p2p/v1" ) type testStruct struct{} func TestReverseMapping(t *testing.T) { tests := []struct { - input map[pb.Topic]reflect.Type - want map[reflect.Type]pb.Topic + input map[shardpb.Topic]reflect.Type + want map[reflect.Type]shardpb.Topic }{ { - input: map[pb.Topic]reflect.Type{ - pb.Topic_UNKNOWN: reflect.TypeOf(testStruct{}), + input: map[shardpb.Topic]reflect.Type{ + shardpb.Topic_UNKNOWN: reflect.TypeOf(testStruct{}), }, - want: map[reflect.Type]pb.Topic{ - reflect.TypeOf(testStruct{}): pb.Topic_UNKNOWN, + want: map[reflect.Type]shardpb.Topic{ + reflect.TypeOf(testStruct{}): shardpb.Topic_UNKNOWN, }, }, } @@ -37,19 +37,19 @@ func TestTopic(t *testing.T) { tests := []struct { input interface{} - want pb.Topic + want shardpb.Topic }{ { - input: pb.CollationBodyRequest{}, - want: pb.Topic_COLLATION_BODY_REQUEST, + input: shardpb.CollationBodyRequest{}, + want: shardpb.Topic_COLLATION_BODY_REQUEST, }, { - input: &pb.CollationBodyRequest{}, - want: pb.Topic_COLLATION_BODY_REQUEST, + input: &shardpb.CollationBodyRequest{}, + want: shardpb.Topic_COLLATION_BODY_REQUEST, }, { input: CustomStruct{}, - want: pb.Topic_UNKNOWN, + want: shardpb.Topic_UNKNOWN, }, }