@@ -191,7 +191,8 @@ func (p *PDPService) handleCreateProofSet(w http.ResponseWriter, r *http.Request
191191 // Step 3: Get the sender address from 'eth_keys' table where role = 'pdp' limit 1
192192 fromAddress , err := p .getSenderAddress (ctx )
193193 if err != nil {
194- http .Error (w , "Failed to get sender address: " + err .Error (), http .StatusInternalServerError )
194+ log .Errorf ("Failed to get sender address: %v" , err )
195+ http .Error (w , "Failed to get sender address" , http .StatusInternalServerError )
195196 return
196197 }
197198
@@ -364,7 +365,8 @@ func (p *PDPService) handleGetProofSetCreationStatus(w http.ResponseWriter, r *h
364365 http .Error (w , "Proof set creation not found for given txHash" , http .StatusNotFound )
365366 return
366367 }
367- http .Error (w , "Failed to query proof set creation: " + err .Error (), http .StatusInternalServerError )
368+ log .Errorf ("Failed to query proof set creation: %v" , err )
369+ http .Error (w , "Failed to query proof set creation" , http .StatusInternalServerError )
368370 return
369371 }
370372
@@ -402,7 +404,8 @@ func (p *PDPService) handleGetProofSetCreationStatus(w http.ResponseWriter, r *h
402404 http .Error (w , "Message status not found for given txHash" , http .StatusInternalServerError )
403405 return
404406 }
405- http .Error (w , "Failed to query message status: " + err .Error (), http .StatusInternalServerError )
407+ log .Errorf ("Failed to query message status: %v" , err )
408+ http .Error (w , "Failed to query message status" , http .StatusInternalServerError )
406409 return
407410 }
408411
@@ -422,7 +425,8 @@ func (p *PDPService) handleGetProofSetCreationStatus(w http.ResponseWriter, r *h
422425 http .Error (w , "Proof set not found despite proofset_created = true" , http .StatusInternalServerError )
423426 return
424427 }
425- http .Error (w , "Failed to query proof set: " + err .Error (), http .StatusInternalServerError )
428+ log .Errorf ("Failed to query proof set: %v" , err )
429+ http .Error (w , "Failed to query proof set" , http .StatusInternalServerError )
426430 return
427431 }
428432 response .ProofSetId = & proofSetId
@@ -485,7 +489,8 @@ func (p *PDPService) handleGetProofSet(w http.ResponseWriter, r *http.Request) {
485489 http .Error (w , "Proof set not found" , http .StatusNotFound )
486490 return
487491 }
488- http .Error (w , "Failed to retrieve proof set: " + err .Error (), http .StatusInternalServerError )
492+ log .Errorf ("Failed to retrieve proof set: %v" , err )
493+ http .Error (w , "Failed to retrieve proof set" , http .StatusInternalServerError )
489494 return
490495 }
491496
@@ -510,7 +515,8 @@ func (p *PDPService) handleGetProofSet(w http.ResponseWriter, r *http.Request) {
510515 ORDER BY root_id, subroot_offset
511516 ` , proofSetId )
512517 if err != nil {
513- http .Error (w , "Failed to retrieve proof set roots: " + err .Error (), http .StatusInternalServerError )
518+ log .Errorf ("Failed to retrieve proof set roots: %v" , err )
519+ http .Error (w , "Failed to retrieve proof set roots" , http .StatusInternalServerError )
514520 return
515521 }
516522
@@ -522,7 +528,8 @@ func (p *PDPService) handleGetProofSet(w http.ResponseWriter, r *http.Request) {
522528 WHERE id = $1
523529 ` , proofSetId ).Scan (& nextChallengeEpoch )
524530 if err != nil {
525- http .Error (w , "Failed to retrieve next challenge epoch: " + err .Error (), http .StatusInternalServerError )
531+ log .Errorf ("Failed to retrieve next challenge epoch: %v" , err )
532+ http .Error (w , "Failed to retrieve next challenge epoch" , http .StatusInternalServerError )
526533 return
527534 }
528535
@@ -615,7 +622,8 @@ func (p *PDPService) handleAddRootToProofSet(w http.ResponseWriter, r *http.Requ
615622 http .Error (w , "Proof set not found" , http .StatusNotFound )
616623 return
617624 }
618- http .Error (w , "Failed to retrieve proof set: " + err .Error (), http .StatusInternalServerError )
625+ log .Errorf ("Failed to retrieve proof set: %v" , err )
626+ http .Error (w , "Failed to retrieve proof set" , http .StatusInternalServerError )
619627 return
620628 }
621629
@@ -725,7 +733,8 @@ func (p *PDPService) handleAddRootToProofSet(w http.ResponseWriter, r *http.Requ
725733 WHERE ppr.service = $1 AND ppr.piece_cid = ANY($2)
726734 ` , serviceLabel , subrootCIDsList )
727735 if err != nil {
728- return false , err
736+ log .Errorf ("Failed to retrieve pdp_piecerefs: %v" , err )
737+ return false , fmt .Errorf ("failed to retrieve pdp_piecerefs" )
729738 }
730739 defer rows .Close ()
731740
@@ -811,7 +820,8 @@ func (p *PDPService) handleAddRootToProofSet(w http.ResponseWriter, r *http.Requ
811820 return true , nil
812821 }, harmonydb .OptionRetry ())
813822 if err != nil {
814- http .Error (w , "Failed to validate subroots: " + err .Error (), http .StatusBadRequest )
823+ log .Errorf ("Failed to validate subroots: %v" , err )
824+ http .Error (w , "Failed to validate subroots" , http .StatusBadRequest )
815825 return
816826 }
817827
@@ -876,7 +886,8 @@ func (p *PDPService) handleAddRootToProofSet(w http.ResponseWriter, r *http.Requ
876886 // Step 7: Get the sender address from 'eth_keys' table where role = 'pdp' limit 1
877887 fromAddress , err := p .getSenderAddress (ctx )
878888 if err != nil {
879- http .Error (w , "Failed to get sender address: " + err .Error (), http .StatusInternalServerError )
889+ log .Errorf ("Failed to get sender address: %v" , err )
890+ http .Error (w , "Failed to get sender address" , http .StatusInternalServerError )
880891 return
881892 }
882893
@@ -919,7 +930,7 @@ func (p *PDPService) handleAddRootToProofSet(w http.ResponseWriter, r *http.Requ
919930 log .Errorw ("Failed to insert AddRoots into message_waits_eth" ,
920931 "txHash" , txHashLower ,
921932 "error" , err )
922- return false , err // Return false to rollback the transaction
933+ return false , errors . New ( "failed to insert AddRoots into message_waits_eth" ) // Return false to rollback the transaction
923934 }
924935
925936 // Update proof set for initialization upon first add
@@ -928,7 +939,8 @@ func (p *PDPService) handleAddRootToProofSet(w http.ResponseWriter, r *http.Requ
928939 WHERE id = $1 AND prev_challenge_request_epoch IS NULL AND challenge_request_msg_hash IS NULL AND prove_at_epoch IS NULL
929940 ` , proofSetIDUint64 )
930941 if err != nil {
931- return false , err
942+ log .Errorf ("Failed to update proof set for initialization upon first add: %v" , err )
943+ return false , errors .New ("failed to update proof set for initialization upon first add" )
932944 }
933945
934946 // Insert into pdp_proofset_roots
@@ -961,7 +973,8 @@ func (p *PDPService) handleAddRootToProofSet(w http.ResponseWriter, r *http.Requ
961973 subrootInfo .PDPPieceRefID ,
962974 )
963975 if err != nil {
964- return false , err
976+ log .Errorf ("Failed to insert into pdp_proofset_roots: %v" , err )
977+ return false , errors .New ("failed to insert into pdp_proofset_roots" )
965978 }
966979 }
967980 }
@@ -1039,7 +1052,8 @@ func (p *PDPService) handleGetRootAdditionStatus(w http.ResponseWriter, r *http.
10391052 http .Error (w , "Proof set not found" , http .StatusNotFound )
10401053 return
10411054 }
1042- http .Error (w , "Failed to retrieve proof set: " + err .Error (), http .StatusInternalServerError )
1055+ log .Errorf ("Failed to retrieve proof set: %v" , err )
1056+ http .Error (w , "Failed to retrieve proof set" , http .StatusInternalServerError )
10431057 return
10441058 }
10451059
@@ -1069,7 +1083,8 @@ func (p *PDPService) handleGetRootAdditionStatus(w http.ResponseWriter, r *http.
10691083 ORDER BY add_message_index, subroot_offset
10701084 ` , proofSetID , txHash )
10711085 if err != nil {
1072- http .Error (w , "Failed to query root additions: " + err .Error (), http .StatusInternalServerError )
1086+ log .Errorf ("Failed to query root additions: %v" , err )
1087+ http .Error (w , "Failed to query root additions" , http .StatusInternalServerError )
10731088 return
10741089 }
10751090
@@ -1088,7 +1103,8 @@ func (p *PDPService) handleGetRootAdditionStatus(w http.ResponseWriter, r *http.
10881103 http .Error (w , "Transaction status not found" , http .StatusNotFound )
10891104 return
10901105 }
1091- http .Error (w , "Failed to query transaction status: " + err .Error (), http .StatusInternalServerError )
1106+ log .Errorf ("Failed to query transaction status: %v" , err )
1107+ http .Error (w , "Failed to query transaction status" , http .StatusInternalServerError )
10921108 return
10931109 }
10941110
@@ -1216,7 +1232,8 @@ func (p *PDPService) handleDeleteProofSetRoot(w http.ResponseWriter, r *http.Req
12161232 http .Error (w , "Proof set not found" , http .StatusNotFound )
12171233 return
12181234 }
1219- http .Error (w , "Failed to retrieve proof set: " + err .Error (), http .StatusInternalServerError )
1235+ log .Errorf ("Failed to retrieve proof set: %v" , err )
1236+ http .Error (w , "Failed to retrieve proof set" , http .StatusInternalServerError )
12201237 return
12211238 }
12221239
@@ -1247,7 +1264,8 @@ func (p *PDPService) handleDeleteProofSetRoot(w http.ResponseWriter, r *http.Req
12471264 // Get the sender address
12481265 fromAddress , err := p .getSenderAddress (ctx )
12491266 if err != nil {
1250- http .Error (w , "Failed to get sender address: " + err .Error (), http .StatusInternalServerError )
1267+ log .Errorf ("Failed to get sender address: %v" , err )
1268+ http .Error (w , "Failed to get sender address" , http .StatusInternalServerError )
12511269 return
12521270 }
12531271
@@ -1285,7 +1303,8 @@ func (p *PDPService) handleDeleteProofSetRoot(w http.ResponseWriter, r *http.Req
12851303 return true , nil
12861304 }, harmonydb .OptionRetry ())
12871305 if err != nil {
1288- http .Error (w , "Failed to schedule delete root: " + err .Error (), http .StatusInternalServerError )
1306+ log .Errorf ("Failed to schedule delete root: %v" , err )
1307+ http .Error (w , "Failed to schedule delete root" , http .StatusInternalServerError )
12891308 return
12901309 }
12911310
@@ -1341,7 +1360,8 @@ func (p *PDPService) handleGetProofSetRoot(w http.ResponseWriter, r *http.Reques
13411360 http .Error (w , "Root not found" , http .StatusNotFound )
13421361 return
13431362 }
1344- http .Error (w , "Failed to retrieve root: " + err .Error (), http .StatusInternalServerError )
1363+ log .Errorf ("Failed to retrieve root: %v" , err )
1364+ http .Error (w , "Failed to retrieve root" , http .StatusInternalServerError )
13451365 return
13461366 }
13471367
@@ -1359,7 +1379,8 @@ func (p *PDPService) handleGetProofSetRoot(w http.ResponseWriter, r *http.Reques
13591379 ORDER BY subroot_offset
13601380 ` , proofSetID , rootID )
13611381 if err != nil {
1362- http .Error (w , "Failed to retrieve subroots: " + err .Error (), http .StatusInternalServerError )
1382+ log .Errorf ("Failed to retrieve subroots: %v" , err )
1383+ http .Error (w , "Failed to retrieve subroots" , http .StatusInternalServerError )
13631384 return
13641385 }
13651386
0 commit comments