Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Dec 10, 2024
1 parent 6097c9f commit 49749a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
2 changes: 2 additions & 0 deletions systemtests/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ var (
MaxGas = 10_000_000
// DefaultApiPort is the port for the node to interact with
DefaultApiPort = 1317
DefaultRpcPort = 26657
DefaultRestPort = 8080
DefaultGrpcPort = 9090
DefaultP2PPort = 16656
)

type TestnetInitializer interface {
Expand Down
17 changes: 5 additions & 12 deletions systemtests/testnet_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,6 @@ func NewModifyConfigYamlInitializer(exec string, s *SystemUnderTest) *ModifyConf
}
}

const (
rpcPortStart = 26657
apiPortStart = 1317
grpcPortStart = 9090
p2pPortStart = 16656
)

func (s ModifyConfigYamlInitializer) Initialize() {
// init with legacy testnet command
args := []string{
Expand Down Expand Up @@ -154,16 +147,16 @@ func (s ModifyConfigYamlInitializer) Initialize() {
for i := 0; i < s.initialNodesCount; i++ {
nodeDir := filepath.Join(WorkDir, NodePath(i, s.outputDir, s.projectName), "config")
id := string(mustV(p2p.LoadNodeKey(filepath.Join(nodeDir, "node_key.json"))).ID())
nodeAddresses[i] = fmt.Sprintf("%[email protected]:%d", id, p2pPortStart+i)
nodeAddresses[i] = fmt.Sprintf("%[email protected]:%d", id, DefaultP2PPort+i)
}

// then update configs
for i := 0; i < s.initialNodesCount; i++ {
nodeDir := filepath.Join(WorkDir, NodePath(i, s.outputDir, s.projectName), "config")
nodeNumber := i
EditToml(filepath.Join(nodeDir, "config.toml"), func(doc *tomledit.Document) {
UpdatePort(doc, rpcPortStart+i, "rpc", "laddr")
UpdatePort(doc, p2pPortStart+i, "p2p", "laddr")
UpdatePort(doc, DefaultRpcPort+i, "rpc", "laddr")
UpdatePort(doc, DefaultP2PPort+i, "p2p", "laddr")
SetBool(doc, false, "p2p", "addr_book_strict")
SetBool(doc, false, "p2p", "pex")
SetBool(doc, true, "p2p", "allow_duplicate_ip")
Expand All @@ -174,8 +167,8 @@ func (s ModifyConfigYamlInitializer) Initialize() {
SetValue(doc, s.commitTimeout.String(), "consensus", "timeout_commit")
})
EditToml(filepath.Join(nodeDir, "app.toml"), func(doc *tomledit.Document) {
UpdatePort(doc, apiPortStart+i, "api", "address")
UpdatePort(doc, grpcPortStart+i, "grpc", "address")
UpdatePort(doc, DefaultApiPort+i, "api", "address")
UpdatePort(doc, DefaultGrpcPort+i, "grpc", "address")
})
}
}
Expand Down

0 comments on commit 49749a8

Please sign in to comment.