Skip to content

Commit

Permalink
logs (#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
ARR552 authored Jun 19, 2023
1 parent 4850f3c commit 59c1ba7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ to interact with the [bridge smart contract](https://github.com/0xPolygonHermez/

## Running the bridge service

- [Running localy](docs/running_local.md)
- [Running locally](docs/running_local.md)

24 changes: 12 additions & 12 deletions claimtxman/claimtxman.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (tm *ClaimTxManager) processDepositStatus(ger *etherman.GlobalExitRoot, dbT
return err
}
if len(claimHash) > 0 || deposit.LeafType == LeafTypeMessage {
log.Info("Ignoring deposit: %d, leafType: %d, claimHash: %s", deposit.DepositCount, deposit.LeafType, claimHash)
log.Infof("Ignoring deposit: %d, leafType: %d, claimHash: %s", deposit.DepositCount, deposit.LeafType, claimHash)
continue
}
log.Infof("create the claim tx for the deposit %d", deposit.DepositCount)
Expand All @@ -165,11 +165,11 @@ func (tm *ClaimTxManager) processDepositStatus(ger *etherman.GlobalExitRoot, dbT
}}, 1, 1, 1,
tm.auth)
if err != nil {
log.Error("error BuildSendClaim tx for deposit %d. Error: %v", deposit.DepositCount, err)
log.Errorf("error BuildSendClaim tx for deposit %d. Error: %v", deposit.DepositCount, err)
return err
}
if err = tm.addClaimTx(deposit.DepositCount, deposit.BlockID, tm.auth.From, tx.To(), nil, tx.Data(), dbTx); err != nil {
log.Error("error adding claim tx for deposit %d. Error: %v", deposit.DepositCount, err)
log.Errorf("error adding claim tx for deposit %d. Error: %v", deposit.DepositCount, err)
return err
}
}
Expand Down Expand Up @@ -201,7 +201,7 @@ func (tm *ClaimTxManager) addClaimTx(depositCount uint, blockID uint64, from com
}
gas, err := tm.l2Node.EstimateGas(tm.ctx, tx)
for i := 0; err != nil && !errors.Is(err, runtime.ErrExecutionReverted) && i < maxRetries; i++ {
log.Warn("error while doing gas estimation. Retrying... Error: %v, Data: %s", err, common.Bytes2Hex(data))
log.Warnf("error while doing gas estimation. Retrying... Error: %v, Data: %s", err, common.Bytes2Hex(data))
time.Sleep(1 * time.Second)
gas, err = tm.l2Node.EstimateGas(tm.ctx, tx)
}
Expand All @@ -212,8 +212,8 @@ func (tm *ClaimTxManager) addClaimTx(depositCount uint, blockID uint64, from com
// get next nonce
nonce, err := tm.getNextNonce(from)
if err != nil {
err := fmt.Errorf("failed to get current nonce: %w", err)
log.Errorf(err.Error())
err := fmt.Errorf("failed to get current nonce: %v", err)
log.Errorf("error getting next nonce. Error: %s", err.Error())
return err
}

Expand All @@ -227,8 +227,8 @@ func (tm *ClaimTxManager) addClaimTx(depositCount uint, blockID uint64, from com
// add to storage
err = tm.storage.AddClaimTx(tm.ctx, mTx, dbTx)
if err != nil {
err := fmt.Errorf("failed to add tx to get monitored: %w", err)
log.Errorf(err.Error())
err := fmt.Errorf("failed to add tx to get monitored: %v", err)
log.Errorf("error adding claim tx to db. Error: %s", err.Error())
return err
}

Expand Down Expand Up @@ -275,7 +275,7 @@ func (tm *ClaimTxManager) monitorTxs(ctx context.Context) error {
// check if the tx is in the pending pool
_, _, err = tm.l2Node.TransactionByHash(ctx, txHash)
if errors.Is(err, ethereum.NotFound) {
mTxLog.Errorf("tx %v was not found in the pending pool", txHash.String())
mTxLog.Errorf("tx %s was not found in the pending pool", txHash.String())
hasFailedReceipts = true
continue
} else if err != nil {
Expand All @@ -289,7 +289,7 @@ func (tm *ClaimTxManager) monitorTxs(ctx context.Context) error {

// if the tx was mined successfully we can break the loop and proceed
if receipt.Status == types.ReceiptStatusSuccessful {
mTxLog.Infof("tx %v was mined successfully", txHash.String())
mTxLog.Infof("tx %s was mined successfully", txHash.String())
receiptSuccessful = true
block, err := tm.l2Node.BlockByNumber(ctx, receipt.BlockNumber)
if err != nil {
Expand Down Expand Up @@ -450,13 +450,13 @@ func (tm *ClaimTxManager) ReviewMonitoredTx(ctx context.Context, mTx *ctmtypes.M
}
gas, err := tm.l2Node.EstimateGas(ctx, tx)
for i := 0; err != nil && !errors.Is(err, runtime.ErrExecutionReverted) && i < maxRetries; i++ {
mTxLog.Warn("error while doing gas estimation. Retrying... Error: %v, Data: %s", err, common.Bytes2Hex(tx.Data))
mTxLog.Warnf("error while doing gas estimation. Retrying... Error: %v, Data: %s", err, common.Bytes2Hex(tx.Data))
time.Sleep(1 * time.Second)
gas, err = tm.l2Node.EstimateGas(tm.ctx, tx)
}
if err != nil {
err := fmt.Errorf("failed to estimate gas. Error: %v, Data: %s", err, common.Bytes2Hex(tx.Data))
mTxLog.Errorf(err.Error())
mTxLog.Errorf("error: %s", err.Error())
return err
}

Expand Down
2 changes: 1 addition & 1 deletion docs/running_local.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This documentation will help you running the following components:

## Requirements

The current version of the environment requires `go`, `docker` and `docker-compose` to be previously installed, check the links bellow to understand how to install them:
The current version of the environment requires `go`, `docker` and `docker-compose` to be previously installed, check the links below to understand how to install them:

- <https://go.dev/doc/install>
- <https://www.docker.com/get-started>
Expand Down

0 comments on commit 59c1ba7

Please sign in to comment.