Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change %w to %v in logs #1764

Merged
merged 1 commit into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ func (a *Aggregator) validateEligibleFinalProof(ctx context.Context, proof *stat
log.Warnf("Proof %d-%d lower than next batch to verify %d. Deleting it", proof.BatchNumber, proof.BatchNumberFinal, batchNumberToVerify)
err := a.State.DeleteGeneratedProofs(ctx, proof.BatchNumber, proof.BatchNumberFinal, nil)
if err != nil {
return false, fmt.Errorf("Failed to delete discarded proof, err: %w", err)
return false, fmt.Errorf("failed to delete discarded proof, err: %w", err)
}
return false, nil
} else {
Expand Down
46 changes: 23 additions & 23 deletions aggregator/prover/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (p *Prover) IsIdle() (bool, error) {
func (p *Prover) SupportsForkID(forkID uint64) bool {
status, err := p.Status()
if err != nil {
log.Warnf("Error asking status for prover ID %s: %w", p.ID(), err)
log.Warnf("Error asking status for prover ID %s: %v", p.ID(), err)
return false
}

Expand All @@ -119,15 +119,15 @@ func (p *Prover) BatchProof(input *pb.InputProver) (*string, error) {
if msg, ok := res.Response.(*pb.ProverMessage_GenBatchProofResponse); ok {
switch msg.GenBatchProofResponse.Result {
case pb.Result_RESULT_UNSPECIFIED:
return nil, fmt.Errorf("Failed to generate proof %s, %w, input %v", msg.GenBatchProofResponse.String(), ErrUnspecified, input)
return nil, fmt.Errorf("failed to generate proof %s, %w, input %v", msg.GenBatchProofResponse.String(), ErrUnspecified, input)
case pb.Result_RESULT_OK:
return &msg.GenBatchProofResponse.Id, nil
case pb.Result_RESULT_ERROR:
return nil, fmt.Errorf("Failed to generate proof %s, %w, input %v", msg.GenBatchProofResponse.String(), ErrBadRequest, input)
return nil, fmt.Errorf("failed to generate proof %s, %w, input %v", msg.GenBatchProofResponse.String(), ErrBadRequest, input)
case pb.Result_RESULT_INTERNAL_ERROR:
return nil, fmt.Errorf("Failed to generate proof %s, %w, input %v", msg.GenBatchProofResponse.String(), ErrProverInternalError, input)
return nil, fmt.Errorf("failed to generate proof %s, %w, input %v", msg.GenBatchProofResponse.String(), ErrProverInternalError, input)
default:
return nil, fmt.Errorf("Failed to generate proof %s, %w,input %v", msg.GenBatchProofResponse.String(), ErrUnknown, input)
return nil, fmt.Errorf("failed to generate proof %s, %w,input %v", msg.GenBatchProofResponse.String(), ErrUnknown, input)
}
}

Expand Down Expand Up @@ -155,18 +155,18 @@ func (p *Prover) AggregatedProof(inputProof1, inputProof2 string) (*string, erro
if msg, ok := res.Response.(*pb.ProverMessage_GenAggregatedProofResponse); ok {
switch msg.GenAggregatedProofResponse.Result {
case pb.Result_RESULT_UNSPECIFIED:
return nil, fmt.Errorf("Failed to aggregate proofs %s, %w, input 1 %s, input 2 %s",
return nil, fmt.Errorf("failed to aggregate proofs %s, %w, input 1 %s, input 2 %s",
msg.GenAggregatedProofResponse.String(), ErrUnspecified, inputProof1, inputProof2)
case pb.Result_RESULT_OK:
return &msg.GenAggregatedProofResponse.Id, nil
case pb.Result_RESULT_ERROR:
return nil, fmt.Errorf("Failed to aggregate proofs %s, %w, input 1 %s, input 2 %s",
return nil, fmt.Errorf("failed to aggregate proofs %s, %w, input 1 %s, input 2 %s",
msg.GenAggregatedProofResponse.String(), ErrBadRequest, inputProof1, inputProof2)
case pb.Result_RESULT_INTERNAL_ERROR:
return nil, fmt.Errorf("Failed to aggregate proofs %s, %w, input 1 %s, input 2 %s",
return nil, fmt.Errorf("failed to aggregate proofs %s, %w, input 1 %s, input 2 %s",
msg.GenAggregatedProofResponse.String(), ErrProverInternalError, inputProof1, inputProof2)
default:
return nil, fmt.Errorf("Failed to aggregate proofs %s, %w, input 1 %s, input 2 %s",
return nil, fmt.Errorf("failed to aggregate proofs %s, %w, input 1 %s, input 2 %s",
msg.GenAggregatedProofResponse.String(), ErrUnknown, inputProof1, inputProof2)
}
}
Expand Down Expand Up @@ -195,18 +195,18 @@ func (p *Prover) FinalProof(inputProof string, aggregatorAddr string) (*string,
if msg, ok := res.Response.(*pb.ProverMessage_GenFinalProofResponse); ok {
switch msg.GenFinalProofResponse.Result {
case pb.Result_RESULT_UNSPECIFIED:
return nil, fmt.Errorf("Failed to generate final proof %s, %w, input %s",
return nil, fmt.Errorf("failed to generate final proof %s, %w, input %s",
msg.GenFinalProofResponse.String(), ErrUnspecified, inputProof)
case pb.Result_RESULT_OK:
return &msg.GenFinalProofResponse.Id, nil
case pb.Result_RESULT_ERROR:
return nil, fmt.Errorf("Failed to generate final proof %s, %w, input %s",
return nil, fmt.Errorf("failed to generate final proof %s, %w, input %s",
msg.GenFinalProofResponse.String(), ErrBadRequest, inputProof)
case pb.Result_RESULT_INTERNAL_ERROR:
return nil, fmt.Errorf("Failed to generate final proof %s, %w, input %s",
return nil, fmt.Errorf("failed to generate final proof %s, %w, input %s",
msg.GenFinalProofResponse.String(), ErrProverInternalError, inputProof)
default:
return nil, fmt.Errorf("Failed to generate final proof %s, %w, input %s",
return nil, fmt.Errorf("failed to generate final proof %s, %w, input %s",
msg.GenFinalProofResponse.String(), ErrUnknown, inputProof)
}
}
Expand All @@ -228,18 +228,18 @@ func (p *Prover) CancelProofRequest(proofID string) error {
if msg, ok := res.Response.(*pb.ProverMessage_CancelResponse); ok {
switch msg.CancelResponse.Result {
case pb.Result_RESULT_UNSPECIFIED:
return fmt.Errorf("Failed to cancel proof id [%s], %w, %s",
return fmt.Errorf("failed to cancel proof id [%s], %w, %s",
proofID, ErrUnspecified, msg.CancelResponse.String())
case pb.Result_RESULT_OK:
return nil
case pb.Result_RESULT_ERROR:
return fmt.Errorf("Failed to cancel proof id [%s], %w, %s",
return fmt.Errorf("failed to cancel proof id [%s], %w, %s",
proofID, ErrBadRequest, msg.CancelResponse.String())
case pb.Result_RESULT_INTERNAL_ERROR:
return fmt.Errorf("Failed to cancel proof id [%s], %w, %s",
return fmt.Errorf("failed to cancel proof id [%s], %w, %s",
proofID, ErrProverInternalError, msg.CancelResponse.String())
default:
return fmt.Errorf("Failed to cancel proof id [%s], %w, %s",
return fmt.Errorf("failed to cancel proof id [%s], %w, %s",
proofID, ErrUnknown, msg.CancelResponse.String())
}
}
Expand Down Expand Up @@ -297,24 +297,24 @@ func (p *Prover) waitProof(ctx context.Context, proofID string) (*pb.GetProofRes
time.Sleep(p.proofStatePollingInterval.Duration)
continue
case pb.GetProofResponse_RESULT_UNSPECIFIED:
return nil, fmt.Errorf("Failed to get proof ID: %s, %w, prover response: %s",
return nil, fmt.Errorf("failed to get proof ID: %s, %w, prover response: %s",
proofID, ErrUnspecified, msg.GetProofResponse.String())
case pb.GetProofResponse_RESULT_COMPLETED_OK:
return msg.GetProofResponse, nil
case pb.GetProofResponse_RESULT_ERROR:
return nil, fmt.Errorf("Failed to get proof with ID %s, %w, prover response: %s",
return nil, fmt.Errorf("failed to get proof with ID %s, %w, prover response: %s",
proofID, ErrBadRequest, msg.GetProofResponse.String())
case pb.GetProofResponse_RESULT_COMPLETED_ERROR:
return nil, fmt.Errorf("Failed to get proof with ID %s, %w, prover response: %s",
return nil, fmt.Errorf("failed to get proof with ID %s, %w, prover response: %s",
proofID, ErrProverCompletedError, msg.GetProofResponse.String())
case pb.GetProofResponse_RESULT_INTERNAL_ERROR:
return nil, fmt.Errorf("Failed to get proof ID: %s, %w, prover response: %s",
return nil, fmt.Errorf("failed to get proof ID: %s, %w, prover response: %s",
proofID, ErrProverInternalError, msg.GetProofResponse.String())
case pb.GetProofResponse_RESULT_CANCEL:
return nil, fmt.Errorf("Proof generation was cancelled for proof ID %s, %w, prover response: %s",
return nil, fmt.Errorf("proof generation was cancelled for proof ID %s, %w, prover response: %s",
proofID, ErrProofCanceled, msg.GetProofResponse.String())
default:
return nil, fmt.Errorf("Failed to get proof ID: %s, %w, prover response: %s",
return nil, fmt.Errorf("failed to get proof ID: %s, %w, prover response: %s",
proofID, ErrUnknown, msg.GetProofResponse.String())
}
}
Expand Down
2 changes: 1 addition & 1 deletion ci/e2e-group1/forced_batches_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func sendForcedBatch(t *testing.T, opsman *operations.Manager) (*state.Batch, er
log.Info("Transactions: ", common.Bytes2Hex(fb.Transactions))
fullBlock, err := ethClient.BlockByHash(ctx, vLog.BlockHash)
if err != nil {
log.Errorf("error getting hashParent. BlockNumber: %d. Error: %w", vLog.BlockNumber, err)
log.Errorf("error getting hashParent. BlockNumber: %d. Error: %v", vLog.BlockNumber, err)
return nil, err
}
log.Info("MinForcedTimestamp: ", fullBlock.Time())
Expand Down
2 changes: 1 addition & 1 deletion sequencer/closingsignalsmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (c *closingSignalsManager) checkForcedBatches() {
// Take into account L1 finality
lastBlock, err := c.dbManager.GetLastBlock(c.ctx, nil)
if err != nil {
log.Errorf("failed to get latest eth block number, err: %w", err)
log.Errorf("failed to get latest eth block number, err: %v", err)
continue
}

Expand Down
2 changes: 1 addition & 1 deletion sequencer/finalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func (f *finalizer) newWIPBatch(ctx context.Context) (*WipBatch, error) {
// backup current sequence
err = f.processTransaction(ctx, nil)
for err != nil {
log.Errorf("failed to process tx, err: %w", err)
log.Errorf("failed to process tx, err: %v", err)
err = f.processTransaction(ctx, nil)
}
}
Expand Down
6 changes: 3 additions & 3 deletions state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ func (s *State) ProcessAndStoreClosedBatch(
// Decode transactions
decodedTransactions, _, err := DecodeTxs(encodedTxs)
if err != nil && !errors.Is(err, InvalidData) {
log.Debugf("error decoding transactions: %w", err)
log.Debugf("error decoding transactions: %v", err)
return err
}

Expand Down Expand Up @@ -1481,10 +1481,10 @@ func (s *State) WaitSequencingTxToBeSynced(parentCtx context.Context, tx *types.
for {
virtualized, err := s.IsSequencingTXSynced(ctx, tx.Hash(), nil)
if err != nil && err != ErrNotFound {
log.Errorf("error waiting sequencing tx %s to be synced: %w", tx.Hash().String(), err)
log.Errorf("error waiting sequencing tx %s to be synced: %v", tx.Hash().String(), err)
return err
} else if ctx.Err() != nil {
log.Errorf("error waiting sequencing tx %s to be synced: %w", tx.Hash().String(), err)
log.Errorf("error waiting sequencing tx %s to be synced: %v", tx.Hash().String(), err)
return ctx.Err()
} else if virtualized {
break
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/forcedbatches_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func sendForcedBatch(t *testing.T, opsman *operations.Manager) (*state.Batch, er
log.Info("Transactions: ", common.Bytes2Hex(fb.Transactions))
fullBlock, err := ethClient.BlockByHash(ctx, vLog.BlockHash)
if err != nil {
log.Errorf("error getting hashParent. BlockNumber: %d. Error: %w", vLog.BlockNumber, err)
log.Errorf("error getting hashParent. BlockNumber: %d. Error: %v", vLog.BlockNumber, err)
return nil, err
}
log.Info("MinForcedTimestamp: ", fullBlock.Time())
Expand Down
2 changes: 1 addition & 1 deletion test/operations/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ func stopNode() error {
func runCmd(c *exec.Cmd) error {
dir, err := os.Getwd()
if err != nil {
log.Fatalf("failed to get current work directory: %w", err)
log.Fatalf("failed to get current work directory: %v", err)
}

if strings.Contains(dir, cmdFolder) {
Expand Down
2 changes: 1 addition & 1 deletion test/scripts/sendForcedBatch/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func sendForcedBatches(cliCtx *cli.Context) error {
log.Info("Transactions: ", common.Bytes2Hex(fb.Transactions))
fullBlock, err := ethClient.BlockByHash(ctx, vLog.BlockHash)
if err != nil {
log.Errorf("error getting hashParent. BlockNumber: %d. Error: %w", vLog.BlockNumber, err)
log.Errorf("error getting hashParent. BlockNumber: %d. Error: %v", vLog.BlockNumber, err)
return err
}
log.Info("MinForcedTimestamp: ", fullBlock.Time())
Expand Down
2 changes: 1 addition & 1 deletion tools/executor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func main() {
time.Sleep(time.Second * waitForDBSeconds)
cmd = exec.Command("docker-compose", "up", "-d", "executor-tool-prover")
if out, err := cmd.CombinedOutput(); err != nil {
log.Errorf("Failed to star prover: %w. %v", err, out)
log.Errorf("Failed to star prover: %v. %v", err, out)
return
}
log.Info("DONE starting DB and prover")
Expand Down