Skip to content

Commit 87cda9a

Browse files
felipemaderorkurisCopilotmaru-avaRodrigoVillar
authored
Add public network support to tmpnet (#4267)
Signed-off-by: Ron Kuris <[email protected]> Signed-off-by: maru <[email protected]> Signed-off-by: Sam Liokumovich <[email protected]> Co-authored-by: Ron Kuris <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: maru <[email protected]> Co-authored-by: rodrigo <[email protected]> Co-authored-by: Sam Liokumovich <[email protected]>
1 parent 42dfbb1 commit 87cda9a

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

tests/fixture/tmpnet/network_config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ func (n *Network) readConfig() error {
154154
type serializedNetworkConfig struct {
155155
UUID string `json:"uuid,omitempty"`
156156
Owner string `json:"owner,omitempty"`
157+
NetworkID uint32 `json:"networkID,omitempty"`
157158
PrimarySubnetConfig ConfigMap `json:"primarySubnetConfig,omitempty"`
158159
PrimaryChainConfigs map[string]ConfigMap `json:"primaryChainConfigs,omitempty"`
159160
DefaultFlags FlagsMap `json:"defaultFlags,omitempty"`
@@ -165,6 +166,7 @@ func (n *Network) writeNetworkConfig() error {
165166
config := &serializedNetworkConfig{
166167
UUID: n.UUID,
167168
Owner: n.Owner,
169+
NetworkID: n.NetworkID,
168170
PrimarySubnetConfig: n.PrimarySubnetConfig,
169171
PrimaryChainConfigs: n.PrimaryChainConfigs,
170172
DefaultFlags: n.DefaultFlags,

tests/fixture/tmpnet/node.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"github.com/ava-labs/avalanchego/ids"
2323
"github.com/ava-labs/avalanchego/staking"
2424
"github.com/ava-labs/avalanchego/tests/fixture/stacktrace"
25+
"github.com/ava-labs/avalanchego/utils/constants"
2526
"github.com/ava-labs/avalanchego/utils/crypto/bls/signer/localsigner"
2627
"github.com/ava-labs/avalanchego/vms/platformvm/signer"
2728
)
@@ -369,10 +370,14 @@ func (n *Node) composeFlags() (FlagsMap, error) {
369370
// Convert the network id to a string to ensure consistency in JSON round-tripping.
370371
flags.SetDefault(config.NetworkNameKey, strconv.FormatUint(uint64(n.network.GetNetworkID()), 10))
371372

372-
// Set the bootstrap configuration
373-
bootstrapIPs, bootstrapIDs := n.network.GetBootstrapIPsAndIDs(n)
374-
flags.SetDefault(config.BootstrapIDsKey, strings.Join(bootstrapIDs, ","))
375-
flags.SetDefault(config.BootstrapIPsKey, strings.Join(bootstrapIPs, ","))
373+
// Set the bootstrap configuration only for non-public networks
374+
// Public networks should use avalanchego's built-in bootstrappers
375+
networkID := n.network.GetNetworkID()
376+
if networkID != constants.FujiID && networkID != constants.MainnetID {
377+
bootstrapIPs, bootstrapIDs := n.network.GetBootstrapIPsAndIDs(n)
378+
flags.SetDefault(config.BootstrapIDsKey, strings.Join(bootstrapIDs, ","))
379+
flags.SetDefault(config.BootstrapIPsKey, strings.Join(bootstrapIPs, ","))
380+
}
376381

377382
// TODO(marun) Maybe avoid computing content flags for each node start?
378383

0 commit comments

Comments
 (0)