diff --git a/core/services/ocr2/plugins/ccip/internal/ccipdata/usdc_reader.go b/core/services/ocr2/plugins/ccip/internal/ccipdata/usdc_reader.go index 12345b8fc1..a8db431117 100644 --- a/core/services/ocr2/plugins/ccip/internal/ccipdata/usdc_reader.go +++ b/core/services/ocr2/plugins/ccip/internal/ccipdata/usdc_reader.go @@ -16,6 +16,12 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/abihelpers" ) +var ( + // shortLivedInMemLogsCacheExpiration is used for the short lived in meme logs cache. Value should not be set + // to a very high value as it is used to prevent frequent log fetching (e.g. in caller's a loop). + shortLivedInMemLogsCacheExpiration = 20 * time.Second +) + const ( MESSAGE_SENT_FILTER_NAME = "USDC message sent" ) @@ -80,7 +86,7 @@ func (u *USDCReaderImpl) GetUSDCMessagePriorToLogIndexInTx(ctx context.Context, var lpLogs []logpoller.Log // fetch all the usdc logs for the provided tx hash - k := fmt.Sprintf("getUsdcMsgPriorToLogIdx-%s", txHash) + k := fmt.Sprintf("usdc-%s", txHash) // custom prefix to avoid key collision if someone re-uses the cache if rawLogs, foundInMem := u.shortLivedInMemLogs.Get(k); foundInMem { inMemLogs, ok := rawLogs.([]logpoller.Log) if !ok { @@ -143,7 +149,7 @@ func NewUSDCReader(lggr logger.Logger, jobID string, transmitter common.Address, Retention: CommitExecLogsRetention, }, transmitterAddress: transmitter, - shortLivedInMemLogs: cache.New(20*time.Second, time.Minute), + shortLivedInMemLogs: cache.New(shortLivedInMemLogsCacheExpiration, 2*shortLivedInMemLogsCacheExpiration), } if registerFilters { diff --git a/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go b/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go index aa7a22618d..fe3a86d2af 100644 --- a/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go +++ b/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go @@ -197,8 +197,9 @@ func (s *TokenDataReader) ReadTokenData(ctx context.Context, msg cciptypes.EVM2E return []byte{}, errors.Wrap(err, "failed calling usdc attestation API ") } - s.lggr.Infow("Got response from attestation API", "messageBodyHash", msgBody, "messageID", msgID, - "ar.status", attestationResp.Status, "ar.attestation", attestationResp.Attestation, "ar.error", attestationResp.Error) + s.lggr.Infow("Got response from attestation API", "messageID", msgID, + "attestationStatus", attestationResp.Status, "attestation", attestationResp.Attestation, + "attestationError", attestationResp.Error) switch attestationResp.Status { case attestationStatusSuccess: