Skip to content

Commit

Permalink
Merge pull request #346 from carver/portal-network
Browse files Browse the repository at this point in the history
Portal network
  • Loading branch information
carver committed May 18, 2021
2 parents fb8a941 + 4cc724e commit 743f3f3
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 8 deletions.
8 changes: 6 additions & 2 deletions ddht/v5_1/alexandria/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,9 @@ async def _feed_talk_requests(self) -> None:
try:
message = decode_message(request.message.payload)
except DecodingError:
pass
self.logger.debug(
"TALKREQ failed to parse: %r", request, exc_info=True
)
else:
if message.type != AlexandriaMessageType.REQUEST:
self.logger.debug(
Expand Down Expand Up @@ -527,7 +529,9 @@ async def _feed_talk_responses(self) -> None:
try:
message = decode_message(response.message.payload)
except DecodingError:
pass
self.logger.debug(
"TALKRESP failed to parse: %r", response, exc_info=True
)
else:
if message.type != AlexandriaMessageType.RESPONSE:
self.logger.debug(
Expand Down
2 changes: 1 addition & 1 deletion ddht/v5_1/alexandria/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from ddht.constants import DISCOVERY_MAX_PACKET_SIZE

ALEXANDRIA_PROTOCOL_ID = b"alexandria"
ALEXANDRIA_PROTOCOL_ID = b"portal"

DEFAULT_BOOTNODES: Tuple[str, ...] = ()

Expand Down
4 changes: 2 additions & 2 deletions ddht/v5_1/alexandria/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ async def bond(
self, node_id: NodeID, *, endpoint: Optional[Endpoint] = None
) -> bool:
self.logger.debug2(
"Bonding with %s", node_id.hex(),
"Bonding on Portal Network with %s...", node_id.hex(),
)

try:
Expand All @@ -155,7 +155,7 @@ async def bond(
self.routing_table.update(enr.node_id)

self.logger.debug(
"Bonded with %s successfully", node_id.hex(),
"Bonded on Portal Network with %s successfully", node_id.hex(),
)

self._routing_table_ready.set()
Expand Down
6 changes: 3 additions & 3 deletions ddht/v5_1/alexandria/sedes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ssz.sedes import Container, List, uint8, uint16, uint32, uint256
from ssz.sedes import Container, List, uint8, uint16, uint64, uint256


class ByteList(List): # type: ignore
Expand All @@ -15,8 +15,8 @@ def deserialize(self, value: bytes) -> bytes:
byte_list = ByteList(max_length=2048)


PingSedes = Container(field_sedes=(uint32, uint256))
PongSedes = Container(field_sedes=(uint32, uint256))
PingSedes = Container(field_sedes=(uint64, uint256))
PongSedes = Container(field_sedes=(uint64, uint256))

FindNodesSedes = Container(field_sedes=(List(uint16, max_length=256),))
FoundNodesSedes = Container(field_sedes=(uint8, List(byte_list, max_length=32)))
Expand Down
1 change: 1 addition & 0 deletions ddht/v5_1/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,7 @@ async def _handle_unhandled_talk_requests(self) -> None:
async with self.dispatcher.subscribe(TalkRequestMessage) as subscription:
async for request in subscription:
if request.message.protocol not in self._talk_protocols:
self.logger.debug("Unhandled TALKREQ: %s", request)
await self.client.send_talk_response(
request.sender_node_id,
request.sender_endpoint,
Expand Down
1 change: 1 addition & 0 deletions newsfragments/346.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Encode ENR sequence number with 64 bits, as mentioned in ENR spec.
1 change: 1 addition & 0 deletions newsfragments/346.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update overlay network ID to "portal".

0 comments on commit 743f3f3

Please sign in to comment.