Skip to content

Commit 1ab7491

Browse files
author
Roman
committed
update async extrinsic
1 parent c059e0b commit 1ab7491

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

bittensor/core/extrinsics/asyncex/commit_reveal.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@
1616
from bittensor.utils.registration import torch
1717

1818

19+
# TODO: Merge this logic with `commit_reveal_extrinsic` in SDKv10 bc this is not CRv3 anymore.
1920
async def _do_commit_reveal_v3(
2021
subtensor: "AsyncSubtensor",
2122
wallet: "Wallet",
2223
netuid: int,
2324
commit: bytes,
2425
reveal_round: int,
26+
commit_reveal_version: int = 4,
2527
wait_for_inclusion: bool = False,
2628
wait_for_finalization: bool = False,
2729
period: Optional[int] = None,
@@ -35,6 +37,7 @@ async def _do_commit_reveal_v3(
3537
netuid: int The network unique identifier.
3638
commit: bytes The commit data in bytes format.
3739
reveal_round: int The round number for the reveal phase.
40+
commit_reveal_version: The version of the chain commit-reveal protocol to use. Default is ``4``.
3841
wait_for_inclusion: bool, optional Flag indicating whether to wait for the extrinsic to be included in a block.
3942
wait_for_finalization: bool, optional Flag indicating whether to wait for the extrinsic to be finalized.
4043
period (Optional[int]): The number of blocks during which the transaction will remain valid after it's submitted. If
@@ -52,11 +55,12 @@ async def _do_commit_reveal_v3(
5255

5356
call = await subtensor.substrate.compose_call(
5457
call_module="SubtensorModule",
55-
call_function="commit_crv3_weights",
58+
call_function="commit_timelocked_weights",
5659
call_params={
5760
"netuid": netuid,
5861
"commit": commit,
5962
"reveal_round": reveal_round,
63+
"commit_reveal_version": commit_reveal_version,
6064
},
6165
)
6266
return await subtensor.sign_and_send_extrinsic(
@@ -69,6 +73,7 @@ async def _do_commit_reveal_v3(
6973
)
7074

7175

76+
# TODO: rename this extrinsic to `commit_reveal_extrinsic` in SDK.v10
7277
async def commit_reveal_v3_extrinsic(
7378
subtensor: "AsyncSubtensor",
7479
wallet: "Wallet",
@@ -122,7 +127,7 @@ async def commit_reveal_v3_extrinsic(
122127
netuid=netuid,
123128
subnet_reveal_period_epochs=subnet_reveal_period_epochs,
124129
block_time=block_time,
125-
hotkey=wallet.hotkey.ss58_address.encode(),
130+
hotkey=wallet.hotkey.public_key,
126131
)
127132

128133
success, message = await _do_commit_reveal_v3(
@@ -136,7 +141,7 @@ async def commit_reveal_v3_extrinsic(
136141
period=period,
137142
)
138143

139-
if success is not True:
144+
if not success:
140145
logging.error(message)
141146
return False, message
142147

0 commit comments

Comments
 (0)