Skip to content

Commit 9d3759a

Browse files
committed
fixup: respond to reviewer feedback
1 parent 422be6b commit 9d3759a

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

tests/fixture/tmpnet/network.go

+10-11
Original file line numberDiff line numberDiff line change
@@ -864,8 +864,8 @@ func (n *Network) GetPluginDir() (string, error) {
864864
return n.DefaultFlags.GetStringVal(config.PluginDirKey)
865865
}
866866

867-
// GetGenesisFileContent returns the base64 encoding of the JSON
868-
// encoding of the network genesis.
867+
// GetGenesisFileContent returns the base64-encoded JSON-marshaled
868+
// network genesis.
869869
func (n *Network) GetGenesisFileContent() (string, error) {
870870
bytes, err := json.Marshal(n.Genesis)
871871
if err != nil {
@@ -874,8 +874,8 @@ func (n *Network) GetGenesisFileContent() (string, error) {
874874
return base64.StdEncoding.EncodeToString(bytes), nil
875875
}
876876

877-
// GetSubnetConfigContent returns the base64-encoded map of subnetID
878-
// to marshalled subnet configuration.
877+
// GetSubnetConfigContent returns the base64-encoded and
878+
// JSON-marshaled map of subnetID to subnet configuration.
879879
func (n *Network) GetSubnetConfigContent() (string, error) {
880880
subnetConfigs := maps.Clone(n.PrimarySubnetConfigs)
881881

@@ -903,9 +903,8 @@ func (n *Network) GetSubnetConfigContent() (string, error) {
903903
return base64.StdEncoding.EncodeToString(marshaledConfigs), nil
904904
}
905905

906-
// GetChainConfigContent returns the base64-encoded map of chain
907-
// alias/ID to marshalled chain configuration for both primary and
908-
// custom chains.
906+
// GetChainConfigContent returns the base64-encoded and JSON-marshaled map of chain alias/ID
907+
// to JSON-marshaled chain configuration for both primary and custom chains.
909908
func (n *Network) GetChainConfigContent() (string, error) {
910909
chainConfigs := map[string]chains.ChainConfig{}
911910
for alias, flags := range n.PrimaryChainConfigs {
@@ -953,7 +952,7 @@ func (n *Network) writeNodeFlags(node *Node) error {
953952
// Set the bootstrap configuration
954953
bootstrapIPs, bootstrapIDs, err := n.GetBootstrapIPsAndIDs(node)
955954
if err != nil {
956-
return err
955+
return fmt.Errorf("failed to determine bootstrap configuration: %w", err)
957956
}
958957
flags[config.BootstrapIDsKey] = strings.Join(bootstrapIDs, ",")
959958
flags[config.BootstrapIPsKey] = strings.Join(bootstrapIPs, ",")
@@ -963,22 +962,22 @@ func (n *Network) writeNodeFlags(node *Node) error {
963962
if n.Genesis != nil {
964963
genesisFileContent, err := n.GetGenesisFileContent()
965964
if err != nil {
966-
return err
965+
return fmt.Errorf("failed to get genesis file content: %w", err)
967966
}
968967
flags.SetDefault(config.GenesisFileContentKey, genesisFileContent)
969968
}
970969

971970
subnetConfigContent, err := n.GetSubnetConfigContent()
972971
if err != nil {
973-
return err
972+
return fmt.Errorf("failed to get subnet config content: %w", err)
974973
}
975974
if len(subnetConfigContent) > 0 {
976975
flags.SetDefault(config.SubnetConfigContentKey, subnetConfigContent)
977976
}
978977

979978
chainConfigContent, err := n.GetChainConfigContent()
980979
if err != nil {
981-
return err
980+
return fmt.Errorf("failed to get chain config content: %w", err)
982981
}
983982
if len(chainConfigContent) > 0 {
984983
flags.SetDefault(config.ChainConfigContentKey, chainConfigContent)

tests/fixture/tmpnet/node.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func ReadNodes(networkDir string, includeEphemeral bool) ([]*Node, error) {
156156
}
157157

158158
if err := node.EnsureNodeID(); err != nil {
159-
return nil, err
159+
return nil, fmt.Errorf("failed to ensure NodeID: %w", err)
160160
}
161161

162162
nodes = append(nodes, node)

0 commit comments

Comments
 (0)