From 58c3eb6cc400b3ed770d918c160c6d321df9f6ce Mon Sep 17 00:00:00 2001 From: jlaveracll Date: Fri, 15 Nov 2024 13:24:44 -0300 Subject: [PATCH 01/10] Update address book to support nonevm --- core/capabilities/ccip/delegate.go | 2 ++ core/capabilities/ccip/oraclecreator/bootstrap.go | 2 ++ core/capabilities/ccip/oraclecreator/plugin.go | 3 +++ core/services/ocr2/delegate.go | 3 +++ .../services/ocr2/plugins/ccip/config/chain_config.go | 3 +++ core/services/relay/evm/evm.go | 1 + core/services/relay/evm/write_target.go | 1 + deployment/address_book.go | 8 ++++---- deployment/ccip/propose.go | 2 ++ deployment/ccip/state.go | 2 ++ deployment/common/view/nops.go | 2 ++ deployment/environment.go | 1 + deployment/environment/devenv/chain.go | 1 + deployment/environment/devenv/don.go | 1 + deployment/environment/memory/environment.go | 1 + deployment/environment/memory/node.go | 1 + .../keystone/changeset/update_node_capabilities.go | 1 + deployment/keystone/changeset/view.go | 2 ++ deployment/keystone/deploy.go | 1 + deployment/keystone/types.go | 2 ++ integration-tests/ccip-tests/actions/ccip_helpers.go | 11 +++++++++++ integration-tests/ccip-tests/load/ccip_loadgen.go | 1 + .../ccip-tests/load/ccip_multicall_loadgen.go | 1 + 23 files changed, 49 insertions(+), 4 deletions(-) diff --git a/core/capabilities/ccip/delegate.go b/core/capabilities/ccip/delegate.go index 09e3769627e..1843b048166 100644 --- a/core/capabilities/ccip/delegate.go +++ b/core/capabilities/ccip/delegate.go @@ -179,6 +179,8 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) (services if err != nil { return nil, fmt.Errorf("failed to parse chain ID %s: %w", d.capabilityConfig.ExternalRegistry().RelayID().ChainID, err) } + + // NOTE: This does not support non-evm chains homeChainChainSelector, err := chainsel.SelectorFromChainId(homeChainChainID) if err != nil { return nil, fmt.Errorf("failed to get chain selector from chain ID %d", homeChainChainID) diff --git a/core/capabilities/ccip/oraclecreator/bootstrap.go b/core/capabilities/ccip/oraclecreator/bootstrap.go index 632ac789c8e..18dd8be9d3b 100644 --- a/core/capabilities/ccip/oraclecreator/bootstrap.go +++ b/core/capabilities/ccip/oraclecreator/bootstrap.go @@ -145,6 +145,8 @@ func (i *bootstrapOracleCreator) Create(ctx context.Context, _ uint32, config cc // TODO: add an api that returns chain family. // NOTE: this doesn't really matter for the bootstrap node, it doesn't do anything on-chain. // Its for the monitoring endpoint generation below. + + // NOTE: This does not support non-evm chains chainID, err := chainsel.ChainIdFromSelector(uint64(config.Config.ChainSelector)) if err != nil { return nil, fmt.Errorf("failed to get chain ID from selector: %w", err) diff --git a/core/capabilities/ccip/oraclecreator/plugin.go b/core/capabilities/ccip/oraclecreator/plugin.go index 573d1dd0cac..48d950eaa82 100644 --- a/core/capabilities/ccip/oraclecreator/plugin.go +++ b/core/capabilities/ccip/oraclecreator/plugin.go @@ -120,6 +120,7 @@ func (i *pluginOracleCreator) Create(ctx context.Context, donID uint32, config c // Assuming that the chain selector is referring to an evm chain for now. // TODO: add an api that returns chain family. + // NOTE: This does not support non-evm chains destChainID, err := chainsel.ChainIdFromSelector(uint64(config.Config.ChainSelector)) if err != nil { return nil, fmt.Errorf("failed to get chain ID from selector %d: %w", config.Config.ChainSelector, err) @@ -412,6 +413,7 @@ func decodeAndValidateOffchainConfig( } func (i *pluginOracleCreator) getChainSelector(chainID uint64) (cciptypes.ChainSelector, error) { + // NOTE: This does not support non-evm chains chainSelector, ok := chainsel.EvmChainIdToChainSelector()[chainID] if !ok { return 0, fmt.Errorf("failed to get chain selector from chain ID %d", chainID) @@ -420,6 +422,7 @@ func (i *pluginOracleCreator) getChainSelector(chainID uint64) (cciptypes.ChainS } func (i *pluginOracleCreator) getChainID(chainSelector cciptypes.ChainSelector) (uint64, error) { + // NOTE: This does not support non-evm chains chainID, err := chainsel.ChainIdFromSelector(uint64(chainSelector)) if err != nil { return 0, fmt.Errorf("failed to get chain ID from chain selector %d: %w", chainSelector, err) diff --git a/core/services/ocr2/delegate.go b/core/services/ocr2/delegate.go index acee4168a5a..c6492c022df 100644 --- a/core/services/ocr2/delegate.go +++ b/core/services/ocr2/delegate.go @@ -374,6 +374,7 @@ func (d *Delegate) cleanupEVM(ctx context.Context, jb job.Job, relayID types.Rel return err } var chainSelector uint64 + // NOTE: This does not support non-evm chains chainSelector, err = chainselectors.SelectorFromChainId(chain.ID().Uint64()) if err != nil { return err @@ -1728,6 +1729,7 @@ func (d *Delegate) ccipCommitGetSrcProvider(ctx context.Context, jb job.Job, plu return nil, 0, fmt.Errorf("get offRamp static config: %w", err) } + // NOTE: This does not support non-evm chains srcChainID, err = chainselectors.ChainIdFromSelector(offRampConfig.SourceChainSelector) if err != nil { return nil, 0, err @@ -1883,6 +1885,7 @@ func (d *Delegate) ccipExecGetSrcProvider(ctx context.Context, jb job.Job, plugi return nil, 0, fmt.Errorf("get offRamp static config: %w", err) } + // NOTE: This does not support non-evm chains srcChainID, err = chainselectors.ChainIdFromSelector(offRampConfig.SourceChainSelector) if err != nil { return nil, 0, err diff --git a/core/services/ocr2/plugins/ccip/config/chain_config.go b/core/services/ocr2/plugins/ccip/config/chain_config.go index ff82def6066..2db805874f4 100644 --- a/core/services/ocr2/plugins/ccip/config/chain_config.go +++ b/core/services/ocr2/plugins/ccip/config/chain_config.go @@ -20,6 +20,7 @@ func GetChainFromSpec(spec *job.OCR2OracleSpec, chainSet legacyevm.LegacyChainCo } func GetChainByChainSelector(chainSet legacyevm.LegacyChainContainer, chainSelector uint64) (legacyevm.Chain, int64, error) { + // NOTE: This does not support non-evm chains chainID, err := chainselectors.ChainIdFromSelector(chainSelector) if err != nil { return nil, 0, err @@ -36,10 +37,12 @@ func GetChainByChainID(chainSet legacyevm.LegacyChainContainer, chainID uint64) } func ResolveChainNames(sourceChainId int64, destChainId int64) (string, string, error) { + // NOTE: This does not support non-evm chains sourceChainName, err := chainselectors.NameFromChainId(uint64(sourceChainId)) if err != nil { return "", "", err } + // NOTE: This does not support non-evm chains destChainName, err := chainselectors.NameFromChainId(uint64(destChainId)) if err != nil { return "", "", err diff --git a/core/services/relay/evm/evm.go b/core/services/relay/evm/evm.go index db0fe90796b..2fa7a6b799b 100644 --- a/core/services/relay/evm/evm.go +++ b/core/services/relay/evm/evm.go @@ -197,6 +197,7 @@ func NewRelayer(ctx context.Context, lggr logger.Logger, chain legacyevm.Chain, sugared := logger.Sugared(lggr).Named("Relayer") mercuryORM := mercury.NewORM(opts.DS) cdcFactory := sync.OnceValues(func() (llo.ChannelDefinitionCacheFactory, error) { + // NOTE: This does not support non-evm chains chainSelector, err := chainselectors.SelectorFromChainId(chain.ID().Uint64()) if err != nil { return nil, fmt.Errorf("failed to get chain selector for chain id %s: %w", chain.ID(), err) diff --git a/core/services/relay/evm/write_target.go b/core/services/relay/evm/write_target.go index cd30e8ab3c3..6e8acb3d9d3 100644 --- a/core/services/relay/evm/write_target.go +++ b/core/services/relay/evm/write_target.go @@ -18,6 +18,7 @@ import ( func NewWriteTarget(ctx context.Context, relayer *Relayer, chain legacyevm.Chain, gasLimitDefault uint64, lggr logger.Logger) (*targets.WriteTarget, error) { // generate ID based on chain selector id := fmt.Sprintf("write_%v@1.0.0", chain.ID()) + // NOTE: This does not support non-evm chains chainName, err := chainselectors.NameFromChainId(chain.ID().Uint64()) if err == nil { id = fmt.Sprintf("write_%v@1.0.0", chainName) diff --git a/deployment/address_book.go b/deployment/address_book.go index 8385bc0e9f1..c7b5f8cd1fb 100644 --- a/deployment/address_book.go +++ b/deployment/address_book.go @@ -90,8 +90,8 @@ type AddressBookMap struct { // Save will save an address for a given chain selector. It will error if there is a conflicting existing address. func (m *AddressBookMap) Save(chainSelector uint64, address string, typeAndVersion TypeAndVersion) error { - _, exists := chainsel.ChainBySelector(chainSelector) - if !exists { + _, err := chainsel.GetChainIDFromSelector(chainSelector) + if err != nil { return errors.Wrapf(ErrInvalidChainSelector, "chain selector %d", chainSelector) } if address == "" || address == common.HexToAddress("0x0").Hex() { @@ -122,8 +122,8 @@ func (m *AddressBookMap) Addresses() (map[uint64]map[string]TypeAndVersion, erro } func (m *AddressBookMap) AddressesForChain(chainSelector uint64) (map[string]TypeAndVersion, error) { - _, exists := chainsel.ChainBySelector(chainSelector) - if !exists { + _, err := chainsel.GetChainIDFromSelector(chainSelector) + if err != nil { return nil, errors.Wrapf(ErrInvalidChainSelector, "chain selector %d", chainSelector) } if _, exists := m.AddressesByChain[chainSelector]; !exists { diff --git a/deployment/ccip/propose.go b/deployment/ccip/propose.go index 9d6ac417968..e411c3a7f5f 100644 --- a/deployment/ccip/propose.go +++ b/deployment/ccip/propose.go @@ -64,6 +64,7 @@ func NewTestMCMSConfig(t *testing.T, e deployment.Environment) MCMSConfig { func SignProposal(t *testing.T, env deployment.Environment, proposal *timelock.MCMSWithTimelockProposal) *mcms.Executor { executorClients := make(map[mcms.ChainIdentifier]mcms.ContractDeployBackend) for _, chain := range env.Chains { + // NOTE: This does not support non-evm chains chainselc, exists := chainsel.ChainBySelector(chain.Selector) require.True(t, exists) chainSel := mcms.ChainIdentifier(chainselc.Selector) @@ -141,6 +142,7 @@ func GenerateAcceptOwnershipProposal( // TODO: Accept rest of contracts var batches []timelock.BatchChainOperation for _, sel := range chains { + // NOTE: This does not support non-evm chains chain, _ := chainsel.ChainBySelector(sel) acceptOnRamp, err := state.Chains[sel].OnRamp.AcceptOwnership(deployment.SimTransactOpts()) if err != nil { diff --git a/deployment/ccip/state.go b/deployment/ccip/state.go index 650f46d2b3a..c54ba100bf5 100644 --- a/deployment/ccip/state.go +++ b/deployment/ccip/state.go @@ -181,10 +181,12 @@ func (s CCIPOnChainState) View(chains []uint64) (map[string]view.ChainView, erro m := make(map[string]view.ChainView) for _, chainSelector := range chains { // TODO: Need a utility for this + // NOTE: This does not support non-evm chains chainid, err := chainsel.ChainIdFromSelector(chainSelector) if err != nil { return m, err } + // NOTE: This does not support non-evm chains chainName, err := chainsel.NameFromChainId(chainid) if err != nil { return m, err diff --git a/deployment/common/view/nops.go b/deployment/common/view/nops.go index 12b8dad96f4..36f817a0f5f 100644 --- a/deployment/common/view/nops.go +++ b/deployment/common/view/nops.go @@ -59,10 +59,12 @@ func GenerateNopsView(nodeIds []string, oc deployment.OffchainClient) (map[strin IsEnabled: nodeDetails.Node.IsEnabled, } for sel, ocrConfig := range node.SelToOCRConfig { + // NOTE: This does not support non-evm chains chainid, err := chainsel.ChainIdFromSelector(sel) if err != nil { return nv, err } + // NOTE: This does not support non-evm chains chainName, err := chainsel.NameFromChainId(chainid) if err != nil { return nv, err diff --git a/deployment/environment.go b/deployment/environment.go index 104db4c5c37..c9996b7dade 100644 --- a/deployment/environment.go +++ b/deployment/environment.go @@ -278,6 +278,7 @@ func NodeInfo(nodeIDs []string, oc NodeChainConfigsLister) (Nodes, error) { if err != nil { return nil, err } + // NOTE: This does not support non-evm chains sel, err := chain_selectors.SelectorFromChainId(uint64(evmChainID)) if err != nil { return nil, err diff --git a/deployment/environment/devenv/chain.go b/deployment/environment/devenv/chain.go index cdbaf35e860..ee6ac75f790 100644 --- a/deployment/environment/devenv/chain.go +++ b/deployment/environment/devenv/chain.go @@ -32,6 +32,7 @@ type ChainConfig struct { func NewChains(logger logger.Logger, configs []ChainConfig) (map[uint64]deployment.Chain, error) { chains := make(map[uint64]deployment.Chain) for _, chainCfg := range configs { + // NOTE: This does not support non-evm chains selector, err := chainselectors.SelectorFromChainId(chainCfg.ChainID) if err != nil { return nil, fmt.Errorf("failed to get selector from chain id %d: %w", chainCfg.ChainID, err) diff --git a/deployment/environment/devenv/don.go b/deployment/environment/devenv/don.go index 830f5b921bc..103dbfdcaaa 100644 --- a/deployment/environment/devenv/don.go +++ b/deployment/environment/devenv/don.go @@ -405,6 +405,7 @@ func (n *Node) ExportEVMKeysForChain(chainId string) ([]*clclient.ExportedEVMKey // ReplayLogs replays logs for the chains on the node for given block numbers for each chain func (n *Node) ReplayLogs(blockByChain map[uint64]uint64) error { for sel, block := range blockByChain { + // NOTE: This does not support non-evm chains chainID, err := chainsel.ChainIdFromSelector(sel) if err != nil { return err diff --git a/deployment/environment/memory/environment.go b/deployment/environment/memory/environment.go index a1478a3bf52..1da4372f2e0 100644 --- a/deployment/environment/memory/environment.go +++ b/deployment/environment/memory/environment.go @@ -57,6 +57,7 @@ func generateMemoryChain(t *testing.T, inputs map[uint64]EVMChain) map[uint64]de chains := make(map[uint64]deployment.Chain) for cid, chain := range inputs { chain := chain + // NOTE: This does not support non-evm chains sel, err := chainsel.SelectorFromChainId(cid) require.NoError(t, err) backend := NewBackend(chain.Backend) diff --git a/deployment/environment/memory/node.go b/deployment/environment/memory/node.go index c2e4e457fbd..318c786f35d 100644 --- a/deployment/environment/memory/node.go +++ b/deployment/environment/memory/node.go @@ -56,6 +56,7 @@ type Node struct { func (n Node) ReplayLogs(chains map[uint64]uint64) error { for sel, block := range chains { + // NOTE: This does not support non-evm chains chainID, _ := chainsel.ChainIdFromSelector(sel) if err := n.App.ReplayFromBlock(big.NewInt(int64(chainID)), block, false); err != nil { return err diff --git a/deployment/keystone/changeset/update_node_capabilities.go b/deployment/keystone/changeset/update_node_capabilities.go index 0b6c4fb5462..3bd772c9a25 100644 --- a/deployment/keystone/changeset/update_node_capabilities.go +++ b/deployment/keystone/changeset/update_node_capabilities.go @@ -49,6 +49,7 @@ func (req *MutateNodeCapabilitiesRequest) Validate() error { if len(req.P2pToCapabilities) == 0 { return fmt.Errorf("p2pToCapabilities is empty") } + // NOTE: This does not support non-evm chains _, exists := chainsel.ChainBySelector(req.RegistryChainSel) if !exists { return fmt.Errorf("registry chain selector %d does not exist", req.RegistryChainSel) diff --git a/deployment/keystone/changeset/view.go b/deployment/keystone/changeset/view.go index cab4ca25ae7..bf130d062a0 100644 --- a/deployment/keystone/changeset/view.go +++ b/deployment/keystone/changeset/view.go @@ -23,10 +23,12 @@ func ViewKeystone(e deployment.Environment) (json.Marshaler, error) { } chainViews := make(map[string]view.KeystoneChainView) for chainSel, contracts := range state.ContractSets { + // NOTE: This does not support non-evm chains chainid, err := chainsel.ChainIdFromSelector(chainSel) if err != nil { return nil, err } + // NOTE: This does not support non-evm chains chainName, err := chainsel.NameFromChainId(chainid) if err != nil { return nil, err diff --git a/deployment/keystone/deploy.go b/deployment/keystone/deploy.go index a43f906178e..d36392d2e61 100644 --- a/deployment/keystone/deploy.go +++ b/deployment/keystone/deploy.go @@ -57,6 +57,7 @@ func (r ConfigureContractsRequest) Validate() error { return fmt.Errorf("don validation failed for '%s': %w", don.Name, err) } } + // NOTE: This does not support non-evm chains _, ok := chainsel.ChainBySelector(r.RegistryChainSel) if !ok { return fmt.Errorf("chain %d not found in environment", r.RegistryChainSel) diff --git a/deployment/keystone/types.go b/deployment/keystone/types.go index e5657657ed9..f19781781d0 100644 --- a/deployment/keystone/types.go +++ b/deployment/keystone/types.go @@ -256,6 +256,7 @@ func NodeOperator(name string, adminAddress string) capabilities_registry.Capabi } func AdminAddress(n *Node, chainSel uint64) (string, error) { + // NOTE: This does not support non-evm chains cid, err := chainsel.ChainIdFromSelector(chainSel) if err != nil { return "", fmt.Errorf("failed to get chain id from selector %d: %w", chainSel, err) @@ -355,6 +356,7 @@ func firstChainConfigByType(ccfgs []*v1.ChainConfig, t v1.ChainType) (*v1.ChainC } func registryChainConfig(ccfgs []*v1.ChainConfig, t v1.ChainType, sel uint64) (*v1.ChainConfig, error) { + // NOTE: This does not support non-evm chains chainId, err := chainsel.ChainIdFromSelector(sel) if err != nil { return nil, fmt.Errorf("failed to get chain id from selector %d: %w", sel, err) diff --git a/integration-tests/ccip-tests/actions/ccip_helpers.go b/integration-tests/ccip-tests/actions/ccip_helpers.go index c24ae2ecd54..1c07a7060bc 100644 --- a/integration-tests/ccip-tests/actions/ccip_helpers.go +++ b/integration-tests/ccip-tests/actions/ccip_helpers.go @@ -463,6 +463,7 @@ func (ccipModule *CCIPCommon) WaitForPriceUpdates( destChainId uint64, allTokens []common.Address, ) error { + // NOTE: This does not support non-evm chains destChainSelector, err := chainselectors.SelectorFromChainId(destChainId) if err != nil { return err @@ -557,6 +558,7 @@ func (ccipModule *CCIPCommon) WatchForPriceUpdates(ctx context.Context, lggr *ze return fmt.Errorf("no event subscription found") } processEvent := func(value, timestamp *big.Int, destChainSelector uint64, raw types.Log) error { + // NOTE: This does not support non-evm chains destChain, err := chainselectors.ChainIdFromSelector(destChainSelector) if err != nil { return err @@ -663,6 +665,7 @@ func (ccipModule *CCIPCommon) SyncUSDCDomain(destTransmitter *contracts.TokenTra if destTransmitter == nil { return fmt.Errorf("invalid address") } + // NOTE: This does not support non-evm chains destChainSelector, err := chainselectors.SelectorFromChainId(destChainID) if err != nil { return fmt.Errorf("invalid chain id %w", err) @@ -1391,6 +1394,7 @@ func (sourceCCIP *SourceCCIPModule) DeployContracts(lane *laneconfig.LaneConfig) log.Info().Msg("Deploying source chain specific contracts") sourceCCIP.LoadContracts(lane) + // NOTE: This does not support non-evm chains sourceChainSelector, err := chainselectors.SelectorFromChainId(sourceCCIP.Common.ChainClient.GetChainID().Uint64()) if err != nil { return fmt.Errorf("getting chain selector shouldn't fail %w", err) @@ -1827,6 +1831,7 @@ func (sourceCCIP *SourceCCIPModule) SendRequest( gasLimit *big.Int, ) (common.Hash, time.Duration, *big.Int, error) { var d time.Duration + // NOTE: This does not support non-evm chains destChainSelector, err := chainselectors.SelectorFromChainId(sourceCCIP.DestinationChainId) if err != nil { return common.Hash{}, d, nil, fmt.Errorf("failed getting the chain selector: %w", err) @@ -1896,6 +1901,7 @@ func DefaultSourceCCIPModule( return nil, err } + // NOTE: This does not support non-evm chains destChainSelector, err := chainselectors.SelectorFromChainId(destChainId) if err != nil { return nil, fmt.Errorf("failed getting the chain selector: %w", err) @@ -2061,6 +2067,7 @@ func (destCCIP *DestCCIPModule) DeployContracts( contractDeployer := destCCIP.Common.Deployer log.Info().Msg("Deploying destination chain specific contracts") destCCIP.LoadContracts(lane) + // NOTE: This does not support non-evm chains destChainSelector, err := chainselectors.SelectorFromChainId(destCCIP.Common.ChainClient.GetChainID().Uint64()) if err != nil { return fmt.Errorf("failed to get chain selector for destination chain id %d: %w", destCCIP.Common.ChainClient.GetChainID().Uint64(), err) @@ -2649,6 +2656,7 @@ func DefaultDestinationCCIPModule( return nil, err } + // NOTE: This does not support non-evm chains sourceChainSelector, err := chainselectors.SelectorFromChainId(sourceChainId) if err != nil { return nil, fmt.Errorf("failed to get chain selector for source chain id %d: %w", sourceChainId, err) @@ -2858,6 +2866,7 @@ func (lane *CCIPLane) Multicall(noOfRequests int, multiSendAddr common.Address) if err != nil { return fmt.Errorf("failed to form the ccip message: %w", err) } + // NOTE: This does not support non-evm chains destChainSelector, err := chainselectors.SelectorFromChainId(lane.Source.DestinationChainId) if err != nil { return fmt.Errorf("failed getting the chain selector: %w", err) @@ -3043,10 +3052,12 @@ func (lane *CCIPLane) ExecuteManually(options ...ManualExecutionOption) error { } } } + // NOTE: This does not support non-evm chains destChainSelector, err := chainselectors.SelectorFromChainId(lane.DestChain.GetChainID().Uint64()) if err != nil { return err } + // NOTE: This does not support non-evm chains sourceChainSelector, err := chainselectors.SelectorFromChainId(lane.SourceChain.GetChainID().Uint64()) if err != nil { return err diff --git a/integration-tests/ccip-tests/load/ccip_loadgen.go b/integration-tests/ccip-tests/load/ccip_loadgen.go index 3ce770d31bc..6986888228e 100644 --- a/integration-tests/ccip-tests/load/ccip_loadgen.go +++ b/integration-tests/ccip-tests/load/ccip_loadgen.go @@ -269,6 +269,7 @@ func (c *CCIPE2ELoad) Call(_ *wasp.Generator) *wasp.Response { lggr.Debug().Str("triggeredAt", time.Now().GoString()).Msg("triggering transfer") var sendTx *types.Transaction + // NOTE: This does not support non-evm chains destChainSelector, err := chain_selectors.SelectorFromChainId(sourceCCIP.DestinationChainId) if err != nil { res.Error = fmt.Sprintf("reqNo %d err %s - while getting selector from chainid", msgSerialNo, err.Error()) diff --git a/integration-tests/ccip-tests/load/ccip_multicall_loadgen.go b/integration-tests/ccip-tests/load/ccip_multicall_loadgen.go index 04fcffaa4b1..c1573c8b962 100644 --- a/integration-tests/ccip-tests/load/ccip_multicall_loadgen.go +++ b/integration-tests/ccip-tests/load/ccip_multicall_loadgen.go @@ -224,6 +224,7 @@ func (m *CCIPMultiCallLoadGenerator) MergeCalls() ([]contracts.CCIPMsgData, map[ statDetails := make(map[string]MultiCallReturnValues) for _, e2eLoad := range m.E2ELoads { + // NOTE: This does not support non-evm chains destChainSelector, err := chain_selectors.SelectorFromChainId(e2eLoad.Lane.Source.DestinationChainId) if err != nil { return ccipMsgs, statDetails, err From c10af692a451317bccf8cb4550a808b4c8ec8eef Mon Sep 17 00:00:00 2001 From: jlaveracll Date: Fri, 15 Nov 2024 14:23:14 -0300 Subject: [PATCH 02/10] Update address book to include nonevm --- .changeset/late-seals-battle.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/late-seals-battle.md diff --git a/.changeset/late-seals-battle.md b/.changeset/late-seals-battle.md new file mode 100644 index 00000000000..194aa4f380e --- /dev/null +++ b/.changeset/late-seals-battle.md @@ -0,0 +1,5 @@ +--- +"chainlink": minor +--- + +Update deployment address book to support non-evm chains From 41324799153a2df3b57f5bc94f4ab3978c8b8ebf Mon Sep 17 00:00:00 2001 From: jlaveracll Date: Tue, 19 Nov 2024 10:33:48 -0300 Subject: [PATCH 03/10] avoid address validation for non evm chains --- deployment/address_book.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/deployment/address_book.go b/deployment/address_book.go index c7b5f8cd1fb..6c45cc74e19 100644 --- a/deployment/address_book.go +++ b/deployment/address_book.go @@ -90,18 +90,20 @@ type AddressBookMap struct { // Save will save an address for a given chain selector. It will error if there is a conflicting existing address. func (m *AddressBookMap) Save(chainSelector uint64, address string, typeAndVersion TypeAndVersion) error { - _, err := chainsel.GetChainIDFromSelector(chainSelector) + family, err := chainsel.GetSelectorFamily(chainSelector) if err != nil { return errors.Wrapf(ErrInvalidChainSelector, "chain selector %d", chainSelector) } - if address == "" || address == common.HexToAddress("0x0").Hex() { - return errors.Wrap(ErrInvalidAddress, "address cannot be empty") - } - if common.IsHexAddress(address) { - // IMPORTANT: WE ALWAYS STANDARDIZE ETHEREUM ADDRESS STRINGS TO EIP55 - address = common.HexToAddress(address).Hex() - } else { - return errors.Wrapf(ErrInvalidAddress, "address %s is not a valid Ethereum address, only Ethereum addresses supported", address) + if family == chainsel.FamilyEVM { + if address == "" || address == common.HexToAddress("0x0").Hex() { + return errors.Wrap(ErrInvalidAddress, "address cannot be empty") + } + if common.IsHexAddress(address) { + // IMPORTANT: WE ALWAYS STANDARDIZE ETHEREUM ADDRESS STRINGS TO EIP55 + address = common.HexToAddress(address).Hex() + } else { + return errors.Wrapf(ErrInvalidAddress, "address %s is not a valid Ethereum address, only Ethereum addresses supported for EVM chains", address) + } } if typeAndVersion.Type == "" { return fmt.Errorf("type cannot be empty") From b5b95e1e990dd2e6bc1af7318fc68bd7d2599c26 Mon Sep 17 00:00:00 2001 From: jlaveracll Date: Tue, 19 Nov 2024 15:28:00 -0300 Subject: [PATCH 04/10] address feedback --- deployment/address_book.go | 5 ++++- deployment/address_book_test.go | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/deployment/address_book.go b/deployment/address_book.go index fbac20586c1..f02ef35ec77 100644 --- a/deployment/address_book.go +++ b/deployment/address_book.go @@ -94,7 +94,7 @@ type AddressBookMap struct { } // Save will save an address for a given chain selector. It will error if there is a conflicting existing address. -func (m *AddressBookMap) Save(chainSelector uint64, address string, typeAndVersion TypeAndVersion) error { +func (m *AddressBookMap) save(chainSelector uint64, address string, typeAndVersion TypeAndVersion) error { family, err := chainsel.GetSelectorFamily(chainSelector) if err != nil { return errors.Wrapf(ErrInvalidChainSelector, "chain selector %d", chainSelector) @@ -110,6 +110,9 @@ func (m *AddressBookMap) Save(chainSelector uint64, address string, typeAndVersi return errors.Wrapf(ErrInvalidAddress, "address %s is not a valid Ethereum address, only Ethereum addresses supported for EVM chains", address) } } + + // TODO NONEVM-960: Add validation for non-EVM chain addresses + if typeAndVersion.Type == "" { return fmt.Errorf("type cannot be empty") } diff --git a/deployment/address_book_test.go b/deployment/address_book_test.go index 9040902a169..4a3d3d95853 100644 --- a/deployment/address_book_test.go +++ b/deployment/address_book_test.go @@ -44,6 +44,10 @@ func TestAddressBook_Save(t *testing.T) { err = ab.Save(chainsel.TEST_90000001.Selector, common.HexToAddress("0x0").Hex(), onRamp100) require.Error(t, err) + // Zero address but non evm chain + err = NewMemoryAddressBook().Save(chainsel.APTOS_MAINNET.Selector, common.HexToAddress("0x0").Hex(), onRamp100) + require.NoError(t, err) + // Distinct address same TV will not err = ab.Save(chainsel.TEST_90000001.Selector, addr2, onRamp100) require.NoError(t, err) From ad98911f849b3782eeef9de3dd0f0bd9067aced2 Mon Sep 17 00:00:00 2001 From: jlaveracll Date: Wed, 20 Nov 2024 17:35:30 -0300 Subject: [PATCH 05/10] fix merge --- core/capabilities/ccip/oraclecreator/plugin.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/core/capabilities/ccip/oraclecreator/plugin.go b/core/capabilities/ccip/oraclecreator/plugin.go index 4b740200430..d7bdaa59cdd 100644 --- a/core/capabilities/ccip/oraclecreator/plugin.go +++ b/core/capabilities/ccip/oraclecreator/plugin.go @@ -116,16 +116,10 @@ func (i *pluginOracleCreator) Type() cctypes.OracleType { // Create implements types.OracleCreator. func (i *pluginOracleCreator) Create(ctx context.Context, donID uint32, config cctypes.OCR3ConfigWithMeta) (cctypes.CCIPOracle, error) { pluginType := cctypes.PluginType(config.Config.PluginType) -<<<<<<< HEAD + chainSelector := uint64(config.Config.ChainSelector) - // Assuming that the chain selector is referring to an evm chain for now. - // TODO: add an api that returns chain family. // NOTE: This does not support non-evm chains - destChainID, err := chainsel.ChainIdFromSelector(uint64(config.Config.ChainSelector)) -======= - chainSelector := uint64(config.Config.ChainSelector) destChainFamily, err := chainsel.GetSelectorFamily(chainSelector) ->>>>>>> 789d02195d5f20a7e198402860916182cbfc598f if err != nil { return nil, fmt.Errorf("failed to get chain family from selector %d: %w", config.Config.ChainSelector, err) } From 051be3684c16b941f693c3d7d37df4ac9daf9f1d Mon Sep 17 00:00:00 2001 From: jlaveracll Date: Thu, 21 Nov 2024 12:07:27 -0300 Subject: [PATCH 06/10] remove comments --- core/capabilities/ccip/delegate.go | 1 - core/capabilities/ccip/oraclecreator/bootstrap.go | 1 - core/capabilities/ccip/oraclecreator/plugin.go | 3 --- core/services/ocr2/delegate.go | 3 --- .../services/ocr2/plugins/ccip/config/chain_config.go | 3 --- core/services/relay/evm/evm.go | 1 - core/services/relay/evm/write_target.go | 1 - deployment/ccip/changeset/propose.go | 1 - deployment/ccip/changeset/state.go | 2 -- deployment/common/view/nops.go | 2 -- deployment/environment.go | 1 - deployment/environment/devenv/chain.go | 1 - deployment/environment/devenv/don.go | 1 - deployment/environment/memory/environment.go | 1 - deployment/environment/memory/node.go | 1 - .../keystone/changeset/update_node_capabilities.go | 1 - deployment/keystone/changeset/view.go | 2 -- deployment/keystone/deploy.go | 1 - deployment/keystone/types.go | 2 -- integration-tests/ccip-tests/actions/ccip_helpers.go | 11 ----------- integration-tests/ccip-tests/load/ccip_loadgen.go | 1 - .../ccip-tests/load/ccip_multicall_loadgen.go | 1 - 22 files changed, 42 deletions(-) diff --git a/core/capabilities/ccip/delegate.go b/core/capabilities/ccip/delegate.go index 1843b048166..1ce461348f8 100644 --- a/core/capabilities/ccip/delegate.go +++ b/core/capabilities/ccip/delegate.go @@ -180,7 +180,6 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) (services return nil, fmt.Errorf("failed to parse chain ID %s: %w", d.capabilityConfig.ExternalRegistry().RelayID().ChainID, err) } - // NOTE: This does not support non-evm chains homeChainChainSelector, err := chainsel.SelectorFromChainId(homeChainChainID) if err != nil { return nil, fmt.Errorf("failed to get chain selector from chain ID %d", homeChainChainID) diff --git a/core/capabilities/ccip/oraclecreator/bootstrap.go b/core/capabilities/ccip/oraclecreator/bootstrap.go index 18dd8be9d3b..311080e875d 100644 --- a/core/capabilities/ccip/oraclecreator/bootstrap.go +++ b/core/capabilities/ccip/oraclecreator/bootstrap.go @@ -146,7 +146,6 @@ func (i *bootstrapOracleCreator) Create(ctx context.Context, _ uint32, config cc // NOTE: this doesn't really matter for the bootstrap node, it doesn't do anything on-chain. // Its for the monitoring endpoint generation below. - // NOTE: This does not support non-evm chains chainID, err := chainsel.ChainIdFromSelector(uint64(config.Config.ChainSelector)) if err != nil { return nil, fmt.Errorf("failed to get chain ID from selector: %w", err) diff --git a/core/capabilities/ccip/oraclecreator/plugin.go b/core/capabilities/ccip/oraclecreator/plugin.go index d7bdaa59cdd..bfdcd0156f0 100644 --- a/core/capabilities/ccip/oraclecreator/plugin.go +++ b/core/capabilities/ccip/oraclecreator/plugin.go @@ -118,7 +118,6 @@ func (i *pluginOracleCreator) Create(ctx context.Context, donID uint32, config c pluginType := cctypes.PluginType(config.Config.PluginType) chainSelector := uint64(config.Config.ChainSelector) - // NOTE: This does not support non-evm chains destChainFamily, err := chainsel.GetSelectorFamily(chainSelector) if err != nil { return nil, fmt.Errorf("failed to get chain family from selector %d: %w", config.Config.ChainSelector, err) @@ -415,7 +414,6 @@ func decodeAndValidateOffchainConfig( } func (i *pluginOracleCreator) getChainSelector(chainID string, chainFamily string) (cciptypes.ChainSelector, error) { - // NOTE: This does not support non-evm chains chainDetails, err := chainsel.GetChainDetailsByChainIDAndFamily(chainID, chainFamily) if err != nil { return 0, fmt.Errorf("failed to get chain selector from chain ID %s and family %s", chainID, chainFamily) @@ -424,7 +422,6 @@ func (i *pluginOracleCreator) getChainSelector(chainID string, chainFamily strin } func (i *pluginOracleCreator) getChainID(chainSelector cciptypes.ChainSelector) (string, error) { - // NOTE: This does not support non-evm chains chainID, err := chainsel.GetChainIDFromSelector(uint64(chainSelector)) if err != nil { return "", fmt.Errorf("failed to get chain ID from chain selector %d: %w", chainSelector, err) diff --git a/core/services/ocr2/delegate.go b/core/services/ocr2/delegate.go index c6492c022df..acee4168a5a 100644 --- a/core/services/ocr2/delegate.go +++ b/core/services/ocr2/delegate.go @@ -374,7 +374,6 @@ func (d *Delegate) cleanupEVM(ctx context.Context, jb job.Job, relayID types.Rel return err } var chainSelector uint64 - // NOTE: This does not support non-evm chains chainSelector, err = chainselectors.SelectorFromChainId(chain.ID().Uint64()) if err != nil { return err @@ -1729,7 +1728,6 @@ func (d *Delegate) ccipCommitGetSrcProvider(ctx context.Context, jb job.Job, plu return nil, 0, fmt.Errorf("get offRamp static config: %w", err) } - // NOTE: This does not support non-evm chains srcChainID, err = chainselectors.ChainIdFromSelector(offRampConfig.SourceChainSelector) if err != nil { return nil, 0, err @@ -1885,7 +1883,6 @@ func (d *Delegate) ccipExecGetSrcProvider(ctx context.Context, jb job.Job, plugi return nil, 0, fmt.Errorf("get offRamp static config: %w", err) } - // NOTE: This does not support non-evm chains srcChainID, err = chainselectors.ChainIdFromSelector(offRampConfig.SourceChainSelector) if err != nil { return nil, 0, err diff --git a/core/services/ocr2/plugins/ccip/config/chain_config.go b/core/services/ocr2/plugins/ccip/config/chain_config.go index 2db805874f4..ff82def6066 100644 --- a/core/services/ocr2/plugins/ccip/config/chain_config.go +++ b/core/services/ocr2/plugins/ccip/config/chain_config.go @@ -20,7 +20,6 @@ func GetChainFromSpec(spec *job.OCR2OracleSpec, chainSet legacyevm.LegacyChainCo } func GetChainByChainSelector(chainSet legacyevm.LegacyChainContainer, chainSelector uint64) (legacyevm.Chain, int64, error) { - // NOTE: This does not support non-evm chains chainID, err := chainselectors.ChainIdFromSelector(chainSelector) if err != nil { return nil, 0, err @@ -37,12 +36,10 @@ func GetChainByChainID(chainSet legacyevm.LegacyChainContainer, chainID uint64) } func ResolveChainNames(sourceChainId int64, destChainId int64) (string, string, error) { - // NOTE: This does not support non-evm chains sourceChainName, err := chainselectors.NameFromChainId(uint64(sourceChainId)) if err != nil { return "", "", err } - // NOTE: This does not support non-evm chains destChainName, err := chainselectors.NameFromChainId(uint64(destChainId)) if err != nil { return "", "", err diff --git a/core/services/relay/evm/evm.go b/core/services/relay/evm/evm.go index ae9bb8a321b..8008fc4fd9e 100644 --- a/core/services/relay/evm/evm.go +++ b/core/services/relay/evm/evm.go @@ -203,7 +203,6 @@ func NewRelayer(ctx context.Context, lggr logger.Logger, chain legacyevm.Chain, sugared := logger.Sugared(lggr).Named("Relayer") mercuryORM := mercury.NewORM(opts.DS) cdcFactory := sync.OnceValues(func() (llo.ChannelDefinitionCacheFactory, error) { - // NOTE: This does not support non-evm chains chainSelector, err := chainselectors.SelectorFromChainId(chain.ID().Uint64()) if err != nil { return nil, fmt.Errorf("failed to get chain selector for chain id %s: %w", chain.ID(), err) diff --git a/core/services/relay/evm/write_target.go b/core/services/relay/evm/write_target.go index 6e8acb3d9d3..cd30e8ab3c3 100644 --- a/core/services/relay/evm/write_target.go +++ b/core/services/relay/evm/write_target.go @@ -18,7 +18,6 @@ import ( func NewWriteTarget(ctx context.Context, relayer *Relayer, chain legacyevm.Chain, gasLimitDefault uint64, lggr logger.Logger) (*targets.WriteTarget, error) { // generate ID based on chain selector id := fmt.Sprintf("write_%v@1.0.0", chain.ID()) - // NOTE: This does not support non-evm chains chainName, err := chainselectors.NameFromChainId(chain.ID().Uint64()) if err == nil { id = fmt.Sprintf("write_%v@1.0.0", chainName) diff --git a/deployment/ccip/changeset/propose.go b/deployment/ccip/changeset/propose.go index d7c276466a8..1b7d928f414 100644 --- a/deployment/ccip/changeset/propose.go +++ b/deployment/ccip/changeset/propose.go @@ -22,7 +22,6 @@ func GenerateAcceptOwnershipProposal( // TODO: Accept rest of contracts var batches []timelock.BatchChainOperation for _, sel := range chains { - // NOTE: This does not support non-evm chains chain, _ := chainsel.ChainBySelector(sel) acceptOnRamp, err := state.Chains[sel].OnRamp.AcceptOwnership(deployment.SimTransactOpts()) if err != nil { diff --git a/deployment/ccip/changeset/state.go b/deployment/ccip/changeset/state.go index dc44884652b..a8b3fb04c96 100644 --- a/deployment/ccip/changeset/state.go +++ b/deployment/ccip/changeset/state.go @@ -194,12 +194,10 @@ func (s CCIPOnChainState) View(chains []uint64) (map[string]view.ChainView, erro m := make(map[string]view.ChainView) for _, chainSelector := range chains { // TODO: Need a utility for this - // NOTE: This does not support non-evm chains chainid, err := chainsel.ChainIdFromSelector(chainSelector) if err != nil { return m, err } - // NOTE: This does not support non-evm chains chainName, err := chainsel.NameFromChainId(chainid) if err != nil { return m, err diff --git a/deployment/common/view/nops.go b/deployment/common/view/nops.go index 36f817a0f5f..12b8dad96f4 100644 --- a/deployment/common/view/nops.go +++ b/deployment/common/view/nops.go @@ -59,12 +59,10 @@ func GenerateNopsView(nodeIds []string, oc deployment.OffchainClient) (map[strin IsEnabled: nodeDetails.Node.IsEnabled, } for sel, ocrConfig := range node.SelToOCRConfig { - // NOTE: This does not support non-evm chains chainid, err := chainsel.ChainIdFromSelector(sel) if err != nil { return nv, err } - // NOTE: This does not support non-evm chains chainName, err := chainsel.NameFromChainId(chainid) if err != nil { return nv, err diff --git a/deployment/environment.go b/deployment/environment.go index 224a590ed9b..2fd1876afd8 100644 --- a/deployment/environment.go +++ b/deployment/environment.go @@ -286,7 +286,6 @@ func NodeInfo(nodeIDs []string, oc NodeChainConfigsLister) (Nodes, error) { if err != nil { return nil, err } - // NOTE: This does not support non-evm chains sel, err := chain_selectors.SelectorFromChainId(uint64(evmChainID)) if err != nil { return nil, err diff --git a/deployment/environment/devenv/chain.go b/deployment/environment/devenv/chain.go index ee6ac75f790..cdbaf35e860 100644 --- a/deployment/environment/devenv/chain.go +++ b/deployment/environment/devenv/chain.go @@ -32,7 +32,6 @@ type ChainConfig struct { func NewChains(logger logger.Logger, configs []ChainConfig) (map[uint64]deployment.Chain, error) { chains := make(map[uint64]deployment.Chain) for _, chainCfg := range configs { - // NOTE: This does not support non-evm chains selector, err := chainselectors.SelectorFromChainId(chainCfg.ChainID) if err != nil { return nil, fmt.Errorf("failed to get selector from chain id %d: %w", chainCfg.ChainID, err) diff --git a/deployment/environment/devenv/don.go b/deployment/environment/devenv/don.go index 103dbfdcaaa..830f5b921bc 100644 --- a/deployment/environment/devenv/don.go +++ b/deployment/environment/devenv/don.go @@ -405,7 +405,6 @@ func (n *Node) ExportEVMKeysForChain(chainId string) ([]*clclient.ExportedEVMKey // ReplayLogs replays logs for the chains on the node for given block numbers for each chain func (n *Node) ReplayLogs(blockByChain map[uint64]uint64) error { for sel, block := range blockByChain { - // NOTE: This does not support non-evm chains chainID, err := chainsel.ChainIdFromSelector(sel) if err != nil { return err diff --git a/deployment/environment/memory/environment.go b/deployment/environment/memory/environment.go index 1da4372f2e0..a1478a3bf52 100644 --- a/deployment/environment/memory/environment.go +++ b/deployment/environment/memory/environment.go @@ -57,7 +57,6 @@ func generateMemoryChain(t *testing.T, inputs map[uint64]EVMChain) map[uint64]de chains := make(map[uint64]deployment.Chain) for cid, chain := range inputs { chain := chain - // NOTE: This does not support non-evm chains sel, err := chainsel.SelectorFromChainId(cid) require.NoError(t, err) backend := NewBackend(chain.Backend) diff --git a/deployment/environment/memory/node.go b/deployment/environment/memory/node.go index 318c786f35d..c2e4e457fbd 100644 --- a/deployment/environment/memory/node.go +++ b/deployment/environment/memory/node.go @@ -56,7 +56,6 @@ type Node struct { func (n Node) ReplayLogs(chains map[uint64]uint64) error { for sel, block := range chains { - // NOTE: This does not support non-evm chains chainID, _ := chainsel.ChainIdFromSelector(sel) if err := n.App.ReplayFromBlock(big.NewInt(int64(chainID)), block, false); err != nil { return err diff --git a/deployment/keystone/changeset/update_node_capabilities.go b/deployment/keystone/changeset/update_node_capabilities.go index 3bd772c9a25..0b6c4fb5462 100644 --- a/deployment/keystone/changeset/update_node_capabilities.go +++ b/deployment/keystone/changeset/update_node_capabilities.go @@ -49,7 +49,6 @@ func (req *MutateNodeCapabilitiesRequest) Validate() error { if len(req.P2pToCapabilities) == 0 { return fmt.Errorf("p2pToCapabilities is empty") } - // NOTE: This does not support non-evm chains _, exists := chainsel.ChainBySelector(req.RegistryChainSel) if !exists { return fmt.Errorf("registry chain selector %d does not exist", req.RegistryChainSel) diff --git a/deployment/keystone/changeset/view.go b/deployment/keystone/changeset/view.go index bf130d062a0..cab4ca25ae7 100644 --- a/deployment/keystone/changeset/view.go +++ b/deployment/keystone/changeset/view.go @@ -23,12 +23,10 @@ func ViewKeystone(e deployment.Environment) (json.Marshaler, error) { } chainViews := make(map[string]view.KeystoneChainView) for chainSel, contracts := range state.ContractSets { - // NOTE: This does not support non-evm chains chainid, err := chainsel.ChainIdFromSelector(chainSel) if err != nil { return nil, err } - // NOTE: This does not support non-evm chains chainName, err := chainsel.NameFromChainId(chainid) if err != nil { return nil, err diff --git a/deployment/keystone/deploy.go b/deployment/keystone/deploy.go index ceae899c22e..3019f934a96 100644 --- a/deployment/keystone/deploy.go +++ b/deployment/keystone/deploy.go @@ -57,7 +57,6 @@ func (r ConfigureContractsRequest) Validate() error { return fmt.Errorf("don validation failed for '%s': %w", don.Name, err) } } - // NOTE: This does not support non-evm chains _, ok := chainsel.ChainBySelector(r.RegistryChainSel) if !ok { return fmt.Errorf("chain %d not found in environment", r.RegistryChainSel) diff --git a/deployment/keystone/types.go b/deployment/keystone/types.go index f19781781d0..e5657657ed9 100644 --- a/deployment/keystone/types.go +++ b/deployment/keystone/types.go @@ -256,7 +256,6 @@ func NodeOperator(name string, adminAddress string) capabilities_registry.Capabi } func AdminAddress(n *Node, chainSel uint64) (string, error) { - // NOTE: This does not support non-evm chains cid, err := chainsel.ChainIdFromSelector(chainSel) if err != nil { return "", fmt.Errorf("failed to get chain id from selector %d: %w", chainSel, err) @@ -356,7 +355,6 @@ func firstChainConfigByType(ccfgs []*v1.ChainConfig, t v1.ChainType) (*v1.ChainC } func registryChainConfig(ccfgs []*v1.ChainConfig, t v1.ChainType, sel uint64) (*v1.ChainConfig, error) { - // NOTE: This does not support non-evm chains chainId, err := chainsel.ChainIdFromSelector(sel) if err != nil { return nil, fmt.Errorf("failed to get chain id from selector %d: %w", sel, err) diff --git a/integration-tests/ccip-tests/actions/ccip_helpers.go b/integration-tests/ccip-tests/actions/ccip_helpers.go index 88436c7cb76..d0587dad789 100644 --- a/integration-tests/ccip-tests/actions/ccip_helpers.go +++ b/integration-tests/ccip-tests/actions/ccip_helpers.go @@ -463,7 +463,6 @@ func (ccipModule *CCIPCommon) WaitForPriceUpdates( destChainId uint64, allTokens []common.Address, ) error { - // NOTE: This does not support non-evm chains destChainSelector, err := chainselectors.SelectorFromChainId(destChainId) if err != nil { return err @@ -558,7 +557,6 @@ func (ccipModule *CCIPCommon) WatchForPriceUpdates(ctx context.Context, lggr *ze return fmt.Errorf("no event subscription found") } processEvent := func(value, timestamp *big.Int, destChainSelector uint64, raw types.Log) error { - // NOTE: This does not support non-evm chains destChain, err := chainselectors.ChainIdFromSelector(destChainSelector) if err != nil { return err @@ -669,7 +667,6 @@ func (ccipModule *CCIPCommon) SyncUSDCDomain(destTransmitter *contracts.TokenTra if destTransmitter == nil { return fmt.Errorf("invalid address") } - // NOTE: This does not support non-evm chains destChainSelector, err := chainselectors.SelectorFromChainId(destChainID) if err != nil { return fmt.Errorf("invalid chain id %w", err) @@ -1398,7 +1395,6 @@ func (sourceCCIP *SourceCCIPModule) DeployContracts(lane *laneconfig.LaneConfig) log.Info().Msg("Deploying source chain specific contracts") sourceCCIP.LoadContracts(lane) - // NOTE: This does not support non-evm chains sourceChainSelector, err := chainselectors.SelectorFromChainId(sourceCCIP.Common.ChainClient.GetChainID().Uint64()) if err != nil { return fmt.Errorf("getting chain selector shouldn't fail %w", err) @@ -1839,7 +1835,6 @@ func (sourceCCIP *SourceCCIPModule) SendRequest( gasLimit *big.Int, ) (common.Hash, time.Duration, *big.Int, error) { var d time.Duration - // NOTE: This does not support non-evm chains destChainSelector, err := chainselectors.SelectorFromChainId(sourceCCIP.DestinationChainId) if err != nil { return common.Hash{}, d, nil, fmt.Errorf("failed getting the chain selector: %w", err) @@ -1909,7 +1904,6 @@ func DefaultSourceCCIPModule( return nil, err } - // NOTE: This does not support non-evm chains destChainSelector, err := chainselectors.SelectorFromChainId(destChainId) if err != nil { return nil, fmt.Errorf("failed getting the chain selector: %w", err) @@ -2075,7 +2069,6 @@ func (destCCIP *DestCCIPModule) DeployContracts( contractDeployer := destCCIP.Common.Deployer log.Info().Msg("Deploying destination chain specific contracts") destCCIP.LoadContracts(lane) - // NOTE: This does not support non-evm chains destChainSelector, err := chainselectors.SelectorFromChainId(destCCIP.Common.ChainClient.GetChainID().Uint64()) if err != nil { return fmt.Errorf("failed to get chain selector for destination chain id %d: %w", destCCIP.Common.ChainClient.GetChainID().Uint64(), err) @@ -2664,7 +2657,6 @@ func DefaultDestinationCCIPModule( return nil, err } - // NOTE: This does not support non-evm chains sourceChainSelector, err := chainselectors.SelectorFromChainId(sourceChainId) if err != nil { return nil, fmt.Errorf("failed to get chain selector for source chain id %d: %w", sourceChainId, err) @@ -2874,7 +2866,6 @@ func (lane *CCIPLane) Multicall(noOfRequests int, multiSendAddr common.Address) if err != nil { return fmt.Errorf("failed to form the ccip message: %w", err) } - // NOTE: This does not support non-evm chains destChainSelector, err := chainselectors.SelectorFromChainId(lane.Source.DestinationChainId) if err != nil { return fmt.Errorf("failed getting the chain selector: %w", err) @@ -3060,12 +3051,10 @@ func (lane *CCIPLane) ExecuteManually(options ...ManualExecutionOption) error { } } } - // NOTE: This does not support non-evm chains destChainSelector, err := chainselectors.SelectorFromChainId(lane.DestChain.GetChainID().Uint64()) if err != nil { return err } - // NOTE: This does not support non-evm chains sourceChainSelector, err := chainselectors.SelectorFromChainId(lane.SourceChain.GetChainID().Uint64()) if err != nil { return err diff --git a/integration-tests/ccip-tests/load/ccip_loadgen.go b/integration-tests/ccip-tests/load/ccip_loadgen.go index 6986888228e..3ce770d31bc 100644 --- a/integration-tests/ccip-tests/load/ccip_loadgen.go +++ b/integration-tests/ccip-tests/load/ccip_loadgen.go @@ -269,7 +269,6 @@ func (c *CCIPE2ELoad) Call(_ *wasp.Generator) *wasp.Response { lggr.Debug().Str("triggeredAt", time.Now().GoString()).Msg("triggering transfer") var sendTx *types.Transaction - // NOTE: This does not support non-evm chains destChainSelector, err := chain_selectors.SelectorFromChainId(sourceCCIP.DestinationChainId) if err != nil { res.Error = fmt.Sprintf("reqNo %d err %s - while getting selector from chainid", msgSerialNo, err.Error()) diff --git a/integration-tests/ccip-tests/load/ccip_multicall_loadgen.go b/integration-tests/ccip-tests/load/ccip_multicall_loadgen.go index c1573c8b962..04fcffaa4b1 100644 --- a/integration-tests/ccip-tests/load/ccip_multicall_loadgen.go +++ b/integration-tests/ccip-tests/load/ccip_multicall_loadgen.go @@ -224,7 +224,6 @@ func (m *CCIPMultiCallLoadGenerator) MergeCalls() ([]contracts.CCIPMsgData, map[ statDetails := make(map[string]MultiCallReturnValues) for _, e2eLoad := range m.E2ELoads { - // NOTE: This does not support non-evm chains destChainSelector, err := chain_selectors.SelectorFromChainId(e2eLoad.Lane.Source.DestinationChainId) if err != nil { return ccipMsgs, statDetails, err From 374ee753064066446f8a5d8ddde9e674bc43117e Mon Sep 17 00:00:00 2001 From: jlaveracll Date: Thu, 21 Nov 2024 12:08:45 -0300 Subject: [PATCH 07/10] clean up --- core/capabilities/ccip/delegate.go | 1 - .../ccip/oraclecreator/bootstrap.go | 1 - .../capabilities/ccip/oraclecreator/plugin.go | 71 +++++++++---------- 3 files changed, 34 insertions(+), 39 deletions(-) diff --git a/core/capabilities/ccip/delegate.go b/core/capabilities/ccip/delegate.go index 1ce461348f8..09e3769627e 100644 --- a/core/capabilities/ccip/delegate.go +++ b/core/capabilities/ccip/delegate.go @@ -179,7 +179,6 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) (services if err != nil { return nil, fmt.Errorf("failed to parse chain ID %s: %w", d.capabilityConfig.ExternalRegistry().RelayID().ChainID, err) } - homeChainChainSelector, err := chainsel.SelectorFromChainId(homeChainChainID) if err != nil { return nil, fmt.Errorf("failed to get chain selector from chain ID %d", homeChainChainID) diff --git a/core/capabilities/ccip/oraclecreator/bootstrap.go b/core/capabilities/ccip/oraclecreator/bootstrap.go index 311080e875d..632ac789c8e 100644 --- a/core/capabilities/ccip/oraclecreator/bootstrap.go +++ b/core/capabilities/ccip/oraclecreator/bootstrap.go @@ -145,7 +145,6 @@ func (i *bootstrapOracleCreator) Create(ctx context.Context, _ uint32, config cc // TODO: add an api that returns chain family. // NOTE: this doesn't really matter for the bootstrap node, it doesn't do anything on-chain. // Its for the monitoring endpoint generation below. - chainID, err := chainsel.ChainIdFromSelector(uint64(config.Config.ChainSelector)) if err != nil { return nil, fmt.Errorf("failed to get chain ID from selector: %w", err) diff --git a/core/capabilities/ccip/oraclecreator/plugin.go b/core/capabilities/ccip/oraclecreator/plugin.go index bfdcd0156f0..573d1dd0cac 100644 --- a/core/capabilities/ccip/oraclecreator/plugin.go +++ b/core/capabilities/ccip/oraclecreator/plugin.go @@ -43,6 +43,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocr2key" "github.com/smartcontractkit/chainlink/v2/core/services/ocrcommon" + "github.com/smartcontractkit/chainlink/v2/core/services/relay" evmrelaytypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" "github.com/smartcontractkit/chainlink/v2/core/services/synchronization" "github.com/smartcontractkit/chainlink/v2/core/services/telemetry" @@ -116,18 +117,15 @@ func (i *pluginOracleCreator) Type() cctypes.OracleType { // Create implements types.OracleCreator. func (i *pluginOracleCreator) Create(ctx context.Context, donID uint32, config cctypes.OCR3ConfigWithMeta) (cctypes.CCIPOracle, error) { pluginType := cctypes.PluginType(config.Config.PluginType) - chainSelector := uint64(config.Config.ChainSelector) - destChainFamily, err := chainsel.GetSelectorFamily(chainSelector) + // Assuming that the chain selector is referring to an evm chain for now. + // TODO: add an api that returns chain family. + destChainID, err := chainsel.ChainIdFromSelector(uint64(config.Config.ChainSelector)) if err != nil { - return nil, fmt.Errorf("failed to get chain family from selector %d: %w", config.Config.ChainSelector, err) + return nil, fmt.Errorf("failed to get chain ID from selector %d: %w", config.Config.ChainSelector, err) } - - destChainID, err := chainsel.GetChainIDFromSelector(chainSelector) - if err != nil { - return nil, fmt.Errorf("failed to get chain ID from selector %d: %w", chainSelector, err) - } - destRelayID := types.NewRelayID(destChainFamily, destChainID) + destChainFamily := relay.NetworkEVM + destRelayID := types.NewRelayID(destChainFamily, fmt.Sprintf("%d", destChainID)) configTracker := ocrimpls.NewConfigTracker(config) publicConfig, err := configTracker.PublicConfig() @@ -141,7 +139,6 @@ func (i *pluginOracleCreator) Create(ctx context.Context, donID uint32, config c pluginType, config, publicConfig, - destChainFamily, ) if err != nil { return nil, fmt.Errorf("failed to create readers and writers: %w", err) @@ -296,11 +293,10 @@ func (i *pluginOracleCreator) createFactoryAndTransmitter( func (i *pluginOracleCreator) createReadersAndWriters( ctx context.Context, - destChainID string, + destChainID uint64, pluginType cctypes.PluginType, config cctypes.OCR3ConfigWithMeta, publicCfg ocr3confighelper.PublicConfig, - chainFamily string, ) ( map[cciptypes.ChainSelector]types.ContractReader, map[cciptypes.ChainSelector]types.ChainWriter, @@ -328,14 +324,17 @@ func (i *pluginOracleCreator) createReadersAndWriters( contractReaders := make(map[cciptypes.ChainSelector]types.ContractReader) chainWriters := make(map[cciptypes.ChainSelector]types.ChainWriter) for relayID, relayer := range i.relayers { - chainID := relayID.ChainID + chainID, ok := new(big.Int).SetString(relayID.ChainID, 10) + if !ok { + return nil, nil, fmt.Errorf("error parsing chain ID, expected big int: %s", relayID.ChainID) + } - chainSelector, err1 := i.getChainSelector(chainID, chainFamily) + chainSelector, err1 := i.getChainSelector(chainID.Uint64()) if err1 != nil { - return nil, nil, fmt.Errorf("failed to get chain selector from chain ID %s: %w", chainID, err1) + return nil, nil, fmt.Errorf("failed to get chain selector from chain ID %s: %w", chainID.String(), err1) } - chainReaderConfig, err1 := getChainReaderConfig(i.lggr, chainID, destChainID, homeChainID, ofc, chainSelector) + chainReaderConfig, err1 := getChainReaderConfig(i.lggr, chainID.Uint64(), destChainID, homeChainID, ofc, chainSelector) if err1 != nil { return nil, nil, fmt.Errorf("failed to get chain reader config: %w", err1) } @@ -345,7 +344,7 @@ func (i *pluginOracleCreator) createReadersAndWriters( return nil, nil, err1 } - if chainID == destChainID { + if chainID.Uint64() == destChainID { offrampAddressHex := common.BytesToAddress(config.Config.OfframpAddress).Hex() err2 := cr.Bind(ctx, []types.BoundContract{ { @@ -354,12 +353,12 @@ func (i *pluginOracleCreator) createReadersAndWriters( }, }) if err2 != nil { - return nil, nil, fmt.Errorf("failed to bind chain reader for dest chain %s's offramp at %s: %w", chainID, offrampAddressHex, err) + return nil, nil, fmt.Errorf("failed to bind chain reader for dest chain %s's offramp at %s: %w", chainID.String(), offrampAddressHex, err) } } if err2 := cr.Start(ctx); err2 != nil { - return nil, nil, fmt.Errorf("failed to start contract reader for chain %s: %w", chainID, err2) + return nil, nil, fmt.Errorf("failed to start contract reader for chain %s: %w", chainID.String(), err2) } cw, err1 := createChainWriter( @@ -367,14 +366,13 @@ func (i *pluginOracleCreator) createReadersAndWriters( chainID, relayer, i.transmitters, - execBatchGasLimit, - chainFamily) + execBatchGasLimit) if err1 != nil { return nil, nil, err1 } if err4 := cw.Start(ctx); err4 != nil { - return nil, nil, fmt.Errorf("failed to start chain writer for chain %s: %w", chainID, err4) + return nil, nil, fmt.Errorf("failed to start chain writer for chain %s: %w", chainID.String(), err4) } contractReaders[chainSelector] = cr @@ -413,27 +411,27 @@ func decodeAndValidateOffchainConfig( return ofc, nil } -func (i *pluginOracleCreator) getChainSelector(chainID string, chainFamily string) (cciptypes.ChainSelector, error) { - chainDetails, err := chainsel.GetChainDetailsByChainIDAndFamily(chainID, chainFamily) - if err != nil { - return 0, fmt.Errorf("failed to get chain selector from chain ID %s and family %s", chainID, chainFamily) +func (i *pluginOracleCreator) getChainSelector(chainID uint64) (cciptypes.ChainSelector, error) { + chainSelector, ok := chainsel.EvmChainIdToChainSelector()[chainID] + if !ok { + return 0, fmt.Errorf("failed to get chain selector from chain ID %d", chainID) } - return cciptypes.ChainSelector(chainDetails.ChainSelector), nil + return cciptypes.ChainSelector(chainSelector), nil } -func (i *pluginOracleCreator) getChainID(chainSelector cciptypes.ChainSelector) (string, error) { - chainID, err := chainsel.GetChainIDFromSelector(uint64(chainSelector)) +func (i *pluginOracleCreator) getChainID(chainSelector cciptypes.ChainSelector) (uint64, error) { + chainID, err := chainsel.ChainIdFromSelector(uint64(chainSelector)) if err != nil { - return "", fmt.Errorf("failed to get chain ID from chain selector %d: %w", chainSelector, err) + return 0, fmt.Errorf("failed to get chain ID from chain selector %d: %w", chainSelector, err) } return chainID, nil } func getChainReaderConfig( lggr logger.Logger, - chainID string, - destChainID string, - homeChainID string, + chainID uint64, + destChainID uint64, + homeChainID uint64, ofc offChainConfig, chainSelector cciptypes.ChainSelector, ) ([]byte, error) { @@ -477,14 +475,13 @@ func isUSDCEnabled(ofc offChainConfig) bool { func createChainWriter( ctx context.Context, - chainID string, + chainID *big.Int, relayer loop.Relayer, transmitters map[types.RelayID][]string, execBatchGasLimit uint64, - chainFamily string, ) (types.ChainWriter, error) { var fromAddress common.Address - transmitter, ok := transmitters[types.NewRelayID(chainFamily, chainID)] + transmitter, ok := transmitters[types.NewRelayID(relay.NetworkEVM, chainID.String())] if ok { // TODO: remove EVM-specific stuff fromAddress = common.HexToAddress(transmitter[0]) @@ -506,7 +503,7 @@ func createChainWriter( cw, err := relayer.NewChainWriter(ctx, chainWriterConfig) if err != nil { - return nil, fmt.Errorf("failed to create chain writer for chain %s: %w", chainID, err) + return nil, fmt.Errorf("failed to create chain writer for chain %s: %w", chainID.String(), err) } return cw, nil From 122241f3a27b0aff00b1d90ac7cbd23386e3df8e Mon Sep 17 00:00:00 2001 From: jlaveracll Date: Thu, 21 Nov 2024 12:12:03 -0300 Subject: [PATCH 08/10] Update plugin.go --- .../capabilities/ccip/oraclecreator/plugin.go | 70 ++++++++++--------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/core/capabilities/ccip/oraclecreator/plugin.go b/core/capabilities/ccip/oraclecreator/plugin.go index 573d1dd0cac..a5063eb8d1c 100644 --- a/core/capabilities/ccip/oraclecreator/plugin.go +++ b/core/capabilities/ccip/oraclecreator/plugin.go @@ -43,7 +43,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocr2key" "github.com/smartcontractkit/chainlink/v2/core/services/ocrcommon" - "github.com/smartcontractkit/chainlink/v2/core/services/relay" evmrelaytypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types" "github.com/smartcontractkit/chainlink/v2/core/services/synchronization" "github.com/smartcontractkit/chainlink/v2/core/services/telemetry" @@ -117,15 +116,17 @@ func (i *pluginOracleCreator) Type() cctypes.OracleType { // Create implements types.OracleCreator. func (i *pluginOracleCreator) Create(ctx context.Context, donID uint32, config cctypes.OCR3ConfigWithMeta) (cctypes.CCIPOracle, error) { pluginType := cctypes.PluginType(config.Config.PluginType) + chainSelector := uint64(config.Config.ChainSelector) + destChainFamily, err := chainsel.GetSelectorFamily(chainSelector) + if err != nil { + return nil, fmt.Errorf("failed to get chain family from selector %d: %w", config.Config.ChainSelector, err) + } - // Assuming that the chain selector is referring to an evm chain for now. - // TODO: add an api that returns chain family. - destChainID, err := chainsel.ChainIdFromSelector(uint64(config.Config.ChainSelector)) + destChainID, err := chainsel.GetChainIDFromSelector(chainSelector) if err != nil { - return nil, fmt.Errorf("failed to get chain ID from selector %d: %w", config.Config.ChainSelector, err) + return nil, fmt.Errorf("failed to get chain ID from selector %d: %w", chainSelector, err) } - destChainFamily := relay.NetworkEVM - destRelayID := types.NewRelayID(destChainFamily, fmt.Sprintf("%d", destChainID)) + destRelayID := types.NewRelayID(destChainFamily, destChainID) configTracker := ocrimpls.NewConfigTracker(config) publicConfig, err := configTracker.PublicConfig() @@ -139,6 +140,7 @@ func (i *pluginOracleCreator) Create(ctx context.Context, donID uint32, config c pluginType, config, publicConfig, + destChainFamily, ) if err != nil { return nil, fmt.Errorf("failed to create readers and writers: %w", err) @@ -293,10 +295,11 @@ func (i *pluginOracleCreator) createFactoryAndTransmitter( func (i *pluginOracleCreator) createReadersAndWriters( ctx context.Context, - destChainID uint64, + destChainID string, pluginType cctypes.PluginType, config cctypes.OCR3ConfigWithMeta, publicCfg ocr3confighelper.PublicConfig, + chainFamily string, ) ( map[cciptypes.ChainSelector]types.ContractReader, map[cciptypes.ChainSelector]types.ChainWriter, @@ -324,17 +327,14 @@ func (i *pluginOracleCreator) createReadersAndWriters( contractReaders := make(map[cciptypes.ChainSelector]types.ContractReader) chainWriters := make(map[cciptypes.ChainSelector]types.ChainWriter) for relayID, relayer := range i.relayers { - chainID, ok := new(big.Int).SetString(relayID.ChainID, 10) - if !ok { - return nil, nil, fmt.Errorf("error parsing chain ID, expected big int: %s", relayID.ChainID) - } + chainID := relayID.ChainID - chainSelector, err1 := i.getChainSelector(chainID.Uint64()) + chainSelector, err1 := i.getChainSelector(chainID, chainFamily) if err1 != nil { - return nil, nil, fmt.Errorf("failed to get chain selector from chain ID %s: %w", chainID.String(), err1) + return nil, nil, fmt.Errorf("failed to get chain selector from chain ID %s: %w", chainID, err1) } - chainReaderConfig, err1 := getChainReaderConfig(i.lggr, chainID.Uint64(), destChainID, homeChainID, ofc, chainSelector) + chainReaderConfig, err1 := getChainReaderConfig(i.lggr, chainID, destChainID, homeChainID, ofc, chainSelector) if err1 != nil { return nil, nil, fmt.Errorf("failed to get chain reader config: %w", err1) } @@ -344,7 +344,7 @@ func (i *pluginOracleCreator) createReadersAndWriters( return nil, nil, err1 } - if chainID.Uint64() == destChainID { + if chainID == destChainID { offrampAddressHex := common.BytesToAddress(config.Config.OfframpAddress).Hex() err2 := cr.Bind(ctx, []types.BoundContract{ { @@ -353,12 +353,12 @@ func (i *pluginOracleCreator) createReadersAndWriters( }, }) if err2 != nil { - return nil, nil, fmt.Errorf("failed to bind chain reader for dest chain %s's offramp at %s: %w", chainID.String(), offrampAddressHex, err) + return nil, nil, fmt.Errorf("failed to bind chain reader for dest chain %s's offramp at %s: %w", chainID, offrampAddressHex, err) } } if err2 := cr.Start(ctx); err2 != nil { - return nil, nil, fmt.Errorf("failed to start contract reader for chain %s: %w", chainID.String(), err2) + return nil, nil, fmt.Errorf("failed to start contract reader for chain %s: %w", chainID, err2) } cw, err1 := createChainWriter( @@ -366,13 +366,14 @@ func (i *pluginOracleCreator) createReadersAndWriters( chainID, relayer, i.transmitters, - execBatchGasLimit) + execBatchGasLimit, + chainFamily) if err1 != nil { return nil, nil, err1 } if err4 := cw.Start(ctx); err4 != nil { - return nil, nil, fmt.Errorf("failed to start chain writer for chain %s: %w", chainID.String(), err4) + return nil, nil, fmt.Errorf("failed to start chain writer for chain %s: %w", chainID, err4) } contractReaders[chainSelector] = cr @@ -411,27 +412,27 @@ func decodeAndValidateOffchainConfig( return ofc, nil } -func (i *pluginOracleCreator) getChainSelector(chainID uint64) (cciptypes.ChainSelector, error) { - chainSelector, ok := chainsel.EvmChainIdToChainSelector()[chainID] - if !ok { - return 0, fmt.Errorf("failed to get chain selector from chain ID %d", chainID) +func (i *pluginOracleCreator) getChainSelector(chainID string, chainFamily string) (cciptypes.ChainSelector, error) { + chainDetails, err := chainsel.GetChainDetailsByChainIDAndFamily(chainID, chainFamily) + if err != nil { + return 0, fmt.Errorf("failed to get chain selector from chain ID %s and family %s", chainID, chainFamily) } - return cciptypes.ChainSelector(chainSelector), nil + return cciptypes.ChainSelector(chainDetails.ChainSelector), nil } -func (i *pluginOracleCreator) getChainID(chainSelector cciptypes.ChainSelector) (uint64, error) { - chainID, err := chainsel.ChainIdFromSelector(uint64(chainSelector)) +func (i *pluginOracleCreator) getChainID(chainSelector cciptypes.ChainSelector) (string, error) { + chainID, err := chainsel.GetChainIDFromSelector(uint64(chainSelector)) if err != nil { - return 0, fmt.Errorf("failed to get chain ID from chain selector %d: %w", chainSelector, err) + return "", fmt.Errorf("failed to get chain ID from chain selector %d: %w", chainSelector, err) } return chainID, nil } func getChainReaderConfig( lggr logger.Logger, - chainID uint64, - destChainID uint64, - homeChainID uint64, + chainID string, + destChainID string, + homeChainID string, ofc offChainConfig, chainSelector cciptypes.ChainSelector, ) ([]byte, error) { @@ -475,13 +476,14 @@ func isUSDCEnabled(ofc offChainConfig) bool { func createChainWriter( ctx context.Context, - chainID *big.Int, + chainID string, relayer loop.Relayer, transmitters map[types.RelayID][]string, execBatchGasLimit uint64, + chainFamily string, ) (types.ChainWriter, error) { var fromAddress common.Address - transmitter, ok := transmitters[types.NewRelayID(relay.NetworkEVM, chainID.String())] + transmitter, ok := transmitters[types.NewRelayID(chainFamily, chainID)] if ok { // TODO: remove EVM-specific stuff fromAddress = common.HexToAddress(transmitter[0]) @@ -503,7 +505,7 @@ func createChainWriter( cw, err := relayer.NewChainWriter(ctx, chainWriterConfig) if err != nil { - return nil, fmt.Errorf("failed to create chain writer for chain %s: %w", chainID.String(), err) + return nil, fmt.Errorf("failed to create chain writer for chain %s: %w", chainID, err) } return cw, nil From f013d316cff1e32f121775f7c35af4e733cb0ec8 Mon Sep 17 00:00:00 2001 From: jlaveracll Date: Thu, 21 Nov 2024 15:02:28 -0300 Subject: [PATCH 09/10] bump chain selector to 1.0.31 --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- deployment/go.mod | 2 +- deployment/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- integration-tests/load/go.mod | 2 +- integration-tests/load/go.sum | 4 ++-- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 3ba1a3c3847..ebbb1e3f717 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -296,7 +296,7 @@ require ( github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/shirou/gopsutil/v3 v3.24.3 // indirect github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240926212305-a6deabdfce86 // indirect - github.com/smartcontractkit/chain-selectors v1.0.29 // indirect + github.com/smartcontractkit/chain-selectors v1.0.31 // indirect github.com/smartcontractkit/chainlink-ccip v0.0.0-20241118091009-43c2b4804cec // indirect github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f // indirect github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241114154055-8d29ea018b57 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 68809a14667..ed2e64a42cb 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1088,8 +1088,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240926212305-a6deabdfce86 h1:qQH6fZZe31nBAG6INHph3z5ysDTPptyu0TR9uoJ1+ok= github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240926212305-a6deabdfce86/go.mod h1:WtWOoVQQEHxRHL2hNmuRrvDfYfQG/CioFNoa9Rr2mBE= -github.com/smartcontractkit/chain-selectors v1.0.29 h1:aZ9+OoUSMn4nqnissHtDvDoKR7JONfDqTHX3MHYIUIE= -github.com/smartcontractkit/chain-selectors v1.0.29/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= +github.com/smartcontractkit/chain-selectors v1.0.31 h1:oRHyK88KnsCh4OdU2hr0u70pm3KUgyMDyK0v0aOtUk4= +github.com/smartcontractkit/chain-selectors v1.0.31/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgBc2xpDKBco/Q4h4ydl6+UUU= github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241118091009-43c2b4804cec h1:5vS1k8Qn09p8SQ3JzvS8iy4Pve7s3aVq+UPIdl74smY= diff --git a/deployment/go.mod b/deployment/go.mod index 80d0b4377c0..dee412754a5 100644 --- a/deployment/go.mod +++ b/deployment/go.mod @@ -21,7 +21,7 @@ require ( github.com/rs/zerolog v1.33.0 github.com/sethvargo/go-retry v0.2.4 github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240926212305-a6deabdfce86 - github.com/smartcontractkit/chain-selectors v1.0.29 + github.com/smartcontractkit/chain-selectors v1.0.31 github.com/smartcontractkit/chainlink-ccip v0.0.0-20241118091009-43c2b4804cec github.com/smartcontractkit/chainlink-common v0.3.1-0.20241120111740-a6a70ec7692b github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0 diff --git a/deployment/go.sum b/deployment/go.sum index 4ecc9148275..3b51cf5feed 100644 --- a/deployment/go.sum +++ b/deployment/go.sum @@ -1378,8 +1378,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240926212305-a6deabdfce86 h1:qQH6fZZe31nBAG6INHph3z5ysDTPptyu0TR9uoJ1+ok= github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240926212305-a6deabdfce86/go.mod h1:WtWOoVQQEHxRHL2hNmuRrvDfYfQG/CioFNoa9Rr2mBE= -github.com/smartcontractkit/chain-selectors v1.0.29 h1:aZ9+OoUSMn4nqnissHtDvDoKR7JONfDqTHX3MHYIUIE= -github.com/smartcontractkit/chain-selectors v1.0.29/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= +github.com/smartcontractkit/chain-selectors v1.0.31 h1:oRHyK88KnsCh4OdU2hr0u70pm3KUgyMDyK0v0aOtUk4= +github.com/smartcontractkit/chain-selectors v1.0.31/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgBc2xpDKBco/Q4h4ydl6+UUU= github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241118091009-43c2b4804cec h1:5vS1k8Qn09p8SQ3JzvS8iy4Pve7s3aVq+UPIdl74smY= diff --git a/go.mod b/go.mod index 7753c4f7d32..428fc4b9489 100644 --- a/go.mod +++ b/go.mod @@ -74,7 +74,7 @@ require ( github.com/scylladb/go-reflectx v1.0.1 github.com/shirou/gopsutil/v3 v3.24.3 github.com/shopspring/decimal v1.4.0 - github.com/smartcontractkit/chain-selectors v1.0.29 + github.com/smartcontractkit/chain-selectors v1.0.31 github.com/smartcontractkit/chainlink-automation v0.8.1 github.com/smartcontractkit/chainlink-ccip v0.0.0-20241118091009-43c2b4804cec github.com/smartcontractkit/chainlink-common v0.3.1-0.20241120111740-a6a70ec7692b diff --git a/go.sum b/go.sum index 43f4a8bd7fb..56523e53528 100644 --- a/go.sum +++ b/go.sum @@ -1072,8 +1072,8 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/smartcontractkit/chain-selectors v1.0.29 h1:aZ9+OoUSMn4nqnissHtDvDoKR7JONfDqTHX3MHYIUIE= -github.com/smartcontractkit/chain-selectors v1.0.29/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= +github.com/smartcontractkit/chain-selectors v1.0.31 h1:oRHyK88KnsCh4OdU2hr0u70pm3KUgyMDyK0v0aOtUk4= +github.com/smartcontractkit/chain-selectors v1.0.31/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgBc2xpDKBco/Q4h4ydl6+UUU= github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241118091009-43c2b4804cec h1:5vS1k8Qn09p8SQ3JzvS8iy4Pve7s3aVq+UPIdl74smY= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index ea469a50b76..4d6d7cd485e 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -34,7 +34,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/shopspring/decimal v1.4.0 github.com/slack-go/slack v0.15.0 - github.com/smartcontractkit/chain-selectors v1.0.29 + github.com/smartcontractkit/chain-selectors v1.0.31 github.com/smartcontractkit/chainlink-automation v0.8.1 github.com/smartcontractkit/chainlink-common v0.3.1-0.20241120111740-a6a70ec7692b github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 095f6728c13..1cd14814313 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1399,8 +1399,8 @@ github.com/slack-go/slack v0.15.0 h1:LE2lj2y9vqqiOf+qIIy0GvEoxgF1N5yLGZffmEZykt0 github.com/slack-go/slack v0.15.0/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240926212305-a6deabdfce86 h1:qQH6fZZe31nBAG6INHph3z5ysDTPptyu0TR9uoJ1+ok= github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240926212305-a6deabdfce86/go.mod h1:WtWOoVQQEHxRHL2hNmuRrvDfYfQG/CioFNoa9Rr2mBE= -github.com/smartcontractkit/chain-selectors v1.0.29 h1:aZ9+OoUSMn4nqnissHtDvDoKR7JONfDqTHX3MHYIUIE= -github.com/smartcontractkit/chain-selectors v1.0.29/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= +github.com/smartcontractkit/chain-selectors v1.0.31 h1:oRHyK88KnsCh4OdU2hr0u70pm3KUgyMDyK0v0aOtUk4= +github.com/smartcontractkit/chain-selectors v1.0.31/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgBc2xpDKBco/Q4h4ydl6+UUU= github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241118091009-43c2b4804cec h1:5vS1k8Qn09p8SQ3JzvS8iy4Pve7s3aVq+UPIdl74smY= diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index 7635e58e88d..cdb7601a114 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -397,7 +397,7 @@ require ( github.com/shoenig/test v0.6.6 // indirect github.com/shopspring/decimal v1.4.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect - github.com/smartcontractkit/chain-selectors v1.0.29 // indirect + github.com/smartcontractkit/chain-selectors v1.0.31 // indirect github.com/smartcontractkit/chainlink-automation v0.8.1 // indirect github.com/smartcontractkit/chainlink-ccip v0.0.0-20241118091009-43c2b4804cec // indirect github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f // indirect diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index b4367bebd30..b02e0bd1547 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -1388,8 +1388,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/slack-go/slack v0.15.0 h1:LE2lj2y9vqqiOf+qIIy0GvEoxgF1N5yLGZffmEZykt0= github.com/slack-go/slack v0.15.0/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= -github.com/smartcontractkit/chain-selectors v1.0.29 h1:aZ9+OoUSMn4nqnissHtDvDoKR7JONfDqTHX3MHYIUIE= -github.com/smartcontractkit/chain-selectors v1.0.29/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= +github.com/smartcontractkit/chain-selectors v1.0.31 h1:oRHyK88KnsCh4OdU2hr0u70pm3KUgyMDyK0v0aOtUk4= +github.com/smartcontractkit/chain-selectors v1.0.31/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8= github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgBc2xpDKBco/Q4h4ydl6+UUU= github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241118091009-43c2b4804cec h1:5vS1k8Qn09p8SQ3JzvS8iy4Pve7s3aVq+UPIdl74smY= From 986a6a4a8d02211a50814279a73c8d004443ffa3 Mon Sep 17 00:00:00 2001 From: jlaveracll Date: Fri, 22 Nov 2024 01:24:02 -0300 Subject: [PATCH 10/10] ran make gomodtidy --- integration-tests/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/go.mod b/integration-tests/go.mod index ddad0424f56..9b7617b0c39 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -34,8 +34,8 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/shopspring/decimal v1.4.0 github.com/slack-go/slack v0.15.0 - github.com/smartcontractkit/chain-selectors v1.0.31 github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240926212305-a6deabdfce86 + github.com/smartcontractkit/chain-selectors v1.0.31 github.com/smartcontractkit/chainlink-automation v0.8.1 github.com/smartcontractkit/chainlink-ccip v0.0.0-20241118091009-43c2b4804cec github.com/smartcontractkit/chainlink-common v0.3.1-0.20241120111740-a6a70ec7692b