Skip to content

Commit 0c98303

Browse files
committed
Almost got state sync test working
1 parent 7fc240b commit 0c98303

File tree

8 files changed

+224
-165
lines changed

8 files changed

+224
-165
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ install_cli_deps: ## Installs `helm`, `tilt` and the underlying `ci_deps`
142142
.PHONY: install_ci_deps
143143
install_ci_deps: ## Installs `protoc-gen-go`, `mockgen`, 'protoc-go-inject-tag' and other tools necessary for CI
144144
go install "google.golang.org/protobuf/cmd/[email protected]" && protoc-gen-go --version
145-
go install "github.com/golang/mock/mockgen@v1.6.0" && mockgen --version
145+
go install "github.com/golang/mock/m ockgen@v1.6.0" && mockgen --version
146146
go install "github.com/favadi/protoc-go-inject-tag@latest"
147147
go install "github.com/deepmap/oapi-codegen/cmd/[email protected]"
148148

app/client/cli/debug.go

+29-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
package cli
22

33
import (
4+
"fmt"
5+
"log"
46
"os"
7+
"os/exec"
58
"time"
69

710
"github.com/manifoldco/promptui"
811
"github.com/spf13/cobra"
12+
"golang.org/x/exp/slices"
913
"google.golang.org/protobuf/types/known/anypb"
1014

1115
"github.com/pokt-network/pocket/app/client/cli/helpers"
@@ -109,6 +113,29 @@ func newDebugSubCommands() []*cobra.Command {
109113
})
110114
},
111115
},
116+
{
117+
Use: "ScaleActor",
118+
Aliases: []string{"scale"},
119+
Short: "Scales the number of actors up or down",
120+
Long: "Scales the type of actor specified to the number provided",
121+
Args: cobra.ExactArgs(2),
122+
PersistentPreRunE: helpers.P2PDependenciesPreRunE,
123+
Run: func(cmd *cobra.Command, args []string) {
124+
fmt.Println("OLSH ARGS", args)
125+
actor := args[0]
126+
numActors := args[1]
127+
validActors := []string{"fishermen", "full_nodes", "servicers", "validators"}
128+
if !slices.Contains(validActors, actor) {
129+
logger.Global.Fatal().Msg("Invalid actor type provided")
130+
}
131+
sedCmd := exec.Command("sed", "-i", fmt.Sprintf("/%s:/,/count:/ s/count: [0-9]*/count: %s/", actor, numActors), "/usr/local/localnet_config.yaml")
132+
// fmt.Println(sedCmd.String())
133+
err := sedCmd.Run()
134+
if err != nil {
135+
log.Fatal(err)
136+
}
137+
},
138+
},
112139
}
113140
return cmds
114141
}
@@ -223,9 +250,9 @@ func handleSelect(cmd *cobra.Command, selection string) {
223250
// - Ending the task too early before the debug client completes its task results in a lack of propagation of the message or retrieval of the result
224251
// TECHDEBT: There is likely an event based solution to this but it would require a lot more refactoring of the p2p module.
225252
func runWithSleep(task func()) {
226-
time.Sleep(1 * time.Second)
253+
time.Sleep(1000 * time.Millisecond)
227254
task()
228-
time.Sleep(1 * time.Second)
255+
time.Sleep(1000 * time.Millisecond)
229256
}
230257

231258
// broadcastDebugMessage broadcasts the debug message to the entire visible network.

0 commit comments

Comments
 (0)