Skip to content

Commit 76d50e1

Browse files
authored
chore(protobuf): cosmetics (#2682)
1 parent 4b7e7a2 commit 76d50e1

13 files changed

Lines changed: 33 additions & 197 deletions

File tree

libp2p/extended_peer_record.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type
3232
addresses* {.fieldNumber: 3.}: seq[AddressInfo]
3333
services* {.fieldNumber: 4.}: seq[ServiceInfo]
3434

35-
Protobuf.serializerFor([ServiceInfo, ExtendedPeerRecord])
35+
Protobuf.serializerFor([ExtendedPeerRecord])
3636

3737
proc init*(
3838
T: typedesc[ExtendedPeerRecord],

libp2p/protocols/connectivity/autonat/types.nim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,4 @@ type
6060
proc isReachable*(self: NetworkReachability): bool =
6161
self == NetworkReachability.Reachable
6262

63-
Protobuf.serializerFor([AutonatPeerInfo, AutonatDial, AutonatDialResponse])
6463
Protobuf.serializerFor([AutonatMsg], withMetrics = true, domain = "autonat-v1")

libp2p/protocols/connectivity/autonatv2/types.nim

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,7 @@ type
102102
AutonatV2Msg* {.proto3.} = object
103103
oneof* {.oneof.}: AutonatV2MsgOneof
104104

105-
Protobuf.serializerFor(
106-
[
107-
DialRequest, DialResponse, DialBack, DialBackResponse, DialDataRequest,
108-
DialDataResponse,
109-
]
110-
)
105+
Protobuf.serializerFor([DialBack, DialBackResponse])
111106
Protobuf.serializerFor([AutonatV2Msg], withMetrics = true, domain = "autonat-v2")
112107

113108
# Custom `==` is needed to ensure consistent comparison with Opt-based fields

libp2p/protocols/connectivity/relay/messages.nim

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ type
4949
dstPeer* {.fieldNumber: 3.}: Opt[RelayPeer]
5050
status* {.fieldNumber: 4, ext.}: Opt[StatusV1]
5151

52-
Protobuf.serializerFor([RelayPeer])
5352
Protobuf.serializerFor([RelayMessage], withMetrics = true, domain = "relay-v1")
5453

5554
# Circuit Relay V2 Messages
@@ -106,7 +105,7 @@ type
106105
limit* {.fieldNumber: 3.}: Opt[Limit]
107106
status* {.fieldNumber: 4, ext.}: Opt[StatusV2]
108107

109-
Protobuf.serializerFor([Peer, Reservation, Limit, Voucher])
108+
Protobuf.serializerFor([Voucher])
110109
Protobuf.serializerFor(
111110
[StopMessage, HopMessage], withMetrics = true, domain = "relay-v2"
112111
)

libp2p/protocols/identify.nim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ type
7575
IdentifyPush* = ref object of LPProtocol
7676
identifyHandler: IdentifyPushHandler
7777

78-
Protobuf.serializerFor([Delta])
7978
Protobuf.serializerFor([IdentifyMsg], withMetrics = true, domain = "identify")
8079

8180
chronicles.expandIt(IdentifyMsg):

libp2p/protocols/kademlia/protobuf.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ proc hash*(peer: Peer): Hash =
100100
proc `==`*(a, b: Peer): bool =
101101
a.id == b.id
102102

103-
Protobuf.serializerFor([Record, Ticket, RegisterMessage, GetAdsMessage])
103+
Protobuf.serializerFor([Record])
104104

105105
# Peer and Message have custom encode because of additional hideConnectionStatus parameter
106106
Protobuf.decodeFor([Peer])

libp2p/protocols/pubsub/rpc/protobuf.nim

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@ import ../../../utils/[protobuf]
88
import ../../../[peerid]
99
import messages
1010

11-
Protobuf.serializerFor(
12-
[
13-
PeerInfoMsg, SubOpts, ControlGraft, ControlIHave, ControlIWant, ControlPrune,
14-
ControlExtensions, ControlMessage, Preamble, IMReceiving, TestExtensionRPC,
15-
PartialMessageExtensionRPC, PingPongExtensionRPC, PreambleExtensionRPC,
16-
]
17-
)
18-
1911
proc encode*(msg: Message, anonymize: bool): seq[byte] =
2012
encode(Protobuf, msg.anonymize(anonymize))
2113

libp2p/protocols/rendezvous/protobuf.nim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,4 @@ type
7171
Protobuf.serializerFor(
7272
[Cookie, Register, RegisterResponse, Unregister, Discover, DiscoverResponse]
7373
)
74-
7574
Protobuf.serializerFor([Message], withMetrics = true, domain = "rendezvous")

libp2p/routing_record.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type
2222
seqNo* {.fieldNumber: 2, required, pint.}: uint64
2323
addresses* {.fieldNumber: 3.}: seq[AddressInfo]
2424

25-
Protobuf.serializerFor([AddressInfo, PeerRecord])
25+
Protobuf.serializerFor([PeerRecord])
2626

2727
proc init*(
2828
T: typedesc[PeerRecord],

tests/libp2p/discovery/test_rendezvous_protobuf.nim

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)