aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-01-08 17:19:37 +0800
committerGitHub <noreply@github.com>2019-01-08 17:19:37 +0800
commit87140e484160e3bec8ee6c26dde80ca8e99efbd3 (patch)
tree175b629b8e06ac9701d8ceebf53226fec742aa89
parentc2f02dcd02c8bf50321ba8d742ebfaf2ab74f8d2 (diff)
downloaddexon-consensus-87140e484160e3bec8ee6c26dde80ca8e99efbd3.tar
dexon-consensus-87140e484160e3bec8ee6c26dde80ca8e99efbd3.tar.gz
dexon-consensus-87140e484160e3bec8ee6c26dde80ca8e99efbd3.tar.bz2
dexon-consensus-87140e484160e3bec8ee6c26dde80ca8e99efbd3.tar.lz
dexon-consensus-87140e484160e3bec8ee6c26dde80ca8e99efbd3.tar.xz
dexon-consensus-87140e484160e3bec8ee6c26dde80ca8e99efbd3.tar.zst
dexon-consensus-87140e484160e3bec8ee6c26dde80ca8e99efbd3.zip
simulation: fix k8s simulation stuff (#410)
* simulation: fix k8s simulation stuff * Default K to 0
-rw-r--r--core/test/tcp-transport.go4
-rw-r--r--simulation/config/config.go2
-rw-r--r--simulation/kubernetes/Dockerfile2
-rw-r--r--simulation/kubernetes/config.toml.in29
-rw-r--r--simulation/kubernetes/node.yaml.in2
-rw-r--r--simulation/kubernetes/peer-server.yaml2
-rwxr-xr-xsimulation/kubernetes/run_simulation.sh2
-rw-r--r--simulation/kubernetes/scheduler.yaml.in2
-rw-r--r--simulation/simulation.go2
9 files changed, 28 insertions, 19 deletions
diff --git a/core/test/tcp-transport.go b/core/test/tcp-transport.go
index e04ba53..020b488 100644
--- a/core/test/tcp-transport.go
+++ b/core/test/tcp-transport.go
@@ -607,7 +607,7 @@ func (t *TCPTransportClient) Join(
conn string
)
for {
- addr = net.JoinHostPort("127.0.0.1", strconv.Itoa(t.localPort))
+ addr = net.JoinHostPort("0.0.0.0", strconv.Itoa(t.localPort))
ln, err = net.Listen("tcp", addr)
if err == nil {
go t.listenerRoutine(ln.(*net.TCPListener))
@@ -772,7 +772,7 @@ func (t *TCPTransportServer) Host() (chan *TransportEnvelope, error) {
// if we can listen on the pre-defiend part, we don't have to
// retry with other random ports.
ln, err := net.Listen(
- "tcp", net.JoinHostPort("127.0.0.1", strconv.Itoa(t.localPort)))
+ "tcp", net.JoinHostPort("0.0.0.0", strconv.Itoa(t.localPort)))
if err != nil {
return nil, err
}
diff --git a/simulation/config/config.go b/simulation/config/config.go
index d22f4f1..482f9cd 100644
--- a/simulation/config/config.go
+++ b/simulation/config/config.go
@@ -115,7 +115,7 @@ func GenerateDefault(path string) error {
Node: Node{
Consensus: Consensus{
PhiRatio: float32(2) / 3,
- K: 1,
+ K: 0,
NumChains: 7,
GenesisCRS: "In DEXON we trust.",
LambdaBA: 250,
diff --git a/simulation/kubernetes/Dockerfile b/simulation/kubernetes/Dockerfile
index 3a30ebd..ed2ed87 100644
--- a/simulation/kubernetes/Dockerfile
+++ b/simulation/kubernetes/Dockerfile
@@ -1,6 +1,8 @@
FROM golang:alpine
MAINTAINER Wei-Ning Huang <w@dexon.org>
+RUN apk add --no-cache libstdc++
+
# Cobinhood vendor base directory.
RUN mkdir -p /opt/dexon/
diff --git a/simulation/kubernetes/config.toml.in b/simulation/kubernetes/config.toml.in
index 7f02f74..af76097 100644
--- a/simulation/kubernetes/config.toml.in
+++ b/simulation/kubernetes/config.toml.in
@@ -1,19 +1,21 @@
title = "DEXON Consensus Simulation Config"
[node]
-num = {{numNode}}
+num = {{numNodes}}
max_block = 18446744073709551615
+changes = []
[node.consensus]
phi_ratio = 6.666666865348816e-01
-k = 1
-chain_num = 7
+k = 0
+num_chains = 7
genesis_crs = "In DEXON we trust."
-lambda_ba = 250
-lambda_dkg = 4000
-round_interval = 31536000000
-notary_set_size = 7
-dkg_set_size = 7
+lambda_ba = 400
+lambda_dkg = 15000
+round_interval = 360000
+notary_set_size = 4
+dkg_set_size = 4
+min_block_interval = 900
[node.legacy]
propose_interval_mean = 5e+02
@@ -22,9 +24,14 @@ propose_interval_sigma = 5e+01
[networking]
type = "tcp"
peer_server = "peer-server-svc.default.svc.cluster.local"
-mean = 1e+02
-sigma = 1e+01
-loss_rate_value = 0e+00
+
+[networking.direct]
+mean = 3e+02
+sigma = 5e+01
+
+[networking.gossip]
+mean = 3e+02
+sigma = 2.5e+01
[scheduler]
worker_num = 2
diff --git a/simulation/kubernetes/node.yaml.in b/simulation/kubernetes/node.yaml.in
index bc457e6..f0fb512 100644
--- a/simulation/kubernetes/node.yaml.in
+++ b/simulation/kubernetes/node.yaml.in
@@ -22,7 +22,7 @@ spec:
path: /etc/ssl/certs
containers:
- name: dexcon-simulation
- image: asia.gcr.io/cobinhood/dexcon-simulation:latest
+ image: asia.gcr.io/dexon-dev/dexcon-simulation:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
diff --git a/simulation/kubernetes/peer-server.yaml b/simulation/kubernetes/peer-server.yaml
index eb8a70e..1094eca 100644
--- a/simulation/kubernetes/peer-server.yaml
+++ b/simulation/kubernetes/peer-server.yaml
@@ -35,7 +35,7 @@ spec:
path: /etc/ssl/certs
containers:
- name: dexcon-simulation
- image: asia.gcr.io/cobinhood/dexcon-simulation:latest
+ image: asia.gcr.io/dexon-dev/dexcon-simulation:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
diff --git a/simulation/kubernetes/run_simulation.sh b/simulation/kubernetes/run_simulation.sh
index b9e6862..2537eb6 100755
--- a/simulation/kubernetes/run_simulation.sh
+++ b/simulation/kubernetes/run_simulation.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-IMAGE_TAG=asia.gcr.io/cobinhood/dexcon-simulation:latest
+IMAGE_TAG=asia.gcr.io/dexon-dev/dexcon-simulation:latest
build_binary() {
diff --git a/simulation/kubernetes/scheduler.yaml.in b/simulation/kubernetes/scheduler.yaml.in
index 0f17a4c..3893383 100644
--- a/simulation/kubernetes/scheduler.yaml.in
+++ b/simulation/kubernetes/scheduler.yaml.in
@@ -21,7 +21,7 @@ spec:
path: /etc/ssh/certs
containers:
- name: dexcon-simulation-with-scheduler
- image: asia.gcr.io/cobinhood/dexcon-simulation:latest
+ image: asia.gcr.io/dexon-dev/dexcon-simulation:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
diff --git a/simulation/simulation.go b/simulation/simulation.go
index 10ccb4c..938b302 100644
--- a/simulation/simulation.go
+++ b/simulation/simulation.go
@@ -61,7 +61,7 @@ func Run(cfg *config.Config, logPrefix string) {
mw = io.MultiWriter(os.Stderr, f)
}
logger := log.New()
- logger.SetHandler(log.StreamHandler(mw, log.LogfmtFormat()))
+ logger.SetHandler(log.StreamHandler(mw, log.TerminalFormat(false)))
return logger
}