Merge remote-tracking branch 'upstream/master' into adlrocha/cns-iface-master

This commit is contained in:
Alfonso de la Rocha 2022-12-05 18:16:14 +01:00
commit 075216d9da
217 changed files with 7947 additions and 5403 deletions

View File

@ -1,12 +1,13 @@
version: 2.1
orbs:
aws-cli: circleci/aws-cli@1.3.2
docker: circleci/docker@2.1.4
executors:
golang:
docker:
# Must match GO_VERSION_MIN in project root
- image: cimg/go:1.18.1
- image: cimg/go:1.18.8
resource_class: 2xlarge
ubuntu:
docker:
@ -583,129 +584,92 @@ jobs:
shell: /bin/bash -o pipefail
command: |
snapcraft upload *.snap --release << parameters.channel >>
build-and-push-image:
description: build and push docker images to public AWS ECR registry
executor: aws-cli/default
build-docker:
description: >
Publish to Dockerhub
executor: docker/docker
parameters:
profile-name:
image:
type: string
default: "default"
description: AWS profile name to be configured.
aws-access-key-id:
type: env_var_name
default: AWS_ACCESS_KEY_ID
default: lotus
description: >
AWS access key id for IAM role. Set this to the name of
the environment variable you will set to hold this
value, i.e. AWS_ACCESS_KEY.
aws-secret-access-key:
type: env_var_name
default: AWS_SECRET_ACCESS_KEY
description: >
AWS secret key for IAM role. Set this to the name of
the environment variable you will set to hold this
value, i.e. AWS_SECRET_ACCESS_KEY.
region:
type: env_var_name
default: AWS_REGION
description: >
Name of env var storing your AWS region information,
defaults to AWS_REGION
account-url:
type: env_var_name
default: AWS_ECR_ACCOUNT_URL
description: >
Env var storing Amazon ECR account URL that maps to an AWS account,
e.g. {awsAccountNum}.dkr.ecr.us-west-2.amazonaws.com
defaults to AWS_ECR_ACCOUNT_URL
dockerfile:
Passed to the docker build process to determine which image in the
Dockerfile should be built. Expected values are `lotus`,
`lotus-all-in-one`
network:
type: string
default: Dockerfile
description: Name of dockerfile to use. Defaults to Dockerfile.
path:
type: string
default: .
description: Path to the directory containing your Dockerfile and build context. Defaults to . (working directory).
extra-build-args:
default: "mainnet"
description: >
Passed to the docker build process using GOFLAGS+=-tags=<<network>>.
Expected values are `debug`, `2k`, `calibnet`, `butterflynet`,
`interopnet`.
channel:
type: string
default: ""
description: >
Extra flags to pass to docker build. For examples, see
https://docs.docker.com/engine/reference/commandline/build
repo:
type: string
description: Name of an Amazon ECR repository
tag:
type: string
default: "latest"
description: A comma-separated string containing docker image tags to build and push (default = latest)
target:
type: string
default: "lotus-all-in-one"
description: Docker target to build
The release channel to use for this image.
push:
type: boolean
default: false
description: >
When true, pushes the image to Dockerhub
steps:
- run:
name: Confirm that environment variables are set
command: |
if [ -z "$AWS_ACCESS_KEY_ID" ]; then
echo "No AWS_ACCESS_KEY_ID is set. Skipping build-and-push job ..."
circleci-agent step halt
fi
- aws-cli/setup:
profile-name: <<parameters.profile-name>>
aws-access-key-id: <<parameters.aws-access-key-id>>
aws-secret-access-key: <<parameters.aws-secret-access-key>>
aws-region: <<parameters.region>>
- run:
name: Log into Amazon ECR
command: |
aws ecr-public get-login-password --region $<<parameters.region>> --profile <<parameters.profile-name>> | docker login --username AWS --password-stdin $<<parameters.account-url>>
- setup_remote_docker
- checkout
- setup_remote_docker:
version: 19.03.13
docker_layer_caching: false
- docker/check:
docker-username: DOCKERHUB_USERNAME
docker-password: DOCKERHUB_PASSWORD
- when:
condition:
equal: [ mainnet, <<parameters.network>> ]
steps:
- when:
condition: <parameters.push>>
steps:
- docker/build:
image: filecoin/<<parameters.image>>
extra_build_args: --target <<parameters.image>>
tag: <<parameters.channel>>
- run:
name: Build docker image
name: Docker push
command: |
registry_id=$(echo $<<parameters.account-url>> | sed "s;\..*;;g")
docker_tag_args=""
IFS="," read -ra DOCKER_TAGS \<<< "<< parameters.tag >>"
for tag in "${DOCKER_TAGS[@]}"; do
docker_tag_args="$docker_tag_args -t $<<parameters.account-url>>/<<parameters.repo>>:$tag"
done
docker build \
<<#parameters.extra-build-args>><<parameters.extra-build-args>><</parameters.extra-build-args>> \
--target <<parameters.target>> \
-f <<parameters.path>>/<<parameters.dockerfile>> \
$docker_tag_args \
<<parameters.path>>
echo docker push filecoin/<<parameters.image>>:<<parameters.channel>>
if [[ ! -z $CIRCLE_TAG ]]; then
docker image tag filecoin/<<parameters.image>>:<<parameters.channel>> filecoin/<<parameters.image>>:"${CIRCLE_TAG}"
echo docker push filecoin/<<parameters.image>>:"${CIRCLE_TAG}"
fi
- unless:
condition: <<parameters.push>>
steps:
- docker/build:
image: filecoin/<<parameters.image>>
extra_build_args: --target <<parameters.image>>
- when:
condition:
not:
equal: [ mainnet, <<parameters.network>> ]
steps:
- when:
condition: <<parameters.push>>
steps:
- docker/build:
image: filecoin/<<parameters.image>>
extra_build_args: --target <<parameters.image>> --build-arg GOFLAGS=-tags=<<parameters.network>>
tag: <<parameters.channel>>-<<parameters.network>>
- run:
name: Push image to Amazon ECR
name: Docker push
command: |
IFS="," read -ra DOCKER_TAGS \<<< "<< parameters.tag >>"
for tag in "${DOCKER_TAGS[@]}"; do
docker push $<<parameters.account-url>>/<<parameters.repo>>:${tag}
done
echo docker push filecoin/<<parameters.image>>:<<parameters.channel>>-<<parameters.network>>
if [[ ! -z $CIRCLE_TAG ]]; then
docker image tag filecoin/<<parameters.image>>:<<parameters.channel>>-<<parameters.network>> filecoin/<<parameters.image>>:"${CIRCLE_TAG}"-<<parameters.network>>
echo docker push filecoin/<<parameters.image>>:"${CIRCLE_TAG}"-<<parameters.network>>
fi
- unless:
condition: <<parameters.push>>
steps:
- docker/build:
image: filecoin/<<parameters.image>>
extra_build_args: --target <<parameters.image>> --build-arg GOFLAGS=-tags=<<parameters.network>>
publish-packer-snap:
description: build packer image with snap. mainnet only.
@ -715,51 +679,6 @@ jobs:
- checkout
- packer_build:
template: tools/packer/lotus-snap.pkr.hcl
publish-dockerhub:
description: publish to dockerhub
machine:
image: ubuntu-2004:202010-01
parameters:
tag:
type: string
default: latest
steps:
- checkout
- run:
name: dockerhub login
command: echo $DOCKERHUB_PASSWORD | docker login --username $DOCKERHUB_USERNAME --password-stdin
- run:
name: docker build
command: |
docker build --target lotus -t filecoin/lotus:<< parameters.tag >> -f Dockerfile.lotus .
docker build --target lotus-gateway -t filecoin/lotus-gateway:<< parameters.tag >> -f Dockerfile.lotus .
docker build --target lotus-all-in-one -t filecoin/lotus-all-in-one:<< parameters.tag >> -f Dockerfile.lotus .
if [[ ! -z $CIRCLE_SHA1 ]]; then
docker build --target lotus -t filecoin/lotus:$CIRCLE_SHA1 -f Dockerfile.lotus .
docker build --target lotus-gateway -t filecoin/lotus-gateway:$CIRCLE_SHA1 -f Dockerfile.lotus .
docker build --target lotus-all-in-one -t filecoin/lotus-all-in-one:$CIRCLE_SHA1 -f Dockerfile.lotus .
fi
if [[ ! -z $CIRCLE_TAG ]]; then
docker build --target lotus -t filecoin/lotus:$CIRCLE_TAG -f Dockerfile.lotus .
docker build --target lotus-gateway -t filecoin/lotus-gateway:$CIRCLE_TAG -f Dockerfile.lotus .
docker build --target lotus-all-in-one -t filecoin/lotus-all-in-one:$CIRCLE_TAG -f Dockerfile.lotus .
fi
- run:
name: docker push
command: |
docker push filecoin/lotus:<< parameters.tag >>
docker push filecoin/lotus-gateway:<< parameters.tag >>
docker push filecoin/lotus-all-in-one:<< parameters.tag >>
if [[ ! -z $CIRCLE_SHA1 ]]; then
docker push filecoin/lotus:$CIRCLE_SHA1
docker push filecoin/lotus-gateway:$CIRCLE_SHA1
docker push filecoin/lotus-all-in-one:$CIRCLE_SHA1
fi
if [[ ! -z $CIRCLE_TAG ]]; then
docker push filecoin/lotus:$CIRCLE_TAG
docker push filecoin/lotus-gateway:$CIRCLE_TAG
docker push filecoin/lotus-all-in-one:$CIRCLE_TAG
fi
workflows:
version: 2.1
@ -1026,6 +945,11 @@ workflows:
suite: itest-sector_terminate
target: "./itests/sector_terminate_test.go"
- test:
name: test-itest-sector_unseal
suite: itest-sector_unseal
target: "./itests/sector_unseal_test.go"
- test:
name: test-itest-self_sent_txn
suite: itest-self_sent_txn
@ -1076,6 +1000,11 @@ workflows:
suite: itest-worker
target: "./itests/worker_test.go"
- test:
name: test-itest-worker_upgrade
suite: itest-worker_upgrade
target: "./itests/worker_upgrade_test.go"
- test:
name: test-unit-cli
suite: utest-unit-cli
@ -1144,8 +1073,6 @@ workflows:
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
- release:
name: "Release"
context:
- filecoin-goreleaser-key
requires:
- "Build ( darwin / amd64 )"
- "Build ( linux / amd64 )"
@ -1159,8 +1086,6 @@ workflows:
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
- release:
name: "Release (dry-run)"
context:
- filecoin-goreleaser-key
dry-run: true
requires:
- "Build ( darwin / amd64 )"
@ -1191,42 +1116,6 @@ workflows:
tags:
only:
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
- build-and-push-image:
name: "Publish ECR (lotus-all-in-one)"
dockerfile: Dockerfile.lotus
path: .
repo: lotus-dev
tag: '${CIRCLE_SHA1:0:8}'
target: lotus-all-in-one
- build-and-push-image:
name: "Publish ECR (lotus-test)"
dockerfile: Dockerfile.lotus
path: .
repo: lotus-test
tag: '${CIRCLE_SHA1:0:8}'
target: lotus-test
- publish-snapcraft:
name: "Publish Snapcraft (lotus-filecoin / candidate)"
channel: stable
snap-name: lotus-filecoin
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+$/
- publish-snapcraft:
name: "Publish Snapcraft (lotus-filecoin / candidate)"
channel: candidate
snap-name: lotus-filecoin
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+-rc\d+$/
- publish-snapcraft:
name: "Publish Snapcraft (lotus / stable)"
channel: stable
@ -1249,9 +1138,10 @@ workflows:
tags:
only:
- /^v\d+\.\d+\.\d+-rc\d+$/
- publish-dockerhub:
name: "Publish Dockerhub (stable)"
tag: stable
- publish-snapcraft:
name: "Publish Snapcraft (lotus-filecoin / stable)"
channel: stable
snap-name: lotus-filecoin
filters:
branches:
ignore:
@ -1259,9 +1149,10 @@ workflows:
tags:
only:
- /^v\d+\.\d+\.\d+$/
- publish-dockerhub:
name: "Publish Dockerhub (candidate)"
tag: candidate
- publish-snapcraft:
name: "Publish Snapcraft (lotus-filecoin / candidate)"
channel: candidate
snap-name: lotus-filecoin
filters:
branches:
ignore:
@ -1269,6 +1160,146 @@ workflows:
tags:
only:
- /^v\d+\.\d+\.\d+-rc\d+$/
- build-docker:
name: "Docker push (lotus-all-in-one / stable / mainnet)"
image: lotus-all-in-one
channel: stable
network: mainnet
push: true
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+$/
- build-docker:
name: "Docker push (lotus-all-in-one / candidate / mainnet)"
image: lotus-all-in-one
channel: candidate
network: mainnet
push: true
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+-rc\d+$/
- build-docker:
name: "Docker build (lotus-all-in-one / mainnet)"
image: lotus-all-in-one
network: mainnet
push: false
filters:
branches:
only:
- /^release\/v\d+\.\d+\.\d+(-rc\d+)?$/
- build-docker:
name: "Docker push (lotus-all-in-one / stable / butterflynet)"
image: lotus-all-in-one
channel: stable
network: butterflynet
push: true
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+$/
- build-docker:
name: "Docker push (lotus-all-in-one / candidate / butterflynet)"
image: lotus-all-in-one
channel: candidate
network: butterflynet
push: true
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+-rc\d+$/
- build-docker:
name: "Docker build (lotus-all-in-one / butterflynet)"
image: lotus-all-in-one
network: butterflynet
push: false
filters:
branches:
only:
- /^release\/v\d+\.\d+\.\d+(-rc\d+)?$/
- build-docker:
name: "Docker push (lotus-all-in-one / stable / calibnet)"
image: lotus-all-in-one
channel: stable
network: calibnet
push: true
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+$/
- build-docker:
name: "Docker push (lotus-all-in-one / candidate / calibnet)"
image: lotus-all-in-one
channel: candidate
network: calibnet
push: true
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+-rc\d+$/
- build-docker:
name: "Docker build (lotus-all-in-one / calibnet)"
image: lotus-all-in-one
network: calibnet
push: false
filters:
branches:
only:
- /^release\/v\d+\.\d+\.\d+(-rc\d+)?$/
- build-docker:
name: "Docker push (lotus-all-in-one / stable / debug)"
image: lotus-all-in-one
channel: stable
network: debug
push: true
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+$/
- build-docker:
name: "Docker push (lotus-all-in-one / candidate / debug)"
image: lotus-all-in-one
channel: candidate
network: debug
push: true
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+-rc\d+$/
- build-docker:
name: "Docker build (lotus-all-in-one / debug)"
image: lotus-all-in-one
network: debug
push: false
filters:
branches:
only:
- /^release\/v\d+\.\d+\.\d+(-rc\d+)?$/
nightly:
triggers:
@ -1280,16 +1311,37 @@ workflows:
- master
jobs:
- publish-snapcraft:
name: "Publish Snapcraft Nightly (lotus-filecoin / edge)"
channel: edge
snap-name: lotus-filecoin
- publish-snapcraft:
name: "Publish Snapcraft Nightly (lotus / edge)"
name: "Publish Snapcraft (lotus / edge)"
channel: edge
snap-name: lotus
- publish-dockerhub:
name: publish-dockerhub-nightly
tag: nightly
- publish-snapcraft:
name: "Publish Snapcraft (lotus-filecoin / edge)"
channel: edge
snap-name: lotus-filecoin
- build-docker:
name: "Docker (lotus-all-in-one / nightly / mainnet)"
image: lotus-all-in-one
channel: nightly
network: mainnet
push: true
- build-docker:
name: "Docker (lotus-all-in-one / nightly / butterflynet)"
image: lotus-all-in-one
channel: nightly
network: butterflynet
push: true
- build-docker:
name: "Docker (lotus-all-in-one / nightly / calibnet)"
image: lotus-all-in-one
channel: nightly
network: calibnet
push: true
- build-docker:
name: "Docker (lotus-all-in-one / nightly / debug)"
image: lotus-all-in-one
channel: nightly
network: debug
push: true
biweekly:
triggers:
- schedule:

View File

@ -106,10 +106,14 @@ func main() {
// form the input data.
type data struct {
Networks []string
SnapNames []string
ItestFiles []string
UnitSuites map[string]string
}
in := data{
Networks: []string{"mainnet", "butterflynet", "calibnet", "debug"},
SnapNames: []string{"lotus", "lotus-filecoin"},
ItestFiles: itests,
UnitSuites: func() map[string]string {
ret := make(map[string]string)

View File

@ -1,12 +1,13 @@
version: 2.1
orbs:
aws-cli: circleci/aws-cli@1.3.2
docker: circleci/docker@2.1.4
executors:
golang:
docker:
# Must match GO_VERSION_MIN in project root
- image: cimg/go:1.18.1
- image: cimg/go:1.18.8
resource_class: 2xlarge
ubuntu:
docker:
@ -583,129 +584,92 @@ jobs:
shell: /bin/bash -o pipefail
command: |
snapcraft upload *.snap --release << parameters.channel >>
build-and-push-image:
description: build and push docker images to public AWS ECR registry
executor: aws-cli/default
build-docker:
description: >
Publish to Dockerhub
executor: docker/docker
parameters:
profile-name:
image:
type: string
default: "default"
description: AWS profile name to be configured.
aws-access-key-id:
type: env_var_name
default: AWS_ACCESS_KEY_ID
default: lotus
description: >
AWS access key id for IAM role. Set this to the name of
the environment variable you will set to hold this
value, i.e. AWS_ACCESS_KEY.
aws-secret-access-key:
type: env_var_name
default: AWS_SECRET_ACCESS_KEY
description: >
AWS secret key for IAM role. Set this to the name of
the environment variable you will set to hold this
value, i.e. AWS_SECRET_ACCESS_KEY.
region:
type: env_var_name
default: AWS_REGION
description: >
Name of env var storing your AWS region information,
defaults to AWS_REGION
account-url:
type: env_var_name
default: AWS_ECR_ACCOUNT_URL
description: >
Env var storing Amazon ECR account URL that maps to an AWS account,
e.g. {awsAccountNum}.dkr.ecr.us-west-2.amazonaws.com
defaults to AWS_ECR_ACCOUNT_URL
dockerfile:
Passed to the docker build process to determine which image in the
Dockerfile should be built. Expected values are `lotus`,
`lotus-all-in-one`
network:
type: string
default: Dockerfile
description: Name of dockerfile to use. Defaults to Dockerfile.
path:
type: string
default: .
description: Path to the directory containing your Dockerfile and build context. Defaults to . (working directory).
extra-build-args:
default: "mainnet"
description: >
Passed to the docker build process using GOFLAGS+=-tags=<<network>>.
Expected values are `debug`, `2k`, `calibnet`, `butterflynet`,
`interopnet`.
channel:
type: string
default: ""
description: >
Extra flags to pass to docker build. For examples, see
https://docs.docker.com/engine/reference/commandline/build
repo:
type: string
description: Name of an Amazon ECR repository
tag:
type: string
default: "latest"
description: A comma-separated string containing docker image tags to build and push (default = latest)
target:
type: string
default: "lotus-all-in-one"
description: Docker target to build
The release channel to use for this image.
push:
type: boolean
default: false
description: >
When true, pushes the image to Dockerhub
steps:
- run:
name: Confirm that environment variables are set
command: |
if [ -z "$AWS_ACCESS_KEY_ID" ]; then
echo "No AWS_ACCESS_KEY_ID is set. Skipping build-and-push job ..."
circleci-agent step halt
fi
- aws-cli/setup:
profile-name: <<parameters.profile-name>>
aws-access-key-id: <<parameters.aws-access-key-id>>
aws-secret-access-key: <<parameters.aws-secret-access-key>>
aws-region: <<parameters.region>>
- run:
name: Log into Amazon ECR
command: |
aws ecr-public get-login-password --region $<<parameters.region>> --profile <<parameters.profile-name>> | docker login --username AWS --password-stdin $<<parameters.account-url>>
- setup_remote_docker
- checkout
- setup_remote_docker:
version: 19.03.13
docker_layer_caching: false
- docker/check:
docker-username: DOCKERHUB_USERNAME
docker-password: DOCKERHUB_PASSWORD
- when:
condition:
equal: [ mainnet, <<parameters.network>> ]
steps:
- when:
condition: <parameters.push>>
steps:
- docker/build:
image: filecoin/<<parameters.image>>
extra_build_args: --target <<parameters.image>>
tag: <<parameters.channel>>
- run:
name: Build docker image
name: Docker push
command: |
registry_id=$(echo $<<parameters.account-url>> | sed "s;\..*;;g")
docker_tag_args=""
IFS="," read -ra DOCKER_TAGS \<<< "<< parameters.tag >>"
for tag in "${DOCKER_TAGS[@]}"; do
docker_tag_args="$docker_tag_args -t $<<parameters.account-url>>/<<parameters.repo>>:$tag"
done
docker build \
<<#parameters.extra-build-args>><<parameters.extra-build-args>><</parameters.extra-build-args>> \
--target <<parameters.target>> \
-f <<parameters.path>>/<<parameters.dockerfile>> \
$docker_tag_args \
<<parameters.path>>
echo docker push filecoin/<<parameters.image>>:<<parameters.channel>>
if [["[[ ! -z $CIRCLE_TAG ]]"]]; then
docker image tag filecoin/<<parameters.image>>:<<parameters.channel>> filecoin/<<parameters.image>>:"${CIRCLE_TAG}"
echo docker push filecoin/<<parameters.image>>:"${CIRCLE_TAG}"
fi
- unless:
condition: <<parameters.push>>
steps:
- docker/build:
image: filecoin/<<parameters.image>>
extra_build_args: --target <<parameters.image>>
- when:
condition:
not:
equal: [ mainnet, <<parameters.network>> ]
steps:
- when:
condition: <<parameters.push>>
steps:
- docker/build:
image: filecoin/<<parameters.image>>
extra_build_args: --target <<parameters.image>> --build-arg GOFLAGS=-tags=<<parameters.network>>
tag: <<parameters.channel>>-<<parameters.network>>
- run:
name: Push image to Amazon ECR
name: Docker push
command: |
IFS="," read -ra DOCKER_TAGS \<<< "<< parameters.tag >>"
for tag in "${DOCKER_TAGS[@]}"; do
docker push $<<parameters.account-url>>/<<parameters.repo>>:${tag}
done
echo docker push filecoin/<<parameters.image>>:<<parameters.channel>>-<<parameters.network>>
if [["[[ ! -z $CIRCLE_TAG ]]"]]; then
docker image tag filecoin/<<parameters.image>>:<<parameters.channel>>-<<parameters.network>> filecoin/<<parameters.image>>:"${CIRCLE_TAG}"-<<parameters.network>>
echo docker push filecoin/<<parameters.image>>:"${CIRCLE_TAG}"-<<parameters.network>>
fi
- unless:
condition: <<parameters.push>>
steps:
- docker/build:
image: filecoin/<<parameters.image>>
extra_build_args: --target <<parameters.image>> --build-arg GOFLAGS=-tags=<<parameters.network>>
publish-packer-snap:
description: build packer image with snap. mainnet only.
@ -715,51 +679,6 @@ jobs:
- checkout
- packer_build:
template: tools/packer/lotus-snap.pkr.hcl
publish-dockerhub:
description: publish to dockerhub
machine:
image: ubuntu-2004:202010-01
parameters:
tag:
type: string
default: latest
steps:
- checkout
- run:
name: dockerhub login
command: echo $DOCKERHUB_PASSWORD | docker login --username $DOCKERHUB_USERNAME --password-stdin
- run:
name: docker build
command: |
docker build --target lotus -t filecoin/lotus:<< parameters.tag >> -f Dockerfile.lotus .
docker build --target lotus-gateway -t filecoin/lotus-gateway:<< parameters.tag >> -f Dockerfile.lotus .
docker build --target lotus-all-in-one -t filecoin/lotus-all-in-one:<< parameters.tag >> -f Dockerfile.lotus .
if [["[[ ! -z $CIRCLE_SHA1 ]]"]]; then
docker build --target lotus -t filecoin/lotus:$CIRCLE_SHA1 -f Dockerfile.lotus .
docker build --target lotus-gateway -t filecoin/lotus-gateway:$CIRCLE_SHA1 -f Dockerfile.lotus .
docker build --target lotus-all-in-one -t filecoin/lotus-all-in-one:$CIRCLE_SHA1 -f Dockerfile.lotus .
fi
if [["[[ ! -z $CIRCLE_TAG ]]"]]; then
docker build --target lotus -t filecoin/lotus:$CIRCLE_TAG -f Dockerfile.lotus .
docker build --target lotus-gateway -t filecoin/lotus-gateway:$CIRCLE_TAG -f Dockerfile.lotus .
docker build --target lotus-all-in-one -t filecoin/lotus-all-in-one:$CIRCLE_TAG -f Dockerfile.lotus .
fi
- run:
name: docker push
command: |
docker push filecoin/lotus:<< parameters.tag >>
docker push filecoin/lotus-gateway:<< parameters.tag >>
docker push filecoin/lotus-all-in-one:<< parameters.tag >>
if [["[[ ! -z $CIRCLE_SHA1 ]]"]]; then
docker push filecoin/lotus:$CIRCLE_SHA1
docker push filecoin/lotus-gateway:$CIRCLE_SHA1
docker push filecoin/lotus-all-in-one:$CIRCLE_SHA1
fi
if [["[[ ! -z $CIRCLE_TAG ]]"]]; then
docker push filecoin/lotus:$CIRCLE_TAG
docker push filecoin/lotus-gateway:$CIRCLE_TAG
docker push filecoin/lotus-all-in-one:$CIRCLE_TAG
fi
workflows:
version: 2.1
@ -839,8 +758,6 @@ workflows:
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
- release:
name: "Release"
context:
- filecoin-goreleaser-key
requires:
- "Build ( darwin / amd64 )"
- "Build ( linux / amd64 )"
@ -854,8 +771,6 @@ workflows:
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
- release:
name: "Release (dry-run)"
context:
- filecoin-goreleaser-key
dry-run: true
requires:
- "Build ( darwin / amd64 )"
@ -886,24 +801,11 @@ workflows:
tags:
only:
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
- build-and-push-image:
name: "Publish ECR (lotus-all-in-one)"
dockerfile: Dockerfile.lotus
path: .
repo: lotus-dev
tag: '${CIRCLE_SHA1:0:8}'
target: lotus-all-in-one
- build-and-push-image:
name: "Publish ECR (lotus-test)"
dockerfile: Dockerfile.lotus
path: .
repo: lotus-test
tag: '${CIRCLE_SHA1:0:8}'
target: lotus-test
[[- range .SnapNames]]
- publish-snapcraft:
name: "Publish Snapcraft (lotus-filecoin / candidate)"
name: "Publish Snapcraft ([[.]] / stable)"
channel: stable
snap-name: lotus-filecoin
snap-name: [[.]]
filters:
branches:
ignore:
@ -912,9 +814,9 @@ workflows:
only:
- /^v\d+\.\d+\.\d+$/
- publish-snapcraft:
name: "Publish Snapcraft (lotus-filecoin / candidate)"
name: "Publish Snapcraft ([[.]] / candidate)"
channel: candidate
snap-name: lotus-filecoin
snap-name: [[.]]
filters:
branches:
ignore:
@ -922,10 +824,14 @@ workflows:
tags:
only:
- /^v\d+\.\d+\.\d+-rc\d+$/
- publish-snapcraft:
name: "Publish Snapcraft (lotus / stable)"
[[- end]]
[[- range .Networks]]
- build-docker:
name: "Docker push (lotus-all-in-one / stable / [[.]])"
image: lotus-all-in-one
channel: stable
snap-name: lotus
network: [[.]]
push: true
filters:
branches:
ignore:
@ -933,10 +839,12 @@ workflows:
tags:
only:
- /^v\d+\.\d+\.\d+$/
- publish-snapcraft:
name: "Publish Snapcraft (lotus / candidate)"
- build-docker:
name: "Docker push (lotus-all-in-one / candidate / [[.]])"
image: lotus-all-in-one
channel: candidate
snap-name: lotus
network: [[.]]
push: true
filters:
branches:
ignore:
@ -944,26 +852,16 @@ workflows:
tags:
only:
- /^v\d+\.\d+\.\d+-rc\d+$/
- publish-dockerhub:
name: "Publish Dockerhub (stable)"
tag: stable
- build-docker:
name: "Docker build (lotus-all-in-one / [[.]])"
image: lotus-all-in-one
network: [[.]]
push: false
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+$/
- publish-dockerhub:
name: "Publish Dockerhub (candidate)"
tag: candidate
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+-rc\d+$/
- /^release\/v\d+\.\d+\.\d+(-rc\d+)?$/
[[- end]]
nightly:
triggers:
@ -974,17 +872,20 @@ workflows:
only:
- master
jobs:
[[- range .SnapNames]]
- publish-snapcraft:
name: "Publish Snapcraft Nightly (lotus-filecoin / edge)"
name: "Publish Snapcraft ([[.]] / edge)"
channel: edge
snap-name: lotus-filecoin
- publish-snapcraft:
name: "Publish Snapcraft Nightly (lotus / edge)"
channel: edge
snap-name: lotus
- publish-dockerhub:
name: publish-dockerhub-nightly
tag: nightly
snap-name: [[.]]
[[- end]]
[[- range .Networks]]
- build-docker:
name: "Docker (lotus-all-in-one / nightly / [[.]])"
image: lotus-all-in-one
channel: nightly
network: [[.]]
push: true
[[- end]]
biweekly:
triggers:
- schedule:

View File

@ -37,7 +37,7 @@ jobs:
- uses: actions/setup-go@v1
with:
go-version: '1.18.1'
go-version: '1.18.8'
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL

134
Dockerfile Normal file
View File

@ -0,0 +1,134 @@
#####################################
FROM golang:1.18.8-buster AS lotus-builder
MAINTAINER Lotus Development Team
RUN apt-get update && apt-get install -y ca-certificates build-essential clang ocl-icd-opencl-dev ocl-icd-libopencl1 jq libhwloc-dev
ENV XDG_CACHE_HOME="/tmp"
### taken from https://github.com/rust-lang/docker-rust/blob/master/1.63.0/buster/Dockerfile
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.63.0
RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='5cc9ffd1026e82e7fb2eec2121ad71f4b0f044e88bca39207b3f6b769aaa799c' ;; \
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='e189948e396d47254103a49c987e7fb0e5dd8e34b200aa4481ecc4b8e41fb929' ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
url="https://static.rust-lang.org/rustup/archive/1.25.1/${rustArch}/rustup-init"; \
wget "$url"; \
echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
chmod +x rustup-init; \
./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \
rm rustup-init; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup --version; \
cargo --version; \
rustc --version;
COPY ./ /opt/filecoin
WORKDIR /opt/filecoin
### make configurable filecoin-ffi build
ARG FFI_BUILD_FROM_SOURCE=0
ENV FFI_BUILD_FROM_SOURCE=${FFI_BUILD_FROM_SOURCE}
RUN make clean deps
ARG RUSTFLAGS=""
ARG GOFLAGS=""
RUN make buildall
#####################################
FROM ubuntu:20.04 AS lotus-base
MAINTAINER Lotus Development Team
# Base resources
COPY --from=lotus-builder /etc/ssl/certs /etc/ssl/certs
COPY --from=lotus-builder /lib/*/libdl.so.2 /lib/
COPY --from=lotus-builder /lib/*/librt.so.1 /lib/
COPY --from=lotus-builder /lib/*/libgcc_s.so.1 /lib/
COPY --from=lotus-builder /lib/*/libutil.so.1 /lib/
COPY --from=lotus-builder /usr/lib/*/libltdl.so.7 /lib/
COPY --from=lotus-builder /usr/lib/*/libnuma.so.1 /lib/
COPY --from=lotus-builder /usr/lib/*/libhwloc.so.5 /lib/
COPY --from=lotus-builder /usr/lib/*/libOpenCL.so.1 /lib/
RUN useradd -r -u 532 -U fc \
&& mkdir -p /etc/OpenCL/vendors \
&& echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd
#####################################
FROM lotus-base AS lotus
MAINTAINER Lotus Development Team
COPY --from=lotus-builder /opt/filecoin/lotus /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-shed /usr/local/bin/
COPY scripts/docker-lotus-entrypoint.sh /
ARG DOCKER_LOTUS_IMPORT_SNAPSHOT https://snapshots.mainnet.filops.net/minimal/latest
ENV DOCKER_LOTUS_IMPORT_SNAPSHOT ${DOCKER_LOTUS_IMPORT_SNAPSHOT}
ENV FILECOIN_PARAMETER_CACHE /var/tmp/filecoin-proof-parameters
ENV LOTUS_PATH /var/lib/lotus
ENV DOCKER_LOTUS_IMPORT_WALLET ""
RUN mkdir /var/lib/lotus /var/tmp/filecoin-proof-parameters
RUN chown fc: /var/lib/lotus /var/tmp/filecoin-proof-parameters
VOLUME /var/lib/lotus
VOLUME /var/tmp/filecoin-proof-parameters
USER fc
EXPOSE 1234
ENTRYPOINT ["/docker-lotus-entrypoint.sh"]
CMD ["-help"]
#####################################
FROM lotus-base AS lotus-all-in-one
ENV FILECOIN_PARAMETER_CACHE /var/tmp/filecoin-proof-parameters
ENV LOTUS_MINER_PATH /var/lib/lotus-miner
ENV LOTUS_PATH /var/lib/lotus
ENV LOTUS_WORKER_PATH /var/lib/lotus-worker
ENV WALLET_PATH /var/lib/lotus-wallet
COPY --from=lotus-builder /opt/filecoin/lotus /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-seed /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-shed /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-wallet /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-gateway /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-miner /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-worker /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-stats /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-fountain /usr/local/bin/
RUN mkdir /var/tmp/filecoin-proof-parameters
RUN mkdir /var/lib/lotus
RUN mkdir /var/lib/lotus-miner
RUN mkdir /var/lib/lotus-worker
RUN mkdir /var/lib/lotus-wallet
RUN chown fc: /var/tmp/filecoin-proof-parameters
RUN chown fc: /var/lib/lotus
RUN chown fc: /var/lib/lotus-miner
RUN chown fc: /var/lib/lotus-worker
RUN chown fc: /var/lib/lotus-wallet
VOLUME /var/tmp/filecoin-proof-parameters
VOLUME /var/lib/lotus
VOLUME /var/lib/lotus-miner
VOLUME /var/lib/lotus-worker
VOLUME /var/lib/lotus-wallet
EXPOSE 1234
EXPOSE 2345
EXPOSE 3456
EXPOSE 1777

View File

@ -1,4 +1,6 @@
FROM golang:1.18.1-buster AS builder-deps
##### DEPRECATED
FROM golang:1.18.8-buster AS builder-deps
MAINTAINER Lotus Development Team
RUN apt-get update && apt-get install -y ca-certificates build-essential clang ocl-icd-opencl-dev ocl-icd-libopencl1 jq libhwloc-dev

View File

@ -1 +1 @@
1.18.1
1.18.8

View File

@ -366,7 +366,7 @@ snap: lotus lotus-miner lotus-worker
# separate from gen because it needs binaries
docsgen-cli: lotus lotus-miner lotus-worker
python ./scripts/generate-lotus-cli.py
python3 ./scripts/generate-lotus-cli.py
./lotus config default > documentation/en/default-lotus-config.toml
./lotus-miner config default > documentation/en/default-lotus-miner-config.toml
.PHONY: docsgen-cli

View File

@ -10,7 +10,7 @@
<a href="https://circleci.com/gh/filecoin-project/lotus"><img src="https://circleci.com/gh/filecoin-project/lotus.svg?style=svg"></a>
<a href="https://codecov.io/gh/filecoin-project/lotus"><img src="https://codecov.io/gh/filecoin-project/lotus/branch/master/graph/badge.svg"></a>
<a href="https://goreportcard.com/report/github.com/filecoin-project/lotus"><img src="https://goreportcard.com/badge/github.com/filecoin-project/lotus" /></a>
<a href=""><img src="https://img.shields.io/badge/golang-%3E%3D1.18.1-blue.svg" /></a>
<a href=""><img src="https://img.shields.io/badge/golang-%3E%3D1.18.8-blue.svg" /></a>
<br>
</p>
@ -71,10 +71,10 @@ For other distributions you can find the required dependencies [here.](https://l
#### Go
To build Lotus, you need a working installation of [Go 1.18.1 or higher](https://golang.org/dl/):
To build Lotus, you need a working installation of [Go 1.18.8 or higher](https://golang.org/dl/):
```bash
wget -c https://golang.org/dl/go1.18.1.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
wget -c https://golang.org/dl/go1.18.8.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
```
**TIP:**

View File

@ -417,6 +417,10 @@ func (st *SealSeed) Equals(ost *SealSeed) bool {
type SectorState string
func (s *SectorState) String() string {
return string(*s)
}
type AddrUse int
const (

View File

@ -39,13 +39,13 @@ type Worker interface {
SealPreCommit2(ctx context.Context, sector storiface.SectorRef, pc1o storiface.PreCommit1Out) (storiface.CallID, error) //perm:admin
SealCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storiface.SectorCids) (storiface.CallID, error) //perm:admin
SealCommit2(ctx context.Context, sector storiface.SectorRef, c1o storiface.Commit1Out) (storiface.CallID, error) //perm:admin
FinalizeSector(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) (storiface.CallID, error) //perm:admin
FinalizeReplicaUpdate(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) (storiface.CallID, error) //perm:admin
FinalizeSector(ctx context.Context, sector storiface.SectorRef) (storiface.CallID, error) //perm:admin
FinalizeReplicaUpdate(ctx context.Context, sector storiface.SectorRef) (storiface.CallID, error) //perm:admin
ReplicaUpdate(ctx context.Context, sector storiface.SectorRef, pieces []abi.PieceInfo) (storiface.CallID, error) //perm:admin
ProveReplicaUpdate1(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.CallID, error) //perm:admin
ProveReplicaUpdate2(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storiface.ReplicaVanillaProofs) (storiface.CallID, error) //perm:admin
GenerateSectorKeyFromData(ctx context.Context, sector storiface.SectorRef, commD cid.Cid) (storiface.CallID, error) //perm:admin
ReleaseUnsealed(ctx context.Context, sector storiface.SectorRef, safeToFree []storiface.Range) (storiface.CallID, error) //perm:admin
ReleaseUnsealed(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) (storiface.CallID, error) //perm:admin
MoveStorage(ctx context.Context, sector storiface.SectorRef, types storiface.SectorFileType) (storiface.CallID, error) //perm:admin
UnsealPiece(context.Context, storiface.SectorRef, storiface.UnpaddedByteIndex, abi.UnpaddedPieceSize, abi.SealRandomness, cid.Cid) (storiface.CallID, error) //perm:admin
Fetch(context.Context, storiface.SectorRef, storiface.SectorFileType, storiface.PathType, storiface.AcquireMode) (storiface.CallID, error) //perm:admin

View File

@ -24,6 +24,8 @@ import (
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/protocol"
"github.com/multiformats/go-multiaddr"
"golang.org/x/text/cases"
"golang.org/x/text/language"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
@ -456,7 +458,8 @@ func exampleStruct(method string, t, parent reflect.Type) interface{} {
if f.Type == parent {
continue
}
if strings.Title(f.Name) == f.Name {
caser := cases.Title(language.English)
if caser.String(f.Name) == f.Name {
ns.Elem().Field(i).Set(reflect.ValueOf(ExampleValue(method, f.Type, t)))
}
}

View File

@ -2394,10 +2394,10 @@ func (mr *MockFullNodeMockRecorder) StateCall(arg0, arg1, arg2 interface{}) *gom
}
// StateChangedActors mocks base method.
func (m *MockFullNode) StateChangedActors(arg0 context.Context, arg1, arg2 cid.Cid) (map[string]types.Actor, error) {
func (m *MockFullNode) StateChangedActors(arg0 context.Context, arg1, arg2 cid.Cid) (map[string]types.ActorV5, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateChangedActors", arg0, arg1, arg2)
ret0, _ := ret[0].(map[string]types.Actor)
ret0, _ := ret[0].(map[string]types.ActorV5)
ret1, _ := ret[1].(error)
return ret0, ret1
}
@ -2499,10 +2499,10 @@ func (mr *MockFullNodeMockRecorder) StateEncodeParams(arg0, arg1, arg2, arg3 int
}
// StateGetActor mocks base method.
func (m *MockFullNode) StateGetActor(arg0 context.Context, arg1 address.Address, arg2 types.TipSetKey) (*types.Actor, error) {
func (m *MockFullNode) StateGetActor(arg0 context.Context, arg1 address.Address, arg2 types.TipSetKey) (*types.ActorV5, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateGetActor", arg0, arg1, arg2)
ret0, _ := ret[0].(*types.Actor)
ret0, _ := ret[0].(*types.ActorV5)
ret1, _ := ret[1].(error)
return ret0, ret1
}

View File

@ -978,9 +978,9 @@ type WorkerStruct struct {
Fetch func(p0 context.Context, p1 storiface.SectorRef, p2 storiface.SectorFileType, p3 storiface.PathType, p4 storiface.AcquireMode) (storiface.CallID, error) `perm:"admin"`
FinalizeReplicaUpdate func(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) `perm:"admin"`
FinalizeReplicaUpdate func(p0 context.Context, p1 storiface.SectorRef) (storiface.CallID, error) `perm:"admin"`
FinalizeSector func(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) `perm:"admin"`
FinalizeSector func(p0 context.Context, p1 storiface.SectorRef) (storiface.CallID, error) `perm:"admin"`
GenerateSectorKeyFromData func(p0 context.Context, p1 storiface.SectorRef, p2 cid.Cid) (storiface.CallID, error) `perm:"admin"`
@ -5689,25 +5689,25 @@ func (s *WorkerStub) Fetch(p0 context.Context, p1 storiface.SectorRef, p2 storif
return *new(storiface.CallID), ErrNotSupported
}
func (s *WorkerStruct) FinalizeReplicaUpdate(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) {
func (s *WorkerStruct) FinalizeReplicaUpdate(p0 context.Context, p1 storiface.SectorRef) (storiface.CallID, error) {
if s.Internal.FinalizeReplicaUpdate == nil {
return *new(storiface.CallID), ErrNotSupported
}
return s.Internal.FinalizeReplicaUpdate(p0, p1, p2)
return s.Internal.FinalizeReplicaUpdate(p0, p1)
}
func (s *WorkerStub) FinalizeReplicaUpdate(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) {
func (s *WorkerStub) FinalizeReplicaUpdate(p0 context.Context, p1 storiface.SectorRef) (storiface.CallID, error) {
return *new(storiface.CallID), ErrNotSupported
}
func (s *WorkerStruct) FinalizeSector(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) {
func (s *WorkerStruct) FinalizeSector(p0 context.Context, p1 storiface.SectorRef) (storiface.CallID, error) {
if s.Internal.FinalizeSector == nil {
return *new(storiface.CallID), ErrNotSupported
}
return s.Internal.FinalizeSector(p0, p1, p2)
return s.Internal.FinalizeSector(p0, p1)
}
func (s *WorkerStub) FinalizeSector(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) {
func (s *WorkerStub) FinalizeSector(p0 context.Context, p1 storiface.SectorRef) (storiface.CallID, error) {
return *new(storiface.CallID), ErrNotSupported
}

View File

@ -2249,10 +2249,10 @@ func (mr *MockFullNodeMockRecorder) StateCall(arg0, arg1, arg2 interface{}) *gom
}
// StateChangedActors mocks base method.
func (m *MockFullNode) StateChangedActors(arg0 context.Context, arg1, arg2 cid.Cid) (map[string]types.Actor, error) {
func (m *MockFullNode) StateChangedActors(arg0 context.Context, arg1, arg2 cid.Cid) (map[string]types.ActorV5, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateChangedActors", arg0, arg1, arg2)
ret0, _ := ret[0].(map[string]types.Actor)
ret0, _ := ret[0].(map[string]types.ActorV5)
ret1, _ := ret[1].(error)
return ret0, ret1
}
@ -2324,10 +2324,10 @@ func (mr *MockFullNodeMockRecorder) StateDecodeParams(arg0, arg1, arg2, arg3, ar
}
// StateGetActor mocks base method.
func (m *MockFullNode) StateGetActor(arg0 context.Context, arg1 address.Address, arg2 types.TipSetKey) (*types.Actor, error) {
func (m *MockFullNode) StateGetActor(arg0 context.Context, arg1 address.Address, arg2 types.TipSetKey) (*types.ActorV5, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateGetActor", arg0, arg1, arg2)
ret0, _ := ret[0].(*types.Actor)
ret0, _ := ret[0].(*types.ActorV5)
ret1, _ := ret[1].(error)
return ret0, ret1
}

View File

@ -58,7 +58,7 @@ var (
FullAPIVersion1 = newVer(2, 3, 0)
MinerAPIVersion0 = newVer(1, 5, 0)
WorkerAPIVersion0 = newVer(1, 6, 0)
WorkerAPIVersion0 = newVer(1, 7, 0)
)
//nolint:varcheck,deadcode

BIN
build/actors/v10.tar.zst Normal file

Binary file not shown.

View File

@ -41,6 +41,27 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
"system": MustParseCid("bafk2bzacedylltr57b2n6zpadh4i2c2kis4fzzvhao3kgvfaggrrbqyacew7q"),
"verifiedregistry": MustParseCid("bafk2bzacecjkesz766626ab4svnzpq3jfs26a75vfktlfaku5fjdao2eyiqyq"),
},
}, {
Network: "butterflynet",
Version: 10,
ManifestCid: MustParseCid("bafy2bzacea4rgt75va5jdxqgsk7gnoy7v3w4xfzbjcglxbgwb6gzh6sg3zl5w"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacea4gzorvg3ckenh3vpmc44mesw2jrm3smmazl6auc2bmklseadh6q"),
"cron": MustParseCid("bafk2bzacecksdqimo5w3lmqt4c2z5xrrfps4slqlulqgl654hyemir7n5zeei"),
"datacap": MustParseCid("bafk2bzacedquhyslr3b3bug6owm43xt2nr4t52gdh2w6m72oqkfog7ehxfelw"),
"eam": MustParseCid("bafk2bzaced5vm4tqg5qeq7mq54qlxufxahl6iyvbflrxt4qj4cq6xqhbe7kwi"),
"embryo": MustParseCid("bafk2bzaceaw3z7opkwf2nqh4jodh2oowyi7wn4rx3iuzohn6puvnvmzx3rwoc"),
"evm": MustParseCid("bafk2bzaceajaevvmu6bfnnuoj4dier36r4ffdf6rnbm5qt4gwfp22c3hwqtpm"),
"init": MustParseCid("bafk2bzacedxxpw3vnppnl3xoibhmztnkf3yr4njoogbng6ey2udesqscrikty"),
"multisig": MustParseCid("bafk2bzacedothsnjtkvvfubj6ilkwe727ithpo4a76m7whwc5gacca7iyfo6c"),
"paymentchannel": MustParseCid("bafk2bzacedetrghid7w37oevk6yhh5w3fl2aescniglof5ygvvnd2mey3uzjc"),
"reward": MustParseCid("bafk2bzacedmem56ss5h5xe77vpot45yb7bcrafhom6f7d7vthbidcxrow45nw"),
"storagemarket": MustParseCid("bafk2bzaceavgzm44zasym7cz344teslgo26dsg3oeseula4z3uctaip2lq5ko"),
"storageminer": MustParseCid("bafk2bzaceanuok53qivst7b3ppklaaiszzchszbj2l53pklinuylnill6chwa"),
"storagepower": MustParseCid("bafk2bzacedlfi7lpsekg6azt22ehu5ivxe5i5ieaw3eofmifupi5n3frwvnqy"),
"system": MustParseCid("bafk2bzacebfpjlwzt2obh4a7dddhrzi6gtvvhoc6hygc7nwvv6pqrjasxb4zi"),
"verifiedregistry": MustParseCid("bafk2bzacea4ygqb3y4ogzjv26ii2fucvkt34lvbjeknsjdbvxitf6bzcbd46y"),
},
}, {
Network: "calibrationnet",
Version: 8,
@ -76,6 +97,27 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
"system": MustParseCid("bafk2bzaceaue3nzucbom3tcclgyaahy3iwvbqejsxrohiquakvvsjgbw3shac"),
"verifiedregistry": MustParseCid("bafk2bzacebh7dj6j7yi5vadh7lgqjtq42qi2uq4n6zy2g5vjeathacwn2tscu"),
},
}, {
Network: "calibrationnet",
Version: 10,
ManifestCid: MustParseCid("bafy2bzacecvby6w67j5v4t2mn66hvupsrknxnntunmzw3rcfg6geyinwv6jxa"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacebm2q4sejrpri42mnnivz675ojruxz7kwxgofpnigisdfg5tyktou"),
"cron": MustParseCid("bafk2bzaceb5anggiq6okthrcze275zobnn2ymgwzopgipedzex6kcy6z7ekd4"),
"datacap": MustParseCid("bafk2bzaceaxicmkwivjartajumk6hn3ci3wxslymsujk36y7joai4zldepcc6"),
"eam": MustParseCid("bafk2bzaced2xbe3m2wywbjn6rqgqe6xcro3ysckixztuqljw6bqofkp7ers22"),
"embryo": MustParseCid("bafk2bzaceaw3z7opkwf2nqh4jodh2oowyi7wn4rx3iuzohn6puvnvmzx3rwoc"),
"evm": MustParseCid("bafk2bzaceb2smsfr2b5sa6iqf74wxdtpyvokbc3ii7xxklzww6uw7pkpwcnai"),
"init": MustParseCid("bafk2bzacec6i5tozav7o4wxfs2tjaikpvnremoih6q2goifyj35n4zc37ax3i"),
"multisig": MustParseCid("bafk2bzacec64dno264s5wjc3m3ejvn5u4a6zfbfyibumnkajcpvdszi3vtycg"),
"paymentchannel": MustParseCid("bafk2bzacecjoc36gvwlorpfau3fzad2rublc7v53t7rnsz7fmibe7kjahd5ek"),
"reward": MustParseCid("bafk2bzacedafgfzmuovijtm65ptplogkezdj2tjdfgwnof4kshzuxcqy6ugq2"),
"storagemarket": MustParseCid("bafk2bzacebombqolnpmzk3erezxpsrnaoue6iz3enlwyvqnthufwq7dufzexi"),
"storageminer": MustParseCid("bafk2bzacebr5dqqf43mptdkp7lq3h465ybia2bfoyj64fbscihn63igqjpks6"),
"storagepower": MustParseCid("bafk2bzacecikqp3mimztmwozjmkyihuttsduzvxam4ymomfvwwce7dimbdj2c"),
"system": MustParseCid("bafk2bzacecudy6gzj2d3syssl2v6ap4cj3wir7k35pypvwcztnscrjpdxztje"),
"verifiedregistry": MustParseCid("bafk2bzacedw5wqq6gzeidkeod7acaquan7xl4faolj2g6rehtml5zmq7sfoaw"),
},
}, {
Network: "caterpillarnet",
Version: 8,
@ -111,6 +153,27 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
"system": MustParseCid("bafk2bzacecisuqj2ln7ep72xaejvs2lrgh2logc7retxxpd3qvobymwyz7bxo"),
"verifiedregistry": MustParseCid("bafk2bzacebyjosiripwqyf56yhjfs5hg26mch7totsqth4rgpt5j32hqg6ric"),
},
}, {
Network: "caterpillarnet",
Version: 10,
ManifestCid: MustParseCid("bafy2bzacebpjaxv7j57sgukbglsc2pca52v3isw6iqeh7s665k4eyhq4da37s"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacedyw4z4v753i5i5b3pzo2hehzwwhnff2sdswzjaqcqsmk62dyv3om"),
"cron": MustParseCid("bafk2bzacecb3fpcua6xmhpi7oyofjqoz7covq6fn34ndzavtaweyafhdq23bo"),
"datacap": MustParseCid("bafk2bzacedri4nmev2hnpzbqermdrhtayrgp7byahv67rz5xya3to4vlzc74u"),
"eam": MustParseCid("bafk2bzacebx54arocffhfzkx7dhc3ahs75qhqrb4lsmp4alki5u6a2yq25jdg"),
"embryo": MustParseCid("bafk2bzaceaw3z7opkwf2nqh4jodh2oowyi7wn4rx3iuzohn6puvnvmzx3rwoc"),
"evm": MustParseCid("bafk2bzaceb4fnnporcrmm7dsncth2ypwa27zu5mw2jscaas763ge64zondh2g"),
"init": MustParseCid("bafk2bzaceayohpdeftjsnth2n2tlzuq3gnzm6hbghk5u6t7xvb46li6csrjp2"),
"multisig": MustParseCid("bafk2bzacebb7356w4oyynoszp23e6gjrmurrazczoxdtxudmha3jtotzscneo"),
"paymentchannel": MustParseCid("bafk2bzaceah4iuyi5w4s3mkajuy6gevnpojuhqezvh5bt5tt7sq5limi46wre"),
"reward": MustParseCid("bafk2bzaced2exgpqqpp3htidqy4dyxlj2cuywepzehmdvw63wqngahvcadceo"),
"storagemarket": MustParseCid("bafk2bzacebrgozvlm6k7aymg2yucdac6v6aqcujivifsrlbrkdenb7mnwn6fq"),
"storageminer": MustParseCid("bafk2bzacecivaazrw5mv3u6i6bybeaj6m3oleszjmlf2ubqgammmqqyiutcd2"),
"storagepower": MustParseCid("bafk2bzacedmali47whpko2qqc22ylbko2ozwmlfmaa32s5cjimb7m23apd63i"),
"system": MustParseCid("bafk2bzacec644tsb32jlmnuetmp7suwto63cay4ip2legftuilyiz6trfu22c"),
"verifiedregistry": MustParseCid("bafk2bzacea3dmogeew5vxm6biiqsfgmwom5gd642ghcdzyvah6xllejmfrlpk"),
},
}, {
Network: "devnet",
Version: 8,
@ -146,6 +209,27 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
"system": MustParseCid("bafk2bzacebgafb6h2o2g5whrujc2uvsttrussyc5t56rvhrjqkqhzdu4jopwa"),
"verifiedregistry": MustParseCid("bafk2bzacednorhcy446agy7ecpmfms2u4aoa3mj2eqomffuoerbik5yavrxyi"),
},
}, {
Network: "devnet",
Version: 10,
ManifestCid: MustParseCid("bafy2bzacea2z2ofgzxj7fd2zu5iem5lj6qyseltqrjwr456s6cf6brpb6ikmk"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacecn4usaovgx6oc3xvzmggsnlbhgxttqbvgts5wjiub6t546xrh6w2"),
"cron": MustParseCid("bafk2bzacea3t2j7zwa74y6de6jvoreuvon2v7ilzdkp3hifkjc32cvp6akhp4"),
"datacap": MustParseCid("bafk2bzacebewv7cf7pftpraqmrpaymtgvcd74ga5tb76fsuzokga7diq5soom"),
"eam": MustParseCid("bafk2bzacedw3dfaqeyddwo2w5nrfjbi6wfcedllxnmi6e7z6ch4yjlpupb4la"),
"embryo": MustParseCid("bafk2bzaceaw3z7opkwf2nqh4jodh2oowyi7wn4rx3iuzohn6puvnvmzx3rwoc"),
"evm": MustParseCid("bafk2bzacednmsvivt6tszxgnn3xy3iuwqqlhn5uif6mf4gj2du6ec4m6emble"),
"init": MustParseCid("bafk2bzaceaiz75eb4s73eublv7al5pq7oonsr2l2ce3aswmvty2qiwq4v2fka"),
"multisig": MustParseCid("bafk2bzacecgbfz224ry6qz2bqbclko77mpttrzl63xrowhmvitoq4n24hsiga"),
"paymentchannel": MustParseCid("bafk2bzacebqymanf5t7tskexwjxcr6xf7hy2s5zvfpzixkt5nddlzy4eopvmi"),
"reward": MustParseCid("bafk2bzacebsmzgseuzbmian7cviplttpr577tavbtsysunnhrgpz6wlmrvcr4"),
"storagemarket": MustParseCid("bafk2bzacecctblbu2vrgydkvni3g7fgqmbxr3rgatlbhg77lqrrb3q24hwacg"),
"storageminer": MustParseCid("bafk2bzacecfo764s4lyxjgfi5vf3lt5pphxmxjsactveth4sjjhwxkvvhymce"),
"storagepower": MustParseCid("bafk2bzaceaaucwxcfqnsikbrbacyb5f526rf5x2ld22knl237itv3gtlhx6we"),
"system": MustParseCid("bafk2bzacebaeqxina5ftv3vfjhf3lczpgr3iidkeuefj2azuqiwnfge22btc6"),
"verifiedregistry": MustParseCid("bafk2bzaceam6msqybrhgd425sfs4iilkfsi4rpd6w6lt24oafihrraaxpdd7m"),
},
}, {
Network: "mainnet",
Version: 8,
@ -181,6 +265,27 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
"system": MustParseCid("bafk2bzaceagvlo2jtahj7dloshrmwfulrd6e2izqev32qm46eumf754weec6c"),
"verifiedregistry": MustParseCid("bafk2bzacecf3yodlyudzukumehbuabgqljyhjt5ifiv4vetcfohnvsxzynwga"),
},
}, {
Network: "mainnet",
Version: 10,
ManifestCid: MustParseCid("bafy2bzacedegqdnmxsyqqp5oxrkwqmn3tvvpq4vicsswaydzaaznajb3hojim"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacedpweyqqf7zig5ghdrnn5wi7plhnmicfje75lkgkcneeh4aijcjsg"),
"cron": MustParseCid("bafk2bzacecs54gyscdh5u76vpgrhdycxqwheivmgcamyvfau5sr2f7zyazvqg"),
"datacap": MustParseCid("bafk2bzacedrwn5sqajrsoyzjgcljou4a44yxx4fo27b4jgysjaqssm2ysydcc"),
"eam": MustParseCid("bafk2bzacec4ptxbxh3f3hoqufvbnjm5eiaiuohlxbbqny4c3hgwggoihyude6"),
"embryo": MustParseCid("bafk2bzaceaw3z7opkwf2nqh4jodh2oowyi7wn4rx3iuzohn6puvnvmzx3rwoc"),
"evm": MustParseCid("bafk2bzaceayxmp4rl4sdsfsdry5e3qv7mdzgkgohk46h3notmxqvjutadtcr4"),
"init": MustParseCid("bafk2bzacebiobdrp6ozfsc6ulvi7kflrtibhmfmwbawsotmqgtcu3x6td2dv6"),
"multisig": MustParseCid("bafk2bzacecfdh7o3d7fqroy26bugmo6lsenh4eeohuyxudrb72ogzkrrsazus"),
"paymentchannel": MustParseCid("bafk2bzacebdtcwhs3a6cem76jthiyr2hrcmmlyxvgn2xcmwhdnfimvoczcwfy"),
"reward": MustParseCid("bafk2bzacec4d24zj4qokg5uf7zog24co2rrlkzc6dlwxj5qtaiiwjteapwrpo"),
"storagemarket": MustParseCid("bafk2bzaceajfqrzxhldofpifrnfb7shudwgf763n365jpw7ee4inpuqifgvze"),
"storageminer": MustParseCid("bafk2bzacedx5c6t5isrkqra4yxubyvccbgvaos7ssdelb25maymyy667mt6iy"),
"storagepower": MustParseCid("bafk2bzaceburpflgqepbh44yjsxyggdkmp4eetw3ibmxu5gjea6imfkv2vewm"),
"system": MustParseCid("bafk2bzacebm4fcxpznmpwvutvl5qihnfiswkbom5u2ov3mnmynjpqspbhjlfk"),
"verifiedregistry": MustParseCid("bafk2bzacebcoujf6qbatimkxz57oc5pffswlhslhe73scxcuvopoj2o4gvsg4"),
},
}, {
Network: "testing",
Version: 8,
@ -216,6 +321,27 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
"system": MustParseCid("bafk2bzacedo4pu3iwx2gu72hinsstpiokhl5iicnb3rumzffsnhy7zhmnxhyy"),
"verifiedregistry": MustParseCid("bafk2bzaceatmqip2o3ausbntvdhj7yemu6hb3b5yqv6hm42gylbbmz7geocpm"),
},
}, {
Network: "testing",
Version: 10,
ManifestCid: MustParseCid("bafy2bzaced7earbadfcdlrnpu52d4tcngyudcq6oov5l5upibymhfry5ftvma"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacebpicdpebz3cmkxiveviqxipr3ui7b7brrxkmljwqw6xq5l2gzjy6"),
"cron": MustParseCid("bafk2bzacebhn7klfyr23ngipexhmsbsr7nxubpurx3xfukxqppcoizeng4vku"),
"datacap": MustParseCid("bafk2bzacecr2tl54tis53js6waucd42snfabeqqmxrhzxkyd7om7ni57ivuim"),
"eam": MustParseCid("bafk2bzacea3otpwxssxlrscj527kbdhzino4tlopzhfdg4u52rtds6tmqhkrq"),
"embryo": MustParseCid("bafk2bzaceaw3z7opkwf2nqh4jodh2oowyi7wn4rx3iuzohn6puvnvmzx3rwoc"),
"evm": MustParseCid("bafk2bzaced7qpqgscwiq2um3j5jgigj2cmkrfdeyyet7uais7thxbcybjitxy"),
"init": MustParseCid("bafk2bzacec3whoya3dailimj2ozjomngowi2lewmkisvtz4xeiyyt5j4wvmoa"),
"multisig": MustParseCid("bafk2bzacectzqdgu6fm2e7rf3gckqwhbo6bchfha6yjjxdlfsllrwu7kkmfic"),
"paymentchannel": MustParseCid("bafk2bzacebmyoo7nyqtxyhjucz6xgacnqbqpoec5q5tpu5jbqjrslracq6foc"),
"reward": MustParseCid("bafk2bzacedjkb5hvskr7rrjjbtd6yomf5a2hue3bg7yupxpdfhfnbaufdiztm"),
"storagemarket": MustParseCid("bafk2bzaceac3c2ajpwiprdage7e23pvbd7zr2bjjotsowoodfxbdbvjzopud6"),
"storageminer": MustParseCid("bafk2bzacearulcdrsxqsglmfvvr4idrha5mmyvvdve4sxczp2d7na2q3mito4"),
"storagepower": MustParseCid("bafk2bzacecnqpq55qiptnzrrqrhfmuguuiptuflco7zg42f5vcorzj6y232lo"),
"system": MustParseCid("bafk2bzacec6qqnlzd35tmowisuydrombj46qdjg225l5c7asdlmsrhhfwezes"),
"verifiedregistry": MustParseCid("bafk2bzacecojfycqzm3ijydyle4n25pnxhue6bosoxsqhmcj6wtcc4w62vfr2"),
},
}, {
Network: "testing-fake-proofs",
Version: 8,
@ -251,4 +377,25 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
"system": MustParseCid("bafk2bzacedo4pu3iwx2gu72hinsstpiokhl5iicnb3rumzffsnhy7zhmnxhyy"),
"verifiedregistry": MustParseCid("bafk2bzaceatmqip2o3ausbntvdhj7yemu6hb3b5yqv6hm42gylbbmz7geocpm"),
},
}, {
Network: "testing-fake-proofs",
Version: 10,
ManifestCid: MustParseCid("bafy2bzacebyvmc775dd37hnd34joeqazs5qywk6mgrxqri6iibuk3pp5f5ql2"),
Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacebpicdpebz3cmkxiveviqxipr3ui7b7brrxkmljwqw6xq5l2gzjy6"),
"cron": MustParseCid("bafk2bzacebhn7klfyr23ngipexhmsbsr7nxubpurx3xfukxqppcoizeng4vku"),
"datacap": MustParseCid("bafk2bzacecr2tl54tis53js6waucd42snfabeqqmxrhzxkyd7om7ni57ivuim"),
"eam": MustParseCid("bafk2bzacea3otpwxssxlrscj527kbdhzino4tlopzhfdg4u52rtds6tmqhkrq"),
"embryo": MustParseCid("bafk2bzaceaw3z7opkwf2nqh4jodh2oowyi7wn4rx3iuzohn6puvnvmzx3rwoc"),
"evm": MustParseCid("bafk2bzaced7qpqgscwiq2um3j5jgigj2cmkrfdeyyet7uais7thxbcybjitxy"),
"init": MustParseCid("bafk2bzacec3whoya3dailimj2ozjomngowi2lewmkisvtz4xeiyyt5j4wvmoa"),
"multisig": MustParseCid("bafk2bzacectzqdgu6fm2e7rf3gckqwhbo6bchfha6yjjxdlfsllrwu7kkmfic"),
"paymentchannel": MustParseCid("bafk2bzacebmyoo7nyqtxyhjucz6xgacnqbqpoec5q5tpu5jbqjrslracq6foc"),
"reward": MustParseCid("bafk2bzacedjkb5hvskr7rrjjbtd6yomf5a2hue3bg7yupxpdfhfnbaufdiztm"),
"storagemarket": MustParseCid("bafk2bzaceac3c2ajpwiprdage7e23pvbd7zr2bjjotsowoodfxbdbvjzopud6"),
"storageminer": MustParseCid("bafk2bzacedubngj67gjuacbcfddyyrl2yxyih4zwjrkw26xppecpcw35f5tem"),
"storagepower": MustParseCid("bafk2bzaced2w5ijctujk2264a23geeep2fb5d27fexpfsz52muh5735uo27ye"),
"system": MustParseCid("bafk2bzacec6qqnlzd35tmowisuydrombj46qdjg225l5c7asdlmsrhhfwezes"),
"verifiedregistry": MustParseCid("bafk2bzacecojfycqzm3ijydyle4n25pnxhue6bosoxsqhmcj6wtcc4w62vfr2"),
},
}}

View File

@ -69,6 +69,10 @@ var DrandConfigs = map[DrandEnum]dtypes.DrandConfig{
ChainInfoJSON: `{"public_key":"8cda589f88914aa728fd183f383980b35789ce81b274e5daee1f338b77d02566ef4d3fb0098af1f844f10f9c803c1827","period":25,"genesis_time":1595348225,"hash":"e73b7dc3c4f6a236378220c0dd6aa110eb16eed26c11259606e07ee122838d4f","groupHash":"567d4785122a5a3e75a9bc9911d7ea807dd85ff76b78dc4ff06b075712898607"}`,
},
DrandIncentinet: {
Servers: []string{
"https://dev1.drand.sh",
"https://dev2.drand.sh",
},
ChainInfoJSON: `{"public_key":"8cad0c72c606ab27d36ee06de1d5b2db1faf92e447025ca37575ab3a8aac2eaae83192f846fc9e158bc738423753d000","period":30,"genesis_time":1595873820,"hash":"80c8b872c714f4c00fdd3daa465d5514049f457f01f85a4caf68cdcd394ba039","groupHash":"d9406aaed487f7af71851b4399448e311f2328923d454e971536c05398ce2d9b"}`,
},
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -22,7 +22,7 @@ const GenesisFile = ""
var NetworkBundle = "devnet"
var BundleOverrides map[actorstypes.Version]string
const GenesisNetworkVersion = network.Version16
const GenesisNetworkVersion = network.Version18
var UpgradeBreezeHeight = abi.ChainEpoch(-1)
@ -56,7 +56,7 @@ var UpgradeOhSnapHeight = abi.ChainEpoch(-18)
var UpgradeSkyrHeight = abi.ChainEpoch(-19)
var UpgradeSharkHeight = abi.ChainEpoch(100)
var UpgradeSharkHeight = abi.ChainEpoch(-20)
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
0: DrandMainnet,

View File

@ -87,7 +87,6 @@ var SupportedProofTypes = []abi.RegisteredSealProof{
abi.RegisteredSealProof_StackedDrg64GiBV1,
}
var ConsensusMinerMinPower = abi.NewStoragePower(10 << 40)
var MinVerifiedDealSize = abi.NewStoragePower(1 << 20)
var PreCommitChallengeDelay = abi.ChainEpoch(150)
var PropagationDelaySecs = uint64(10)

View File

@ -33,7 +33,7 @@ const TestNetworkVersion = network.Version{{.latestNetworkVersion}}
/* inline-gen start */
const TestNetworkVersion = network.Version17
const TestNetworkVersion = network.Version18
/* inline-gen end */

View File

@ -28,6 +28,7 @@ var actors = map[string][]int{
"reward": lotusactors.Versions,
"verifreg": lotusactors.Versions,
"datacap": lotusactors.Versions[8:],
"evm": lotusactors.Versions[9:],
}
func main() {

View File

@ -6,7 +6,7 @@ import (
"github.com/filecoin-project/go-address"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtin10 "github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/go-state-types/cbor"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
@ -21,7 +21,7 @@ import (
"github.com/filecoin-project/lotus/chain/types"
)
var Methods = builtin9.MethodsAccount
var Methods = builtin10.MethodsAccount
func Load(store adt.Store, act *types.Actor) (State, error) {
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
@ -37,6 +37,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
case actorstypes.Version9:
return load9(store, act.Head)
case actorstypes.Version10:
return load10(store, act.Head)
}
}
@ -98,6 +101,9 @@ func MakeState(store adt.Store, av actorstypes.Version, addr address.Address) (S
case actorstypes.Version9:
return make9(store, addr)
case actorstypes.Version10:
return make10(store, addr)
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
@ -124,5 +130,6 @@ func AllCodes() []cid.Cid {
(&state7{}).Code(),
(&state8{}).Code(),
(&state9{}).Code(),
(&state10{}).Code(),
}
}

61
chain/actors/builtin/account/v10.go generated Normal file
View File

@ -0,0 +1,61 @@
package account
import (
"fmt"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-address"
actorstypes "github.com/filecoin-project/go-state-types/actors"
account10 "github.com/filecoin-project/go-state-types/builtin/v10/account"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state10)(nil)
func load10(store adt.Store, root cid.Cid) (State, error) {
out := state10{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
func make10(store adt.Store, addr address.Address) (State, error) {
out := state10{store: store}
out.State = account10.State{Address: addr}
return &out, nil
}
type state10 struct {
account10.State
store adt.Store
}
func (s *state10) PubkeyAddress() (address.Address, error) {
return s.Address, nil
}
func (s *state10) GetState() interface{} {
return &s.State
}
func (s *state10) ActorKey() string {
return actors.AccountKey
}
func (s *state10) ActorVersion() actorstypes.Version {
return actorstypes.Version10
}
func (s *state10) Code() cid.Cid {
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
if !ok {
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
}
return code
}

View File

@ -5,7 +5,7 @@ import (
"golang.org/x/xerrors"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtin10 "github.com/filecoin-project/go-state-types/builtin"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
@ -33,6 +33,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
case actorstypes.Version9:
return load9(store, act.Head)
case actorstypes.Version10:
return load10(store, act.Head)
}
}
@ -94,13 +97,16 @@ func MakeState(store adt.Store, av actorstypes.Version) (State, error) {
case actorstypes.Version9:
return make9(store)
case actorstypes.Version10:
return make10(store)
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
var (
Address = builtin9.CronActorAddr
Methods = builtin9.MethodsCron
Address = builtin10.CronActorAddr
Methods = builtin10.MethodsCron
)
type State interface {
@ -122,5 +128,6 @@ func AllCodes() []cid.Cid {
(&state7{}).Code(),
(&state8{}).Code(),
(&state9{}).Code(),
(&state10{}).Code(),
}
}

56
chain/actors/builtin/cron/v10.go generated Normal file
View File

@ -0,0 +1,56 @@
package cron
import (
"fmt"
"github.com/ipfs/go-cid"
actorstypes "github.com/filecoin-project/go-state-types/actors"
cron10 "github.com/filecoin-project/go-state-types/builtin/v10/cron"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state10)(nil)
func load10(store adt.Store, root cid.Cid) (State, error) {
out := state10{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
func make10(store adt.Store) (State, error) {
out := state10{store: store}
out.State = *cron10.ConstructState(cron10.BuiltInEntries())
return &out, nil
}
type state10 struct {
cron10.State
store adt.Store
}
func (s *state10) GetState() interface{} {
return &s.State
}
func (s *state10) ActorKey() string {
return actors.CronKey
}
func (s *state10) ActorVersion() actorstypes.Version {
return actorstypes.Version10
}
func (s *state10) Code() cid.Cid {
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
if !ok {
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
}
return code
}

View File

@ -43,9 +43,8 @@ func MakeState(store adt.Store, av actorstypes.Version, governor address.Address
{{range .versions}}
case actorstypes.Version{{.}}:
return make{{.}}(store, governor, bitwidth)
default: return nil, xerrors.Errorf("datacap actor only valid for actors v9 and above, got %d", av)
{{end}}
default: return nil, xerrors.Errorf("datacap actor only valid for actors v9 and above, got %d", av)
}
}

View File

@ -7,7 +7,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtin10 "github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/go-state-types/cbor"
"github.com/filecoin-project/lotus/chain/actors"
@ -16,8 +16,8 @@ import (
)
var (
Address = builtin9.DatacapActorAddr
Methods = builtin9.MethodsDatacap
Address = builtin10.DatacapActorAddr
Methods = builtin10.MethodsDatacap
)
func Load(store adt.Store, act *types.Actor) (State, error) {
@ -31,6 +31,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
case actorstypes.Version9:
return load9(store, act.Head)
case actorstypes.Version10:
return load10(store, act.Head)
}
}
@ -43,9 +46,11 @@ func MakeState(store adt.Store, av actorstypes.Version, governor address.Address
case actorstypes.Version9:
return make9(store, governor, bitwidth)
case actorstypes.Version10:
return make10(store, governor, bitwidth)
default:
return nil, xerrors.Errorf("datacap actor only valid for actors v9 and above, got %d", av)
}
}
@ -65,5 +70,6 @@ type State interface {
func AllCodes() []cid.Cid {
return []cid.Cid{
(&state9{}).Code(),
(&state10{}).Code(),
}
}

View File

@ -54,6 +54,9 @@ func forEachClient(store adt.Store, ver actors.Version, root rootFunc, cb func(a
}
a, err := address.NewIDAddress(id)
if err != nil {
return xerrors.Errorf("creating ID address from actor ID: %w", err)
}
return cb(a, big.Div(dcap, verifreg.DataCapGranularity))
})

81
chain/actors/builtin/datacap/v10.go generated Normal file
View File

@ -0,0 +1,81 @@
package datacap
import (
"fmt"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
datacap10 "github.com/filecoin-project/go-state-types/builtin/v10/datacap"
adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state10)(nil)
func load10(store adt.Store, root cid.Cid) (State, error) {
out := state10{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
func make10(store adt.Store, governor address.Address, bitwidth uint64) (State, error) {
out := state10{store: store}
s, err := datacap10.ConstructState(store, governor, bitwidth)
if err != nil {
return nil, err
}
out.State = *s
return &out, nil
}
type state10 struct {
datacap10.State
store adt.Store
}
func (s *state10) Governor() (address.Address, error) {
return s.State.Governor, nil
}
func (s *state10) GetState() interface{} {
return &s.State
}
func (s *state10) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
return forEachClient(s.store, actors.Version10, s.verifiedClients, cb)
}
func (s *state10) verifiedClients() (adt.Map, error) {
return adt10.AsMap(s.store, s.Token.Balances, int(s.Token.HamtBitWidth))
}
func (s *state10) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
return getDataCap(s.store, actors.Version10, s.verifiedClients, addr)
}
func (s *state10) ActorKey() string {
return actors.DatacapKey
}
func (s *state10) ActorVersion() actorstypes.Version {
return actorstypes.Version10
}
func (s *state10) Code() cid.Cid {
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
if !ok {
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
}
return code
}

View File

@ -0,0 +1,51 @@
package evm
import (
"github.com/ipfs/go-cid"
"golang.org/x/xerrors"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/cbor"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
builtin{{.latestVersion}} "github.com/filecoin-project/go-state-types/builtin"
)
var Methods = builtin{{.latestVersion}}.MethodsEVM
func Load(store adt.Store, act *types.Actor) (State, error) {
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
if name != actors.EvmKey {
return nil, xerrors.Errorf("actor code is not evm: %s", name)
}
switch av {
{{range .versions}}
case actorstypes.Version{{.}}:
return load{{.}}(store, act.Head)
{{end}}
}
}
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
func MakeState(store adt.Store, av actorstypes.Version, bytecode cid.Cid) (State, error) {
switch av {
{{range .versions}}
case actorstypes.Version{{.}}:
return make{{.}}(store, bytecode)
{{end}}
default: return nil, xerrors.Errorf("evm actor only valid for actors v10 and above, got %d", av)
}
}
type State interface {
cbor.Marshaler
Nonce() (uint64, error)
GetState() interface{}
}

View File

@ -0,0 +1,51 @@
package evm
import (
"github.com/ipfs/go-cid"
"golang.org/x/xerrors"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtin10 "github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/go-state-types/cbor"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
)
var Methods = builtin10.MethodsEVM
func Load(store adt.Store, act *types.Actor) (State, error) {
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
if name != actors.EvmKey {
return nil, xerrors.Errorf("actor code is not evm: %s", name)
}
switch av {
case actorstypes.Version10:
return load10(store, act.Head)
}
}
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
func MakeState(store adt.Store, av actorstypes.Version, bytecode cid.Cid) (State, error) {
switch av {
case actorstypes.Version10:
return make10(store, bytecode)
default:
return nil, xerrors.Errorf("evm actor only valid for actors v10 and above, got %d", av)
}
}
type State interface {
cbor.Marshaler
Nonce() (uint64, error)
GetState() interface{}
}

View File

@ -0,0 +1,45 @@
package evm
import (
"github.com/ipfs/go-cid"
"github.com/filecoin-project/lotus/chain/actors/adt"
evm{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}evm"
)
var _ State = (*state{{.v}})(nil)
func load{{.v}}(store adt.Store, root cid.Cid) (State, error) {
out := state{{.v}}{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
func make{{.v}}(store adt.Store, bytecode cid.Cid) (State, error) {
out := state{{.v}}{store: store}
s, err := evm{{.v}}.ConstructState(store, bytecode)
if err != nil {
return nil, err
}
out.State = *s
return &out, nil
}
type state{{.v}} struct {
evm{{.v}}.State
store adt.Store
}
func (s *state{{.v}}) Nonce() (uint64, error) {
return s.State.Nonce, nil
}
func (s *state{{.v}}) GetState() interface{} {
return &s.State
}

45
chain/actors/builtin/evm/v10.go generated Normal file
View File

@ -0,0 +1,45 @@
package evm
import (
"github.com/ipfs/go-cid"
evm10 "github.com/filecoin-project/go-state-types/builtin/v10/evm"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state10)(nil)
func load10(store adt.Store, root cid.Cid) (State, error) {
out := state10{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
func make10(store adt.Store, bytecode cid.Cid) (State, error) {
out := state10{store: store}
s, err := evm10.ConstructState(store, bytecode)
if err != nil {
return nil, err
}
out.State = *s
return &out, nil
}
type state10 struct {
evm10.State
store adt.Store
}
func (s *state10) Nonce() (uint64, error) {
return s.State.Nonce, nil
}
func (s *state10) GetState() interface{} {
return &s.State
}

View File

@ -7,7 +7,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtin10 "github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/go-state-types/cbor"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
@ -24,8 +24,8 @@ import (
)
var (
Address = builtin9.InitActorAddr
Methods = builtin9.MethodsInit
Address = builtin10.InitActorAddr
Methods = builtin10.MethodsInit
)
func Load(store adt.Store, act *types.Actor) (State, error) {
@ -42,6 +42,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
case actorstypes.Version9:
return load9(store, act.Head)
case actorstypes.Version10:
return load10(store, act.Head)
}
}
@ -103,6 +106,9 @@ func MakeState(store adt.Store, av actorstypes.Version, networkName string) (Sta
case actorstypes.Version9:
return make9(store, networkName)
case actorstypes.Version10:
return make10(store, networkName)
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
@ -152,5 +158,6 @@ func AllCodes() []cid.Cid {
(&state7{}).Code(),
(&state8{}).Code(),
(&state9{}).Code(),
(&state10{}).Code(),
}
}

146
chain/actors/builtin/init/v10.go generated Normal file
View File

@ -0,0 +1,146 @@
package init
import (
"crypto/sha256"
"fmt"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtin10 "github.com/filecoin-project/go-state-types/builtin"
init10 "github.com/filecoin-project/go-state-types/builtin/v10/init"
adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/node/modules/dtypes"
)
var _ State = (*state10)(nil)
func load10(store adt.Store, root cid.Cid) (State, error) {
out := state10{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
func make10(store adt.Store, networkName string) (State, error) {
out := state10{store: store}
s, err := init10.ConstructState(store, networkName)
if err != nil {
return nil, err
}
out.State = *s
return &out, nil
}
type state10 struct {
init10.State
store adt.Store
}
func (s *state10) ResolveAddress(address address.Address) (address.Address, bool, error) {
return s.State.ResolveAddress(s.store, address)
}
func (s *state10) MapAddressToNewID(address address.Address) (address.Address, error) {
return s.State.MapAddressToNewID(s.store, address)
}
func (s *state10) ForEachActor(cb func(id abi.ActorID, address address.Address) error) error {
addrs, err := adt10.AsMap(s.store, s.State.AddressMap, builtin10.DefaultHamtBitwidth)
if err != nil {
return err
}
var actorID cbg.CborInt
return addrs.ForEach(&actorID, func(key string) error {
addr, err := address.NewFromBytes([]byte(key))
if err != nil {
return err
}
return cb(abi.ActorID(actorID), addr)
})
}
func (s *state10) NetworkName() (dtypes.NetworkName, error) {
return dtypes.NetworkName(s.State.NetworkName), nil
}
func (s *state10) SetNetworkName(name string) error {
s.State.NetworkName = name
return nil
}
func (s *state10) SetNextID(id abi.ActorID) error {
s.State.NextID = id
return nil
}
func (s *state10) Remove(addrs ...address.Address) (err error) {
m, err := adt10.AsMap(s.store, s.State.AddressMap, builtin10.DefaultHamtBitwidth)
if err != nil {
return err
}
for _, addr := range addrs {
if err = m.Delete(abi.AddrKey(addr)); err != nil {
return xerrors.Errorf("failed to delete entry for address: %s; err: %w", addr, err)
}
}
amr, err := m.Root()
if err != nil {
return xerrors.Errorf("failed to get address map root: %w", err)
}
s.State.AddressMap = amr
return nil
}
func (s *state10) SetAddressMap(mcid cid.Cid) error {
s.State.AddressMap = mcid
return nil
}
func (s *state10) GetState() interface{} {
return &s.State
}
func (s *state10) AddressMap() (adt.Map, error) {
return adt10.AsMap(s.store, s.State.AddressMap, builtin10.DefaultHamtBitwidth)
}
func (s *state10) AddressMapBitWidth() int {
return builtin10.DefaultHamtBitwidth
}
func (s *state10) AddressMapHashFunction() func(input []byte) []byte {
return func(input []byte) []byte {
res := sha256.Sum256(input)
return res[:]
}
}
func (s *state10) ActorKey() string {
return actors.InitKey
}
func (s *state10) ActorVersion() actorstypes.Version {
return actorstypes.Version10
}
func (s *state10) Code() cid.Cid {
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
if !ok {
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
}
return code
}

View File

@ -48,6 +48,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
case actorstypes.Version9:
return load9(store, act.Head)
case actorstypes.Version10:
return load10(store, act.Head)
}
}
@ -109,6 +112,9 @@ func MakeState(store adt.Store, av actorstypes.Version) (State, error) {
case actorstypes.Version9:
return make9(store)
case actorstypes.Version10:
return make10(store)
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
@ -198,6 +204,9 @@ func DecodePublishStorageDealsReturn(b []byte, nv network.Version) (PublishStora
case actorstypes.Version9:
return decodePublishStorageDealsReturn9(b)
case actorstypes.Version10:
return decodePublishStorageDealsReturn10(b)
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
@ -282,5 +291,6 @@ func AllCodes() []cid.Cid {
(&state7{}).Code(),
(&state8{}).Code(),
(&state9{}).Code(),
(&state10{}).Code(),
}
}

View File

@ -208,16 +208,17 @@ func (s *dealStates{{.v}}) array() adt.Array {
}
func fromV{{.v}}DealState(v{{.v}} market{{.v}}.DealState) DealState {
{{if (le .v 8)}}
return DealState{
ret := DealState{
SectorStartEpoch: v{{.v}}.SectorStartEpoch,
LastUpdatedEpoch: v{{.v}}.LastUpdatedEpoch,
SlashEpoch: v{{.v}}.SlashEpoch,
VerifiedClaim: 0,
}
{{else}}
return (DealState)(v{{.v}})
{{if (ge .v 9)}}
ret.VerifiedClaim = verifregtypes.AllocationId(v{{.v}}.VerifiedClaim)
{{end}}
return ret
}
type dealProposals{{.v}} struct {
@ -373,7 +374,7 @@ func (s *state{{.v}}) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifreg
{{if (le .v 8)}}
return verifregtypes.NoAllocationID, xerrors.Errorf("unsupported before actors v9")
{{else}}
allocations, err := adt9.AsMap(s.store, s.PendingDealAllocationIds, builtin.DefaultHamtBitwidth)
allocations, err := adt{{.v}}.AsMap(s.store, s.PendingDealAllocationIds, builtin.DefaultHamtBitwidth)
if err != nil {
return verifregtypes.NoAllocationID, xerrors.Errorf("failed to load allocation id for %d: %w", dealId, err)
}

View File

@ -187,14 +187,14 @@ func (s *dealStates0) array() adt.Array {
}
func fromV0DealState(v0 market0.DealState) DealState {
return DealState{
ret := DealState{
SectorStartEpoch: v0.SectorStartEpoch,
LastUpdatedEpoch: v0.LastUpdatedEpoch,
SlashEpoch: v0.SlashEpoch,
VerifiedClaim: 0,
}
return ret
}
type dealProposals0 struct {

376
chain/actors/builtin/market/v10.go generated Normal file
View File

@ -0,0 +1,376 @@
package market
import (
"bytes"
"fmt"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/builtin"
market10 "github.com/filecoin-project/go-state-types/builtin/v10/market"
adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt"
markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market"
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
)
var _ State = (*state10)(nil)
func load10(store adt.Store, root cid.Cid) (State, error) {
out := state10{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
func make10(store adt.Store) (State, error) {
out := state10{store: store}
s, err := market10.ConstructState(store)
if err != nil {
return nil, err
}
out.State = *s
return &out, nil
}
type state10 struct {
market10.State
store adt.Store
}
func (s *state10) TotalLocked() (abi.TokenAmount, error) {
fml := types.BigAdd(s.TotalClientLockedCollateral, s.TotalProviderLockedCollateral)
fml = types.BigAdd(fml, s.TotalClientStorageFee)
return fml, nil
}
func (s *state10) BalancesChanged(otherState State) (bool, error) {
otherState10, ok := otherState.(*state10)
if !ok {
// there's no way to compare different versions of the state, so let's
// just say that means the state of balances has changed
return true, nil
}
return !s.State.EscrowTable.Equals(otherState10.State.EscrowTable) || !s.State.LockedTable.Equals(otherState10.State.LockedTable), nil
}
func (s *state10) StatesChanged(otherState State) (bool, error) {
otherState10, ok := otherState.(*state10)
if !ok {
// there's no way to compare different versions of the state, so let's
// just say that means the state of balances has changed
return true, nil
}
return !s.State.States.Equals(otherState10.State.States), nil
}
func (s *state10) States() (DealStates, error) {
stateArray, err := adt10.AsArray(s.store, s.State.States, market10.StatesAmtBitwidth)
if err != nil {
return nil, err
}
return &dealStates10{stateArray}, nil
}
func (s *state10) ProposalsChanged(otherState State) (bool, error) {
otherState10, ok := otherState.(*state10)
if !ok {
// there's no way to compare different versions of the state, so let's
// just say that means the state of balances has changed
return true, nil
}
return !s.State.Proposals.Equals(otherState10.State.Proposals), nil
}
func (s *state10) Proposals() (DealProposals, error) {
proposalArray, err := adt10.AsArray(s.store, s.State.Proposals, market10.ProposalsAmtBitwidth)
if err != nil {
return nil, err
}
return &dealProposals10{proposalArray}, nil
}
func (s *state10) EscrowTable() (BalanceTable, error) {
bt, err := adt10.AsBalanceTable(s.store, s.State.EscrowTable)
if err != nil {
return nil, err
}
return &balanceTable10{bt}, nil
}
func (s *state10) LockedTable() (BalanceTable, error) {
bt, err := adt10.AsBalanceTable(s.store, s.State.LockedTable)
if err != nil {
return nil, err
}
return &balanceTable10{bt}, nil
}
func (s *state10) VerifyDealsForActivation(
minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch,
) (weight, verifiedWeight abi.DealWeight, err error) {
w, vw, _, err := market10.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch)
return w, vw, err
}
func (s *state10) NextID() (abi.DealID, error) {
return s.State.NextID, nil
}
type balanceTable10 struct {
*adt10.BalanceTable
}
func (bt *balanceTable10) ForEach(cb func(address.Address, abi.TokenAmount) error) error {
asMap := (*adt10.Map)(bt.BalanceTable)
var ta abi.TokenAmount
return asMap.ForEach(&ta, func(key string) error {
a, err := address.NewFromBytes([]byte(key))
if err != nil {
return err
}
return cb(a, ta)
})
}
type dealStates10 struct {
adt.Array
}
func (s *dealStates10) Get(dealID abi.DealID) (*DealState, bool, error) {
var deal10 market10.DealState
found, err := s.Array.Get(uint64(dealID), &deal10)
if err != nil {
return nil, false, err
}
if !found {
return nil, false, nil
}
deal := fromV10DealState(deal10)
return &deal, true, nil
}
func (s *dealStates10) ForEach(cb func(dealID abi.DealID, ds DealState) error) error {
var ds10 market10.DealState
return s.Array.ForEach(&ds10, func(idx int64) error {
return cb(abi.DealID(idx), fromV10DealState(ds10))
})
}
func (s *dealStates10) decode(val *cbg.Deferred) (*DealState, error) {
var ds10 market10.DealState
if err := ds10.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
return nil, err
}
ds := fromV10DealState(ds10)
return &ds, nil
}
func (s *dealStates10) array() adt.Array {
return s.Array
}
func fromV10DealState(v10 market10.DealState) DealState {
ret := DealState{
SectorStartEpoch: v10.SectorStartEpoch,
LastUpdatedEpoch: v10.LastUpdatedEpoch,
SlashEpoch: v10.SlashEpoch,
VerifiedClaim: 0,
}
ret.VerifiedClaim = verifregtypes.AllocationId(v10.VerifiedClaim)
return ret
}
type dealProposals10 struct {
adt.Array
}
func (s *dealProposals10) Get(dealID abi.DealID) (*DealProposal, bool, error) {
var proposal10 market10.DealProposal
found, err := s.Array.Get(uint64(dealID), &proposal10)
if err != nil {
return nil, false, err
}
if !found {
return nil, false, nil
}
proposal, err := fromV10DealProposal(proposal10)
if err != nil {
return nil, true, xerrors.Errorf("decoding proposal: %w", err)
}
return &proposal, true, nil
}
func (s *dealProposals10) ForEach(cb func(dealID abi.DealID, dp DealProposal) error) error {
var dp10 market10.DealProposal
return s.Array.ForEach(&dp10, func(idx int64) error {
dp, err := fromV10DealProposal(dp10)
if err != nil {
return xerrors.Errorf("decoding proposal: %w", err)
}
return cb(abi.DealID(idx), dp)
})
}
func (s *dealProposals10) decode(val *cbg.Deferred) (*DealProposal, error) {
var dp10 market10.DealProposal
if err := dp10.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
return nil, err
}
dp, err := fromV10DealProposal(dp10)
if err != nil {
return nil, err
}
return &dp, nil
}
func (s *dealProposals10) array() adt.Array {
return s.Array
}
func fromV10DealProposal(v10 market10.DealProposal) (DealProposal, error) {
label, err := fromV10Label(v10.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}
return DealProposal{
PieceCID: v10.PieceCID,
PieceSize: v10.PieceSize,
VerifiedDeal: v10.VerifiedDeal,
Client: v10.Client,
Provider: v10.Provider,
Label: label,
StartEpoch: v10.StartEpoch,
EndEpoch: v10.EndEpoch,
StoragePricePerEpoch: v10.StoragePricePerEpoch,
ProviderCollateral: v10.ProviderCollateral,
ClientCollateral: v10.ClientCollateral,
}, nil
}
func fromV10Label(v10 market10.DealLabel) (DealLabel, error) {
if v10.IsString() {
str, err := v10.ToString()
if err != nil {
return markettypes.EmptyDealLabel, xerrors.Errorf("failed to convert string label to string: %w", err)
}
return markettypes.NewLabelFromString(str)
}
bs, err := v10.ToBytes()
if err != nil {
return markettypes.EmptyDealLabel, xerrors.Errorf("failed to convert bytes label to bytes: %w", err)
}
return markettypes.NewLabelFromBytes(bs)
}
func (s *state10) GetState() interface{} {
return &s.State
}
var _ PublishStorageDealsReturn = (*publishStorageDealsReturn10)(nil)
func decodePublishStorageDealsReturn10(b []byte) (PublishStorageDealsReturn, error) {
var retval market10.PublishStorageDealsReturn
if err := retval.UnmarshalCBOR(bytes.NewReader(b)); err != nil {
return nil, xerrors.Errorf("failed to unmarshal PublishStorageDealsReturn: %w", err)
}
return &publishStorageDealsReturn10{retval}, nil
}
type publishStorageDealsReturn10 struct {
market10.PublishStorageDealsReturn
}
func (r *publishStorageDealsReturn10) IsDealValid(index uint64) (bool, int, error) {
set, err := r.ValidDeals.IsSet(index)
if err != nil || !set {
return false, -1, err
}
maskBf, err := bitfield.NewFromIter(&rlepluslazy.RunSliceIterator{
Runs: []rlepluslazy.Run{rlepluslazy.Run{Val: true, Len: index}}})
if err != nil {
return false, -1, err
}
before, err := bitfield.IntersectBitField(maskBf, r.ValidDeals)
if err != nil {
return false, -1, err
}
outIdx, err := before.Count()
if err != nil {
return false, -1, err
}
return set, int(outIdx), nil
}
func (r *publishStorageDealsReturn10) DealIDs() ([]abi.DealID, error) {
return r.IDs, nil
}
func (s *state10) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes.AllocationId, error) {
allocations, err := adt10.AsMap(s.store, s.PendingDealAllocationIds, builtin.DefaultHamtBitwidth)
if err != nil {
return verifregtypes.NoAllocationID, xerrors.Errorf("failed to load allocation id for %d: %w", dealId, err)
}
var allocationId cbg.CborInt
found, err := allocations.Get(abi.UIntKey(uint64(dealId)), &allocationId)
if err != nil {
return verifregtypes.NoAllocationID, xerrors.Errorf("failed to load allocation id for %d: %w", dealId, err)
}
if !found {
return verifregtypes.NoAllocationID, nil
}
return verifregtypes.AllocationId(allocationId), nil
}
func (s *state10) ActorKey() string {
return actors.MarketKey
}
func (s *state10) ActorVersion() actorstypes.Version {
return actorstypes.Version10
}
func (s *state10) Code() cid.Cid {
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
if !ok {
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
}
return code
}

View File

@ -187,14 +187,14 @@ func (s *dealStates2) array() adt.Array {
}
func fromV2DealState(v2 market2.DealState) DealState {
return DealState{
ret := DealState{
SectorStartEpoch: v2.SectorStartEpoch,
LastUpdatedEpoch: v2.LastUpdatedEpoch,
SlashEpoch: v2.SlashEpoch,
VerifiedClaim: 0,
}
return ret
}
type dealProposals2 struct {

View File

@ -182,14 +182,14 @@ func (s *dealStates3) array() adt.Array {
}
func fromV3DealState(v3 market3.DealState) DealState {
return DealState{
ret := DealState{
SectorStartEpoch: v3.SectorStartEpoch,
LastUpdatedEpoch: v3.LastUpdatedEpoch,
SlashEpoch: v3.SlashEpoch,
VerifiedClaim: 0,
}
return ret
}
type dealProposals3 struct {

View File

@ -182,14 +182,14 @@ func (s *dealStates4) array() adt.Array {
}
func fromV4DealState(v4 market4.DealState) DealState {
return DealState{
ret := DealState{
SectorStartEpoch: v4.SectorStartEpoch,
LastUpdatedEpoch: v4.LastUpdatedEpoch,
SlashEpoch: v4.SlashEpoch,
VerifiedClaim: 0,
}
return ret
}
type dealProposals4 struct {

View File

@ -182,14 +182,14 @@ func (s *dealStates5) array() adt.Array {
}
func fromV5DealState(v5 market5.DealState) DealState {
return DealState{
ret := DealState{
SectorStartEpoch: v5.SectorStartEpoch,
LastUpdatedEpoch: v5.LastUpdatedEpoch,
SlashEpoch: v5.SlashEpoch,
VerifiedClaim: 0,
}
return ret
}
type dealProposals5 struct {

View File

@ -184,14 +184,14 @@ func (s *dealStates6) array() adt.Array {
}
func fromV6DealState(v6 market6.DealState) DealState {
return DealState{
ret := DealState{
SectorStartEpoch: v6.SectorStartEpoch,
LastUpdatedEpoch: v6.LastUpdatedEpoch,
SlashEpoch: v6.SlashEpoch,
VerifiedClaim: 0,
}
return ret
}
type dealProposals6 struct {

View File

@ -184,14 +184,14 @@ func (s *dealStates7) array() adt.Array {
}
func fromV7DealState(v7 market7.DealState) DealState {
return DealState{
ret := DealState{
SectorStartEpoch: v7.SectorStartEpoch,
LastUpdatedEpoch: v7.LastUpdatedEpoch,
SlashEpoch: v7.SlashEpoch,
VerifiedClaim: 0,
}
return ret
}
type dealProposals7 struct {

View File

@ -185,14 +185,14 @@ func (s *dealStates8) array() adt.Array {
}
func fromV8DealState(v8 market8.DealState) DealState {
return DealState{
ret := DealState{
SectorStartEpoch: v8.SectorStartEpoch,
LastUpdatedEpoch: v8.LastUpdatedEpoch,
SlashEpoch: v8.SlashEpoch,
VerifiedClaim: 0,
}
return ret
}
type dealProposals8 struct {

View File

@ -186,9 +186,16 @@ func (s *dealStates9) array() adt.Array {
}
func fromV9DealState(v9 market9.DealState) DealState {
ret := DealState{
SectorStartEpoch: v9.SectorStartEpoch,
LastUpdatedEpoch: v9.LastUpdatedEpoch,
SlashEpoch: v9.SlashEpoch,
VerifiedClaim: 0,
}
return (DealState)(v9)
ret.VerifiedClaim = verifregtypes.AllocationId(v9.VerifiedClaim)
return ret
}
type dealProposals9 struct {

View File

@ -17,7 +17,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
miner{{.latestVersion}} "github.com/filecoin-project/go-state-types/builtin{{import .latestVersion}}miner"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
{{range .versions}}
{{if (le . 7)}}
@ -82,8 +82,8 @@ type State interface {
GetSector(abi.SectorNumber) (*SectorOnChainInfo, error)
FindSector(abi.SectorNumber) (*SectorLocation, error)
GetSectorExpiration(abi.SectorNumber) (*SectorExpiration, error)
GetPrecommittedSector(abi.SectorNumber) (*miner{{.latestVersion}}.SectorPreCommitOnChainInfo, error)
ForEachPrecommittedSector(func(miner{{.latestVersion}}.SectorPreCommitOnChainInfo) error) error
GetPrecommittedSector(abi.SectorNumber) (*SectorPreCommitOnChainInfo, error)
ForEachPrecommittedSector(func(SectorPreCommitOnChainInfo) error) error
LoadSectors(sectorNos *bitfield.BitField) ([]*SectorOnChainInfo, error)
NumLiveSectors() (uint64, error)
IsAllocated(abi.SectorNumber) (bool, error)
@ -112,7 +112,7 @@ type State interface {
sectors() (adt.Array, error)
decodeSectorOnChainInfo(*cbg.Deferred) (SectorOnChainInfo, error)
precommits() (adt.Map, error)
decodeSectorPreCommitOnChainInfo(*cbg.Deferred) (miner{{.latestVersion}}.SectorPreCommitOnChainInfo, error)
decodeSectorPreCommitOnChainInfo(*cbg.Deferred) (SectorPreCommitOnChainInfo, error)
GetState() interface{}
}
@ -150,7 +150,7 @@ type Partition interface {
UnprovenSectors() (bitfield.BitField, error)
}
type SectorOnChainInfo = miner{{.latestVersion}}.SectorOnChainInfo
type SectorOnChainInfo = minertypes.SectorOnChainInfo
func PreferredSealProofTypeFromWindowPoStType(nver network.Version, proof abi.RegisteredPoStProof) (abi.RegisteredSealProof, error) {
// We added support for the new proofs in network version 7, and removed support for the old
@ -205,9 +205,12 @@ func WinningPoStProofTypeFromWindowPoStProofType(nver network.Version, proof abi
}
}
type MinerInfo = miner{{.latestVersion}}.MinerInfo
type WorkerKeyChange = miner{{.latestVersion}}.WorkerKeyChange
type SectorPreCommitOnChainInfo = miner{{.latestVersion}}.SectorPreCommitOnChainInfo
type MinerInfo = minertypes.MinerInfo
type BeneficiaryTerm = minertypes.BeneficiaryTerm
type PendingBeneficiaryChange = minertypes.PendingBeneficiaryChange
type WorkerKeyChange = minertypes.WorkerKeyChange
type SectorPreCommitOnChainInfo = minertypes.SectorPreCommitOnChainInfo
type SectorPreCommitInfo = minertypes.SectorPreCommitInfo
type WindowPostVerifyInfo = proof.WindowPoStVerifyInfo
type SectorExpiration struct {
@ -235,8 +238,8 @@ type SectorExtensions struct {
}
type PreCommitChanges struct {
Added []miner{{.latestVersion}}.SectorPreCommitOnChainInfo
Removed []miner{{.latestVersion}}.SectorPreCommitOnChainInfo
Added []SectorPreCommitOnChainInfo
Removed []SectorPreCommitOnChainInfo
}
type LockedFunds struct {

View File

@ -9,7 +9,7 @@ import (
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/big"
miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/cbor"
"github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/go-state-types/network"
@ -41,6 +41,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
case actorstypes.Version9:
return load9(store, act.Head)
case actorstypes.Version10:
return load10(store, act.Head)
}
}
@ -102,6 +105,9 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
case actors.Version9:
return make9(store)
case actors.Version10:
return make10(store)
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
@ -124,8 +130,8 @@ type State interface {
GetSector(abi.SectorNumber) (*SectorOnChainInfo, error)
FindSector(abi.SectorNumber) (*SectorLocation, error)
GetSectorExpiration(abi.SectorNumber) (*SectorExpiration, error)
GetPrecommittedSector(abi.SectorNumber) (*miner9.SectorPreCommitOnChainInfo, error)
ForEachPrecommittedSector(func(miner9.SectorPreCommitOnChainInfo) error) error
GetPrecommittedSector(abi.SectorNumber) (*SectorPreCommitOnChainInfo, error)
ForEachPrecommittedSector(func(SectorPreCommitOnChainInfo) error) error
LoadSectors(sectorNos *bitfield.BitField) ([]*SectorOnChainInfo, error)
NumLiveSectors() (uint64, error)
IsAllocated(abi.SectorNumber) (bool, error)
@ -154,7 +160,7 @@ type State interface {
sectors() (adt.Array, error)
decodeSectorOnChainInfo(*cbg.Deferred) (SectorOnChainInfo, error)
precommits() (adt.Map, error)
decodeSectorPreCommitOnChainInfo(*cbg.Deferred) (miner9.SectorPreCommitOnChainInfo, error)
decodeSectorPreCommitOnChainInfo(*cbg.Deferred) (SectorPreCommitOnChainInfo, error)
GetState() interface{}
}
@ -192,7 +198,7 @@ type Partition interface {
UnprovenSectors() (bitfield.BitField, error)
}
type SectorOnChainInfo = miner9.SectorOnChainInfo
type SectorOnChainInfo = minertypes.SectorOnChainInfo
func PreferredSealProofTypeFromWindowPoStType(nver network.Version, proof abi.RegisteredPoStProof) (abi.RegisteredSealProof, error) {
// We added support for the new proofs in network version 7, and removed support for the old
@ -247,9 +253,12 @@ func WinningPoStProofTypeFromWindowPoStProofType(nver network.Version, proof abi
}
}
type MinerInfo = miner9.MinerInfo
type WorkerKeyChange = miner9.WorkerKeyChange
type SectorPreCommitOnChainInfo = miner9.SectorPreCommitOnChainInfo
type MinerInfo = minertypes.MinerInfo
type BeneficiaryTerm = minertypes.BeneficiaryTerm
type PendingBeneficiaryChange = minertypes.PendingBeneficiaryChange
type WorkerKeyChange = minertypes.WorkerKeyChange
type SectorPreCommitOnChainInfo = minertypes.SectorPreCommitOnChainInfo
type SectorPreCommitInfo = minertypes.SectorPreCommitInfo
type WindowPostVerifyInfo = proof.WindowPoStVerifyInfo
type SectorExpiration struct {
@ -277,8 +286,8 @@ type SectorExtensions struct {
}
type PreCommitChanges struct {
Added []miner9.SectorPreCommitOnChainInfo
Removed []miner9.SectorPreCommitOnChainInfo
Added []SectorPreCommitOnChainInfo
Removed []SectorPreCommitOnChainInfo
}
type LockedFunds struct {
@ -302,5 +311,6 @@ func AllCodes() []cid.Cid {
(&state7{}).Code(),
(&state8{}).Code(),
(&state9{}).Code(),
(&state10{}).Code(),
}
}

View File

@ -18,7 +18,6 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors"
actorstypes "github.com/filecoin-project/go-state-types/actors"
minertypes "github.com/filecoin-project/go-state-types/builtin/v{{.latestVersion}}/miner"
{{if (le .v 7)}}
{{if (ge .v 3)}}
@ -218,7 +217,7 @@ func (s *state{{.v}}) GetSectorExpiration(num abi.SectorNumber) (*SectorExpirati
return &out, nil
}
func (s *state{{.v}}) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.SectorPreCommitOnChainInfo, error) {
func (s *state{{.v}}) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
if !ok || err != nil {
return nil, err
@ -229,7 +228,7 @@ func (s *state{{.v}}) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.S
return &ret, nil
}
func (s *state{{.v}}) ForEachPrecommittedSector(cb func(minertypes.SectorPreCommitOnChainInfo) error) error {
func (s *state{{.v}}) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
{{if (ge .v 3) -}}
precommitted, err := adt{{.v}}.AsMap(s.store, s.State.PreCommittedSectors, builtin{{.v}}.DefaultHamtBitwidth)
{{- else -}}
@ -418,8 +417,9 @@ func (s *state{{.v}}) Info() (MinerInfo, error) {
ConsensusFaultElapsed: {{if (ge .v 2)}}info.ConsensusFaultElapsed{{else}}-1{{end}},
{{if (ge .v 9)}}
Beneficiary: info.Beneficiary,
BeneficiaryTerm: info.BeneficiaryTerm,
PendingBeneficiaryTerm: info.PendingBeneficiaryTerm,{{end}}
BeneficiaryTerm: BeneficiaryTerm(info.BeneficiaryTerm),
PendingBeneficiaryTerm: (*PendingBeneficiaryChange)(info.PendingBeneficiaryTerm),
{{end}}
}
return mi, nil
@ -451,11 +451,11 @@ func (s *state{{.v}}) precommits() (adt.Map, error) {
return adt{{.v}}.AsMap(s.store, s.PreCommittedSectors{{if (ge .v 3)}}, builtin{{.v}}.DefaultHamtBitwidth{{end}})
}
func (s *state{{.v}}) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (minertypes.SectorPreCommitOnChainInfo, error) {
func (s *state{{.v}}) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
var sp miner{{.v}}.SectorPreCommitOnChainInfo
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return minertypes.SectorPreCommitOnChainInfo{}, err
return SectorPreCommitOnChainInfo{}, err
}
return fromV{{.v}}SectorPreCommitOnChainInfo(sp), nil
@ -586,9 +586,9 @@ func fromV{{.v}}SectorOnChainInfo(v{{.v}} miner{{.v}}.SectorOnChainInfo) SectorO
return info
}
func fromV{{.v}}SectorPreCommitOnChainInfo(v{{.v}} miner{{.v}}.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
{{if (le .v 8)}}return minertypes.SectorPreCommitOnChainInfo{
Info: minertypes.SectorPreCommitInfo{
func fromV{{.v}}SectorPreCommitOnChainInfo(v{{.v}} miner{{.v}}.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
ret := SectorPreCommitOnChainInfo{
Info: SectorPreCommitInfo{
SealProof: v{{.v}}.Info.SealProof,
SectorNumber: v{{.v}}.Info.SectorNumber,
SealedCID: v{{.v}}.Info.SealedCID,
@ -599,7 +599,13 @@ func fromV{{.v}}SectorPreCommitOnChainInfo(v{{.v}} miner{{.v}}.SectorPreCommitOn
},
PreCommitDeposit: v{{.v}}.PreCommitDeposit,
PreCommitEpoch: v{{.v}}.PreCommitEpoch,
}{{else}}return v{{.v}}{{end}}
}
{{if (ge .v 9)}}
ret.Info.UnsealedCid = v{{.v}}.Info.UnsealedCid
{{end}}
return ret
}
func (s *state{{.v}}) GetState() interface{} {

View File

@ -14,7 +14,6 @@ import (
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/big"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/dline"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
@ -198,7 +197,7 @@ func (s *state0) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
return &out, nil
}
func (s *state0) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.SectorPreCommitOnChainInfo, error) {
func (s *state0) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
if !ok || err != nil {
return nil, err
@ -209,7 +208,7 @@ func (s *state0) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.Sector
return &ret, nil
}
func (s *state0) ForEachPrecommittedSector(cb func(minertypes.SectorPreCommitOnChainInfo) error) error {
func (s *state0) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
precommitted, err := adt0.AsMap(s.store, s.State.PreCommittedSectors)
if err != nil {
return err
@ -422,11 +421,11 @@ func (s *state0) precommits() (adt.Map, error) {
return adt0.AsMap(s.store, s.PreCommittedSectors)
}
func (s *state0) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (minertypes.SectorPreCommitOnChainInfo, error) {
func (s *state0) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
var sp miner0.SectorPreCommitOnChainInfo
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return minertypes.SectorPreCommitOnChainInfo{}, err
return SectorPreCommitOnChainInfo{}, err
}
return fromV0SectorPreCommitOnChainInfo(sp), nil
@ -512,9 +511,9 @@ func fromV0SectorOnChainInfo(v0 miner0.SectorOnChainInfo) SectorOnChainInfo {
return info
}
func fromV0SectorPreCommitOnChainInfo(v0 miner0.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
return minertypes.SectorPreCommitOnChainInfo{
Info: minertypes.SectorPreCommitInfo{
func fromV0SectorPreCommitOnChainInfo(v0 miner0.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
ret := SectorPreCommitOnChainInfo{
Info: SectorPreCommitInfo{
SealProof: v0.Info.SealProof,
SectorNumber: v0.Info.SectorNumber,
SealedCID: v0.Info.SealedCID,
@ -526,6 +525,8 @@ func fromV0SectorPreCommitOnChainInfo(v0 miner0.SectorPreCommitOnChainInfo) mine
PreCommitDeposit: v0.PreCommitDeposit,
PreCommitEpoch: v0.PreCommitEpoch,
}
return ret
}
func (s *state0) GetState() interface{} {

589
chain/actors/builtin/miner/v10.go generated Normal file
View File

@ -0,0 +1,589 @@
package miner
import (
"bytes"
"errors"
"fmt"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-bitfield"
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtin10 "github.com/filecoin-project/go-state-types/builtin"
miner10 "github.com/filecoin-project/go-state-types/builtin/v10/miner"
adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt"
"github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state10)(nil)
func load10(store adt.Store, root cid.Cid) (State, error) {
out := state10{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
func make10(store adt.Store) (State, error) {
out := state10{store: store}
out.State = miner10.State{}
return &out, nil
}
type state10 struct {
miner10.State
store adt.Store
}
type deadline10 struct {
miner10.Deadline
store adt.Store
}
type partition10 struct {
miner10.Partition
store adt.Store
}
func (s *state10) AvailableBalance(bal abi.TokenAmount) (available abi.TokenAmount, err error) {
defer func() {
if r := recover(); r != nil {
err = xerrors.Errorf("failed to get available balance: %w", r)
available = abi.NewTokenAmount(0)
}
}()
// this panics if the miner doesnt have enough funds to cover their locked pledge
available, err = s.GetAvailableBalance(bal)
return available, err
}
func (s *state10) VestedFunds(epoch abi.ChainEpoch) (abi.TokenAmount, error) {
return s.CheckVestedFunds(s.store, epoch)
}
func (s *state10) LockedFunds() (LockedFunds, error) {
return LockedFunds{
VestingFunds: s.State.LockedFunds,
InitialPledgeRequirement: s.State.InitialPledge,
PreCommitDeposits: s.State.PreCommitDeposits,
}, nil
}
func (s *state10) FeeDebt() (abi.TokenAmount, error) {
return s.State.FeeDebt, nil
}
func (s *state10) InitialPledge() (abi.TokenAmount, error) {
return s.State.InitialPledge, nil
}
func (s *state10) PreCommitDeposits() (abi.TokenAmount, error) {
return s.State.PreCommitDeposits, nil
}
func (s *state10) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) {
info, ok, err := s.State.GetSector(s.store, num)
if !ok || err != nil {
return nil, err
}
ret := fromV10SectorOnChainInfo(*info)
return &ret, nil
}
func (s *state10) FindSector(num abi.SectorNumber) (*SectorLocation, error) {
dlIdx, partIdx, err := s.State.FindSector(s.store, num)
if err != nil {
return nil, err
}
return &SectorLocation{
Deadline: dlIdx,
Partition: partIdx,
}, nil
}
func (s *state10) NumLiveSectors() (uint64, error) {
dls, err := s.State.LoadDeadlines(s.store)
if err != nil {
return 0, err
}
var total uint64
if err := dls.ForEach(s.store, func(dlIdx uint64, dl *miner10.Deadline) error {
total += dl.LiveSectors
return nil
}); err != nil {
return 0, err
}
return total, nil
}
// GetSectorExpiration returns the effective expiration of the given sector.
//
// If the sector does not expire early, the Early expiration field is 0.
func (s *state10) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, error) {
dls, err := s.State.LoadDeadlines(s.store)
if err != nil {
return nil, err
}
// NOTE: this can be optimized significantly.
// 1. If the sector is non-faulty, it will expire on-time (can be
// learned from the sector info).
// 2. If it's faulty, it will expire early within the first 42 entries
// of the expiration queue.
stopErr := errors.New("stop")
out := SectorExpiration{}
err = dls.ForEach(s.store, func(dlIdx uint64, dl *miner10.Deadline) error {
partitions, err := dl.PartitionsArray(s.store)
if err != nil {
return err
}
quant := s.State.QuantSpecForDeadline(dlIdx)
var part miner10.Partition
return partitions.ForEach(&part, func(partIdx int64) error {
if found, err := part.Sectors.IsSet(uint64(num)); err != nil {
return err
} else if !found {
return nil
}
if found, err := part.Terminated.IsSet(uint64(num)); err != nil {
return err
} else if found {
// already terminated
return stopErr
}
q, err := miner10.LoadExpirationQueue(s.store, part.ExpirationsEpochs, quant, miner10.PartitionExpirationAmtBitwidth)
if err != nil {
return err
}
var exp miner10.ExpirationSet
return q.ForEach(&exp, func(epoch int64) error {
if early, err := exp.EarlySectors.IsSet(uint64(num)); err != nil {
return err
} else if early {
out.Early = abi.ChainEpoch(epoch)
return nil
}
if onTime, err := exp.OnTimeSectors.IsSet(uint64(num)); err != nil {
return err
} else if onTime {
out.OnTime = abi.ChainEpoch(epoch)
return stopErr
}
return nil
})
})
})
if err == stopErr {
err = nil
}
if err != nil {
return nil, err
}
if out.Early == 0 && out.OnTime == 0 {
return nil, xerrors.Errorf("failed to find sector %d", num)
}
return &out, nil
}
func (s *state10) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
if !ok || err != nil {
return nil, err
}
ret := fromV10SectorPreCommitOnChainInfo(*info)
return &ret, nil
}
func (s *state10) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
precommitted, err := adt10.AsMap(s.store, s.State.PreCommittedSectors, builtin10.DefaultHamtBitwidth)
if err != nil {
return err
}
var info miner10.SectorPreCommitOnChainInfo
if err := precommitted.ForEach(&info, func(_ string) error {
return cb(fromV10SectorPreCommitOnChainInfo(info))
}); err != nil {
return err
}
return nil
}
func (s *state10) LoadSectors(snos *bitfield.BitField) ([]*SectorOnChainInfo, error) {
sectors, err := miner10.LoadSectors(s.store, s.State.Sectors)
if err != nil {
return nil, err
}
// If no sector numbers are specified, load all.
if snos == nil {
infos := make([]*SectorOnChainInfo, 0, sectors.Length())
var info10 miner10.SectorOnChainInfo
if err := sectors.ForEach(&info10, func(_ int64) error {
info := fromV10SectorOnChainInfo(info10)
infos = append(infos, &info)
return nil
}); err != nil {
return nil, err
}
return infos, nil
}
// Otherwise, load selected.
infos10, err := sectors.Load(*snos)
if err != nil {
return nil, err
}
infos := make([]*SectorOnChainInfo, len(infos10))
for i, info10 := range infos10 {
info := fromV10SectorOnChainInfo(*info10)
infos[i] = &info
}
return infos, nil
}
func (s *state10) loadAllocatedSectorNumbers() (bitfield.BitField, error) {
var allocatedSectors bitfield.BitField
err := s.store.Get(s.store.Context(), s.State.AllocatedSectors, &allocatedSectors)
return allocatedSectors, err
}
func (s *state10) IsAllocated(num abi.SectorNumber) (bool, error) {
allocatedSectors, err := s.loadAllocatedSectorNumbers()
if err != nil {
return false, err
}
return allocatedSectors.IsSet(uint64(num))
}
func (s *state10) GetProvingPeriodStart() (abi.ChainEpoch, error) {
return s.State.ProvingPeriodStart, nil
}
func (s *state10) UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error) {
allocatedSectors, err := s.loadAllocatedSectorNumbers()
if err != nil {
return nil, err
}
allocatedRuns, err := allocatedSectors.RunIterator()
if err != nil {
return nil, err
}
unallocatedRuns, err := rle.Subtract(
&rle.RunSliceIterator{Runs: []rle.Run{{Val: true, Len: abi.MaxSectorNumber}}},
allocatedRuns,
)
if err != nil {
return nil, err
}
iter, err := rle.BitsFromRuns(unallocatedRuns)
if err != nil {
return nil, err
}
sectors := make([]abi.SectorNumber, 0, count)
for iter.HasNext() && len(sectors) < count {
nextNo, err := iter.Next()
if err != nil {
return nil, err
}
sectors = append(sectors, abi.SectorNumber(nextNo))
}
return sectors, nil
}
func (s *state10) GetAllocatedSectors() (*bitfield.BitField, error) {
var allocatedSectors bitfield.BitField
if err := s.store.Get(s.store.Context(), s.State.AllocatedSectors, &allocatedSectors); err != nil {
return nil, err
}
return &allocatedSectors, nil
}
func (s *state10) LoadDeadline(idx uint64) (Deadline, error) {
dls, err := s.State.LoadDeadlines(s.store)
if err != nil {
return nil, err
}
dl, err := dls.LoadDeadline(s.store, idx)
if err != nil {
return nil, err
}
return &deadline10{*dl, s.store}, nil
}
func (s *state10) ForEachDeadline(cb func(uint64, Deadline) error) error {
dls, err := s.State.LoadDeadlines(s.store)
if err != nil {
return err
}
return dls.ForEach(s.store, func(i uint64, dl *miner10.Deadline) error {
return cb(i, &deadline10{*dl, s.store})
})
}
func (s *state10) NumDeadlines() (uint64, error) {
return miner10.WPoStPeriodDeadlines, nil
}
func (s *state10) DeadlinesChanged(other State) (bool, error) {
other10, ok := other.(*state10)
if !ok {
// treat an upgrade as a change, always
return true, nil
}
return !s.State.Deadlines.Equals(other10.Deadlines), nil
}
func (s *state10) MinerInfoChanged(other State) (bool, error) {
other0, ok := other.(*state10)
if !ok {
// treat an upgrade as a change, always
return true, nil
}
return !s.State.Info.Equals(other0.State.Info), nil
}
func (s *state10) Info() (MinerInfo, error) {
info, err := s.State.GetInfo(s.store)
if err != nil {
return MinerInfo{}, err
}
mi := MinerInfo{
Owner: info.Owner,
Worker: info.Worker,
ControlAddresses: info.ControlAddresses,
PendingWorkerKey: (*WorkerKeyChange)(info.PendingWorkerKey),
PeerId: info.PeerId,
Multiaddrs: info.Multiaddrs,
WindowPoStProofType: info.WindowPoStProofType,
SectorSize: info.SectorSize,
WindowPoStPartitionSectors: info.WindowPoStPartitionSectors,
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
Beneficiary: info.Beneficiary,
BeneficiaryTerm: BeneficiaryTerm(info.BeneficiaryTerm),
PendingBeneficiaryTerm: (*PendingBeneficiaryChange)(info.PendingBeneficiaryTerm),
}
return mi, nil
}
func (s *state10) DeadlineInfo(epoch abi.ChainEpoch) (*dline.Info, error) {
return s.State.RecordedDeadlineInfo(epoch), nil
}
func (s *state10) DeadlineCronActive() (bool, error) {
return s.State.DeadlineCronActive, nil
}
func (s *state10) sectors() (adt.Array, error) {
return adt10.AsArray(s.store, s.Sectors, miner10.SectorsAmtBitwidth)
}
func (s *state10) decodeSectorOnChainInfo(val *cbg.Deferred) (SectorOnChainInfo, error) {
var si miner10.SectorOnChainInfo
err := si.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return SectorOnChainInfo{}, err
}
return fromV10SectorOnChainInfo(si), nil
}
func (s *state10) precommits() (adt.Map, error) {
return adt10.AsMap(s.store, s.PreCommittedSectors, builtin10.DefaultHamtBitwidth)
}
func (s *state10) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
var sp miner10.SectorPreCommitOnChainInfo
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return SectorPreCommitOnChainInfo{}, err
}
return fromV10SectorPreCommitOnChainInfo(sp), nil
}
func (s *state10) EraseAllUnproven() error {
dls, err := s.State.LoadDeadlines(s.store)
if err != nil {
return err
}
err = dls.ForEach(s.store, func(dindx uint64, dl *miner10.Deadline) error {
ps, err := dl.PartitionsArray(s.store)
if err != nil {
return err
}
var part miner10.Partition
err = ps.ForEach(&part, func(pindx int64) error {
_ = part.ActivateUnproven()
err = ps.Set(uint64(pindx), &part)
return nil
})
if err != nil {
return err
}
dl.Partitions, err = ps.Root()
if err != nil {
return err
}
return dls.UpdateDeadline(s.store, dindx, dl)
})
if err != nil {
return err
}
return s.State.SaveDeadlines(s.store, dls)
}
func (d *deadline10) LoadPartition(idx uint64) (Partition, error) {
p, err := d.Deadline.LoadPartition(d.store, idx)
if err != nil {
return nil, err
}
return &partition10{*p, d.store}, nil
}
func (d *deadline10) ForEachPartition(cb func(uint64, Partition) error) error {
ps, err := d.Deadline.PartitionsArray(d.store)
if err != nil {
return err
}
var part miner10.Partition
return ps.ForEach(&part, func(i int64) error {
return cb(uint64(i), &partition10{part, d.store})
})
}
func (d *deadline10) PartitionsChanged(other Deadline) (bool, error) {
other10, ok := other.(*deadline10)
if !ok {
// treat an upgrade as a change, always
return true, nil
}
return !d.Deadline.Partitions.Equals(other10.Deadline.Partitions), nil
}
func (d *deadline10) PartitionsPoSted() (bitfield.BitField, error) {
return d.Deadline.PartitionsPoSted, nil
}
func (d *deadline10) DisputableProofCount() (uint64, error) {
ops, err := d.OptimisticProofsSnapshotArray(d.store)
if err != nil {
return 0, err
}
return ops.Length(), nil
}
func (p *partition10) AllSectors() (bitfield.BitField, error) {
return p.Partition.Sectors, nil
}
func (p *partition10) FaultySectors() (bitfield.BitField, error) {
return p.Partition.Faults, nil
}
func (p *partition10) RecoveringSectors() (bitfield.BitField, error) {
return p.Partition.Recoveries, nil
}
func (p *partition10) UnprovenSectors() (bitfield.BitField, error) {
return p.Partition.Unproven, nil
}
func fromV10SectorOnChainInfo(v10 miner10.SectorOnChainInfo) SectorOnChainInfo {
info := SectorOnChainInfo{
SectorNumber: v10.SectorNumber,
SealProof: v10.SealProof,
SealedCID: v10.SealedCID,
DealIDs: v10.DealIDs,
Activation: v10.Activation,
Expiration: v10.Expiration,
DealWeight: v10.DealWeight,
VerifiedDealWeight: v10.VerifiedDealWeight,
InitialPledge: v10.InitialPledge,
ExpectedDayReward: v10.ExpectedDayReward,
ExpectedStoragePledge: v10.ExpectedStoragePledge,
SectorKeyCID: v10.SectorKeyCID,
}
return info
}
func fromV10SectorPreCommitOnChainInfo(v10 miner10.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
ret := SectorPreCommitOnChainInfo{
Info: SectorPreCommitInfo{
SealProof: v10.Info.SealProof,
SectorNumber: v10.Info.SectorNumber,
SealedCID: v10.Info.SealedCID,
SealRandEpoch: v10.Info.SealRandEpoch,
DealIDs: v10.Info.DealIDs,
Expiration: v10.Info.Expiration,
UnsealedCid: nil,
},
PreCommitDeposit: v10.PreCommitDeposit,
PreCommitEpoch: v10.PreCommitEpoch,
}
ret.Info.UnsealedCid = v10.Info.UnsealedCid
return ret
}
func (s *state10) GetState() interface{} {
return &s.State
}
func (s *state10) ActorKey() string {
return actors.MinerKey
}
func (s *state10) ActorVersion() actorstypes.Version {
return actorstypes.Version10
}
func (s *state10) Code() cid.Cid {
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
if !ok {
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
}
return code
}

View File

@ -13,7 +13,6 @@ import (
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/dline"
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
@ -197,7 +196,7 @@ func (s *state2) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
return &out, nil
}
func (s *state2) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.SectorPreCommitOnChainInfo, error) {
func (s *state2) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
if !ok || err != nil {
return nil, err
@ -208,7 +207,7 @@ func (s *state2) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.Sector
return &ret, nil
}
func (s *state2) ForEachPrecommittedSector(cb func(minertypes.SectorPreCommitOnChainInfo) error) error {
func (s *state2) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
precommitted, err := adt2.AsMap(s.store, s.State.PreCommittedSectors)
if err != nil {
return err
@ -421,11 +420,11 @@ func (s *state2) precommits() (adt.Map, error) {
return adt2.AsMap(s.store, s.PreCommittedSectors)
}
func (s *state2) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (minertypes.SectorPreCommitOnChainInfo, error) {
func (s *state2) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
var sp miner2.SectorPreCommitOnChainInfo
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return minertypes.SectorPreCommitOnChainInfo{}, err
return SectorPreCommitOnChainInfo{}, err
}
return fromV2SectorPreCommitOnChainInfo(sp), nil
@ -543,9 +542,9 @@ func fromV2SectorOnChainInfo(v2 miner2.SectorOnChainInfo) SectorOnChainInfo {
return info
}
func fromV2SectorPreCommitOnChainInfo(v2 miner2.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
return minertypes.SectorPreCommitOnChainInfo{
Info: minertypes.SectorPreCommitInfo{
func fromV2SectorPreCommitOnChainInfo(v2 miner2.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
ret := SectorPreCommitOnChainInfo{
Info: SectorPreCommitInfo{
SealProof: v2.Info.SealProof,
SectorNumber: v2.Info.SectorNumber,
SealedCID: v2.Info.SealedCID,
@ -557,6 +556,8 @@ func fromV2SectorPreCommitOnChainInfo(v2 miner2.SectorPreCommitOnChainInfo) mine
PreCommitDeposit: v2.PreCommitDeposit,
PreCommitEpoch: v2.PreCommitEpoch,
}
return ret
}
func (s *state2) GetState() interface{} {

View File

@ -13,7 +13,6 @@ import (
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/dline"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
miner3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/miner"
@ -198,7 +197,7 @@ func (s *state3) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
return &out, nil
}
func (s *state3) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.SectorPreCommitOnChainInfo, error) {
func (s *state3) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
if !ok || err != nil {
return nil, err
@ -209,7 +208,7 @@ func (s *state3) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.Sector
return &ret, nil
}
func (s *state3) ForEachPrecommittedSector(cb func(minertypes.SectorPreCommitOnChainInfo) error) error {
func (s *state3) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
precommitted, err := adt3.AsMap(s.store, s.State.PreCommittedSectors, builtin3.DefaultHamtBitwidth)
if err != nil {
return err
@ -417,11 +416,11 @@ func (s *state3) precommits() (adt.Map, error) {
return adt3.AsMap(s.store, s.PreCommittedSectors, builtin3.DefaultHamtBitwidth)
}
func (s *state3) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (minertypes.SectorPreCommitOnChainInfo, error) {
func (s *state3) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
var sp miner3.SectorPreCommitOnChainInfo
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return minertypes.SectorPreCommitOnChainInfo{}, err
return SectorPreCommitOnChainInfo{}, err
}
return fromV3SectorPreCommitOnChainInfo(sp), nil
@ -543,9 +542,9 @@ func fromV3SectorOnChainInfo(v3 miner3.SectorOnChainInfo) SectorOnChainInfo {
return info
}
func fromV3SectorPreCommitOnChainInfo(v3 miner3.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
return minertypes.SectorPreCommitOnChainInfo{
Info: minertypes.SectorPreCommitInfo{
func fromV3SectorPreCommitOnChainInfo(v3 miner3.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
ret := SectorPreCommitOnChainInfo{
Info: SectorPreCommitInfo{
SealProof: v3.Info.SealProof,
SectorNumber: v3.Info.SectorNumber,
SealedCID: v3.Info.SealedCID,
@ -557,6 +556,8 @@ func fromV3SectorPreCommitOnChainInfo(v3 miner3.SectorPreCommitOnChainInfo) mine
PreCommitDeposit: v3.PreCommitDeposit,
PreCommitEpoch: v3.PreCommitEpoch,
}
return ret
}
func (s *state3) GetState() interface{} {

View File

@ -13,7 +13,6 @@ import (
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/dline"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
miner4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/miner"
@ -198,7 +197,7 @@ func (s *state4) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
return &out, nil
}
func (s *state4) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.SectorPreCommitOnChainInfo, error) {
func (s *state4) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
if !ok || err != nil {
return nil, err
@ -209,7 +208,7 @@ func (s *state4) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.Sector
return &ret, nil
}
func (s *state4) ForEachPrecommittedSector(cb func(minertypes.SectorPreCommitOnChainInfo) error) error {
func (s *state4) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
precommitted, err := adt4.AsMap(s.store, s.State.PreCommittedSectors, builtin4.DefaultHamtBitwidth)
if err != nil {
return err
@ -417,11 +416,11 @@ func (s *state4) precommits() (adt.Map, error) {
return adt4.AsMap(s.store, s.PreCommittedSectors, builtin4.DefaultHamtBitwidth)
}
func (s *state4) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (minertypes.SectorPreCommitOnChainInfo, error) {
func (s *state4) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
var sp miner4.SectorPreCommitOnChainInfo
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return minertypes.SectorPreCommitOnChainInfo{}, err
return SectorPreCommitOnChainInfo{}, err
}
return fromV4SectorPreCommitOnChainInfo(sp), nil
@ -543,9 +542,9 @@ func fromV4SectorOnChainInfo(v4 miner4.SectorOnChainInfo) SectorOnChainInfo {
return info
}
func fromV4SectorPreCommitOnChainInfo(v4 miner4.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
return minertypes.SectorPreCommitOnChainInfo{
Info: minertypes.SectorPreCommitInfo{
func fromV4SectorPreCommitOnChainInfo(v4 miner4.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
ret := SectorPreCommitOnChainInfo{
Info: SectorPreCommitInfo{
SealProof: v4.Info.SealProof,
SectorNumber: v4.Info.SectorNumber,
SealedCID: v4.Info.SealedCID,
@ -557,6 +556,8 @@ func fromV4SectorPreCommitOnChainInfo(v4 miner4.SectorPreCommitOnChainInfo) mine
PreCommitDeposit: v4.PreCommitDeposit,
PreCommitEpoch: v4.PreCommitEpoch,
}
return ret
}
func (s *state4) GetState() interface{} {

View File

@ -13,7 +13,6 @@ import (
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/dline"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
@ -198,7 +197,7 @@ func (s *state5) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
return &out, nil
}
func (s *state5) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.SectorPreCommitOnChainInfo, error) {
func (s *state5) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
if !ok || err != nil {
return nil, err
@ -209,7 +208,7 @@ func (s *state5) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.Sector
return &ret, nil
}
func (s *state5) ForEachPrecommittedSector(cb func(minertypes.SectorPreCommitOnChainInfo) error) error {
func (s *state5) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
precommitted, err := adt5.AsMap(s.store, s.State.PreCommittedSectors, builtin5.DefaultHamtBitwidth)
if err != nil {
return err
@ -417,11 +416,11 @@ func (s *state5) precommits() (adt.Map, error) {
return adt5.AsMap(s.store, s.PreCommittedSectors, builtin5.DefaultHamtBitwidth)
}
func (s *state5) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (minertypes.SectorPreCommitOnChainInfo, error) {
func (s *state5) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
var sp miner5.SectorPreCommitOnChainInfo
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return minertypes.SectorPreCommitOnChainInfo{}, err
return SectorPreCommitOnChainInfo{}, err
}
return fromV5SectorPreCommitOnChainInfo(sp), nil
@ -543,9 +542,9 @@ func fromV5SectorOnChainInfo(v5 miner5.SectorOnChainInfo) SectorOnChainInfo {
return info
}
func fromV5SectorPreCommitOnChainInfo(v5 miner5.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
return minertypes.SectorPreCommitOnChainInfo{
Info: minertypes.SectorPreCommitInfo{
func fromV5SectorPreCommitOnChainInfo(v5 miner5.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
ret := SectorPreCommitOnChainInfo{
Info: SectorPreCommitInfo{
SealProof: v5.Info.SealProof,
SectorNumber: v5.Info.SectorNumber,
SealedCID: v5.Info.SealedCID,
@ -557,6 +556,8 @@ func fromV5SectorPreCommitOnChainInfo(v5 miner5.SectorPreCommitOnChainInfo) mine
PreCommitDeposit: v5.PreCommitDeposit,
PreCommitEpoch: v5.PreCommitEpoch,
}
return ret
}
func (s *state5) GetState() interface{} {

View File

@ -13,7 +13,6 @@ import (
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/dline"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
miner6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/miner"
@ -198,7 +197,7 @@ func (s *state6) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
return &out, nil
}
func (s *state6) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.SectorPreCommitOnChainInfo, error) {
func (s *state6) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
if !ok || err != nil {
return nil, err
@ -209,7 +208,7 @@ func (s *state6) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.Sector
return &ret, nil
}
func (s *state6) ForEachPrecommittedSector(cb func(minertypes.SectorPreCommitOnChainInfo) error) error {
func (s *state6) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
precommitted, err := adt6.AsMap(s.store, s.State.PreCommittedSectors, builtin6.DefaultHamtBitwidth)
if err != nil {
return err
@ -417,11 +416,11 @@ func (s *state6) precommits() (adt.Map, error) {
return adt6.AsMap(s.store, s.PreCommittedSectors, builtin6.DefaultHamtBitwidth)
}
func (s *state6) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (minertypes.SectorPreCommitOnChainInfo, error) {
func (s *state6) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
var sp miner6.SectorPreCommitOnChainInfo
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return minertypes.SectorPreCommitOnChainInfo{}, err
return SectorPreCommitOnChainInfo{}, err
}
return fromV6SectorPreCommitOnChainInfo(sp), nil
@ -543,9 +542,9 @@ func fromV6SectorOnChainInfo(v6 miner6.SectorOnChainInfo) SectorOnChainInfo {
return info
}
func fromV6SectorPreCommitOnChainInfo(v6 miner6.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
return minertypes.SectorPreCommitOnChainInfo{
Info: minertypes.SectorPreCommitInfo{
func fromV6SectorPreCommitOnChainInfo(v6 miner6.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
ret := SectorPreCommitOnChainInfo{
Info: SectorPreCommitInfo{
SealProof: v6.Info.SealProof,
SectorNumber: v6.Info.SectorNumber,
SealedCID: v6.Info.SealedCID,
@ -557,6 +556,8 @@ func fromV6SectorPreCommitOnChainInfo(v6 miner6.SectorPreCommitOnChainInfo) mine
PreCommitDeposit: v6.PreCommitDeposit,
PreCommitEpoch: v6.PreCommitEpoch,
}
return ret
}
func (s *state6) GetState() interface{} {

View File

@ -13,7 +13,6 @@ import (
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/dline"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
miner7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/miner"
@ -197,7 +196,7 @@ func (s *state7) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
return &out, nil
}
func (s *state7) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.SectorPreCommitOnChainInfo, error) {
func (s *state7) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
if !ok || err != nil {
return nil, err
@ -208,7 +207,7 @@ func (s *state7) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.Sector
return &ret, nil
}
func (s *state7) ForEachPrecommittedSector(cb func(minertypes.SectorPreCommitOnChainInfo) error) error {
func (s *state7) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
precommitted, err := adt7.AsMap(s.store, s.State.PreCommittedSectors, builtin7.DefaultHamtBitwidth)
if err != nil {
return err
@ -416,11 +415,11 @@ func (s *state7) precommits() (adt.Map, error) {
return adt7.AsMap(s.store, s.PreCommittedSectors, builtin7.DefaultHamtBitwidth)
}
func (s *state7) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (minertypes.SectorPreCommitOnChainInfo, error) {
func (s *state7) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
var sp miner7.SectorPreCommitOnChainInfo
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return minertypes.SectorPreCommitOnChainInfo{}, err
return SectorPreCommitOnChainInfo{}, err
}
return fromV7SectorPreCommitOnChainInfo(sp), nil
@ -544,9 +543,9 @@ func fromV7SectorOnChainInfo(v7 miner7.SectorOnChainInfo) SectorOnChainInfo {
return info
}
func fromV7SectorPreCommitOnChainInfo(v7 miner7.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
return minertypes.SectorPreCommitOnChainInfo{
Info: minertypes.SectorPreCommitInfo{
func fromV7SectorPreCommitOnChainInfo(v7 miner7.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
ret := SectorPreCommitOnChainInfo{
Info: SectorPreCommitInfo{
SealProof: v7.Info.SealProof,
SectorNumber: v7.Info.SectorNumber,
SealedCID: v7.Info.SealedCID,
@ -558,6 +557,8 @@ func fromV7SectorPreCommitOnChainInfo(v7 miner7.SectorPreCommitOnChainInfo) mine
PreCommitDeposit: v7.PreCommitDeposit,
PreCommitEpoch: v7.PreCommitEpoch,
}
return ret
}
func (s *state7) GetState() interface{} {

View File

@ -16,7 +16,6 @@ import (
builtin8 "github.com/filecoin-project/go-state-types/builtin"
miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner"
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/lotus/chain/actors"
@ -197,7 +196,7 @@ func (s *state8) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
return &out, nil
}
func (s *state8) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.SectorPreCommitOnChainInfo, error) {
func (s *state8) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
if !ok || err != nil {
return nil, err
@ -208,7 +207,7 @@ func (s *state8) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.Sector
return &ret, nil
}
func (s *state8) ForEachPrecommittedSector(cb func(minertypes.SectorPreCommitOnChainInfo) error) error {
func (s *state8) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
precommitted, err := adt8.AsMap(s.store, s.State.PreCommittedSectors, builtin8.DefaultHamtBitwidth)
if err != nil {
return err
@ -416,11 +415,11 @@ func (s *state8) precommits() (adt.Map, error) {
return adt8.AsMap(s.store, s.PreCommittedSectors, builtin8.DefaultHamtBitwidth)
}
func (s *state8) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (minertypes.SectorPreCommitOnChainInfo, error) {
func (s *state8) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
var sp miner8.SectorPreCommitOnChainInfo
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return minertypes.SectorPreCommitOnChainInfo{}, err
return SectorPreCommitOnChainInfo{}, err
}
return fromV8SectorPreCommitOnChainInfo(sp), nil
@ -544,9 +543,9 @@ func fromV8SectorOnChainInfo(v8 miner8.SectorOnChainInfo) SectorOnChainInfo {
return info
}
func fromV8SectorPreCommitOnChainInfo(v8 miner8.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
return minertypes.SectorPreCommitOnChainInfo{
Info: minertypes.SectorPreCommitInfo{
func fromV8SectorPreCommitOnChainInfo(v8 miner8.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
ret := SectorPreCommitOnChainInfo{
Info: SectorPreCommitInfo{
SealProof: v8.Info.SealProof,
SectorNumber: v8.Info.SectorNumber,
SealedCID: v8.Info.SealedCID,
@ -558,6 +557,8 @@ func fromV8SectorPreCommitOnChainInfo(v8 miner8.SectorPreCommitOnChainInfo) mine
PreCommitDeposit: v8.PreCommitDeposit,
PreCommitEpoch: v8.PreCommitEpoch,
}
return ret
}
func (s *state8) GetState() interface{} {

View File

@ -15,7 +15,6 @@ import (
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt"
"github.com/filecoin-project/go-state-types/dline"
@ -197,7 +196,7 @@ func (s *state9) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
return &out, nil
}
func (s *state9) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.SectorPreCommitOnChainInfo, error) {
func (s *state9) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
if !ok || err != nil {
return nil, err
@ -208,7 +207,7 @@ func (s *state9) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.Sector
return &ret, nil
}
func (s *state9) ForEachPrecommittedSector(cb func(minertypes.SectorPreCommitOnChainInfo) error) error {
func (s *state9) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
precommitted, err := adt9.AsMap(s.store, s.State.PreCommittedSectors, builtin9.DefaultHamtBitwidth)
if err != nil {
return err
@ -387,8 +386,8 @@ func (s *state9) Info() (MinerInfo, error) {
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
Beneficiary: info.Beneficiary,
BeneficiaryTerm: info.BeneficiaryTerm,
PendingBeneficiaryTerm: info.PendingBeneficiaryTerm,
BeneficiaryTerm: BeneficiaryTerm(info.BeneficiaryTerm),
PendingBeneficiaryTerm: (*PendingBeneficiaryChange)(info.PendingBeneficiaryTerm),
}
return mi, nil
@ -420,11 +419,11 @@ func (s *state9) precommits() (adt.Map, error) {
return adt9.AsMap(s.store, s.PreCommittedSectors, builtin9.DefaultHamtBitwidth)
}
func (s *state9) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (minertypes.SectorPreCommitOnChainInfo, error) {
func (s *state9) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
var sp miner9.SectorPreCommitOnChainInfo
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return minertypes.SectorPreCommitOnChainInfo{}, err
return SectorPreCommitOnChainInfo{}, err
}
return fromV9SectorPreCommitOnChainInfo(sp), nil
@ -548,8 +547,24 @@ func fromV9SectorOnChainInfo(v9 miner9.SectorOnChainInfo) SectorOnChainInfo {
return info
}
func fromV9SectorPreCommitOnChainInfo(v9 miner9.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
return v9
func fromV9SectorPreCommitOnChainInfo(v9 miner9.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
ret := SectorPreCommitOnChainInfo{
Info: SectorPreCommitInfo{
SealProof: v9.Info.SealProof,
SectorNumber: v9.Info.SectorNumber,
SealedCID: v9.Info.SealedCID,
SealRandEpoch: v9.Info.SealRandEpoch,
DealIDs: v9.Info.DealIDs,
Expiration: v9.Info.Expiration,
UnsealedCid: nil,
},
PreCommitDeposit: v9.PreCommitDeposit,
PreCommitEpoch: v9.PreCommitEpoch,
}
ret.Info.UnsealedCid = v9.Info.UnsealedCid
return ret
}
func (s *state9) GetState() interface{} {

View File

@ -0,0 +1,76 @@
package multisig
import (
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtintypes "github.com/filecoin-project/go-state-types/builtin"
init10 "github.com/filecoin-project/go-state-types/builtin/v10/init"
multisig10 "github.com/filecoin-project/go-state-types/builtin/v10/multisig"
"github.com/filecoin-project/lotus/chain/actors"
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
"github.com/filecoin-project/lotus/chain/types"
)
type message10 struct{ message0 }
func (m message10) Create(
signers []address.Address, threshold uint64,
unlockStart, unlockDuration abi.ChainEpoch,
initialAmount abi.TokenAmount,
) (*types.Message, error) {
lenAddrs := uint64(len(signers))
if lenAddrs < threshold {
return nil, xerrors.Errorf("cannot require signing of more addresses than provided for multisig")
}
if threshold == 0 {
threshold = lenAddrs
}
if m.from == address.Undef {
return nil, xerrors.Errorf("must provide source address")
}
// Set up constructor parameters for multisig
msigParams := &multisig10.ConstructorParams{
Signers: signers,
NumApprovalsThreshold: threshold,
UnlockDuration: unlockDuration,
StartEpoch: unlockStart,
}
enc, actErr := actors.SerializeParams(msigParams)
if actErr != nil {
return nil, actErr
}
code, ok := actors.GetActorCodeID(actorstypes.Version10, actors.MultisigKey)
if !ok {
return nil, xerrors.Errorf("failed to get multisig code ID")
}
// new actors are created by invoking 'exec' on the init actor with the constructor params
execParams := &init10.ExecParams{
CodeCID: code,
ConstructorParams: enc,
}
enc, actErr = actors.SerializeParams(execParams)
if actErr != nil {
return nil, actErr
}
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtintypes.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil
}

View File

@ -7,8 +7,8 @@ import (
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtintypes "github.com/filecoin-project/go-state-types/builtin"
init10 "github.com/filecoin-project/go-state-types/builtin/v10/init"
multisig8 "github.com/filecoin-project/go-state-types/builtin/v8/multisig"
init9 "github.com/filecoin-project/go-state-types/builtin/v9/init"
"github.com/filecoin-project/lotus/chain/actors"
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
@ -56,7 +56,7 @@ func (m message8) Create(
}
// new actors are created by invoking 'exec' on the init actor with the constructor params
execParams := &init9.ExecParams{
execParams := &init10.ExecParams{
CodeCID: code,
ConstructorParams: enc,
}

View File

@ -7,7 +7,7 @@ import (
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtintypes "github.com/filecoin-project/go-state-types/builtin"
init9 "github.com/filecoin-project/go-state-types/builtin/v9/init"
init10 "github.com/filecoin-project/go-state-types/builtin/v10/init"
multisig9 "github.com/filecoin-project/go-state-types/builtin/v9/multisig"
"github.com/filecoin-project/lotus/chain/actors"
@ -56,7 +56,7 @@ func (m message9) Create(
}
// new actors are created by invoking 'exec' on the init actor with the constructor params
execParams := &init9.ExecParams{
execParams := &init10.ExecParams{
CodeCID: code,
ConstructorParams: enc,
}

View File

@ -12,7 +12,7 @@ import (
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtintypes "github.com/filecoin-project/go-state-types/builtin"
msig9 "github.com/filecoin-project/go-state-types/builtin/v9/multisig"
msig10 "github.com/filecoin-project/go-state-types/builtin/v10/multisig"
"github.com/filecoin-project/go-state-types/cbor"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
@ -41,6 +41,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
case actorstypes.Version9:
return load9(store, act.Head)
case actorstypes.Version10:
return load10(store, act.Head)
}
}
@ -102,6 +105,9 @@ func MakeState(store adt.Store, av actorstypes.Version, signers []address.Addres
case actorstypes.Version9:
return make9(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
case actorstypes.Version10:
return make10(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
@ -128,7 +134,7 @@ type State interface {
GetState() interface{}
}
type Transaction = msig9.Transaction
type Transaction = msig10.Transaction
var Methods = builtintypes.MethodsMultisig
@ -161,6 +167,9 @@ func Message(version actorstypes.Version, from address.Address) MessageBuilder {
case actorstypes.Version9:
return message9{message0{from}}
case actorstypes.Version10:
return message10{message0{from}}
default:
panic(fmt.Sprintf("unsupported actors version: %d", version))
}
@ -184,13 +193,13 @@ type MessageBuilder interface {
}
// this type is the same between v0 and v2
type ProposalHashData = msig9.ProposalHashData
type ProposeReturn = msig9.ProposeReturn
type ProposeParams = msig9.ProposeParams
type ApproveReturn = msig9.ApproveReturn
type ProposalHashData = msig10.ProposalHashData
type ProposeReturn = msig10.ProposeReturn
type ProposeParams = msig10.ProposeParams
type ApproveReturn = msig10.ApproveReturn
func txnParams(id uint64, data *ProposalHashData) ([]byte, error) {
params := msig9.TxnIDParams{ID: msig9.TxnID(id)}
params := msig10.TxnIDParams{ID: msig10.TxnID(id)}
if data != nil {
if data.Requester.Protocol() != address.ID {
return nil, xerrors.Errorf("proposer address must be an ID address, was %s", data.Requester)
@ -223,5 +232,6 @@ func AllCodes() []cid.Cid {
(&state7{}).Code(),
(&state8{}).Code(),
(&state9{}).Code(),
(&state10{}).Code(),
}
}

137
chain/actors/builtin/multisig/v10.go generated Normal file
View File

@ -0,0 +1,137 @@
package multisig
import (
"bytes"
"encoding/binary"
"fmt"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtin10 "github.com/filecoin-project/go-state-types/builtin"
msig10 "github.com/filecoin-project/go-state-types/builtin/v10/multisig"
adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state10)(nil)
func load10(store adt.Store, root cid.Cid) (State, error) {
out := state10{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
func make10(store adt.Store, signers []address.Address, threshold uint64, startEpoch abi.ChainEpoch, unlockDuration abi.ChainEpoch, initialBalance abi.TokenAmount) (State, error) {
out := state10{store: store}
out.State = msig10.State{}
out.State.Signers = signers
out.State.NumApprovalsThreshold = threshold
out.State.StartEpoch = startEpoch
out.State.UnlockDuration = unlockDuration
out.State.InitialBalance = initialBalance
em, err := adt10.StoreEmptyMap(store, builtin10.DefaultHamtBitwidth)
if err != nil {
return nil, err
}
out.State.PendingTxns = em
return &out, nil
}
type state10 struct {
msig10.State
store adt.Store
}
func (s *state10) LockedBalance(currEpoch abi.ChainEpoch) (abi.TokenAmount, error) {
return s.State.AmountLocked(currEpoch - s.State.StartEpoch), nil
}
func (s *state10) StartEpoch() (abi.ChainEpoch, error) {
return s.State.StartEpoch, nil
}
func (s *state10) UnlockDuration() (abi.ChainEpoch, error) {
return s.State.UnlockDuration, nil
}
func (s *state10) InitialBalance() (abi.TokenAmount, error) {
return s.State.InitialBalance, nil
}
func (s *state10) Threshold() (uint64, error) {
return s.State.NumApprovalsThreshold, nil
}
func (s *state10) Signers() ([]address.Address, error) {
return s.State.Signers, nil
}
func (s *state10) ForEachPendingTxn(cb func(id int64, txn Transaction) error) error {
arr, err := adt10.AsMap(s.store, s.State.PendingTxns, builtin10.DefaultHamtBitwidth)
if err != nil {
return err
}
var out msig10.Transaction
return arr.ForEach(&out, func(key string) error {
txid, n := binary.Varint([]byte(key))
if n <= 0 {
return xerrors.Errorf("invalid pending transaction key: %v", key)
}
return cb(txid, (Transaction)(out)) //nolint:unconvert
})
}
func (s *state10) PendingTxnChanged(other State) (bool, error) {
other10, ok := other.(*state10)
if !ok {
// treat an upgrade as a change, always
return true, nil
}
return !s.State.PendingTxns.Equals(other10.PendingTxns), nil
}
func (s *state10) transactions() (adt.Map, error) {
return adt10.AsMap(s.store, s.PendingTxns, builtin10.DefaultHamtBitwidth)
}
func (s *state10) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
var tx msig10.Transaction
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
return Transaction{}, err
}
return Transaction(tx), nil
}
func (s *state10) GetState() interface{} {
return &s.State
}
func (s *state10) ActorKey() string {
return actors.MultisigKey
}
func (s *state10) ActorVersion() actorstypes.Version {
return actorstypes.Version10
}
func (s *state10) Code() cid.Cid {
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
if !ok {
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
}
return code
}

109
chain/actors/builtin/paych/message10.go generated Normal file
View File

@ -0,0 +1,109 @@
package paych
import (
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtin10 "github.com/filecoin-project/go-state-types/builtin"
init10 "github.com/filecoin-project/go-state-types/builtin/v10/init"
paych10 "github.com/filecoin-project/go-state-types/builtin/v10/paych"
paychtypes "github.com/filecoin-project/go-state-types/builtin/v8/paych"
"github.com/filecoin-project/lotus/chain/actors"
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
"github.com/filecoin-project/lotus/chain/types"
)
type message10 struct{ from address.Address }
func (m message10) Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error) {
actorCodeID, ok := actors.GetActorCodeID(actorstypes.Version10, "paymentchannel")
if !ok {
return nil, xerrors.Errorf("error getting actor paymentchannel code id for actor version %d", 10)
}
params, aerr := actors.SerializeParams(&paych10.ConstructorParams{From: m.from, To: to})
if aerr != nil {
return nil, aerr
}
enc, aerr := actors.SerializeParams(&init10.ExecParams{
CodeCID: actorCodeID,
ConstructorParams: params,
})
if aerr != nil {
return nil, aerr
}
return &types.Message{
To: init_.Address,
From: m.from,
Value: initialAmount,
Method: builtin10.MethodsInit.Exec,
Params: enc,
}, nil
}
func (m message10) Update(paych address.Address, sv *paychtypes.SignedVoucher, secret []byte) (*types.Message, error) {
params, aerr := actors.SerializeParams(&paych10.UpdateChannelStateParams{
Sv: toV10SignedVoucher(*sv),
Secret: secret,
})
if aerr != nil {
return nil, aerr
}
return &types.Message{
To: paych,
From: m.from,
Value: abi.NewTokenAmount(0),
Method: builtin10.MethodsPaych.UpdateChannelState,
Params: params,
}, nil
}
func toV10SignedVoucher(sv paychtypes.SignedVoucher) paych10.SignedVoucher {
merges := make([]paych10.Merge, len(sv.Merges))
for i := range sv.Merges {
merges[i] = paych10.Merge{
Lane: sv.Merges[i].Lane,
Nonce: sv.Merges[i].Nonce,
}
}
return paych10.SignedVoucher{
ChannelAddr: sv.ChannelAddr,
TimeLockMin: sv.TimeLockMin,
TimeLockMax: sv.TimeLockMax,
SecretHash: sv.SecretHash,
Extra: (*paych10.ModVerifyParams)(sv.Extra),
Lane: sv.Lane,
Nonce: sv.Nonce,
Amount: sv.Amount,
MinSettleHeight: sv.MinSettleHeight,
Merges: merges,
Signature: sv.Signature,
}
}
func (m message10) Settle(paych address.Address) (*types.Message, error) {
return &types.Message{
To: paych,
From: m.from,
Value: abi.NewTokenAmount(0),
Method: builtin10.MethodsPaych.Settle,
}, nil
}
func (m message10) Collect(paych address.Address) (*types.Message, error) {
return &types.Message{
To: paych,
From: m.from,
Value: abi.NewTokenAmount(0),
Method: builtin10.MethodsPaych.Collect,
}, nil
}

View File

@ -43,6 +43,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
case actorstypes.Version9:
return load9(store, act.Head)
case actorstypes.Version10:
return load10(store, act.Head)
}
}
@ -154,6 +157,9 @@ func Message(version actorstypes.Version, from address.Address) MessageBuilder {
case actorstypes.Version9:
return message9{from}
case actorstypes.Version10:
return message10{from}
default:
panic(fmt.Sprintf("unsupported actors version: %d", version))
}
@ -193,5 +199,6 @@ func AllCodes() []cid.Cid {
(&state7{}).Code(),
(&state8{}).Code(),
(&state9{}).Code(),
(&state10{}).Code(),
}
}

134
chain/actors/builtin/paych/v10.go generated Normal file
View File

@ -0,0 +1,134 @@
package paych
import (
"fmt"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/big"
paych10 "github.com/filecoin-project/go-state-types/builtin/v10/paych"
adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state10)(nil)
func load10(store adt.Store, root cid.Cid) (State, error) {
out := state10{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
func make10(store adt.Store) (State, error) {
out := state10{store: store}
out.State = paych10.State{}
return &out, nil
}
type state10 struct {
paych10.State
store adt.Store
lsAmt *adt10.Array
}
// Channel owner, who has funded the actor
func (s *state10) From() (address.Address, error) {
return s.State.From, nil
}
// Recipient of payouts from channel
func (s *state10) To() (address.Address, error) {
return s.State.To, nil
}
// Height at which the channel can be `Collected`
func (s *state10) SettlingAt() (abi.ChainEpoch, error) {
return s.State.SettlingAt, nil
}
// Amount successfully redeemed through the payment channel, paid out on `Collect()`
func (s *state10) ToSend() (abi.TokenAmount, error) {
return s.State.ToSend, nil
}
func (s *state10) getOrLoadLsAmt() (*adt10.Array, error) {
if s.lsAmt != nil {
return s.lsAmt, nil
}
// Get the lane state from the chain
lsamt, err := adt10.AsArray(s.store, s.State.LaneStates, paych10.LaneStatesAmtBitwidth)
if err != nil {
return nil, err
}
s.lsAmt = lsamt
return lsamt, nil
}
// Get total number of lanes
func (s *state10) LaneCount() (uint64, error) {
lsamt, err := s.getOrLoadLsAmt()
if err != nil {
return 0, err
}
return lsamt.Length(), nil
}
func (s *state10) GetState() interface{} {
return &s.State
}
// Iterate lane states
func (s *state10) ForEachLaneState(cb func(idx uint64, dl LaneState) error) error {
// Get the lane state from the chain
lsamt, err := s.getOrLoadLsAmt()
if err != nil {
return err
}
// Note: we use a map instead of an array to store laneStates because the
// client sets the lane ID (the index) and potentially they could use a
// very large index.
var ls paych10.LaneState
return lsamt.ForEach(&ls, func(i int64) error {
return cb(uint64(i), &laneState10{ls})
})
}
type laneState10 struct {
paych10.LaneState
}
func (ls *laneState10) Redeemed() (big.Int, error) {
return ls.LaneState.Redeemed, nil
}
func (ls *laneState10) Nonce() (uint64, error) {
return ls.LaneState.Nonce, nil
}
func (s *state10) ActorKey() string {
return actors.PaychKey
}
func (s *state10) ActorVersion() actorstypes.Version {
return actorstypes.Version10
}
func (s *state10) Code() cid.Cid {
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
if !ok {
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
}
return code
}

View File

@ -9,7 +9,7 @@ import (
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/big"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtin10 "github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/go-state-types/cbor"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
@ -26,8 +26,8 @@ import (
)
var (
Address = builtin9.StoragePowerActorAddr
Methods = builtin9.MethodsPower
Address = builtin10.StoragePowerActorAddr
Methods = builtin10.MethodsPower
)
func Load(store adt.Store, act *types.Actor) (State, error) {
@ -44,6 +44,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
case actorstypes.Version9:
return load9(store, act.Head)
case actorstypes.Version10:
return load10(store, act.Head)
}
}
@ -105,6 +108,9 @@ func MakeState(store adt.Store, av actorstypes.Version) (State, error) {
case actorstypes.Version9:
return make9(store)
case actorstypes.Version10:
return make10(store)
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
@ -168,5 +174,6 @@ func AllCodes() []cid.Cid {
(&state7{}).Code(),
(&state8{}).Code(),
(&state9{}).Code(),
(&state10{}).Code(),
}
}

206
chain/actors/builtin/power/v10.go generated Normal file
View File

@ -0,0 +1,206 @@
package power
import (
"bytes"
"fmt"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtin10 "github.com/filecoin-project/go-state-types/builtin"
power10 "github.com/filecoin-project/go-state-types/builtin/v10/power"
adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
)
var _ State = (*state10)(nil)
func load10(store adt.Store, root cid.Cid) (State, error) {
out := state10{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
func make10(store adt.Store) (State, error) {
out := state10{store: store}
s, err := power10.ConstructState(store)
if err != nil {
return nil, err
}
out.State = *s
return &out, nil
}
type state10 struct {
power10.State
store adt.Store
}
func (s *state10) TotalLocked() (abi.TokenAmount, error) {
return s.TotalPledgeCollateral, nil
}
func (s *state10) TotalPower() (Claim, error) {
return Claim{
RawBytePower: s.TotalRawBytePower,
QualityAdjPower: s.TotalQualityAdjPower,
}, nil
}
// Committed power to the network. Includes miners below the minimum threshold.
func (s *state10) TotalCommitted() (Claim, error) {
return Claim{
RawBytePower: s.TotalBytesCommitted,
QualityAdjPower: s.TotalQABytesCommitted,
}, nil
}
func (s *state10) MinerPower(addr address.Address) (Claim, bool, error) {
claims, err := s.claims()
if err != nil {
return Claim{}, false, err
}
var claim power10.Claim
ok, err := claims.Get(abi.AddrKey(addr), &claim)
if err != nil {
return Claim{}, false, err
}
return Claim{
RawBytePower: claim.RawBytePower,
QualityAdjPower: claim.QualityAdjPower,
}, ok, nil
}
func (s *state10) MinerNominalPowerMeetsConsensusMinimum(a address.Address) (bool, error) {
return s.State.MinerNominalPowerMeetsConsensusMinimum(s.store, a)
}
func (s *state10) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
return builtin.FilterEstimate(s.State.ThisEpochQAPowerSmoothed), nil
}
func (s *state10) MinerCounts() (uint64, uint64, error) {
return uint64(s.State.MinerAboveMinPowerCount), uint64(s.State.MinerCount), nil
}
func (s *state10) ListAllMiners() ([]address.Address, error) {
claims, err := s.claims()
if err != nil {
return nil, err
}
var miners []address.Address
err = claims.ForEach(nil, func(k string) error {
a, err := address.NewFromBytes([]byte(k))
if err != nil {
return err
}
miners = append(miners, a)
return nil
})
if err != nil {
return nil, err
}
return miners, nil
}
func (s *state10) ForEachClaim(cb func(miner address.Address, claim Claim) error) error {
claims, err := s.claims()
if err != nil {
return err
}
var claim power10.Claim
return claims.ForEach(&claim, func(k string) error {
a, err := address.NewFromBytes([]byte(k))
if err != nil {
return err
}
return cb(a, Claim{
RawBytePower: claim.RawBytePower,
QualityAdjPower: claim.QualityAdjPower,
})
})
}
func (s *state10) ClaimsChanged(other State) (bool, error) {
other10, ok := other.(*state10)
if !ok {
// treat an upgrade as a change, always
return true, nil
}
return !s.State.Claims.Equals(other10.State.Claims), nil
}
func (s *state10) SetTotalQualityAdjPower(p abi.StoragePower) error {
s.State.TotalQualityAdjPower = p
return nil
}
func (s *state10) SetTotalRawBytePower(p abi.StoragePower) error {
s.State.TotalRawBytePower = p
return nil
}
func (s *state10) SetThisEpochQualityAdjPower(p abi.StoragePower) error {
s.State.ThisEpochQualityAdjPower = p
return nil
}
func (s *state10) SetThisEpochRawBytePower(p abi.StoragePower) error {
s.State.ThisEpochRawBytePower = p
return nil
}
func (s *state10) GetState() interface{} {
return &s.State
}
func (s *state10) claims() (adt.Map, error) {
return adt10.AsMap(s.store, s.Claims, builtin10.DefaultHamtBitwidth)
}
func (s *state10) decodeClaim(val *cbg.Deferred) (Claim, error) {
var ci power10.Claim
if err := ci.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
return Claim{}, err
}
return fromV10Claim(ci), nil
}
func fromV10Claim(v10 power10.Claim) Claim {
return Claim{
RawBytePower: v10.RawBytePower,
QualityAdjPower: v10.QualityAdjPower,
}
}
func (s *state10) ActorKey() string {
return actors.PowerKey
}
func (s *state10) ActorVersion() actorstypes.Version {
return actorstypes.Version10
}
func (s *state10) Code() cid.Cid {
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
if !ok {
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
}
return code
}

View File

@ -9,6 +9,18 @@ import (
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/builtin"
account10 "github.com/filecoin-project/go-state-types/builtin/v10/account"
cron10 "github.com/filecoin-project/go-state-types/builtin/v10/cron"
datacap10 "github.com/filecoin-project/go-state-types/builtin/v10/datacap"
_init10 "github.com/filecoin-project/go-state-types/builtin/v10/init"
market10 "github.com/filecoin-project/go-state-types/builtin/v10/market"
miner10 "github.com/filecoin-project/go-state-types/builtin/v10/miner"
multisig10 "github.com/filecoin-project/go-state-types/builtin/v10/multisig"
paych10 "github.com/filecoin-project/go-state-types/builtin/v10/paych"
power10 "github.com/filecoin-project/go-state-types/builtin/v10/power"
reward10 "github.com/filecoin-project/go-state-types/builtin/v10/reward"
system10 "github.com/filecoin-project/go-state-types/builtin/v10/system"
verifreg10 "github.com/filecoin-project/go-state-types/builtin/v10/verifreg"
account8 "github.com/filecoin-project/go-state-types/builtin/v8/account"
cron8 "github.com/filecoin-project/go-state-types/builtin/v8/cron"
_init8 "github.com/filecoin-project/go-state-types/builtin/v8/init"
@ -254,6 +266,84 @@ func MakeRegistry(av actorstypes.Version) []RegistryEntry {
}
}
case actorstypes.Version10:
for key, codeID := range codeIDs {
switch key {
case actors.AccountKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: account10.Methods,
state: new(account10.State),
})
case actors.CronKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: cron10.Methods,
state: new(cron10.State),
})
case actors.InitKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: _init10.Methods,
state: new(_init10.State),
})
case actors.MarketKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: market10.Methods,
state: new(market10.State),
})
case actors.MinerKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: miner10.Methods,
state: new(miner10.State),
})
case actors.MultisigKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: multisig10.Methods,
state: new(multisig10.State),
})
case actors.PaychKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: paych10.Methods,
state: new(paych10.State),
})
case actors.PowerKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: power10.Methods,
state: new(power10.State),
})
case actors.RewardKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: reward10.Methods,
state: new(reward10.State),
})
case actors.SystemKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: system10.Methods,
state: new(system10.State),
})
case actors.VerifregKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: verifreg10.Methods,
state: new(verifreg10.State),
})
case actors.DatacapKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: datacap10.Methods,
state: new(datacap10.State),
})
}
}
default:
panic("expected version v8 and up only, use specs-actors for v0-7")
}

View File

@ -6,7 +6,7 @@ import (
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtin10 "github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/go-state-types/cbor"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
@ -24,8 +24,8 @@ import (
)
var (
Address = builtin9.RewardActorAddr
Methods = builtin9.MethodsReward
Address = builtin10.RewardActorAddr
Methods = builtin10.MethodsReward
)
func Load(store adt.Store, act *types.Actor) (State, error) {
@ -42,6 +42,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
case actorstypes.Version9:
return load9(store, act.Head)
case actorstypes.Version10:
return load10(store, act.Head)
}
}
@ -103,6 +106,9 @@ func MakeState(store adt.Store, av actorstypes.Version, currRealizedPower abi.St
case actorstypes.Version9:
return make9(store, currRealizedPower)
case actorstypes.Version10:
return make10(store, currRealizedPower)
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
@ -144,5 +150,6 @@ func AllCodes() []cid.Cid {
(&state7{}).Code(),
(&state8{}).Code(),
(&state9{}).Code(),
(&state10{}).Code(),
}
}

119
chain/actors/builtin/reward/v10.go generated Normal file
View File

@ -0,0 +1,119 @@
package reward
import (
"fmt"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
miner10 "github.com/filecoin-project/go-state-types/builtin/v10/miner"
reward10 "github.com/filecoin-project/go-state-types/builtin/v10/reward"
smoothing10 "github.com/filecoin-project/go-state-types/builtin/v10/util/smoothing"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
)
var _ State = (*state10)(nil)
func load10(store adt.Store, root cid.Cid) (State, error) {
out := state10{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
func make10(store adt.Store, currRealizedPower abi.StoragePower) (State, error) {
out := state10{store: store}
out.State = *reward10.ConstructState(currRealizedPower)
return &out, nil
}
type state10 struct {
reward10.State
store adt.Store
}
func (s *state10) ThisEpochReward() (abi.TokenAmount, error) {
return s.State.ThisEpochReward, nil
}
func (s *state10) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
return builtin.FilterEstimate{
PositionEstimate: s.State.ThisEpochRewardSmoothed.PositionEstimate,
VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate,
}, nil
}
func (s *state10) ThisEpochBaselinePower() (abi.StoragePower, error) {
return s.State.ThisEpochBaselinePower, nil
}
func (s *state10) TotalStoragePowerReward() (abi.TokenAmount, error) {
return s.State.TotalStoragePowerReward, nil
}
func (s *state10) EffectiveBaselinePower() (abi.StoragePower, error) {
return s.State.EffectiveBaselinePower, nil
}
func (s *state10) EffectiveNetworkTime() (abi.ChainEpoch, error) {
return s.State.EffectiveNetworkTime, nil
}
func (s *state10) CumsumBaseline() (reward10.Spacetime, error) {
return s.State.CumsumBaseline, nil
}
func (s *state10) CumsumRealized() (reward10.Spacetime, error) {
return s.State.CumsumRealized, nil
}
func (s *state10) InitialPledgeForPower(qaPower abi.StoragePower, networkTotalPledge abi.TokenAmount, networkQAPower *builtin.FilterEstimate, circSupply abi.TokenAmount) (abi.TokenAmount, error) {
return miner10.InitialPledgeForPower(
qaPower,
s.State.ThisEpochBaselinePower,
s.State.ThisEpochRewardSmoothed,
smoothing10.FilterEstimate{
PositionEstimate: networkQAPower.PositionEstimate,
VelocityEstimate: networkQAPower.VelocityEstimate,
},
circSupply,
), nil
}
func (s *state10) PreCommitDepositForPower(networkQAPower builtin.FilterEstimate, sectorWeight abi.StoragePower) (abi.TokenAmount, error) {
return miner10.PreCommitDepositForPower(s.State.ThisEpochRewardSmoothed,
smoothing10.FilterEstimate{
PositionEstimate: networkQAPower.PositionEstimate,
VelocityEstimate: networkQAPower.VelocityEstimate,
},
sectorWeight), nil
}
func (s *state10) GetState() interface{} {
return &s.State
}
func (s *state10) ActorKey() string {
return actors.RewardKey
}
func (s *state10) ActorVersion() actorstypes.Version {
return actorstypes.Version10
}
func (s *state10) Code() cid.Cid {
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
if !ok {
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
}
return code
}

View File

@ -5,7 +5,7 @@ import (
"golang.org/x/xerrors"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtin10 "github.com/filecoin-project/go-state-types/builtin"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
@ -20,7 +20,7 @@ import (
)
var (
Address = builtin9.SystemActorAddr
Address = builtin10.SystemActorAddr
)
func Load(store adt.Store, act *types.Actor) (State, error) {
@ -37,6 +37,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
case actorstypes.Version9:
return load9(store, act.Head)
case actorstypes.Version10:
return load10(store, act.Head)
}
}
@ -98,6 +101,9 @@ func MakeState(store adt.Store, av actorstypes.Version, builtinActors cid.Cid) (
case actorstypes.Version9:
return make9(store, builtinActors)
case actorstypes.Version10:
return make10(store, builtinActors)
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
@ -123,5 +129,6 @@ func AllCodes() []cid.Cid {
(&state7{}).Code(),
(&state8{}).Code(),
(&state9{}).Code(),
(&state10{}).Code(),
}
}

71
chain/actors/builtin/system/v10.go generated Normal file
View File

@ -0,0 +1,71 @@
package system
import (
"fmt"
"github.com/ipfs/go-cid"
actorstypes "github.com/filecoin-project/go-state-types/actors"
system10 "github.com/filecoin-project/go-state-types/builtin/v10/system"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state10)(nil)
func load10(store adt.Store, root cid.Cid) (State, error) {
out := state10{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
func make10(store adt.Store, builtinActors cid.Cid) (State, error) {
out := state10{store: store}
out.State = system10.State{
BuiltinActors: builtinActors,
}
return &out, nil
}
type state10 struct {
system10.State
store adt.Store
}
func (s *state10) GetState() interface{} {
return &s.State
}
func (s *state10) GetBuiltinActors() cid.Cid {
return s.State.BuiltinActors
}
func (s *state10) SetBuiltinActors(c cid.Cid) error {
s.State.BuiltinActors = c
return nil
}
func (s *state10) ActorKey() string {
return actors.SystemKey
}
func (s *state10) ActorVersion() actorstypes.Version {
return actorstypes.Version10
}
func (s *state10) Code() cid.Cid {
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
if !ok {
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
}
return code
}

View File

@ -78,10 +78,10 @@ type State interface {
RemoveDataCapProposalID(verifier address.Address, client address.Address) (bool, uint64, error)
ForEachVerifier(func(addr address.Address, dcap abi.StoragePower) error) error
ForEachClient(func(addr address.Address, dcap abi.StoragePower) error) error
GetAllocation(clientIdAddr address.Address, allocationId verifregtypes.AllocationId) (*verifregtypes.Allocation, bool, error)
GetAllocations(clientIdAddr address.Address) (map[verifregtypes.AllocationId]verifregtypes.Allocation, error)
GetClaim(providerIdAddr address.Address, claimId verifregtypes.ClaimId) (*verifregtypes.Claim, bool, error)
GetClaims(providerIdAddr address.Address) (map[verifregtypes.ClaimId]verifregtypes.Claim, error)
GetAllocation(clientIdAddr address.Address, allocationId AllocationId) (*Allocation, bool, error)
GetAllocations(clientIdAddr address.Address) (map[AllocationId]Allocation, error)
GetClaim(providerIdAddr address.Address, claimId ClaimId) (*Claim, bool, error)
GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, error)
GetState() interface{}
}
@ -91,3 +91,8 @@ func AllCodes() []cid.Cid {
{{- end}}
}
}
type Allocation = verifregtypes.Allocation
type AllocationId = verifregtypes.AllocationId
type Claim = verifregtypes.Claim
type ClaimId = verifregtypes.ClaimId

View File

@ -24,6 +24,9 @@ import (
{{end}}
{{if (ge .v 9)}}
"github.com/filecoin-project/go-state-types/big"
{{if (gt .v 9)}}
verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
{{end}}
{{else}}
verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
{{end}}
@ -118,35 +121,51 @@ func (s *state{{.v}}) GetState() interface{} {
return &s.State
}
func (s *state{{.v}}) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*verifreg9.Allocation, bool, error) {
func (s *state{{.v}}) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*Allocation, bool, error) {
{{if (le .v 8)}}
return nil, false, xerrors.Errorf("unsupported in actors v{{.v}}")
{{else}}
return s.FindAllocation(s.store, clientIdAddr, allocationId)
{{end}}
alloc, ok, err := s.FindAllocation(s.store, clientIdAddr, verifreg{{.v}}.AllocationId(allocationId))
return (*Allocation)(alloc), ok, err{{end}}
}
func (s *state{{.v}}) GetAllocations(clientIdAddr address.Address) (map[verifreg9.AllocationId]verifreg9.Allocation, error) {
func (s *state{{.v}}) GetAllocations(clientIdAddr address.Address) (map[AllocationId]Allocation, error) {
{{if (le .v 8)}}
return nil, xerrors.Errorf("unsupported in actors v{{.v}}")
{{else}}
return s.LoadAllocationsToMap(s.store, clientIdAddr)
v{{.v}}Map, err := s.LoadAllocationsToMap(s.store, clientIdAddr)
retMap := make(map[AllocationId]Allocation, len(v{{.v}}Map))
for k, v := range v{{.v}}Map {
retMap[AllocationId(k)] = Allocation(v)
}
return retMap, err
{{end}}
}
func (s *state{{.v}}) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*verifreg9.Claim, bool, error) {
func (s *state{{.v}}) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*Claim, bool, error) {
{{if (le .v 8)}}
return nil, false, xerrors.Errorf("unsupported in actors v{{.v}}")
{{else}}
return s.FindClaim(s.store, providerIdAddr, claimId)
claim, ok, err := s.FindClaim(s.store, providerIdAddr, verifreg{{.v}}.ClaimId(claimId))
return (*Claim)(claim), ok, err
{{end}}
}
func (s *state{{.v}}) GetClaims(providerIdAddr address.Address) (map[verifreg9.ClaimId]verifreg9.Claim, error) {
func (s *state{{.v}}) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, error) {
{{if (le .v 8)}}
return nil, xerrors.Errorf("unsupported in actors v{{.v}}")
{{else}}
return s.LoadClaimsToMap(s.store, providerIdAddr)
v{{.v}}Map, err := s.LoadClaimsToMap(s.store, providerIdAddr)
retMap := make(map[ClaimId]Claim, len(v{{.v}}Map))
for k, v := range v{{.v}}Map {
retMap[ClaimId(k)] = Claim(v)
}
return retMap, err
{{end}}
}

View File

@ -93,25 +93,25 @@ func (s *state0) GetState() interface{} {
return &s.State
}
func (s *state0) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*verifreg9.Allocation, bool, error) {
func (s *state0) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*Allocation, bool, error) {
return nil, false, xerrors.Errorf("unsupported in actors v0")
}
func (s *state0) GetAllocations(clientIdAddr address.Address) (map[verifreg9.AllocationId]verifreg9.Allocation, error) {
func (s *state0) GetAllocations(clientIdAddr address.Address) (map[AllocationId]Allocation, error) {
return nil, xerrors.Errorf("unsupported in actors v0")
}
func (s *state0) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*verifreg9.Claim, bool, error) {
func (s *state0) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*Claim, bool, error) {
return nil, false, xerrors.Errorf("unsupported in actors v0")
}
func (s *state0) GetClaims(providerIdAddr address.Address) (map[verifreg9.ClaimId]verifreg9.Claim, error) {
func (s *state0) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, error) {
return nil, xerrors.Errorf("unsupported in actors v0")

151
chain/actors/builtin/verifreg/v10.go generated Normal file
View File

@ -0,0 +1,151 @@
package verifreg
import (
"fmt"
"github.com/ipfs/go-cid"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/big"
builtin10 "github.com/filecoin-project/go-state-types/builtin"
adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt"
verifreg10 "github.com/filecoin-project/go-state-types/builtin/v10/verifreg"
verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state10)(nil)
func load10(store adt.Store, root cid.Cid) (State, error) {
out := state10{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
func make10(store adt.Store, rootKeyAddress address.Address) (State, error) {
out := state10{store: store}
s, err := verifreg10.ConstructState(store, rootKeyAddress)
if err != nil {
return nil, err
}
out.State = *s
return &out, nil
}
type state10 struct {
verifreg10.State
store adt.Store
}
func (s *state10) RootKey() (address.Address, error) {
return s.State.RootKey, nil
}
func (s *state10) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
return false, big.Zero(), xerrors.Errorf("unsupported in actors v10")
}
func (s *state10) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
return getDataCap(s.store, actors.Version10, s.verifiers, addr)
}
func (s *state10) RemoveDataCapProposalID(verifier address.Address, client address.Address) (bool, uint64, error) {
return getRemoveDataCapProposalID(s.store, actors.Version10, s.removeDataCapProposalIDs, verifier, client)
}
func (s *state10) ForEachVerifier(cb func(addr address.Address, dcap abi.StoragePower) error) error {
return forEachCap(s.store, actors.Version10, s.verifiers, cb)
}
func (s *state10) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
return xerrors.Errorf("unsupported in actors v10")
}
func (s *state10) verifiedClients() (adt.Map, error) {
return nil, xerrors.Errorf("unsupported in actors v10")
}
func (s *state10) verifiers() (adt.Map, error) {
return adt10.AsMap(s.store, s.Verifiers, builtin10.DefaultHamtBitwidth)
}
func (s *state10) removeDataCapProposalIDs() (adt.Map, error) {
return adt10.AsMap(s.store, s.RemoveDataCapProposalIDs, builtin10.DefaultHamtBitwidth)
}
func (s *state10) GetState() interface{} {
return &s.State
}
func (s *state10) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*Allocation, bool, error) {
alloc, ok, err := s.FindAllocation(s.store, clientIdAddr, verifreg10.AllocationId(allocationId))
return (*Allocation)(alloc), ok, err
}
func (s *state10) GetAllocations(clientIdAddr address.Address) (map[AllocationId]Allocation, error) {
v10Map, err := s.LoadAllocationsToMap(s.store, clientIdAddr)
retMap := make(map[AllocationId]Allocation, len(v10Map))
for k, v := range v10Map {
retMap[AllocationId(k)] = Allocation(v)
}
return retMap, err
}
func (s *state10) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*Claim, bool, error) {
claim, ok, err := s.FindClaim(s.store, providerIdAddr, verifreg10.ClaimId(claimId))
return (*Claim)(claim), ok, err
}
func (s *state10) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, error) {
v10Map, err := s.LoadClaimsToMap(s.store, providerIdAddr)
retMap := make(map[ClaimId]Claim, len(v10Map))
for k, v := range v10Map {
retMap[ClaimId(k)] = Claim(v)
}
return retMap, err
}
func (s *state10) ActorKey() string {
return actors.VerifregKey
}
func (s *state10) ActorVersion() actorstypes.Version {
return actorstypes.Version10
}
func (s *state10) Code() cid.Cid {
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
if !ok {
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
}
return code
}

View File

@ -93,25 +93,25 @@ func (s *state2) GetState() interface{} {
return &s.State
}
func (s *state2) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*verifreg9.Allocation, bool, error) {
func (s *state2) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*Allocation, bool, error) {
return nil, false, xerrors.Errorf("unsupported in actors v2")
}
func (s *state2) GetAllocations(clientIdAddr address.Address) (map[verifreg9.AllocationId]verifreg9.Allocation, error) {
func (s *state2) GetAllocations(clientIdAddr address.Address) (map[AllocationId]Allocation, error) {
return nil, xerrors.Errorf("unsupported in actors v2")
}
func (s *state2) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*verifreg9.Claim, bool, error) {
func (s *state2) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*Claim, bool, error) {
return nil, false, xerrors.Errorf("unsupported in actors v2")
}
func (s *state2) GetClaims(providerIdAddr address.Address) (map[verifreg9.ClaimId]verifreg9.Claim, error) {
func (s *state2) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, error) {
return nil, xerrors.Errorf("unsupported in actors v2")

View File

@ -94,25 +94,25 @@ func (s *state3) GetState() interface{} {
return &s.State
}
func (s *state3) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*verifreg9.Allocation, bool, error) {
func (s *state3) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*Allocation, bool, error) {
return nil, false, xerrors.Errorf("unsupported in actors v3")
}
func (s *state3) GetAllocations(clientIdAddr address.Address) (map[verifreg9.AllocationId]verifreg9.Allocation, error) {
func (s *state3) GetAllocations(clientIdAddr address.Address) (map[AllocationId]Allocation, error) {
return nil, xerrors.Errorf("unsupported in actors v3")
}
func (s *state3) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*verifreg9.Claim, bool, error) {
func (s *state3) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*Claim, bool, error) {
return nil, false, xerrors.Errorf("unsupported in actors v3")
}
func (s *state3) GetClaims(providerIdAddr address.Address) (map[verifreg9.ClaimId]verifreg9.Claim, error) {
func (s *state3) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, error) {
return nil, xerrors.Errorf("unsupported in actors v3")

View File

@ -94,25 +94,25 @@ func (s *state4) GetState() interface{} {
return &s.State
}
func (s *state4) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*verifreg9.Allocation, bool, error) {
func (s *state4) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*Allocation, bool, error) {
return nil, false, xerrors.Errorf("unsupported in actors v4")
}
func (s *state4) GetAllocations(clientIdAddr address.Address) (map[verifreg9.AllocationId]verifreg9.Allocation, error) {
func (s *state4) GetAllocations(clientIdAddr address.Address) (map[AllocationId]Allocation, error) {
return nil, xerrors.Errorf("unsupported in actors v4")
}
func (s *state4) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*verifreg9.Claim, bool, error) {
func (s *state4) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*Claim, bool, error) {
return nil, false, xerrors.Errorf("unsupported in actors v4")
}
func (s *state4) GetClaims(providerIdAddr address.Address) (map[verifreg9.ClaimId]verifreg9.Claim, error) {
func (s *state4) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, error) {
return nil, xerrors.Errorf("unsupported in actors v4")

View File

@ -94,25 +94,25 @@ func (s *state5) GetState() interface{} {
return &s.State
}
func (s *state5) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*verifreg9.Allocation, bool, error) {
func (s *state5) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*Allocation, bool, error) {
return nil, false, xerrors.Errorf("unsupported in actors v5")
}
func (s *state5) GetAllocations(clientIdAddr address.Address) (map[verifreg9.AllocationId]verifreg9.Allocation, error) {
func (s *state5) GetAllocations(clientIdAddr address.Address) (map[AllocationId]Allocation, error) {
return nil, xerrors.Errorf("unsupported in actors v5")
}
func (s *state5) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*verifreg9.Claim, bool, error) {
func (s *state5) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*Claim, bool, error) {
return nil, false, xerrors.Errorf("unsupported in actors v5")
}
func (s *state5) GetClaims(providerIdAddr address.Address) (map[verifreg9.ClaimId]verifreg9.Claim, error) {
func (s *state5) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, error) {
return nil, xerrors.Errorf("unsupported in actors v5")

View File

@ -94,25 +94,25 @@ func (s *state6) GetState() interface{} {
return &s.State
}
func (s *state6) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*verifreg9.Allocation, bool, error) {
func (s *state6) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*Allocation, bool, error) {
return nil, false, xerrors.Errorf("unsupported in actors v6")
}
func (s *state6) GetAllocations(clientIdAddr address.Address) (map[verifreg9.AllocationId]verifreg9.Allocation, error) {
func (s *state6) GetAllocations(clientIdAddr address.Address) (map[AllocationId]Allocation, error) {
return nil, xerrors.Errorf("unsupported in actors v6")
}
func (s *state6) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*verifreg9.Claim, bool, error) {
func (s *state6) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*Claim, bool, error) {
return nil, false, xerrors.Errorf("unsupported in actors v6")
}
func (s *state6) GetClaims(providerIdAddr address.Address) (map[verifreg9.ClaimId]verifreg9.Claim, error) {
func (s *state6) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, error) {
return nil, xerrors.Errorf("unsupported in actors v6")

View File

@ -93,25 +93,25 @@ func (s *state7) GetState() interface{} {
return &s.State
}
func (s *state7) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*verifreg9.Allocation, bool, error) {
func (s *state7) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*Allocation, bool, error) {
return nil, false, xerrors.Errorf("unsupported in actors v7")
}
func (s *state7) GetAllocations(clientIdAddr address.Address) (map[verifreg9.AllocationId]verifreg9.Allocation, error) {
func (s *state7) GetAllocations(clientIdAddr address.Address) (map[AllocationId]Allocation, error) {
return nil, xerrors.Errorf("unsupported in actors v7")
}
func (s *state7) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*verifreg9.Claim, bool, error) {
func (s *state7) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*Claim, bool, error) {
return nil, false, xerrors.Errorf("unsupported in actors v7")
}
func (s *state7) GetClaims(providerIdAddr address.Address) (map[verifreg9.ClaimId]verifreg9.Claim, error) {
func (s *state7) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, error) {
return nil, xerrors.Errorf("unsupported in actors v7")

View File

@ -93,25 +93,25 @@ func (s *state8) GetState() interface{} {
return &s.State
}
func (s *state8) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*verifreg9.Allocation, bool, error) {
func (s *state8) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*Allocation, bool, error) {
return nil, false, xerrors.Errorf("unsupported in actors v8")
}
func (s *state8) GetAllocations(clientIdAddr address.Address) (map[verifreg9.AllocationId]verifreg9.Allocation, error) {
func (s *state8) GetAllocations(clientIdAddr address.Address) (map[AllocationId]Allocation, error) {
return nil, xerrors.Errorf("unsupported in actors v8")
}
func (s *state8) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*verifreg9.Claim, bool, error) {
func (s *state8) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*Claim, bool, error) {
return nil, false, xerrors.Errorf("unsupported in actors v8")
}
func (s *state8) GetClaims(providerIdAddr address.Address) (map[verifreg9.ClaimId]verifreg9.Claim, error) {
func (s *state8) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, error) {
return nil, xerrors.Errorf("unsupported in actors v8")

View File

@ -93,27 +93,42 @@ func (s *state9) GetState() interface{} {
return &s.State
}
func (s *state9) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*verifreg9.Allocation, bool, error) {
func (s *state9) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*Allocation, bool, error) {
return s.FindAllocation(s.store, clientIdAddr, allocationId)
alloc, ok, err := s.FindAllocation(s.store, clientIdAddr, verifreg9.AllocationId(allocationId))
return (*Allocation)(alloc), ok, err
}
func (s *state9) GetAllocations(clientIdAddr address.Address) (map[AllocationId]Allocation, error) {
v9Map, err := s.LoadAllocationsToMap(s.store, clientIdAddr)
retMap := make(map[AllocationId]Allocation, len(v9Map))
for k, v := range v9Map {
retMap[AllocationId(k)] = Allocation(v)
}
return retMap, err
}
func (s *state9) GetAllocations(clientIdAddr address.Address) (map[verifreg9.AllocationId]verifreg9.Allocation, error) {
func (s *state9) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*Claim, bool, error) {
return s.LoadAllocationsToMap(s.store, clientIdAddr)
claim, ok, err := s.FindClaim(s.store, providerIdAddr, verifreg9.ClaimId(claimId))
return (*Claim)(claim), ok, err
}
func (s *state9) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*verifreg9.Claim, bool, error) {
func (s *state9) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, error) {
return s.FindClaim(s.store, providerIdAddr, claimId)
v9Map, err := s.LoadClaimsToMap(s.store, providerIdAddr)
}
retMap := make(map[ClaimId]Claim, len(v9Map))
for k, v := range v9Map {
retMap[ClaimId(k)] = Claim(v)
}
func (s *state9) GetClaims(providerIdAddr address.Address) (map[verifreg9.ClaimId]verifreg9.Claim, error) {
return s.LoadClaimsToMap(s.store, providerIdAddr)
return retMap, err
}

View File

@ -7,7 +7,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtin10 "github.com/filecoin-project/go-state-types/builtin"
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
"github.com/filecoin-project/go-state-types/cbor"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
@ -24,8 +24,8 @@ import (
)
var (
Address = builtin9.VerifiedRegistryActorAddr
Methods = builtin9.MethodsVerifiedRegistry
Address = builtin10.VerifiedRegistryActorAddr
Methods = builtin10.MethodsVerifiedRegistry
)
func Load(store adt.Store, act *types.Actor) (State, error) {
@ -42,6 +42,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
case actorstypes.Version9:
return load9(store, act.Head)
case actorstypes.Version10:
return load10(store, act.Head)
}
}
@ -103,6 +106,9 @@ func MakeState(store adt.Store, av actorstypes.Version, rootKeyAddress address.A
case actorstypes.Version9:
return make9(store, rootKeyAddress)
case actorstypes.Version10:
return make10(store, rootKeyAddress)
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
@ -120,10 +126,10 @@ type State interface {
RemoveDataCapProposalID(verifier address.Address, client address.Address) (bool, uint64, error)
ForEachVerifier(func(addr address.Address, dcap abi.StoragePower) error) error
ForEachClient(func(addr address.Address, dcap abi.StoragePower) error) error
GetAllocation(clientIdAddr address.Address, allocationId verifregtypes.AllocationId) (*verifregtypes.Allocation, bool, error)
GetAllocations(clientIdAddr address.Address) (map[verifregtypes.AllocationId]verifregtypes.Allocation, error)
GetClaim(providerIdAddr address.Address, claimId verifregtypes.ClaimId) (*verifregtypes.Claim, bool, error)
GetClaims(providerIdAddr address.Address) (map[verifregtypes.ClaimId]verifregtypes.Claim, error)
GetAllocation(clientIdAddr address.Address, allocationId AllocationId) (*Allocation, bool, error)
GetAllocations(clientIdAddr address.Address) (map[AllocationId]Allocation, error)
GetClaim(providerIdAddr address.Address, claimId ClaimId) (*Claim, bool, error)
GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, error)
GetState() interface{}
}
@ -138,5 +144,11 @@ func AllCodes() []cid.Cid {
(&state7{}).Code(),
(&state8{}).Code(),
(&state9{}).Code(),
(&state10{}).Code(),
}
}
type Allocation = verifregtypes.Allocation
type AllocationId = verifregtypes.AllocationId
type Claim = verifregtypes.Claim
type ClaimId = verifregtypes.ClaimId

View File

@ -32,6 +32,9 @@ const (
SystemKey = "system"
VerifregKey = "verifiedregistry"
DatacapKey = "datacap"
EvmKey = "evm"
EamKey = "eam"
EmbryoKey = "embryo"
)
func GetBuiltinActorsKeys(av actorstypes.Version) []string {
@ -51,6 +54,9 @@ func GetBuiltinActorsKeys(av actorstypes.Version) []string {
if av >= 9 {
keys = append(keys, DatacapKey)
}
if av >= 10 {
keys = append(keys, EvmKey, EamKey, EmbryoKey)
}
return keys
}

View File

@ -6,14 +6,18 @@ import (
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/big"
builtin10 "github.com/filecoin-project/go-state-types/builtin"
builtin8 "github.com/filecoin-project/go-state-types/builtin"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
market10 "github.com/filecoin-project/go-state-types/builtin/v10/market"
miner10 "github.com/filecoin-project/go-state-types/builtin/v10/miner"
paych10 "github.com/filecoin-project/go-state-types/builtin/v10/paych"
verifreg10 "github.com/filecoin-project/go-state-types/builtin/v10/verifreg"
market8 "github.com/filecoin-project/go-state-types/builtin/v8/market"
miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner"
verifreg8 "github.com/filecoin-project/go-state-types/builtin/v8/verifreg"
market9 "github.com/filecoin-project/go-state-types/builtin/v9/market"
miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner"
paych9 "github.com/filecoin-project/go-state-types/builtin/v9/paych"
verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
"github.com/filecoin-project/go-state-types/network"
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
@ -47,10 +51,10 @@ import (
)
const (
ChainFinality = miner9.ChainFinality
ChainFinality = miner10.ChainFinality
SealRandomnessLookback = ChainFinality
PaychSettleDelay = paych9.SettleDelay
MaxPreCommitRandomnessLookback = builtin9.EpochsInDay + SealRandomnessLookback
PaychSettleDelay = paych10.SettleDelay
MaxPreCommitRandomnessLookback = builtin10.EpochsInDay + SealRandomnessLookback
)
// SetSupportedProofTypes sets supported proof types, across all actor versions.
@ -159,11 +163,13 @@ func SetPreCommitChallengeDelay(delay abi.ChainEpoch) {
miner9.PreCommitChallengeDelay = delay
miner10.PreCommitChallengeDelay = delay
}
// TODO: this function shouldn't really exist. Instead, the API should expose the precommit delay.
func GetPreCommitChallengeDelay() abi.ChainEpoch {
return miner9.PreCommitChallengeDelay
return miner10.PreCommitChallengeDelay
}
// SetConsensusMinerMinPower sets the minimum power of an individual miner must
@ -205,6 +211,10 @@ func SetConsensusMinerMinPower(p abi.StoragePower) {
policy.ConsensusMinerMinPower = p
}
for _, policy := range builtin10.PoStProofPolicies {
policy.ConsensusMinerMinPower = p
}
}
// SetMinVerifiedDealSize sets the minimum size of a verified deal. This should
@ -229,6 +239,8 @@ func SetMinVerifiedDealSize(size abi.StoragePower) {
verifreg9.MinVerifiedDealSize = size
verifreg10.MinVerifiedDealSize = size
}
func GetMaxProveCommitDuration(ver actorstypes.Version, t abi.RegisteredSealProof) (abi.ChainEpoch, error) {
@ -270,6 +282,10 @@ func GetMaxProveCommitDuration(ver actorstypes.Version, t abi.RegisteredSealProo
return miner9.MaxProveCommitDuration[t], nil
case actorstypes.Version10:
return miner10.MaxProveCommitDuration[t], nil
default:
return 0, xerrors.Errorf("unsupported actors version")
}
@ -320,6 +336,11 @@ func SetProviderCollateralSupplyTarget(num, denom big.Int) {
Denominator: denom,
}
market10.ProviderCollateralSupplyTarget = builtin10.BigFrac{
Numerator: num,
Denominator: denom,
}
}
func DealProviderCollateralBounds(
@ -378,13 +399,18 @@ func DealProviderCollateralBounds(
min, max := market9.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
return min, max, nil
case actorstypes.Version10:
min, max := market10.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
return min, max, nil
default:
return big.Zero(), big.Zero(), xerrors.Errorf("unsupported actors version")
}
}
func DealDurationBounds(pieceSize abi.PaddedPieceSize) (min, max abi.ChainEpoch) {
return market9.DealDurationBounds(pieceSize)
return market10.DealDurationBounds(pieceSize)
}
// Sets the challenge window and scales the proving period to match (such that
@ -446,6 +472,13 @@ func SetWPoStChallengeWindow(period abi.ChainEpoch) {
// scale it if we're scaling the challenge period.
miner9.WPoStDisputeWindow = period * 30
miner10.WPoStChallengeWindow = period
miner10.WPoStProvingPeriod = period * abi.ChainEpoch(miner10.WPoStPeriodDeadlines)
// by default, this is 2x finality which is 30 periods.
// scale it if we're scaling the challenge period.
miner10.WPoStDisputeWindow = period * 30
}
func GetWinningPoStSectorSetLookback(nwVer network.Version) abi.ChainEpoch {
@ -458,15 +491,15 @@ func GetWinningPoStSectorSetLookback(nwVer network.Version) abi.ChainEpoch {
}
func GetMaxSectorExpirationExtension() abi.ChainEpoch {
return miner9.MaxSectorExpirationExtension
return miner10.MaxSectorExpirationExtension
}
func GetMinSectorExpiration() abi.ChainEpoch {
return miner9.MinSectorExpiration
return miner10.MinSectorExpiration
}
func GetMaxPoStPartitions(nv network.Version, p abi.RegisteredPoStProof) (int, error) {
sectorsPerPart, err := builtin9.PoStProofWindowPoStPartitionSectors(p)
sectorsPerPart, err := builtin10.PoStProofWindowPoStPartitionSectors(p)
if err != nil {
return 0, err
}
@ -486,7 +519,7 @@ func GetSectorMaxLifetime(proof abi.RegisteredSealProof, nwVer network.Version)
return builtin4.SealProofPoliciesV0[proof].SectorMaxLifetime
}
return builtin9.SealProofPoliciesV11[proof].SectorMaxLifetime
return builtin10.SealProofPoliciesV11[proof].SectorMaxLifetime
}
func GetAddressedSectorsMax(nwVer network.Version) (int, error) {
@ -523,6 +556,9 @@ func GetAddressedSectorsMax(nwVer network.Version) (int, error) {
case actorstypes.Version9:
return miner9.AddressedSectorsMax, nil
case actorstypes.Version10:
return miner10.AddressedSectorsMax, nil
default:
return 0, xerrors.Errorf("unsupported network version")
}
@ -572,6 +608,10 @@ func GetDeclarationsMax(nwVer network.Version) (int, error) {
return miner9.DeclarationsMax, nil
case actorstypes.Version10:
return miner10.DeclarationsMax, nil
default:
return 0, xerrors.Errorf("unsupported network version")
}
@ -620,6 +660,10 @@ func AggregateProveCommitNetworkFee(nwVer network.Version, aggregateSize int, ba
return miner9.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
case actorstypes.Version10:
return miner10.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
default:
return big.Zero(), xerrors.Errorf("unsupported network version")
}
@ -668,6 +712,10 @@ func AggregatePreCommitNetworkFee(nwVer network.Version, aggregateSize int, base
return miner9.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
case actorstypes.Version10:
return miner10.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
default:
return big.Zero(), xerrors.Errorf("unsupported network version")
}

View File

@ -14,9 +14,9 @@ const ({{range .actorVersions}}
/* inline-gen start */
var LatestVersion = 9
var LatestVersion = 10
var Versions = []int{0, 2, 3, 4, 5, 6, 7, 8, 9}
var Versions = []int{0, 2, 3, 4, 5, 6, 7, 8, 9, 10}
const (
Version0 Version = 0
@ -28,6 +28,7 @@ const (
Version7 Version = 7
Version8 Version = 8
Version9 Version = 9
Version10 Version = 10
)
/* inline-gen end */

View File

@ -107,7 +107,7 @@ func NewDrandBeacon(genesisTs, interval uint64, ps *pubsub.PubSub, config dtypes
client, err := dclient.Wrap(clients, opts...)
if err != nil {
return nil, xerrors.Errorf("creating drand client")
return nil, xerrors.Errorf("creating drand client: %w", err)
}
lc, err := lru.New(1024)

View File

@ -47,6 +47,7 @@ func NewActorRegistry() *vm.ActorRegistry {
inv.Register(actorstypes.Version7, vm.ActorsVersionPredicate(actorstypes.Version7), builtin.MakeRegistryLegacy(exported7.BuiltinActors()))
inv.Register(actorstypes.Version8, vm.ActorsVersionPredicate(actorstypes.Version8), builtin.MakeRegistry(actorstypes.Version8))
inv.Register(actorstypes.Version9, vm.ActorsVersionPredicate(actorstypes.Version9), builtin.MakeRegistry(actorstypes.Version9))
inv.Register(actorstypes.Version10, vm.ActorsVersionPredicate(actorstypes.Version10), builtin.MakeRegistry(actorstypes.Version10))
return inv
}
@ -101,6 +102,7 @@ func (t *TipSetExecutor) ApplyBlocks(ctx context.Context,
NetworkVersion: sm.GetNetworkVersion(ctx, e),
BaseFee: baseFee,
LookbackState: stmgr.LookbackStateGetterForTipset(sm, ts),
TipSetGetter: stmgr.TipSetGetterForTipset(sm.ChainStore(), ts),
Tracing: vmTracing,
}

View File

@ -4,7 +4,9 @@ import (
"context"
_ "embed"
"fmt"
"os"
"runtime"
"strconv"
"time"
"github.com/docker/go-units"
@ -53,6 +55,29 @@ import (
//go:embed FVMLiftoff.txt
var fvmLiftoffBanner string
var (
MigrationMaxWorkerCount int
EnvMigrationMaxWorkerCount = "LOTUS_MIGRATION_MAX_WORKER_COUNT"
)
func init() {
// the default calculation used for migration worker count
MigrationMaxWorkerCount = runtime.NumCPU()
// check if an alternative value was request by environment
if mwcs := os.Getenv(EnvMigrationMaxWorkerCount); mwcs != "" {
mwc, err := strconv.ParseInt(mwcs, 10, 32)
if err != nil {
log.Warnf("invalid value for %s (%s) defaulting to %d: %s", EnvMigrationMaxWorkerCount, mwcs, MigrationMaxWorkerCount, err)
return
}
// use value from environment
log.Infof("migration worker cound set from %s (%d)", EnvMigrationMaxWorkerCount, mwc)
MigrationMaxWorkerCount = int(mwc)
return
}
log.Infof("migration worker count: %d", MigrationMaxWorkerCount)
}
func DefaultUpgradeSchedule() stmgr.UpgradeSchedule {
var us stmgr.UpgradeSchedule
@ -208,6 +233,7 @@ func DefaultUpgradeSchedule() stmgr.UpgradeSchedule {
}},
Expensive: true,
},
// TODO v10 upgrade
}
for _, u := range updates {
@ -890,7 +916,7 @@ func UpgradeCalico(ctx context.Context, sm *stmgr.StateManager, _ stmgr.Migratio
func UpgradeActorsV3(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, cb stmgr.ExecMonitor, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error) {
// Use all the CPUs except 3.
workerCount := runtime.NumCPU() - 3
workerCount := MigrationMaxWorkerCount - 3
if workerCount <= 0 {
workerCount = 1
}
@ -928,7 +954,7 @@ func UpgradeActorsV3(ctx context.Context, sm *stmgr.StateManager, cache stmgr.Mi
func PreUpgradeActorsV3(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) error {
// Use half the CPUs for pre-migration, but leave at least 3.
workerCount := runtime.NumCPU()
workerCount := MigrationMaxWorkerCount
if workerCount <= 4 {
workerCount = 1
} else {
@ -992,7 +1018,7 @@ func upgradeActorsV3Common(
func UpgradeActorsV4(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, cb stmgr.ExecMonitor, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error) {
// Use all the CPUs except 3.
workerCount := runtime.NumCPU() - 3
workerCount := MigrationMaxWorkerCount - 3
if workerCount <= 0 {
workerCount = 1
}
@ -1014,7 +1040,7 @@ func UpgradeActorsV4(ctx context.Context, sm *stmgr.StateManager, cache stmgr.Mi
func PreUpgradeActorsV4(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) error {
// Use half the CPUs for pre-migration, but leave at least 3.
workerCount := runtime.NumCPU()
workerCount := MigrationMaxWorkerCount
if workerCount <= 4 {
workerCount = 1
} else {
@ -1078,7 +1104,7 @@ func upgradeActorsV4Common(
func UpgradeActorsV5(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, cb stmgr.ExecMonitor, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error) {
// Use all the CPUs except 3.
workerCount := runtime.NumCPU() - 3
workerCount := MigrationMaxWorkerCount - 3
if workerCount <= 0 {
workerCount = 1
}
@ -1100,7 +1126,7 @@ func UpgradeActorsV5(ctx context.Context, sm *stmgr.StateManager, cache stmgr.Mi
func PreUpgradeActorsV5(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) error {
// Use half the CPUs for pre-migration, but leave at least 3.
workerCount := runtime.NumCPU()
workerCount := MigrationMaxWorkerCount
if workerCount <= 4 {
workerCount = 1
} else {
@ -1164,7 +1190,7 @@ func upgradeActorsV5Common(
func UpgradeActorsV6(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, cb stmgr.ExecMonitor, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error) {
// Use all the CPUs except 3.
workerCount := runtime.NumCPU() - 3
workerCount := MigrationMaxWorkerCount - 3
if workerCount <= 0 {
workerCount = 1
}
@ -1186,7 +1212,7 @@ func UpgradeActorsV6(ctx context.Context, sm *stmgr.StateManager, cache stmgr.Mi
func PreUpgradeActorsV6(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) error {
// Use half the CPUs for pre-migration, but leave at least 3.
workerCount := runtime.NumCPU()
workerCount := MigrationMaxWorkerCount
if workerCount <= 4 {
workerCount = 1
} else {
@ -1250,7 +1276,7 @@ func upgradeActorsV6Common(
func UpgradeActorsV7(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, cb stmgr.ExecMonitor, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error) {
// Use all the CPUs except 3.
workerCount := runtime.NumCPU() - 3
workerCount := MigrationMaxWorkerCount - 3
if workerCount <= 0 {
workerCount = 1
}
@ -1272,7 +1298,7 @@ func UpgradeActorsV7(ctx context.Context, sm *stmgr.StateManager, cache stmgr.Mi
func PreUpgradeActorsV7(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) error {
// Use half the CPUs for pre-migration, but leave at least 3.
workerCount := runtime.NumCPU()
workerCount := MigrationMaxWorkerCount
if workerCount <= 4 {
workerCount = 1
} else {
@ -1343,7 +1369,7 @@ func upgradeActorsV7Common(
func UpgradeActorsV8(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, cb stmgr.ExecMonitor, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error) {
// Use all the CPUs except 3.
workerCount := runtime.NumCPU() - 3
workerCount := MigrationMaxWorkerCount - 3
if workerCount <= 0 {
workerCount = 1
}
@ -1367,7 +1393,7 @@ func UpgradeActorsV8(ctx context.Context, sm *stmgr.StateManager, cache stmgr.Mi
func PreUpgradeActorsV8(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) error {
// Use half the CPUs for pre-migration, but leave at least 3.
workerCount := runtime.NumCPU()
workerCount := MigrationMaxWorkerCount
if workerCount <= 4 {
workerCount = 1
} else {
@ -1450,7 +1476,7 @@ func upgradeActorsV8Common(
func UpgradeActorsV9(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, cb stmgr.ExecMonitor,
root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error) {
// Use all the CPUs except 3.
workerCount := runtime.NumCPU() - 3
workerCount := MigrationMaxWorkerCount - 3
if workerCount <= 0 {
workerCount = 1
}
@ -1473,7 +1499,7 @@ func UpgradeActorsV9(ctx context.Context, sm *stmgr.StateManager, cache stmgr.Mi
func PreUpgradeActorsV9(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, root cid.Cid,
epoch abi.ChainEpoch, ts *types.TipSet) error {
// Use half the CPUs for pre-migration, but leave at least 3.
workerCount := runtime.NumCPU()
workerCount := MigrationMaxWorkerCount
if workerCount <= 4 {
workerCount = 1
} else {
@ -1552,6 +1578,15 @@ func upgradeActorsV9Common(
return newRoot, nil
}
func UpgradeActorsV10(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, cb stmgr.ExecMonitor,
root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error) {
// TODO migration
// - the init actor state to include the (empty) installed actors field
// - state tree migration to v5
return cid.Undef, fmt.Errorf("IMPLEMENTME: v10 migration")
}
// Example upgrade function if upgrade requires only code changes
//func UpgradeActorsV9(ctx context.Context, sm *stmgr.StateManager, _ stmgr.MigrationCache, _ stmgr.ExecMonitor, root cid.Cid, _ abi.ChainEpoch, _ *types.TipSet) (cid.Cid, error) {
// buf := blockstore.NewTieredBstore(sm.ChainStore().StateBlockstore(), blockstore.NewMemorySync())

Some files were not shown because too many files have changed in this diff Show More