This repository was archived by the owner on Aug 12, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
crates/storb_validator/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -242,6 +242,25 @@ impl<'a> UploadProcessor<'a> {
242242 }
243243 } ;
244244
245+ let owner_account_id = SqlAccountId ( account_id. clone ( ) ) ;
246+
247+ // Verify nonce before we upload the user's file
248+ let message = {
249+ let mut msg = Vec :: new ( ) ;
250+ msg. extend_from_slice ( & nonce) ;
251+ msg
252+ } ;
253+ debug ! ( "Verifying signature for nonce {}" , hex:: encode( nonce) ) ;
254+ let verified =
255+ crabtensor:: sign:: verify_signature ( & owner_account_id. 0 , & signature, & message) ;
256+ if !verified {
257+ error ! (
258+ "Signature verification failed for nonce {}" ,
259+ hex:: encode( message)
260+ ) ;
261+ return Err ( anyhow:: anyhow!( "Signature verification failed for nonce" ) ) ;
262+ }
263+
245264 // Spawn consumer task
246265 let miner_uids = self . miner_uids . clone ( ) ;
247266 let miner_connections = self . miner_connections . clone ( ) ;
@@ -287,7 +306,7 @@ impl<'a> UploadProcessor<'a> {
287306 length : total_size,
288307 chunk_size,
289308 chunk_count : chunks_with_pieces. len ( ) as u64 ,
290- owner_account_id : SqlAccountId ( account_id . clone ( ) ) ,
309+ owner_account_id,
291310 creation_timestamp : now,
292311 signature : KeypairSignature :: from_raw ( [ 0 ; 64 ] ) , // Placeholder, will be signed below
293312 } ;
You can’t perform that action at this time.
0 commit comments