@@ -671,6 +671,7 @@ func (r *ccipChainReader) discoverOffRampContracts(
671
671
}
672
672
673
673
// Add static config contracts
674
+ lggr .Debugw ("checking offramp static config contracts" )
674
675
if len (config .Offramp .StaticConfig .RmnRemote ) > 0 {
675
676
lggr .Infow ("appending RMN remote contract address" ,
676
677
"address" , hex .EncodeToString (config .Offramp .StaticConfig .RmnRemote ),
@@ -679,6 +680,9 @@ func (r *ccipChainReader) discoverOffRampContracts(
679
680
}
680
681
681
682
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 )
682
686
resp = resp .Append (consts .ContractNameNonceManager , r .destChain , config .Offramp .StaticConfig .NonceManager )
683
687
}
684
688
@@ -690,6 +694,7 @@ func (r *ccipChainReader) discoverOffRampContracts(
690
694
resp = resp .Append (consts .ContractNameFeeQuoter , r .destChain , config .Offramp .DynamicConfig .FeeQuoter )
691
695
}
692
696
697
+ lggr .Debugw ("returning discovered contracts" , "contracts" , resp )
693
698
return resp , nil
694
699
}
695
700
@@ -699,14 +704,21 @@ func (r *ccipChainReader) DiscoverContracts(ctx context.Context,
699
704
var resp ContractAddresses
700
705
var err error
701
706
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 )
702
710
703
711
if slices .Contains (supportedChains , r .destChain ) {
712
+ lggr .Debugw ("dest chain is supported, calling discoverOffRampContracts" )
704
713
resp , err = r .discoverOffRampContracts (ctx , lggr , allChains )
705
714
// Can't continue with discovery if the destination chain is not available.
706
715
// We read source chains OnRamps from there, and onRamps are essential for feeQuoter and Router discovery.
707
716
if err != nil {
717
+ lggr .Debugw ("failed to discover destination contracts" , "err" , err )
708
718
return nil , fmt .Errorf ("discover destination contracts: %w" , err )
709
719
}
720
+ } else {
721
+ lggr .Debugw ("dest chain is not supported, skipping discoverOffRampContracts" )
710
722
}
711
723
712
724
// The following calls are on dynamically configured chains which may not
@@ -744,32 +756,46 @@ func (r *ccipChainReader) DiscoverContracts(ctx context.Context,
744
756
"err" , err )
745
757
return
746
758
}
759
+ lggr .Debugw ("got chain config for chainSel" , "chainSel" , chainSel , "config" , config )
747
760
748
761
// Use mutex to safely update the shared resp
749
762
mu .Lock ()
750
763
defer mu .Unlock ()
751
764
752
765
// Add FeeQuoter from dynamic config
753
766
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 ))
754
769
resp = resp .Append (
755
770
consts .ContractNameFeeQuoter ,
756
771
chainSel ,
757
772
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 ))
758
777
}
759
778
760
779
// Add Router from dest chain config
761
780
if ! cciptypes .UnknownAddress (config .OnRamp .DestChainConfig .Router ).IsZeroOrEmpty () {
781
+ lggr .Debugw ("appending router contract address" ,
782
+ "address" , hex .EncodeToString (config .OnRamp .DestChainConfig .Router ))
762
783
resp = resp .Append (
763
784
consts .ContractNameRouter ,
764
785
chainSel ,
765
786
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 ))
766
791
}
767
792
}(chainCopy )
768
793
}
769
794
770
795
// Wait for all goroutines to complete
771
796
wg .Wait ()
772
797
798
+ lggr .Debugw ("returning discovered contracts" , "contracts" , resp )
773
799
return resp , nil
774
800
}
775
801
0 commit comments