chore(netrunner): kill subnet — chain/network vocabulary (#48)

zapwire types renamed:
  WhitelistedSubnets → WhitelistedChains
  SubnetID          → NetworkID
  Subnets           → Networks

local/network.go: comment rephrase --whitelisted-subnets → --whitelisted-chains
zapwire/e2e_test.go: test data updated to match renamed fields.

Build clean. zapwire tests pass.
This commit is contained in:
Hanzo Dev
2026-05-29 21:11:41 -07:00
committed by GitHub
parent 44f7f089d4
commit 59fd676294
3 changed files with 15 additions and 15 deletions
+1 -1
View File
@@ -1396,7 +1396,7 @@ func getFlagsForLuxdVersion(luxdVersion string, givenFlags map[string]string) ma
// luxd binary is current (no downgrade needed). Previously this // luxd binary is current (no downgrade needed). Previously this
// branch incorrectly compared "" < "v1.9.6" → -1, which caused the // branch incorrectly compared "" < "v1.9.6" → -1, which caused the
// downgrade table to fire on every modern luxd and inject the // downgrade table to fire on every modern luxd and inject the
// deprecated --build-dir / --whitelisted-subnets flags. Modern // deprecated --build-dir / --whitelisted-chains flags. Modern
// luxd rejects those flags with "unknown flag" and node1 exits 1. // luxd rejects those flags with "unknown flag" and node1 exits 1.
if luxdVersion == "" || !semver.IsValid(luxdVersion) { if luxdVersion == "" || !semver.IsValid(luxdVersion) {
return flags return flags
+3 -3
View File
@@ -121,7 +121,7 @@ func (b *stubBackend) Status(ctx context.Context) (*types.StatusResponse, error)
DBDir: "/tmp/db", DBDir: "/tmp/db",
Config: []byte(`{"network-id":1}`), Config: []byte(`{"network-id":1}`),
PluginDir: "/usr/local/lib/lux/plugins", PluginDir: "/usr/local/lib/lux/plugins",
WhitelistedSubnets: "", WhitelistedChains: "",
Paused: false, Paused: false,
}, },
}, },
@@ -134,11 +134,11 @@ func (b *stubBackend) Status(ctx context.Context) (*types.StatusResponse, error)
VMID: "mgj786NP7uDwBCcq6YwThhaN8FLyybkCa4zBWTQbNgmK6k9A6", VMID: "mgj786NP7uDwBCcq6YwThhaN8FLyybkCa4zBWTQbNgmK6k9A6",
VMName: "evm", VMName: "evm",
ChainID: "chain-1", ChainID: "chain-1",
SubnetID: "primary", NetworkID: "primary",
Genesis: []byte(`{"chainId":96369}`), Genesis: []byte(`{"chainId":96369}`),
}, },
}, },
Subnets: []string{"primary"}, Networks: []string{"primary"},
NetworkID: 96369, NetworkID: 96369,
}, },
}, nil }, nil
+11 -11
View File
@@ -727,7 +727,7 @@ type NodeInfo struct {
DBDir string DBDir string
Config []byte Config []byte
PluginDir string PluginDir string
WhitelistedSubnets string // legacy field name preserved for migration; rename pending WhitelistedChains string
Paused bool Paused bool
} }
@@ -740,7 +740,7 @@ func (n *NodeInfo) Encode(b *zap.Buffer) {
b.WriteString(n.DBDir) b.WriteString(n.DBDir)
b.WriteBytes(n.Config) b.WriteBytes(n.Config)
b.WriteString(n.PluginDir) b.WriteString(n.PluginDir)
b.WriteString(n.WhitelistedSubnets) b.WriteString(n.WhitelistedChains)
b.WriteBool(n.Paused) b.WriteBool(n.Paused)
} }
@@ -773,7 +773,7 @@ func (n *NodeInfo) Decode(r *zap.Reader) error {
if n.PluginDir, err = r.ReadString(); err != nil { if n.PluginDir, err = r.ReadString(); err != nil {
return err return err
} }
if n.WhitelistedSubnets, err = r.ReadString(); err != nil { if n.WhitelistedChains, err = r.ReadString(); err != nil {
return err return err
} }
if n.Paused, err = r.ReadBool(); err != nil { if n.Paused, err = r.ReadBool(); err != nil {
@@ -788,7 +788,7 @@ type ChainInfo struct {
VMID string VMID string
VMName string VMName string
ChainID string ChainID string
SubnetID string // P-Chain validator-set identifier — distinct from ChainID NetworkID string // P-Chain validator-set identifier — distinct from ChainID
Genesis []byte Genesis []byte
} }
@@ -797,7 +797,7 @@ func (c *ChainInfo) Encode(b *zap.Buffer) {
b.WriteString(c.VMID) b.WriteString(c.VMID)
b.WriteString(c.VMName) b.WriteString(c.VMName)
b.WriteString(c.ChainID) b.WriteString(c.ChainID)
b.WriteString(c.SubnetID) b.WriteString(c.NetworkID)
b.WriteBytes(c.Genesis) b.WriteBytes(c.Genesis)
} }
@@ -815,7 +815,7 @@ func (c *ChainInfo) Decode(r *zap.Reader) error {
if c.ChainID, err = r.ReadString(); err != nil { if c.ChainID, err = r.ReadString(); err != nil {
return err return err
} }
if c.SubnetID, err = r.ReadString(); err != nil { if c.NetworkID, err = r.ReadString(); err != nil {
return err return err
} }
gen, err := r.ReadBytes() gen, err := r.ReadBytes()
@@ -835,7 +835,7 @@ type ClusterInfo struct {
RootDataDir string RootDataDir string
Healthy bool Healthy bool
CustomChains map[string]*ChainInfo // keyed by chain ID CustomChains map[string]*ChainInfo // keyed by chain ID
Subnets []string // P-Chain validator sets Networks []string // P-Chain validator-set identifiers
NetworkID uint32 NetworkID uint32
} }
@@ -855,8 +855,8 @@ func (c *ClusterInfo) Encode(b *zap.Buffer) {
for _, ch := range c.CustomChains { for _, ch := range c.CustomChains {
ch.Encode(b) ch.Encode(b)
} }
b.WriteUint32(uint32(len(c.Subnets))) b.WriteUint32(uint32(len(c.Networks)))
for _, s := range c.Subnets { for _, s := range c.Networks {
b.WriteString(s) b.WriteString(s)
} }
b.WriteUint32(c.NetworkID) b.WriteUint32(c.NetworkID)
@@ -910,9 +910,9 @@ func (c *ClusterInfo) Decode(r *zap.Reader) error {
if err != nil { if err != nil {
return err return err
} }
c.Subnets = make([]string, n) c.Networks = make([]string, n)
for i := uint32(0); i < n; i++ { for i := uint32(0); i < n; i++ {
if c.Subnets[i], err = r.ReadString(); err != nil { if c.Networks[i], err = r.ReadString(); err != nil {
return err return err
} }
} }