Skip to content

Commit 173979c

Browse files
author
EchoBT
committed
fix: use u16 salt directly in reveal_mechanism_weights
The salt was being truncated from u16 to u8 during reveal, causing hash mismatch with the original commit. Now reveal_mechanism_weights accepts: - uids: &[u16] (was &[u64]) - salt: &[u16] (was &[u8]) This matches subtensor's expected format exactly.
1 parent cd777d5 commit 173979c

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/validator/mechanism.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,15 @@ pub async fn reveal_mechanism_weights(
8787
client: &BittensorClient,
8888
signer: &BittensorSigner,
8989
netuid: u16,
90-
mechanism_id: u8, // Changed from u64 to u8 (MechId)
91-
uids: &[u64],
92-
weights: &[u16], // Changed from u64 to u16 to match Subtensor format
93-
salt: &[u8],
90+
mechanism_id: u8,
91+
uids: &[u16],
92+
weights: &[u16],
93+
salt: &[u16],
9494
version_key: u64,
9595
wait_for: ExtrinsicWait,
9696
) -> Result<String> {
97-
// Convert uids from u64 to u16 (Subtensor expects Vec<u16>)
98-
let uid_u16: Vec<u16> = uids.iter().map(|uid| *uid as u16).collect();
99-
// Convert salt from u8 to u16 (Subtensor expects Vec<u16>)
100-
let salt_u16: Vec<u16> = salt.iter().map(|b| *b as u16).collect();
97+
let uid_u16 = uids;
98+
let salt_u16 = salt;
10199

102100
let uid_values: Vec<Value> = uid_u16
103101
.iter()

0 commit comments

Comments
 (0)