Merge pull request #9804 from filecoin-project/sbansal/v1.19.0_backport_20221206
chore: Backport changes to v1.19.0
This commit is contained in:
commit
6b77b949d7
@ -135,12 +135,6 @@ jobs:
|
|||||||
command: |
|
command: |
|
||||||
git --no-pager diff go.mod go.sum
|
git --no-pager diff go.mod go.sum
|
||||||
git --no-pager diff --quiet go.mod go.sum
|
git --no-pager diff --quiet go.mod go.sum
|
||||||
build-debug:
|
|
||||||
executor: golang
|
|
||||||
steps:
|
|
||||||
- prepare
|
|
||||||
- run:
|
|
||||||
command: make debug
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
description: |
|
description: |
|
||||||
@ -255,47 +249,6 @@ jobs:
|
|||||||
path: /tmp/test-reports
|
path: /tmp/test-reports
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: /tmp/test-artifacts/conformance-coverage.html
|
path: /tmp/test-artifacts/conformance-coverage.html
|
||||||
build-lotus-soup:
|
|
||||||
description: |
|
|
||||||
Compile `lotus-soup` Testground test plan
|
|
||||||
parameters:
|
|
||||||
<<: *test-params
|
|
||||||
executor: << parameters.executor >>
|
|
||||||
steps:
|
|
||||||
- prepare
|
|
||||||
- run: cd extern/filecoin-ffi && make
|
|
||||||
- run:
|
|
||||||
name: "go get lotus@master"
|
|
||||||
command: cd testplans/lotus-soup && go mod edit -replace=github.com/filecoin-project/lotus=../.. && go mod tidy
|
|
||||||
- run:
|
|
||||||
name: "build lotus-soup testplan"
|
|
||||||
command: pushd testplans/lotus-soup && go build -tags=testground .
|
|
||||||
trigger-testplans:
|
|
||||||
description: |
|
|
||||||
Trigger `lotus-soup` test cases on TaaS
|
|
||||||
parameters:
|
|
||||||
<<: *test-params
|
|
||||||
executor: << parameters.executor >>
|
|
||||||
steps:
|
|
||||||
- prepare
|
|
||||||
- run:
|
|
||||||
name: "download testground"
|
|
||||||
command: wget https://gist.github.com/nonsense/5fbf3167cac79945f658771aed32fc44/raw/2e17eb0debf7ec6bdf027c1bdafc2c92dd97273b/testground-d3e9603 -O ~/testground-cli && chmod +x ~/testground-cli
|
|
||||||
- run:
|
|
||||||
name: "prepare .env.toml"
|
|
||||||
command: pushd testplans/lotus-soup && mkdir -p $HOME/testground && cp env-ci.toml $HOME/testground/.env.toml && echo 'endpoint="https://ci.testground.ipfs.team"' >> $HOME/testground/.env.toml && echo 'user="circleci"' >> $HOME/testground/.env.toml
|
|
||||||
- run:
|
|
||||||
name: "prepare testground home dir and link test plans"
|
|
||||||
command: mkdir -p $HOME/testground/plans && ln -s $(pwd)/testplans/lotus-soup $HOME/testground/plans/lotus-soup
|
|
||||||
- run:
|
|
||||||
name: "go get lotus@master"
|
|
||||||
command: cd testplans/lotus-soup && go get github.com/filecoin-project/lotus@master
|
|
||||||
- run:
|
|
||||||
name: "trigger deals baseline testplan on taas"
|
|
||||||
command: ~/testground-cli run composition -f $HOME/testground/plans/lotus-soup/_compositions/baseline-k8s-3-1.toml --metadata-commit=$CIRCLE_SHA1 --metadata-repo=filecoin-project/lotus --metadata-branch=$CIRCLE_BRANCH
|
|
||||||
- run:
|
|
||||||
name: "trigger payment channel stress testplan on taas"
|
|
||||||
command: ~/testground-cli run composition -f $HOME/testground/plans/lotus-soup/_compositions/paych-stress-k8s.toml --metadata-commit=$CIRCLE_SHA1 --metadata-repo=filecoin-project/lotus --metadata-branch=$CIRCLE_BRANCH
|
|
||||||
|
|
||||||
build-linux-amd64:
|
build-linux-amd64:
|
||||||
executor: golang
|
executor: golang
|
||||||
@ -1105,13 +1058,6 @@ workflows:
|
|||||||
suite: conformance-bleeding-edge
|
suite: conformance-bleeding-edge
|
||||||
target: "./conformance"
|
target: "./conformance"
|
||||||
vectors-branch: specs-actors-v7
|
vectors-branch: specs-actors-v7
|
||||||
- trigger-testplans:
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
- build-debug
|
|
||||||
- build-lotus-soup
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
jobs:
|
jobs:
|
||||||
@ -1144,8 +1090,6 @@ workflows:
|
|||||||
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
|
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
|
||||||
- release:
|
- release:
|
||||||
name: "Release"
|
name: "Release"
|
||||||
context:
|
|
||||||
- filecoin-goreleaser-key
|
|
||||||
requires:
|
requires:
|
||||||
- "Build ( darwin / amd64 )"
|
- "Build ( darwin / amd64 )"
|
||||||
- "Build ( linux / amd64 )"
|
- "Build ( linux / amd64 )"
|
||||||
@ -1159,8 +1103,6 @@ workflows:
|
|||||||
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
|
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
|
||||||
- release:
|
- release:
|
||||||
name: "Release (dry-run)"
|
name: "Release (dry-run)"
|
||||||
context:
|
|
||||||
- filecoin-goreleaser-key
|
|
||||||
dry-run: true
|
dry-run: true
|
||||||
requires:
|
requires:
|
||||||
- "Build ( darwin / amd64 )"
|
- "Build ( darwin / amd64 )"
|
||||||
|
@ -135,12 +135,6 @@ jobs:
|
|||||||
command: |
|
command: |
|
||||||
git --no-pager diff go.mod go.sum
|
git --no-pager diff go.mod go.sum
|
||||||
git --no-pager diff --quiet go.mod go.sum
|
git --no-pager diff --quiet go.mod go.sum
|
||||||
build-debug:
|
|
||||||
executor: golang
|
|
||||||
steps:
|
|
||||||
- prepare
|
|
||||||
- run:
|
|
||||||
command: make debug
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
description: |
|
description: |
|
||||||
@ -255,47 +249,6 @@ jobs:
|
|||||||
path: /tmp/test-reports
|
path: /tmp/test-reports
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: /tmp/test-artifacts/conformance-coverage.html
|
path: /tmp/test-artifacts/conformance-coverage.html
|
||||||
build-lotus-soup:
|
|
||||||
description: |
|
|
||||||
Compile `lotus-soup` Testground test plan
|
|
||||||
parameters:
|
|
||||||
<<: *test-params
|
|
||||||
executor: << parameters.executor >>
|
|
||||||
steps:
|
|
||||||
- prepare
|
|
||||||
- run: cd extern/filecoin-ffi && make
|
|
||||||
- run:
|
|
||||||
name: "go get lotus@master"
|
|
||||||
command: cd testplans/lotus-soup && go mod edit -replace=github.com/filecoin-project/lotus=../.. && go mod tidy
|
|
||||||
- run:
|
|
||||||
name: "build lotus-soup testplan"
|
|
||||||
command: pushd testplans/lotus-soup && go build -tags=testground .
|
|
||||||
trigger-testplans:
|
|
||||||
description: |
|
|
||||||
Trigger `lotus-soup` test cases on TaaS
|
|
||||||
parameters:
|
|
||||||
<<: *test-params
|
|
||||||
executor: << parameters.executor >>
|
|
||||||
steps:
|
|
||||||
- prepare
|
|
||||||
- run:
|
|
||||||
name: "download testground"
|
|
||||||
command: wget https://gist.github.com/nonsense/5fbf3167cac79945f658771aed32fc44/raw/2e17eb0debf7ec6bdf027c1bdafc2c92dd97273b/testground-d3e9603 -O ~/testground-cli && chmod +x ~/testground-cli
|
|
||||||
- run:
|
|
||||||
name: "prepare .env.toml"
|
|
||||||
command: pushd testplans/lotus-soup && mkdir -p $HOME/testground && cp env-ci.toml $HOME/testground/.env.toml && echo 'endpoint="https://ci.testground.ipfs.team"' >> $HOME/testground/.env.toml && echo 'user="circleci"' >> $HOME/testground/.env.toml
|
|
||||||
- run:
|
|
||||||
name: "prepare testground home dir and link test plans"
|
|
||||||
command: mkdir -p $HOME/testground/plans && ln -s $(pwd)/testplans/lotus-soup $HOME/testground/plans/lotus-soup
|
|
||||||
- run:
|
|
||||||
name: "go get lotus@master"
|
|
||||||
command: cd testplans/lotus-soup && go get github.com/filecoin-project/lotus@master
|
|
||||||
- run:
|
|
||||||
name: "trigger deals baseline testplan on taas"
|
|
||||||
command: ~/testground-cli run composition -f $HOME/testground/plans/lotus-soup/_compositions/baseline-k8s-3-1.toml --metadata-commit=$CIRCLE_SHA1 --metadata-repo=filecoin-project/lotus --metadata-branch=$CIRCLE_BRANCH
|
|
||||||
- run:
|
|
||||||
name: "trigger payment channel stress testplan on taas"
|
|
||||||
command: ~/testground-cli run composition -f $HOME/testground/plans/lotus-soup/_compositions/paych-stress-k8s.toml --metadata-commit=$CIRCLE_SHA1 --metadata-repo=filecoin-project/lotus --metadata-branch=$CIRCLE_BRANCH
|
|
||||||
|
|
||||||
build-linux-amd64:
|
build-linux-amd64:
|
||||||
executor: golang
|
executor: golang
|
||||||
@ -800,13 +753,6 @@ workflows:
|
|||||||
suite: conformance-bleeding-edge
|
suite: conformance-bleeding-edge
|
||||||
target: "./conformance"
|
target: "./conformance"
|
||||||
vectors-branch: specs-actors-v7
|
vectors-branch: specs-actors-v7
|
||||||
- trigger-testplans:
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
- build-debug
|
|
||||||
- build-lotus-soup
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
jobs:
|
jobs:
|
||||||
@ -839,8 +785,6 @@ workflows:
|
|||||||
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
|
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
|
||||||
- release:
|
- release:
|
||||||
name: "Release"
|
name: "Release"
|
||||||
context:
|
|
||||||
- filecoin-goreleaser-key
|
|
||||||
requires:
|
requires:
|
||||||
- "Build ( darwin / amd64 )"
|
- "Build ( darwin / amd64 )"
|
||||||
- "Build ( linux / amd64 )"
|
- "Build ( linux / amd64 )"
|
||||||
@ -854,8 +798,6 @@ workflows:
|
|||||||
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
|
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
|
||||||
- release:
|
- release:
|
||||||
name: "Release (dry-run)"
|
name: "Release (dry-run)"
|
||||||
context:
|
|
||||||
- filecoin-goreleaser-key
|
|
||||||
dry-run: true
|
dry-run: true
|
||||||
requires:
|
requires:
|
||||||
- "Build ( darwin / amd64 )"
|
- "Build ( darwin / amd64 )"
|
||||||
|
@ -43,13 +43,7 @@ func ParseApiInfoMulti(s string) []APIInfo {
|
|||||||
allAddrs := strings.SplitN(s, ",", -1)
|
allAddrs := strings.SplitN(s, ",", -1)
|
||||||
|
|
||||||
for _, addr := range allAddrs {
|
for _, addr := range allAddrs {
|
||||||
if infoWithToken.Match([]byte(addr)) {
|
apiInfos = append(apiInfos, ParseApiInfo(addr))
|
||||||
sp := strings.SplitN(addr, ":", 2)
|
|
||||||
apiInfos = append(apiInfos, APIInfo{
|
|
||||||
Addr: sp[1],
|
|
||||||
Token: []byte(sp[0]),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return apiInfos
|
return apiInfos
|
||||||
|
2
go.mod
2
go.mod
@ -97,7 +97,7 @@ require (
|
|||||||
github.com/ipfs/go-ipld-cbor v0.0.6
|
github.com/ipfs/go-ipld-cbor v0.0.6
|
||||||
github.com/ipfs/go-ipld-format v0.4.0
|
github.com/ipfs/go-ipld-format v0.4.0
|
||||||
github.com/ipfs/go-log/v2 v2.5.1
|
github.com/ipfs/go-log/v2 v2.5.1
|
||||||
github.com/ipfs/go-merkledag v0.8.0
|
github.com/ipfs/go-merkledag v0.8.1
|
||||||
github.com/ipfs/go-metrics-interface v0.0.1
|
github.com/ipfs/go-metrics-interface v0.0.1
|
||||||
github.com/ipfs/go-metrics-prometheus v0.0.2
|
github.com/ipfs/go-metrics-prometheus v0.0.2
|
||||||
github.com/ipfs/go-unixfs v0.3.1
|
github.com/ipfs/go-unixfs v0.3.1
|
||||||
|
4
go.sum
4
go.sum
@ -829,8 +829,8 @@ github.com/ipfs/go-merkledag v0.2.4/go.mod h1:SQiXrtSts3KGNmgOzMICy5c0POOpUNQLvB
|
|||||||
github.com/ipfs/go-merkledag v0.3.2/go.mod h1:fvkZNNZixVW6cKSZ/JfLlON5OlgTXNdRLz0p6QG/I2M=
|
github.com/ipfs/go-merkledag v0.3.2/go.mod h1:fvkZNNZixVW6cKSZ/JfLlON5OlgTXNdRLz0p6QG/I2M=
|
||||||
github.com/ipfs/go-merkledag v0.5.1/go.mod h1:cLMZXx8J08idkp5+id62iVftUQV+HlYJ3PIhDfZsjA4=
|
github.com/ipfs/go-merkledag v0.5.1/go.mod h1:cLMZXx8J08idkp5+id62iVftUQV+HlYJ3PIhDfZsjA4=
|
||||||
github.com/ipfs/go-merkledag v0.6.0/go.mod h1:9HSEwRd5sV+lbykiYP+2NC/3o6MZbKNaa4hfNcH5iH0=
|
github.com/ipfs/go-merkledag v0.6.0/go.mod h1:9HSEwRd5sV+lbykiYP+2NC/3o6MZbKNaa4hfNcH5iH0=
|
||||||
github.com/ipfs/go-merkledag v0.8.0 h1:ZUda+sh/MGZX4Z13DE/VQT4GmKWm4H95Nje4qcL/yPE=
|
github.com/ipfs/go-merkledag v0.8.1 h1:N3yrqSre/ffvdwtHL4MXy0n7XH+VzN8DlzDrJySPa94=
|
||||||
github.com/ipfs/go-merkledag v0.8.0/go.mod h1:/RmH1kOs7qDMNtGKPh4d/UErNMVuAMpPS/tP57a3aoY=
|
github.com/ipfs/go-merkledag v0.8.1/go.mod h1:uYUlWE34GhbcTjGuUDEcdPzsEtOdnOupL64NgSRjmWI=
|
||||||
github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg=
|
github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg=
|
||||||
github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY=
|
github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY=
|
||||||
github.com/ipfs/go-metrics-prometheus v0.0.2 h1:9i2iljLg12S78OhC6UAiXi176xvQGiZaGVF1CUVdE+s=
|
github.com/ipfs/go-metrics-prometheus v0.0.2 h1:9i2iljLg12S78OhC6UAiXi176xvQGiZaGVF1CUVdE+s=
|
||||||
|
@ -1,193 +0,0 @@
|
|||||||
# Delving into the unknown
|
|
||||||
|
|
||||||
This write-up summarises how to debug what appears to be a mischievous Lotus
|
|
||||||
instance during our Testground tests. It also goes enumerates which assets are
|
|
||||||
useful to report suspicious behaviours upstream, in a way that they are
|
|
||||||
actionable.
|
|
||||||
|
|
||||||
## Querying the Lotus RPC API
|
|
||||||
|
|
||||||
The `local:docker` and `cluster:k8s` map ports that you specify in the
|
|
||||||
composition.toml, so you can access them externally.
|
|
||||||
|
|
||||||
All our compositions should carry this fragment:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
```
|
|
||||||
|
|
||||||
This tells Testground to expose the following ports:
|
|
||||||
|
|
||||||
* `6060` => Go pprof.
|
|
||||||
* `1234` => Lotus full node RPC.
|
|
||||||
* `2345` => Lotus storage miner RPC.
|
|
||||||
|
|
||||||
### `local:docker`
|
|
||||||
|
|
||||||
1. Install the `lotus` binary on your host.
|
|
||||||
2. Find the container that you want to connect to in `docker ps`.
|
|
||||||
* Note that our _container names_ are slightly long, and they're the last
|
|
||||||
field on every line, so if your terminal is wrapping text, the port
|
|
||||||
numbers will end up ABOVE the friendly/recognizable container name (e.g. `tg-lotus-soup-deals-e2e-acfc60bc1727-miners-1`).
|
|
||||||
* The testground output displays the _container ID_ inside coloured angle
|
|
||||||
brackets, so if you spot something spurious in a particular node, you can
|
|
||||||
hone in on that one, e.g. `<< 54dd5ad916b2 >>`.
|
|
||||||
|
|
||||||
```
|
|
||||||
⟩ docker ps
|
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
|
||||||
54dd5ad916b2 be3c18d7f0d4 "/testplan" 10 seconds ago Up 8 seconds 0.0.0.0:32788->1234/tcp, 0.0.0.0:32783->2345/tcp, 0.0.0.0:32773->6060/tcp, 0.0.0.0:32777->6060/tcp tg-lotus-soup-deals-e2e-acfc60bc1727-clients-2
|
|
||||||
53757489ce71 be3c18d7f0d4 "/testplan" 10 seconds ago Up 8 seconds 0.0.0.0:32792->1234/tcp, 0.0.0.0:32790->2345/tcp, 0.0.0.0:32781->6060/tcp, 0.0.0.0:32786->6060/tcp tg-lotus-soup-deals-e2e-acfc60bc1727-clients-1
|
|
||||||
9d3e83b71087 be3c18d7f0d4 "/testplan" 10 seconds ago Up 8 seconds 0.0.0.0:32791->1234/tcp, 0.0.0.0:32789->2345/tcp, 0.0.0.0:32779->6060/tcp, 0.0.0.0:32784->6060/tcp tg-lotus-soup-deals-e2e-acfc60bc1727-clients-0
|
|
||||||
7bd60e75ed0e be3c18d7f0d4 "/testplan" 10 seconds ago Up 8 seconds 0.0.0.0:32787->1234/tcp, 0.0.0.0:32782->2345/tcp, 0.0.0.0:32772->6060/tcp, 0.0.0.0:32776->6060/tcp tg-lotus-soup-deals-e2e-acfc60bc1727-miners-1
|
|
||||||
dff229d7b342 be3c18d7f0d4 "/testplan" 10 seconds ago Up 9 seconds 0.0.0.0:32778->1234/tcp, 0.0.0.0:32774->2345/tcp, 0.0.0.0:32769->6060/tcp, 0.0.0.0:32770->6060/tcp tg-lotus-soup-deals-e2e-acfc60bc1727-miners-0
|
|
||||||
4cd67690e3b8 be3c18d7f0d4 "/testplan" 11 seconds ago Up 8 seconds 0.0.0.0:32785->1234/tcp, 0.0.0.0:32780->2345/tcp, 0.0.0.0:32771->6060/tcp, 0.0.0.0:32775->6060/tcp tg-lotus-soup-deals-e2e-acfc60bc1727-bootstrapper-0
|
|
||||||
aeb334adf88d iptestground/sidecar:edge "testground sidecar …" 43 hours ago Up About an hour 0.0.0.0:32768->6060/tcp testground-sidecar
|
|
||||||
c1157500282b influxdb:1.8 "/entrypoint.sh infl…" 43 hours ago Up 25 seconds 0.0.0.0:8086->8086/tcp testground-influxdb
|
|
||||||
99ca4c07fecc redis "docker-entrypoint.s…" 43 hours ago Up About an hour 0.0.0.0:6379->6379/tcp testground-redis
|
|
||||||
bf25c87488a5 bitnami/grafana "/run.sh" 43 hours ago Up 26 seconds 0.0.0.0:3000->3000/tcp testground-grafana
|
|
||||||
cd1d6383eff7 goproxy/goproxy "/goproxy" 45 hours ago Up About a minute 8081/tcp testground-goproxy
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Take note of the port mapping. Imagine in the output above, we want to query
|
|
||||||
`54dd5ad916b2`. We'd use `localhost:32788`, as it forwards to the container's
|
|
||||||
1234 port (Lotus Full Node RPC).
|
|
||||||
4. Run your Lotus CLI command setting the `FULLNODE_API_INFO` env variable,
|
|
||||||
which is a multiaddr:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ FULLNODE_API_INFO=":/ip4/127.0.0.1/tcp/$port/http" lotus chain list
|
|
||||||
[...]
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
Alternatively, you could download gawk and setup a script in you .bashrc or .zshrc similar to:
|
|
||||||
|
|
||||||
```
|
|
||||||
lprt() {
|
|
||||||
NAME=$1
|
|
||||||
PORT=$2
|
|
||||||
|
|
||||||
docker ps --format "table {{.Names}}" | grep $NAME | xargs -I {} docker port {} $PORT | gawk --field-separator=":" '{print $2}'
|
|
||||||
}
|
|
||||||
|
|
||||||
envs() {
|
|
||||||
NAME=$1
|
|
||||||
|
|
||||||
local REMOTE_PORT_1234=$(lprt $NAME 1234)
|
|
||||||
local REMOTE_PORT_2345=$(lprt $NAME 2345)
|
|
||||||
|
|
||||||
export FULLNODE_API_INFO=":/ip4/127.0.0.1/tcp/$REMOTE_PORT_1234/http"
|
|
||||||
export STORAGE_API_INFO=":/ip4/127.0.0.1/tcp/$REMOTE_PORT_2345/http"
|
|
||||||
|
|
||||||
echo "Setting \$FULLNODE_API_INFO to $FULLNODE_API_INFO"
|
|
||||||
echo "Setting \$STORAGE_API_INFO to $STORAGE_API_INFO"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Then call commands like:
|
|
||||||
```
|
|
||||||
envs miners-0
|
|
||||||
lotus chain list
|
|
||||||
```
|
|
||||||
|
|
||||||
### `cluster:k8s`
|
|
||||||
|
|
||||||
Similar to `local:docker`, you pick a pod that you want to connect to and port-forward 1234 and 2345 to that specific pod, such as:
|
|
||||||
|
|
||||||
```
|
|
||||||
export PODNAME="tg-lotus-soup-ae620dfb2e19-miners-0"
|
|
||||||
kubectl port-forward pods/$PODNAME 1234:1234 2345:2345
|
|
||||||
|
|
||||||
export FULLNODE_API_INFO=":/ip4/127.0.0.1/tcp/1234/http"
|
|
||||||
export STORAGE_API_INFO=":/ip4/127.0.0.1/tcp/2345/http"
|
|
||||||
lotus-storage-miner storage-deals list
|
|
||||||
lotus-storage-miner storage-deals get-ask
|
|
||||||
```
|
|
||||||
|
|
||||||
### Useful commands / checks
|
|
||||||
|
|
||||||
* **Making sure miners are on the same chain:** compare outputs of `lotus chain list`.
|
|
||||||
* **Checking deals:** `lotus client list-deals`.
|
|
||||||
* **Sector queries:** `lotus-storage-miner info` , `lotus-storage-miner proving info`
|
|
||||||
* **Sector sealing errors:**
|
|
||||||
* `STORAGE_API_INFO=":/ip4/127.0.0.1/tcp/53624/http" FULLNODE_API_INFO=":/ip4/127.0.0.1/tcp/53623/http" lotus-storage-miner sector info`
|
|
||||||
* `STORAGE_API_INFO=":/ip4/127.0.0.1/tcp/53624/http" FULLNODE_API_INFO=":/ip4/127.0.0.1/tcp/53623/http" lotus-storage-miner sector status <sector_no>`
|
|
||||||
* `STORAGE_API_INFO=":/ip4/127.0.0.1/tcp/53624/http" FULLNODE_API_INFO=":/ip4/127.0.0.1/tcp/53623/http" lotus-storage-miner sector status --log <sector_no>`
|
|
||||||
|
|
||||||
## Viewing logs of a particular container `local:docker`
|
|
||||||
|
|
||||||
This works for both started and stopped containers. Just get the container ID
|
|
||||||
(in double angle brackets in Testground output, on every log line), and do a:
|
|
||||||
|
|
||||||
```shell script
|
|
||||||
$ docker logs $container_id
|
|
||||||
```
|
|
||||||
|
|
||||||
## Accessing the golang instrumentation
|
|
||||||
|
|
||||||
Testground exposes a pprof endpoint under local port 6060, which both
|
|
||||||
`local:docker` and `cluster:k8s` map.
|
|
||||||
|
|
||||||
For `local:docker`, see above to figure out which host port maps to the
|
|
||||||
container's 6060 port.
|
|
||||||
|
|
||||||
## Acquiring a goroutine dump
|
|
||||||
|
|
||||||
When things appear to be stuck, get a goroutine dump.
|
|
||||||
|
|
||||||
```shell script
|
|
||||||
$ wget -o goroutine.out http://localhost:${pprof_port}/debug/pprof/goroutine?debug=2
|
|
||||||
```
|
|
||||||
|
|
||||||
You can use whyrusleeping/stackparse to extract a summary:
|
|
||||||
|
|
||||||
```shell script
|
|
||||||
$ go get https://github.com/whyrusleeping/stackparse
|
|
||||||
$ stackparse --summary goroutine.out
|
|
||||||
```
|
|
||||||
|
|
||||||
## Acquiring a CPU profile
|
|
||||||
|
|
||||||
When the CPU appears to be spiking/rallying, grab a CPU profile.
|
|
||||||
|
|
||||||
```shell script
|
|
||||||
$ wget -o profile.out http://localhost:${pprof_port}/debug/pprof/profile
|
|
||||||
```
|
|
||||||
|
|
||||||
Analyse it using `go tool pprof`. Usually, generating a `png` graph is useful:
|
|
||||||
|
|
||||||
```shell script
|
|
||||||
$ go tool pprof profile.out
|
|
||||||
File: testground
|
|
||||||
Type: cpu
|
|
||||||
Time: Jul 3, 2020 at 12:00am (WEST)
|
|
||||||
Duration: 30.07s, Total samples = 2.81s ( 9.34%)
|
|
||||||
Entering interactive mode (type "help" for commands, "o" for options)
|
|
||||||
(pprof) png
|
|
||||||
Generating report in profile003.png
|
|
||||||
```
|
|
||||||
|
|
||||||
## Submitting actionable reports / findings
|
|
||||||
|
|
||||||
This is useful both internally (within the Oni team, so that peers can help) and
|
|
||||||
externally (when submitting a finding upstream).
|
|
||||||
|
|
||||||
We don't need to play the full bug-hunting game on Lotus, but it's tremendously
|
|
||||||
useful to provide the necessary data so that any reports are actionable.
|
|
||||||
|
|
||||||
These include:
|
|
||||||
|
|
||||||
* test outputs (use `testground collect`).
|
|
||||||
* stack traces that appear in logs (whether panics or not).
|
|
||||||
* output of relevant Lotus CLI commands.
|
|
||||||
* if this is some kind of blockage / deadlock, goroutine dumps.
|
|
||||||
* if this is a CPU hotspot, a CPU profile would be useful.
|
|
||||||
* if this is a memory issue, a heap dump would be useful.
|
|
||||||
|
|
||||||
**When submitting bugs upstream (Lotus), make sure to indicate:**
|
|
||||||
|
|
||||||
* Lotus commit.
|
|
||||||
* FFI commit.
|
|
@ -1,23 +0,0 @@
|
|||||||
SHELL = /bin/bash
|
|
||||||
|
|
||||||
.DEFAULT_GOAL := download-proofs
|
|
||||||
|
|
||||||
download-proofs:
|
|
||||||
go run github.com/filecoin-project/go-paramfetch/paramfetch 2048 ./docker-images/proof-parameters.json
|
|
||||||
|
|
||||||
build-images:
|
|
||||||
docker build -t "iptestground/oni-buildbase:v15-lotus" -f "docker-images/Dockerfile.oni-buildbase" "docker-images"
|
|
||||||
docker build -t "iptestground/oni-runtime:v10" -f "docker-images/Dockerfile.oni-runtime" "docker-images"
|
|
||||||
docker build -t "iptestground/oni-runtime:v10-debug" -f "docker-images/Dockerfile.oni-runtime-debug" "docker-images"
|
|
||||||
|
|
||||||
push-images:
|
|
||||||
docker push iptestground/oni-buildbase:v15-lotus
|
|
||||||
docker push iptestground/oni-runtime:v10
|
|
||||||
docker push iptestground/oni-runtime:v10-debug
|
|
||||||
|
|
||||||
pull-images:
|
|
||||||
docker pull iptestground/oni-buildbase:v15-lotus
|
|
||||||
docker pull iptestground/oni-runtime:v10
|
|
||||||
docker pull iptestground/oni-runtime:v10-debug
|
|
||||||
|
|
||||||
.PHONY: download-proofs build-images push-images pull-images
|
|
@ -1,254 +0,0 @@
|
|||||||
# Project Oni 👹
|
|
||||||
|
|
||||||
Our mandate is:
|
|
||||||
|
|
||||||
> To verify the successful end-to-end outcome of the filecoin protocol and filecoin implementations, under a variety of real-world and simulated scenarios.
|
|
||||||
|
|
||||||
➡️ Find out more about our goals, requirements, execution plan, and team culture, in our [Project Description](https://docs.google.com/document/d/16jYL--EWYpJhxT9bakYq7ZBGLQ9SB940Wd1lTDOAbNE).
|
|
||||||
|
|
||||||
## Table of Contents
|
|
||||||
|
|
||||||
- [Testing topics](#testing-topics)
|
|
||||||
- [Repository contents](#repository-contents)
|
|
||||||
- [Running the test cases](#running-the-test-cases)
|
|
||||||
- [Catalog](#catalog)
|
|
||||||
- [Debugging](#debugging)
|
|
||||||
- [Dependencies](#dependencies)
|
|
||||||
- [Docker images changelog](#docker-images-changelog)
|
|
||||||
- [Team](#team)
|
|
||||||
|
|
||||||
## Testing topics
|
|
||||||
|
|
||||||
These are the topics we are currently centering our testing efforts on. Our testing efforts include fault induction, stress tests, and end-to-end testing.
|
|
||||||
|
|
||||||
* **slashing:** [_(view test scenarios)_](https://github.com/filecoin-project/oni/issues?q=is%3Aissue+sort%3Aupdated-desc+label%3Atopic%2Fslashing)
|
|
||||||
* We are recreating the scenarios that lead to slashing, as they are not readily seen in mono-client testnets.
|
|
||||||
* Context: slashing is the negative economic consequence of penalising a miner that has breached protocol by deducing FIL and/or removing their power from the network.
|
|
||||||
* **windowed PoSt/sector proving faults:** [_(view test scenarios)_](https://github.com/filecoin-project/oni/issues?q=is%3Aissue+sort%3Aupdated-desc+label%3Atopic%2Fsector-proving)
|
|
||||||
* We are recreating the proving fault scenarios and triggering them in an accelerated fasion (by modifying the system configuration), so that we're able to verify that the sector state transitions properly through the different milestones (temporary faults, termination, etc.), and under chain fork conditions.
|
|
||||||
* Context: every 24 hours there are 36 windows where miners need to submit their proofs of sector liveness, correctness, and validity. Failure to do so will mark a sector as faulted, and will eventually terminate the sector, triggering slashing consequences for the miner.
|
|
||||||
* **syncing/fork selection:** [_(view test scenarios)_](https://github.com/filecoin-project/oni/issues?q=is%3Aissue+sort%3Aupdated-desc+label%3Atopic%2Fsync-forks)
|
|
||||||
* Newly bootstrapped clients, and paused-then-resumed clients, are able to latch on to the correct chain even in the presence of a large number of forks in the network, either in the present, or throughout history.
|
|
||||||
* **present-time mining/tipset assembly:** [_(view test scenarios)_](https://github.com/filecoin-project/oni/issues?q=is%3Aissue+sort%3Aupdated-desc+label%3Atopic%2Fmining-present)
|
|
||||||
* Induce forks in the network, create network partitions, simulate chain halts, long-range forks, etc. Stage many kinds of convoluted chain shapes, and network partitions, and ensure that miners are always able to arrive to consensus when disruptions subside.
|
|
||||||
* **catch-up/rush mining:** [_(view test scenarios)_](https://github.com/filecoin-project/oni/issues?q=is%3Aissue+sort%3Aupdated-desc+label%3Atopic%2Fmining-rush)
|
|
||||||
* Induce network-wide, or partition-wide arrests, and investigate what the resulting chain is after the system is allowed to recover.
|
|
||||||
* Context: catch-up/rush mining is a dedicated pathway in the mining logic that brings the chain up to speed with present time, in order to recover from network halts. Basically it entails producing backdated blocks in a hot loop. Imagine all miners recover in unison from a network-wide disruption; miners will produce blocks for their winning rounds, and will label losing rounds as _null rounds_. In the current implementation, there is no time for block propagation, so miners will produce solo-chains, and the assumption is that when all these chains hit the network, the _fork choice rule_ will pick the heaviest one. Unfortunately this process is brittle and unbalanced, as it favours the miner that held the highest power before the disruption commenced.
|
|
||||||
* **storage and retrieval deals:** [_(view test scenarios)_](https://github.com/filecoin-project/oni/issues?q=is%3Aissue+sort%3Aupdated-desc+label%3Atopic%2Fdeals)
|
|
||||||
* end-to-end flows where clients store and retrieve pieces from miners, including stress testing the system.
|
|
||||||
* **payment channels:** [_(view test scenarios)_](https://github.com/filecoin-project/oni/issues?q=is%3Aissue+sort%3Aupdated-desc+label%3Atopic%2Fpaych)
|
|
||||||
* stress testing payment channels via excessive lane creation, excessive payment voucher atomisation, and redemption.
|
|
||||||
* **drand incidents and impact on the filecoin network/protocol/chain:** [_(view test scenarios)_](https://github.com/filecoin-project/oni/issues?q=is%3Aissue+sort%3Aupdated-desc+label%3Atopic%2Fdrand)
|
|
||||||
* drand total unavailabilities, drand catch-ups, drand slowness, etc.
|
|
||||||
* **mempool message selection:** [_(view test scenarios)_](https://github.com/filecoin-project/oni/issues?q=is%3Aissue+sort%3Aupdated-desc+label%3Atopic%2Fmempool)
|
|
||||||
* soundness of message selection logic; potentially targeted attacks against miners by flooding their message pools with different kinds of messages.
|
|
||||||
* **presealing:** [_(view test scenarios)_](https://github.com/filecoin-project/oni/issues?q=is%3Aissue+sort%3Aupdated-desc+label%3Atopic%2Fpresealing)
|
|
||||||
* TBD, anything related to this worth testing?
|
|
||||||
|
|
||||||
## Repository contents
|
|
||||||
|
|
||||||
This repository consists of [test plans](https://docs.testground.ai/concepts-and-architecture/test-structure) built to be run on [Testground](https://github.com/testground/testground).
|
|
||||||
|
|
||||||
The source code for the various test cases can be found in the [`lotus-soup` directory](https://github.com/filecoin-project/oni/tree/master/lotus-soup).
|
|
||||||
|
|
||||||
## Running the test cases
|
|
||||||
|
|
||||||
If you are unfamiliar with Testground, we strongly suggest you read the Testground [Getting Started guide](https://docs.testground.ai/getting-started) in order to learn how to install Testground and how to use it.
|
|
||||||
|
|
||||||
You can find various [composition files](https://docs.testground.ai/running-test-plans#composition-runs) describing various test scenarios built as part of Project Oni at [`lotus-soup/_compositions` directory](https://github.com/filecoin-project/oni/tree/master/lotus-soup/_compositions).
|
|
||||||
|
|
||||||
We've designed the test cases so that you can run them via the `local:exec`, `local:docker` and the `cluster:k8s` runners. Note that Lotus miners are quite resource intensive, requiring gigabytes of memory. Hence you would have to run these test cases on a beafy machine (when using `local:docker` and `local:exec`), or on a Kubernetes cluster (when using `cluster:k8s`).
|
|
||||||
|
|
||||||
Here are the basics of how to run the baseline deals end-to-end test case:
|
|
||||||
|
|
||||||
### Running the baseline deals end-to-end test case
|
|
||||||
|
|
||||||
1. Compile and Install Testground from source code.
|
|
||||||
* See the [Getting Started](https://github.com/testground/testground#getting-started) section of the README for instructions.
|
|
||||||
|
|
||||||
2. Run a Testground daemon
|
|
||||||
|
|
||||||
```
|
|
||||||
testground daemon
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Download required Docker images for the `lotus-soup` test plan
|
|
||||||
|
|
||||||
```
|
|
||||||
make pull-images
|
|
||||||
```
|
|
||||||
|
|
||||||
Alternatively you can build them locally with
|
|
||||||
|
|
||||||
```
|
|
||||||
make build-images
|
|
||||||
```
|
|
||||||
|
|
||||||
4. Import the `lotus-soup` test plan into your Testground home directory
|
|
||||||
|
|
||||||
```
|
|
||||||
testground plan import --from ./lotus-soup
|
|
||||||
```
|
|
||||||
|
|
||||||
5. Init the `filecoin-ffi` Git submodule in the `extra` folder.
|
|
||||||
|
|
||||||
```
|
|
||||||
git submodule update --init --recursive
|
|
||||||
```
|
|
||||||
|
|
||||||
6. Compile the `filecoin-ffi` version locally (necessary if you use `local:exec`)
|
|
||||||
|
|
||||||
```
|
|
||||||
cd extra/filecoin-ffi
|
|
||||||
make
|
|
||||||
```
|
|
||||||
|
|
||||||
7. Run a composition for the baseline deals end-to-end test case
|
|
||||||
|
|
||||||
```
|
|
||||||
testground run composition -f ./lotus-soup/_compositions/baseline-docker-5-1.toml
|
|
||||||
```
|
|
||||||
|
|
||||||
## Batch-running randomised test cases
|
|
||||||
|
|
||||||
The Oni testkit supports [range parameters](https://github.com/filecoin-project/oni/blob/master/lotus-soup/testkit/testenv_ranges.go),
|
|
||||||
which test cases can use to generate random values, either at the instance level
|
|
||||||
(each instance computes a random value within range), or at the run level (one
|
|
||||||
instance computes the values, and propagates them to all other instances via the
|
|
||||||
sync service).
|
|
||||||
|
|
||||||
For example:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
latency_range = '["20ms", "500ms"]'
|
|
||||||
loss_range = '[0, 0.2]'
|
|
||||||
```
|
|
||||||
|
|
||||||
Could pick a random latency between 20ms and 500ms, and a packet loss
|
|
||||||
probability between 0 and 0.2. We could apply those values through the
|
|
||||||
`netclient.ConfigureNetwork` Testground SDK API.
|
|
||||||
|
|
||||||
Randomized range-based parameters are specially interesting when combined with
|
|
||||||
batch runs, as it enables Monte Carlo approaches to testing.
|
|
||||||
|
|
||||||
The Oni codebase includes a batch test run driver in package `lotus-soup/runner`.
|
|
||||||
You can point it at a composition file that uses range parameters and tell it to
|
|
||||||
run N iterations of the test:
|
|
||||||
|
|
||||||
```shell script
|
|
||||||
$ go run ./runner -runs 5 _compositions/net-chaos/latency.toml
|
|
||||||
```
|
|
||||||
|
|
||||||
This will run the test as many times as instructed, and will place all outputs
|
|
||||||
in a temporary directory. You can pass a concrete output directory with
|
|
||||||
the `-output` flag.
|
|
||||||
|
|
||||||
## Catalog
|
|
||||||
|
|
||||||
### Test cases part of `lotus-soup`
|
|
||||||
|
|
||||||
* `deals-e2e` - Deals end-to-end test case. Clients pick a miner at random, start a deal, wait for it to be sealed, and try to retrieve from another random miner who offers back the data.
|
|
||||||
* `drand-halting` - Test case that instructs Drand with a sequence of halt/resume/wait events, while running deals between clients and miners at the same time.
|
|
||||||
* `deals-stress` - Deals stress test case. Clients pick a miner and send multiple deals (concurrently or serially) in order to test how many deals miners can handle.
|
|
||||||
* `paych-stress` - A test case exercising various payment channel stress tests.
|
|
||||||
|
|
||||||
### Compositions part of `lotus-soup`
|
|
||||||
|
|
||||||
* `baseline-docker-5-1.toml` - Runs a `baseline` test (deals e2e test) with a network of 5 clients and 1 miner targeting `local:docker`
|
|
||||||
* `baseline-k8s-10-3.toml` - Runs a `baseline` test (deals e2e test) with a network of 10 clients and 3 miner targeting `cluster:k8s`
|
|
||||||
* `baseline-k8s-3-1.toml` - Runs a `baseline` test (deals e2e test) with a network of 3 clients and 1 miner targeting `cluster:k8s`
|
|
||||||
* `baseline-k8s-3-2.toml` - Runs a `baseline` test (deals e2e test) with a network of 3 clients and 2 miner targeting `cluster:k8s`
|
|
||||||
* `baseline.toml` - Runs a `baseline` test (deals e2e test) with a network of 3 clients and 2 miner targeting `local:exec`. You have to manually download the proof parameters and place them in `/var/tmp`.
|
|
||||||
* `deals-stress-concurrent-natural-k8s.toml`
|
|
||||||
* `deals-stress-concurrent-natural.toml`
|
|
||||||
* `deals-stress-concurrent.toml`
|
|
||||||
* `deals-stress-serial-natural.toml`
|
|
||||||
* `deals-stress-serial.toml`
|
|
||||||
* `drand-halt.toml`
|
|
||||||
* `local-drand.toml`
|
|
||||||
* `natural.toml`
|
|
||||||
* `paych-stress.toml`
|
|
||||||
* `pubsub-tracer.toml`
|
|
||||||
|
|
||||||
|
|
||||||
## Debugging
|
|
||||||
|
|
||||||
Find commands and how-to guides on debugging test plans at [DELVING.md](https://github.com/filecoin-project/oni/blob/master/DELVING.md)
|
|
||||||
|
|
||||||
1. Querying the Lotus RPC API
|
|
||||||
|
|
||||||
2. Useful commands / checks
|
|
||||||
|
|
||||||
* Making sure miners are on the same chain
|
|
||||||
|
|
||||||
* Checking deals
|
|
||||||
|
|
||||||
* Sector queries
|
|
||||||
|
|
||||||
* Sector sealing errors
|
|
||||||
|
|
||||||
## Dependencies
|
|
||||||
|
|
||||||
Our current test plan `lotus-soup` is building programatically the Lotus filecoin implementation and therefore requires all it's dependencies. The build process is slightly more complicated than a normal Go project, because we are binding a bit of Rust code. Lotus codebase is in Go, however its `proofs` and `crypto` libraries are in Rust (BLS signatures, SNARK verification, etc.).
|
|
||||||
|
|
||||||
Depending on the runner you want to use to run the test plan, these dependencies are included in the build process in a different way, which you should be aware of should you require to use the test plan with a newer version of Lotus:
|
|
||||||
|
|
||||||
### Filecoin FFI libraries
|
|
||||||
|
|
||||||
* `local:docker`
|
|
||||||
|
|
||||||
The Rust libraries are included in the Filecoin FFI Git submodule, which is part of the `iptestground/oni-buildbase` image. If the FFI changes on Lotus, we have to rebuild this image with the `make build-images` command, where X is the next version (see [Docker images changelog](#docker-images-changelog)
|
|
||||||
below).
|
|
||||||
|
|
||||||
* `local:exec`
|
|
||||||
|
|
||||||
The Rust libraries are included via the `extra` directory. Make sure that the test plan reference to Lotus in `go.mod` and the `extra` directory are pointing to the same commit of the FFI git submodule. You also need to compile the `extra/filecoin-ffi` libraries with `make`.
|
|
||||||
|
|
||||||
* `cluster:k8s`
|
|
||||||
|
|
||||||
The same process as for `local:docker`, however you need to make sure that the respective `iptestground/oni-buildbase` image is available as a public Docker image, so that the Kubernetes cluster can download it.
|
|
||||||
|
|
||||||
### proof parameters
|
|
||||||
|
|
||||||
Additional to the Filecoin FFI Git submodules, we are also bundling `proof parameters` in the `iptestground/oni-runtime` image. If these change, you will need to rebuild that image with `make build-images` command, where X is the next version.
|
|
||||||
|
|
||||||
## Docker images changelog
|
|
||||||
|
|
||||||
### oni-buildbase
|
|
||||||
|
|
||||||
* `v1` => initial image locking in Filecoin FFI commit ca281af0b6c00314382a75ae869e5cb22c83655b.
|
|
||||||
* `v2` => no changes; released only for aligning both images to aesthetically please @nonsense :D
|
|
||||||
* `v3` => locking in Filecoin FFI commit 5342c7c97d1a1df4650629d14f2823d52889edd9.
|
|
||||||
* `v4` => locking in Filecoin FFI commit 6a143e06f923f3a4f544c7a652e8b4df420a3d28.
|
|
||||||
* `v5` => locking in Filecoin FFI commit cddc56607e1d851ea6d09d49404bd7db70cb3c2e.
|
|
||||||
* `v6` => locking in Filecoin FFI commit 40569104603407c999d6c9e4c3f1228cbd4d0e5c.
|
|
||||||
* `v7` => add Filecoin-BLST repo to buildbase.
|
|
||||||
* `v8` => locking in Filecoin FFI commit f640612a1a1f7a2d.
|
|
||||||
* `v9` => locking in Filecoin FFI commit 57e38efe4943f09d3127dcf6f0edd614e6acf68e and Filecoin-BLST commit 8609119cf4595d1741139c24378fcd8bc4f1c475.
|
|
||||||
|
|
||||||
|
|
||||||
### oni-runtime
|
|
||||||
|
|
||||||
* `v1` => initial image with 2048 parameters.
|
|
||||||
* `v2` => adds auxiliary tools: `net-tools netcat traceroute iputils-ping wget vim curl telnet iproute2 dnsutils`.
|
|
||||||
* `v3` => bump proof parameters from v27 to v28
|
|
||||||
|
|
||||||
### oni-runtime-debug
|
|
||||||
|
|
||||||
* `v1` => initial image
|
|
||||||
* `v2` => locking in Lotus commit e21ea53
|
|
||||||
* `v3` => locking in Lotus commit d557c40
|
|
||||||
* `v4` => bump proof parameters from v27 to v28
|
|
||||||
* `v5` => locking in Lotus commit 1a170e18a
|
|
||||||
|
|
||||||
|
|
||||||
## Team
|
|
||||||
|
|
||||||
* [@raulk](https://github.com/raulk) (Captain + TL)
|
|
||||||
* [@nonsense](https://github.com/nonsense) (Testground TG + engineer)
|
|
||||||
* [@yusefnapora](https://github.com/yusefnapora) (engineer and technical writer)
|
|
||||||
* [@vyzo](https://github.com/vyzo) (engineer)
|
|
||||||
* [@schomatis](https://github.com/schomatis) (advisor)
|
|
||||||
* [@willscott](https://github.com/willscott) (engineer)
|
|
||||||
* [@alanshaw](https://github.com/alanshaw) (engineer)
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
|||||||
# Testground testplans for Lotus
|
|
||||||
|
|
||||||
This directory consists of [testplans](https://docs.testground.ai/concepts-and-architecture/test-structure) built to be run on [Testground](https://github.com/testground/testground) that exercise Lotus on [TaaS](https://ci.testground.ipfs.team).
|
|
||||||
|
|
||||||
## Table of Contents
|
|
||||||
|
|
||||||
- [Testing topics](#testing-topics)
|
|
||||||
- [Running the test cases](#running-the-test-cases)
|
|
||||||
|
|
||||||
## Testing topics
|
|
||||||
|
|
||||||
* **storage and retrieval deals:**
|
|
||||||
* end-to-end flows where clients store and retrieve pieces from miners, including stress testing the system.
|
|
||||||
* **payment channels:**
|
|
||||||
* stress testing payment channels via excessive lane creation, excessive payment voucher atomisation, and redemption.
|
|
||||||
|
|
||||||
## Running the test cases
|
|
||||||
|
|
||||||
If you are unfamiliar with Testground, we strongly suggest you read the Testground [Getting Started guide](https://docs.testground.ai/getting-started) in order to learn how to install Testground and how to use it.
|
|
||||||
|
|
||||||
You can find various [composition files](https://docs.testground.ai/running-test-plans#composition-runs) describing various test scenarios built as part of Project Oni at [`lotus-soup/_compositions` directory](https://github.com/filecoin-project/oni/tree/master/lotus-soup/_compositions).
|
|
||||||
|
|
||||||
We've designed the test cases so that you can run them via the `local:exec`, `local:docker` and the `cluster:k8s` runners. Note that Lotus miners are quite resource intensive, requiring gigabytes of memory. Hence you would have to run these test cases on a beafy machine (when using `local:docker` and `local:exec`), or on a Kubernetes cluster (when using `cluster:k8s`).
|
|
||||||
|
|
||||||
Here are the basics of how to run the baseline deals end-to-end test case:
|
|
||||||
|
|
||||||
### Running the baseline deals end-to-end test case
|
|
||||||
|
|
||||||
1. Compile and Install Testground from source code.
|
|
||||||
* See the [Getting Started](https://github.com/testground/testground#getting-started) section of the README for instructions.
|
|
||||||
|
|
||||||
2. Run a Testground daemon
|
|
||||||
|
|
||||||
```
|
|
||||||
testground daemon
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Download required Docker images for the `lotus-soup` test plan
|
|
||||||
|
|
||||||
```
|
|
||||||
make pull-images
|
|
||||||
```
|
|
||||||
|
|
||||||
Alternatively you can build them locally with
|
|
||||||
|
|
||||||
```
|
|
||||||
make build-images
|
|
||||||
```
|
|
||||||
|
|
||||||
4. Import the `lotus-soup` test plan into your Testground home directory
|
|
||||||
|
|
||||||
```
|
|
||||||
testground plan import --from ./lotus-soup
|
|
||||||
```
|
|
||||||
|
|
||||||
6. Run a composition for the baseline deals end-to-end test case
|
|
||||||
|
|
||||||
```
|
|
||||||
testground run composition -f ./lotus-soup/_compositions/baseline-docker-5-1.toml
|
|
||||||
```
|
|
@ -1,29 +0,0 @@
|
|||||||
FROM golang:1.18.1-buster as tg-build
|
|
||||||
|
|
||||||
ARG TESTGROUND_REF="oni"
|
|
||||||
WORKDIR /usr/src
|
|
||||||
RUN git clone https://github.com/testground/testground.git
|
|
||||||
RUN cd testground && git checkout $TESTGROUND_REF && go build .
|
|
||||||
|
|
||||||
FROM python:3.8-buster
|
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
|
||||||
|
|
||||||
COPY --from=tg-build /usr/src/testground/testground /usr/bin/testground
|
|
||||||
|
|
||||||
RUN mkdir /composer && chmod 777 /composer
|
|
||||||
RUN mkdir /testground && chmod 777 /testground
|
|
||||||
|
|
||||||
ENV HOME /composer
|
|
||||||
ENV TESTGROUND_HOME /testground
|
|
||||||
ENV LISTEN_PORT 5006
|
|
||||||
ENV TESTGROUND_DAEMON_HOST host.docker.internal
|
|
||||||
|
|
||||||
VOLUME /testground/plans
|
|
||||||
|
|
||||||
|
|
||||||
COPY requirements.txt ./
|
|
||||||
RUN pip install -r requirements.txt
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
CMD panel serve --address 0.0.0.0 --port $LISTEN_PORT composer.ipynb
|
|
@ -1,4 +0,0 @@
|
|||||||
all: docker
|
|
||||||
|
|
||||||
docker:
|
|
||||||
docker build -t "iptestground/composer:latest" .
|
|
@ -1,63 +0,0 @@
|
|||||||
# Testground Composer
|
|
||||||
|
|
||||||
This is a work-in-progress UI for configuring and running testground compositions.
|
|
||||||
|
|
||||||
The app code lives in [./app](./app), and there's a thin Jupyter notebook shell in [composer.ipynb](./composer.ipynb).
|
|
||||||
|
|
||||||
## Running
|
|
||||||
|
|
||||||
You can either run the app in docker, or in a local python virtualenv. Docker is recommended unless you're hacking
|
|
||||||
on the code for Composer itself.
|
|
||||||
|
|
||||||
### Running with docker
|
|
||||||
|
|
||||||
Run the `./composer.sh` script to build a container with the latest source and run it. The first build
|
|
||||||
will take a little while since it needs to build testground and fetch a bunch of python dependencies.
|
|
||||||
|
|
||||||
You can skip the build if you set `SKIP_BUILD=true` when running `composer.sh`, and you can rebuild
|
|
||||||
manually with `make docker`.
|
|
||||||
|
|
||||||
The contents of `$TESTGROUND_HOME/plans` will be sync'd to a temporary directory and read-only mounted
|
|
||||||
into the container.
|
|
||||||
|
|
||||||
After building and starting the container, the script will open a browser to the composer UI.
|
|
||||||
|
|
||||||
You should be able to load an existing composition or create a new one from one of the plans in
|
|
||||||
`$TESTGROUND_HOME/plans`.
|
|
||||||
|
|
||||||
Right now docker only supports the standalone webapp UI; to run the UI in a Jupyter notebook, see below.
|
|
||||||
|
|
||||||
### Running with local python
|
|
||||||
|
|
||||||
To run without docker, make a python3 virtual environment somewhere and activate it:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
# make a virtualenv called "venv" in the current directory
|
|
||||||
python3 -m venv ./venv
|
|
||||||
|
|
||||||
# activate (bash/zsh):
|
|
||||||
source ./venv/bin/activate
|
|
||||||
|
|
||||||
# activate (fish):
|
|
||||||
source ./venv/bin/activate.fish
|
|
||||||
```
|
|
||||||
|
|
||||||
Then install the python dependencies:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
pip install -r requirements.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
And start the UI:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
panel serve composer.ipynb
|
|
||||||
```
|
|
||||||
|
|
||||||
That will start the standalone webapp UI. If you want a Jupyter notebook instead, run:
|
|
||||||
|
|
||||||
```
|
|
||||||
jupyter notebook
|
|
||||||
```
|
|
||||||
|
|
||||||
and open `composer.ipynb` in the Jupyter file picker.
|
|
@ -1,94 +0,0 @@
|
|||||||
import param
|
|
||||||
import panel as pn
|
|
||||||
import toml
|
|
||||||
from .util import get_plans, get_manifest
|
|
||||||
from .composition import Composition
|
|
||||||
from .runner import TestRunner
|
|
||||||
|
|
||||||
STAGE_WELCOME = 'Welcome'
|
|
||||||
STAGE_CONFIG_COMPOSITION = 'Configure'
|
|
||||||
STAGE_RUN_TEST = 'Run'
|
|
||||||
|
|
||||||
|
|
||||||
class Welcome(param.Parameterized):
|
|
||||||
composition = param.Parameter()
|
|
||||||
composition_picker = pn.widgets.FileInput(accept='.toml')
|
|
||||||
plan_picker = param.Selector()
|
|
||||||
ready = param.Boolean()
|
|
||||||
|
|
||||||
def __init__(self, **params):
|
|
||||||
super().__init__(**params)
|
|
||||||
self.composition_picker.param.watch(self._composition_updated, 'value')
|
|
||||||
self.param.watch(self._plan_selected, 'plan_picker')
|
|
||||||
self.param['plan_picker'].objects = ['Select a Plan'] + get_plans()
|
|
||||||
|
|
||||||
def panel(self):
|
|
||||||
tabs = pn.Tabs(
|
|
||||||
('New Compostion', self.param['plan_picker']),
|
|
||||||
('Existing Composition', self.composition_picker),
|
|
||||||
)
|
|
||||||
|
|
||||||
return pn.Column(
|
|
||||||
"Either choose an existing composition or select a plan to create a new composition:",
|
|
||||||
tabs,
|
|
||||||
)
|
|
||||||
|
|
||||||
def _composition_updated(self, *args):
|
|
||||||
print('composition updated')
|
|
||||||
content = self.composition_picker.value.decode('utf8')
|
|
||||||
comp_toml = toml.loads(content)
|
|
||||||
manifest = get_manifest(comp_toml['global']['plan'])
|
|
||||||
self.composition = Composition.from_dict(comp_toml, manifest=manifest)
|
|
||||||
print('existing composition: {}'.format(self.composition))
|
|
||||||
self.ready = True
|
|
||||||
|
|
||||||
def _plan_selected(self, evt):
|
|
||||||
if evt.new == 'Select a Plan':
|
|
||||||
return
|
|
||||||
print('plan selected: {}'.format(evt.new))
|
|
||||||
manifest = get_manifest(evt.new)
|
|
||||||
self.composition = Composition(manifest=manifest, add_default_group=True)
|
|
||||||
print('new composition: ', self.composition)
|
|
||||||
self.ready = True
|
|
||||||
|
|
||||||
|
|
||||||
class ConfigureComposition(param.Parameterized):
|
|
||||||
composition = param.Parameter()
|
|
||||||
|
|
||||||
@param.depends('composition')
|
|
||||||
def panel(self):
|
|
||||||
if self.composition is None:
|
|
||||||
return pn.Pane("no composition :(")
|
|
||||||
print('composition: ', self.composition)
|
|
||||||
return self.composition.panel()
|
|
||||||
|
|
||||||
|
|
||||||
class WorkflowPipeline(object):
|
|
||||||
def __init__(self):
|
|
||||||
stages = [
|
|
||||||
(STAGE_WELCOME, Welcome(), dict(ready_parameter='ready')),
|
|
||||||
(STAGE_CONFIG_COMPOSITION, ConfigureComposition()),
|
|
||||||
(STAGE_RUN_TEST, TestRunner()),
|
|
||||||
]
|
|
||||||
|
|
||||||
self.pipeline = pn.pipeline.Pipeline(debug=True, stages=stages)
|
|
||||||
|
|
||||||
def panel(self):
|
|
||||||
return pn.Column(
|
|
||||||
pn.Row(
|
|
||||||
self.pipeline.title,
|
|
||||||
self.pipeline.network,
|
|
||||||
self.pipeline.prev_button,
|
|
||||||
self.pipeline.next_button,
|
|
||||||
),
|
|
||||||
self.pipeline.stage,
|
|
||||||
sizing_mode='stretch_width',
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class App(object):
|
|
||||||
def __init__(self):
|
|
||||||
self.workflow = WorkflowPipeline()
|
|
||||||
|
|
||||||
def ui(self):
|
|
||||||
return self.workflow.panel().servable("Testground Composer")
|
|
@ -1,328 +0,0 @@
|
|||||||
import param
|
|
||||||
import panel as pn
|
|
||||||
import toml
|
|
||||||
from .util import get_manifest, print_err
|
|
||||||
|
|
||||||
|
|
||||||
def value_dict(parameterized, renames=None, stringify=False):
|
|
||||||
d = dict()
|
|
||||||
if renames is None:
|
|
||||||
renames = dict()
|
|
||||||
for name, p in parameterized.param.objects().items():
|
|
||||||
if name == 'name':
|
|
||||||
continue
|
|
||||||
if name in renames:
|
|
||||||
name = renames[name]
|
|
||||||
val = p.__get__(parameterized, type(p))
|
|
||||||
if isinstance(val, param.Parameterized):
|
|
||||||
try:
|
|
||||||
val = val.to_dict()
|
|
||||||
except:
|
|
||||||
val = value_dict(val, renames=renames)
|
|
||||||
if stringify:
|
|
||||||
val = str(val)
|
|
||||||
d[name] = val
|
|
||||||
return d
|
|
||||||
|
|
||||||
|
|
||||||
def make_group_params_class(testcase):
|
|
||||||
"""Returns a subclass of param.Parameterized whose params are defined by the
|
|
||||||
'params' dict inside of the given testcase dict"""
|
|
||||||
tc_params = dict()
|
|
||||||
for name, p in testcase.get('params', {}).items():
|
|
||||||
tc_params[name] = make_param(p)
|
|
||||||
|
|
||||||
name = 'Test Params for testcase {}'.format(testcase.get('name', ''))
|
|
||||||
cls = param.parameterized_class(name, tc_params, GroupParamsBase)
|
|
||||||
return cls
|
|
||||||
|
|
||||||
|
|
||||||
def make_param(pdef):
|
|
||||||
"""
|
|
||||||
:param pdef: a parameter definition dict from a testground plan manifest
|
|
||||||
:return: a param.Parameter that has the type, bounds, default value, etc from the definition
|
|
||||||
"""
|
|
||||||
typ = pdef['type'].lower()
|
|
||||||
if typ == 'int':
|
|
||||||
return num_param(pdef, cls=param.Integer)
|
|
||||||
elif typ == 'float':
|
|
||||||
return num_param(pdef)
|
|
||||||
elif typ.startswith('bool'):
|
|
||||||
return bool_param(pdef)
|
|
||||||
else:
|
|
||||||
return str_param(pdef)
|
|
||||||
|
|
||||||
|
|
||||||
def num_param(pdef, cls=param.Number):
|
|
||||||
lo = pdef.get('min', None)
|
|
||||||
hi = pdef.get('max', None)
|
|
||||||
bounds = (lo, hi)
|
|
||||||
if lo == hi and lo is not None:
|
|
||||||
bounds = None
|
|
||||||
|
|
||||||
default_val = pdef.get('default', None)
|
|
||||||
if default_val is not None:
|
|
||||||
if cls == param.Integer:
|
|
||||||
default_val = int(default_val)
|
|
||||||
else:
|
|
||||||
default_val = float(default_val)
|
|
||||||
return cls(default=default_val, bounds=bounds, doc=pdef.get('desc', ''))
|
|
||||||
|
|
||||||
|
|
||||||
def bool_param(pdef):
|
|
||||||
default_val = str(pdef.get('default', 'false')).lower() == 'true'
|
|
||||||
return param.Boolean(
|
|
||||||
doc=pdef.get('desc', ''),
|
|
||||||
default=default_val
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def str_param(pdef):
|
|
||||||
return param.String(
|
|
||||||
default=pdef.get('default', ''),
|
|
||||||
doc=pdef.get('desc', ''),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class Base(param.Parameterized):
|
|
||||||
@classmethod
|
|
||||||
def from_dict(cls, d):
|
|
||||||
return cls(**d)
|
|
||||||
|
|
||||||
def to_dict(self):
|
|
||||||
return value_dict(self)
|
|
||||||
|
|
||||||
|
|
||||||
class GroupParamsBase(Base):
|
|
||||||
def to_dict(self):
|
|
||||||
return value_dict(self, stringify=True)
|
|
||||||
|
|
||||||
|
|
||||||
class Metadata(Base):
|
|
||||||
composition_name = param.String()
|
|
||||||
author = param.String()
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_dict(cls, d):
|
|
||||||
d['composition_name'] = d.get('name', '')
|
|
||||||
del d['name']
|
|
||||||
return Metadata(**d)
|
|
||||||
|
|
||||||
def to_dict(self):
|
|
||||||
return value_dict(self, {'composition_name': 'name'})
|
|
||||||
|
|
||||||
|
|
||||||
class Global(Base):
|
|
||||||
plan = param.String()
|
|
||||||
case = param.Selector()
|
|
||||||
builder = param.String()
|
|
||||||
runner = param.String()
|
|
||||||
|
|
||||||
# TODO: link to instance counts in groups
|
|
||||||
total_instances = param.Integer()
|
|
||||||
# TODO: add ui widget for key/value maps instead of using Dict param type
|
|
||||||
build_config = param.Dict(default={}, allow_None=True)
|
|
||||||
run_config = param.Dict(default={}, allow_None=True)
|
|
||||||
|
|
||||||
def set_manifest(self, manifest):
|
|
||||||
if manifest is None:
|
|
||||||
return
|
|
||||||
print('manifest:', manifest)
|
|
||||||
self.plan = manifest['name']
|
|
||||||
cases = [tc['name'] for tc in manifest['testcases']]
|
|
||||||
self.param['case'].objects = cases
|
|
||||||
print('global config updated manifest. cases:', self.param['case'].objects)
|
|
||||||
if len(cases) != 0:
|
|
||||||
self.case = cases[0]
|
|
||||||
|
|
||||||
if 'defaults' in manifest:
|
|
||||||
print('manifest defaults', manifest['defaults'])
|
|
||||||
if self.builder == '':
|
|
||||||
self.builder = manifest['defaults'].get('builder', '')
|
|
||||||
if self.runner == '':
|
|
||||||
self.runner = manifest['defaults'].get('runner', '')
|
|
||||||
|
|
||||||
|
|
||||||
class Resources(Base):
|
|
||||||
memory = param.String(allow_None=True)
|
|
||||||
cpu = param.String(allow_None=True)
|
|
||||||
|
|
||||||
|
|
||||||
class Instances(Base):
|
|
||||||
count = param.Integer(allow_None=True)
|
|
||||||
percentage = param.Number(allow_None=True)
|
|
||||||
|
|
||||||
|
|
||||||
class Dependency(Base):
|
|
||||||
module = param.String()
|
|
||||||
version = param.String()
|
|
||||||
|
|
||||||
|
|
||||||
class Build(Base):
|
|
||||||
selectors = param.List(class_=str, allow_None=True)
|
|
||||||
dependencies = param.List(allow_None=True)
|
|
||||||
|
|
||||||
|
|
||||||
class Run(Base):
|
|
||||||
artifact = param.String(allow_None=True)
|
|
||||||
test_params = param.Parameter(instantiate=True)
|
|
||||||
|
|
||||||
def __init__(self, params_class=None, **params):
|
|
||||||
super().__init__(**params)
|
|
||||||
if params_class is not None:
|
|
||||||
self.test_params = params_class()
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_dict(cls, d, params_class=None):
|
|
||||||
return Run(artifact=d.get('artifact', None), params_class=params_class)
|
|
||||||
|
|
||||||
def panel(self):
|
|
||||||
return pn.Column(
|
|
||||||
self.param['artifact'],
|
|
||||||
pn.Param(self.test_params)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class Group(Base):
|
|
||||||
id = param.String()
|
|
||||||
instances = param.Parameter(Instances(), instantiate=True)
|
|
||||||
resources = param.Parameter(Resources(), allow_None=True, instantiate=True)
|
|
||||||
build = param.Parameter(Build(), instantiate=True)
|
|
||||||
run = param.Parameter(Run(), instantiate=True)
|
|
||||||
|
|
||||||
def __init__(self, params_class=None, **params):
|
|
||||||
super().__init__(**params)
|
|
||||||
if params_class is not None:
|
|
||||||
self.run = Run(params_class=params_class)
|
|
||||||
self._set_name(self.id)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_dict(cls, d, params_class=None):
|
|
||||||
return Group(
|
|
||||||
id=d['id'],
|
|
||||||
resources=Resources.from_dict(d.get('resources', {})),
|
|
||||||
instances=Instances.from_dict(d.get('instances', {})),
|
|
||||||
build=Build.from_dict(d.get('build', {})),
|
|
||||||
run=Run.from_dict(d.get('params', {}), params_class=params_class),
|
|
||||||
)
|
|
||||||
|
|
||||||
def panel(self):
|
|
||||||
print('rendering groups panel for ' + self.id)
|
|
||||||
return pn.Column(
|
|
||||||
"**Group: {}**".format(self.id),
|
|
||||||
self.param['id'],
|
|
||||||
self.instances,
|
|
||||||
self.resources,
|
|
||||||
self.build,
|
|
||||||
self.run.panel(),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class Composition(param.Parameterized):
|
|
||||||
metadata = param.Parameter(Metadata(), instantiate=True)
|
|
||||||
global_config = param.Parameter(Global(), instantiate=True)
|
|
||||||
|
|
||||||
groups = param.List(precedence=-1)
|
|
||||||
group_tabs = pn.Tabs()
|
|
||||||
groups_ui = None
|
|
||||||
|
|
||||||
def __init__(self, manifest=None, add_default_group=False, **params):
|
|
||||||
super(Composition, self).__init__(**params)
|
|
||||||
self.manifest = manifest
|
|
||||||
self.testcase_param_classes = dict()
|
|
||||||
self._set_manifest(manifest)
|
|
||||||
if add_default_group:
|
|
||||||
self._add_group()
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_dict(cls, d, manifest=None):
|
|
||||||
if manifest is None:
|
|
||||||
try:
|
|
||||||
manifest = get_manifest(d['global']['plan'])
|
|
||||||
except FileNotFoundError:
|
|
||||||
print_err("Unable to find manifest for test plan {}. Please import into $TESTGROUND_HOME/plans and try again".format(d['global']['plan']))
|
|
||||||
|
|
||||||
c = Composition(
|
|
||||||
manifest=manifest,
|
|
||||||
metadata=Metadata.from_dict(d.get('metadata', {})),
|
|
||||||
global_config=Global.from_dict(d.get('global', {})),
|
|
||||||
)
|
|
||||||
params_class = c._params_class_for_current_testcase()
|
|
||||||
c.groups = [Group.from_dict(g, params_class=params_class) for g in d.get('groups', [])]
|
|
||||||
|
|
||||||
return c
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_toml_file(cls, filename, manifest=None):
|
|
||||||
with open(filename, 'rt') as f:
|
|
||||||
d = toml.load(f)
|
|
||||||
return cls.from_dict(d, manifest=manifest)
|
|
||||||
|
|
||||||
@param.depends('groups', watch=True)
|
|
||||||
def panel(self):
|
|
||||||
add_group_button = pn.widgets.Button(name='Add Group')
|
|
||||||
add_group_button.on_click(self._add_group)
|
|
||||||
|
|
||||||
self._refresh_tabs()
|
|
||||||
|
|
||||||
if self.groups_ui is None:
|
|
||||||
self.groups_ui = pn.Column(
|
|
||||||
add_group_button,
|
|
||||||
self.group_tabs,
|
|
||||||
)
|
|
||||||
|
|
||||||
return pn.Row(
|
|
||||||
pn.Column(self.metadata, self.global_config),
|
|
||||||
self.groups_ui,
|
|
||||||
)
|
|
||||||
|
|
||||||
def _set_manifest(self, manifest):
|
|
||||||
if manifest is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
g = self.global_config
|
|
||||||
print('global conifg: ', g)
|
|
||||||
g.set_manifest(manifest)
|
|
||||||
for tc in manifest.get('testcases', []):
|
|
||||||
self.testcase_param_classes[tc['name']] = make_group_params_class(tc)
|
|
||||||
|
|
||||||
def _params_class_for_current_testcase(self):
|
|
||||||
case = self.global_config.case
|
|
||||||
cls = self.testcase_param_classes.get(case, None)
|
|
||||||
if cls is None:
|
|
||||||
print_err("No testcase found in manifest named " + case)
|
|
||||||
return cls
|
|
||||||
|
|
||||||
def _add_group(self, *args):
|
|
||||||
group_id = 'group-{}'.format(len(self.groups) + 1)
|
|
||||||
g = Group(id=group_id, params_class=self._params_class_for_current_testcase())
|
|
||||||
g.param.watch(self._refresh_tabs, 'id')
|
|
||||||
groups = self.groups
|
|
||||||
groups.append(g)
|
|
||||||
self.groups = groups
|
|
||||||
self.group_tabs.active = len(groups)-1
|
|
||||||
|
|
||||||
@param.depends("global_config.case", watch=True)
|
|
||||||
def _test_case_changed(self):
|
|
||||||
print('test case changed', self.global_config.case)
|
|
||||||
cls = self._params_class_for_current_testcase()
|
|
||||||
for g in self.groups:
|
|
||||||
g.run.test_params = cls()
|
|
||||||
self._refresh_tabs()
|
|
||||||
|
|
||||||
def _refresh_tabs(self, *args):
|
|
||||||
self.group_tabs[:] = [(g.id, g.panel()) for g in self.groups]
|
|
||||||
|
|
||||||
def to_dict(self):
|
|
||||||
return {
|
|
||||||
'metadata': value_dict(self.metadata, renames={'composition_name': 'name'}),
|
|
||||||
'global': value_dict(self.global_config),
|
|
||||||
'groups': [g.to_dict() for g in self.groups]
|
|
||||||
}
|
|
||||||
|
|
||||||
def to_toml(self):
|
|
||||||
return toml.dumps(self.to_dict())
|
|
||||||
|
|
||||||
def write_to_file(self, filename):
|
|
||||||
with open(filename, 'wt') as f:
|
|
||||||
toml.dump(self.to_dict(), f)
|
|
@ -1,111 +0,0 @@
|
|||||||
import os
|
|
||||||
import panel as pn
|
|
||||||
import param
|
|
||||||
from panel.io.server import unlocked
|
|
||||||
from tornado.ioloop import IOLoop, PeriodicCallback
|
|
||||||
from tornado.process import Subprocess
|
|
||||||
from subprocess import STDOUT
|
|
||||||
from bokeh.models.widgets import Div
|
|
||||||
from ansi2html import Ansi2HTMLConverter
|
|
||||||
|
|
||||||
from .composition import Composition
|
|
||||||
|
|
||||||
TESTGROUND = 'testground'
|
|
||||||
|
|
||||||
|
|
||||||
class AnsiColorText(pn.widgets.Widget):
|
|
||||||
style = param.Dict(default=None, doc="""
|
|
||||||
Dictionary of CSS property:value pairs to apply to this Div.""")
|
|
||||||
|
|
||||||
value = param.Parameter(default=None)
|
|
||||||
|
|
||||||
_format = '<div>{value}</div>'
|
|
||||||
|
|
||||||
_rename = {'name': None, 'value': 'text'}
|
|
||||||
|
|
||||||
# _target_transforms = {'value': 'target.text.split(": ")[0]+": "+value'}
|
|
||||||
#
|
|
||||||
# _source_transforms = {'value': 'value.split(": ")[1]'}
|
|
||||||
|
|
||||||
_widget_type = Div
|
|
||||||
|
|
||||||
_converter = Ansi2HTMLConverter(inline=True)
|
|
||||||
|
|
||||||
def _process_param_change(self, msg):
|
|
||||||
msg = super(AnsiColorText, self)._process_property_change(msg)
|
|
||||||
if 'value' in msg:
|
|
||||||
text = str(msg.pop('value'))
|
|
||||||
text = self._converter.convert(text)
|
|
||||||
msg['text'] = text
|
|
||||||
return msg
|
|
||||||
|
|
||||||
def scroll_down(self):
|
|
||||||
# TODO: figure out how to automatically scroll down as text is added
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class CommandRunner(param.Parameterized):
|
|
||||||
command_output = param.String()
|
|
||||||
|
|
||||||
def __init__(self, **params):
|
|
||||||
super().__init__(**params)
|
|
||||||
self._output_lines = []
|
|
||||||
self.proc = None
|
|
||||||
self._updater = PeriodicCallback(self._refresh_output, callback_time=1000)
|
|
||||||
|
|
||||||
@pn.depends('command_output')
|
|
||||||
def panel(self):
|
|
||||||
return pn.Param(self.param, show_name=False, sizing_mode='stretch_width', widgets={
|
|
||||||
'command_output': dict(
|
|
||||||
type=AnsiColorText,
|
|
||||||
sizing_mode='stretch_width',
|
|
||||||
height=800)
|
|
||||||
})
|
|
||||||
|
|
||||||
def run(self, *cmd):
|
|
||||||
self.command_output = ''
|
|
||||||
self._output_lines = []
|
|
||||||
self.proc = Subprocess(cmd, stdout=Subprocess.STREAM, stderr=STDOUT)
|
|
||||||
self._get_next_line()
|
|
||||||
self._updater.start()
|
|
||||||
|
|
||||||
def _get_next_line(self):
|
|
||||||
if self.proc is None:
|
|
||||||
return
|
|
||||||
loop = IOLoop.current()
|
|
||||||
loop.add_future(self.proc.stdout.read_until(bytes('\n', encoding='utf8')), self._append_output)
|
|
||||||
|
|
||||||
def _append_output(self, future):
|
|
||||||
self._output_lines.append(future.result().decode('utf8'))
|
|
||||||
self._get_next_line()
|
|
||||||
|
|
||||||
def _refresh_output(self):
|
|
||||||
text = ''.join(self._output_lines)
|
|
||||||
if len(text) != len(self.command_output):
|
|
||||||
with unlocked():
|
|
||||||
self.command_output = text
|
|
||||||
|
|
||||||
|
|
||||||
class TestRunner(param.Parameterized):
|
|
||||||
composition = param.ClassSelector(class_=Composition, precedence=-1)
|
|
||||||
testground_daemon_endpoint = param.String(default="{}:8042".format(os.environ.get('TESTGROUND_DAEMON_HOST', 'localhost')))
|
|
||||||
run_test = param.Action(lambda self: self.run())
|
|
||||||
runner = CommandRunner()
|
|
||||||
|
|
||||||
def __init__(self, **params):
|
|
||||||
super().__init__(**params)
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
# TODO: temp file management - maybe we should mount a volume and save there?
|
|
||||||
filename = '/tmp/composition.toml'
|
|
||||||
self.composition.write_to_file(filename)
|
|
||||||
|
|
||||||
self.runner.run(TESTGROUND, '--endpoint', self.testground_daemon_endpoint, 'run', 'composition', '-f', filename)
|
|
||||||
|
|
||||||
def panel(self):
|
|
||||||
return pn.Column(
|
|
||||||
self.param['testground_daemon_endpoint'],
|
|
||||||
self.param['run_test'],
|
|
||||||
self.runner.panel(),
|
|
||||||
sizing_mode='stretch_width',
|
|
||||||
)
|
|
@ -1,26 +0,0 @@
|
|||||||
import toml
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def parse_manifest(manifest_path):
|
|
||||||
with open(manifest_path, 'rt') as f:
|
|
||||||
return toml.load(f)
|
|
||||||
|
|
||||||
|
|
||||||
def tg_home():
|
|
||||||
return os.environ.get('TESTGROUND_HOME',
|
|
||||||
os.path.join(os.environ['HOME'], 'testground'))
|
|
||||||
|
|
||||||
|
|
||||||
def get_plans():
|
|
||||||
return list(os.listdir(os.path.join(tg_home(), 'plans')))
|
|
||||||
|
|
||||||
|
|
||||||
def get_manifest(plan_name):
|
|
||||||
manifest_path = os.path.join(tg_home(), 'plans', plan_name, 'manifest.toml')
|
|
||||||
return parse_manifest(manifest_path)
|
|
||||||
|
|
||||||
|
|
||||||
def print_err(*args):
|
|
||||||
print(*args, file=sys.stderr)
|
|
@ -1,174 +0,0 @@
|
|||||||
{
|
|
||||||
"cells": [
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"import json\n",
|
|
||||||
"import pandas as pd\n",
|
|
||||||
"import matplotlib.pyplot as plt\n",
|
|
||||||
"import hvplot.pandas\n",
|
|
||||||
"import panel as pn\n",
|
|
||||||
"\n",
|
|
||||||
"STATE_FILE = './chain-state.ndjson'\n",
|
|
||||||
"\n",
|
|
||||||
"MINER_STATE_COL_RENAMES = {\n",
|
|
||||||
" 'Info.MinerAddr': 'Miner',\n",
|
|
||||||
" 'Info.MinerPower.MinerPower.RawBytePower': 'Info.MinerPowerRaw',\n",
|
|
||||||
" 'Info.MinerPower.MinerPower.QualityAdjPower': 'Info.MinerPowerQualityAdj',\n",
|
|
||||||
" 'Info.MinerPower.TotalPower.RawBytePower': 'Info.TotalPowerRaw',\n",
|
|
||||||
" 'Info.MinerPower.TotalPower.QualityAdjPower': 'Info.TotalPowerQualityAdj',\n",
|
|
||||||
"}\n",
|
|
||||||
"\n",
|
|
||||||
"MINER_NUMERIC_COLS = [\n",
|
|
||||||
" 'Info.MinerPowerRaw',\n",
|
|
||||||
" 'Info.MinerPowerQualityAdj',\n",
|
|
||||||
" 'Info.TotalPowerRaw',\n",
|
|
||||||
" 'Info.TotalPowerQualityAdj',\n",
|
|
||||||
" 'Info.Balance',\n",
|
|
||||||
" 'Info.CommittedBytes',\n",
|
|
||||||
" 'Info.ProvingBytes',\n",
|
|
||||||
" 'Info.FaultyBytes',\n",
|
|
||||||
" 'Info.FaultyPercentage',\n",
|
|
||||||
" 'Info.PreCommitDeposits',\n",
|
|
||||||
" 'Info.LockedFunds',\n",
|
|
||||||
" 'Info.AvailableFunds',\n",
|
|
||||||
" 'Info.WorkerBalance',\n",
|
|
||||||
" 'Info.MarketEscrow',\n",
|
|
||||||
" 'Info.MarketLocked',\n",
|
|
||||||
"]\n",
|
|
||||||
"\n",
|
|
||||||
"DERIVED_COLS = [\n",
|
|
||||||
" 'CommittedSectors',\n",
|
|
||||||
" 'ProvingSectors',\n",
|
|
||||||
"]\n",
|
|
||||||
"\n",
|
|
||||||
"ATTO_FIL_COLS = [\n",
|
|
||||||
" 'Info.Balance',\n",
|
|
||||||
" 'Info.PreCommitDeposits',\n",
|
|
||||||
" 'Info.LockedFunds',\n",
|
|
||||||
" 'Info.AvailableFunds',\n",
|
|
||||||
" 'Info.WorkerBalance',\n",
|
|
||||||
" 'Info.MarketEscrow',\n",
|
|
||||||
" 'Info.MarketLocked',\n",
|
|
||||||
"]\n",
|
|
||||||
"\n",
|
|
||||||
"def atto_to_fil(x):\n",
|
|
||||||
" return float(x) * pow(10, -18)\n",
|
|
||||||
"\n",
|
|
||||||
"def chain_state_to_pandas(statefile):\n",
|
|
||||||
" chain = None\n",
|
|
||||||
" \n",
|
|
||||||
" with open(statefile, 'rt') as f:\n",
|
|
||||||
" for line in f.readlines():\n",
|
|
||||||
" j = json.loads(line)\n",
|
|
||||||
" chain_height = j['Height']\n",
|
|
||||||
" \n",
|
|
||||||
" miners = j['MinerStates']\n",
|
|
||||||
" for m in miners.values():\n",
|
|
||||||
" df = pd.json_normalize(m)\n",
|
|
||||||
" df['Height'] = chain_height\n",
|
|
||||||
" df.rename(columns=MINER_STATE_COL_RENAMES, inplace=True)\n",
|
|
||||||
" if chain is None:\n",
|
|
||||||
" chain = df\n",
|
|
||||||
" else:\n",
|
|
||||||
" chain = chain.append(df, ignore_index=True)\n",
|
|
||||||
" chain.fillna(0, inplace=True)\n",
|
|
||||||
" chain.set_index('Height', inplace=True)\n",
|
|
||||||
" \n",
|
|
||||||
" for c in ATTO_FIL_COLS:\n",
|
|
||||||
" chain[c] = chain[c].apply(atto_to_fil)\n",
|
|
||||||
" \n",
|
|
||||||
" for c in MINER_NUMERIC_COLS:\n",
|
|
||||||
" chain[c] = chain[c].apply(pd.to_numeric)\n",
|
|
||||||
" \n",
|
|
||||||
" # the Sectors.* fields are lists of sector ids, but we want to plot counts, so\n",
|
|
||||||
" # we pull the length of each list into a new column\n",
|
|
||||||
" chain['CommittedSectors'] = chain['Sectors.Committed'].apply(lambda x: len(x))\n",
|
|
||||||
" chain['ProvingSectors'] = chain['Sectors.Proving'].apply(lambda x: len(x))\n",
|
|
||||||
" return chain\n",
|
|
||||||
" \n",
|
|
||||||
"cs = chain_state_to_pandas(STATE_FILE)"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"# choose which col to plot using a widget\n",
|
|
||||||
"\n",
|
|
||||||
"cols_to_plot = MINER_NUMERIC_COLS + DERIVED_COLS\n",
|
|
||||||
"\n",
|
|
||||||
"col_selector = pn.widgets.Select(name='Field', options=cols_to_plot)\n",
|
|
||||||
"cols = ['Miner'] + cols_to_plot\n",
|
|
||||||
"plot = cs[cols].hvplot(by='Miner', y=col_selector)\n",
|
|
||||||
"pn.Column(pn.WidgetBox(col_selector), plot)"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"metadata": {
|
|
||||||
"scrolled": true
|
|
||||||
},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"# plot all line charts in a vertical stack\n",
|
|
||||||
"\n",
|
|
||||||
"plots = []\n",
|
|
||||||
"for c in cols_to_plot:\n",
|
|
||||||
" title = c.split('.')[-1]\n",
|
|
||||||
" p = cs[['Miner', c]].hvplot(by='Miner', y=c, title=title)\n",
|
|
||||||
" plots.append(p)\n",
|
|
||||||
"pn.Column(*plots)"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"# miner power area chart\n",
|
|
||||||
"\n",
|
|
||||||
"mp = cs[['Miner', 'Info.MinerPowerRaw']].rename(columns={'Info.MinerPowerRaw': 'Power'})\n",
|
|
||||||
"mp = mp.pivot_table(values=['Power'], index=cs.index, columns='Miner', aggfunc='sum')\n",
|
|
||||||
"mp = mp.div(mp.sum(1), axis=0)\n",
|
|
||||||
"mp.columns = mp.columns.get_level_values(1)\n",
|
|
||||||
"mp.hvplot.area(title='Miner Power Distribution')"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"metadata": {
|
|
||||||
"kernelspec": {
|
|
||||||
"display_name": "Python 3",
|
|
||||||
"language": "python",
|
|
||||||
"name": "python3"
|
|
||||||
},
|
|
||||||
"language_info": {
|
|
||||||
"codemirror_mode": {
|
|
||||||
"name": "ipython",
|
|
||||||
"version": 3
|
|
||||||
},
|
|
||||||
"file_extension": ".py",
|
|
||||||
"mimetype": "text/x-python",
|
|
||||||
"name": "python",
|
|
||||||
"nbconvert_exporter": "python",
|
|
||||||
"pygments_lexer": "ipython3",
|
|
||||||
"version": "3.8.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nbformat": 4,
|
|
||||||
"nbformat_minor": 4
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
{
|
|
||||||
"cells": [
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"metadata": {
|
|
||||||
"scrolled": true
|
|
||||||
},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"import param\n",
|
|
||||||
"import panel as pn\n",
|
|
||||||
"import app.app as app\n",
|
|
||||||
"import importlib\n",
|
|
||||||
"importlib.reload(app)\n",
|
|
||||||
"\n",
|
|
||||||
"pn.extension()\n",
|
|
||||||
"\n",
|
|
||||||
"a = app.App()\n",
|
|
||||||
"a.ui()"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"metadata": {
|
|
||||||
"kernelspec": {
|
|
||||||
"display_name": "Python 3",
|
|
||||||
"language": "python",
|
|
||||||
"name": "python3"
|
|
||||||
},
|
|
||||||
"language_info": {
|
|
||||||
"codemirror_mode": {
|
|
||||||
"name": "ipython",
|
|
||||||
"version": 3
|
|
||||||
},
|
|
||||||
"file_extension": ".py",
|
|
||||||
"mimetype": "text/x-python",
|
|
||||||
"name": "python",
|
|
||||||
"nbconvert_exporter": "python",
|
|
||||||
"pygments_lexer": "ipython3",
|
|
||||||
"version": "3.8.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nbformat": 4,
|
|
||||||
"nbformat_minor": 4
|
|
||||||
}
|
|
@ -1,134 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# this script runs jupyter inside a docker container and copies
|
|
||||||
# plan manifests from the user's local filesystem into a temporary
|
|
||||||
# directory that's bind-mounted into the container.
|
|
||||||
|
|
||||||
set -o errexit
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
err_report() {
|
|
||||||
echo "Error on line $1"
|
|
||||||
}
|
|
||||||
|
|
||||||
trap 'err_report $LINENO' ERR
|
|
||||||
|
|
||||||
|
|
||||||
image_name="iptestground/composer"
|
|
||||||
image_tag="latest"
|
|
||||||
image_full_name="$image_name:$image_tag"
|
|
||||||
tg_home=${TESTGROUND_HOME:-$HOME/testground}
|
|
||||||
container_plans_dir="/testground/plans"
|
|
||||||
jupyter_port=${JUPYTER_PORT:-8888}
|
|
||||||
panel_port=${PANEL_PORT:-5006}
|
|
||||||
|
|
||||||
poll_interval=30
|
|
||||||
|
|
||||||
exists() {
|
|
||||||
command -v "$1" >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
require_cmds() {
|
|
||||||
for cmd in $@; do
|
|
||||||
exists $cmd || { echo "This script requires the $cmd command. Please install it and try again." >&2; exit 1; }
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
update_plans() {
|
|
||||||
local dest_dir=$1
|
|
||||||
rsync -avzh --quiet --copy-links "${tg_home}/plans/" ${dest_dir}
|
|
||||||
}
|
|
||||||
|
|
||||||
watch_plans() {
|
|
||||||
local plans_dest=$1
|
|
||||||
while true; do
|
|
||||||
update_plans ${plans_dest}
|
|
||||||
sleep $poll_interval
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
open_url() {
|
|
||||||
local url=$1
|
|
||||||
if exists cmd.exe; then
|
|
||||||
cmd.exe /c start ${url} >/dev/null 2>&1
|
|
||||||
elif exists xdg-open; then
|
|
||||||
xdg-open ${url} >/dev/null 2>&1 &
|
|
||||||
elif exists open; then
|
|
||||||
open ${url}
|
|
||||||
else
|
|
||||||
echo "unable to automatically open url. copy/paste this into a browser: $url"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# delete temp dir and stop docker container
|
|
||||||
cleanup () {
|
|
||||||
if [[ "$container_id" != "" ]]; then
|
|
||||||
docker stop ${container_id} >/dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d "$temp_plans_dir" ]]; then
|
|
||||||
rm -rf ${temp_plans_dir}
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
get_host_ip() {
|
|
||||||
# get interface of default route
|
|
||||||
local net_if=$(netstat -rn | awk '/^0.0.0.0/ {thif=substr($0,74,10); print thif;} /^default.*UG/ {thif=substr($0,65,10); print thif;}')
|
|
||||||
# use ifconfig to get addr of that interface
|
|
||||||
detected_host_ip=`ifconfig ${net_if} | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'`
|
|
||||||
|
|
||||||
if [ -z "$detected_host_ip" ]
|
|
||||||
then
|
|
||||||
detected_host_ip="host.docker.internal"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo $detected_host_ip
|
|
||||||
}
|
|
||||||
|
|
||||||
# run cleanup on exit
|
|
||||||
trap "{ cleanup; }" EXIT
|
|
||||||
|
|
||||||
# make sure we have the commands we need
|
|
||||||
require_cmds jq docker rsync
|
|
||||||
|
|
||||||
if [[ "$SKIP_BUILD" == "" ]]; then
|
|
||||||
echo "Building latest docker image. Set SKIP_BUILD env var to any value to bypass."
|
|
||||||
require_cmds make
|
|
||||||
make docker
|
|
||||||
fi
|
|
||||||
|
|
||||||
# make temp dir for manifests
|
|
||||||
temp_base="/tmp"
|
|
||||||
if [[ "$TEMP" != "" ]]; then
|
|
||||||
temp_base=$TEMP
|
|
||||||
fi
|
|
||||||
|
|
||||||
temp_plans_dir="$(mktemp -d ${temp_base}/testground-composer-XXXX)"
|
|
||||||
echo "temp plans dir: $temp_plans_dir"
|
|
||||||
|
|
||||||
# copy testplans from $TESTGROUND_HOME/plans to the temp dir
|
|
||||||
update_plans ${temp_plans_dir}
|
|
||||||
|
|
||||||
# run the container in detached mode and grab the id
|
|
||||||
container_id=$(docker run -d \
|
|
||||||
-e TESTGROUND_DAEMON_HOST=$(get_host_ip) \
|
|
||||||
--user $(id -u):$(id -g) \
|
|
||||||
-p ${panel_port}:5006 \
|
|
||||||
-v ${temp_plans_dir}:${container_plans_dir}:ro \
|
|
||||||
$image_full_name)
|
|
||||||
|
|
||||||
echo "container $container_id started"
|
|
||||||
# print the log output
|
|
||||||
docker logs -f ${container_id} &
|
|
||||||
|
|
||||||
# sleep for a couple seconds to let the server start up
|
|
||||||
sleep 2
|
|
||||||
|
|
||||||
# open a browser to the app url
|
|
||||||
panel_url="http://localhost:${panel_port}"
|
|
||||||
open_url $panel_url
|
|
||||||
|
|
||||||
# poll & sync testplan changes every few seconds
|
|
||||||
watch_plans ${temp_plans_dir}
|
|
@ -1,214 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "all-both"
|
|
||||||
author = "adin"
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "dht"
|
|
||||||
case = "all"
|
|
||||||
total_instances = 1000
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "cluster:k8s"
|
|
||||||
[global.build_config]
|
|
||||||
push_registry = true
|
|
||||||
registry_type = "aws"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "balsam-undialable-provider"
|
|
||||||
[groups.instances]
|
|
||||||
count = 5
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.build]
|
|
||||||
selectors = ["balsam"]
|
|
||||||
[groups.run]
|
|
||||||
artifact = "909427826938.dkr.ecr.us-east-1.amazonaws.com/testground-us-east-1-dht:701251a63b92"
|
|
||||||
[groups.run.test_params]
|
|
||||||
bs_strategy = "7"
|
|
||||||
bucket_size = "10"
|
|
||||||
expect_dht = "false"
|
|
||||||
group_order = "4"
|
|
||||||
latency = "100"
|
|
||||||
record_count = "1"
|
|
||||||
timeout_secs = "600"
|
|
||||||
undialable = "true"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "balsam-undialable-searcher"
|
|
||||||
[groups.instances]
|
|
||||||
count = 5
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.build]
|
|
||||||
selectors = ["balsam"]
|
|
||||||
[groups.run]
|
|
||||||
artifact = "909427826938.dkr.ecr.us-east-1.amazonaws.com/testground-us-east-1-dht:701251a63b92"
|
|
||||||
[groups.run.test_params]
|
|
||||||
bs_strategy = "7"
|
|
||||||
bucket_size = "10"
|
|
||||||
expect_dht = "false"
|
|
||||||
group_order = "5"
|
|
||||||
latency = "100"
|
|
||||||
search_records = "true"
|
|
||||||
timeout_secs = "600"
|
|
||||||
undialable = "true"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "balsam-dialable-passive"
|
|
||||||
[groups.instances]
|
|
||||||
count = 780
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.build]
|
|
||||||
selectors = ["balsam"]
|
|
||||||
[groups.run]
|
|
||||||
artifact = "909427826938.dkr.ecr.us-east-1.amazonaws.com/testground-us-east-1-dht:701251a63b92"
|
|
||||||
[groups.run.test_params]
|
|
||||||
bs_strategy = "7"
|
|
||||||
bucket_size = "10"
|
|
||||||
expect_dht = "false"
|
|
||||||
group_order = "6"
|
|
||||||
latency = "100"
|
|
||||||
timeout_secs = "600"
|
|
||||||
undialable = "false"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "balsam-dialable-provider"
|
|
||||||
[groups.instances]
|
|
||||||
count = 5
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.build]
|
|
||||||
selectors = ["balsam"]
|
|
||||||
[groups.run]
|
|
||||||
artifact = "909427826938.dkr.ecr.us-east-1.amazonaws.com/testground-us-east-1-dht:701251a63b92"
|
|
||||||
[groups.run.test_params]
|
|
||||||
bs_strategy = "7"
|
|
||||||
bucket_size = "10"
|
|
||||||
expect_dht = "false"
|
|
||||||
group_order = "7"
|
|
||||||
latency = "100"
|
|
||||||
record_count = "1"
|
|
||||||
timeout_secs = "600"
|
|
||||||
undialable = "false"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "balsam-dialable-searcher"
|
|
||||||
[groups.instances]
|
|
||||||
count = 5
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.build]
|
|
||||||
selectors = ["balsam"]
|
|
||||||
[groups.run]
|
|
||||||
artifact = "909427826938.dkr.ecr.us-east-1.amazonaws.com/testground-us-east-1-dht:701251a63b92"
|
|
||||||
[groups.run.test_params]
|
|
||||||
bs_strategy = "7"
|
|
||||||
bucket_size = "10"
|
|
||||||
expect_dht = "false"
|
|
||||||
group_order = "8"
|
|
||||||
latency = "100"
|
|
||||||
search_records = "true"
|
|
||||||
timeout_secs = "600"
|
|
||||||
undialable = "false"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "cypress-passive"
|
|
||||||
[groups.instances]
|
|
||||||
count = 185
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.build]
|
|
||||||
selectors = ["cypress"]
|
|
||||||
|
|
||||||
[[groups.build.dependencies]]
|
|
||||||
module = "github.com/libp2p/go-libp2p-kad-dht"
|
|
||||||
version = "180be07b8303d536e39809bc39c58be5407fedd9"
|
|
||||||
|
|
||||||
[[groups.build.dependencies]]
|
|
||||||
module = "github.com/libp2p/go-libp2p-xor"
|
|
||||||
version = "df24f5b04bcbdc0059b27989163a6090f4f6dc7a"
|
|
||||||
[groups.run]
|
|
||||||
artifact = "909427826938.dkr.ecr.us-east-1.amazonaws.com/testground-us-east-1-dht:ca78473d669d"
|
|
||||||
[groups.run.test_params]
|
|
||||||
alpha = "6"
|
|
||||||
beta = "3"
|
|
||||||
bs_strategy = "7"
|
|
||||||
bucket_size = "10"
|
|
||||||
group_order = "1"
|
|
||||||
latency = "100"
|
|
||||||
timeout_secs = "600"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "cypress-provider"
|
|
||||||
[groups.instances]
|
|
||||||
count = 5
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.build]
|
|
||||||
selectors = ["cypress"]
|
|
||||||
|
|
||||||
[[groups.build.dependencies]]
|
|
||||||
module = "github.com/libp2p/go-libp2p-kad-dht"
|
|
||||||
version = "180be07b8303d536e39809bc39c58be5407fedd9"
|
|
||||||
|
|
||||||
[[groups.build.dependencies]]
|
|
||||||
module = "github.com/libp2p/go-libp2p-xor"
|
|
||||||
version = "df24f5b04bcbdc0059b27989163a6090f4f6dc7a"
|
|
||||||
[groups.run]
|
|
||||||
artifact = "909427826938.dkr.ecr.us-east-1.amazonaws.com/testground-us-east-1-dht:ca78473d669d"
|
|
||||||
[groups.run.test_params]
|
|
||||||
alpha = "6"
|
|
||||||
beta = "3"
|
|
||||||
bs_strategy = "7"
|
|
||||||
bucket_size = "10"
|
|
||||||
group_order = "2"
|
|
||||||
latency = "100"
|
|
||||||
record_count = "1"
|
|
||||||
timeout_secs = "600"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "cypress-searcher"
|
|
||||||
[groups.instances]
|
|
||||||
count = 5
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.build]
|
|
||||||
selectors = ["cypress"]
|
|
||||||
|
|
||||||
[[groups.build.dependencies]]
|
|
||||||
module = "github.com/libp2p/go-libp2p-kad-dht"
|
|
||||||
version = "180be07b8303d536e39809bc39c58be5407fedd9"
|
|
||||||
|
|
||||||
[[groups.build.dependencies]]
|
|
||||||
module = "github.com/libp2p/go-libp2p-xor"
|
|
||||||
version = "df24f5b04bcbdc0059b27989163a6090f4f6dc7a"
|
|
||||||
[groups.run]
|
|
||||||
artifact = "909427826938.dkr.ecr.us-east-1.amazonaws.com/testground-us-east-1-dht:ca78473d669d"
|
|
||||||
[groups.run.test_params]
|
|
||||||
alpha = "6"
|
|
||||||
beta = "3"
|
|
||||||
bs_strategy = "7"
|
|
||||||
bucket_size = "10"
|
|
||||||
group_order = "3"
|
|
||||||
latency = "100"
|
|
||||||
search_records = "true"
|
|
||||||
timeout_secs = "600"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "cypress-bs"
|
|
||||||
[groups.instances]
|
|
||||||
count = 5
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.build]
|
|
||||||
selectors = ["cypress"]
|
|
||||||
|
|
||||||
[[groups.build.dependencies]]
|
|
||||||
module = "github.com/libp2p/go-libp2p-kad-dht"
|
|
||||||
version = "180be07b8303d536e39809bc39c58be5407fedd9"
|
|
||||||
|
|
||||||
[[groups.build.dependencies]]
|
|
||||||
module = "github.com/libp2p/go-libp2p-xor"
|
|
||||||
version = "df24f5b04bcbdc0059b27989163a6090f4f6dc7a"
|
|
||||||
[groups.run]
|
|
||||||
artifact = "909427826938.dkr.ecr.us-east-1.amazonaws.com/testground-us-east-1-dht:ca78473d669d"
|
|
||||||
[groups.run.test_params]
|
|
||||||
alpha = "6"
|
|
||||||
beta = "3"
|
|
||||||
bootstrapper = "true"
|
|
||||||
bs_strategy = "7"
|
|
||||||
bucket_size = "10"
|
|
||||||
group_order = "0"
|
|
||||||
latency = "100"
|
|
||||||
timeout_secs = "600"
|
|
@ -1,14 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "ping-pong-local"
|
|
||||||
author = "yusef"
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "network"
|
|
||||||
case = "ping-pong"
|
|
||||||
total_instances = 2
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "local:docker"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "nodes"
|
|
||||||
instances = { count = 2 }
|
|
@ -1,8 +0,0 @@
|
|||||||
param
|
|
||||||
toml
|
|
||||||
jupyter
|
|
||||||
panel
|
|
||||||
holoviews
|
|
||||||
ansi2html
|
|
||||||
matplotlib
|
|
||||||
hvplot
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,16 +0,0 @@
|
|||||||
ARG GO_VERSION=1.18.1
|
|
||||||
|
|
||||||
FROM golang:${GO_VERSION}-buster
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y ca-certificates llvm clang mesa-opencl-icd ocl-icd-opencl-dev jq gcc git pkg-config bzr libhwloc-dev
|
|
||||||
|
|
||||||
ARG FILECOIN_FFI_COMMIT=8b97bd8230b77bd32f4f27e4766a6d8a03b4e801
|
|
||||||
ARG FFI_DIR=/extern/filecoin-ffi
|
|
||||||
|
|
||||||
RUN mkdir -p ${FFI_DIR} \
|
|
||||||
&& git clone https://github.com/filecoin-project/filecoin-ffi.git ${FFI_DIR} \
|
|
||||||
&& cd ${FFI_DIR} \
|
|
||||||
&& git checkout ${FILECOIN_FFI_COMMIT} \
|
|
||||||
&& make
|
|
||||||
|
|
||||||
RUN ldconfig
|
|
@ -1,23 +0,0 @@
|
|||||||
ARG GO_VERSION=1.18.1
|
|
||||||
|
|
||||||
FROM golang:${GO_VERSION}-buster as downloader
|
|
||||||
|
|
||||||
## Fetch the proof parameters.
|
|
||||||
## 1. Install the paramfetch binary first, so it can be cached over builds.
|
|
||||||
## 2. Then copy over the parameters (which could change).
|
|
||||||
## 3. Trigger the download.
|
|
||||||
## Output will be in /var/tmp/filecoin-proof-parameters.
|
|
||||||
|
|
||||||
RUN go get github.com/filecoin-project/go-paramfetch/paramfetch@master
|
|
||||||
COPY /proof-parameters.json /
|
|
||||||
RUN paramfetch 8388608 /proof-parameters.json
|
|
||||||
|
|
||||||
FROM ubuntu:18.04
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y ca-certificates llvm clang mesa-opencl-icd ocl-icd-opencl-dev gcc pkg-config libhwloc-dev
|
|
||||||
|
|
||||||
RUN apt-get install -y jq net-tools netcat traceroute iputils-ping wget vim curl telnet iproute2 dnsutils
|
|
||||||
|
|
||||||
COPY --from=downloader /var/tmp/filecoin-proof-parameters /var/tmp/filecoin-proof-parameters
|
|
||||||
|
|
||||||
RUN ldconfig
|
|
@ -1,30 +0,0 @@
|
|||||||
ARG GO_VERSION=1.18.1
|
|
||||||
|
|
||||||
FROM golang:${GO_VERSION}-buster as downloader
|
|
||||||
|
|
||||||
## Fetch the proof parameters.
|
|
||||||
## 1. Install the paramfetch binary first, so it can be cached over builds.
|
|
||||||
## 2. Then copy over the parameters (which could change).
|
|
||||||
## 3. Trigger the download.
|
|
||||||
## Output will be in /var/tmp/filecoin-proof-parameters.
|
|
||||||
|
|
||||||
RUN go get github.com/filecoin-project/go-paramfetch/paramfetch@master
|
|
||||||
COPY /proof-parameters.json /
|
|
||||||
RUN paramfetch 8388608 /proof-parameters.json
|
|
||||||
|
|
||||||
ARG LOTUS_COMMIT=b8deee048eaf850113e8626a73f64b17ba69a9f6
|
|
||||||
|
|
||||||
## for debug purposes
|
|
||||||
RUN apt update && apt install -y mesa-opencl-icd ocl-icd-opencl-dev gcc git bzr jq pkg-config libhwloc-dev curl && git clone https://github.com/filecoin-project/lotus.git && cd lotus/ && git checkout ${LOTUS_COMMIT} && make clean && make all && make install
|
|
||||||
|
|
||||||
FROM ubuntu:18.04
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y ca-certificates llvm clang mesa-opencl-icd ocl-icd-opencl-dev jq gcc pkg-config libhwloc-dev net-tools netcat traceroute iputils-ping wget vim curl telnet iproute2 dnsutils
|
|
||||||
COPY --from=downloader /var/tmp/filecoin-proof-parameters /var/tmp/filecoin-proof-parameters
|
|
||||||
|
|
||||||
## for debug purposes
|
|
||||||
COPY --from=downloader /usr/local/bin/lotus /usr/local/bin/lll
|
|
||||||
COPY --from=downloader /usr/local/bin/lotus-miner /usr/local/bin/lm
|
|
||||||
|
|
||||||
ENV FULLNODE_API_INFO="/ip4/127.0.0.1/tcp/1234/http"
|
|
||||||
ENV MINER_API_INFO="/ip4/127.0.0.1/tcp/2345/http"
|
|
@ -1,202 +0,0 @@
|
|||||||
{
|
|
||||||
"v28-empty-sector-update-merkletree-poseidon_hasher-8-0-0-61fa69f38b9cc771ba27b670124714b4ea77fbeae05e377fb859c4a43b73a30c.params": {
|
|
||||||
"cid": "Qma5WL6abSqYg9uUQAZ3EHS286bsNsha7oAGsJBD48Bq2q",
|
|
||||||
"digest": "c3ad7bb549470b82ad52ed070aebb4f4",
|
|
||||||
"sector_size": 536870912
|
|
||||||
},
|
|
||||||
"v28-empty-sector-update-merkletree-poseidon_hasher-8-0-0-61fa69f38b9cc771ba27b670124714b4ea77fbeae05e377fb859c4a43b73a30c.vk": {
|
|
||||||
"cid": "QmUa7f9JtJMsqJJ3s3ZXk6WyF4xJLE8FiqYskZGgk8GCDv",
|
|
||||||
"digest": "994c5b7d450ca9da348c910689f2dc7f",
|
|
||||||
"sector_size": 536870912
|
|
||||||
},
|
|
||||||
"v28-empty-sector-update-merkletree-poseidon_hasher-8-0-0-92180959e1918d26350b8e6cfe217bbdd0a2d8de51ebec269078b364b715ad63.params": {
|
|
||||||
"cid": "QmQiT4qBGodrVNEgVTDXxBNDdPbaD8Ag7Sx3ZTq1zHX79S",
|
|
||||||
"digest": "5aedd2cf3e5c0a15623d56a1b43110ad",
|
|
||||||
"sector_size": 8388608
|
|
||||||
},
|
|
||||||
"v28-empty-sector-update-merkletree-poseidon_hasher-8-0-0-92180959e1918d26350b8e6cfe217bbdd0a2d8de51ebec269078b364b715ad63.vk": {
|
|
||||||
"cid": "QmdcpKUQvHM8RFRVKbk1yHfEqMcBzhtFWKRp9SNEmWq37i",
|
|
||||||
"digest": "abd80269054d391a734febdac0d2e687",
|
|
||||||
"sector_size": 8388608
|
|
||||||
},
|
|
||||||
"v28-empty-sector-update-merkletree-poseidon_hasher-8-0-0-fb9e095bebdd77511c0269b967b4d87ba8b8a525edaa0e165de23ba454510194.params": {
|
|
||||||
"cid": "QmYM6Hg7mjmvA3ZHTsqkss1fkdyDju5dDmLiBZGJ5pz9y9",
|
|
||||||
"digest": "311f92a3e75036ced01b1c0025f1fa0c",
|
|
||||||
"sector_size": 2048
|
|
||||||
},
|
|
||||||
"v28-empty-sector-update-merkletree-poseidon_hasher-8-0-0-fb9e095bebdd77511c0269b967b4d87ba8b8a525edaa0e165de23ba454510194.vk": {
|
|
||||||
"cid": "QmaQsTLL3nc5dw6wAvaioJSBfd1jhQrA2o6ucFf7XeV74P",
|
|
||||||
"digest": "eadad9784969890d30f2749708c79771",
|
|
||||||
"sector_size": 2048
|
|
||||||
},
|
|
||||||
"v28-empty-sector-update-merkletree-poseidon_hasher-8-8-0-3b7f44a9362e3985369454947bc94022e118211e49fd672d52bec1cbfd599d18.params": {
|
|
||||||
"cid": "QmNPc75iEfcahCwNKdqnWLtxnjspUGGR4iscjiz3wP3RtS",
|
|
||||||
"digest": "1b3cfd761a961543f9eb273e435a06a2",
|
|
||||||
"sector_size": 34359738368
|
|
||||||
},
|
|
||||||
"v28-empty-sector-update-merkletree-poseidon_hasher-8-8-0-3b7f44a9362e3985369454947bc94022e118211e49fd672d52bec1cbfd599d18.vk": {
|
|
||||||
"cid": "QmdFFUe1gcz9MMHc6YW8aoV48w4ckvcERjt7PkydQAMfCN",
|
|
||||||
"digest": "3a6941983754737fde880d29c7094905",
|
|
||||||
"sector_size": 34359738368
|
|
||||||
},
|
|
||||||
"v28-empty-sector-update-merkletree-poseidon_hasher-8-8-2-102e1444a7e9a97ebf1e3d6855dcc77e66c011ea66f936d9b2c508f87f2f83a7.params": {
|
|
||||||
"cid": "QmUB6xTVjzBQGuDNeyJMrrJ1byk58vhPm8eY2Lv9pgwanp",
|
|
||||||
"digest": "1a392e7b759fb18e036c7559b5ece816",
|
|
||||||
"sector_size": 68719476736
|
|
||||||
},
|
|
||||||
"v28-empty-sector-update-merkletree-poseidon_hasher-8-8-2-102e1444a7e9a97ebf1e3d6855dcc77e66c011ea66f936d9b2c508f87f2f83a7.vk": {
|
|
||||||
"cid": "Qmd794Jty7k26XJ8Eg4NDEks65Qk8G4GVfGkwqvymv8HAg",
|
|
||||||
"digest": "80e366df2f1011953c2d01c7b7c9ee8e",
|
|
||||||
"sector_size": 68719476736
|
|
||||||
},
|
|
||||||
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-0170db1f394b35d995252228ee359194b13199d259380541dc529fb0099096b0.params": {
|
|
||||||
"cid": "QmVxjFRyhmyQaZEtCh7nk2abc7LhFkzhnRX4rcHqCCpikR",
|
|
||||||
"digest": "7610b9f82bfc88405b7a832b651ce2f6",
|
|
||||||
"sector_size": 2048
|
|
||||||
},
|
|
||||||
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-0170db1f394b35d995252228ee359194b13199d259380541dc529fb0099096b0.vk": {
|
|
||||||
"cid": "QmcS5JZs8X3TdtkEBpHAdUYjdNDqcL7fWQFtQz69mpnu2X",
|
|
||||||
"digest": "0e0958009936b9d5e515ec97b8cb792d",
|
|
||||||
"sector_size": 2048
|
|
||||||
},
|
|
||||||
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-0cfb4f178bbb71cf2ecfcd42accce558b27199ab4fb59cb78f2483fe21ef36d9.params": {
|
|
||||||
"cid": "QmUiRx71uxfmUE8V3H9sWAsAXoM88KR4eo1ByvvcFNeTLR",
|
|
||||||
"digest": "1a7d4a9c8a502a497ed92a54366af33f",
|
|
||||||
"sector_size": 536870912
|
|
||||||
},
|
|
||||||
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-0cfb4f178bbb71cf2ecfcd42accce558b27199ab4fb59cb78f2483fe21ef36d9.vk": {
|
|
||||||
"cid": "QmfCeddjFpWtavzfEzZpJfzSajGNwfL4RjFXWAvA9TSnTV",
|
|
||||||
"digest": "4dae975de4f011f101f5a2f86d1daaba",
|
|
||||||
"sector_size": 536870912
|
|
||||||
},
|
|
||||||
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-3ea05428c9d11689f23529cde32fd30aabd50f7d2c93657c1d3650bca3e8ea9e.params": {
|
|
||||||
"cid": "QmcSTqDcFVLGGVYz1njhUZ7B6fkKtBumsLUwx4nkh22TzS",
|
|
||||||
"digest": "82c88066be968bb550a05e30ff6c2413",
|
|
||||||
"sector_size": 2048
|
|
||||||
},
|
|
||||||
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-3ea05428c9d11689f23529cde32fd30aabd50f7d2c93657c1d3650bca3e8ea9e.vk": {
|
|
||||||
"cid": "QmSTCXF2ipGA3f6muVo6kHc2URSx6PzZxGUqu7uykaH5KU",
|
|
||||||
"digest": "ffd79788d614d27919ae5bd2d94eacb6",
|
|
||||||
"sector_size": 2048
|
|
||||||
},
|
|
||||||
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-50c7368dea9593ed0989e70974d28024efa9d156d585b7eea1be22b2e753f331.params": {
|
|
||||||
"cid": "QmU9SBzJNrcjRFDiFc4GcApqdApN6z9X7MpUr66mJ2kAJP",
|
|
||||||
"digest": "700171ecf7334e3199437c930676af82",
|
|
||||||
"sector_size": 8388608
|
|
||||||
},
|
|
||||||
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-50c7368dea9593ed0989e70974d28024efa9d156d585b7eea1be22b2e753f331.vk": {
|
|
||||||
"cid": "QmbmUMa3TbbW3X5kFhExs6WgC4KeWT18YivaVmXDkB6ANG",
|
|
||||||
"digest": "79ebb55f56fda427743e35053edad8fc",
|
|
||||||
"sector_size": 8388608
|
|
||||||
},
|
|
||||||
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-5294475db5237a2e83c3e52fd6c2b03859a1831d45ed08c4f35dbf9a803165a9.params": {
|
|
||||||
"cid": "QmdNEL2RtqL52GQNuj8uz6mVj5Z34NVnbaJ1yMyh1oXtBx",
|
|
||||||
"digest": "c49499bb76a0762884896f9683403f55",
|
|
||||||
"sector_size": 8388608
|
|
||||||
},
|
|
||||||
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-5294475db5237a2e83c3e52fd6c2b03859a1831d45ed08c4f35dbf9a803165a9.vk": {
|
|
||||||
"cid": "QmUiVYCQUgr6Y13pZFr8acWpSM4xvTXUdcvGmxyuHbKhsc",
|
|
||||||
"digest": "34d4feeacd9abf788d69ef1bb4d8fd00",
|
|
||||||
"sector_size": 8388608
|
|
||||||
},
|
|
||||||
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-7d739b8cf60f1b0709eeebee7730e297683552e4b69cab6984ec0285663c5781.params": {
|
|
||||||
"cid": "QmVgCsJFRXKLuuUhT3aMYwKVGNA9rDeR6DCrs7cAe8riBT",
|
|
||||||
"digest": "827359440349fe8f5a016e7598993b79",
|
|
||||||
"sector_size": 536870912
|
|
||||||
},
|
|
||||||
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-7d739b8cf60f1b0709eeebee7730e297683552e4b69cab6984ec0285663c5781.vk": {
|
|
||||||
"cid": "QmfA31fbCWojSmhSGvvfxmxaYCpMoXP95zEQ9sLvBGHNaN",
|
|
||||||
"digest": "bd2cd62f65c1ab84f19ca27e97b7c731",
|
|
||||||
"sector_size": 536870912
|
|
||||||
},
|
|
||||||
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-0-0377ded656c6f524f1618760bffe4e0a1c51d5a70c4509eedae8a27555733edc.params": {
|
|
||||||
"cid": "QmaUmfcJt6pozn8ndq1JVBzLRjRJdHMTPd4foa8iw5sjBZ",
|
|
||||||
"digest": "2cf49eb26f1fee94c85781a390ddb4c8",
|
|
||||||
"sector_size": 34359738368
|
|
||||||
},
|
|
||||||
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-0-0377ded656c6f524f1618760bffe4e0a1c51d5a70c4509eedae8a27555733edc.vk": {
|
|
||||||
"cid": "QmR9i9KL3vhhAqTBGj1bPPC7LvkptxrH9RvxJxLN1vvsBE",
|
|
||||||
"digest": "0f8ec542485568fa3468c066e9fed82b",
|
|
||||||
"sector_size": 34359738368
|
|
||||||
},
|
|
||||||
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-0-559e581f022bb4e4ec6e719e563bf0e026ad6de42e56c18714a2c692b1b88d7e.params": {
|
|
||||||
"cid": "Qmdtczp7p4wrbDofmHdGhiixn9irAcN77mV9AEHZBaTt1i",
|
|
||||||
"digest": "d84f79a16fe40e9e25a36e2107bb1ba0",
|
|
||||||
"sector_size": 34359738368
|
|
||||||
},
|
|
||||||
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-0-559e581f022bb4e4ec6e719e563bf0e026ad6de42e56c18714a2c692b1b88d7e.vk": {
|
|
||||||
"cid": "QmZCvxKcKP97vDAk8Nxs9R1fWtqpjQrAhhfXPoCi1nkDoF",
|
|
||||||
"digest": "fc02943678dd119e69e7fab8420e8819",
|
|
||||||
"sector_size": 34359738368
|
|
||||||
},
|
|
||||||
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-2-2627e4006b67f99cef990c0a47d5426cb7ab0a0ad58fc1061547bf2d28b09def.params": {
|
|
||||||
"cid": "QmeAN4vuANhXsF8xP2Lx5j2L6yMSdogLzpcvqCJThRGK1V",
|
|
||||||
"digest": "3810b7780ac0e299b22ae70f1f94c9bc",
|
|
||||||
"sector_size": 68719476736
|
|
||||||
},
|
|
||||||
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-2-2627e4006b67f99cef990c0a47d5426cb7ab0a0ad58fc1061547bf2d28b09def.vk": {
|
|
||||||
"cid": "QmWV8rqZLxs1oQN9jxNWmnT1YdgLwCcscv94VARrhHf1T7",
|
|
||||||
"digest": "59d2bf1857adc59a4f08fcf2afaa916b",
|
|
||||||
"sector_size": 68719476736
|
|
||||||
},
|
|
||||||
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-2-b62098629d07946e9028127e70295ed996fe3ed25b0f9f88eb610a0ab4385a3c.params": {
|
|
||||||
"cid": "QmVkrXc1SLcpgcudK5J25HH93QvR9tNsVhVTYHm5UymXAz",
|
|
||||||
"digest": "2170a91ad5bae22ea61f2ea766630322",
|
|
||||||
"sector_size": 68719476736
|
|
||||||
},
|
|
||||||
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-2-b62098629d07946e9028127e70295ed996fe3ed25b0f9f88eb610a0ab4385a3c.vk": {
|
|
||||||
"cid": "QmbfQjPD7EpzjhWGmvWAsyN2mAZ4PcYhsf3ujuhU9CSuBm",
|
|
||||||
"digest": "6d3789148fb6466d07ee1e24d6292fd6",
|
|
||||||
"sector_size": 68719476736
|
|
||||||
},
|
|
||||||
"v28-stacked-proof-of-replication-merkletree-poseidon_hasher-8-0-0-sha256_hasher-032d3138d22506ec0082ed72b2dcba18df18477904e35bafee82b3793b06832f.params": {
|
|
||||||
"cid": "QmWceMgnWYLopMuM4AoGMvGEau7tNe5UK83XFjH5V9B17h",
|
|
||||||
"digest": "434fb1338ecfaf0f59256f30dde4968f",
|
|
||||||
"sector_size": 2048
|
|
||||||
},
|
|
||||||
"v28-stacked-proof-of-replication-merkletree-poseidon_hasher-8-0-0-sha256_hasher-032d3138d22506ec0082ed72b2dcba18df18477904e35bafee82b3793b06832f.vk": {
|
|
||||||
"cid": "QmamahpFCstMUqHi2qGtVoDnRrsXhid86qsfvoyCTKJqHr",
|
|
||||||
"digest": "dc1ade9929ade1708238f155343044ac",
|
|
||||||
"sector_size": 2048
|
|
||||||
},
|
|
||||||
"v28-stacked-proof-of-replication-merkletree-poseidon_hasher-8-0-0-sha256_hasher-6babf46ce344ae495d558e7770a585b2382d54f225af8ed0397b8be7c3fcd472.params": {
|
|
||||||
"cid": "QmYBpTt7LWNAWr1JXThV5VxX7wsQFLd1PHrGYVbrU1EZjC",
|
|
||||||
"digest": "6c77597eb91ab936c1cef4cf19eba1b3",
|
|
||||||
"sector_size": 536870912
|
|
||||||
},
|
|
||||||
"v28-stacked-proof-of-replication-merkletree-poseidon_hasher-8-0-0-sha256_hasher-6babf46ce344ae495d558e7770a585b2382d54f225af8ed0397b8be7c3fcd472.vk": {
|
|
||||||
"cid": "QmWionkqH2B6TXivzBSQeSyBxojaiAFbzhjtwYRrfwd8nH",
|
|
||||||
"digest": "065179da19fbe515507267677f02823e",
|
|
||||||
"sector_size": 536870912
|
|
||||||
},
|
|
||||||
"v28-stacked-proof-of-replication-merkletree-poseidon_hasher-8-0-0-sha256_hasher-ecd683648512ab1765faa2a5f14bab48f676e633467f0aa8aad4b55dcb0652bb.params": {
|
|
||||||
"cid": "QmPXAPPuQtuQz7Zz3MHMAMEtsYwqM1o9H1csPLeiMUQwZH",
|
|
||||||
"digest": "09e612e4eeb7a0eb95679a88404f960c",
|
|
||||||
"sector_size": 8388608
|
|
||||||
},
|
|
||||||
"v28-stacked-proof-of-replication-merkletree-poseidon_hasher-8-0-0-sha256_hasher-ecd683648512ab1765faa2a5f14bab48f676e633467f0aa8aad4b55dcb0652bb.vk": {
|
|
||||||
"cid": "QmYCuipFyvVW1GojdMrjK1JnMobXtT4zRCZs1CGxjizs99",
|
|
||||||
"digest": "b687beb9adbd9dabe265a7e3620813e4",
|
|
||||||
"sector_size": 8388608
|
|
||||||
},
|
|
||||||
"v28-stacked-proof-of-replication-merkletree-poseidon_hasher-8-8-0-sha256_hasher-82a357d2f2ca81dc61bb45f4a762807aedee1b0a53fd6c4e77b46a01bfef7820.params": {
|
|
||||||
"cid": "QmengpM684XLQfG8754ToonszgEg2bQeAGUan5uXTHUQzJ",
|
|
||||||
"digest": "6a388072a518cf46ebd661f5cc46900a",
|
|
||||||
"sector_size": 34359738368
|
|
||||||
},
|
|
||||||
"v28-stacked-proof-of-replication-merkletree-poseidon_hasher-8-8-0-sha256_hasher-82a357d2f2ca81dc61bb45f4a762807aedee1b0a53fd6c4e77b46a01bfef7820.vk": {
|
|
||||||
"cid": "Qmf93EMrADXAK6CyiSfE8xx45fkMfR3uzKEPCvZC1n2kzb",
|
|
||||||
"digest": "0c7b4aac1c40fdb7eb82bc355b41addf",
|
|
||||||
"sector_size": 34359738368
|
|
||||||
},
|
|
||||||
"v28-stacked-proof-of-replication-merkletree-poseidon_hasher-8-8-2-sha256_hasher-96f1b4a04c5c51e4759bbf224bbc2ef5a42c7100f16ec0637123f16a845ddfb2.params": {
|
|
||||||
"cid": "QmS7ye6Ri2MfFzCkcUJ7FQ6zxDKuJ6J6B8k5PN7wzSR9sX",
|
|
||||||
"digest": "1801f8a6e1b00bceb00cc27314bb5ce3",
|
|
||||||
"sector_size": 68719476736
|
|
||||||
},
|
|
||||||
"v28-stacked-proof-of-replication-merkletree-poseidon_hasher-8-8-2-sha256_hasher-96f1b4a04c5c51e4759bbf224bbc2ef5a42c7100f16ec0637123f16a845ddfb2.vk": {
|
|
||||||
"cid": "QmehSmC6BhrgRZakPDta2ewoH9nosNzdjCqQRXsNFNUkLN",
|
|
||||||
"digest": "a89884252c04c298d0b3c81bfd884164",
|
|
||||||
"sector_size": 68719476736
|
|
||||||
}
|
|
||||||
}
|
|
1
testplans/lotus-soup/.gitignore
vendored
1
testplans/lotus-soup/.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
lotus-soup
|
|
@ -1,59 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "deals-e2e"
|
|
||||||
total_instances = 3
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "local:docker"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
enable_go_build_cache = true
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "1"
|
|
||||||
miners = "1"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "3"
|
|
||||||
random_beacon_type = "mock"
|
|
||||||
mining_mode = "natural"
|
|
||||||
bandwidth = "4MB"
|
|
||||||
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "bootstrapper"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "bootstrapper"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
||||||
# Bounce the connection during push and pull requests
|
|
||||||
bounce_conn_data_transfers = "true"
|
|
@ -1,55 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "deals-e2e"
|
|
||||||
total_instances = 3
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "local:docker"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
enable_go_build_cache = true
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "1"
|
|
||||||
miners = "1"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "3"
|
|
||||||
random_beacon_type = "mock"
|
|
||||||
mining_mode = "natural"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "bootstrapper"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "bootstrapper"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
@ -1,55 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "deals-e2e"
|
|
||||||
total_instances = 7
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "local:docker"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
enable_go_build_cache = true
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "5"
|
|
||||||
miners = "1"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "5"
|
|
||||||
random_beacon_type = "mock"
|
|
||||||
mining_mode = "natural"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "bootstrapper"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "bootstrapper"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
[groups.instances]
|
|
||||||
count = 5
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
@ -1,74 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "deals-e2e"
|
|
||||||
total_instances = 3
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "cluster:k8s"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
push_registry=true
|
|
||||||
go_proxy_mode="remote"
|
|
||||||
go_proxy_url="http://localhost:8081"
|
|
||||||
registry_type="aws"
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "1"
|
|
||||||
miners = "1"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "10"
|
|
||||||
random_beacon_type = "mock"
|
|
||||||
mining_mode = "natural"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "bootstrapper"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "512Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "bootstrapper"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "4096Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner"
|
|
||||||
[groups.build]
|
|
||||||
dependencies = [
|
|
||||||
{ module = "github.com/filecoin-project/lotus", version = "{{.Env.LOTUS_VERSION_MINER}}"},
|
|
||||||
]
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "1024Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
||||||
[groups.build]
|
|
||||||
dependencies = [
|
|
||||||
{ module = "github.com/filecoin-project/lotus", version = "{{.Env.LOTUS_VERSION_CLIENT}}"},
|
|
||||||
]
|
|
@ -1,67 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "deals-e2e"
|
|
||||||
total_instances = 3
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "cluster:k8s"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
push_registry=true
|
|
||||||
go_proxy_mode="remote"
|
|
||||||
go_proxy_url="http://localhost:8081"
|
|
||||||
registry_type="aws"
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "1"
|
|
||||||
miners = "1"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "10"
|
|
||||||
random_beacon_type = "mock"
|
|
||||||
mining_mode = "natural"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "bootstrapper"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "512Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "bootstrapper"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "4096Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "1024Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
@ -1,80 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "deals-e2e"
|
|
||||||
total_instances = 14
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "cluster:k8s"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
push_registry=true
|
|
||||||
go_proxy_mode="remote"
|
|
||||||
go_proxy_url="http://localhost:8081"
|
|
||||||
registry_type="aws"
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "10"
|
|
||||||
miners = "3"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
random_beacon_type = "mock"
|
|
||||||
mining_mode = "natural"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "bootstrapper"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "512Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "bootstrapper"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners-weak"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "8192Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
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"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "1024Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 10
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
@ -1,67 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "deals-e2e"
|
|
||||||
total_instances = 4
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "cluster:k8s"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
push_registry=true
|
|
||||||
go_proxy_mode="remote"
|
|
||||||
go_proxy_url="http://localhost:8081"
|
|
||||||
registry_type="aws"
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "2"
|
|
||||||
miners = "1"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "10"
|
|
||||||
random_beacon_type = "mock"
|
|
||||||
mining_mode = "natural"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "bootstrapper"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "512Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "bootstrapper"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "4096Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "1024Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 2
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
@ -1,67 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "deals-e2e"
|
|
||||||
total_instances = 5
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "cluster:k8s"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
push_registry=true
|
|
||||||
go_proxy_mode="remote"
|
|
||||||
go_proxy_url="http://localhost:8081"
|
|
||||||
registry_type="aws"
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "3"
|
|
||||||
miners = "1"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "10"
|
|
||||||
random_beacon_type = "mock"
|
|
||||||
mining_mode = "natural"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "bootstrapper"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "512Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "bootstrapper"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "8192Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "1024Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 3
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
@ -1,67 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "deals-e2e"
|
|
||||||
total_instances = 6
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "cluster:k8s"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
push_registry=true
|
|
||||||
go_proxy_mode="remote"
|
|
||||||
go_proxy_url="http://localhost:8081"
|
|
||||||
registry_type="aws"
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "3"
|
|
||||||
miners = "2"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "4"
|
|
||||||
random_beacon_type = "mock"
|
|
||||||
mining_mode = "natural"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "bootstrapper"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "512Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "bootstrapper"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "4096Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 2
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "1024Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 3
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
@ -1,67 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "deals-e2e"
|
|
||||||
total_instances = 7
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "cluster:k8s"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
push_registry=true
|
|
||||||
go_proxy_mode="remote"
|
|
||||||
go_proxy_url="http://localhost:8081"
|
|
||||||
registry_type="aws"
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "3"
|
|
||||||
miners = "3"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "10"
|
|
||||||
random_beacon_type = "mock"
|
|
||||||
mining_mode = "natural"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "bootstrapper"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "512Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "bootstrapper"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "4096Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 3
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "1024Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 3
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
@ -1,55 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "deals-e2e"
|
|
||||||
total_instances = 6
|
|
||||||
builder = "exec:go"
|
|
||||||
runner = "local:exec"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
enable_go_build_cache = true
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "3"
|
|
||||||
miners = "2"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
balance = "20000000.5" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "10"
|
|
||||||
random_beacon_type = "mock"
|
|
||||||
mining_mode = "natural"
|
|
||||||
|
|
||||||
[[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"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
[groups.instances]
|
|
||||||
count = 3
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
@ -1,69 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "deals-stress"
|
|
||||||
total_instances = 6
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "cluster:k8s"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
push_registry=true
|
|
||||||
go_proxy_mode="remote"
|
|
||||||
go_proxy_url="http://localhost:8081"
|
|
||||||
registry_type="aws"
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "3"
|
|
||||||
miners = "2"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
balance = "90000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "10"
|
|
||||||
random_beacon_type = "mock"
|
|
||||||
mining_mode = "natural"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "bootstrapper"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "512Mi"
|
|
||||||
cpu = "100m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "bootstrapper"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "14000Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 2
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "2048Mi"
|
|
||||||
cpu = "100m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 3
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
||||||
deals = "3"
|
|
||||||
deal_mode = "concurrent"
|
|
@ -1,57 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "deals-stress"
|
|
||||||
total_instances = 6
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "local:docker"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
enable_go_build_cache = true
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "3"
|
|
||||||
miners = "2"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "1000"
|
|
||||||
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"
|
|
||||||
deals = "300"
|
|
||||||
deal_mode = "concurrent"
|
|
@ -1,56 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "deals-stress"
|
|
||||||
total_instances = 6
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "local:docker"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
enable_go_build_cache = true
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "3"
|
|
||||||
miners = "2"
|
|
||||||
genesis_timestamp_offset = "100000"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "1000"
|
|
||||||
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"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
[groups.instances]
|
|
||||||
count = 3
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
||||||
deals = "300"
|
|
||||||
deal_mode = "concurrent"
|
|
@ -1,57 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "deals-stress"
|
|
||||||
total_instances = 6
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "local:docker"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
enable_go_build_cache = true
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "3"
|
|
||||||
miners = "2"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "1000"
|
|
||||||
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"
|
|
||||||
deals = "300"
|
|
||||||
deal_mode = "serial"
|
|
@ -1,56 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "deals-stress"
|
|
||||||
total_instances = 6
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "local:docker"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
enable_go_build_cache = true
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "3"
|
|
||||||
miners = "2"
|
|
||||||
genesis_timestamp_offset = "100000"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "1000"
|
|
||||||
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"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
[groups.instances]
|
|
||||||
count = 3
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
||||||
deals = "300"
|
|
||||||
deal_mode = "serial"
|
|
@ -1,79 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "drand-halting"
|
|
||||||
total_instances = 6
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "local:docker"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
enable_go_build_cache = true
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "1"
|
|
||||||
miners = "1"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "10"
|
|
||||||
random_beacon_type = "local-drand"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
# mining_mode = "natural"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "bootstrapper"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "120Mi"
|
|
||||||
cpu = "10m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "bootstrapper"
|
|
||||||
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "120Mi"
|
|
||||||
cpu = "10m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner"
|
|
||||||
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "120Mi"
|
|
||||||
cpu = "10m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
||||||
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "drand"
|
|
||||||
[groups.instances]
|
|
||||||
count = 3
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "drand"
|
|
||||||
drand_period = "1s"
|
|
||||||
drand_log_level = "none"
|
|
||||||
suspend_events = "wait 20s -> halt -> wait 1m -> resume -> wait 2s -> halt -> wait 1m -> resume"
|
|
@ -1,71 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "drand-outage"
|
|
||||||
total_instances = 7
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "cluster:k8s"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
push_registry=true
|
|
||||||
go_proxy_mode="remote"
|
|
||||||
go_proxy_url="http://localhost:8081"
|
|
||||||
registry_type="aws"
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "0"
|
|
||||||
miners = "3"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "100"
|
|
||||||
random_beacon_type = "local-drand"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
mining_mode = "natural"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "bootstrapper"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "1024Mi"
|
|
||||||
cpu = "10m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "bootstrapper"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "1024Mi"
|
|
||||||
cpu = "10m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 3
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "drand"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "1024Mi"
|
|
||||||
cpu = "10m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 3
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "drand"
|
|
||||||
drand_period = "30s"
|
|
||||||
drand_catchup_period = "10s"
|
|
||||||
drand_log_level = "debug"
|
|
||||||
suspend_events = "wait 5m -> halt -> wait 45m -> resume -> wait 15m -> halt -> wait 5m -> resume"
|
|
@ -1,59 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "drand-outage"
|
|
||||||
total_instances = 7
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "local:docker"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
enable_go_build_cache = true
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "0"
|
|
||||||
miners = "3"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "10"
|
|
||||||
random_beacon_type = "local-drand"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
mining_mode = "natural"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "bootstrapper"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "bootstrapper"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners"
|
|
||||||
[groups.instances]
|
|
||||||
count = 3
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "drand"
|
|
||||||
[groups.instances]
|
|
||||||
count = 3
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "drand"
|
|
||||||
drand_period = "30s"
|
|
||||||
drand_catchup_period = "10s"
|
|
||||||
drand_log_level = "debug"
|
|
||||||
suspend_events = "wait 3m -> halt -> wait 3m -> resume -> wait 3m -> halt -> wait 3m -> resume"
|
|
@ -1,68 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "deals-e2e"
|
|
||||||
total_instances = 5
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "cluster:k8s"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
push_registry=true
|
|
||||||
go_proxy_mode="remote"
|
|
||||||
go_proxy_url="http://localhost:8081"
|
|
||||||
registry_type="aws"
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "3"
|
|
||||||
miners = "1"
|
|
||||||
fast_retrieval = "true"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "10"
|
|
||||||
random_beacon_type = "mock"
|
|
||||||
mining_mode = "natural"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "bootstrapper"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "512Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "bootstrapper"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "4096Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "1024Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 3
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
@ -1,72 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "deals-e2e"
|
|
||||||
total_instances = 6
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "local:docker"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
enable_go_build_cache = true
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "1"
|
|
||||||
miners = "1"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "10"
|
|
||||||
random_beacon_type = "local-drand"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "bootstrapper"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "120Mi"
|
|
||||||
cpu = "10m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "bootstrapper"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "120Mi"
|
|
||||||
cpu = "10m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "120Mi"
|
|
||||||
cpu = "10m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "drand"
|
|
||||||
[groups.instances]
|
|
||||||
count = 3
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "drand"
|
|
@ -1,55 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "deals-e2e"
|
|
||||||
total_instances = 6
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "local:docker"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
enable_go_build_cache = true
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "3"
|
|
||||||
miners = "2"
|
|
||||||
genesis_timestamp_offset = "100000"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
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"
|
|
@ -1,57 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "deals-e2e"
|
|
||||||
total_instances = 7
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "local:docker"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
enable_go_build_cache = true
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "5"
|
|
||||||
miners = "1"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "5"
|
|
||||||
random_beacon_type = "mock"
|
|
||||||
mining_mode = "natural"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "bootstrapper"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "bootstrapper"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner"
|
|
||||||
latency_range = '["20ms", "300ms"]'
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
[groups.instances]
|
|
||||||
count = 5
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
||||||
latency_range = '["100ms", "1500ms"]'
|
|
@ -1,62 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = "raulk"
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "paych-stress"
|
|
||||||
total_instances = 4 # 2 clients + 1 miners + 1 bootstrapper
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "cluster:k8s"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
push_registry=true
|
|
||||||
go_proxy_mode="remote"
|
|
||||||
go_proxy_url="http://localhost:8081"
|
|
||||||
registry_type="aws"
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "2"
|
|
||||||
miners = "1"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
balance = "100" ## be careful, this is in FIL.
|
|
||||||
sectors = "10"
|
|
||||||
random_beacon_type = "mock"
|
|
||||||
mining_mode = "natural"
|
|
||||||
# number of lanes to send vouchers on
|
|
||||||
lane_count = "8"
|
|
||||||
# number of vouchers on each lane
|
|
||||||
vouchers_per_lane = "3"
|
|
||||||
# amount to increase voucher by each time (per lane)
|
|
||||||
increments = "3" ## in FIL
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "bootstrapper"
|
|
||||||
instances = { count = 1 }
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "bootstrapper"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners"
|
|
||||||
instances = { count = 1 }
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "2048Mi"
|
|
||||||
cpu = "100m"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
# the first client will be on the receiving end; all others will be on the sending end.
|
|
||||||
instances = { count = 2 }
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "1024Mi"
|
|
||||||
cpu = "100m"
|
|
@ -1,53 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = "raulk"
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "paych-stress"
|
|
||||||
total_instances = 5 # 2 clients + 2 miners + 1 bootstrapper
|
|
||||||
builder = "exec:go"
|
|
||||||
runner = "local:exec"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
enable_go_build_cache = true
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "2"
|
|
||||||
miners = "2"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
balance = "100" ## be careful, this is in FIL.
|
|
||||||
sectors = "10"
|
|
||||||
random_beacon_type = "mock"
|
|
||||||
mining_mode = "natural"
|
|
||||||
# number of lanes to send vouchers on
|
|
||||||
lane_count = "8"
|
|
||||||
# number of vouchers on each lane
|
|
||||||
vouchers_per_lane = "3"
|
|
||||||
# amount to increase voucher by each time (per lane)
|
|
||||||
increments = "3" ## in FIL
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "bootstrapper"
|
|
||||||
instances = { count = 1 }
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "bootstrapper"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners"
|
|
||||||
instances = { count = 2 }
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
# the first client will be on the receiving end; all others will be on the sending end.
|
|
||||||
instances = { count = 2 }
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
@ -1,64 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "deals-e2e"
|
|
||||||
total_instances = 7
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "local:docker"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
enable_go_build_cache = true
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "3"
|
|
||||||
miners = "2"
|
|
||||||
genesis_timestamp_offset = "100000"
|
|
||||||
balance = "20000000" # These balances will work for maximum 100 nodes, as TotalFilecoin is 2B
|
|
||||||
sectors = "10"
|
|
||||||
random_beacon_type = "mock"
|
|
||||||
enable_pubsub_tracer = "true"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "pubsub-tracer"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "pubsub-tracer"
|
|
||||||
|
|
||||||
[[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"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
[groups.instances]
|
|
||||||
count = 3
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
@ -1,80 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "recovery-failed-windowed-post"
|
|
||||||
total_instances = 7
|
|
||||||
builder = "exec:go"
|
|
||||||
runner = "local:exec"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
push_registry=true
|
|
||||||
go_proxy_mode="remote"
|
|
||||||
go_proxy_url="http://localhost:8081"
|
|
||||||
registry_type="aws"
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "3"
|
|
||||||
miners = "3"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
balance = "20000000"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "bootstrapper"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "512Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "bootstrapper"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "4096Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 2
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner"
|
|
||||||
sectors = "10"
|
|
||||||
mining_mode = "natural"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners-biserk"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "4096Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner-biserk"
|
|
||||||
sectors = "5"
|
|
||||||
mining_mode = "natural"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "1024Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 3
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
@ -1,95 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = "lotus-soup"
|
|
||||||
author = ""
|
|
||||||
|
|
||||||
[global]
|
|
||||||
plan = "lotus-soup"
|
|
||||||
case = "recovery-failed-windowed-post"
|
|
||||||
total_instances = 9
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "cluster:k8s"
|
|
||||||
|
|
||||||
[global.build]
|
|
||||||
selectors = ["testground"]
|
|
||||||
|
|
||||||
[global.run_config]
|
|
||||||
exposed_ports = { pprof = "6060", node_rpc = "1234", miner_rpc = "2345" }
|
|
||||||
keep_service=true
|
|
||||||
|
|
||||||
[global.build_config]
|
|
||||||
push_registry=true
|
|
||||||
go_proxy_mode="remote"
|
|
||||||
go_proxy_url="http://localhost:8081"
|
|
||||||
registry_type="aws"
|
|
||||||
|
|
||||||
[global.run.test_params]
|
|
||||||
clients = "4"
|
|
||||||
miners = "4"
|
|
||||||
genesis_timestamp_offset = "0"
|
|
||||||
balance = "20000000"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "bootstrapper"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "512Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "bootstrapper"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "4096Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 2
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner"
|
|
||||||
sectors = "10"
|
|
||||||
mining_mode = "natural"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners-full-slash"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "4096Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner-full-slash"
|
|
||||||
sectors = "10"
|
|
||||||
mining_mode = "natural"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "miners-partial-slash"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "4096Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 1
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "miner-partial-slash"
|
|
||||||
sectors = "10"
|
|
||||||
mining_mode = "natural"
|
|
||||||
|
|
||||||
[[groups]]
|
|
||||||
id = "clients"
|
|
||||||
[groups.resources]
|
|
||||||
memory = "1024Mi"
|
|
||||||
cpu = "1000m"
|
|
||||||
[groups.instances]
|
|
||||||
count = 4
|
|
||||||
percentage = 0.0
|
|
||||||
[groups.run]
|
|
||||||
[groups.run.test_params]
|
|
||||||
role = "client"
|
|
@ -1,246 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
mbig "math/big"
|
|
||||||
"math/rand"
|
|
||||||
"os"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/libp2p/go-libp2p/core/peer"
|
|
||||||
"github.com/testground/sdk-go/sync"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
|
||||||
datatransfer "github.com/filecoin-project/go-data-transfer"
|
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
|
||||||
"github.com/filecoin-project/lotus/build"
|
|
||||||
"github.com/filecoin-project/lotus/testplans/lotus-soup/testkit"
|
|
||||||
)
|
|
||||||
|
|
||||||
// This is the baseline test; Filecoin 101.
|
|
||||||
//
|
|
||||||
// A network with a bootstrapper, a number of miners, and a number of clients/full nodes
|
|
||||||
// is constructed and connected through the bootstrapper.
|
|
||||||
// Some funds are allocated to each node and a number of sectors are presealed in the genesis block.
|
|
||||||
//
|
|
||||||
// The test plan:
|
|
||||||
// One or more clients store content to one or more miners, testing storage deals.
|
|
||||||
// The plan ensures that the storage deals hit the blockchain and measure the time it took.
|
|
||||||
// Verification: one or more clients retrieve and verify the hashes of stored content.
|
|
||||||
// The plan ensures that all (previously) published content can be correctly retrieved
|
|
||||||
// and measures the time it took.
|
|
||||||
//
|
|
||||||
// Preparation of the genesis block: this is the responsibility of the bootstrapper.
|
|
||||||
// In order to compute the genesis block, we need to collect identities and presealed
|
|
||||||
// sectors from each node.
|
|
||||||
// Then we create a genesis block that allocates some funds to each node and collects
|
|
||||||
// the presealed sectors.
|
|
||||||
func dealsE2E(t *testkit.TestEnvironment) error {
|
|
||||||
t.RecordMessage("running node with role '%s'", t.Role)
|
|
||||||
|
|
||||||
// Dispatch/forward non-client roles to defaults.
|
|
||||||
if t.Role != "client" {
|
|
||||||
return testkit.HandleDefaultRole(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is a client role
|
|
||||||
fastRetrieval := t.BooleanParam("fast_retrieval")
|
|
||||||
t.RecordMessage("running client, with fast retrieval set to: %v", fastRetrieval)
|
|
||||||
|
|
||||||
cl, err := testkit.PrepareClient(t)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx := context.Background()
|
|
||||||
client := cl.FullApi
|
|
||||||
|
|
||||||
// select a random miner
|
|
||||||
minerAddr := cl.MinerAddrs[rand.Intn(len(cl.MinerAddrs))]
|
|
||||||
if err := client.NetConnect(ctx, minerAddr.MinerNetAddrs); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
t.D().Counter(fmt.Sprintf("send-data-to,miner=%s", minerAddr.MinerActorAddr)).Inc(1)
|
|
||||||
|
|
||||||
t.RecordMessage("selected %s as the miner", minerAddr.MinerActorAddr)
|
|
||||||
|
|
||||||
if fastRetrieval {
|
|
||||||
err = initPaymentChannel(t, ctx, cl, minerAddr)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// give some time to the miner, otherwise, we get errors like:
|
|
||||||
// deal errored deal failed: (State=26) error calling node: publishing deal: GasEstimateMessageGas
|
|
||||||
// error: estimating gas used: message execution failed: exit 19, reason: failed to lock balance: failed to lock client funds: not enough balance to lock for addr t0102: escrow balance 0 < locked 0 + required 640297000 (RetCode=19)
|
|
||||||
time.Sleep(40 * time.Second)
|
|
||||||
|
|
||||||
time.Sleep(time.Duration(t.GlobalSeq) * 5 * time.Second)
|
|
||||||
|
|
||||||
// generate 5000000 bytes of random data
|
|
||||||
data := make([]byte, 5000000)
|
|
||||||
rand.New(rand.NewSource(time.Now().UnixNano())).Read(data)
|
|
||||||
|
|
||||||
file, err := ioutil.TempFile("/tmp", "data")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer os.Remove(file.Name())
|
|
||||||
|
|
||||||
_, err = file.Write(data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
fcid, err := client.ClientImport(ctx, api.FileRef{Path: file.Name(), IsCAR: false})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
t.RecordMessage("file cid: %s", fcid)
|
|
||||||
|
|
||||||
// Check if we should bounce the connection during data transfers
|
|
||||||
if t.BooleanParam("bounce_conn_data_transfers") {
|
|
||||||
t.RecordMessage("Will bounce connection during push and pull data-transfers")
|
|
||||||
err = bounceConnInTransfers(ctx, t, client, minerAddr.MinerNetAddrs.ID)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// start deal
|
|
||||||
t1 := time.Now()
|
|
||||||
deal := testkit.StartDeal(ctx, minerAddr.MinerActorAddr, client, fcid.Root, fastRetrieval)
|
|
||||||
t.RecordMessage("started deal: %s", deal)
|
|
||||||
|
|
||||||
// TODO: this sleep is only necessary because deals don't immediately get logged in the dealstore, we should fix this
|
|
||||||
time.Sleep(2 * time.Second)
|
|
||||||
|
|
||||||
t.RecordMessage("waiting for deal to be sealed")
|
|
||||||
testkit.WaitDealSealed(t, ctx, client, deal)
|
|
||||||
t.D().ResettingHistogram("deal.sealed").Update(int64(time.Since(t1)))
|
|
||||||
|
|
||||||
// wait for all client deals to be sealed before trying to retrieve
|
|
||||||
t.SyncClient.MustSignalAndWait(ctx, sync.State("done-sealing"), t.IntParam("clients"))
|
|
||||||
|
|
||||||
carExport := true
|
|
||||||
|
|
||||||
t.RecordMessage("trying to retrieve %s", fcid)
|
|
||||||
t1 = time.Now()
|
|
||||||
_ = testkit.RetrieveData(t, ctx, client, fcid.Root, nil, carExport, data)
|
|
||||||
t.D().ResettingHistogram("deal.retrieved").Update(int64(time.Since(t1)))
|
|
||||||
|
|
||||||
t.SyncClient.MustSignalEntry(ctx, testkit.StateStopMining)
|
|
||||||
|
|
||||||
time.Sleep(10 * time.Second) // wait for metrics to be emitted
|
|
||||||
|
|
||||||
// TODO broadcast published content CIDs to other clients
|
|
||||||
// TODO select a random piece of content published by some other client and retrieve it
|
|
||||||
|
|
||||||
t.SyncClient.MustSignalAndWait(ctx, testkit.StateDone, t.TestInstanceCount)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func bounceConnInTransfers(ctx context.Context, t *testkit.TestEnvironment, client api.FullNode, minerPeerID peer.ID) error {
|
|
||||||
storageConnBroken := false
|
|
||||||
retrievalConnBroken := false
|
|
||||||
upds, err := client.ClientDataTransferUpdates(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
for upd := range upds {
|
|
||||||
dir := "push"
|
|
||||||
if !upd.IsSender {
|
|
||||||
dir = "pull"
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("%s data transfer status: %s, transferred: %d", dir, datatransfer.Statuses[upd.Status], upd.Transferred)
|
|
||||||
|
|
||||||
// Bounce the connection after the first block is sent for the storage deal
|
|
||||||
if upd.IsSender && upd.Transferred > 0 && !storageConnBroken {
|
|
||||||
storageConnBroken = true
|
|
||||||
bounceConnection(ctx, t, client, minerPeerID)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bounce the connection after the first block is received for the retrieval deal
|
|
||||||
if !upd.IsSender && upd.Transferred > 0 && !retrievalConnBroken {
|
|
||||||
retrievalConnBroken = true
|
|
||||||
bounceConnection(ctx, t, client, minerPeerID)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func bounceConnection(ctx context.Context, t *testkit.TestEnvironment, client api.FullNode, minerPeerID peer.ID) {
|
|
||||||
t.RecordMessage("disconnecting peer %s", minerPeerID)
|
|
||||||
client.NetBlockAdd(ctx, api.NetBlockList{
|
|
||||||
Peers: []peer.ID{minerPeerID},
|
|
||||||
})
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
time.Sleep(3 * time.Second)
|
|
||||||
t.RecordMessage("reconnecting to peer %s", minerPeerID)
|
|
||||||
client.NetBlockRemove(ctx, api.NetBlockList{
|
|
||||||
Peers: []peer.ID{minerPeerID},
|
|
||||||
})
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
|
|
||||||
// filToAttoFil converts a fractional filecoin value into AttoFIL, rounding if necessary
|
|
||||||
func filToAttoFil(f float64) big.Int {
|
|
||||||
a := mbig.NewFloat(f)
|
|
||||||
a.Mul(a, mbig.NewFloat(float64(build.FilecoinPrecision)))
|
|
||||||
i, _ := a.Int(nil)
|
|
||||||
return big.Int{Int: i}
|
|
||||||
}
|
|
||||||
|
|
||||||
func initPaymentChannel(t *testkit.TestEnvironment, ctx context.Context, cl *testkit.LotusClient, minerAddr testkit.MinerAddressesMsg) error {
|
|
||||||
recv := minerAddr
|
|
||||||
balance := filToAttoFil(10)
|
|
||||||
t.RecordMessage("my balance: %d", balance)
|
|
||||||
t.RecordMessage("creating payment channel; from=%s, to=%s, funds=%d", cl.Wallet.Address, recv.WalletAddr, balance)
|
|
||||||
|
|
||||||
channel, err := cl.FullApi.PaychGet(ctx, cl.Wallet.Address, recv.WalletAddr, balance, api.PaychGetOpts{
|
|
||||||
OffChain: false,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to create payment channel: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if addr := channel.Channel; addr != address.Undef {
|
|
||||||
return fmt.Errorf("expected an Undef channel address, got: %s", addr)
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("payment channel created; msg_cid=%s", channel.WaitSentinel)
|
|
||||||
t.RecordMessage("waiting for payment channel message to appear on chain")
|
|
||||||
|
|
||||||
// wait for the channel creation message to appear on chain.
|
|
||||||
_, err = cl.FullApi.StateWaitMsg(ctx, channel.WaitSentinel, 2, api.LookbackNoLimit, true)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed while waiting for payment channel creation msg to appear on chain: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// need to wait so that the channel is tracked.
|
|
||||||
// the full API waits for build.MessageConfidence (=1 in tests) before tracking the channel.
|
|
||||||
// we wait for 2 confirmations, so we have the assurance the channel is tracked.
|
|
||||||
|
|
||||||
t.RecordMessage("reloading paych; now it should have an address")
|
|
||||||
channel, err = cl.FullApi.PaychGet(ctx, cl.Wallet.Address, recv.WalletAddr, big.Zero(), api.PaychGetOpts{
|
|
||||||
OffChain: false,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to reload payment channel: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("channel address: %s", channel.Channel)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
@ -1,147 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"math/rand"
|
|
||||||
"os"
|
|
||||||
"sync"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
|
||||||
"github.com/filecoin-project/lotus/testplans/lotus-soup/testkit"
|
|
||||||
)
|
|
||||||
|
|
||||||
func dealsStress(t *testkit.TestEnvironment) error {
|
|
||||||
// Dispatch/forward non-client roles to defaults.
|
|
||||||
if t.Role != "client" {
|
|
||||||
return testkit.HandleDefaultRole(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("running client")
|
|
||||||
|
|
||||||
cl, err := testkit.PrepareClient(t)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx := context.Background()
|
|
||||||
client := cl.FullApi
|
|
||||||
|
|
||||||
// select a random miner
|
|
||||||
minerAddr := cl.MinerAddrs[rand.Intn(len(cl.MinerAddrs))]
|
|
||||||
if err := client.NetConnect(ctx, minerAddr.MinerNetAddrs); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("selected %s as the miner", minerAddr.MinerActorAddr)
|
|
||||||
|
|
||||||
time.Sleep(12 * time.Second)
|
|
||||||
|
|
||||||
// prepare a number of concurrent data points
|
|
||||||
deals := t.IntParam("deals")
|
|
||||||
data := make([][]byte, 0, deals)
|
|
||||||
files := make([]*os.File, 0, deals)
|
|
||||||
cids := make([]cid.Cid, 0, deals)
|
|
||||||
rng := rand.NewSource(time.Now().UnixNano())
|
|
||||||
|
|
||||||
for i := 0; i < deals; i++ {
|
|
||||||
dealData := make([]byte, 1600)
|
|
||||||
rand.New(rng).Read(dealData)
|
|
||||||
|
|
||||||
dealFile, err := ioutil.TempFile("/tmp", "data")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer os.Remove(dealFile.Name())
|
|
||||||
|
|
||||||
_, err = dealFile.Write(dealData)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
dealCid, err := client.ClientImport(ctx, api.FileRef{Path: dealFile.Name(), IsCAR: false})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("deal %d file cid: %s", i, dealCid)
|
|
||||||
|
|
||||||
data = append(data, dealData)
|
|
||||||
files = append(files, dealFile)
|
|
||||||
cids = append(cids, dealCid.Root)
|
|
||||||
}
|
|
||||||
|
|
||||||
concurrentDeals := true
|
|
||||||
if t.StringParam("deal_mode") == "serial" {
|
|
||||||
concurrentDeals = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// this to avoid failure to get block
|
|
||||||
time.Sleep(2 * time.Second)
|
|
||||||
|
|
||||||
t.RecordMessage("starting storage deals")
|
|
||||||
if concurrentDeals {
|
|
||||||
|
|
||||||
var wg1 sync.WaitGroup
|
|
||||||
for i := 0; i < deals; i++ {
|
|
||||||
wg1.Add(1)
|
|
||||||
go func(i int) {
|
|
||||||
defer wg1.Done()
|
|
||||||
t1 := time.Now()
|
|
||||||
deal := testkit.StartDeal(ctx, minerAddr.MinerActorAddr, client, cids[i], false)
|
|
||||||
t.RecordMessage("started storage deal %d -> %s", i, deal)
|
|
||||||
time.Sleep(2 * time.Second)
|
|
||||||
t.RecordMessage("waiting for deal %d to be sealed", i)
|
|
||||||
testkit.WaitDealSealed(t, ctx, client, deal)
|
|
||||||
t.D().ResettingHistogram(fmt.Sprintf("deal.sealed,miner=%s", minerAddr.MinerActorAddr)).Update(int64(time.Since(t1)))
|
|
||||||
}(i)
|
|
||||||
}
|
|
||||||
t.RecordMessage("waiting for all deals to be sealed")
|
|
||||||
wg1.Wait()
|
|
||||||
t.RecordMessage("all deals sealed; starting retrieval")
|
|
||||||
|
|
||||||
var wg2 sync.WaitGroup
|
|
||||||
for i := 0; i < deals; i++ {
|
|
||||||
wg2.Add(1)
|
|
||||||
go func(i int) {
|
|
||||||
defer wg2.Done()
|
|
||||||
t.RecordMessage("retrieving data for deal %d", i)
|
|
||||||
t1 := time.Now()
|
|
||||||
_ = testkit.RetrieveData(t, ctx, client, cids[i], nil, true, data[i])
|
|
||||||
|
|
||||||
t.RecordMessage("retrieved data for deal %d", i)
|
|
||||||
t.D().ResettingHistogram("deal.retrieved").Update(int64(time.Since(t1)))
|
|
||||||
}(i)
|
|
||||||
}
|
|
||||||
t.RecordMessage("waiting for all retrieval deals to complete")
|
|
||||||
wg2.Wait()
|
|
||||||
t.RecordMessage("all retrieval deals successful")
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
for i := 0; i < deals; i++ {
|
|
||||||
deal := testkit.StartDeal(ctx, minerAddr.MinerActorAddr, client, cids[i], false)
|
|
||||||
t.RecordMessage("started storage deal %d -> %s", i, deal)
|
|
||||||
time.Sleep(2 * time.Second)
|
|
||||||
t.RecordMessage("waiting for deal %d to be sealed", i)
|
|
||||||
testkit.WaitDealSealed(t, ctx, client, deal)
|
|
||||||
}
|
|
||||||
|
|
||||||
for i := 0; i < deals; i++ {
|
|
||||||
t.RecordMessage("retrieving data for deal %d", i)
|
|
||||||
_ = testkit.RetrieveData(t, ctx, client, cids[i], nil, true, data[i])
|
|
||||||
t.RecordMessage("retrieved data for deal %d", i)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
t.SyncClient.MustSignalEntry(ctx, testkit.StateStopMining)
|
|
||||||
t.SyncClient.MustSignalAndWait(ctx, testkit.StateDone, t.TestInstanceCount)
|
|
||||||
|
|
||||||
time.Sleep(15 * time.Second) // wait for metrics to be emitted
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
[client]
|
|
@ -1,348 +0,0 @@
|
|||||||
module github.com/filecoin-project/lotus/testplans/lotus-soup
|
|
||||||
|
|
||||||
go 1.18
|
|
||||||
|
|
||||||
require (
|
|
||||||
contrib.go.opencensus.io/exporter/prometheus v0.4.0
|
|
||||||
github.com/codeskyblue/go-sh v0.0.0-20200712050446-30169cf553fe
|
|
||||||
github.com/davecgh/go-spew v1.1.1
|
|
||||||
github.com/drand/drand v1.3.0
|
|
||||||
github.com/filecoin-project/go-address v1.0.0
|
|
||||||
github.com/filecoin-project/go-data-transfer v1.15.2
|
|
||||||
github.com/filecoin-project/go-fil-markets v1.25.0
|
|
||||||
github.com/filecoin-project/go-jsonrpc v0.1.8
|
|
||||||
github.com/filecoin-project/go-state-types v0.9.9
|
|
||||||
github.com/filecoin-project/go-storedcounter v0.1.0
|
|
||||||
github.com/filecoin-project/lotus v0.0.0-00010101000000-000000000000
|
|
||||||
github.com/filecoin-project/specs-actors v0.9.15
|
|
||||||
github.com/google/uuid v1.3.0
|
|
||||||
github.com/gorilla/mux v1.8.0
|
|
||||||
github.com/hashicorp/go-multierror v1.1.1
|
|
||||||
github.com/ipfs/go-cid v0.2.0
|
|
||||||
github.com/ipfs/go-datastore v0.5.1
|
|
||||||
github.com/ipfs/go-ipfs-files v0.1.1
|
|
||||||
github.com/ipfs/go-ipld-format v0.4.0
|
|
||||||
github.com/ipfs/go-log/v2 v2.5.1
|
|
||||||
github.com/ipfs/go-merkledag v0.8.0
|
|
||||||
github.com/ipfs/go-unixfs v0.3.1
|
|
||||||
github.com/ipld/go-car v0.4.0
|
|
||||||
github.com/kpacha/opencensus-influxdb v0.0.0-20181102202715-663e2683a27c
|
|
||||||
github.com/libp2p/go-libp2p v0.22.0
|
|
||||||
github.com/libp2p/go-libp2p-pubsub-tracer v0.0.0-20200626141350-e730b32bf1e6
|
|
||||||
github.com/multiformats/go-multiaddr v0.6.0
|
|
||||||
github.com/testground/sdk-go v0.2.6
|
|
||||||
go.opencensus.io v0.23.0
|
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4
|
|
||||||
)
|
|
||||||
|
|
||||||
require (
|
|
||||||
github.com/BurntSushi/toml v1.1.0 // indirect
|
|
||||||
github.com/DataDog/zstd v1.4.1 // indirect
|
|
||||||
github.com/GeertJohan/go.incremental v1.0.0 // indirect
|
|
||||||
github.com/GeertJohan/go.rice v1.0.2 // indirect
|
|
||||||
github.com/Gurpartap/async v0.0.0-20180927173644-4f7f499dd9ee // indirect
|
|
||||||
github.com/Kubuxu/imtui v0.0.0-20210401140320-41663d68d0fa // indirect
|
|
||||||
github.com/StackExchange/wmi v1.2.1 // indirect
|
|
||||||
github.com/Stebalien/go-bitfield v0.0.1 // indirect
|
|
||||||
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect
|
|
||||||
github.com/akavel/rsrc v0.8.0 // indirect
|
|
||||||
github.com/alecthomas/units v0.0.0-20210927113745-59d0afb8317a // indirect
|
|
||||||
github.com/armon/go-metrics v0.3.9 // indirect
|
|
||||||
github.com/avast/retry-go v2.6.0+incompatible // indirect
|
|
||||||
github.com/benbjohnson/clock v1.3.0 // indirect
|
|
||||||
github.com/beorn7/perks v1.0.1 // indirect
|
|
||||||
github.com/bep/debounce v1.2.0 // indirect
|
|
||||||
github.com/boltdb/bolt v1.3.1 // indirect
|
|
||||||
github.com/buger/goterm v1.0.3 // indirect
|
|
||||||
github.com/cespare/xxhash v1.1.0 // indirect
|
|
||||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
|
||||||
github.com/cheekybits/genny v1.0.0 // indirect
|
|
||||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
|
|
||||||
github.com/cilium/ebpf v0.4.0 // indirect
|
|
||||||
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 // indirect
|
|
||||||
github.com/containerd/cgroups v1.0.4 // indirect
|
|
||||||
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
|
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
|
|
||||||
github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 // indirect
|
|
||||||
github.com/cskr/pubsub v1.0.2 // indirect
|
|
||||||
github.com/daaku/go.zipexe v1.0.0 // indirect
|
|
||||||
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
|
|
||||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
|
|
||||||
github.com/detailyang/go-fallocate v0.0.0-20180908115635-432fa640bd2e // indirect
|
|
||||||
github.com/dgraph-io/badger/v2 v2.2007.3 // indirect
|
|
||||||
github.com/dgraph-io/ristretto v0.1.0 // indirect
|
|
||||||
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 // indirect
|
|
||||||
github.com/docker/go-units v0.4.0 // indirect
|
|
||||||
github.com/drand/kyber v1.1.7 // indirect
|
|
||||||
github.com/drand/kyber-bls12381 v0.2.1 // indirect
|
|
||||||
github.com/dustin/go-humanize v1.0.0 // indirect
|
|
||||||
github.com/elastic/go-sysinfo v1.7.0 // indirect
|
|
||||||
github.com/elastic/go-windows v1.0.0 // indirect
|
|
||||||
github.com/elastic/gosigar v0.14.2 // indirect
|
|
||||||
github.com/fatih/color v1.13.0 // indirect
|
|
||||||
github.com/filecoin-project/dagstore v0.5.2 // indirect
|
|
||||||
github.com/filecoin-project/filecoin-ffi v0.30.4-0.20200910194244-f640612a1a1f // indirect
|
|
||||||
github.com/filecoin-project/go-amt-ipld/v2 v2.1.0 // indirect
|
|
||||||
github.com/filecoin-project/go-amt-ipld/v3 v3.1.0 // indirect
|
|
||||||
github.com/filecoin-project/go-amt-ipld/v4 v4.0.0 // indirect
|
|
||||||
github.com/filecoin-project/go-bitfield v0.2.4 // indirect
|
|
||||||
github.com/filecoin-project/go-cbor-util v0.0.1 // indirect
|
|
||||||
github.com/filecoin-project/go-commp-utils v0.1.3 // indirect
|
|
||||||
github.com/filecoin-project/go-commp-utils/nonffi v0.0.0-20220905160352-62059082a837 // indirect
|
|
||||||
github.com/filecoin-project/go-crypto v0.0.1 // indirect
|
|
||||||
github.com/filecoin-project/go-ds-versioning v0.1.1 // indirect
|
|
||||||
github.com/filecoin-project/go-fil-commcid v0.1.0 // indirect
|
|
||||||
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0 // indirect
|
|
||||||
github.com/filecoin-project/go-hamt-ipld v0.1.5 // indirect
|
|
||||||
github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 // indirect
|
|
||||||
github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0 // indirect
|
|
||||||
github.com/filecoin-project/go-legs v0.4.4 // indirect
|
|
||||||
github.com/filecoin-project/go-padreader v0.0.1 // indirect
|
|
||||||
github.com/filecoin-project/go-paramfetch v0.0.4 // indirect
|
|
||||||
github.com/filecoin-project/go-statemachine v1.0.2 // indirect
|
|
||||||
github.com/filecoin-project/go-statestore v0.2.0 // indirect
|
|
||||||
github.com/filecoin-project/index-provider v0.8.1 // indirect
|
|
||||||
github.com/filecoin-project/pubsub v1.0.0 // indirect
|
|
||||||
github.com/filecoin-project/specs-actors/v2 v2.3.6 // indirect
|
|
||||||
github.com/filecoin-project/specs-actors/v3 v3.1.2 // indirect
|
|
||||||
github.com/filecoin-project/specs-actors/v4 v4.0.2 // indirect
|
|
||||||
github.com/filecoin-project/specs-actors/v5 v5.0.6 // indirect
|
|
||||||
github.com/filecoin-project/specs-actors/v6 v6.0.2 // indirect
|
|
||||||
github.com/filecoin-project/specs-actors/v7 v7.0.1 // indirect
|
|
||||||
github.com/filecoin-project/specs-actors/v8 v8.0.1 // indirect
|
|
||||||
github.com/filecoin-project/storetheindex v0.4.17 // indirect
|
|
||||||
github.com/flynn/noise v1.0.0 // indirect
|
|
||||||
github.com/francoispqt/gojay v1.2.13 // indirect
|
|
||||||
github.com/fsnotify/fsnotify v1.5.4 // indirect
|
|
||||||
github.com/gbrlsnchs/jwt/v3 v3.0.1 // indirect
|
|
||||||
github.com/gdamore/encoding v1.0.0 // indirect
|
|
||||||
github.com/gdamore/tcell/v2 v2.2.0 // indirect
|
|
||||||
github.com/go-kit/kit v0.12.0 // indirect
|
|
||||||
github.com/go-kit/log v0.2.0 // indirect
|
|
||||||
github.com/go-logfmt/logfmt v0.5.1 // indirect
|
|
||||||
github.com/go-logr/logr v1.2.3 // indirect
|
|
||||||
github.com/go-logr/stdr v1.2.2 // indirect
|
|
||||||
github.com/go-ole/go-ole v1.2.5 // indirect
|
|
||||||
github.com/go-redis/redis/v7 v7.4.0 // indirect
|
|
||||||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
|
|
||||||
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
|
||||||
github.com/gogo/googleapis v1.4.0 // indirect
|
|
||||||
github.com/gogo/protobuf v1.3.2 // indirect
|
|
||||||
github.com/gogo/status v1.1.0 // indirect
|
|
||||||
github.com/golang/glog v1.0.0 // indirect
|
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
|
||||||
github.com/golang/mock v1.6.0 // indirect
|
|
||||||
github.com/golang/protobuf v1.5.2 // indirect
|
|
||||||
github.com/golang/snappy v0.0.4 // indirect
|
|
||||||
github.com/google/gopacket v1.1.19 // indirect
|
|
||||||
github.com/gorilla/websocket v1.5.0 // indirect
|
|
||||||
github.com/grpc-ecosystem/go-grpc-middleware v1.2.0 // indirect
|
|
||||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
|
|
||||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
|
|
||||||
github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026 // indirect
|
|
||||||
github.com/hannahhoward/cbor-gen-for v0.0.0-20200817222906-ea96cece81f1 // indirect
|
|
||||||
github.com/hannahhoward/go-pubsub v0.0.0-20200423002714-8d62886cc36e // indirect
|
|
||||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
|
||||||
github.com/hashicorp/go-hclog v0.16.2 // indirect
|
|
||||||
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
|
|
||||||
github.com/hashicorp/go-msgpack v0.5.5 // indirect
|
|
||||||
github.com/hashicorp/golang-lru v0.5.4 // indirect
|
|
||||||
github.com/hashicorp/raft v1.1.1 // indirect
|
|
||||||
github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea // indirect
|
|
||||||
github.com/huin/goupnp v1.0.3 // indirect
|
|
||||||
github.com/icza/backscanner v0.0.0-20210726202459-ac2ffc679f94 // indirect
|
|
||||||
github.com/influxdata/influxdb v1.9.4 // indirect
|
|
||||||
github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab // indirect
|
|
||||||
github.com/ipfs/bbloom v0.0.4 // indirect
|
|
||||||
github.com/ipfs/go-bitfield v1.0.0 // indirect
|
|
||||||
github.com/ipfs/go-bitswap v0.10.2 // indirect
|
|
||||||
github.com/ipfs/go-block-format v0.0.3 // indirect
|
|
||||||
github.com/ipfs/go-blockservice v0.4.0 // indirect
|
|
||||||
github.com/ipfs/go-cidutil v0.1.0 // indirect
|
|
||||||
github.com/ipfs/go-ds-badger2 v0.1.2 // indirect
|
|
||||||
github.com/ipfs/go-ds-leveldb v0.5.0 // indirect
|
|
||||||
github.com/ipfs/go-ds-measure v0.2.0 // indirect
|
|
||||||
github.com/ipfs/go-filestore v1.2.0 // indirect
|
|
||||||
github.com/ipfs/go-fs-lock v0.0.7 // indirect
|
|
||||||
github.com/ipfs/go-graphsync v0.13.1 // indirect
|
|
||||||
github.com/ipfs/go-ipfs-blockstore v1.2.0 // indirect
|
|
||||||
github.com/ipfs/go-ipfs-chunker v0.0.5 // indirect
|
|
||||||
github.com/ipfs/go-ipfs-cmds v0.7.0 // indirect
|
|
||||||
github.com/ipfs/go-ipfs-delay v0.0.1 // indirect
|
|
||||||
github.com/ipfs/go-ipfs-ds-help v1.1.0 // indirect
|
|
||||||
github.com/ipfs/go-ipfs-exchange-interface v0.2.0 // indirect
|
|
||||||
github.com/ipfs/go-ipfs-exchange-offline v0.3.0 // indirect
|
|
||||||
github.com/ipfs/go-ipfs-http-client v0.4.0 // indirect
|
|
||||||
github.com/ipfs/go-ipfs-posinfo v0.0.1 // indirect
|
|
||||||
github.com/ipfs/go-ipfs-pq v0.0.2 // indirect
|
|
||||||
github.com/ipfs/go-ipfs-routing v0.2.1 // indirect
|
|
||||||
github.com/ipfs/go-ipfs-util v0.0.2 // indirect
|
|
||||||
github.com/ipfs/go-ipld-cbor v0.0.6 // indirect
|
|
||||||
github.com/ipfs/go-ipld-legacy v0.1.1 // indirect
|
|
||||||
github.com/ipfs/go-ipns v0.2.0 // indirect
|
|
||||||
github.com/ipfs/go-log v1.0.5 // indirect
|
|
||||||
github.com/ipfs/go-metrics-interface v0.0.1 // indirect
|
|
||||||
github.com/ipfs/go-path v0.3.0 // indirect
|
|
||||||
github.com/ipfs/go-peertaskqueue v0.7.1 // indirect
|
|
||||||
github.com/ipfs/go-unixfsnode v1.4.0 // indirect
|
|
||||||
github.com/ipfs/go-verifcid v0.0.1 // indirect
|
|
||||||
github.com/ipfs/interface-go-ipfs-core v0.7.0 // indirect
|
|
||||||
github.com/ipld/go-car/v2 v2.5.0 // indirect
|
|
||||||
github.com/ipld/go-codec-dagpb v1.3.2 // indirect
|
|
||||||
github.com/ipld/go-ipld-prime v0.17.0 // indirect
|
|
||||||
github.com/ipld/go-ipld-selector-text-lite v0.0.1 // indirect
|
|
||||||
github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52 // indirect
|
|
||||||
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
|
|
||||||
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
|
|
||||||
github.com/jbenet/goprocess v0.1.4 // indirect
|
|
||||||
github.com/jessevdk/go-flags v1.4.0 // indirect
|
|
||||||
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 // indirect
|
|
||||||
github.com/jonboulle/clockwork v0.2.2 // indirect
|
|
||||||
github.com/jpillora/backoff v1.0.0 // indirect
|
|
||||||
github.com/kelseyhightower/envconfig v1.4.0 // indirect
|
|
||||||
github.com/kilic/bls12-381 v0.0.0-20200820230200-6b2c19996391 // indirect
|
|
||||||
github.com/klauspost/compress v1.15.1 // indirect
|
|
||||||
github.com/klauspost/cpuid/v2 v2.1.0 // indirect
|
|
||||||
github.com/koron/go-ssdp v0.0.3 // indirect
|
|
||||||
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
|
|
||||||
github.com/libp2p/go-cidranger v1.1.0 // indirect
|
|
||||||
github.com/libp2p/go-flow-metrics v0.1.0 // indirect
|
|
||||||
github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect
|
|
||||||
github.com/libp2p/go-libp2p-connmgr v0.4.0 // indirect
|
|
||||||
github.com/libp2p/go-libp2p-consensus v0.0.1 // indirect
|
|
||||||
github.com/libp2p/go-libp2p-core v0.20.0 // indirect
|
|
||||||
github.com/libp2p/go-libp2p-gorpc v0.4.0 // indirect
|
|
||||||
github.com/libp2p/go-libp2p-gostream v0.4.0 // indirect
|
|
||||||
github.com/libp2p/go-libp2p-kad-dht v0.18.0 // indirect
|
|
||||||
github.com/libp2p/go-libp2p-kbucket v0.5.0 // indirect
|
|
||||||
github.com/libp2p/go-libp2p-noise v0.5.0 // indirect
|
|
||||||
github.com/libp2p/go-libp2p-peerstore v0.8.0 // indirect
|
|
||||||
github.com/libp2p/go-libp2p-pubsub v0.8.0 // indirect
|
|
||||||
github.com/libp2p/go-libp2p-raft v0.1.8 // indirect
|
|
||||||
github.com/libp2p/go-libp2p-record v0.2.0 // indirect
|
|
||||||
github.com/libp2p/go-libp2p-routing-helpers v0.2.3 // indirect
|
|
||||||
github.com/libp2p/go-libp2p-tls v0.5.0 // indirect
|
|
||||||
github.com/libp2p/go-maddr-filter v0.1.0 // indirect
|
|
||||||
github.com/libp2p/go-msgio v0.2.0 // indirect
|
|
||||||
github.com/libp2p/go-nat v0.1.0 // indirect
|
|
||||||
github.com/libp2p/go-netroute v0.2.0 // indirect
|
|
||||||
github.com/libp2p/go-openssl v0.1.0 // indirect
|
|
||||||
github.com/libp2p/go-reuseport v0.2.0 // indirect
|
|
||||||
github.com/libp2p/go-yamux/v3 v3.1.2 // indirect
|
|
||||||
github.com/lucas-clemente/quic-go v0.28.1 // indirect
|
|
||||||
github.com/lucasb-eyer/go-colorful v1.0.3 // indirect
|
|
||||||
github.com/magefile/mage v1.9.0 // indirect
|
|
||||||
github.com/marten-seemann/qtls-go1-16 v0.1.5 // indirect
|
|
||||||
github.com/marten-seemann/qtls-go1-17 v0.1.2 // indirect
|
|
||||||
github.com/marten-seemann/qtls-go1-18 v0.1.2 // indirect
|
|
||||||
github.com/marten-seemann/qtls-go1-19 v0.1.0 // indirect
|
|
||||||
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
|
|
||||||
github.com/mattn/go-colorable v0.1.9 // indirect
|
|
||||||
github.com/mattn/go-isatty v0.0.16 // indirect
|
|
||||||
github.com/mattn/go-pointer v0.0.1 // indirect
|
|
||||||
github.com/mattn/go-runewidth v0.0.10 // indirect
|
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
|
||||||
github.com/miekg/dns v1.1.50 // indirect
|
|
||||||
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
|
|
||||||
github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect
|
|
||||||
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect
|
|
||||||
github.com/minio/sha256-simd v1.0.0 // indirect
|
|
||||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
|
||||||
github.com/mr-tron/base58 v1.2.0 // indirect
|
|
||||||
github.com/multiformats/go-base32 v0.0.4 // indirect
|
|
||||||
github.com/multiformats/go-base36 v0.1.0 // indirect
|
|
||||||
github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect
|
|
||||||
github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect
|
|
||||||
github.com/multiformats/go-multibase v0.1.1 // indirect
|
|
||||||
github.com/multiformats/go-multicodec v0.5.0 // indirect
|
|
||||||
github.com/multiformats/go-multihash v0.2.1 // indirect
|
|
||||||
github.com/multiformats/go-multistream v0.3.3 // indirect
|
|
||||||
github.com/multiformats/go-varint v0.0.6 // indirect
|
|
||||||
github.com/nikkolasg/hexjson v0.0.0-20181101101858-78e39397e00c // indirect
|
|
||||||
github.com/nkovacs/streamquote v1.0.0 // indirect
|
|
||||||
github.com/nxadm/tail v1.4.8 // indirect
|
|
||||||
github.com/onsi/ginkgo v1.16.5 // indirect
|
|
||||||
github.com/opencontainers/runtime-spec v1.0.2 // indirect
|
|
||||||
github.com/opentracing-contrib/go-grpc v0.0.0-20191001143057-db30781987df // indirect
|
|
||||||
github.com/opentracing-contrib/go-stdlib v1.0.0 // indirect
|
|
||||||
github.com/opentracing/opentracing-go v1.2.0 // indirect
|
|
||||||
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
|
|
||||||
github.com/petar/GoLLRB v0.0.0-20210522233825-ae3b015fd3e9 // indirect
|
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
|
||||||
github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e // indirect
|
|
||||||
github.com/prometheus/client_golang v1.12.1 // indirect
|
|
||||||
github.com/prometheus/client_model v0.2.0 // indirect
|
|
||||||
github.com/prometheus/common v0.37.0 // indirect
|
|
||||||
github.com/prometheus/procfs v0.8.0 // indirect
|
|
||||||
github.com/prometheus/statsd_exporter v0.21.0 // indirect
|
|
||||||
github.com/raulk/clock v1.1.0 // indirect
|
|
||||||
github.com/raulk/go-watchdog v1.3.0 // indirect
|
|
||||||
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect
|
|
||||||
github.com/rivo/uniseg v0.1.0 // indirect
|
|
||||||
github.com/rs/cors v1.7.0 // indirect
|
|
||||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
|
||||||
github.com/sercand/kuberesolver v2.4.0+incompatible // indirect
|
|
||||||
github.com/shirou/gopsutil v2.18.12+incompatible // indirect
|
|
||||||
github.com/sirupsen/logrus v1.8.1 // indirect
|
|
||||||
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
|
|
||||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
|
||||||
github.com/stretchr/testify v1.8.0 // indirect
|
|
||||||
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
|
|
||||||
github.com/uber/jaeger-client-go v2.28.0+incompatible // indirect
|
|
||||||
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
|
|
||||||
github.com/ugorji/go/codec v1.2.6 // indirect
|
|
||||||
github.com/urfave/cli/v2 v2.8.1 // indirect
|
|
||||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
|
||||||
github.com/valyala/fasttemplate v1.2.1 // indirect
|
|
||||||
github.com/weaveworks/common v0.0.0-20200512154658-384f10054ec5 // indirect
|
|
||||||
github.com/weaveworks/promrus v1.2.0 // indirect
|
|
||||||
github.com/whyrusleeping/bencher v0.0.0-20190829221104-bb6607aa8bba // indirect
|
|
||||||
github.com/whyrusleeping/cbor v0.0.0-20171005072247-63513f603b11 // indirect
|
|
||||||
github.com/whyrusleeping/cbor-gen v0.0.0-20220514204315-f29c37e9c44c // indirect
|
|
||||||
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f // indirect
|
|
||||||
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect
|
|
||||||
github.com/whyrusleeping/ledger-filecoin-go v0.9.1-0.20201010031517-c3dcc1bddce4 // indirect
|
|
||||||
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 // indirect
|
|
||||||
github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee // indirect
|
|
||||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
|
|
||||||
github.com/zondax/hid v0.9.1-0.20220302062450-5552068d2266 // indirect
|
|
||||||
github.com/zondax/ledger-go v0.12.1 // indirect
|
|
||||||
go.dedis.ch/fixbuf v1.0.3 // indirect
|
|
||||||
go.dedis.ch/protobuf v1.0.11 // indirect
|
|
||||||
go.etcd.io/bbolt v1.3.4 // indirect
|
|
||||||
go.opentelemetry.io/otel v1.7.0 // indirect
|
|
||||||
go.opentelemetry.io/otel/trace v1.7.0 // indirect
|
|
||||||
go.uber.org/atomic v1.10.0 // indirect
|
|
||||||
go.uber.org/dig v1.12.0 // indirect
|
|
||||||
go.uber.org/fx v1.15.0 // indirect
|
|
||||||
go.uber.org/multierr v1.8.0 // indirect
|
|
||||||
go.uber.org/zap v1.22.0 // indirect
|
|
||||||
go4.org v0.0.0-20200411211856-f5505b9728dd // indirect
|
|
||||||
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
|
|
||||||
golang.org/x/exp v0.0.0-20220426173459-3bcf042a4bf5 // indirect
|
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
|
|
||||||
golang.org/x/net v0.0.0-20220812174116-3211cb980234 // indirect
|
|
||||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
|
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
|
|
||||||
golang.org/x/text v0.3.7 // indirect
|
|
||||||
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
|
|
||||||
golang.org/x/tools v0.1.12 // indirect
|
|
||||||
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect
|
|
||||||
google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4 // indirect
|
|
||||||
google.golang.org/grpc v1.45.0 // indirect
|
|
||||||
google.golang.org/protobuf v1.28.1 // indirect
|
|
||||||
gopkg.in/cheggaaa/pb.v1 v1.0.28 // indirect
|
|
||||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
|
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
|
||||||
howett.net/plist v0.0.0-20181124034731-591f970eefbb // indirect
|
|
||||||
lukechampine.com/blake3 v1.1.7 // indirect
|
|
||||||
)
|
|
||||||
|
|
||||||
// This will work in all build modes: docker:go, exec:go, and local go build.
|
|
||||||
// On docker:go and exec:go, it maps to /extra/filecoin-ffi, as it's picked up
|
|
||||||
// as an "extra source" in the manifest.
|
|
||||||
replace github.com/filecoin-project/filecoin-ffi => ../../extern/filecoin-ffi
|
|
||||||
|
|
||||||
replace github.com/filecoin-project/lotus => ../..
|
|
File diff suppressed because it is too large
Load Diff
@ -1,63 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/ipfs/go-log/v2"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/build"
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
build.BlockDelaySecs = 3
|
|
||||||
build.PropagationDelaySecs = 1
|
|
||||||
|
|
||||||
_ = log.SetLogLevel("*", "DEBUG")
|
|
||||||
_ = log.SetLogLevel("dht", "WARN")
|
|
||||||
_ = log.SetLogLevel("swarm2", "WARN")
|
|
||||||
_ = log.SetLogLevel("addrutil", "WARN")
|
|
||||||
_ = log.SetLogLevel("stats", "WARN")
|
|
||||||
_ = log.SetLogLevel("dht/RtRefreshManager", "ERROR") // noisy
|
|
||||||
_ = log.SetLogLevel("bitswap", "ERROR") // noisy
|
|
||||||
_ = log.SetLogLevel("badgerbs", "ERROR") // noisy
|
|
||||||
_ = log.SetLogLevel("sub", "ERROR") // noisy
|
|
||||||
_ = log.SetLogLevel("pubsub", "ERROR") // noisy
|
|
||||||
_ = log.SetLogLevel("chain", "ERROR") // noisy
|
|
||||||
_ = log.SetLogLevel("chainstore", "ERROR") // noisy
|
|
||||||
_ = log.SetLogLevel("basichost", "ERROR") // noisy
|
|
||||||
|
|
||||||
_ = os.Setenv("BELLMAN_NO_GPU", "1")
|
|
||||||
|
|
||||||
build.InsecurePoStValidation = true
|
|
||||||
build.DisableBuiltinAssets = true
|
|
||||||
|
|
||||||
// MessageConfidence is the amount of tipsets we wait after a message is
|
|
||||||
// mined, e.g. payment channel creation, to be considered committed.
|
|
||||||
build.MessageConfidence = 1
|
|
||||||
|
|
||||||
// The duration of a deadline's challenge window, the period before a
|
|
||||||
// deadline when the challenge is available.
|
|
||||||
//
|
|
||||||
// This will auto-scale the proving period.
|
|
||||||
// policy.SetWPoStChallengeWindow(abi.ChainEpoch(5)) // commented-out until we enable PoSt faults tests
|
|
||||||
|
|
||||||
// Number of epochs between publishing the precommit and when the challenge for interactive PoRep is drawn
|
|
||||||
// used to ensure it is not predictable by miner.
|
|
||||||
policy.SetPreCommitChallengeDelay(abi.ChainEpoch(10))
|
|
||||||
|
|
||||||
policy.SetConsensusMinerMinPower(abi.NewTokenAmount(2048))
|
|
||||||
policy.SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg8MiBV1)
|
|
||||||
|
|
||||||
policy.SetMinVerifiedDealSize(abi.NewTokenAmount(256))
|
|
||||||
|
|
||||||
// Disable upgrades.
|
|
||||||
build.UpgradeSmokeHeight = -1
|
|
||||||
build.UpgradeIgnitionHeight = -2
|
|
||||||
build.UpgradeLiftoffHeight = -3
|
|
||||||
// We need to _run_ this upgrade because genesis doesn't support v2, so
|
|
||||||
// we run it at height 0.
|
|
||||||
build.UpgradeAssemblyHeight = 0
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/testground/sdk-go/run"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/testplans/lotus-soup/paych"
|
|
||||||
"github.com/filecoin-project/lotus/testplans/lotus-soup/rfwp"
|
|
||||||
"github.com/filecoin-project/lotus/testplans/lotus-soup/testkit"
|
|
||||||
)
|
|
||||||
|
|
||||||
var cases = map[string]interface{}{
|
|
||||||
"deals-e2e": testkit.WrapTestEnvironment(dealsE2E),
|
|
||||||
"recovery-failed-windowed-post": testkit.WrapTestEnvironment(rfwp.RecoveryFromFailedWindowedPoStE2E),
|
|
||||||
"deals-stress": testkit.WrapTestEnvironment(dealsStress),
|
|
||||||
"drand-halting": testkit.WrapTestEnvironment(dealsE2E),
|
|
||||||
"drand-outage": testkit.WrapTestEnvironment(dealsE2E),
|
|
||||||
"paych-stress": testkit.WrapTestEnvironment(paych.Stress),
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
sanityCheck()
|
|
||||||
|
|
||||||
run.InvokeMap(cases)
|
|
||||||
}
|
|
@ -1,218 +0,0 @@
|
|||||||
name = "lotus-soup"
|
|
||||||
|
|
||||||
[defaults]
|
|
||||||
builder = "docker:go"
|
|
||||||
runner = "local:docker"
|
|
||||||
|
|
||||||
[builders."exec:go"]
|
|
||||||
enabled = true
|
|
||||||
|
|
||||||
[builders."docker:go"]
|
|
||||||
enabled = true
|
|
||||||
build_base_image = "iptestground/oni-buildbase:v15-lotus"
|
|
||||||
runtime_image = "iptestground/oni-runtime:v10-debug"
|
|
||||||
|
|
||||||
[runners."local:exec"]
|
|
||||||
enabled = true
|
|
||||||
|
|
||||||
[runners."local:docker"]
|
|
||||||
enabled = true
|
|
||||||
|
|
||||||
[runners."cluster:k8s"]
|
|
||||||
enabled = true
|
|
||||||
|
|
||||||
######################
|
|
||||||
##
|
|
||||||
## Testcases
|
|
||||||
##
|
|
||||||
######################
|
|
||||||
|
|
||||||
[[testcases]]
|
|
||||||
name = "deals-e2e"
|
|
||||||
instances = { min = 1, max = 100, default = 5 }
|
|
||||||
|
|
||||||
[testcases.params]
|
|
||||||
clients = { type = "int", default = 1 }
|
|
||||||
miners = { type = "int", default = 1 }
|
|
||||||
balance = { type = "float", default = 1 }
|
|
||||||
sectors = { type = "int", default = 1 }
|
|
||||||
role = { type = "string" }
|
|
||||||
|
|
||||||
genesis_timestamp_offset = { type = "int", default = 0 }
|
|
||||||
|
|
||||||
random_beacon_type = { type = "enum", default = "mock", options = ["mock", "local-drand", "external-drand"] }
|
|
||||||
|
|
||||||
# Params relevant to drand nodes. drand nodes should have role="drand", and must all be
|
|
||||||
# in the same composition group. There must be at least threshold drand nodes.
|
|
||||||
# To get lotus nodes to actually use the drand nodes, you must set random_beacon_type="local-drand"
|
|
||||||
# for the lotus node groups.
|
|
||||||
drand_period = { type = "duration", default="10s" }
|
|
||||||
drand_threshold = { type = "int", default = 2 }
|
|
||||||
drand_gossip_relay = { type = "bool", default = true }
|
|
||||||
drand_log_level = { type = "string", default="info" }
|
|
||||||
|
|
||||||
# Params relevant to pubsub tracing
|
|
||||||
enable_pubsub_tracer = { type = "bool", default = false }
|
|
||||||
mining_mode = { type = "enum", default = "synchronized", options = ["synchronized", "natural"] }
|
|
||||||
|
|
||||||
# Fast retrieval
|
|
||||||
fast_retrieval = { type = "bool", default = false }
|
|
||||||
|
|
||||||
# Bounce connection during push and pull data transfers
|
|
||||||
bounce_conn_data_transfers = { type = "bool", default = false }
|
|
||||||
|
|
||||||
|
|
||||||
[[testcases]]
|
|
||||||
name = "drand-halting"
|
|
||||||
instances = { min = 1, max = 100, default = 5 }
|
|
||||||
|
|
||||||
[testcases.params]
|
|
||||||
clients = { type = "int", default = 1 }
|
|
||||||
miners = { type = "int", default = 1 }
|
|
||||||
balance = { type = "float", default = 1 }
|
|
||||||
sectors = { type = "int", default = 1 }
|
|
||||||
role = { type = "string" }
|
|
||||||
genesis_timestamp_offset = { type = "int", default = 0 }
|
|
||||||
|
|
||||||
|
|
||||||
random_beacon_type = { type = "enum", default = "local-drand", options = ["mock", "local-drand", "external-drand"] }
|
|
||||||
|
|
||||||
# Params relevant to drand nodes. drand nodes should have role="drand", and must all be
|
|
||||||
# in the same composition group. There must be at least threshold drand nodes.
|
|
||||||
# To get lotus nodes to actually use the drand nodes, you must set random_beacon_type="local-drand"
|
|
||||||
# for the lotus node groups.
|
|
||||||
drand_period = { type = "duration", default="10s" }
|
|
||||||
drand_threshold = { type = "int", default = 2 }
|
|
||||||
drand_gossip_relay = { type = "bool", default = true }
|
|
||||||
drand_log_level = { type = "string", default="info" }
|
|
||||||
suspend_events = { type = "string", default="", desc = "a sequence of halt/resume/wait events separated by '->'" }
|
|
||||||
|
|
||||||
# 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"] }
|
|
||||||
|
|
||||||
|
|
||||||
[[testcases]]
|
|
||||||
name = "drand-outage"
|
|
||||||
instances = { min = 1, max = 100, default = 5 }
|
|
||||||
|
|
||||||
[testcases.params]
|
|
||||||
clients = { type = "int", default = 0 }
|
|
||||||
miners = { type = "int", default = 3 }
|
|
||||||
balance = { type = "float", default = 1 }
|
|
||||||
sectors = { type = "int", default = 1 }
|
|
||||||
role = { type = "string" }
|
|
||||||
genesis_timestamp_offset = { type = "int", default = 0 }
|
|
||||||
|
|
||||||
|
|
||||||
random_beacon_type = { type = "enum", default = "local-drand", options = ["mock", "local-drand", "external-drand"] }
|
|
||||||
|
|
||||||
# Params relevant to drand nodes. drand nodes should have role="drand", and must all be
|
|
||||||
# in the same composition group. There must be at least threshold drand nodes.
|
|
||||||
# To get lotus nodes to actually use the drand nodes, you must set random_beacon_type="local-drand"
|
|
||||||
# for the lotus node groups.
|
|
||||||
drand_period = { type = "duration", default="30s" }
|
|
||||||
drand_catchup_period = { type = "duration", default="10s" }
|
|
||||||
drand_threshold = { type = "int", default = 2 }
|
|
||||||
drand_gossip_relay = { type = "bool", default = true }
|
|
||||||
drand_log_level = { type = "string", default="info" }
|
|
||||||
suspend_events = { type = "string", default="", desc = "a sequence of halt/resume/wait events separated by '->'" }
|
|
||||||
|
|
||||||
# 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"] }
|
|
||||||
|
|
||||||
|
|
||||||
[[testcases]]
|
|
||||||
name = "deals-stress"
|
|
||||||
instances = { min = 1, max = 100, default = 5 }
|
|
||||||
|
|
||||||
[testcases.params]
|
|
||||||
clients = { type = "int", default = 1 }
|
|
||||||
miners = { type = "int", default = 1 }
|
|
||||||
balance = { type = "float", default = 1 }
|
|
||||||
sectors = { type = "int", default = 1 }
|
|
||||||
role = { type = "string" }
|
|
||||||
|
|
||||||
genesis_timestamp_offset = { type = "int", default = 0 }
|
|
||||||
|
|
||||||
random_beacon_type = { type = "enum", default = "mock", options = ["mock", "local-drand", "external-drand"] }
|
|
||||||
|
|
||||||
# Params relevant to drand nodes. drand nodes should have role="drand", and must all be
|
|
||||||
# in the same composition group. There must be at least threshold drand nodes.
|
|
||||||
# To get lotus nodes to actually use the drand nodes, you must set random_beacon_type="local-drand"
|
|
||||||
# for the lotus node groups.
|
|
||||||
drand_period = { type = "duration", default="10s" }
|
|
||||||
drand_threshold = { type = "int", default = 2 }
|
|
||||||
drand_gossip_relay = { type = "bool", default = true }
|
|
||||||
|
|
||||||
# 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"] }
|
|
||||||
|
|
||||||
deals = { type = "int", default = 1 }
|
|
||||||
deal_mode = { type = "enum", default = "serial", options = ["serial", "concurrent"] }
|
|
||||||
|
|
||||||
|
|
||||||
[[testcases]]
|
|
||||||
name = "paych-stress"
|
|
||||||
instances = { min = 1, max = 100, default = 5 }
|
|
||||||
|
|
||||||
[testcases.params]
|
|
||||||
clients = { type = "int", default = 1 }
|
|
||||||
miners = { type = "int", default = 1 }
|
|
||||||
balance = { type = "float", default = 1 }
|
|
||||||
sectors = { type = "int", default = 1 }
|
|
||||||
role = { type = "string" }
|
|
||||||
genesis_timestamp_offset = { type = "int", default = 0 }
|
|
||||||
|
|
||||||
random_beacon_type = { type = "enum", default = "local-drand", options = ["mock", "local-drand", "external-drand"] }
|
|
||||||
|
|
||||||
# Params relevant to drand nodes. drand nodes should have role="drand", and must all be
|
|
||||||
# in the same composition group. There must be at least threshold drand nodes.
|
|
||||||
# To get lotus nodes to actually use the drand nodes, you must set random_beacon_type="local-drand"
|
|
||||||
# for the lotus node groups.
|
|
||||||
drand_period = { type = "duration", default="10s" }
|
|
||||||
drand_threshold = { type = "int", default = 2 }
|
|
||||||
drand_gossip_relay = { type = "bool", default = true }
|
|
||||||
drand_log_level = { type = "string", default="info" }
|
|
||||||
suspend_events = { type = "string", default="", desc = "a sequence of halt/resume/wait events separated by '->'" }
|
|
||||||
|
|
||||||
# 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"] }
|
|
||||||
|
|
||||||
# ********** Test-case specific **********
|
|
||||||
increments = { type = "int", default = "100", desc = "increments in which to send payment vouchers" }
|
|
||||||
lane_count = { type = "int", default = "256", desc = "lanes to open; vouchers will be distributed across these lanes in round-robin fashion" }
|
|
||||||
|
|
||||||
|
|
||||||
[[testcases]]
|
|
||||||
name = "recovery-failed-windowed-post"
|
|
||||||
instances = { min = 1, max = 100, default = 5 }
|
|
||||||
|
|
||||||
[testcases.params]
|
|
||||||
clients = { type = "int", default = 1 }
|
|
||||||
miners = { type = "int", default = 1 }
|
|
||||||
balance = { type = "int", default = 1 }
|
|
||||||
sectors = { type = "int", default = 1 }
|
|
||||||
role = { type = "string" }
|
|
||||||
|
|
||||||
genesis_timestamp_offset = { type = "int", default = 0 }
|
|
||||||
|
|
||||||
random_beacon_type = { type = "enum", default = "mock", options = ["mock", "local-drand", "external-drand"] }
|
|
||||||
|
|
||||||
# Params relevant to drand nodes. drand nodes should have role="drand", and must all be
|
|
||||||
# in the same composition group. There must be at least threshold drand nodes.
|
|
||||||
# To get lotus nodes to actually use the drand nodes, you must set random_beacon_type="local-drand"
|
|
||||||
# for the lotus node groups.
|
|
||||||
drand_period = { type = "duration", default="10s" }
|
|
||||||
drand_threshold = { type = "int", default = 2 }
|
|
||||||
drand_gossip_relay = { type = "bool", default = true }
|
|
||||||
drand_log_level = { type = "string", default="info" }
|
|
||||||
|
|
||||||
# Params relevant to pubsub tracing
|
|
||||||
enable_pubsub_tracer = { type = "bool", default = false }
|
|
||||||
mining_mode = { type = "enum", default = "synchronized", options = ["synchronized", "natural"] }
|
|
@ -1,32 +0,0 @@
|
|||||||
# Payment channels end-to-end tests
|
|
||||||
|
|
||||||
This package contains the following test cases, each of which is described
|
|
||||||
further below.
|
|
||||||
|
|
||||||
- Payment channels stress test case (`stress.go`).
|
|
||||||
|
|
||||||
## Payment channels stress test case (`stress.go`)
|
|
||||||
|
|
||||||
***WIP | blocked due to https://github.com/filecoin-project/lotus/issues/2297***
|
|
||||||
|
|
||||||
This test case turns all clients into payment receivers and senders.
|
|
||||||
The first member to start in the group becomes the _receiver_.
|
|
||||||
All other members become _senders_.
|
|
||||||
|
|
||||||
The _senders_ will open a single payment channel to the _receiver_, and will
|
|
||||||
wait for the message to be posted on-chain. We are setting
|
|
||||||
`build.MessageConfidence=1`, in order to accelerate the test. So we'll only wait
|
|
||||||
for a single tipset confirmation once we witness the message.
|
|
||||||
|
|
||||||
Once the message is posted, we load the payment channel actor address and create
|
|
||||||
as many lanes as the `lane_count` test parameter dictates.
|
|
||||||
|
|
||||||
When then fetch our total balance, and start sending it on the payment channel,
|
|
||||||
round-robinning across all lanes, until our balance is extinguished.
|
|
||||||
|
|
||||||
**TODO:**
|
|
||||||
|
|
||||||
- [ ] Assertions, metrics, etc. Actually gather statistics. Right now this is
|
|
||||||
just a smoke test, and it fails.
|
|
||||||
- [ ] Implement the _receiver_ logic.
|
|
||||||
- [ ] Model test lifetime by signalling end.
|
|
@ -1,316 +0,0 @@
|
|||||||
package paych
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
"github.com/testground/sdk-go/sync"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
|
||||||
"github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
|
||||||
"github.com/filecoin-project/lotus/build"
|
|
||||||
"github.com/filecoin-project/lotus/testplans/lotus-soup/testkit"
|
|
||||||
)
|
|
||||||
|
|
||||||
var SendersDoneState = sync.State("senders-done")
|
|
||||||
var ReceiverReadyState = sync.State("receiver-ready")
|
|
||||||
var ReceiverAddedVouchersState = sync.State("receiver-added-vouchers")
|
|
||||||
|
|
||||||
var VoucherTopic = sync.NewTopic("voucher", &paych.SignedVoucher{})
|
|
||||||
var SettleTopic = sync.NewTopic("settle", cid.Cid{})
|
|
||||||
|
|
||||||
type ClientMode uint64
|
|
||||||
|
|
||||||
const (
|
|
||||||
ModeSender ClientMode = iota
|
|
||||||
ModeReceiver
|
|
||||||
)
|
|
||||||
|
|
||||||
func (cm ClientMode) String() string {
|
|
||||||
return [...]string{"Sender", "Receiver"}[cm]
|
|
||||||
}
|
|
||||||
|
|
||||||
func getClientMode(groupSeq int64) ClientMode {
|
|
||||||
if groupSeq == 1 {
|
|
||||||
return ModeReceiver
|
|
||||||
}
|
|
||||||
return ModeSender
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO Stress is currently WIP. We found blockers in Lotus that prevent us from
|
|
||||||
//
|
|
||||||
// making progress. See https://github.com/filecoin-project/lotus/issues/2297.
|
|
||||||
func Stress(t *testkit.TestEnvironment) error {
|
|
||||||
// Dispatch/forward non-client roles to defaults.
|
|
||||||
if t.Role != "client" {
|
|
||||||
return testkit.HandleDefaultRole(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is a client role.
|
|
||||||
t.RecordMessage("running payments client")
|
|
||||||
|
|
||||||
ctx := context.Background()
|
|
||||||
cl, err := testkit.PrepareClient(t)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// are we the receiver or a sender?
|
|
||||||
mode := getClientMode(t.GroupSeq)
|
|
||||||
t.RecordMessage("acting as %s", mode)
|
|
||||||
|
|
||||||
var clients []*testkit.ClientAddressesMsg
|
|
||||||
sctx, cancel := context.WithCancel(ctx)
|
|
||||||
clientsCh := make(chan *testkit.ClientAddressesMsg)
|
|
||||||
t.SyncClient.MustSubscribe(sctx, testkit.ClientsAddrsTopic, clientsCh)
|
|
||||||
for i := 0; i < t.TestGroupInstanceCount; i++ {
|
|
||||||
clients = append(clients, <-clientsCh)
|
|
||||||
}
|
|
||||||
cancel()
|
|
||||||
|
|
||||||
switch mode {
|
|
||||||
case ModeReceiver:
|
|
||||||
err := runReceiver(t, ctx, cl)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
case ModeSender:
|
|
||||||
err := runSender(ctx, t, clients, cl)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Signal that the client is done
|
|
||||||
t.SyncClient.MustSignalEntry(ctx, testkit.StateDone)
|
|
||||||
|
|
||||||
// Signal to the miners to stop mining
|
|
||||||
t.SyncClient.MustSignalEntry(ctx, testkit.StateStopMining)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func runSender(ctx context.Context, t *testkit.TestEnvironment, clients []*testkit.ClientAddressesMsg, cl *testkit.LotusClient) error {
|
|
||||||
var (
|
|
||||||
// lanes to open; vouchers will be distributed across these lanes in round-robin fashion
|
|
||||||
laneCount = t.IntParam("lane_count")
|
|
||||||
// number of vouchers to send on each lane
|
|
||||||
vouchersPerLane = t.IntParam("vouchers_per_lane")
|
|
||||||
// increments in which to send payment vouchers
|
|
||||||
increments = big.Mul(big.NewInt(int64(t.IntParam("increments"))), big.NewInt(int64(build.FilecoinPrecision)))
|
|
||||||
// channel amount should be enough to cover all vouchers
|
|
||||||
channelAmt = big.Mul(big.NewInt(int64(laneCount*vouchersPerLane)), increments)
|
|
||||||
)
|
|
||||||
|
|
||||||
// Lock up funds in the payment channel.
|
|
||||||
recv := findReceiver(clients)
|
|
||||||
balance, err := cl.FullApi.WalletBalance(ctx, cl.Wallet.Address)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to acquire wallet balance: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("my balance: %d", balance)
|
|
||||||
t.RecordMessage("creating payment channel; from=%s, to=%s, funds=%d", cl.Wallet.Address, recv.WalletAddr, channelAmt)
|
|
||||||
|
|
||||||
pid := os.Getpid()
|
|
||||||
t.RecordMessage("sender pid: %d", pid)
|
|
||||||
|
|
||||||
time.Sleep(20 * time.Second)
|
|
||||||
|
|
||||||
channel, err := cl.FullApi.PaychGet(ctx, cl.Wallet.Address, recv.WalletAddr, channelAmt, api.PaychGetOpts{
|
|
||||||
OffChain: false,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to create payment channel: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if addr := channel.Channel; addr != address.Undef {
|
|
||||||
return fmt.Errorf("expected an Undef channel address, got: %s", addr)
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("payment channel created; msg_cid=%s", channel.WaitSentinel)
|
|
||||||
t.RecordMessage("waiting for payment channel message to appear on chain")
|
|
||||||
|
|
||||||
// wait for the channel creation message to appear on chain.
|
|
||||||
_, err = cl.FullApi.StateWaitMsg(ctx, channel.WaitSentinel, 2, api.LookbackNoLimit, true)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed while waiting for payment channel creation msg to appear on chain: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// need to wait so that the channel is tracked.
|
|
||||||
// the full API waits for build.MessageConfidence (=1 in tests) before tracking the channel.
|
|
||||||
// we wait for 2 confirmations, so we have the assurance the channel is tracked.
|
|
||||||
|
|
||||||
t.RecordMessage("get payment channel address")
|
|
||||||
channelAddr, err := cl.FullApi.PaychGetWaitReady(ctx, channel.WaitSentinel)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to get payment channel address: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("channel address: %s", channelAddr)
|
|
||||||
t.RecordMessage("allocating lanes; count=%d", laneCount)
|
|
||||||
|
|
||||||
// allocate as many lanes as required
|
|
||||||
var lanes []uint64
|
|
||||||
for i := 0; i < laneCount; i++ {
|
|
||||||
lane, err := cl.FullApi.PaychAllocateLane(ctx, channelAddr)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to allocate lane: %w", err)
|
|
||||||
}
|
|
||||||
lanes = append(lanes, lane)
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("lanes allocated; count=%d", laneCount)
|
|
||||||
|
|
||||||
<-t.SyncClient.MustBarrier(ctx, ReceiverReadyState, 1).C
|
|
||||||
|
|
||||||
t.RecordMessage("sending payments in round-robin fashion across lanes; increments=%d", increments)
|
|
||||||
|
|
||||||
// create vouchers
|
|
||||||
remaining := channelAmt
|
|
||||||
for i := 0; i < vouchersPerLane; i++ {
|
|
||||||
for _, lane := range lanes {
|
|
||||||
voucherAmt := big.Mul(big.NewInt(int64(i+1)), increments)
|
|
||||||
voucher, err := cl.FullApi.PaychVoucherCreate(ctx, channelAddr, voucherAmt, lane)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to create voucher: %w", err)
|
|
||||||
}
|
|
||||||
t.RecordMessage("payment voucher created; lane=%d, nonce=%d, amount=%d", voucher.Voucher.Lane, voucher.Voucher.Nonce, voucher.Voucher.Amount)
|
|
||||||
|
|
||||||
_, err = t.SyncClient.Publish(ctx, VoucherTopic, voucher.Voucher)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to publish voucher: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
remaining = big.Sub(remaining, increments)
|
|
||||||
t.RecordMessage("remaining balance: %d", remaining)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("finished sending all payment vouchers")
|
|
||||||
|
|
||||||
// Inform the receiver that all vouchers have been created
|
|
||||||
t.SyncClient.MustSignalEntry(ctx, SendersDoneState)
|
|
||||||
|
|
||||||
// Wait for the receiver to add all vouchers
|
|
||||||
<-t.SyncClient.MustBarrier(ctx, ReceiverAddedVouchersState, 1).C
|
|
||||||
|
|
||||||
t.RecordMessage("settle channel")
|
|
||||||
|
|
||||||
// Settle the channel. When the receiver sees the settle message, they
|
|
||||||
// should automatically submit all vouchers.
|
|
||||||
settleMsgCid, err := cl.FullApi.PaychSettle(ctx, channelAddr)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to settle payment channel: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = t.SyncClient.Publish(ctx, SettleTopic, settleMsgCid)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to publish settle message cid: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func findReceiver(clients []*testkit.ClientAddressesMsg) *testkit.ClientAddressesMsg {
|
|
||||||
for _, c := range clients {
|
|
||||||
if getClientMode(c.GroupSeq) == ModeReceiver {
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func runReceiver(t *testkit.TestEnvironment, ctx context.Context, cl *testkit.LotusClient) error {
|
|
||||||
// lanes to open; vouchers will be distributed across these lanes in round-robin fashion
|
|
||||||
laneCount := t.IntParam("lane_count")
|
|
||||||
// number of vouchers to send on each lane
|
|
||||||
vouchersPerLane := t.IntParam("vouchers_per_lane")
|
|
||||||
totalVouchers := laneCount * vouchersPerLane
|
|
||||||
|
|
||||||
vouchers := make(chan *paych.SignedVoucher)
|
|
||||||
vouchersSub, err := t.SyncClient.Subscribe(ctx, VoucherTopic, vouchers)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to subscribe to voucher topic: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
settleMsgChan := make(chan cid.Cid)
|
|
||||||
settleSub, err := t.SyncClient.Subscribe(ctx, SettleTopic, settleMsgChan)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to subscribe to settle topic: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// inform the clients that the receiver is ready for incoming vouchers
|
|
||||||
t.SyncClient.MustSignalEntry(ctx, ReceiverReadyState)
|
|
||||||
|
|
||||||
t.RecordMessage("adding %d payment vouchers", totalVouchers)
|
|
||||||
|
|
||||||
// Add each of the vouchers
|
|
||||||
var addedVouchers []*paych.SignedVoucher
|
|
||||||
for i := 0; i < totalVouchers; i++ {
|
|
||||||
v := <-vouchers
|
|
||||||
addedVouchers = append(addedVouchers, v)
|
|
||||||
|
|
||||||
_, err := cl.FullApi.PaychVoucherAdd(ctx, v.ChannelAddr, v, nil, big.NewInt(0))
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to add voucher: %w", err)
|
|
||||||
}
|
|
||||||
spendable, err := cl.FullApi.PaychVoucherCheckSpendable(ctx, v.ChannelAddr, v, nil, nil)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to check voucher spendable: %w", err)
|
|
||||||
}
|
|
||||||
if !spendable {
|
|
||||||
return fmt.Errorf("expected voucher %d to be spendable", i)
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("payment voucher added; lane=%d, nonce=%d, amount=%d", v.Lane, v.Nonce, v.Amount)
|
|
||||||
}
|
|
||||||
|
|
||||||
vouchersSub.Done()
|
|
||||||
|
|
||||||
t.RecordMessage("finished adding all payment vouchers")
|
|
||||||
|
|
||||||
// Inform the clients that the receiver has added all vouchers
|
|
||||||
t.SyncClient.MustSignalEntry(ctx, ReceiverAddedVouchersState)
|
|
||||||
|
|
||||||
// Wait for the settle message (put on chain by the sender)
|
|
||||||
t.RecordMessage("waiting for client to put settle message on chain")
|
|
||||||
settleMsgCid := <-settleMsgChan
|
|
||||||
settleSub.Done()
|
|
||||||
|
|
||||||
time.Sleep(5 * time.Second)
|
|
||||||
|
|
||||||
t.RecordMessage("waiting for confirmation of settle message on chain: %s", settleMsgCid)
|
|
||||||
_, err = cl.FullApi.StateWaitMsg(ctx, settleMsgCid, 10, api.LookbackNoLimit, true)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to wait for settle message: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: Once the receiver sees the settle message on chain, it will
|
|
||||||
// automatically call submit voucher with the best vouchers
|
|
||||||
|
|
||||||
// TODO: Uncomment this section once this PR is merged:
|
|
||||||
// https://github.com/filecoin-project/lotus/pull/3197
|
|
||||||
//t.RecordMessage("checking that all %d vouchers are no longer spendable", len(addedVouchers))
|
|
||||||
//for i, v := range addedVouchers {
|
|
||||||
// spendable, err := cl.FullApi.PaychVoucherCheckSpendable(ctx, v.ChannelAddr, v, nil, nil)
|
|
||||||
// if err != nil {
|
|
||||||
// return fmt.Errorf("failed to check voucher spendable: %w", err)
|
|
||||||
// }
|
|
||||||
// // Should no longer be spendable because the best voucher has been submitted
|
|
||||||
// if spendable {
|
|
||||||
// return fmt.Errorf("expected voucher %d to no longer be spendable", i)
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
t.RecordMessage("all vouchers were submitted successfully")
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
@ -1,837 +0,0 @@
|
|||||||
package rfwp
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bufio"
|
|
||||||
"bytes"
|
|
||||||
"context"
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"math"
|
|
||||||
corebig "math/big"
|
|
||||||
"os"
|
|
||||||
"sort"
|
|
||||||
"text/tabwriter"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
|
||||||
"github.com/filecoin-project/lotus/api/v0api"
|
|
||||||
"github.com/filecoin-project/lotus/blockstore"
|
|
||||||
"github.com/filecoin-project/lotus/build"
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
|
||||||
"github.com/filecoin-project/lotus/chain/store"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
|
||||||
sealing "github.com/filecoin-project/lotus/storage/pipeline"
|
|
||||||
"github.com/filecoin-project/lotus/testplans/lotus-soup/testkit"
|
|
||||||
tsync "github.com/filecoin-project/lotus/tools/stats/sync"
|
|
||||||
)
|
|
||||||
|
|
||||||
func UpdateChainState(t *testkit.TestEnvironment, m *testkit.LotusMiner) error {
|
|
||||||
height := 0
|
|
||||||
headlag := 3
|
|
||||||
|
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
tipsetsCh, err := tsync.BufferedTipsetChannel(ctx, &v0api.WrapperV1Full{FullNode: m.FullApi}, abi.ChainEpoch(height), headlag)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
jsonFilename := fmt.Sprintf("%s%cchain-state.ndjson", t.TestOutputsPath, os.PathSeparator)
|
|
||||||
jsonFile, err := os.Create(jsonFilename)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer jsonFile.Close()
|
|
||||||
jsonEncoder := json.NewEncoder(jsonFile)
|
|
||||||
|
|
||||||
for tipset := range tipsetsCh {
|
|
||||||
maddrs, err := m.FullApi.StateListMiners(ctx, tipset.Key())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
snapshot := ChainSnapshot{
|
|
||||||
Height: tipset.Height(),
|
|
||||||
MinerStates: make(map[string]*MinerStateSnapshot),
|
|
||||||
}
|
|
||||||
|
|
||||||
err = func() error {
|
|
||||||
cs.Lock()
|
|
||||||
defer cs.Unlock()
|
|
||||||
|
|
||||||
for _, maddr := range maddrs {
|
|
||||||
err := func() error {
|
|
||||||
filename := fmt.Sprintf("%s%cstate-%s-%d", t.TestOutputsPath, os.PathSeparator, maddr, tipset.Height())
|
|
||||||
|
|
||||||
f, err := os.Create(filename)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
|
|
||||||
w := bufio.NewWriter(f)
|
|
||||||
defer w.Flush()
|
|
||||||
|
|
||||||
minerInfo, err := info(t, m, maddr, w, tipset.Height())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
writeText(w, minerInfo)
|
|
||||||
|
|
||||||
if tipset.Height()%100 == 0 {
|
|
||||||
printDiff(t, minerInfo, tipset.Height())
|
|
||||||
}
|
|
||||||
|
|
||||||
faultState, err := provingFaults(t, m, maddr, tipset.Height())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
writeText(w, faultState)
|
|
||||||
|
|
||||||
provState, err := provingInfo(t, m, maddr, tipset.Height())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
writeText(w, provState)
|
|
||||||
|
|
||||||
// record diff
|
|
||||||
recordDiff(minerInfo, provState, tipset.Height())
|
|
||||||
|
|
||||||
deadlines, err := provingDeadlines(t, m, maddr, tipset.Height())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
writeText(w, deadlines)
|
|
||||||
|
|
||||||
sectorInfo, err := sectorsList(t, m, maddr, w, tipset.Height())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
writeText(w, sectorInfo)
|
|
||||||
|
|
||||||
snapshot.MinerStates[maddr.String()] = &MinerStateSnapshot{
|
|
||||||
Info: minerInfo,
|
|
||||||
Faults: faultState,
|
|
||||||
ProvingInfo: provState,
|
|
||||||
Deadlines: deadlines,
|
|
||||||
Sectors: sectorInfo,
|
|
||||||
}
|
|
||||||
|
|
||||||
return jsonEncoder.Encode(snapshot)
|
|
||||||
}()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cs.PrevHeight = tipset.Height()
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type ChainSnapshot struct {
|
|
||||||
Height abi.ChainEpoch
|
|
||||||
|
|
||||||
MinerStates map[string]*MinerStateSnapshot
|
|
||||||
}
|
|
||||||
|
|
||||||
type MinerStateSnapshot struct {
|
|
||||||
Info *MinerInfo
|
|
||||||
Faults *ProvingFaultState
|
|
||||||
ProvingInfo *ProvingInfoState
|
|
||||||
Deadlines *ProvingDeadlines
|
|
||||||
Sectors *SectorInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
// writeText marshals m to text and writes to w, swallowing any errors along the way.
|
|
||||||
func writeText(w io.Writer, m plainTextMarshaler) {
|
|
||||||
b, err := m.MarshalPlainText()
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
_, _ = w.Write(b)
|
|
||||||
}
|
|
||||||
|
|
||||||
// if we make our structs `encoding.TextMarshaler`s, they all get stringified when marshaling to JSON
|
|
||||||
// instead of just using the default struct marshaler.
|
|
||||||
// so here's encoding.TextMarshaler with a different name, so that doesn't happen.
|
|
||||||
type plainTextMarshaler interface {
|
|
||||||
MarshalPlainText() ([]byte, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type ProvingFaultState struct {
|
|
||||||
// FaultedSectors is a slice per-deadline faulty sectors. If the miner
|
|
||||||
// has no faulty sectors, this will be nil.
|
|
||||||
FaultedSectors [][]uint64
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *ProvingFaultState) MarshalPlainText() ([]byte, error) {
|
|
||||||
w := &bytes.Buffer{}
|
|
||||||
|
|
||||||
if len(s.FaultedSectors) == 0 {
|
|
||||||
fmt.Fprintf(w, "no faulty sectors\n")
|
|
||||||
return w.Bytes(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
tw := tabwriter.NewWriter(w, 2, 4, 2, ' ', 0)
|
|
||||||
_, _ = fmt.Fprintf(tw, "deadline\tsectors")
|
|
||||||
for deadline, sectors := range s.FaultedSectors {
|
|
||||||
for _, num := range sectors {
|
|
||||||
_, _ = fmt.Fprintf(tw, "%d\t%d\n", deadline, num)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return w.Bytes(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func provingFaults(t *testkit.TestEnvironment, m *testkit.LotusMiner, maddr address.Address, height abi.ChainEpoch) (*ProvingFaultState, error) {
|
|
||||||
api := m.FullApi
|
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
head, err := api.ChainHead(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
deadlines, err := api.StateMinerDeadlines(ctx, maddr, head.Key())
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
faultedSectors := make([][]uint64, len(deadlines))
|
|
||||||
hasFaults := false
|
|
||||||
for dlIdx := range deadlines {
|
|
||||||
partitions, err := api.StateMinerPartitions(ctx, maddr, uint64(dlIdx), types.EmptyTSK)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, partition := range partitions {
|
|
||||||
faulty, err := partition.FaultySectors.All(10000000)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(faulty) > 0 {
|
|
||||||
hasFaults = true
|
|
||||||
}
|
|
||||||
|
|
||||||
faultedSectors[dlIdx] = append(faultedSectors[dlIdx], faulty...)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result := new(ProvingFaultState)
|
|
||||||
if hasFaults {
|
|
||||||
result.FaultedSectors = faultedSectors
|
|
||||||
}
|
|
||||||
|
|
||||||
return result, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type ProvingInfoState struct {
|
|
||||||
CurrentEpoch abi.ChainEpoch
|
|
||||||
|
|
||||||
ProvingPeriodStart abi.ChainEpoch
|
|
||||||
|
|
||||||
Faults uint64
|
|
||||||
ProvenSectors uint64
|
|
||||||
FaultPercent float64
|
|
||||||
Recoveries uint64
|
|
||||||
|
|
||||||
DeadlineIndex uint64
|
|
||||||
DeadlineSectors uint64
|
|
||||||
DeadlineOpen abi.ChainEpoch
|
|
||||||
DeadlineClose abi.ChainEpoch
|
|
||||||
DeadlineChallenge abi.ChainEpoch
|
|
||||||
DeadlineFaultCutoff abi.ChainEpoch
|
|
||||||
|
|
||||||
WPoStProvingPeriod abi.ChainEpoch
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *ProvingInfoState) MarshalPlainText() ([]byte, error) {
|
|
||||||
w := &bytes.Buffer{}
|
|
||||||
fmt.Fprintf(w, "Current Epoch: %d\n", s.CurrentEpoch)
|
|
||||||
fmt.Fprintf(w, "Chain Period: %d\n", s.CurrentEpoch/s.WPoStProvingPeriod)
|
|
||||||
fmt.Fprintf(w, "Chain Period Start: %s\n", epochTime(s.CurrentEpoch, (s.CurrentEpoch/s.WPoStProvingPeriod)*s.WPoStProvingPeriod))
|
|
||||||
fmt.Fprintf(w, "Chain Period End: %s\n\n", epochTime(s.CurrentEpoch, (s.CurrentEpoch/s.WPoStProvingPeriod+1)*s.WPoStProvingPeriod))
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Proving Period Boundary: %d\n", s.ProvingPeriodStart%s.WPoStProvingPeriod)
|
|
||||||
fmt.Fprintf(w, "Proving Period Start: %s\n", epochTime(s.CurrentEpoch, s.ProvingPeriodStart))
|
|
||||||
fmt.Fprintf(w, "Next Period Start: %s\n\n", epochTime(s.CurrentEpoch, s.ProvingPeriodStart+s.WPoStProvingPeriod))
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Faults: %d (%.2f%%)\n", s.Faults, s.FaultPercent)
|
|
||||||
fmt.Fprintf(w, "Recovering: %d\n", s.Recoveries)
|
|
||||||
//fmt.Fprintf(w, "New Sectors: %d\n\n", s.NewSectors)
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Deadline Index: %d\n", s.DeadlineIndex)
|
|
||||||
fmt.Fprintf(w, "Deadline Sectors: %d\n", s.DeadlineSectors)
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Deadline Open: %s\n", epochTime(s.CurrentEpoch, s.DeadlineOpen))
|
|
||||||
fmt.Fprintf(w, "Deadline Close: %s\n", epochTime(s.CurrentEpoch, s.DeadlineClose))
|
|
||||||
fmt.Fprintf(w, "Deadline Challenge: %s\n", epochTime(s.CurrentEpoch, s.DeadlineChallenge))
|
|
||||||
fmt.Fprintf(w, "Deadline FaultCutoff: %s\n", epochTime(s.CurrentEpoch, s.DeadlineFaultCutoff))
|
|
||||||
|
|
||||||
return w.Bytes(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func provingInfo(t *testkit.TestEnvironment, m *testkit.LotusMiner, maddr address.Address, height abi.ChainEpoch) (*ProvingInfoState, error) {
|
|
||||||
lapi := m.FullApi
|
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
head, err := lapi.ChainHead(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
cd, err := lapi.StateMinerProvingDeadline(ctx, maddr, head.Key())
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
deadlines, err := lapi.StateMinerDeadlines(ctx, maddr, head.Key())
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
parts := map[uint64][]api.Partition{}
|
|
||||||
for dlIdx := range deadlines {
|
|
||||||
part, err := lapi.StateMinerPartitions(ctx, maddr, uint64(dlIdx), types.EmptyTSK)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
parts[uint64(dlIdx)] = part
|
|
||||||
}
|
|
||||||
|
|
||||||
proving := uint64(0)
|
|
||||||
faults := uint64(0)
|
|
||||||
recovering := uint64(0)
|
|
||||||
|
|
||||||
for _, partitions := range parts {
|
|
||||||
for _, partition := range partitions {
|
|
||||||
sc, err := partition.LiveSectors.Count()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
proving += sc
|
|
||||||
|
|
||||||
fc, err := partition.FaultySectors.Count()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
faults += fc
|
|
||||||
|
|
||||||
rc, err := partition.RecoveringSectors.Count()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
recovering += rc
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var faultPerc float64
|
|
||||||
if proving > 0 {
|
|
||||||
faultPerc = float64(faults*10000/proving) / 100
|
|
||||||
}
|
|
||||||
|
|
||||||
s := ProvingInfoState{
|
|
||||||
CurrentEpoch: cd.CurrentEpoch,
|
|
||||||
ProvingPeriodStart: cd.PeriodStart,
|
|
||||||
Faults: faults,
|
|
||||||
ProvenSectors: proving,
|
|
||||||
FaultPercent: faultPerc,
|
|
||||||
Recoveries: recovering,
|
|
||||||
DeadlineIndex: cd.Index,
|
|
||||||
DeadlineOpen: cd.Open,
|
|
||||||
DeadlineClose: cd.Close,
|
|
||||||
DeadlineChallenge: cd.Challenge,
|
|
||||||
DeadlineFaultCutoff: cd.FaultCutoff,
|
|
||||||
WPoStProvingPeriod: cd.WPoStProvingPeriod,
|
|
||||||
}
|
|
||||||
|
|
||||||
if cd.Index < cd.WPoStPeriodDeadlines {
|
|
||||||
for _, partition := range parts[cd.Index] {
|
|
||||||
sc, err := partition.LiveSectors.Count()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
s.DeadlineSectors += sc
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return &s, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func epochTime(curr, e abi.ChainEpoch) string {
|
|
||||||
switch {
|
|
||||||
case curr > e:
|
|
||||||
return fmt.Sprintf("%d (%s ago)", e, time.Second*time.Duration(int64(build.BlockDelaySecs)*int64(curr-e)))
|
|
||||||
case curr == e:
|
|
||||||
return fmt.Sprintf("%d (now)", e)
|
|
||||||
case curr < e:
|
|
||||||
return fmt.Sprintf("%d (in %s)", e, time.Second*time.Duration(int64(build.BlockDelaySecs)*int64(e-curr)))
|
|
||||||
}
|
|
||||||
|
|
||||||
panic("math broke")
|
|
||||||
}
|
|
||||||
|
|
||||||
type ProvingDeadlines struct {
|
|
||||||
Deadlines []DeadlineInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
type DeadlineInfo struct {
|
|
||||||
Sectors uint64
|
|
||||||
Partitions int
|
|
||||||
Proven uint64
|
|
||||||
Current bool
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *ProvingDeadlines) MarshalPlainText() ([]byte, error) {
|
|
||||||
w := new(bytes.Buffer)
|
|
||||||
tw := tabwriter.NewWriter(w, 2, 4, 2, ' ', 0)
|
|
||||||
_, _ = fmt.Fprintln(tw, "deadline\tsectors\tpartitions\tproven")
|
|
||||||
|
|
||||||
for i, di := range d.Deadlines {
|
|
||||||
var cur string
|
|
||||||
if di.Current {
|
|
||||||
cur += "\t(current)"
|
|
||||||
}
|
|
||||||
_, _ = fmt.Fprintf(tw, "%d\t%d\t%d\t%d%s\n", i, di.Sectors, di.Partitions, di.Proven, cur)
|
|
||||||
}
|
|
||||||
tw.Flush()
|
|
||||||
return w.Bytes(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func provingDeadlines(t *testkit.TestEnvironment, m *testkit.LotusMiner, maddr address.Address, height abi.ChainEpoch) (*ProvingDeadlines, error) {
|
|
||||||
lapi := m.FullApi
|
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
deadlines, err := lapi.StateMinerDeadlines(ctx, maddr, types.EmptyTSK)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
di, err := lapi.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
infos := make([]DeadlineInfo, 0, len(deadlines))
|
|
||||||
for dlIdx, deadline := range deadlines {
|
|
||||||
partitions, err := lapi.StateMinerPartitions(ctx, maddr, uint64(dlIdx), types.EmptyTSK)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
provenPartitions, err := deadline.PostSubmissions.Count()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var cur string
|
|
||||||
if di.Index == uint64(dlIdx) {
|
|
||||||
cur += "\t(current)"
|
|
||||||
}
|
|
||||||
|
|
||||||
outInfo := DeadlineInfo{
|
|
||||||
//Sectors: c,
|
|
||||||
Partitions: len(partitions),
|
|
||||||
Proven: provenPartitions,
|
|
||||||
Current: di.Index == uint64(dlIdx),
|
|
||||||
}
|
|
||||||
infos = append(infos, outInfo)
|
|
||||||
//_, _ = fmt.Fprintf(tw, "%d\t%d\t%d%s\n", dlIdx, len(partitions), provenPartitions, cur)
|
|
||||||
}
|
|
||||||
|
|
||||||
return &ProvingDeadlines{Deadlines: infos}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type SectorInfo struct {
|
|
||||||
Sectors []abi.SectorNumber
|
|
||||||
SectorStates map[abi.SectorNumber]api.SectorInfo
|
|
||||||
Committed []abi.SectorNumber
|
|
||||||
Proving []abi.SectorNumber
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *SectorInfo) MarshalPlainText() ([]byte, error) {
|
|
||||||
provingIDs := make(map[abi.SectorNumber]struct{}, len(i.Proving))
|
|
||||||
for _, id := range i.Proving {
|
|
||||||
provingIDs[id] = struct{}{}
|
|
||||||
}
|
|
||||||
commitedIDs := make(map[abi.SectorNumber]struct{}, len(i.Committed))
|
|
||||||
for _, id := range i.Committed {
|
|
||||||
commitedIDs[id] = struct{}{}
|
|
||||||
}
|
|
||||||
|
|
||||||
w := new(bytes.Buffer)
|
|
||||||
tw := tabwriter.NewWriter(w, 8, 4, 1, ' ', 0)
|
|
||||||
|
|
||||||
for _, s := range i.Sectors {
|
|
||||||
_, inSSet := commitedIDs[s]
|
|
||||||
_, inPSet := provingIDs[s]
|
|
||||||
|
|
||||||
st, ok := i.SectorStates[s]
|
|
||||||
if !ok {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Fprintf(tw, "%d: %s\tsSet: %s\tpSet: %s\ttktH: %d\tseedH: %d\tdeals: %v\n",
|
|
||||||
s,
|
|
||||||
st.State,
|
|
||||||
yesno(inSSet),
|
|
||||||
yesno(inPSet),
|
|
||||||
st.Ticket.Epoch,
|
|
||||||
st.Seed.Epoch,
|
|
||||||
st.Deals,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := tw.Flush(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return w.Bytes(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func sectorsList(t *testkit.TestEnvironment, m *testkit.LotusMiner, maddr address.Address, w io.Writer, height abi.ChainEpoch) (*SectorInfo, error) {
|
|
||||||
node := m.FullApi
|
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
list, err := m.MinerApi.SectorsList(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
activeSet, err := node.StateMinerActiveSectors(ctx, maddr, types.EmptyTSK)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
activeIDs := make(map[abi.SectorNumber]struct{}, len(activeSet))
|
|
||||||
for _, info := range activeSet {
|
|
||||||
activeIDs[info.SectorNumber] = struct{}{}
|
|
||||||
}
|
|
||||||
|
|
||||||
sset, err := node.StateMinerSectors(ctx, maddr, nil, types.EmptyTSK)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
commitedIDs := make(map[abi.SectorNumber]struct{}, len(activeSet))
|
|
||||||
for _, info := range sset {
|
|
||||||
commitedIDs[info.SectorNumber] = struct{}{}
|
|
||||||
}
|
|
||||||
|
|
||||||
sort.Slice(list, func(i, j int) bool {
|
|
||||||
return list[i] < list[j]
|
|
||||||
})
|
|
||||||
|
|
||||||
i := SectorInfo{Sectors: list, SectorStates: make(map[abi.SectorNumber]api.SectorInfo, len(list))}
|
|
||||||
|
|
||||||
for _, s := range list {
|
|
||||||
st, err := m.MinerApi.SectorsStatus(ctx, s, true)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Fprintf(w, "%d:\tError: %s\n", s, err)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
i.SectorStates[s] = st
|
|
||||||
}
|
|
||||||
return &i, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func yesno(b bool) string {
|
|
||||||
if b {
|
|
||||||
return "YES"
|
|
||||||
}
|
|
||||||
return "NO"
|
|
||||||
}
|
|
||||||
|
|
||||||
type MinerInfo struct {
|
|
||||||
MinerAddr address.Address
|
|
||||||
SectorSize string
|
|
||||||
|
|
||||||
MinerPower *api.MinerPower
|
|
||||||
|
|
||||||
CommittedBytes big.Int
|
|
||||||
ProvingBytes big.Int
|
|
||||||
FaultyBytes big.Int
|
|
||||||
FaultyPercentage float64
|
|
||||||
|
|
||||||
Balance big.Int
|
|
||||||
PreCommitDeposits big.Int
|
|
||||||
LockedFunds big.Int
|
|
||||||
AvailableFunds big.Int
|
|
||||||
WorkerBalance big.Int
|
|
||||||
MarketEscrow big.Int
|
|
||||||
MarketLocked big.Int
|
|
||||||
|
|
||||||
SectorStateCounts map[sealing.SectorState]int
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *MinerInfo) MarshalPlainText() ([]byte, error) {
|
|
||||||
w := new(bytes.Buffer)
|
|
||||||
fmt.Fprintf(w, "Miner: %s\n", i.MinerAddr)
|
|
||||||
fmt.Fprintf(w, "Sector Size: %s\n", i.SectorSize)
|
|
||||||
|
|
||||||
pow := i.MinerPower
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Byte Power: %s / %s (%0.4f%%)\n",
|
|
||||||
types.SizeStr(pow.MinerPower.RawBytePower),
|
|
||||||
types.SizeStr(pow.TotalPower.RawBytePower),
|
|
||||||
types.BigDivFloat(
|
|
||||||
types.BigMul(pow.MinerPower.RawBytePower, big.NewInt(100)),
|
|
||||||
pow.TotalPower.RawBytePower,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Actual Power: %s / %s (%0.4f%%)\n",
|
|
||||||
types.DeciStr(pow.MinerPower.QualityAdjPower),
|
|
||||||
types.DeciStr(pow.TotalPower.QualityAdjPower),
|
|
||||||
types.BigDivFloat(
|
|
||||||
types.BigMul(pow.MinerPower.QualityAdjPower, big.NewInt(100)),
|
|
||||||
pow.TotalPower.QualityAdjPower,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "\tCommitted: %s\n", types.SizeStr(i.CommittedBytes))
|
|
||||||
|
|
||||||
if i.FaultyBytes.Int == nil || i.FaultyBytes.IsZero() {
|
|
||||||
fmt.Fprintf(w, "\tProving: %s\n", types.SizeStr(i.ProvingBytes))
|
|
||||||
} else {
|
|
||||||
fmt.Fprintf(w, "\tProving: %s (%s Faulty, %.2f%%)\n",
|
|
||||||
types.SizeStr(i.ProvingBytes),
|
|
||||||
types.SizeStr(i.FaultyBytes),
|
|
||||||
i.FaultyPercentage)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !i.MinerPower.HasMinPower {
|
|
||||||
fmt.Fprintf(w, "Below minimum power threshold, no blocks will be won\n")
|
|
||||||
} else {
|
|
||||||
|
|
||||||
winRatio := new(corebig.Rat).SetFrac(
|
|
||||||
types.BigMul(pow.MinerPower.QualityAdjPower, types.NewInt(build.BlocksPerEpoch)).Int,
|
|
||||||
pow.TotalPower.QualityAdjPower.Int,
|
|
||||||
)
|
|
||||||
|
|
||||||
if winRatioFloat, _ := winRatio.Float64(); winRatioFloat > 0 {
|
|
||||||
|
|
||||||
// if the corresponding poisson distribution isn't infinitely small then
|
|
||||||
// throw it into the mix as well, accounting for multi-wins
|
|
||||||
winRationWithPoissonFloat := -math.Expm1(-winRatioFloat)
|
|
||||||
winRationWithPoisson := new(corebig.Rat).SetFloat64(winRationWithPoissonFloat)
|
|
||||||
if winRationWithPoisson != nil {
|
|
||||||
winRatio = winRationWithPoisson
|
|
||||||
winRatioFloat = winRationWithPoissonFloat
|
|
||||||
}
|
|
||||||
|
|
||||||
weekly, _ := new(corebig.Rat).Mul(
|
|
||||||
winRatio,
|
|
||||||
new(corebig.Rat).SetInt64(7*builtin.EpochsInDay),
|
|
||||||
).Float64()
|
|
||||||
|
|
||||||
avgDuration, _ := new(corebig.Rat).Mul(
|
|
||||||
new(corebig.Rat).SetInt64(builtin.EpochDurationSeconds),
|
|
||||||
new(corebig.Rat).Inv(winRatio),
|
|
||||||
).Float64()
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Projected average block win rate: %.02f/week (every %s)\n",
|
|
||||||
weekly,
|
|
||||||
(time.Second * time.Duration(avgDuration)).Truncate(time.Second).String(),
|
|
||||||
)
|
|
||||||
|
|
||||||
// Geometric distribution of P(Y < k) calculated as described in https://en.wikipedia.org/wiki/Geometric_distribution#Probability_Outcomes_Examples
|
|
||||||
// https://www.wolframalpha.com/input/?i=t+%3E+0%3B+p+%3E+0%3B+p+%3C+1%3B+c+%3E+0%3B+c+%3C1%3B+1-%281-p%29%5E%28t%29%3Dc%3B+solve+t
|
|
||||||
// t == how many dice-rolls (epochs) before win
|
|
||||||
// p == winRate == ( minerPower / netPower )
|
|
||||||
// c == target probability of win ( 99.9% in this case )
|
|
||||||
fmt.Fprintf(w, "Projected block win with 99.9%% probability every %s\n",
|
|
||||||
(time.Second * time.Duration(
|
|
||||||
builtin.EpochDurationSeconds*math.Log(1-0.999)/
|
|
||||||
math.Log(1-winRatioFloat),
|
|
||||||
)).Truncate(time.Second).String(),
|
|
||||||
)
|
|
||||||
fmt.Fprintln(w, "(projections DO NOT account for future network and miner growth)")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Miner Balance: %s\n", types.FIL(i.Balance))
|
|
||||||
fmt.Fprintf(w, "\tPreCommit: %s\n", types.FIL(i.PreCommitDeposits))
|
|
||||||
fmt.Fprintf(w, "\tLocked: %s\n", types.FIL(i.LockedFunds))
|
|
||||||
fmt.Fprintf(w, "\tAvailable: %s\n", types.FIL(i.AvailableFunds))
|
|
||||||
fmt.Fprintf(w, "Worker Balance: %s\n", types.FIL(i.WorkerBalance))
|
|
||||||
fmt.Fprintf(w, "Market (Escrow): %s\n", types.FIL(i.MarketEscrow))
|
|
||||||
fmt.Fprintf(w, "Market (Locked): %s\n\n", types.FIL(i.MarketLocked))
|
|
||||||
|
|
||||||
buckets := i.SectorStateCounts
|
|
||||||
|
|
||||||
var sorted []stateMeta
|
|
||||||
for state, i := range buckets {
|
|
||||||
sorted = append(sorted, stateMeta{i: i, state: state})
|
|
||||||
}
|
|
||||||
|
|
||||||
sort.Slice(sorted, func(i, j int) bool {
|
|
||||||
return stateOrder[sorted[i].state].i < stateOrder[sorted[j].state].i
|
|
||||||
})
|
|
||||||
|
|
||||||
for _, s := range sorted {
|
|
||||||
_, _ = fmt.Fprintf(w, "\t%s: %d\n", s.state, s.i)
|
|
||||||
}
|
|
||||||
|
|
||||||
return w.Bytes(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func info(t *testkit.TestEnvironment, m *testkit.LotusMiner, maddr address.Address, w io.Writer, height abi.ChainEpoch) (*MinerInfo, error) {
|
|
||||||
api := m.FullApi
|
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
ts, err := api.ChainHead(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
mact, err := api.StateGetActor(ctx, maddr, ts.Key())
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
i := MinerInfo{MinerAddr: maddr}
|
|
||||||
|
|
||||||
// Sector size
|
|
||||||
mi, err := api.StateMinerInfo(ctx, maddr, ts.Key())
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
i.SectorSize = types.SizeStr(types.NewInt(uint64(mi.SectorSize)))
|
|
||||||
|
|
||||||
i.MinerPower, err = api.StateMinerPower(ctx, maddr, ts.Key())
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
secCounts, err := api.StateMinerSectorCount(ctx, maddr, ts.Key())
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
faults, err := api.StateMinerFaults(ctx, maddr, ts.Key())
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
nfaults, err := faults.Count()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
i.CommittedBytes = types.BigMul(types.NewInt(secCounts.Live), types.NewInt(uint64(mi.SectorSize)))
|
|
||||||
i.ProvingBytes = types.BigMul(types.NewInt(secCounts.Active), types.NewInt(uint64(mi.SectorSize)))
|
|
||||||
|
|
||||||
if nfaults != 0 {
|
|
||||||
if secCounts.Live != 0 {
|
|
||||||
i.FaultyPercentage = float64(10000*nfaults/secCounts.Live) / 100.
|
|
||||||
}
|
|
||||||
i.FaultyBytes = types.BigMul(types.NewInt(nfaults), types.NewInt(uint64(mi.SectorSize)))
|
|
||||||
}
|
|
||||||
|
|
||||||
stor := store.ActorStore(ctx, blockstore.NewAPIBlockstore(api))
|
|
||||||
mas, err := miner.Load(stor, mact)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
funds, err := mas.LockedFunds()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
i.Balance = mact.Balance
|
|
||||||
i.PreCommitDeposits = funds.PreCommitDeposits
|
|
||||||
i.LockedFunds = funds.VestingFunds
|
|
||||||
i.AvailableFunds, err = mas.AvailableBalance(mact.Balance)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
wb, err := api.WalletBalance(ctx, mi.Worker)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
i.WorkerBalance = wb
|
|
||||||
|
|
||||||
mb, err := api.StateMarketBalance(ctx, maddr, types.EmptyTSK)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
i.MarketEscrow = mb.Escrow
|
|
||||||
i.MarketLocked = mb.Locked
|
|
||||||
|
|
||||||
sectors, err := m.MinerApi.SectorsList(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
buckets := map[sealing.SectorState]int{
|
|
||||||
"Total": len(sectors),
|
|
||||||
}
|
|
||||||
for _, s := range sectors {
|
|
||||||
st, err := m.MinerApi.SectorsStatus(ctx, s, true)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
buckets[sealing.SectorState(st.State)]++
|
|
||||||
}
|
|
||||||
i.SectorStateCounts = buckets
|
|
||||||
|
|
||||||
return &i, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type stateMeta struct {
|
|
||||||
i int
|
|
||||||
state sealing.SectorState
|
|
||||||
}
|
|
||||||
|
|
||||||
var stateOrder = map[sealing.SectorState]stateMeta{}
|
|
||||||
var stateList = []stateMeta{
|
|
||||||
{state: "Total"},
|
|
||||||
{state: sealing.Proving},
|
|
||||||
|
|
||||||
{state: sealing.UndefinedSectorState},
|
|
||||||
{state: sealing.Empty},
|
|
||||||
{state: sealing.Packing},
|
|
||||||
{state: sealing.PreCommit1},
|
|
||||||
{state: sealing.PreCommit2},
|
|
||||||
{state: sealing.PreCommitting},
|
|
||||||
{state: sealing.PreCommitWait},
|
|
||||||
{state: sealing.WaitSeed},
|
|
||||||
{state: sealing.Committing},
|
|
||||||
{state: sealing.CommitWait},
|
|
||||||
{state: sealing.FinalizeSector},
|
|
||||||
|
|
||||||
{state: sealing.FailedUnrecoverable},
|
|
||||||
{state: sealing.SealPreCommit1Failed},
|
|
||||||
{state: sealing.SealPreCommit2Failed},
|
|
||||||
{state: sealing.PreCommitFailed},
|
|
||||||
{state: sealing.ComputeProofFailed},
|
|
||||||
{state: sealing.CommitFailed},
|
|
||||||
{state: sealing.PackingFailed},
|
|
||||||
{state: sealing.FinalizeFailed},
|
|
||||||
{state: sealing.Faulty},
|
|
||||||
{state: sealing.FaultReported},
|
|
||||||
{state: sealing.FaultedFinal},
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
for i, state := range stateList {
|
|
||||||
stateOrder[state.state] = stateMeta{
|
|
||||||
i: i,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,296 +0,0 @@
|
|||||||
package rfwp
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bufio"
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"sort"
|
|
||||||
"sync"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/testplans/lotus-soup/testkit"
|
|
||||||
)
|
|
||||||
|
|
||||||
type ChainState struct {
|
|
||||||
sync.Mutex
|
|
||||||
|
|
||||||
PrevHeight abi.ChainEpoch
|
|
||||||
DiffHeight map[string]map[string]map[abi.ChainEpoch]big.Int // height -> value
|
|
||||||
DiffValue map[string]map[string]map[string][]abi.ChainEpoch // value -> []height
|
|
||||||
DiffCmp map[string]map[string]map[string][]abi.ChainEpoch // difference (height, height-1) -> []height
|
|
||||||
valueTypes []string
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewChainState() *ChainState {
|
|
||||||
cs := &ChainState{}
|
|
||||||
cs.PrevHeight = abi.ChainEpoch(-1)
|
|
||||||
cs.DiffHeight = make(map[string]map[string]map[abi.ChainEpoch]big.Int) // height -> value
|
|
||||||
cs.DiffValue = make(map[string]map[string]map[string][]abi.ChainEpoch) // value -> []height
|
|
||||||
cs.DiffCmp = make(map[string]map[string]map[string][]abi.ChainEpoch) // difference (height, height-1) -> []height
|
|
||||||
cs.valueTypes = []string{"MinerPower", "CommittedBytes", "ProvingBytes", "Balance", "PreCommitDeposits", "LockedFunds", "AvailableFunds", "WorkerBalance", "MarketEscrow", "MarketLocked", "Faults", "ProvenSectors", "Recoveries"}
|
|
||||||
return cs
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
cs *ChainState
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
cs = NewChainState()
|
|
||||||
}
|
|
||||||
|
|
||||||
func printDiff(t *testkit.TestEnvironment, mi *MinerInfo, height abi.ChainEpoch) {
|
|
||||||
maddr := mi.MinerAddr.String()
|
|
||||||
filename := fmt.Sprintf("%s%cdiff-%s-%d", t.TestOutputsPath, os.PathSeparator, maddr, height)
|
|
||||||
|
|
||||||
f, err := os.Create(filename)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
|
|
||||||
w := bufio.NewWriter(f)
|
|
||||||
defer w.Flush()
|
|
||||||
|
|
||||||
keys := make([]string, 0, len(cs.DiffCmp[maddr]))
|
|
||||||
for k := range cs.DiffCmp[maddr] {
|
|
||||||
keys = append(keys, k)
|
|
||||||
}
|
|
||||||
sort.Strings(keys)
|
|
||||||
|
|
||||||
fmt.Fprintln(w, "=====", maddr, "=====")
|
|
||||||
for i, valueName := range keys {
|
|
||||||
fmt.Fprintln(w, toCharStr(i), "=====", valueName, "=====")
|
|
||||||
if len(cs.DiffCmp[maddr][valueName]) > 0 {
|
|
||||||
fmt.Fprintf(w, "%s diff of |\n", toCharStr(i))
|
|
||||||
}
|
|
||||||
|
|
||||||
for difference, heights := range cs.DiffCmp[maddr][valueName] {
|
|
||||||
fmt.Fprintf(w, "%s diff of %30v at heights %v\n", toCharStr(i), difference, heights)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func recordDiff(mi *MinerInfo, ps *ProvingInfoState, height abi.ChainEpoch) {
|
|
||||||
maddr := mi.MinerAddr.String()
|
|
||||||
if _, ok := cs.DiffHeight[maddr]; !ok {
|
|
||||||
cs.DiffHeight[maddr] = make(map[string]map[abi.ChainEpoch]big.Int)
|
|
||||||
cs.DiffValue[maddr] = make(map[string]map[string][]abi.ChainEpoch)
|
|
||||||
cs.DiffCmp[maddr] = make(map[string]map[string][]abi.ChainEpoch)
|
|
||||||
|
|
||||||
for _, v := range cs.valueTypes {
|
|
||||||
cs.DiffHeight[maddr][v] = make(map[abi.ChainEpoch]big.Int)
|
|
||||||
cs.DiffValue[maddr][v] = make(map[string][]abi.ChainEpoch)
|
|
||||||
cs.DiffCmp[maddr][v] = make(map[string][]abi.ChainEpoch)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
value := big.Int(mi.MinerPower.MinerPower.RawBytePower)
|
|
||||||
cs.DiffHeight[maddr]["MinerPower"][height] = value
|
|
||||||
cs.DiffValue[maddr]["MinerPower"][value.String()] = append(cs.DiffValue[maddr]["MinerPower"][value.String()], height)
|
|
||||||
|
|
||||||
if cs.PrevHeight != -1 {
|
|
||||||
prevValue := cs.DiffHeight[maddr]["MinerPower"][cs.PrevHeight]
|
|
||||||
cmp := big.Zero()
|
|
||||||
cmp.Sub(value.Int, prevValue.Int) // value - prevValue
|
|
||||||
if big.Cmp(cmp, big.Zero()) != 0 {
|
|
||||||
cs.DiffCmp[maddr]["MinerPower"][cmp.String()] = append(cs.DiffCmp[maddr]["MinerPower"][cmp.String()], height)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
value := big.Int(mi.CommittedBytes)
|
|
||||||
cs.DiffHeight[maddr]["CommittedBytes"][height] = value
|
|
||||||
cs.DiffValue[maddr]["CommittedBytes"][value.String()] = append(cs.DiffValue[maddr]["CommittedBytes"][value.String()], height)
|
|
||||||
|
|
||||||
if cs.PrevHeight != -1 {
|
|
||||||
prevValue := cs.DiffHeight[maddr]["CommittedBytes"][cs.PrevHeight]
|
|
||||||
cmp := big.Zero()
|
|
||||||
cmp.Sub(value.Int, prevValue.Int) // value - prevValue
|
|
||||||
if big.Cmp(cmp, big.Zero()) != 0 {
|
|
||||||
cs.DiffCmp[maddr]["CommittedBytes"][cmp.String()] = append(cs.DiffCmp[maddr]["CommittedBytes"][cmp.String()], height)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
value := big.Int(mi.ProvingBytes)
|
|
||||||
cs.DiffHeight[maddr]["ProvingBytes"][height] = value
|
|
||||||
cs.DiffValue[maddr]["ProvingBytes"][value.String()] = append(cs.DiffValue[maddr]["ProvingBytes"][value.String()], height)
|
|
||||||
|
|
||||||
if cs.PrevHeight != -1 {
|
|
||||||
prevValue := cs.DiffHeight[maddr]["ProvingBytes"][cs.PrevHeight]
|
|
||||||
cmp := big.Zero()
|
|
||||||
cmp.Sub(value.Int, prevValue.Int) // value - prevValue
|
|
||||||
if big.Cmp(cmp, big.Zero()) != 0 {
|
|
||||||
cs.DiffCmp[maddr]["ProvingBytes"][cmp.String()] = append(cs.DiffCmp[maddr]["ProvingBytes"][cmp.String()], height)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
value := big.Int(mi.Balance)
|
|
||||||
roundBalance(&value)
|
|
||||||
cs.DiffHeight[maddr]["Balance"][height] = value
|
|
||||||
cs.DiffValue[maddr]["Balance"][value.String()] = append(cs.DiffValue[maddr]["Balance"][value.String()], height)
|
|
||||||
|
|
||||||
if cs.PrevHeight != -1 {
|
|
||||||
prevValue := cs.DiffHeight[maddr]["Balance"][cs.PrevHeight]
|
|
||||||
cmp := big.Zero()
|
|
||||||
cmp.Sub(value.Int, prevValue.Int) // value - prevValue
|
|
||||||
if big.Cmp(cmp, big.Zero()) != 0 {
|
|
||||||
cs.DiffCmp[maddr]["Balance"][cmp.String()] = append(cs.DiffCmp[maddr]["Balance"][cmp.String()], height)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
value := big.Int(mi.PreCommitDeposits)
|
|
||||||
cs.DiffHeight[maddr]["PreCommitDeposits"][height] = value
|
|
||||||
cs.DiffValue[maddr]["PreCommitDeposits"][value.String()] = append(cs.DiffValue[maddr]["PreCommitDeposits"][value.String()], height)
|
|
||||||
|
|
||||||
if cs.PrevHeight != -1 {
|
|
||||||
prevValue := cs.DiffHeight[maddr]["PreCommitDeposits"][cs.PrevHeight]
|
|
||||||
cmp := big.Zero()
|
|
||||||
cmp.Sub(value.Int, prevValue.Int) // value - prevValue
|
|
||||||
if big.Cmp(cmp, big.Zero()) != 0 {
|
|
||||||
cs.DiffCmp[maddr]["PreCommitDeposits"][cmp.String()] = append(cs.DiffCmp[maddr]["PreCommitDeposits"][cmp.String()], height)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
value := big.Int(mi.LockedFunds)
|
|
||||||
roundBalance(&value)
|
|
||||||
cs.DiffHeight[maddr]["LockedFunds"][height] = value
|
|
||||||
cs.DiffValue[maddr]["LockedFunds"][value.String()] = append(cs.DiffValue[maddr]["LockedFunds"][value.String()], height)
|
|
||||||
|
|
||||||
if cs.PrevHeight != -1 {
|
|
||||||
prevValue := cs.DiffHeight[maddr]["LockedFunds"][cs.PrevHeight]
|
|
||||||
cmp := big.Zero()
|
|
||||||
cmp.Sub(value.Int, prevValue.Int) // value - prevValue
|
|
||||||
if big.Cmp(cmp, big.Zero()) != 0 {
|
|
||||||
cs.DiffCmp[maddr]["LockedFunds"][cmp.String()] = append(cs.DiffCmp[maddr]["LockedFunds"][cmp.String()], height)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
value := big.Int(mi.AvailableFunds)
|
|
||||||
roundBalance(&value)
|
|
||||||
cs.DiffHeight[maddr]["AvailableFunds"][height] = value
|
|
||||||
cs.DiffValue[maddr]["AvailableFunds"][value.String()] = append(cs.DiffValue[maddr]["AvailableFunds"][value.String()], height)
|
|
||||||
|
|
||||||
if cs.PrevHeight != -1 {
|
|
||||||
prevValue := cs.DiffHeight[maddr]["AvailableFunds"][cs.PrevHeight]
|
|
||||||
cmp := big.Zero()
|
|
||||||
cmp.Sub(value.Int, prevValue.Int) // value - prevValue
|
|
||||||
if big.Cmp(cmp, big.Zero()) != 0 {
|
|
||||||
cs.DiffCmp[maddr]["AvailableFunds"][cmp.String()] = append(cs.DiffCmp[maddr]["AvailableFunds"][cmp.String()], height)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
value := big.Int(mi.WorkerBalance)
|
|
||||||
cs.DiffHeight[maddr]["WorkerBalance"][height] = value
|
|
||||||
cs.DiffValue[maddr]["WorkerBalance"][value.String()] = append(cs.DiffValue[maddr]["WorkerBalance"][value.String()], height)
|
|
||||||
|
|
||||||
if cs.PrevHeight != -1 {
|
|
||||||
prevValue := cs.DiffHeight[maddr]["WorkerBalance"][cs.PrevHeight]
|
|
||||||
cmp := big.Zero()
|
|
||||||
cmp.Sub(value.Int, prevValue.Int) // value - prevValue
|
|
||||||
if big.Cmp(cmp, big.Zero()) != 0 {
|
|
||||||
cs.DiffCmp[maddr]["WorkerBalance"][cmp.String()] = append(cs.DiffCmp[maddr]["WorkerBalance"][cmp.String()], height)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
value := big.Int(mi.MarketEscrow)
|
|
||||||
cs.DiffHeight[maddr]["MarketEscrow"][height] = value
|
|
||||||
cs.DiffValue[maddr]["MarketEscrow"][value.String()] = append(cs.DiffValue[maddr]["MarketEscrow"][value.String()], height)
|
|
||||||
|
|
||||||
if cs.PrevHeight != -1 {
|
|
||||||
prevValue := cs.DiffHeight[maddr]["MarketEscrow"][cs.PrevHeight]
|
|
||||||
cmp := big.Zero()
|
|
||||||
cmp.Sub(value.Int, prevValue.Int) // value - prevValue
|
|
||||||
if big.Cmp(cmp, big.Zero()) != 0 {
|
|
||||||
cs.DiffCmp[maddr]["MarketEscrow"][cmp.String()] = append(cs.DiffCmp[maddr]["MarketEscrow"][cmp.String()], height)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
value := big.Int(mi.MarketLocked)
|
|
||||||
cs.DiffHeight[maddr]["MarketLocked"][height] = value
|
|
||||||
cs.DiffValue[maddr]["MarketLocked"][value.String()] = append(cs.DiffValue[maddr]["MarketLocked"][value.String()], height)
|
|
||||||
|
|
||||||
if cs.PrevHeight != -1 {
|
|
||||||
prevValue := cs.DiffHeight[maddr]["MarketLocked"][cs.PrevHeight]
|
|
||||||
cmp := big.Zero()
|
|
||||||
cmp.Sub(value.Int, prevValue.Int) // value - prevValue
|
|
||||||
if big.Cmp(cmp, big.Zero()) != 0 {
|
|
||||||
cs.DiffCmp[maddr]["MarketLocked"][cmp.String()] = append(cs.DiffCmp[maddr]["MarketLocked"][cmp.String()], height)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
value := big.NewInt(int64(ps.Faults))
|
|
||||||
cs.DiffHeight[maddr]["Faults"][height] = value
|
|
||||||
cs.DiffValue[maddr]["Faults"][value.String()] = append(cs.DiffValue[maddr]["Faults"][value.String()], height)
|
|
||||||
|
|
||||||
if cs.PrevHeight != -1 {
|
|
||||||
prevValue := cs.DiffHeight[maddr]["Faults"][cs.PrevHeight]
|
|
||||||
cmp := big.Zero()
|
|
||||||
cmp.Sub(value.Int, prevValue.Int) // value - prevValue
|
|
||||||
if big.Cmp(cmp, big.Zero()) != 0 {
|
|
||||||
cs.DiffCmp[maddr]["Faults"][cmp.String()] = append(cs.DiffCmp[maddr]["Faults"][cmp.String()], height)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
value := big.NewInt(int64(ps.ProvenSectors))
|
|
||||||
cs.DiffHeight[maddr]["ProvenSectors"][height] = value
|
|
||||||
cs.DiffValue[maddr]["ProvenSectors"][value.String()] = append(cs.DiffValue[maddr]["ProvenSectors"][value.String()], height)
|
|
||||||
|
|
||||||
if cs.PrevHeight != -1 {
|
|
||||||
prevValue := cs.DiffHeight[maddr]["ProvenSectors"][cs.PrevHeight]
|
|
||||||
cmp := big.Zero()
|
|
||||||
cmp.Sub(value.Int, prevValue.Int) // value - prevValue
|
|
||||||
if big.Cmp(cmp, big.Zero()) != 0 {
|
|
||||||
cs.DiffCmp[maddr]["ProvenSectors"][cmp.String()] = append(cs.DiffCmp[maddr]["ProvenSectors"][cmp.String()], height)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
value := big.NewInt(int64(ps.Recoveries))
|
|
||||||
cs.DiffHeight[maddr]["Recoveries"][height] = value
|
|
||||||
cs.DiffValue[maddr]["Recoveries"][value.String()] = append(cs.DiffValue[maddr]["Recoveries"][value.String()], height)
|
|
||||||
|
|
||||||
if cs.PrevHeight != -1 {
|
|
||||||
prevValue := cs.DiffHeight[maddr]["Recoveries"][cs.PrevHeight]
|
|
||||||
cmp := big.Zero()
|
|
||||||
cmp.Sub(value.Int, prevValue.Int) // value - prevValue
|
|
||||||
if big.Cmp(cmp, big.Zero()) != 0 {
|
|
||||||
cs.DiffCmp[maddr]["Recoveries"][cmp.String()] = append(cs.DiffCmp[maddr]["Recoveries"][cmp.String()], height)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func roundBalance(i *big.Int) {
|
|
||||||
*i = big.Div(*i, big.NewInt(1000000000000000))
|
|
||||||
*i = big.Mul(*i, big.NewInt(1000000000000000))
|
|
||||||
}
|
|
||||||
|
|
||||||
func toCharStr(i int) string {
|
|
||||||
return string('a' + i)
|
|
||||||
}
|
|
@ -1,349 +0,0 @@
|
|||||||
package rfwp
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"math/rand"
|
|
||||||
"os"
|
|
||||||
"sort"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"golang.org/x/sync/errgroup"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
|
||||||
"github.com/filecoin-project/lotus/testplans/lotus-soup/testkit"
|
|
||||||
)
|
|
||||||
|
|
||||||
func RecoveryFromFailedWindowedPoStE2E(t *testkit.TestEnvironment) error {
|
|
||||||
switch t.Role {
|
|
||||||
case "bootstrapper":
|
|
||||||
return testkit.HandleDefaultRole(t)
|
|
||||||
case "client":
|
|
||||||
return handleClient(t)
|
|
||||||
case "miner":
|
|
||||||
return handleMiner(t)
|
|
||||||
case "miner-full-slash":
|
|
||||||
return handleMinerFullSlash(t)
|
|
||||||
case "miner-partial-slash":
|
|
||||||
return handleMinerPartialSlash(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
return fmt.Errorf("unknown role: %s", t.Role)
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleMiner(t *testkit.TestEnvironment) error {
|
|
||||||
m, err := testkit.PrepareMiner(t)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx := context.Background()
|
|
||||||
myActorAddr, err := m.MinerApi.ActorAddress(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("running miner: %s", myActorAddr)
|
|
||||||
|
|
||||||
if t.GroupSeq == 1 {
|
|
||||||
go FetchChainState(t, m)
|
|
||||||
}
|
|
||||||
|
|
||||||
go UpdateChainState(t, m)
|
|
||||||
|
|
||||||
minersToBeSlashed := 2
|
|
||||||
ch := make(chan testkit.SlashedMinerMsg)
|
|
||||||
sub := t.SyncClient.MustSubscribe(ctx, testkit.SlashedMinerTopic, ch)
|
|
||||||
var eg errgroup.Group
|
|
||||||
|
|
||||||
for i := 0; i < minersToBeSlashed; i++ {
|
|
||||||
select {
|
|
||||||
case slashedMiner := <-ch:
|
|
||||||
// wait for slash
|
|
||||||
eg.Go(func() error {
|
|
||||||
select {
|
|
||||||
case <-waitForSlash(t, slashedMiner):
|
|
||||||
case err = <-t.SyncClient.MustBarrier(ctx, testkit.StateAbortTest, 1).C:
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return errors.New("got abort signal, exitting")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
case err := <-sub.Done():
|
|
||||||
return fmt.Errorf("got error while waiting for slashed miners: %w", err)
|
|
||||||
case err := <-t.SyncClient.MustBarrier(ctx, testkit.StateAbortTest, 1).C:
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return errors.New("got abort signal, exitting")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
errc := make(chan error)
|
|
||||||
go func() {
|
|
||||||
errc <- eg.Wait()
|
|
||||||
}()
|
|
||||||
|
|
||||||
select {
|
|
||||||
case err := <-errc:
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
case err := <-t.SyncClient.MustBarrier(ctx, testkit.StateAbortTest, 1).C:
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return errors.New("got abort signal, exitting")
|
|
||||||
}
|
|
||||||
|
|
||||||
t.SyncClient.MustSignalAndWait(ctx, testkit.StateDone, t.TestInstanceCount)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func waitForSlash(t *testkit.TestEnvironment, msg testkit.SlashedMinerMsg) chan error {
|
|
||||||
// assert that balance got reduced with that much 5 times (sector fee)
|
|
||||||
// assert that balance got reduced with that much 2 times (termination fee)
|
|
||||||
// assert that balance got increased with that much 10 times (block reward)
|
|
||||||
// assert that power got increased with that much 1 times (after sector is sealed)
|
|
||||||
// assert that power got reduced with that much 1 times (after sector is announced faulty)
|
|
||||||
slashedMiner := msg.MinerActorAddr
|
|
||||||
|
|
||||||
errc := make(chan error)
|
|
||||||
go func() {
|
|
||||||
foundSlashConditions := false
|
|
||||||
for range time.Tick(10 * time.Second) {
|
|
||||||
if foundSlashConditions {
|
|
||||||
close(errc)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
t.RecordMessage("wait for slashing, tick")
|
|
||||||
func() {
|
|
||||||
cs.Lock()
|
|
||||||
defer cs.Unlock()
|
|
||||||
|
|
||||||
negativeAmounts := []big.Int{}
|
|
||||||
negativeDiffs := make(map[big.Int][]abi.ChainEpoch)
|
|
||||||
|
|
||||||
for am, heights := range cs.DiffCmp[slashedMiner.String()]["LockedFunds"] {
|
|
||||||
amount, err := big.FromString(am)
|
|
||||||
if err != nil {
|
|
||||||
errc <- fmt.Errorf("cannot parse LockedFunds amount: %w:", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// amount is negative => slash condition
|
|
||||||
if big.Cmp(amount, big.Zero()) < 0 {
|
|
||||||
negativeDiffs[amount] = heights
|
|
||||||
negativeAmounts = append(negativeAmounts, amount)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("negative diffs: %d", len(negativeDiffs))
|
|
||||||
if len(negativeDiffs) < 3 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
sort.Slice(negativeAmounts, func(i, j int) bool { return big.Cmp(negativeAmounts[i], negativeAmounts[j]) > 0 })
|
|
||||||
|
|
||||||
// TODO: confirm the largest is > 18 filecoin
|
|
||||||
// TODO: confirm the next largest is > 9 filecoin
|
|
||||||
foundSlashConditions = true
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
return errc
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleMinerFullSlash(t *testkit.TestEnvironment) error {
|
|
||||||
m, err := testkit.PrepareMiner(t)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx := context.Background()
|
|
||||||
myActorAddr, err := m.MinerApi.ActorAddress(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("running miner, full slash: %s", myActorAddr)
|
|
||||||
|
|
||||||
// TODO: wait until we have sealed a deal for a client
|
|
||||||
time.Sleep(240 * time.Second)
|
|
||||||
|
|
||||||
t.RecordMessage("shutting down miner, full slash: %s", myActorAddr)
|
|
||||||
|
|
||||||
ctxt, cancel := context.WithTimeout(ctx, 10*time.Second)
|
|
||||||
defer cancel()
|
|
||||||
err = m.StopFn(ctxt)
|
|
||||||
if err != nil {
|
|
||||||
//return err
|
|
||||||
t.RecordMessage("err from StopFn: %s", err.Error()) // TODO: expect this to be fixed on Lotus
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("shutdown miner, full slash: %s", myActorAddr)
|
|
||||||
|
|
||||||
t.SyncClient.MustPublish(ctx, testkit.SlashedMinerTopic, testkit.SlashedMinerMsg{
|
|
||||||
MinerActorAddr: myActorAddr,
|
|
||||||
})
|
|
||||||
|
|
||||||
t.SyncClient.MustSignalAndWait(ctx, testkit.StateDone, t.TestInstanceCount)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleMinerPartialSlash(t *testkit.TestEnvironment) error {
|
|
||||||
m, err := testkit.PrepareMiner(t)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx := context.Background()
|
|
||||||
myActorAddr, err := m.MinerApi.ActorAddress(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("running miner, partial slash: %s", myActorAddr)
|
|
||||||
|
|
||||||
// TODO: wait until we have sealed a deal for a client
|
|
||||||
time.Sleep(185 * time.Second)
|
|
||||||
|
|
||||||
t.RecordMessage("shutting down miner, partial slash: %s", myActorAddr)
|
|
||||||
|
|
||||||
ctxt, cancel := context.WithTimeout(ctx, 10*time.Second)
|
|
||||||
defer cancel()
|
|
||||||
err = m.StopFn(ctxt)
|
|
||||||
if err != nil {
|
|
||||||
//return err
|
|
||||||
t.RecordMessage("err from StopFn: %s", err.Error()) // TODO: expect this to be fixed on Lotus
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("shutdown miner, partial slash: %s", myActorAddr)
|
|
||||||
|
|
||||||
t.SyncClient.MustPublish(ctx, testkit.SlashedMinerTopic, testkit.SlashedMinerMsg{
|
|
||||||
MinerActorAddr: myActorAddr,
|
|
||||||
})
|
|
||||||
|
|
||||||
time.Sleep(300 * time.Second)
|
|
||||||
|
|
||||||
rm, err := testkit.RestoreMiner(t, m)
|
|
||||||
if err != nil {
|
|
||||||
t.RecordMessage("got err: %s", err.Error())
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
myActorAddr, err = rm.MinerApi.ActorAddress(ctx)
|
|
||||||
if err != nil {
|
|
||||||
t.RecordMessage("got err: %s", err.Error())
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("running miner again, partial slash: %s", myActorAddr)
|
|
||||||
|
|
||||||
time.Sleep(3600 * time.Second)
|
|
||||||
|
|
||||||
//t.SyncClient.MustSignalAndWait(ctx, testkit.StateDone, t.TestInstanceCount)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleClient(t *testkit.TestEnvironment) error {
|
|
||||||
cl, err := testkit.PrepareClient(t)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is a client role
|
|
||||||
t.RecordMessage("running client")
|
|
||||||
|
|
||||||
ctx := context.Background()
|
|
||||||
client := cl.FullApi
|
|
||||||
|
|
||||||
time.Sleep(10 * time.Second)
|
|
||||||
|
|
||||||
// select a miner based on our GroupSeq (client 1 -> miner 1 ; client 2 -> miner 2)
|
|
||||||
// this assumes that all miner instances receive the same sorted MinerAddrs slice
|
|
||||||
minerAddr := cl.MinerAddrs[t.InitContext.GroupSeq-1]
|
|
||||||
if err := client.NetConnect(ctx, minerAddr.MinerNetAddrs); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
t.D().Counter(fmt.Sprintf("send-data-to,miner=%s", minerAddr.MinerActorAddr)).Inc(1)
|
|
||||||
|
|
||||||
t.RecordMessage("selected %s as the miner", minerAddr.MinerActorAddr)
|
|
||||||
|
|
||||||
time.Sleep(2 * time.Second)
|
|
||||||
|
|
||||||
// generate 1800 bytes of random data
|
|
||||||
data := make([]byte, 1800)
|
|
||||||
rand.New(rand.NewSource(time.Now().UnixNano())).Read(data)
|
|
||||||
|
|
||||||
file, err := ioutil.TempFile("/tmp", "data")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer os.Remove(file.Name())
|
|
||||||
|
|
||||||
_, err = file.Write(data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
fcid, err := client.ClientImport(ctx, api.FileRef{Path: file.Name(), IsCAR: false})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
t.RecordMessage("file cid: %s", fcid)
|
|
||||||
|
|
||||||
// start deal
|
|
||||||
t1 := time.Now()
|
|
||||||
fastRetrieval := false
|
|
||||||
deal := testkit.StartDeal(ctx, minerAddr.MinerActorAddr, client, fcid.Root, fastRetrieval)
|
|
||||||
t.RecordMessage("started deal: %s", deal)
|
|
||||||
|
|
||||||
// this sleep is only necessary because deals don't immediately get logged in the dealstore, we should fix this
|
|
||||||
time.Sleep(2 * time.Second)
|
|
||||||
|
|
||||||
t.RecordMessage("waiting for deal to be sealed")
|
|
||||||
testkit.WaitDealSealed(t, ctx, client, deal)
|
|
||||||
t.D().ResettingHistogram("deal.sealed").Update(int64(time.Since(t1)))
|
|
||||||
|
|
||||||
// TODO: wait to stop miner (ideally get a signal, rather than sleep)
|
|
||||||
time.Sleep(180 * time.Second)
|
|
||||||
|
|
||||||
t.RecordMessage("trying to retrieve %s", fcid)
|
|
||||||
info, err := client.ClientGetDealInfo(ctx, *deal)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
carExport := true
|
|
||||||
err = testkit.RetrieveData(t, ctx, client, fcid.Root, &info.PieceCID, carExport, data)
|
|
||||||
if err != nil && strings.Contains(err.Error(), "cannot make retrieval deal for zero bytes") {
|
|
||||||
t.D().Counter("deal.expect-slashing").Inc(1)
|
|
||||||
} else if err != nil {
|
|
||||||
// unknown error => fail test
|
|
||||||
t.RecordFailure(err)
|
|
||||||
|
|
||||||
// send signal to abort test
|
|
||||||
t.SyncClient.MustSignalEntry(ctx, testkit.StateAbortTest)
|
|
||||||
|
|
||||||
t.D().ResettingHistogram("deal.retrieved.err").Update(int64(time.Since(t1)))
|
|
||||||
time.Sleep(10 * time.Second) // wait for metrics to be emitted
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
t.D().ResettingHistogram("deal.retrieved").Update(int64(time.Since(t1)))
|
|
||||||
time.Sleep(10 * time.Second) // wait for metrics to be emitted
|
|
||||||
|
|
||||||
t.SyncClient.MustSignalAndWait(ctx, testkit.StateDone, t.TestInstanceCount) // TODO: not sure about this
|
|
||||||
return nil
|
|
||||||
}
|
|
@ -1,69 +0,0 @@
|
|||||||
package rfwp
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api/v0api"
|
|
||||||
"github.com/filecoin-project/lotus/cli"
|
|
||||||
"github.com/filecoin-project/lotus/testplans/lotus-soup/testkit"
|
|
||||||
tsync "github.com/filecoin-project/lotus/tools/stats/sync"
|
|
||||||
)
|
|
||||||
|
|
||||||
func FetchChainState(t *testkit.TestEnvironment, m *testkit.LotusMiner) error {
|
|
||||||
height := 0
|
|
||||||
headlag := 3
|
|
||||||
|
|
||||||
ctx := context.Background()
|
|
||||||
api := m.FullApi
|
|
||||||
|
|
||||||
tipsetsCh, err := tsync.BufferedTipsetChannel(ctx, &v0api.WrapperV1Full{FullNode: m.FullApi}, abi.ChainEpoch(height), headlag)
|
|
||||||
if err != nil {
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
for tipset := range tipsetsCh {
|
|
||||||
err := func() error {
|
|
||||||
filename := fmt.Sprintf("%s%cchain-state-%d.html", t.TestOutputsPath, os.PathSeparator, tipset.Height())
|
|
||||||
file, err := os.Create(filename)
|
|
||||||
defer file.Close()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
stout, err := api.StateCompute(ctx, tipset.Height(), nil, tipset.Key())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
codeCache := map[address.Address]cid.Cid{}
|
|
||||||
getCode := func(addr address.Address) (cid.Cid, error) {
|
|
||||||
if c, found := codeCache[addr]; found {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
c, err := api.StateGetActor(ctx, addr, tipset.Key())
|
|
||||||
if err != nil {
|
|
||||||
return cid.Cid{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
codeCache[addr] = c.Code
|
|
||||||
return c.Code, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return cli.ComputeStateHTMLTempl(file, tipset, stout, true, getCode)
|
|
||||||
}()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"flag"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
"path"
|
|
||||||
|
|
||||||
"github.com/codeskyblue/go-sh"
|
|
||||||
)
|
|
||||||
|
|
||||||
type jobDefinition struct {
|
|
||||||
runNumber int
|
|
||||||
compositionPath string
|
|
||||||
outputDir string
|
|
||||||
skipStdout bool
|
|
||||||
}
|
|
||||||
|
|
||||||
type jobResult struct {
|
|
||||||
job jobDefinition
|
|
||||||
runError error
|
|
||||||
}
|
|
||||||
|
|
||||||
func runComposition(job jobDefinition) jobResult {
|
|
||||||
outputArchive := path.Join(job.outputDir, "test-outputs.tgz")
|
|
||||||
cmd := sh.Command("testground", "run", "composition", "-f", job.compositionPath, "--collect", "-o", outputArchive)
|
|
||||||
if err := os.MkdirAll(job.outputDir, os.ModePerm); err != nil {
|
|
||||||
return jobResult{runError: fmt.Errorf("unable to make output directory: %w", err)}
|
|
||||||
}
|
|
||||||
|
|
||||||
outPath := path.Join(job.outputDir, "run.out")
|
|
||||||
outFile, err := os.Create(outPath)
|
|
||||||
if err != nil {
|
|
||||||
return jobResult{runError: fmt.Errorf("unable to create output file %s: %w", outPath, err)}
|
|
||||||
}
|
|
||||||
if job.skipStdout {
|
|
||||||
cmd.Stdout = outFile
|
|
||||||
} else {
|
|
||||||
cmd.Stdout = io.MultiWriter(os.Stdout, outFile)
|
|
||||||
}
|
|
||||||
log.Printf("starting test run %d. writing testground client output to %s\n", job.runNumber, outPath)
|
|
||||||
if err = cmd.Run(); err != nil {
|
|
||||||
return jobResult{job: job, runError: err}
|
|
||||||
}
|
|
||||||
return jobResult{job: job}
|
|
||||||
}
|
|
||||||
|
|
||||||
func worker(id int, jobs <-chan jobDefinition, results chan<- jobResult) {
|
|
||||||
log.Printf("started worker %d\n", id)
|
|
||||||
for j := range jobs {
|
|
||||||
log.Printf("worker %d started test run %d\n", id, j.runNumber)
|
|
||||||
results <- runComposition(j)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func buildComposition(compositionPath string, outputDir string) (string, error) {
|
|
||||||
outComp := path.Join(outputDir, "composition.toml")
|
|
||||||
err := sh.Command("cp", compositionPath, outComp).Run()
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
return outComp, sh.Command("testground", "build", "composition", "-w", "-f", outComp).Run()
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
runs := flag.Int("runs", 1, "number of times to run composition")
|
|
||||||
parallelism := flag.Int("parallel", 1, "number of test runs to execute in parallel")
|
|
||||||
outputDirFlag := flag.String("output", "", "path to output directory (will use temp dir if unset)")
|
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
if len(flag.Args()) != 1 {
|
|
||||||
log.Fatal("must provide a single composition file path argument")
|
|
||||||
}
|
|
||||||
|
|
||||||
outdir := *outputDirFlag
|
|
||||||
if outdir == "" {
|
|
||||||
var err error
|
|
||||||
outdir, err = ioutil.TempDir(os.TempDir(), "oni-batch-run-")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if err := os.MkdirAll(outdir, os.ModePerm); err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
compositionPath := flag.Args()[0]
|
|
||||||
|
|
||||||
// first build the composition and write out the artifacts.
|
|
||||||
// we copy to a temp file first to avoid modifying the original
|
|
||||||
log.Printf("building composition %s\n", compositionPath)
|
|
||||||
compositionPath, err := buildComposition(compositionPath, outdir)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
jobs := make(chan jobDefinition, *runs)
|
|
||||||
results := make(chan jobResult, *runs)
|
|
||||||
for w := 1; w <= *parallelism; w++ {
|
|
||||||
go worker(w, jobs, results)
|
|
||||||
}
|
|
||||||
|
|
||||||
for j := 1; j <= *runs; j++ {
|
|
||||||
dir := path.Join(outdir, fmt.Sprintf("run-%d", j))
|
|
||||||
skipStdout := *parallelism != 1
|
|
||||||
jobs <- jobDefinition{runNumber: j, compositionPath: compositionPath, outputDir: dir, skipStdout: skipStdout}
|
|
||||||
}
|
|
||||||
close(jobs)
|
|
||||||
|
|
||||||
for i := 0; i < *runs; i++ {
|
|
||||||
r := <-results
|
|
||||||
if r.runError != nil {
|
|
||||||
log.Printf("error running job %d: %s\n", r.job.runNumber, r.runError)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
)
|
|
||||||
|
|
||||||
func sanityCheck() {
|
|
||||||
enhanceMsg := func(msg string, a ...interface{}) string {
|
|
||||||
return fmt.Sprintf("sanity check: "+msg+"; if running on local:exec, make sure to run `make` from the root of the oni repo", a...)
|
|
||||||
}
|
|
||||||
|
|
||||||
dir := "/var/tmp/filecoin-proof-parameters"
|
|
||||||
stat, err := os.Stat(dir)
|
|
||||||
if os.IsNotExist(err) {
|
|
||||||
panic(enhanceMsg("proofs parameters not available in /var/tmp/filecoin-proof-parameters"))
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
panic(enhanceMsg("failed to stat /var/tmp/filecoin-proof-parameters: %s", err))
|
|
||||||
}
|
|
||||||
|
|
||||||
if !stat.IsDir() {
|
|
||||||
panic(enhanceMsg("/var/tmp/filecoin-proof-parameters is not a directory; aborting"))
|
|
||||||
}
|
|
||||||
|
|
||||||
files, err := os.ReadDir(dir)
|
|
||||||
if err != nil {
|
|
||||||
panic(enhanceMsg("failed list directory /var/tmp/filecoin-proof-parameters: %s", err))
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(files) == 0 {
|
|
||||||
panic(enhanceMsg("no files in /var/tmp/filecoin-proof-parameters"))
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,108 +0,0 @@
|
|||||||
package statemachine
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"sync"
|
|
||||||
)
|
|
||||||
|
|
||||||
// This code has been shamelessly lifted from this blog post:
|
|
||||||
// https://venilnoronha.io/a-simple-state-machine-framework-in-go
|
|
||||||
// Many thanks to the author, Venil Norohnha
|
|
||||||
|
|
||||||
// ErrEventRejected is the error returned when the state machine cannot process
|
|
||||||
// an event in the state that it is in.
|
|
||||||
var ErrEventRejected = errors.New("event rejected")
|
|
||||||
|
|
||||||
const (
|
|
||||||
// Default represents the default state of the system.
|
|
||||||
Default StateType = ""
|
|
||||||
|
|
||||||
// NoOp represents a no-op event.
|
|
||||||
NoOp EventType = "NoOp"
|
|
||||||
)
|
|
||||||
|
|
||||||
// StateType represents an extensible state type in the state machine.
|
|
||||||
type StateType string
|
|
||||||
|
|
||||||
// EventType represents an extensible event type in the state machine.
|
|
||||||
type EventType string
|
|
||||||
|
|
||||||
// EventContext represents the context to be passed to the action implementation.
|
|
||||||
type EventContext interface{}
|
|
||||||
|
|
||||||
// Action represents the action to be executed in a given state.
|
|
||||||
type Action interface {
|
|
||||||
Execute(eventCtx EventContext) EventType
|
|
||||||
}
|
|
||||||
|
|
||||||
// Events represents a mapping of events and states.
|
|
||||||
type Events map[EventType]StateType
|
|
||||||
|
|
||||||
// State binds a state with an action and a set of events it can handle.
|
|
||||||
type State struct {
|
|
||||||
Action Action
|
|
||||||
Events Events
|
|
||||||
}
|
|
||||||
|
|
||||||
// States represents a mapping of states and their implementations.
|
|
||||||
type States map[StateType]State
|
|
||||||
|
|
||||||
// StateMachine represents the state machine.
|
|
||||||
type StateMachine struct {
|
|
||||||
// Previous represents the previous state.
|
|
||||||
Previous StateType
|
|
||||||
|
|
||||||
// Current represents the current state.
|
|
||||||
Current StateType
|
|
||||||
|
|
||||||
// States holds the configuration of states and events handled by the state machine.
|
|
||||||
States States
|
|
||||||
|
|
||||||
// mutex ensures that only 1 event is processed by the state machine at any given time.
|
|
||||||
mutex sync.Mutex
|
|
||||||
}
|
|
||||||
|
|
||||||
// getNextState returns the next state for the event given the machine's current
|
|
||||||
// state, or an error if the event can't be handled in the given state.
|
|
||||||
func (s *StateMachine) getNextState(event EventType) (StateType, error) {
|
|
||||||
if state, ok := s.States[s.Current]; ok {
|
|
||||||
if state.Events != nil {
|
|
||||||
if next, ok := state.Events[event]; ok {
|
|
||||||
return next, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Default, ErrEventRejected
|
|
||||||
}
|
|
||||||
|
|
||||||
// SendEvent sends an event to the state machine.
|
|
||||||
func (s *StateMachine) SendEvent(event EventType, eventCtx EventContext) error {
|
|
||||||
s.mutex.Lock()
|
|
||||||
defer s.mutex.Unlock()
|
|
||||||
|
|
||||||
for {
|
|
||||||
// Determine the next state for the event given the machine's current state.
|
|
||||||
nextState, err := s.getNextState(event)
|
|
||||||
if err != nil {
|
|
||||||
return ErrEventRejected
|
|
||||||
}
|
|
||||||
|
|
||||||
// Identify the state definition for the next state.
|
|
||||||
state, ok := s.States[nextState]
|
|
||||||
if !ok || state.Action == nil {
|
|
||||||
// configuration error
|
|
||||||
}
|
|
||||||
|
|
||||||
// Transition over to the next state.
|
|
||||||
s.Previous = s.Current
|
|
||||||
s.Current = nextState
|
|
||||||
|
|
||||||
// Execute the next state's action and loop over again if the event returned
|
|
||||||
// is not a no-op.
|
|
||||||
nextEvent := state.Action.Execute(eventCtx)
|
|
||||||
if nextEvent == NoOp {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
event = nextEvent
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,128 +0,0 @@
|
|||||||
package statemachine
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
Running StateType = "running"
|
|
||||||
Suspended StateType = "suspended"
|
|
||||||
|
|
||||||
Halt EventType = "halt"
|
|
||||||
Resume EventType = "resume"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Suspendable interface {
|
|
||||||
Halt()
|
|
||||||
Resume()
|
|
||||||
}
|
|
||||||
|
|
||||||
type HaltAction struct{}
|
|
||||||
|
|
||||||
func (a *HaltAction) Execute(ctx EventContext) EventType {
|
|
||||||
s, ok := ctx.(*Suspender)
|
|
||||||
if !ok {
|
|
||||||
fmt.Println("unable to halt, event context is not Suspendable")
|
|
||||||
return NoOp
|
|
||||||
}
|
|
||||||
s.target.Halt()
|
|
||||||
return NoOp
|
|
||||||
}
|
|
||||||
|
|
||||||
type ResumeAction struct{}
|
|
||||||
|
|
||||||
func (a *ResumeAction) Execute(ctx EventContext) EventType {
|
|
||||||
s, ok := ctx.(*Suspender)
|
|
||||||
if !ok {
|
|
||||||
fmt.Println("unable to resume, event context is not Suspendable")
|
|
||||||
return NoOp
|
|
||||||
}
|
|
||||||
s.target.Resume()
|
|
||||||
return NoOp
|
|
||||||
}
|
|
||||||
|
|
||||||
type Suspender struct {
|
|
||||||
StateMachine
|
|
||||||
target Suspendable
|
|
||||||
log LogFn
|
|
||||||
}
|
|
||||||
|
|
||||||
type LogFn func(fmt string, args ...interface{})
|
|
||||||
|
|
||||||
func NewSuspender(target Suspendable, log LogFn) *Suspender {
|
|
||||||
return &Suspender{
|
|
||||||
target: target,
|
|
||||||
log: log,
|
|
||||||
StateMachine: StateMachine{
|
|
||||||
Current: Running,
|
|
||||||
States: States{
|
|
||||||
Running: State{
|
|
||||||
Action: &ResumeAction{},
|
|
||||||
Events: Events{
|
|
||||||
Halt: Suspended,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
Suspended: State{
|
|
||||||
Action: &HaltAction{},
|
|
||||||
Events: Events{
|
|
||||||
Resume: Running,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Suspender) RunEvents(eventSpec string) {
|
|
||||||
s.log("running event spec: %s", eventSpec)
|
|
||||||
for _, et := range parseEventSpec(eventSpec, s.log) {
|
|
||||||
if et.delay != 0 {
|
|
||||||
//s.log("waiting %s", et.delay.String())
|
|
||||||
time.Sleep(et.delay)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if et.event == "" {
|
|
||||||
s.log("ignoring empty event")
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
s.log("sending event %s", et.event)
|
|
||||||
err := s.SendEvent(et.event, s)
|
|
||||||
if err != nil {
|
|
||||||
s.log("error sending event %s: %s", et.event, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type eventTiming struct {
|
|
||||||
delay time.Duration
|
|
||||||
event EventType
|
|
||||||
}
|
|
||||||
|
|
||||||
func parseEventSpec(spec string, log LogFn) []eventTiming {
|
|
||||||
fields := strings.Split(spec, "->")
|
|
||||||
out := make([]eventTiming, 0, len(fields))
|
|
||||||
for _, f := range fields {
|
|
||||||
f = strings.TrimSpace(f)
|
|
||||||
words := strings.Split(f, " ")
|
|
||||||
|
|
||||||
// TODO: try to implement a "waiting" state instead of special casing like this
|
|
||||||
if words[0] == "wait" {
|
|
||||||
if len(words) != 2 {
|
|
||||||
log("expected 'wait' to be followed by duration, e.g. 'wait 30s'. ignoring.")
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
d, err := time.ParseDuration(words[1])
|
|
||||||
if err != nil {
|
|
||||||
log("bad argument for 'wait': %s", err)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
out = append(out, eventTiming{delay: d})
|
|
||||||
} else {
|
|
||||||
out = append(out, eventTiming{event: EventType(words[0])})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return out
|
|
||||||
}
|
|
@ -1,76 +0,0 @@
|
|||||||
package testkit
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
|
||||||
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
|
||||||
"github.com/filecoin-project/lotus/api/v0api"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
|
||||||
tsync "github.com/filecoin-project/lotus/tools/stats/sync"
|
|
||||||
)
|
|
||||||
|
|
||||||
func StartDeal(ctx context.Context, minerActorAddr address.Address, client api.FullNode, fcid cid.Cid, fastRetrieval bool) *cid.Cid {
|
|
||||||
addr, err := client.WalletDefaultAddress(ctx)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
deal, err := client.ClientStartDeal(ctx, &api.StartDealParams{
|
|
||||||
Data: &storagemarket.DataRef{
|
|
||||||
TransferType: storagemarket.TTGraphsync,
|
|
||||||
Root: fcid,
|
|
||||||
},
|
|
||||||
Wallet: addr,
|
|
||||||
Miner: minerActorAddr,
|
|
||||||
EpochPrice: types.NewInt(4000000),
|
|
||||||
MinBlocksDuration: 640000,
|
|
||||||
DealStartEpoch: 200,
|
|
||||||
FastRetrieval: fastRetrieval,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
return deal
|
|
||||||
}
|
|
||||||
|
|
||||||
func WaitDealSealed(t *TestEnvironment, ctx context.Context, client api.FullNode, deal *cid.Cid) {
|
|
||||||
height := 0
|
|
||||||
headlag := 3
|
|
||||||
|
|
||||||
cctx, cancel := context.WithCancel(ctx)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
tipsetsCh, err := tsync.BufferedTipsetChannel(cctx, &v0api.WrapperV1Full{FullNode: client}, abi.ChainEpoch(height), headlag)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
for tipset := range tipsetsCh {
|
|
||||||
t.RecordMessage("got tipset: height %d", tipset.Height())
|
|
||||||
|
|
||||||
di, err := client.ClientGetDealInfo(ctx, *deal)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
switch di.State {
|
|
||||||
case storagemarket.StorageDealProposalRejected:
|
|
||||||
panic("deal rejected")
|
|
||||||
case storagemarket.StorageDealFailing:
|
|
||||||
panic("deal failed")
|
|
||||||
case storagemarket.StorageDealError:
|
|
||||||
panic(fmt.Sprintf("deal errored %s", di.Message))
|
|
||||||
case storagemarket.StorageDealActive:
|
|
||||||
t.RecordMessage("completed deal: %s", di)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("deal state: %s", storagemarket.DealStates[di.State])
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
package testkit
|
|
||||||
|
|
||||||
import "fmt"
|
|
||||||
|
|
||||||
type RoleName = string
|
|
||||||
|
|
||||||
var DefaultRoles = map[RoleName]func(*TestEnvironment) error{
|
|
||||||
"bootstrapper": func(t *TestEnvironment) error {
|
|
||||||
b, err := PrepareBootstrapper(t)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return b.RunDefault()
|
|
||||||
},
|
|
||||||
"miner": func(t *TestEnvironment) error {
|
|
||||||
m, err := PrepareMiner(t)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return m.RunDefault()
|
|
||||||
},
|
|
||||||
"client": func(t *TestEnvironment) error {
|
|
||||||
c, err := PrepareClient(t)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return c.RunDefault()
|
|
||||||
},
|
|
||||||
"drand": func(t *TestEnvironment) error {
|
|
||||||
d, err := PrepareDrandInstance(t)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return d.RunDefault()
|
|
||||||
},
|
|
||||||
"pubsub-tracer": func(t *TestEnvironment) error {
|
|
||||||
tr, err := PreparePubsubTracer(t)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return tr.RunDefault()
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// HandleDefaultRole handles a role by running its default behaviour.
|
|
||||||
//
|
|
||||||
// This function is suitable to forward to when a test case doesn't need to
|
|
||||||
// explicitly handle/alter a role.
|
|
||||||
func HandleDefaultRole(t *TestEnvironment) error {
|
|
||||||
f, ok := DefaultRoles[t.Role]
|
|
||||||
if !ok {
|
|
||||||
panic(fmt.Sprintf("unrecognized role: %s", t.Role))
|
|
||||||
}
|
|
||||||
return f(t)
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
package testkit
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/libp2p/go-libp2p/core/peer"
|
|
||||||
ma "github.com/multiformats/go-multiaddr"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/node"
|
|
||||||
"github.com/filecoin-project/lotus/node/config"
|
|
||||||
"github.com/filecoin-project/lotus/node/modules"
|
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
|
||||||
"github.com/filecoin-project/lotus/node/modules/lp2p"
|
|
||||||
"github.com/filecoin-project/lotus/node/repo"
|
|
||||||
)
|
|
||||||
|
|
||||||
func withGenesis(gb []byte) node.Option {
|
|
||||||
return node.Override(new(modules.Genesis), modules.LoadGenesis(gb))
|
|
||||||
}
|
|
||||||
|
|
||||||
func withBootstrapper(ab []byte) node.Option {
|
|
||||||
return node.Override(new(dtypes.BootstrapPeers),
|
|
||||||
func() (dtypes.BootstrapPeers, error) {
|
|
||||||
if ab == nil {
|
|
||||||
return dtypes.BootstrapPeers{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
a, err := ma.NewMultiaddrBytes(ab)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
ai, err := peer.AddrInfoFromP2pAddr(a)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return dtypes.BootstrapPeers{*ai}, nil
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func withPubsubConfig(bootstrapper bool, pubsubTracer string) node.Option {
|
|
||||||
return node.Override(new(*config.Pubsub), func() *config.Pubsub {
|
|
||||||
return &config.Pubsub{
|
|
||||||
Bootstrapper: bootstrapper,
|
|
||||||
RemoteTracer: pubsubTracer,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func withListenAddress(ip string) node.Option {
|
|
||||||
addrs := []string{fmt.Sprintf("/ip4/%s/tcp/0", ip)}
|
|
||||||
return node.Override(node.StartListeningKey, lp2p.StartListening(addrs))
|
|
||||||
}
|
|
||||||
|
|
||||||
func withMinerListenAddress(ip string) node.Option {
|
|
||||||
addrs := []string{fmt.Sprintf("/ip4/%s/tcp/0", ip)}
|
|
||||||
return node.Override(node.StartListeningKey, lp2p.StartListening(addrs))
|
|
||||||
}
|
|
||||||
|
|
||||||
func withApiEndpoint(addr string) node.Option {
|
|
||||||
return node.Override(node.SetApiEndpointKey, func(lr repo.LockedRepo) error {
|
|
||||||
apima, err := ma.NewMultiaddr(addr)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return lr.SetAPIEndpoint(apima)
|
|
||||||
})
|
|
||||||
}
|
|
@ -1,92 +0,0 @@
|
|||||||
package testkit
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/testground/sdk-go/network"
|
|
||||||
"github.com/testground/sdk-go/sync"
|
|
||||||
)
|
|
||||||
|
|
||||||
func ApplyNetworkParameters(t *TestEnvironment) {
|
|
||||||
if !t.TestSidecar {
|
|
||||||
t.RecordMessage("no test sidecar, skipping network config")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
ls := network.LinkShape{}
|
|
||||||
|
|
||||||
if t.IsParamSet("latency_range") {
|
|
||||||
r := t.DurationRangeParam("latency_range")
|
|
||||||
ls.Latency = r.ChooseRandom()
|
|
||||||
t.D().RecordPoint("latency_ms", float64(ls.Latency.Milliseconds()))
|
|
||||||
}
|
|
||||||
|
|
||||||
if t.IsParamSet("jitter_range") {
|
|
||||||
r := t.DurationRangeParam("jitter_range")
|
|
||||||
ls.Jitter = r.ChooseRandom()
|
|
||||||
t.D().RecordPoint("jitter_ms", float64(ls.Jitter.Milliseconds()))
|
|
||||||
}
|
|
||||||
|
|
||||||
if t.IsParamSet("loss_range") {
|
|
||||||
r := t.FloatRangeParam("loss_range")
|
|
||||||
ls.Loss = r.ChooseRandom()
|
|
||||||
t.D().RecordPoint("packet_loss", float64(ls.Loss))
|
|
||||||
}
|
|
||||||
|
|
||||||
if t.IsParamSet("corrupt_range") {
|
|
||||||
r := t.FloatRangeParam("corrupt_range")
|
|
||||||
ls.Corrupt = r.ChooseRandom()
|
|
||||||
t.D().RecordPoint("corrupt_packet_probability", float64(ls.Corrupt))
|
|
||||||
}
|
|
||||||
|
|
||||||
if t.IsParamSet("corrupt_corr_range") {
|
|
||||||
r := t.FloatRangeParam("corrupt_corr_range")
|
|
||||||
ls.CorruptCorr = r.ChooseRandom()
|
|
||||||
t.D().RecordPoint("corrupt_packet_correlation", float64(ls.CorruptCorr))
|
|
||||||
}
|
|
||||||
|
|
||||||
if t.IsParamSet("reorder_range") {
|
|
||||||
r := t.FloatRangeParam("reorder_range")
|
|
||||||
ls.Reorder = r.ChooseRandom()
|
|
||||||
t.D().RecordPoint("reordered_packet_probability", float64(ls.Reorder))
|
|
||||||
}
|
|
||||||
|
|
||||||
if t.IsParamSet("reorder_corr_range") {
|
|
||||||
r := t.FloatRangeParam("reorder_corr_range")
|
|
||||||
ls.ReorderCorr = r.ChooseRandom()
|
|
||||||
t.D().RecordPoint("reordered_packet_correlation", float64(ls.ReorderCorr))
|
|
||||||
}
|
|
||||||
|
|
||||||
if t.IsParamSet("duplicate_range") {
|
|
||||||
r := t.FloatRangeParam("duplicate_range")
|
|
||||||
ls.Duplicate = r.ChooseRandom()
|
|
||||||
t.D().RecordPoint("duplicate_packet_probability", float64(ls.Duplicate))
|
|
||||||
}
|
|
||||||
|
|
||||||
if t.IsParamSet("duplicate_corr_range") {
|
|
||||||
r := t.FloatRangeParam("duplicate_corr_range")
|
|
||||||
ls.DuplicateCorr = r.ChooseRandom()
|
|
||||||
t.D().RecordPoint("duplicate_packet_correlation", float64(ls.DuplicateCorr))
|
|
||||||
}
|
|
||||||
|
|
||||||
if t.IsParamSet("bandwidth") {
|
|
||||||
ls.Bandwidth = t.SizeParam("bandwidth")
|
|
||||||
t.D().RecordPoint("bandwidth_bytes", float64(ls.Bandwidth))
|
|
||||||
}
|
|
||||||
|
|
||||||
t.NetClient.MustConfigureNetwork(ctx, &network.Config{
|
|
||||||
Network: "default",
|
|
||||||
Enable: true,
|
|
||||||
Default: ls,
|
|
||||||
CallbackState: sync.State(fmt.Sprintf("latency-configured-%s", t.TestGroupID)),
|
|
||||||
CallbackTarget: t.TestGroupInstanceCount,
|
|
||||||
RoutingPolicy: network.AllowAll,
|
|
||||||
})
|
|
||||||
|
|
||||||
t.DumpJSON("network-link-shape.json", ls)
|
|
||||||
}
|
|
@ -1,288 +0,0 @@
|
|||||||
package testkit
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"net/http"
|
|
||||||
"os"
|
|
||||||
"sort"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
influxdb "github.com/kpacha/opencensus-influxdb"
|
|
||||||
ma "github.com/multiformats/go-multiaddr"
|
|
||||||
manet "github.com/multiformats/go-multiaddr/net"
|
|
||||||
"go.opencensus.io/stats"
|
|
||||||
"go.opencensus.io/stats/view"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
|
||||||
"github.com/filecoin-project/lotus/chain/beacon"
|
|
||||||
"github.com/filecoin-project/lotus/chain/wallet/key"
|
|
||||||
"github.com/filecoin-project/lotus/metrics"
|
|
||||||
"github.com/filecoin-project/lotus/miner"
|
|
||||||
"github.com/filecoin-project/lotus/node"
|
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
|
||||||
modtest "github.com/filecoin-project/lotus/node/modules/testing"
|
|
||||||
tinflux "github.com/filecoin-project/lotus/tools/stats/influx"
|
|
||||||
tipldstore "github.com/filecoin-project/lotus/tools/stats/ipldstore"
|
|
||||||
tpoints "github.com/filecoin-project/lotus/tools/stats/points"
|
|
||||||
tsync "github.com/filecoin-project/lotus/tools/stats/sync"
|
|
||||||
)
|
|
||||||
|
|
||||||
var PrepareNodeTimeout = 3 * time.Minute
|
|
||||||
|
|
||||||
type LotusNode struct {
|
|
||||||
FullApi api.FullNode
|
|
||||||
MinerApi api.StorageMiner
|
|
||||||
StopFn node.StopFunc
|
|
||||||
Wallet *key.Key
|
|
||||||
MineOne func(context.Context, miner.MineReq) error
|
|
||||||
}
|
|
||||||
|
|
||||||
func (n *LotusNode) setWallet(ctx context.Context, walletKey *key.Key) error {
|
|
||||||
_, err := n.FullApi.WalletImport(ctx, &walletKey.KeyInfo)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = n.FullApi.WalletSetDefault(ctx, walletKey.Address)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
n.Wallet = walletKey
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func WaitForBalances(t *TestEnvironment, ctx context.Context, nodes int) ([]*InitialBalanceMsg, error) {
|
|
||||||
ch := make(chan *InitialBalanceMsg)
|
|
||||||
sub := t.SyncClient.MustSubscribe(ctx, BalanceTopic, ch)
|
|
||||||
|
|
||||||
balances := make([]*InitialBalanceMsg, 0, nodes)
|
|
||||||
for i := 0; i < nodes; i++ {
|
|
||||||
select {
|
|
||||||
case m := <-ch:
|
|
||||||
balances = append(balances, m)
|
|
||||||
case err := <-sub.Done():
|
|
||||||
return nil, fmt.Errorf("got error while waiting for balances: %w", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return balances, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func CollectPreseals(t *TestEnvironment, ctx context.Context, miners int) ([]*PresealMsg, error) {
|
|
||||||
ch := make(chan *PresealMsg)
|
|
||||||
sub := t.SyncClient.MustSubscribe(ctx, PresealTopic, ch)
|
|
||||||
|
|
||||||
preseals := make([]*PresealMsg, 0, miners)
|
|
||||||
for i := 0; i < miners; i++ {
|
|
||||||
select {
|
|
||||||
case m := <-ch:
|
|
||||||
preseals = append(preseals, m)
|
|
||||||
case err := <-sub.Done():
|
|
||||||
return nil, fmt.Errorf("got error while waiting for preseals: %w", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sort.Slice(preseals, func(i, j int) bool {
|
|
||||||
return preseals[i].Seqno < preseals[j].Seqno
|
|
||||||
})
|
|
||||||
|
|
||||||
return preseals, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func WaitForGenesis(t *TestEnvironment, ctx context.Context) (*GenesisMsg, error) {
|
|
||||||
genesisCh := make(chan *GenesisMsg)
|
|
||||||
sub := t.SyncClient.MustSubscribe(ctx, GenesisTopic, genesisCh)
|
|
||||||
|
|
||||||
select {
|
|
||||||
case genesisMsg := <-genesisCh:
|
|
||||||
return genesisMsg, nil
|
|
||||||
case err := <-sub.Done():
|
|
||||||
return nil, fmt.Errorf("error while waiting for genesis msg: %w", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func CollectMinerAddrs(t *TestEnvironment, ctx context.Context, miners int) ([]MinerAddressesMsg, error) {
|
|
||||||
ch := make(chan MinerAddressesMsg)
|
|
||||||
sub := t.SyncClient.MustSubscribe(ctx, MinersAddrsTopic, ch)
|
|
||||||
|
|
||||||
addrs := make([]MinerAddressesMsg, 0, miners)
|
|
||||||
for i := 0; i < miners; i++ {
|
|
||||||
select {
|
|
||||||
case a := <-ch:
|
|
||||||
addrs = append(addrs, a)
|
|
||||||
case err := <-sub.Done():
|
|
||||||
return nil, fmt.Errorf("got error while waiting for miners addrs: %w", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return addrs, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func CollectClientAddrs(t *TestEnvironment, ctx context.Context, clients int) ([]*ClientAddressesMsg, error) {
|
|
||||||
ch := make(chan *ClientAddressesMsg)
|
|
||||||
sub := t.SyncClient.MustSubscribe(ctx, ClientsAddrsTopic, ch)
|
|
||||||
|
|
||||||
addrs := make([]*ClientAddressesMsg, 0, clients)
|
|
||||||
for i := 0; i < clients; i++ {
|
|
||||||
select {
|
|
||||||
case a := <-ch:
|
|
||||||
addrs = append(addrs, a)
|
|
||||||
case err := <-sub.Done():
|
|
||||||
return nil, fmt.Errorf("got error while waiting for clients addrs: %w", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return addrs, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetPubsubTracerMaddr(ctx context.Context, t *TestEnvironment) (string, error) {
|
|
||||||
if !t.BooleanParam("enable_pubsub_tracer") {
|
|
||||||
return "", nil
|
|
||||||
}
|
|
||||||
|
|
||||||
ch := make(chan *PubsubTracerMsg)
|
|
||||||
sub := t.SyncClient.MustSubscribe(ctx, PubsubTracerTopic, ch)
|
|
||||||
|
|
||||||
select {
|
|
||||||
case m := <-ch:
|
|
||||||
return m.Multiaddr, nil
|
|
||||||
case err := <-sub.Done():
|
|
||||||
return "", fmt.Errorf("got error while waiting for pubsub tracer config: %w", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetRandomBeaconOpts(ctx context.Context, t *TestEnvironment) (node.Option, error) {
|
|
||||||
beaconType := t.StringParam("random_beacon_type")
|
|
||||||
switch beaconType {
|
|
||||||
case "external-drand":
|
|
||||||
noop := func(settings *node.Settings) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return noop, nil
|
|
||||||
|
|
||||||
case "local-drand":
|
|
||||||
cfg, err := waitForDrandConfig(ctx, t.SyncClient)
|
|
||||||
if err != nil {
|
|
||||||
t.RecordMessage("error getting drand config: %w", err)
|
|
||||||
return nil, err
|
|
||||||
|
|
||||||
}
|
|
||||||
t.RecordMessage("setting drand config: %v", cfg)
|
|
||||||
return node.Options(
|
|
||||||
node.Override(new(dtypes.DrandConfig), cfg.Config),
|
|
||||||
node.Override(new(dtypes.DrandBootstrap), cfg.GossipBootstrap),
|
|
||||||
), nil
|
|
||||||
|
|
||||||
case "mock":
|
|
||||||
return node.Options(
|
|
||||||
node.Override(new(beacon.RandomBeacon), modtest.RandomBeacon),
|
|
||||||
node.Override(new(dtypes.DrandConfig), dtypes.DrandConfig{
|
|
||||||
ChainInfoJSON: "{\"Hash\":\"wtf\"}",
|
|
||||||
}),
|
|
||||||
node.Override(new(dtypes.DrandBootstrap), dtypes.DrandBootstrap{}),
|
|
||||||
), nil
|
|
||||||
|
|
||||||
default:
|
|
||||||
return nil, fmt.Errorf("unknown random_beacon_type: %s", beaconType)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func startServer(endpoint ma.Multiaddr, srv *http.Server) (listenAddr string, err error) {
|
|
||||||
lst, err := manet.Listen(endpoint)
|
|
||||||
if err != nil {
|
|
||||||
return "", fmt.Errorf("could not listen: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
_ = srv.Serve(manet.NetListener(lst))
|
|
||||||
}()
|
|
||||||
|
|
||||||
return lst.Addr().String(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func registerAndExportMetrics(instanceName string) {
|
|
||||||
// Register all Lotus metric views
|
|
||||||
err := view.Register(metrics.DefaultViews...)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the metric to one so it is published to the exporter
|
|
||||||
stats.Record(context.Background(), metrics.LotusInfo.M(1))
|
|
||||||
|
|
||||||
// Register our custom exporter to opencensus
|
|
||||||
e, err := influxdb.NewExporter(context.Background(), influxdb.Options{
|
|
||||||
Database: "testground",
|
|
||||||
Address: os.Getenv("INFLUXDB_URL"),
|
|
||||||
Username: "",
|
|
||||||
Password: "",
|
|
||||||
InstanceName: instanceName,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
view.RegisterExporter(e)
|
|
||||||
view.SetReportingPeriod(5 * time.Second)
|
|
||||||
}
|
|
||||||
|
|
||||||
func collectStats(t *TestEnvironment, ctx context.Context, api api.FullNode) error {
|
|
||||||
t.RecordMessage("collecting blockchain stats")
|
|
||||||
|
|
||||||
influxAddr := os.Getenv("INFLUXDB_URL")
|
|
||||||
influxUser := ""
|
|
||||||
influxPass := ""
|
|
||||||
influxDb := "testground"
|
|
||||||
|
|
||||||
influxClient, err := tinflux.NewClient(influxAddr, influxUser, influxPass)
|
|
||||||
if err != nil {
|
|
||||||
t.RecordMessage(err.Error())
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
height := int64(0)
|
|
||||||
headlag := 1
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
time.Sleep(15 * time.Second)
|
|
||||||
t.RecordMessage("calling tstats.Collect")
|
|
||||||
|
|
||||||
store, err := tipldstore.NewApiIpldStore(ctx, api, 1024)
|
|
||||||
if err != nil {
|
|
||||||
t.RecordMessage(err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
collector, err := tpoints.NewChainPointCollector(ctx, store, api)
|
|
||||||
if err != nil {
|
|
||||||
t.RecordMessage(err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
tipsets, err := tsync.BufferedTipsetChannel(ctx, api, abi.ChainEpoch(height), headlag)
|
|
||||||
if err != nil {
|
|
||||||
t.RecordMessage(err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
wq := tinflux.NewWriteQueue(ctx, influxClient)
|
|
||||||
defer wq.Close()
|
|
||||||
|
|
||||||
for tipset := range tipsets {
|
|
||||||
if nb, err := collector.Collect(ctx, tipset); err != nil {
|
|
||||||
t.RecordMessage(err.Error())
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
nb.SetDatabase(influxDb)
|
|
||||||
wq.AddBatch(nb)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}()
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
@ -1,108 +0,0 @@
|
|||||||
package testkit
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"context"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
files "github.com/ipfs/go-ipfs-files"
|
|
||||||
ipld "github.com/ipfs/go-ipld-format"
|
|
||||||
dag "github.com/ipfs/go-merkledag"
|
|
||||||
dstest "github.com/ipfs/go-merkledag/test"
|
|
||||||
unixfile "github.com/ipfs/go-unixfs/file"
|
|
||||||
"github.com/ipld/go-car"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
|
||||||
"github.com/filecoin-project/lotus/api/v0api"
|
|
||||||
)
|
|
||||||
|
|
||||||
func RetrieveData(t *TestEnvironment, ctx context.Context, client api.FullNode, fcid cid.Cid, _ *cid.Cid, carExport bool, data []byte) error {
|
|
||||||
t1 := time.Now()
|
|
||||||
offers, err := client.ClientFindData(ctx, fcid, nil)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
for _, o := range offers {
|
|
||||||
t.D().Counter(fmt.Sprintf("find-data.offer,miner=%s", o.Miner)).Inc(1)
|
|
||||||
}
|
|
||||||
t.D().ResettingHistogram("find-data").Update(int64(time.Since(t1)))
|
|
||||||
|
|
||||||
if len(offers) < 1 {
|
|
||||||
panic("no offers")
|
|
||||||
}
|
|
||||||
|
|
||||||
rpath, err := ioutil.TempDir("", "lotus-retrieve-test-")
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
defer os.RemoveAll(rpath)
|
|
||||||
|
|
||||||
caddr, err := client.WalletDefaultAddress(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
ref := &api.FileRef{
|
|
||||||
Path: filepath.Join(rpath, "ret"),
|
|
||||||
IsCAR: carExport,
|
|
||||||
}
|
|
||||||
t1 = time.Now()
|
|
||||||
err = (&v0api.WrapperV1Full{FullNode: client}).ClientRetrieve(ctx, v0api.OfferOrder(offers[0], caddr), ref)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
t.D().ResettingHistogram("retrieve-data").Update(int64(time.Since(t1)))
|
|
||||||
|
|
||||||
rdata, err := ioutil.ReadFile(filepath.Join(rpath, "ret"))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if carExport {
|
|
||||||
rdata = ExtractCarData(ctx, rdata, rpath)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !bytes.Equal(rdata, data) {
|
|
||||||
return errors.New("wrong data retrieved")
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("retrieved successfully")
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func ExtractCarData(ctx context.Context, rdata []byte, rpath string) []byte {
|
|
||||||
bserv := dstest.Bserv()
|
|
||||||
ch, err := car.LoadCar(ctx, bserv.Blockstore(), bytes.NewReader(rdata))
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
b, err := bserv.GetBlock(ctx, ch.Roots[0])
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
nd, err := ipld.Decode(b)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
dserv := dag.NewDAGService(bserv)
|
|
||||||
fil, err := unixfile.NewUnixfsFile(ctx, dserv, nd)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
outPath := filepath.Join(rpath, "retLoadedCAR")
|
|
||||||
if err := files.WriteTo(fil, outPath); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
rdata, err = ioutil.ReadFile(outPath)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
return rdata
|
|
||||||
}
|
|
@ -1,203 +0,0 @@
|
|||||||
package testkit
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
mbig "math/big"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/google/uuid"
|
|
||||||
"github.com/libp2p/go-libp2p/core/peer"
|
|
||||||
ma "github.com/multiformats/go-multiaddr"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/build"
|
|
||||||
"github.com/filecoin-project/lotus/chain/gen"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
|
||||||
"github.com/filecoin-project/lotus/genesis"
|
|
||||||
"github.com/filecoin-project/lotus/node"
|
|
||||||
"github.com/filecoin-project/lotus/node/modules"
|
|
||||||
modtest "github.com/filecoin-project/lotus/node/modules/testing"
|
|
||||||
"github.com/filecoin-project/lotus/node/repo"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Bootstrapper is a special kind of process that produces a genesis block with
|
|
||||||
// the initial wallet balances and preseals for all enlisted miners and clients.
|
|
||||||
type Bootstrapper struct {
|
|
||||||
*LotusNode
|
|
||||||
|
|
||||||
t *TestEnvironment
|
|
||||||
}
|
|
||||||
|
|
||||||
func PrepareBootstrapper(t *TestEnvironment) (*Bootstrapper, error) {
|
|
||||||
var (
|
|
||||||
clients = t.IntParam("clients")
|
|
||||||
miners = t.IntParam("miners")
|
|
||||||
nodes = clients + miners
|
|
||||||
)
|
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), PrepareNodeTimeout)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
pubsubTracerMaddr, err := GetPubsubTracerMaddr(ctx, t)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
randomBeaconOpt, err := GetRandomBeaconOpts(ctx, t)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// the first duty of the boostrapper is to construct the genesis block
|
|
||||||
// first collect all client and miner balances to assign initial funds
|
|
||||||
balances, err := WaitForBalances(t, ctx, nodes)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
totalBalance := big.Zero()
|
|
||||||
for _, b := range balances {
|
|
||||||
totalBalance = big.Add(filToAttoFil(b.Balance), totalBalance)
|
|
||||||
}
|
|
||||||
|
|
||||||
totalBalanceFil := attoFilToFil(totalBalance)
|
|
||||||
t.RecordMessage("TOTAL BALANCE: %s AttoFIL (%s FIL)", totalBalance, totalBalanceFil)
|
|
||||||
if max := types.TotalFilecoinInt; totalBalanceFil.GreaterThanEqual(max) {
|
|
||||||
panic(fmt.Sprintf("total sum of balances is greater than max Filecoin ever; sum=%s, max=%s", totalBalance, max))
|
|
||||||
}
|
|
||||||
|
|
||||||
// then collect all preseals from miners
|
|
||||||
preseals, err := CollectPreseals(t, ctx, miners)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// now construct the genesis block
|
|
||||||
var genesisActors []genesis.Actor
|
|
||||||
var genesisMiners []genesis.Miner
|
|
||||||
|
|
||||||
for _, bm := range balances {
|
|
||||||
balance := filToAttoFil(bm.Balance)
|
|
||||||
t.RecordMessage("balance assigned to actor %s: %s AttoFIL", bm.Addr, balance)
|
|
||||||
genesisActors = append(genesisActors,
|
|
||||||
genesis.Actor{
|
|
||||||
Type: genesis.TAccount,
|
|
||||||
Balance: balance,
|
|
||||||
Meta: (&genesis.AccountMeta{Owner: bm.Addr}).ActorMeta(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, pm := range preseals {
|
|
||||||
genesisMiners = append(genesisMiners, pm.Miner)
|
|
||||||
}
|
|
||||||
|
|
||||||
genesisTemplate := genesis.Template{
|
|
||||||
Accounts: genesisActors,
|
|
||||||
Miners: genesisMiners,
|
|
||||||
Timestamp: uint64(time.Now().Unix()) - uint64(t.IntParam("genesis_timestamp_offset")),
|
|
||||||
VerifregRootKey: gen.DefaultVerifregRootkeyActor,
|
|
||||||
RemainderAccount: gen.DefaultRemainderAccountActor,
|
|
||||||
NetworkName: "testground-local-" + uuid.New().String(),
|
|
||||||
}
|
|
||||||
|
|
||||||
// dump the genesis block
|
|
||||||
// var jsonBuf bytes.Buffer
|
|
||||||
// jsonEnc := json.NewEncoder(&jsonBuf)
|
|
||||||
// err := jsonEnc.Encode(genesisTemplate)
|
|
||||||
// if err != nil {
|
|
||||||
// panic(err)
|
|
||||||
// }
|
|
||||||
// runenv.RecordMessage(fmt.Sprintf("Genesis template: %s", string(jsonBuf.Bytes())))
|
|
||||||
|
|
||||||
// this is horrendously disgusting, we use this contraption to side effect the construction
|
|
||||||
// of the genesis block in the buffer -- yes, a side effect of dependency injection.
|
|
||||||
// I remember when software was straightforward...
|
|
||||||
var genesisBuffer bytes.Buffer
|
|
||||||
|
|
||||||
bootstrapperIP := t.NetClient.MustGetDataNetworkIP().String()
|
|
||||||
|
|
||||||
n := &LotusNode{}
|
|
||||||
r := repo.NewMemory(nil)
|
|
||||||
stop, err := node.New(context.Background(),
|
|
||||||
node.FullAPI(&n.FullApi),
|
|
||||||
node.Base(),
|
|
||||||
node.Repo(r),
|
|
||||||
node.Override(new(modules.Genesis), modtest.MakeGenesisMem(&genesisBuffer, genesisTemplate)),
|
|
||||||
withApiEndpoint(fmt.Sprintf("/ip4/0.0.0.0/tcp/%s", t.PortNumber("node_rpc", "0"))),
|
|
||||||
withListenAddress(bootstrapperIP),
|
|
||||||
withBootstrapper(nil),
|
|
||||||
withPubsubConfig(true, pubsubTracerMaddr),
|
|
||||||
randomBeaconOpt,
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
n.StopFn = stop
|
|
||||||
|
|
||||||
var bootstrapperAddr ma.Multiaddr
|
|
||||||
|
|
||||||
bootstrapperAddrs, err := n.FullApi.NetAddrsListen(ctx)
|
|
||||||
if err != nil {
|
|
||||||
stop(context.TODO())
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
for _, a := range bootstrapperAddrs.Addrs {
|
|
||||||
ip, err := a.ValueForProtocol(ma.P_IP4)
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if ip != bootstrapperIP {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
addrs, err := peer.AddrInfoToP2pAddrs(&peer.AddrInfo{
|
|
||||||
ID: bootstrapperAddrs.ID,
|
|
||||||
Addrs: []ma.Multiaddr{a},
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
bootstrapperAddr = addrs[0]
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if bootstrapperAddr == nil {
|
|
||||||
panic("failed to determine bootstrapper address")
|
|
||||||
}
|
|
||||||
|
|
||||||
genesisMsg := &GenesisMsg{
|
|
||||||
Genesis: genesisBuffer.Bytes(),
|
|
||||||
Bootstrapper: bootstrapperAddr.Bytes(),
|
|
||||||
}
|
|
||||||
t.SyncClient.MustPublish(ctx, GenesisTopic, genesisMsg)
|
|
||||||
|
|
||||||
t.RecordMessage("waiting for all nodes to be ready")
|
|
||||||
t.SyncClient.MustSignalAndWait(ctx, StateReady, t.TestInstanceCount)
|
|
||||||
|
|
||||||
return &Bootstrapper{n, t}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// RunDefault runs a default bootstrapper.
|
|
||||||
func (b *Bootstrapper) RunDefault() error {
|
|
||||||
b.t.RecordMessage("running bootstrapper")
|
|
||||||
ctx := context.Background()
|
|
||||||
b.t.SyncClient.MustSignalAndWait(ctx, StateDone, b.t.TestInstanceCount)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// filToAttoFil converts a fractional filecoin value into AttoFIL, rounding if necessary
|
|
||||||
func filToAttoFil(f float64) big.Int {
|
|
||||||
a := mbig.NewFloat(f)
|
|
||||||
a.Mul(a, mbig.NewFloat(float64(build.FilecoinPrecision)))
|
|
||||||
i, _ := a.Int(nil)
|
|
||||||
return big.Int{Int: i}
|
|
||||||
}
|
|
||||||
|
|
||||||
func attoFilToFil(atto big.Int) big.Int {
|
|
||||||
i := big.NewInt(0)
|
|
||||||
i.Add(i.Int, atto.Int)
|
|
||||||
i.Div(i.Int, big.NewIntUnsigned(build.FilecoinPrecision).Int)
|
|
||||||
return i
|
|
||||||
}
|
|
@ -1,199 +0,0 @@
|
|||||||
package testkit
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"net/http"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"contrib.go.opencensus.io/exporter/prometheus"
|
|
||||||
"github.com/gorilla/mux"
|
|
||||||
"github.com/hashicorp/go-multierror"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-jsonrpc"
|
|
||||||
"github.com/filecoin-project/go-jsonrpc/auth"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
|
||||||
"github.com/filecoin-project/lotus/chain/wallet/key"
|
|
||||||
"github.com/filecoin-project/lotus/node"
|
|
||||||
"github.com/filecoin-project/lotus/node/repo"
|
|
||||||
)
|
|
||||||
|
|
||||||
type LotusClient struct {
|
|
||||||
*LotusNode
|
|
||||||
|
|
||||||
t *TestEnvironment
|
|
||||||
MinerAddrs []MinerAddressesMsg
|
|
||||||
}
|
|
||||||
|
|
||||||
func PrepareClient(t *TestEnvironment) (*LotusClient, error) {
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), PrepareNodeTimeout)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
ApplyNetworkParameters(t)
|
|
||||||
|
|
||||||
pubsubTracer, err := GetPubsubTracerMaddr(ctx, t)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
drandOpt, err := GetRandomBeaconOpts(ctx, t)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// first create a wallet
|
|
||||||
walletKey, err := key.GenerateKey(types.KTBLS)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// publish the account ID/balance
|
|
||||||
balance := t.FloatParam("balance")
|
|
||||||
balanceMsg := &InitialBalanceMsg{Addr: walletKey.Address, Balance: balance}
|
|
||||||
t.SyncClient.Publish(ctx, BalanceTopic, balanceMsg)
|
|
||||||
|
|
||||||
// then collect the genesis block and bootstrapper address
|
|
||||||
genesisMsg, err := WaitForGenesis(t, ctx)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
clientIP := t.NetClient.MustGetDataNetworkIP().String()
|
|
||||||
|
|
||||||
nodeRepo := repo.NewMemory(nil)
|
|
||||||
|
|
||||||
// create the node
|
|
||||||
n := &LotusNode{}
|
|
||||||
stop, err := node.New(context.Background(),
|
|
||||||
node.FullAPI(&n.FullApi),
|
|
||||||
node.Base(),
|
|
||||||
node.Repo(nodeRepo),
|
|
||||||
withApiEndpoint(fmt.Sprintf("/ip4/0.0.0.0/tcp/%s", t.PortNumber("node_rpc", "0"))),
|
|
||||||
withGenesis(genesisMsg.Genesis),
|
|
||||||
withListenAddress(clientIP),
|
|
||||||
withBootstrapper(genesisMsg.Bootstrapper),
|
|
||||||
withPubsubConfig(false, pubsubTracer),
|
|
||||||
drandOpt,
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// set the wallet
|
|
||||||
err = n.setWallet(ctx, walletKey)
|
|
||||||
if err != nil {
|
|
||||||
_ = stop(context.TODO())
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
fullSrv, err := startFullNodeAPIServer(t, nodeRepo, n.FullApi)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
n.StopFn = func(ctx context.Context) error {
|
|
||||||
var err *multierror.Error
|
|
||||||
err = multierror.Append(fullSrv.Shutdown(ctx))
|
|
||||||
err = multierror.Append(stop(ctx))
|
|
||||||
return err.ErrorOrNil()
|
|
||||||
}
|
|
||||||
|
|
||||||
registerAndExportMetrics(fmt.Sprintf("client_%d", t.GroupSeq))
|
|
||||||
|
|
||||||
t.RecordMessage("publish our address to the clients addr topic")
|
|
||||||
addrinfo, err := n.FullApi.NetAddrsListen(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
t.SyncClient.MustPublish(ctx, ClientsAddrsTopic, &ClientAddressesMsg{
|
|
||||||
PeerNetAddr: addrinfo,
|
|
||||||
WalletAddr: walletKey.Address,
|
|
||||||
GroupSeq: t.GroupSeq,
|
|
||||||
})
|
|
||||||
|
|
||||||
t.RecordMessage("waiting for all nodes to be ready")
|
|
||||||
t.SyncClient.MustSignalAndWait(ctx, StateReady, t.TestInstanceCount)
|
|
||||||
|
|
||||||
// collect miner addresses.
|
|
||||||
addrs, err := CollectMinerAddrs(t, ctx, t.IntParam("miners"))
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
t.RecordMessage("got %v miner addrs", len(addrs))
|
|
||||||
|
|
||||||
// densely connect the client to the full node and the miners themselves.
|
|
||||||
for _, miner := range addrs {
|
|
||||||
if err := n.FullApi.NetConnect(ctx, miner.FullNetAddrs); err != nil {
|
|
||||||
return nil, fmt.Errorf("client failed to connect to full node of miner: %w", err)
|
|
||||||
}
|
|
||||||
if err := n.FullApi.NetConnect(ctx, miner.MinerNetAddrs); err != nil {
|
|
||||||
return nil, fmt.Errorf("client failed to connect to storage miner node node of miner: %w", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// wait for all clients to have completed identify, pubsub negotiation with miners.
|
|
||||||
time.Sleep(1 * time.Second)
|
|
||||||
|
|
||||||
peers, err := n.FullApi.NetPeers(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("failed to query connected peers: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("connected peers: %d", len(peers))
|
|
||||||
|
|
||||||
cl := &LotusClient{
|
|
||||||
t: t,
|
|
||||||
LotusNode: n,
|
|
||||||
MinerAddrs: addrs,
|
|
||||||
}
|
|
||||||
return cl, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *LotusClient) RunDefault() error {
|
|
||||||
// run forever
|
|
||||||
c.t.RecordMessage("running default client forever")
|
|
||||||
c.t.WaitUntilAllDone()
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func startFullNodeAPIServer(t *TestEnvironment, repo repo.Repo, napi api.FullNode) (*http.Server, error) {
|
|
||||||
mux := mux.NewRouter()
|
|
||||||
|
|
||||||
rpcServer := jsonrpc.NewServer()
|
|
||||||
rpcServer.Register("Filecoin", napi)
|
|
||||||
|
|
||||||
mux.Handle("/rpc/v0", rpcServer)
|
|
||||||
|
|
||||||
exporter, err := prometheus.NewExporter(prometheus.Options{
|
|
||||||
Namespace: "lotus",
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
mux.Handle("/debug/metrics", exporter)
|
|
||||||
|
|
||||||
ah := &auth.Handler{
|
|
||||||
Verify: func(ctx context.Context, token string) ([]auth.Permission, error) {
|
|
||||||
return api.AllPermissions, nil
|
|
||||||
},
|
|
||||||
Next: mux.ServeHTTP,
|
|
||||||
}
|
|
||||||
|
|
||||||
srv := &http.Server{Handler: ah}
|
|
||||||
|
|
||||||
endpoint, err := repo.APIEndpoint()
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("no API endpoint in repo: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
listenAddr, err := startServer(endpoint, srv)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("failed to start client API endpoint: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("started node API server at %s", listenAddr)
|
|
||||||
return srv, nil
|
|
||||||
}
|
|
@ -1,391 +0,0 @@
|
|||||||
package testkit
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"context"
|
|
||||||
"encoding/hex"
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"net"
|
|
||||||
"os"
|
|
||||||
"path"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/drand/drand/chain"
|
|
||||||
"github.com/drand/drand/client"
|
|
||||||
hclient "github.com/drand/drand/client/http"
|
|
||||||
"github.com/drand/drand/core"
|
|
||||||
"github.com/drand/drand/key"
|
|
||||||
"github.com/drand/drand/log"
|
|
||||||
"github.com/drand/drand/lp2p"
|
|
||||||
dnet "github.com/drand/drand/net"
|
|
||||||
"github.com/drand/drand/protobuf/drand"
|
|
||||||
dtest "github.com/drand/drand/test"
|
|
||||||
"github.com/libp2p/go-libp2p/core/peer"
|
|
||||||
ma "github.com/multiformats/go-multiaddr"
|
|
||||||
"github.com/testground/sdk-go/sync"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
|
||||||
"github.com/filecoin-project/lotus/testplans/lotus-soup/statemachine"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
PrepareDrandTimeout = 3 * time.Minute
|
|
||||||
secretDKG = "dkgsecret"
|
|
||||||
)
|
|
||||||
|
|
||||||
type DrandInstance struct {
|
|
||||||
daemon *core.Drand
|
|
||||||
httpClient client.Client
|
|
||||||
ctrlClient *dnet.ControlClient
|
|
||||||
gossipRelay *lp2p.GossipRelayNode
|
|
||||||
|
|
||||||
t *TestEnvironment
|
|
||||||
stateDir string
|
|
||||||
priv *key.Pair
|
|
||||||
pubAddr string
|
|
||||||
privAddr string
|
|
||||||
ctrlAddr string
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dr *DrandInstance) Start() error {
|
|
||||||
opts := []core.ConfigOption{
|
|
||||||
core.WithLogLevel(getLogLevel(dr.t)),
|
|
||||||
core.WithConfigFolder(dr.stateDir),
|
|
||||||
core.WithPublicListenAddress(dr.pubAddr),
|
|
||||||
core.WithPrivateListenAddress(dr.privAddr),
|
|
||||||
core.WithControlPort(dr.ctrlAddr),
|
|
||||||
core.WithInsecure(),
|
|
||||||
}
|
|
||||||
conf := core.NewConfig(opts...)
|
|
||||||
fs := key.NewFileStore(conf.ConfigFolder())
|
|
||||||
fs.SaveKeyPair(dr.priv)
|
|
||||||
key.Save(path.Join(dr.stateDir, "public.toml"), dr.priv.Public, false)
|
|
||||||
if dr.daemon == nil {
|
|
||||||
drand, err := core.NewDrand(fs, conf)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
dr.daemon = drand
|
|
||||||
} else {
|
|
||||||
drand, err := core.LoadDrand(fs, conf)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
drand.StartBeacon(true)
|
|
||||||
dr.daemon = drand
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dr *DrandInstance) Ping() bool {
|
|
||||||
cl := dr.ctrl()
|
|
||||||
if err := cl.Ping(); err != nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dr *DrandInstance) Close() error {
|
|
||||||
dr.gossipRelay.Shutdown()
|
|
||||||
dr.daemon.Stop(context.Background())
|
|
||||||
return os.RemoveAll(dr.stateDir)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dr *DrandInstance) ctrl() *dnet.ControlClient {
|
|
||||||
if dr.ctrlClient != nil {
|
|
||||||
return dr.ctrlClient
|
|
||||||
}
|
|
||||||
cl, err := dnet.NewControlClient(dr.ctrlAddr)
|
|
||||||
if err != nil {
|
|
||||||
dr.t.RecordMessage("drand can't instantiate control client: %w", err)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
dr.ctrlClient = cl
|
|
||||||
return cl
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dr *DrandInstance) RunDKG(nodes, thr int, timeout string, leader bool, leaderAddr string, beaconOffset int) *key.Group {
|
|
||||||
cl := dr.ctrl()
|
|
||||||
p := dr.t.DurationParam("drand_period")
|
|
||||||
catchupPeriod := dr.t.DurationParam("drand_catchup_period")
|
|
||||||
t, _ := time.ParseDuration(timeout)
|
|
||||||
var grp *drand.GroupPacket
|
|
||||||
var err error
|
|
||||||
if leader {
|
|
||||||
grp, err = cl.InitDKGLeader(nodes, thr, p, catchupPeriod, t, nil, secretDKG, beaconOffset)
|
|
||||||
} else {
|
|
||||||
leader := dnet.CreatePeer(leaderAddr, false)
|
|
||||||
grp, err = cl.InitDKG(leader, nil, secretDKG)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
dr.t.RecordMessage("drand dkg run failed: %w", err)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
kg, _ := key.GroupFromProto(grp)
|
|
||||||
return kg
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dr *DrandInstance) Halt() {
|
|
||||||
dr.t.RecordMessage("drand node #%d halting", dr.t.GroupSeq)
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
|
||||||
defer cancel()
|
|
||||||
dr.daemon.Stop(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dr *DrandInstance) Resume() {
|
|
||||||
dr.t.RecordMessage("drand node #%d resuming", dr.t.GroupSeq)
|
|
||||||
dr.Start()
|
|
||||||
// block until we can fetch the round corresponding to the current time
|
|
||||||
startTime := time.Now()
|
|
||||||
round := dr.httpClient.RoundAt(startTime)
|
|
||||||
timeout := 120 * time.Second
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
done := make(chan struct{}, 1)
|
|
||||||
go func() {
|
|
||||||
for {
|
|
||||||
res, err := dr.httpClient.Get(ctx, round)
|
|
||||||
if err == nil {
|
|
||||||
dr.t.RecordMessage("drand chain caught up to round %d", res.Round())
|
|
||||||
done <- struct{}{}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
time.Sleep(2 * time.Second)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
select {
|
|
||||||
case <-ctx.Done():
|
|
||||||
dr.t.RecordMessage("drand chain failed to catch up after %s", timeout.String())
|
|
||||||
case <-done:
|
|
||||||
dr.t.RecordMessage("drand chain resumed after %s catchup time", time.Since(startTime))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dr *DrandInstance) RunDefault() error {
|
|
||||||
dr.t.RecordMessage("running drand node")
|
|
||||||
|
|
||||||
if dr.t.IsParamSet("suspend_events") {
|
|
||||||
suspender := statemachine.NewSuspender(dr, dr.t.RecordMessage)
|
|
||||||
suspender.RunEvents(dr.t.StringParam("suspend_events"))
|
|
||||||
}
|
|
||||||
|
|
||||||
dr.t.WaitUntilAllDone()
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// prepareDrandNode starts a drand instance and runs a DKG with the other members of the composition group.
|
|
||||||
// Once the chain is running, the leader publishes the chain info needed by lotus nodes on
|
|
||||||
// drandConfigTopic
|
|
||||||
func PrepareDrandInstance(t *TestEnvironment) (*DrandInstance, error) {
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), PrepareDrandTimeout)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
ApplyNetworkParameters(t)
|
|
||||||
|
|
||||||
startTime := time.Now()
|
|
||||||
|
|
||||||
seq := t.GroupSeq
|
|
||||||
isLeader := seq == 1
|
|
||||||
nNodes := t.TestGroupInstanceCount
|
|
||||||
|
|
||||||
myAddr := t.NetClient.MustGetDataNetworkIP()
|
|
||||||
threshold := t.IntParam("drand_threshold")
|
|
||||||
runGossipRelay := t.BooleanParam("drand_gossip_relay")
|
|
||||||
|
|
||||||
beaconOffset := 3
|
|
||||||
|
|
||||||
stateDir, err := ioutil.TempDir("/tmp", fmt.Sprintf("drand-%d", t.GroupSeq))
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
dr := DrandInstance{
|
|
||||||
t: t,
|
|
||||||
stateDir: stateDir,
|
|
||||||
pubAddr: dtest.FreeBind(myAddr.String()),
|
|
||||||
privAddr: dtest.FreeBind(myAddr.String()),
|
|
||||||
ctrlAddr: dtest.FreeBind("localhost"),
|
|
||||||
}
|
|
||||||
dr.priv = key.NewKeyPair(dr.privAddr)
|
|
||||||
|
|
||||||
// share the node addresses with other nodes
|
|
||||||
// TODO: if we implement TLS, this is where we'd share public TLS keys
|
|
||||||
type NodeAddr struct {
|
|
||||||
PrivateAddr string
|
|
||||||
PublicAddr string
|
|
||||||
IsLeader bool
|
|
||||||
}
|
|
||||||
addrTopic := sync.NewTopic("drand-addrs", &NodeAddr{})
|
|
||||||
var publicAddrs []string
|
|
||||||
var leaderAddr string
|
|
||||||
ch := make(chan *NodeAddr)
|
|
||||||
_, sub := t.SyncClient.MustPublishSubscribe(ctx, addrTopic, &NodeAddr{
|
|
||||||
PrivateAddr: dr.privAddr,
|
|
||||||
PublicAddr: dr.pubAddr,
|
|
||||||
IsLeader: isLeader,
|
|
||||||
}, ch)
|
|
||||||
for i := 0; i < nNodes; i++ {
|
|
||||||
select {
|
|
||||||
case msg := <-ch:
|
|
||||||
publicAddrs = append(publicAddrs, fmt.Sprintf("http://%s", msg.PublicAddr))
|
|
||||||
if msg.IsLeader {
|
|
||||||
leaderAddr = msg.PrivateAddr
|
|
||||||
}
|
|
||||||
case err := <-sub.Done():
|
|
||||||
return nil, fmt.Errorf("unable to read drand addrs from sync service: %w", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if leaderAddr == "" {
|
|
||||||
return nil, fmt.Errorf("got %d drand addrs, but no leader", len(publicAddrs))
|
|
||||||
}
|
|
||||||
|
|
||||||
t.SyncClient.MustSignalAndWait(ctx, "drand-start", nNodes)
|
|
||||||
t.RecordMessage("Starting drand sharing ceremony")
|
|
||||||
if err := dr.Start(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
alive := false
|
|
||||||
waitSecs := 10
|
|
||||||
for i := 0; i < waitSecs; i++ {
|
|
||||||
if !dr.Ping() {
|
|
||||||
time.Sleep(time.Second)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
t.R().RecordPoint("drand_first_ping", time.Now().Sub(startTime).Seconds())
|
|
||||||
alive = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
if !alive {
|
|
||||||
return nil, fmt.Errorf("drand node %d failed to start after %d seconds", t.GroupSeq, waitSecs)
|
|
||||||
}
|
|
||||||
|
|
||||||
// run DKG
|
|
||||||
t.SyncClient.MustSignalAndWait(ctx, "drand-dkg-start", nNodes)
|
|
||||||
if !isLeader {
|
|
||||||
time.Sleep(3 * time.Second)
|
|
||||||
}
|
|
||||||
grp := dr.RunDKG(nNodes, threshold, "10s", isLeader, leaderAddr, beaconOffset)
|
|
||||||
if grp == nil {
|
|
||||||
return nil, fmt.Errorf("drand dkg failed")
|
|
||||||
}
|
|
||||||
t.R().RecordPoint("drand_dkg_complete", time.Now().Sub(startTime).Seconds())
|
|
||||||
|
|
||||||
t.RecordMessage("drand dkg complete, waiting for chain start: %v", time.Until(time.Unix(grp.GenesisTime, 0).Add(grp.Period)))
|
|
||||||
|
|
||||||
// wait for chain to begin
|
|
||||||
to := time.Until(time.Unix(grp.GenesisTime, 0).Add(5 * time.Second).Add(grp.Period))
|
|
||||||
time.Sleep(to)
|
|
||||||
|
|
||||||
t.RecordMessage("drand beacon chain started, fetching initial round via http")
|
|
||||||
// verify that we can get a round of randomness from the chain using an http client
|
|
||||||
info := chain.NewChainInfo(grp)
|
|
||||||
myPublicAddr := fmt.Sprintf("http://%s", dr.pubAddr)
|
|
||||||
dr.httpClient, err = hclient.NewWithInfo(myPublicAddr, info, nil)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("unable to create drand http client: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = dr.httpClient.Get(ctx, 1)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("unable to get initial drand round: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// start gossip relay (unless disabled via testplan parameter)
|
|
||||||
var relayAddrs []peer.AddrInfo
|
|
||||||
|
|
||||||
if runGossipRelay {
|
|
||||||
gossipDir := path.Join(stateDir, "gossip-relay")
|
|
||||||
listenAddr := fmt.Sprintf("/ip4/%s/tcp/7777", myAddr.String())
|
|
||||||
relayCfg := lp2p.GossipRelayConfig{
|
|
||||||
ChainHash: hex.EncodeToString(info.Hash()),
|
|
||||||
Addr: listenAddr,
|
|
||||||
DataDir: gossipDir,
|
|
||||||
IdentityPath: path.Join(gossipDir, "identity.key"),
|
|
||||||
Insecure: true,
|
|
||||||
Client: dr.httpClient,
|
|
||||||
}
|
|
||||||
t.RecordMessage("starting drand gossip relay")
|
|
||||||
dr.gossipRelay, err = lp2p.NewGossipRelayNode(log.NewLogger(nil, getLogLevel(t)), &relayCfg)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("failed to construct drand gossip relay: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("sharing gossip relay addrs")
|
|
||||||
// share the gossip relay addrs so we can publish them in DrandRuntimeInfo
|
|
||||||
relayInfo, err := relayAddrInfo(dr.gossipRelay.Multiaddrs(), myAddr)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
infoCh := make(chan *peer.AddrInfo, nNodes)
|
|
||||||
infoTopic := sync.NewTopic("drand-gossip-addrs", &peer.AddrInfo{})
|
|
||||||
|
|
||||||
_, sub := t.SyncClient.MustPublishSubscribe(ctx, infoTopic, relayInfo, infoCh)
|
|
||||||
for i := 0; i < nNodes; i++ {
|
|
||||||
select {
|
|
||||||
case ai := <-infoCh:
|
|
||||||
relayAddrs = append(relayAddrs, *ai)
|
|
||||||
case err := <-sub.Done():
|
|
||||||
return nil, fmt.Errorf("unable to get drand relay addr from sync service: %w", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if we're the leader, publish the config to the sync service
|
|
||||||
if isLeader {
|
|
||||||
buf := bytes.Buffer{}
|
|
||||||
if err := info.ToJSON(&buf); err != nil {
|
|
||||||
return nil, fmt.Errorf("error marshaling chain info: %w", err)
|
|
||||||
}
|
|
||||||
cfg := DrandRuntimeInfo{
|
|
||||||
Config: dtypes.DrandConfig{
|
|
||||||
Servers: publicAddrs,
|
|
||||||
ChainInfoJSON: buf.String(),
|
|
||||||
},
|
|
||||||
GossipBootstrap: relayAddrs,
|
|
||||||
}
|
|
||||||
t.DebugSpew("publishing drand config on sync topic: %v", cfg)
|
|
||||||
t.SyncClient.MustPublish(ctx, DrandConfigTopic, &cfg)
|
|
||||||
}
|
|
||||||
|
|
||||||
// signal ready state
|
|
||||||
t.SyncClient.MustSignalAndWait(ctx, StateReady, t.TestInstanceCount)
|
|
||||||
return &dr, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// waitForDrandConfig should be called by filecoin instances before constructing the lotus Node
|
|
||||||
// you can use the returned dtypes.DrandConfig to override the default production config.
|
|
||||||
func waitForDrandConfig(ctx context.Context, client sync.Client) (*DrandRuntimeInfo, error) {
|
|
||||||
ch := make(chan *DrandRuntimeInfo, 1)
|
|
||||||
sub := client.MustSubscribe(ctx, DrandConfigTopic, ch)
|
|
||||||
select {
|
|
||||||
case cfg := <-ch:
|
|
||||||
return cfg, nil
|
|
||||||
case err := <-sub.Done():
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func relayAddrInfo(addrs []ma.Multiaddr, dataIP net.IP) (*peer.AddrInfo, error) {
|
|
||||||
for _, a := range addrs {
|
|
||||||
if ip, _ := a.ValueForProtocol(ma.P_IP4); ip != dataIP.String() {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
return peer.AddrInfoFromP2pAddr(a)
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf("no addr found with data ip %s in addrs: %v", dataIP, addrs)
|
|
||||||
}
|
|
||||||
|
|
||||||
func getLogLevel(t *TestEnvironment) int {
|
|
||||||
switch t.StringParam("drand_log_level") {
|
|
||||||
case "info":
|
|
||||||
return log.LogInfo
|
|
||||||
case "debug":
|
|
||||||
return log.LogDebug
|
|
||||||
default:
|
|
||||||
return log.LogNone
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,650 +0,0 @@
|
|||||||
package testkit
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"crypto/rand"
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
|
||||||
"path/filepath"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"contrib.go.opencensus.io/exporter/prometheus"
|
|
||||||
"github.com/google/uuid"
|
|
||||||
"github.com/gorilla/mux"
|
|
||||||
"github.com/hashicorp/go-multierror"
|
|
||||||
"github.com/ipfs/go-datastore"
|
|
||||||
libp2pcrypto "github.com/libp2p/go-libp2p/core/crypto"
|
|
||||||
"github.com/libp2p/go-libp2p/core/peer"
|
|
||||||
"github.com/testground/sdk-go/sync"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
|
||||||
"github.com/filecoin-project/go-jsonrpc"
|
|
||||||
"github.com/filecoin-project/go-jsonrpc/auth"
|
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
|
||||||
"github.com/filecoin-project/go-storedcounter"
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
|
||||||
saminer "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
|
||||||
"github.com/filecoin-project/lotus/build"
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
|
||||||
genesis_chain "github.com/filecoin-project/lotus/chain/gen/genesis"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
|
||||||
"github.com/filecoin-project/lotus/chain/wallet/key"
|
|
||||||
"github.com/filecoin-project/lotus/cmd/lotus-seed/seed"
|
|
||||||
"github.com/filecoin-project/lotus/markets/storageadapter"
|
|
||||||
"github.com/filecoin-project/lotus/miner"
|
|
||||||
"github.com/filecoin-project/lotus/node"
|
|
||||||
"github.com/filecoin-project/lotus/node/config"
|
|
||||||
"github.com/filecoin-project/lotus/node/impl"
|
|
||||||
"github.com/filecoin-project/lotus/node/repo"
|
|
||||||
sealing "github.com/filecoin-project/lotus/storage/pipeline"
|
|
||||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
sealDelay = 30 * time.Second
|
|
||||||
)
|
|
||||||
|
|
||||||
type LotusMiner struct {
|
|
||||||
*LotusNode
|
|
||||||
|
|
||||||
MinerRepo repo.Repo
|
|
||||||
NodeRepo repo.Repo
|
|
||||||
FullNetAddrs []peer.AddrInfo
|
|
||||||
GenesisMsg *GenesisMsg
|
|
||||||
Subsystems config.MinerSubsystemConfig
|
|
||||||
|
|
||||||
t *TestEnvironment
|
|
||||||
}
|
|
||||||
|
|
||||||
func PrepareMiner(t *TestEnvironment) (*LotusMiner, error) {
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), PrepareNodeTimeout)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
ApplyNetworkParameters(t)
|
|
||||||
|
|
||||||
pubsubTracer, err := GetPubsubTracerMaddr(ctx, t)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
drandOpt, err := GetRandomBeaconOpts(ctx, t)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// first create a wallet
|
|
||||||
walletKey, err := key.GenerateKey(types.KTBLS)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// publish the account ID/balance
|
|
||||||
balance := t.FloatParam("balance")
|
|
||||||
balanceMsg := &InitialBalanceMsg{Addr: walletKey.Address, Balance: balance}
|
|
||||||
t.SyncClient.Publish(ctx, BalanceTopic, balanceMsg)
|
|
||||||
|
|
||||||
// create and publish the preseal commitment
|
|
||||||
priv, _, err := libp2pcrypto.GenerateEd25519Key(rand.Reader)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
minerID, err := peer.IDFromPrivateKey(priv)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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
|
|
||||||
}
|
|
||||||
|
|
||||||
presealDir, err := ioutil.TempDir("", "preseal")
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
sectors := t.IntParam("sectors")
|
|
||||||
genMiner, _, err := seed.PreSeal(minerAddr, abi.RegisteredSealProof_StackedDrg8MiBV1, 0, sectors, presealDir, []byte("TODO: randomize this"), &walletKey.KeyInfo, false)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
genMiner.PeerId = minerID
|
|
||||||
|
|
||||||
t.RecordMessage("Miner Info: Owner: %s Worker: %s", genMiner.Owner, genMiner.Worker)
|
|
||||||
|
|
||||||
presealMsg := &PresealMsg{Miner: *genMiner, Seqno: seq}
|
|
||||||
t.SyncClient.Publish(ctx, PresealTopic, presealMsg)
|
|
||||||
|
|
||||||
// then collect the genesis block and bootstrapper address
|
|
||||||
genesisMsg, err := WaitForGenesis(t, ctx)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// prepare the repo
|
|
||||||
minerRepoDir, err := ioutil.TempDir("", "miner-repo-dir")
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
minerRepo, err := repo.NewFS(minerRepoDir)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = minerRepo.Init(repo.StorageMiner)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var subsystems config.MinerSubsystemConfig
|
|
||||||
|
|
||||||
{
|
|
||||||
lr, err := minerRepo.Lock(repo.StorageMiner)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
c, err := lr.Config()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg := c.(*config.StorageMiner)
|
|
||||||
subsystems = cfg.Subsystems
|
|
||||||
|
|
||||||
ks, err := lr.KeyStore()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
kbytes, err := libp2pcrypto.MarshalPrivateKey(priv)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = ks.Put("libp2p-host", types.KeyInfo{
|
|
||||||
Type: "libp2p-host",
|
|
||||||
PrivateKey: kbytes,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
ds, err := lr.Datastore(context.Background(), "/metadata")
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = ds.Put(context.Background(), datastore.NewKey("miner-address"), minerAddr.Bytes())
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
nic := storedcounter.New(ds, datastore.NewKey(sealing.StorageCounterDSPrefix))
|
|
||||||
for i := 0; i < (sectors + 1); i++ {
|
|
||||||
_, err = nic.Next()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var localPaths []storiface.LocalPath
|
|
||||||
|
|
||||||
b, err := json.MarshalIndent(&storiface.LocalStorageMeta{
|
|
||||||
ID: storiface.ID(uuid.New().String()),
|
|
||||||
Weight: 10,
|
|
||||||
CanSeal: true,
|
|
||||||
CanStore: true,
|
|
||||||
}, "", " ")
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("marshaling storage config: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := ioutil.WriteFile(filepath.Join(lr.Path(), "sectorstore.json"), b, 0644); err != nil {
|
|
||||||
return nil, fmt.Errorf("persisting storage metadata (%s): %w", filepath.Join(lr.Path(), "sectorstore.json"), err)
|
|
||||||
}
|
|
||||||
|
|
||||||
localPaths = append(localPaths, storiface.LocalPath{
|
|
||||||
Path: lr.Path(),
|
|
||||||
})
|
|
||||||
|
|
||||||
if err := lr.SetStorage(func(sc *storiface.StorageConfig) {
|
|
||||||
sc.StoragePaths = append(sc.StoragePaths, localPaths...)
|
|
||||||
}); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = lr.Close()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
minerIP := t.NetClient.MustGetDataNetworkIP().String()
|
|
||||||
|
|
||||||
// create the node
|
|
||||||
// we need both a full node _and_ and storage miner node
|
|
||||||
n := &LotusNode{}
|
|
||||||
|
|
||||||
// prepare the repo
|
|
||||||
nodeRepoDir, err := ioutil.TempDir("", "node-repo-dir")
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
nodeRepo, err := repo.NewFS(nodeRepoDir)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = nodeRepo.Init(repo.FullNode)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
stop1, err := node.New(context.Background(),
|
|
||||||
node.FullAPI(&n.FullApi),
|
|
||||||
node.Base(),
|
|
||||||
node.Repo(nodeRepo),
|
|
||||||
withGenesis(genesisMsg.Genesis),
|
|
||||||
withApiEndpoint(fmt.Sprintf("/ip4/0.0.0.0/tcp/%s", t.PortNumber("node_rpc", "0"))),
|
|
||||||
withListenAddress(minerIP),
|
|
||||||
withBootstrapper(genesisMsg.Bootstrapper),
|
|
||||||
withPubsubConfig(false, pubsubTracer),
|
|
||||||
drandOpt,
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("node node.new error: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// set the wallet
|
|
||||||
err = n.setWallet(ctx, walletKey)
|
|
||||||
if err != nil {
|
|
||||||
stop1(context.TODO())
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
minerOpts := []node.Option{
|
|
||||||
node.StorageMiner(&n.MinerApi, subsystems),
|
|
||||||
node.Base(),
|
|
||||||
node.Repo(minerRepo),
|
|
||||||
node.Override(new(api.FullNode), n.FullApi),
|
|
||||||
node.Override(new(*storageadapter.DealPublisher), storageadapter.NewDealPublisher(nil, storageadapter.PublishMsgConfig{
|
|
||||||
Period: 15 * time.Second,
|
|
||||||
MaxDealsPerMsg: 1,
|
|
||||||
})),
|
|
||||||
withApiEndpoint(fmt.Sprintf("/ip4/0.0.0.0/tcp/%s", t.PortNumber("miner_rpc", "0"))),
|
|
||||||
withMinerListenAddress(minerIP),
|
|
||||||
}
|
|
||||||
|
|
||||||
if t.StringParam("mining_mode") != "natural" {
|
|
||||||
mineBlock := make(chan miner.MineReq)
|
|
||||||
|
|
||||||
minerOpts = append(minerOpts,
|
|
||||||
node.Override(new(*miner.Miner), miner.NewTestMiner(mineBlock, minerAddr)))
|
|
||||||
|
|
||||||
n.MineOne = func(ctx context.Context, cb miner.MineReq) 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, fmt.Errorf("miner node.new error: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
registerAndExportMetrics(minerAddr.String())
|
|
||||||
|
|
||||||
// collect stats based on blockchain from first instance of `miner` role
|
|
||||||
if t.InitContext.GroupSeq == 1 && t.Role == "miner" {
|
|
||||||
go collectStats(t, ctx, n.FullApi)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start listening on the full node.
|
|
||||||
fullNodeNetAddrs, err := n.FullApi.NetAddrsListen(ctx)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// set seal delay to lower value than 1 hour
|
|
||||||
err = n.MinerApi.SectorSetSealDelay(ctx, sealDelay)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// set expected seal duration to 1 minute
|
|
||||||
err = n.MinerApi.SectorSetExpectedSealDuration(ctx, 1*time.Minute)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// print out the admin auth token
|
|
||||||
token, err := n.MinerApi.AuthNew(ctx, api.AllPermissions)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("Auth token: %s", string(token))
|
|
||||||
|
|
||||||
// add local storage for presealed sectors
|
|
||||||
err = n.MinerApi.StorageAddLocal(ctx, presealDir)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// set the miner PeerID
|
|
||||||
minerIDEncoded, err := actors.SerializeParams(&saminer.ChangePeerIDParams{NewID: abi.PeerID(minerID)})
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
changeMinerID := &types.Message{
|
|
||||||
To: minerAddr,
|
|
||||||
From: genMiner.Worker,
|
|
||||||
Method: builtin.MethodsMiner.ChangePeerID,
|
|
||||||
Params: minerIDEncoded,
|
|
||||||
Value: types.NewInt(0),
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = n.FullApi.MpoolPushMessage(ctx, changeMinerID, nil)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("publish our address to the miners addr topic")
|
|
||||||
minerActor, err := n.MinerApi.ActorAddress(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
minerNetAddrs, err := n.MinerApi.NetAddrsListen(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
t.SyncClient.MustPublish(ctx, MinersAddrsTopic, MinerAddressesMsg{
|
|
||||||
FullNetAddrs: fullNodeNetAddrs,
|
|
||||||
MinerNetAddrs: minerNetAddrs,
|
|
||||||
MinerActorAddr: minerActor,
|
|
||||||
WalletAddr: walletKey.Address,
|
|
||||||
})
|
|
||||||
|
|
||||||
t.RecordMessage("connecting to all other miners")
|
|
||||||
|
|
||||||
// densely connect the miner's full nodes.
|
|
||||||
minerCh := make(chan *MinerAddressesMsg, 16)
|
|
||||||
sctx, cancel := context.WithCancel(ctx)
|
|
||||||
defer cancel()
|
|
||||||
t.SyncClient.MustSubscribe(sctx, MinersAddrsTopic, minerCh)
|
|
||||||
var fullNetAddrs []peer.AddrInfo
|
|
||||||
for i := 0; i < t.IntParam("miners"); i++ {
|
|
||||||
m := <-minerCh
|
|
||||||
if m.MinerActorAddr == minerActor {
|
|
||||||
// once I find myself, I stop connecting to others, to avoid a simopen problem.
|
|
||||||
break
|
|
||||||
}
|
|
||||||
err := n.FullApi.NetConnect(ctx, m.FullNetAddrs)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("failed to connect to miner %s on: %v", m.MinerActorAddr, m.FullNetAddrs)
|
|
||||||
}
|
|
||||||
t.RecordMessage("connected to full node of miner %s on %v", m.MinerActorAddr, m.FullNetAddrs)
|
|
||||||
|
|
||||||
fullNetAddrs = append(fullNetAddrs, m.FullNetAddrs)
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("waiting for all nodes to be ready")
|
|
||||||
t.SyncClient.MustSignalAndWait(ctx, StateReady, t.TestInstanceCount)
|
|
||||||
|
|
||||||
fullSrv, err := startFullNodeAPIServer(t, nodeRepo, n.FullApi)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
minerSrv, err := startStorageMinerAPIServer(t, minerRepo, n.MinerApi)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
n.StopFn = func(ctx context.Context) error {
|
|
||||||
var err *multierror.Error
|
|
||||||
err = multierror.Append(fullSrv.Shutdown(ctx))
|
|
||||||
err = multierror.Append(minerSrv.Shutdown(ctx))
|
|
||||||
err = multierror.Append(stop2(ctx))
|
|
||||||
err = multierror.Append(stop2(ctx))
|
|
||||||
err = multierror.Append(stop1(ctx))
|
|
||||||
return err.ErrorOrNil()
|
|
||||||
}
|
|
||||||
|
|
||||||
m := &LotusMiner{n, minerRepo, nodeRepo, fullNetAddrs, genesisMsg, subsystems, t}
|
|
||||||
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func RestoreMiner(t *TestEnvironment, m *LotusMiner) (*LotusMiner, error) {
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), PrepareNodeTimeout)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
minerRepo := m.MinerRepo
|
|
||||||
nodeRepo := m.NodeRepo
|
|
||||||
fullNetAddrs := m.FullNetAddrs
|
|
||||||
genesisMsg := m.GenesisMsg
|
|
||||||
|
|
||||||
minerIP := t.NetClient.MustGetDataNetworkIP().String()
|
|
||||||
|
|
||||||
drandOpt, err := GetRandomBeaconOpts(ctx, t)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// create the node
|
|
||||||
// we need both a full node _and_ and storage miner node
|
|
||||||
n := &LotusNode{}
|
|
||||||
|
|
||||||
stop1, err := node.New(context.Background(),
|
|
||||||
node.FullAPI(&n.FullApi),
|
|
||||||
node.Base(),
|
|
||||||
node.Repo(nodeRepo),
|
|
||||||
//withGenesis(genesisMsg.Genesis),
|
|
||||||
withApiEndpoint(fmt.Sprintf("/ip4/0.0.0.0/tcp/%s", t.PortNumber("node_rpc", "0"))),
|
|
||||||
withListenAddress(minerIP),
|
|
||||||
withBootstrapper(genesisMsg.Bootstrapper),
|
|
||||||
//withPubsubConfig(false, pubsubTracer),
|
|
||||||
drandOpt,
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
minerOpts := []node.Option{
|
|
||||||
node.StorageMiner(&n.MinerApi, m.Subsystems),
|
|
||||||
node.Base(),
|
|
||||||
node.Repo(minerRepo),
|
|
||||||
node.Override(new(api.FullNode), n.FullApi),
|
|
||||||
withApiEndpoint(fmt.Sprintf("/ip4/0.0.0.0/tcp/%s", t.PortNumber("miner_rpc", "0"))),
|
|
||||||
withMinerListenAddress(minerIP),
|
|
||||||
}
|
|
||||||
|
|
||||||
stop2, err := node.New(context.Background(), minerOpts...)
|
|
||||||
if err != nil {
|
|
||||||
stop1(context.TODO())
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
fullSrv, err := startFullNodeAPIServer(t, nodeRepo, n.FullApi)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
minerSrv, err := startStorageMinerAPIServer(t, minerRepo, n.MinerApi)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
n.StopFn = func(ctx context.Context) error {
|
|
||||||
var err *multierror.Error
|
|
||||||
err = multierror.Append(fullSrv.Shutdown(ctx))
|
|
||||||
err = multierror.Append(minerSrv.Shutdown(ctx))
|
|
||||||
err = multierror.Append(stop2(ctx))
|
|
||||||
err = multierror.Append(stop2(ctx))
|
|
||||||
err = multierror.Append(stop1(ctx))
|
|
||||||
return err.ErrorOrNil()
|
|
||||||
}
|
|
||||||
|
|
||||||
for i := 0; i < len(fullNetAddrs); i++ {
|
|
||||||
err := n.FullApi.NetConnect(ctx, fullNetAddrs[i])
|
|
||||||
if err != nil {
|
|
||||||
// we expect a failure since we also shutdown another miner
|
|
||||||
t.RecordMessage("failed to connect to miner %d on: %v", i, fullNetAddrs[i])
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
t.RecordMessage("connected to full node of miner %d on %v", i, fullNetAddrs[i])
|
|
||||||
}
|
|
||||||
|
|
||||||
pm := &LotusMiner{n, minerRepo, nodeRepo, fullNetAddrs, genesisMsg, m.Subsystems, t}
|
|
||||||
|
|
||||||
return pm, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *LotusMiner) RunDefault() error {
|
|
||||||
var (
|
|
||||||
t = m.t
|
|
||||||
clients = t.IntParam("clients")
|
|
||||||
miners = t.IntParam("miners")
|
|
||||||
)
|
|
||||||
|
|
||||||
t.RecordMessage("running miner")
|
|
||||||
t.RecordMessage("block delay: %v", build.BlockDelaySecs)
|
|
||||||
t.D().Gauge("miner.block-delay").Update(float64(build.BlockDelaySecs))
|
|
||||||
|
|
||||||
ctx := context.Background()
|
|
||||||
myActorAddr, err := m.MinerApi.ActorAddress(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// mine / stop mining
|
|
||||||
mine := true
|
|
||||||
done := make(chan struct{})
|
|
||||||
|
|
||||||
if m.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
|
|
||||||
t.RecordMessage("synchronizing all miners to mine next block [%d]", i)
|
|
||||||
stateMineNext := sync.State(fmt.Sprintf("mine-block-%d", i))
|
|
||||||
t.SyncClient.MustSignalAndWait(ctx, stateMineNext, miners)
|
|
||||||
|
|
||||||
ch := make(chan error)
|
|
||||||
const maxRetries = 100
|
|
||||||
success := false
|
|
||||||
for retries := 0; retries < maxRetries; retries++ {
|
|
||||||
f := func(mined bool, epoch abi.ChainEpoch, err error) {
|
|
||||||
if mined {
|
|
||||||
t.D().Counter(fmt.Sprintf("block.mine,miner=%s", myActorAddr)).Inc(1)
|
|
||||||
}
|
|
||||||
ch <- err
|
|
||||||
}
|
|
||||||
req := miner.MineReq{
|
|
||||||
Done: f,
|
|
||||||
}
|
|
||||||
err := m.MineOne(ctx, req)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
miningErr := <-ch
|
|
||||||
if miningErr == nil {
|
|
||||||
success = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
t.D().Counter("block.mine.err").Inc(1)
|
|
||||||
t.RecordMessage("retrying block [%d] after %d attempts due to mining error: %s",
|
|
||||||
i, retries, miningErr)
|
|
||||||
}
|
|
||||||
if !success {
|
|
||||||
panic(fmt.Errorf("failed to mine block %d after %d retries", i, maxRetries))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// signal the last block to make sure no miners are left stuck waiting for the next block signal
|
|
||||||
// while the others have stopped
|
|
||||||
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
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
mine = false
|
|
||||||
<-done
|
|
||||||
|
|
||||||
t.SyncClient.MustSignalAndWait(ctx, StateDone, t.TestInstanceCount)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func startStorageMinerAPIServer(t *TestEnvironment, repo repo.Repo, minerApi api.StorageMiner) (*http.Server, error) {
|
|
||||||
mux := mux.NewRouter()
|
|
||||||
|
|
||||||
rpcServer := jsonrpc.NewServer()
|
|
||||||
rpcServer.Register("Filecoin", minerApi)
|
|
||||||
|
|
||||||
mux.Handle("/rpc/v0", rpcServer)
|
|
||||||
mux.PathPrefix("/remote").HandlerFunc(minerApi.(*impl.StorageMinerAPI).ServeRemote(true))
|
|
||||||
mux.PathPrefix("/").Handler(http.DefaultServeMux) // pprof
|
|
||||||
|
|
||||||
exporter, err := prometheus.NewExporter(prometheus.Options{
|
|
||||||
Namespace: "lotus",
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
mux.Handle("/debug/metrics", exporter)
|
|
||||||
|
|
||||||
ah := &auth.Handler{
|
|
||||||
Verify: func(ctx context.Context, token string) ([]auth.Permission, error) {
|
|
||||||
return api.AllPermissions, nil
|
|
||||||
},
|
|
||||||
Next: mux.ServeHTTP,
|
|
||||||
}
|
|
||||||
|
|
||||||
endpoint, err := repo.APIEndpoint()
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("no API endpoint in repo: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
srv := &http.Server{Handler: ah}
|
|
||||||
|
|
||||||
listenAddr, err := startServer(endpoint, srv)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("failed to start storage miner API endpoint: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
t.RecordMessage("started storage miner API server at %s", listenAddr)
|
|
||||||
return srv, nil
|
|
||||||
}
|
|
@ -1,78 +0,0 @@
|
|||||||
package testkit
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"crypto/rand"
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/libp2p/go-libp2p"
|
|
||||||
"github.com/libp2p/go-libp2p-pubsub-tracer/traced"
|
|
||||||
"github.com/libp2p/go-libp2p/core/crypto"
|
|
||||||
"github.com/libp2p/go-libp2p/core/host"
|
|
||||||
ma "github.com/multiformats/go-multiaddr"
|
|
||||||
)
|
|
||||||
|
|
||||||
type PubsubTracer struct {
|
|
||||||
t *TestEnvironment
|
|
||||||
host host.Host
|
|
||||||
traced *traced.TraceCollector
|
|
||||||
}
|
|
||||||
|
|
||||||
func PreparePubsubTracer(t *TestEnvironment) (*PubsubTracer, error) {
|
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
privk, _, err := crypto.GenerateEd25519Key(rand.Reader)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
tracedIP := t.NetClient.MustGetDataNetworkIP().String()
|
|
||||||
tracedAddr := fmt.Sprintf("/ip4/%s/tcp/4001", tracedIP)
|
|
||||||
|
|
||||||
host, err := libp2p.New(
|
|
||||||
libp2p.Identity(privk),
|
|
||||||
libp2p.ListenAddrStrings(tracedAddr),
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
tracedDir := t.TestOutputsPath + "/traced.logs"
|
|
||||||
traced, err := traced.NewTraceCollector(host, tracedDir)
|
|
||||||
if err != nil {
|
|
||||||
host.Close()
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
tracedMultiaddrStr := fmt.Sprintf("%s/p2p/%s", tracedAddr, host.ID())
|
|
||||||
t.RecordMessage("I am %s", tracedMultiaddrStr)
|
|
||||||
|
|
||||||
_ = ma.StringCast(tracedMultiaddrStr)
|
|
||||||
tracedMsg := &PubsubTracerMsg{Multiaddr: tracedMultiaddrStr}
|
|
||||||
t.SyncClient.MustPublish(ctx, PubsubTracerTopic, tracedMsg)
|
|
||||||
|
|
||||||
t.RecordMessage("waiting for all nodes to be ready")
|
|
||||||
t.SyncClient.MustSignalAndWait(ctx, StateReady, t.TestInstanceCount)
|
|
||||||
|
|
||||||
tracer := &PubsubTracer{t: t, host: host, traced: traced}
|
|
||||||
return tracer, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (tr *PubsubTracer) RunDefault() error {
|
|
||||||
tr.t.RecordMessage("running pubsub tracer")
|
|
||||||
|
|
||||||
defer func() {
|
|
||||||
err := tr.Stop()
|
|
||||||
if err != nil {
|
|
||||||
tr.t.RecordMessage("error stoping tracer: %s", err)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
tr.t.WaitUntilAllDone()
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (tr *PubsubTracer) Stop() error {
|
|
||||||
tr.traced.Stop()
|
|
||||||
return tr.host.Close()
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
package testkit
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/libp2p/go-libp2p/core/peer"
|
|
||||||
"github.com/testground/sdk-go/sync"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/genesis"
|
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
GenesisTopic = sync.NewTopic("genesis", &GenesisMsg{})
|
|
||||||
BalanceTopic = sync.NewTopic("balance", &InitialBalanceMsg{})
|
|
||||||
PresealTopic = sync.NewTopic("preseal", &PresealMsg{})
|
|
||||||
ClientsAddrsTopic = sync.NewTopic("clients_addrs", &ClientAddressesMsg{})
|
|
||||||
MinersAddrsTopic = sync.NewTopic("miners_addrs", &MinerAddressesMsg{})
|
|
||||||
SlashedMinerTopic = sync.NewTopic("slashed_miner", &SlashedMinerMsg{})
|
|
||||||
PubsubTracerTopic = sync.NewTopic("pubsub_tracer", &PubsubTracerMsg{})
|
|
||||||
DrandConfigTopic = sync.NewTopic("drand_config", &DrandRuntimeInfo{})
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
StateReady = sync.State("ready")
|
|
||||||
StateDone = sync.State("done")
|
|
||||||
StateStopMining = sync.State("stop-mining")
|
|
||||||
StateMinerPickSeqNum = sync.State("miner-pick-seq-num")
|
|
||||||
StateAbortTest = sync.State("abort-test")
|
|
||||||
)
|
|
||||||
|
|
||||||
type InitialBalanceMsg struct {
|
|
||||||
Addr address.Address
|
|
||||||
Balance float64
|
|
||||||
}
|
|
||||||
|
|
||||||
type PresealMsg struct {
|
|
||||||
Miner genesis.Miner
|
|
||||||
Seqno int64
|
|
||||||
}
|
|
||||||
|
|
||||||
type GenesisMsg struct {
|
|
||||||
Genesis []byte
|
|
||||||
Bootstrapper []byte
|
|
||||||
}
|
|
||||||
|
|
||||||
type ClientAddressesMsg struct {
|
|
||||||
PeerNetAddr peer.AddrInfo
|
|
||||||
WalletAddr address.Address
|
|
||||||
GroupSeq int64
|
|
||||||
}
|
|
||||||
|
|
||||||
type MinerAddressesMsg struct {
|
|
||||||
FullNetAddrs peer.AddrInfo
|
|
||||||
MinerNetAddrs peer.AddrInfo
|
|
||||||
MinerActorAddr address.Address
|
|
||||||
WalletAddr address.Address
|
|
||||||
}
|
|
||||||
|
|
||||||
type SlashedMinerMsg struct {
|
|
||||||
MinerActorAddr address.Address
|
|
||||||
}
|
|
||||||
|
|
||||||
type PubsubTracerMsg struct {
|
|
||||||
Multiaddr string
|
|
||||||
}
|
|
||||||
|
|
||||||
type DrandRuntimeInfo struct {
|
|
||||||
Config dtypes.DrandConfig
|
|
||||||
GossipBootstrap dtypes.DrandBootstrap
|
|
||||||
}
|
|
@ -1,88 +0,0 @@
|
|||||||
package testkit
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/davecgh/go-spew/spew"
|
|
||||||
"github.com/testground/sdk-go/run"
|
|
||||||
"github.com/testground/sdk-go/runtime"
|
|
||||||
)
|
|
||||||
|
|
||||||
type TestEnvironment struct {
|
|
||||||
*runtime.RunEnv
|
|
||||||
*run.InitContext
|
|
||||||
|
|
||||||
Role string
|
|
||||||
}
|
|
||||||
|
|
||||||
// workaround for default params being wrapped in quote chars
|
|
||||||
func (t *TestEnvironment) StringParam(name string) string {
|
|
||||||
return strings.Trim(t.RunEnv.StringParam(name), "\"")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *TestEnvironment) DurationParam(name string) time.Duration {
|
|
||||||
d, err := time.ParseDuration(t.StringParam(name))
|
|
||||||
if err != nil {
|
|
||||||
panic(fmt.Errorf("invalid duration value for param '%s': %w", name, err))
|
|
||||||
}
|
|
||||||
return d
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *TestEnvironment) DurationRangeParam(name string) DurationRange {
|
|
||||||
var r DurationRange
|
|
||||||
t.JSONParam(name, &r)
|
|
||||||
return r
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *TestEnvironment) FloatRangeParam(name string) FloatRange {
|
|
||||||
r := FloatRange{}
|
|
||||||
t.JSONParam(name, &r)
|
|
||||||
return r
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *TestEnvironment) DebugSpew(format string, args ...interface{}) {
|
|
||||||
t.RecordMessage(spew.Sprintf(format, args...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *TestEnvironment) DumpJSON(filename string, v interface{}) {
|
|
||||||
b, err := json.Marshal(v)
|
|
||||||
if err != nil {
|
|
||||||
t.RecordMessage("unable to marshal object to JSON: %s", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
f, err := t.CreateRawAsset(filename)
|
|
||||||
if err != nil {
|
|
||||||
t.RecordMessage("unable to create asset file: %s", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
|
|
||||||
_, err = f.Write(b)
|
|
||||||
if err != nil {
|
|
||||||
t.RecordMessage("error writing json object dump: %s", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// WaitUntilAllDone waits until all instances in the test case are done.
|
|
||||||
func (t *TestEnvironment) WaitUntilAllDone() {
|
|
||||||
ctx := context.Background()
|
|
||||||
t.SyncClient.MustSignalAndWait(ctx, StateDone, t.TestInstanceCount)
|
|
||||||
}
|
|
||||||
|
|
||||||
// WrapTestEnvironment takes a test case function that accepts a
|
|
||||||
// *TestEnvironment, and adapts it to the original unwrapped SDK style
|
|
||||||
// (run.InitializedTestCaseFn).
|
|
||||||
func WrapTestEnvironment(f func(t *TestEnvironment) error) run.InitializedTestCaseFn {
|
|
||||||
return func(runenv *runtime.RunEnv, initCtx *run.InitContext) error {
|
|
||||||
t := &TestEnvironment{RunEnv: runenv, InitContext: initCtx}
|
|
||||||
t.Role = t.StringParam("role")
|
|
||||||
|
|
||||||
t.DumpJSON("test-parameters.json", t.TestInstanceParams)
|
|
||||||
|
|
||||||
return f(t)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
package testkit
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
"math/rand"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/testground/sdk-go/ptypes"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DurationRange is a Testground parameter type that represents a duration
|
|
||||||
// range, suitable use in randomized tests. This type is encoded as a JSON array
|
|
||||||
// of length 2 of element type ptypes.Duration, e.g. ["10s", "10m"].
|
|
||||||
type DurationRange struct {
|
|
||||||
Min time.Duration
|
|
||||||
Max time.Duration
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *DurationRange) ChooseRandom() time.Duration {
|
|
||||||
i := int64(r.Min) + rand.Int63n(int64(r.Max)-int64(r.Min))
|
|
||||||
return time.Duration(i)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *DurationRange) UnmarshalJSON(b []byte) error {
|
|
||||||
var s []ptypes.Duration
|
|
||||||
if err := json.Unmarshal(b, &s); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if len(s) != 2 {
|
|
||||||
return fmt.Errorf("expected two-element array of duration strings, got array of length %d", len(s))
|
|
||||||
}
|
|
||||||
if s[0].Duration > s[1].Duration {
|
|
||||||
return fmt.Errorf("expected first element to be <= second element")
|
|
||||||
}
|
|
||||||
r.Min = s[0].Duration
|
|
||||||
r.Max = s[1].Duration
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *DurationRange) MarshalJSON() ([]byte, error) {
|
|
||||||
s := []ptypes.Duration{{r.Min}, {r.Max}}
|
|
||||||
return json.Marshal(s)
|
|
||||||
}
|
|
||||||
|
|
||||||
// FloatRange is a Testground parameter type that represents a float
|
|
||||||
// range, suitable use in randomized tests. This type is encoded as a JSON array
|
|
||||||
// of length 2 of element type float32, e.g. [1.45, 10.675].
|
|
||||||
type FloatRange struct {
|
|
||||||
Min float32
|
|
||||||
Max float32
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *FloatRange) ChooseRandom() float32 {
|
|
||||||
return r.Min + rand.Float32()*(r.Max-r.Min)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *FloatRange) UnmarshalJSON(b []byte) error {
|
|
||||||
var s []float32
|
|
||||||
if err := json.Unmarshal(b, &s); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if len(s) != 2 {
|
|
||||||
return fmt.Errorf("expected two-element array of floats, got array of length %d", len(s))
|
|
||||||
}
|
|
||||||
if s[0] > s[1] {
|
|
||||||
return fmt.Errorf("expected first element to be <= second element")
|
|
||||||
}
|
|
||||||
r.Min = s[0]
|
|
||||||
r.Max = s[1]
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *FloatRange) MarshalJSON() ([]byte, error) {
|
|
||||||
s := []float32{r.Min, r.Max}
|
|
||||||
return json.Marshal(s)
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
# Raúl's notes
|
|
||||||
|
|
||||||
## Storage mining
|
|
||||||
|
|
||||||
The Storage Mining System is the part of the Filecoin Protocol that deals with
|
|
||||||
storing Client’s data, producing proof artifacts that demonstrate correct
|
|
||||||
storage behavior, and managing the work involved.
|
|
||||||
|
|
||||||
## Preseals
|
|
||||||
|
|
||||||
In the Filecoin consensus protocol, the miners' probability of being eligible
|
|
||||||
to mine a block in a given epoch is directly correlated with their power in the
|
|
||||||
network. This creates a chicken-and-egg problem at genesis. Since there are no
|
|
||||||
miners, there is no power in the network, therefore no miner is eligible to mine
|
|
||||||
and advance the chain.
|
|
||||||
|
|
||||||
Preseals are sealed sectors that are blessed at genesis, thus conferring
|
|
||||||
their miners the possibility to win round elections and successfully mine a
|
|
||||||
block. Without preseals, the chain would be dead on arrival.
|
|
||||||
|
|
||||||
Preseals work with fauxrep and faux sealing, which are special-case
|
|
||||||
implementations of PoRep and the sealing logic that do not depend on slow
|
|
||||||
sealing.
|
|
||||||
|
|
||||||
### Not implemented things
|
|
||||||
|
|
||||||
**Sector Resealing:** Miners should be able to ’re-seal’ sectors, to allow them
|
|
||||||
to take a set of sectors with mostly expired pieces, and combine the
|
|
||||||
not-yet-expired pieces into a single (or multiple) sectors.
|
|
||||||
|
|
||||||
**Sector Transfer:** Miners should be able to re-delegate the responsibility of
|
|
||||||
storing data to another miner. This is tricky for many reasons, and will not be
|
|
||||||
implemented in the initial release of Filecoin, but could provide interesting
|
|
||||||
capabilities down the road.
|
|
||||||
|
|
||||||
## Catch-up/rush mining
|
|
||||||
|
|
||||||
In catch-up or rush mining, miners make up for chain history that does not
|
|
||||||
exist. It's a recovery/healing procedure. The chain runs at at constant
|
|
||||||
25 second epoch time. When in the network mining halts for some reason
|
|
||||||
(consensus/liveness bug, drand availability issues, etc.), upon a restart miners
|
|
||||||
will go and backfill the chain history by mining backdated blocks in
|
|
||||||
the appropriate timestamps.
|
|
||||||
|
|
||||||
There are a few things worth highlighting:
|
|
||||||
* mining runs in a hot loop, and there is no time for miners to gossip about
|
|
||||||
their blocks; therefore they end up building the chain solo, as they can't
|
|
||||||
incorprate other blocks into tipsets.
|
|
||||||
* the miner with most power will mine most blocks.
|
|
||||||
* presumably, as many forks in the network will appear as miners who mined a
|
|
||||||
block + a fork filled with null rounds only (for miners that didn't win a
|
|
||||||
round).
|
|
||||||
* at the end of the catch-up, the heaviest fork will win the race, and it may
|
|
||||||
be possible for the most powerful miner pre-disruption to affect the
|
|
||||||
outcome by choosing the messages that go in their blocks.
|
|
Loading…
Reference in New Issue
Block a user