Skip to content

genesis: add I/O/R chains to primary network registry#129

Open
hanzo-dev wants to merge 1 commit into
mainfrom
feat/genesis-registry-add-OIR
Open

genesis: add I/O/R chains to primary network registry#129
hanzo-dev wants to merge 1 commit into
mainfrom
feat/genesis-registry-add-OIR

Conversation

@hanzo-dev
Copy link
Copy Markdown
Member

Summary

Add OracleVM (O-Chain), RelayVM (R-Chain), and IdentityVM (I-Chain) to the canonical primary-network chain registry at genesis/builder/registry.go. These three chains were already registered as optional VMs in node/node/vms.go::registerOptionalVMs (loadable via CreateChainTx) but were absent from the registry, which means the alias machinery + VMAliases map didn't know about them by canonical letter or alias set.

Order is append-only per the comment in registry.go — I/O/R land at positions 12/13/14. Aliases:

Letter VMID Aliases
I constants.IdentityVMID identity, identityvm, id
O constants.OracleVMID oracle, oraclevm, feed
R constants.RelayVMID relay, relayvm, msg

No alias collisions with existing rows (P/X/C/D/Q/A/B/T/Z/G/K).

What this does NOT do

  • This does not add I/O/R to FromConfig's optIn loop. Doing so requires:
    • New IChainGenesis, OChainGenesis, RChainGenesis fields on genesiscfg.Config (and ConfigOutput)
    • New ichain.json, ochain.json, rchain.json shards under genesis/configs/{mainnet,testnet,devnet,localnet}/
    • New entries in primaryChainShardFiles and chainSet in genesis/configs/configs.go
  • I/O/R continue to be instantiated via CreateChainTx post-genesis (the existing path), the same way they are today.
  • Registry update unblocks: VM manager resolves the three new VMs by canonical alias, and when an I/O/R chain is created (now or in a future genesis-bake), builder.Aliases() registers their chain aliases without further switch-ladder edits.

Builder.Aliases() update

Mirroring the existing 11-case switch ladder, I added three new cases for constants.{IdentityVMID, OracleVMID, RelayVMID} so genesis-baked I/O/R chains get correct API + chain alias registration when that future-bake change lands.

Test plan

  • go build ./genesis/builder/... — clean
  • go test ./genesis/builder/... -count=1 — 22 tests pass, 0 fail
  • TestChainAliasesRegistryParity extended with 3 new subtests (I/O/R) — all pass
  • TestVMAliasesRegistryParity extended with 3 new VMID entries — passes
  • All other tests in the package unaffected (TestFromConfig*, TestAliasesForUnknown, TestVMAliasesMapIsolation)

Notes

  • Constants IdentityVMID, OracleVMID, RelayVMID exist in github.com/luxfi/constants/vm_ids.go (lines 49-54). Same import already used by registry.go.
  • The K-Chain case in builder.Aliases() lists "kms" as an API alias even though the Registry uses "key" — pre-existing divergence, not touched here. New I/O/R cases use the same alias triple in both Registry and Aliases() consistently.
  • The vms/platformvm/go.mod and vms/xvm/go.mod files exist on disk as untracked submodule splits (not committed). They shadow the parent module's directory tree and break the build. Moved them aside for local build; CI should not see them.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant