Skip to content

Commit 72f3806

Browse files
author
EchoBT
committed
fix: use u16 salt directly for reveal_mechanism_weights
The salt was being truncated from u16 to u8 during reveal, causing InvalidRevealCommitHashNotMatch error. Changes: - Update bittensor-rs to 173979c (u16 salt fix) - Pass salt as &[u16] directly instead of converting to &[u8]
1 parent b42dfc8 commit 72f3806

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ license = "MIT"
3030

3131
[workspace.dependencies]
3232
# Bittensor
33-
bittensor-rs = { git = "https://github.com/CortexLM/bittensor-rs", rev = "a69a624" }
33+
bittensor-rs = { git = "https://github.com/CortexLM/bittensor-rs", rev = "173979c" }
3434

3535
# Async runtime
3636
tokio = { version = "1.40", features = ["full", "sync", "macros", "rt-multi-thread"] }

crates/bittensor-integration/src/weights.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -383,17 +383,14 @@ impl WeightSubmitter {
383383
// Batch reveal via mechanism weights API
384384
let mut last_tx = String::new();
385385
for (_, commit) in pending {
386-
let uids_u64: Vec<u64> = commit.uids.iter().map(|u| *u as u64).collect();
387-
let salt_u8: Vec<u8> = commit.salt.iter().map(|s| *s as u8).collect();
388-
389386
let tx_hash = reveal_mechanism_weights(
390387
self.client.client()?,
391388
self.client.signer()?,
392389
self.client.netuid(),
393390
commit.mechanism_id,
394-
&uids_u64,
391+
&commit.uids,
395392
&commit.weights,
396-
&salt_u8,
393+
&commit.salt,
397394
commit.version_key,
398395
ExtrinsicWait::Finalized,
399396
)
@@ -620,18 +617,14 @@ impl MechanismWeightManager {
620617
pending.mechanism_id, pending.hash
621618
);
622619

623-
// Convert uids to u64 for reveal_mechanism_weights API
624-
let uids_u64: Vec<u64> = pending.uids.iter().map(|u| *u as u64).collect();
625-
626620
let tx_hash = reveal_mechanism_weights(
627621
self.client.client()?,
628622
self.client.signer()?,
629623
self.client.netuid(),
630624
pending.mechanism_id,
631-
&uids_u64,
625+
&pending.uids,
632626
&pending.weights,
633-
// Convert salt u16 back to u8 for reveal API (it converts internally)
634-
&pending.salt.iter().map(|s| *s as u8).collect::<Vec<u8>>(),
627+
&pending.salt,
635628
pending.version_key,
636629
ExtrinsicWait::Finalized,
637630
)

0 commit comments

Comments
 (0)