resolved merge conflicts

This commit is contained in:
Anton Evangelatov 2020-06-30 13:23:02 +02:00
commit 33e60df301
8 changed files with 228 additions and 91 deletions

View File

@ -16,7 +16,7 @@
"gnetId": null, "gnetId": null,
"graphTooltip": 0, "graphTooltip": 0,
"id": 16, "id": 16,
"iteration": 1593204217741, "iteration": 1593448862489,
"links": [], "links": [],
"panels": [ "panels": [
{ {
@ -111,7 +111,13 @@
} }
] ]
], ],
"tags": [] "tags": [
{
"key": "run",
"operator": "=~",
"value": "/^$runid$/"
}
]
} }
], ],
"timeFrom": null, "timeFrom": null,
@ -216,7 +222,13 @@
} }
] ]
], ],
"tags": [] "tags": [
{
"key": "run",
"operator": "=~",
"value": "/^$runid$/"
}
]
}, },
{ {
"alias": "all ($tag_run)", "alias": "all ($tag_run)",
@ -259,7 +271,13 @@
} }
] ]
], ],
"tags": [] "tags": [
{
"key": "run",
"operator": "=~",
"value": "/^$runid$/"
}
]
} }
], ],
"thresholds": [], "thresholds": [],
@ -406,7 +424,13 @@
} }
] ]
], ],
"tags": [] "tags": [
{
"key": "run",
"operator": "=~",
"value": "/^$runid$/"
}
]
} }
], ],
"thresholds": [], "thresholds": [],
@ -547,7 +571,13 @@
} }
] ]
], ],
"tags": [] "tags": [
{
"key": "run",
"operator": "=~",
"value": "/^$runid$/"
}
]
}, },
{ {
"alias": "find-data.offer - $tag_miner ($tag_run)", "alias": "find-data.offer - $tag_miner ($tag_run)",
@ -596,7 +626,13 @@
} }
] ]
], ],
"tags": [] "tags": [
{
"key": "run",
"operator": "=~",
"value": "/^$runid$/"
}
]
} }
], ],
"thresholds": [], "thresholds": [],
@ -743,7 +779,13 @@
} }
] ]
], ],
"tags": [] "tags": [
{
"key": "run",
"operator": "=~",
"value": "/^$runid$/"
}
]
} }
], ],
"thresholds": [], "thresholds": [],
@ -876,7 +918,13 @@
} }
] ]
], ],
"tags": [] "tags": [
{
"key": "run",
"operator": "=~",
"value": "/^$runid$/"
}
]
} }
], ],
"thresholds": [], "thresholds": [],
@ -956,11 +1004,37 @@
"refresh": 2, "refresh": 2,
"skipUrlSync": false, "skipUrlSync": false,
"type": "interval" "type": "interval"
},
{
"allValue": null,
"current": {
"selected": true,
"text": "All",
"value": "$__all"
},
"datasource": "influxdb",
"definition": "SHOW TAG VALUES WITH KEY = run",
"hide": 0,
"includeAll": true,
"label": null,
"multi": false,
"name": "runid",
"options": [],
"query": "SHOW TAG VALUES WITH KEY = run",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 1,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
} }
] ]
}, },
"time": { "time": {
"from": "now-8m", "from": "now-15m",
"to": "now" "to": "now"
}, },
"timepicker": { "timepicker": {
@ -979,5 +1053,5 @@
"timezone": "", "timezone": "",
"title": "Project Oni - Baseline test", "title": "Project Oni - Baseline test",
"uid": "8em8RXWMz", "uid": "8em8RXWMz",
"version": 8 "version": 1
} }

View File

@ -44,8 +44,12 @@ func runMiner(t *TestEnvironment) error {
// mine / stop mining // mine / stop mining
mine := true mine := true
done := make(chan struct{}) done := make(chan struct{})
if miner.MineOne != nil {
go func() { go func() {
defer t.RecordMessage("shutting down mining")
defer close(done) defer close(done)
var i int var i int
for i = 0; mine; i++ { for i = 0; mine; i++ {
// synchronize all miners to mine the next block // synchronize all miners to mine the next block
@ -55,7 +59,9 @@ func runMiner(t *TestEnvironment) error {
ch := make(chan struct{}) ch := make(chan struct{})
err := miner.MineOne(ctx, func(mined bool) { err := miner.MineOne(ctx, func(mined bool) {
if mined {
t.D().Counter(fmt.Sprintf("block.mine,miner=%s", myActorAddr)).Inc(1) t.D().Counter(fmt.Sprintf("block.mine,miner=%s", myActorAddr)).Inc(1)
}
close(ch) close(ch)
}) })
if err != nil { if err != nil {
@ -69,6 +75,9 @@ func runMiner(t *TestEnvironment) error {
stateMineLast := sync.State(fmt.Sprintf("mine-block-%d", i)) stateMineLast := sync.State(fmt.Sprintf("mine-block-%d", i))
t.SyncClient.MustSignalEntry(ctx, stateMineLast) t.SyncClient.MustSignalEntry(ctx, stateMineLast)
}() }()
} else {
close(done)
}
// wait for a signal from all clients to stop mining // wait for a signal from all clients to stop mining
err = <-t.SyncClient.MustBarrier(ctx, stateStopMining, clients).C err = <-t.SyncClient.MustBarrier(ctx, stateStopMining, clients).C
@ -77,7 +86,6 @@ func runMiner(t *TestEnvironment) error {
} }
mine = false mine = false
t.RecordMessage("shutting down mining")
<-done <-done
time.Sleep(3600 * time.Second) time.Sleep(3600 * time.Second)

View File

@ -20,7 +20,6 @@
miners = "3" miners = "3"
genesis_timestamp_offset = "100000" genesis_timestamp_offset = "100000"
balance = "2000" balance = "2000"
sectors = "20"
[[groups]] [[groups]]
id = "bootstrapper" id = "bootstrapper"
@ -35,16 +34,30 @@
role = "bootstrapper" role = "bootstrapper"
[[groups]] [[groups]]
id = "miners" id = "miners-weak"
[groups.resources] [groups.resources]
memory = "8192Mi" memory = "8192Mi"
cpu = "1000m" cpu = "1000m"
[groups.instances] [groups.instances]
count = 3 count = 2
percentage = 0.0 percentage = 0.0
[groups.run] [groups.run]
[groups.run.test_params] [groups.run.test_params]
role = "miner" role = "miner"
sectors = "8"
[[groups]]
id = "miners-strong"
[groups.resources]
memory = "8192Mi"
cpu = "1000m"
[groups.instances]
count = 1
percentage = 0.0
[groups.run]
[groups.run.test_params]
role = "miner"
sectors = "24"
[[groups]] [[groups]]
id = "clients" id = "clients"

View File

@ -0,0 +1,49 @@
[metadata]
name = "lotus-soup"
author = ""
[global]
plan = "lotus-soup"
case = "lotus-baseline"
total_instances = 6
builder = "docker:go"
runner = "local:docker"
[global.build_config]
enable_go_build_cache = true
[global.run.test_params]
clients = "3"
miners = "2"
genesis_timestamp_offset = "100000"
balance = "2000000000"
sectors = "10"
random_beacon_type = "mock"
[[groups]]
id = "bootstrapper"
[groups.instances]
count = 1
percentage = 0.0
[groups.run]
[groups.run.test_params]
role = "bootstrapper"
[[groups]]
id = "miners"
[groups.instances]
count = 2
percentage = 0.0
[groups.run]
[groups.run.test_params]
role = "miner"
mining_mode = "natural"
[[groups]]
id = "clients"
[groups.instances]
count = 3
percentage = 0.0
[groups.run]
[groups.run.test_params]
role = "client"

View File

@ -12,6 +12,15 @@
[global.build_config] [global.build_config]
enable_go_build_cache = true enable_go_build_cache = true
[global.run.test_params]
clients = "3"
miners = "2"
genesis_timestamp_offset = "100000"
balance = "2000000000"
sectors = "10"
random_beacon_type = "mock"
enable_pubsub_tracer = "true"
[[groups]] [[groups]]
id = "pubsub-tracer" id = "pubsub-tracer"
[groups.instances] [groups.instances]
@ -29,12 +38,6 @@
[groups.run] [groups.run]
[groups.run.test_params] [groups.run.test_params]
role = "bootstrapper" role = "bootstrapper"
clients = "3"
miners = "2"
balance = "2000000000"
sectors = "10"
random_beacon_type = "mock"
enable_pubsub_tracer = "true"
[[groups]] [[groups]]
id = "miners" id = "miners"
@ -44,13 +47,6 @@
[groups.run] [groups.run]
[groups.run.test_params] [groups.run.test_params]
role = "miner" role = "miner"
clients = "3"
miners = "2"
balance = "2000000000"
sectors = "10"
random_beacon_type = "mock"
enable_pubsub_tracer = "true"
[[groups]] [[groups]]
id = "clients" id = "clients"
@ -60,9 +56,3 @@
[groups.run] [groups.run]
[groups.run.test_params] [groups.run.test_params]
role = "client" role = "client"
clients = "3"
miners = "2"
balance = "2000000000"
sectors = "10"
random_beacon_type = "mock"
enable_pubsub_tracer = "true"

View File

@ -12,6 +12,14 @@
[global.build_config] [global.build_config]
enable_go_build_cache = true enable_go_build_cache = true
[global.run.test_params]
clients = "3"
miners = "2"
genesis_timestamp_offset = "100000"
balance = "2000000000"
sectors = "10"
random_beacon_type = "mock"
[[groups]] [[groups]]
id = "bootstrapper" id = "bootstrapper"
[groups.instances] [groups.instances]
@ -20,11 +28,6 @@
[groups.run] [groups.run]
[groups.run.test_params] [groups.run.test_params]
role = "bootstrapper" role = "bootstrapper"
clients = "3"
miners = "2"
balance = "2000000000"
sectors = "10"
random_beacon_type = "mock"
[[groups]] [[groups]]
id = "miners" id = "miners"
@ -34,12 +37,6 @@
[groups.run] [groups.run]
[groups.run.test_params] [groups.run.test_params]
role = "miner" role = "miner"
clients = "3"
miners = "2"
balance = "2000000000"
sectors = "10"
random_beacon_type = "mock"
[[groups]] [[groups]]
id = "clients" id = "clients"
@ -49,9 +46,3 @@
[groups.run] [groups.run]
[groups.run.test_params] [groups.run.test_params]
role = "client" role = "client"
clients = "3"
miners = "2"
balance = "2000000000"
sectors = "10"
random_beacon_type = "mock"

View File

@ -41,3 +41,6 @@ instances = { min = 1, max = 100, default = 5 }
# Params relevant to pubsub tracing # Params relevant to pubsub tracing
enable_pubsub_tracer = { type = "bool", default = false } enable_pubsub_tracer = { type = "bool", default = false }
# Mining Mode: synchronized -vs- natural time
mining_mode = { type = "enum", default = "synchronized", options = ["synchronized", "natural"] }

View File

@ -83,6 +83,7 @@ var (
stateReady = sync.State("ready") stateReady = sync.State("ready")
stateDone = sync.State("done") stateDone = sync.State("done")
stateStopMining = sync.State("stop-mining") stateStopMining = sync.State("stop-mining")
stateMinerPickSeqNum = sync.State("miner-pick-seq-num")
) )
type TestEnvironment struct { type TestEnvironment struct {
@ -301,7 +302,10 @@ func prepareMiner(t *TestEnvironment) (*Node, error) {
return nil, err return nil, err
} }
minerAddr, err := address.NewIDAddress(genesis_chain.MinerStart + uint64(t.GroupSeq-1)) // pick unique sequence number for each miner, no matter in which group they are
seq := t.SyncClient.MustSignalAndWait(ctx, stateMinerPickSeqNum, t.IntParam("miners"))
minerAddr, err := address.NewIDAddress(genesis_chain.MinerStart + uint64(seq-1))
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -320,7 +324,7 @@ func prepareMiner(t *TestEnvironment) (*Node, error) {
t.RecordMessage("Miner Info: Owner: %s Worker: %s", genMiner.Owner, genMiner.Worker) t.RecordMessage("Miner Info: Owner: %s Worker: %s", genMiner.Owner, genMiner.Worker)
presealMsg := &PresealMsg{Miner: *genMiner, Seqno: t.GroupSeq} presealMsg := &PresealMsg{Miner: *genMiner, Seqno: seq}
t.SyncClient.Publish(ctx, presealTopic, presealMsg) t.SyncClient.Publish(ctx, presealTopic, presealMsg)
// then collect the genesis block and bootstrapper address // then collect the genesis block and bootstrapper address
@ -414,8 +418,7 @@ func prepareMiner(t *TestEnvironment) (*Node, error) {
return nil, err return nil, err
} }
mineBlock := make(chan func(bool)) minerOpts := []node.Option{
stop2, err := node.New(context.Background(),
node.StorageMiner(&n.minerApi), node.StorageMiner(&n.minerApi),
node.Online(), node.Online(),
node.Repo(minerRepo), node.Repo(minerRepo),
@ -427,9 +430,24 @@ func prepareMiner(t *TestEnvironment) (*Node, error) {
} }
return lr.SetAPIEndpoint(apima) return lr.SetAPIEndpoint(apima)
}), }),
node.Override(new(*miner.Miner), miner.NewTestMiner(mineBlock, minerAddr)),
withMinerListenAddress(minerIP), withMinerListenAddress(minerIP),
) }
if t.StringParam("mining_mode") != "natural" {
mineBlock := make(chan func(bool))
minerOpts = append(minerOpts,
node.Override(new(*miner.Miner), miner.NewTestMiner(mineBlock, minerAddr)))
n.MineOne = func(ctx context.Context, cb func(bool)) error {
select {
case mineBlock <- cb:
return nil
case <-ctx.Done():
return ctx.Err()
}
}
}
stop2, err := node.New(context.Background(), minerOpts...)
if err != nil { if err != nil {
stop1(context.TODO()) stop1(context.TODO())
return nil, err return nil, err
@ -455,15 +473,6 @@ func prepareMiner(t *TestEnvironment) (*Node, error) {
panic(err) panic(err)
} }
n.MineOne = func(ctx context.Context, cb func(bool)) error {
select {
case mineBlock <- cb:
return nil
case <-ctx.Done():
return ctx.Err()
}
}
endpoint, err := minerRepo.APIEndpoint() endpoint, err := minerRepo.APIEndpoint()
if err != nil { if err != nil {
return nil, err return nil, err