Skip to content

Commit

Permalink
follow up the chain selector refactor for CCIP plugin, fix potential …
Browse files Browse the repository at this point in the history
…bug in CR/CW config (#15482)

* fix chain family logic

* add changeset
  • Loading branch information
huangzhen1997 authored Dec 5, 2024
1 parent a0d9eb5 commit 35c2f05
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/breezy-kings-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

Potential bug introduced from chain selector refactor, not causing issue now since only EVM is used, but need to fix #bugfix
10 changes: 5 additions & 5 deletions core/capabilities/ccip/oraclecreator/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func (i *pluginOracleCreator) createReadersAndWriters(
pluginType cctypes.PluginType,
config cctypes.OCR3ConfigWithMeta,
publicCfg ocr3confighelper.PublicConfig,
chainFamily string,
destChainFamily string,
) (
map[cciptypes.ChainSelector]types.ContractReader,
map[cciptypes.ChainSelector]types.ContractWriter,
Expand Down Expand Up @@ -328,8 +328,8 @@ func (i *pluginOracleCreator) createReadersAndWriters(
chainWriters := make(map[cciptypes.ChainSelector]types.ContractWriter)
for relayID, relayer := range i.relayers {
chainID := relayID.ChainID

chainSelector, err1 := i.getChainSelector(chainID, chainFamily)
relayChainFamily := relayID.Network
chainSelector, err1 := i.getChainSelector(chainID, relayChainFamily)
if err1 != nil {
return nil, nil, fmt.Errorf("failed to get chain selector from chain ID %s: %w", chainID, err1)
}
Expand All @@ -344,7 +344,7 @@ func (i *pluginOracleCreator) createReadersAndWriters(
return nil, nil, err1
}

if chainID == destChainID {
if chainID == destChainID && destChainFamily == relayChainFamily {
offrampAddressHex := common.BytesToAddress(config.Config.OfframpAddress).Hex()
err2 := cr.Bind(ctx, []types.BoundContract{
{
Expand All @@ -367,7 +367,7 @@ func (i *pluginOracleCreator) createReadersAndWriters(
relayer,
i.transmitters,
execBatchGasLimit,
chainFamily)
relayChainFamily)
if err1 != nil {
return nil, nil, err1
}
Expand Down

0 comments on commit 35c2f05

Please sign in to comment.