From 0fa175b2515419dc9a1c1e5bc87b19a9656e2555 Mon Sep 17 00:00:00 2001 From: Hanzo AI Date: Mon, 1 Jun 2026 16:45:49 -0700 Subject: [PATCH] genesis: add I/O/R chains to primary network registry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OracleVM, RelayVM, IdentityVM were previously registered as optional VMs (loadable via CreateChainTx) but not part of the genesis-baked primary network registry. Adding them to the registry means the VM alias machinery + VMAliases map now know about all 14 primary-network chains by canonical letter and alias set. Order is append-only per the comment in registry.go — I/O/R land at positions 12/13/14. Each row picks a unique alias triple: I: identity, identityvm, id O: oracle, oraclevm, feed R: relay, relayvm, msg This change does NOT bake I/O/R into FromConfig's primary-genesis optIn loop — that would require new IChainGenesis/OChainGenesis/ RChainGenesis fields on genesiscfg.Config plus matching ichain.json/ ochain.json/rchain.json shards under genesis/configs/{net}/. I/O/R continue to be instantiated via CreateChainTx post-genesis (as today). What the registry update unblocks is the alias resolution path so when those chains DO get created, the VM manager knows them by canonical name without per-chain switch-ladder edits. builder.Aliases() gets matching cases for the three new VMIDs so when a future genesis bakes them, chain alias registration works without further changes. Existing tests in TestChainAliasesRegistryParity and TestVMAliasesRegistryParity get three new rows each; both pass. --- genesis/builder/builder.go | 33 ++++++++++++++++++++++++++++++++ genesis/builder/registry.go | 3 +++ genesis/builder/registry_test.go | 6 ++++++ 3 files changed, 42 insertions(+) diff --git a/genesis/builder/builder.go b/genesis/builder/builder.go index a6df655c35..98d4ce00c8 100644 --- a/genesis/builder/builder.go +++ b/genesis/builder/builder.go @@ -58,6 +58,9 @@ var ( ZChainAliases = AliasesFor("Z") GChainAliases = AliasesFor("G") KChainAliases = AliasesFor("K") + IChainAliases = AliasesFor("I") + OChainAliases = AliasesFor("O") + RChainAliases = AliasesFor("R") // Network-specific genesis messages (Latin for mainnet, descriptive for others) // Mainnet: "Lux et Libertas" - Light and Liberty @@ -861,6 +864,36 @@ func Aliases(genesisBytes []byte) (map[string][]string, map[ids.ID][]string, err path.Join(constants.ChainAliasPrefix, "kms"), } chainAliases[chainID] = KChainAliases + case constants.IdentityVMID: + apiAliases[endpoint] = []string{ + "I", + "identity", + "identityvm", + "id", + path.Join(constants.ChainAliasPrefix, "I"), + path.Join(constants.ChainAliasPrefix, "identity"), + } + chainAliases[chainID] = IChainAliases + case constants.OracleVMID: + apiAliases[endpoint] = []string{ + "O", + "oracle", + "oraclevm", + "feed", + path.Join(constants.ChainAliasPrefix, "O"), + path.Join(constants.ChainAliasPrefix, "oracle"), + } + chainAliases[chainID] = OChainAliases + case constants.RelayVMID: + apiAliases[endpoint] = []string{ + "R", + "relay", + "relayvm", + "msg", + path.Join(constants.ChainAliasPrefix, "R"), + path.Join(constants.ChainAliasPrefix, "relay"), + } + chainAliases[chainID] = RChainAliases } } return apiAliases, chainAliases, nil diff --git a/genesis/builder/registry.go b/genesis/builder/registry.go index 4717ca144b..20027e3e11 100644 --- a/genesis/builder/registry.go +++ b/genesis/builder/registry.go @@ -66,6 +66,9 @@ var Registry = []ChainSpec{ {Letter: "Z", VMID: constants.ZKVMID, Aliases: []string{"zk", "zkvm"}, Name: "Z-Chain"}, {Letter: "G", VMID: constants.GraphVMID, Aliases: []string{"graph", "graphvm", "dgraph"}, Name: "G-Chain"}, {Letter: "K", VMID: constants.KeyVMID, Aliases: []string{"key", "keyvm"}, Name: "K-Chain"}, + {Letter: "I", VMID: constants.IdentityVMID, Aliases: []string{"identity", "identityvm", "id"}, Name: "I-Chain"}, + {Letter: "O", VMID: constants.OracleVMID, Aliases: []string{"oracle", "oraclevm", "feed"}, Name: "O-Chain"}, + {Letter: "R", VMID: constants.RelayVMID, Aliases: []string{"relay", "relayvm", "msg"}, Name: "R-Chain"}, } // specsByLetter is an O(1) lookup built once at package init. diff --git a/genesis/builder/registry_test.go b/genesis/builder/registry_test.go index 370bc13f69..036d8d7c8f 100644 --- a/genesis/builder/registry_test.go +++ b/genesis/builder/registry_test.go @@ -45,6 +45,9 @@ func TestChainAliasesRegistryParity(t *testing.T) { {"Z", ZChainAliases, []string{"Z", "zk", "zkvm"}}, {"G", GChainAliases, []string{"G", "graph", "graphvm", "dgraph"}}, {"K", KChainAliases, []string{"K", "key", "keyvm"}}, + {"I", IChainAliases, []string{"I", "identity", "identityvm", "id"}}, + {"O", OChainAliases, []string{"O", "oracle", "oraclevm", "feed"}}, + {"R", RChainAliases, []string{"R", "relay", "relayvm", "msg"}}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -73,6 +76,9 @@ func TestVMAliasesRegistryParity(t *testing.T) { constants.ZKVMID: {"zkvm", "zk"}, constants.GraphVMID: {"graphvm", "graph", "dgraph"}, constants.KeyVMID: {"keyvm", "key"}, + constants.IdentityVMID: {"identity", "identityvm", "id"}, + constants.OracleVMID: {"oracle", "oraclevm", "feed"}, + constants.RelayVMID: {"relay", "relayvm", "msg"}, secp256k1fx.ID: {"secp256k1fx"}, nftfx.ID: {"nftfx"}, propertyfx.ID: {"propertyfx"},