Skip to content

Commit 1cd1aa5

Browse files
committed
more logs
1 parent 813f082 commit 1cd1aa5

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

pkg/chainaccessor/default_accessor.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ func (l *DefaultAccessor) GetAllConfigsLegacy(
125125
"destChainSelector", destChainSelector,
126126
"sourceChainSelectors", sourceChainSelectors,
127127
"numSourceChainConfigs", len(sourceChainConfigs),
128+
"standardConfigs", standardConfigs,
129+
"sourceChainConfigs", sourceChainConfigs,
128130
)
129131
return standardConfigs, sourceChainConfigs, nil
130132
}

pkg/reader/ccip.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,7 @@ func (r *ccipChainReader) discoverOffRampContracts(
671671
}
672672

673673
// Add static config contracts
674+
lggr.Debugw("checking offramp static config contracts")
674675
if len(config.Offramp.StaticConfig.RmnRemote) > 0 {
675676
lggr.Infow("appending RMN remote contract address",
676677
"address", hex.EncodeToString(config.Offramp.StaticConfig.RmnRemote),
@@ -679,6 +680,9 @@ func (r *ccipChainReader) discoverOffRampContracts(
679680
}
680681

681682
if len(config.Offramp.StaticConfig.NonceManager) > 0 {
683+
lggr.Infow("appending nonce manager contract address",
684+
"address", hex.EncodeToString(config.Offramp.StaticConfig.NonceManager),
685+
"chain", r.destChain)
682686
resp = resp.Append(consts.ContractNameNonceManager, r.destChain, config.Offramp.StaticConfig.NonceManager)
683687
}
684688

@@ -690,6 +694,7 @@ func (r *ccipChainReader) discoverOffRampContracts(
690694
resp = resp.Append(consts.ContractNameFeeQuoter, r.destChain, config.Offramp.DynamicConfig.FeeQuoter)
691695
}
692696

697+
lggr.Debugw("returning discovered contracts", "contracts", resp)
693698
return resp, nil
694699
}
695700

@@ -699,14 +704,21 @@ func (r *ccipChainReader) DiscoverContracts(ctx context.Context,
699704
var resp ContractAddresses
700705
var err error
701706
lggr := logutil.WithContextValues(ctx, r.lggr)
707+
lggr = logger.With(lggr, "function", "DiscoverContracts",
708+
"destChain", r.destChain, "offRamp", r.offrampAddress,
709+
"supportedChains", supportedChains, "allChains", allChains)
702710

703711
if slices.Contains(supportedChains, r.destChain) {
712+
lggr.Debugw("dest chain is supported, calling discoverOffRampContracts")
704713
resp, err = r.discoverOffRampContracts(ctx, lggr, allChains)
705714
// Can't continue with discovery if the destination chain is not available.
706715
// We read source chains OnRamps from there, and onRamps are essential for feeQuoter and Router discovery.
707716
if err != nil {
717+
lggr.Debugw("failed to discover destination contracts", "err", err)
708718
return nil, fmt.Errorf("discover destination contracts: %w", err)
709719
}
720+
} else {
721+
lggr.Debugw("dest chain is not supported, skipping discoverOffRampContracts")
710722
}
711723

712724
// The following calls are on dynamically configured chains which may not
@@ -744,32 +756,46 @@ func (r *ccipChainReader) DiscoverContracts(ctx context.Context,
744756
"err", err)
745757
return
746758
}
759+
lggr.Debugw("got chain config for chainSel", "chainSel", chainSel, "config", config)
747760

748761
// Use mutex to safely update the shared resp
749762
mu.Lock()
750763
defer mu.Unlock()
751764

752765
// Add FeeQuoter from dynamic config
753766
if !cciptypes.UnknownAddress(config.OnRamp.DynamicConfig.DynamicConfig.FeeQuoter).IsZeroOrEmpty() {
767+
lggr.Debugw("appending fee quoter contract address",
768+
"address", hex.EncodeToString(config.OnRamp.DynamicConfig.DynamicConfig.FeeQuoter))
754769
resp = resp.Append(
755770
consts.ContractNameFeeQuoter,
756771
chainSel,
757772
config.OnRamp.DynamicConfig.DynamicConfig.FeeQuoter)
773+
} else {
774+
lggr.Warnw("FeeQuoter address is zero or empty. Ignore for disabled chains otherwise "+
775+
"check for onRamp misconfiguration", "chain", chainSel,
776+
"address", hex.EncodeToString(config.OnRamp.DynamicConfig.DynamicConfig.FeeQuoter))
758777
}
759778

760779
// Add Router from dest chain config
761780
if !cciptypes.UnknownAddress(config.OnRamp.DestChainConfig.Router).IsZeroOrEmpty() {
781+
lggr.Debugw("appending router contract address",
782+
"address", hex.EncodeToString(config.OnRamp.DestChainConfig.Router))
762783
resp = resp.Append(
763784
consts.ContractNameRouter,
764785
chainSel,
765786
config.OnRamp.DestChainConfig.Router)
787+
} else {
788+
lggr.Warnw("Router address is zero or empty. Ignore for disabled chains otherwise "+
789+
"check for onRamp misconfiguration", "chain", chainSel,
790+
"address", hex.EncodeToString(config.OnRamp.DestChainConfig.Router))
766791
}
767792
}(chainCopy)
768793
}
769794

770795
// Wait for all goroutines to complete
771796
wg.Wait()
772797

798+
lggr.Debugw("returning discovered contracts", "contracts", resp)
773799
return resp, nil
774800
}
775801

pkg/reader/config_poller_v2.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,18 @@ func (c *configPollerV2) GetChainConfig(
165165
ctx context.Context,
166166
chainSel cciptypes.ChainSelector,
167167
) (cciptypes.ChainConfigSnapshot, error) {
168+
lggr := logger.With(c.lggr, "function", "config_poller_v2 GetChainConfig", "chain", chainSel, "destChain", c.destChainSelector)
169+
168170
// Confirm we have an accessor for this chain
169171
_, err := getChainAccessor(c.chainAccessors, chainSel)
170172
if err != nil {
171-
c.lggr.Errorw("No chain accessor for chain", "chain", chainSel, "error", err)
173+
lggr.Errorw("No chain accessor for chain", "chain", chainSel, "error", err)
172174
return cciptypes.ChainConfigSnapshot{}, fmt.Errorf("no chain accessor for %s: %w", chainSel, err)
173175
}
174176

175177
cache := c.getOrCreateChainCache(chainSel)
176178
if cache == nil {
179+
lggr.Debugw("failed to get or create chain cache for chain")
177180
return cciptypes.ChainConfigSnapshot{},
178181
fmt.Errorf("failed to get or create chain cache for chain %s", chainSel)
179182
}
@@ -182,23 +185,26 @@ func (c *configPollerV2) GetChainConfig(
182185
cache.chainConfigMu.RLock()
183186
if !cache.chainConfigRefresh.IsZero() {
184187
defer cache.chainConfigMu.RUnlock()
185-
c.lggr.Debugw("Returning cached chain config",
188+
lggr.Debugw("Returning cached chain config",
186189
"chain", chainSel,
187-
"cacheAge", time.Since(cache.chainConfigRefresh))
190+
"cacheAge", time.Since(cache.chainConfigRefresh),
191+
"cachedChainConfigSnapshot", cache.chainConfigData)
188192
return cache.chainConfigData, nil
189193
}
190194
cache.chainConfigMu.RUnlock()
191195

192196
// Cache miss: batch fetch all configs for this chain. Don't hold the lock while fetching.
193197
// TODO: alternatively, if we want to prevent multiple goroutines from fetching the same chain config (especially
194198
// during node startup), we could block on this fetch if the cache is empty.
199+
lggr.Debugw("Cache miss - fetching chain config via batch refresh")
195200
if err := c.batchRefreshChainAndSourceConfigs(ctx, chainSel); err != nil {
196201
return cciptypes.ChainConfigSnapshot{}, err
197202
}
198203

199204
// Re-acquire read lock to return the data
200205
cache.chainConfigMu.RLock()
201206
defer cache.chainConfigMu.RUnlock()
207+
lggr.Debugw("Returning freshly fetched chain config after cache miss", "freshlyFetchedChainConfigSnapshot", cache.chainConfigData)
202208
return cache.chainConfigData, nil
203209
}
204210

0 commit comments

Comments
 (0)