mirror of
https://github.com/luxfi/netrunner.git
synced 2026-07-27 00:04:23 +00:00
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:
+1
-1
@@ -1396,7 +1396,7 @@ func getFlagsForLuxdVersion(luxdVersion string, givenFlags map[string]string) ma
|
||||
// luxd binary is current (no downgrade needed). Previously this
|
||||
// branch incorrectly compared "" < "v1.9.6" → -1, which caused 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.
|
||||
if luxdVersion == "" || !semver.IsValid(luxdVersion) {
|
||||
return flags
|
||||
|
||||
+3
-3
@@ -121,7 +121,7 @@ func (b *stubBackend) Status(ctx context.Context) (*types.StatusResponse, error)
|
||||
DBDir: "/tmp/db",
|
||||
Config: []byte(`{"network-id":1}`),
|
||||
PluginDir: "/usr/local/lib/lux/plugins",
|
||||
WhitelistedSubnets: "",
|
||||
WhitelistedChains: "",
|
||||
Paused: false,
|
||||
},
|
||||
},
|
||||
@@ -134,11 +134,11 @@ func (b *stubBackend) Status(ctx context.Context) (*types.StatusResponse, error)
|
||||
VMID: "mgj786NP7uDwBCcq6YwThhaN8FLyybkCa4zBWTQbNgmK6k9A6",
|
||||
VMName: "evm",
|
||||
ChainID: "chain-1",
|
||||
SubnetID: "primary",
|
||||
NetworkID: "primary",
|
||||
Genesis: []byte(`{"chainId":96369}`),
|
||||
},
|
||||
},
|
||||
Subnets: []string{"primary"},
|
||||
Networks: []string{"primary"},
|
||||
NetworkID: 96369,
|
||||
},
|
||||
}, nil
|
||||
|
||||
+11
-11
@@ -727,7 +727,7 @@ type NodeInfo struct {
|
||||
DBDir string
|
||||
Config []byte
|
||||
PluginDir string
|
||||
WhitelistedSubnets string // legacy field name preserved for migration; rename pending
|
||||
WhitelistedChains string
|
||||
Paused bool
|
||||
}
|
||||
|
||||
@@ -740,7 +740,7 @@ func (n *NodeInfo) Encode(b *zap.Buffer) {
|
||||
b.WriteString(n.DBDir)
|
||||
b.WriteBytes(n.Config)
|
||||
b.WriteString(n.PluginDir)
|
||||
b.WriteString(n.WhitelistedSubnets)
|
||||
b.WriteString(n.WhitelistedChains)
|
||||
b.WriteBool(n.Paused)
|
||||
}
|
||||
|
||||
@@ -773,7 +773,7 @@ func (n *NodeInfo) Decode(r *zap.Reader) error {
|
||||
if n.PluginDir, err = r.ReadString(); err != nil {
|
||||
return err
|
||||
}
|
||||
if n.WhitelistedSubnets, err = r.ReadString(); err != nil {
|
||||
if n.WhitelistedChains, err = r.ReadString(); err != nil {
|
||||
return err
|
||||
}
|
||||
if n.Paused, err = r.ReadBool(); err != nil {
|
||||
@@ -788,7 +788,7 @@ type ChainInfo struct {
|
||||
VMID string
|
||||
VMName 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
|
||||
}
|
||||
|
||||
@@ -797,7 +797,7 @@ func (c *ChainInfo) Encode(b *zap.Buffer) {
|
||||
b.WriteString(c.VMID)
|
||||
b.WriteString(c.VMName)
|
||||
b.WriteString(c.ChainID)
|
||||
b.WriteString(c.SubnetID)
|
||||
b.WriteString(c.NetworkID)
|
||||
b.WriteBytes(c.Genesis)
|
||||
}
|
||||
|
||||
@@ -815,7 +815,7 @@ func (c *ChainInfo) Decode(r *zap.Reader) error {
|
||||
if c.ChainID, err = r.ReadString(); err != nil {
|
||||
return err
|
||||
}
|
||||
if c.SubnetID, err = r.ReadString(); err != nil {
|
||||
if c.NetworkID, err = r.ReadString(); err != nil {
|
||||
return err
|
||||
}
|
||||
gen, err := r.ReadBytes()
|
||||
@@ -835,7 +835,7 @@ type ClusterInfo struct {
|
||||
RootDataDir string
|
||||
Healthy bool
|
||||
CustomChains map[string]*ChainInfo // keyed by chain ID
|
||||
Subnets []string // P-Chain validator sets
|
||||
Networks []string // P-Chain validator-set identifiers
|
||||
NetworkID uint32
|
||||
}
|
||||
|
||||
@@ -855,8 +855,8 @@ func (c *ClusterInfo) Encode(b *zap.Buffer) {
|
||||
for _, ch := range c.CustomChains {
|
||||
ch.Encode(b)
|
||||
}
|
||||
b.WriteUint32(uint32(len(c.Subnets)))
|
||||
for _, s := range c.Subnets {
|
||||
b.WriteUint32(uint32(len(c.Networks)))
|
||||
for _, s := range c.Networks {
|
||||
b.WriteString(s)
|
||||
}
|
||||
b.WriteUint32(c.NetworkID)
|
||||
@@ -910,9 +910,9 @@ func (c *ClusterInfo) Decode(r *zap.Reader) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.Subnets = make([]string, n)
|
||||
c.Networks = make([]string, n)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user