16
16
from bittensor .utils .registration import torch
17
17
18
18
19
+ # TODO: Merge this logic with `commit_reveal_extrinsic` in SDKv10 bc this is not CRv3 anymore.
19
20
async def _do_commit_reveal_v3 (
20
21
subtensor : "AsyncSubtensor" ,
21
22
wallet : "Wallet" ,
22
23
netuid : int ,
23
24
commit : bytes ,
24
25
reveal_round : int ,
26
+ commit_reveal_version : int = 4 ,
25
27
wait_for_inclusion : bool = False ,
26
28
wait_for_finalization : bool = False ,
27
29
period : Optional [int ] = None ,
@@ -35,6 +37,7 @@ async def _do_commit_reveal_v3(
35
37
netuid: int The network unique identifier.
36
38
commit: bytes The commit data in bytes format.
37
39
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``.
38
41
wait_for_inclusion: bool, optional Flag indicating whether to wait for the extrinsic to be included in a block.
39
42
wait_for_finalization: bool, optional Flag indicating whether to wait for the extrinsic to be finalized.
40
43
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(
52
55
53
56
call = await subtensor .substrate .compose_call (
54
57
call_module = "SubtensorModule" ,
55
- call_function = "commit_crv3_weights " ,
58
+ call_function = "commit_timelocked_weights " ,
56
59
call_params = {
57
60
"netuid" : netuid ,
58
61
"commit" : commit ,
59
62
"reveal_round" : reveal_round ,
63
+ "commit_reveal_version" : commit_reveal_version ,
60
64
},
61
65
)
62
66
return await subtensor .sign_and_send_extrinsic (
@@ -69,6 +73,7 @@ async def _do_commit_reveal_v3(
69
73
)
70
74
71
75
76
+ # TODO: rename this extrinsic to `commit_reveal_extrinsic` in SDK.v10
72
77
async def commit_reveal_v3_extrinsic (
73
78
subtensor : "AsyncSubtensor" ,
74
79
wallet : "Wallet" ,
@@ -122,7 +127,7 @@ async def commit_reveal_v3_extrinsic(
122
127
netuid = netuid ,
123
128
subnet_reveal_period_epochs = subnet_reveal_period_epochs ,
124
129
block_time = block_time ,
125
- hotkey = wallet .hotkey .ss58_address . encode () ,
130
+ hotkey = wallet .hotkey .public_key ,
126
131
)
127
132
128
133
success , message = await _do_commit_reveal_v3 (
@@ -136,7 +141,7 @@ async def commit_reveal_v3_extrinsic(
136
141
period = period ,
137
142
)
138
143
139
- if success is not True :
144
+ if not success :
140
145
logging .error (message )
141
146
return False , message
142
147
0 commit comments