Skip to content

Commit 1b8d5c0

Browse files
authored
Merge pull request #2930 from Windfarer/fix-verify
fix type conversion in axon preprocess
2 parents 0503b66 + f3a4db3 commit 1b8d5c0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

bittensor/core/axon.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,7 @@ async def preprocess(self, request: "Request") -> "Synapse":
12671267
# Fills the local axon information into the synapse.
12681268
synapse.axon.__dict__.update(
12691269
{
1270-
"version": str(version_as_int),
1270+
"version": int(version_as_int),
12711271
"uuid": str(self.axon.uuid),
12721272
"nonce": time.time_ns(),
12731273
"status_code": 100,
@@ -1276,7 +1276,7 @@ async def preprocess(self, request: "Request") -> "Synapse":
12761276

12771277
# Fills the dendrite information into the synapse.
12781278
synapse.dendrite.__dict__.update(
1279-
{"port": str(request.client.port), "ip": str(request.client.host)} # type: ignore
1279+
{"port": int(request.client.port), "ip": str(request.client.host)} # type: ignore
12801280
)
12811281

12821282
# Signs the synapse from the axon side using the wallet hotkey.

tests/unit_tests/test_axon.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,15 +493,15 @@ async def test_preprocess(self):
493493
synapse = await self.axon_middleware.preprocess(request)
494494

495495
# Check if the preprocess function fills the axon information into the synapse
496-
assert synapse.axon.version == str(version_as_int)
496+
assert synapse.axon.version == version_as_int
497497
assert synapse.axon.uuid == "1234"
498498
assert synapse.axon.nonce is not None
499499
assert synapse.axon.status_message is None
500500
assert synapse.axon.status_code == 100
501501
assert synapse.axon.signature == "0xaabbccdd"
502502

503503
# Check if the preprocess function fills the dendrite information into the synapse
504-
assert synapse.dendrite.port == "5000"
504+
assert synapse.dendrite.port == 5000
505505
assert synapse.dendrite.ip == "192.168.0.1"
506506

507507
# Check if the preprocess function sets the request name correctly

0 commit comments

Comments
 (0)