Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion crates/storb_validator/src/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,25 @@ impl<'a> UploadProcessor<'a> {
}
};

let owner_account_id = SqlAccountId(account_id.clone());

// Verify nonce before we upload the user's file
let message = {
let mut msg = Vec::new();
msg.extend_from_slice(&nonce);
msg
};
debug!("Verifying signature for nonce {}", hex::encode(nonce));
let verified =
crabtensor::sign::verify_signature(&owner_account_id.0, &signature, &message);
if !verified {
error!(
"Signature verification failed for nonce {}",
hex::encode(message)
);
return Err(anyhow::anyhow!("Signature verification failed for nonce"));
}

// Spawn consumer task
let miner_uids = self.miner_uids.clone();
let miner_connections = self.miner_connections.clone();
Expand Down Expand Up @@ -287,7 +306,7 @@ impl<'a> UploadProcessor<'a> {
length: total_size,
chunk_size,
chunk_count: chunks_with_pieces.len() as u64,
owner_account_id: SqlAccountId(account_id.clone()),
owner_account_id,
creation_timestamp: now,
signature: KeypairSignature::from_raw([0; 64]), // Placeholder, will be signed below
};
Expand Down
Loading