node
node copied to clipboard
Allow to have chain with non-Integer chain IDs
Describe the Issue
We currently use a int64 type for chain ID that identifies a chain.
Some chain might not use an integer as the format for the chain ID. For example: Cosmos chain uses strings:
cosmoshub-4
injective-1
We should support static data for these chains.
Since changing the chain ID format would be a significant refactoring since we index many data using it. I think we could consider a virtual chain ID. A int64 id that identifies the chain ID on ZetaChain. Then a mapping object can be use to retrieve the actual chain ID.
It can follow a specific rule like 7010 + index of the chain using virtual chain ID
Example:
var CosmosHubChainID "cosmoshub-4"
var CosmosHubVirtualChainID 7010
CosmosHub {
ChainID: CosmosHubVirtualChainID
...
}
GetCosmosChainID(CosmosHubVirtualChainID) -> CosmosHubChainID
It seems to be the same with Solana. Doesn't seem to have a proper chain ID