MCPcopy Create free account
hub / github.com/akash-network/node / GetCmd

Function GetCmd

cmd/akash/cmd/testnetify/testnetify.go:49–275  ·  view source on GitHub ↗

GetCmd uses the provided chainID and operatorAddress as well as the local private validator key to control the network represented in the data folder. This is useful to create testnets nearly identical to your mainnet environment.

(testnetAppCreator types.AppCreator)

Source from the content-addressed store, hash-verified

47// control the network represented in the data folder. This is useful to create testnets nearly identical to your
48// mainnet environment.
49func GetCmd(testnetAppCreator types.AppCreator) *cobra.Command {
50 opts := sdksrv.StartCmdOptions{}
51 if opts.DBOpener == nil {
52 opts.DBOpener = openDB
53 }
54
55 cmd := &cobra.Command{
56 Use: "testnetify",
57 Short: "Create a testnet from current local state",
58 Long: `Create a testnet from current local state.
59After utilizing this command the network will start. If the network is stopped,
60the normal "start" command should be used. Re-using this command on state that
61has already been modified by this command could result in unexpected behavior.
62
63Additionally, the first block may take a few minutes to be committed, depending
64on how old the block is. For instance, if a snapshot was taken weeks ago and we want
65to turn this into a testnet, it is possible lots of pending state needs to be committed
66(expiring locks, etc.). It is recommended that you should wait for this block to be committed
67before stopping the daemon.
68
69If the --trigger-testnet-upgrade flag is set, the upgrade handler specified by the flag will be run
70on the first block of the testnet.
71
72Regardless of whether the flag is set or not, if any new stores are introduced in the daemon being run,
73those stores will be registered in order to prevent panics. Therefore, you only need to set the flag if
74you want to test the upgrade handler itself.
75`,
76 Example: "testnetify",
77 Args: cobra.NoArgs,
78 RunE: func(cmd *cobra.Command, _ []string) error {
79 sctx := sdksrv.GetServerContextFromCmd(cmd)
80 cctx, err := client.GetClientQueryContext(cmd)
81 if err != nil {
82 return err
83 }
84
85 _, err = sdksrv.GetPruningOptionsFromFlags(sctx.Viper)
86 if err != nil {
87 return err
88 }
89
90 sctx.Logger.Info("testnetifying blockchain state")
91 cfg := TestnetConfig{}
92
93 cfgFilePath, err := cmd.Flags().GetString(cflags.KeyTestnetConfig)
94 if err != nil {
95 return err
96 }
97 cfgFile, err := os.Open(cfgFilePath) //nolint: gosec
98 if err != nil {
99 return err
100 }
101
102 defer func() {
103 _ = cfgFile.Close()
104 }()
105
106 cfgData, err := io.ReadAll(cfgFile)

Callers 1

initRootCmdFunction · 0.92

Calls 11

GetAppDBBackendFunction · 0.92
ListenForQuitSignalsFunction · 0.92
setupTraceWriterFunction · 0.85
testnetifyFunction · 0.85
ContextMethod · 0.80
AfterMethod · 0.80
StatusMethod · 0.80
CloseMethod · 0.65
ErrorMethod · 0.65
InfoMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected