Remove Topic related message types

This commit is contained in:
kdeme 2023-04-20 12:52:18 +02:00
parent ce4cde6557
commit a3c008b80f
No known key found for this signature in database
GPG Key ID: 4E8DD21420AF43F5
4 changed files with 0 additions and 31 deletions

View File

@ -31,10 +31,6 @@ type
nodes = 0x04
talkReq = 0x05
talkResp = 0x06
regTopic = 0x07
ticket = 0x08
regConfirmation = 0x09
topicQuery = 0x0A
RequestId* = object
id*: seq[byte]
@ -61,12 +57,6 @@ type
TalkRespMessage* = object
response*: seq[byte]
# Not implemented, specification is not final here.
RegTopicMessage* = object
TicketMessage* = object
RegConfirmationMessage* = object
TopicQueryMessage* = object
SomeMessage* = PingMessage or PongMessage or FindNodeMessage or NodesMessage or
TalkReqMessage or TalkRespMessage
@ -85,14 +75,6 @@ type
talkReq*: TalkReqMessage
of talkResp:
talkResp*: TalkRespMessage
of regTopic:
regtopic*: RegTopicMessage
of ticket:
ticket*: TicketMessage
of regConfirmation:
regConfirmation*: RegConfirmationMessage
of topicQuery:
topicQuery*: TopicQueryMessage
else:
discard

View File

@ -106,12 +106,6 @@ func decodeMessage*(body: openArray[byte]): Result[Message, cstring] =
of nodes: rlp.decode(message.nodes)
of talkReq: rlp.decode(message.talkReq)
of talkResp: rlp.decode(message.talkResp)
of regTopic, ticket, regConfirmation, topicQuery:
# We just pass the empty type of this message without attempting to
# decode, so that the protocol knows what was received.
# But we ignore the message as per specification as "the content and
# semantics of this message are not final".
discard
except RlpError, ValueError:
return err("Invalid message encoding")

View File

@ -368,11 +368,6 @@ proc handleMessage(d: Protocol, srcId: NodeId, fromAddr: Address,
of talkReq:
discovery_message_requests_incoming.inc()
d.handleTalkReq(srcId, fromAddr, message.talkReq, message.reqId)
of regTopic, topicQuery:
discovery_message_requests_incoming.inc()
discovery_message_requests_incoming.inc(labelValues = ["no_response"])
trace "Received unimplemented message kind", kind = message.kind,
origin = fromAddr
else:
var waiter: Future[Option[Message]]
if d.awaitedMessages.take((srcId, message.reqId), waiter):

View File

@ -17,8 +17,6 @@ test:
of nodes: encoded = encodeMessage(message.nodes, message.reqId)
of talkReq: encoded = encodeMessage(message.talkReq, message.reqId)
of talkResp: encoded = encodeMessage(message.talkResp, message.reqId)
of regTopic, ticket, regConfirmation, topicQuery:
break
# This will hit assert because of issue:
# https://github.com/status-im/nim-eth/issues/255