Merge master into feat/nv13
This commit is contained in:
commit
1e4456138e
@ -11,7 +11,7 @@ executors:
|
||||
resource_class: 2xlarge
|
||||
ubuntu:
|
||||
docker:
|
||||
- image: ubuntu:19.10
|
||||
- image: ubuntu:20.04
|
||||
|
||||
commands:
|
||||
install-deps:
|
||||
@ -436,7 +436,7 @@ jobs:
|
||||
- run:
|
||||
command: "! go fmt ./... 2>&1 | read"
|
||||
|
||||
cbor-gen-check:
|
||||
gen-check:
|
||||
executor: golang
|
||||
steps:
|
||||
- install-deps
|
||||
@ -444,7 +444,10 @@ jobs:
|
||||
- run: make deps
|
||||
- run: go install golang.org/x/tools/cmd/goimports
|
||||
- run: go install github.com/hannahhoward/cbor-gen-for
|
||||
- run: go generate ./...
|
||||
- run: make gen
|
||||
- run: git --no-pager diff
|
||||
- run: git --no-pager diff --quiet
|
||||
- run: make docsgen-cli
|
||||
- run: git --no-pager diff
|
||||
- run: git --no-pager diff --quiet
|
||||
|
||||
@ -453,6 +456,7 @@ jobs:
|
||||
steps:
|
||||
- install-deps
|
||||
- prepare
|
||||
- run: go install golang.org/x/tools/cmd/goimports
|
||||
- run: zcat build/openrpc/full.json.gz | jq > ../pre-openrpc-full
|
||||
- run: zcat build/openrpc/miner.json.gz | jq > ../pre-openrpc-miner
|
||||
- run: zcat build/openrpc/worker.json.gz | jq > ../pre-openrpc-worker
|
||||
@ -700,7 +704,7 @@ workflows:
|
||||
concurrency: "16" # expend all docker 2xlarge CPUs.
|
||||
- mod-tidy-check
|
||||
- gofmt
|
||||
- cbor-gen-check
|
||||
- gen-check
|
||||
- docs-check
|
||||
- test:
|
||||
codecov-upload: true
|
||||
@ -747,7 +751,7 @@ workflows:
|
||||
filters:
|
||||
tags:
|
||||
only:
|
||||
- /^v\d+\.\d+\.\d+$/
|
||||
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
|
||||
- test-conformance:
|
||||
test-suite-name: conformance
|
||||
packages: "./conformance"
|
||||
@ -768,28 +772,28 @@ workflows:
|
||||
filters:
|
||||
tags:
|
||||
only:
|
||||
- /^v\d+\.\d+\.\d+$/
|
||||
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
|
||||
- build-ntwk-calibration:
|
||||
requires:
|
||||
- test-short
|
||||
filters:
|
||||
tags:
|
||||
only:
|
||||
- /^v\d+\.\d+\.\d+$/
|
||||
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
|
||||
- build-ntwk-butterfly:
|
||||
requires:
|
||||
- test-short
|
||||
filters:
|
||||
tags:
|
||||
only:
|
||||
- /^v\d+\.\d+\.\d+$/
|
||||
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
|
||||
- build-ntwk-nerpa:
|
||||
requires:
|
||||
- test-short
|
||||
filters:
|
||||
tags:
|
||||
only:
|
||||
- /^v\d+\.\d+\.\d+$/
|
||||
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
|
||||
- build-lotus-soup
|
||||
- build-macos:
|
||||
requires:
|
||||
@ -800,7 +804,7 @@ workflows:
|
||||
- /.*/
|
||||
tags:
|
||||
only:
|
||||
- /^v\d+\.\d+\.\d+$/
|
||||
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
|
||||
- publish:
|
||||
requires:
|
||||
- build-all
|
||||
@ -811,7 +815,7 @@ workflows:
|
||||
- /.*/
|
||||
tags:
|
||||
only:
|
||||
- /^v\d+\.\d+\.\d+$/
|
||||
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
|
||||
- build-and-push-image:
|
||||
dockerfile: Dockerfile.lotus
|
||||
path: .
|
||||
@ -826,7 +830,7 @@ workflows:
|
||||
- /.*/
|
||||
tags:
|
||||
only:
|
||||
- /^v\d+\.\d+\.\d+$/
|
||||
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
|
||||
- publish-packer-calibrationnet:
|
||||
requires:
|
||||
- build-ntwk-calibration
|
||||
@ -836,7 +840,7 @@ workflows:
|
||||
- /.*/
|
||||
tags:
|
||||
only:
|
||||
- /^v\d+\.\d+\.\d+$/
|
||||
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
|
||||
- publish-packer-butterflynet:
|
||||
requires:
|
||||
- build-ntwk-butterfly
|
||||
@ -846,7 +850,7 @@ workflows:
|
||||
- /.*/
|
||||
tags:
|
||||
only:
|
||||
- /^v\d+\.\d+\.\d+$/
|
||||
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
|
||||
- publish-packer-nerpanet:
|
||||
requires:
|
||||
- build-ntwk-nerpa
|
||||
@ -856,4 +860,4 @@ workflows:
|
||||
- /.*/
|
||||
tags:
|
||||
only:
|
||||
- /^v\d+\.\d+\.\d+$/
|
||||
- /^v\d+\.\d+\.\d+(-rc\d+)?$/
|
||||
|
16
.github/CODEOWNERS
vendored
16
.github/CODEOWNERS
vendored
@ -1,16 +0,0 @@
|
||||
## filecoin-project/lotus CODEOWNERS
|
||||
## Refer to https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners.
|
||||
##
|
||||
## These users or groups will be automatically assigned as reviewers every time
|
||||
## a PR is submitted that modifies code in the specified locations.
|
||||
##
|
||||
## The Lotus repo configuration requires that at least ONE codeowner approves
|
||||
## the PR before merging.
|
||||
|
||||
### Global owners.
|
||||
* @magik6k @whyrusleeping @Kubuxu
|
||||
|
||||
### Conformance testing.
|
||||
conformance/ @raulk
|
||||
extern/test-vectors @raulk
|
||||
cmd/tvx @raulk
|
65
.github/workflows/codeql-analysis.yml
vendored
Normal file
65
.github/workflows/codeql-analysis.yml
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'go' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||
# Learn more:
|
||||
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
29
.github/workflows/testground-on-push.yml
vendored
Normal file
29
.github/workflows/testground-on-push.yml
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
---
|
||||
name: Testground PR Checker
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
testground:
|
||||
runs-on: ubuntu-latest
|
||||
name: ${{ matrix.composition_file }}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- backend_addr: ci.testground.ipfs.team
|
||||
backend_proto: https
|
||||
plan_directory: testplans/lotus-soup
|
||||
composition_file: testplans/lotus-soup/_compositions/baseline-k8s-3-1.toml
|
||||
- backend_addr: ci.testground.ipfs.team
|
||||
backend_proto: https
|
||||
plan_directory: testplans/lotus-soup
|
||||
composition_file: testplans/lotus-soup/_compositions/paych-stress-k8s.toml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: testground run
|
||||
uses: coryschwartz/testground-github-action@v1.0
|
||||
with:
|
||||
backend_addr: ${{ matrix.backend_addr }}
|
||||
backend_proto: ${{ matrix.backend_proto }}
|
||||
plan_directory: ${{ matrix.plan_directory }}
|
||||
composition_file: ${{ matrix.composition_file }}
|
216
CHANGELOG.md
216
CHANGELOG.md
@ -1,5 +1,145 @@
|
||||
# Lotus changelog
|
||||
|
||||
# 1.9.0 / 2021-05-17
|
||||
|
||||
This is an optional Lotus release that introduces various improvements to the sealing, mining, and deal-making processes.
|
||||
|
||||
## Highlights
|
||||
|
||||
- OpenRPC Support (https://github.com/filecoin-project/lotus/pull/5843)
|
||||
- Take latency into account when making interactive deals (https://github.com/filecoin-project/lotus/pull/5876)
|
||||
- Update go-commp-utils for >10x faster client commp calculation (https://github.com/filecoin-project/lotus/pull/5892)
|
||||
- add `lotus client cancel-retrieval` cmd to lotus CLI (https://github.com/filecoin-project/lotus/pull/5871)
|
||||
- add `inspect-deal` command to `lotus client` (https://github.com/filecoin-project/lotus/pull/5833)
|
||||
- Local retrieval support (https://github.com/filecoin-project/lotus/pull/5917)
|
||||
- go-fil-markets v1.1.9 -> v1.2.5
|
||||
- For a detailed changelog see https://github.com/filecoin-project/go-fil-markets/blob/master/CHANGELOG.md
|
||||
- rust-fil-proofs v5.4.1 -> v7.0.1
|
||||
- For a detailed changelog see https://github.com/filecoin-project/rust-fil-proofs/blob/master/CHANGELOG.md
|
||||
|
||||
## Changes
|
||||
- storagefsm: Apply global events even in broken states (https://github.com/filecoin-project/lotus/pull/5962)
|
||||
- Default the AlwaysKeepUnsealedCopy flag to true (https://github.com/filecoin-project/lotus/pull/5743)
|
||||
- splitstore: compact hotstore prior to garbage collection (https://github.com/filecoin-project/lotus/pull/5778)
|
||||
- ipfs-force bootstrapper update (https://github.com/filecoin-project/lotus/pull/5799)
|
||||
- better logging when unsealing fails (https://github.com/filecoin-project/lotus/pull/5851)
|
||||
- perf: add cache for gas permium estimation (https://github.com/filecoin-project/lotus/pull/5709)
|
||||
- backupds: Compact log on restart (https://github.com/filecoin-project/lotus/pull/5875)
|
||||
- backupds: Improve truncated log handling (https://github.com/filecoin-project/lotus/pull/5891)
|
||||
- State CLI improvements (State CLI improvements)
|
||||
- API proxy struct codegen (https://github.com/filecoin-project/lotus/pull/5854)
|
||||
- move DI stuff for paychmgr into modules (https://github.com/filecoin-project/lotus/pull/5791)
|
||||
- Implement Event observer and Settings for 3rd party dep injection (https://github.com/filecoin-project/lotus/pull/5693)
|
||||
- Export developer and network commands for consumption by derivatives of Lotus (https://github.com/filecoin-project/lotus/pull/5864)
|
||||
- mock sealer: Simulate randomness sideeffects (https://github.com/filecoin-project/lotus/pull/5805)
|
||||
- localstorage: Demote reservation stat error to debug (https://github.com/filecoin-project/lotus/pull/5976)
|
||||
- shed command to unpack miner info dumps (https://github.com/filecoin-project/lotus/pull/5800)
|
||||
- Add two utils to Lotus-shed (https://github.com/filecoin-project/lotus/pull/5867)
|
||||
- add shed election estimate command (https://github.com/filecoin-project/lotus/pull/5092)
|
||||
- Add --actor flag in lotus-shed sectors terminate (https://github.com/filecoin-project/lotus/pull/5819)
|
||||
- Move lotus mpool clear to lotus-shed (https://github.com/filecoin-project/lotus/pull/5900)
|
||||
- Centralize everything on ipfs/go-log/v2 (https://github.com/filecoin-project/lotus/pull/5974)
|
||||
- expose NextID from nice market actor interface (https://github.com/filecoin-project/lotus/pull/5850)
|
||||
- add available options for perm on error (https://github.com/filecoin-project/lotus/pull/5814)
|
||||
- API docs clarification: Document StateSearchMsg replaced message behavior (https://github.com/filecoin-project/lotus/pull/5838)
|
||||
- api: Document StateReplay replaced message behavior (https://github.com/filecoin-project/lotus/pull/5840)
|
||||
- add godocs to miner objects (https://github.com/filecoin-project/lotus/pull/2184)
|
||||
- Add description to the client deal CLI command (https://github.com/filecoin-project/lotus/pull/5999)
|
||||
- lint: don't skip builtin (https://github.com/filecoin-project/lotus/pull/5881)
|
||||
- use deal duration from actors (https://github.com/filecoin-project/lotus/pull/5270)
|
||||
- remote calc winningpost proof (https://github.com/filecoin-project/lotus/pull/5884)
|
||||
- packer: other network images (https://github.com/filecoin-project/lotus/pull/5930)
|
||||
- Convert the chainstore lock to RW (https://github.com/filecoin-project/lotus/pull/5971)
|
||||
- Remove CachedBlockstore (https://github.com/filecoin-project/lotus/pull/5972)
|
||||
- remove messagepool CapGasFee duplicate code (https://github.com/filecoin-project/lotus/pull/5992)
|
||||
- Add a mining-heartbeat INFO line at every epoch (https://github.com/filecoin-project/lotus/pull/6183)
|
||||
- chore(ci): Enable build on RC tags (https://github.com/filecoin-project/lotus/pull/6245)
|
||||
- Upgrade nerpa to actor v4 and bump the version to rc4 (https://github.com/filecoin-project/lotus/pull/6249)
|
||||
## Fixes
|
||||
- return buffers after canceling badger operation (https://github.com/filecoin-project/lotus/pull/5796)
|
||||
- avoid holding a lock while calling the View callback (https://github.com/filecoin-project/lotus/pull/5792)
|
||||
- storagefsm: Trigger input processing when below limits (https://github.com/filecoin-project/lotus/pull/5801)
|
||||
- After importing a previously deleted key, be able to delete it again (https://github.com/filecoin-project/lotus/pull/4653)
|
||||
- fix StateManager.Replay on reward actor (https://github.com/filecoin-project/lotus/pull/5804)
|
||||
- make sure atomic 64bit fields are 64bit aligned (https://github.com/filecoin-project/lotus/pull/5794)
|
||||
- Import secp sigs in paych tests (https://github.com/filecoin-project/lotus/pull/5879)
|
||||
- fix ci build-macos (https://github.com/filecoin-project/lotus/pull/5934)
|
||||
- Fix creation of remainder account when it's not a multisig (https://github.com/filecoin-project/lotus/pull/5807)
|
||||
- Fix fallback chainstore (https://github.com/filecoin-project/lotus/pull/6003)
|
||||
- fix 4857: show help for set-addrs (https://github.com/filecoin-project/lotus/pull/5943)
|
||||
- fix health report (https://github.com/filecoin-project/lotus/pull/6011)
|
||||
- fix(ci): Use recent ubuntu LTS release; Update release params ((https://github.com/filecoin-project/lotus/pull/6011))
|
||||
|
||||
# 1.9.0-rc4 / 2021-05-13
|
||||
|
||||
This is an optional Lotus release that introduces various improvements to the sealing, mining, and deal-making processes.
|
||||
|
||||
## Highlights
|
||||
|
||||
- OpenRPC Support (https://github.com/filecoin-project/lotus/pull/5843)
|
||||
- Take latency into account when making interactive deals (https://github.com/filecoin-project/lotus/pull/5876)
|
||||
- Update go-commp-utils for >10x faster client commp calculation (https://github.com/filecoin-project/lotus/pull/5892)
|
||||
- add `lotus client cancel-retrieval` cmd to lotus CLI (https://github.com/filecoin-project/lotus/pull/5871)
|
||||
- add `inspect-deal` command to `lotus client` (https://github.com/filecoin-project/lotus/pull/5833)
|
||||
- Local retrieval support (https://github.com/filecoin-project/lotus/pull/5917)
|
||||
- go-fil-markets v1.1.9 -> v1.2.5
|
||||
- For a detailed changelog see https://github.com/filecoin-project/go-fil-markets/blob/master/CHANGELOG.md
|
||||
- rust-fil-proofs v5.4.1 -> v7.0.1
|
||||
- For a detailed changelog see https://github.com/filecoin-project/rust-fil-proofs/blob/master/CHANGELOG.md
|
||||
|
||||
## Changes
|
||||
- storagefsm: Apply global events even in broken states (https://github.com/filecoin-project/lotus/pull/5962)
|
||||
- Default the AlwaysKeepUnsealedCopy flag to true (https://github.com/filecoin-project/lotus/pull/5743)
|
||||
- splitstore: compact hotstore prior to garbage collection (https://github.com/filecoin-project/lotus/pull/5778)
|
||||
- ipfs-force bootstrapper update (https://github.com/filecoin-project/lotus/pull/5799)
|
||||
- better logging when unsealing fails (https://github.com/filecoin-project/lotus/pull/5851)
|
||||
- perf: add cache for gas permium estimation (https://github.com/filecoin-project/lotus/pull/5709)
|
||||
- backupds: Compact log on restart (https://github.com/filecoin-project/lotus/pull/5875)
|
||||
- backupds: Improve truncated log handling (https://github.com/filecoin-project/lotus/pull/5891)
|
||||
- State CLI improvements (State CLI improvements)
|
||||
- API proxy struct codegen (https://github.com/filecoin-project/lotus/pull/5854)
|
||||
- move DI stuff for paychmgr into modules (https://github.com/filecoin-project/lotus/pull/5791)
|
||||
- Implement Event observer and Settings for 3rd party dep injection (https://github.com/filecoin-project/lotus/pull/5693)
|
||||
- Export developer and network commands for consumption by derivatives of Lotus (https://github.com/filecoin-project/lotus/pull/5864)
|
||||
- mock sealer: Simulate randomness sideeffects (https://github.com/filecoin-project/lotus/pull/5805)
|
||||
- localstorage: Demote reservation stat error to debug (https://github.com/filecoin-project/lotus/pull/5976)
|
||||
- shed command to unpack miner info dumps (https://github.com/filecoin-project/lotus/pull/5800)
|
||||
- Add two utils to Lotus-shed (https://github.com/filecoin-project/lotus/pull/5867)
|
||||
- add shed election estimate command (https://github.com/filecoin-project/lotus/pull/5092)
|
||||
- Add --actor flag in lotus-shed sectors terminate (https://github.com/filecoin-project/lotus/pull/5819)
|
||||
- Move lotus mpool clear to lotus-shed (https://github.com/filecoin-project/lotus/pull/5900)
|
||||
- Centralize everything on ipfs/go-log/v2 (https://github.com/filecoin-project/lotus/pull/5974)
|
||||
- expose NextID from nice market actor interface (https://github.com/filecoin-project/lotus/pull/5850)
|
||||
- add available options for perm on error (https://github.com/filecoin-project/lotus/pull/5814)
|
||||
- API docs clarification: Document StateSearchMsg replaced message behavior (https://github.com/filecoin-project/lotus/pull/5838)
|
||||
- api: Document StateReplay replaced message behavior (https://github.com/filecoin-project/lotus/pull/5840)
|
||||
- add godocs to miner objects (https://github.com/filecoin-project/lotus/pull/2184)
|
||||
- Add description to the client deal CLI command (https://github.com/filecoin-project/lotus/pull/5999)
|
||||
- lint: don't skip builtin (https://github.com/filecoin-project/lotus/pull/5881)
|
||||
- use deal duration from actors (https://github.com/filecoin-project/lotus/pull/5270)
|
||||
- remote calc winningpost proof (https://github.com/filecoin-project/lotus/pull/5884)
|
||||
- packer: other network images (https://github.com/filecoin-project/lotus/pull/5930)
|
||||
- Convert the chainstore lock to RW (https://github.com/filecoin-project/lotus/pull/5971)
|
||||
- Remove CachedBlockstore (https://github.com/filecoin-project/lotus/pull/5972)
|
||||
- remove messagepool CapGasFee duplicate code (https://github.com/filecoin-project/lotus/pull/5992)
|
||||
- Add a mining-heartbeat INFO line at every epoch (https://github.com/filecoin-project/lotus/pull/6183)
|
||||
- chore(ci): Enable build on RC tags (https://github.com/filecoin-project/lotus/pull/6245)
|
||||
- Upgrade nerpa to actor v4 and bump the version to rc4 (https://github.com/filecoin-project/lotus/pull/6249)
|
||||
## Fixes
|
||||
- return buffers after canceling badger operation (https://github.com/filecoin-project/lotus/pull/5796)
|
||||
- avoid holding a lock while calling the View callback (https://github.com/filecoin-project/lotus/pull/5792)
|
||||
- storagefsm: Trigger input processing when below limits (https://github.com/filecoin-project/lotus/pull/5801)
|
||||
- After importing a previously deleted key, be able to delete it again (https://github.com/filecoin-project/lotus/pull/4653)
|
||||
- fix StateManager.Replay on reward actor (https://github.com/filecoin-project/lotus/pull/5804)
|
||||
- make sure atomic 64bit fields are 64bit aligned (https://github.com/filecoin-project/lotus/pull/5794)
|
||||
- Import secp sigs in paych tests (https://github.com/filecoin-project/lotus/pull/5879)
|
||||
- fix ci build-macos (https://github.com/filecoin-project/lotus/pull/5934)
|
||||
- Fix creation of remainder account when it's not a multisig (https://github.com/filecoin-project/lotus/pull/5807)
|
||||
- Fix fallback chainstore (https://github.com/filecoin-project/lotus/pull/6003)
|
||||
- fix 4857: show help for set-addrs (https://github.com/filecoin-project/lotus/pull/5943)
|
||||
- fix health report (https://github.com/filecoin-project/lotus/pull/6011)
|
||||
|
||||
|
||||
# 1.9.0-rc2 / 2021-04-30
|
||||
|
||||
This is an optional Lotus release that introduces various improvements to the sealing, mining, and deal-making processes.
|
||||
@ -207,7 +347,7 @@ FIP-0010 introduces the ability to dispute bad Window PoSts. Node operators are
|
||||
## Changes
|
||||
|
||||
- [#5341](https://github.com/filecoin-project/lotus/pull/5341) Add a `LOTUS_DISABLE_V3_ACTOR_MIGRATION` envvar
|
||||
- Setting this envvar to 1 disables the v3 actor migration, should only be used in the event of a failed migration
|
||||
- Setting this envvar to 1 disables the v3 actor migration, should only be used in the event of a failed migration
|
||||
|
||||
# 1.4.2 / 2021-02-17
|
||||
|
||||
@ -218,10 +358,10 @@ This is a large, and highly recommended, optional release with new features and
|
||||
|
||||
Note that this release does NOT set an upgrade epoch for v3 actors to take effect. That will be done in the upcoming 1.5.0 release.
|
||||
|
||||
## New Features
|
||||
## New Features
|
||||
|
||||
- [#5341](https://github.com/filecoin-project/lotus/pull/5341) Added sector termination API and CLI
|
||||
- Run `lotus-miner sectors terminate`
|
||||
- [#5341](https://github.com/filecoin-project/lotus/pull/5341) Added sector termination API and CLI
|
||||
- Run `lotus-miner sectors terminate`
|
||||
- [#5342](https://github.com/filecoin-project/lotus/pull/5342) Added CLI for using a multisig wallet as miner's owner address
|
||||
- See how to set it up [here](https://github.com/filecoin-project/lotus/pull/5342#issue-554009129)
|
||||
- [#5363](https://github.com/filecoin-project/lotus/pull/5363), [#5418](https://github.com/filecoin-project/lotus/pull/), [#5476](https://github.com/filecoin-project/lotus/pull/5476), [#5459](https://github.com/filecoin-project/lotus/pull/5459) Integrated [spec-actor v3](https://github.com/filecoin-pro5418ject/specs-actors/releases/tag/v3.0.0)
|
||||
@ -243,28 +383,28 @@ Note that this release does NOT set an upgrade epoch for v3 actors to take effec
|
||||
- [#5219](https://github.com/filecoin-project/lotus/pull/5219) Added interactive mode for lotus-wallet
|
||||
- [5529](https://github.com/filecoin-project/lotus/pull/5529) Added support for minder nodes in `lotus-shed rpc` util
|
||||
|
||||
## Bug Fixes
|
||||
## Bug Fixes
|
||||
|
||||
- [#5210](https://github.com/filecoin-project/lotus/pull/5210) Miner should not dial client on restart
|
||||
- [#5403](https://github.com/filecoin-project/lotus/pull/5403) When estimating GasLimit only apply prior messages up to the nonce
|
||||
- [#5410](https://github.com/filecoin-project/lotus/pull/510) Fix the calibnet build option
|
||||
- [#5492](https://github.com/filecoin-project/lotus/pull/5492) Fixed `has` for ipfsbstore for non-existing blocks
|
||||
- [#5361](https://github.com/filecoin-project/lotus/pull/5361) Fixed retrieval hangs when using `IpfsOnlineMode=true`
|
||||
- [#5493](https://github.com/filecoin-project/lotus/pull/5493) Fixed retrieval failure when price-per-byte is zero
|
||||
- [#5506](https://github.com/filecoin-project/lotus/pull/5506) Fixed contexts in the storage adpater
|
||||
- [#5515](https://github.com/filecoin-project/lotus/pull/5515) Properly wire up `StateReadState` on gateway API
|
||||
- [#5582](https://github.com/filecoin-project/lotus/pull/5582) Fixed error logging format strings
|
||||
- [#5614](https://github.com/filecoin-project/lotus/pull/5614) Fixed websocket reconnecting handling
|
||||
- [#5210](https://github.com/filecoin-project/lotus/pull/5210) Miner should not dial client on restart
|
||||
- [#5403](https://github.com/filecoin-project/lotus/pull/5403) When estimating GasLimit only apply prior messages up to the nonce
|
||||
- [#5410](https://github.com/filecoin-project/lotus/pull/510) Fix the calibnet build option
|
||||
- [#5492](https://github.com/filecoin-project/lotus/pull/5492) Fixed `has` for ipfsbstore for non-existing blocks
|
||||
- [#5361](https://github.com/filecoin-project/lotus/pull/5361) Fixed retrieval hangs when using `IpfsOnlineMode=true`
|
||||
- [#5493](https://github.com/filecoin-project/lotus/pull/5493) Fixed retrieval failure when price-per-byte is zero
|
||||
- [#5506](https://github.com/filecoin-project/lotus/pull/5506) Fixed contexts in the storage adpater
|
||||
- [#5515](https://github.com/filecoin-project/lotus/pull/5515) Properly wire up `StateReadState` on gateway API
|
||||
- [#5582](https://github.com/filecoin-project/lotus/pull/5582) Fixed error logging format strings
|
||||
- [#5614](https://github.com/filecoin-project/lotus/pull/5614) Fixed websocket reconnecting handling
|
||||
|
||||
|
||||
## Improvements
|
||||
## Improvements
|
||||
|
||||
- [#5389](https://github.com/filecoin-project/lotus/pull/5389) Show verified indicator for `./lotus-miner storage-deals list`
|
||||
- [#5389](https://github.com/filecoin-project/lotus/pull/5389) Show verified indicator for `./lotus-miner storage-deals list`
|
||||
- [#5229](https://github.com/filecoin-project/lotus/pull/5220) Show power for verified deals in `./lotus-miner setocr list`
|
||||
- [#5407](https://github.com/filecoin-project/lotus/pull/5407) Added explicit check of the miner address protocol
|
||||
- [#5399](https://github.com/filecoin-project/lotus/pull/5399) watchdog: increase heapprof capture threshold to 90%
|
||||
- [#5398](https://github.com/filecoin-project/lotus/pull/5398) storageadapter: Look at precommits on-chain since deal publish msg
|
||||
- [#5470](https://github.com/filecoin-project/lotus/pull/5470) Added `--no-timing` option for `./lotus state compute-state --html`
|
||||
- [#5399](https://github.com/filecoin-project/lotus/pull/5399) watchdog: increase heapprof capture threshold to 90%
|
||||
- [#5398](https://github.com/filecoin-project/lotus/pull/5398) storageadapter: Look at precommits on-chain since deal publish msg
|
||||
- [#5470](https://github.com/filecoin-project/lotus/pull/5470) Added `--no-timing` option for `./lotus state compute-state --html`
|
||||
- [#5417](https://github.com/filecoin-project/lotus/pull/5417) Storage Manager: Always unseal full sectors
|
||||
- [#5393](https://github.com/filecoin-project/lotus/pull/5393) Switched to [filecoin-ffi bls api ](https://github.com/filecoin-project/filecoin-ffi/pull/159)for bls signatures
|
||||
- [#5380](https://github.com/filecoin-project/lotus/pull/5210) Refactor deals API tests
|
||||
@ -294,14 +434,14 @@ Note that this release does NOT set an upgrade epoch for v3 actors to take effec
|
||||
- [#5592](https://github.com/filecoin-project/lotus/pull/5592) Verify FFI version before building
|
||||
|
||||
## Dependency Updates
|
||||
- [#5296](https://github.com/filecoin-project/lotus/pull/5396) Upgraded to [raulk/go-watchdog@v1.0.1](https://github.com/raulk/go-watchdog/releases/tag/v1.0.1)
|
||||
- [#5450](https://github.com/filecoin-project/lotus/pull/5450) Dependency updates
|
||||
- [#5425](https://github.com/filecoin-project/lotus/pull/5425) Fixed stale imports in testplans/lotus-soup
|
||||
- [#5535](https://github.com/filecoin-project/lotus/pull/5535) Updated to [go-fil-markets@v1.1.7](https://github.com/filecoin-project/go-fil-markets/releases/tag/v1.1.7)
|
||||
- [#5616](https://github.com/filecoin-project/lotus/pull/5600) Updated to [filecoin-ffi@b6e0b35fb49ed0fe](https://github.com/filecoin-project/filecoin-ffi/releases/tag/b6e0b35fb49ed0fe)
|
||||
- [#5599](https://github.com/filecoin-project/lotus/pull/5599) Updated to [go-bitfield@v0.2.4](https://github.com/filecoin-project/go-bitfield/releases/tag/v0.2.4)
|
||||
- [#5614](https://github.com/filecoin-project/lotus/pull/5614), , [#5621](https://github.com/filecoin-project/lotus/pull/5621) Updated to [go-jsonrpc@v0.1.3](https://github.com/filecoin-project/go-jsonrpc/releases/tag/v0.1.3)
|
||||
- [#5459](https://github.com/filecoin-project/lotus/pull/5459) Updated to [spec-actors@v3.0.1](https://github.com/filecoin-project/specs-actors/releases/tag/v3.0.1)
|
||||
- [#5296](https://github.com/filecoin-project/lotus/pull/5396) Upgraded to [raulk/go-watchdog@v1.0.1](https://github.com/raulk/go-watchdog/releases/tag/v1.0.1)
|
||||
- [#5450](https://github.com/filecoin-project/lotus/pull/5450) Dependency updates
|
||||
- [#5425](https://github.com/filecoin-project/lotus/pull/5425) Fixed stale imports in testplans/lotus-soup
|
||||
- [#5535](https://github.com/filecoin-project/lotus/pull/5535) Updated to [go-fil-markets@v1.1.7](https://github.com/filecoin-project/go-fil-markets/releases/tag/v1.1.7)
|
||||
- [#5616](https://github.com/filecoin-project/lotus/pull/5600) Updated to [filecoin-ffi@b6e0b35fb49ed0fe](https://github.com/filecoin-project/filecoin-ffi/releases/tag/b6e0b35fb49ed0fe)
|
||||
- [#5599](https://github.com/filecoin-project/lotus/pull/5599) Updated to [go-bitfield@v0.2.4](https://github.com/filecoin-project/go-bitfield/releases/tag/v0.2.4)
|
||||
- [#5614](https://github.com/filecoin-project/lotus/pull/5614), , [#5621](https://github.com/filecoin-project/lotus/pull/5621) Updated to [go-jsonrpc@v0.1.3](https://github.com/filecoin-project/go-jsonrpc/releases/tag/v0.1.3)
|
||||
- [#5459](https://github.com/filecoin-project/lotus/pull/5459) Updated to [spec-actors@v3.0.1](https://github.com/filecoin-project/specs-actors/releases/tag/v3.0.1)
|
||||
|
||||
|
||||
## Network Version v10 Upgrade
|
||||
@ -1379,12 +1519,12 @@ and go-libp2p-pubsub to [v0.3.5](https://github.com/libp2p/go-libp2p-pubsub/rele
|
||||
|
||||
- The following improvements were introduced in https://github.com/filecoin-project/lotus/pull/3350.
|
||||
|
||||
- Allow `lotus-miner sectors remove` to remove a sector in any state.
|
||||
- Create a separate state in the storage FSM dedicated to submitting the Commit message.
|
||||
- Recovery for when the Deal IDs of deals in a sector get changed in a reorg.
|
||||
- Auto-retry sending Precommit and Commit messages if they run out of gas
|
||||
- Auto-retry sector remove tasks when they fail
|
||||
- Compact worker windows, and allow their tasks to be executed in any order
|
||||
- Allow `lotus-miner sectors remove` to remove a sector in any state.
|
||||
- Create a separate state in the storage FSM dedicated to submitting the Commit message.
|
||||
- Recovery for when the Deal IDs of deals in a sector get changed in a reorg.
|
||||
- Auto-retry sending Precommit and Commit messages if they run out of gas
|
||||
- Auto-retry sector remove tasks when they fail
|
||||
- Compact worker windows, and allow their tasks to be executed in any order
|
||||
|
||||
- Don't simply skip PoSt for bad sectors (https://github.com/filecoin-project/lotus/pull/3323)
|
||||
|
||||
@ -1452,9 +1592,9 @@ Among the highlights included in this release are:
|
||||
|
||||
- Gas changes: We implemented EIP-1559 and introduced real gas values.
|
||||
- Deal-making: We now support "Committed Capacity" sectors, "fast-retrieval" deals,
|
||||
and the packing of multiple deals into a single sector.
|
||||
and the packing of multiple deals into a single sector.
|
||||
- Renamed features: We renamed some of the binaries, environment variables, and default
|
||||
paths associated with a Lotus node.
|
||||
paths associated with a Lotus node.
|
||||
|
||||
### Gas changes
|
||||
|
||||
@ -1467,9 +1607,9 @@ We implemented something similar to
|
||||
The `Message` structure had three changes:
|
||||
- The `GasPrice` field has been removed
|
||||
- A new `GasFeeCap` field has been added, which controls the maximum cost
|
||||
the sender incurs for the message
|
||||
the sender incurs for the message
|
||||
- A new `GasPremium` field has been added, which controls the reward a miner
|
||||
earns for including the message
|
||||
earns for including the message
|
||||
|
||||
A sender will never be charged more than `GasFeeCap * GasLimit`.
|
||||
A miner will typically earn `GasPremium * GasLimit` as a reward.
|
||||
|
54
Makefile
54
Makefile
@ -233,6 +233,13 @@ testground:
|
||||
.PHONY: testground
|
||||
BINS+=testground
|
||||
|
||||
|
||||
tvx:
|
||||
rm -f tvx
|
||||
go build -o tvx ./cmd/tvx
|
||||
.PHONY: tvx
|
||||
BINS+=tvx
|
||||
|
||||
install-chainwatch: lotus-chainwatch
|
||||
install -C ./lotus-chainwatch /usr/local/bin/lotus-chainwatch
|
||||
|
||||
@ -296,17 +303,10 @@ clean-services: clean-all-services
|
||||
|
||||
buildall: $(BINS)
|
||||
|
||||
completions:
|
||||
./scripts/make-completions.sh lotus
|
||||
./scripts/make-completions.sh lotus-miner
|
||||
.PHONY: completions
|
||||
|
||||
install-completions:
|
||||
mkdir -p /usr/share/bash-completion/completions /usr/local/share/zsh/site-functions/
|
||||
install -C ./scripts/bash-completion/lotus /usr/share/bash-completion/completions/lotus
|
||||
install -C ./scripts/bash-completion/lotus-miner /usr/share/bash-completion/completions/lotus-miner
|
||||
install -C ./scripts/zsh-completion/lotus /usr/local/share/zsh/site-functions/_lotus
|
||||
install -C ./scripts/zsh-completion/lotus-miner /usr/local/share/zsh/site-functions/_lotus-miner
|
||||
|
||||
clean:
|
||||
rm -rf $(CLEAN) $(BINS)
|
||||
@ -318,11 +318,12 @@ dist-clean:
|
||||
git submodule deinit --all -f
|
||||
.PHONY: dist-clean
|
||||
|
||||
type-gen:
|
||||
type-gen: api-gen
|
||||
go run ./gen/main.go
|
||||
go generate ./...
|
||||
go generate -x ./...
|
||||
goimports -w api/
|
||||
|
||||
method-gen:
|
||||
method-gen: api-gen
|
||||
(cd ./lotuspond/front/src/chain && go run ./methodgen.go)
|
||||
|
||||
actors-gen:
|
||||
@ -330,40 +331,51 @@ actors-gen:
|
||||
go fmt ./...
|
||||
|
||||
api-gen:
|
||||
go run ./gen/api > api/apistruct/struct.go
|
||||
goimports -w api/apistruct
|
||||
goimports -w api/apistruct
|
||||
go run ./gen/api
|
||||
goimports -w api
|
||||
goimports -w api
|
||||
.PHONY: api-gen
|
||||
|
||||
docsgen: docsgen-md docsgen-openrpc
|
||||
|
||||
docsgen-md-bin: actors-gen
|
||||
docsgen-md-bin: api-gen actors-gen
|
||||
go build $(GOFLAGS) -o docgen-md ./api/docgen/cmd
|
||||
docsgen-openrpc-bin: actors-gen
|
||||
docsgen-openrpc-bin: api-gen actors-gen
|
||||
go build $(GOFLAGS) -o docgen-openrpc ./api/docgen-openrpc/cmd
|
||||
|
||||
docsgen-md: docsgen-md-full docsgen-md-storage docsgen-md-worker
|
||||
|
||||
docsgen-md-full: docsgen-md-bin
|
||||
./docgen-md "api/api_full.go" "FullNode" > documentation/en/api-methods.md
|
||||
./docgen-md "api/api_full.go" "FullNode" "api" "./api" > documentation/en/api-v1-unstable-methods.md
|
||||
./docgen-md "api/v0api/full.go" "FullNode" "v0api" "./api/v0api" > documentation/en/api-v0-methods.md
|
||||
docsgen-md-storage: docsgen-md-bin
|
||||
./docgen-md "api/api_storage.go" "StorageMiner" > documentation/en/api-methods-miner.md
|
||||
./docgen-md "api/api_storage.go" "StorageMiner" "api" "./api" > documentation/en/api-v0-methods-miner.md
|
||||
docsgen-md-worker: docsgen-md-bin
|
||||
./docgen-md "api/api_worker.go" "Worker" > documentation/en/api-methods-worker.md
|
||||
./docgen-md "api/api_worker.go" "Worker" "api" "./api" > documentation/en/api-v0-methods-worker.md
|
||||
|
||||
docsgen-openrpc: docsgen-openrpc-full docsgen-openrpc-storage docsgen-openrpc-worker
|
||||
|
||||
docsgen-openrpc-full: docsgen-openrpc-bin
|
||||
./docgen-openrpc "api/api_full.go" "FullNode" -gzip > build/openrpc/full.json.gz
|
||||
./docgen-openrpc "api/api_full.go" "FullNode" "api" "./api" -gzip > build/openrpc/full.json.gz
|
||||
docsgen-openrpc-storage: docsgen-openrpc-bin
|
||||
./docgen-openrpc "api/api_storage.go" "StorageMiner" -gzip > build/openrpc/miner.json.gz
|
||||
./docgen-openrpc "api/api_storage.go" "StorageMiner" "api" "./api" -gzip > build/openrpc/miner.json.gz
|
||||
docsgen-openrpc-worker: docsgen-openrpc-bin
|
||||
./docgen-openrpc "api/api_worker.go" "Worker" -gzip > build/openrpc/worker.json.gz
|
||||
./docgen-openrpc "api/api_worker.go" "Worker" "api" "./api" -gzip > build/openrpc/worker.json.gz
|
||||
|
||||
.PHONY: docsgen docsgen-md-bin docsgen-openrpc-bin
|
||||
|
||||
gen: actors-gen type-gen method-gen docsgen api-gen
|
||||
@echo ">>> IF YOU'VE MODIFIED THE CLI, REMEMBER TO ALSO MAKE docsgen-cli"
|
||||
.PHONY: gen
|
||||
|
||||
snap: lotus lotus-miner lotus-worker
|
||||
snapcraft
|
||||
# snapcraft upload ./lotus_*.snap
|
||||
|
||||
# separate from gen because it needs binaries
|
||||
docsgen-cli: lotus lotus-miner lotus-worker
|
||||
python ./scripts/generate-lotus-cli.py
|
||||
.PHONY: docsgen-cli
|
||||
|
||||
print-%:
|
||||
@echo $*=$($*)
|
||||
|
14
api/README.md
Normal file
14
api/README.md
Normal file
@ -0,0 +1,14 @@
|
||||
## Lotus API
|
||||
|
||||
This package contains all lotus API definitions. Interfaces defined here are
|
||||
exposed as JsonRPC 2.0 endpoints by lotus programs.
|
||||
|
||||
### Versions
|
||||
|
||||
| File | Alias File | Interface | Exposed by | Version | HTTP Endpoint | Status | Docs
|
||||
|------------------|-------------------|----------------|--------------------|---------|---------------|------------------------------|------
|
||||
| `api_common.go` | `v0api/latest.go` | `Common` | lotus; lotus-miner | v0 | `/rpc/v0` | Latest, Stable | [Methods](../documentation/en/api-v0-methods.md)
|
||||
| `api_full.go` | `v1api/latest.go` | `FullNode` | lotus | v1 | `/rpc/v1` | Latest, **Work in progress** | [Methods](../documentation/en/api-v1-unstable-methods.md)
|
||||
| `api_storage.go` | `v0api/latest.go` | `StorageMiner` | lotus-miner | v0 | `/rpc/v0` | Latest, Stable | [Methods](../documentation/en/api-v0-methods-miner.md)
|
||||
| `api_worker.go` | `v0api/latest.go` | `Worker` | lotus-worker | v0 | `/rpc/v0` | Latest, Stable | [Methods](../documentation/en/api-v0-methods-worker.md)
|
||||
| `v0api/full.go` | | `FullNode` | lotus | v0 | `/rpc/v0` | Stable | [Methods](../documentation/en/api-v0-methods.md)
|
@ -15,6 +15,17 @@ import (
|
||||
apitypes "github.com/filecoin-project/lotus/api/types"
|
||||
)
|
||||
|
||||
// MODIFYING THE API INTERFACE
|
||||
//
|
||||
// When adding / changing methods in this file:
|
||||
// * Do the change here
|
||||
// * Adjust implementation in `node/impl/`
|
||||
// * Run `make gen` - this will:
|
||||
// * Generate proxy structs
|
||||
// * Generate mocks
|
||||
// * Generate markdown docs
|
||||
// * Generate openrpc blobs
|
||||
|
||||
type Common interface {
|
||||
|
||||
// MethodGroup: Auth
|
||||
|
133
api/api_full.go
133
api/api_full.go
@ -39,6 +39,22 @@ type ChainIO interface {
|
||||
ChainHasObj(context.Context, cid.Cid) (bool, error)
|
||||
}
|
||||
|
||||
const LookbackNoLimit = abi.ChainEpoch(-1)
|
||||
|
||||
// MODIFYING THE API INTERFACE
|
||||
//
|
||||
// NOTE: This is the V1 (Unstable) API - to add methods to the V0 (Stable) API
|
||||
// you'll have to add those methods to interfaces in `api/v0api`
|
||||
//
|
||||
// When adding / changing methods in this file:
|
||||
// * Do the change here
|
||||
// * Adjust implementation in `node/impl/`
|
||||
// * Run `make gen` - this will:
|
||||
// * Generate proxy structs
|
||||
// * Generate mocks
|
||||
// * Generate markdown docs
|
||||
// * Generate openrpc blobs
|
||||
|
||||
// FullNode API is a low-level interface to the Filecoin network full node
|
||||
type FullNode interface {
|
||||
Common
|
||||
@ -236,6 +252,13 @@ type FullNode interface {
|
||||
// MpoolBatchPushMessage batch pushes a unsigned message to mempool.
|
||||
MpoolBatchPushMessage(context.Context, []*types.Message, *MessageSendSpec) ([]*types.SignedMessage, error) //perm:sign
|
||||
|
||||
// MpoolCheckMessages performs logical checks on a batch of messages
|
||||
MpoolCheckMessages(context.Context, []*MessagePrototype) ([][]MessageCheckStatus, error) //perm:read
|
||||
// MpoolCheckPendingMessages performs logical checks for all pending messages from a given address
|
||||
MpoolCheckPendingMessages(context.Context, address.Address) ([][]MessageCheckStatus, error) //perm:read
|
||||
// MpoolCheckReplaceMessages performs logical checks on pending messages with replacement
|
||||
MpoolCheckReplaceMessages(context.Context, []*types.Message) ([][]MessageCheckStatus, error) //perm:read
|
||||
|
||||
// MpoolGetNonce gets next nonce for the specified sender.
|
||||
// Note that this method may not be atomic. Use MpoolPushMessage instead.
|
||||
MpoolGetNonce(context.Context, address.Address) (uint64, error) //perm:read
|
||||
@ -300,6 +323,8 @@ type FullNode interface {
|
||||
ClientRemoveImport(ctx context.Context, importID multistore.StoreID) error //perm:admin
|
||||
// ClientStartDeal proposes a deal with a miner.
|
||||
ClientStartDeal(ctx context.Context, params *StartDealParams) (*cid.Cid, error) //perm:admin
|
||||
// ClientStatelessDeal fire-and-forget-proposes an offline deal to a miner without subsequent tracking.
|
||||
ClientStatelessDeal(ctx context.Context, params *StartDealParams) (*cid.Cid, error) //perm:write
|
||||
// ClientGetDealInfo returns the latest information about a given deal.
|
||||
ClientGetDealInfo(context.Context, cid.Cid) (*DealInfo, error) //perm:read
|
||||
// ClientListDeals returns information about the deals made by the local client.
|
||||
@ -430,7 +455,7 @@ type FullNode interface {
|
||||
StateSectorExpiration(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*miner.SectorExpiration, error) //perm:read
|
||||
// StateSectorPartition finds deadline/partition with the specified sector
|
||||
StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok types.TipSetKey) (*miner.SectorLocation, error) //perm:read
|
||||
// StateSearchMsg searches for a message in the chain, and returns its receipt and the tipset where it was executed
|
||||
// StateSearchMsg looks back up to limit epochs in the chain for a message, and returns its receipt and the tipset where it was executed
|
||||
//
|
||||
// NOTE: If a replacing message is found on chain, this method will return
|
||||
// a MsgLookup for the replacing message - the MsgLookup.Message will be a different
|
||||
@ -438,48 +463,16 @@ type FullNode interface {
|
||||
// result of the execution of the replacing message.
|
||||
//
|
||||
// If the caller wants to ensure that exactly the requested message was executed,
|
||||
// they MUST check that MsgLookup.Message is equal to the provided 'cid'.
|
||||
// Without this check both the requested and original message may appear as
|
||||
// they must check that MsgLookup.Message is equal to the provided 'cid', or set the
|
||||
// `allowReplaced` parameter to false. Without this check, and with `allowReplaced`
|
||||
// set to true, both the requested and original message may appear as
|
||||
// successfully executed on-chain, which may look like a double-spend.
|
||||
//
|
||||
// A replacing message is a message with a different CID, any of Gas values, and
|
||||
// different signature, but with all other parameters matching (source/destination,
|
||||
// nonce, params, etc.)
|
||||
StateSearchMsg(context.Context, cid.Cid) (*MsgLookup, error) //perm:read
|
||||
// StateSearchMsgLimited looks back up to limit epochs in the chain for a message, and returns its receipt and the tipset where it was executed
|
||||
//
|
||||
// NOTE: If a replacing message is found on chain, this method will return
|
||||
// a MsgLookup for the replacing message - the MsgLookup.Message will be a different
|
||||
// CID than the one provided in the 'cid' param, MsgLookup.Receipt will contain the
|
||||
// result of the execution of the replacing message.
|
||||
//
|
||||
// If the caller wants to ensure that exactly the requested message was executed,
|
||||
// they MUST check that MsgLookup.Message is equal to the provided 'cid'.
|
||||
// Without this check both the requested and original message may appear as
|
||||
// successfully executed on-chain, which may look like a double-spend.
|
||||
//
|
||||
// A replacing message is a message with a different CID, any of Gas values, and
|
||||
// different signature, but with all other parameters matching (source/destination,
|
||||
// nonce, params, etc.)
|
||||
StateSearchMsgLimited(ctx context.Context, msg cid.Cid, limit abi.ChainEpoch) (*MsgLookup, error) //perm:read
|
||||
// StateWaitMsg looks back in the chain for a message. If not found, it blocks until the
|
||||
// message arrives on chain, and gets to the indicated confidence depth.
|
||||
//
|
||||
// NOTE: If a replacing message is found on chain, this method will return
|
||||
// a MsgLookup for the replacing message - the MsgLookup.Message will be a different
|
||||
// CID than the one provided in the 'cid' param, MsgLookup.Receipt will contain the
|
||||
// result of the execution of the replacing message.
|
||||
//
|
||||
// If the caller wants to ensure that exactly the requested message was executed,
|
||||
// they MUST check that MsgLookup.Message is equal to the provided 'cid'.
|
||||
// Without this check both the requested and original message may appear as
|
||||
// successfully executed on-chain, which may look like a double-spend.
|
||||
//
|
||||
// A replacing message is a message with a different CID, any of Gas values, and
|
||||
// different signature, but with all other parameters matching (source/destination,
|
||||
// nonce, params, etc.)
|
||||
StateWaitMsg(ctx context.Context, cid cid.Cid, confidence uint64) (*MsgLookup, error) //perm:read
|
||||
// StateWaitMsgLimited looks back up to limit epochs in the chain for a message.
|
||||
StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*MsgLookup, error) //perm:read
|
||||
// StateWaitMsg looks back up to limit epochs in the chain for a message.
|
||||
// If not found, it blocks until the message arrives on chain, and gets to the
|
||||
// indicated confidence depth.
|
||||
//
|
||||
@ -489,14 +482,15 @@ type FullNode interface {
|
||||
// result of the execution of the replacing message.
|
||||
//
|
||||
// If the caller wants to ensure that exactly the requested message was executed,
|
||||
// they MUST check that MsgLookup.Message is equal to the provided 'cid'.
|
||||
// Without this check both the requested and original message may appear as
|
||||
// they must check that MsgLookup.Message is equal to the provided 'cid', or set the
|
||||
// `allowReplaced` parameter to false. Without this check, and with `allowReplaced`
|
||||
// set to true, both the requested and original message may appear as
|
||||
// successfully executed on-chain, which may look like a double-spend.
|
||||
//
|
||||
// A replacing message is a message with a different CID, any of Gas values, and
|
||||
// different signature, but with all other parameters matching (source/destination,
|
||||
// nonce, params, etc.)
|
||||
StateWaitMsgLimited(ctx context.Context, cid cid.Cid, confidence uint64, limit abi.ChainEpoch) (*MsgLookup, error) //perm:read
|
||||
StateWaitMsg(ctx context.Context, cid cid.Cid, confidence uint64, limit abi.ChainEpoch, allowReplaced bool) (*MsgLookup, error) //perm:read
|
||||
// StateListMiners returns the addresses of every miner that has claimed power in the Power Actor
|
||||
StateListMiners(context.Context, types.TipSetKey) ([]address.Address, error) //perm:read
|
||||
// StateListActors returns the addresses of every actor in the state
|
||||
@ -516,16 +510,6 @@ type FullNode interface {
|
||||
// StateChangedActors returns all the actors whose states change between the two given state CIDs
|
||||
// TODO: Should this take tipset keys instead?
|
||||
StateChangedActors(context.Context, cid.Cid, cid.Cid) (map[string]types.Actor, error) //perm:read
|
||||
// StateGetReceipt returns the message receipt for the given message or for a
|
||||
// matching gas-repriced replacing message
|
||||
//
|
||||
// NOTE: If the requested message was replaced, this method will return the receipt
|
||||
// for the replacing message - if the caller needs the receipt for exactly the
|
||||
// requested message, use StateSearchMsg().Receipt, and check that MsgLookup.Message
|
||||
// is matching the requested CID
|
||||
//
|
||||
// DEPRECATED: Use StateSearchMsg, this method won't be supported in v1 API
|
||||
StateGetReceipt(context.Context, cid.Cid, types.TipSetKey) (*types.MessageReceipt, error) //perm:read
|
||||
// StateMinerSectorCount returns the number of sectors in a miner's sector set and proving set
|
||||
StateMinerSectorCount(context.Context, address.Address, types.TipSetKey) (MinerSectors, error) //perm:read
|
||||
// StateCompute is a flexible command that applies the given messages on the given tipset.
|
||||
@ -604,15 +588,16 @@ type FullNode interface {
|
||||
// MsigCreate creates a multisig wallet
|
||||
// It takes the following params: <required number of senders>, <approving addresses>, <unlock duration>
|
||||
//<initial balance>, <sender address of the create msg>, <gas price>
|
||||
MsigCreate(context.Context, uint64, []address.Address, abi.ChainEpoch, types.BigInt, address.Address, types.BigInt) (cid.Cid, error) //perm:sign
|
||||
MsigCreate(context.Context, uint64, []address.Address, abi.ChainEpoch, types.BigInt, address.Address, types.BigInt) (*MessagePrototype, error) //perm:sign
|
||||
|
||||
// MsigPropose proposes a multisig message
|
||||
// It takes the following params: <multisig address>, <recipient address>, <value to transfer>,
|
||||
// <sender address of the propose msg>, <method to call in the proposed message>, <params to include in the proposed message>
|
||||
MsigPropose(context.Context, address.Address, address.Address, types.BigInt, address.Address, uint64, []byte) (cid.Cid, error) //perm:sign
|
||||
MsigPropose(context.Context, address.Address, address.Address, types.BigInt, address.Address, uint64, []byte) (*MessagePrototype, error) //perm:sign
|
||||
|
||||
// MsigApprove approves a previously-proposed multisig message by transaction ID
|
||||
// It takes the following params: <multisig address>, <proposed transaction ID> <signer address>
|
||||
MsigApprove(context.Context, address.Address, uint64, address.Address) (cid.Cid, error) //perm:sign
|
||||
MsigApprove(context.Context, address.Address, uint64, address.Address) (*MessagePrototype, error) //perm:sign
|
||||
|
||||
// MsigApproveTxnHash approves a previously-proposed multisig message, specified
|
||||
// using both transaction ID and a hash of the parameters used in the
|
||||
@ -620,43 +605,49 @@ type FullNode interface {
|
||||
// exactly the transaction you think you are.
|
||||
// It takes the following params: <multisig address>, <proposed message ID>, <proposer address>, <recipient address>, <value to transfer>,
|
||||
// <sender address of the approve msg>, <method to call in the proposed message>, <params to include in the proposed message>
|
||||
MsigApproveTxnHash(context.Context, address.Address, uint64, address.Address, address.Address, types.BigInt, address.Address, uint64, []byte) (cid.Cid, error) //perm:sign
|
||||
MsigApproveTxnHash(context.Context, address.Address, uint64, address.Address, address.Address, types.BigInt, address.Address, uint64, []byte) (*MessagePrototype, error) //perm:sign
|
||||
|
||||
// MsigCancel cancels a previously-proposed multisig message
|
||||
// It takes the following params: <multisig address>, <proposed transaction ID>, <recipient address>, <value to transfer>,
|
||||
// <sender address of the cancel msg>, <method to call in the proposed message>, <params to include in the proposed message>
|
||||
MsigCancel(context.Context, address.Address, uint64, address.Address, types.BigInt, address.Address, uint64, []byte) (cid.Cid, error) //perm:sign
|
||||
MsigCancel(context.Context, address.Address, uint64, address.Address, types.BigInt, address.Address, uint64, []byte) (*MessagePrototype, error) //perm:sign
|
||||
|
||||
// MsigAddPropose proposes adding a signer in the multisig
|
||||
// It takes the following params: <multisig address>, <sender address of the propose msg>,
|
||||
// <new signer>, <whether the number of required signers should be increased>
|
||||
MsigAddPropose(context.Context, address.Address, address.Address, address.Address, bool) (cid.Cid, error) //perm:sign
|
||||
MsigAddPropose(context.Context, address.Address, address.Address, address.Address, bool) (*MessagePrototype, error) //perm:sign
|
||||
|
||||
// MsigAddApprove approves a previously proposed AddSigner message
|
||||
// It takes the following params: <multisig address>, <sender address of the approve msg>, <proposed message ID>,
|
||||
// <proposer address>, <new signer>, <whether the number of required signers should be increased>
|
||||
MsigAddApprove(context.Context, address.Address, address.Address, uint64, address.Address, address.Address, bool) (cid.Cid, error) //perm:sign
|
||||
MsigAddApprove(context.Context, address.Address, address.Address, uint64, address.Address, address.Address, bool) (*MessagePrototype, error) //perm:sign
|
||||
|
||||
// MsigAddCancel cancels a previously proposed AddSigner message
|
||||
// It takes the following params: <multisig address>, <sender address of the cancel msg>, <proposed message ID>,
|
||||
// <new signer>, <whether the number of required signers should be increased>
|
||||
MsigAddCancel(context.Context, address.Address, address.Address, uint64, address.Address, bool) (cid.Cid, error) //perm:sign
|
||||
MsigAddCancel(context.Context, address.Address, address.Address, uint64, address.Address, bool) (*MessagePrototype, error) //perm:sign
|
||||
|
||||
// MsigSwapPropose proposes swapping 2 signers in the multisig
|
||||
// It takes the following params: <multisig address>, <sender address of the propose msg>,
|
||||
// <old signer>, <new signer>
|
||||
MsigSwapPropose(context.Context, address.Address, address.Address, address.Address, address.Address) (cid.Cid, error) //perm:sign
|
||||
MsigSwapPropose(context.Context, address.Address, address.Address, address.Address, address.Address) (*MessagePrototype, error) //perm:sign
|
||||
|
||||
// MsigSwapApprove approves a previously proposed SwapSigner
|
||||
// It takes the following params: <multisig address>, <sender address of the approve msg>, <proposed message ID>,
|
||||
// <proposer address>, <old signer>, <new signer>
|
||||
MsigSwapApprove(context.Context, address.Address, address.Address, uint64, address.Address, address.Address, address.Address) (cid.Cid, error) //perm:sign
|
||||
MsigSwapApprove(context.Context, address.Address, address.Address, uint64, address.Address, address.Address, address.Address) (*MessagePrototype, error) //perm:sign
|
||||
|
||||
// MsigSwapCancel cancels a previously proposed SwapSigner message
|
||||
// It takes the following params: <multisig address>, <sender address of the cancel msg>, <proposed message ID>,
|
||||
// <old signer>, <new signer>
|
||||
MsigSwapCancel(context.Context, address.Address, address.Address, uint64, address.Address, address.Address) (cid.Cid, error) //perm:sign
|
||||
MsigSwapCancel(context.Context, address.Address, address.Address, uint64, address.Address, address.Address) (*MessagePrototype, error) //perm:sign
|
||||
|
||||
// MsigRemoveSigner proposes the removal of a signer from the multisig.
|
||||
// It accepts the multisig to make the change on, the proposer address to
|
||||
// send the message from, the address to be removed, and a boolean
|
||||
// indicating whether or not the signing threshold should be lowered by one
|
||||
// along with the address removal.
|
||||
MsigRemoveSigner(ctx context.Context, msig address.Address, proposer address.Address, toRemove address.Address, decrease bool) (cid.Cid, error) //perm:sign
|
||||
MsigRemoveSigner(ctx context.Context, msig address.Address, proposer address.Address, toRemove address.Address, decrease bool) (*MessagePrototype, error) //perm:sign
|
||||
|
||||
// MarketAddBalance adds funds to the market actor
|
||||
MarketAddBalance(ctx context.Context, wallet, addr address.Address, amt types.BigInt) (cid.Cid, error) //perm:sign
|
||||
@ -689,6 +680,11 @@ type FullNode interface {
|
||||
PaychVoucherList(context.Context, address.Address) ([]*paych.SignedVoucher, error) //perm:write
|
||||
PaychVoucherSubmit(context.Context, address.Address, *paych.SignedVoucher, []byte, []byte) (cid.Cid, error) //perm:sign
|
||||
|
||||
// MethodGroup: Node
|
||||
// These methods are general node management and status commands
|
||||
|
||||
NodeStatus(ctx context.Context, inclChainStatus bool) (NodeStatus, error) //perm:read
|
||||
|
||||
// CreateBackup creates node backup onder the specified file name. The
|
||||
// method requires that the lotus daemon is running with the
|
||||
// LOTUS_BACKUP_BASE_PATH environment variable set to some path, and that
|
||||
@ -1038,11 +1034,12 @@ type DealCollateralBounds struct {
|
||||
}
|
||||
|
||||
type CirculatingSupply struct {
|
||||
FilVested abi.TokenAmount
|
||||
FilMined abi.TokenAmount
|
||||
FilBurnt abi.TokenAmount
|
||||
FilLocked abi.TokenAmount
|
||||
FilCirculating abi.TokenAmount
|
||||
FilVested abi.TokenAmount
|
||||
FilMined abi.TokenAmount
|
||||
FilBurnt abi.TokenAmount
|
||||
FilLocked abi.TokenAmount
|
||||
FilCirculating abi.TokenAmount
|
||||
FilReserveDisbursed abi.TokenAmount
|
||||
}
|
||||
|
||||
type MiningBaseInfo struct {
|
||||
|
@ -14,6 +14,20 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
// MODIFYING THE API INTERFACE
|
||||
//
|
||||
// NOTE: This is the V1 (Unstable) API - to add methods to the V0 (Stable) API
|
||||
// you'll have to add those methods to interfaces in `api/v0api`
|
||||
//
|
||||
// When adding / changing methods in this file:
|
||||
// * Do the change here
|
||||
// * Adjust implementation in `node/impl/`
|
||||
// * Run `make gen` - this will:
|
||||
// * Generate proxy structs
|
||||
// * Generate mocks
|
||||
// * Generate markdown docs
|
||||
// * Generate openrpc blobs
|
||||
|
||||
type Gateway interface {
|
||||
ChainHasObj(context.Context, cid.Cid) (bool, error)
|
||||
ChainHead(ctx context.Context) (*types.TipSet, error)
|
||||
@ -31,7 +45,6 @@ type Gateway interface {
|
||||
StateAccountKey(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error)
|
||||
StateDealProviderCollateralBounds(ctx context.Context, size abi.PaddedPieceSize, verified bool, tsk types.TipSetKey) (DealCollateralBounds, error)
|
||||
StateGetActor(ctx context.Context, actor address.Address, ts types.TipSetKey) (*types.Actor, error)
|
||||
StateGetReceipt(context.Context, cid.Cid, types.TipSetKey) (*types.MessageReceipt, error)
|
||||
StateListMiners(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error)
|
||||
StateLookupID(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error)
|
||||
StateMarketBalance(ctx context.Context, addr address.Address, tsk types.TipSetKey) (MarketBalance, error)
|
||||
@ -40,8 +53,9 @@ type Gateway interface {
|
||||
StateMinerProvingDeadline(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*dline.Info, error)
|
||||
StateMinerPower(context.Context, address.Address, types.TipSetKey) (*MinerPower, error)
|
||||
StateNetworkVersion(context.Context, types.TipSetKey) (apitypes.NetworkVersion, error)
|
||||
StateSearchMsg(ctx context.Context, msg cid.Cid) (*MsgLookup, error)
|
||||
StateSectorGetInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorOnChainInfo, error)
|
||||
StateVerifiedClientStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error)
|
||||
StateWaitMsg(ctx context.Context, msg cid.Cid, confidence uint64) (*MsgLookup, error)
|
||||
StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*MsgLookup, error)
|
||||
StateWaitMsg(ctx context.Context, cid cid.Cid, confidence uint64, limit abi.ChainEpoch, allowReplaced bool) (*MsgLookup, error)
|
||||
WalletBalance(context.Context, address.Address) (types.BigInt, error)
|
||||
}
|
||||
|
@ -26,6 +26,17 @@ import (
|
||||
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
||||
)
|
||||
|
||||
// MODIFYING THE API INTERFACE
|
||||
//
|
||||
// When adding / changing methods in this file:
|
||||
// * Do the change here
|
||||
// * Adjust implementation in `node/impl/`
|
||||
// * Run `make gen` - this will:
|
||||
// * Generate proxy structs
|
||||
// * Generate mocks
|
||||
// * Generate markdown docs
|
||||
// * Generate openrpc blobs
|
||||
|
||||
// StorageMiner is a low-level interface to the Filecoin network storage miner node
|
||||
type StorageMiner interface {
|
||||
Common
|
||||
|
@ -113,3 +113,9 @@ func TestReturnTypes(t *testing.T) {
|
||||
t.Run("miner", tst(new(StorageMiner)))
|
||||
t.Run("worker", tst(new(Worker)))
|
||||
}
|
||||
|
||||
func TestPermTags(t *testing.T) {
|
||||
_ = PermissionedFullAPI(&FullNodeStruct{})
|
||||
_ = PermissionedStorMinerAPI(&StorageMinerStruct{})
|
||||
_ = PermissionedWorkerAPI(&WorkerStruct{})
|
||||
}
|
||||
|
@ -14,6 +14,17 @@ import (
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
)
|
||||
|
||||
// MODIFYING THE API INTERFACE
|
||||
//
|
||||
// When adding / changing methods in this file:
|
||||
// * Do the change here
|
||||
// * Adjust implementation in `node/impl/`
|
||||
// * Run `make gen` - this will:
|
||||
// * Generate proxy structs
|
||||
// * Generate mocks
|
||||
// * Generate markdown docs
|
||||
// * Generate openrpc blobs
|
||||
|
||||
type Worker interface {
|
||||
Version(context.Context) (Version, error) //perm:admin
|
||||
|
||||
|
@ -1,9 +0,0 @@
|
||||
package apistruct
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestPermTags(t *testing.T) {
|
||||
_ = PermissionedFullAPI(&FullNodeStruct{})
|
||||
_ = PermissionedStorMinerAPI(&StorageMinerStruct{})
|
||||
_ = PermissionedWorkerAPI(&WorkerStruct{})
|
||||
}
|
35
api/checkstatuscode_string.go
Normal file
35
api/checkstatuscode_string.go
Normal file
@ -0,0 +1,35 @@
|
||||
// Code generated by "stringer -type=CheckStatusCode -trimprefix=CheckStatus"; DO NOT EDIT.
|
||||
|
||||
package api
|
||||
|
||||
import "strconv"
|
||||
|
||||
func _() {
|
||||
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||
// Re-run the stringer command to generate them again.
|
||||
var x [1]struct{}
|
||||
_ = x[CheckStatusMessageSerialize-1]
|
||||
_ = x[CheckStatusMessageSize-2]
|
||||
_ = x[CheckStatusMessageValidity-3]
|
||||
_ = x[CheckStatusMessageMinGas-4]
|
||||
_ = x[CheckStatusMessageMinBaseFee-5]
|
||||
_ = x[CheckStatusMessageBaseFee-6]
|
||||
_ = x[CheckStatusMessageBaseFeeLowerBound-7]
|
||||
_ = x[CheckStatusMessageBaseFeeUpperBound-8]
|
||||
_ = x[CheckStatusMessageGetStateNonce-9]
|
||||
_ = x[CheckStatusMessageNonce-10]
|
||||
_ = x[CheckStatusMessageGetStateBalance-11]
|
||||
_ = x[CheckStatusMessageBalance-12]
|
||||
}
|
||||
|
||||
const _CheckStatusCode_name = "MessageSerializeMessageSizeMessageValidityMessageMinGasMessageMinBaseFeeMessageBaseFeeMessageBaseFeeLowerBoundMessageBaseFeeUpperBoundMessageGetStateNonceMessageNonceMessageGetStateBalanceMessageBalance"
|
||||
|
||||
var _CheckStatusCode_index = [...]uint8{0, 16, 27, 42, 55, 72, 86, 110, 134, 154, 166, 188, 202}
|
||||
|
||||
func (i CheckStatusCode) String() string {
|
||||
i -= 1
|
||||
if i < 0 || i >= CheckStatusCode(len(_CheckStatusCode_index)-1) {
|
||||
return "CheckStatusCode(" + strconv.FormatInt(int64(i+1), 10) + ")"
|
||||
}
|
||||
return _CheckStatusCode_name[_CheckStatusCode_index[i]:_CheckStatusCode_index[i+1]]
|
||||
}
|
@ -10,13 +10,14 @@ import (
|
||||
"github.com/filecoin-project/go-jsonrpc"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/api/apistruct"
|
||||
"github.com/filecoin-project/lotus/api/v0api"
|
||||
"github.com/filecoin-project/lotus/api/v1api"
|
||||
"github.com/filecoin-project/lotus/lib/rpcenc"
|
||||
)
|
||||
|
||||
// NewCommonRPC creates a new http jsonrpc client.
|
||||
func NewCommonRPC(ctx context.Context, addr string, requestHeader http.Header) (api.Common, jsonrpc.ClientCloser, error) {
|
||||
var res apistruct.CommonStruct
|
||||
// NewCommonRPCV0 creates a new http jsonrpc client.
|
||||
func NewCommonRPCV0(ctx context.Context, addr string, requestHeader http.Header) (api.Common, jsonrpc.ClientCloser, error) {
|
||||
var res v0api.CommonStruct
|
||||
closer, err := jsonrpc.NewMergeClient(ctx, addr, "Filecoin",
|
||||
[]interface{}{
|
||||
&res.Internal,
|
||||
@ -27,9 +28,9 @@ func NewCommonRPC(ctx context.Context, addr string, requestHeader http.Header) (
|
||||
return &res, closer, err
|
||||
}
|
||||
|
||||
// NewFullNodeRPC creates a new http jsonrpc client.
|
||||
func NewFullNodeRPC(ctx context.Context, addr string, requestHeader http.Header) (api.FullNode, jsonrpc.ClientCloser, error) {
|
||||
var res apistruct.FullNodeStruct
|
||||
// NewFullNodeRPCV0 creates a new http jsonrpc client.
|
||||
func NewFullNodeRPCV0(ctx context.Context, addr string, requestHeader http.Header) (v0api.FullNode, jsonrpc.ClientCloser, error) {
|
||||
var res v0api.FullNodeStruct
|
||||
closer, err := jsonrpc.NewMergeClient(ctx, addr, "Filecoin",
|
||||
[]interface{}{
|
||||
&res.CommonStruct.Internal,
|
||||
@ -39,9 +40,21 @@ func NewFullNodeRPC(ctx context.Context, addr string, requestHeader http.Header)
|
||||
return &res, closer, err
|
||||
}
|
||||
|
||||
// NewStorageMinerRPC creates a new http jsonrpc client for miner
|
||||
func NewStorageMinerRPC(ctx context.Context, addr string, requestHeader http.Header, opts ...jsonrpc.Option) (api.StorageMiner, jsonrpc.ClientCloser, error) {
|
||||
var res apistruct.StorageMinerStruct
|
||||
// NewFullNodeRPCV1 creates a new http jsonrpc client.
|
||||
func NewFullNodeRPCV1(ctx context.Context, addr string, requestHeader http.Header) (api.FullNode, jsonrpc.ClientCloser, error) {
|
||||
var res v1api.FullNodeStruct
|
||||
closer, err := jsonrpc.NewMergeClient(ctx, addr, "Filecoin",
|
||||
[]interface{}{
|
||||
&res.CommonStruct.Internal,
|
||||
&res.Internal,
|
||||
}, requestHeader)
|
||||
|
||||
return &res, closer, err
|
||||
}
|
||||
|
||||
// NewStorageMinerRPCV0 creates a new http jsonrpc client for miner
|
||||
func NewStorageMinerRPCV0(ctx context.Context, addr string, requestHeader http.Header, opts ...jsonrpc.Option) (v0api.StorageMiner, jsonrpc.ClientCloser, error) {
|
||||
var res v0api.StorageMinerStruct
|
||||
closer, err := jsonrpc.NewMergeClient(ctx, addr, "Filecoin",
|
||||
[]interface{}{
|
||||
&res.CommonStruct.Internal,
|
||||
@ -54,7 +67,7 @@ func NewStorageMinerRPC(ctx context.Context, addr string, requestHeader http.Hea
|
||||
return &res, closer, err
|
||||
}
|
||||
|
||||
func NewWorkerRPC(ctx context.Context, addr string, requestHeader http.Header) (api.Worker, jsonrpc.ClientCloser, error) {
|
||||
func NewWorkerRPCV0(ctx context.Context, addr string, requestHeader http.Header) (api.Worker, jsonrpc.ClientCloser, error) {
|
||||
u, err := url.Parse(addr)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@ -69,7 +82,7 @@ func NewWorkerRPC(ctx context.Context, addr string, requestHeader http.Header) (
|
||||
|
||||
u.Path = path.Join(u.Path, "../streams/v0/push")
|
||||
|
||||
var res apistruct.WorkerStruct
|
||||
var res api.WorkerStruct
|
||||
closer, err := jsonrpc.NewMergeClient(ctx, addr, "Filecoin",
|
||||
[]interface{}{
|
||||
&res.Internal,
|
||||
@ -83,9 +96,9 @@ func NewWorkerRPC(ctx context.Context, addr string, requestHeader http.Header) (
|
||||
return &res, closer, err
|
||||
}
|
||||
|
||||
// NewGatewayRPC creates a new http jsonrpc client for a gateway node.
|
||||
func NewGatewayRPC(ctx context.Context, addr string, requestHeader http.Header, opts ...jsonrpc.Option) (api.Gateway, jsonrpc.ClientCloser, error) {
|
||||
var res apistruct.GatewayStruct
|
||||
// NewGatewayRPCV1 creates a new http jsonrpc client for a gateway node.
|
||||
func NewGatewayRPCV1(ctx context.Context, addr string, requestHeader http.Header, opts ...jsonrpc.Option) (api.Gateway, jsonrpc.ClientCloser, error) {
|
||||
var res api.GatewayStruct
|
||||
closer, err := jsonrpc.NewMergeClient(ctx, addr, "Filecoin",
|
||||
[]interface{}{
|
||||
&res.Internal,
|
||||
@ -97,8 +110,22 @@ func NewGatewayRPC(ctx context.Context, addr string, requestHeader http.Header,
|
||||
return &res, closer, err
|
||||
}
|
||||
|
||||
func NewWalletRPC(ctx context.Context, addr string, requestHeader http.Header) (api.Wallet, jsonrpc.ClientCloser, error) {
|
||||
var res apistruct.WalletStruct
|
||||
// NewGatewayRPCV0 creates a new http jsonrpc client for a gateway node.
|
||||
func NewGatewayRPCV0(ctx context.Context, addr string, requestHeader http.Header, opts ...jsonrpc.Option) (v0api.Gateway, jsonrpc.ClientCloser, error) {
|
||||
var res v0api.GatewayStruct
|
||||
closer, err := jsonrpc.NewMergeClient(ctx, addr, "Filecoin",
|
||||
[]interface{}{
|
||||
&res.Internal,
|
||||
},
|
||||
requestHeader,
|
||||
opts...,
|
||||
)
|
||||
|
||||
return &res, closer, err
|
||||
}
|
||||
|
||||
func NewWalletRPCV0(ctx context.Context, addr string, requestHeader http.Header) (api.Wallet, jsonrpc.ClientCloser, error) {
|
||||
var res api.WalletStruct
|
||||
closer, err := jsonrpc.NewMergeClient(ctx, addr, "Filecoin",
|
||||
[]interface{}{
|
||||
&res.Internal,
|
||||
|
@ -7,7 +7,8 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/filecoin-project/lotus/api/apistruct"
|
||||
"github.com/filecoin-project/lotus/api/docgen"
|
||||
|
||||
docgen_openrpc "github.com/filecoin-project/lotus/api/docgen-openrpc"
|
||||
)
|
||||
|
||||
@ -29,16 +30,12 @@ Use:
|
||||
*/
|
||||
|
||||
func main() {
|
||||
doc := docgen_openrpc.NewLotusOpenRPCDocument()
|
||||
Comments, GroupDocs := docgen.ParseApiASTInfo(os.Args[1], os.Args[2], os.Args[3], os.Args[4])
|
||||
|
||||
switch os.Args[2] {
|
||||
case "FullNode":
|
||||
doc.RegisterReceiverName("Filecoin", &apistruct.FullNodeStruct{})
|
||||
case "StorageMiner":
|
||||
doc.RegisterReceiverName("Filecoin", &apistruct.StorageMinerStruct{})
|
||||
case "Worker":
|
||||
doc.RegisterReceiverName("Filecoin", &apistruct.WorkerStruct{})
|
||||
}
|
||||
doc := docgen_openrpc.NewLotusOpenRPCDocument(Comments, GroupDocs)
|
||||
|
||||
i, _, _, _ := docgen.GetAPIType(os.Args[2], os.Args[3])
|
||||
doc.RegisterReceiverName("Filecoin", i)
|
||||
|
||||
out, err := doc.Discover()
|
||||
if err != nil {
|
||||
@ -52,7 +49,7 @@ func main() {
|
||||
// Could use flags package to handle this more cleanly, but that requires changes elsewhere
|
||||
// the scope of which just isn't warranted by this one use case which will usually be run
|
||||
// programmatically anyways.
|
||||
if len(os.Args) > 3 && os.Args[3] == "-gzip" {
|
||||
if len(os.Args) > 5 && os.Args[5] == "-gzip" {
|
||||
jsonOut, err = json.Marshal(out)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"encoding/json"
|
||||
"go/ast"
|
||||
"net"
|
||||
"os"
|
||||
"reflect"
|
||||
|
||||
"github.com/alecthomas/jsonschema"
|
||||
@ -15,16 +14,6 @@ import (
|
||||
meta_schema "github.com/open-rpc/meta-schema"
|
||||
)
|
||||
|
||||
// Comments holds API method comments collected by AST parsing.
|
||||
var Comments map[string]string
|
||||
|
||||
// GroupDocs holds documentation for documentation groups.
|
||||
var GroupDocs map[string]string
|
||||
|
||||
func init() {
|
||||
Comments, GroupDocs = docgen.ParseApiASTInfo(os.Args[1], os.Args[2])
|
||||
}
|
||||
|
||||
// schemaDictEntry represents a type association passed to the jsonschema reflector.
|
||||
type schemaDictEntry struct {
|
||||
example interface{}
|
||||
@ -94,7 +83,7 @@ func OpenRPCSchemaTypeMapper(ty reflect.Type) *jsonschema.Type {
|
||||
}
|
||||
|
||||
// NewLotusOpenRPCDocument defines application-specific documentation and configuration for its OpenRPC document.
|
||||
func NewLotusOpenRPCDocument() *go_openrpc_reflect.Document {
|
||||
func NewLotusOpenRPCDocument(Comments, GroupDocs map[string]string) *go_openrpc_reflect.Document {
|
||||
d := &go_openrpc_reflect.Document{}
|
||||
|
||||
// Register "Meta" document fields.
|
||||
|
@ -4,39 +4,18 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/api/apistruct"
|
||||
"github.com/filecoin-project/lotus/api/docgen"
|
||||
)
|
||||
|
||||
func main() {
|
||||
comments, groupComments := docgen.ParseApiASTInfo(os.Args[1], os.Args[2])
|
||||
comments, groupComments := docgen.ParseApiASTInfo(os.Args[1], os.Args[2], os.Args[3], os.Args[4])
|
||||
|
||||
groups := make(map[string]*docgen.MethodGroup)
|
||||
|
||||
var t reflect.Type
|
||||
var permStruct, commonPermStruct reflect.Type
|
||||
|
||||
switch os.Args[2] {
|
||||
case "FullNode":
|
||||
t = reflect.TypeOf(new(struct{ api.FullNode })).Elem()
|
||||
permStruct = reflect.TypeOf(apistruct.FullNodeStruct{}.Internal)
|
||||
commonPermStruct = reflect.TypeOf(apistruct.CommonStruct{}.Internal)
|
||||
case "StorageMiner":
|
||||
t = reflect.TypeOf(new(struct{ api.StorageMiner })).Elem()
|
||||
permStruct = reflect.TypeOf(apistruct.StorageMinerStruct{}.Internal)
|
||||
commonPermStruct = reflect.TypeOf(apistruct.CommonStruct{}.Internal)
|
||||
case "Worker":
|
||||
t = reflect.TypeOf(new(struct{ api.Worker })).Elem()
|
||||
permStruct = reflect.TypeOf(apistruct.WorkerStruct{}.Internal)
|
||||
commonPermStruct = reflect.TypeOf(apistruct.WorkerStruct{}.Internal)
|
||||
default:
|
||||
panic("unknown type")
|
||||
}
|
||||
_, t, permStruct, commonPermStruct := docgen.GetAPIType(os.Args[2], os.Args[3])
|
||||
|
||||
for i := 0; i < t.NumMethod(); i++ {
|
||||
m := t.Method(i)
|
||||
|
@ -35,6 +35,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
apitypes "github.com/filecoin-project/lotus/api/types"
|
||||
"github.com/filecoin-project/lotus/api/v0api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
|
||||
@ -113,7 +114,7 @@ func init() {
|
||||
addExample(network.Connected)
|
||||
addExample(dtypes.NetworkName("lotus"))
|
||||
addExample(api.SyncStateStage(1))
|
||||
addExample(api.FullAPIVersion)
|
||||
addExample(api.FullAPIVersion1)
|
||||
addExample(api.PCHInbound)
|
||||
addExample(time.Minute)
|
||||
addExample(datatransfer.TransferID(3))
|
||||
@ -260,6 +261,45 @@ func init() {
|
||||
},
|
||||
"methods": []interface{}{}},
|
||||
)
|
||||
|
||||
addExample(api.CheckStatusCode(0))
|
||||
addExample(map[string]interface{}{"abc": 123})
|
||||
}
|
||||
|
||||
func GetAPIType(name, pkg string) (i interface{}, t, permStruct, commonPermStruct reflect.Type) {
|
||||
switch pkg {
|
||||
case "api": // latest
|
||||
switch name {
|
||||
case "FullNode":
|
||||
i = &api.FullNodeStruct{}
|
||||
t = reflect.TypeOf(new(struct{ api.FullNode })).Elem()
|
||||
permStruct = reflect.TypeOf(api.FullNodeStruct{}.Internal)
|
||||
commonPermStruct = reflect.TypeOf(api.CommonStruct{}.Internal)
|
||||
case "StorageMiner":
|
||||
i = &api.StorageMinerStruct{}
|
||||
t = reflect.TypeOf(new(struct{ api.StorageMiner })).Elem()
|
||||
permStruct = reflect.TypeOf(api.StorageMinerStruct{}.Internal)
|
||||
commonPermStruct = reflect.TypeOf(api.CommonStruct{}.Internal)
|
||||
case "Worker":
|
||||
i = &api.WorkerStruct{}
|
||||
t = reflect.TypeOf(new(struct{ api.Worker })).Elem()
|
||||
permStruct = reflect.TypeOf(api.WorkerStruct{}.Internal)
|
||||
commonPermStruct = reflect.TypeOf(api.WorkerStruct{}.Internal)
|
||||
default:
|
||||
panic("unknown type")
|
||||
}
|
||||
case "v0api":
|
||||
switch name {
|
||||
case "FullNode":
|
||||
i = v0api.FullNodeStruct{}
|
||||
t = reflect.TypeOf(new(struct{ v0api.FullNode })).Elem()
|
||||
permStruct = reflect.TypeOf(v0api.FullNodeStruct{}.Internal)
|
||||
commonPermStruct = reflect.TypeOf(v0api.CommonStruct{}.Internal)
|
||||
default:
|
||||
panic("unknown type")
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func ExampleValue(method string, t, parent reflect.Type) interface{} {
|
||||
@ -342,9 +382,9 @@ func (v *Visitor) Visit(node ast.Node) ast.Visitor {
|
||||
|
||||
const NoComment = "There are not yet any comments for this method."
|
||||
|
||||
func ParseApiASTInfo(apiFile, iface string) (comments map[string]string, groupDocs map[string]string) { //nolint:golint
|
||||
func ParseApiASTInfo(apiFile, iface, pkg, dir string) (comments map[string]string, groupDocs map[string]string) { //nolint:golint
|
||||
fset := token.NewFileSet()
|
||||
apiDir, err := filepath.Abs("./api")
|
||||
apiDir, err := filepath.Abs(dir)
|
||||
if err != nil {
|
||||
fmt.Println("./api filepath absolute error: ", err)
|
||||
return
|
||||
@ -360,14 +400,14 @@ func ParseApiASTInfo(apiFile, iface string) (comments map[string]string, groupDo
|
||||
return
|
||||
}
|
||||
|
||||
ap := pkgs["api"]
|
||||
ap := pkgs[pkg]
|
||||
|
||||
f := ap.Files[apiFile]
|
||||
|
||||
cmap := ast.NewCommentMap(fset, f, f.Comments)
|
||||
|
||||
v := &Visitor{iface, make(map[string]ast.Node)}
|
||||
ast.Walk(v, pkgs["api"])
|
||||
ast.Walk(v, ap)
|
||||
|
||||
comments = make(map[string]string)
|
||||
groupDocs = make(map[string]string)
|
||||
|
@ -6,6 +6,8 @@ package mocks
|
||||
|
||||
import (
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
|
||||
address "github.com/filecoin-project/go-address"
|
||||
bitfield "github.com/filecoin-project/go-bitfield"
|
||||
datatransfer "github.com/filecoin-project/go-data-transfer"
|
||||
@ -33,7 +35,6 @@ import (
|
||||
network0 "github.com/libp2p/go-libp2p-core/network"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
protocol "github.com/libp2p/go-libp2p-core/protocol"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
// MockFullNode is a mock of FullNode interface
|
||||
@ -770,6 +771,21 @@ func (mr *MockFullNodeMockRecorder) ClientStartDeal(arg0, arg1 interface{}) *gom
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ClientStartDeal", reflect.TypeOf((*MockFullNode)(nil).ClientStartDeal), arg0, arg1)
|
||||
}
|
||||
|
||||
// ClientStatelessDeal mocks base method
|
||||
func (m *MockFullNode) ClientStatelessDeal(arg0 context.Context, arg1 *api.StartDealParams) (*cid.Cid, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ClientStatelessDeal", arg0, arg1)
|
||||
ret0, _ := ret[0].(*cid.Cid)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// ClientStatelessDeal indicates an expected call of ClientStatelessDeal
|
||||
func (mr *MockFullNodeMockRecorder) ClientStatelessDeal(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ClientStatelessDeal", reflect.TypeOf((*MockFullNode)(nil).ClientStatelessDeal), arg0, arg1)
|
||||
}
|
||||
|
||||
// Closing mocks base method
|
||||
func (m *MockFullNode) Closing(arg0 context.Context) (<-chan struct{}, error) {
|
||||
m.ctrl.T.Helper()
|
||||
@ -1067,6 +1083,51 @@ func (mr *MockFullNodeMockRecorder) MpoolBatchPushUntrusted(arg0, arg1 interface
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MpoolBatchPushUntrusted", reflect.TypeOf((*MockFullNode)(nil).MpoolBatchPushUntrusted), arg0, arg1)
|
||||
}
|
||||
|
||||
// MpoolCheckMessages mocks base method
|
||||
func (m *MockFullNode) MpoolCheckMessages(arg0 context.Context, arg1 []*api.MessagePrototype) ([][]api.MessageCheckStatus, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "MpoolCheckMessages", arg0, arg1)
|
||||
ret0, _ := ret[0].([][]api.MessageCheckStatus)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// MpoolCheckMessages indicates an expected call of MpoolCheckMessages
|
||||
func (mr *MockFullNodeMockRecorder) MpoolCheckMessages(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MpoolCheckMessages", reflect.TypeOf((*MockFullNode)(nil).MpoolCheckMessages), arg0, arg1)
|
||||
}
|
||||
|
||||
// MpoolCheckPendingMessages mocks base method
|
||||
func (m *MockFullNode) MpoolCheckPendingMessages(arg0 context.Context, arg1 address.Address) ([][]api.MessageCheckStatus, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "MpoolCheckPendingMessages", arg0, arg1)
|
||||
ret0, _ := ret[0].([][]api.MessageCheckStatus)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// MpoolCheckPendingMessages indicates an expected call of MpoolCheckPendingMessages
|
||||
func (mr *MockFullNodeMockRecorder) MpoolCheckPendingMessages(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MpoolCheckPendingMessages", reflect.TypeOf((*MockFullNode)(nil).MpoolCheckPendingMessages), arg0, arg1)
|
||||
}
|
||||
|
||||
// MpoolCheckReplaceMessages mocks base method
|
||||
func (m *MockFullNode) MpoolCheckReplaceMessages(arg0 context.Context, arg1 []*types.Message) ([][]api.MessageCheckStatus, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "MpoolCheckReplaceMessages", arg0, arg1)
|
||||
ret0, _ := ret[0].([][]api.MessageCheckStatus)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// MpoolCheckReplaceMessages indicates an expected call of MpoolCheckReplaceMessages
|
||||
func (mr *MockFullNodeMockRecorder) MpoolCheckReplaceMessages(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MpoolCheckReplaceMessages", reflect.TypeOf((*MockFullNode)(nil).MpoolCheckReplaceMessages), arg0, arg1)
|
||||
}
|
||||
|
||||
// MpoolClear mocks base method
|
||||
func (m *MockFullNode) MpoolClear(arg0 context.Context, arg1 bool) error {
|
||||
m.ctrl.T.Helper()
|
||||
@ -1216,10 +1277,10 @@ func (mr *MockFullNodeMockRecorder) MpoolSub(arg0 interface{}) *gomock.Call {
|
||||
}
|
||||
|
||||
// MsigAddApprove mocks base method
|
||||
func (m *MockFullNode) MsigAddApprove(arg0 context.Context, arg1, arg2 address.Address, arg3 uint64, arg4, arg5 address.Address, arg6 bool) (cid.Cid, error) {
|
||||
func (m *MockFullNode) MsigAddApprove(arg0 context.Context, arg1, arg2 address.Address, arg3 uint64, arg4, arg5 address.Address, arg6 bool) (*api.MessagePrototype, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "MsigAddApprove", arg0, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
ret0, _ := ret[0].(cid.Cid)
|
||||
ret0, _ := ret[0].(*api.MessagePrototype)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
@ -1231,10 +1292,10 @@ func (mr *MockFullNodeMockRecorder) MsigAddApprove(arg0, arg1, arg2, arg3, arg4,
|
||||
}
|
||||
|
||||
// MsigAddCancel mocks base method
|
||||
func (m *MockFullNode) MsigAddCancel(arg0 context.Context, arg1, arg2 address.Address, arg3 uint64, arg4 address.Address, arg5 bool) (cid.Cid, error) {
|
||||
func (m *MockFullNode) MsigAddCancel(arg0 context.Context, arg1, arg2 address.Address, arg3 uint64, arg4 address.Address, arg5 bool) (*api.MessagePrototype, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "MsigAddCancel", arg0, arg1, arg2, arg3, arg4, arg5)
|
||||
ret0, _ := ret[0].(cid.Cid)
|
||||
ret0, _ := ret[0].(*api.MessagePrototype)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
@ -1246,10 +1307,10 @@ func (mr *MockFullNodeMockRecorder) MsigAddCancel(arg0, arg1, arg2, arg3, arg4,
|
||||
}
|
||||
|
||||
// MsigAddPropose mocks base method
|
||||
func (m *MockFullNode) MsigAddPropose(arg0 context.Context, arg1, arg2, arg3 address.Address, arg4 bool) (cid.Cid, error) {
|
||||
func (m *MockFullNode) MsigAddPropose(arg0 context.Context, arg1, arg2, arg3 address.Address, arg4 bool) (*api.MessagePrototype, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "MsigAddPropose", arg0, arg1, arg2, arg3, arg4)
|
||||
ret0, _ := ret[0].(cid.Cid)
|
||||
ret0, _ := ret[0].(*api.MessagePrototype)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
@ -1261,10 +1322,10 @@ func (mr *MockFullNodeMockRecorder) MsigAddPropose(arg0, arg1, arg2, arg3, arg4
|
||||
}
|
||||
|
||||
// MsigApprove mocks base method
|
||||
func (m *MockFullNode) MsigApprove(arg0 context.Context, arg1 address.Address, arg2 uint64, arg3 address.Address) (cid.Cid, error) {
|
||||
func (m *MockFullNode) MsigApprove(arg0 context.Context, arg1 address.Address, arg2 uint64, arg3 address.Address) (*api.MessagePrototype, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "MsigApprove", arg0, arg1, arg2, arg3)
|
||||
ret0, _ := ret[0].(cid.Cid)
|
||||
ret0, _ := ret[0].(*api.MessagePrototype)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
@ -1276,10 +1337,10 @@ func (mr *MockFullNodeMockRecorder) MsigApprove(arg0, arg1, arg2, arg3 interface
|
||||
}
|
||||
|
||||
// MsigApproveTxnHash mocks base method
|
||||
func (m *MockFullNode) MsigApproveTxnHash(arg0 context.Context, arg1 address.Address, arg2 uint64, arg3, arg4 address.Address, arg5 big.Int, arg6 address.Address, arg7 uint64, arg8 []byte) (cid.Cid, error) {
|
||||
func (m *MockFullNode) MsigApproveTxnHash(arg0 context.Context, arg1 address.Address, arg2 uint64, arg3, arg4 address.Address, arg5 big.Int, arg6 address.Address, arg7 uint64, arg8 []byte) (*api.MessagePrototype, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "MsigApproveTxnHash", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
|
||||
ret0, _ := ret[0].(cid.Cid)
|
||||
ret0, _ := ret[0].(*api.MessagePrototype)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
@ -1291,10 +1352,10 @@ func (mr *MockFullNodeMockRecorder) MsigApproveTxnHash(arg0, arg1, arg2, arg3, a
|
||||
}
|
||||
|
||||
// MsigCancel mocks base method
|
||||
func (m *MockFullNode) MsigCancel(arg0 context.Context, arg1 address.Address, arg2 uint64, arg3 address.Address, arg4 big.Int, arg5 address.Address, arg6 uint64, arg7 []byte) (cid.Cid, error) {
|
||||
func (m *MockFullNode) MsigCancel(arg0 context.Context, arg1 address.Address, arg2 uint64, arg3 address.Address, arg4 big.Int, arg5 address.Address, arg6 uint64, arg7 []byte) (*api.MessagePrototype, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "MsigCancel", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
|
||||
ret0, _ := ret[0].(cid.Cid)
|
||||
ret0, _ := ret[0].(*api.MessagePrototype)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
@ -1306,10 +1367,10 @@ func (mr *MockFullNodeMockRecorder) MsigCancel(arg0, arg1, arg2, arg3, arg4, arg
|
||||
}
|
||||
|
||||
// MsigCreate mocks base method
|
||||
func (m *MockFullNode) MsigCreate(arg0 context.Context, arg1 uint64, arg2 []address.Address, arg3 abi.ChainEpoch, arg4 big.Int, arg5 address.Address, arg6 big.Int) (cid.Cid, error) {
|
||||
func (m *MockFullNode) MsigCreate(arg0 context.Context, arg1 uint64, arg2 []address.Address, arg3 abi.ChainEpoch, arg4 big.Int, arg5 address.Address, arg6 big.Int) (*api.MessagePrototype, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "MsigCreate", arg0, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
ret0, _ := ret[0].(cid.Cid)
|
||||
ret0, _ := ret[0].(*api.MessagePrototype)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
@ -1381,10 +1442,10 @@ func (mr *MockFullNodeMockRecorder) MsigGetVestingSchedule(arg0, arg1, arg2 inte
|
||||
}
|
||||
|
||||
// MsigPropose mocks base method
|
||||
func (m *MockFullNode) MsigPropose(arg0 context.Context, arg1, arg2 address.Address, arg3 big.Int, arg4 address.Address, arg5 uint64, arg6 []byte) (cid.Cid, error) {
|
||||
func (m *MockFullNode) MsigPropose(arg0 context.Context, arg1, arg2 address.Address, arg3 big.Int, arg4 address.Address, arg5 uint64, arg6 []byte) (*api.MessagePrototype, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "MsigPropose", arg0, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
ret0, _ := ret[0].(cid.Cid)
|
||||
ret0, _ := ret[0].(*api.MessagePrototype)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
@ -1396,10 +1457,10 @@ func (mr *MockFullNodeMockRecorder) MsigPropose(arg0, arg1, arg2, arg3, arg4, ar
|
||||
}
|
||||
|
||||
// MsigRemoveSigner mocks base method
|
||||
func (m *MockFullNode) MsigRemoveSigner(arg0 context.Context, arg1, arg2, arg3 address.Address, arg4 bool) (cid.Cid, error) {
|
||||
func (m *MockFullNode) MsigRemoveSigner(arg0 context.Context, arg1, arg2, arg3 address.Address, arg4 bool) (*api.MessagePrototype, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "MsigRemoveSigner", arg0, arg1, arg2, arg3, arg4)
|
||||
ret0, _ := ret[0].(cid.Cid)
|
||||
ret0, _ := ret[0].(*api.MessagePrototype)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
@ -1411,10 +1472,10 @@ func (mr *MockFullNodeMockRecorder) MsigRemoveSigner(arg0, arg1, arg2, arg3, arg
|
||||
}
|
||||
|
||||
// MsigSwapApprove mocks base method
|
||||
func (m *MockFullNode) MsigSwapApprove(arg0 context.Context, arg1, arg2 address.Address, arg3 uint64, arg4, arg5, arg6 address.Address) (cid.Cid, error) {
|
||||
func (m *MockFullNode) MsigSwapApprove(arg0 context.Context, arg1, arg2 address.Address, arg3 uint64, arg4, arg5, arg6 address.Address) (*api.MessagePrototype, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "MsigSwapApprove", arg0, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
ret0, _ := ret[0].(cid.Cid)
|
||||
ret0, _ := ret[0].(*api.MessagePrototype)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
@ -1426,10 +1487,10 @@ func (mr *MockFullNodeMockRecorder) MsigSwapApprove(arg0, arg1, arg2, arg3, arg4
|
||||
}
|
||||
|
||||
// MsigSwapCancel mocks base method
|
||||
func (m *MockFullNode) MsigSwapCancel(arg0 context.Context, arg1, arg2 address.Address, arg3 uint64, arg4, arg5 address.Address) (cid.Cid, error) {
|
||||
func (m *MockFullNode) MsigSwapCancel(arg0 context.Context, arg1, arg2 address.Address, arg3 uint64, arg4, arg5 address.Address) (*api.MessagePrototype, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "MsigSwapCancel", arg0, arg1, arg2, arg3, arg4, arg5)
|
||||
ret0, _ := ret[0].(cid.Cid)
|
||||
ret0, _ := ret[0].(*api.MessagePrototype)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
@ -1441,10 +1502,10 @@ func (mr *MockFullNodeMockRecorder) MsigSwapCancel(arg0, arg1, arg2, arg3, arg4,
|
||||
}
|
||||
|
||||
// MsigSwapPropose mocks base method
|
||||
func (m *MockFullNode) MsigSwapPropose(arg0 context.Context, arg1, arg2, arg3, arg4 address.Address) (cid.Cid, error) {
|
||||
func (m *MockFullNode) MsigSwapPropose(arg0 context.Context, arg1, arg2, arg3, arg4 address.Address) (*api.MessagePrototype, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "MsigSwapPropose", arg0, arg1, arg2, arg3, arg4)
|
||||
ret0, _ := ret[0].(cid.Cid)
|
||||
ret0, _ := ret[0].(*api.MessagePrototype)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
@ -1691,6 +1752,21 @@ func (mr *MockFullNodeMockRecorder) NetPubsubScores(arg0 interface{}) *gomock.Ca
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetPubsubScores", reflect.TypeOf((*MockFullNode)(nil).NetPubsubScores), arg0)
|
||||
}
|
||||
|
||||
// NodeStatus mocks base method
|
||||
func (m *MockFullNode) NodeStatus(arg0 context.Context, arg1 bool) (api.NodeStatus, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "NodeStatus", arg0, arg1)
|
||||
ret0, _ := ret[0].(api.NodeStatus)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// NodeStatus indicates an expected call of NodeStatus
|
||||
func (mr *MockFullNodeMockRecorder) NodeStatus(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NodeStatus", reflect.TypeOf((*MockFullNode)(nil).NodeStatus), arg0, arg1)
|
||||
}
|
||||
|
||||
// PaychAllocateLane mocks base method
|
||||
func (m *MockFullNode) PaychAllocateLane(arg0 context.Context, arg1 address.Address) (uint64, error) {
|
||||
m.ctrl.T.Helper()
|
||||
@ -2094,21 +2170,6 @@ func (mr *MockFullNodeMockRecorder) StateGetActor(arg0, arg1, arg2 interface{})
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateGetActor", reflect.TypeOf((*MockFullNode)(nil).StateGetActor), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// StateGetReceipt mocks base method
|
||||
func (m *MockFullNode) StateGetReceipt(arg0 context.Context, arg1 cid.Cid, arg2 types.TipSetKey) (*types.MessageReceipt, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateGetReceipt", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(*types.MessageReceipt)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateGetReceipt indicates an expected call of StateGetReceipt
|
||||
func (mr *MockFullNodeMockRecorder) StateGetReceipt(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateGetReceipt", reflect.TypeOf((*MockFullNode)(nil).StateGetReceipt), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// StateListActors mocks base method
|
||||
func (m *MockFullNode) StateListActors(arg0 context.Context, arg1 types.TipSetKey) ([]address.Address, error) {
|
||||
m.ctrl.T.Helper()
|
||||
@ -2500,33 +2561,18 @@ func (mr *MockFullNodeMockRecorder) StateReplay(arg0, arg1, arg2 interface{}) *g
|
||||
}
|
||||
|
||||
// StateSearchMsg mocks base method
|
||||
func (m *MockFullNode) StateSearchMsg(arg0 context.Context, arg1 cid.Cid) (*api.MsgLookup, error) {
|
||||
func (m *MockFullNode) StateSearchMsg(arg0 context.Context, arg1 types.TipSetKey, arg2 cid.Cid, arg3 abi.ChainEpoch, arg4 bool) (*api.MsgLookup, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateSearchMsg", arg0, arg1)
|
||||
ret := m.ctrl.Call(m, "StateSearchMsg", arg0, arg1, arg2, arg3, arg4)
|
||||
ret0, _ := ret[0].(*api.MsgLookup)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateSearchMsg indicates an expected call of StateSearchMsg
|
||||
func (mr *MockFullNodeMockRecorder) StateSearchMsg(arg0, arg1 interface{}) *gomock.Call {
|
||||
func (mr *MockFullNodeMockRecorder) StateSearchMsg(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateSearchMsg", reflect.TypeOf((*MockFullNode)(nil).StateSearchMsg), arg0, arg1)
|
||||
}
|
||||
|
||||
// StateSearchMsgLimited mocks base method
|
||||
func (m *MockFullNode) StateSearchMsgLimited(arg0 context.Context, arg1 cid.Cid, arg2 abi.ChainEpoch) (*api.MsgLookup, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateSearchMsgLimited", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(*api.MsgLookup)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateSearchMsgLimited indicates an expected call of StateSearchMsgLimited
|
||||
func (mr *MockFullNodeMockRecorder) StateSearchMsgLimited(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateSearchMsgLimited", reflect.TypeOf((*MockFullNode)(nil).StateSearchMsgLimited), arg0, arg1, arg2)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateSearchMsg", reflect.TypeOf((*MockFullNode)(nil).StateSearchMsg), arg0, arg1, arg2, arg3, arg4)
|
||||
}
|
||||
|
||||
// StateSectorExpiration mocks base method
|
||||
@ -2650,33 +2696,18 @@ func (mr *MockFullNodeMockRecorder) StateVerifierStatus(arg0, arg1, arg2 interfa
|
||||
}
|
||||
|
||||
// StateWaitMsg mocks base method
|
||||
func (m *MockFullNode) StateWaitMsg(arg0 context.Context, arg1 cid.Cid, arg2 uint64) (*api.MsgLookup, error) {
|
||||
func (m *MockFullNode) StateWaitMsg(arg0 context.Context, arg1 cid.Cid, arg2 uint64, arg3 abi.ChainEpoch, arg4 bool) (*api.MsgLookup, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateWaitMsg", arg0, arg1, arg2)
|
||||
ret := m.ctrl.Call(m, "StateWaitMsg", arg0, arg1, arg2, arg3, arg4)
|
||||
ret0, _ := ret[0].(*api.MsgLookup)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateWaitMsg indicates an expected call of StateWaitMsg
|
||||
func (mr *MockFullNodeMockRecorder) StateWaitMsg(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
func (mr *MockFullNodeMockRecorder) StateWaitMsg(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateWaitMsg", reflect.TypeOf((*MockFullNode)(nil).StateWaitMsg), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// StateWaitMsgLimited mocks base method
|
||||
func (m *MockFullNode) StateWaitMsgLimited(arg0 context.Context, arg1 cid.Cid, arg2 uint64, arg3 abi.ChainEpoch) (*api.MsgLookup, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateWaitMsgLimited", arg0, arg1, arg2, arg3)
|
||||
ret0, _ := ret[0].(*api.MsgLookup)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateWaitMsgLimited indicates an expected call of StateWaitMsgLimited
|
||||
func (mr *MockFullNodeMockRecorder) StateWaitMsgLimited(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateWaitMsgLimited", reflect.TypeOf((*MockFullNode)(nil).StateWaitMsgLimited), arg0, arg1, arg2, arg3)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateWaitMsg", reflect.TypeOf((*MockFullNode)(nil).StateWaitMsg), arg0, arg1, arg2, arg3, arg4)
|
||||
}
|
||||
|
||||
// SyncCheckBad mocks base method
|
||||
|
@ -1,8 +1,7 @@
|
||||
package apistruct
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/filecoin-project/go-jsonrpc/auth"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -17,27 +16,27 @@ const (
|
||||
var AllPermissions = []auth.Permission{PermRead, PermWrite, PermSign, PermAdmin}
|
||||
var DefaultPerms = []auth.Permission{PermRead}
|
||||
|
||||
func PermissionedStorMinerAPI(a api.StorageMiner) api.StorageMiner {
|
||||
func PermissionedStorMinerAPI(a StorageMiner) StorageMiner {
|
||||
var out StorageMinerStruct
|
||||
auth.PermissionedProxy(AllPermissions, DefaultPerms, a, &out.Internal)
|
||||
auth.PermissionedProxy(AllPermissions, DefaultPerms, a, &out.CommonStruct.Internal)
|
||||
return &out
|
||||
}
|
||||
|
||||
func PermissionedFullAPI(a api.FullNode) api.FullNode {
|
||||
func PermissionedFullAPI(a FullNode) FullNode {
|
||||
var out FullNodeStruct
|
||||
auth.PermissionedProxy(AllPermissions, DefaultPerms, a, &out.Internal)
|
||||
auth.PermissionedProxy(AllPermissions, DefaultPerms, a, &out.CommonStruct.Internal)
|
||||
return &out
|
||||
}
|
||||
|
||||
func PermissionedWorkerAPI(a api.Worker) api.Worker {
|
||||
func PermissionedWorkerAPI(a Worker) Worker {
|
||||
var out WorkerStruct
|
||||
auth.PermissionedProxy(AllPermissions, DefaultPerms, a, &out.Internal)
|
||||
return &out
|
||||
}
|
||||
|
||||
func PermissionedWalletAPI(a api.Wallet) api.Wallet {
|
||||
func PermissionedWalletAPI(a Wallet) Wallet {
|
||||
var out WalletStruct
|
||||
auth.PermissionedProxy(AllPermissions, DefaultPerms, a, &out.Internal)
|
||||
return &out
|
3671
api/proxy_gen.go
Normal file
3671
api/proxy_gen.go
Normal file
File diff suppressed because it is too large
Load Diff
@ -7,6 +7,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
@ -61,7 +63,7 @@ func TestDeadlineToggling(t *testing.T, b APIBuilder, blocktime time.Duration) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
n, sn := b(t, []FullNodeOpts{FullNodeWithV4ActorsAt(upgradeH)}, OneMiner)
|
||||
n, sn := b(t, []FullNodeOpts{FullNodeWithLatestActorsAt(upgradeH)}, OneMiner)
|
||||
|
||||
client := n[0].FullNode.(*impl.FullNodeAPI)
|
||||
minerA := sn[0]
|
||||
@ -240,7 +242,7 @@ func TestDeadlineToggling(t *testing.T, b APIBuilder, blocktime time.Duration) {
|
||||
}, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
r, err := client.StateWaitMsg(ctx, m.Cid(), 2)
|
||||
r, err := client.StateWaitMsg(ctx, m.Cid(), 2, api.LookbackNoLimit, true)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, exitcode.Ok, r.Receipt.ExitCode)
|
||||
}
|
||||
@ -323,7 +325,7 @@ func TestDeadlineToggling(t *testing.T, b APIBuilder, blocktime time.Duration) {
|
||||
|
||||
fmt.Println("sent termination message:", smsg.Cid())
|
||||
|
||||
r, err := client.StateWaitMsg(ctx, smsg.Cid(), 2)
|
||||
r, err := client.StateWaitMsg(ctx, smsg.Cid(), 2, api.LookbackNoLimit, true)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, exitcode.Ok, r.Receipt.ExitCode)
|
||||
|
||||
|
@ -235,7 +235,7 @@ func TestPaymentChannels(t *testing.T, b APIBuilder, blocktime time.Duration) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
res, err = paymentReceiver.StateWaitMsg(ctx, collectMsg, 3)
|
||||
res, err = paymentReceiver.StateWaitMsg(ctx, collectMsg, 3, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -287,7 +287,7 @@ func waitForBlocks(ctx context.Context, t *testing.T, bm *BlockMiner, paymentRec
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
_, err = paymentReceiver.StateWaitMsg(ctx, m.Cid(), 1)
|
||||
_, err = paymentReceiver.StateWaitMsg(ctx, m.Cid(), 1, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -299,7 +299,7 @@ func waitForMessage(ctx context.Context, t *testing.T, paymentCreator TestNode,
|
||||
defer cancel()
|
||||
|
||||
fmt.Println("Waiting for", desc)
|
||||
res, err := paymentCreator.StateWaitMsg(ctx, msgCid, 1)
|
||||
res, err := paymentCreator.StateWaitMsg(ctx, msgCid, 1, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
fmt.Println("Error waiting for", desc, err)
|
||||
t.Fatal(err)
|
||||
|
@ -19,7 +19,8 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
lapi "github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/api/v1api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
@ -39,7 +40,7 @@ func init() {
|
||||
type StorageBuilder func(context.Context, *testing.T, abi.RegisteredSealProof, address.Address) TestStorageNode
|
||||
|
||||
type TestNode struct {
|
||||
api.FullNode
|
||||
v1api.FullNode
|
||||
// ListenAddr is the address on which an API server is listening, if an
|
||||
// API server is created for this Node
|
||||
ListenAddr multiaddr.Multiaddr
|
||||
@ -48,7 +49,7 @@ type TestNode struct {
|
||||
}
|
||||
|
||||
type TestStorageNode struct {
|
||||
api.StorageMiner
|
||||
lapi.StorageMiner
|
||||
// ListenAddr is the address on which an API server is listening, if an
|
||||
// API server is created for this Node
|
||||
ListenAddr multiaddr.Multiaddr
|
||||
@ -200,9 +201,9 @@ var MineNext = miner.MineReq{
|
||||
}
|
||||
|
||||
func (ts *testSuite) testVersion(t *testing.T) {
|
||||
api.RunningNodeType = api.NodeFull
|
||||
lapi.RunningNodeType = lapi.NodeFull
|
||||
t.Cleanup(func() {
|
||||
api.RunningNodeType = api.NodeUnknown
|
||||
lapi.RunningNodeType = lapi.NodeUnknown
|
||||
})
|
||||
|
||||
ctx := context.Background()
|
||||
@ -244,7 +245,7 @@ func (ts *testSuite) testSearchMsg(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
res, err := api.StateWaitMsg(ctx, sm.Cid(), 1)
|
||||
res, err := api.StateWaitMsg(ctx, sm.Cid(), 1, lapi.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -252,7 +253,7 @@ func (ts *testSuite) testSearchMsg(t *testing.T) {
|
||||
t.Fatal("did not successfully send message")
|
||||
}
|
||||
|
||||
searchRes, err := api.StateSearchMsg(ctx, sm.Cid())
|
||||
searchRes, err := api.StateSearchMsg(ctx, types.EmptyTSK, sm.Cid(), lapi.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
lapi "github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/miner"
|
||||
)
|
||||
@ -28,7 +29,7 @@ func SendFunds(ctx context.Context, t *testing.T, sender TestNode, addr address.
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
res, err := sender.StateWaitMsg(ctx, sm.Cid(), 1)
|
||||
res, err := sender.StateWaitMsg(ctx, sm.Cid(), 3, lapi.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -439,7 +439,7 @@ func TestWindowPostDispute(t *testing.T, b APIBuilder, blocktime time.Duration)
|
||||
///
|
||||
// Then we're going to manually submit bad proofs.
|
||||
n, sn := b(t, []FullNodeOpts{
|
||||
FullNodeWithV4ActorsAt(-1),
|
||||
FullNodeWithLatestActorsAt(-1),
|
||||
}, []StorageMiner{
|
||||
{Full: 0, Preseal: PresealGenesis},
|
||||
{Full: 0},
|
||||
@ -588,7 +588,7 @@ func TestWindowPostDispute(t *testing.T, b APIBuilder, blocktime time.Duration)
|
||||
require.NoError(t, err)
|
||||
|
||||
fmt.Println("waiting dispute")
|
||||
rec, err := client.StateWaitMsg(ctx, sm.Cid(), build.MessageConfidence)
|
||||
rec, err := client.StateWaitMsg(ctx, sm.Cid(), build.MessageConfidence, api.LookbackNoLimit, true)
|
||||
require.NoError(t, err)
|
||||
require.Zero(t, rec.Receipt.ExitCode, "dispute not accepted: %s", rec.Receipt.ExitCode.Error())
|
||||
}
|
||||
@ -629,7 +629,7 @@ func TestWindowPostDispute(t *testing.T, b APIBuilder, blocktime time.Duration)
|
||||
sm, err := client.MpoolPushMessage(ctx, msg, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
rec, err := client.StateWaitMsg(ctx, sm.Cid(), build.MessageConfidence)
|
||||
rec, err := client.StateWaitMsg(ctx, sm.Cid(), build.MessageConfidence, api.LookbackNoLimit, true)
|
||||
require.NoError(t, err)
|
||||
require.Zero(t, rec.Receipt.ExitCode, "recovery not accepted: %s", rec.Receipt.ExitCode.Error())
|
||||
}
|
||||
@ -708,7 +708,7 @@ func submitBadProof(
|
||||
return err
|
||||
}
|
||||
|
||||
rec, err := client.StateWaitMsg(ctx, sm.Cid(), build.MessageConfidence)
|
||||
rec, err := client.StateWaitMsg(ctx, sm.Cid(), build.MessageConfidence, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -722,7 +722,7 @@ func TestWindowPostDisputeFails(t *testing.T, b APIBuilder, blocktime time.Durat
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
n, sn := b(t, []FullNodeOpts{FullNodeWithV4ActorsAt(-1)}, OneMiner)
|
||||
n, sn := b(t, []FullNodeOpts{FullNodeWithLatestActorsAt(-1)}, OneMiner)
|
||||
|
||||
client := n[0].FullNode.(*impl.FullNodeAPI)
|
||||
miner := sn[0]
|
||||
|
60
api/types.go
60
api/types.go
@ -5,6 +5,8 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
|
||||
datatransfer "github.com/filecoin-project/go-data-transfer"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/ipfs/go-cid"
|
||||
@ -116,3 +118,61 @@ type ConnMgrInfo struct {
|
||||
Tags map[string]int
|
||||
Conns map[string]time.Time
|
||||
}
|
||||
|
||||
type NodeStatus struct {
|
||||
SyncStatus NodeSyncStatus
|
||||
PeerStatus NodePeerStatus
|
||||
ChainStatus NodeChainStatus
|
||||
}
|
||||
|
||||
type NodeSyncStatus struct {
|
||||
Epoch uint64
|
||||
Behind uint64
|
||||
}
|
||||
|
||||
type NodePeerStatus struct {
|
||||
PeersToPublishMsgs int
|
||||
PeersToPublishBlocks int
|
||||
}
|
||||
|
||||
type NodeChainStatus struct {
|
||||
BlocksPerTipsetLast100 float64
|
||||
BlocksPerTipsetLastFinality float64
|
||||
}
|
||||
|
||||
type CheckStatusCode int
|
||||
|
||||
//go:generate go run golang.org/x/tools/cmd/stringer -type=CheckStatusCode -trimprefix=CheckStatus
|
||||
const (
|
||||
_ CheckStatusCode = iota
|
||||
// Message Checks
|
||||
CheckStatusMessageSerialize
|
||||
CheckStatusMessageSize
|
||||
CheckStatusMessageValidity
|
||||
CheckStatusMessageMinGas
|
||||
CheckStatusMessageMinBaseFee
|
||||
CheckStatusMessageBaseFee
|
||||
CheckStatusMessageBaseFeeLowerBound
|
||||
CheckStatusMessageBaseFeeUpperBound
|
||||
CheckStatusMessageGetStateNonce
|
||||
CheckStatusMessageNonce
|
||||
CheckStatusMessageGetStateBalance
|
||||
CheckStatusMessageBalance
|
||||
)
|
||||
|
||||
type CheckStatus struct {
|
||||
Code CheckStatusCode
|
||||
OK bool
|
||||
Err string
|
||||
Hint map[string]interface{}
|
||||
}
|
||||
|
||||
type MessageCheckStatus struct {
|
||||
Cid cid.Cid
|
||||
CheckStatus
|
||||
}
|
||||
|
||||
type MessagePrototype struct {
|
||||
Message types.Message
|
||||
ValidNonce bool
|
||||
}
|
||||
|
703
api/v0api/full.go
Normal file
703
api/v0api/full.go
Normal file
@ -0,0 +1,703 @@
|
||||
package v0api
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
datatransfer "github.com/filecoin-project/go-data-transfer"
|
||||
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
|
||||
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
||||
"github.com/filecoin-project/go-multistore"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
apitypes "github.com/filecoin-project/lotus/api/types"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/paych"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
marketevents "github.com/filecoin-project/lotus/markets/loggers"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
)
|
||||
|
||||
//go:generate go run github.com/golang/mock/mockgen -destination=v0mocks/mock_full.go -package=v0mocks . FullNode
|
||||
|
||||
// MODIFYING THE API INTERFACE
|
||||
//
|
||||
// NOTE: This is the V0 (Stable) API - when adding methods to this interface,
|
||||
// you'll need to make sure they are also present on the V1 (Unstable) API
|
||||
//
|
||||
// This API is implemented in `v1_wrapper.go` as a compatibility layer backed
|
||||
// by the V1 api
|
||||
//
|
||||
// When adding / changing methods in this file:
|
||||
// * Do the change here
|
||||
// * Adjust implementation in `node/impl/`
|
||||
// * Run `make gen` - this will:
|
||||
// * Generate proxy structs
|
||||
// * Generate mocks
|
||||
// * Generate markdown docs
|
||||
// * Generate openrpc blobs
|
||||
|
||||
// FullNode API is a low-level interface to the Filecoin network full node
|
||||
type FullNode interface {
|
||||
Common
|
||||
|
||||
// MethodGroup: Chain
|
||||
// The Chain method group contains methods for interacting with the
|
||||
// blockchain, but that do not require any form of state computation.
|
||||
|
||||
// ChainNotify returns channel with chain head updates.
|
||||
// First message is guaranteed to be of len == 1, and type == 'current'.
|
||||
ChainNotify(context.Context) (<-chan []*api.HeadChange, error) //perm:read
|
||||
|
||||
// ChainHead returns the current head of the chain.
|
||||
ChainHead(context.Context) (*types.TipSet, error) //perm:read
|
||||
|
||||
// ChainGetRandomnessFromTickets is used to sample the chain for randomness.
|
||||
ChainGetRandomnessFromTickets(ctx context.Context, tsk types.TipSetKey, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error) //perm:read
|
||||
|
||||
// ChainGetRandomnessFromBeacon is used to sample the beacon for randomness.
|
||||
ChainGetRandomnessFromBeacon(ctx context.Context, tsk types.TipSetKey, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error) //perm:read
|
||||
|
||||
// ChainGetBlock returns the block specified by the given CID.
|
||||
ChainGetBlock(context.Context, cid.Cid) (*types.BlockHeader, error) //perm:read
|
||||
// ChainGetTipSet returns the tipset specified by the given TipSetKey.
|
||||
ChainGetTipSet(context.Context, types.TipSetKey) (*types.TipSet, error) //perm:read
|
||||
|
||||
// ChainGetBlockMessages returns messages stored in the specified block.
|
||||
//
|
||||
// Note: If there are multiple blocks in a tipset, it's likely that some
|
||||
// messages will be duplicated. It's also possible for blocks in a tipset to have
|
||||
// different messages from the same sender at the same nonce. When that happens,
|
||||
// only the first message (in a block with lowest ticket) will be considered
|
||||
// for execution
|
||||
//
|
||||
// NOTE: THIS METHOD SHOULD ONLY BE USED FOR GETTING MESSAGES IN A SPECIFIC BLOCK
|
||||
//
|
||||
// DO NOT USE THIS METHOD TO GET MESSAGES INCLUDED IN A TIPSET
|
||||
// Use ChainGetParentMessages, which will perform correct message deduplication
|
||||
ChainGetBlockMessages(ctx context.Context, blockCid cid.Cid) (*api.BlockMessages, error) //perm:read
|
||||
|
||||
// ChainGetParentReceipts returns receipts for messages in parent tipset of
|
||||
// the specified block. The receipts in the list returned is one-to-one with the
|
||||
// messages returned by a call to ChainGetParentMessages with the same blockCid.
|
||||
ChainGetParentReceipts(ctx context.Context, blockCid cid.Cid) ([]*types.MessageReceipt, error) //perm:read
|
||||
|
||||
// ChainGetParentMessages returns messages stored in parent tipset of the
|
||||
// specified block.
|
||||
ChainGetParentMessages(ctx context.Context, blockCid cid.Cid) ([]api.Message, error) //perm:read
|
||||
|
||||
// ChainGetTipSetByHeight looks back for a tipset at the specified epoch.
|
||||
// If there are no blocks at the specified epoch, a tipset at an earlier epoch
|
||||
// will be returned.
|
||||
ChainGetTipSetByHeight(context.Context, abi.ChainEpoch, types.TipSetKey) (*types.TipSet, error) //perm:read
|
||||
|
||||
// ChainReadObj reads ipld nodes referenced by the specified CID from chain
|
||||
// blockstore and returns raw bytes.
|
||||
ChainReadObj(context.Context, cid.Cid) ([]byte, error) //perm:read
|
||||
|
||||
// ChainDeleteObj deletes node referenced by the given CID
|
||||
ChainDeleteObj(context.Context, cid.Cid) error //perm:admin
|
||||
|
||||
// ChainHasObj checks if a given CID exists in the chain blockstore.
|
||||
ChainHasObj(context.Context, cid.Cid) (bool, error) //perm:read
|
||||
|
||||
// ChainStatObj returns statistics about the graph referenced by 'obj'.
|
||||
// If 'base' is also specified, then the returned stat will be a diff
|
||||
// between the two objects.
|
||||
ChainStatObj(ctx context.Context, obj cid.Cid, base cid.Cid) (api.ObjStat, error) //perm:read
|
||||
|
||||
// ChainSetHead forcefully sets current chain head. Use with caution.
|
||||
ChainSetHead(context.Context, types.TipSetKey) error //perm:admin
|
||||
|
||||
// ChainGetGenesis returns the genesis tipset.
|
||||
ChainGetGenesis(context.Context) (*types.TipSet, error) //perm:read
|
||||
|
||||
// ChainTipSetWeight computes weight for the specified tipset.
|
||||
ChainTipSetWeight(context.Context, types.TipSetKey) (types.BigInt, error) //perm:read
|
||||
ChainGetNode(ctx context.Context, p string) (*api.IpldObject, error) //perm:read
|
||||
|
||||
// ChainGetMessage reads a message referenced by the specified CID from the
|
||||
// chain blockstore.
|
||||
ChainGetMessage(context.Context, cid.Cid) (*types.Message, error) //perm:read
|
||||
|
||||
// ChainGetPath returns a set of revert/apply operations needed to get from
|
||||
// one tipset to another, for example:
|
||||
//```
|
||||
// to
|
||||
// ^
|
||||
// from tAA
|
||||
// ^ ^
|
||||
// tBA tAB
|
||||
// ^---*--^
|
||||
// ^
|
||||
// tRR
|
||||
//```
|
||||
// Would return `[revert(tBA), apply(tAB), apply(tAA)]`
|
||||
ChainGetPath(ctx context.Context, from types.TipSetKey, to types.TipSetKey) ([]*api.HeadChange, error) //perm:read
|
||||
|
||||
// ChainExport returns a stream of bytes with CAR dump of chain data.
|
||||
// The exported chain data includes the header chain from the given tipset
|
||||
// back to genesis, the entire genesis state, and the most recent 'nroots'
|
||||
// state trees.
|
||||
// If oldmsgskip is set, messages from before the requested roots are also not included.
|
||||
ChainExport(ctx context.Context, nroots abi.ChainEpoch, oldmsgskip bool, tsk types.TipSetKey) (<-chan []byte, error) //perm:read
|
||||
|
||||
// MethodGroup: Beacon
|
||||
// The Beacon method group contains methods for interacting with the random beacon (DRAND)
|
||||
|
||||
// BeaconGetEntry returns the beacon entry for the given filecoin epoch. If
|
||||
// the entry has not yet been produced, the call will block until the entry
|
||||
// becomes available
|
||||
BeaconGetEntry(ctx context.Context, epoch abi.ChainEpoch) (*types.BeaconEntry, error) //perm:read
|
||||
|
||||
// GasEstimateFeeCap estimates gas fee cap
|
||||
GasEstimateFeeCap(context.Context, *types.Message, int64, types.TipSetKey) (types.BigInt, error) //perm:read
|
||||
|
||||
// GasEstimateGasLimit estimates gas used by the message and returns it.
|
||||
// It fails if message fails to execute.
|
||||
GasEstimateGasLimit(context.Context, *types.Message, types.TipSetKey) (int64, error) //perm:read
|
||||
|
||||
// GasEstimateGasPremium estimates what gas price should be used for a
|
||||
// message to have high likelihood of inclusion in `nblocksincl` epochs.
|
||||
|
||||
GasEstimateGasPremium(_ context.Context, nblocksincl uint64,
|
||||
sender address.Address, gaslimit int64, tsk types.TipSetKey) (types.BigInt, error) //perm:read
|
||||
|
||||
// GasEstimateMessageGas estimates gas values for unset message gas fields
|
||||
GasEstimateMessageGas(context.Context, *types.Message, *api.MessageSendSpec, types.TipSetKey) (*types.Message, error) //perm:read
|
||||
|
||||
// MethodGroup: Sync
|
||||
// The Sync method group contains methods for interacting with and
|
||||
// observing the lotus sync service.
|
||||
|
||||
// SyncState returns the current status of the lotus sync system.
|
||||
SyncState(context.Context) (*api.SyncState, error) //perm:read
|
||||
|
||||
// SyncSubmitBlock can be used to submit a newly created block to the.
|
||||
// network through this node
|
||||
SyncSubmitBlock(ctx context.Context, blk *types.BlockMsg) error //perm:write
|
||||
|
||||
// SyncIncomingBlocks returns a channel streaming incoming, potentially not
|
||||
// yet synced block headers.
|
||||
SyncIncomingBlocks(ctx context.Context) (<-chan *types.BlockHeader, error) //perm:read
|
||||
|
||||
// SyncCheckpoint marks a blocks as checkpointed, meaning that it won't ever fork away from it.
|
||||
SyncCheckpoint(ctx context.Context, tsk types.TipSetKey) error //perm:admin
|
||||
|
||||
// SyncMarkBad marks a blocks as bad, meaning that it won't ever by synced.
|
||||
// Use with extreme caution.
|
||||
SyncMarkBad(ctx context.Context, bcid cid.Cid) error //perm:admin
|
||||
|
||||
// SyncUnmarkBad unmarks a blocks as bad, making it possible to be validated and synced again.
|
||||
SyncUnmarkBad(ctx context.Context, bcid cid.Cid) error //perm:admin
|
||||
|
||||
// SyncUnmarkAllBad purges bad block cache, making it possible to sync to chains previously marked as bad
|
||||
SyncUnmarkAllBad(ctx context.Context) error //perm:admin
|
||||
|
||||
// SyncCheckBad checks if a block was marked as bad, and if it was, returns
|
||||
// the reason.
|
||||
SyncCheckBad(ctx context.Context, bcid cid.Cid) (string, error) //perm:read
|
||||
|
||||
// SyncValidateTipset indicates whether the provided tipset is valid or not
|
||||
SyncValidateTipset(ctx context.Context, tsk types.TipSetKey) (bool, error) //perm:read
|
||||
|
||||
// MethodGroup: Mpool
|
||||
// The Mpool methods are for interacting with the message pool. The message pool
|
||||
// manages all incoming and outgoing 'messages' going over the network.
|
||||
|
||||
// MpoolPending returns pending mempool messages.
|
||||
MpoolPending(context.Context, types.TipSetKey) ([]*types.SignedMessage, error) //perm:read
|
||||
|
||||
// MpoolSelect returns a list of pending messages for inclusion in the next block
|
||||
MpoolSelect(context.Context, types.TipSetKey, float64) ([]*types.SignedMessage, error) //perm:read
|
||||
|
||||
// MpoolPush pushes a signed message to mempool.
|
||||
MpoolPush(context.Context, *types.SignedMessage) (cid.Cid, error) //perm:write
|
||||
|
||||
// MpoolPushUntrusted pushes a signed message to mempool from untrusted sources.
|
||||
MpoolPushUntrusted(context.Context, *types.SignedMessage) (cid.Cid, error) //perm:write
|
||||
|
||||
// MpoolPushMessage atomically assigns a nonce, signs, and pushes a message
|
||||
// to mempool.
|
||||
// maxFee is only used when GasFeeCap/GasPremium fields aren't specified
|
||||
//
|
||||
// When maxFee is set to 0, MpoolPushMessage will guess appropriate fee
|
||||
// based on current chain conditions
|
||||
MpoolPushMessage(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec) (*types.SignedMessage, error) //perm:sign
|
||||
|
||||
// MpoolBatchPush batch pushes a signed message to mempool.
|
||||
MpoolBatchPush(context.Context, []*types.SignedMessage) ([]cid.Cid, error) //perm:write
|
||||
|
||||
// MpoolBatchPushUntrusted batch pushes a signed message to mempool from untrusted sources.
|
||||
MpoolBatchPushUntrusted(context.Context, []*types.SignedMessage) ([]cid.Cid, error) //perm:write
|
||||
|
||||
// MpoolBatchPushMessage batch pushes a unsigned message to mempool.
|
||||
MpoolBatchPushMessage(context.Context, []*types.Message, *api.MessageSendSpec) ([]*types.SignedMessage, error) //perm:sign
|
||||
|
||||
// MpoolGetNonce gets next nonce for the specified sender.
|
||||
// Note that this method may not be atomic. Use MpoolPushMessage instead.
|
||||
MpoolGetNonce(context.Context, address.Address) (uint64, error) //perm:read
|
||||
MpoolSub(context.Context) (<-chan api.MpoolUpdate, error) //perm:read
|
||||
|
||||
// MpoolClear clears pending messages from the mpool
|
||||
MpoolClear(context.Context, bool) error //perm:write
|
||||
|
||||
// MpoolGetConfig returns (a copy of) the current mpool config
|
||||
MpoolGetConfig(context.Context) (*types.MpoolConfig, error) //perm:read
|
||||
// MpoolSetConfig sets the mpool config to (a copy of) the supplied config
|
||||
MpoolSetConfig(context.Context, *types.MpoolConfig) error //perm:admin
|
||||
|
||||
// MethodGroup: Miner
|
||||
|
||||
MinerGetBaseInfo(context.Context, address.Address, abi.ChainEpoch, types.TipSetKey) (*api.MiningBaseInfo, error) //perm:read
|
||||
MinerCreateBlock(context.Context, *api.BlockTemplate) (*types.BlockMsg, error) //perm:write
|
||||
|
||||
// // UX ?
|
||||
|
||||
// MethodGroup: Wallet
|
||||
|
||||
// WalletNew creates a new address in the wallet with the given sigType.
|
||||
// Available key types: bls, secp256k1, secp256k1-ledger
|
||||
// Support for numerical types: 1 - secp256k1, 2 - BLS is deprecated
|
||||
WalletNew(context.Context, types.KeyType) (address.Address, error) //perm:write
|
||||
// WalletHas indicates whether the given address is in the wallet.
|
||||
WalletHas(context.Context, address.Address) (bool, error) //perm:write
|
||||
// WalletList lists all the addresses in the wallet.
|
||||
WalletList(context.Context) ([]address.Address, error) //perm:write
|
||||
// WalletBalance returns the balance of the given address at the current head of the chain.
|
||||
WalletBalance(context.Context, address.Address) (types.BigInt, error) //perm:read
|
||||
// WalletSign signs the given bytes using the given address.
|
||||
WalletSign(context.Context, address.Address, []byte) (*crypto.Signature, error) //perm:sign
|
||||
// WalletSignMessage signs the given message using the given address.
|
||||
WalletSignMessage(context.Context, address.Address, *types.Message) (*types.SignedMessage, error) //perm:sign
|
||||
// WalletVerify takes an address, a signature, and some bytes, and indicates whether the signature is valid.
|
||||
// The address does not have to be in the wallet.
|
||||
WalletVerify(context.Context, address.Address, []byte, *crypto.Signature) (bool, error) //perm:read
|
||||
// WalletDefaultAddress returns the address marked as default in the wallet.
|
||||
WalletDefaultAddress(context.Context) (address.Address, error) //perm:write
|
||||
// WalletSetDefault marks the given address as as the default one.
|
||||
WalletSetDefault(context.Context, address.Address) error //perm:write
|
||||
// WalletExport returns the private key of an address in the wallet.
|
||||
WalletExport(context.Context, address.Address) (*types.KeyInfo, error) //perm:admin
|
||||
// WalletImport receives a KeyInfo, which includes a private key, and imports it into the wallet.
|
||||
WalletImport(context.Context, *types.KeyInfo) (address.Address, error) //perm:admin
|
||||
// WalletDelete deletes an address from the wallet.
|
||||
WalletDelete(context.Context, address.Address) error //perm:admin
|
||||
// WalletValidateAddress validates whether a given string can be decoded as a well-formed address
|
||||
WalletValidateAddress(context.Context, string) (address.Address, error) //perm:read
|
||||
|
||||
// Other
|
||||
|
||||
// MethodGroup: Client
|
||||
// The Client methods all have to do with interacting with the storage and
|
||||
// retrieval markets as a client
|
||||
|
||||
// ClientImport imports file under the specified path into filestore.
|
||||
ClientImport(ctx context.Context, ref api.FileRef) (*api.ImportRes, error) //perm:admin
|
||||
// ClientRemoveImport removes file import
|
||||
ClientRemoveImport(ctx context.Context, importID multistore.StoreID) error //perm:admin
|
||||
// ClientStartDeal proposes a deal with a miner.
|
||||
ClientStartDeal(ctx context.Context, params *api.StartDealParams) (*cid.Cid, error) //perm:admin
|
||||
// ClientStatelessDeal fire-and-forget-proposes an offline deal to a miner without subsequent tracking.
|
||||
ClientStatelessDeal(ctx context.Context, params *api.StartDealParams) (*cid.Cid, error) //perm:write
|
||||
// ClientGetDealInfo returns the latest information about a given deal.
|
||||
ClientGetDealInfo(context.Context, cid.Cid) (*api.DealInfo, error) //perm:read
|
||||
// ClientListDeals returns information about the deals made by the local client.
|
||||
ClientListDeals(ctx context.Context) ([]api.DealInfo, error) //perm:write
|
||||
// ClientGetDealUpdates returns the status of updated deals
|
||||
ClientGetDealUpdates(ctx context.Context) (<-chan api.DealInfo, error) //perm:write
|
||||
// ClientGetDealStatus returns status given a code
|
||||
ClientGetDealStatus(ctx context.Context, statusCode uint64) (string, error) //perm:read
|
||||
// ClientHasLocal indicates whether a certain CID is locally stored.
|
||||
ClientHasLocal(ctx context.Context, root cid.Cid) (bool, error) //perm:write
|
||||
// ClientFindData identifies peers that have a certain file, and returns QueryOffers (one per peer).
|
||||
ClientFindData(ctx context.Context, root cid.Cid, piece *cid.Cid) ([]api.QueryOffer, error) //perm:read
|
||||
// ClientMinerQueryOffer returns a QueryOffer for the specific miner and file.
|
||||
ClientMinerQueryOffer(ctx context.Context, miner address.Address, root cid.Cid, piece *cid.Cid) (api.QueryOffer, error) //perm:read
|
||||
// ClientRetrieve initiates the retrieval of a file, as specified in the order.
|
||||
ClientRetrieve(ctx context.Context, order api.RetrievalOrder, ref *api.FileRef) error //perm:admin
|
||||
// ClientRetrieveWithEvents initiates the retrieval of a file, as specified in the order, and provides a channel
|
||||
// of status updates.
|
||||
ClientRetrieveWithEvents(ctx context.Context, order api.RetrievalOrder, ref *api.FileRef) (<-chan marketevents.RetrievalEvent, error) //perm:admin
|
||||
// ClientQueryAsk returns a signed StorageAsk from the specified miner.
|
||||
ClientQueryAsk(ctx context.Context, p peer.ID, miner address.Address) (*storagemarket.StorageAsk, error) //perm:read
|
||||
// ClientCalcCommP calculates the CommP and data size of the specified CID
|
||||
ClientDealPieceCID(ctx context.Context, root cid.Cid) (api.DataCIDSize, error) //perm:read
|
||||
// ClientCalcCommP calculates the CommP for a specified file
|
||||
ClientCalcCommP(ctx context.Context, inpath string) (*api.CommPRet, error) //perm:write
|
||||
// ClientGenCar generates a CAR file for the specified file.
|
||||
ClientGenCar(ctx context.Context, ref api.FileRef, outpath string) error //perm:write
|
||||
// ClientDealSize calculates real deal data size
|
||||
ClientDealSize(ctx context.Context, root cid.Cid) (api.DataSize, error) //perm:read
|
||||
// ClientListTransfers returns the status of all ongoing transfers of data
|
||||
ClientListDataTransfers(ctx context.Context) ([]api.DataTransferChannel, error) //perm:write
|
||||
ClientDataTransferUpdates(ctx context.Context) (<-chan api.DataTransferChannel, error) //perm:write
|
||||
// ClientRestartDataTransfer attempts to restart a data transfer with the given transfer ID and other peer
|
||||
ClientRestartDataTransfer(ctx context.Context, transferID datatransfer.TransferID, otherPeer peer.ID, isInitiator bool) error //perm:write
|
||||
// ClientCancelDataTransfer cancels a data transfer with the given transfer ID and other peer
|
||||
ClientCancelDataTransfer(ctx context.Context, transferID datatransfer.TransferID, otherPeer peer.ID, isInitiator bool) error //perm:write
|
||||
// ClientRetrieveTryRestartInsufficientFunds attempts to restart stalled retrievals on a given payment channel
|
||||
// which are stuck due to insufficient funds
|
||||
ClientRetrieveTryRestartInsufficientFunds(ctx context.Context, paymentChannel address.Address) error //perm:write
|
||||
|
||||
// ClientCancelRetrievalDeal cancels an ongoing retrieval deal based on DealID
|
||||
ClientCancelRetrievalDeal(ctx context.Context, dealid retrievalmarket.DealID) error //perm:write
|
||||
|
||||
// ClientUnimport removes references to the specified file from filestore
|
||||
//ClientUnimport(path string)
|
||||
|
||||
// ClientListImports lists imported files and their root CIDs
|
||||
ClientListImports(ctx context.Context) ([]api.Import, error) //perm:write
|
||||
|
||||
//ClientListAsks() []Ask
|
||||
|
||||
// MethodGroup: State
|
||||
// The State methods are used to query, inspect, and interact with chain state.
|
||||
// Most methods take a TipSetKey as a parameter. The state looked up is the parent state of the tipset.
|
||||
// A nil TipSetKey can be provided as a param, this will cause the heaviest tipset in the chain to be used.
|
||||
|
||||
// StateCall runs the given message and returns its result without any persisted changes.
|
||||
//
|
||||
// StateCall applies the message to the tipset's parent state. The
|
||||
// message is not applied on-top-of the messages in the passed-in
|
||||
// tipset.
|
||||
StateCall(context.Context, *types.Message, types.TipSetKey) (*api.InvocResult, error) //perm:read
|
||||
// StateReplay replays a given message, assuming it was included in a block in the specified tipset.
|
||||
//
|
||||
// If a tipset key is provided, and a replacing message is found on chain,
|
||||
// the method will return an error saying that the message wasn't found
|
||||
//
|
||||
// If no tipset key is provided, the appropriate tipset is looked up, and if
|
||||
// the message was gas-repriced, the on-chain message will be replayed - in
|
||||
// that case the returned InvocResult.MsgCid will not match the Cid param
|
||||
//
|
||||
// If the caller wants to ensure that exactly the requested message was executed,
|
||||
// they MUST check that InvocResult.MsgCid is equal to the provided Cid.
|
||||
// Without this check both the requested and original message may appear as
|
||||
// successfully executed on-chain, which may look like a double-spend.
|
||||
//
|
||||
// A replacing message is a message with a different CID, any of Gas values, and
|
||||
// different signature, but with all other parameters matching (source/destination,
|
||||
// nonce, params, etc.)
|
||||
StateReplay(context.Context, types.TipSetKey, cid.Cid) (*api.InvocResult, error) //perm:read
|
||||
// StateGetActor returns the indicated actor's nonce and balance.
|
||||
StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error) //perm:read
|
||||
// StateReadState returns the indicated actor's state.
|
||||
StateReadState(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*api.ActorState, error) //perm:read
|
||||
// StateListMessages looks back and returns all messages with a matching to or from address, stopping at the given height.
|
||||
StateListMessages(ctx context.Context, match *api.MessageMatch, tsk types.TipSetKey, toht abi.ChainEpoch) ([]cid.Cid, error) //perm:read
|
||||
// StateDecodeParams attempts to decode the provided params, based on the recipient actor address and method number.
|
||||
StateDecodeParams(ctx context.Context, toAddr address.Address, method abi.MethodNum, params []byte, tsk types.TipSetKey) (interface{}, error) //perm:read
|
||||
|
||||
// StateNetworkName returns the name of the network the node is synced to
|
||||
StateNetworkName(context.Context) (dtypes.NetworkName, error) //perm:read
|
||||
// StateMinerSectors returns info about the given miner's sectors. If the filter bitfield is nil, all sectors are included.
|
||||
StateMinerSectors(context.Context, address.Address, *bitfield.BitField, types.TipSetKey) ([]*miner.SectorOnChainInfo, error) //perm:read
|
||||
// StateMinerActiveSectors returns info about sectors that a given miner is actively proving.
|
||||
StateMinerActiveSectors(context.Context, address.Address, types.TipSetKey) ([]*miner.SectorOnChainInfo, error) //perm:read
|
||||
// StateMinerProvingDeadline calculates the deadline at some epoch for a proving period
|
||||
// and returns the deadline-related calculations.
|
||||
StateMinerProvingDeadline(context.Context, address.Address, types.TipSetKey) (*dline.Info, error) //perm:read
|
||||
// StateMinerPower returns the power of the indicated miner
|
||||
StateMinerPower(context.Context, address.Address, types.TipSetKey) (*api.MinerPower, error) //perm:read
|
||||
// StateMinerInfo returns info about the indicated miner
|
||||
StateMinerInfo(context.Context, address.Address, types.TipSetKey) (miner.MinerInfo, error) //perm:read
|
||||
// StateMinerDeadlines returns all the proving deadlines for the given miner
|
||||
StateMinerDeadlines(context.Context, address.Address, types.TipSetKey) ([]api.Deadline, error) //perm:read
|
||||
// StateMinerPartitions returns all partitions in the specified deadline
|
||||
StateMinerPartitions(ctx context.Context, m address.Address, dlIdx uint64, tsk types.TipSetKey) ([]api.Partition, error) //perm:read
|
||||
// StateMinerFaults returns a bitfield indicating the faulty sectors of the given miner
|
||||
StateMinerFaults(context.Context, address.Address, types.TipSetKey) (bitfield.BitField, error) //perm:read
|
||||
// StateAllMinerFaults returns all non-expired Faults that occur within lookback epochs of the given tipset
|
||||
StateAllMinerFaults(ctx context.Context, lookback abi.ChainEpoch, ts types.TipSetKey) ([]*api.Fault, error) //perm:read
|
||||
// StateMinerRecoveries returns a bitfield indicating the recovering sectors of the given miner
|
||||
StateMinerRecoveries(context.Context, address.Address, types.TipSetKey) (bitfield.BitField, error) //perm:read
|
||||
// StateMinerInitialPledgeCollateral returns the precommit deposit for the specified miner's sector
|
||||
StateMinerPreCommitDepositForPower(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (types.BigInt, error) //perm:read
|
||||
// StateMinerInitialPledgeCollateral returns the initial pledge collateral for the specified miner's sector
|
||||
StateMinerInitialPledgeCollateral(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (types.BigInt, error) //perm:read
|
||||
// StateMinerAvailableBalance returns the portion of a miner's balance that can be withdrawn or spent
|
||||
StateMinerAvailableBalance(context.Context, address.Address, types.TipSetKey) (types.BigInt, error) //perm:read
|
||||
// StateMinerSectorAllocated checks if a sector is allocated
|
||||
StateMinerSectorAllocated(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (bool, error) //perm:read
|
||||
// StateSectorPreCommitInfo returns the PreCommit info for the specified miner's sector
|
||||
StateSectorPreCommitInfo(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (miner.SectorPreCommitOnChainInfo, error) //perm:read
|
||||
// StateSectorGetInfo returns the on-chain info for the specified miner's sector. Returns null in case the sector info isn't found
|
||||
// NOTE: returned info.Expiration may not be accurate in some cases, use StateSectorExpiration to get accurate
|
||||
// expiration epoch
|
||||
StateSectorGetInfo(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*miner.SectorOnChainInfo, error) //perm:read
|
||||
// StateSectorExpiration returns epoch at which given sector will expire
|
||||
StateSectorExpiration(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*miner.SectorExpiration, error) //perm:read
|
||||
// StateSectorPartition finds deadline/partition with the specified sector
|
||||
StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok types.TipSetKey) (*miner.SectorLocation, error) //perm:read
|
||||
// StateSearchMsg searches for a message in the chain, and returns its receipt and the tipset where it was executed
|
||||
//
|
||||
// NOTE: If a replacing message is found on chain, this method will return
|
||||
// a MsgLookup for the replacing message - the MsgLookup.Message will be a different
|
||||
// CID than the one provided in the 'cid' param, MsgLookup.Receipt will contain the
|
||||
// result of the execution of the replacing message.
|
||||
//
|
||||
// If the caller wants to ensure that exactly the requested message was executed,
|
||||
// they MUST check that MsgLookup.Message is equal to the provided 'cid'.
|
||||
// Without this check both the requested and original message may appear as
|
||||
// successfully executed on-chain, which may look like a double-spend.
|
||||
//
|
||||
// A replacing message is a message with a different CID, any of Gas values, and
|
||||
// different signature, but with all other parameters matching (source/destination,
|
||||
// nonce, params, etc.)
|
||||
StateSearchMsg(context.Context, cid.Cid) (*api.MsgLookup, error) //perm:read
|
||||
// StateSearchMsgLimited looks back up to limit epochs in the chain for a message, and returns its receipt and the tipset where it was executed
|
||||
//
|
||||
// NOTE: If a replacing message is found on chain, this method will return
|
||||
// a MsgLookup for the replacing message - the MsgLookup.Message will be a different
|
||||
// CID than the one provided in the 'cid' param, MsgLookup.Receipt will contain the
|
||||
// result of the execution of the replacing message.
|
||||
//
|
||||
// If the caller wants to ensure that exactly the requested message was executed,
|
||||
// they MUST check that MsgLookup.Message is equal to the provided 'cid'.
|
||||
// Without this check both the requested and original message may appear as
|
||||
// successfully executed on-chain, which may look like a double-spend.
|
||||
//
|
||||
// A replacing message is a message with a different CID, any of Gas values, and
|
||||
// different signature, but with all other parameters matching (source/destination,
|
||||
// nonce, params, etc.)
|
||||
StateSearchMsgLimited(ctx context.Context, msg cid.Cid, limit abi.ChainEpoch) (*api.MsgLookup, error) //perm:read
|
||||
// StateWaitMsg looks back in the chain for a message. If not found, it blocks until the
|
||||
// message arrives on chain, and gets to the indicated confidence depth.
|
||||
//
|
||||
// NOTE: If a replacing message is found on chain, this method will return
|
||||
// a MsgLookup for the replacing message - the MsgLookup.Message will be a different
|
||||
// CID than the one provided in the 'cid' param, MsgLookup.Receipt will contain the
|
||||
// result of the execution of the replacing message.
|
||||
//
|
||||
// If the caller wants to ensure that exactly the requested message was executed,
|
||||
// they MUST check that MsgLookup.Message is equal to the provided 'cid'.
|
||||
// Without this check both the requested and original message may appear as
|
||||
// successfully executed on-chain, which may look like a double-spend.
|
||||
//
|
||||
// A replacing message is a message with a different CID, any of Gas values, and
|
||||
// different signature, but with all other parameters matching (source/destination,
|
||||
// nonce, params, etc.)
|
||||
StateWaitMsg(ctx context.Context, cid cid.Cid, confidence uint64) (*api.MsgLookup, error) //perm:read
|
||||
// StateWaitMsgLimited looks back up to limit epochs in the chain for a message.
|
||||
// If not found, it blocks until the message arrives on chain, and gets to the
|
||||
// indicated confidence depth.
|
||||
//
|
||||
// NOTE: If a replacing message is found on chain, this method will return
|
||||
// a MsgLookup for the replacing message - the MsgLookup.Message will be a different
|
||||
// CID than the one provided in the 'cid' param, MsgLookup.Receipt will contain the
|
||||
// result of the execution of the replacing message.
|
||||
//
|
||||
// If the caller wants to ensure that exactly the requested message was executed,
|
||||
// they MUST check that MsgLookup.Message is equal to the provided 'cid'.
|
||||
// Without this check both the requested and original message may appear as
|
||||
// successfully executed on-chain, which may look like a double-spend.
|
||||
//
|
||||
// A replacing message is a message with a different CID, any of Gas values, and
|
||||
// different signature, but with all other parameters matching (source/destination,
|
||||
// nonce, params, etc.)
|
||||
StateWaitMsgLimited(ctx context.Context, cid cid.Cid, confidence uint64, limit abi.ChainEpoch) (*api.MsgLookup, error) //perm:read
|
||||
// StateListMiners returns the addresses of every miner that has claimed power in the Power Actor
|
||||
StateListMiners(context.Context, types.TipSetKey) ([]address.Address, error) //perm:read
|
||||
// StateListActors returns the addresses of every actor in the state
|
||||
StateListActors(context.Context, types.TipSetKey) ([]address.Address, error) //perm:read
|
||||
// StateMarketBalance looks up the Escrow and Locked balances of the given address in the Storage Market
|
||||
StateMarketBalance(context.Context, address.Address, types.TipSetKey) (api.MarketBalance, error) //perm:read
|
||||
// StateMarketParticipants returns the Escrow and Locked balances of every participant in the Storage Market
|
||||
StateMarketParticipants(context.Context, types.TipSetKey) (map[string]api.MarketBalance, error) //perm:read
|
||||
// StateMarketDeals returns information about every deal in the Storage Market
|
||||
StateMarketDeals(context.Context, types.TipSetKey) (map[string]api.MarketDeal, error) //perm:read
|
||||
// StateMarketStorageDeal returns information about the indicated deal
|
||||
StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*api.MarketDeal, error) //perm:read
|
||||
// StateLookupID retrieves the ID address of the given address
|
||||
StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error) //perm:read
|
||||
// StateAccountKey returns the public key address of the given ID address
|
||||
StateAccountKey(context.Context, address.Address, types.TipSetKey) (address.Address, error) //perm:read
|
||||
// StateChangedActors returns all the actors whose states change between the two given state CIDs
|
||||
// TODO: Should this take tipset keys instead?
|
||||
StateChangedActors(context.Context, cid.Cid, cid.Cid) (map[string]types.Actor, error) //perm:read
|
||||
// StateGetReceipt returns the message receipt for the given message or for a
|
||||
// matching gas-repriced replacing message
|
||||
//
|
||||
// NOTE: If the requested message was replaced, this method will return the receipt
|
||||
// for the replacing message - if the caller needs the receipt for exactly the
|
||||
// requested message, use StateSearchMsg().Receipt, and check that MsgLookup.Message
|
||||
// is matching the requested CID
|
||||
//
|
||||
// DEPRECATED: Use StateSearchMsg, this method won't be supported in v1 API
|
||||
StateGetReceipt(context.Context, cid.Cid, types.TipSetKey) (*types.MessageReceipt, error) //perm:read
|
||||
// StateMinerSectorCount returns the number of sectors in a miner's sector set and proving set
|
||||
StateMinerSectorCount(context.Context, address.Address, types.TipSetKey) (api.MinerSectors, error) //perm:read
|
||||
// StateCompute is a flexible command that applies the given messages on the given tipset.
|
||||
// The messages are run as though the VM were at the provided height.
|
||||
//
|
||||
// When called, StateCompute will:
|
||||
// - Load the provided tipset, or use the current chain head if not provided
|
||||
// - Compute the tipset state of the provided tipset on top of the parent state
|
||||
// - (note that this step runs before vmheight is applied to the execution)
|
||||
// - Execute state upgrade if any were scheduled at the epoch, or in null
|
||||
// blocks preceding the tipset
|
||||
// - Call the cron actor on null blocks preceding the tipset
|
||||
// - For each block in the tipset
|
||||
// - Apply messages in blocks in the specified
|
||||
// - Award block reward by calling the reward actor
|
||||
// - Call the cron actor for the current epoch
|
||||
// - If the specified vmheight is higher than the current epoch, apply any
|
||||
// needed state upgrades to the state
|
||||
// - Apply the specified messages to the state
|
||||
//
|
||||
// The vmheight parameter sets VM execution epoch, and can be used to simulate
|
||||
// message execution in different network versions. If the specified vmheight
|
||||
// epoch is higher than the epoch of the specified tipset, any state upgrades
|
||||
// until the vmheight will be executed on the state before applying messages
|
||||
// specified by the user.
|
||||
//
|
||||
// Note that the initial tipset state computation is not affected by the
|
||||
// vmheight parameter - only the messages in the `apply` set are
|
||||
//
|
||||
// If the caller wants to simply compute the state, vmheight should be set to
|
||||
// the epoch of the specified tipset.
|
||||
//
|
||||
// Messages in the `apply` parameter must have the correct nonces, and gas
|
||||
// values set.
|
||||
StateCompute(context.Context, abi.ChainEpoch, []*types.Message, types.TipSetKey) (*api.ComputeStateOutput, error) //perm:read
|
||||
// StateVerifierStatus returns the data cap for the given address.
|
||||
// Returns nil if there is no entry in the data cap table for the
|
||||
// address.
|
||||
StateVerifierStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error) //perm:read
|
||||
// StateVerifiedClientStatus returns the data cap for the given address.
|
||||
// Returns nil if there is no entry in the data cap table for the
|
||||
// address.
|
||||
StateVerifiedClientStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error) //perm:read
|
||||
// StateVerifiedClientStatus returns the address of the Verified Registry's root key
|
||||
StateVerifiedRegistryRootKey(ctx context.Context, tsk types.TipSetKey) (address.Address, error) //perm:read
|
||||
// StateDealProviderCollateralBounds returns the min and max collateral a storage provider
|
||||
// can issue. It takes the deal size and verified status as parameters.
|
||||
StateDealProviderCollateralBounds(context.Context, abi.PaddedPieceSize, bool, types.TipSetKey) (api.DealCollateralBounds, error) //perm:read
|
||||
|
||||
// StateCirculatingSupply returns the exact circulating supply of Filecoin at the given tipset.
|
||||
// This is not used anywhere in the protocol itself, and is only for external consumption.
|
||||
StateCirculatingSupply(context.Context, types.TipSetKey) (abi.TokenAmount, error) //perm:read
|
||||
// StateVMCirculatingSupplyInternal returns an approximation of the circulating supply of Filecoin at the given tipset.
|
||||
// This is the value reported by the runtime interface to actors code.
|
||||
StateVMCirculatingSupplyInternal(context.Context, types.TipSetKey) (api.CirculatingSupply, error) //perm:read
|
||||
// StateNetworkVersion returns the network version at the given tipset
|
||||
StateNetworkVersion(context.Context, types.TipSetKey) (apitypes.NetworkVersion, error) //perm:read
|
||||
|
||||
// MethodGroup: Msig
|
||||
// The Msig methods are used to interact with multisig wallets on the
|
||||
// filecoin network
|
||||
|
||||
// MsigGetAvailableBalance returns the portion of a multisig's balance that can be withdrawn or spent
|
||||
MsigGetAvailableBalance(context.Context, address.Address, types.TipSetKey) (types.BigInt, error) //perm:read
|
||||
// MsigGetVestingSchedule returns the vesting details of a given multisig.
|
||||
MsigGetVestingSchedule(context.Context, address.Address, types.TipSetKey) (api.MsigVesting, error) //perm:read
|
||||
// MsigGetVested returns the amount of FIL that vested in a multisig in a certain period.
|
||||
// It takes the following params: <multisig address>, <start epoch>, <end epoch>
|
||||
MsigGetVested(context.Context, address.Address, types.TipSetKey, types.TipSetKey) (types.BigInt, error) //perm:read
|
||||
|
||||
//MsigGetPending returns pending transactions for the given multisig
|
||||
//wallet. Once pending transactions are fully approved, they will no longer
|
||||
//appear here.
|
||||
MsigGetPending(context.Context, address.Address, types.TipSetKey) ([]*api.MsigTransaction, error) //perm:read
|
||||
|
||||
// MsigCreate creates a multisig wallet
|
||||
// It takes the following params: <required number of senders>, <approving addresses>, <unlock duration>
|
||||
//<initial balance>, <sender address of the create msg>, <gas price>
|
||||
MsigCreate(context.Context, uint64, []address.Address, abi.ChainEpoch, types.BigInt, address.Address, types.BigInt) (cid.Cid, error) //perm:sign
|
||||
// MsigPropose proposes a multisig message
|
||||
// It takes the following params: <multisig address>, <recipient address>, <value to transfer>,
|
||||
// <sender address of the propose msg>, <method to call in the proposed message>, <params to include in the proposed message>
|
||||
MsigPropose(context.Context, address.Address, address.Address, types.BigInt, address.Address, uint64, []byte) (cid.Cid, error) //perm:sign
|
||||
|
||||
// MsigApprove approves a previously-proposed multisig message by transaction ID
|
||||
// It takes the following params: <multisig address>, <proposed transaction ID> <signer address>
|
||||
MsigApprove(context.Context, address.Address, uint64, address.Address) (cid.Cid, error) //perm:sign
|
||||
|
||||
// MsigApproveTxnHash approves a previously-proposed multisig message, specified
|
||||
// using both transaction ID and a hash of the parameters used in the
|
||||
// proposal. This method of approval can be used to ensure you only approve
|
||||
// exactly the transaction you think you are.
|
||||
// It takes the following params: <multisig address>, <proposed message ID>, <proposer address>, <recipient address>, <value to transfer>,
|
||||
// <sender address of the approve msg>, <method to call in the proposed message>, <params to include in the proposed message>
|
||||
MsigApproveTxnHash(context.Context, address.Address, uint64, address.Address, address.Address, types.BigInt, address.Address, uint64, []byte) (cid.Cid, error) //perm:sign
|
||||
|
||||
// MsigCancel cancels a previously-proposed multisig message
|
||||
// It takes the following params: <multisig address>, <proposed transaction ID>, <recipient address>, <value to transfer>,
|
||||
// <sender address of the cancel msg>, <method to call in the proposed message>, <params to include in the proposed message>
|
||||
MsigCancel(context.Context, address.Address, uint64, address.Address, types.BigInt, address.Address, uint64, []byte) (cid.Cid, error) //perm:sign
|
||||
// MsigAddPropose proposes adding a signer in the multisig
|
||||
// It takes the following params: <multisig address>, <sender address of the propose msg>,
|
||||
// <new signer>, <whether the number of required signers should be increased>
|
||||
MsigAddPropose(context.Context, address.Address, address.Address, address.Address, bool) (cid.Cid, error) //perm:sign
|
||||
// MsigAddApprove approves a previously proposed AddSigner message
|
||||
// It takes the following params: <multisig address>, <sender address of the approve msg>, <proposed message ID>,
|
||||
// <proposer address>, <new signer>, <whether the number of required signers should be increased>
|
||||
MsigAddApprove(context.Context, address.Address, address.Address, uint64, address.Address, address.Address, bool) (cid.Cid, error) //perm:sign
|
||||
// MsigAddCancel cancels a previously proposed AddSigner message
|
||||
// It takes the following params: <multisig address>, <sender address of the cancel msg>, <proposed message ID>,
|
||||
// <new signer>, <whether the number of required signers should be increased>
|
||||
MsigAddCancel(context.Context, address.Address, address.Address, uint64, address.Address, bool) (cid.Cid, error) //perm:sign
|
||||
// MsigSwapPropose proposes swapping 2 signers in the multisig
|
||||
// It takes the following params: <multisig address>, <sender address of the propose msg>,
|
||||
// <old signer>, <new signer>
|
||||
MsigSwapPropose(context.Context, address.Address, address.Address, address.Address, address.Address) (cid.Cid, error) //perm:sign
|
||||
// MsigSwapApprove approves a previously proposed SwapSigner
|
||||
// It takes the following params: <multisig address>, <sender address of the approve msg>, <proposed message ID>,
|
||||
// <proposer address>, <old signer>, <new signer>
|
||||
MsigSwapApprove(context.Context, address.Address, address.Address, uint64, address.Address, address.Address, address.Address) (cid.Cid, error) //perm:sign
|
||||
// MsigSwapCancel cancels a previously proposed SwapSigner message
|
||||
// It takes the following params: <multisig address>, <sender address of the cancel msg>, <proposed message ID>,
|
||||
// <old signer>, <new signer>
|
||||
MsigSwapCancel(context.Context, address.Address, address.Address, uint64, address.Address, address.Address) (cid.Cid, error) //perm:sign
|
||||
|
||||
// MsigRemoveSigner proposes the removal of a signer from the multisig.
|
||||
// It accepts the multisig to make the change on, the proposer address to
|
||||
// send the message from, the address to be removed, and a boolean
|
||||
// indicating whether or not the signing threshold should be lowered by one
|
||||
// along with the address removal.
|
||||
MsigRemoveSigner(ctx context.Context, msig address.Address, proposer address.Address, toRemove address.Address, decrease bool) (cid.Cid, error) //perm:sign
|
||||
|
||||
// MarketAddBalance adds funds to the market actor
|
||||
MarketAddBalance(ctx context.Context, wallet, addr address.Address, amt types.BigInt) (cid.Cid, error) //perm:sign
|
||||
// MarketGetReserved gets the amount of funds that are currently reserved for the address
|
||||
MarketGetReserved(ctx context.Context, addr address.Address) (types.BigInt, error) //perm:sign
|
||||
// MarketReserveFunds reserves funds for a deal
|
||||
MarketReserveFunds(ctx context.Context, wallet address.Address, addr address.Address, amt types.BigInt) (cid.Cid, error) //perm:sign
|
||||
// MarketReleaseFunds releases funds reserved by MarketReserveFunds
|
||||
MarketReleaseFunds(ctx context.Context, addr address.Address, amt types.BigInt) error //perm:sign
|
||||
// MarketWithdraw withdraws unlocked funds from the market actor
|
||||
MarketWithdraw(ctx context.Context, wallet, addr address.Address, amt types.BigInt) (cid.Cid, error) //perm:sign
|
||||
|
||||
// MethodGroup: Paych
|
||||
// The Paych methods are for interacting with and managing payment channels
|
||||
|
||||
PaychGet(ctx context.Context, from, to address.Address, amt types.BigInt) (*api.ChannelInfo, error) //perm:sign
|
||||
PaychGetWaitReady(context.Context, cid.Cid) (address.Address, error) //perm:sign
|
||||
PaychAvailableFunds(ctx context.Context, ch address.Address) (*api.ChannelAvailableFunds, error) //perm:sign
|
||||
PaychAvailableFundsByFromTo(ctx context.Context, from, to address.Address) (*api.ChannelAvailableFunds, error) //perm:sign
|
||||
PaychList(context.Context) ([]address.Address, error) //perm:read
|
||||
PaychStatus(context.Context, address.Address) (*api.PaychStatus, error) //perm:read
|
||||
PaychSettle(context.Context, address.Address) (cid.Cid, error) //perm:sign
|
||||
PaychCollect(context.Context, address.Address) (cid.Cid, error) //perm:sign
|
||||
PaychAllocateLane(ctx context.Context, ch address.Address) (uint64, error) //perm:sign
|
||||
PaychNewPayment(ctx context.Context, from, to address.Address, vouchers []api.VoucherSpec) (*api.PaymentInfo, error) //perm:sign
|
||||
PaychVoucherCheckValid(context.Context, address.Address, *paych.SignedVoucher) error //perm:read
|
||||
PaychVoucherCheckSpendable(context.Context, address.Address, *paych.SignedVoucher, []byte, []byte) (bool, error) //perm:read
|
||||
PaychVoucherCreate(context.Context, address.Address, types.BigInt, uint64) (*api.VoucherCreateResult, error) //perm:sign
|
||||
PaychVoucherAdd(context.Context, address.Address, *paych.SignedVoucher, []byte, types.BigInt) (types.BigInt, error) //perm:write
|
||||
PaychVoucherList(context.Context, address.Address) ([]*paych.SignedVoucher, error) //perm:write
|
||||
PaychVoucherSubmit(context.Context, address.Address, *paych.SignedVoucher, []byte, []byte) (cid.Cid, error) //perm:sign
|
||||
|
||||
// CreateBackup creates node backup onder the specified file name. The
|
||||
// method requires that the lotus daemon is running with the
|
||||
// LOTUS_BACKUP_BASE_PATH environment variable set to some path, and that
|
||||
// the path specified when calling CreateBackup is within the base path
|
||||
CreateBackup(ctx context.Context, fpath string) error //perm:admin
|
||||
}
|
68
api/v0api/gateway.go
Normal file
68
api/v0api/gateway.go
Normal file
@ -0,0 +1,68 @@
|
||||
package v0api
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
// MODIFYING THE API INTERFACE
|
||||
//
|
||||
// NOTE: This is the V0 (Stable) API - when adding methods to this interface,
|
||||
// you'll need to make sure they are also present on the V1 (Unstable) API
|
||||
//
|
||||
// This API is implemented in `v1_wrapper.go` as a compatibility layer backed
|
||||
// by the V1 api
|
||||
//
|
||||
// When adding / changing methods in this file:
|
||||
// * Do the change here
|
||||
// * Adjust implementation in `node/impl/`
|
||||
// * Run `make gen` - this will:
|
||||
// * Generate proxy structs
|
||||
// * Generate mocks
|
||||
// * Generate markdown docs
|
||||
// * Generate openrpc blobs
|
||||
|
||||
type Gateway interface {
|
||||
ChainHasObj(context.Context, cid.Cid) (bool, error)
|
||||
ChainHead(ctx context.Context) (*types.TipSet, error)
|
||||
ChainGetBlockMessages(context.Context, cid.Cid) (*api.BlockMessages, error)
|
||||
ChainGetMessage(ctx context.Context, mc cid.Cid) (*types.Message, error)
|
||||
ChainGetTipSet(ctx context.Context, tsk types.TipSetKey) (*types.TipSet, error)
|
||||
ChainGetTipSetByHeight(ctx context.Context, h abi.ChainEpoch, tsk types.TipSetKey) (*types.TipSet, error)
|
||||
ChainNotify(context.Context) (<-chan []*api.HeadChange, error)
|
||||
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
|
||||
GasEstimateMessageGas(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec, tsk types.TipSetKey) (*types.Message, error)
|
||||
MpoolPush(ctx context.Context, sm *types.SignedMessage) (cid.Cid, error)
|
||||
MsigGetAvailableBalance(ctx context.Context, addr address.Address, tsk types.TipSetKey) (types.BigInt, error)
|
||||
MsigGetVested(ctx context.Context, addr address.Address, start types.TipSetKey, end types.TipSetKey) (types.BigInt, error)
|
||||
MsigGetPending(context.Context, address.Address, types.TipSetKey) ([]*api.MsigTransaction, error)
|
||||
StateAccountKey(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error)
|
||||
StateDealProviderCollateralBounds(ctx context.Context, size abi.PaddedPieceSize, verified bool, tsk types.TipSetKey) (api.DealCollateralBounds, error)
|
||||
StateGetActor(ctx context.Context, actor address.Address, ts types.TipSetKey) (*types.Actor, error)
|
||||
StateGetReceipt(context.Context, cid.Cid, types.TipSetKey) (*types.MessageReceipt, error)
|
||||
StateListMiners(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error)
|
||||
StateLookupID(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error)
|
||||
StateMarketBalance(ctx context.Context, addr address.Address, tsk types.TipSetKey) (api.MarketBalance, error)
|
||||
StateMarketStorageDeal(ctx context.Context, dealId abi.DealID, tsk types.TipSetKey) (*api.MarketDeal, error)
|
||||
StateMinerInfo(ctx context.Context, actor address.Address, tsk types.TipSetKey) (miner.MinerInfo, error)
|
||||
StateMinerProvingDeadline(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*dline.Info, error)
|
||||
StateMinerPower(context.Context, address.Address, types.TipSetKey) (*api.MinerPower, error)
|
||||
StateNetworkVersion(context.Context, types.TipSetKey) (network.Version, error)
|
||||
StateSearchMsg(ctx context.Context, msg cid.Cid) (*api.MsgLookup, error)
|
||||
StateSectorGetInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorOnChainInfo, error)
|
||||
StateVerifiedClientStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error)
|
||||
StateWaitMsg(ctx context.Context, msg cid.Cid, confidence uint64) (*api.MsgLookup, error)
|
||||
WalletBalance(context.Context, address.Address) (types.BigInt, error)
|
||||
}
|
||||
|
||||
var _ Gateway = *new(FullNode)
|
25
api/v0api/latest.go
Normal file
25
api/v0api/latest.go
Normal file
@ -0,0 +1,25 @@
|
||||
package v0api
|
||||
|
||||
import (
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
)
|
||||
|
||||
type Common = api.Common
|
||||
type CommonStruct = api.CommonStruct
|
||||
type CommonStub = api.CommonStub
|
||||
|
||||
type StorageMiner = api.StorageMiner
|
||||
type StorageMinerStruct = api.StorageMinerStruct
|
||||
|
||||
type Worker = api.Worker
|
||||
type WorkerStruct = api.WorkerStruct
|
||||
|
||||
type Wallet = api.Wallet
|
||||
|
||||
func PermissionedStorMinerAPI(a StorageMiner) StorageMiner {
|
||||
return api.PermissionedStorMinerAPI(a)
|
||||
}
|
||||
|
||||
func PermissionedWorkerAPI(a Worker) Worker {
|
||||
return api.PermissionedWorkerAPI(a)
|
||||
}
|
13
api/v0api/permissioned.go
Normal file
13
api/v0api/permissioned.go
Normal file
@ -0,0 +1,13 @@
|
||||
package v0api
|
||||
|
||||
import (
|
||||
"github.com/filecoin-project/go-jsonrpc/auth"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
)
|
||||
|
||||
func PermissionedFullAPI(a FullNode) FullNode {
|
||||
var out FullNodeStruct
|
||||
auth.PermissionedProxy(api.AllPermissions, api.DefaultPerms, a, &out.Internal)
|
||||
auth.PermissionedProxy(api.AllPermissions, api.DefaultPerms, a, &out.CommonStruct.Internal)
|
||||
return &out
|
||||
}
|
File diff suppressed because it is too large
Load Diff
3034
api/v0api/v0mocks/mock_full.go
Normal file
3034
api/v0api/v0mocks/mock_full.go
Normal file
File diff suppressed because it is too large
Load Diff
187
api/v0api/v1_wrapper.go
Normal file
187
api/v0api/v1_wrapper.go
Normal file
@ -0,0 +1,187 @@
|
||||
package v0api
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/api/v1api"
|
||||
)
|
||||
|
||||
type WrapperV1Full struct {
|
||||
v1api.FullNode
|
||||
}
|
||||
|
||||
func (w *WrapperV1Full) StateSearchMsg(ctx context.Context, msg cid.Cid) (*api.MsgLookup, error) {
|
||||
return w.FullNode.StateSearchMsg(ctx, types.EmptyTSK, msg, api.LookbackNoLimit, true)
|
||||
}
|
||||
|
||||
func (w *WrapperV1Full) StateSearchMsgLimited(ctx context.Context, msg cid.Cid, limit abi.ChainEpoch) (*api.MsgLookup, error) {
|
||||
return w.FullNode.StateSearchMsg(ctx, types.EmptyTSK, msg, limit, true)
|
||||
}
|
||||
|
||||
func (w *WrapperV1Full) StateWaitMsg(ctx context.Context, msg cid.Cid, confidence uint64) (*api.MsgLookup, error) {
|
||||
return w.FullNode.StateWaitMsg(ctx, msg, confidence, api.LookbackNoLimit, true)
|
||||
}
|
||||
|
||||
func (w *WrapperV1Full) StateWaitMsgLimited(ctx context.Context, msg cid.Cid, confidence uint64, limit abi.ChainEpoch) (*api.MsgLookup, error) {
|
||||
return w.FullNode.StateWaitMsg(ctx, msg, confidence, limit, true)
|
||||
}
|
||||
|
||||
func (w *WrapperV1Full) StateGetReceipt(ctx context.Context, msg cid.Cid, from types.TipSetKey) (*types.MessageReceipt, error) {
|
||||
ml, err := w.FullNode.StateSearchMsg(ctx, from, msg, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if ml == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return &ml.Receipt, nil
|
||||
}
|
||||
|
||||
func (w *WrapperV1Full) Version(ctx context.Context) (api.APIVersion, error) {
|
||||
ver, err := w.FullNode.Version(ctx)
|
||||
if err != nil {
|
||||
return api.APIVersion{}, err
|
||||
}
|
||||
|
||||
ver.APIVersion = api.FullAPIVersion0
|
||||
|
||||
return ver, nil
|
||||
}
|
||||
|
||||
func (w *WrapperV1Full) executePrototype(ctx context.Context, p *api.MessagePrototype) (cid.Cid, error) {
|
||||
sm, err := w.FullNode.MpoolPushMessage(ctx, &p.Message, nil)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("pushing message: %w", err)
|
||||
}
|
||||
|
||||
return sm.Cid(), nil
|
||||
}
|
||||
func (w *WrapperV1Full) MsigCreate(ctx context.Context, req uint64, addrs []address.Address, duration abi.ChainEpoch, val types.BigInt, src address.Address, gp types.BigInt) (cid.Cid, error) {
|
||||
|
||||
p, err := w.FullNode.MsigCreate(ctx, req, addrs, duration, val, src, gp)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("creating prototype: %w", err)
|
||||
}
|
||||
|
||||
return w.executePrototype(ctx, p)
|
||||
}
|
||||
|
||||
func (w *WrapperV1Full) MsigPropose(ctx context.Context, msig address.Address, to address.Address, amt types.BigInt, src address.Address, method uint64, params []byte) (cid.Cid, error) {
|
||||
|
||||
p, err := w.FullNode.MsigPropose(ctx, msig, to, amt, src, method, params)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("creating prototype: %w", err)
|
||||
}
|
||||
|
||||
return w.executePrototype(ctx, p)
|
||||
}
|
||||
func (w *WrapperV1Full) MsigApprove(ctx context.Context, msig address.Address, txID uint64, src address.Address) (cid.Cid, error) {
|
||||
|
||||
p, err := w.FullNode.MsigApprove(ctx, msig, txID, src)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("creating prototype: %w", err)
|
||||
}
|
||||
|
||||
return w.executePrototype(ctx, p)
|
||||
}
|
||||
|
||||
func (w *WrapperV1Full) MsigApproveTxnHash(ctx context.Context, msig address.Address, txID uint64, proposer address.Address, to address.Address, amt types.BigInt, src address.Address, method uint64, params []byte) (cid.Cid, error) {
|
||||
p, err := w.FullNode.MsigApproveTxnHash(ctx, msig, txID, proposer, to, amt, src, method, params)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("creating prototype: %w", err)
|
||||
}
|
||||
|
||||
return w.executePrototype(ctx, p)
|
||||
}
|
||||
|
||||
func (w *WrapperV1Full) MsigCancel(ctx context.Context, msig address.Address, txID uint64, to address.Address, amt types.BigInt, src address.Address, method uint64, params []byte) (cid.Cid, error) {
|
||||
p, err := w.FullNode.MsigCancel(ctx, msig, txID, to, amt, src, method, params)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("creating prototype: %w", err)
|
||||
}
|
||||
|
||||
return w.executePrototype(ctx, p)
|
||||
}
|
||||
|
||||
func (w *WrapperV1Full) MsigAddPropose(ctx context.Context, msig address.Address, src address.Address, newAdd address.Address, inc bool) (cid.Cid, error) {
|
||||
|
||||
p, err := w.FullNode.MsigAddPropose(ctx, msig, src, newAdd, inc)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("creating prototype: %w", err)
|
||||
}
|
||||
|
||||
return w.executePrototype(ctx, p)
|
||||
}
|
||||
|
||||
func (w *WrapperV1Full) MsigAddApprove(ctx context.Context, msig address.Address, src address.Address, txID uint64, proposer address.Address, newAdd address.Address, inc bool) (cid.Cid, error) {
|
||||
|
||||
p, err := w.FullNode.MsigAddApprove(ctx, msig, src, txID, proposer, newAdd, inc)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("creating prototype: %w", err)
|
||||
}
|
||||
|
||||
return w.executePrototype(ctx, p)
|
||||
}
|
||||
|
||||
func (w *WrapperV1Full) MsigAddCancel(ctx context.Context, msig address.Address, src address.Address, txID uint64, newAdd address.Address, inc bool) (cid.Cid, error) {
|
||||
|
||||
p, err := w.FullNode.MsigAddCancel(ctx, msig, src, txID, newAdd, inc)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("creating prototype: %w", err)
|
||||
}
|
||||
|
||||
return w.executePrototype(ctx, p)
|
||||
}
|
||||
|
||||
func (w *WrapperV1Full) MsigSwapPropose(ctx context.Context, msig address.Address, src address.Address, oldAdd address.Address, newAdd address.Address) (cid.Cid, error) {
|
||||
|
||||
p, err := w.FullNode.MsigSwapPropose(ctx, msig, src, oldAdd, newAdd)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("creating prototype: %w", err)
|
||||
}
|
||||
|
||||
return w.executePrototype(ctx, p)
|
||||
}
|
||||
|
||||
func (w *WrapperV1Full) MsigSwapApprove(ctx context.Context, msig address.Address, src address.Address, txID uint64, proposer address.Address, oldAdd address.Address, newAdd address.Address) (cid.Cid, error) {
|
||||
|
||||
p, err := w.FullNode.MsigSwapApprove(ctx, msig, src, txID, proposer, oldAdd, newAdd)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("creating prototype: %w", err)
|
||||
}
|
||||
|
||||
return w.executePrototype(ctx, p)
|
||||
}
|
||||
|
||||
func (w *WrapperV1Full) MsigSwapCancel(ctx context.Context, msig address.Address, src address.Address, txID uint64, oldAdd address.Address, newAdd address.Address) (cid.Cid, error) {
|
||||
|
||||
p, err := w.FullNode.MsigSwapCancel(ctx, msig, src, txID, oldAdd, newAdd)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("creating prototype: %w", err)
|
||||
}
|
||||
|
||||
return w.executePrototype(ctx, p)
|
||||
}
|
||||
|
||||
func (w *WrapperV1Full) MsigRemoveSigner(ctx context.Context, msig address.Address, proposer address.Address, toRemove address.Address, decrease bool) (cid.Cid, error) {
|
||||
|
||||
p, err := w.FullNode.MsigRemoveSigner(ctx, msig, proposer, toRemove, decrease)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("creating prototype: %w", err)
|
||||
}
|
||||
|
||||
return w.executePrototype(ctx, p)
|
||||
}
|
||||
|
||||
var _ FullNode = &WrapperV1Full{}
|
12
api/v1api/latest.go
Normal file
12
api/v1api/latest.go
Normal file
@ -0,0 +1,12 @@
|
||||
package v1api
|
||||
|
||||
import (
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
)
|
||||
|
||||
type FullNode = api.FullNode
|
||||
type FullNodeStruct = api.FullNodeStruct
|
||||
|
||||
func PermissionedFullAPI(a FullNode) FullNode {
|
||||
return api.PermissionedFullAPI(a)
|
||||
}
|
@ -42,11 +42,11 @@ var RunningNodeType NodeType
|
||||
func VersionForType(nodeType NodeType) (Version, error) {
|
||||
switch nodeType {
|
||||
case NodeFull:
|
||||
return FullAPIVersion, nil
|
||||
return FullAPIVersion1, nil
|
||||
case NodeMiner:
|
||||
return MinerAPIVersion, nil
|
||||
return MinerAPIVersion0, nil
|
||||
case NodeWorker:
|
||||
return WorkerAPIVersion, nil
|
||||
return WorkerAPIVersion0, nil
|
||||
default:
|
||||
return Version(0), xerrors.Errorf("unknown node type %d", nodeType)
|
||||
}
|
||||
@ -54,9 +54,11 @@ func VersionForType(nodeType NodeType) (Version, error) {
|
||||
|
||||
// semver versions of the rpc api exposed
|
||||
var (
|
||||
FullAPIVersion = newVer(1, 2, 0)
|
||||
MinerAPIVersion = newVer(1, 0, 1)
|
||||
WorkerAPIVersion = newVer(1, 0, 0)
|
||||
FullAPIVersion0 = newVer(1, 3, 0)
|
||||
FullAPIVersion1 = newVer(2, 1, 0)
|
||||
|
||||
MinerAPIVersion0 = newVer(1, 0, 1)
|
||||
WorkerAPIVersion0 = newVer(1, 0, 0)
|
||||
)
|
||||
|
||||
//nolint:varcheck,deadcode
|
||||
|
32
api/wrap.go
Normal file
32
api/wrap.go
Normal file
@ -0,0 +1,32 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
)
|
||||
|
||||
// Wrap adapts partial api impl to another version
|
||||
// proxyT is the proxy type used as input in wrapperT
|
||||
// Usage: Wrap(new(v1api.FullNodeStruct), new(v0api.WrapperV1Full), eventsApi).(EventAPI)
|
||||
func Wrap(proxyT, wrapperT, impl interface{}) interface{} {
|
||||
proxy := reflect.New(reflect.TypeOf(proxyT).Elem())
|
||||
proxyMethods := proxy.Elem().FieldByName("Internal")
|
||||
ri := reflect.ValueOf(impl)
|
||||
|
||||
for i := 0; i < ri.NumMethod(); i++ {
|
||||
mt := ri.Type().Method(i)
|
||||
if proxyMethods.FieldByName(mt.Name).Kind() == reflect.Invalid {
|
||||
continue
|
||||
}
|
||||
|
||||
fn := ri.Method(i)
|
||||
of := proxyMethods.FieldByName(mt.Name)
|
||||
|
||||
proxyMethods.FieldByName(mt.Name).Set(reflect.MakeFunc(of.Type(), func(args []reflect.Value) (results []reflect.Value) {
|
||||
return fn.Call(args)
|
||||
}))
|
||||
}
|
||||
|
||||
wp := reflect.New(reflect.TypeOf(wrapperT).Elem())
|
||||
wp.Elem().Field(0).Set(proxy)
|
||||
return wp.Interface()
|
||||
}
|
@ -406,6 +406,11 @@ func (s *SplitStore) Close() error {
|
||||
}
|
||||
|
||||
func (s *SplitStore) HeadChange(_, apply []*types.TipSet) error {
|
||||
// Revert only.
|
||||
if len(apply) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
s.mx.Lock()
|
||||
curTs := apply[len(apply)-1]
|
||||
epoch := curTs.Height()
|
||||
|
@ -27,7 +27,7 @@ func init() {
|
||||
}
|
||||
|
||||
func testSplitStore(t *testing.T, cfg *Config) {
|
||||
chain := &mockChain{}
|
||||
chain := &mockChain{t: t}
|
||||
// genesis
|
||||
genBlock := mock.MkBlock(nil, 0, 0)
|
||||
genTs := mock.TipSet(genBlock)
|
||||
@ -169,6 +169,9 @@ func testSplitStore(t *testing.T, cfg *Config) {
|
||||
t.Errorf("expected %d hot blocks, but got %d", 7, hotCnt)
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure we can revert without panicking.
|
||||
chain.revert(2)
|
||||
}
|
||||
|
||||
func TestSplitStoreSimpleCompaction(t *testing.T) {
|
||||
@ -191,6 +194,8 @@ func TestSplitStoreFullCompactionWithGC(t *testing.T) {
|
||||
}
|
||||
|
||||
type mockChain struct {
|
||||
t testing.TB
|
||||
|
||||
sync.Mutex
|
||||
tipsets []*types.TipSet
|
||||
listener func(revert []*types.TipSet, apply []*types.TipSet) error
|
||||
@ -204,7 +209,26 @@ func (c *mockChain) push(ts *types.TipSet) {
|
||||
if c.listener != nil {
|
||||
err := c.listener(nil, []*types.TipSet{ts})
|
||||
if err != nil {
|
||||
log.Errorf("mockchain: error dispatching listener: %s", err)
|
||||
c.t.Errorf("mockchain: error dispatching listener: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (c *mockChain) revert(count int) {
|
||||
c.Lock()
|
||||
revert := make([]*types.TipSet, count)
|
||||
if count > len(c.tipsets) {
|
||||
c.Unlock()
|
||||
c.t.Fatalf("not enough tipsets to revert")
|
||||
}
|
||||
copy(revert, c.tipsets[len(c.tipsets)-count:])
|
||||
c.tipsets = c.tipsets[:len(c.tipsets)-count]
|
||||
c.Unlock()
|
||||
|
||||
if c.listener != nil {
|
||||
err := c.listener(revert, nil)
|
||||
if err != nil {
|
||||
c.t.Errorf("mockchain: error dispatching listener: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -24,29 +24,27 @@ var UpgradeIgnitionHeight = abi.ChainEpoch(-2)
|
||||
var UpgradeRefuelHeight = abi.ChainEpoch(-3)
|
||||
var UpgradeTapeHeight = abi.ChainEpoch(-4)
|
||||
|
||||
var UpgradeAssemblyHeight = abi.ChainEpoch(5)
|
||||
var UpgradeLiftoffHeight = abi.ChainEpoch(-5)
|
||||
var UpgradeAssemblyHeight = abi.ChainEpoch(-5)
|
||||
var UpgradeLiftoffHeight = abi.ChainEpoch(-6)
|
||||
|
||||
var UpgradeKumquatHeight = abi.ChainEpoch(6)
|
||||
var UpgradeCalicoHeight = abi.ChainEpoch(7)
|
||||
var UpgradePersianHeight = abi.ChainEpoch(8)
|
||||
var UpgradeOrangeHeight = abi.ChainEpoch(9)
|
||||
var UpgradeClausHeight = abi.ChainEpoch(10)
|
||||
var UpgradeKumquatHeight = abi.ChainEpoch(-7)
|
||||
var UpgradeCalicoHeight = abi.ChainEpoch(-8)
|
||||
var UpgradePersianHeight = abi.ChainEpoch(-9)
|
||||
var UpgradeOrangeHeight = abi.ChainEpoch(-10)
|
||||
var UpgradeClausHeight = abi.ChainEpoch(-11)
|
||||
|
||||
var UpgradeTrustHeight = abi.ChainEpoch(11)
|
||||
var UpgradeTrustHeight = abi.ChainEpoch(-12)
|
||||
|
||||
var UpgradeNorwegianHeight = abi.ChainEpoch(12)
|
||||
var UpgradeNorwegianHeight = abi.ChainEpoch(-13)
|
||||
|
||||
var UpgradeTurboHeight = abi.ChainEpoch(13)
|
||||
|
||||
var UpgradeHyperdriveHeight = abi.ChainEpoch(14)
|
||||
var UpgradeTurboHeight = abi.ChainEpoch(-14)
|
||||
|
||||
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
||||
0: DrandMainnet,
|
||||
}
|
||||
|
||||
func init() {
|
||||
policy.SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1)
|
||||
policy.SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1, abi.RegisteredSealProof_StackedDrg8MiBV1)
|
||||
policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048))
|
||||
policy.SetMinVerifiedDealSize(abi.NewStoragePower(256))
|
||||
policy.SetPreCommitChallengeDelay(abi.ChainEpoch(10))
|
||||
|
@ -13,7 +13,6 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||
)
|
||||
|
||||
@ -66,8 +65,6 @@ const UpgradeTurboHeight = 712320
|
||||
var UpgradeHyperdriveHeight = abi.ChainEpoch(9999999)
|
||||
|
||||
func init() {
|
||||
policy.SetConsensusMinerMinPower(abi.NewStoragePower(10 << 40))
|
||||
|
||||
if os.Getenv("LOTUS_USE_TEST_ADDRESSES") != "1" {
|
||||
SetAddressNetwork(address.Mainnet)
|
||||
}
|
||||
|
@ -40,8 +40,8 @@ const UpgradeClausHeight = 250
|
||||
const UpgradeOrangeHeight = 300
|
||||
|
||||
const UpgradeTrustHeight = 600
|
||||
const UpgradeNorwegianHeight = 999999
|
||||
const UpgradeTurboHeight = 99999999
|
||||
const UpgradeNorwegianHeight = 201000
|
||||
const UpgradeTurboHeight = 203000
|
||||
const UpgradeHyperdriveHeight = 999999999
|
||||
|
||||
func init() {
|
||||
|
@ -6,4 +6,5 @@ import (
|
||||
_ "github.com/GeertJohan/go.rice/rice"
|
||||
_ "github.com/golang/mock/mockgen"
|
||||
_ "github.com/whyrusleeping/bencher"
|
||||
_ "golang.org/x/tools/cmd/stringer"
|
||||
)
|
||||
|
@ -1,5 +1,7 @@
|
||||
package build
|
||||
|
||||
import "os"
|
||||
|
||||
var CurrentCommit string
|
||||
var BuildType int
|
||||
|
||||
@ -29,8 +31,12 @@ func buildType() string {
|
||||
}
|
||||
|
||||
// BuildVersion is the local build version, set by build system
|
||||
const BuildVersion = "1.9.0-rc3"
|
||||
const BuildVersion = "1.11.0-dev"
|
||||
|
||||
func UserVersion() string {
|
||||
if os.Getenv("LOTUS_VERSION_IGNORE_COMMIT") == "1" {
|
||||
return BuildVersion
|
||||
}
|
||||
|
||||
return BuildVersion + buildType() + CurrentCommit
|
||||
}
|
||||
|
@ -6,34 +6,26 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"text/template"
|
||||
|
||||
lotusactors "github.com/filecoin-project/lotus/chain/actors"
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
)
|
||||
|
||||
var latestVersion = 5
|
||||
|
||||
var versions = []int{0, 2, 3, 4, latestVersion}
|
||||
|
||||
var versionImports = map[int]string{
|
||||
0: "/",
|
||||
2: "/v2/",
|
||||
3: "/v3/",
|
||||
4: "/v4/",
|
||||
latestVersion: "/v5/",
|
||||
}
|
||||
|
||||
var actors = map[string][]int{
|
||||
"account": versions,
|
||||
"cron": versions,
|
||||
"init": versions,
|
||||
"market": versions,
|
||||
"miner": versions,
|
||||
"multisig": versions,
|
||||
"paych": versions,
|
||||
"power": versions,
|
||||
"reward": versions,
|
||||
"verifreg": versions,
|
||||
"account": lotusactors.Versions,
|
||||
"cron": lotusactors.Versions,
|
||||
"init": lotusactors.Versions,
|
||||
"market": lotusactors.Versions,
|
||||
"miner": lotusactors.Versions,
|
||||
"multisig": lotusactors.Versions,
|
||||
"paych": lotusactors.Versions,
|
||||
"power": lotusactors.Versions,
|
||||
"system": lotusactors.Versions,
|
||||
"reward": lotusactors.Versions,
|
||||
"verifreg": lotusactors.Versions,
|
||||
}
|
||||
|
||||
func main() {
|
||||
@ -72,14 +64,14 @@ func generateAdapters() error {
|
||||
}
|
||||
|
||||
tpl := template.Must(template.New("").Funcs(template.FuncMap{
|
||||
"import": func(v int) string { return versionImports[v] },
|
||||
"import": func(v int) string { return getVersionImports()[v] },
|
||||
}).Parse(string(af)))
|
||||
|
||||
var b bytes.Buffer
|
||||
|
||||
err = tpl.Execute(&b, map[string]interface{}{
|
||||
"versions": versions,
|
||||
"latestVersion": latestVersion,
|
||||
"latestVersion": lotusactors.LatestVersion,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@ -104,14 +96,14 @@ func generateState(actDir string) error {
|
||||
return xerrors.Errorf("loading state adapter template: %w", err)
|
||||
}
|
||||
|
||||
for _, version := range versions {
|
||||
for _, version := range lotusactors.Versions {
|
||||
tpl := template.Must(template.New("").Funcs(template.FuncMap{}).Parse(string(af)))
|
||||
|
||||
var b bytes.Buffer
|
||||
|
||||
err := tpl.Execute(&b, map[string]interface{}{
|
||||
"v": version,
|
||||
"import": versionImports[version],
|
||||
"import": getVersionImports()[version],
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@ -135,14 +127,14 @@ func generateMessages(actDir string) error {
|
||||
return xerrors.Errorf("loading message adapter template: %w", err)
|
||||
}
|
||||
|
||||
for _, version := range versions {
|
||||
for _, version := range lotusactors.Versions {
|
||||
tpl := template.Must(template.New("").Funcs(template.FuncMap{}).Parse(string(af)))
|
||||
|
||||
var b bytes.Buffer
|
||||
|
||||
err := tpl.Execute(&b, map[string]interface{}{
|
||||
"v": version,
|
||||
"import": versionImports[version],
|
||||
"import": getVersionImports()[version],
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@ -168,13 +160,13 @@ func generatePolicy(policyPath string) error {
|
||||
}
|
||||
|
||||
tpl := template.Must(template.New("").Funcs(template.FuncMap{
|
||||
"import": func(v int) string { return versionImports[v] },
|
||||
"import": func(v int) string { return getVersionImports()[v] },
|
||||
}).Parse(string(pf)))
|
||||
var b bytes.Buffer
|
||||
|
||||
err = tpl.Execute(&b, map[string]interface{}{
|
||||
"versions": versions,
|
||||
"latestVersion": latestVersion,
|
||||
"versions": lotusactors.Versions,
|
||||
"latestVersion": lotusactors.LatestVersion,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@ -199,13 +191,13 @@ func generateBuiltin(builtinPath string) error {
|
||||
}
|
||||
|
||||
tpl := template.Must(template.New("").Funcs(template.FuncMap{
|
||||
"import": func(v int) string { return versionImports[v] },
|
||||
"import": func(v int) string { return getVersionImports()[v] },
|
||||
}).Parse(string(bf)))
|
||||
var b bytes.Buffer
|
||||
|
||||
err = tpl.Execute(&b, map[string]interface{}{
|
||||
"versions": versions,
|
||||
"latestVersion": latestVersion,
|
||||
"versions": lotusactors.Versions,
|
||||
"latestVersion": lotusactors.LatestVersion,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@ -217,3 +209,16 @@ func generateBuiltin(builtinPath string) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func getVersionImports() map[int]string {
|
||||
versionImports := make(map[int]string, lotusactors.LatestVersion)
|
||||
for _, v := range lotusactors.Versions {
|
||||
if v == 0 {
|
||||
versionImports[v] = "/"
|
||||
} else {
|
||||
versionImports[v] = "/v" + strconv.Itoa(v) + "/"
|
||||
}
|
||||
}
|
||||
|
||||
return versionImports
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
@ -69,8 +70,54 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||
}
|
||||
|
||||
func MakeState(store adt.Store, av actors.Version, addr address.Address) (State, error) {
|
||||
switch av {
|
||||
|
||||
case actors.Version0:
|
||||
return make0(store, addr)
|
||||
|
||||
case actors.Version2:
|
||||
return make2(store, addr)
|
||||
|
||||
case actors.Version3:
|
||||
return make3(store, addr)
|
||||
|
||||
case actors.Version4:
|
||||
return make4(store, addr)
|
||||
|
||||
case actors.Version5:
|
||||
return make5(store, addr)
|
||||
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||
switch av {
|
||||
|
||||
case actors.Version0:
|
||||
return builtin0.AccountActorCodeID, nil
|
||||
|
||||
case actors.Version2:
|
||||
return builtin2.AccountActorCodeID, nil
|
||||
|
||||
case actors.Version3:
|
||||
return builtin3.AccountActorCodeID, nil
|
||||
|
||||
case actors.Version4:
|
||||
return builtin4.AccountActorCodeID, nil
|
||||
|
||||
case actors.Version5:
|
||||
return builtin5.AccountActorCodeID, nil
|
||||
|
||||
}
|
||||
|
||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
PubkeyAddress() (address.Address, error)
|
||||
GetState() interface{}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
@ -34,8 +35,30 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||
}
|
||||
|
||||
func MakeState(store adt.Store, av actors.Version, addr address.Address) (State, error) {
|
||||
switch av {
|
||||
{{range .versions}}
|
||||
case actors.Version{{.}}:
|
||||
return make{{.}}(store, addr)
|
||||
{{end}}
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||
switch av {
|
||||
{{range .versions}}
|
||||
case actors.Version{{.}}:
|
||||
return builtin{{.}}.AccountActorCodeID, nil
|
||||
{{end}}
|
||||
}
|
||||
|
||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
PubkeyAddress() (address.Address, error)
|
||||
GetState() interface{}
|
||||
}
|
||||
|
@ -20,6 +20,12 @@ func load{{.v}}(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make{{.v}}(store adt.Store, addr address.Address) (State, error) {
|
||||
out := state{{.v}}{store: store}
|
||||
out.State = account{{.v}}.State{Address:addr}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state{{.v}} struct {
|
||||
account{{.v}}.State
|
||||
store adt.Store
|
||||
@ -28,3 +34,7 @@ type state{{.v}} struct {
|
||||
func (s *state{{.v}}) PubkeyAddress() (address.Address, error) {
|
||||
return s.Address, nil
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
@ -20,6 +20,12 @@ func load0(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make0(store adt.Store, addr address.Address) (State, error) {
|
||||
out := state0{store: store}
|
||||
out.State = account0.State{Address: addr}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state0 struct {
|
||||
account0.State
|
||||
store adt.Store
|
||||
@ -28,3 +34,7 @@ type state0 struct {
|
||||
func (s *state0) PubkeyAddress() (address.Address, error) {
|
||||
return s.Address, nil
|
||||
}
|
||||
|
||||
func (s *state0) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -20,6 +20,12 @@ func load2(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make2(store adt.Store, addr address.Address) (State, error) {
|
||||
out := state2{store: store}
|
||||
out.State = account2.State{Address: addr}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state2 struct {
|
||||
account2.State
|
||||
store adt.Store
|
||||
@ -28,3 +34,7 @@ type state2 struct {
|
||||
func (s *state2) PubkeyAddress() (address.Address, error) {
|
||||
return s.Address, nil
|
||||
}
|
||||
|
||||
func (s *state2) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -20,6 +20,12 @@ func load3(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make3(store adt.Store, addr address.Address) (State, error) {
|
||||
out := state3{store: store}
|
||||
out.State = account3.State{Address: addr}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state3 struct {
|
||||
account3.State
|
||||
store adt.Store
|
||||
@ -28,3 +34,7 @@ type state3 struct {
|
||||
func (s *state3) PubkeyAddress() (address.Address, error) {
|
||||
return s.Address, nil
|
||||
}
|
||||
|
||||
func (s *state3) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -20,6 +20,12 @@ func load4(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make4(store adt.Store, addr address.Address) (State, error) {
|
||||
out := state4{store: store}
|
||||
out.State = account4.State{Address: addr}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state4 struct {
|
||||
account4.State
|
||||
store adt.Store
|
||||
@ -28,3 +34,7 @@ type state4 struct {
|
||||
func (s *state4) PubkeyAddress() (address.Address, error) {
|
||||
return s.Address, nil
|
||||
}
|
||||
|
||||
func (s *state4) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -20,6 +20,12 @@ func load5(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make5(store adt.Store, addr address.Address) (State, error) {
|
||||
out := state5{store: store}
|
||||
out.State = account5.State{Address: addr}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state5 struct {
|
||||
account5.State
|
||||
store adt.Store
|
||||
@ -28,3 +34,7 @@ type state5 struct {
|
||||
func (s *state5) PubkeyAddress() (address.Address, error) {
|
||||
return s.Address, nil
|
||||
}
|
||||
|
||||
func (s *state5) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -6,9 +6,9 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
{{range .versions}}
|
||||
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
||||
smoothing{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/util/smoothing"
|
||||
{{end}}
|
||||
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
||||
smoothing{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/util/smoothing"
|
||||
{{end}}
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
@ -17,7 +17,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
|
||||
miner{{.latestVersion}} "github.com/filecoin-project/specs-actors{{import .latestVersion}}actors/builtin/miner"
|
||||
proof{{.latestVersion}} "github.com/filecoin-project/specs-actors{{import .latestVersion}}actors/runtime/proof"
|
||||
proof{{.latestVersion}} "github.com/filecoin-project/specs-actors{{import .latestVersion}}actors/runtime/proof"
|
||||
)
|
||||
|
||||
var SystemActorAddr = builtin{{.latestVersion}}.SystemActorAddr
|
||||
@ -53,13 +53,13 @@ func QAPowerForWeight(size abi.SectorSize, duration abi.ChainEpoch, dealWeight,
|
||||
}
|
||||
|
||||
{{range .versions}}
|
||||
func FromV{{.}}FilterEstimate(v{{.}} smoothing{{.}}.FilterEstimate) FilterEstimate {
|
||||
func FromV{{.}}FilterEstimate(v{{.}} smoothing{{.}}.FilterEstimate) FilterEstimate {
|
||||
{{if (eq . 0)}}
|
||||
return (FilterEstimate)(v{{.}}) //nolint:unconvert
|
||||
{{else}}
|
||||
return (FilterEstimate)(v{{.}})
|
||||
{{end}}
|
||||
}
|
||||
return (FilterEstimate)(v{{.}}) //nolint:unconvert
|
||||
{{else}}
|
||||
return (FilterEstimate)(v{{.}})
|
||||
{{end}}
|
||||
}
|
||||
{{end}}
|
||||
|
||||
type ActorStateLoader func(store adt.Store, root cid.Cid) (cbor.Marshaler, error)
|
||||
@ -80,58 +80,58 @@ func Load(store adt.Store, act *types.Actor) (cbor.Marshaler, error) {
|
||||
|
||||
func ActorNameByCode(c cid.Cid) string {
|
||||
switch {
|
||||
{{range .versions}}
|
||||
case builtin{{.}}.IsBuiltinActor(c):
|
||||
return builtin{{.}}.ActorNameByCode(c)
|
||||
{{end}}
|
||||
{{range .versions}}
|
||||
case builtin{{.}}.IsBuiltinActor(c):
|
||||
return builtin{{.}}.ActorNameByCode(c)
|
||||
{{end}}
|
||||
default:
|
||||
return "<unknown>"
|
||||
}
|
||||
}
|
||||
|
||||
func IsBuiltinActor(c cid.Cid) bool {
|
||||
{{range .versions}}
|
||||
if builtin{{.}}.IsBuiltinActor(c) {
|
||||
return true
|
||||
}
|
||||
{{end}}
|
||||
return false
|
||||
{{range .versions}}
|
||||
if builtin{{.}}.IsBuiltinActor(c) {
|
||||
return true
|
||||
}
|
||||
{{end}}
|
||||
return false
|
||||
}
|
||||
|
||||
func IsAccountActor(c cid.Cid) bool {
|
||||
{{range .versions}}
|
||||
if c == builtin{{.}}.AccountActorCodeID {
|
||||
return true
|
||||
}
|
||||
{{end}}
|
||||
return false
|
||||
{{range .versions}}
|
||||
if c == builtin{{.}}.AccountActorCodeID {
|
||||
return true
|
||||
}
|
||||
{{end}}
|
||||
return false
|
||||
}
|
||||
|
||||
func IsStorageMinerActor(c cid.Cid) bool {
|
||||
{{range .versions}}
|
||||
if c == builtin{{.}}.StorageMinerActorCodeID {
|
||||
return true
|
||||
}
|
||||
{{end}}
|
||||
return false
|
||||
{{range .versions}}
|
||||
if c == builtin{{.}}.StorageMinerActorCodeID {
|
||||
return true
|
||||
}
|
||||
{{end}}
|
||||
return false
|
||||
}
|
||||
|
||||
func IsMultisigActor(c cid.Cid) bool {
|
||||
{{range .versions}}
|
||||
if c == builtin{{.}}.MultisigActorCodeID {
|
||||
return true
|
||||
}
|
||||
{{end}}
|
||||
return false
|
||||
{{range .versions}}
|
||||
if c == builtin{{.}}.MultisigActorCodeID {
|
||||
return true
|
||||
}
|
||||
{{end}}
|
||||
return false
|
||||
}
|
||||
|
||||
func IsPaymentChannelActor(c cid.Cid) bool {
|
||||
{{range .versions}}
|
||||
if c == builtin{{.}}.PaymentChannelActorCodeID {
|
||||
return true
|
||||
}
|
||||
{{end}}
|
||||
return false
|
||||
{{range .versions}}
|
||||
if c == builtin{{.}}.PaymentChannelActorCodeID {
|
||||
return true
|
||||
}
|
||||
{{end}}
|
||||
return false
|
||||
}
|
||||
|
||||
func makeAddress(addr string) address.Address {
|
||||
|
@ -1,10 +1,42 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
builtin{{.latestVersion}} "github.com/filecoin-project/specs-actors{{import .latestVersion}}actors/builtin"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"golang.org/x/xerrors"
|
||||
"github.com/ipfs/go-cid"
|
||||
{{range .versions}}
|
||||
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
||||
{{end}}
|
||||
)
|
||||
|
||||
func MakeState(store adt.Store, av actors.Version) (State, error) {
|
||||
switch av {
|
||||
{{range .versions}}
|
||||
case actors.Version{{.}}:
|
||||
return make{{.}}(store)
|
||||
{{end}}
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||
switch av {
|
||||
{{range .versions}}
|
||||
case actors.Version{{.}}:
|
||||
return builtin{{.}}.CronActorCodeID, nil
|
||||
{{end}}
|
||||
}
|
||||
|
||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
var (
|
||||
Address = builtin{{.latestVersion}}.CronActorAddr
|
||||
Methods = builtin{{.latestVersion}}.MethodsCron
|
||||
)
|
||||
|
||||
|
||||
type State interface {
|
||||
GetState() interface{}
|
||||
}
|
||||
|
@ -1,10 +1,72 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/ipfs/go-cid"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
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"
|
||||
|
||||
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
||||
|
||||
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
||||
)
|
||||
|
||||
func MakeState(store adt.Store, av actors.Version) (State, error) {
|
||||
switch av {
|
||||
|
||||
case actors.Version0:
|
||||
return make0(store)
|
||||
|
||||
case actors.Version2:
|
||||
return make2(store)
|
||||
|
||||
case actors.Version3:
|
||||
return make3(store)
|
||||
|
||||
case actors.Version4:
|
||||
return make4(store)
|
||||
|
||||
case actors.Version5:
|
||||
return make5(store)
|
||||
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||
switch av {
|
||||
|
||||
case actors.Version0:
|
||||
return builtin0.CronActorCodeID, nil
|
||||
|
||||
case actors.Version2:
|
||||
return builtin2.CronActorCodeID, nil
|
||||
|
||||
case actors.Version3:
|
||||
return builtin3.CronActorCodeID, nil
|
||||
|
||||
case actors.Version4:
|
||||
return builtin4.CronActorCodeID, nil
|
||||
|
||||
case actors.Version5:
|
||||
return builtin5.CronActorCodeID, nil
|
||||
|
||||
}
|
||||
|
||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
var (
|
||||
Address = builtin5.CronActorAddr
|
||||
Methods = builtin5.MethodsCron
|
||||
)
|
||||
|
||||
type State interface {
|
||||
GetState() interface{}
|
||||
}
|
||||
|
35
chain/actors/builtin/cron/state.go.template
Normal file
35
chain/actors/builtin/cron/state.go.template
Normal file
@ -0,0 +1,35 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
|
||||
cron{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/cron"
|
||||
)
|
||||
|
||||
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) (State, error) {
|
||||
out := state{{.v}}{store: store}
|
||||
out.State = *cron{{.v}}.ConstructState(cron{{.v}}.BuiltInEntries())
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state{{.v}} struct {
|
||||
cron{{.v}}.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
35
chain/actors/builtin/cron/v0.go
Normal file
35
chain/actors/builtin/cron/v0.go
Normal file
@ -0,0 +1,35 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
|
||||
cron0 "github.com/filecoin-project/specs-actors/actors/builtin/cron"
|
||||
)
|
||||
|
||||
var _ State = (*state0)(nil)
|
||||
|
||||
func load0(store adt.Store, root cid.Cid) (State, error) {
|
||||
out := state0{store: store}
|
||||
err := store.Get(store.Context(), root, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make0(store adt.Store) (State, error) {
|
||||
out := state0{store: store}
|
||||
out.State = *cron0.ConstructState(cron0.BuiltInEntries())
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state0 struct {
|
||||
cron0.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *state0) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
35
chain/actors/builtin/cron/v2.go
Normal file
35
chain/actors/builtin/cron/v2.go
Normal file
@ -0,0 +1,35 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
|
||||
cron2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/cron"
|
||||
)
|
||||
|
||||
var _ State = (*state2)(nil)
|
||||
|
||||
func load2(store adt.Store, root cid.Cid) (State, error) {
|
||||
out := state2{store: store}
|
||||
err := store.Get(store.Context(), root, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make2(store adt.Store) (State, error) {
|
||||
out := state2{store: store}
|
||||
out.State = *cron2.ConstructState(cron2.BuiltInEntries())
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state2 struct {
|
||||
cron2.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *state2) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
35
chain/actors/builtin/cron/v3.go
Normal file
35
chain/actors/builtin/cron/v3.go
Normal file
@ -0,0 +1,35 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
|
||||
cron3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/cron"
|
||||
)
|
||||
|
||||
var _ State = (*state3)(nil)
|
||||
|
||||
func load3(store adt.Store, root cid.Cid) (State, error) {
|
||||
out := state3{store: store}
|
||||
err := store.Get(store.Context(), root, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make3(store adt.Store) (State, error) {
|
||||
out := state3{store: store}
|
||||
out.State = *cron3.ConstructState(cron3.BuiltInEntries())
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state3 struct {
|
||||
cron3.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *state3) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
35
chain/actors/builtin/cron/v4.go
Normal file
35
chain/actors/builtin/cron/v4.go
Normal file
@ -0,0 +1,35 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
|
||||
cron4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/cron"
|
||||
)
|
||||
|
||||
var _ State = (*state4)(nil)
|
||||
|
||||
func load4(store adt.Store, root cid.Cid) (State, error) {
|
||||
out := state4{store: store}
|
||||
err := store.Get(store.Context(), root, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make4(store adt.Store) (State, error) {
|
||||
out := state4{store: store}
|
||||
out.State = *cron4.ConstructState(cron4.BuiltInEntries())
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state4 struct {
|
||||
cron4.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *state4) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package init
|
||||
|
||||
import (
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
@ -39,6 +40,27 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||
}
|
||||
|
||||
func MakeState(store adt.Store, av actors.Version, networkName string) (State, error) {
|
||||
switch av {
|
||||
{{range .versions}}
|
||||
case actors.Version{{.}}:
|
||||
return make{{.}}(store, networkName)
|
||||
{{end}}
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||
switch av {
|
||||
{{range .versions}}
|
||||
case actors.Version{{.}}:
|
||||
return builtin{{.}}.InitActorCodeID, nil
|
||||
{{end}}
|
||||
}
|
||||
|
||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
@ -56,5 +78,12 @@ type State interface {
|
||||
// Sets the network's name. This should only be used on upgrade/fork.
|
||||
SetNetworkName(name string) error
|
||||
|
||||
addressMap() (adt.Map, error)
|
||||
// Sets the next ID for the init actor. This should only be used for testing.
|
||||
SetNextID(id abi.ActorID) error
|
||||
|
||||
// Sets the address map for the init actor. This should only be used for testing.
|
||||
SetAddressMap(mcid cid.Cid) error
|
||||
|
||||
AddressMap() (adt.Map, error)
|
||||
GetState() interface{}
|
||||
}
|
||||
|
@ -11,12 +11,12 @@ import (
|
||||
)
|
||||
|
||||
func DiffAddressMap(pre, cur State) (*AddressMapChanges, error) {
|
||||
prem, err := pre.addressMap()
|
||||
prem, err := pre.AddressMap()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
curm, err := cur.addressMap()
|
||||
curm, err := cur.AddressMap()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package init
|
||||
|
||||
import (
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
@ -74,6 +75,51 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||
}
|
||||
|
||||
func MakeState(store adt.Store, av actors.Version, networkName string) (State, error) {
|
||||
switch av {
|
||||
|
||||
case actors.Version0:
|
||||
return make0(store, networkName)
|
||||
|
||||
case actors.Version2:
|
||||
return make2(store, networkName)
|
||||
|
||||
case actors.Version3:
|
||||
return make3(store, networkName)
|
||||
|
||||
case actors.Version4:
|
||||
return make4(store, networkName)
|
||||
|
||||
case actors.Version5:
|
||||
return make5(store, networkName)
|
||||
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||
switch av {
|
||||
|
||||
case actors.Version0:
|
||||
return builtin0.InitActorCodeID, nil
|
||||
|
||||
case actors.Version2:
|
||||
return builtin2.InitActorCodeID, nil
|
||||
|
||||
case actors.Version3:
|
||||
return builtin3.InitActorCodeID, nil
|
||||
|
||||
case actors.Version4:
|
||||
return builtin4.InitActorCodeID, nil
|
||||
|
||||
case actors.Version5:
|
||||
return builtin5.InitActorCodeID, nil
|
||||
|
||||
}
|
||||
|
||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
@ -91,5 +137,12 @@ type State interface {
|
||||
// Sets the network's name. This should only be used on upgrade/fork.
|
||||
SetNetworkName(name string) error
|
||||
|
||||
addressMap() (adt.Map, error)
|
||||
// Sets the next ID for the init actor. This should only be used for testing.
|
||||
SetNextID(id abi.ActorID) error
|
||||
|
||||
// Sets the address map for the init actor. This should only be used for testing.
|
||||
SetAddressMap(mcid cid.Cid) error
|
||||
|
||||
AddressMap() (adt.Map, error)
|
||||
GetState() interface{}
|
||||
}
|
||||
|
@ -29,6 +29,26 @@ func load{{.v}}(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make{{.v}}(store adt.Store, networkName string) (State, error) {
|
||||
out := state{{.v}}{store: store}
|
||||
{{if (le .v 2)}}
|
||||
mr, err := adt{{.v}}.MakeEmptyMap(store).Root()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *init{{.v}}.ConstructState(mr, networkName)
|
||||
{{else}}
|
||||
s, err := init{{.v}}.ConstructState(store, networkName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *s
|
||||
{{end}}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state{{.v}} struct {
|
||||
init{{.v}}.State
|
||||
store adt.Store
|
||||
@ -66,6 +86,11 @@ func (s *state{{.v}}) SetNetworkName(name string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) SetNextID(id abi.ActorID) error {
|
||||
s.State.NextID = id
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) Remove(addrs ...address.Address) (err error) {
|
||||
m, err := adt{{.v}}.AsMap(s.store, s.State.AddressMap{{if (ge .v 3)}}, builtin{{.v}}.DefaultHamtBitwidth{{end}})
|
||||
if err != nil {
|
||||
@ -84,6 +109,15 @@ func (s *state{{.v}}) Remove(addrs ...address.Address) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) addressMap() (adt.Map, error) {
|
||||
return adt{{.v}}.AsMap(s.store, s.AddressMap{{if (ge .v 3)}}, builtin{{.v}}.DefaultHamtBitwidth{{end}})
|
||||
func (s *state{{.v}}) SetAddressMap(mcid cid.Cid) error {
|
||||
s.State.AddressMap = mcid
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) AddressMap() (adt.Map, error) {
|
||||
return adt{{.v}}.AsMap(s.store, s.State.AddressMap{{if (ge .v 3)}}, builtin{{.v}}.DefaultHamtBitwidth{{end}})
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
@ -25,6 +25,19 @@ func load0(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make0(store adt.Store, networkName string) (State, error) {
|
||||
out := state0{store: store}
|
||||
|
||||
mr, err := adt0.MakeEmptyMap(store).Root()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *init0.ConstructState(mr, networkName)
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state0 struct {
|
||||
init0.State
|
||||
store adt.Store
|
||||
@ -62,6 +75,11 @@ func (s *state0) SetNetworkName(name string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state0) SetNextID(id abi.ActorID) error {
|
||||
s.State.NextID = id
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state0) Remove(addrs ...address.Address) (err error) {
|
||||
m, err := adt0.AsMap(s.store, s.State.AddressMap)
|
||||
if err != nil {
|
||||
@ -80,6 +98,15 @@ func (s *state0) Remove(addrs ...address.Address) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state0) addressMap() (adt.Map, error) {
|
||||
return adt0.AsMap(s.store, s.AddressMap)
|
||||
func (s *state0) SetAddressMap(mcid cid.Cid) error {
|
||||
s.State.AddressMap = mcid
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state0) AddressMap() (adt.Map, error) {
|
||||
return adt0.AsMap(s.store, s.State.AddressMap)
|
||||
}
|
||||
|
||||
func (s *state0) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -25,6 +25,19 @@ func load2(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make2(store adt.Store, networkName string) (State, error) {
|
||||
out := state2{store: store}
|
||||
|
||||
mr, err := adt2.MakeEmptyMap(store).Root()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *init2.ConstructState(mr, networkName)
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state2 struct {
|
||||
init2.State
|
||||
store adt.Store
|
||||
@ -62,6 +75,11 @@ func (s *state2) SetNetworkName(name string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state2) SetNextID(id abi.ActorID) error {
|
||||
s.State.NextID = id
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state2) Remove(addrs ...address.Address) (err error) {
|
||||
m, err := adt2.AsMap(s.store, s.State.AddressMap)
|
||||
if err != nil {
|
||||
@ -80,6 +98,15 @@ func (s *state2) Remove(addrs ...address.Address) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state2) addressMap() (adt.Map, error) {
|
||||
return adt2.AsMap(s.store, s.AddressMap)
|
||||
func (s *state2) SetAddressMap(mcid cid.Cid) error {
|
||||
s.State.AddressMap = mcid
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state2) AddressMap() (adt.Map, error) {
|
||||
return adt2.AsMap(s.store, s.State.AddressMap)
|
||||
}
|
||||
|
||||
func (s *state2) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -27,6 +27,19 @@ func load3(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make3(store adt.Store, networkName string) (State, error) {
|
||||
out := state3{store: store}
|
||||
|
||||
s, err := init3.ConstructState(store, networkName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *s
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state3 struct {
|
||||
init3.State
|
||||
store adt.Store
|
||||
@ -64,6 +77,11 @@ func (s *state3) SetNetworkName(name string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state3) SetNextID(id abi.ActorID) error {
|
||||
s.State.NextID = id
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state3) Remove(addrs ...address.Address) (err error) {
|
||||
m, err := adt3.AsMap(s.store, s.State.AddressMap, builtin3.DefaultHamtBitwidth)
|
||||
if err != nil {
|
||||
@ -82,6 +100,15 @@ func (s *state3) Remove(addrs ...address.Address) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state3) addressMap() (adt.Map, error) {
|
||||
return adt3.AsMap(s.store, s.AddressMap, builtin3.DefaultHamtBitwidth)
|
||||
func (s *state3) SetAddressMap(mcid cid.Cid) error {
|
||||
s.State.AddressMap = mcid
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state3) AddressMap() (adt.Map, error) {
|
||||
return adt3.AsMap(s.store, s.State.AddressMap, builtin3.DefaultHamtBitwidth)
|
||||
}
|
||||
|
||||
func (s *state3) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -27,6 +27,19 @@ func load4(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make4(store adt.Store, networkName string) (State, error) {
|
||||
out := state4{store: store}
|
||||
|
||||
s, err := init4.ConstructState(store, networkName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *s
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state4 struct {
|
||||
init4.State
|
||||
store adt.Store
|
||||
@ -64,6 +77,11 @@ func (s *state4) SetNetworkName(name string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state4) SetNextID(id abi.ActorID) error {
|
||||
s.State.NextID = id
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state4) Remove(addrs ...address.Address) (err error) {
|
||||
m, err := adt4.AsMap(s.store, s.State.AddressMap, builtin4.DefaultHamtBitwidth)
|
||||
if err != nil {
|
||||
@ -82,6 +100,15 @@ func (s *state4) Remove(addrs ...address.Address) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state4) addressMap() (adt.Map, error) {
|
||||
return adt4.AsMap(s.store, s.AddressMap, builtin4.DefaultHamtBitwidth)
|
||||
func (s *state4) SetAddressMap(mcid cid.Cid) error {
|
||||
s.State.AddressMap = mcid
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state4) AddressMap() (adt.Map, error) {
|
||||
return adt4.AsMap(s.store, s.State.AddressMap, builtin4.DefaultHamtBitwidth)
|
||||
}
|
||||
|
||||
func (s *state4) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -27,6 +27,19 @@ func load5(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make5(store adt.Store, networkName string) (State, error) {
|
||||
out := state5{store: store}
|
||||
|
||||
s, err := init5.ConstructState(store, networkName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *s
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state5 struct {
|
||||
init5.State
|
||||
store adt.Store
|
||||
@ -64,6 +77,11 @@ func (s *state5) SetNetworkName(name string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state5) SetNextID(id abi.ActorID) error {
|
||||
s.State.NextID = id
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state5) Remove(addrs ...address.Address) (err error) {
|
||||
m, err := adt5.AsMap(s.store, s.State.AddressMap, builtin5.DefaultHamtBitwidth)
|
||||
if err != nil {
|
||||
@ -82,6 +100,15 @@ func (s *state5) Remove(addrs ...address.Address) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state5) addressMap() (adt.Map, error) {
|
||||
return adt5.AsMap(s.store, s.AddressMap, builtin5.DefaultHamtBitwidth)
|
||||
func (s *state5) SetAddressMap(mcid cid.Cid) error {
|
||||
s.State.AddressMap = mcid
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state5) AddressMap() (adt.Map, error) {
|
||||
return adt5.AsMap(s.store, s.State.AddressMap, builtin5.DefaultHamtBitwidth)
|
||||
}
|
||||
|
||||
func (s *state5) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -15,6 +16,7 @@ import (
|
||||
{{end}}
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
@ -41,6 +43,27 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||
}
|
||||
|
||||
func MakeState(store adt.Store, av actors.Version) (State, error) {
|
||||
switch av {
|
||||
{{range .versions}}
|
||||
case actors.Version{{.}}:
|
||||
return make{{.}}(store)
|
||||
{{end}}
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||
switch av {
|
||||
{{range .versions}}
|
||||
case actors.Version{{.}}:
|
||||
return builtin{{.}}.StorageMarketActorCodeID, nil
|
||||
{{end}}
|
||||
}
|
||||
|
||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
BalancesChanged(State) (bool, error)
|
||||
@ -55,6 +78,7 @@ type State interface {
|
||||
minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch,
|
||||
) (weight, verifiedWeight abi.DealWeight, err error)
|
||||
NextID() (abi.DealID, error)
|
||||
GetState() interface{}
|
||||
}
|
||||
|
||||
type BalanceTable interface {
|
||||
@ -92,51 +116,67 @@ type DealState struct {
|
||||
}
|
||||
|
||||
type DealProposal struct {
|
||||
PieceCID cid.Cid
|
||||
PieceSize abi.PaddedPieceSize
|
||||
VerifiedDeal bool
|
||||
Client address.Address
|
||||
Provider address.Address
|
||||
Label string
|
||||
StartEpoch abi.ChainEpoch
|
||||
EndEpoch abi.ChainEpoch
|
||||
PieceCID cid.Cid
|
||||
PieceSize abi.PaddedPieceSize
|
||||
VerifiedDeal bool
|
||||
Client address.Address
|
||||
Provider address.Address
|
||||
Label string
|
||||
StartEpoch abi.ChainEpoch
|
||||
EndEpoch abi.ChainEpoch
|
||||
StoragePricePerEpoch abi.TokenAmount
|
||||
ProviderCollateral abi.TokenAmount
|
||||
ClientCollateral abi.TokenAmount
|
||||
ProviderCollateral abi.TokenAmount
|
||||
ClientCollateral abi.TokenAmount
|
||||
}
|
||||
|
||||
type DealStateChanges struct {
|
||||
Added []DealIDState
|
||||
Added []DealIDState
|
||||
Modified []DealStateChange
|
||||
Removed []DealIDState
|
||||
Removed []DealIDState
|
||||
}
|
||||
|
||||
type DealIDState struct {
|
||||
ID abi.DealID
|
||||
ID abi.DealID
|
||||
Deal DealState
|
||||
}
|
||||
|
||||
// DealStateChange is a change in deal state from -> to
|
||||
type DealStateChange struct {
|
||||
ID abi.DealID
|
||||
ID abi.DealID
|
||||
From *DealState
|
||||
To *DealState
|
||||
To *DealState
|
||||
}
|
||||
|
||||
type DealProposalChanges struct {
|
||||
Added []ProposalIDState
|
||||
Added []ProposalIDState
|
||||
Removed []ProposalIDState
|
||||
}
|
||||
|
||||
type ProposalIDState struct {
|
||||
ID abi.DealID
|
||||
ID abi.DealID
|
||||
Proposal DealProposal
|
||||
}
|
||||
|
||||
func EmptyDealState() *DealState {
|
||||
return &DealState{
|
||||
SectorStartEpoch: -1,
|
||||
SlashEpoch: -1,
|
||||
SlashEpoch: -1,
|
||||
LastUpdatedEpoch: -1,
|
||||
}
|
||||
}
|
||||
|
||||
// returns the earned fees and pending fees for a given deal
|
||||
func (deal DealProposal) GetDealFees(height abi.ChainEpoch) (abi.TokenAmount, abi.TokenAmount) {
|
||||
tf := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(deal.EndEpoch-deal.StartEpoch)))
|
||||
|
||||
ef := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(height-deal.StartEpoch)))
|
||||
if ef.LessThan(big.Zero()) {
|
||||
ef = big.Zero()
|
||||
}
|
||||
|
||||
if ef.GreaterThan(tf) {
|
||||
ef = tf
|
||||
}
|
||||
|
||||
return ef, big.Sub(tf, ef)
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -21,6 +22,7 @@ import (
|
||||
|
||||
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
@ -76,6 +78,51 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||
}
|
||||
|
||||
func MakeState(store adt.Store, av actors.Version) (State, error) {
|
||||
switch av {
|
||||
|
||||
case actors.Version0:
|
||||
return make0(store)
|
||||
|
||||
case actors.Version2:
|
||||
return make2(store)
|
||||
|
||||
case actors.Version3:
|
||||
return make3(store)
|
||||
|
||||
case actors.Version4:
|
||||
return make4(store)
|
||||
|
||||
case actors.Version5:
|
||||
return make5(store)
|
||||
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||
switch av {
|
||||
|
||||
case actors.Version0:
|
||||
return builtin0.StorageMarketActorCodeID, nil
|
||||
|
||||
case actors.Version2:
|
||||
return builtin2.StorageMarketActorCodeID, nil
|
||||
|
||||
case actors.Version3:
|
||||
return builtin3.StorageMarketActorCodeID, nil
|
||||
|
||||
case actors.Version4:
|
||||
return builtin4.StorageMarketActorCodeID, nil
|
||||
|
||||
case actors.Version5:
|
||||
return builtin5.StorageMarketActorCodeID, nil
|
||||
|
||||
}
|
||||
|
||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
BalancesChanged(State) (bool, error)
|
||||
@ -90,6 +137,7 @@ type State interface {
|
||||
minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch,
|
||||
) (weight, verifiedWeight abi.DealWeight, err error)
|
||||
NextID() (abi.DealID, error)
|
||||
GetState() interface{}
|
||||
}
|
||||
|
||||
type BalanceTable interface {
|
||||
@ -175,3 +223,19 @@ func EmptyDealState() *DealState {
|
||||
LastUpdatedEpoch: -1,
|
||||
}
|
||||
}
|
||||
|
||||
// returns the earned fees and pending fees for a given deal
|
||||
func (deal DealProposal) GetDealFees(height abi.ChainEpoch) (abi.TokenAmount, abi.TokenAmount) {
|
||||
tf := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(deal.EndEpoch-deal.StartEpoch)))
|
||||
|
||||
ef := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(height-deal.StartEpoch)))
|
||||
if ef.LessThan(big.Zero()) {
|
||||
ef = big.Zero()
|
||||
}
|
||||
|
||||
if ef.GreaterThan(tf) {
|
||||
ef = tf
|
||||
}
|
||||
|
||||
return ef, big.Sub(tf, ef)
|
||||
}
|
||||
|
@ -26,6 +26,31 @@ func load{{.v}}(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make{{.v}}(store adt.Store) (State, error) {
|
||||
out := state{{.v}}{store: store}
|
||||
{{if (le .v 2)}}
|
||||
ea, err := adt{{.v}}.MakeEmptyArray(store).Root()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
em, err := adt{{.v}}.MakeEmptyMap(store).Root()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *market{{.v}}.ConstructState(ea, em, em)
|
||||
{{else}}
|
||||
s, err := market{{.v}}.ConstructState(store)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *s
|
||||
{{end}}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state{{.v}} struct {
|
||||
market{{.v}}.State
|
||||
store adt.Store
|
||||
@ -207,3 +232,7 @@ func (s *dealProposals{{.v}}) array() adt.Array {
|
||||
func fromV{{.v}}DealProposal(v{{.v}} market{{.v}}.DealProposal) DealProposal {
|
||||
return (DealProposal)(v{{.v}})
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -26,6 +26,24 @@ func load0(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make0(store adt.Store) (State, error) {
|
||||
out := state0{store: store}
|
||||
|
||||
ea, err := adt0.MakeEmptyArray(store).Root()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
em, err := adt0.MakeEmptyMap(store).Root()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *market0.ConstructState(ea, em, em)
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state0 struct {
|
||||
market0.State
|
||||
store adt.Store
|
||||
@ -207,3 +225,7 @@ func (s *dealProposals0) array() adt.Array {
|
||||
func fromV0DealProposal(v0 market0.DealProposal) DealProposal {
|
||||
return (DealProposal)(v0)
|
||||
}
|
||||
|
||||
func (s *state0) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -26,6 +26,24 @@ func load2(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make2(store adt.Store) (State, error) {
|
||||
out := state2{store: store}
|
||||
|
||||
ea, err := adt2.MakeEmptyArray(store).Root()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
em, err := adt2.MakeEmptyMap(store).Root()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *market2.ConstructState(ea, em, em)
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state2 struct {
|
||||
market2.State
|
||||
store adt.Store
|
||||
@ -207,3 +225,7 @@ func (s *dealProposals2) array() adt.Array {
|
||||
func fromV2DealProposal(v2 market2.DealProposal) DealProposal {
|
||||
return (DealProposal)(v2)
|
||||
}
|
||||
|
||||
func (s *state2) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -26,6 +26,19 @@ func load3(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make3(store adt.Store) (State, error) {
|
||||
out := state3{store: store}
|
||||
|
||||
s, err := market3.ConstructState(store)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *s
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state3 struct {
|
||||
market3.State
|
||||
store adt.Store
|
||||
@ -207,3 +220,7 @@ func (s *dealProposals3) array() adt.Array {
|
||||
func fromV3DealProposal(v3 market3.DealProposal) DealProposal {
|
||||
return (DealProposal)(v3)
|
||||
}
|
||||
|
||||
func (s *state3) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -26,6 +26,19 @@ func load4(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make4(store adt.Store) (State, error) {
|
||||
out := state4{store: store}
|
||||
|
||||
s, err := market4.ConstructState(store)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *s
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state4 struct {
|
||||
market4.State
|
||||
store adt.Store
|
||||
@ -207,3 +220,7 @@ func (s *dealProposals4) array() adt.Array {
|
||||
func fromV4DealProposal(v4 market4.DealProposal) DealProposal {
|
||||
return (DealProposal)(v4)
|
||||
}
|
||||
|
||||
func (s *state4) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -26,6 +26,19 @@ func load5(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make5(store adt.Store) (State, error) {
|
||||
out := state5{store: store}
|
||||
|
||||
s, err := market5.ConstructState(store)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *s
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state5 struct {
|
||||
market5.State
|
||||
store adt.Store
|
||||
@ -207,3 +220,7 @@ func (s *dealProposals5) array() adt.Array {
|
||||
func fromV5DealProposal(v5 market5.DealProposal) DealProposal {
|
||||
return (DealProposal)(v5)
|
||||
}
|
||||
|
||||
func (s *state5) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package miner
|
||||
import (
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -60,6 +61,27 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||
}
|
||||
|
||||
func MakeState(store adt.Store, av actors.Version) (State, error) {
|
||||
switch av {
|
||||
{{range .versions}}
|
||||
case actors.Version{{.}}:
|
||||
return make{{.}}(store)
|
||||
{{end}}
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||
switch av {
|
||||
{{range .versions}}
|
||||
case actors.Version{{.}}:
|
||||
return builtin{{.}}.StorageMinerActorCodeID, nil
|
||||
{{end}}
|
||||
}
|
||||
|
||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
@ -79,6 +101,11 @@ type State interface {
|
||||
NumLiveSectors() (uint64, error)
|
||||
IsAllocated(abi.SectorNumber) (bool, error)
|
||||
|
||||
// Note that ProvingPeriodStart is deprecated and will be renamed / removed in a future version of actors
|
||||
GetProvingPeriodStart() (abi.ChainEpoch, error)
|
||||
// Testing only
|
||||
EraseAllUnproven() error
|
||||
|
||||
LoadDeadline(idx uint64) (Deadline, error)
|
||||
ForEachDeadline(cb func(idx uint64, dl Deadline) error) error
|
||||
NumDeadlines() (uint64, error)
|
||||
@ -95,6 +122,7 @@ type State interface {
|
||||
decodeSectorOnChainInfo(*cbg.Deferred) (SectorOnChainInfo, error)
|
||||
precommits() (adt.Map, error)
|
||||
decodeSectorPreCommitOnChainInfo(*cbg.Deferred) (SectorPreCommitOnChainInfo, error)
|
||||
GetState() interface{}
|
||||
}
|
||||
|
||||
type Deadline interface {
|
||||
|
@ -3,6 +3,7 @@ package miner
|
||||
import (
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -95,6 +96,51 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||
}
|
||||
|
||||
func MakeState(store adt.Store, av actors.Version) (State, error) {
|
||||
switch av {
|
||||
|
||||
case actors.Version0:
|
||||
return make0(store)
|
||||
|
||||
case actors.Version2:
|
||||
return make2(store)
|
||||
|
||||
case actors.Version3:
|
||||
return make3(store)
|
||||
|
||||
case actors.Version4:
|
||||
return make4(store)
|
||||
|
||||
case actors.Version5:
|
||||
return make5(store)
|
||||
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||
switch av {
|
||||
|
||||
case actors.Version0:
|
||||
return builtin0.StorageMinerActorCodeID, nil
|
||||
|
||||
case actors.Version2:
|
||||
return builtin2.StorageMinerActorCodeID, nil
|
||||
|
||||
case actors.Version3:
|
||||
return builtin3.StorageMinerActorCodeID, nil
|
||||
|
||||
case actors.Version4:
|
||||
return builtin4.StorageMinerActorCodeID, nil
|
||||
|
||||
case actors.Version5:
|
||||
return builtin5.StorageMinerActorCodeID, nil
|
||||
|
||||
}
|
||||
|
||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
@ -114,6 +160,11 @@ type State interface {
|
||||
NumLiveSectors() (uint64, error)
|
||||
IsAllocated(abi.SectorNumber) (bool, error)
|
||||
|
||||
// Note that ProvingPeriodStart is deprecated and will be renamed / removed in a future version of actors
|
||||
GetProvingPeriodStart() (abi.ChainEpoch, error)
|
||||
// Testing only
|
||||
EraseAllUnproven() error
|
||||
|
||||
LoadDeadline(idx uint64) (Deadline, error)
|
||||
ForEachDeadline(cb func(idx uint64, dl Deadline) error) error
|
||||
NumDeadlines() (uint64, error)
|
||||
@ -130,6 +181,7 @@ type State interface {
|
||||
decodeSectorOnChainInfo(*cbg.Deferred) (SectorOnChainInfo, error)
|
||||
precommits() (adt.Map, error)
|
||||
decodeSectorPreCommitOnChainInfo(*cbg.Deferred) (SectorPreCommitOnChainInfo, error)
|
||||
GetState() interface{}
|
||||
}
|
||||
|
||||
type Deadline interface {
|
||||
|
@ -35,6 +35,12 @@ func load{{.v}}(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make{{.v}}(store adt.Store) (State, error) {
|
||||
out := state{{.v}}{store: store}
|
||||
out.State = miner{{.v}}.State{}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state{{.v}} struct {
|
||||
miner{{.v}}.State
|
||||
store adt.Store
|
||||
@ -245,6 +251,10 @@ func (s *state{{.v}}) IsAllocated(num abi.SectorNumber) (bool, error) {
|
||||
return allocatedSectors.IsSet(uint64(num))
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) GetProvingPeriodStart() (abi.ChainEpoch, error) {
|
||||
return s.State.ProvingPeriodStart, nil
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) LoadDeadline(idx uint64) (Deadline, error) {
|
||||
dls, err := s.State.LoadDeadlines(s.store)
|
||||
if err != nil {
|
||||
@ -366,6 +376,45 @@ func (s *state{{.v}}) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (Secto
|
||||
return fromV{{.v}}SectorPreCommitOnChainInfo(sp), nil
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) EraseAllUnproven() error {
|
||||
{{if (ge .v 2)}}
|
||||
dls, err := s.State.LoadDeadlines(s.store)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = dls.ForEach(s.store, func(dindx uint64, dl *miner{{.v}}.Deadline) error {
|
||||
ps, err := dl.PartitionsArray(s.store)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var part miner{{.v}}.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)
|
||||
})
|
||||
|
||||
return s.State.SaveDeadlines(s.store, dls)
|
||||
{{else}}
|
||||
// field doesn't exist until v2
|
||||
{{end}}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *deadline{{.v}}) LoadPartition(idx uint64) (Partition, error) {
|
||||
p, err := d.Deadline.LoadPartition(d.store, idx)
|
||||
if err != nil {
|
||||
@ -458,3 +507,7 @@ func fromV{{.v}}SectorPreCommitOnChainInfo(v{{.v}} miner{{.v}}.SectorPreCommitOn
|
||||
return (SectorPreCommitOnChainInfo)(v0)
|
||||
{{end}}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -32,6 +32,12 @@ func load0(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make0(store adt.Store) (State, error) {
|
||||
out := state0{store: store}
|
||||
out.State = miner0.State{}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state0 struct {
|
||||
miner0.State
|
||||
store adt.Store
|
||||
@ -242,6 +248,10 @@ func (s *state0) IsAllocated(num abi.SectorNumber) (bool, error) {
|
||||
return allocatedSectors.IsSet(uint64(num))
|
||||
}
|
||||
|
||||
func (s *state0) GetProvingPeriodStart() (abi.ChainEpoch, error) {
|
||||
return s.State.ProvingPeriodStart, nil
|
||||
}
|
||||
|
||||
func (s *state0) LoadDeadline(idx uint64) (Deadline, error) {
|
||||
dls, err := s.State.LoadDeadlines(s.store)
|
||||
if err != nil {
|
||||
@ -363,6 +373,13 @@ func (s *state0) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreC
|
||||
return fromV0SectorPreCommitOnChainInfo(sp), nil
|
||||
}
|
||||
|
||||
func (s *state0) EraseAllUnproven() error {
|
||||
|
||||
// field doesn't exist until v2
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *deadline0) LoadPartition(idx uint64) (Partition, error) {
|
||||
p, err := d.Deadline.LoadPartition(d.store, idx)
|
||||
if err != nil {
|
||||
@ -426,3 +443,7 @@ func fromV0SectorPreCommitOnChainInfo(v0 miner0.SectorPreCommitOnChainInfo) Sect
|
||||
return (SectorPreCommitOnChainInfo)(v0)
|
||||
|
||||
}
|
||||
|
||||
func (s *state0) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -30,6 +30,12 @@ func load2(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make2(store adt.Store) (State, error) {
|
||||
out := state2{store: store}
|
||||
out.State = miner2.State{}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state2 struct {
|
||||
miner2.State
|
||||
store adt.Store
|
||||
@ -240,6 +246,10 @@ func (s *state2) IsAllocated(num abi.SectorNumber) (bool, error) {
|
||||
return allocatedSectors.IsSet(uint64(num))
|
||||
}
|
||||
|
||||
func (s *state2) GetProvingPeriodStart() (abi.ChainEpoch, error) {
|
||||
return s.State.ProvingPeriodStart, nil
|
||||
}
|
||||
|
||||
func (s *state2) LoadDeadline(idx uint64) (Deadline, error) {
|
||||
dls, err := s.State.LoadDeadlines(s.store)
|
||||
if err != nil {
|
||||
@ -361,6 +371,43 @@ func (s *state2) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreC
|
||||
return fromV2SectorPreCommitOnChainInfo(sp), nil
|
||||
}
|
||||
|
||||
func (s *state2) EraseAllUnproven() error {
|
||||
|
||||
dls, err := s.State.LoadDeadlines(s.store)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = dls.ForEach(s.store, func(dindx uint64, dl *miner2.Deadline) error {
|
||||
ps, err := dl.PartitionsArray(s.store)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var part miner2.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)
|
||||
})
|
||||
|
||||
return s.State.SaveDeadlines(s.store, dls)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *deadline2) LoadPartition(idx uint64) (Partition, error) {
|
||||
p, err := d.Deadline.LoadPartition(d.store, idx)
|
||||
if err != nil {
|
||||
@ -442,3 +489,7 @@ func fromV2SectorPreCommitOnChainInfo(v2 miner2.SectorPreCommitOnChainInfo) Sect
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *state2) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -32,6 +32,12 @@ func load3(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make3(store adt.Store) (State, error) {
|
||||
out := state3{store: store}
|
||||
out.State = miner3.State{}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state3 struct {
|
||||
miner3.State
|
||||
store adt.Store
|
||||
@ -242,6 +248,10 @@ func (s *state3) IsAllocated(num abi.SectorNumber) (bool, error) {
|
||||
return allocatedSectors.IsSet(uint64(num))
|
||||
}
|
||||
|
||||
func (s *state3) GetProvingPeriodStart() (abi.ChainEpoch, error) {
|
||||
return s.State.ProvingPeriodStart, nil
|
||||
}
|
||||
|
||||
func (s *state3) LoadDeadline(idx uint64) (Deadline, error) {
|
||||
dls, err := s.State.LoadDeadlines(s.store)
|
||||
if err != nil {
|
||||
@ -358,6 +368,43 @@ func (s *state3) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreC
|
||||
return fromV3SectorPreCommitOnChainInfo(sp), nil
|
||||
}
|
||||
|
||||
func (s *state3) EraseAllUnproven() error {
|
||||
|
||||
dls, err := s.State.LoadDeadlines(s.store)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = dls.ForEach(s.store, func(dindx uint64, dl *miner3.Deadline) error {
|
||||
ps, err := dl.PartitionsArray(s.store)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var part miner3.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)
|
||||
})
|
||||
|
||||
return s.State.SaveDeadlines(s.store, dls)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *deadline3) LoadPartition(idx uint64) (Partition, error) {
|
||||
p, err := d.Deadline.LoadPartition(d.store, idx)
|
||||
if err != nil {
|
||||
@ -443,3 +490,7 @@ func fromV3SectorPreCommitOnChainInfo(v3 miner3.SectorPreCommitOnChainInfo) Sect
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *state3) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -32,6 +32,12 @@ func load4(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make4(store adt.Store) (State, error) {
|
||||
out := state4{store: store}
|
||||
out.State = miner4.State{}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state4 struct {
|
||||
miner4.State
|
||||
store adt.Store
|
||||
@ -242,6 +248,10 @@ func (s *state4) IsAllocated(num abi.SectorNumber) (bool, error) {
|
||||
return allocatedSectors.IsSet(uint64(num))
|
||||
}
|
||||
|
||||
func (s *state4) GetProvingPeriodStart() (abi.ChainEpoch, error) {
|
||||
return s.State.ProvingPeriodStart, nil
|
||||
}
|
||||
|
||||
func (s *state4) LoadDeadline(idx uint64) (Deadline, error) {
|
||||
dls, err := s.State.LoadDeadlines(s.store)
|
||||
if err != nil {
|
||||
@ -358,6 +368,43 @@ func (s *state4) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreC
|
||||
return fromV4SectorPreCommitOnChainInfo(sp), nil
|
||||
}
|
||||
|
||||
func (s *state4) EraseAllUnproven() error {
|
||||
|
||||
dls, err := s.State.LoadDeadlines(s.store)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = dls.ForEach(s.store, func(dindx uint64, dl *miner4.Deadline) error {
|
||||
ps, err := dl.PartitionsArray(s.store)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var part miner4.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)
|
||||
})
|
||||
|
||||
return s.State.SaveDeadlines(s.store, dls)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *deadline4) LoadPartition(idx uint64) (Partition, error) {
|
||||
p, err := d.Deadline.LoadPartition(d.store, idx)
|
||||
if err != nil {
|
||||
@ -443,3 +490,7 @@ func fromV4SectorPreCommitOnChainInfo(v4 miner4.SectorPreCommitOnChainInfo) Sect
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *state4) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -32,6 +32,12 @@ func load5(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make5(store adt.Store) (State, error) {
|
||||
out := state5{store: store}
|
||||
out.State = miner5.State{}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state5 struct {
|
||||
miner5.State
|
||||
store adt.Store
|
||||
@ -242,6 +248,10 @@ func (s *state5) IsAllocated(num abi.SectorNumber) (bool, error) {
|
||||
return allocatedSectors.IsSet(uint64(num))
|
||||
}
|
||||
|
||||
func (s *state5) GetProvingPeriodStart() (abi.ChainEpoch, error) {
|
||||
return s.State.ProvingPeriodStart, nil
|
||||
}
|
||||
|
||||
func (s *state5) LoadDeadline(idx uint64) (Deadline, error) {
|
||||
dls, err := s.State.LoadDeadlines(s.store)
|
||||
if err != nil {
|
||||
@ -358,6 +368,43 @@ func (s *state5) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreC
|
||||
return fromV5SectorPreCommitOnChainInfo(sp), nil
|
||||
}
|
||||
|
||||
func (s *state5) EraseAllUnproven() error {
|
||||
|
||||
dls, err := s.State.LoadDeadlines(s.store)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = dls.ForEach(s.store, func(dindx uint64, dl *miner5.Deadline) error {
|
||||
ps, err := dl.PartitionsArray(s.store)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var part miner5.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)
|
||||
})
|
||||
|
||||
return s.State.SaveDeadlines(s.store, dls)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *deadline5) LoadPartition(idx uint64) (Partition, error) {
|
||||
p, err := d.Deadline.LoadPartition(d.store, idx)
|
||||
if err != nil {
|
||||
@ -443,3 +490,7 @@ func fromV5SectorPreCommitOnChainInfo(v5 miner5.SectorPreCommitOnChainInfo) Sect
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *state5) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -41,6 +41,27 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||
}
|
||||
|
||||
func MakeState(store adt.Store, av actors.Version, signers []address.Address, threshold uint64, startEpoch abi.ChainEpoch, unlockDuration abi.ChainEpoch, initialBalance abi.TokenAmount) (State, error) {
|
||||
switch av {
|
||||
{{range .versions}}
|
||||
case actors.Version{{.}}:
|
||||
return make{{.}}(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
|
||||
{{end}}
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||
switch av {
|
||||
{{range .versions}}
|
||||
case actors.Version{{.}}:
|
||||
return builtin{{.}}.MultisigActorCodeID, nil
|
||||
{{end}}
|
||||
}
|
||||
|
||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
@ -56,6 +77,7 @@ type State interface {
|
||||
|
||||
transactions() (adt.Map, error)
|
||||
decodeTransaction(val *cbg.Deferred) (Transaction, error)
|
||||
GetState() interface{}
|
||||
}
|
||||
|
||||
type Transaction = msig0.Transaction
|
||||
|
@ -76,6 +76,51 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||
}
|
||||
|
||||
func MakeState(store adt.Store, av actors.Version, signers []address.Address, threshold uint64, startEpoch abi.ChainEpoch, unlockDuration abi.ChainEpoch, initialBalance abi.TokenAmount) (State, error) {
|
||||
switch av {
|
||||
|
||||
case actors.Version0:
|
||||
return make0(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
|
||||
|
||||
case actors.Version2:
|
||||
return make2(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
|
||||
|
||||
case actors.Version3:
|
||||
return make3(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
|
||||
|
||||
case actors.Version4:
|
||||
return make4(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
|
||||
|
||||
case actors.Version5:
|
||||
return make5(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
|
||||
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||
switch av {
|
||||
|
||||
case actors.Version0:
|
||||
return builtin0.MultisigActorCodeID, nil
|
||||
|
||||
case actors.Version2:
|
||||
return builtin2.MultisigActorCodeID, nil
|
||||
|
||||
case actors.Version3:
|
||||
return builtin3.MultisigActorCodeID, nil
|
||||
|
||||
case actors.Version4:
|
||||
return builtin4.MultisigActorCodeID, nil
|
||||
|
||||
case actors.Version5:
|
||||
return builtin5.MultisigActorCodeID, nil
|
||||
|
||||
}
|
||||
|
||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
@ -91,6 +136,7 @@ type State interface {
|
||||
|
||||
transactions() (adt.Map, error)
|
||||
decodeTransaction(val *cbg.Deferred) (Transaction, error)
|
||||
GetState() interface{}
|
||||
}
|
||||
|
||||
type Transaction = msig0.Transaction
|
||||
|
@ -31,6 +31,32 @@ func load{{.v}}(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make{{.v}}(store adt.Store, signers []address.Address, threshold uint64, startEpoch abi.ChainEpoch, unlockDuration abi.ChainEpoch, initialBalance abi.TokenAmount) (State, error) {
|
||||
out := state{{.v}}{store: store}
|
||||
out.State = msig{{.v}}.State{}
|
||||
out.State.Signers = signers
|
||||
out.State.NumApprovalsThreshold = threshold
|
||||
out.State.StartEpoch = startEpoch
|
||||
out.State.UnlockDuration = unlockDuration
|
||||
out.State.InitialBalance = initialBalance
|
||||
{{if (le .v 2)}}
|
||||
em, err := adt{{.v}}.MakeEmptyMap(store).Root()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State.PendingTxns = em
|
||||
{{else}}
|
||||
em, err := adt{{.v}}.StoreEmptyMap(store, builtin{{.v}}.DefaultHamtBitwidth)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State.PendingTxns = em
|
||||
{{end}}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state{{.v}} struct {
|
||||
msig{{.v}}.State
|
||||
store adt.Store
|
||||
@ -95,3 +121,7 @@ func (s *state{{.v}}) decodeTransaction(val *cbg.Deferred) (Transaction, error)
|
||||
}
|
||||
return tx, nil
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -28,6 +28,25 @@ func load0(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make0(store adt.Store, signers []address.Address, threshold uint64, startEpoch abi.ChainEpoch, unlockDuration abi.ChainEpoch, initialBalance abi.TokenAmount) (State, error) {
|
||||
out := state0{store: store}
|
||||
out.State = msig0.State{}
|
||||
out.State.Signers = signers
|
||||
out.State.NumApprovalsThreshold = threshold
|
||||
out.State.StartEpoch = startEpoch
|
||||
out.State.UnlockDuration = unlockDuration
|
||||
out.State.InitialBalance = initialBalance
|
||||
|
||||
em, err := adt0.MakeEmptyMap(store).Root()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State.PendingTxns = em
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state0 struct {
|
||||
msig0.State
|
||||
store adt.Store
|
||||
@ -92,3 +111,7 @@ func (s *state0) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
||||
}
|
||||
return tx, nil
|
||||
}
|
||||
|
||||
func (s *state0) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -28,6 +28,25 @@ func load2(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make2(store adt.Store, signers []address.Address, threshold uint64, startEpoch abi.ChainEpoch, unlockDuration abi.ChainEpoch, initialBalance abi.TokenAmount) (State, error) {
|
||||
out := state2{store: store}
|
||||
out.State = msig2.State{}
|
||||
out.State.Signers = signers
|
||||
out.State.NumApprovalsThreshold = threshold
|
||||
out.State.StartEpoch = startEpoch
|
||||
out.State.UnlockDuration = unlockDuration
|
||||
out.State.InitialBalance = initialBalance
|
||||
|
||||
em, err := adt2.MakeEmptyMap(store).Root()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State.PendingTxns = em
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state2 struct {
|
||||
msig2.State
|
||||
store adt.Store
|
||||
@ -92,3 +111,7 @@ func (s *state2) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
||||
}
|
||||
return tx, nil
|
||||
}
|
||||
|
||||
func (s *state2) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -30,6 +30,25 @@ func load3(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make3(store adt.Store, signers []address.Address, threshold uint64, startEpoch abi.ChainEpoch, unlockDuration abi.ChainEpoch, initialBalance abi.TokenAmount) (State, error) {
|
||||
out := state3{store: store}
|
||||
out.State = msig3.State{}
|
||||
out.State.Signers = signers
|
||||
out.State.NumApprovalsThreshold = threshold
|
||||
out.State.StartEpoch = startEpoch
|
||||
out.State.UnlockDuration = unlockDuration
|
||||
out.State.InitialBalance = initialBalance
|
||||
|
||||
em, err := adt3.StoreEmptyMap(store, builtin3.DefaultHamtBitwidth)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State.PendingTxns = em
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state3 struct {
|
||||
msig3.State
|
||||
store adt.Store
|
||||
@ -94,3 +113,7 @@ func (s *state3) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
||||
}
|
||||
return tx, nil
|
||||
}
|
||||
|
||||
func (s *state3) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -30,6 +30,25 @@ func load4(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make4(store adt.Store, signers []address.Address, threshold uint64, startEpoch abi.ChainEpoch, unlockDuration abi.ChainEpoch, initialBalance abi.TokenAmount) (State, error) {
|
||||
out := state4{store: store}
|
||||
out.State = msig4.State{}
|
||||
out.State.Signers = signers
|
||||
out.State.NumApprovalsThreshold = threshold
|
||||
out.State.StartEpoch = startEpoch
|
||||
out.State.UnlockDuration = unlockDuration
|
||||
out.State.InitialBalance = initialBalance
|
||||
|
||||
em, err := adt4.StoreEmptyMap(store, builtin4.DefaultHamtBitwidth)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State.PendingTxns = em
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state4 struct {
|
||||
msig4.State
|
||||
store adt.Store
|
||||
@ -94,3 +113,7 @@ func (s *state4) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
||||
}
|
||||
return tx, nil
|
||||
}
|
||||
|
||||
func (s *state4) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -30,6 +30,25 @@ func load5(store adt.Store, root cid.Cid) (State, error) {
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make5(store adt.Store, signers []address.Address, threshold uint64, startEpoch abi.ChainEpoch, unlockDuration abi.ChainEpoch, initialBalance abi.TokenAmount) (State, error) {
|
||||
out := state5{store: store}
|
||||
out.State = msig5.State{}
|
||||
out.State.Signers = signers
|
||||
out.State.NumApprovalsThreshold = threshold
|
||||
out.State.StartEpoch = startEpoch
|
||||
out.State.UnlockDuration = unlockDuration
|
||||
out.State.InitialBalance = initialBalance
|
||||
|
||||
em, err := adt5.StoreEmptyMap(store, builtin5.DefaultHamtBitwidth)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State.PendingTxns = em
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state5 struct {
|
||||
msig5.State
|
||||
store adt.Store
|
||||
@ -94,3 +113,7 @@ func (s *state5) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
||||
}
|
||||
return tx, nil
|
||||
}
|
||||
|
||||
func (s *state5) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
@ -42,6 +42,27 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||
}
|
||||
|
||||
func MakeState(store adt.Store, av actors.Version) (State, error) {
|
||||
switch av {
|
||||
{{range .versions}}
|
||||
case actors.Version{{.}}:
|
||||
return make{{.}}(store)
|
||||
{{end}}
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||
switch av {
|
||||
{{range .versions}}
|
||||
case actors.Version{{.}}:
|
||||
return builtin{{.}}.PaymentChannelActorCodeID, nil
|
||||
{{end}}
|
||||
}
|
||||
|
||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
// State is an abstract version of payment channel state that works across
|
||||
// versions
|
||||
type State interface {
|
||||
@ -62,6 +83,8 @@ type State interface {
|
||||
|
||||
// Iterate lane states
|
||||
ForEachLaneState(cb func(idx uint64, dl LaneState) error) error
|
||||
|
||||
GetState() interface{}
|
||||
}
|
||||
|
||||
// LaneState is an abstract copy of the state of a single lane
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user