A given CCTP domain can be registered for multiple foreign chains due to insufficient validation in `Governance::registerEmitterAndDomain`
`Governance::registerEmitterAndDomain` is a Governance action that is used to register the emitter address and corresponding CCTP domain for a given foreign chain. Validation is currently performed to ensure that the registered CCTP domain of the foreign chain is not equal to that of the local chain; however, there is no such check to ensure that the given CCTP domain has not already been registered for a different foreign chain. In this case, where the CCTP domain of an existing foreign chain is mistakenly used in the registration of a new foreign chain, the `getDomainToChain` mapping of an existing CCTP domain will be overwritten to the most recently registered foreign chain. Given the validation that prevents foreign chains from being registered again, without a method for updating an already registered emitter, it will not be possible to correct this corruption of state.\\n```\\nfunction registerEmitterAndDomain(bytes memory encodedVaa) public {\\n    /* snip: parsing of Governance VAA payload */\\n\\n    // For now, ensure that we cannot register the same foreign chain again.\\n    require(registeredEmitters[foreignChain] == 0, "chain already registered");\\n\\n    /* snip: additional parsing of Governance VAA payload */\\n\\n    // Set the registeredEmitters state variable.\\n    registeredEmitters[foreignChain] = foreignAddress;\\n\\n    // update the chainId to domain (and domain to chainId) mappings\\n    getChainToDomain()[foreignChain] = cctpDomain;\\n    getDomainToChain()[cctpDomain] = foreignChain;\\n}\\n```\\n
Consider adding the following validation when registering a CCTP domain for a foreign chain:\\n```\\n// Add the line below\\n require (getDomainToChain()[cctpDomain] == 0, "CCTP domain already registered for a different foreign chain");\\n```\\n
The impact of this issue in the current scope is limited since the corrupted state is only ever queried in a public view function; however, if it is important for third-party integrators, then this has the potential to cause downstream issues.\\nProof of Concept:\\nCCTP Domain A is registered for foreign chain identifier X.\\nCCTP Domain A is again registered, this time for foreign chain identifier Y.\\nThe `getDomainToChain` mapping for CCTP Domain A now points to foreign chain identifier Y, while the `getChainToDomain` mapping for both X and Y now points to CCTP domain A.
```\\nfunction registerEmitterAndDomain(bytes memory encodedVaa) public {\\n    /* snip: parsing of Governance VAA payload */\\n\\n    // For now, ensure that we cannot register the same foreign chain again.\\n    require(registeredEmitters[foreignChain] == 0, "chain already registered");\\n\\n    /* snip: additional parsing of Governance VAA payload */\\n\\n    // Set the registeredEmitters state variable.\\n    registeredEmitters[foreignChain] = foreignAddress;\\n\\n    // update the chainId to domain (and domain to chainId) mappings\\n    getChainToDomain()[foreignChain] = cctpDomain;\\n    getDomainToChain()[cctpDomain] = foreignChain;\\n}\\n```\\n