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,
"graphTooltip": 0,
"id": 16,
"iteration": 1593204217741,
"iteration": 1593448862489,
"links": [],
"panels": [
{
@ -111,7 +111,13 @@
}
]
],
"tags": []
"tags": [
{
"key": "run",
"operator": "=~",
"value": "/^$runid$/"
}
]
}
],
"timeFrom": null,
@ -216,7 +222,13 @@
}
]
],
"tags": []
"tags": [
{
"key": "run",
"operator": "=~",
"value": "/^$runid$/"
}
]
},
{
"alias": "all ($tag_run)",
@ -259,7 +271,13 @@
}
]
],
"tags": []
"tags": [
{
"key": "run",
"operator": "=~",
"value": "/^$runid$/"
}
]
}
],
"thresholds": [],
@ -406,7 +424,13 @@
}
]
],
"tags": []
"tags": [
{
"key": "run",
"operator": "=~",
"value": "/^$runid$/"
}
]
}
],
"thresholds": [],
@ -547,7 +571,13 @@
}
]
],
"tags": []
"tags": [
{
"key": "run",
"operator": "=~",
"value": "/^$runid$/"
}
]
},
{
"alias": "find-data.offer - $tag_miner ($tag_run)",
@ -596,7 +626,13 @@
}
]
],
"tags": []
"tags": [
{
"key": "run",
"operator": "=~",
"value": "/^$runid$/"
}
]
}
],
"thresholds": [],
@ -743,7 +779,13 @@
}
]
],
"tags": []
"tags": [
{
"key": "run",
"operator": "=~",
"value": "/^$runid$/"
}
]
}
],
"thresholds": [],
@ -876,7 +918,13 @@
}
]
],
"tags": []
"tags": [
{
"key": "run",
"operator": "=~",
"value": "/^$runid$/"
}
]
}
],
"thresholds": [],
@ -956,11 +1004,37 @@
"refresh": 2,
"skipUrlSync": false,
"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": {
"from": "now-8m",
"from": "now-15m",
"to": "now"
},
"timepicker": {
@ -979,5 +1053,5 @@
"timezone": "",
"title": "Project Oni - Baseline test",
"uid": "8em8RXWMz",
"version": 8
"version": 1
}

View File

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

View File

@ -20,7 +20,6 @@
miners = "3"
genesis_timestamp_offset = "100000"
balance = "2000"
sectors = "20"
[[groups]]
id = "bootstrapper"
@ -35,16 +34,30 @@
role = "bootstrapper"
[[groups]]
id = "miners"
id = "miners-weak"
[groups.resources]
memory = "8192Mi"
cpu = "1000m"
[groups.instances]
count = 3
count = 2
percentage = 0.0
[groups.run]
[groups.run.test_params]
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]]
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]
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]]
id = "pubsub-tracer"
[groups.instances]
@ -29,12 +38,6 @@
[groups.run]
[groups.run.test_params]
role = "bootstrapper"
clients = "3"
miners = "2"
balance = "2000000000"
sectors = "10"
random_beacon_type = "mock"
enable_pubsub_tracer = "true"
[[groups]]
id = "miners"
@ -44,13 +47,6 @@
[groups.run]
[groups.run.test_params]
role = "miner"
clients = "3"
miners = "2"
balance = "2000000000"
sectors = "10"
random_beacon_type = "mock"
enable_pubsub_tracer = "true"
[[groups]]
id = "clients"
@ -60,9 +56,3 @@
[groups.run]
[groups.run.test_params]
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]
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]
@ -20,11 +28,6 @@
[groups.run]
[groups.run.test_params]
role = "bootstrapper"
clients = "3"
miners = "2"
balance = "2000000000"
sectors = "10"
random_beacon_type = "mock"
[[groups]]
id = "miners"
@ -34,12 +37,6 @@
[groups.run]
[groups.run.test_params]
role = "miner"
clients = "3"
miners = "2"
balance = "2000000000"
sectors = "10"
random_beacon_type = "mock"
[[groups]]
id = "clients"
@ -49,9 +46,3 @@
[groups.run]
[groups.run.test_params]
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
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")
stateDone = sync.State("done")
stateStopMining = sync.State("stop-mining")
stateMinerPickSeqNum = sync.State("miner-pick-seq-num")
)
type TestEnvironment struct {
@ -301,7 +302,10 @@ func prepareMiner(t *TestEnvironment) (*Node, error) {
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 {
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)
presealMsg := &PresealMsg{Miner: *genMiner, Seqno: t.GroupSeq}
presealMsg := &PresealMsg{Miner: *genMiner, Seqno: seq}
t.SyncClient.Publish(ctx, presealTopic, presealMsg)
// then collect the genesis block and bootstrapper address
@ -414,8 +418,7 @@ func prepareMiner(t *TestEnvironment) (*Node, error) {
return nil, err
}
mineBlock := make(chan func(bool))
stop2, err := node.New(context.Background(),
minerOpts := []node.Option{
node.StorageMiner(&n.minerApi),
node.Online(),
node.Repo(minerRepo),
@ -427,9 +430,24 @@ func prepareMiner(t *TestEnvironment) (*Node, error) {
}
return lr.SetAPIEndpoint(apima)
}),
node.Override(new(*miner.Miner), miner.NewTestMiner(mineBlock, minerAddr)),
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 {
stop1(context.TODO())
return nil, err
@ -455,15 +473,6 @@ func prepareMiner(t *TestEnvironment) (*Node, error) {
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()
if err != nil {
return nil, err