Skip to content

Commit

Permalink
remove repeated fields information from log message; Devops team woul…
Browse files Browse the repository at this point in the history
…d configure Datadog to show the fields
  • Loading branch information
ws4charlie committed Aug 5, 2024
1 parent 9c637f1 commit d659e5a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
16 changes: 6 additions & 10 deletions zetaclient/chains/evm/signer/outbound_tracker_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ func (signer *Signer) reportToOutboundTracker(
// set being reported flag to avoid duplicate reporting
alreadySet := signer.SetBeingReportedFlag(outboundHash)
if alreadySet {
logger.Info().
Msgf("outbound %s for chain %d nonce %d is being reported", outboundHash, chainID, nonce)
logger.Info().Msg("outbound is being reported to tracker")
return

Check warning on line 37 in zetaclient/chains/evm/signer/outbound_tracker_reporter.go

View check run for this annotation

Codecov / codecov/patch

zetaclient/chains/evm/signer/outbound_tracker_reporter.go#L36-L37

Added lines #L36 - L37 were not covered by tests
}

Expand All @@ -54,16 +53,14 @@ func (signer *Signer) reportToOutboundTracker(
// 1. the gas stability pool should have kicked in and replaced the tx by then.
// 2. even if there is a chance that the tx is included later, most likely it's going to be a false tx hash (either replaced or dropped).
if time.Since(tStart) > evm.OutboundInclusionTimeout {
logger.Info().
Msgf("timeout waiting outbound %s inclusion for chain %d nonce %d", outboundHash, chainID, nonce)
logger.Info().Msgf("timeout waiting outbound inclusion")
return

Check warning on line 57 in zetaclient/chains/evm/signer/outbound_tracker_reporter.go

View check run for this annotation

Codecov / codecov/patch

zetaclient/chains/evm/signer/outbound_tracker_reporter.go#L56-L57

Added lines #L56 - L57 were not covered by tests
}

// check tx confirmation status
confirmed, err := rpc.IsTxConfirmed(ctx, signer.client, outboundHash, evm.ReorgProtectBlockCount)
if err != nil {
logger.Err(err).
Msgf("unable to check confirmation status for chain %d nonce %d outbound %s", chainID, nonce, outboundHash)
logger.Err(err).Msg("unable to check confirmation status of outbound")

Check warning on line 63 in zetaclient/chains/evm/signer/outbound_tracker_reporter.go

View check run for this annotation

Codecov / codecov/patch

zetaclient/chains/evm/signer/outbound_tracker_reporter.go#L61-L63

Added lines #L61 - L63 were not covered by tests
}
if !confirmed {
continue

Check warning on line 66 in zetaclient/chains/evm/signer/outbound_tracker_reporter.go

View check run for this annotation

Codecov / codecov/patch

zetaclient/chains/evm/signer/outbound_tracker_reporter.go#L65-L66

Added lines #L65 - L66 were not covered by tests
Expand All @@ -72,13 +69,12 @@ func (signer *Signer) reportToOutboundTracker(
// report outbound hash to tracker
zetaHash, err := zetacoreClient.AddOutboundTracker(ctx, chainID, nonce, outboundHash, nil, "", -1)
if err != nil {
logger.Err(err).
Msgf("error adding outbound %s to tracker for chain %d nonce %d", outboundHash, chainID, nonce)
logger.Err(err).Msg("error adding outbound to tracker")
} else if zetaHash != "" {
logger.Info().Msgf("added outbound %s to tracker for chain %d nonce %d; zeta txhash %s", outboundHash, chainID, nonce, zetaHash)
logger.Info().Msgf("added outbound to tracker; zeta txhash %s", zetaHash)
} else {

Check warning on line 75 in zetaclient/chains/evm/signer/outbound_tracker_reporter.go

View check run for this annotation

Codecov / codecov/patch

zetaclient/chains/evm/signer/outbound_tracker_reporter.go#L70-L75

Added lines #L70 - L75 were not covered by tests
// exit goroutine until the tracker contains the hash (reported by either this or other signers)
logger.Info().Msgf("outbound %s now exists in tracker for chain %d nonce %d", outboundHash, chainID, nonce)
logger.Info().Msg("outbound now exists in tracker")
return

Check warning on line 78 in zetaclient/chains/evm/signer/outbound_tracker_reporter.go

View check run for this annotation

Codecov / codecov/patch

zetaclient/chains/evm/signer/outbound_tracker_reporter.go#L77-L78

Added lines #L77 - L78 were not covered by tests
}
}
Expand Down
17 changes: 6 additions & 11 deletions zetaclient/chains/solana/signer/outbound_tracker_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ func (signer *Signer) reportToOutboundTracker(
// set being reported flag to avoid duplicate reporting
alreadySet := signer.Signer.SetBeingReportedFlag(txSig.String())
if alreadySet {
logger.Info().
Msgf("outbound %s for chain %d nonce %d is being reported", txSig, chainID, nonce)
logger.Info().Msg("outbound is being reported to tracker")

Check warning on line 42 in zetaclient/chains/solana/signer/outbound_tracker_reporter.go

View check run for this annotation

Codecov / codecov/patch

zetaclient/chains/solana/signer/outbound_tracker_reporter.go#L42

Added line #L42 was not covered by tests
return
}

Expand All @@ -57,8 +56,7 @@ func (signer *Signer) reportToOutboundTracker(

// give up if we know the tx is too old and already expired
if time.Since(start) > SolanaTransactionTimeout {
logger.Info().
Msgf("outbound %s expired for chain %d nonce %d", txSig, chainID, nonce)
logger.Info().Msg("outbound is expired")

Check warning on line 59 in zetaclient/chains/solana/signer/outbound_tracker_reporter.go

View check run for this annotation

Codecov / codecov/patch

zetaclient/chains/solana/signer/outbound_tracker_reporter.go#L59

Added line #L59 was not covered by tests
return
}

Expand All @@ -77,22 +75,19 @@ func (signer *Signer) reportToOutboundTracker(
// unlike Ethereum, Solana doesn't have protocol-level nonce; the nonce is enforced by the gateway program.
// a failed outbound (e.g. signature err, balance err) will never be able to increment the gateway program nonce.
// a good/valid candidate of outbound tracker hash must come with a successful tx.
logger.Warn().
Any("Err", tx.Meta.Err).
Msgf("outbound %s failed for chain %d nonce %d", txSig, chainID, nonce)
logger.Warn().Any("Err", tx.Meta.Err).Msg("outbound is failed")

Check warning on line 78 in zetaclient/chains/solana/signer/outbound_tracker_reporter.go

View check run for this annotation

Codecov / codecov/patch

zetaclient/chains/solana/signer/outbound_tracker_reporter.go#L78

Added line #L78 was not covered by tests
return
}

// report outbound hash to zetacore
zetaHash, err := zetacoreClient.AddOutboundTracker(ctx, chainID, nonce, txSig.String(), nil, "", -1)
if err != nil {
logger.Err(err).
Msgf("error adding outbound %s for chain %d nonce %d", txSig, chainID, nonce)
logger.Err(err).Msg("error adding outbound to tracker")

Check warning on line 85 in zetaclient/chains/solana/signer/outbound_tracker_reporter.go

View check run for this annotation

Codecov / codecov/patch

zetaclient/chains/solana/signer/outbound_tracker_reporter.go#L85

Added line #L85 was not covered by tests
} else if zetaHash != "" {
logger.Info().Msgf("added outbound %s for chain %d nonce %d; zeta txhash %s", txSig, chainID, nonce, zetaHash)
logger.Info().Msgf("added outbound to tracker; zeta txhash %s", zetaHash)

Check warning on line 87 in zetaclient/chains/solana/signer/outbound_tracker_reporter.go

View check run for this annotation

Codecov / codecov/patch

zetaclient/chains/solana/signer/outbound_tracker_reporter.go#L87

Added line #L87 was not covered by tests
} else {
// exit goroutine until the tracker contains the hash (reported by either this or other signers)
logger.Info().Msgf("outbound %s now exists in tracker for chain %d nonce %d", txSig, chainID, nonce)
logger.Info().Msg("outbound now exists in tracker")

Check warning on line 90 in zetaclient/chains/solana/signer/outbound_tracker_reporter.go

View check run for this annotation

Codecov / codecov/patch

zetaclient/chains/solana/signer/outbound_tracker_reporter.go#L90

Added line #L90 was not covered by tests
return
}
}
Expand Down

0 comments on commit d659e5a

Please sign in to comment.