@@ -510,15 +510,18 @@ func (r *ccipChainReader) MsgsBetweenSeqNums(
510510 ctx context.Context , sourceChainSelector cciptypes.ChainSelector , seqNumRange cciptypes.SeqNumRange ,
511511) ([]cciptypes.Message , error ) {
512512 lggr := logutil .WithContextValues (ctx , r .lggr )
513- if err := validateReaderExistence (r .contractReaders , sourceChainSelector ); err != nil {
513+
514+ if err := validateAccessorExistence (r .accessors , sourceChainSelector ); err != nil {
514515 return nil , err
515516 }
516-
517- onRampAddress , err := r .GetContractAddress (consts .ContractNameOnRamp , sourceChainSelector )
517+ onRampAddress , err := r .accessors [sourceChainSelector ].GetContractAddress (consts .ContractNameOnRamp )
518518 if err != nil {
519519 return nil , fmt .Errorf ("get onRamp address: %w" , err )
520520 }
521521
522+ if err := validateReaderExistence (r .contractReaders , sourceChainSelector ); err != nil {
523+ return nil , err
524+ }
522525 seq , err := r .contractReaders [sourceChainSelector ].ExtendedQueryKey (
523526 ctx ,
524527 consts .ContractNameOnRamp ,
@@ -557,7 +560,7 @@ func (r *ccipChainReader) MsgsBetweenSeqNums(
557560 return nil , fmt .Errorf ("failed to query onRamp: %w" , err )
558561 }
559562
560- onRampAddressAfterQuery , err := r .GetContractAddress (consts .ContractNameOnRamp , sourceChainSelector )
563+ onRampAddressAfterQuery , err := r .accessors [ sourceChainSelector ]. GetContractAddress (consts .ContractNameOnRamp )
561564 if err != nil {
562565 return nil , fmt .Errorf ("get onRamp address after query: %w" , err )
563566 }
@@ -1126,7 +1129,11 @@ func (r *ccipChainReader) GetRMNRemoteConfig(ctx context.Context) (cciptypes.Rem
11261129
11271130 // RMNRemote address stored in the offramp static config is actually the proxy contract address.
11281131 // Here we will get the RMNRemote address from the proxy contract by calling the RMNProxy contract.
1129- proxyContractAddress , err := r .GetContractAddress (consts .ContractNameRMNRemote , r .destChain )
1132+ destChainAccessor := r .accessors [r .destChain ]
1133+ if destChainAccessor == nil {
1134+ return cciptypes.RemoteConfig {}, fmt .Errorf ("chain accessor not found for dest chain %d" , r .destChain )
1135+ }
1136+ proxyContractAddress , err := destChainAccessor .GetContractAddress (consts .ContractNameRMNRemote )
11301137 if err != nil {
11311138 return cciptypes.RemoteConfig {}, fmt .Errorf ("get RMNRemote proxy contract address: %w" , err )
11321139 }
@@ -1380,6 +1387,7 @@ func (r *ccipChainReader) Sync(ctx context.Context, contracts ContractAddresses)
13801387 return errors .Join (errs ... )
13811388}
13821389
1390+ // TODO(NONEVM-1865): remove this function once from CCIPReader interface once CAL migration is complete.
13831391func (r * ccipChainReader ) GetContractAddress (contractName string , chain cciptypes.ChainSelector ) ([]byte , error ) {
13841392 return r .donAddressBook .GetContractAddress (addressbook .ContractName (contractName ), chain )
13851393}
0 commit comments