From 3aadcf78f1aa8daaafd03bd9eb1a60874c9af025 Mon Sep 17 00:00:00 2001 From: Will Winder Date: Fri, 20 Dec 2024 14:53:07 -0500 Subject: [PATCH] Check for nil maps in token data attestation fetcher. --- execute/tokendata/usdc/usdc.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/execute/tokendata/usdc/usdc.go b/execute/tokendata/usdc/usdc.go index 156df20ac..914857bf4 100644 --- a/execute/tokendata/usdc/usdc.go +++ b/execute/tokendata/usdc/usdc.go @@ -160,6 +160,12 @@ func (u *TokenDataObserver) extractTokenData( messages exectypes.MessageObservations, attestations map[cciptypes.ChainSelector]map[reader.MessageTokenID]AttestationStatus, ) (exectypes.TokenDataObservations, error) { + if attestations == nil { + // TODO: is this an error? + u.lggr.Warnw("extractTokenData given a nil attestations map.") + return exectypes.TokenDataObservations{}, nil + } + tokenObservations := make(exectypes.TokenDataObservations) for chainSelector, chainMessages := range messages { @@ -194,6 +200,11 @@ func (u *TokenDataObserver) attestationToTokenData( tokenIndex int, attestations map[reader.MessageTokenID]AttestationStatus, ) exectypes.TokenData { + if attestations == nil { + // TODO: is this an error? + u.lggr.Warnw("attestationToTokenData given a nil attestations map.") + return exectypes.NewErrorTokenData(fmt.Errorf("missing token status")) + } status, ok := attestations[reader.NewMessageTokenID(seqNr, tokenIndex)] if !ok { return exectypes.NewErrorTokenData(ErrDataMissing)