diff --git a/libp2p/pubsub/gossipsub.py b/libp2p/pubsub/gossipsub.py index cebc438b..c345c138 100644 --- a/libp2p/pubsub/gossipsub.py +++ b/libp2p/pubsub/gossipsub.py @@ -775,16 +775,16 @@ class GossipSub(IPubsubRouter, Service): # Get list of all seen (seqnos, from) from the (seqno, from) tuples in # seen_messages cache seen_seqnos_and_peers = [ - seqno_and_from for seqno_and_from in self.pubsub.seen_messages.cache.keys() + str(seqno_and_from) + for seqno_and_from in self.pubsub.seen_messages.cache.keys() ] # Add all unknown message ids (ids that appear in ihave_msg but not in # seen_seqnos) to list of messages we want to request - # FIXME: Update type of message ID - msg_ids_wanted: list[Any] = [ + msg_ids_wanted: list[str] = [ msg_id for msg_id in ihave_msg.messageIDs - if literal_eval(msg_id) not in seen_seqnos_and_peers + if msg_id not in seen_seqnos_and_peers ] # Request messages with IWANT message diff --git a/newsfragments/859.feature.rst b/newsfragments/859.feature.rst new file mode 100644 index 00000000..7307c82f --- /dev/null +++ b/newsfragments/859.feature.rst @@ -0,0 +1 @@ +Fix type for gossipsub_message_id for consistency and security