5555
5656@pytest .mark .trio
5757async def test_subscribe_and_unsubscribe ():
58- async with PubsubFactory .create_batch_with_floodsub (1 ) as pubsubs_fsub :
58+ async with PubsubFactory .create_batch_with_gossipsub (1 ) as pubsubs_fsub :
5959 await pubsubs_fsub [0 ].subscribe (TESTING_TOPIC )
6060 assert TESTING_TOPIC in pubsubs_fsub [0 ].topic_ids
6161
@@ -65,7 +65,7 @@ async def test_subscribe_and_unsubscribe():
6565
6666@pytest .mark .trio
6767async def test_re_subscribe ():
68- async with PubsubFactory .create_batch_with_floodsub (1 ) as pubsubs_fsub :
68+ async with PubsubFactory .create_batch_with_gossipsub (1 ) as pubsubs_fsub :
6969 await pubsubs_fsub [0 ].subscribe (TESTING_TOPIC )
7070 assert TESTING_TOPIC in pubsubs_fsub [0 ].topic_ids
7171
@@ -75,7 +75,7 @@ async def test_re_subscribe():
7575
7676@pytest .mark .trio
7777async def test_re_unsubscribe ():
78- async with PubsubFactory .create_batch_with_floodsub (1 ) as pubsubs_fsub :
78+ async with PubsubFactory .create_batch_with_gossipsub (1 ) as pubsubs_fsub :
7979 # Unsubscribe from topic we didn't even subscribe to
8080 assert "NOT_MY_TOPIC" not in pubsubs_fsub [0 ].topic_ids
8181 await pubsubs_fsub [0 ].unsubscribe ("NOT_MY_TOPIC" )
@@ -93,7 +93,7 @@ async def test_re_unsubscribe():
9393
9494@pytest .mark .trio
9595async def test_reissue_when_listen_addrs_change ():
96- async with PubsubFactory .create_batch_with_floodsub (2 ) as pubsubs_fsub :
96+ async with PubsubFactory .create_batch_with_gossipsub (2 ) as pubsubs_fsub :
9797 await connect (pubsubs_fsub [0 ].host , pubsubs_fsub [1 ].host )
9898 await pubsubs_fsub [0 ].subscribe (TESTING_TOPIC )
9999 # Yield to let 0 notify 1
@@ -132,7 +132,7 @@ async def test_reissue_when_listen_addrs_change():
132132
133133@pytest .mark .trio
134134async def test_peers_subscribe ():
135- async with PubsubFactory .create_batch_with_floodsub (2 ) as pubsubs_fsub :
135+ async with PubsubFactory .create_batch_with_gossipsub (2 ) as pubsubs_fsub :
136136 await connect (pubsubs_fsub [0 ].host , pubsubs_fsub [1 ].host )
137137 await pubsubs_fsub [0 ].subscribe (TESTING_TOPIC )
138138 # Yield to let 0 notify 1
@@ -166,7 +166,7 @@ async def test_peers_subscribe():
166166
167167@pytest .mark .trio
168168async def test_peer_subscribe_fail_upon_invald_record_transfer ():
169- async with PubsubFactory .create_batch_with_floodsub (2 ) as pubsubs_fsub :
169+ async with PubsubFactory .create_batch_with_gossipsub (2 ) as pubsubs_fsub :
170170 await connect (pubsubs_fsub [0 ].host , pubsubs_fsub [1 ].host )
171171
172172 # Corrupt host_a's local peer record
@@ -206,7 +206,7 @@ async def test_peer_subscribe_fail_upon_invald_record_transfer():
206206
207207@pytest .mark .trio
208208async def test_get_hello_packet ():
209- async with PubsubFactory .create_batch_with_floodsub (1 ) as pubsubs_fsub :
209+ async with PubsubFactory .create_batch_with_gossipsub (1 ) as pubsubs_fsub :
210210
211211 def _get_hello_packet_topic_ids ():
212212 packet = pubsubs_fsub [0 ].get_hello_packet ()
@@ -227,7 +227,7 @@ def _get_hello_packet_topic_ids():
227227
228228@pytest .mark .trio
229229async def test_set_and_remove_topic_validator ():
230- async with PubsubFactory .create_batch_with_floodsub (1 ) as pubsubs_fsub :
230+ async with PubsubFactory .create_batch_with_gossipsub (1 ) as pubsubs_fsub :
231231 is_sync_validator_called = False
232232
233233 def sync_validator (peer_id : ID , msg : rpc_pb2 .Message ) -> bool :
@@ -311,7 +311,7 @@ async def async_validator(peer_id: ID, msg: rpc_pb2.Message) -> bool:
311311 await trio .lowlevel .checkpoint ()
312312 return True
313313
314- async with PubsubFactory .create_batch_with_floodsub (1 ) as pubsubs_fsub :
314+ async with PubsubFactory .create_batch_with_gossipsub (1 ) as pubsubs_fsub :
315315 topic_1 = "TEST_VALIDATOR_1"
316316 topic_2 = "TEST_VALIDATOR_2"
317317 topic_3 = "TEST_VALIDATOR_3"
@@ -379,7 +379,7 @@ async def mock_run_async_validator(
379379 async with lock :
380380 state ["concurrency_counter" ] -= 1
381381
382- async with PubsubFactory .create_batch_with_floodsub (1 ) as pubsubs_fsub :
382+ async with PubsubFactory .create_batch_with_gossipsub (1 ) as pubsubs_fsub :
383383
384384 def passed_sync_validator (peer_id : ID , msg : rpc_pb2 .Message ) -> bool :
385385 return True
@@ -466,7 +466,7 @@ async def mock_handle_rpc(rpc, sender_peer_id):
466466 yield Events (event_push_msg , event_handle_subscription , event_handle_rpc )
467467
468468 async with (
469- PubsubFactory .create_batch_with_floodsub (
469+ PubsubFactory .create_batch_with_gossipsub (
470470 1 , security_protocol = security_protocol
471471 ) as pubsubs_fsub ,
472472 net_stream_pair_factory (security_protocol = security_protocol ) as stream_pair ,
@@ -541,7 +541,7 @@ async def mock_handle_rpc(rpc, sender_peer_id):
541541
542542@pytest .mark .trio
543543async def test_handle_subscription ():
544- async with PubsubFactory .create_batch_with_floodsub (1 ) as pubsubs_fsub :
544+ async with PubsubFactory .create_batch_with_gossipsub (1 ) as pubsubs_fsub :
545545 assert len (pubsubs_fsub [0 ].peer_topics ) == 0
546546 sub_msg_0 = rpc_pb2 .RPC .SubOpts (subscribe = True , topicid = TESTING_TOPIC )
547547 peer_ids = [IDFactory () for _ in range (2 )]
@@ -573,7 +573,7 @@ async def test_handle_subscription():
573573
574574@pytest .mark .trio
575575async def test_handle_talk ():
576- async with PubsubFactory .create_batch_with_floodsub (1 ) as pubsubs_fsub :
576+ async with PubsubFactory .create_batch_with_gossipsub (1 ) as pubsubs_fsub :
577577 sub = await pubsubs_fsub [0 ].subscribe (TESTING_TOPIC )
578578 msg_0 = make_pubsub_msg (
579579 origin_id = pubsubs_fsub [0 ].my_id ,
@@ -599,7 +599,7 @@ async def test_handle_talk():
599599@pytest .mark .trio
600600async def test_message_all_peers (monkeypatch , security_protocol ):
601601 async with (
602- PubsubFactory .create_batch_with_floodsub (
602+ PubsubFactory .create_batch_with_gossipsub (
603603 1 , security_protocol = security_protocol
604604 ) as pubsubs_fsub ,
605605 net_stream_pair_factory (security_protocol = security_protocol ) as stream_pair ,
@@ -620,7 +620,7 @@ async def test_message_all_peers(monkeypatch, security_protocol):
620620
621621@pytest .mark .trio
622622async def test_subscribe_and_publish ():
623- async with PubsubFactory .create_batch_with_floodsub (1 ) as pubsubs_fsub :
623+ async with PubsubFactory .create_batch_with_gossipsub (1 ) as pubsubs_fsub :
624624 pubsub = pubsubs_fsub [0 ]
625625
626626 list_data = [b"d0" , b"d1" ]
@@ -652,7 +652,7 @@ async def receive_data(topic):
652652
653653@pytest .mark .trio
654654async def test_subscribe_and_publish_full_channel ():
655- async with PubsubFactory .create_batch_with_floodsub (1 ) as pubsubs_fsub :
655+ async with PubsubFactory .create_batch_with_gossipsub (1 ) as pubsubs_fsub :
656656 pubsub = pubsubs_fsub [0 ]
657657
658658 extra_data_0 = b"extra_data_0"
@@ -693,7 +693,7 @@ async def push_msg(msg_forwarder, msg):
693693 msgs .append (msg )
694694 await trio .lowlevel .checkpoint ()
695695
696- async with PubsubFactory .create_batch_with_floodsub (1 ) as pubsubs_fsub :
696+ async with PubsubFactory .create_batch_with_gossipsub (1 ) as pubsubs_fsub :
697697 with monkeypatch .context () as m :
698698 m .setattr (pubsubs_fsub [0 ], "push_msg" , push_msg )
699699
@@ -713,7 +713,7 @@ async def push_msg(msg_forwarder, msg):
713713
714714@pytest .mark .trio
715715async def test_push_msg (monkeypatch ):
716- async with PubsubFactory .create_batch_with_floodsub (2 ) as pubsubs_fsub :
716+ async with PubsubFactory .create_batch_with_gossipsub (2 ) as pubsubs_fsub :
717717 msg_0 = make_pubsub_msg (
718718 origin_id = pubsubs_fsub [0 ].my_id ,
719719 topic_ids = [TESTING_TOPIC ],
@@ -802,7 +802,7 @@ def failed_sync_validator(peer_id: ID, msg: rpc_pb2.Message) -> bool:
802802
803803@pytest .mark .trio
804804async def test_strict_signing ():
805- async with PubsubFactory .create_batch_with_floodsub (
805+ async with PubsubFactory .create_batch_with_gossipsub (
806806 2 , strict_signing = True
807807 ) as pubsubs_fsub :
808808 await connect (pubsubs_fsub [0 ].host , pubsubs_fsub [1 ].host )
@@ -819,7 +819,7 @@ async def test_strict_signing():
819819
820820@pytest .mark .trio
821821async def test_strict_signing_failed_validation (monkeypatch ):
822- async with PubsubFactory .create_batch_with_floodsub (
822+ async with PubsubFactory .create_batch_with_gossipsub (
823823 2 , strict_signing = True
824824 ) as pubsubs_fsub :
825825 msg = make_pubsub_msg (
@@ -880,7 +880,7 @@ async def router_publish(*args, **kwargs):
880880@pytest .mark .trio
881881async def test_blacklist_basic_operations ():
882882 """Test basic blacklist operations: add, remove, check, clear."""
883- async with PubsubFactory .create_batch_with_floodsub (1 ) as pubsubs_fsub :
883+ async with PubsubFactory .create_batch_with_gossipsub (1 ) as pubsubs_fsub :
884884 pubsub = pubsubs_fsub [0 ]
885885
886886 # Create test peer IDs
@@ -936,7 +936,7 @@ async def test_blacklist_basic_operations():
936936@pytest .mark .trio
937937async def test_blacklist_blocks_new_peer_connections (monkeypatch ):
938938 """Test that blacklisted peers are rejected when trying to connect."""
939- async with PubsubFactory .create_batch_with_floodsub (1 ) as pubsubs_fsub :
939+ async with PubsubFactory .create_batch_with_gossipsub (1 ) as pubsubs_fsub :
940940 pubsub = pubsubs_fsub [0 ]
941941
942942 # Create a blacklisted peer ID
@@ -990,7 +990,7 @@ def mock_add_peer(*args, **kwargs):
990990@pytest .mark .trio
991991async def test_blacklist_blocks_messages_from_blacklisted_originator ():
992992 """Test that messages from blacklisted originator (from field) are rejected."""
993- async with PubsubFactory .create_batch_with_floodsub (2 ) as pubsubs_fsub :
993+ async with PubsubFactory .create_batch_with_gossipsub (2 ) as pubsubs_fsub :
994994 pubsub = pubsubs_fsub [0 ]
995995 blacklisted_originator = pubsubs_fsub [1 ].my_id # Use existing peer ID
996996
@@ -1038,7 +1038,7 @@ async def mock_router_publish(msg_forwarder: ID, pubsub_msg: rpc_pb2.Message):
10381038@pytest .mark .trio
10391039async def test_blacklist_allows_non_blacklisted_peers ():
10401040 """Test that non-blacklisted peers can send messages normally."""
1041- async with PubsubFactory .create_batch_with_floodsub (3 ) as pubsubs_fsub :
1041+ async with PubsubFactory .create_batch_with_gossipsub (3 ) as pubsubs_fsub :
10421042 pubsub = pubsubs_fsub [0 ]
10431043 allowed_peer = pubsubs_fsub [1 ].my_id
10441044 blacklisted_peer = pubsubs_fsub [2 ].my_id
@@ -1103,7 +1103,7 @@ async def mock_router_publish(msg_forwarder: ID, pubsub_msg: rpc_pb2.Message):
11031103@pytest .mark .trio
11041104async def test_blacklist_integration_with_existing_functionality ():
11051105 """Test that blacklisting works correctly with existing pubsub functionality."""
1106- async with PubsubFactory .create_batch_with_floodsub (2 ) as pubsubs_fsub :
1106+ async with PubsubFactory .create_batch_with_gossipsub (2 ) as pubsubs_fsub :
11071107 pubsub = pubsubs_fsub [0 ]
11081108 other_peer = pubsubs_fsub [1 ].my_id
11091109
@@ -1153,7 +1153,7 @@ async def mock_router_publish(msg_forwarder: ID, pubsub_msg: rpc_pb2.Message):
11531153@pytest .mark .trio
11541154async def test_blacklist_blocks_messages_from_blacklisted_source ():
11551155 """Test that messages from blacklisted source (forwarder) are rejected."""
1156- async with PubsubFactory .create_batch_with_floodsub (2 ) as pubsubs_fsub :
1156+ async with PubsubFactory .create_batch_with_gossipsub (2 ) as pubsubs_fsub :
11571157 pubsub = pubsubs_fsub [0 ]
11581158 blacklisted_forwarder = pubsubs_fsub [1 ].my_id
11591159
@@ -1205,8 +1205,9 @@ async def test_blacklist_tears_down_existing_connection():
12051205 calling add_to_blacklist(peer_id) immediately resets its stream and
12061206 removes it from both places.
12071207 """
1208- # Create two pubsub instances (floodsub), so they can connect to each other
1209- async with PubsubFactory .create_batch_with_floodsub (2 ) as pubsubs_fsub :
1208+ # Create two pubsub instances (gosscreate_batch_with_gossipsub),
1209+ # so they can connect to each other
1210+ async with PubsubFactory .create_batch_with_gossipsub (2 ) as pubsubs_fsub :
12101211 pubsub0 , pubsub1 = pubsubs_fsub
12111212
12121213 # 1) Connect peer1 to peer0
@@ -1246,7 +1247,7 @@ async def test_blacklist_tears_down_existing_connection():
12461247@pytest .mark .trio
12471248async def test_get_message_id ():
12481249 """Test that the get_message_id method provides correct message ID construction."""
1249- async with PubsubFactory .create_batch_with_floodsub (1 ) as pubsubs_fsub :
1250+ async with PubsubFactory .create_batch_with_gossipsub (1 ) as pubsubs_fsub :
12501251 pubsub = pubsubs_fsub [0 ]
12511252
12521253 # Create a test message
@@ -1268,7 +1269,7 @@ def custom_msg_id_constructor(msg):
12681269 return msg .data + msg .from_id
12691270
12701271 # Create a new pubsub instance with custom constructor
1271- async with PubsubFactory .create_batch_with_floodsub (
1272+ async with PubsubFactory .create_batch_with_gossipsub (
12721273 1 , msg_id_constructor = custom_msg_id_constructor
12731274 ) as custom_pubsubs :
12741275 custom_pubsub = custom_pubsubs [0 ]
0 commit comments