diff --git a/.circleci/config.yml b/.circleci/config.yml index 259fd4ee3..ce4a4f3bb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -34,6 +34,10 @@ commands: default: false description: is a darwin build environment? type: boolean + darwin-architecture: + default: "amd64" + description: which darwin architecture is being used? + type: string steps: - checkout - git_fetch_all_tags @@ -59,7 +63,7 @@ commands: - run: name: Install Go command: | - curl https://dl.google.com/go/go`cat GO_VERSION_MIN`.darwin-amd64.pkg -o /tmp/go.pkg && \ + curl https://dl.google.com/go/go`cat GO_VERSION_MIN`.darwin-<>.pkg -o /tmp/go.pkg && \ sudo installer -pkg /tmp/go.pkg -target / - run: name: Export Go @@ -276,7 +280,9 @@ jobs: - prepare: linux: false darwin: true + darwin-architecture: amd64 - run: make lotus lotus-miner lotus-worker + - run: otool -hv lotus - run: name: check tag and version output match command: ./scripts/version-check.sh ./lotus @@ -298,10 +304,12 @@ jobs: - prepare: linux: false darwin: true + darwin-architecture: arm64 - run: | export CPATH=$(brew --prefix)/include export LIBRARY_PATH=$(brew --prefix)/lib make lotus lotus-miner lotus-worker + - run: otool -hv lotus - run: name: check tag and version output match command: ./scripts/version-check.sh ./lotus @@ -586,10 +594,14 @@ jobs: - run: name: Docker push command: | - echo docker push filecoin/<>:<> + docker push filecoin/<>:<> + if [[ ! -z $CIRCLE_SHA ]]; then + docker image tag filecoin/<>:<>> filecoin/<>:"${CIRCLE_SHA:0:7}" + docker push filecoin/<>:"${CIRCLE_SHA:0:7}" + fi if [[ ! -z $CIRCLE_TAG ]]; then docker image tag filecoin/<>:<> filecoin/<>:"${CIRCLE_TAG}" - echo docker push filecoin/<>:"${CIRCLE_TAG}" + docker push filecoin/<>:"${CIRCLE_TAG}" fi - unless: condition: <> @@ -612,10 +624,14 @@ jobs: - run: name: Docker push command: | - echo docker push filecoin/<>:<>-<> + docker push filecoin/<>:<>-<> + if [[ ! -z $CIRCLE_SHA ]]; then + docker image tag filecoin/<>:<>-<> filecoin/<>:"${CIRCLE_SHA:0:7}"-<> + docker push filecoin/<>:"${CIRCLE_SHA:0:7}"-<> + fi if [[ ! -z $CIRCLE_TAG ]]; then docker image tag filecoin/<>:<>-<> filecoin/<>:"${CIRCLE_TAG}"-<> - echo docker push filecoin/<>:"${CIRCLE_TAG}"-<> + docker push filecoin/<>:"${CIRCLE_TAG}"-<> fi - unless: condition: <> @@ -752,12 +768,17 @@ workflows: name: test-itest-eth_filter suite: itest-eth_filter target: "./itests/eth_filter_test.go" - + - test: name: test-itest-fevm_events suite: itest-fevm_events target: "./itests/fevm_events_test.go" - + + - test: + name: test-itest-eth_account_abstraction + suite: itest-eth_account_abstraction + target: "./itests/eth_account_abstraction_test.go" + - test: name: test-itest-fevm suite: itest-fevm @@ -1147,6 +1168,16 @@ workflows: tags: only: - /^v\d+\.\d+\.\d+-rc\d+$/ + - build-docker: + name: "Docker push (lotus-all-in-one / edge / mainnet)" + image: lotus-all-in-one + channel: master + network: mainnet + push: true + filters: + branches: + only: + - master - build-docker: name: "Docker build (lotus-all-in-one / mainnet)" image: lotus-all-in-one @@ -1182,6 +1213,16 @@ workflows: tags: only: - /^v\d+\.\d+\.\d+-rc\d+$/ + - build-docker: + name: "Docker push (lotus-all-in-one / edge / butterflynet)" + image: lotus-all-in-one + channel: master + network: butterflynet + push: true + filters: + branches: + only: + - master - build-docker: name: "Docker build (lotus-all-in-one / butterflynet)" image: lotus-all-in-one @@ -1217,6 +1258,16 @@ workflows: tags: only: - /^v\d+\.\d+\.\d+-rc\d+$/ + - build-docker: + name: "Docker push (lotus-all-in-one / edge / calibnet)" + image: lotus-all-in-one + channel: master + network: calibnet + push: true + filters: + branches: + only: + - master - build-docker: name: "Docker build (lotus-all-in-one / calibnet)" image: lotus-all-in-one @@ -1252,6 +1303,16 @@ workflows: tags: only: - /^v\d+\.\d+\.\d+-rc\d+$/ + - build-docker: + name: "Docker push (lotus-all-in-one / edge / debug)" + image: lotus-all-in-one + channel: master + network: debug + push: true + filters: + branches: + only: + - master - build-docker: name: "Docker build (lotus-all-in-one / debug)" image: lotus-all-in-one @@ -1261,6 +1322,51 @@ workflows: branches: only: - /^release\/v\d+\.\d+\.\d+(-rc\d+)?$/ + - build-docker: + name: "Docker push (lotus / stable / mainnet)" + image: lotus + channel: stable + network: mainnet + push: true + filters: + branches: + ignore: + - /.*/ + tags: + only: + - /^v\d+\.\d+\.\d+$/ + - build-docker: + name: "Docker push (lotus / candidate / mainnet)" + image: lotus + channel: candidate + network: mainnet + push: true + filters: + branches: + ignore: + - /.*/ + tags: + only: + - /^v\d+\.\d+\.\d+-rc\d+$/ + - build-docker: + name: "Docker push (lotus / master / mainnet)" + image: lotus + channel: master + network: mainnet + push: true + filters: + branches: + only: + - master + - build-docker: + name: "Docker build (lotus / mainnet)" + image: lotus + network: mainnet + push: false + filters: + branches: + only: + - /^release\/v\d+\.\d+\.\d+(-rc\d+)?$/ nightly: triggers: diff --git a/.circleci/template.yml b/.circleci/template.yml index 3127f253c..f56950faf 100644 --- a/.circleci/template.yml +++ b/.circleci/template.yml @@ -34,6 +34,10 @@ commands: default: false description: is a darwin build environment? type: boolean + darwin-architecture: + default: "amd64" + description: which darwin architecture is being used? + type: string steps: - checkout - git_fetch_all_tags @@ -59,7 +63,7 @@ commands: - run: name: Install Go command: | - curl https://dl.google.com/go/go`cat GO_VERSION_MIN`.darwin-amd64.pkg -o /tmp/go.pkg && \ + curl https://dl.google.com/go/go`cat GO_VERSION_MIN`.darwin-<>.pkg -o /tmp/go.pkg && \ sudo installer -pkg /tmp/go.pkg -target / - run: name: Export Go @@ -276,7 +280,9 @@ jobs: - prepare: linux: false darwin: true + darwin-architecture: amd64 - run: make lotus lotus-miner lotus-worker + - run: otool -hv lotus - run: name: check tag and version output match command: ./scripts/version-check.sh ./lotus @@ -298,10 +304,12 @@ jobs: - prepare: linux: false darwin: true + darwin-architecture: arm64 - run: | export CPATH=$(brew --prefix)/include export LIBRARY_PATH=$(brew --prefix)/lib make lotus lotus-miner lotus-worker + - run: otool -hv lotus - run: name: check tag and version output match command: ./scripts/version-check.sh ./lotus @@ -586,10 +594,14 @@ jobs: - run: name: Docker push command: | - echo docker push filecoin/<>:<> + docker push filecoin/<>:<> + if [["[[ ! -z $CIRCLE_SHA ]]"]]; then + docker image tag filecoin/<>:<>> filecoin/<>:"${CIRCLE_SHA:0:7}" + docker push filecoin/<>:"${CIRCLE_SHA:0:7}" + fi if [["[[ ! -z $CIRCLE_TAG ]]"]]; then docker image tag filecoin/<>:<> filecoin/<>:"${CIRCLE_TAG}" - echo docker push filecoin/<>:"${CIRCLE_TAG}" + docker push filecoin/<>:"${CIRCLE_TAG}" fi - unless: condition: <> @@ -612,10 +624,14 @@ jobs: - run: name: Docker push command: | - echo docker push filecoin/<>:<>-<> + docker push filecoin/<>:<>-<> + if [["[[ ! -z $CIRCLE_SHA ]]"]]; then + docker image tag filecoin/<>:<>-<> filecoin/<>:"${CIRCLE_SHA:0:7}"-<> + docker push filecoin/<>:"${CIRCLE_SHA:0:7}"-<> + fi if [["[[ ! -z $CIRCLE_TAG ]]"]]; then docker image tag filecoin/<>:<>-<> filecoin/<>:"${CIRCLE_TAG}"-<> - echo docker push filecoin/<>:"${CIRCLE_TAG}"-<> + docker push filecoin/<>:"${CIRCLE_TAG}"-<> fi - unless: condition: <> @@ -798,6 +814,16 @@ workflows: tags: only: - /^v\d+\.\d+\.\d+-rc\d+$/ + - build-docker: + name: "Docker push (lotus-all-in-one / edge / [[.]])" + image: lotus-all-in-one + channel: master + network: [[.]] + push: true + filters: + branches: + only: + - master - build-docker: name: "Docker build (lotus-all-in-one / [[.]])" image: lotus-all-in-one @@ -808,6 +834,51 @@ workflows: only: - /^release\/v\d+\.\d+\.\d+(-rc\d+)?$/ [[- end]] + - build-docker: + name: "Docker push (lotus / stable / mainnet)" + image: lotus + channel: stable + network: mainnet + push: true + filters: + branches: + ignore: + - /.*/ + tags: + only: + - /^v\d+\.\d+\.\d+$/ + - build-docker: + name: "Docker push (lotus / candidate / mainnet)" + image: lotus + channel: candidate + network: mainnet + push: true + filters: + branches: + ignore: + - /.*/ + tags: + only: + - /^v\d+\.\d+\.\d+-rc\d+$/ + - build-docker: + name: "Docker push (lotus / master / mainnet)" + image: lotus + channel: master + network: mainnet + push: true + filters: + branches: + only: + - master + - build-docker: + name: "Docker build (lotus / mainnet)" + image: lotus + network: mainnet + push: false + filters: + branches: + only: + - /^release\/v\d+\.\d+\.\d+(-rc\d+)?$/ nightly: triggers: diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 021945acf..766f4f30a 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -65,6 +65,7 @@ archives: - id: primary format: tar.gz wrap_in_directory: true + name_template: "{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}" files: # this is a dumb but required hack so it doesn't include the default files # https://github.com/goreleaser/goreleaser/issues/602 @@ -75,7 +76,7 @@ release: owner: filecoin-project name: lotus prerelease: auto - name_template: "Release v{{.Version}}" + name_template: "v{{.Version}}" brews: - tap: @@ -105,4 +106,4 @@ checksum: disable: true snapshot: - name_template: "{{ .Tag }}" + name_template: "{{ .Version }}" diff --git a/CHANGELOG.md b/CHANGELOG.md index 622de475a..cd450afd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,176 @@ # Lotus changelog +# 1.19.0 / 2022-12-07 + +This is an optional feature release of Lotus. This feature release includes the SplitStore beta, the experimental Lotus node cluster feature, as well as numerous enhancments and bugfixes. + +## Highlights +### 🟢 SplitStore v2(Beta) 🟢 + +Splitstore aims to reduce the node performance impact that's caused by the Filecoin's very large, and continuously growing chain datastore by having a hot and cold blockstore. You can find more about the Splitstore implementation [here](https://github.com/filecoin-project/lotus/blob/master/blockstore/splitstore/README.md). +Splitstore has three basic modes for node operators to configure according to your needs: +- `discard`: hotstore only, automatically archive out-of-scope objects that are beyond 4 finalities(3600 epochs). +- `universal`: stores all chain data that's beyond 4 finalities into coldstore. +- `messages`: only stores on-chain messages into coldstore. + +The `EnableColdStoreAutoPrune=` configuration is being deprecated in this release, as there is only ever one compaction running. We welcome all node operators to try the new feature and let us know [here](https://github.com/filecoin-project/lotus/discussions/9179) if you have any feedback! +There are more configuration one may set, you can read the full documentation about the SplitStoreV2 here: https://lotus.filecoin.io/lotus/configure/splitstore/. + +### 🧪 Node Cluster (*EXPERIMENTAL.*) 🧪 +The Lotus HA node cluster feature allows you to run multiple Lotus daemons for the same lotus-miner increasing resiliency. We welcome all Lotus users to join the early testing for this feature and provide your feedback. Please note that this feature is targeted towards more enterprise users of Lotus and requires at least 3 lotus nodes to be set up in a cluster. +Check out the documentation here: https://lotus.filecoin.io/lotus/configure/clusters/ + +### ⭐️ SnapDeals Enhancements ⭐️ +Numerous SnapDeals related improvements and fixes made it into this release before the code freeze. Some the highlights of the issues that has been fixed in this feature release are: + +- *Unable to snap-up a sector again if something went wrong.* - This has now been fixed ✅ +- *Error messages on loop during an open deadline.* - This has now been fixed ✅ + +## New features +- feat:splitstore:single compaction that can handle prune aka two marksets one compaction (#9571) ([filecoin-project/lotus#9571](https://github.com/filecoin-project/lotus/pull/9571)) + - Introduces a new SplitStore-mode, `messages`, which will only store on-chain messages. Fixes previously issues with regards to `AutoPrune` not compacting the coldstore. [Link to documentation](https://lotus.filecoin.io/lotus/configure/splitstore/) +- feat: Raft consensus for lotus nodes in a cluster ([filecoin-project/lotus#9294](https://github.com/filecoin-project/lotus/pull/9294)) + - Adds the experimental node cluster feature. +- feat: storage: Force exit GenerateSingleVanillaProof on cancelled context ([filecoin-project/lotus#9613](https://github.com/filecoin-project/lotus/pull/9613)) + - `GenerateSingleVanillaProof` now respects context, which means that it will skip slow to read sectors :snail: and return a context error. Instead of being blocked forever if storage reads where blocked (e.g disconnected NFS). +- feat: wdpost: Configurable pre-check timeouts ([filecoin-project/lotus#9680](https://github.com/filecoin-project/lotus/pull/9680)) + - Adds configuration knobs for setting custom amount of time a proving pre-check can take before a sector and partition will be skipped. [Link to documentation](https://lotus.filecoin.io/storage-providers/advanced-configurations/proving/#pre-check-sector-timeout) +- feat: chain: future proof the from & to address protocols ([filecoin-project/lotus#9515](https://github.com/filecoin-project/lotus/pull/9515)) + - This lets us add new address protocols to go-address without implicitly accepting them in messages on the network. +- feat: Retrieval into remote blockstores ([filecoin-project/lotus#9565](https://github.com/filecoin-project/lotus/pull/9565)) + - Makes it possible to point retrievals at a network-backed blockstore. +- feat: Add node uptime rpc / output in info command ([filecoin-project/lotus#9436](https://github.com/filecoin-project/lotus/pull/9436)) + - Adds node uptime stats to the `lotus-miner info` and `lotus info` commands +- feat: wdpost: Add ability to only have single partition per msg for partitions with… ([filecoin-project/lotus#9413](https://github.com/filecoin-project/lotus/pull/9413)) + - Adds a configuration option to have a single partition per PoSt Message for partitions containing recovering sectors. +- feat: miner paramfetch: Don't fetch param files when not needed ([filecoin-project/lotus#9391](https://github.com/filecoin-project/lotus/pull/9391)) + - A Lotus-Miner processes that has disabled local PoSt / C2 / PR2 does not need the param-files. This makes node startup much faster, reducing downtime by a lot when restarts are needed. +- feat: client: Add retrieval deal ID and bytes transferred to retrieval output ([filecoin-project/lotus#9398](https://github.com/filecoin-project/lotus/pull/9398)) + - Appends retrieval deal ID and bytes transferred to the retrieval output. +- feat: dealpublisher: check for duplicate deals before adding ([filecoin-project/lotus#9365](https://github.com/filecoin-project/lotus/pull/9365)) +- feat: Drop active retrieval check (#764) ([filecoin-project/go-fil-markets#764](https://github.com/filecoin-project/go-fil-markets/pull/764)) +- feat(retrievalmarkets): expose GetDynamicAsk (#748) ([filecoin-project/go-fil-markets#748](https://github.com/filecoin-project/go-fil-markets/pull/748)) +- feat: handle retrieval queries for unindexed identity payload CIDs (#747) ([filecoin-project/go-fil-markets#747](https://github.com/filecoin-project/go-fil-markets/pull/747)) +- feat: add a method for validating an address for a network version (#115) ([filecoin-project/go-state-types#115](https://github.com/filecoin-project/go-state-types/pull/115)) + +## Improvements +- fix: miner-cli: Fix lotus-miner proving check ([filecoin-project/lotus#9643](https://github.com/filecoin-project/lotus/pull/9643)) + - Fixes the issue where the `lotus-miner proving check` command always outputted `Error: rg is nil` +- fix: sealing pipeline: Clear CreationTime when starting sector upgrade ([filecoin-project/lotus#9642](https://github.com/filecoin-project/lotus/pull/9642)) + - Fixes the issue where an aborted SnapDeal upgrade could no longer be retried with SnapDeals. +- fix:sealing-fsm:wait mutable fsm state for immutable sector upgrade error ([filecoin-project/lotus#9598](https://github.com/filecoin-project/lotus/pull/9598)) + - Creating a new WaitMutable state - now if the deadline is open and the sectors are trying finalize they will wait on the worker until the deadline has closed. Important to note that they will not finalize as soon as the deadline closes, they will wait 1h before continuing. Fixes the previous issue where upgraded Snap-sectors for an open deadline cause a lot of `error-messages` and `p_aux` issues +- fix: cli: add beneficiary info to lotus-miner actor control list ([filecoin-project/lotus#9632](https://github.com/filecoin-project/lotus/pull/9632)) + - Adds the beneficiary address to the `lotus-miner actor control list` output. +- fix: sealing pipeine: Release assigned deals on snapdeals abort ([filecoin-project/lotus#9601](https://github.com/filecoin-project/lotus/pull/9601)) +- fix: docker: make compatible with arm platform ([filecoin-project/lotus#9363](https://github.com/filecoin-project/lotus/pull/9363)) + - Makes the `Dockerfile.lotus` compatible with ARM-platforms (e.g Mac M1). +- fix: post worker sched: Don't check worker session in a busy loop ([filecoin-project/lotus#9495](https://github.com/filecoin-project/lotus/pull/9495)) + - Fixes a looping pattern which could result in a flood of requests between `lotus-miner`<->`lotus-worker`, potentially exhausting resources needed to make http requests, that lead to all sorts of random RPC-related issues. +- fix: miner: init miner's with 32GiB sectors by default ([filecoin-project/lotus#9364](https://github.com/filecoin-project/lotus/pull/9364)) + - Makes the `lotus-miner init` defualt to 32GiB sectors. +- fix: store identity CIDs in CARs for online deals (#749) ([filecoin-project/go-fil-markets#749](https://github.com/filecoin-project/go-fil-markets/pull/749)) +- fix: cliutil: Fix URL-based API endpoint parsing + +## Dependencies +- deps: upgrade go-merkledag to 0.8.1 (#9717) +- deps: Update go-fil-markets to v1.25.0 ([filecoin-project/lotus#9633](https://github.com/filecoin-project/lotus/pull/9633)) +- deps: upgrade go-merkledag to 0.8.0 ([filecoin-project/lotus#9455](https://github.com/filecoin-project/lotus/pull/9455)) + +## Others +- fix/build: Update Zondax/hid to 0.9.1 +- refactor: sealing: minor refactor of FinalizeReplicaUpdate ([filecoin-project/lotus#9614](https://github.com/filecoin-project/lotus/pull/9614)) +- update ffi to 280c4f8b94fd46dc (#9608) ([filecoin-project/lotus#9608](https://github.com/filecoin-project/lotus/pull/9608)) +- fix: tvx: make it work with the FVM ([filecoin-project/lotus#9604](https://github.com/filecoin-project/lotus/pull/9604)) +- fix: autobatch: remove potential deadlock when a block is missing ([filecoin-project/lotus#9602](https://github.com/filecoin-project/lotus/pull/9602)) +- feat: shed: set control address: add dump bytes option ([filecoin-project/lotus#9572](https://github.com/filecoin-project/lotus/pull/9572)) +- feat: shed: Online export-car ([filecoin-project/lotus#9590](https://github.com/filecoin-project/lotus/pull/9590)) +- fix: chain: Update chain.go ([filecoin-project/lotus#9373](https://github.com/filecoin-project/lotus/pull/9373)) +- fix: fvm: Allow setting local bundles for Debug FVM for av 9+ ([filecoin-project/lotus#9509](https://github.com/filecoin-project/lotus/pull/9509)) +- fix: ux: Add outputs to wallet commands ([filecoin-project/lotus#9416](https://github.com/filecoin-project/lotus/pull/9416)) +- fix: ux: specify arg in `net ping` cmd ([filecoin-project/lotus#9459](https://github.com/filecoin-project/lotus/pull/9459)) +- fix: cli: renew --only-cc with sectorfile ([filecoin-project/lotus#9402](https://github.com/filecoin-project/lotus/pull/9402)) +- fix: bstore: Handle codecs correctly in membstore Get ([filecoin-project/lotus#9471](https://github.com/filecoin-project/lotus/pull/9471)) +- fix: not multiplied by the number of seconds ([filecoin-project/lotus#9460](https://github.com/filecoin-project/lotus/pull/9460)) +- Makefile: Drop rarely used binaries from build-devnets (#9513) ([filecoin-project/lotus#9513](https://github.com/filecoin-project/lotus/pull/9513)) +- _ci_ Remove unneeded homebrew deps ([filecoin-project/lotus#9559](https://github.com/filecoin-project/lotus/pull/9559)) +- _ci_: Have apt-get wait until it can get a lock in packer builds ([filecoin-project/lotus#9534](https://github.com/filecoin-project/lotus/pull/9534)) +- _ci_ Appimage go1.18.1 fix ([filecoin-project/lotus#9496](https://github.com/filecoin-project/lotus/pull/9496)) +- _ci_: Fix failing Digital Ocean and Amazon Machine Image release process ([filecoin-project/lotus#9425](https://github.com/filecoin-project/lotus/pull/9425)) +- _ci_: Don't publish new homebrew releases for RC builds ([filecoin-project/lotus#9350](https://github.com/filecoin-project/lotus/pull/9350)) +- _ci_: Use golang 1.18.1 to build appimage ([filecoin-project/lotus#9386](https://github.com/filecoin-project/lotus/pull/9386)) +- _ci_ Refactor release pipeline to better support m1 builds ([filecoin-project/lotus#9600](https://github.com/filecoin-project/lotus/pull/9600)) +- _ci_: Rely on local env varibale instead of context ([filecoin-project/lotus#9740](https://github.com/filecoin-project/lotus/pull/9740)) +- feat: shed: FIP0036 post poll result processing ([filecoin-project/lotus#9387](https://github.com/filecoin-project/lotus/pull/9387)) +- misc: github: Cleanup PR template ([filecoin-project/lotus#9472](https://github.com/filecoin-project/lotus/pull/9472)) +- docs: release template: Mention codegen in release prep ([filecoin-project/lotus#9430](https://github.com/filecoin-project/lotus/pull/9430)) +- chore: merge releases (v1.17.2) into master ([filecoin-project/lotus#9433](https://github.com/filecoin-project/lotus/pull/9433)) +- chore: merge release/v1.18.0 into master ([filecoin-project/lotus#9597](https://github.com/filecoin-project/lotus/pull/9597)) +- chore:shed: Teach shed/sim to understand --tipset=@nnn notation ([filecoin-project/lotus#9434](https://github.com/filecoin-project/lotus/pull/9434)) +- _chore_: Upgrade `hid` ([filecoin-project/lotus#9406](https://github.com/filecoin-project/lotus/pull/9406)) +- chore: release: Update `release_issue_template` ([filecoin-project/lotus#9150](https://github.com/filecoin-project/lotus/pull/9150)) +- chore: update lotus version to 1.19.0-rc1 +- chore: merge release into master ([filecoin-project/lotus#9657](https://github.com/filecoin-project/lotus/pull/9657)) +- Backport: #9061 rpc errors ([filecoin-project/lotus#9384](https://github.com/filecoin-project/lotus/pull/9384)) +- shed: util: get all msig ([filecoin-project/lotus#9322](https://github.com/filecoin-project/lotus/pull/9322)) +- fix: test: simplify TestDeadlineToggling ([filecoin-project/lotus#9356](https://github.com/filecoin-project/lotus/pull/9356)) +- fix: build: set PropagationDelaySecs correctly ([filecoin-project/lotus#9358](https://github.com/filecoin-project/lotus/pull/9358)) +- fix: test: flaky TestDeadlineToggling around nulls (#9354) ([filecoin-project/lotus#9354](https://github.com/filecoin-project/lotus/pull/9354)) +- fix: retrievals: price-per-byte calculation fix ([filecoin-project/lotus#9353](https://github.com/filecoin-project/lotus/pull/9353)) +- fix: docs: update Go-badge in readme ([filecoin-project/lotus#9347](https://github.com/filecoin-project/lotus/pull/9347)) +- docs: release template: clarify location of version.go ([filecoin-project/lotus#9338](https://github.com/filecoin-project/lotus/pull/9338)) +- build: Bump version to v1.17.3-dev ([filecoin-project/lotus#9337](https://github.com/filecoin-project/lotus/pull/9337)) +- github.com/filecoin-project/go-fil-markets (v1.24.0-v17 -> v1.25.0): +- Merge branch 'release/v1.24.3' +- Update ffi and update markets to v9 (#751) (#761) ([filecoin-project/go-fil-markets#761](https://github.com/filecoin-project/go-fil-markets/pull/761)) +- chore: extract Provider piece logic to separate file (#750) ([filecoin-project/go-fil-markets#750](https://github.com/filecoin-project/go-fil-markets/pull/750)) +- Merge branch 'release/v1.24.2' +- Feat/support custom metadata (#759) ([filecoin-project/go-fil-markets#759](https://github.com/filecoin-project/go-fil-markets/pull/759)) +- Revert "Update ffi and update markets to v9 (#751)" (#755) ([filecoin-project/go-fil-markets#755](https://github.com/filecoin-project/go-fil-markets/pull/755)) +- Update ffi and update markets to v9 (#751) ([filecoin-project/go-fil-markets#751](https://github.com/filecoin-project/go-fil-markets/pull/751)) +- release: v1.24.0 ([filecoin-project/go-fil-markets#745](https://github.com/filecoin-project/go-fil-markets/pull/745)) +- github.com/filecoin-project/go-state-types (v0.9.8 -> v0.9.9): + +## lotus-market EOL notice + +As mentioned in [lotus v1.17.0 release notes](https://github.com/filecoin-project/lotus/releases/tag/v1.17.0), markets related features, enhancements and fixes is now lower priority for Lotus. We recommend our users to migrate to other deal making focused software, like [boost](https://boost.filecoin.io/) as soon as possible. That being said, the lotus maintainers will be: +- Lotus maintainers will stop supporting lotus-market subcomponent/**storage** deal making related issues or enhancements on Jan 31, 2023. +- In Q2 2023, we will be deprecating/removing lotus-market related code from this repository. + +If you have any questions or concerns, please raise them in [Lotus discussion](https://github.com/filecoin-project/lotus/discussions/categories/market)! + +## Contributors + +| Contributor | Commits | Lines ± | Files Changed | +|-------------|---------|---------|---------------| +| Geoff Stuart | 69 | +4745/-19478 | 405 | +| Shrenuj Bansal | 39 | +5257/-2183 | 243 | +| Łukasz Magiera | 32 | +2763/-730 | 169 | +| Aayush | 47 | +1439/-1138 | 157 | +| Ian Davis | 21 | +556/-1065 | 41 | +| Rod Vagg | 5 | +657/-320 | 18 | +| jennijuju | 4 | +632/-317 | 6 | +| Aayush Rajasekaran | 13 | +700/-135 | 18 | +| Jennifer Wang | 14 | +740/-54 | 25 | +| ZenGround0 | 1 | +193/-195 | 14 | +| Hannah Howard | 4 | +138/-122 | 52 | +| Steven Allen | 4 | +105/-24 | 11 | +| zenground0 | 9 | +109/-16 | 14 | +| Peter Rabbitson | 1 | +27/-23 | 3 | +| hannahhoward | 2 | +49/-0 | 2 | +| Airenas Vaičiūnas | 2 | +31/-16 | 2 | +| simlecode | 6 | +19/-10 | 12 | +| Phi | 5 | +16/-10 | 7 | +| sectrgt | 2 | +18/-0 | 2 | +| Jiaying Wang | 2 | +4/-4 | 3 | +| Rob Quist | 1 | +3/-1 | 1 | +| Jakub Sztandera | 1 | +1/-1 | 1 | + +# 1.18.2 / 2022-12-10 + +This is an OPTIONAL patch release that fixes a recently reported bug, where the miner process crashes due to a panic during an AddPiece process. More details can be found [here](https://github.com/filecoin-project/lotus/pull/9822). + + # 1.18.1 / 2022-11-28 This is a small OPTIONAL patch release for the mandatory v1.18.0 release that supports the Filecoin nv17 Shark Upgrade. diff --git a/api/api_full.go b/api/api_full.go index c0217fc27..409f617f9 100644 --- a/api/api_full.go +++ b/api/api_full.go @@ -31,6 +31,7 @@ import ( lminer "github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/actors/builtin/power" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/lotus/chain/types/ethtypes" "github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/repo/imports" ) @@ -766,60 +767,60 @@ type FullNode interface { // These methods are used for Ethereum-compatible JSON-RPC calls // // EthAccounts will always return [] since we don't expect Lotus to manage private keys - EthAccounts(ctx context.Context) ([]EthAddress, error) //perm:read + EthAccounts(ctx context.Context) ([]ethtypes.EthAddress, error) //perm:read // EthBlockNumber returns the height of the latest (heaviest) TipSet - EthBlockNumber(ctx context.Context) (EthUint64, error) //perm:read + EthBlockNumber(ctx context.Context) (ethtypes.EthUint64, error) //perm:read // EthGetBlockTransactionCountByNumber returns the number of messages in the TipSet - EthGetBlockTransactionCountByNumber(ctx context.Context, blkNum EthUint64) (EthUint64, error) //perm:read + EthGetBlockTransactionCountByNumber(ctx context.Context, blkNum ethtypes.EthUint64) (ethtypes.EthUint64, error) //perm:read // EthGetBlockTransactionCountByHash returns the number of messages in the TipSet - EthGetBlockTransactionCountByHash(ctx context.Context, blkHash EthHash) (EthUint64, error) //perm:read + EthGetBlockTransactionCountByHash(ctx context.Context, blkHash ethtypes.EthHash) (ethtypes.EthUint64, error) //perm:read - EthGetBlockByHash(ctx context.Context, blkHash EthHash, fullTxInfo bool) (EthBlock, error) //perm:read - EthGetBlockByNumber(ctx context.Context, blkNum string, fullTxInfo bool) (EthBlock, error) //perm:read - EthGetTransactionByHash(ctx context.Context, txHash *EthHash) (*EthTx, error) //perm:read - EthGetTransactionCount(ctx context.Context, sender EthAddress, blkOpt string) (EthUint64, error) //perm:read - EthGetTransactionReceipt(ctx context.Context, txHash EthHash) (*EthTxReceipt, error) //perm:read - EthGetTransactionByBlockHashAndIndex(ctx context.Context, blkHash EthHash, txIndex EthUint64) (EthTx, error) //perm:read - EthGetTransactionByBlockNumberAndIndex(ctx context.Context, blkNum EthUint64, txIndex EthUint64) (EthTx, error) //perm:read + EthGetBlockByHash(ctx context.Context, blkHash ethtypes.EthHash, fullTxInfo bool) (ethtypes.EthBlock, error) //perm:read + EthGetBlockByNumber(ctx context.Context, blkNum string, fullTxInfo bool) (ethtypes.EthBlock, error) //perm:read + EthGetTransactionByHash(ctx context.Context, txHash *ethtypes.EthHash) (*ethtypes.EthTx, error) //perm:read + EthGetTransactionCount(ctx context.Context, sender ethtypes.EthAddress, blkOpt string) (ethtypes.EthUint64, error) //perm:read + EthGetTransactionReceipt(ctx context.Context, txHash ethtypes.EthHash) (*EthTxReceipt, error) //perm:read + EthGetTransactionByBlockHashAndIndex(ctx context.Context, blkHash ethtypes.EthHash, txIndex ethtypes.EthUint64) (ethtypes.EthTx, error) //perm:read + EthGetTransactionByBlockNumberAndIndex(ctx context.Context, blkNum ethtypes.EthUint64, txIndex ethtypes.EthUint64) (ethtypes.EthTx, error) //perm:read - EthGetCode(ctx context.Context, address EthAddress, blkOpt string) (EthBytes, error) //perm:read - EthGetStorageAt(ctx context.Context, address EthAddress, position EthBytes, blkParam string) (EthBytes, error) //perm:read - EthGetBalance(ctx context.Context, address EthAddress, blkParam string) (EthBigInt, error) //perm:read - EthChainId(ctx context.Context) (EthUint64, error) //perm:read - NetVersion(ctx context.Context) (string, error) //perm:read - NetListening(ctx context.Context) (bool, error) //perm:read - EthProtocolVersion(ctx context.Context) (EthUint64, error) //perm:read - EthGasPrice(ctx context.Context) (EthBigInt, error) //perm:read - EthFeeHistory(ctx context.Context, blkCount EthUint64, newestBlk string, rewardPercentiles []float64) (EthFeeHistory, error) //perm:read + EthGetCode(ctx context.Context, address ethtypes.EthAddress, blkOpt string) (ethtypes.EthBytes, error) //perm:read + EthGetStorageAt(ctx context.Context, address ethtypes.EthAddress, position ethtypes.EthBytes, blkParam string) (ethtypes.EthBytes, error) //perm:read + EthGetBalance(ctx context.Context, address ethtypes.EthAddress, blkParam string) (ethtypes.EthBigInt, error) //perm:read + EthChainId(ctx context.Context) (ethtypes.EthUint64, error) //perm:read + NetVersion(ctx context.Context) (string, error) //perm:read + NetListening(ctx context.Context) (bool, error) //perm:read + EthProtocolVersion(ctx context.Context) (ethtypes.EthUint64, error) //perm:read + EthGasPrice(ctx context.Context) (ethtypes.EthBigInt, error) //perm:read + EthFeeHistory(ctx context.Context, blkCount ethtypes.EthUint64, newestBlk string, rewardPercentiles []float64) (ethtypes.EthFeeHistory, error) //perm:read - EthMaxPriorityFeePerGas(ctx context.Context) (EthBigInt, error) //perm:read - EthEstimateGas(ctx context.Context, tx EthCall) (EthUint64, error) //perm:read - EthCall(ctx context.Context, tx EthCall, blkParam string) (EthBytes, error) //perm:read + EthMaxPriorityFeePerGas(ctx context.Context) (ethtypes.EthBigInt, error) //perm:read + EthEstimateGas(ctx context.Context, tx ethtypes.EthCall) (ethtypes.EthUint64, error) //perm:read + EthCall(ctx context.Context, tx ethtypes.EthCall, blkParam string) (ethtypes.EthBytes, error) //perm:read - EthSendRawTransaction(ctx context.Context, rawTx EthBytes) (EthHash, error) //perm:read + EthSendRawTransaction(ctx context.Context, rawTx ethtypes.EthBytes) (ethtypes.EthHash, error) //perm:read // Returns event logs matching given filter spec. - EthGetLogs(ctx context.Context, filter *EthFilterSpec) (*EthFilterResult, error) //perm:read + EthGetLogs(ctx context.Context, filter *ethtypes.EthFilterSpec) (*ethtypes.EthFilterResult, error) //perm:read // Polling method for a filter, returns event logs which occurred since last poll. // (requires write perm since timestamp of last filter execution will be written) - EthGetFilterChanges(ctx context.Context, id EthFilterID) (*EthFilterResult, error) //perm:write + EthGetFilterChanges(ctx context.Context, id ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error) //perm:write // Returns event logs matching filter with given id. // (requires write perm since timestamp of last filter execution will be written) - EthGetFilterLogs(ctx context.Context, id EthFilterID) (*EthFilterResult, error) //perm:write + EthGetFilterLogs(ctx context.Context, id ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error) //perm:write // Installs a persistent filter based on given filter spec. - EthNewFilter(ctx context.Context, filter *EthFilterSpec) (EthFilterID, error) //perm:write + EthNewFilter(ctx context.Context, filter *ethtypes.EthFilterSpec) (ethtypes.EthFilterID, error) //perm:write // Installs a persistent filter to notify when a new block arrives. - EthNewBlockFilter(ctx context.Context) (EthFilterID, error) //perm:write + EthNewBlockFilter(ctx context.Context) (ethtypes.EthFilterID, error) //perm:write // Installs a persistent filter to notify when new messages arrive in the message pool. - EthNewPendingTransactionFilter(ctx context.Context) (EthFilterID, error) //perm:write + EthNewPendingTransactionFilter(ctx context.Context) (ethtypes.EthFilterID, error) //perm:write // Uninstalls a filter with given id. - EthUninstallFilter(ctx context.Context, id EthFilterID) (bool, error) //perm:write + EthUninstallFilter(ctx context.Context, id ethtypes.EthFilterID) (bool, error) //perm:write // Subscribe to different event types using websockets // eventTypes is one or more of: @@ -828,10 +829,10 @@ type FullNode interface { // - logs: notify new event logs that match a criteria // params contains additional parameters used with the log event type // The client will receive a stream of EthSubscriptionResponse values until EthUnsubscribe is called. - EthSubscribe(ctx context.Context, eventType string, params *EthSubscriptionParams) (<-chan EthSubscriptionResponse, error) //perm:write + EthSubscribe(ctx context.Context, eventType string, params *ethtypes.EthSubscriptionParams) (<-chan ethtypes.EthSubscriptionResponse, error) //perm:write // Unsubscribe from a websocket subscription - EthUnsubscribe(ctx context.Context, id EthSubscriptionID) (bool, error) //perm:write + EthUnsubscribe(ctx context.Context, id ethtypes.EthSubscriptionID) (bool, error) //perm:write // CreateBackup creates node backup onder the specified file name. The // method requires that the lotus daemon is running with the @@ -1326,3 +1327,23 @@ type PruneOpts struct { MovingGC bool RetainState int64 } + +type EthTxReceipt struct { + TransactionHash ethtypes.EthHash `json:"transactionHash"` + TransactionIndex ethtypes.EthUint64 `json:"transactionIndex"` + BlockHash ethtypes.EthHash `json:"blockHash"` + BlockNumber ethtypes.EthUint64 `json:"blockNumber"` + From ethtypes.EthAddress `json:"from"` + To *ethtypes.EthAddress `json:"to"` + // Logs + // LogsBloom + StateRoot ethtypes.EthHash `json:"root"` + Status ethtypes.EthUint64 `json:"status"` + ContractAddress *ethtypes.EthAddress `json:"contractAddress"` + CumulativeGasUsed ethtypes.EthUint64 `json:"cumulativeGasUsed"` + GasUsed ethtypes.EthUint64 `json:"gasUsed"` + EffectiveGasPrice ethtypes.EthBigInt `json:"effectiveGasPrice"` + LogsBloom ethtypes.EthBytes `json:"logsBloom"` + Logs []string `json:"logs"` + Type ethtypes.EthUint64 `json:"type"` +} diff --git a/api/docgen/docgen.go b/api/docgen/docgen.go index 8a6b1dafb..755dee1f8 100644 --- a/api/docgen/docgen.go +++ b/api/docgen/docgen.go @@ -43,6 +43,7 @@ import ( "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/chain/types/ethtypes" "github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/repo/imports" sealing "github.com/filecoin-project/lotus/storage/pipeline" @@ -372,16 +373,16 @@ func init() { }, }) - ethint := api.EthUint64(5) + ethint := ethtypes.EthUint64(5) addExample(ethint) addExample(ðint) - ethaddr, _ := api.EthAddressFromHex("0x5CbEeCF99d3fDB3f25E309Cc264f240bb0664031") + ethaddr, _ := ethtypes.EthAddressFromHex("0x5CbEeCF99d3fDB3f25E309Cc264f240bb0664031") addExample(ðaddr) - ethhash, _ := api.NewEthHashFromCid(c) + ethhash, _ := ethtypes.NewEthHashFromCid(c) addExample(ðhash) - ethFeeHistoryReward := [][]api.EthBigInt{} + ethFeeHistoryReward := [][]ethtypes.EthBigInt{} addExample(ðFeeHistoryReward) addExample(&uuid.UUID{}) diff --git a/api/mocks/mock_full.go b/api/mocks/mock_full.go index e96a1b214..ad8540bdf 100644 --- a/api/mocks/mock_full.go +++ b/api/mocks/mock_full.go @@ -37,6 +37,7 @@ import ( apitypes "github.com/filecoin-project/lotus/api/types" miner0 "github.com/filecoin-project/lotus/chain/actors/builtin/miner" types "github.com/filecoin-project/lotus/chain/types" + ethtypes "github.com/filecoin-project/lotus/chain/types/ethtypes" alerting "github.com/filecoin-project/lotus/journal/alerting" dtypes "github.com/filecoin-project/lotus/node/modules/dtypes" imports "github.com/filecoin-project/lotus/node/repo/imports" @@ -937,10 +938,10 @@ func (mr *MockFullNodeMockRecorder) Discover(arg0 interface{}) *gomock.Call { } // EthAccounts mocks base method. -func (m *MockFullNode) EthAccounts(arg0 context.Context) ([]api.EthAddress, error) { +func (m *MockFullNode) EthAccounts(arg0 context.Context) ([]ethtypes.EthAddress, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthAccounts", arg0) - ret0, _ := ret[0].([]api.EthAddress) + ret0, _ := ret[0].([]ethtypes.EthAddress) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -952,10 +953,10 @@ func (mr *MockFullNodeMockRecorder) EthAccounts(arg0 interface{}) *gomock.Call { } // EthBlockNumber mocks base method. -func (m *MockFullNode) EthBlockNumber(arg0 context.Context) (api.EthUint64, error) { +func (m *MockFullNode) EthBlockNumber(arg0 context.Context) (ethtypes.EthUint64, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthBlockNumber", arg0) - ret0, _ := ret[0].(api.EthUint64) + ret0, _ := ret[0].(ethtypes.EthUint64) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -967,10 +968,10 @@ func (mr *MockFullNodeMockRecorder) EthBlockNumber(arg0 interface{}) *gomock.Cal } // EthCall mocks base method. -func (m *MockFullNode) EthCall(arg0 context.Context, arg1 api.EthCall, arg2 string) (api.EthBytes, error) { +func (m *MockFullNode) EthCall(arg0 context.Context, arg1 ethtypes.EthCall, arg2 string) (ethtypes.EthBytes, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthCall", arg0, arg1, arg2) - ret0, _ := ret[0].(api.EthBytes) + ret0, _ := ret[0].(ethtypes.EthBytes) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -982,10 +983,10 @@ func (mr *MockFullNodeMockRecorder) EthCall(arg0, arg1, arg2 interface{}) *gomoc } // EthChainId mocks base method. -func (m *MockFullNode) EthChainId(arg0 context.Context) (api.EthUint64, error) { +func (m *MockFullNode) EthChainId(arg0 context.Context) (ethtypes.EthUint64, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthChainId", arg0) - ret0, _ := ret[0].(api.EthUint64) + ret0, _ := ret[0].(ethtypes.EthUint64) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -997,10 +998,10 @@ func (mr *MockFullNodeMockRecorder) EthChainId(arg0 interface{}) *gomock.Call { } // EthEstimateGas mocks base method. -func (m *MockFullNode) EthEstimateGas(arg0 context.Context, arg1 api.EthCall) (api.EthUint64, error) { +func (m *MockFullNode) EthEstimateGas(arg0 context.Context, arg1 ethtypes.EthCall) (ethtypes.EthUint64, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthEstimateGas", arg0, arg1) - ret0, _ := ret[0].(api.EthUint64) + ret0, _ := ret[0].(ethtypes.EthUint64) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1012,10 +1013,10 @@ func (mr *MockFullNodeMockRecorder) EthEstimateGas(arg0, arg1 interface{}) *gomo } // EthFeeHistory mocks base method. -func (m *MockFullNode) EthFeeHistory(arg0 context.Context, arg1 api.EthUint64, arg2 string, arg3 []float64) (api.EthFeeHistory, error) { +func (m *MockFullNode) EthFeeHistory(arg0 context.Context, arg1 ethtypes.EthUint64, arg2 string, arg3 []float64) (ethtypes.EthFeeHistory, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthFeeHistory", arg0, arg1, arg2, arg3) - ret0, _ := ret[0].(api.EthFeeHistory) + ret0, _ := ret[0].(ethtypes.EthFeeHistory) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1027,10 +1028,10 @@ func (mr *MockFullNodeMockRecorder) EthFeeHistory(arg0, arg1, arg2, arg3 interfa } // EthGasPrice mocks base method. -func (m *MockFullNode) EthGasPrice(arg0 context.Context) (api.EthBigInt, error) { +func (m *MockFullNode) EthGasPrice(arg0 context.Context) (ethtypes.EthBigInt, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthGasPrice", arg0) - ret0, _ := ret[0].(api.EthBigInt) + ret0, _ := ret[0].(ethtypes.EthBigInt) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1042,10 +1043,10 @@ func (mr *MockFullNodeMockRecorder) EthGasPrice(arg0 interface{}) *gomock.Call { } // EthGetBalance mocks base method. -func (m *MockFullNode) EthGetBalance(arg0 context.Context, arg1 api.EthAddress, arg2 string) (api.EthBigInt, error) { +func (m *MockFullNode) EthGetBalance(arg0 context.Context, arg1 ethtypes.EthAddress, arg2 string) (ethtypes.EthBigInt, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthGetBalance", arg0, arg1, arg2) - ret0, _ := ret[0].(api.EthBigInt) + ret0, _ := ret[0].(ethtypes.EthBigInt) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1057,10 +1058,10 @@ func (mr *MockFullNodeMockRecorder) EthGetBalance(arg0, arg1, arg2 interface{}) } // EthGetBlockByHash mocks base method. -func (m *MockFullNode) EthGetBlockByHash(arg0 context.Context, arg1 api.EthHash, arg2 bool) (api.EthBlock, error) { +func (m *MockFullNode) EthGetBlockByHash(arg0 context.Context, arg1 ethtypes.EthHash, arg2 bool) (ethtypes.EthBlock, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthGetBlockByHash", arg0, arg1, arg2) - ret0, _ := ret[0].(api.EthBlock) + ret0, _ := ret[0].(ethtypes.EthBlock) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1072,10 +1073,10 @@ func (mr *MockFullNodeMockRecorder) EthGetBlockByHash(arg0, arg1, arg2 interface } // EthGetBlockByNumber mocks base method. -func (m *MockFullNode) EthGetBlockByNumber(arg0 context.Context, arg1 string, arg2 bool) (api.EthBlock, error) { +func (m *MockFullNode) EthGetBlockByNumber(arg0 context.Context, arg1 string, arg2 bool) (ethtypes.EthBlock, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthGetBlockByNumber", arg0, arg1, arg2) - ret0, _ := ret[0].(api.EthBlock) + ret0, _ := ret[0].(ethtypes.EthBlock) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1087,10 +1088,10 @@ func (mr *MockFullNodeMockRecorder) EthGetBlockByNumber(arg0, arg1, arg2 interfa } // EthGetBlockTransactionCountByHash mocks base method. -func (m *MockFullNode) EthGetBlockTransactionCountByHash(arg0 context.Context, arg1 api.EthHash) (api.EthUint64, error) { +func (m *MockFullNode) EthGetBlockTransactionCountByHash(arg0 context.Context, arg1 ethtypes.EthHash) (ethtypes.EthUint64, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthGetBlockTransactionCountByHash", arg0, arg1) - ret0, _ := ret[0].(api.EthUint64) + ret0, _ := ret[0].(ethtypes.EthUint64) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1102,10 +1103,10 @@ func (mr *MockFullNodeMockRecorder) EthGetBlockTransactionCountByHash(arg0, arg1 } // EthGetBlockTransactionCountByNumber mocks base method. -func (m *MockFullNode) EthGetBlockTransactionCountByNumber(arg0 context.Context, arg1 api.EthUint64) (api.EthUint64, error) { +func (m *MockFullNode) EthGetBlockTransactionCountByNumber(arg0 context.Context, arg1 ethtypes.EthUint64) (ethtypes.EthUint64, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthGetBlockTransactionCountByNumber", arg0, arg1) - ret0, _ := ret[0].(api.EthUint64) + ret0, _ := ret[0].(ethtypes.EthUint64) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1117,10 +1118,10 @@ func (mr *MockFullNodeMockRecorder) EthGetBlockTransactionCountByNumber(arg0, ar } // EthGetCode mocks base method. -func (m *MockFullNode) EthGetCode(arg0 context.Context, arg1 api.EthAddress, arg2 string) (api.EthBytes, error) { +func (m *MockFullNode) EthGetCode(arg0 context.Context, arg1 ethtypes.EthAddress, arg2 string) (ethtypes.EthBytes, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthGetCode", arg0, arg1, arg2) - ret0, _ := ret[0].(api.EthBytes) + ret0, _ := ret[0].(ethtypes.EthBytes) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1177,10 +1178,10 @@ func (mr *MockFullNodeMockRecorder) EthGetLogs(arg0, arg1 interface{}) *gomock.C } // EthGetStorageAt mocks base method. -func (m *MockFullNode) EthGetStorageAt(arg0 context.Context, arg1 api.EthAddress, arg2 api.EthBytes, arg3 string) (api.EthBytes, error) { +func (m *MockFullNode) EthGetStorageAt(arg0 context.Context, arg1 ethtypes.EthAddress, arg2 ethtypes.EthBytes, arg3 string) (ethtypes.EthBytes, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthGetStorageAt", arg0, arg1, arg2, arg3) - ret0, _ := ret[0].(api.EthBytes) + ret0, _ := ret[0].(ethtypes.EthBytes) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1192,10 +1193,10 @@ func (mr *MockFullNodeMockRecorder) EthGetStorageAt(arg0, arg1, arg2, arg3 inter } // EthGetTransactionByBlockHashAndIndex mocks base method. -func (m *MockFullNode) EthGetTransactionByBlockHashAndIndex(arg0 context.Context, arg1 api.EthHash, arg2 api.EthUint64) (api.EthTx, error) { +func (m *MockFullNode) EthGetTransactionByBlockHashAndIndex(arg0 context.Context, arg1 ethtypes.EthHash, arg2 ethtypes.EthUint64) (ethtypes.EthTx, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthGetTransactionByBlockHashAndIndex", arg0, arg1, arg2) - ret0, _ := ret[0].(api.EthTx) + ret0, _ := ret[0].(ethtypes.EthTx) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1207,10 +1208,10 @@ func (mr *MockFullNodeMockRecorder) EthGetTransactionByBlockHashAndIndex(arg0, a } // EthGetTransactionByBlockNumberAndIndex mocks base method. -func (m *MockFullNode) EthGetTransactionByBlockNumberAndIndex(arg0 context.Context, arg1, arg2 api.EthUint64) (api.EthTx, error) { +func (m *MockFullNode) EthGetTransactionByBlockNumberAndIndex(arg0 context.Context, arg1, arg2 ethtypes.EthUint64) (ethtypes.EthTx, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthGetTransactionByBlockNumberAndIndex", arg0, arg1, arg2) - ret0, _ := ret[0].(api.EthTx) + ret0, _ := ret[0].(ethtypes.EthTx) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1222,10 +1223,10 @@ func (mr *MockFullNodeMockRecorder) EthGetTransactionByBlockNumberAndIndex(arg0, } // EthGetTransactionByHash mocks base method. -func (m *MockFullNode) EthGetTransactionByHash(arg0 context.Context, arg1 *api.EthHash) (*api.EthTx, error) { +func (m *MockFullNode) EthGetTransactionByHash(arg0 context.Context, arg1 *ethtypes.EthHash) (*ethtypes.EthTx, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthGetTransactionByHash", arg0, arg1) - ret0, _ := ret[0].(*api.EthTx) + ret0, _ := ret[0].(*ethtypes.EthTx) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1237,10 +1238,10 @@ func (mr *MockFullNodeMockRecorder) EthGetTransactionByHash(arg0, arg1 interface } // EthGetTransactionCount mocks base method. -func (m *MockFullNode) EthGetTransactionCount(arg0 context.Context, arg1 api.EthAddress, arg2 string) (api.EthUint64, error) { +func (m *MockFullNode) EthGetTransactionCount(arg0 context.Context, arg1 ethtypes.EthAddress, arg2 string) (ethtypes.EthUint64, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthGetTransactionCount", arg0, arg1, arg2) - ret0, _ := ret[0].(api.EthUint64) + ret0, _ := ret[0].(ethtypes.EthUint64) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1252,7 +1253,7 @@ func (mr *MockFullNodeMockRecorder) EthGetTransactionCount(arg0, arg1, arg2 inte } // EthGetTransactionReceipt mocks base method. -func (m *MockFullNode) EthGetTransactionReceipt(arg0 context.Context, arg1 api.EthHash) (*api.EthTxReceipt, error) { +func (m *MockFullNode) EthGetTransactionReceipt(arg0 context.Context, arg1 ethtypes.EthHash) (*api.EthTxReceipt, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthGetTransactionReceipt", arg0, arg1) ret0, _ := ret[0].(*api.EthTxReceipt) @@ -1267,10 +1268,10 @@ func (mr *MockFullNodeMockRecorder) EthGetTransactionReceipt(arg0, arg1 interfac } // EthMaxPriorityFeePerGas mocks base method. -func (m *MockFullNode) EthMaxPriorityFeePerGas(arg0 context.Context) (api.EthBigInt, error) { +func (m *MockFullNode) EthMaxPriorityFeePerGas(arg0 context.Context) (ethtypes.EthBigInt, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthMaxPriorityFeePerGas", arg0) - ret0, _ := ret[0].(api.EthBigInt) + ret0, _ := ret[0].(ethtypes.EthBigInt) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1327,10 +1328,10 @@ func (mr *MockFullNodeMockRecorder) EthNewPendingTransactionFilter(arg0 interfac } // EthProtocolVersion mocks base method. -func (m *MockFullNode) EthProtocolVersion(arg0 context.Context) (api.EthUint64, error) { +func (m *MockFullNode) EthProtocolVersion(arg0 context.Context) (ethtypes.EthUint64, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthProtocolVersion", arg0) - ret0, _ := ret[0].(api.EthUint64) + ret0, _ := ret[0].(ethtypes.EthUint64) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1342,10 +1343,10 @@ func (mr *MockFullNodeMockRecorder) EthProtocolVersion(arg0 interface{}) *gomock } // EthSendRawTransaction mocks base method. -func (m *MockFullNode) EthSendRawTransaction(arg0 context.Context, arg1 api.EthBytes) (api.EthHash, error) { +func (m *MockFullNode) EthSendRawTransaction(arg0 context.Context, arg1 ethtypes.EthBytes) (ethtypes.EthHash, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthSendRawTransaction", arg0, arg1) - ret0, _ := ret[0].(api.EthHash) + ret0, _ := ret[0].(ethtypes.EthHash) ret1, _ := ret[1].(error) return ret0, ret1 } diff --git a/build/actors/v10.tar.zst b/build/actors/v10.tar.zst index f5644f474..4e25522d3 100644 Binary files a/build/actors/v10.tar.zst and b/build/actors/v10.tar.zst differ diff --git a/build/builtin_actors_gen.go b/build/builtin_actors_gen.go index fa10798ef..0b9c1712a 100644 --- a/build/builtin_actors_gen.go +++ b/build/builtin_actors_gen.go @@ -44,23 +44,24 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet }, { Network: "butterflynet", Version: 10, - ManifestCid: MustParseCid("bafy2bzaceciz4ytt5gnn6gc4epez7v6xeg6efkgbvwfxkoa34o2gj3hp5f7zc"), + ManifestCid: MustParseCid("bafy2bzacea6kki7qtpkuxhskje3p7tuwmsdb2lequi3fjo7q2g4egedgmcaos"), Actors: map[string]cid.Cid{ - "account": MustParseCid("bafk2bzacedavorwsriewoddjlaganjpsk3o7zfts2wyid3clv5xnctacg37j2"), - "cron": MustParseCid("bafk2bzacebtauucwaewxuzgxfpjtmn6xt3kya4om4ugyprlkhhkde76h7fkqg"), - "datacap": MustParseCid("bafk2bzacebzdjapqwasq6woxkgq2nm2nre3v7cl2754xwiuo2cfhvsceq4cba"), - "eam": MustParseCid("bafk2bzacecmr4zdbpfnemvgo446qby7x4y4v5cbfespt3f6ousv2hxnflyrlk"), - "embryo": MustParseCid("bafk2bzacebj2mj5zlcs3yjlgpbznzistfjkdlwaoncjziliqrxqavvz4dcvnk"), - "evm": MustParseCid("bafk2bzacebuewexvig54cuvsvwn4k4zr36tm2q5fel4ezq4v7363n2lmn362k"), - "init": MustParseCid("bafk2bzacebww5gsctsk5hack2alkt4kh55bmpb4ywzbyyhoaskryymjj3snj6"), - "multisig": MustParseCid("bafk2bzacec5k4wxvou34pyjd5kcsrbsfnlk4k753kkscg3ron2r7tsxollfsq"), - "paymentchannel": MustParseCid("bafk2bzacebzdeaxglaqpmegalakmxr6secjd24mu5llo4ctoy7pvom5upyuvs"), - "reward": MustParseCid("bafk2bzaceb4hyabxnyrrsno5erqqwk5ynnjibblzfcaq3aotlz3ek4uu6dyla"), - "storagemarket": MustParseCid("bafk2bzacedpocbf2lg2x2jg6arw2argnwmvo2hyjqvpkrgfu4khz5mtlzxz2o"), - "storageminer": MustParseCid("bafk2bzaceacrumah7jdfc62bmvemob4lsh5yiohwodest2cgxakgnn24cenlk"), - "storagepower": MustParseCid("bafk2bzaceaxz6n5nywermfptnz6dc53vqsa42lic4rf66l4irm3mqfj4ak5ps"), - "system": MustParseCid("bafk2bzaceb4w5bblgyu25ylytpmfrixjsk2ra6emd44j4mv42xfxbwnqloyzi"), - "verifiedregistry": MustParseCid("bafk2bzacedbz2koeb6teewobcjdpgfv7qdae7utgoka6wzlkf6gronnis2nn2"), + "account": MustParseCid("bafk2bzacebvgiflqavofskiq56aj4ktkzediyeo7j4cqqdkbmu6f3pib4sbb2"), + "cron": MustParseCid("bafk2bzaceb4mn2ehsyjueq4ja3zmvmgstx2sdvzvf52xzs7pzlumxr7acr5sk"), + "datacap": MustParseCid("bafk2bzacecetu7dadc2dznwhutwl43lislb22qqdkdmpwgmonspiiysud63rg"), + "eam": MustParseCid("bafk2bzacebuexqxddkgyptjn5cmldjkbmxgmkq5i4pbvtdwcdcfdt63fpwrwe"), + "embryo": MustParseCid("bafk2bzaceax2tehd7m42kxf3z56hjj67buzucn5cj2456daz5yj4ai5txs2r4"), + "ethaccount": MustParseCid("bafk2bzacebeqqs3ov6olevtpnra4txkfumnx5yqi2hrn47nphyzz3wjb5s3xa"), + "evm": MustParseCid("bafk2bzacedgfppymynx6gf5t5abs25fhpjljwp3pzyg2rh777iq4qkoxv6r2m"), + "init": MustParseCid("bafk2bzacedezxmexxjrxda3aqyghk6v53to4dxtpcvk3oyp5hrpxsmhokjtzk"), + "multisig": MustParseCid("bafk2bzaceady5ddezunmb77i2yod727jx5tegdxdhxric4hv5tdgoyj2yzs76"), + "paymentchannel": MustParseCid("bafk2bzacedljjqkbtn33jlx5iic6rxz6g7l5j55xut5kvxkp3n53lfguhh3tk"), + "reward": MustParseCid("bafk2bzacecpaajt7l47j2oh4k5xm2lkpfxssy2s3ruethh3nrjqa5vzk636ee"), + "storagemarket": MustParseCid("bafk2bzacedyg67aeetx7yc5nhkv24dyy5qgsb4miktqtbllhb25qxhezxkeua"), + "storageminer": MustParseCid("bafk2bzacecmrhmmowsetorpgl5ljbfzowe7p5jhsg6qrpqffcxiobj6viouts"), + "storagepower": MustParseCid("bafk2bzacedygmbf2reecyktif77fhgik6r2hrt5lpxwcrcsvgrb6fzuz64r5e"), + "system": MustParseCid("bafk2bzacedobj3mr33345jy236wzbs46luvqxllczmmv2leqkonezskibehxa"), + "verifiedregistry": MustParseCid("bafk2bzacecaud67cooasim3xmykvla7sprxds5vjpyjugwaubapmglxwrcd5m"), }, }, { Network: "calibrationnet", @@ -100,23 +101,24 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet }, { Network: "calibrationnet", Version: 10, - ManifestCid: MustParseCid("bafy2bzaced7wbd43lvgc55xb37mkoo4ppev6ig4jj4j7dtswtjfjq4u5qmpck"), + ManifestCid: MustParseCid("bafy2bzaceavw3rjjahsviowz6nprq6ame33tel5tqzsmpfh7uw4tov24gkcww"), Actors: map[string]cid.Cid{ - "account": MustParseCid("bafk2bzacecq4owv5begvryvpsy4atfb2jnf7g7o4hxovtdb5a4jfkzacownli"), - "cron": MustParseCid("bafk2bzaced4uz5w5h5wksx4end27lphd4qc4kh7q336uyt46lba5ddynwftya"), - "datacap": MustParseCid("bafk2bzacedoc7y4s5n3p2zo4bcmafcrellkakn2e3uyf5wb3mtbuqhvwqn2l4"), - "eam": MustParseCid("bafk2bzacealpqjgz5qmucm3v6z6hn36igx7zijixhqrxwoj3g4bdgvyml3adi"), - "embryo": MustParseCid("bafk2bzacebj2mj5zlcs3yjlgpbznzistfjkdlwaoncjziliqrxqavvz4dcvnk"), - "evm": MustParseCid("bafk2bzacedmlmyy2efbt4qk5ighawiychklhzc6pzyiwvpijwvxoq3xyxlgxw"), - "init": MustParseCid("bafk2bzaceaqcfmfylwdemq5bdcelydpf6iqfct4p7b2zwtmqyhuxn522yvic2"), - "multisig": MustParseCid("bafk2bzacebuh55hkbkobmmoaoduruss5nsh6e2gtqtdbqsmw6e7k5vg6heyrm"), - "paymentchannel": MustParseCid("bafk2bzacedcpzw7prdoxnaclcvmtwr6yf54zi4bzzwe5w3xknh72ji6p3qfc6"), - "reward": MustParseCid("bafk2bzaced74ym6j424zzbr6millasfcyl3r4zm5fnauasrwn3ti6fdarbkym"), - "storagemarket": MustParseCid("bafk2bzacec7delr2q42yj4wu3daa5xjz4zezeivphtx3xwyvpgwpdnfoevhh2"), - "storageminer": MustParseCid("bafk2bzaced7isnew5lhu237pdtwaqmbv65qqvfmmnve2c5yfobtfqw2fptuvc"), - "storagepower": MustParseCid("bafk2bzacebe5frk6gcgzcvzkxavhhbs3id3iyacybn7y7gxwzgl5t6zawzswg"), - "system": MustParseCid("bafk2bzacectivaezqijucle5s2f7xeui5uxig7bnk7fe4vsvz3xu7agjtb2ge"), - "verifiedregistry": MustParseCid("bafk2bzaceczgwckte4exultjxyzgzoo6m6r5coyphnlappi4clethhhybslxc"), + "account": MustParseCid("bafk2bzacedifn4xp6aike3xdgntk355pgb3ky6bme454t6dpol5235w2vibwi"), + "cron": MustParseCid("bafk2bzacecwcvtgwto3s5o6v5jzx2rvbzv6uaixws7i4epdcsxgg52hwtw2tm"), + "datacap": MustParseCid("bafk2bzaceczuhzrowju6c6jk2agkrqahjnkm3abu3dvjve5g6z3xng2m7hxwq"), + "eam": MustParseCid("bafk2bzacecpf4u5zr2ilft5rt3i3s4alldjxqekhdruwrfqts57fwwoagjjws"), + "embryo": MustParseCid("bafk2bzaceax2tehd7m42kxf3z56hjj67buzucn5cj2456daz5yj4ai5txs2r4"), + "ethaccount": MustParseCid("bafk2bzacec5kyeyy32zmucx3vbiw22j4znmmdvzkdoqu2e5e5gk33bhbfkseq"), + "evm": MustParseCid("bafk2bzacec72jwgdndy2gnbvzapknihdlp27f3qvj3ykmj6paq7o6tdgbykvq"), + "init": MustParseCid("bafk2bzacea6mrjm65wr436mlgv6eaceghfvpchcueqf3qsdon5e2paxnoqgtm"), + "multisig": MustParseCid("bafk2bzaceaeuzxfixer56laljcn34tygi2kvngstqmhwz7ushjx4qwx4n5mi2"), + "paymentchannel": MustParseCid("bafk2bzacecm6k45iz277jypjd6sfyjodgbiwymblsch6wnkz4q2uzzmy4gsuw"), + "reward": MustParseCid("bafk2bzacebr7gdppcalate32rukzbbezbyk6sounbdigb2asyeodcjdedzpm2"), + "storagemarket": MustParseCid("bafk2bzacea6kvoeb2v4mmvhf4vzmxim3objnsasjfg33jabqianczt7i3zyfi"), + "storageminer": MustParseCid("bafk2bzacecrmibyb4oyd53ik3zva5debmyzha72l65oom3ulwftfiv6jo5va2"), + "storagepower": MustParseCid("bafk2bzaceajch5ed7s2ennbnfny6r4l2kpidnxbsclqedvufi2b5635vsgabe"), + "system": MustParseCid("bafk2bzacea6dferxxxiimkdl43y7yqh6rywtbrprrg76pn2xfkyixwgd6j2jw"), + "verifiedregistry": MustParseCid("bafk2bzaceckaisg3sv4j6d3bsu5rqpvtw4vvzsosb5e2brxcllvjymgj6uvaa"), }, }, { Network: "caterpillarnet", @@ -156,23 +158,24 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet }, { Network: "caterpillarnet", Version: 10, - ManifestCid: MustParseCid("bafy2bzacea5csj2os7h76a6yvf6shgpwkysawijxemk5uvvzejxrwjo6ir4yg"), + ManifestCid: MustParseCid("bafy2bzacedkotw6g6uork3rjwqtoixta4ajphfqrjjqef6p3grqd5bwu7o6t6"), Actors: map[string]cid.Cid{ - "account": MustParseCid("bafk2bzacea7tpruyxdgyz4xa7curiphwdw4abmspft3ee24puruazdcl3tq5c"), - "cron": MustParseCid("bafk2bzacebc6kkj7kzsicm5baszjgd37b4b3kijsffqmmkhhjlyd7zhkwfcqm"), - "datacap": MustParseCid("bafk2bzaceddcmwl6po2jd3tfkkgv4zvub7i47gsx33pkqdspqhgvhe4npc4as"), - "eam": MustParseCid("bafk2bzaceccsvcww2rmqnh4plkq6oapqaeqbhydrtup54z4dwunolz5tpgtb4"), - "embryo": MustParseCid("bafk2bzacebj2mj5zlcs3yjlgpbznzistfjkdlwaoncjziliqrxqavvz4dcvnk"), - "evm": MustParseCid("bafk2bzacea5sig3zpxfkqppoj3t344cvuhzvkx6ge2isgdzc34rfpng2ogdje"), - "init": MustParseCid("bafk2bzacedtby353aho7itoyoj7w6moydmigjm3sgy6djgnfxqehlpae4vcc2"), - "multisig": MustParseCid("bafk2bzacedyguvwz5zfveqoqicn3j6lkdzipf247nhvdi6dvmahulr7nzgox6"), - "paymentchannel": MustParseCid("bafk2bzaceavaatmmnsz3v3ksopcbu6jx4iq7u7nnmqbclsiabsfkfu3zfpmka"), - "reward": MustParseCid("bafk2bzacecrphs4avteik4yejsqwkpy5bcqramdhnzykbfq3uu2qalj2p26ti"), - "storagemarket": MustParseCid("bafk2bzaceajby2jb5m3fenzarum374zxdzuyrpkspfljwovu7c3hvyceqd5sa"), - "storageminer": MustParseCid("bafk2bzacebqtn7jdvk756ighri5ajro6gjepnef3c6rxupbbgkth62zytiy5s"), - "storagepower": MustParseCid("bafk2bzacedwlo32brlalpovfkkk7qwo3ou2kpgv2bf7fioy5srn7uejmn7n46"), - "system": MustParseCid("bafk2bzacebbt63h26x5vw5fdo2pmdb4q65u3t6lilkugvmjar6zfsc7ethxsi"), - "verifiedregistry": MustParseCid("bafk2bzacecr5kbyypdxnxlepzk5sji2k72t454vto5ok4owfcuwfpeyivjtu4"), + "account": MustParseCid("bafk2bzaceckyjekq4bk5cdi2jxwm7frt4zi3fgx6jtxxwasjyf7novw6wjygy"), + "cron": MustParseCid("bafk2bzacedgrej6vnsjiagnt32uwmaaj7elar7qbqepmd7tbqgi4kvnut77fs"), + "datacap": MustParseCid("bafk2bzaceaty2is6zk4riuovw3sljonxwy6z4kor6iqn7qhpvisqwaytunhfi"), + "eam": MustParseCid("bafk2bzacebdnuqjgeeulpkre7pi7dhsyy2ylbhc2kaz2q3x774zcykwsnbh4y"), + "embryo": MustParseCid("bafk2bzaceax2tehd7m42kxf3z56hjj67buzucn5cj2456daz5yj4ai5txs2r4"), + "ethaccount": MustParseCid("bafk2bzaceayfch6isxpeocfq2gxdmzbk7cnj34qpuieb5mckutstjmffntrm2"), + "evm": MustParseCid("bafk2bzaceb7cxusflapxwubzwcievqtobkk2jhyek2wrgv2ym5io2s4xfy3aw"), + "init": MustParseCid("bafk2bzacebkwjggvge2budrgnhuclmyzivqvw2qt33odgxbycvr2dhdk6ipvq"), + "multisig": MustParseCid("bafk2bzacebyzyofjm636trmq5uriaccfbvnkjfxmjayfo3autndtuxpbz52co"), + "paymentchannel": MustParseCid("bafk2bzacea4m4bhoilmjzrrl7og2oudyj6juy3adod2duy6gkl3pzkunefpls"), + "reward": MustParseCid("bafk2bzaceavtfypwa6qpeo3j7bc2ty3zkphefy4hep43hhx4kssfmdr3utsga"), + "storagemarket": MustParseCid("bafk2bzacecoudxpin4hwajlzp7wufntfijus4nlnacfbqv4n3zfd4cstezmg6"), + "storageminer": MustParseCid("bafk2bzacebflyrvdlc2iu7aehjtaue5nsu45oelpzwrt7wslyngeyzyjderom"), + "storagepower": MustParseCid("bafk2bzacedem5mvgirhfloykv5owwafcleaaeog3x27datnnmfs2tp7yqwilg"), + "system": MustParseCid("bafk2bzacedtfjxsiimp2cfwpx2ocy6vvtj3xs57spddrywmodpzqhpov7az74"), + "verifiedregistry": MustParseCid("bafk2bzacec7slmn6lrpooarehctxdtmjdbizoxsj345im53x5u3mbphnp7764"), }, }, { Network: "devnet", @@ -212,23 +215,24 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet }, { Network: "devnet", Version: 10, - ManifestCid: MustParseCid("bafy2bzacea73thrlpfejrswlcu5uhe7rcgdewvmrcwoef6jzngsba3i4v5ibi"), + ManifestCid: MustParseCid("bafy2bzaced4j4o6aujjdnrcedyzqmdmy335mamepf5wxjxtrrrcbmjqjkwmai"), Actors: map[string]cid.Cid{ - "account": MustParseCid("bafk2bzaceau2o55aripm7kqrbzzog72zcduv5psnxzpohx5rdkykepc4z7aag"), - "cron": MustParseCid("bafk2bzacec5qc5xluwikf4lolfa4oe356iwep25tiezbxfdyg5jib54rhlh6q"), - "datacap": MustParseCid("bafk2bzacebo47u6q3xou5exsecjpa4rpfqjfm7vyhz4qlr3nk7p46trsk4occ"), - "eam": MustParseCid("bafk2bzacea6yeptevserd7ayf4ahokor4sdpizpxpbqwkuvvhzdkon672shsm"), - "embryo": MustParseCid("bafk2bzacebj2mj5zlcs3yjlgpbznzistfjkdlwaoncjziliqrxqavvz4dcvnk"), - "evm": MustParseCid("bafk2bzacebi46zgjili4luu3nqy6mno5k4skvo4cvs7genhkdfaukhtw7xirw"), - "init": MustParseCid("bafk2bzacedvf2bij6jovem2dfzkz347yvmydxj7vlgaiagosz5t3c5jyy43zu"), - "multisig": MustParseCid("bafk2bzacecukolwx6y5pcajnxg2aawiubgxo5zyj24a23zg5t4qu3k4qbofh4"), - "paymentchannel": MustParseCid("bafk2bzacecwyih7nodrwsw5vyl5zk7fapklje76jpowqjr6x6br2bm55smqqy"), - "reward": MustParseCid("bafk2bzacea6vfrcprxg2i4l5qnigf4c6pyvnjxpzfqr4pmph3elif7sfidrei"), - "storagemarket": MustParseCid("bafk2bzaceahradb3od4ahs46x6yriwvm36iabgtohhoiolubsumto5eravzbu"), - "storageminer": MustParseCid("bafk2bzacedekivqgvqapbepvzn6jte3xyymyg5yjuwy42xvboa6rcqnzgo74u"), - "storagepower": MustParseCid("bafk2bzacedkmiosllqqqarmr53twspyswdvsm7givwczgo3qqsxzpad4hzjma"), - "system": MustParseCid("bafk2bzaceagdymtxb4lxqqjgmnphbgdtdgveuuqaouswpzagj4bpbon3ptop4"), - "verifiedregistry": MustParseCid("bafk2bzacec556wsqldm22k2abshvvnsrawlm3bbqkwzht6ubcj76m2jsy3azi"), + "account": MustParseCid("bafk2bzacechueo4lu2celcpv54wfcg24fmrzhxflqqzo2wlisbmfnau5admrk"), + "cron": MustParseCid("bafk2bzacecwazk6vmemzhpqbziuc4h4ldmomvxbb64dpxdoupnbe22rq3ay7o"), + "datacap": MustParseCid("bafk2bzaceaq7ghb7j7tzjm3moeqnpzwwm22jmmxrtid7wb7bgudw5zuhbu6kk"), + "eam": MustParseCid("bafk2bzaceb7r6vktesqypltzqmdwev7izvljce3zbtgvrzz56zfoutvcmbmac"), + "embryo": MustParseCid("bafk2bzaceax2tehd7m42kxf3z56hjj67buzucn5cj2456daz5yj4ai5txs2r4"), + "ethaccount": MustParseCid("bafk2bzacedtdrfesgj6w6e4txltpwyhvu655dl6y3z3h3yszfcrfl2thcmvg2"), + "evm": MustParseCid("bafk2bzacebefcg7i6qa6b6hnnbdaobxe5knusmfxszydw5fcpradcdgnfxevu"), + "init": MustParseCid("bafk2bzacedgihzwljh7ss3i77fvfrmiei6rg2u3fxrlhxasnexmdsqt2wok32"), + "multisig": MustParseCid("bafk2bzacea6ecjhk64kh3mzcfd4elk5fj7c5dodey2jzpfd75h73mhpv5q5pg"), + "paymentchannel": MustParseCid("bafk2bzaceduj4lck7aywx2byp4xadkao6iapaze76b3gs46ueo4hwjwptuq56"), + "reward": MustParseCid("bafk2bzacednnsuol6pxcqduhwyi4jpn2ci6llw6e5jsps2t4zvqwhrizqk3jq"), + "storagemarket": MustParseCid("bafk2bzacecmoed6ip7omv4qm55klsa73zh6qb2pxapavvnw5d3uxymowdcbg2"), + "storageminer": MustParseCid("bafk2bzaceaeuxvmxuwkezbigjfnieirqkljl4evyjsfu2hklun2legmp6emos"), + "storagepower": MustParseCid("bafk2bzacec447h7soxygu37fph3f5qgua6t4e5h53p4cfk56zhxhw4xhavjt6"), + "system": MustParseCid("bafk2bzacec742xs2egn2xyfbspjkszsinpgamtdm4cj45k55mmw2gwbp7le7c"), + "verifiedregistry": MustParseCid("bafk2bzacedw6yaadhwqeifx2tr66zz2l4q5x37sb6udbbrwpopcwavlmyf65g"), }, }, { Network: "mainnet", @@ -268,23 +272,24 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet }, { Network: "mainnet", Version: 10, - ManifestCid: MustParseCid("bafy2bzaceduyggnyqhlr346hfw32tbobzrvhzhill33zhe7jw64pmwjci2xoc"), + ManifestCid: MustParseCid("bafy2bzaceb2pad2sm5pp73mplrgn43zgcruhnog3rtovxdstc33j6tqw2txeu"), Actors: map[string]cid.Cid{ - "account": MustParseCid("bafk2bzacedmr3wxl7qmhquageorrt3aavbzqfpm7eymxidakwuhaobu7dseqs"), - "cron": MustParseCid("bafk2bzaceblekxapm5nnqnxmw3mk27236iyutvbhhpsc3fyde7zi7guccn7cc"), - "datacap": MustParseCid("bafk2bzacedu4jevyvqsilq7bq4uhegbkm75muwebc5ifqpfaojwhexf2j4i6a"), - "eam": MustParseCid("bafk2bzacedc7224twbolvdq6iwc7ybdpah2ywe3ueo33jv67ecimndinle374"), - "embryo": MustParseCid("bafk2bzacebj2mj5zlcs3yjlgpbznzistfjkdlwaoncjziliqrxqavvz4dcvnk"), - "evm": MustParseCid("bafk2bzaceaggldo6wmkvp5innv4pnjv4xnpedspzofvma3dhu7vk45hh5djoq"), - "init": MustParseCid("bafk2bzacedutlaebaczkdi4vqvt3xim24u3whleqk2r4lufjd5jnmxcosea6q"), - "multisig": MustParseCid("bafk2bzaceatiqxjwtugpzus3s52zoggnrftxqn7kiw3obvjgkjvtd6zr3636q"), - "paymentchannel": MustParseCid("bafk2bzacebyviac6i43gtsvmjfg6mzcp6rwgz44axidc7m432btbmvt7i2m2g"), - "reward": MustParseCid("bafk2bzacecbcnlvk2izojpfoaksitqenhzaofn6ynxx5pegl4y45wjlouexdi"), - "storagemarket": MustParseCid("bafk2bzacebobteeoz2jycplgtydfyltzughegz2sopn6pzy2udjfvuo77joyk"), - "storageminer": MustParseCid("bafk2bzacecwcypas3y6u4rya7qolfwmou437xgrjxh7mnnim7bo3nhk4dscxw"), - "storagepower": MustParseCid("bafk2bzacec62kids6rcrdmdeqhwiz3s5rs35s5gn25ilwemgmm6jqnr2rnaaq"), - "system": MustParseCid("bafk2bzacecj3c4bjbs2xfttn7zqle7yocqh47u2s7hwuxrsn7fi5h74tcyxoc"), - "verifiedregistry": MustParseCid("bafk2bzacedgf7zbnlste5ukzueduemkimiit64scz7lvebztufx5jxtx6gkz2"), + "account": MustParseCid("bafk2bzaced52tigw7332nbwmntkhc3cbnhfwofxjgmgbb4a4zrz32ssoryoa2"), + "cron": MustParseCid("bafk2bzacecvbqhnxwrbdcmkby6gbancdegzpd5deur2gwz7m4jofqqvuwzjlq"), + "datacap": MustParseCid("bafk2bzacebsbpmcmu6iulwsyqfvvlmb3gb7wkikomxelic7q4edwm2se3mmkw"), + "eam": MustParseCid("bafk2bzacedlitpm3xq6ccwvagen74j33g4b5modvhmdyfdp3zgugdzi5i7zca"), + "embryo": MustParseCid("bafk2bzaceax2tehd7m42kxf3z56hjj67buzucn5cj2456daz5yj4ai5txs2r4"), + "ethaccount": MustParseCid("bafk2bzaceb3lxonodwk37f2oir6bniided2igfmzyguahvbr2jboqxtw36msg"), + "evm": MustParseCid("bafk2bzacedcd6nssqvrkhj5poggswcsx6nwhp6c35r7qdcuhpr3n3n7hvt4io"), + "init": MustParseCid("bafk2bzacebpxqu3snf35csvq3xhammyksous2vq3b5vo4j4wcmisfefc2g3im"), + "multisig": MustParseCid("bafk2bzaceayuaank6skp6vjemcpkkrq3j27aqdj7dxbz4zsrg4jrlgdqv4lki"), + "paymentchannel": MustParseCid("bafk2bzacebq4cq3bwtcwkqlogeeb2kd2wszi574qpeerlnyu6ue7uaa5yhrs6"), + "reward": MustParseCid("bafk2bzacebyps7ufqmyoleu2l6khm2f5lm4f7fdetsel2dkhob6ap3mncz3f4"), + "storagemarket": MustParseCid("bafk2bzacearla63zfijzysmg7bq53px5meslo6bs57wc22unepsb5vq2kmbxa"), + "storageminer": MustParseCid("bafk2bzacedwn3amkxwp5gfn3padbtstzukoxdny4zb3i72vtfyecf5qqfmx6c"), + "storagepower": MustParseCid("bafk2bzaceaqj4nwaekiczhqa5c3ijoj2qdtf6zyny573ybh5agk2wyfn5hrwa"), + "system": MustParseCid("bafk2bzacecnu27jhvsccspft5nlnava5ymj53qid2tvtoa5gq3whixejuqzc2"), + "verifiedregistry": MustParseCid("bafk2bzaceb5a3hot67g62augmuxmeu7nzwy4eputtdd5w6ncuhheycjzwbucu"), }, }, { Network: "testing", @@ -324,23 +329,24 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet }, { Network: "testing", Version: 10, - ManifestCid: MustParseCid("bafy2bzacearlgbespxi2zdrybtp2rrbwscmtbyou5qa2egbdvcz6v2yjjqvjo"), + ManifestCid: MustParseCid("bafy2bzaceav62uv5asafn2z5ycqtgfbiziym7lkfgdfoauxkjg23qj6lwgo2q"), Actors: map[string]cid.Cid{ - "account": MustParseCid("bafk2bzaceba6me5ipkcijuhyypnzjydhv3ebi2ctailar7mtzlk4vk3rbxfee"), - "cron": MustParseCid("bafk2bzacea6k2mai2xnakygqvbigivfrvv5q7d34qrzjv2crkqtwbjxnxmkbe"), - "datacap": MustParseCid("bafk2bzaceah4oxcgck6bcfkzctm2klpvmltyidq7uxnlkcap6ypi3lnkcvrqk"), - "eam": MustParseCid("bafk2bzacedjtkvocrnkrot2oztsfrxtpwl32wwbmbkrjfbbm4xipwzrhhxn5c"), - "embryo": MustParseCid("bafk2bzacebj2mj5zlcs3yjlgpbznzistfjkdlwaoncjziliqrxqavvz4dcvnk"), - "evm": MustParseCid("bafk2bzaced6vhabkr2ojpjzsybrq5yvksjzpjk6yei6fwobkwwydlj5f473pw"), - "init": MustParseCid("bafk2bzaceaib3o5e7wop7kwjirgpferqarmngrgjkur2yhdnwplctidpxsgme"), - "multisig": MustParseCid("bafk2bzaced4z3awacxumq6yr33a3adu2legb7colahgvqpmigs3fvvjxs3byc"), - "paymentchannel": MustParseCid("bafk2bzaceb6mfi24mpzt7qlkratj2tdtqo7aia67zcztuslrxcjaycz6fnai6"), - "reward": MustParseCid("bafk2bzacebngh5kwtem4ncarpjtxhs4rwyoficttkgxlsjtiz5ucdi4p3czoc"), - "storagemarket": MustParseCid("bafk2bzacecnsibyil62jfq2gbkoe6c2epehfcrxzjmqjnwz7kxab2hkbu3lks"), - "storageminer": MustParseCid("bafk2bzacedzw4vkrt3sdkhagpvn62pknyyjkcrzewncvtvae5qgwe6ulzx4a4"), - "storagepower": MustParseCid("bafk2bzacedxgadibot6nzvripqt3z5shvjsoscupinejnsvswq4cbeskblwyy"), - "system": MustParseCid("bafk2bzacedm24avrmp5o5odhpad43qeglooflygwh4ah7qnzbij2h4c3v6cge"), - "verifiedregistry": MustParseCid("bafk2bzaceapq3j6ww3ofytwq3pz3obumaqsyg3wrm6tksdh7op23a72co3rya"), + "account": MustParseCid("bafk2bzacedv3nqh7an5mruvymqd3yfo4llb2fkplfyuygoyjmw6zvms3getk6"), + "cron": MustParseCid("bafk2bzacebavz62zzbji2titwdal4gynm5izzpinvqxcuqzx2pcfazemknw56"), + "datacap": MustParseCid("bafk2bzacebtexhugokrbrftjrf5wyisv2kmz6gjngn5btzb2jcwi5rswlwswo"), + "eam": MustParseCid("bafk2bzacecejdlqwa4owqjx6vd7szgsl7eliwme4xkggch6qmdz4egei7ugrq"), + "embryo": MustParseCid("bafk2bzaceax2tehd7m42kxf3z56hjj67buzucn5cj2456daz5yj4ai5txs2r4"), + "ethaccount": MustParseCid("bafk2bzacedk3tsjwvjmvublhroesm7jwg7oymydo7zg35zfrqm327ojeizkoi"), + "evm": MustParseCid("bafk2bzacedgtmzatizm3l6e5qis7lzuodq2ky5brjladxxocsws2hbp2fgqzc"), + "init": MustParseCid("bafk2bzaceaevlnwyust4hjmmqx2owyy3x3pdmonjtqlwilfqxy4vidz32cbaq"), + "multisig": MustParseCid("bafk2bzacea6qbjyvq7uo66priz6maqluwjt7dfljv5xmzbm5guumqdmpak6ta"), + "paymentchannel": MustParseCid("bafk2bzacebcc5vdwkwizjjipy5mnk5ymneititrm7g6bcolvvnejys75qk7xg"), + "reward": MustParseCid("bafk2bzaceaycrdfmsayqyd5c6lxy6wevpkey57hrzukg7bcmctrccajzhl3oi"), + "storagemarket": MustParseCid("bafk2bzacecgpuwjbzvscr4stwclatt52xepd5yhcv3yzr6sfoijefiyi2blbu"), + "storageminer": MustParseCid("bafk2bzacedb77qv4zajpgjylvpuyephiffhavd4iujbmc7s2epkgbbkaijozg"), + "storagepower": MustParseCid("bafk2bzacealijkzu3qcehojibkth7kkhbi4v5ilxm6g5vhdn3apb3dfwuqgta"), + "system": MustParseCid("bafk2bzaceb3i3oqv5plkzrakukaphr2nq3q5sk55hmilmznfyshmthg7ybduq"), + "verifiedregistry": MustParseCid("bafk2bzaceb5n547gmp6idmulnlnxm3hoa3ib6x3yuzoilhim3r4u4acodka7e"), }, }, { Network: "testing-fake-proofs", @@ -380,22 +386,23 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet }, { Network: "testing-fake-proofs", Version: 10, - ManifestCid: MustParseCid("bafy2bzacea4irr2oxhclwt4mvtrevbzb7mbqddcebjz7bkqjq6eoflpfhencc"), + ManifestCid: MustParseCid("bafy2bzacebqopajwertdqzuklkqudhqh5coa6zhbj4zhkqkumlhjtn7gyzb3k"), Actors: map[string]cid.Cid{ - "account": MustParseCid("bafk2bzaceba6me5ipkcijuhyypnzjydhv3ebi2ctailar7mtzlk4vk3rbxfee"), - "cron": MustParseCid("bafk2bzacea6k2mai2xnakygqvbigivfrvv5q7d34qrzjv2crkqtwbjxnxmkbe"), - "datacap": MustParseCid("bafk2bzaceah4oxcgck6bcfkzctm2klpvmltyidq7uxnlkcap6ypi3lnkcvrqk"), - "eam": MustParseCid("bafk2bzacedjtkvocrnkrot2oztsfrxtpwl32wwbmbkrjfbbm4xipwzrhhxn5c"), - "embryo": MustParseCid("bafk2bzacebj2mj5zlcs3yjlgpbznzistfjkdlwaoncjziliqrxqavvz4dcvnk"), - "evm": MustParseCid("bafk2bzaced6vhabkr2ojpjzsybrq5yvksjzpjk6yei6fwobkwwydlj5f473pw"), - "init": MustParseCid("bafk2bzaceaib3o5e7wop7kwjirgpferqarmngrgjkur2yhdnwplctidpxsgme"), - "multisig": MustParseCid("bafk2bzaced4z3awacxumq6yr33a3adu2legb7colahgvqpmigs3fvvjxs3byc"), - "paymentchannel": MustParseCid("bafk2bzaceb6mfi24mpzt7qlkratj2tdtqo7aia67zcztuslrxcjaycz6fnai6"), - "reward": MustParseCid("bafk2bzacebngh5kwtem4ncarpjtxhs4rwyoficttkgxlsjtiz5ucdi4p3czoc"), - "storagemarket": MustParseCid("bafk2bzacecnsibyil62jfq2gbkoe6c2epehfcrxzjmqjnwz7kxab2hkbu3lks"), - "storageminer": MustParseCid("bafk2bzaceb4grddnw54gczgcdak5a2gqvwed66mhibbug6qu4jy35bf45jltg"), - "storagepower": MustParseCid("bafk2bzacedp2dnbk4bg3hhaeztre4q3jv7eqs267rlafszpggb2njjn3x5eru"), - "system": MustParseCid("bafk2bzacedm24avrmp5o5odhpad43qeglooflygwh4ah7qnzbij2h4c3v6cge"), - "verifiedregistry": MustParseCid("bafk2bzaceapq3j6ww3ofytwq3pz3obumaqsyg3wrm6tksdh7op23a72co3rya"), + "account": MustParseCid("bafk2bzacedv3nqh7an5mruvymqd3yfo4llb2fkplfyuygoyjmw6zvms3getk6"), + "cron": MustParseCid("bafk2bzacebavz62zzbji2titwdal4gynm5izzpinvqxcuqzx2pcfazemknw56"), + "datacap": MustParseCid("bafk2bzacebtexhugokrbrftjrf5wyisv2kmz6gjngn5btzb2jcwi5rswlwswo"), + "eam": MustParseCid("bafk2bzacecejdlqwa4owqjx6vd7szgsl7eliwme4xkggch6qmdz4egei7ugrq"), + "embryo": MustParseCid("bafk2bzaceax2tehd7m42kxf3z56hjj67buzucn5cj2456daz5yj4ai5txs2r4"), + "ethaccount": MustParseCid("bafk2bzacedk3tsjwvjmvublhroesm7jwg7oymydo7zg35zfrqm327ojeizkoi"), + "evm": MustParseCid("bafk2bzacedgtmzatizm3l6e5qis7lzuodq2ky5brjladxxocsws2hbp2fgqzc"), + "init": MustParseCid("bafk2bzaceaevlnwyust4hjmmqx2owyy3x3pdmonjtqlwilfqxy4vidz32cbaq"), + "multisig": MustParseCid("bafk2bzacea6qbjyvq7uo66priz6maqluwjt7dfljv5xmzbm5guumqdmpak6ta"), + "paymentchannel": MustParseCid("bafk2bzacebcc5vdwkwizjjipy5mnk5ymneititrm7g6bcolvvnejys75qk7xg"), + "reward": MustParseCid("bafk2bzaceaycrdfmsayqyd5c6lxy6wevpkey57hrzukg7bcmctrccajzhl3oi"), + "storagemarket": MustParseCid("bafk2bzacecgpuwjbzvscr4stwclatt52xepd5yhcv3yzr6sfoijefiyi2blbu"), + "storageminer": MustParseCid("bafk2bzacecka5zpyelv62iuqya6vfbhabhqc4qtugpe7po6kayy2v4yntzrl2"), + "storagepower": MustParseCid("bafk2bzacearjt7hf56on3qotxaxacrz3vqbdckuxf32m6azhu56oisi3j62xo"), + "system": MustParseCid("bafk2bzaceb3i3oqv5plkzrakukaphr2nq3q5sk55hmilmznfyshmthg7ybduq"), + "verifiedregistry": MustParseCid("bafk2bzaceb5n547gmp6idmulnlnxm3hoa3ib6x3yuzoilhim3r4u4acodka7e"), }, }} diff --git a/build/builtin_actors_test.go b/build/builtin_actors_test.go index 384193fee..858a8b3a1 100644 --- a/build/builtin_actors_test.go +++ b/build/builtin_actors_test.go @@ -6,6 +6,7 @@ import ( "github.com/stretchr/testify/require" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/actors" @@ -26,7 +27,7 @@ func TestRegistration(t *testing.T) { require.True(t, found) require.True(t, manifestCid.Defined()) - for _, key := range actors.GetBuiltinActorsKeys(av) { + for _, key := range manifest.GetBuiltinActorsKeys(av) { actorCid, found := actors.GetActorCodeID(av, key) require.True(t, found) name, version, found := actors.GetActorMetaByCode(actorCid) diff --git a/chain/actors/actor_cids.go b/chain/actors/actor_cids.go index 042426801..ad9ae4909 100644 --- a/chain/actors/actor_cids.go +++ b/chain/actors/actor_cids.go @@ -5,6 +5,7 @@ import ( "golang.org/x/xerrors" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" 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" @@ -28,7 +29,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { // Actors V7 and lower switch name { - case AccountKey: + case manifest.AccountKey: switch av { case actorstypes.Version0: @@ -53,7 +54,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { return builtin7.AccountActorCodeID, true } - case CronKey: + case manifest.CronKey: switch av { case actorstypes.Version0: @@ -78,7 +79,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { return builtin7.CronActorCodeID, true } - case InitKey: + case manifest.InitKey: switch av { case actorstypes.Version0: @@ -103,7 +104,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { return builtin7.InitActorCodeID, true } - case MarketKey: + case manifest.MarketKey: switch av { case actorstypes.Version0: @@ -128,7 +129,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { return builtin7.StorageMarketActorCodeID, true } - case MinerKey: + case manifest.MinerKey: switch av { case actorstypes.Version0: @@ -153,7 +154,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { return builtin7.StorageMinerActorCodeID, true } - case MultisigKey: + case manifest.MultisigKey: switch av { case actorstypes.Version0: @@ -178,7 +179,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { return builtin7.MultisigActorCodeID, true } - case PaychKey: + case manifest.PaychKey: switch av { case actorstypes.Version0: @@ -203,7 +204,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { return builtin7.PaymentChannelActorCodeID, true } - case PowerKey: + case manifest.PowerKey: switch av { case actorstypes.Version0: @@ -228,7 +229,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { return builtin7.StoragePowerActorCodeID, true } - case RewardKey: + case manifest.RewardKey: switch av { case actorstypes.Version0: @@ -253,7 +254,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { return builtin7.RewardActorCodeID, true } - case SystemKey: + case manifest.SystemKey: switch av { case actorstypes.Version0: @@ -278,7 +279,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { return builtin7.SystemActorCodeID, true } - case VerifregKey: + case manifest.VerifregKey: switch av { case actorstypes.Version0: @@ -314,7 +315,7 @@ func GetActorCodeIDs(av actorstypes.Version) (map[string]cid.Cid, error) { return cids, nil } - actorsKeys := GetBuiltinActorsKeys(av) + actorsKeys := manifest.GetBuiltinActorsKeys(av) synthCids := make(map[string]cid.Cid) for _, key := range actorsKeys { diff --git a/chain/actors/builtin/account/account.go b/chain/actors/builtin/account/account.go index 5a2d55961..4542ad767 100644 --- a/chain/actors/builtin/account/account.go +++ b/chain/actors/builtin/account/account.go @@ -8,6 +8,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" builtin10 "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" 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" @@ -25,7 +26,7 @@ var Methods = builtin10.MethodsAccount func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.AccountKey { + if name != manifest.AccountKey { return nil, xerrors.Errorf("actor code is not account: %s", name) } diff --git a/chain/actors/builtin/account/actor.go.template b/chain/actors/builtin/account/actor.go.template index ef6e7ac3d..2db38eff6 100644 --- a/chain/actors/builtin/account/actor.go.template +++ b/chain/actors/builtin/account/actor.go.template @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/go-state-types/manifest" {{range .versions}} {{if (le . 7)}} @@ -24,7 +25,7 @@ var Methods = builtin{{.latestVersion}}.MethodsAccount func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.AccountKey { + if name != manifest.AccountKey { return nil, xerrors.Errorf("actor code is not account: %s", name) } diff --git a/chain/actors/builtin/account/state.go.template b/chain/actors/builtin/account/state.go.template index 9b623519d..55a56de8c 100644 --- a/chain/actors/builtin/account/state.go.template +++ b/chain/actors/builtin/account/state.go.template @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors" + "github.com/filecoin-project/go-state-types/manifest" {{if (le .v 7)}} account{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/account" @@ -48,7 +49,7 @@ func (s *state{{.v}}) GetState() interface{} { } func (s *state{{.v}}) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/account/v0.go b/chain/actors/builtin/account/v0.go index f6af2c79c..a41ee3879 100644 --- a/chain/actors/builtin/account/v0.go +++ b/chain/actors/builtin/account/v0.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" account0 "github.com/filecoin-project/specs-actors/actors/builtin/account" "github.com/filecoin-project/lotus/chain/actors" @@ -44,7 +45,7 @@ func (s *state0) GetState() interface{} { } func (s *state0) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/account/v10.go b/chain/actors/builtin/account/v10.go index dbe7c609e..ff87c4212 100644 --- a/chain/actors/builtin/account/v10.go +++ b/chain/actors/builtin/account/v10.go @@ -8,6 +8,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" account10 "github.com/filecoin-project/go-state-types/builtin/v10/account" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -44,7 +45,7 @@ func (s *state10) GetState() interface{} { } func (s *state10) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/account/v2.go b/chain/actors/builtin/account/v2.go index 5e2297b4a..db0af77e2 100644 --- a/chain/actors/builtin/account/v2.go +++ b/chain/actors/builtin/account/v2.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" account2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/account" "github.com/filecoin-project/lotus/chain/actors" @@ -44,7 +45,7 @@ func (s *state2) GetState() interface{} { } func (s *state2) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/account/v3.go b/chain/actors/builtin/account/v3.go index 4e142bcf7..9e6c71ad0 100644 --- a/chain/actors/builtin/account/v3.go +++ b/chain/actors/builtin/account/v3.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" account3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/account" "github.com/filecoin-project/lotus/chain/actors" @@ -44,7 +45,7 @@ func (s *state3) GetState() interface{} { } func (s *state3) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/account/v4.go b/chain/actors/builtin/account/v4.go index 7b1e7f0dd..907896312 100644 --- a/chain/actors/builtin/account/v4.go +++ b/chain/actors/builtin/account/v4.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" account4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/account" "github.com/filecoin-project/lotus/chain/actors" @@ -44,7 +45,7 @@ func (s *state4) GetState() interface{} { } func (s *state4) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/account/v5.go b/chain/actors/builtin/account/v5.go index ad8bed522..8514ab325 100644 --- a/chain/actors/builtin/account/v5.go +++ b/chain/actors/builtin/account/v5.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" account5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/account" "github.com/filecoin-project/lotus/chain/actors" @@ -44,7 +45,7 @@ func (s *state5) GetState() interface{} { } func (s *state5) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/account/v6.go b/chain/actors/builtin/account/v6.go index 74c959c5f..16369f38c 100644 --- a/chain/actors/builtin/account/v6.go +++ b/chain/actors/builtin/account/v6.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" account6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/account" "github.com/filecoin-project/lotus/chain/actors" @@ -44,7 +45,7 @@ func (s *state6) GetState() interface{} { } func (s *state6) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/account/v7.go b/chain/actors/builtin/account/v7.go index 24d259f33..cd420da92 100644 --- a/chain/actors/builtin/account/v7.go +++ b/chain/actors/builtin/account/v7.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" account7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/account" "github.com/filecoin-project/lotus/chain/actors" @@ -44,7 +45,7 @@ func (s *state7) GetState() interface{} { } func (s *state7) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/account/v8.go b/chain/actors/builtin/account/v8.go index 2a4a74ca4..13b478de8 100644 --- a/chain/actors/builtin/account/v8.go +++ b/chain/actors/builtin/account/v8.go @@ -8,6 +8,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" account8 "github.com/filecoin-project/go-state-types/builtin/v8/account" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -44,7 +45,7 @@ func (s *state8) GetState() interface{} { } func (s *state8) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/account/v9.go b/chain/actors/builtin/account/v9.go index 97bcd43d7..fc1fc4d14 100644 --- a/chain/actors/builtin/account/v9.go +++ b/chain/actors/builtin/account/v9.go @@ -8,6 +8,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" account9 "github.com/filecoin-project/go-state-types/builtin/v9/account" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -44,7 +45,7 @@ func (s *state9) GetState() interface{} { } func (s *state9) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/builtin.go b/chain/actors/builtin/builtin.go index 82e80365a..8ab188317 100644 --- a/chain/actors/builtin/builtin.go +++ b/chain/actors/builtin/builtin.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-state-types/builtin" smoothingtypes "github.com/filecoin-project/go-state-types/builtin/v8/util/smoothing" minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/go-state-types/proof" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" @@ -165,7 +166,7 @@ func IsAccountActor(c cid.Cid) bool { func IsStorageMinerActor(c cid.Cid) bool { name, _, ok := actors.GetActorMetaByCode(c) if ok { - return name == actors.MinerKey + return name == manifest.MinerKey } if c == builtin0.StorageMinerActorCodeID { @@ -202,7 +203,7 @@ func IsStorageMinerActor(c cid.Cid) bool { func IsMultisigActor(c cid.Cid) bool { name, _, ok := actors.GetActorMetaByCode(c) if ok { - return name == actors.MultisigKey + return name == manifest.MultisigKey } if c == builtin0.MultisigActorCodeID { @@ -273,6 +274,24 @@ func IsPaymentChannelActor(c cid.Cid) bool { return false } +func IsEmbryoActor(c cid.Cid) bool { + name, _, ok := actors.GetActorMetaByCode(c) + if ok { + return name == "embryo" + } + + return false +} + +func IsEthAccountActor(c cid.Cid) bool { + name, _, ok := actors.GetActorMetaByCode(c) + if ok { + return name == "ethaccount" + } + + return false +} + func makeAddress(addr string) address.Address { ret, err := address.NewFromString(addr) if err != nil { diff --git a/chain/actors/builtin/builtin.go.template b/chain/actors/builtin/builtin.go.template index 825f6cc07..5cd9b1f7f 100644 --- a/chain/actors/builtin/builtin.go.template +++ b/chain/actors/builtin/builtin.go.template @@ -15,6 +15,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/proof" "github.com/filecoin-project/go-state-types/builtin" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" @@ -107,7 +108,7 @@ func IsAccountActor(c cid.Cid) bool { func IsStorageMinerActor(c cid.Cid) bool { name, _, ok := actors.GetActorMetaByCode(c) if ok { - return name == actors.MinerKey + return name == manifest.MinerKey } {{range .versions}} @@ -123,7 +124,7 @@ func IsStorageMinerActor(c cid.Cid) bool { func IsMultisigActor(c cid.Cid) bool { name, _, ok := actors.GetActorMetaByCode(c) if ok { - return name == actors.MultisigKey + return name == manifest.MultisigKey } {{range .versions}} @@ -152,6 +153,24 @@ func IsPaymentChannelActor(c cid.Cid) bool { return false } +func IsEmbryoActor(c cid.Cid) bool { + name, _, ok := actors.GetActorMetaByCode(c) + if ok { + return name == "embryo" + } + + return false +} + +func IsEthAccountActor(c cid.Cid) bool { + name, _, ok := actors.GetActorMetaByCode(c) + if ok { + return name == "ethaccount" + } + + return false +} + func makeAddress(addr string) address.Address { ret, err := address.NewFromString(addr) if err != nil { diff --git a/chain/actors/builtin/cron/actor.go.template b/chain/actors/builtin/cron/actor.go.template index 3abb33e63..7e01483d2 100644 --- a/chain/actors/builtin/cron/actor.go.template +++ b/chain/actors/builtin/cron/actor.go.template @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "golang.org/x/xerrors" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/go-state-types/manifest" {{range .versions}} {{if (le . 7)}} @@ -18,7 +19,7 @@ import ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.CronKey { + if name != manifest.CronKey { return nil, xerrors.Errorf("actor code is not cron: %s", name) } diff --git a/chain/actors/builtin/cron/cron.go b/chain/actors/builtin/cron/cron.go index 3f573789a..43b8c0eaa 100644 --- a/chain/actors/builtin/cron/cron.go +++ b/chain/actors/builtin/cron/cron.go @@ -6,6 +6,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" builtin10 "github.com/filecoin-project/go-state-types/builtin" + "github.com/filecoin-project/go-state-types/manifest" 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" @@ -21,7 +22,7 @@ import ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.CronKey { + if name != manifest.CronKey { return nil, xerrors.Errorf("actor code is not cron: %s", name) } diff --git a/chain/actors/builtin/cron/state.go.template b/chain/actors/builtin/cron/state.go.template index 24739f162..ca82d8be8 100644 --- a/chain/actors/builtin/cron/state.go.template +++ b/chain/actors/builtin/cron/state.go.template @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" {{if (le .v 7)}} cron{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/cron" @@ -42,7 +43,7 @@ func (s *state{{.v}}) GetState() interface{} { } func (s *state{{.v}}) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/cron/v0.go b/chain/actors/builtin/cron/v0.go index ef5f6d93e..6dce524f6 100644 --- a/chain/actors/builtin/cron/v0.go +++ b/chain/actors/builtin/cron/v0.go @@ -6,6 +6,7 @@ import ( "github.com/ipfs/go-cid" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" cron0 "github.com/filecoin-project/specs-actors/actors/builtin/cron" "github.com/filecoin-project/lotus/chain/actors" @@ -39,7 +40,7 @@ func (s *state0) GetState() interface{} { } func (s *state0) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/cron/v10.go b/chain/actors/builtin/cron/v10.go index 4e2e1c815..2d20e2401 100644 --- a/chain/actors/builtin/cron/v10.go +++ b/chain/actors/builtin/cron/v10.go @@ -7,6 +7,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" cron10 "github.com/filecoin-project/go-state-types/builtin/v10/cron" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -39,7 +40,7 @@ func (s *state10) GetState() interface{} { } func (s *state10) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/cron/v2.go b/chain/actors/builtin/cron/v2.go index fc45be0de..97b3ffbe0 100644 --- a/chain/actors/builtin/cron/v2.go +++ b/chain/actors/builtin/cron/v2.go @@ -6,6 +6,7 @@ import ( "github.com/ipfs/go-cid" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" cron2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/cron" "github.com/filecoin-project/lotus/chain/actors" @@ -39,7 +40,7 @@ func (s *state2) GetState() interface{} { } func (s *state2) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/cron/v3.go b/chain/actors/builtin/cron/v3.go index 6f8e66a3b..4c0d4f1d9 100644 --- a/chain/actors/builtin/cron/v3.go +++ b/chain/actors/builtin/cron/v3.go @@ -6,6 +6,7 @@ import ( "github.com/ipfs/go-cid" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" cron3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/cron" "github.com/filecoin-project/lotus/chain/actors" @@ -39,7 +40,7 @@ func (s *state3) GetState() interface{} { } func (s *state3) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/cron/v4.go b/chain/actors/builtin/cron/v4.go index 2539f2b1c..a222f0d93 100644 --- a/chain/actors/builtin/cron/v4.go +++ b/chain/actors/builtin/cron/v4.go @@ -6,6 +6,7 @@ import ( "github.com/ipfs/go-cid" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" cron4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/cron" "github.com/filecoin-project/lotus/chain/actors" @@ -39,7 +40,7 @@ func (s *state4) GetState() interface{} { } func (s *state4) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/cron/v5.go b/chain/actors/builtin/cron/v5.go index 8aba47a2b..2487cbbc6 100644 --- a/chain/actors/builtin/cron/v5.go +++ b/chain/actors/builtin/cron/v5.go @@ -6,6 +6,7 @@ import ( "github.com/ipfs/go-cid" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" cron5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/cron" "github.com/filecoin-project/lotus/chain/actors" @@ -39,7 +40,7 @@ func (s *state5) GetState() interface{} { } func (s *state5) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/cron/v6.go b/chain/actors/builtin/cron/v6.go index f607a409f..673e7588a 100644 --- a/chain/actors/builtin/cron/v6.go +++ b/chain/actors/builtin/cron/v6.go @@ -6,6 +6,7 @@ import ( "github.com/ipfs/go-cid" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" cron6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/cron" "github.com/filecoin-project/lotus/chain/actors" @@ -39,7 +40,7 @@ func (s *state6) GetState() interface{} { } func (s *state6) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/cron/v7.go b/chain/actors/builtin/cron/v7.go index ef962fd41..cd71bd418 100644 --- a/chain/actors/builtin/cron/v7.go +++ b/chain/actors/builtin/cron/v7.go @@ -6,6 +6,7 @@ import ( "github.com/ipfs/go-cid" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" cron7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/cron" "github.com/filecoin-project/lotus/chain/actors" @@ -39,7 +40,7 @@ func (s *state7) GetState() interface{} { } func (s *state7) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/cron/v8.go b/chain/actors/builtin/cron/v8.go index 377cba060..904de5496 100644 --- a/chain/actors/builtin/cron/v8.go +++ b/chain/actors/builtin/cron/v8.go @@ -7,6 +7,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" cron8 "github.com/filecoin-project/go-state-types/builtin/v8/cron" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -39,7 +40,7 @@ func (s *state8) GetState() interface{} { } func (s *state8) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/cron/v9.go b/chain/actors/builtin/cron/v9.go index b2e1d1265..201348b6c 100644 --- a/chain/actors/builtin/cron/v9.go +++ b/chain/actors/builtin/cron/v9.go @@ -7,6 +7,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" cron9 "github.com/filecoin-project/go-state-types/builtin/v9/cron" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -39,7 +40,7 @@ func (s *state9) GetState() interface{} { } func (s *state9) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/datacap/actor.go.template b/chain/actors/builtin/datacap/actor.go.template index 15272d7d1..7bf4fbef2 100644 --- a/chain/actors/builtin/datacap/actor.go.template +++ b/chain/actors/builtin/datacap/actor.go.template @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/go-state-types/manifest" ) var ( @@ -23,7 +24,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.DatacapKey { + if name != manifest.DatacapKey { return nil, xerrors.Errorf("actor code is not datacap: %s", name) } diff --git a/chain/actors/builtin/datacap/datacap.go b/chain/actors/builtin/datacap/datacap.go index 977c020d3..c12c77230 100644 --- a/chain/actors/builtin/datacap/datacap.go +++ b/chain/actors/builtin/datacap/datacap.go @@ -9,6 +9,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" builtin10 "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -22,7 +23,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.DatacapKey { + if name != manifest.DatacapKey { return nil, xerrors.Errorf("actor code is not datacap: %s", name) } diff --git a/chain/actors/builtin/datacap/state.go.template b/chain/actors/builtin/datacap/state.go.template index dfb6eaad4..de0ccb4be 100644 --- a/chain/actors/builtin/datacap/state.go.template +++ b/chain/actors/builtin/datacap/state.go.template @@ -12,6 +12,7 @@ import ( datacap{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}datacap" adt{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}util/adt" + "github.com/filecoin-project/go-state-types/manifest" ) var _ State = (*state{{.v}})(nil) @@ -63,7 +64,7 @@ func (s *state{{.v}}) VerifiedClientDataCap(addr address.Address) (bool, abi.Sto } func (s *state{{.v}}) ActorKey() string { - return actors.DatacapKey + return manifest.DatacapKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/datacap/v10.go b/chain/actors/builtin/datacap/v10.go index 6f4c8593d..25eec4ea8 100644 --- a/chain/actors/builtin/datacap/v10.go +++ b/chain/actors/builtin/datacap/v10.go @@ -10,6 +10,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" datacap10 "github.com/filecoin-project/go-state-types/builtin/v10/datacap" adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -64,7 +65,7 @@ func (s *state10) VerifiedClientDataCap(addr address.Address) (bool, abi.Storage } func (s *state10) ActorKey() string { - return actors.DatacapKey + return manifest.DatacapKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/datacap/v9.go b/chain/actors/builtin/datacap/v9.go index 6dcf04477..1d239fb95 100644 --- a/chain/actors/builtin/datacap/v9.go +++ b/chain/actors/builtin/datacap/v9.go @@ -10,6 +10,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" datacap9 "github.com/filecoin-project/go-state-types/builtin/v9/datacap" adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -64,7 +65,7 @@ func (s *state9) VerifiedClientDataCap(addr address.Address) (bool, abi.StorageP } func (s *state9) ActorKey() string { - return actors.DatacapKey + return manifest.DatacapKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/embryo.go b/chain/actors/builtin/embryo.go deleted file mode 100644 index 6879b7dc5..000000000 --- a/chain/actors/builtin/embryo.go +++ /dev/null @@ -1,12 +0,0 @@ -package builtin - -import ( - "github.com/ipfs/go-cid" - - "github.com/filecoin-project/lotus/chain/actors" -) - -func IsEmbryo(c cid.Cid) bool { - name, _, ok := actors.GetActorMetaByCode(c) - return ok && name == "embryo" -} diff --git a/chain/actors/builtin/evm/actor.go.template b/chain/actors/builtin/evm/actor.go.template index 698029253..d20db6bcb 100644 --- a/chain/actors/builtin/evm/actor.go.template +++ b/chain/actors/builtin/evm/actor.go.template @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/go-state-types/manifest" builtin{{.latestVersion}} "github.com/filecoin-project/go-state-types/builtin" ) @@ -18,7 +19,7 @@ var Methods = builtin{{.latestVersion}}.MethodsEVM func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.EvmKey { + if name != manifest.EvmKey { return nil, xerrors.Errorf("actor code is not evm: %s", name) } diff --git a/chain/actors/builtin/evm/evm.go b/chain/actors/builtin/evm/evm.go index 69bd90c42..120ca66f8 100644 --- a/chain/actors/builtin/evm/evm.go +++ b/chain/actors/builtin/evm/evm.go @@ -7,6 +7,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" builtin10 "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -17,7 +18,7 @@ var Methods = builtin10.MethodsEVM func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.EvmKey { + if name != manifest.EvmKey { return nil, xerrors.Errorf("actor code is not evm: %s", name) } diff --git a/chain/actors/builtin/init/actor.go.template b/chain/actors/builtin/init/actor.go.template index 453aba963..1d19ebb40 100644 --- a/chain/actors/builtin/init/actor.go.template +++ b/chain/actors/builtin/init/actor.go.template @@ -13,6 +13,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/node/modules/dtypes" + "github.com/filecoin-project/go-state-types/manifest" {{range .versions}} {{if (le . 7)}} builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin" @@ -28,7 +29,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.InitKey { + if name != manifest.InitKey { return nil, xerrors.Errorf("actor code is not init: %s", name) } diff --git a/chain/actors/builtin/init/init.go b/chain/actors/builtin/init/init.go index a97d40297..c38629d2d 100644 --- a/chain/actors/builtin/init/init.go +++ b/chain/actors/builtin/init/init.go @@ -9,6 +9,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" builtin10 "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" 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" @@ -30,7 +31,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.InitKey { + if name != manifest.InitKey { return nil, xerrors.Errorf("actor code is not init: %s", name) } diff --git a/chain/actors/builtin/init/state.go.template b/chain/actors/builtin/init/state.go.template index c31aef6a0..52e223a85 100644 --- a/chain/actors/builtin/init/state.go.template +++ b/chain/actors/builtin/init/state.go.template @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/lotus/node/modules/dtypes" + "github.com/filecoin-project/go-state-types/manifest" {{if (le .v 7)}} {{if (ge .v 3)}} @@ -148,7 +149,7 @@ func (s *state{{.v}}) AddressMapHashFunction() func(input []byte) []byte { } func (s *state{{.v}}) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/init/v0.go b/chain/actors/builtin/init/v0.go index 61ae3f2db..7e48dda9e 100644 --- a/chain/actors/builtin/init/v0.go +++ b/chain/actors/builtin/init/v0.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" init0 "github.com/filecoin-project/specs-actors/actors/builtin/init" adt0 "github.com/filecoin-project/specs-actors/actors/util/adt" @@ -128,7 +129,7 @@ func (s *state0) AddressMapHashFunction() func(input []byte) []byte { } func (s *state0) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/init/v10.go b/chain/actors/builtin/init/v10.go index 761f9dacc..dd8c778dd 100644 --- a/chain/actors/builtin/init/v10.go +++ b/chain/actors/builtin/init/v10.go @@ -14,6 +14,7 @@ import ( builtin10 "github.com/filecoin-project/go-state-types/builtin" init10 "github.com/filecoin-project/go-state-types/builtin/v10/init" adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -129,7 +130,7 @@ func (s *state10) AddressMapHashFunction() func(input []byte) []byte { } func (s *state10) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/init/v2.go b/chain/actors/builtin/init/v2.go index dfbdde6c9..c107bd52d 100644 --- a/chain/actors/builtin/init/v2.go +++ b/chain/actors/builtin/init/v2.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init" adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt" @@ -128,7 +129,7 @@ func (s *state2) AddressMapHashFunction() func(input []byte) []byte { } func (s *state2) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/init/v3.go b/chain/actors/builtin/init/v3.go index 56a5e4afd..0be11f976 100644 --- a/chain/actors/builtin/init/v3.go +++ b/chain/actors/builtin/init/v3.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin" init3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/init" adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt" @@ -129,7 +130,7 @@ func (s *state3) AddressMapHashFunction() func(input []byte) []byte { } func (s *state3) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/init/v4.go b/chain/actors/builtin/init/v4.go index b1ecd3188..5ca6bc1c8 100644 --- a/chain/actors/builtin/init/v4.go +++ b/chain/actors/builtin/init/v4.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin" init4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/init" adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt" @@ -129,7 +130,7 @@ func (s *state4) AddressMapHashFunction() func(input []byte) []byte { } func (s *state4) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/init/v5.go b/chain/actors/builtin/init/v5.go index b8a6438d7..f6450789d 100644 --- a/chain/actors/builtin/init/v5.go +++ b/chain/actors/builtin/init/v5.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" init5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/init" adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt" @@ -129,7 +130,7 @@ func (s *state5) AddressMapHashFunction() func(input []byte) []byte { } func (s *state5) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/init/v6.go b/chain/actors/builtin/init/v6.go index aeadc2caf..4d2267aa1 100644 --- a/chain/actors/builtin/init/v6.go +++ b/chain/actors/builtin/init/v6.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" init6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/init" adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt" @@ -129,7 +130,7 @@ func (s *state6) AddressMapHashFunction() func(input []byte) []byte { } func (s *state6) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/init/v7.go b/chain/actors/builtin/init/v7.go index e62c56277..052faf985 100644 --- a/chain/actors/builtin/init/v7.go +++ b/chain/actors/builtin/init/v7.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin" init7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/init" adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt" @@ -129,7 +130,7 @@ func (s *state7) AddressMapHashFunction() func(input []byte) []byte { } func (s *state7) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/init/v8.go b/chain/actors/builtin/init/v8.go index 145b75551..c7c7860d3 100644 --- a/chain/actors/builtin/init/v8.go +++ b/chain/actors/builtin/init/v8.go @@ -14,6 +14,7 @@ import ( builtin8 "github.com/filecoin-project/go-state-types/builtin" init8 "github.com/filecoin-project/go-state-types/builtin/v8/init" adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -129,7 +130,7 @@ func (s *state8) AddressMapHashFunction() func(input []byte) []byte { } func (s *state8) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/init/v9.go b/chain/actors/builtin/init/v9.go index 8cba18e7a..a221a4a7c 100644 --- a/chain/actors/builtin/init/v9.go +++ b/chain/actors/builtin/init/v9.go @@ -14,6 +14,7 @@ import ( builtin9 "github.com/filecoin-project/go-state-types/builtin" init9 "github.com/filecoin-project/go-state-types/builtin/v9/init" adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -129,7 +130,7 @@ func (s *state9) AddressMapHashFunction() func(input []byte) []byte { } func (s *state9) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/actor.go.template b/chain/actors/builtin/market/actor.go.template index b8d8c987b..a84c04ab9 100644 --- a/chain/actors/builtin/market/actor.go.template +++ b/chain/actors/builtin/market/actor.go.template @@ -13,6 +13,7 @@ import ( "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/cbor" cbg "github.com/whyrusleeping/cbor-gen" + "github.com/filecoin-project/go-state-types/manifest" markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" @@ -36,7 +37,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.MarketKey { + if name != manifest.MarketKey { return nil, xerrors.Errorf("actor code is not market: %s", name) } diff --git a/chain/actors/builtin/market/market.go b/chain/actors/builtin/market/market.go index e96484d64..fc057549d 100644 --- a/chain/actors/builtin/market/market.go +++ b/chain/actors/builtin/market/market.go @@ -15,6 +15,7 @@ import ( markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/go-state-types/network" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" @@ -36,7 +37,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.MarketKey { + if name != manifest.MarketKey { return nil, xerrors.Errorf("actor code is not market: %s", name) } diff --git a/chain/actors/builtin/market/state.go.template b/chain/actors/builtin/market/state.go.template index ef5dff0a5..bbaa5c775 100644 --- a/chain/actors/builtin/market/state.go.template +++ b/chain/actors/builtin/market/state.go.template @@ -20,6 +20,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/types" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" {{if (le .v 7)}} market{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/market" @@ -394,7 +395,7 @@ func (s *state{{.v}}) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifreg func (s *state{{.v}}) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/v0.go b/chain/actors/builtin/market/v0.go index 4af5fe9b0..c0a628b47 100644 --- a/chain/actors/builtin/market/v0.go +++ b/chain/actors/builtin/market/v0.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" market0 "github.com/filecoin-project/specs-actors/actors/builtin/market" adt0 "github.com/filecoin-project/specs-actors/actors/util/adt" @@ -312,7 +313,7 @@ func (s *state0) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes } func (s *state0) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/v10.go b/chain/actors/builtin/market/v10.go index 21acf15ac..aaa0ee0f1 100644 --- a/chain/actors/builtin/market/v10.go +++ b/chain/actors/builtin/market/v10.go @@ -18,6 +18,7 @@ import ( adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt" markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -359,7 +360,7 @@ func (s *state10) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtype } func (s *state10) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/v2.go b/chain/actors/builtin/market/v2.go index 45a357f33..89ffdde8f 100644 --- a/chain/actors/builtin/market/v2.go +++ b/chain/actors/builtin/market/v2.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market" adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt" @@ -312,7 +313,7 @@ func (s *state2) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes } func (s *state2) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/v3.go b/chain/actors/builtin/market/v3.go index ec745f5a0..f4d073ed8 100644 --- a/chain/actors/builtin/market/v3.go +++ b/chain/actors/builtin/market/v3.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" market3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/market" adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt" @@ -307,7 +308,7 @@ func (s *state3) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes } func (s *state3) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/v4.go b/chain/actors/builtin/market/v4.go index 03e728c15..422a30cbb 100644 --- a/chain/actors/builtin/market/v4.go +++ b/chain/actors/builtin/market/v4.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" market4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/market" adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt" @@ -307,7 +308,7 @@ func (s *state4) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes } func (s *state4) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/v5.go b/chain/actors/builtin/market/v5.go index 98d498258..b30decb03 100644 --- a/chain/actors/builtin/market/v5.go +++ b/chain/actors/builtin/market/v5.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" market5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/market" adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt" @@ -307,7 +308,7 @@ func (s *state5) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes } func (s *state5) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/v6.go b/chain/actors/builtin/market/v6.go index 5966f2f8b..377b278ae 100644 --- a/chain/actors/builtin/market/v6.go +++ b/chain/actors/builtin/market/v6.go @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" market6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/market" adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt" @@ -325,7 +326,7 @@ func (s *state6) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes } func (s *state6) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/v7.go b/chain/actors/builtin/market/v7.go index df910cd4a..cd4607cbe 100644 --- a/chain/actors/builtin/market/v7.go +++ b/chain/actors/builtin/market/v7.go @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market" adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt" @@ -325,7 +326,7 @@ func (s *state7) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes } func (s *state7) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/v8.go b/chain/actors/builtin/market/v8.go index 1c0bfd3c5..5cce06d3a 100644 --- a/chain/actors/builtin/market/v8.go +++ b/chain/actors/builtin/market/v8.go @@ -17,6 +17,7 @@ import ( adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt" markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -342,7 +343,7 @@ func (s *state8) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes } func (s *state8) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/v9.go b/chain/actors/builtin/market/v9.go index 9335a235a..095c20850 100644 --- a/chain/actors/builtin/market/v9.go +++ b/chain/actors/builtin/market/v9.go @@ -18,6 +18,7 @@ import ( markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market" adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -359,7 +360,7 @@ func (s *state9) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes } func (s *state9) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/actor.go.template b/chain/actors/builtin/miner/actor.go.template index 74923a453..abbcbfeb6 100644 --- a/chain/actors/builtin/miner/actor.go.template +++ b/chain/actors/builtin/miner/actor.go.template @@ -18,6 +18,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/types" minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner" + "github.com/filecoin-project/go-state-types/manifest" {{range .versions}} {{if (le . 7)}} @@ -28,7 +29,7 @@ import ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.MinerKey { + if name != manifest.MinerKey { return nil, xerrors.Errorf("actor code is not miner: %s", name) } @@ -79,6 +80,7 @@ type State interface { LockedFunds() (LockedFunds, error) FeeDebt() (abi.TokenAmount, error) + // Returns nil, nil if sector is not found GetSector(abi.SectorNumber) (*SectorOnChainInfo, error) FindSector(abi.SectorNumber) (*SectorLocation, error) GetSectorExpiration(abi.SectorNumber) (*SectorExpiration, error) diff --git a/chain/actors/builtin/miner/miner.go b/chain/actors/builtin/miner/miner.go index 8d1dc89e9..1931af3d3 100644 --- a/chain/actors/builtin/miner/miner.go +++ b/chain/actors/builtin/miner/miner.go @@ -12,6 +12,7 @@ import ( minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner" "github.com/filecoin-project/go-state-types/cbor" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/proof" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" @@ -29,7 +30,7 @@ import ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.MinerKey { + if name != manifest.MinerKey { return nil, xerrors.Errorf("actor code is not miner: %s", name) } @@ -127,6 +128,7 @@ type State interface { LockedFunds() (LockedFunds, error) FeeDebt() (abi.TokenAmount, error) + // Returns nil, nil if sector is not found GetSector(abi.SectorNumber) (*SectorOnChainInfo, error) FindSector(abi.SectorNumber) (*SectorLocation, error) GetSectorExpiration(abi.SectorNumber) (*SectorExpiration, error) diff --git a/chain/actors/builtin/miner/state.go.template b/chain/actors/builtin/miner/state.go.template index e6994daa3..b322b2283 100644 --- a/chain/actors/builtin/miner/state.go.template +++ b/chain/actors/builtin/miner/state.go.template @@ -18,6 +18,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" {{if (le .v 7)}} {{if (ge .v 3)}} @@ -100,6 +101,7 @@ func (s *state{{.v}}) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state{{.v}}) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { @@ -613,7 +615,7 @@ func (s *state{{.v}}) GetState() interface{} { } func (s *state{{.v}}) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/v0.go b/chain/actors/builtin/miner/v0.go index d053df0ac..7d5eaf8e0 100644 --- a/chain/actors/builtin/miner/v0.go +++ b/chain/actors/builtin/miner/v0.go @@ -15,6 +15,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" adt0 "github.com/filecoin-project/specs-actors/actors/util/adt" @@ -90,6 +91,7 @@ func (s *state0) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state0) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { @@ -534,7 +536,7 @@ func (s *state0) GetState() interface{} { } func (s *state0) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/v10.go b/chain/actors/builtin/miner/v10.go index 3cd3974b5..4d47ba396 100644 --- a/chain/actors/builtin/miner/v10.go +++ b/chain/actors/builtin/miner/v10.go @@ -17,6 +17,7 @@ import ( miner10 "github.com/filecoin-project/go-state-types/builtin/v10/miner" adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -90,6 +91,7 @@ func (s *state10) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state10) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { @@ -572,7 +574,7 @@ func (s *state10) GetState() interface{} { } func (s *state10) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/v2.go b/chain/actors/builtin/miner/v2.go index 33c00ae62..14341ae38 100644 --- a/chain/actors/builtin/miner/v2.go +++ b/chain/actors/builtin/miner/v2.go @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner" adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt" @@ -89,6 +90,7 @@ func (s *state2) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state2) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { @@ -565,7 +567,7 @@ func (s *state2) GetState() interface{} { } func (s *state2) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/v3.go b/chain/actors/builtin/miner/v3.go index c59a053bd..52808da8c 100644 --- a/chain/actors/builtin/miner/v3.go +++ b/chain/actors/builtin/miner/v3.go @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin" miner3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/miner" adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt" @@ -90,6 +91,7 @@ func (s *state3) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state3) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { @@ -565,7 +567,7 @@ func (s *state3) GetState() interface{} { } func (s *state3) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/v4.go b/chain/actors/builtin/miner/v4.go index 0eecd89f3..5980ef769 100644 --- a/chain/actors/builtin/miner/v4.go +++ b/chain/actors/builtin/miner/v4.go @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin" miner4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/miner" adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt" @@ -90,6 +91,7 @@ func (s *state4) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state4) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { @@ -565,7 +567,7 @@ func (s *state4) GetState() interface{} { } func (s *state4) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/v5.go b/chain/actors/builtin/miner/v5.go index f667a7149..886300ea3 100644 --- a/chain/actors/builtin/miner/v5.go +++ b/chain/actors/builtin/miner/v5.go @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner" adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt" @@ -90,6 +91,7 @@ func (s *state5) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state5) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { @@ -565,7 +567,7 @@ func (s *state5) GetState() interface{} { } func (s *state5) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/v6.go b/chain/actors/builtin/miner/v6.go index 37e4aba0b..4737b0ee2 100644 --- a/chain/actors/builtin/miner/v6.go +++ b/chain/actors/builtin/miner/v6.go @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" miner6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/miner" adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt" @@ -90,6 +91,7 @@ func (s *state6) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state6) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { @@ -565,7 +567,7 @@ func (s *state6) GetState() interface{} { } func (s *state6) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/v7.go b/chain/actors/builtin/miner/v7.go index 4d330a4e7..72803eb75 100644 --- a/chain/actors/builtin/miner/v7.go +++ b/chain/actors/builtin/miner/v7.go @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin" miner7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/miner" adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt" @@ -90,6 +91,7 @@ func (s *state7) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state7) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { @@ -566,7 +568,7 @@ func (s *state7) GetState() interface{} { } func (s *state7) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/v8.go b/chain/actors/builtin/miner/v8.go index 1822a3c25..3e3739591 100644 --- a/chain/actors/builtin/miner/v8.go +++ b/chain/actors/builtin/miner/v8.go @@ -17,6 +17,7 @@ import ( miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner" adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -90,6 +91,7 @@ func (s *state8) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state8) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { @@ -566,7 +568,7 @@ func (s *state8) GetState() interface{} { } func (s *state8) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/v9.go b/chain/actors/builtin/miner/v9.go index 39328c559..72d9dbd59 100644 --- a/chain/actors/builtin/miner/v9.go +++ b/chain/actors/builtin/miner/v9.go @@ -17,6 +17,7 @@ import ( miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner" adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -90,6 +91,7 @@ func (s *state9) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state9) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { @@ -572,7 +574,7 @@ func (s *state9) GetState() interface{} { } func (s *state9) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/actor.go.template b/chain/actors/builtin/multisig/actor.go.template index 40e49e702..9bb69a048 100644 --- a/chain/actors/builtin/multisig/actor.go.template +++ b/chain/actors/builtin/multisig/actor.go.template @@ -21,6 +21,7 @@ import ( {{end}} builtintypes "github.com/filecoin-project/go-state-types/builtin" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -29,7 +30,7 @@ import ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.MultisigKey { + if name != manifest.MultisigKey { return nil, xerrors.Errorf("actor code is not multisig: %s", name) } diff --git a/chain/actors/builtin/multisig/message.go.template b/chain/actors/builtin/multisig/message.go.template index 1e1559968..b5bc6924f 100644 --- a/chain/actors/builtin/multisig/message.go.template +++ b/chain/actors/builtin/multisig/message.go.template @@ -14,6 +14,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" multisig{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}multisig" init{{.latestVersion}} "github.com/filecoin-project/go-state-types/builtin/v{{.latestVersion}}/init" + "github.com/filecoin-project/go-state-types/manifest" {{end}} builtintypes "github.com/filecoin-project/go-state-types/builtin" @@ -68,7 +69,7 @@ func (m message{{.v}}) Create( ConstructorParams: enc, } {{else}} - code, ok := actors.GetActorCodeID(actorstypes.Version{{.v}}, actors.MultisigKey) + code, ok := actors.GetActorCodeID(actorstypes.Version{{.v}}, manifest.MultisigKey) if !ok { return nil, xerrors.Errorf("failed to get multisig code ID") } diff --git a/chain/actors/builtin/multisig/message10.go b/chain/actors/builtin/multisig/message10.go index 944911643..87ee759bd 100644 --- a/chain/actors/builtin/multisig/message10.go +++ b/chain/actors/builtin/multisig/message10.go @@ -9,6 +9,7 @@ import ( builtintypes "github.com/filecoin-project/go-state-types/builtin" init10 "github.com/filecoin-project/go-state-types/builtin/v10/init" multisig10 "github.com/filecoin-project/go-state-types/builtin/v10/multisig" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init" @@ -50,7 +51,7 @@ func (m message10) Create( return nil, actErr } - code, ok := actors.GetActorCodeID(actorstypes.Version10, actors.MultisigKey) + code, ok := actors.GetActorCodeID(actorstypes.Version10, manifest.MultisigKey) if !ok { return nil, xerrors.Errorf("failed to get multisig code ID") } diff --git a/chain/actors/builtin/multisig/message8.go b/chain/actors/builtin/multisig/message8.go index 7c79f3f50..4131a1b76 100644 --- a/chain/actors/builtin/multisig/message8.go +++ b/chain/actors/builtin/multisig/message8.go @@ -9,6 +9,7 @@ import ( builtintypes "github.com/filecoin-project/go-state-types/builtin" init10 "github.com/filecoin-project/go-state-types/builtin/v10/init" multisig8 "github.com/filecoin-project/go-state-types/builtin/v8/multisig" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init" @@ -50,7 +51,7 @@ func (m message8) Create( return nil, actErr } - code, ok := actors.GetActorCodeID(actorstypes.Version8, actors.MultisigKey) + code, ok := actors.GetActorCodeID(actorstypes.Version8, manifest.MultisigKey) if !ok { return nil, xerrors.Errorf("failed to get multisig code ID") } diff --git a/chain/actors/builtin/multisig/message9.go b/chain/actors/builtin/multisig/message9.go index be49894fa..f9c8c3103 100644 --- a/chain/actors/builtin/multisig/message9.go +++ b/chain/actors/builtin/multisig/message9.go @@ -9,6 +9,7 @@ import ( builtintypes "github.com/filecoin-project/go-state-types/builtin" init10 "github.com/filecoin-project/go-state-types/builtin/v10/init" multisig9 "github.com/filecoin-project/go-state-types/builtin/v9/multisig" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init" @@ -50,7 +51,7 @@ func (m message9) Create( return nil, actErr } - code, ok := actors.GetActorCodeID(actorstypes.Version9, actors.MultisigKey) + code, ok := actors.GetActorCodeID(actorstypes.Version9, manifest.MultisigKey) if !ok { return nil, xerrors.Errorf("failed to get multisig code ID") } diff --git a/chain/actors/builtin/multisig/multisig.go b/chain/actors/builtin/multisig/multisig.go index adb2fcfa0..4abdf7bbb 100644 --- a/chain/actors/builtin/multisig/multisig.go +++ b/chain/actors/builtin/multisig/multisig.go @@ -14,6 +14,7 @@ import ( builtintypes "github.com/filecoin-project/go-state-types/builtin" msig10 "github.com/filecoin-project/go-state-types/builtin/v10/multisig" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" 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" @@ -29,7 +30,7 @@ import ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.MultisigKey { + if name != manifest.MultisigKey { return nil, xerrors.Errorf("actor code is not multisig: %s", name) } diff --git a/chain/actors/builtin/multisig/state.go.template b/chain/actors/builtin/multisig/state.go.template index 457e8cb4d..5d04b94be 100644 --- a/chain/actors/builtin/multisig/state.go.template +++ b/chain/actors/builtin/multisig/state.go.template @@ -15,6 +15,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors" + "github.com/filecoin-project/go-state-types/manifest" {{if (le .v 7)}} {{if (ge .v 3)}} @@ -136,7 +137,7 @@ func (s *state{{.v}}) GetState() interface{} { } func (s *state{{.v}}) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/v0.go b/chain/actors/builtin/multisig/v0.go index 38cc76411..86bfdaaf3 100644 --- a/chain/actors/builtin/multisig/v0.go +++ b/chain/actors/builtin/multisig/v0.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig" adt0 "github.com/filecoin-project/specs-actors/actors/util/adt" @@ -119,7 +120,7 @@ func (s *state0) GetState() interface{} { } func (s *state0) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/v10.go b/chain/actors/builtin/multisig/v10.go index 3b9babebe..d87fc5807 100644 --- a/chain/actors/builtin/multisig/v10.go +++ b/chain/actors/builtin/multisig/v10.go @@ -15,6 +15,7 @@ import ( builtin10 "github.com/filecoin-project/go-state-types/builtin" msig10 "github.com/filecoin-project/go-state-types/builtin/v10/multisig" adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -120,7 +121,7 @@ func (s *state10) GetState() interface{} { } func (s *state10) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/v2.go b/chain/actors/builtin/multisig/v2.go index 2d72b3215..77330d513 100644 --- a/chain/actors/builtin/multisig/v2.go +++ b/chain/actors/builtin/multisig/v2.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" msig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig" adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt" @@ -119,7 +120,7 @@ func (s *state2) GetState() interface{} { } func (s *state2) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/v3.go b/chain/actors/builtin/multisig/v3.go index bd45ecdaa..e8659093f 100644 --- a/chain/actors/builtin/multisig/v3.go +++ b/chain/actors/builtin/multisig/v3.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin" msig3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/multisig" adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt" @@ -120,7 +121,7 @@ func (s *state3) GetState() interface{} { } func (s *state3) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/v4.go b/chain/actors/builtin/multisig/v4.go index 1f5f2a9ce..ddaac5470 100644 --- a/chain/actors/builtin/multisig/v4.go +++ b/chain/actors/builtin/multisig/v4.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin" msig4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/multisig" adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt" @@ -120,7 +121,7 @@ func (s *state4) GetState() interface{} { } func (s *state4) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/v5.go b/chain/actors/builtin/multisig/v5.go index bf4a58cbf..50474d5fd 100644 --- a/chain/actors/builtin/multisig/v5.go +++ b/chain/actors/builtin/multisig/v5.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" msig5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/multisig" adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt" @@ -120,7 +121,7 @@ func (s *state5) GetState() interface{} { } func (s *state5) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/v6.go b/chain/actors/builtin/multisig/v6.go index f5c6f66bb..c51404dc4 100644 --- a/chain/actors/builtin/multisig/v6.go +++ b/chain/actors/builtin/multisig/v6.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" msig6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/multisig" adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt" @@ -120,7 +121,7 @@ func (s *state6) GetState() interface{} { } func (s *state6) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/v7.go b/chain/actors/builtin/multisig/v7.go index e75865841..9ddce167a 100644 --- a/chain/actors/builtin/multisig/v7.go +++ b/chain/actors/builtin/multisig/v7.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin" msig7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/multisig" adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt" @@ -120,7 +121,7 @@ func (s *state7) GetState() interface{} { } func (s *state7) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/v8.go b/chain/actors/builtin/multisig/v8.go index 677f4ffe9..b28ec5684 100644 --- a/chain/actors/builtin/multisig/v8.go +++ b/chain/actors/builtin/multisig/v8.go @@ -15,6 +15,7 @@ import ( builtin8 "github.com/filecoin-project/go-state-types/builtin" msig8 "github.com/filecoin-project/go-state-types/builtin/v8/multisig" adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -120,7 +121,7 @@ func (s *state8) GetState() interface{} { } func (s *state8) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/v9.go b/chain/actors/builtin/multisig/v9.go index 2700470d3..faa3b7d37 100644 --- a/chain/actors/builtin/multisig/v9.go +++ b/chain/actors/builtin/multisig/v9.go @@ -15,6 +15,7 @@ import ( builtin9 "github.com/filecoin-project/go-state-types/builtin" msig9 "github.com/filecoin-project/go-state-types/builtin/v9/multisig" adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -120,7 +121,7 @@ func (s *state9) GetState() interface{} { } func (s *state9) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/actor.go.template b/chain/actors/builtin/paych/actor.go.template index 4250b4770..e19ac5e29 100644 --- a/chain/actors/builtin/paych/actor.go.template +++ b/chain/actors/builtin/paych/actor.go.template @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/cbor" ipldcbor "github.com/ipfs/go-ipld-cbor" + "github.com/filecoin-project/go-state-types/manifest" paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych" paychtypes "github.com/filecoin-project/go-state-types/builtin/v8/paych" @@ -31,7 +32,7 @@ import ( // Load returns an abstract copy of payment channel state, irregardless of actor version func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.PaychKey { + if name != manifest.PaychKey { return nil, xerrors.Errorf("actor code is not paych: %s", name) } diff --git a/chain/actors/builtin/paych/mock/mock.go b/chain/actors/builtin/paych/mock/mock.go index 8b8624ac8..3b8881319 100644 --- a/chain/actors/builtin/paych/mock/mock.go +++ b/chain/actors/builtin/paych/mock/mock.go @@ -9,8 +9,8 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" - "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/builtin/paych" ) @@ -27,7 +27,7 @@ func (ms *mockState) Code() cid.Cid { } func (ms *mockState) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (ms *mockState) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/paych.go b/chain/actors/builtin/paych/paych.go index 537ae8d92..0e6a3ca07 100644 --- a/chain/actors/builtin/paych/paych.go +++ b/chain/actors/builtin/paych/paych.go @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/big" paychtypes "github.com/filecoin-project/go-state-types/builtin/v8/paych" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" @@ -31,7 +32,7 @@ import ( // Load returns an abstract copy of payment channel state, irregardless of actor version func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.PaychKey { + if name != manifest.PaychKey { return nil, xerrors.Errorf("actor code is not paych: %s", name) } diff --git a/chain/actors/builtin/paych/state.go.template b/chain/actors/builtin/paych/state.go.template index c00f7dc56..0b0f9f9a1 100644 --- a/chain/actors/builtin/paych/state.go.template +++ b/chain/actors/builtin/paych/state.go.template @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors" + "github.com/filecoin-project/go-state-types/manifest" {{if (le .v 7)}} paych{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/paych" @@ -122,7 +123,7 @@ func (ls *laneState{{.v}}) Nonce() (uint64, error) { } func (s *state{{.v}}) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/v0.go b/chain/actors/builtin/paych/v0.go index 8cdc27c39..facc7f656 100644 --- a/chain/actors/builtin/paych/v0.go +++ b/chain/actors/builtin/paych/v0.go @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych" adt0 "github.com/filecoin-project/specs-actors/actors/util/adt" @@ -117,7 +118,7 @@ func (ls *laneState0) Nonce() (uint64, error) { } func (s *state0) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/v10.go b/chain/actors/builtin/paych/v10.go index 0527c36d1..edc6c96b6 100644 --- a/chain/actors/builtin/paych/v10.go +++ b/chain/actors/builtin/paych/v10.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-state-types/big" paych10 "github.com/filecoin-project/go-state-types/builtin/v10/paych" adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -117,7 +118,7 @@ func (ls *laneState10) Nonce() (uint64, error) { } func (s *state10) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/v2.go b/chain/actors/builtin/paych/v2.go index ae94adc17..63a3cc75e 100644 --- a/chain/actors/builtin/paych/v2.go +++ b/chain/actors/builtin/paych/v2.go @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" paych2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/paych" adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt" @@ -117,7 +118,7 @@ func (ls *laneState2) Nonce() (uint64, error) { } func (s *state2) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/v3.go b/chain/actors/builtin/paych/v3.go index 5c57ea729..c672c0027 100644 --- a/chain/actors/builtin/paych/v3.go +++ b/chain/actors/builtin/paych/v3.go @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" paych3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/paych" adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt" @@ -117,7 +118,7 @@ func (ls *laneState3) Nonce() (uint64, error) { } func (s *state3) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/v4.go b/chain/actors/builtin/paych/v4.go index b243be2e3..842e52093 100644 --- a/chain/actors/builtin/paych/v4.go +++ b/chain/actors/builtin/paych/v4.go @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" paych4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/paych" adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt" @@ -117,7 +118,7 @@ func (ls *laneState4) Nonce() (uint64, error) { } func (s *state4) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/v5.go b/chain/actors/builtin/paych/v5.go index b3b9ad50e..8f53fe43f 100644 --- a/chain/actors/builtin/paych/v5.go +++ b/chain/actors/builtin/paych/v5.go @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" paych5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/paych" adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt" @@ -117,7 +118,7 @@ func (ls *laneState5) Nonce() (uint64, error) { } func (s *state5) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/v6.go b/chain/actors/builtin/paych/v6.go index a3b80c8e1..0a8a93896 100644 --- a/chain/actors/builtin/paych/v6.go +++ b/chain/actors/builtin/paych/v6.go @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" paych6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/paych" adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt" @@ -117,7 +118,7 @@ func (ls *laneState6) Nonce() (uint64, error) { } func (s *state6) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/v7.go b/chain/actors/builtin/paych/v7.go index bb6721b01..ce0dcba0a 100644 --- a/chain/actors/builtin/paych/v7.go +++ b/chain/actors/builtin/paych/v7.go @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" paych7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/paych" adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt" @@ -117,7 +118,7 @@ func (ls *laneState7) Nonce() (uint64, error) { } func (s *state7) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/v8.go b/chain/actors/builtin/paych/v8.go index fc6853cad..51067e87b 100644 --- a/chain/actors/builtin/paych/v8.go +++ b/chain/actors/builtin/paych/v8.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-state-types/big" paych8 "github.com/filecoin-project/go-state-types/builtin/v8/paych" adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -117,7 +118,7 @@ func (ls *laneState8) Nonce() (uint64, error) { } func (s *state8) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/v9.go b/chain/actors/builtin/paych/v9.go index 817541dfb..8a69e16d4 100644 --- a/chain/actors/builtin/paych/v9.go +++ b/chain/actors/builtin/paych/v9.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-state-types/big" paych9 "github.com/filecoin-project/go-state-types/builtin/v9/paych" adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -117,7 +118,7 @@ func (ls *laneState9) Nonce() (uint64, error) { } func (s *state9) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/actor.go.template b/chain/actors/builtin/power/actor.go.template index 0a4d70f46..ed2d3fa77 100644 --- a/chain/actors/builtin/power/actor.go.template +++ b/chain/actors/builtin/power/actor.go.template @@ -15,6 +15,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/go-state-types/manifest" {{range .versions}} {{if (le . 7)}} @@ -31,7 +32,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.PowerKey { + if name != manifest.PowerKey { return nil, xerrors.Errorf("actor code is not power: %s", name) } diff --git a/chain/actors/builtin/power/power.go b/chain/actors/builtin/power/power.go index 893a25cd7..6dca61435 100644 --- a/chain/actors/builtin/power/power.go +++ b/chain/actors/builtin/power/power.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-state-types/big" builtin10 "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" 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" @@ -32,7 +33,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.PowerKey { + if name != manifest.PowerKey { return nil, xerrors.Errorf("actor code is not power: %s", name) } diff --git a/chain/actors/builtin/power/state.go.template b/chain/actors/builtin/power/state.go.template index 8c2a8ce97..d37a8b98a 100644 --- a/chain/actors/builtin/power/state.go.template +++ b/chain/actors/builtin/power/state.go.template @@ -13,6 +13,7 @@ import ( "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/go-state-types/manifest" {{if (le .v 7)}} {{if (ge .v 3)}} @@ -210,7 +211,7 @@ func fromV{{.v}}Claim(v{{.v}} power{{.v}}.Claim) Claim { } func (s *state{{.v}}) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/v0.go b/chain/actors/builtin/power/v0.go index 56982e77b..4cf550616 100644 --- a/chain/actors/builtin/power/v0.go +++ b/chain/actors/builtin/power/v0.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" power0 "github.com/filecoin-project/specs-actors/actors/builtin/power" adt0 "github.com/filecoin-project/specs-actors/actors/util/adt" @@ -193,7 +194,7 @@ func fromV0Claim(v0 power0.Claim) Claim { } func (s *state0) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/v10.go b/chain/actors/builtin/power/v10.go index 7359ca947..dd7a9decf 100644 --- a/chain/actors/builtin/power/v10.go +++ b/chain/actors/builtin/power/v10.go @@ -13,6 +13,7 @@ import ( builtin10 "github.com/filecoin-project/go-state-types/builtin" power10 "github.com/filecoin-project/go-state-types/builtin/v10/power" adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -189,7 +190,7 @@ func fromV10Claim(v10 power10.Claim) Claim { } func (s *state10) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/v2.go b/chain/actors/builtin/power/v2.go index b4e253024..bac0fa179 100644 --- a/chain/actors/builtin/power/v2.go +++ b/chain/actors/builtin/power/v2.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" power2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/power" adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt" @@ -193,7 +194,7 @@ func fromV2Claim(v2 power2.Claim) Claim { } func (s *state2) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/v3.go b/chain/actors/builtin/power/v3.go index 2b2b75ae7..bdb66e384 100644 --- a/chain/actors/builtin/power/v3.go +++ b/chain/actors/builtin/power/v3.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin" power3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/power" adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt" @@ -189,7 +190,7 @@ func fromV3Claim(v3 power3.Claim) Claim { } func (s *state3) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/v4.go b/chain/actors/builtin/power/v4.go index c40dad92a..b2dc95347 100644 --- a/chain/actors/builtin/power/v4.go +++ b/chain/actors/builtin/power/v4.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin" power4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/power" adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt" @@ -189,7 +190,7 @@ func fromV4Claim(v4 power4.Claim) Claim { } func (s *state4) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/v5.go b/chain/actors/builtin/power/v5.go index 5d740a40b..3a3adaf32 100644 --- a/chain/actors/builtin/power/v5.go +++ b/chain/actors/builtin/power/v5.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" power5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/power" adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt" @@ -189,7 +190,7 @@ func fromV5Claim(v5 power5.Claim) Claim { } func (s *state5) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/v6.go b/chain/actors/builtin/power/v6.go index 45c0db9e8..7e8eb3654 100644 --- a/chain/actors/builtin/power/v6.go +++ b/chain/actors/builtin/power/v6.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" power6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/power" adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt" @@ -189,7 +190,7 @@ func fromV6Claim(v6 power6.Claim) Claim { } func (s *state6) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/v7.go b/chain/actors/builtin/power/v7.go index 314318263..893c58667 100644 --- a/chain/actors/builtin/power/v7.go +++ b/chain/actors/builtin/power/v7.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin" power7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/power" adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt" @@ -189,7 +190,7 @@ func fromV7Claim(v7 power7.Claim) Claim { } func (s *state7) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/v8.go b/chain/actors/builtin/power/v8.go index a462b2600..b15fe4355 100644 --- a/chain/actors/builtin/power/v8.go +++ b/chain/actors/builtin/power/v8.go @@ -13,6 +13,7 @@ import ( builtin8 "github.com/filecoin-project/go-state-types/builtin" power8 "github.com/filecoin-project/go-state-types/builtin/v8/power" adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -189,7 +190,7 @@ func fromV8Claim(v8 power8.Claim) Claim { } func (s *state8) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/v9.go b/chain/actors/builtin/power/v9.go index 0e8d5b072..126fbbfbf 100644 --- a/chain/actors/builtin/power/v9.go +++ b/chain/actors/builtin/power/v9.go @@ -13,6 +13,7 @@ import ( builtin9 "github.com/filecoin-project/go-state-types/builtin" power9 "github.com/filecoin-project/go-state-types/builtin/v9/power" adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -189,7 +190,7 @@ func fromV9Claim(v9 power9.Claim) Claim { } func (s *state9) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/registry.go b/chain/actors/builtin/registry.go index 73c9c117f..ec487275b 100644 --- a/chain/actors/builtin/registry.go +++ b/chain/actors/builtin/registry.go @@ -7,6 +7,7 @@ import ( "github.com/ipfs/go-cid" + "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/builtin" account10 "github.com/filecoin-project/go-state-types/builtin/v10/account" @@ -45,6 +46,7 @@ import ( system9 "github.com/filecoin-project/go-state-types/builtin/v9/system" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" rtt "github.com/filecoin-project/go-state-types/rt" "github.com/filecoin-project/lotus/chain/actors" @@ -53,14 +55,14 @@ import ( type RegistryEntry struct { state cbor.Er code cid.Cid - methods map[uint64]builtin.MethodMeta + methods map[abi.MethodNum]builtin.MethodMeta } func (r RegistryEntry) State() cbor.Er { return r.state } -func (r RegistryEntry) Exports() map[uint64]builtin.MethodMeta { +func (r RegistryEntry) Exports() map[abi.MethodNum]builtin.MethodMeta { return r.methods } @@ -72,10 +74,10 @@ func MakeRegistryLegacy(actors []rtt.VMActor) []RegistryEntry { registry := make([]RegistryEntry, 0) for _, actor := range actors { - methodMap := make(map[uint64]builtin.MethodMeta) + methodMap := make(map[abi.MethodNum]builtin.MethodMeta) for methodNum, method := range actor.Exports() { if method != nil { - methodMap[uint64(methodNum)] = makeMethodMeta(method) + methodMap[abi.MethodNum(methodNum)] = makeMethodMeta(method) } } registry = append(registry, RegistryEntry{ @@ -118,67 +120,67 @@ func MakeRegistry(av actorstypes.Version) []RegistryEntry { case actorstypes.Version8: for key, codeID := range codeIDs { switch key { - case actors.AccountKey: + case manifest.AccountKey: registry = append(registry, RegistryEntry{ code: codeID, methods: account8.Methods, state: new(account8.State), }) - case actors.CronKey: + case manifest.CronKey: registry = append(registry, RegistryEntry{ code: codeID, methods: cron8.Methods, state: new(cron8.State), }) - case actors.InitKey: + case manifest.InitKey: registry = append(registry, RegistryEntry{ code: codeID, methods: _init8.Methods, state: new(_init8.State), }) - case actors.MarketKey: + case manifest.MarketKey: registry = append(registry, RegistryEntry{ code: codeID, methods: market8.Methods, state: new(market8.State), }) - case actors.MinerKey: + case manifest.MinerKey: registry = append(registry, RegistryEntry{ code: codeID, methods: miner8.Methods, state: new(miner8.State), }) - case actors.MultisigKey: + case manifest.MultisigKey: registry = append(registry, RegistryEntry{ code: codeID, methods: multisig8.Methods, state: new(multisig8.State), }) - case actors.PaychKey: + case manifest.PaychKey: registry = append(registry, RegistryEntry{ code: codeID, methods: paych8.Methods, state: new(paych8.State), }) - case actors.PowerKey: + case manifest.PowerKey: registry = append(registry, RegistryEntry{ code: codeID, methods: power8.Methods, state: new(power8.State), }) - case actors.RewardKey: + case manifest.RewardKey: registry = append(registry, RegistryEntry{ code: codeID, methods: reward8.Methods, state: new(reward8.State), }) - case actors.SystemKey: + case manifest.SystemKey: registry = append(registry, RegistryEntry{ code: codeID, methods: system8.Methods, state: new(system8.State), }) - case actors.VerifregKey: + case manifest.VerifregKey: registry = append(registry, RegistryEntry{ code: codeID, methods: verifreg8.Methods, @@ -191,73 +193,73 @@ func MakeRegistry(av actorstypes.Version) []RegistryEntry { case actorstypes.Version9: for key, codeID := range codeIDs { switch key { - case actors.AccountKey: + case manifest.AccountKey: registry = append(registry, RegistryEntry{ code: codeID, methods: account9.Methods, state: new(account9.State), }) - case actors.CronKey: + case manifest.CronKey: registry = append(registry, RegistryEntry{ code: codeID, methods: cron9.Methods, state: new(cron9.State), }) - case actors.InitKey: + case manifest.InitKey: registry = append(registry, RegistryEntry{ code: codeID, methods: _init9.Methods, state: new(_init9.State), }) - case actors.MarketKey: + case manifest.MarketKey: registry = append(registry, RegistryEntry{ code: codeID, methods: market9.Methods, state: new(market9.State), }) - case actors.MinerKey: + case manifest.MinerKey: registry = append(registry, RegistryEntry{ code: codeID, methods: miner9.Methods, state: new(miner9.State), }) - case actors.MultisigKey: + case manifest.MultisigKey: registry = append(registry, RegistryEntry{ code: codeID, methods: multisig9.Methods, state: new(multisig9.State), }) - case actors.PaychKey: + case manifest.PaychKey: registry = append(registry, RegistryEntry{ code: codeID, methods: paych9.Methods, state: new(paych9.State), }) - case actors.PowerKey: + case manifest.PowerKey: registry = append(registry, RegistryEntry{ code: codeID, methods: power9.Methods, state: new(power9.State), }) - case actors.RewardKey: + case manifest.RewardKey: registry = append(registry, RegistryEntry{ code: codeID, methods: reward9.Methods, state: new(reward9.State), }) - case actors.SystemKey: + case manifest.SystemKey: registry = append(registry, RegistryEntry{ code: codeID, methods: system9.Methods, state: new(system9.State), }) - case actors.VerifregKey: + case manifest.VerifregKey: registry = append(registry, RegistryEntry{ code: codeID, methods: verifreg9.Methods, state: new(verifreg9.State), }) - case actors.DatacapKey: + case manifest.DatacapKey: registry = append(registry, RegistryEntry{ code: codeID, methods: datacap9.Methods, @@ -269,73 +271,73 @@ func MakeRegistry(av actorstypes.Version) []RegistryEntry { case actorstypes.Version10: for key, codeID := range codeIDs { switch key { - case actors.AccountKey: + case manifest.AccountKey: registry = append(registry, RegistryEntry{ code: codeID, methods: account10.Methods, state: new(account10.State), }) - case actors.CronKey: + case manifest.CronKey: registry = append(registry, RegistryEntry{ code: codeID, methods: cron10.Methods, state: new(cron10.State), }) - case actors.InitKey: + case manifest.InitKey: registry = append(registry, RegistryEntry{ code: codeID, methods: _init10.Methods, state: new(_init10.State), }) - case actors.MarketKey: + case manifest.MarketKey: registry = append(registry, RegistryEntry{ code: codeID, methods: market10.Methods, state: new(market10.State), }) - case actors.MinerKey: + case manifest.MinerKey: registry = append(registry, RegistryEntry{ code: codeID, methods: miner10.Methods, state: new(miner10.State), }) - case actors.MultisigKey: + case manifest.MultisigKey: registry = append(registry, RegistryEntry{ code: codeID, methods: multisig10.Methods, state: new(multisig10.State), }) - case actors.PaychKey: + case manifest.PaychKey: registry = append(registry, RegistryEntry{ code: codeID, methods: paych10.Methods, state: new(paych10.State), }) - case actors.PowerKey: + case manifest.PowerKey: registry = append(registry, RegistryEntry{ code: codeID, methods: power10.Methods, state: new(power10.State), }) - case actors.RewardKey: + case manifest.RewardKey: registry = append(registry, RegistryEntry{ code: codeID, methods: reward10.Methods, state: new(reward10.State), }) - case actors.SystemKey: + case manifest.SystemKey: registry = append(registry, RegistryEntry{ code: codeID, methods: system10.Methods, state: new(system10.State), }) - case actors.VerifregKey: + case manifest.VerifregKey: registry = append(registry, RegistryEntry{ code: codeID, methods: verifreg10.Methods, state: new(verifreg10.State), }) - case actors.DatacapKey: + case manifest.DatacapKey: registry = append(registry, RegistryEntry{ code: codeID, methods: datacap10.Methods, diff --git a/chain/actors/builtin/registry.go.template b/chain/actors/builtin/registry.go.template index 39211c476..b38cd41c6 100644 --- a/chain/actors/builtin/registry.go.template +++ b/chain/actors/builtin/registry.go.template @@ -29,19 +29,21 @@ import ( "github.com/filecoin-project/go-state-types/cbor" rtt "github.com/filecoin-project/go-state-types/rt" "github.com/filecoin-project/lotus/chain/actors" + "github.com/filecoin-project/go-state-types/abi" + "github.com/filecoin-project/go-state-types/manifest" ) type RegistryEntry struct { state cbor.Er code cid.Cid - methods map[uint64]builtin.MethodMeta + methods map[abi.MethodNum]builtin.MethodMeta } func (r RegistryEntry) State() cbor.Er { return r.state } -func (r RegistryEntry) Exports() map[uint64]builtin.MethodMeta { +func (r RegistryEntry) Exports() map[abi.MethodNum]builtin.MethodMeta { return r.methods } @@ -53,10 +55,10 @@ func MakeRegistryLegacy(actors []rtt.VMActor) []RegistryEntry { registry := make([]RegistryEntry, 0) for _, actor := range actors { - methodMap := make(map[uint64]builtin.MethodMeta) + methodMap := make(map[abi.MethodNum]builtin.MethodMeta) for methodNum, method := range actor.Exports() { if method != nil { - methodMap[uint64(methodNum)] = makeMethodMeta(method) + methodMap[abi.MethodNum(methodNum)] = makeMethodMeta(method) } } registry = append(registry, RegistryEntry{ @@ -100,73 +102,73 @@ func MakeRegistry(av actorstypes.Version) []RegistryEntry { case actorstypes.Version{{.}}: for key, codeID := range codeIDs { switch key { - case actors.AccountKey: + case manifest.AccountKey: registry = append(registry, RegistryEntry{ code: codeID, methods: account{{.}}.Methods, state: new(account{{.}}.State), }) - case actors.CronKey: + case manifest.CronKey: registry = append(registry, RegistryEntry{ code: codeID, methods: cron{{.}}.Methods, state: new(cron{{.}}.State), }) - case actors.InitKey: + case manifest.InitKey: registry = append(registry, RegistryEntry{ code: codeID, methods: _init{{.}}.Methods, state: new(_init{{.}}.State), }) - case actors.MarketKey: + case manifest.MarketKey: registry = append(registry, RegistryEntry{ code: codeID, methods: market{{.}}.Methods, state: new(market{{.}}.State), }) - case actors.MinerKey: + case manifest.MinerKey: registry = append(registry, RegistryEntry{ code: codeID, methods: miner{{.}}.Methods, state: new(miner{{.}}.State), }) - case actors.MultisigKey: + case manifest.MultisigKey: registry = append(registry, RegistryEntry{ code: codeID, methods: multisig{{.}}.Methods, state: new(multisig{{.}}.State), }) - case actors.PaychKey: + case manifest.PaychKey: registry = append(registry, RegistryEntry{ code: codeID, methods: paych{{.}}.Methods, state: new(paych{{.}}.State), }) - case actors.PowerKey: + case manifest.PowerKey: registry = append(registry, RegistryEntry{ code: codeID, methods: power{{.}}.Methods, state: new(power{{.}}.State), }) - case actors.RewardKey: + case manifest.RewardKey: registry = append(registry, RegistryEntry{ code: codeID, methods: reward{{.}}.Methods, state: new(reward{{.}}.State), }) - case actors.SystemKey: + case manifest.SystemKey: registry = append(registry, RegistryEntry{ code: codeID, methods: system{{.}}.Methods, state: new(system{{.}}.State), }) - case actors.VerifregKey: + case manifest.VerifregKey: registry = append(registry, RegistryEntry{ code: codeID, methods: verifreg{{.}}.Methods, state: new(verifreg{{.}}.State), }) - {{if (ge . 9)}}case actors.DatacapKey: + {{if (ge . 9)}}case manifest.DatacapKey: registry = append(registry, RegistryEntry{ code: codeID, methods: datacap{{.}}.Methods, diff --git a/chain/actors/builtin/reward/actor.go.template b/chain/actors/builtin/reward/actor.go.template index 4fd317c97..81bf91ac3 100644 --- a/chain/actors/builtin/reward/actor.go.template +++ b/chain/actors/builtin/reward/actor.go.template @@ -19,6 +19,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/go-state-types/manifest" ) var ( @@ -28,7 +29,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.RewardKey { + if name != manifest.RewardKey { return nil, xerrors.Errorf("actor code is not reward: %s", name) } diff --git a/chain/actors/builtin/reward/reward.go b/chain/actors/builtin/reward/reward.go index 0efbdaf79..01462d680 100644 --- a/chain/actors/builtin/reward/reward.go +++ b/chain/actors/builtin/reward/reward.go @@ -8,6 +8,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" builtin10 "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" @@ -30,7 +31,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.RewardKey { + if name != manifest.RewardKey { return nil, xerrors.Errorf("actor code is not reward: %s", name) } diff --git a/chain/actors/builtin/reward/state.go.template b/chain/actors/builtin/reward/state.go.template index 104aefbaf..28ddb80f0 100644 --- a/chain/actors/builtin/reward/state.go.template +++ b/chain/actors/builtin/reward/state.go.template @@ -9,6 +9,7 @@ import ( "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/go-state-types/manifest" {{if (le .v 7)}} miner{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/miner" @@ -122,7 +123,7 @@ func (s *state{{.v}}) GetState() interface{} { } func (s *state{{.v}}) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/reward/v0.go b/chain/actors/builtin/reward/v0.go index 332e97128..66736f9e0 100644 --- a/chain/actors/builtin/reward/v0.go +++ b/chain/actors/builtin/reward/v0.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward" smoothing0 "github.com/filecoin-project/specs-actors/actors/util/smoothing" @@ -99,7 +100,7 @@ func (s *state0) GetState() interface{} { } func (s *state0) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/reward/v10.go b/chain/actors/builtin/reward/v10.go index 75c23e1a6..3ffe9a267 100644 --- a/chain/actors/builtin/reward/v10.go +++ b/chain/actors/builtin/reward/v10.go @@ -10,6 +10,7 @@ import ( miner10 "github.com/filecoin-project/go-state-types/builtin/v10/miner" reward10 "github.com/filecoin-project/go-state-types/builtin/v10/reward" smoothing10 "github.com/filecoin-project/go-state-types/builtin/v10/util/smoothing" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -102,7 +103,7 @@ func (s *state10) GetState() interface{} { } func (s *state10) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/reward/v2.go b/chain/actors/builtin/reward/v2.go index 33f6c120f..6d640f2e9 100644 --- a/chain/actors/builtin/reward/v2.go +++ b/chain/actors/builtin/reward/v2.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner" reward2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/reward" smoothing2 "github.com/filecoin-project/specs-actors/v2/actors/util/smoothing" @@ -102,7 +103,7 @@ func (s *state2) GetState() interface{} { } func (s *state2) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/reward/v3.go b/chain/actors/builtin/reward/v3.go index d727a9861..fe8e555c9 100644 --- a/chain/actors/builtin/reward/v3.go +++ b/chain/actors/builtin/reward/v3.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" miner3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/miner" reward3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/reward" smoothing3 "github.com/filecoin-project/specs-actors/v3/actors/util/smoothing" @@ -102,7 +103,7 @@ func (s *state3) GetState() interface{} { } func (s *state3) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/reward/v4.go b/chain/actors/builtin/reward/v4.go index 94ebc43c4..f0decd392 100644 --- a/chain/actors/builtin/reward/v4.go +++ b/chain/actors/builtin/reward/v4.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" miner4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/miner" reward4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/reward" smoothing4 "github.com/filecoin-project/specs-actors/v4/actors/util/smoothing" @@ -102,7 +103,7 @@ func (s *state4) GetState() interface{} { } func (s *state4) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/reward/v5.go b/chain/actors/builtin/reward/v5.go index 563b8f42a..82be12c0a 100644 --- a/chain/actors/builtin/reward/v5.go +++ b/chain/actors/builtin/reward/v5.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner" reward5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/reward" smoothing5 "github.com/filecoin-project/specs-actors/v5/actors/util/smoothing" @@ -102,7 +103,7 @@ func (s *state5) GetState() interface{} { } func (s *state5) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/reward/v6.go b/chain/actors/builtin/reward/v6.go index 523736766..71884dada 100644 --- a/chain/actors/builtin/reward/v6.go +++ b/chain/actors/builtin/reward/v6.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" miner6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/miner" reward6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/reward" smoothing6 "github.com/filecoin-project/specs-actors/v6/actors/util/smoothing" @@ -102,7 +103,7 @@ func (s *state6) GetState() interface{} { } func (s *state6) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/reward/v7.go b/chain/actors/builtin/reward/v7.go index 79db860e1..bc39f3666 100644 --- a/chain/actors/builtin/reward/v7.go +++ b/chain/actors/builtin/reward/v7.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" miner7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/miner" reward7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/reward" smoothing7 "github.com/filecoin-project/specs-actors/v7/actors/util/smoothing" @@ -102,7 +103,7 @@ func (s *state7) GetState() interface{} { } func (s *state7) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/reward/v8.go b/chain/actors/builtin/reward/v8.go index a9d6fae69..5f6b96d29 100644 --- a/chain/actors/builtin/reward/v8.go +++ b/chain/actors/builtin/reward/v8.go @@ -10,6 +10,7 @@ import ( miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner" reward8 "github.com/filecoin-project/go-state-types/builtin/v8/reward" smoothing8 "github.com/filecoin-project/go-state-types/builtin/v8/util/smoothing" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -102,7 +103,7 @@ func (s *state8) GetState() interface{} { } func (s *state8) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/reward/v9.go b/chain/actors/builtin/reward/v9.go index 34b8a7d34..6118e2b30 100644 --- a/chain/actors/builtin/reward/v9.go +++ b/chain/actors/builtin/reward/v9.go @@ -10,6 +10,7 @@ import ( miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner" reward9 "github.com/filecoin-project/go-state-types/builtin/v9/reward" smoothing9 "github.com/filecoin-project/go-state-types/builtin/v9/util/smoothing" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -102,7 +103,7 @@ func (s *state9) GetState() interface{} { } func (s *state9) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/actor.go.template b/chain/actors/builtin/system/actor.go.template index a6442c6a9..b725f0820 100644 --- a/chain/actors/builtin/system/actor.go.template +++ b/chain/actors/builtin/system/actor.go.template @@ -3,6 +3,7 @@ package system import ( "github.com/ipfs/go-cid" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/types" @@ -24,7 +25,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.SystemKey { + if name != manifest.SystemKey { return nil, xerrors.Errorf("actor code is not system: %s", name) } diff --git a/chain/actors/builtin/system/state.go.template b/chain/actors/builtin/system/state.go.template index 62dba041a..c6cab0583 100644 --- a/chain/actors/builtin/system/state.go.template +++ b/chain/actors/builtin/system/state.go.template @@ -3,6 +3,7 @@ package system import ( "fmt" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" "github.com/ipfs/go-cid" @@ -63,7 +64,7 @@ func (s *state{{.v}}) SetBuiltinActors(c cid.Cid) error { } func (s *state{{.v}}) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/system.go b/chain/actors/builtin/system/system.go index 747563cc0..c7589efa1 100644 --- a/chain/actors/builtin/system/system.go +++ b/chain/actors/builtin/system/system.go @@ -6,6 +6,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" builtin10 "github.com/filecoin-project/go-state-types/builtin" + "github.com/filecoin-project/go-state-types/manifest" 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" @@ -25,7 +26,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.SystemKey { + if name != manifest.SystemKey { return nil, xerrors.Errorf("actor code is not system: %s", name) } diff --git a/chain/actors/builtin/system/v0.go b/chain/actors/builtin/system/v0.go index 17fa9e8c7..d5f0f079e 100644 --- a/chain/actors/builtin/system/v0.go +++ b/chain/actors/builtin/system/v0.go @@ -7,6 +7,7 @@ import ( "golang.org/x/xerrors" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" system0 "github.com/filecoin-project/specs-actors/actors/builtin/system" "github.com/filecoin-project/lotus/chain/actors" @@ -52,7 +53,7 @@ func (s *state0) SetBuiltinActors(c cid.Cid) error { } func (s *state0) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/v10.go b/chain/actors/builtin/system/v10.go index e6d6fbe96..2cdb39682 100644 --- a/chain/actors/builtin/system/v10.go +++ b/chain/actors/builtin/system/v10.go @@ -7,6 +7,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" system10 "github.com/filecoin-project/go-state-types/builtin/v10/system" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -54,7 +55,7 @@ func (s *state10) SetBuiltinActors(c cid.Cid) error { } func (s *state10) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/v2.go b/chain/actors/builtin/system/v2.go index 7821bee58..b0c642054 100644 --- a/chain/actors/builtin/system/v2.go +++ b/chain/actors/builtin/system/v2.go @@ -7,6 +7,7 @@ import ( "golang.org/x/xerrors" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" system2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/system" "github.com/filecoin-project/lotus/chain/actors" @@ -52,7 +53,7 @@ func (s *state2) SetBuiltinActors(c cid.Cid) error { } func (s *state2) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/v3.go b/chain/actors/builtin/system/v3.go index 0c80218c4..8334f780e 100644 --- a/chain/actors/builtin/system/v3.go +++ b/chain/actors/builtin/system/v3.go @@ -7,6 +7,7 @@ import ( "golang.org/x/xerrors" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" system3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/system" "github.com/filecoin-project/lotus/chain/actors" @@ -52,7 +53,7 @@ func (s *state3) SetBuiltinActors(c cid.Cid) error { } func (s *state3) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/v4.go b/chain/actors/builtin/system/v4.go index e41792110..227104f37 100644 --- a/chain/actors/builtin/system/v4.go +++ b/chain/actors/builtin/system/v4.go @@ -7,6 +7,7 @@ import ( "golang.org/x/xerrors" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" system4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/system" "github.com/filecoin-project/lotus/chain/actors" @@ -52,7 +53,7 @@ func (s *state4) SetBuiltinActors(c cid.Cid) error { } func (s *state4) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/v5.go b/chain/actors/builtin/system/v5.go index a2760b096..bbfb70b51 100644 --- a/chain/actors/builtin/system/v5.go +++ b/chain/actors/builtin/system/v5.go @@ -7,6 +7,7 @@ import ( "golang.org/x/xerrors" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" system5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/system" "github.com/filecoin-project/lotus/chain/actors" @@ -52,7 +53,7 @@ func (s *state5) SetBuiltinActors(c cid.Cid) error { } func (s *state5) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/v6.go b/chain/actors/builtin/system/v6.go index 0de085a5e..2319b5929 100644 --- a/chain/actors/builtin/system/v6.go +++ b/chain/actors/builtin/system/v6.go @@ -7,6 +7,7 @@ import ( "golang.org/x/xerrors" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" system6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/system" "github.com/filecoin-project/lotus/chain/actors" @@ -52,7 +53,7 @@ func (s *state6) SetBuiltinActors(c cid.Cid) error { } func (s *state6) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/v7.go b/chain/actors/builtin/system/v7.go index 2753251c0..0b10129e8 100644 --- a/chain/actors/builtin/system/v7.go +++ b/chain/actors/builtin/system/v7.go @@ -7,6 +7,7 @@ import ( "golang.org/x/xerrors" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" system7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/system" "github.com/filecoin-project/lotus/chain/actors" @@ -52,7 +53,7 @@ func (s *state7) SetBuiltinActors(c cid.Cid) error { } func (s *state7) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/v8.go b/chain/actors/builtin/system/v8.go index 00cafdfed..eca3b0c04 100644 --- a/chain/actors/builtin/system/v8.go +++ b/chain/actors/builtin/system/v8.go @@ -7,6 +7,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" system8 "github.com/filecoin-project/go-state-types/builtin/v8/system" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -54,7 +55,7 @@ func (s *state8) SetBuiltinActors(c cid.Cid) error { } func (s *state8) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/v9.go b/chain/actors/builtin/system/v9.go index 8bf96a917..55e073efe 100644 --- a/chain/actors/builtin/system/v9.go +++ b/chain/actors/builtin/system/v9.go @@ -7,6 +7,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" system9 "github.com/filecoin-project/go-state-types/builtin/v9/system" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -54,7 +55,7 @@ func (s *state9) SetBuiltinActors(c cid.Cid) error { } func (s *state9) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/actor.go.template b/chain/actors/builtin/verifreg/actor.go.template index 97d1417f7..9f9efef92 100644 --- a/chain/actors/builtin/verifreg/actor.go.template +++ b/chain/actors/builtin/verifreg/actor.go.template @@ -3,6 +3,7 @@ package verifreg import ( "github.com/ipfs/go-cid" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" "golang.org/x/xerrors" "github.com/filecoin-project/go-address" @@ -29,7 +30,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.VerifregKey { + if name != manifest.VerifregKey { return nil, xerrors.Errorf("actor code is not verifreg: %s", name) } diff --git a/chain/actors/builtin/verifreg/state.go.template b/chain/actors/builtin/verifreg/state.go.template index 960b2b604..526dff54e 100644 --- a/chain/actors/builtin/verifreg/state.go.template +++ b/chain/actors/builtin/verifreg/state.go.template @@ -3,6 +3,7 @@ package verifreg import ( "fmt" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" "github.com/ipfs/go-cid" @@ -170,7 +171,7 @@ func (s *state{{.v}}) GetClaims(providerIdAddr address.Address) (map[ClaimId]Cla } func (s *state{{.v}}) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/v0.go b/chain/actors/builtin/verifreg/v0.go index 4917667ea..8d97ebbc2 100644 --- a/chain/actors/builtin/verifreg/v0.go +++ b/chain/actors/builtin/verifreg/v0.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" adt0 "github.com/filecoin-project/specs-actors/actors/util/adt" @@ -118,7 +119,7 @@ func (s *state0) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, e } func (s *state0) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/v10.go b/chain/actors/builtin/verifreg/v10.go index a510d1970..63b161da3 100644 --- a/chain/actors/builtin/verifreg/v10.go +++ b/chain/actors/builtin/verifreg/v10.go @@ -14,6 +14,7 @@ import ( adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt" verifreg10 "github.com/filecoin-project/go-state-types/builtin/v10/verifreg" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -134,7 +135,7 @@ func (s *state10) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, } func (s *state10) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/v2.go b/chain/actors/builtin/verifreg/v2.go index 28061c2d1..61c175c7a 100644 --- a/chain/actors/builtin/verifreg/v2.go +++ b/chain/actors/builtin/verifreg/v2.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" verifreg2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/verifreg" adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt" @@ -118,7 +119,7 @@ func (s *state2) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, e } func (s *state2) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/v3.go b/chain/actors/builtin/verifreg/v3.go index 4096059a6..5ba478500 100644 --- a/chain/actors/builtin/verifreg/v3.go +++ b/chain/actors/builtin/verifreg/v3.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin" verifreg3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/verifreg" adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt" @@ -119,7 +120,7 @@ func (s *state3) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, e } func (s *state3) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/v4.go b/chain/actors/builtin/verifreg/v4.go index 457704504..3ad739f68 100644 --- a/chain/actors/builtin/verifreg/v4.go +++ b/chain/actors/builtin/verifreg/v4.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin" verifreg4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/verifreg" adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt" @@ -119,7 +120,7 @@ func (s *state4) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, e } func (s *state4) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/v5.go b/chain/actors/builtin/verifreg/v5.go index b1e6db424..1ffe06f3f 100644 --- a/chain/actors/builtin/verifreg/v5.go +++ b/chain/actors/builtin/verifreg/v5.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" verifreg5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/verifreg" adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt" @@ -119,7 +120,7 @@ func (s *state5) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, e } func (s *state5) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/v6.go b/chain/actors/builtin/verifreg/v6.go index d66ae105c..9786838d1 100644 --- a/chain/actors/builtin/verifreg/v6.go +++ b/chain/actors/builtin/verifreg/v6.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" verifreg6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/verifreg" adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt" @@ -119,7 +120,7 @@ func (s *state6) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, e } func (s *state6) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/v7.go b/chain/actors/builtin/verifreg/v7.go index 72235e268..e63e27742 100644 --- a/chain/actors/builtin/verifreg/v7.go +++ b/chain/actors/builtin/verifreg/v7.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin" verifreg7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/verifreg" adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt" @@ -118,7 +119,7 @@ func (s *state7) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, e } func (s *state7) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/v8.go b/chain/actors/builtin/verifreg/v8.go index b39895bd9..a1edeba34 100644 --- a/chain/actors/builtin/verifreg/v8.go +++ b/chain/actors/builtin/verifreg/v8.go @@ -13,6 +13,7 @@ import ( adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt" verifreg8 "github.com/filecoin-project/go-state-types/builtin/v8/verifreg" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -118,7 +119,7 @@ func (s *state8) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, e } func (s *state8) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/v9.go b/chain/actors/builtin/verifreg/v9.go index 2348007e6..bf6424ba7 100644 --- a/chain/actors/builtin/verifreg/v9.go +++ b/chain/actors/builtin/verifreg/v9.go @@ -13,6 +13,7 @@ import ( builtin9 "github.com/filecoin-project/go-state-types/builtin" adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -133,7 +134,7 @@ func (s *state9) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, e } func (s *state9) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/verifreg.go b/chain/actors/builtin/verifreg/verifreg.go index 82c630c0f..1380a9207 100644 --- a/chain/actors/builtin/verifreg/verifreg.go +++ b/chain/actors/builtin/verifreg/verifreg.go @@ -10,6 +10,7 @@ import ( builtin10 "github.com/filecoin-project/go-state-types/builtin" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" 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" @@ -30,7 +31,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.VerifregKey { + if name != manifest.VerifregKey { return nil, xerrors.Errorf("actor code is not verifreg: %s", name) } diff --git a/chain/actors/manifest.go b/chain/actors/manifest.go index 225c8b990..f58768ca2 100644 --- a/chain/actors/manifest.go +++ b/chain/actors/manifest.go @@ -15,50 +15,9 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" ) -var manifestCids map[actorstypes.Version]cid.Cid = make(map[actorstypes.Version]cid.Cid) -var manifests map[actorstypes.Version]map[string]cid.Cid = make(map[actorstypes.Version]map[string]cid.Cid) -var actorMeta map[cid.Cid]actorEntry = make(map[cid.Cid]actorEntry) - -const ( - AccountKey = "account" - CronKey = "cron" - InitKey = "init" - MarketKey = "storagemarket" - MinerKey = "storageminer" - MultisigKey = "multisig" - PaychKey = "paymentchannel" - PowerKey = "storagepower" - RewardKey = "reward" - SystemKey = "system" - VerifregKey = "verifiedregistry" - DatacapKey = "datacap" - EvmKey = "evm" - EamKey = "eam" - EmbryoKey = "embryo" -) - -func GetBuiltinActorsKeys(av actorstypes.Version) []string { - keys := []string{ - AccountKey, - CronKey, - InitKey, - MarketKey, - MinerKey, - MultisigKey, - PaychKey, - PowerKey, - RewardKey, - SystemKey, - VerifregKey, - } - if av >= 9 { - keys = append(keys, DatacapKey) - } - if av >= 10 { - keys = append(keys, EvmKey, EamKey, EmbryoKey) - } - return keys -} +var manifestCids = make(map[actorstypes.Version]cid.Cid) +var manifests = make(map[actorstypes.Version]map[string]cid.Cid) +var actorMeta = make(map[cid.Cid]actorEntry) var ( manifestMx sync.RWMutex diff --git a/chain/consensus/filcns/filecoin.go b/chain/consensus/filcns/filecoin.go index 570410052..c1029cbe9 100644 --- a/chain/consensus/filcns/filecoin.go +++ b/chain/consensus/filcns/filecoin.go @@ -28,7 +28,6 @@ import ( blockadt "github.com/filecoin-project/specs-actors/actors/util/adt" "github.com/filecoin-project/specs-actors/v7/actors/runtime/proof" - "github.com/filecoin-project/lotus/api" bstore "github.com/filecoin-project/lotus/blockstore" "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain" @@ -41,6 +40,7 @@ import ( "github.com/filecoin-project/lotus/chain/stmgr" "github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/lotus/chain/types/ethtypes" "github.com/filecoin-project/lotus/chain/vm" "github.com/filecoin-project/lotus/lib/async" "github.com/filecoin-project/lotus/lib/sigs" @@ -436,15 +436,15 @@ func (filec *FilecoinEC) VerifyWinningPoStProof(ctx context.Context, nv network. return nil } -func isValidForSending(act *types.Actor) bool { - if builtin.IsAccountActor(act.Code) { +func IsValidForSending(act *types.Actor) bool { + if builtin.IsAccountActor(act.Code) || builtin.IsEthAccountActor(act.Code) { return true } - // HACK: Allow Eth embryos to send messages - if !builtin.IsEmbryo(act.Code) || act.Address == nil || act.Address.Protocol() != address.Delegated { + if !builtin.IsEmbryoActor(act.Code) || act.Address == nil || act.Address.Protocol() != address.Delegated { return false } + id, _, err := varint.FromUvarint(act.Address.Payload()) return err == nil && id == builtintypes.EthereumAddressManagerActorID } @@ -521,7 +521,7 @@ func (filec *FilecoinEC) checkBlockMessages(ctx context.Context, b *types.FullBl return xerrors.Errorf("failed to get actor: %w", err) } - if !isValidForSending(act) { + if !IsValidForSending(act) { return xerrors.New("Sender must be an account actor") } nonces[sender] = act.Nonce @@ -577,7 +577,7 @@ func (filec *FilecoinEC) checkBlockMessages(ctx context.Context, b *types.FullBl digest := m.Message.Cid().Bytes() if m.Signature.Type == crypto.SigTypeDelegated { - txArgs, err := api.NewEthTxArgsFromMessage(&m.Message) + txArgs, err := ethtypes.NewEthTxArgsFromMessage(&m.Message) if err != nil { return err } diff --git a/chain/consensus/filcns/upgrades.go b/chain/consensus/filcns/upgrades.go index 89f72f67e..83c560aa4 100644 --- a/chain/consensus/filcns/upgrades.go +++ b/chain/consensus/filcns/upgrades.go @@ -1652,10 +1652,10 @@ func LiteMigration(ctx context.Context, bstore blockstore.Blockstore, newActorsM return cid.Undef, xerrors.Errorf("error loading new manifest data: %w", err) } - if len(oldManifestData.Entries) != len(actors.GetBuiltinActorsKeys(oldAv)) { + if len(oldManifestData.Entries) != len(manifest.GetBuiltinActorsKeys(oldAv)) { return cid.Undef, xerrors.Errorf("incomplete old manifest with %d code CIDs", len(oldManifestData.Entries)) } - if len(newManifestData.Entries) != len(actors.GetBuiltinActorsKeys(newAv)) { + if len(newManifestData.Entries) != len(manifest.GetBuiltinActorsKeys(newAv)) { return cid.Undef, xerrors.Errorf("incomplete new manifest with %d code CIDs", len(newManifestData.Entries)) } diff --git a/chain/gen/genesis/f00_system.go b/chain/gen/genesis/f00_system.go index 93849bcc9..5c6ecacbf 100644 --- a/chain/gen/genesis/f00_system.go +++ b/chain/gen/genesis/f00_system.go @@ -48,7 +48,7 @@ func SetupSystemActor(ctx context.Context, bs bstore.Blockstore, av actorstypes. return nil, err } - actcid, ok := actors.GetActorCodeID(av, actors.SystemKey) + actcid, ok := actors.GetActorCodeID(av, manifest.SystemKey) if !ok { return nil, xerrors.Errorf("failed to get system actor code ID for actors version %d", av) } diff --git a/chain/gen/genesis/f01_init.go b/chain/gen/genesis/f01_init.go index 26062cf27..706328d21 100644 --- a/chain/gen/genesis/f01_init.go +++ b/chain/gen/genesis/f01_init.go @@ -13,6 +13,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/specs-actors/actors/util/adt" bstore "github.com/filecoin-project/lotus/blockstore" @@ -174,7 +175,7 @@ func SetupInitActor(ctx context.Context, bs bstore.Blockstore, netname string, i return 0, nil, nil, err } - actcid, ok := actors.GetActorCodeID(av, actors.InitKey) + actcid, ok := actors.GetActorCodeID(av, manifest.InitKey) if !ok { return 0, nil, nil, xerrors.Errorf("failed to get init actor code ID for actors version %d", av) } diff --git a/chain/gen/genesis/f02_reward.go b/chain/gen/genesis/f02_reward.go index 4a5ac9fa1..db32517f9 100644 --- a/chain/gen/genesis/f02_reward.go +++ b/chain/gen/genesis/f02_reward.go @@ -8,6 +8,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" bstore "github.com/filecoin-project/lotus/blockstore" "github.com/filecoin-project/lotus/build" @@ -29,7 +30,7 @@ func SetupRewardActor(ctx context.Context, bs bstore.Blockstore, qaPower big.Int return nil, err } - actcid, ok := actors.GetActorCodeID(av, actors.RewardKey) + actcid, ok := actors.GetActorCodeID(av, manifest.RewardKey) if !ok { return nil, xerrors.Errorf("failed to get reward actor code ID for actors version %d", av) } diff --git a/chain/gen/genesis/f03_cron.go b/chain/gen/genesis/f03_cron.go index 16396c437..4c377b191 100644 --- a/chain/gen/genesis/f03_cron.go +++ b/chain/gen/genesis/f03_cron.go @@ -8,6 +8,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" bstore "github.com/filecoin-project/lotus/blockstore" "github.com/filecoin-project/lotus/chain/actors" @@ -28,7 +29,7 @@ func SetupCronActor(ctx context.Context, bs bstore.Blockstore, av actorstypes.Ve return nil, err } - actcid, ok := actors.GetActorCodeID(av, actors.CronKey) + actcid, ok := actors.GetActorCodeID(av, manifest.CronKey) if !ok { return nil, xerrors.Errorf("failed to get cron actor code ID for actors version %d", av) } diff --git a/chain/gen/genesis/f04_power.go b/chain/gen/genesis/f04_power.go index f05b0c746..385cc97d2 100644 --- a/chain/gen/genesis/f04_power.go +++ b/chain/gen/genesis/f04_power.go @@ -8,6 +8,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/specs-actors/actors/util/adt" bstore "github.com/filecoin-project/lotus/blockstore" @@ -29,7 +30,7 @@ func SetupStoragePowerActor(ctx context.Context, bs bstore.Blockstore, av actors return nil, err } - actcid, ok := actors.GetActorCodeID(av, actors.PowerKey) + actcid, ok := actors.GetActorCodeID(av, manifest.PowerKey) if !ok { return nil, xerrors.Errorf("failed to get power actor code ID for actors version %d", av) } diff --git a/chain/gen/genesis/f05_market.go b/chain/gen/genesis/f05_market.go index 28a258c40..59c61a3ae 100644 --- a/chain/gen/genesis/f05_market.go +++ b/chain/gen/genesis/f05_market.go @@ -8,6 +8,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" bstore "github.com/filecoin-project/lotus/blockstore" "github.com/filecoin-project/lotus/chain/actors" @@ -28,7 +29,7 @@ func SetupStorageMarketActor(ctx context.Context, bs bstore.Blockstore, av actor return nil, err } - actcid, ok := actors.GetActorCodeID(av, actors.MarketKey) + actcid, ok := actors.GetActorCodeID(av, manifest.MarketKey) if !ok { return nil, xerrors.Errorf("failed to get market actor code ID for actors version %d", av) } diff --git a/chain/gen/genesis/f06_vreg.go b/chain/gen/genesis/f06_vreg.go index 1b3582d4d..ffddc814f 100644 --- a/chain/gen/genesis/f06_vreg.go +++ b/chain/gen/genesis/f06_vreg.go @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/specs-actors/actors/util/adt" bstore "github.com/filecoin-project/lotus/blockstore" @@ -41,7 +42,7 @@ func SetupVerifiedRegistryActor(ctx context.Context, bs bstore.Blockstore, av ac return nil, err } - actcid, ok := actors.GetActorCodeID(av, actors.VerifregKey) + actcid, ok := actors.GetActorCodeID(av, manifest.VerifregKey) if !ok { return nil, xerrors.Errorf("failed to get verifreg actor code ID for actors version %d", av) } diff --git a/chain/gen/genesis/f07_dcap.go b/chain/gen/genesis/f07_dcap.go index 235cb0ce3..6d8e3258e 100644 --- a/chain/gen/genesis/f07_dcap.go +++ b/chain/gen/genesis/f07_dcap.go @@ -10,6 +10,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/builtin" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/specs-actors/actors/util/adt" bstore "github.com/filecoin-project/lotus/blockstore" @@ -41,7 +42,7 @@ func SetupDatacapActor(ctx context.Context, bs bstore.Blockstore, av actorstypes return nil, err } - actcid, ok := actors.GetActorCodeID(av, actors.DatacapKey) + actcid, ok := actors.GetActorCodeID(av, manifest.DatacapKey) if !ok { return nil, xerrors.Errorf("failed to get datacap actor code ID for actors version %d", av) } diff --git a/chain/gen/genesis/fevm.go b/chain/gen/genesis/fevm.go index c154716b9..5cbf200ce 100644 --- a/chain/gen/genesis/fevm.go +++ b/chain/gen/genesis/fevm.go @@ -13,6 +13,7 @@ import ( builtintypes "github.com/filecoin-project/go-state-types/builtin" evm10 "github.com/filecoin-project/go-state-types/builtin/v10/evm" init10 "github.com/filecoin-project/go-state-types/builtin/v10/init" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/lotus/chain/actors" @@ -59,7 +60,7 @@ func SetupFEVM(ctx context.Context, cs *store.ChainStore, sys vm.SyscallBuilder, } // The ETH0 address is occupied by an empty contract EVM actor - evmCodeCid, ok := actors.GetActorCodeID(av, actors.EvmKey) + evmCodeCid, ok := actors.GetActorCodeID(av, manifest.EvmKey) if !ok { return cid.Undef, fmt.Errorf("failed to get CodeCID for EVM during genesis") } diff --git a/chain/gen/genesis/genesis.go b/chain/gen/genesis/genesis.go index 864b272e4..3e1c916f6 100644 --- a/chain/gen/genesis/genesis.go +++ b/chain/gen/genesis/genesis.go @@ -18,6 +18,7 @@ import ( "github.com/filecoin-project/go-state-types/big" builtintypes "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/crypto" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/go-state-types/network" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" @@ -381,7 +382,7 @@ func MakeAccountActor(ctx context.Context, cst cbor.IpldStore, av actorstypes.Ve return nil, err } - actcid, ok := actors.GetActorCodeID(av, actors.AccountKey) + actcid, ok := actors.GetActorCodeID(av, manifest.AccountKey) if !ok { return nil, xerrors.Errorf("failed to get account actor code ID for actors version %d", av) } @@ -464,7 +465,7 @@ func CreateMultisigAccount(ctx context.Context, cst cbor.IpldStore, state *state return err } - actcid, ok := actors.GetActorCodeID(av, actors.MultisigKey) + actcid, ok := actors.GetActorCodeID(av, manifest.MultisigKey) if !ok { return xerrors.Errorf("failed to get multisig code ID for actors version %d", av) } @@ -692,7 +693,7 @@ func SetupEAM(_ context.Context, nst *state.StateTree, nv network.Version) error return nil } - codecid, ok := actors.GetActorCodeID(av, actors.EamKey) + codecid, ok := actors.GetActorCodeID(av, manifest.EamKey) if !ok { return fmt.Errorf("failed to get CodeCID for EAM during genesis") } diff --git a/chain/messagepool/messagepool.go b/chain/messagepool/messagepool.go index 93f6977b1..0a20f3c24 100644 --- a/chain/messagepool/messagepool.go +++ b/chain/messagepool/messagepool.go @@ -34,9 +34,11 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/chain/consensus/filcns" "github.com/filecoin-project/lotus/chain/stmgr" "github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/lotus/chain/types/ethtypes" "github.com/filecoin-project/lotus/chain/vm" "github.com/filecoin-project/lotus/journal" "github.com/filecoin-project/lotus/lib/sigs" @@ -776,7 +778,7 @@ func sigCacheKey(m *types.SignedMessage) (string, error) { case crypto.SigTypeSecp256k1: return string(m.Cid().Bytes()), nil case crypto.SigTypeDelegated: - txArgs, err := api.NewEthTxArgsFromMessage(&m.Message) + txArgs, err := ethtypes.NewEthTxArgsFromMessage(&m.Message) if err != nil { return "", err } @@ -803,9 +805,9 @@ func (mp *MessagePool) VerifyMsgSig(m *types.SignedMessage) error { } if m.Signature.Type == crypto.SigTypeDelegated { - txArgs, err := api.NewEthTxArgsFromMessage(&m.Message) + txArgs, err := ethtypes.NewEthTxArgsFromMessage(&m.Message) if err != nil { - return err + return xerrors.Errorf("failed to convert to eth tx args: %w", err) } msg, err := txArgs.OriginalRlpMsg() if err != nil { @@ -872,18 +874,28 @@ func (mp *MessagePool) addTs(ctx context.Context, m *types.SignedMessage, curTs mp.lk.Lock() defer mp.lk.Unlock() + senderAct, err := mp.api.GetActorAfter(m.Message.From, curTs) + if err != nil { + return false, xerrors.Errorf("failed to get sender actor: %w", err) + } + + // TODO: I'm not thrilled about depending on filcns here, but I prefer this to duplicating logic + if !filcns.IsValidForSending(senderAct) { + return false, xerrors.Errorf("sender actor %s is not a valid top-level sender", m.Message.From) + } + publish, err := mp.verifyMsgBeforeAdd(ctx, m, curTs, local) if err != nil { - return false, err + return false, xerrors.Errorf("verify msg failed: %w", err) } if err := mp.checkBalance(ctx, m, curTs); err != nil { - return false, err + return false, xerrors.Errorf("failed to check balance: %w", err) } err = mp.addLocked(ctx, m, !local, untrusted) if err != nil { - return false, err + return false, xerrors.Errorf("failed to add locked: %w", err) } if local { diff --git a/chain/messagepool/messagepool_test.go b/chain/messagepool/messagepool_test.go index 35e13e13d..c205bbc6a 100644 --- a/chain/messagepool/messagepool_test.go +++ b/chain/messagepool/messagepool_test.go @@ -155,7 +155,7 @@ func (tma *testMpoolAPI) GetActorAfter(addr address.Address, ts *types.TipSet) ( } return &types.Actor{ - Code: builtin2.StorageMarketActorCodeID, + Code: builtin2.AccountActorCodeID, Nonce: nonce, Balance: balance, }, nil diff --git a/chain/stmgr/actors.go b/chain/stmgr/actors.go index f4fa2d98d..0c2524b7b 100644 --- a/chain/stmgr/actors.go +++ b/chain/stmgr/actors.go @@ -103,6 +103,7 @@ func PreCommitInfo(ctx context.Context, sm *StateManager, maddr address.Address, return mas.GetPrecommittedSector(sid) } +// Returns nil, nil if sector is not found func MinerSectorInfo(ctx context.Context, sm *StateManager, maddr address.Address, sid abi.SectorNumber, ts *types.TipSet) (*miner.SectorOnChainInfo, error) { act, err := sm.LoadActor(ctx, maddr, ts) if err != nil { diff --git a/api/eth_transactions.go b/chain/types/ethtypes/eth_transactions.go similarity index 99% rename from api/eth_transactions.go rename to chain/types/ethtypes/eth_transactions.go index ee2b083ce..4f5f865e4 100644 --- a/api/eth_transactions.go +++ b/chain/types/ethtypes/eth_transactions.go @@ -1,4 +1,4 @@ -package api +package ethtypes import ( "bytes" diff --git a/api/eth_transactions_test.go b/chain/types/ethtypes/eth_transactions_test.go similarity index 99% rename from api/eth_transactions_test.go rename to chain/types/ethtypes/eth_transactions_test.go index e7dd6ba1e..b94692a3f 100644 --- a/api/eth_transactions_test.go +++ b/chain/types/ethtypes/eth_transactions_test.go @@ -1,4 +1,4 @@ -package api +package ethtypes import ( "bytes" diff --git a/api/eth_types.go b/chain/types/ethtypes/eth_types.go similarity index 97% rename from api/eth_types.go rename to chain/types/ethtypes/eth_types.go index b01566e5f..69546844b 100644 --- a/api/eth_types.go +++ b/chain/types/ethtypes/eth_types.go @@ -1,4 +1,4 @@ -package api +package ethtypes import ( "bytes" @@ -19,7 +19,6 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/big" builtintypes "github.com/filecoin-project/go-state-types/builtin" - "github.com/filecoin-project/lotus/build" ) @@ -199,6 +198,7 @@ type EthTxReceipt struct { BlockNumber EthUint64 `json:"blockNumber"` From EthAddress `json:"from"` To *EthAddress `json:"to"` + StateRoot EthHash `json:"root"` Status EthUint64 `json:"status"` ContractAddress *EthAddress `json:"contractAddress"` CumulativeGasUsed EthUint64 `json:"cumulativeGasUsed"` @@ -315,10 +315,15 @@ func TryEthAddressFromFilecoinAddress(addr address.Address, allowId bool) (EthAd func EthAddressFromFilecoinAddress(addr address.Address) (EthAddress, error) { ethAddr, ok, err := TryEthAddressFromFilecoinAddress(addr, true) - if !ok && err == nil { - err = xerrors.Errorf("failed to convert filecoin address %s to an equivalent eth address", addr) + if err != nil { + return EthAddress{}, xerrors.Errorf("failed to try converting filecoin to eth addr: %w", err) } - return ethAddr, err + + if !ok { + return EthAddress{}, xerrors.Errorf("failed to convert filecoin address %s to an equivalent eth address", addr) + } + + return ethAddr, nil } func EthAddressFromHex(s string) (EthAddress, error) { @@ -335,7 +340,7 @@ func EthAddressFromHex(s string) (EthAddress, error) { func EthAddressFromBytes(b []byte) (EthAddress, error) { var a EthAddress if len(b) != EthAddressLength { - return EthAddress{}, xerrors.Errorf("cannot parse bytes into anœ EthAddress: incorrect input length") + return EthAddress{}, xerrors.Errorf("cannot parse bytes into an EthAddress: incorrect input length") } copy(a[:], b[:]) return a, nil diff --git a/api/eth_types_test.go b/chain/types/ethtypes/eth_types_test.go similarity index 99% rename from api/eth_types_test.go rename to chain/types/ethtypes/eth_types_test.go index 845c14edd..fe7b07b11 100644 --- a/api/eth_types_test.go +++ b/chain/types/ethtypes/eth_types_test.go @@ -1,5 +1,4 @@ -// stm: #unit -package api +package ethtypes import ( "encoding/json" diff --git a/api/rlp.go b/chain/types/ethtypes/rlp.go similarity index 99% rename from api/rlp.go rename to chain/types/ethtypes/rlp.go index 1a0b06a80..e94ad8bb6 100644 --- a/api/rlp.go +++ b/chain/types/ethtypes/rlp.go @@ -1,4 +1,4 @@ -package api +package ethtypes import ( "bytes" diff --git a/api/rlp_test.go b/chain/types/ethtypes/rlp_test.go similarity index 99% rename from api/rlp_test.go rename to chain/types/ethtypes/rlp_test.go index fae14c782..bdbedff00 100644 --- a/api/rlp_test.go +++ b/chain/types/ethtypes/rlp_test.go @@ -1,4 +1,4 @@ -package api +package ethtypes import ( "encoding/hex" diff --git a/chain/vm/fvm.go b/chain/vm/fvm.go index 45b4d6b0f..3d1588e89 100644 --- a/chain/vm/fvm.go +++ b/chain/vm/fvm.go @@ -23,6 +23,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/exitcode" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/lotus/blockstore" @@ -311,6 +312,7 @@ func defaultFVMOpts(ctx context.Context, opts *VMOpts) (*ffi.FVMOpts, error) { }, Epoch: opts.Epoch, Timestamp: opts.Timestamp, + ChainID: build.Eip155ChainId, BaseFee: opts.BaseFee, BaseCircSupply: circToReport, NetworkVersion: opts.NetworkVersion, @@ -405,7 +407,7 @@ func NewDebugFVM(ctx context.Context, opts *VMOpts) (*FVM, error) { // create actor redirect mapping actorRedirect := make(map[cid.Cid]cid.Cid) - for _, key := range actors.GetBuiltinActorsKeys(av) { + for _, key := range manifest.GetBuiltinActorsKeys(av) { from, ok := actors.GetActorCodeID(av, key) if !ok { log.Warnf("actor missing in the from manifest %s", key) diff --git a/chain/vm/invoker.go b/chain/vm/invoker.go index ad4a54334..ebf8dd734 100644 --- a/chain/vm/invoker.go +++ b/chain/vm/invoker.go @@ -53,7 +53,7 @@ func ActorsVersionPredicate(ver actorstypes.Version) ActorPredicate { } type invokeFunc func(rt vmr.Runtime, params []byte) ([]byte, aerrors.ActorError) -type nativeCode map[uint64]invokeFunc +type nativeCode map[abi.MethodNum]invokeFunc type actorInfo struct { methods nativeCode @@ -78,10 +78,10 @@ func (ar *ActorRegistry) Invoke(codeCid cid.Cid, rt vmr.Runtime, method abi.Meth if err := act.predicate(rt, codeCid); err != nil { return nil, aerrors.Newf(exitcode.SysErrorIllegalActor, "unsupported actor: %s", err) } - if act.methods[uint64(method)] == nil { + if act.methods[method] == nil { return nil, aerrors.Newf(exitcode.SysErrInvalidMethod, "no method %d on actor", method) } - return act.methods[uint64(method)](rt, params) + return act.methods[method](rt, params) } @@ -156,7 +156,7 @@ func (ar *ActorRegistry) Register(av actorstypes.Version, pred ActorPredicate, v mm.Params = et.In(0) } - methods[abi.MethodNum(number)] = mm + methods[number] = mm } if realCode.Defined() { ar.Methods[realCode] = methods @@ -185,7 +185,7 @@ func (ar *ActorRegistry) Create(codeCid cid.Cid, rt vmr.Runtime) (*types.Actor, } type invokee interface { - Exports() map[uint64]builtinst.MethodMeta + Exports() map[abi.MethodNum]builtinst.MethodMeta } func (*ActorRegistry) transform(instance invokee) (nativeCode, error) { @@ -285,7 +285,7 @@ func DecodeParams(b []byte, out interface{}) error { func DumpActorState(i *ActorRegistry, act *types.Actor, b []byte) (interface{}, error) { // Account & Embryo code special case - if builtin.IsAccountActor(act.Code) || builtin.IsEmbryo(act.Code) { + if builtin.IsAccountActor(act.Code) || builtin.IsEmbryoActor(act.Code) { return nil, nil } diff --git a/chain/wallet/key/key.go b/chain/wallet/key/key.go index cb769ef09..a52a431c6 100644 --- a/chain/wallet/key/key.go +++ b/chain/wallet/key/key.go @@ -1,9 +1,11 @@ package key import ( + "golang.org/x/crypto/sha3" "golang.org/x/xerrors" "github.com/filecoin-project/go-address" + "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/lotus/chain/types" @@ -45,11 +47,27 @@ func NewKey(keyinfo types.KeyInfo) (*Key, error) { } switch k.Type { - case types.KTSecp256k1, types.KTDelegated: + case types.KTSecp256k1: k.Address, err = address.NewSecp256k1Address(k.PublicKey) if err != nil { return nil, xerrors.Errorf("converting Secp256k1 to address: %w", err) } + case types.KTDelegated: + // Assume eth for now + hasher := sha3.NewLegacyKeccak256() + pubk := k.PublicKey + // if we get an uncompressed public key (that's what we get from the library, + // but putting this check here for defensiveness), strip the prefix + if pubk[0] == 0x04 { + pubk = pubk[1:] + } + + hasher.Write(pubk) + + k.Address, err = address.NewDelegatedAddress(builtin.EthereumAddressManagerActorID, hasher.Sum(nil)[12:]) + if err != nil { + return nil, xerrors.Errorf("converting Delegated to address: %w", err) + } case types.KTBLS: k.Address, err = address.NewBLSAddress(k.PublicKey) if err != nil { @@ -58,6 +76,7 @@ func NewKey(keyinfo types.KeyInfo) (*Key, error) { default: return nil, xerrors.Errorf("unsupported key type: %s", k.Type) } + return k, nil } diff --git a/chain/wallet/multi.go b/chain/wallet/multi.go index a88475c2e..91d271477 100644 --- a/chain/wallet/multi.go +++ b/chain/wallet/multi.go @@ -120,22 +120,22 @@ func (m MultiWallet) WalletSign(ctx context.Context, signer address.Address, toS return nil, err } if w == nil { - return nil, xerrors.Errorf("key not found") + return nil, xerrors.Errorf("key not found for %s", signer) } return w.WalletSign(ctx, signer, toSign, meta) } -func (m MultiWallet) WalletExport(ctx context.Context, address address.Address) (*types.KeyInfo, error) { - w, err := m.find(ctx, address, m.Remote, m.Local) +func (m MultiWallet) WalletExport(ctx context.Context, addr address.Address) (*types.KeyInfo, error) { + w, err := m.find(ctx, addr, m.Remote, m.Local) if err != nil { return nil, err } if w == nil { - return nil, xerrors.Errorf("key not found") + return nil, xerrors.Errorf("key not found for %s", addr) } - return w.WalletExport(ctx, address) + return w.WalletExport(ctx, addr) } func (m MultiWallet) WalletImport(ctx context.Context, info *types.KeyInfo) (address.Address, error) { diff --git a/chain/wallet/wallet.go b/chain/wallet/wallet.go index 32a94d3b2..76af663c7 100644 --- a/chain/wallet/wallet.go +++ b/chain/wallet/wallet.go @@ -141,7 +141,7 @@ func (w *LocalWallet) WalletExport(ctx context.Context, addr address.Address) (* return nil, xerrors.Errorf("failed to find key to export: %w", err) } if k == nil { - return nil, xerrors.Errorf("key not found") + return nil, xerrors.Errorf("key not found for %s", addr) } return &k.KeyInfo, nil diff --git a/cli/chain.go b/cli/chain.go index 5c20d631c..4da3273d5 100644 --- a/cli/chain.go +++ b/cli/chain.go @@ -1668,6 +1668,9 @@ var ChainInvokeEVMCmd = &cli.Command{ &cli.StringFlag{ Name: "from", Usage: "optionally specify the account to use for sending the exec message", + }, &cli.IntFlag{ + Name: "value", + Usage: "optionally specify the value to be sent with the invokation message", }, }, Action: func(cctx *cli.Context) error { @@ -1728,10 +1731,11 @@ var ChainInvokeEVMCmd = &cli.Command{ fromAddr = addr } + val := abi.NewTokenAmount(cctx.Int64("value")) msg := &types.Message{ To: addr, From: fromAddr, - Value: big.Zero(), + Value: val, Method: abi.MethodNum(2), Params: params, } diff --git a/cli/client.go b/cli/client.go index 377505363..1c41262a5 100644 --- a/cli/client.go +++ b/cli/client.go @@ -627,7 +627,13 @@ uiLoop: minDealDurationDays := uint64(build.MinDealDuration) / (builtin.SecondsInDay / build.BlockDelaySecs) if days < int(minDealDurationDays) { - printErr(xerrors.Errorf("minimum duration is %d days", minDealDurationDays)) + printErr(xerrors.Errorf("minimum duration is %d days, got %d", minDealDurationDays, days)) + continue + } + + maxDealDurationDays := uint64(build.MaxDealDuration) / (builtin.SecondsInDay / build.BlockDelaySecs) + if days > int(maxDealDurationDays) { + printErr(xerrors.Errorf("maximum duration is %d days, got %d", maxDealDurationDays, days)) continue } diff --git a/cli/helper.go b/cli/helper.go index c4a61397c..81a5bb033 100644 --- a/cli/helper.go +++ b/cli/helper.go @@ -4,6 +4,8 @@ import ( "fmt" "io" "os" + "os/signal" + "syscall" ufcli "github.com/urfave/cli/v2" "golang.org/x/xerrors" @@ -36,6 +38,13 @@ func IncorrectNumArgs(cctx *ufcli.Context) error { } func RunApp(app *ufcli.App) { + c := make(chan os.Signal, 1) + signal.Notify(c, syscall.SIGTERM, syscall.SIGINT) + go func() { + <-c + os.Exit(1) + }() + if err := app.Run(os.Args); err != nil { if os.Getenv("LOTUS_DEV") != "" { log.Warnf("%+v", err) diff --git a/cmd/lotus-miner/actor.go b/cmd/lotus-miner/actor.go index 99c30a05b..dd78adfef 100644 --- a/cmd/lotus-miner/actor.go +++ b/cmd/lotus-miner/actor.go @@ -1133,7 +1133,7 @@ var actorConfirmChangeWorker = &cli.Command{ smsg, err := api.MpoolPushMessage(ctx, &types.Message{ From: mi.Owner, To: maddr, - Method: builtin.MethodsMiner.ConfirmUpdateWorkerKey, + Method: builtin.MethodsMiner.ConfirmChangeWorkerAddress, Value: big.Zero(), }, nil) if err != nil { diff --git a/cmd/lotus-miner/info.go b/cmd/lotus-miner/info.go index b1075be37..d791b0760 100644 --- a/cmd/lotus-miner/info.go +++ b/cmd/lotus-miner/info.go @@ -93,7 +93,7 @@ func infoCmdAct(cctx *cli.Context) error { fmt.Println("Enabled subsystems (from markets API):", subsystems) - start, err := fullapi.StartTime(ctx) + start, err := minerApi.StartTime(ctx) if err != nil { return err } diff --git a/cmd/lotus-miner/sectors.go b/cmd/lotus-miner/sectors.go index 3bb904d7a..9bfe56c4e 100644 --- a/cmd/lotus-miner/sectors.go +++ b/cmd/lotus-miner/sectors.go @@ -1119,31 +1119,21 @@ var sectorsExtendCmd = &cli.Command{ ArgsUsage: "", Flags: []cli.Flag{ &cli.Int64Flag{ - Name: "new-expiration", - Usage: "new expiration epoch", - Required: false, + Name: "new-expiration", + Usage: "new expiration epoch", }, &cli.BoolFlag{ - Name: "v1-sectors", - Usage: "renews all v1 sectors up to the maximum possible lifetime", - Required: false, + Name: "v1-sectors", + Usage: "renews all v1 sectors up to the maximum possible lifetime", }, &cli.Int64Flag{ - Name: "tolerance", - Value: 20160, - Usage: "when extending v1 sectors, don't try to extend sectors by fewer than this number of epochs", - Required: false, + Name: "expiration-ignore", + Value: 120, + Usage: "when extending v1 sectors, skip sectors whose current expiration is less than epochs from now", }, &cli.Int64Flag{ - Name: "expiration-ignore", - Value: 120, - Usage: "when extending v1 sectors, skip sectors whose current expiration is less than epochs from now", - Required: false, - }, - &cli.Int64Flag{ - Name: "expiration-cutoff", - Usage: "when extending v1 sectors, skip sectors whose current expiration is more than epochs from now (infinity if unspecified)", - Required: false, + Name: "expiration-cutoff", + Usage: "when extending v1 sectors, skip sectors whose current expiration is more than epochs from now (infinity if unspecified)", }, &cli.StringFlag{}, }, diff --git a/cmd/lotus-shed/actor.go b/cmd/lotus-shed/actor.go index 037b6d433..bdf2ecaf7 100644 --- a/cmd/lotus-shed/actor.go +++ b/cmd/lotus-shed/actor.go @@ -34,6 +34,7 @@ var actorCmd = &cli.Command{ actorControl, actorProposeChangeWorker, actorConfirmChangeWorker, + actorGetMethodNum, }, } @@ -777,7 +778,7 @@ var actorConfirmChangeWorker = &cli.Command{ smsg, err := nodeAPI.MpoolPushMessage(ctx, &types.Message{ From: mi.Owner, To: maddr, - Method: builtin.MethodsMiner.ConfirmUpdateWorkerKey, + Method: builtin.MethodsMiner.ConfirmChangeWorkerAddress, Value: big.Zero(), }, nil) if err != nil { @@ -809,3 +810,24 @@ var actorConfirmChangeWorker = &cli.Command{ return nil }, } + +var actorGetMethodNum = &cli.Command{ + Name: "generate-method-num", + Usage: "Generate method number from method name", + ArgsUsage: "[methodName]", + Action: func(cctx *cli.Context) error { + if !cctx.Args().Present() { + return fmt.Errorf("must pass methodNum") + } + + methodName := cctx.Args().First() + methodNum, err := builtin.GenerateFRCMethodNum(methodName) + if err != nil { + return err + } + + fmt.Println("Method Num: ", methodNum) + + return nil + }, +} diff --git a/cmd/lotus-shed/migrations.go b/cmd/lotus-shed/migrations.go index f23942326..ce570c6ac 100644 --- a/cmd/lotus-shed/migrations.go +++ b/cmd/lotus-shed/migrations.go @@ -24,6 +24,7 @@ import ( miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner" adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/specs-actors/v7/actors/migration/nv15" "github.com/filecoin-project/lotus/blockstore" @@ -587,7 +588,7 @@ func checkAllMinersUnsealedCID(stateTreeV9 *state.StateTree, store adt.Store) er } func checkMinerUnsealedCID(act *types.Actor, stateTreeV9 *state.StateTree, store adt.Store) error { - minerCodeCid, found := actors.GetActorCodeID(actorstypes.Version9, actors.MinerKey) + minerCodeCid, found := actors.GetActorCodeID(actorstypes.Version9, manifest.MinerKey) if !found { return xerrors.Errorf("could not find code cid for miner actor") } diff --git a/cmd/lotus-shed/miner-multisig.go b/cmd/lotus-shed/miner-multisig.go index 080229a6a..e8394b17a 100644 --- a/cmd/lotus-shed/miner-multisig.go +++ b/cmd/lotus-shed/miner-multisig.go @@ -627,7 +627,7 @@ var mmConfirmChangeWorker = &cli.Command{ return xerrors.Errorf("worker key change cannot be confirmed until %d, current height is %d", mi.WorkerChangeEpoch, head.Height()) } - pcid, err := api.MsigPropose(ctx, multisigAddr, minerAddr, big.Zero(), sender, uint64(builtin.MethodsMiner.ConfirmUpdateWorkerKey), nil) + pcid, err := api.MsigPropose(ctx, multisigAddr, minerAddr, big.Zero(), sender, uint64(builtin.MethodsMiner.ConfirmChangeWorkerAddress), nil) if err != nil { return xerrors.Errorf("proposing message: %w", err) } diff --git a/documentation/en/cli-lotus-miner.md b/documentation/en/cli-lotus-miner.md index b666d8ca7..4f3f33cf6 100644 --- a/documentation/en/cli-lotus-miner.md +++ b/documentation/en/cli-lotus-miner.md @@ -1919,7 +1919,6 @@ OPTIONS: --expiration-cutoff value when extending v1 sectors, skip sectors whose current expiration is more than epochs from now (infinity if unspecified) (default: 0) --expiration-ignore value when extending v1 sectors, skip sectors whose current expiration is less than epochs from now (default: 120) --new-expiration value new expiration epoch (default: 0) - --tolerance value when extending v1 sectors, don't try to extend sectors by fewer than this number of epochs (default: 20160) --v1-sectors renews all v1 sectors up to the maximum possible lifetime (default: false) ``` diff --git a/documentation/en/cli-lotus.md b/documentation/en/cli-lotus.md index d17b915e3..35bc11760 100644 --- a/documentation/en/cli-lotus.md +++ b/documentation/en/cli-lotus.md @@ -2454,7 +2454,8 @@ USAGE: lotus chain invoke-evm-actor [command options] address contract-entry-point [input-data] OPTIONS: - --from value optionally specify the account to use for sending the exec message + --from value optionally specify the account to use for sending the exec message + --value value optionally specify the value to be sent with the invokation message (default: 0) ``` diff --git a/documentation/en/default-lotus-config.toml b/documentation/en/default-lotus-config.toml index 574d11950..d8ddc27e3 100644 --- a/documentation/en/default-lotus-config.toml +++ b/documentation/en/default-lotus-config.toml @@ -98,6 +98,35 @@ # env var: LOTUS_PUBSUB_REMOTETRACER #RemoteTracer = "" + # Path to file that will be used to output tracer content in JSON format. + # If present tracer will save data to defined file. + # Format: file path + # + # type: string + # env var: LOTUS_PUBSUB_JSONTRACER + #JsonTracer = "" + + # Connection string for elasticsearch instance. + # If present tracer will save data to elasticsearch. + # Format: https://:@:/ + # + # type: string + # env var: LOTUS_PUBSUB_ELASTICSEARCHTRACER + #ElasticSearchTracer = "" + + # Name of elasticsearch index that will be used to save tracer data. + # This property is used only if ElasticSearchTracer propery is set. + # + # type: string + # env var: LOTUS_PUBSUB_ELASTICSEARCHINDEX + #ElasticSearchIndex = "" + + # Auth token that will be passed with logs to elasticsearch - used for weighted peers score. + # + # type: string + # env var: LOTUS_PUBSUB_TRACERSOURCEAUTH + #TracerSourceAuth = "" + [Client] # type: bool diff --git a/documentation/en/default-lotus-miner-config.toml b/documentation/en/default-lotus-miner-config.toml index 939bac0cc..416531f98 100644 --- a/documentation/en/default-lotus-miner-config.toml +++ b/documentation/en/default-lotus-miner-config.toml @@ -98,6 +98,35 @@ # env var: LOTUS_PUBSUB_REMOTETRACER #RemoteTracer = "" + # Path to file that will be used to output tracer content in JSON format. + # If present tracer will save data to defined file. + # Format: file path + # + # type: string + # env var: LOTUS_PUBSUB_JSONTRACER + #JsonTracer = "" + + # Connection string for elasticsearch instance. + # If present tracer will save data to elasticsearch. + # Format: https://:@:/ + # + # type: string + # env var: LOTUS_PUBSUB_ELASTICSEARCHTRACER + #ElasticSearchTracer = "" + + # Name of elasticsearch index that will be used to save tracer data. + # This property is used only if ElasticSearchTracer propery is set. + # + # type: string + # env var: LOTUS_PUBSUB_ELASTICSEARCHINDEX + #ElasticSearchIndex = "" + + # Auth token that will be passed with logs to elasticsearch - used for weighted peers score. + # + # type: string + # env var: LOTUS_PUBSUB_TRACERSOURCEAUTH + #TracerSourceAuth = "" + [Subsystems] # type: bool diff --git a/go.mod b/go.mod index dc3e6b23d..5a0bfa6b5 100644 --- a/go.mod +++ b/go.mod @@ -23,6 +23,7 @@ require ( github.com/drand/drand v1.3.0 github.com/drand/kyber v1.1.7 github.com/dustin/go-humanize v1.0.0 + github.com/elastic/go-elasticsearch/v7 v7.14.0 github.com/elastic/go-sysinfo v1.7.0 github.com/elastic/gosigar v0.14.2 github.com/etclabscore/go-openrpc-reflect v0.0.36 @@ -43,7 +44,7 @@ require ( github.com/filecoin-project/go-legs v0.4.4 github.com/filecoin-project/go-padreader v0.0.1 github.com/filecoin-project/go-paramfetch v0.0.4 - github.com/filecoin-project/go-state-types v0.10.0-alpha-2 + github.com/filecoin-project/go-state-types v0.10.0-alpha-5 github.com/filecoin-project/go-statemachine v1.0.2 github.com/filecoin-project/go-statestore v0.2.0 github.com/filecoin-project/go-storedcounter v0.1.0 diff --git a/go.sum b/go.sum index 1aabf6ab9..3ae66f5f1 100644 --- a/go.sum +++ b/go.sum @@ -266,6 +266,8 @@ github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5m github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/elastic/go-elasticsearch/v7 v7.14.0 h1:extp3jos/rwJn3J+lgbaGlwAgs0TVsIHme00GyNAyX4= +github.com/elastic/go-elasticsearch/v7 v7.14.0/go.mod h1:OJ4wdbtDNk5g503kvlHLyErCgQwwzmDtaFC4XyOxXA4= github.com/elastic/go-sysinfo v1.7.0 h1:4vVvcfi255+8+TyQ7TYUTEK3A+G8v5FLE+ZKYL1z1Dg= github.com/elastic/go-sysinfo v1.7.0/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6eh0ikPT9F0= github.com/elastic/go-windows v1.0.0 h1:qLURgZFkkrYyTTkvYpsZIgf83AUsdIHfvlJaqaZ7aSY= @@ -354,8 +356,8 @@ github.com/filecoin-project/go-state-types v0.1.0/go.mod h1:ezYnPf0bNkTsDibL/psS github.com/filecoin-project/go-state-types v0.1.6/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q= github.com/filecoin-project/go-state-types v0.1.8/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q= github.com/filecoin-project/go-state-types v0.1.10/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q= -github.com/filecoin-project/go-state-types v0.10.0-alpha-2 h1:xz8+sXAuCMane7SkEYCtQjD/zYJ4n1d5bxwYNL8Thf0= -github.com/filecoin-project/go-state-types v0.10.0-alpha-2/go.mod h1:7ty480tvttEAqWKywhAaDCElk7ksTqEXtXWAzTSdEKo= +github.com/filecoin-project/go-state-types v0.10.0-alpha-5 h1:k5yLpgqTns8OFjPwMWfDCmSDd+BqpFhsQEQKIquM3cM= +github.com/filecoin-project/go-state-types v0.10.0-alpha-5/go.mod h1:FPgQE05BFwZxKw/vCuIaIrzfJKo4RPQQMMPGd43dAFI= github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig= github.com/filecoin-project/go-statemachine v1.0.2 h1:421SSWBk8GIoCoWYYTE/d+qCWccgmRH0uXotXRDjUbc= github.com/filecoin-project/go-statemachine v1.0.2/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54= diff --git a/itests/ccupgrade_test.go b/itests/ccupgrade_test.go index 909b5691e..819340ea1 100644 --- a/itests/ccupgrade_test.go +++ b/itests/ccupgrade_test.go @@ -71,6 +71,7 @@ func runTestCCUpgrade(t *testing.T) *kit.TestFullNode { { si, err := client.StateSectorGetInfo(ctx, maddr, CCUpgrade, types.EmptyTSK) require.NoError(t, err) + require.NotNil(t, si) require.Less(t, 50000, int(si.Expiration)) } client.WaitForSectorActive(ctx, t, CCUpgrade, maddr) diff --git a/itests/eth_account_abstraction_test.go b/itests/eth_account_abstraction_test.go new file mode 100644 index 000000000..edbff32eb --- /dev/null +++ b/itests/eth_account_abstraction_test.go @@ -0,0 +1,127 @@ +package itests + +import ( + "context" + "fmt" + "testing" + "time" + + "github.com/stretchr/testify/require" + + "github.com/filecoin-project/go-state-types/abi" + "github.com/filecoin-project/go-state-types/exitcode" + + "github.com/filecoin-project/lotus/api" + "github.com/filecoin-project/lotus/chain/actors/builtin" + "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/lotus/chain/types/ethtypes" + "github.com/filecoin-project/lotus/chain/wallet/key" + "github.com/filecoin-project/lotus/itests/kit" +) + +// TestEthAccountAbstraction goes over the account abstraction workflow: +// - an embryo is created when it receives a message +// - the embryo turns into an EOA when it sends a message +func TestEthAccountAbstraction(t *testing.T) { + kit.QuietMiningLogs() + + blockTime := 100 * time.Millisecond + client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC()) + ens.InterconnectAll().BeginMining(blockTime) + + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + defer cancel() + + secpKey, err := key.GenerateKey(types.KTDelegated) + require.NoError(t, err) + + embryoAddress, err := client.WalletImport(ctx, &secpKey.KeyInfo) + require.NoError(t, err) + + fmt.Println(embryoAddress) + + // create an embryo actor at the target address + msgCreateEmbryo := &types.Message{ + From: client.DefaultKey.Address, + To: embryoAddress, + Value: abi.TokenAmount(types.MustParseFIL("100")), + } + smCreateEmbryo, err := client.MpoolPushMessage(ctx, msgCreateEmbryo, nil) + require.NoError(t, err) + mLookup, err := client.StateWaitMsg(ctx, smCreateEmbryo.Cid(), 3, api.LookbackNoLimit, true) + require.NoError(t, err) + require.Equal(t, exitcode.Ok, mLookup.Receipt.ExitCode) + + // confirm the embryo is an embryo + embryoActor, err := client.StateGetActor(ctx, embryoAddress, types.EmptyTSK) + require.NoError(t, err) + + require.True(t, builtin.IsEmbryoActor(embryoActor.Code)) + + // send a message from the embryo address + msgFromEmbryo := &types.Message{ + From: embryoAddress, + // self-send because an "eth tx payload" can't be to a filecoin address? + To: embryoAddress, + } + msgFromEmbryo, err = client.GasEstimateMessageGas(ctx, msgFromEmbryo, nil, types.EmptyTSK) + require.NoError(t, err) + + txArgs, err := ethtypes.NewEthTxArgsFromMessage(msgFromEmbryo) + require.NoError(t, err) + + digest, err := txArgs.OriginalRlpMsg() + require.NoError(t, err) + + siggy, err := client.WalletSign(ctx, embryoAddress, digest) + require.NoError(t, err) + + smFromEmbryoCid, err := client.MpoolPush(ctx, &types.SignedMessage{Message: *msgFromEmbryo, Signature: *siggy}) + require.NoError(t, err) + + mLookup, err = client.StateWaitMsg(ctx, smFromEmbryoCid, 3, api.LookbackNoLimit, true) + require.NoError(t, err) + require.Equal(t, exitcode.Ok, mLookup.Receipt.ExitCode) + + // confirm ugly Embryo duckling has turned into a beautiful EthAccount swan + + eoaActor, err := client.StateGetActor(ctx, embryoAddress, types.EmptyTSK) + require.NoError(t, err) + + require.False(t, builtin.IsEmbryoActor(eoaActor.Code)) + require.True(t, builtin.IsEthAccountActor(eoaActor.Code)) + + // Send another message, it should succeed without any code CID changes + + msgFromEmbryo = &types.Message{ + From: embryoAddress, + To: embryoAddress, + } + + msgFromEmbryo, err = client.GasEstimateMessageGas(ctx, msgFromEmbryo, nil, types.EmptyTSK) + require.NoError(t, err) + + txArgs, err = ethtypes.NewEthTxArgsFromMessage(msgFromEmbryo) + require.NoError(t, err) + + digest, err = txArgs.OriginalRlpMsg() + require.NoError(t, err) + + siggy, err = client.WalletSign(ctx, embryoAddress, digest) + require.NoError(t, err) + + smFromEmbryoCid, err = client.MpoolPush(ctx, &types.SignedMessage{Message: *msgFromEmbryo, Signature: *siggy}) + require.NoError(t, err) + + mLookup, err = client.StateWaitMsg(ctx, smFromEmbryoCid, 3, api.LookbackNoLimit, true) + require.NoError(t, err) + require.Equal(t, exitcode.Ok, mLookup.Receipt.ExitCode) + + // confirm no changes in code CID + + eoaActor, err = client.StateGetActor(ctx, embryoAddress, types.EmptyTSK) + require.NoError(t, err) + + require.False(t, builtin.IsEmbryoActor(eoaActor.Code)) + require.True(t, builtin.IsEthAccountActor(eoaActor.Code)) +} diff --git a/itests/fevm_test.go b/itests/fevm_test.go index d16ddc1e4..ca03c6b16 100644 --- a/itests/fevm_test.go +++ b/itests/fevm_test.go @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" builtintypes "github.com/filecoin-project/go-state-types/builtin" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/types" @@ -113,7 +114,7 @@ func TestFEVMETH0(t *testing.T) { av, err := actorstypes.VersionForNetwork(nv) require.NoError(t, err) - evmCodeCid, ok := actors.GetActorCodeID(av, actors.EvmKey) + evmCodeCid, ok := actors.GetActorCodeID(av, manifest.EvmKey) require.True(t, ok, "failed to get EVM code id") require.Equal(t, act.Code, evmCodeCid) diff --git a/itests/kit/log.go b/itests/kit/log.go index 2932255d2..beac3895c 100644 --- a/itests/kit/log.go +++ b/itests/kit/log.go @@ -13,6 +13,7 @@ func QuietMiningLogs() { _ = logging.SetLogLevel("chainstore", "ERROR") _ = logging.SetLogLevel("chain", "ERROR") _ = logging.SetLogLevel("sub", "ERROR") + _ = logging.SetLogLevel("wdpost", "ERROR") _ = logging.SetLogLevel("storageminer", "ERROR") _ = logging.SetLogLevel("pubsub", "ERROR") _ = logging.SetLogLevel("gen", "ERROR") diff --git a/itests/lite_migration_test.go b/itests/lite_migration_test.go index 541a56b21..0f846e6fa 100644 --- a/itests/lite_migration_test.go +++ b/itests/lite_migration_test.go @@ -19,7 +19,6 @@ import ( "github.com/filecoin-project/specs-actors/v8/actors/util/adt" "github.com/filecoin-project/lotus/blockstore" - "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/builtin/system" "github.com/filecoin-project/lotus/chain/consensus/filcns" "github.com/filecoin-project/lotus/chain/state" @@ -95,7 +94,7 @@ func makeTestManifest(t *testing.T, ctxStore adt.Store, av actorstypes.Version) builder := cid.V1Builder{Codec: cid.Raw, MhType: mh.IDENTITY} manifestData := manifest.ManifestData{} - for _, name := range actors.GetBuiltinActorsKeys(av) { + for _, name := range manifest.GetBuiltinActorsKeys(av) { codeCid, err := builder.Sum([]byte(fmt.Sprintf("fil/8/%s", name))) if err != nil { t.Fatal(err) diff --git a/itests/multisig_test.go b/itests/multisig_test.go index 63cc2f511..b20dcf16b 100644 --- a/itests/multisig_test.go +++ b/itests/multisig_test.go @@ -133,7 +133,7 @@ func TestMultisigReentrant(t *testing.T) { sl, err := client.StateReplay(ctx, types.EmptyTSK, pm.Cid()) require.NoError(t, err, "failed to replay reentrant propose message (StateWaitMsg)") - require.Equal(t, 1025, countDepth(sl.ExecutionTrace)) + require.Equal(t, 1025, countDepth(sl.ExecutionTrace), "failed: %s", sl.Error) } func countDepth(trace types.ExecutionTrace) int { diff --git a/itests/raft_messagesigner_test.go b/itests/raft_messagesigner_test.go index 22dd7a5eb..220da9699 100644 --- a/itests/raft_messagesigner_test.go +++ b/itests/raft_messagesigner_test.go @@ -488,6 +488,8 @@ func TestChainStoreSync(t *testing.T) { } func TestGoRPCAuth(t *testing.T) { + // TODO Fix Raft, then enable this test. https://github.com/filecoin-project/lotus/issues/9888 + t.SkipNow() blockTime := 1 * time.Second diff --git a/itests/sector_make_cc_avail_test.go b/itests/sector_make_cc_avail_test.go index c6ed4b36d..524b3c70f 100644 --- a/itests/sector_make_cc_avail_test.go +++ b/itests/sector_make_cc_avail_test.go @@ -44,6 +44,7 @@ func TestMakeAvailable(t *testing.T) { { si, err := client.StateSectorGetInfo(ctx, maddr, CCUpgrade, types.EmptyTSK) require.NoError(t, err) + require.NotNil(t, si) require.Less(t, 50000, int(si.Expiration)) } client.WaitForSectorActive(ctx, t, CCUpgrade, maddr) diff --git a/itests/sector_prefer_no_upgrade_test.go b/itests/sector_prefer_no_upgrade_test.go index 0294899d9..96f07f9e4 100644 --- a/itests/sector_prefer_no_upgrade_test.go +++ b/itests/sector_prefer_no_upgrade_test.go @@ -46,6 +46,7 @@ func TestPreferNoUpgrade(t *testing.T) { { si, err := client.StateSectorGetInfo(ctx, maddr, CCUpgrade, types.EmptyTSK) require.NoError(t, err) + require.NotNil(t, si) require.Less(t, 50000, int(si.Expiration)) } client.WaitForSectorActive(ctx, t, CCUpgrade, maddr) diff --git a/itests/sector_revert_available_test.go b/itests/sector_revert_available_test.go index 99d410e95..41a46024f 100644 --- a/itests/sector_revert_available_test.go +++ b/itests/sector_revert_available_test.go @@ -42,6 +42,7 @@ func TestAbortUpgradeAvailable(t *testing.T) { { si, err := client.StateSectorGetInfo(ctx, maddr, CCUpgrade, types.EmptyTSK) require.NoError(t, err) + require.NotNil(t, si) require.Less(t, 50000, int(si.Expiration)) } client.WaitForSectorActive(ctx, t, CCUpgrade, maddr) diff --git a/lib/sigs/delegated/init.go b/lib/sigs/delegated/init.go index e092bc576..e25e8e9cb 100644 --- a/lib/sigs/delegated/init.go +++ b/lib/sigs/delegated/init.go @@ -27,8 +27,16 @@ func (delegatedSigner) ToPublic(pk []byte) ([]byte, error) { return gocrypto.PublicKey(pk), nil } -func (delegatedSigner) Sign(pk []byte, msg []byte) ([]byte, error) { - return nil, fmt.Errorf("not implemented") +func (s delegatedSigner) Sign(pk []byte, msg []byte) ([]byte, error) { + hasher := sha3.NewLegacyKeccak256() + hasher.Write(msg) + hashSum := hasher.Sum(nil) + sig, err := gocrypto.Sign(pk, hashSum) + if err != nil { + return nil, err + } + + return sig, nil } func (delegatedSigner) Verify(sig []byte, a address.Address, msg []byte) error { diff --git a/miner/warmup.go b/miner/warmup.go index 3b73afbc9..46236784a 100644 --- a/miner/warmup.go +++ b/miner/warmup.go @@ -59,6 +59,9 @@ out: if err != nil { return xerrors.Errorf("getting sector info: %w", err) } + if si == nil { + return xerrors.Errorf("sector not found %d", sector) + } ts, err := m.api.ChainHead(ctx) if err != nil { diff --git a/node/config/doc_gen.go b/node/config/doc_gen.go index 6b0fbf3d3..78698a5b9 100644 --- a/node/config/doc_gen.go +++ b/node/config/doc_gen.go @@ -843,6 +843,35 @@ Type: Array of multiaddress peerinfo strings, must include peerid (/p2p/12D3K... Comment: ``, }, + { + Name: "JsonTracer", + Type: "string", + + Comment: `Path to file that will be used to output tracer content in JSON format. +If present tracer will save data to defined file. +Format: file path`, + }, + { + Name: "ElasticSearchTracer", + Type: "string", + + Comment: `Connection string for elasticsearch instance. +If present tracer will save data to elasticsearch. +Format: https://:@:/`, + }, + { + Name: "ElasticSearchIndex", + Type: "string", + + Comment: `Name of elasticsearch index that will be used to save tracer data. +This property is used only if ElasticSearchTracer propery is set.`, + }, + { + Name: "TracerSourceAuth", + Type: "string", + + Comment: `Auth token that will be passed with logs to elasticsearch - used for weighted peers score.`, + }, }, "RetrievalPricing": []DocField{ { diff --git a/node/config/types.go b/node/config/types.go index c38430a3f..934192097 100644 --- a/node/config/types.go +++ b/node/config/types.go @@ -563,6 +563,19 @@ type Pubsub struct { DirectPeers []string IPColocationWhitelist []string RemoteTracer string + // Path to file that will be used to output tracer content in JSON format. + // If present tracer will save data to defined file. + // Format: file path + JsonTracer string + // Connection string for elasticsearch instance. + // If present tracer will save data to elasticsearch. + // Format: https://:@:/ + ElasticSearchTracer string + // Name of elasticsearch index that will be used to save tracer data. + // This property is used only if ElasticSearchTracer propery is set. + ElasticSearchIndex string + // Auth token that will be passed with logs to elasticsearch - used for weighted peers score. + TracerSourceAuth string } type Chainstore struct { diff --git a/node/impl/full/dummy.go b/node/impl/full/dummy.go index a46690340..865e14c9a 100644 --- a/node/impl/full/dummy.go +++ b/node/impl/full/dummy.go @@ -5,73 +5,74 @@ import ( "errors" "github.com/filecoin-project/lotus/api" + "github.com/filecoin-project/lotus/chain/types/ethtypes" ) var ErrImplementMe = errors.New("Not implemented yet") type EthModuleDummy struct{} -func (e *EthModuleDummy) EthBlockNumber(ctx context.Context) (api.EthUint64, error) { +func (e *EthModuleDummy) EthBlockNumber(ctx context.Context) (ethtypes.EthUint64, error) { return 0, ErrImplementMe } -func (e *EthModuleDummy) EthAccounts(ctx context.Context) ([]api.EthAddress, error) { +func (e *EthModuleDummy) EthAccounts(ctx context.Context) ([]ethtypes.EthAddress, error) { return nil, ErrImplementMe } -func (e *EthModuleDummy) EthGetBlockTransactionCountByNumber(ctx context.Context, blkNum api.EthUint64) (api.EthUint64, error) { +func (e *EthModuleDummy) EthGetBlockTransactionCountByNumber(ctx context.Context, blkNum ethtypes.EthUint64) (ethtypes.EthUint64, error) { return 0, ErrImplementMe } -func (e *EthModuleDummy) EthGetBlockTransactionCountByHash(ctx context.Context, blkHash api.EthHash) (api.EthUint64, error) { +func (e *EthModuleDummy) EthGetBlockTransactionCountByHash(ctx context.Context, blkHash ethtypes.EthHash) (ethtypes.EthUint64, error) { return 0, ErrImplementMe } -func (e *EthModuleDummy) EthGetBlockByHash(ctx context.Context, blkHash api.EthHash, fullTxInfo bool) (api.EthBlock, error) { - return api.EthBlock{}, ErrImplementMe +func (e *EthModuleDummy) EthGetBlockByHash(ctx context.Context, blkHash ethtypes.EthHash, fullTxInfo bool) (ethtypes.EthBlock, error) { + return ethtypes.EthBlock{}, ErrImplementMe } -func (e *EthModuleDummy) EthGetBlockByNumber(ctx context.Context, blkNum string, fullTxInfo bool) (api.EthBlock, error) { - return api.EthBlock{}, ErrImplementMe +func (e *EthModuleDummy) EthGetBlockByNumber(ctx context.Context, blkNum string, fullTxInfo bool) (ethtypes.EthBlock, error) { + return ethtypes.EthBlock{}, ErrImplementMe } -func (e *EthModuleDummy) EthGetTransactionByHash(ctx context.Context, txHash *api.EthHash) (*api.EthTx, error) { +func (e *EthModuleDummy) EthGetTransactionByHash(ctx context.Context, txHash *ethtypes.EthHash) (*ethtypes.EthTx, error) { return nil, ErrImplementMe } -func (e *EthModuleDummy) EthGetTransactionCount(ctx context.Context, sender api.EthAddress, blkOpt string) (api.EthUint64, error) { +func (e *EthModuleDummy) EthGetTransactionCount(ctx context.Context, sender ethtypes.EthAddress, blkOpt string) (ethtypes.EthUint64, error) { return 0, ErrImplementMe } -func (e *EthModuleDummy) EthGetTransactionReceipt(ctx context.Context, txHash api.EthHash) (*api.EthTxReceipt, error) { +func (e *EthModuleDummy) EthGetTransactionReceipt(ctx context.Context, txHash ethtypes.EthHash) (*api.EthTxReceipt, error) { return nil, ErrImplementMe } -func (e *EthModuleDummy) EthGetTransactionByBlockHashAndIndex(ctx context.Context, blkHash api.EthHash, txIndex api.EthUint64) (api.EthTx, error) { - return api.EthTx{}, ErrImplementMe +func (e *EthModuleDummy) EthGetTransactionByBlockHashAndIndex(ctx context.Context, blkHash ethtypes.EthHash, txIndex ethtypes.EthUint64) (ethtypes.EthTx, error) { + return ethtypes.EthTx{}, ErrImplementMe } -func (e *EthModuleDummy) EthGetTransactionByBlockNumberAndIndex(ctx context.Context, blkNum api.EthUint64, txIndex api.EthUint64) (api.EthTx, error) { - return api.EthTx{}, ErrImplementMe +func (e *EthModuleDummy) EthGetTransactionByBlockNumberAndIndex(ctx context.Context, blkNum ethtypes.EthUint64, txIndex ethtypes.EthUint64) (ethtypes.EthTx, error) { + return ethtypes.EthTx{}, ErrImplementMe } -func (e *EthModuleDummy) EthGetCode(ctx context.Context, address api.EthAddress, blkOpt string) (api.EthBytes, error) { +func (e *EthModuleDummy) EthGetCode(ctx context.Context, address ethtypes.EthAddress, blkOpt string) (ethtypes.EthBytes, error) { return nil, ErrImplementMe } -func (e *EthModuleDummy) EthGetStorageAt(ctx context.Context, address api.EthAddress, position api.EthBytes, blkParam string) (api.EthBytes, error) { +func (e *EthModuleDummy) EthGetStorageAt(ctx context.Context, address ethtypes.EthAddress, position ethtypes.EthBytes, blkParam string) (ethtypes.EthBytes, error) { return nil, ErrImplementMe } -func (e *EthModuleDummy) EthGetBalance(ctx context.Context, address api.EthAddress, blkParam string) (api.EthBigInt, error) { - return api.EthBigIntZero, ErrImplementMe +func (e *EthModuleDummy) EthGetBalance(ctx context.Context, address ethtypes.EthAddress, blkParam string) (ethtypes.EthBigInt, error) { + return ethtypes.EthBigIntZero, ErrImplementMe } -func (e *EthModuleDummy) EthFeeHistory(ctx context.Context, blkCount api.EthUint64, newestBlk string, rewardPercentiles []float64) (api.EthFeeHistory, error) { - return api.EthFeeHistory{}, ErrImplementMe +func (e *EthModuleDummy) EthFeeHistory(ctx context.Context, blkCount ethtypes.EthUint64, newestBlk string, rewardPercentiles []float64) (ethtypes.EthFeeHistory, error) { + return ethtypes.EthFeeHistory{}, ErrImplementMe } -func (e *EthModuleDummy) EthChainId(ctx context.Context) (api.EthUint64, error) { +func (e *EthModuleDummy) EthChainId(ctx context.Context) (ethtypes.EthUint64, error) { return 0, ErrImplementMe } @@ -83,26 +84,26 @@ func (e *EthModuleDummy) NetListening(ctx context.Context) (bool, error) { return false, ErrImplementMe } -func (e *EthModuleDummy) EthProtocolVersion(ctx context.Context) (api.EthUint64, error) { +func (e *EthModuleDummy) EthProtocolVersion(ctx context.Context) (ethtypes.EthUint64, error) { return 0, ErrImplementMe } -func (e *EthModuleDummy) EthGasPrice(ctx context.Context) (api.EthBigInt, error) { - return api.EthBigIntZero, ErrImplementMe +func (e *EthModuleDummy) EthGasPrice(ctx context.Context) (ethtypes.EthBigInt, error) { + return ethtypes.EthBigIntZero, ErrImplementMe } -func (e *EthModuleDummy) EthEstimateGas(ctx context.Context, tx api.EthCall) (api.EthUint64, error) { +func (e *EthModuleDummy) EthEstimateGas(ctx context.Context, tx ethtypes.EthCall) (ethtypes.EthUint64, error) { return 0, ErrImplementMe } -func (e *EthModuleDummy) EthCall(ctx context.Context, tx api.EthCall, blkParam string) (api.EthBytes, error) { +func (e *EthModuleDummy) EthCall(ctx context.Context, tx ethtypes.EthCall, blkParam string) (ethtypes.EthBytes, error) { return nil, ErrImplementMe } -func (e *EthModuleDummy) EthMaxPriorityFeePerGas(ctx context.Context) (api.EthBigInt, error) { - return api.EthBigIntZero, ErrImplementMe +func (e *EthModuleDummy) EthMaxPriorityFeePerGas(ctx context.Context) (ethtypes.EthBigInt, error) { + return ethtypes.EthBigIntZero, ErrImplementMe } -func (e *EthModuleDummy) EthSendRawTransaction(ctx context.Context, rawTx api.EthBytes) (api.EthHash, error) { - return api.EthHash{}, ErrImplementMe +func (e *EthModuleDummy) EthSendRawTransaction(ctx context.Context, rawTx ethtypes.EthBytes) (ethtypes.EthHash, error) { + return ethtypes.EthHash{}, ErrImplementMe } diff --git a/node/impl/full/eth.go b/node/impl/full/eth.go index a49aa3d2d..d6ec05875 100644 --- a/node/impl/full/eth.go +++ b/node/impl/full/eth.go @@ -31,46 +31,47 @@ import ( "github.com/filecoin-project/lotus/chain/stmgr" "github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/lotus/chain/types/ethtypes" "github.com/filecoin-project/lotus/node/modules/dtypes" ) type EthModuleAPI interface { - EthBlockNumber(ctx context.Context) (api.EthUint64, error) - EthAccounts(ctx context.Context) ([]api.EthAddress, error) - EthGetBlockTransactionCountByNumber(ctx context.Context, blkNum api.EthUint64) (api.EthUint64, error) - EthGetBlockTransactionCountByHash(ctx context.Context, blkHash api.EthHash) (api.EthUint64, error) - EthGetBlockByHash(ctx context.Context, blkHash api.EthHash, fullTxInfo bool) (api.EthBlock, error) - EthGetBlockByNumber(ctx context.Context, blkNum string, fullTxInfo bool) (api.EthBlock, error) - EthGetTransactionByHash(ctx context.Context, txHash *api.EthHash) (*api.EthTx, error) - EthGetTransactionCount(ctx context.Context, sender api.EthAddress, blkOpt string) (api.EthUint64, error) - EthGetTransactionReceipt(ctx context.Context, txHash api.EthHash) (*api.EthTxReceipt, error) - EthGetTransactionByBlockHashAndIndex(ctx context.Context, blkHash api.EthHash, txIndex api.EthUint64) (api.EthTx, error) - EthGetTransactionByBlockNumberAndIndex(ctx context.Context, blkNum api.EthUint64, txIndex api.EthUint64) (api.EthTx, error) - EthGetCode(ctx context.Context, address api.EthAddress, blkOpt string) (api.EthBytes, error) - EthGetStorageAt(ctx context.Context, address api.EthAddress, position api.EthBytes, blkParam string) (api.EthBytes, error) - EthGetBalance(ctx context.Context, address api.EthAddress, blkParam string) (api.EthBigInt, error) - EthFeeHistory(ctx context.Context, blkCount api.EthUint64, newestBlk string, rewardPercentiles []float64) (api.EthFeeHistory, error) - EthChainId(ctx context.Context) (api.EthUint64, error) + EthBlockNumber(ctx context.Context) (ethtypes.EthUint64, error) + EthAccounts(ctx context.Context) ([]ethtypes.EthAddress, error) + EthGetBlockTransactionCountByNumber(ctx context.Context, blkNum ethtypes.EthUint64) (ethtypes.EthUint64, error) + EthGetBlockTransactionCountByHash(ctx context.Context, blkHash ethtypes.EthHash) (ethtypes.EthUint64, error) + EthGetBlockByHash(ctx context.Context, blkHash ethtypes.EthHash, fullTxInfo bool) (ethtypes.EthBlock, error) + EthGetBlockByNumber(ctx context.Context, blkNum string, fullTxInfo bool) (ethtypes.EthBlock, error) + EthGetTransactionByHash(ctx context.Context, txHash *ethtypes.EthHash) (*ethtypes.EthTx, error) + EthGetTransactionCount(ctx context.Context, sender ethtypes.EthAddress, blkOpt string) (ethtypes.EthUint64, error) + EthGetTransactionReceipt(ctx context.Context, txHash ethtypes.EthHash) (*api.EthTxReceipt, error) + EthGetTransactionByBlockHashAndIndex(ctx context.Context, blkHash ethtypes.EthHash, txIndex ethtypes.EthUint64) (ethtypes.EthTx, error) + EthGetTransactionByBlockNumberAndIndex(ctx context.Context, blkNum ethtypes.EthUint64, txIndex ethtypes.EthUint64) (ethtypes.EthTx, error) + EthGetCode(ctx context.Context, address ethtypes.EthAddress, blkOpt string) (ethtypes.EthBytes, error) + EthGetStorageAt(ctx context.Context, address ethtypes.EthAddress, position ethtypes.EthBytes, blkParam string) (ethtypes.EthBytes, error) + EthGetBalance(ctx context.Context, address ethtypes.EthAddress, blkParam string) (ethtypes.EthBigInt, error) + EthFeeHistory(ctx context.Context, blkCount ethtypes.EthUint64, newestBlk string, rewardPercentiles []float64) (ethtypes.EthFeeHistory, error) + EthChainId(ctx context.Context) (ethtypes.EthUint64, error) NetVersion(ctx context.Context) (string, error) NetListening(ctx context.Context) (bool, error) - EthProtocolVersion(ctx context.Context) (api.EthUint64, error) - EthGasPrice(ctx context.Context) (api.EthBigInt, error) - EthEstimateGas(ctx context.Context, tx api.EthCall) (api.EthUint64, error) - EthCall(ctx context.Context, tx api.EthCall, blkParam string) (api.EthBytes, error) - EthMaxPriorityFeePerGas(ctx context.Context) (api.EthBigInt, error) - EthSendRawTransaction(ctx context.Context, rawTx api.EthBytes) (api.EthHash, error) + EthProtocolVersion(ctx context.Context) (ethtypes.EthUint64, error) + EthGasPrice(ctx context.Context) (ethtypes.EthBigInt, error) + EthEstimateGas(ctx context.Context, tx ethtypes.EthCall) (ethtypes.EthUint64, error) + EthCall(ctx context.Context, tx ethtypes.EthCall, blkParam string) (ethtypes.EthBytes, error) + EthMaxPriorityFeePerGas(ctx context.Context) (ethtypes.EthBigInt, error) + EthSendRawTransaction(ctx context.Context, rawTx ethtypes.EthBytes) (ethtypes.EthHash, error) } type EthEventAPI interface { - EthGetLogs(ctx context.Context, filter *api.EthFilterSpec) (*api.EthFilterResult, error) - EthGetFilterChanges(ctx context.Context, id api.EthFilterID) (*api.EthFilterResult, error) - EthGetFilterLogs(ctx context.Context, id api.EthFilterID) (*api.EthFilterResult, error) - EthNewFilter(ctx context.Context, filter *api.EthFilterSpec) (api.EthFilterID, error) - EthNewBlockFilter(ctx context.Context) (api.EthFilterID, error) - EthNewPendingTransactionFilter(ctx context.Context) (api.EthFilterID, error) - EthUninstallFilter(ctx context.Context, id api.EthFilterID) (bool, error) - EthSubscribe(ctx context.Context, eventType string, params *api.EthSubscriptionParams) (<-chan api.EthSubscriptionResponse, error) - EthUnsubscribe(ctx context.Context, id api.EthSubscriptionID) (bool, error) + EthGetLogs(ctx context.Context, filter *ethtypes.EthFilterSpec) (*ethtypes.EthFilterResult, error) + EthGetFilterChanges(ctx context.Context, id ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error) + EthGetFilterLogs(ctx context.Context, id ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error) + EthNewFilter(ctx context.Context, filter *ethtypes.EthFilterSpec) (ethtypes.EthFilterID, error) + EthNewBlockFilter(ctx context.Context) (ethtypes.EthFilterID, error) + EthNewPendingTransactionFilter(ctx context.Context) (ethtypes.EthFilterID, error) + EthUninstallFilter(ctx context.Context, id ethtypes.EthFilterID) (bool, error) + EthSubscribe(ctx context.Context, eventType string, params *ethtypes.EthSubscriptionParams) (<-chan ethtypes.EthSubscriptionResponse, error) + EthUnsubscribe(ctx context.Context, id ethtypes.EthSubscriptionID) (bool, error) } var ( @@ -120,14 +121,14 @@ func (a *EthModule) StateNetworkName(ctx context.Context) (dtypes.NetworkName, e return stmgr.GetNetworkName(ctx, a.StateManager, a.Chain.GetHeaviestTipSet().ParentState()) } -func (a *EthModule) EthBlockNumber(context.Context) (api.EthUint64, error) { +func (a *EthModule) EthBlockNumber(context.Context) (ethtypes.EthUint64, error) { height := a.Chain.GetHeaviestTipSet().Height() - return api.EthUint64(height), nil + return ethtypes.EthUint64(height), nil } -func (a *EthModule) EthAccounts(context.Context) ([]api.EthAddress, error) { +func (a *EthModule) EthAccounts(context.Context) ([]ethtypes.EthAddress, error) { // The lotus node is not expected to hold manage accounts, so we'll always return an empty array - return []api.EthAddress{}, nil + return []ethtypes.EthAddress{}, nil } func (a *EthModule) countTipsetMsgs(ctx context.Context, ts *types.TipSet) (int, error) { @@ -144,54 +145,54 @@ func (a *EthModule) countTipsetMsgs(ctx context.Context, ts *types.TipSet) (int, return count, nil } -func (a *EthModule) EthGetBlockTransactionCountByNumber(ctx context.Context, blkNum api.EthUint64) (api.EthUint64, error) { +func (a *EthModule) EthGetBlockTransactionCountByNumber(ctx context.Context, blkNum ethtypes.EthUint64) (ethtypes.EthUint64, error) { ts, err := a.Chain.GetTipsetByHeight(ctx, abi.ChainEpoch(blkNum), nil, false) if err != nil { - return api.EthUint64(0), xerrors.Errorf("error loading tipset %s: %w", ts, err) + return ethtypes.EthUint64(0), xerrors.Errorf("error loading tipset %s: %w", ts, err) } count, err := a.countTipsetMsgs(ctx, ts) - return api.EthUint64(count), err + return ethtypes.EthUint64(count), err } -func (a *EthModule) EthGetBlockTransactionCountByHash(ctx context.Context, blkHash api.EthHash) (api.EthUint64, error) { +func (a *EthModule) EthGetBlockTransactionCountByHash(ctx context.Context, blkHash ethtypes.EthHash) (ethtypes.EthUint64, error) { ts, err := a.Chain.GetTipSetByCid(ctx, blkHash.ToCid()) if err != nil { - return api.EthUint64(0), xerrors.Errorf("error loading tipset %s: %w", ts, err) + return ethtypes.EthUint64(0), xerrors.Errorf("error loading tipset %s: %w", ts, err) } count, err := a.countTipsetMsgs(ctx, ts) - return api.EthUint64(count), err + return ethtypes.EthUint64(count), err } -func (a *EthModule) EthGetBlockByHash(ctx context.Context, blkHash api.EthHash, fullTxInfo bool) (api.EthBlock, error) { +func (a *EthModule) EthGetBlockByHash(ctx context.Context, blkHash ethtypes.EthHash, fullTxInfo bool) (ethtypes.EthBlock, error) { ts, err := a.Chain.GetTipSetByCid(ctx, blkHash.ToCid()) if err != nil { - return api.EthBlock{}, xerrors.Errorf("error loading tipset %s: %w", ts, err) + return ethtypes.EthBlock{}, xerrors.Errorf("error loading tipset %s: %w", ts, err) } return newEthBlockFromFilecoinTipSet(ctx, ts, fullTxInfo, a.Chain, a.ChainAPI, a.StateAPI) } -func (a *EthModule) EthGetBlockByNumber(ctx context.Context, blkNum string, fullTxInfo bool) (api.EthBlock, error) { - typ, num, err := api.ParseBlkNumOption(blkNum) +func (a *EthModule) EthGetBlockByNumber(ctx context.Context, blkNum string, fullTxInfo bool) (ethtypes.EthBlock, error) { + typ, num, err := ethtypes.ParseBlkNumOption(blkNum) if err != nil { - return api.EthBlock{}, fmt.Errorf("cannot parse block number: %v", err) + return ethtypes.EthBlock{}, fmt.Errorf("cannot parse block number: %v", err) } switch typ { - case api.BlkNumLatest: - num = api.EthUint64(a.Chain.GetHeaviestTipSet().Height()) - 1 - case api.BlkNumPending: - num = api.EthUint64(a.Chain.GetHeaviestTipSet().Height()) + case ethtypes.BlkNumLatest: + num = ethtypes.EthUint64(a.Chain.GetHeaviestTipSet().Height()) - 1 + case ethtypes.BlkNumPending: + num = ethtypes.EthUint64(a.Chain.GetHeaviestTipSet().Height()) } ts, err := a.Chain.GetTipsetByHeight(ctx, abi.ChainEpoch(num), nil, false) if err != nil { - return api.EthBlock{}, xerrors.Errorf("error loading tipset %s: %w", ts, err) + return ethtypes.EthBlock{}, xerrors.Errorf("error loading tipset %s: %w", ts, err) } return newEthBlockFromFilecoinTipSet(ctx, ts, fullTxInfo, a.Chain, a.ChainAPI, a.StateAPI) } -func (a *EthModule) EthGetTransactionByHash(ctx context.Context, txHash *api.EthHash) (*api.EthTx, error) { +func (a *EthModule) EthGetTransactionByHash(ctx context.Context, txHash *ethtypes.EthHash) (*ethtypes.EthTx, error) { // Ethereum's behavior is to return null when the txHash is invalid, so we use nil to check if txHash is valid if txHash == nil { return nil, nil @@ -211,19 +212,19 @@ func (a *EthModule) EthGetTransactionByHash(ctx context.Context, txHash *api.Eth return &tx, nil } -func (a *EthModule) EthGetTransactionCount(ctx context.Context, sender api.EthAddress, blkParam string) (api.EthUint64, error) { +func (a *EthModule) EthGetTransactionCount(ctx context.Context, sender ethtypes.EthAddress, blkParam string) (ethtypes.EthUint64, error) { addr, err := sender.ToFilecoinAddress() if err != nil { - return api.EthUint64(0), nil + return ethtypes.EthUint64(0), nil } nonce, err := a.Mpool.GetNonce(ctx, addr, types.EmptyTSK) if err != nil { - return api.EthUint64(0), nil + return ethtypes.EthUint64(0), nil } - return api.EthUint64(nonce), nil + return ethtypes.EthUint64(nonce), nil } -func (a *EthModule) EthGetTransactionReceipt(ctx context.Context, txHash api.EthHash) (*api.EthTxReceipt, error) { +func (a *EthModule) EthGetTransactionReceipt(ctx context.Context, txHash ethtypes.EthHash) (*api.EthTxReceipt, error) { cid := txHash.ToCid() msgLookup, err := a.StateAPI.StateSearchMsg(ctx, types.EmptyTSK, cid, api.LookbackNoLimit, true) @@ -257,16 +258,16 @@ func (a *EthModule) EthGetTransactionReceipt(ctx context.Context, txHash api.Eth return &receipt, nil } -func (a *EthModule) EthGetTransactionByBlockHashAndIndex(ctx context.Context, blkHash api.EthHash, txIndex api.EthUint64) (api.EthTx, error) { - return api.EthTx{}, nil +func (a *EthModule) EthGetTransactionByBlockHashAndIndex(ctx context.Context, blkHash ethtypes.EthHash, txIndex ethtypes.EthUint64) (ethtypes.EthTx, error) { + return ethtypes.EthTx{}, nil } -func (a *EthModule) EthGetTransactionByBlockNumberAndIndex(ctx context.Context, blkNum api.EthUint64, txIndex api.EthUint64) (api.EthTx, error) { - return api.EthTx{}, nil +func (a *EthModule) EthGetTransactionByBlockNumberAndIndex(ctx context.Context, blkNum ethtypes.EthUint64, txIndex ethtypes.EthUint64) (ethtypes.EthTx, error) { + return ethtypes.EthTx{}, nil } // EthGetCode returns string value of the compiled bytecode -func (a *EthModule) EthGetCode(ctx context.Context, ethAddr api.EthAddress, blkOpt string) (api.EthBytes, error) { +func (a *EthModule) EthGetCode(ctx context.Context, ethAddr ethtypes.EthAddress, blkOpt string) (ethtypes.EthBytes, error) { to, err := ethAddr.ToFilecoinAddress() if err != nil { return nil, xerrors.Errorf("cannot get Filecoin address: %w", err) @@ -330,7 +331,7 @@ func (a *EthModule) EthGetCode(ctx context.Context, ethAddr api.EthAddress, blkO return blk.RawData(), nil } -func (a *EthModule) EthGetStorageAt(ctx context.Context, ethAddr api.EthAddress, position api.EthBytes, blkParam string) (api.EthBytes, error) { +func (a *EthModule) EthGetStorageAt(ctx context.Context, ethAddr ethtypes.EthAddress, position ethtypes.EthBytes, blkParam string) (ethtypes.EthBytes, error) { l := len(position) if l > 32 { return nil, fmt.Errorf("supplied storage key is too long") @@ -404,35 +405,35 @@ func (a *EthModule) EthGetStorageAt(ctx context.Context, ethAddr api.EthAddress, return res.MsgRct.Return, nil } -func (a *EthModule) EthGetBalance(ctx context.Context, address api.EthAddress, blkParam string) (api.EthBigInt, error) { +func (a *EthModule) EthGetBalance(ctx context.Context, address ethtypes.EthAddress, blkParam string) (ethtypes.EthBigInt, error) { filAddr, err := address.ToFilecoinAddress() if err != nil { - return api.EthBigInt{}, err + return ethtypes.EthBigInt{}, err } actor, err := a.StateGetActor(ctx, filAddr, types.EmptyTSK) if xerrors.Is(err, types.ErrActorNotFound) { - return api.EthBigIntZero, nil + return ethtypes.EthBigIntZero, nil } else if err != nil { - return api.EthBigInt{}, err + return ethtypes.EthBigInt{}, err } - return api.EthBigInt{Int: actor.Balance.Int}, nil + return ethtypes.EthBigInt{Int: actor.Balance.Int}, nil } -func (a *EthModule) EthChainId(ctx context.Context) (api.EthUint64, error) { - return api.EthUint64(build.Eip155ChainId), nil +func (a *EthModule) EthChainId(ctx context.Context) (ethtypes.EthUint64, error) { + return ethtypes.EthUint64(build.Eip155ChainId), nil } -func (a *EthModule) EthFeeHistory(ctx context.Context, blkCount api.EthUint64, newestBlkNum string, rewardPercentiles []float64) (api.EthFeeHistory, error) { +func (a *EthModule) EthFeeHistory(ctx context.Context, blkCount ethtypes.EthUint64, newestBlkNum string, rewardPercentiles []float64) (ethtypes.EthFeeHistory, error) { if blkCount > 1024 { - return api.EthFeeHistory{}, fmt.Errorf("block count should be smaller than 1024") + return ethtypes.EthFeeHistory{}, fmt.Errorf("block count should be smaller than 1024") } newestBlkHeight := uint64(a.Chain.GetHeaviestTipSet().Height()) // TODO https://github.com/filecoin-project/ref-fvm/issues/1016 - var blkNum api.EthUint64 + var blkNum ethtypes.EthUint64 err := blkNum.UnmarshalJSON([]byte(`"` + newestBlkNum + `"`)) if err == nil && uint64(blkNum) < newestBlkHeight { newestBlkHeight = uint64(blkNum) @@ -447,13 +448,13 @@ func (a *EthModule) EthFeeHistory(ctx context.Context, blkCount api.EthUint64, n ts, err := a.Chain.GetTipsetByHeight(ctx, abi.ChainEpoch(newestBlkHeight), nil, false) if err != nil { - return api.EthFeeHistory{}, fmt.Errorf("cannot load find block height: %v", newestBlkHeight) + return ethtypes.EthFeeHistory{}, fmt.Errorf("cannot load find block height: %v", newestBlkHeight) } // FIXME: baseFeePerGas should include the next block after the newest of the returned range, because this // can be inferred from the newest block. we use the newest block's baseFeePerGas for now but need to fix it // In other words, due to deferred execution, we might not be returning the most useful value here for the client. - baseFeeArray := []api.EthBigInt{api.EthBigInt(ts.Blocks()[0].ParentBaseFee)} + baseFeeArray := []ethtypes.EthBigInt{ethtypes.EthBigInt(ts.Blocks()[0].ParentBaseFee)} gasUsedRatioArray := []float64{} for ts.Height() >= abi.ChainEpoch(oldestBlkHeight) { @@ -461,17 +462,17 @@ func (a *EthModule) EthFeeHistory(ctx context.Context, blkCount api.EthUint64, n // totalize gas used in the tipset. block, err := newEthBlockFromFilecoinTipSet(ctx, ts, false, a.Chain, a.ChainAPI, a.StateAPI) if err != nil { - return api.EthFeeHistory{}, fmt.Errorf("cannot create eth block: %v", err) + return ethtypes.EthFeeHistory{}, fmt.Errorf("cannot create eth block: %v", err) } // both arrays should be reversed at the end - baseFeeArray = append(baseFeeArray, api.EthBigInt(ts.Blocks()[0].ParentBaseFee)) + baseFeeArray = append(baseFeeArray, ethtypes.EthBigInt(ts.Blocks()[0].ParentBaseFee)) gasUsedRatioArray = append(gasUsedRatioArray, float64(block.GasUsed)/float64(build.BlockGasLimit)) parentTsKey := ts.Parents() ts, err = a.Chain.LoadTipSet(ctx, parentTsKey) if err != nil { - return api.EthFeeHistory{}, fmt.Errorf("cannot load tipset key: %v", parentTsKey) + return ethtypes.EthFeeHistory{}, fmt.Errorf("cannot load tipset key: %v", parentTsKey) } } @@ -484,7 +485,7 @@ func (a *EthModule) EthFeeHistory(ctx context.Context, blkCount api.EthUint64, n gasUsedRatioArray[i], gasUsedRatioArray[j] = gasUsedRatioArray[j], gasUsedRatioArray[i] } - return api.EthFeeHistory{ + return ethtypes.EthFeeHistory{ OldestBlock: oldestBlkHeight, BaseFeePerGas: baseFeeArray, GasUsedRatio: gasUsedRatioArray, @@ -504,20 +505,20 @@ func (a *EthModule) NetListening(ctx context.Context) (bool, error) { return true, nil } -func (a *EthModule) EthProtocolVersion(ctx context.Context) (api.EthUint64, error) { +func (a *EthModule) EthProtocolVersion(ctx context.Context) (ethtypes.EthUint64, error) { height := a.Chain.GetHeaviestTipSet().Height() - return api.EthUint64(a.StateManager.GetNetworkVersion(ctx, height)), nil + return ethtypes.EthUint64(a.StateManager.GetNetworkVersion(ctx, height)), nil } -func (a *EthModule) EthMaxPriorityFeePerGas(ctx context.Context) (api.EthBigInt, error) { +func (a *EthModule) EthMaxPriorityFeePerGas(ctx context.Context) (ethtypes.EthBigInt, error) { gasPremium, err := a.GasAPI.GasEstimateGasPremium(ctx, 0, builtinactors.SystemActorAddr, 10000, types.EmptyTSK) if err != nil { - return api.EthBigInt(big.Zero()), err + return ethtypes.EthBigInt(big.Zero()), err } - return api.EthBigInt(gasPremium), nil + return ethtypes.EthBigInt(gasPremium), nil } -func (a *EthModule) EthGasPrice(ctx context.Context) (api.EthBigInt, error) { +func (a *EthModule) EthGasPrice(ctx context.Context) (ethtypes.EthBigInt, error) { // According to Geth's implementation, eth_gasPrice should return base + tip // Ref: https://github.com/ethereum/pm/issues/328#issuecomment-853234014 @@ -526,22 +527,22 @@ func (a *EthModule) EthGasPrice(ctx context.Context) (api.EthBigInt, error) { premium, err := a.EthMaxPriorityFeePerGas(ctx) if err != nil { - return api.EthBigInt(big.Zero()), nil + return ethtypes.EthBigInt(big.Zero()), nil } gasPrice := big.Add(baseFee, big.Int(premium)) - return api.EthBigInt(gasPrice), nil + return ethtypes.EthBigInt(gasPrice), nil } -func (a *EthModule) EthSendRawTransaction(ctx context.Context, rawTx api.EthBytes) (api.EthHash, error) { - txArgs, err := api.ParseEthTxArgs(rawTx) +func (a *EthModule) EthSendRawTransaction(ctx context.Context, rawTx ethtypes.EthBytes) (ethtypes.EthHash, error) { + txArgs, err := ethtypes.ParseEthTxArgs(rawTx) if err != nil { - return api.EmptyEthHash, err + return ethtypes.EmptyEthHash, err } smsg, err := txArgs.ToSignedMessage() if err != nil { - return api.EmptyEthHash, err + return ethtypes.EmptyEthHash, err } _, err = a.StateAPI.StateGetActor(ctx, smsg.Message.To, types.EmptyTSK) @@ -553,17 +554,17 @@ func (a *EthModule) EthSendRawTransaction(ctx context.Context, rawTx api.EthByte cid, err := a.MpoolAPI.MpoolPush(ctx, smsg) if err != nil { - return api.EmptyEthHash, err + return ethtypes.EmptyEthHash, err } - return api.NewEthHashFromCid(cid) + return ethtypes.NewEthHashFromCid(cid) } -func (a *EthModule) ethCallToFilecoinMessage(ctx context.Context, tx api.EthCall) (*types.Message, error) { +func (a *EthModule) ethCallToFilecoinMessage(ctx context.Context, tx ethtypes.EthCall) (*types.Message, error) { var err error var from address.Address if tx.From == nil { // Send from the filecoin "system" address. - from, err = (api.EthAddress{}).ToFilecoinAddress() + from, err = (ethtypes.EthAddress{}).ToFilecoinAddress() if err != nil { return nil, fmt.Errorf("failed to construct the ethereum system address: %w", err) } @@ -653,10 +654,10 @@ func (a *EthModule) applyMessage(ctx context.Context, msg *types.Message) (res * return res, nil } -func (a *EthModule) EthEstimateGas(ctx context.Context, tx api.EthCall) (api.EthUint64, error) { +func (a *EthModule) EthEstimateGas(ctx context.Context, tx ethtypes.EthCall) (ethtypes.EthUint64, error) { msg, err := a.ethCallToFilecoinMessage(ctx, tx) if err != nil { - return api.EthUint64(0), err + return ethtypes.EthUint64(0), err } // Set the gas limit to the zero sentinel value, which makes @@ -665,13 +666,13 @@ func (a *EthModule) EthEstimateGas(ctx context.Context, tx api.EthCall) (api.Eth msg, err = a.GasAPI.GasEstimateMessageGas(ctx, msg, nil, types.EmptyTSK) if err != nil { - return api.EthUint64(0), err + return ethtypes.EthUint64(0), err } - return api.EthUint64(msg.GasLimit), nil + return ethtypes.EthUint64(msg.GasLimit), nil } -func (a *EthModule) EthCall(ctx context.Context, tx api.EthCall, blkParam string) (api.EthBytes, error) { +func (a *EthModule) EthCall(ctx context.Context, tx ethtypes.EthCall, blkParam string) (ethtypes.EthBytes, error) { msg, err := a.ethCallToFilecoinMessage(ctx, tx) if err != nil { return nil, err @@ -684,10 +685,10 @@ func (a *EthModule) EthCall(ctx context.Context, tx api.EthCall, blkParam string if len(invokeResult.MsgRct.Return) > 0 { return cbg.ReadByteArray(bytes.NewReader(invokeResult.MsgRct.Return), uint64(len(invokeResult.MsgRct.Return))) } - return api.EthBytes{}, nil + return ethtypes.EthBytes{}, nil } -func (e *EthEvent) EthGetLogs(ctx context.Context, filterSpec *api.EthFilterSpec) (*api.EthFilterResult, error) { +func (e *EthEvent) EthGetLogs(ctx context.Context, filterSpec *ethtypes.EthFilterSpec) (*ethtypes.EthFilterResult, error) { if e.EventFilterManager == nil { return nil, api.ErrNotSupported } @@ -704,7 +705,7 @@ func (e *EthEvent) EthGetLogs(ctx context.Context, filterSpec *api.EthFilterSpec return ethFilterResultFromEvents(ces) } -func (e *EthEvent) EthGetFilterChanges(ctx context.Context, id api.EthFilterID) (*api.EthFilterResult, error) { +func (e *EthEvent) EthGetFilterChanges(ctx context.Context, id ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error) { if e.FilterStore == nil { return nil, api.ErrNotSupported } @@ -726,7 +727,7 @@ func (e *EthEvent) EthGetFilterChanges(ctx context.Context, id api.EthFilterID) return nil, xerrors.Errorf("unknown filter type") } -func (e *EthEvent) EthGetFilterLogs(ctx context.Context, id api.EthFilterID) (*api.EthFilterResult, error) { +func (e *EthEvent) EthGetFilterLogs(ctx context.Context, id ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error) { if e.FilterStore == nil { return nil, api.ErrNotSupported } @@ -744,7 +745,7 @@ func (e *EthEvent) EthGetFilterLogs(ctx context.Context, id api.EthFilterID) (*a return nil, xerrors.Errorf("wrong filter type") } -func (e *EthEvent) installEthFilterSpec(ctx context.Context, filterSpec *api.EthFilterSpec) (*filter.EventFilter, error) { +func (e *EthEvent) installEthFilterSpec(ctx context.Context, filterSpec *ethtypes.EthFilterSpec) (*filter.EventFilter, error) { var ( minHeight abi.ChainEpoch maxHeight abi.ChainEpoch @@ -768,7 +769,7 @@ func (e *EthEvent) installEthFilterSpec(ctx context.Context, filterSpec *api.Eth } else if *filterSpec.FromBlock == "pending" { return nil, api.ErrNotSupported } else { - epoch, err := api.EthUint64FromHex(*filterSpec.FromBlock) + epoch, err := ethtypes.EthUint64FromHex(*filterSpec.FromBlock) if err != nil { return nil, xerrors.Errorf("invalid epoch") } @@ -783,7 +784,7 @@ func (e *EthEvent) installEthFilterSpec(ctx context.Context, filterSpec *api.Eth } else if *filterSpec.ToBlock == "pending" { return nil, api.ErrNotSupported } else { - epoch, err := api.EthUint64FromHex(*filterSpec.ToBlock) + epoch, err := ethtypes.EthUint64FromHex(*filterSpec.ToBlock) if err != nil { return nil, xerrors.Errorf("invalid epoch") } @@ -834,76 +835,76 @@ func (e *EthEvent) installEthFilterSpec(ctx context.Context, filterSpec *api.Eth return e.EventFilterManager.Install(ctx, minHeight, maxHeight, tipsetCid, addresses, keys) } -func (e *EthEvent) EthNewFilter(ctx context.Context, filterSpec *api.EthFilterSpec) (api.EthFilterID, error) { +func (e *EthEvent) EthNewFilter(ctx context.Context, filterSpec *ethtypes.EthFilterSpec) (ethtypes.EthFilterID, error) { if e.FilterStore == nil || e.EventFilterManager == nil { - return api.EthFilterID{}, api.ErrNotSupported + return ethtypes.EthFilterID{}, api.ErrNotSupported } f, err := e.installEthFilterSpec(ctx, filterSpec) if err != nil { - return api.EthFilterID{}, err + return ethtypes.EthFilterID{}, err } if err := e.FilterStore.Add(ctx, f); err != nil { // Could not record in store, attempt to delete filter to clean up err2 := e.TipSetFilterManager.Remove(ctx, f.ID()) if err2 != nil { - return api.EthFilterID{}, xerrors.Errorf("encountered error %v while removing new filter due to %v", err2, err) + return ethtypes.EthFilterID{}, xerrors.Errorf("encountered error %v while removing new filter due to %v", err2, err) } - return api.EthFilterID{}, err + return ethtypes.EthFilterID{}, err } - return api.EthFilterID(f.ID()), nil + return ethtypes.EthFilterID(f.ID()), nil } -func (e *EthEvent) EthNewBlockFilter(ctx context.Context) (api.EthFilterID, error) { +func (e *EthEvent) EthNewBlockFilter(ctx context.Context) (ethtypes.EthFilterID, error) { if e.FilterStore == nil || e.TipSetFilterManager == nil { - return api.EthFilterID{}, api.ErrNotSupported + return ethtypes.EthFilterID{}, api.ErrNotSupported } f, err := e.TipSetFilterManager.Install(ctx) if err != nil { - return api.EthFilterID{}, err + return ethtypes.EthFilterID{}, err } if err := e.FilterStore.Add(ctx, f); err != nil { // Could not record in store, attempt to delete filter to clean up err2 := e.TipSetFilterManager.Remove(ctx, f.ID()) if err2 != nil { - return api.EthFilterID{}, xerrors.Errorf("encountered error %v while removing new filter due to %v", err2, err) + return ethtypes.EthFilterID{}, xerrors.Errorf("encountered error %v while removing new filter due to %v", err2, err) } - return api.EthFilterID{}, err + return ethtypes.EthFilterID{}, err } - return api.EthFilterID(f.ID()), nil + return ethtypes.EthFilterID(f.ID()), nil } -func (e *EthEvent) EthNewPendingTransactionFilter(ctx context.Context) (api.EthFilterID, error) { +func (e *EthEvent) EthNewPendingTransactionFilter(ctx context.Context) (ethtypes.EthFilterID, error) { if e.FilterStore == nil || e.MemPoolFilterManager == nil { - return api.EthFilterID{}, api.ErrNotSupported + return ethtypes.EthFilterID{}, api.ErrNotSupported } f, err := e.MemPoolFilterManager.Install(ctx) if err != nil { - return api.EthFilterID{}, err + return ethtypes.EthFilterID{}, err } if err := e.FilterStore.Add(ctx, f); err != nil { // Could not record in store, attempt to delete filter to clean up err2 := e.MemPoolFilterManager.Remove(ctx, f.ID()) if err2 != nil { - return api.EthFilterID{}, xerrors.Errorf("encountered error %v while removing new filter due to %v", err2, err) + return ethtypes.EthFilterID{}, xerrors.Errorf("encountered error %v while removing new filter due to %v", err2, err) } - return api.EthFilterID{}, err + return ethtypes.EthFilterID{}, err } - return api.EthFilterID(f.ID()), nil + return ethtypes.EthFilterID(f.ID()), nil } -func (e *EthEvent) EthUninstallFilter(ctx context.Context, id api.EthFilterID) (bool, error) { +func (e *EthEvent) EthUninstallFilter(ctx context.Context, id ethtypes.EthFilterID) (bool, error) { if e.FilterStore == nil { return false, api.ErrNotSupported } @@ -952,7 +953,7 @@ const ( EthSubscribeEventTypeLogs = "logs" ) -func (e *EthEvent) EthSubscribe(ctx context.Context, eventType string, params *api.EthSubscriptionParams) (<-chan api.EthSubscriptionResponse, error) { +func (e *EthEvent) EthSubscribe(ctx context.Context, eventType string, params *ethtypes.EthSubscriptionParams) (<-chan ethtypes.EthSubscriptionResponse, error) { if e.SubManager == nil { return nil, api.ErrNotSupported } @@ -1002,7 +1003,7 @@ func (e *EthEvent) EthSubscribe(ctx context.Context, eventType string, params *a return sub.out, nil } -func (e *EthEvent) EthUnsubscribe(ctx context.Context, id api.EthSubscriptionID) (bool, error) { +func (e *EthEvent) EthUnsubscribe(ctx context.Context, id ethtypes.EthSubscriptionID) (bool, error) { if e.SubManager == nil { return false, api.ErrNotSupported } @@ -1058,33 +1059,33 @@ type filterTipSetCollector interface { TakeCollectedTipSets(context.Context) []types.TipSetKey } -func ethFilterResultFromEvents(evs []*filter.CollectedEvent) (*api.EthFilterResult, error) { - res := &api.EthFilterResult{} +func ethFilterResultFromEvents(evs []*filter.CollectedEvent) (*ethtypes.EthFilterResult, error) { + res := ðtypes.EthFilterResult{} for _, ev := range evs { - log := api.EthLog{ + log := ethtypes.EthLog{ Removed: ev.Reverted, - LogIndex: api.EthUint64(ev.EventIdx), - TransactionIndex: api.EthUint64(ev.MsgIdx), - BlockNumber: api.EthUint64(ev.Height), + LogIndex: ethtypes.EthUint64(ev.EventIdx), + TransactionIndex: ethtypes.EthUint64(ev.MsgIdx), + BlockNumber: ethtypes.EthUint64(ev.Height), } var err error for _, entry := range ev.Entries { - value := api.EthBytes(leftpad32(decodeLogBytes(entry.Value))) - if entry.Key == api.EthTopic1 || entry.Key == api.EthTopic2 || entry.Key == api.EthTopic3 || entry.Key == api.EthTopic4 { + value := ethtypes.EthBytes(leftpad32(decodeLogBytes(entry.Value))) + if entry.Key == ethtypes.EthTopic1 || entry.Key == ethtypes.EthTopic2 || entry.Key == ethtypes.EthTopic3 || entry.Key == ethtypes.EthTopic4 { log.Topics = append(log.Topics, value) } else { log.Data = value } } - log.Address, err = api.EthAddressFromFilecoinAddress(ev.EmitterAddr) + log.Address, err = ethtypes.EthAddressFromFilecoinAddress(ev.EmitterAddr) if err != nil { return nil, err } - log.TransactionHash, err = api.NewEthHashFromCid(ev.MsgCid) + log.TransactionHash, err = ethtypes.NewEthHashFromCid(ev.MsgCid) if err != nil { return nil, err } @@ -1093,7 +1094,7 @@ func ethFilterResultFromEvents(evs []*filter.CollectedEvent) (*api.EthFilterResu if err != nil { return nil, err } - log.BlockHash, err = api.NewEthHashFromCid(c) + log.BlockHash, err = ethtypes.NewEthHashFromCid(c) if err != nil { return nil, err } @@ -1104,15 +1105,15 @@ func ethFilterResultFromEvents(evs []*filter.CollectedEvent) (*api.EthFilterResu return res, nil } -func ethFilterResultFromTipSets(tsks []types.TipSetKey) (*api.EthFilterResult, error) { - res := &api.EthFilterResult{} +func ethFilterResultFromTipSets(tsks []types.TipSetKey) (*ethtypes.EthFilterResult, error) { + res := ðtypes.EthFilterResult{} for _, tsk := range tsks { c, err := tsk.Cid() if err != nil { return nil, err } - hash, err := api.NewEthHashFromCid(c) + hash, err := ethtypes.NewEthHashFromCid(c) if err != nil { return nil, err } @@ -1123,11 +1124,11 @@ func ethFilterResultFromTipSets(tsks []types.TipSetKey) (*api.EthFilterResult, e return res, nil } -func ethFilterResultFromMessages(cs []cid.Cid) (*api.EthFilterResult, error) { - res := &api.EthFilterResult{} +func ethFilterResultFromMessages(cs []cid.Cid) (*ethtypes.EthFilterResult, error) { + res := ðtypes.EthFilterResult{} for _, c := range cs { - hash, err := api.NewEthHashFromCid(c) + hash, err := ethtypes.NewEthHashFromCid(c) if err != nil { return nil, err } @@ -1143,7 +1144,7 @@ type EthSubscriptionManager struct { StateAPI StateAPI ChainAPI ChainAPI mu sync.Mutex - subs map[api.EthSubscriptionID]*ethSubscription + subs map[ethtypes.EthSubscriptionID]*ethSubscription } func (e *EthSubscriptionManager) StartSubscription(ctx context.Context) (*ethSubscription, error) { // nolint @@ -1151,7 +1152,7 @@ func (e *EthSubscriptionManager) StartSubscription(ctx context.Context) (*ethSub if err != nil { return nil, xerrors.Errorf("new uuid: %w", err) } - id := api.EthSubscriptionID{} + id := ethtypes.EthSubscriptionID{} copy(id[:], rawid[:]) // uuid is 16 bytes ctx, quit := context.WithCancel(ctx) @@ -1162,13 +1163,13 @@ func (e *EthSubscriptionManager) StartSubscription(ctx context.Context) (*ethSub ChainAPI: e.ChainAPI, id: id, in: make(chan interface{}, 200), - out: make(chan api.EthSubscriptionResponse, 20), + out: make(chan ethtypes.EthSubscriptionResponse, 20), quit: quit, } e.mu.Lock() if e.subs == nil { - e.subs = make(map[api.EthSubscriptionID]*ethSubscription) + e.subs = make(map[ethtypes.EthSubscriptionID]*ethSubscription) } e.subs[sub.id] = sub e.mu.Unlock() @@ -1178,7 +1179,7 @@ func (e *EthSubscriptionManager) StartSubscription(ctx context.Context) (*ethSub return sub, nil } -func (e *EthSubscriptionManager) StopSubscription(ctx context.Context, id api.EthSubscriptionID) ([]filter.Filter, error) { +func (e *EthSubscriptionManager) StopSubscription(ctx context.Context, id ethtypes.EthSubscriptionID) ([]filter.Filter, error) { e.mu.Lock() defer e.mu.Unlock() @@ -1196,9 +1197,9 @@ type ethSubscription struct { Chain *store.ChainStore StateAPI StateAPI ChainAPI ChainAPI - id api.EthSubscriptionID + id ethtypes.EthSubscriptionID in chan interface{} - out chan api.EthSubscriptionResponse + out chan ethtypes.EthSubscriptionResponse mu sync.Mutex filters []filter.Filter @@ -1219,7 +1220,7 @@ func (e *ethSubscription) start(ctx context.Context) { case <-ctx.Done(): return case v := <-e.in: - resp := api.EthSubscriptionResponse{ + resp := ethtypes.EthSubscriptionResponse{ SubscriptionID: e.id, } @@ -1262,35 +1263,35 @@ func (e *ethSubscription) stop() { } } -func newEthBlockFromFilecoinTipSet(ctx context.Context, ts *types.TipSet, fullTxInfo bool, cs *store.ChainStore, ca ChainAPI, sa StateAPI) (api.EthBlock, error) { +func newEthBlockFromFilecoinTipSet(ctx context.Context, ts *types.TipSet, fullTxInfo bool, cs *store.ChainStore, ca ChainAPI, sa StateAPI) (ethtypes.EthBlock, error) { parent, err := cs.LoadTipSet(ctx, ts.Parents()) if err != nil { - return api.EthBlock{}, err + return ethtypes.EthBlock{}, err } parentKeyCid, err := parent.Key().Cid() if err != nil { - return api.EthBlock{}, err + return ethtypes.EthBlock{}, err } - parentBlkHash, err := api.NewEthHashFromCid(parentKeyCid) + parentBlkHash, err := ethtypes.NewEthHashFromCid(parentKeyCid) if err != nil { - return api.EthBlock{}, err + return ethtypes.EthBlock{}, err } blkCid, err := ts.Key().Cid() if err != nil { - return api.EthBlock{}, err + return ethtypes.EthBlock{}, err } - blkHash, err := api.NewEthHashFromCid(blkCid) + blkHash, err := ethtypes.NewEthHashFromCid(blkCid) if err != nil { - return api.EthBlock{}, err + return ethtypes.EthBlock{}, err } blkMsgs, err := cs.BlockMsgsForTipset(ctx, ts) if err != nil { - return api.EthBlock{}, xerrors.Errorf("error loading messages for tipset: %v: %w", ts, err) + return ethtypes.EthBlock{}, xerrors.Errorf("error loading messages for tipset: %v: %w", ts, err) } - block := api.NewEthBlock() + block := ethtypes.NewEthBlock() // this seems to be a very expensive way to get gasUsed of the block. may need to find an efficient way to do it gasUsed := int64(0) @@ -1298,20 +1299,20 @@ func newEthBlockFromFilecoinTipSet(ctx context.Context, ts *types.TipSet, fullTx for _, msg := range append(blkMsg.BlsMessages, blkMsg.SecpkMessages...) { msgLookup, err := sa.StateSearchMsg(ctx, types.EmptyTSK, msg.Cid(), api.LookbackNoLimit, true) if err != nil || msgLookup == nil { - return api.EthBlock{}, nil + return ethtypes.EthBlock{}, nil } gasUsed += msgLookup.Receipt.GasUsed if fullTxInfo { tx, err := newEthTxFromFilecoinMessageLookup(ctx, msgLookup, cs, ca, sa) if err != nil { - return api.EthBlock{}, nil + return ethtypes.EthBlock{}, nil } block.Transactions = append(block.Transactions, tx) } else { - hash, err := api.NewEthHashFromCid(msg.Cid()) + hash, err := ethtypes.NewEthHashFromCid(msg.Cid()) if err != nil { - return api.EthBlock{}, err + return ethtypes.EthBlock{}, err } block.Transactions = append(block.Transactions, hash.String()) } @@ -1319,11 +1320,11 @@ func newEthBlockFromFilecoinTipSet(ctx context.Context, ts *types.TipSet, fullTx } block.Hash = blkHash - block.Number = api.EthUint64(ts.Height()) + block.Number = ethtypes.EthUint64(ts.Height()) block.ParentHash = parentBlkHash - block.Timestamp = api.EthUint64(ts.Blocks()[0].Timestamp) - block.BaseFeePerGas = api.EthBigInt{Int: ts.Blocks()[0].ParentBaseFee.Int} - block.GasUsed = api.EthUint64(gasUsed) + block.Timestamp = ethtypes.EthUint64(ts.Blocks()[0].Timestamp) + block.BaseFeePerGas = ethtypes.EthBigInt{Int: ts.Blocks()[0].ParentBaseFee.Int} + block.GasUsed = ethtypes.EthUint64(gasUsed) return block, nil } @@ -1335,10 +1336,10 @@ func newEthBlockFromFilecoinTipSet(ctx context.Context, ts *types.TipSet, fullTx // 3. Otherwise, we fall back to returning a masked ID Ethereum address. If the supplied address is an f0 address, we // use that ID to form the masked ID address. // 4. Otherwise, we fetch the actor's ID from the state tree and form the masked ID with it. -func lookupEthAddress(ctx context.Context, addr address.Address, sa StateAPI) (api.EthAddress, error) { +func lookupEthAddress(ctx context.Context, addr address.Address, sa StateAPI) (ethtypes.EthAddress, error) { // Attempt to convert directly. - if ethAddr, ok, err := api.TryEthAddressFromFilecoinAddress(addr, false); err != nil { - return api.EthAddress{}, err + if ethAddr, ok, err := ethtypes.TryEthAddressFromFilecoinAddress(addr, false); err != nil { + return ethtypes.EthAddress{}, err } else if ok { return ethAddr, nil } @@ -1346,19 +1347,19 @@ func lookupEthAddress(ctx context.Context, addr address.Address, sa StateAPI) (a // Lookup on the target actor. actor, err := sa.StateGetActor(ctx, addr, types.EmptyTSK) if err != nil { - return api.EthAddress{}, err + return ethtypes.EthAddress{}, err } if actor.Address != nil { - if ethAddr, ok, err := api.TryEthAddressFromFilecoinAddress(*actor.Address, false); err != nil { - return api.EthAddress{}, err + if ethAddr, ok, err := ethtypes.TryEthAddressFromFilecoinAddress(*actor.Address, false); err != nil { + return ethtypes.EthAddress{}, err } else if ok { return ethAddr, nil } } // Check if we already have an ID addr, and use it if possible. - if ethAddr, ok, err := api.TryEthAddressFromFilecoinAddress(addr, true); err != nil { - return api.EthAddress{}, err + if ethAddr, ok, err := ethtypes.TryEthAddressFromFilecoinAddress(addr, true); err != nil { + return ethtypes.EthAddress{}, err } else if ok { return ethAddr, nil } @@ -1366,42 +1367,42 @@ func lookupEthAddress(ctx context.Context, addr address.Address, sa StateAPI) (a // Otherwise, resolve the ID addr. idAddr, err := sa.StateLookupID(ctx, addr, types.EmptyTSK) if err != nil { - return api.EthAddress{}, err + return ethtypes.EthAddress{}, err } - return api.EthAddressFromFilecoinAddress(idAddr) + return ethtypes.EthAddressFromFilecoinAddress(idAddr) } -func newEthTxFromFilecoinMessageLookup(ctx context.Context, msgLookup *api.MsgLookup, cs *store.ChainStore, ca ChainAPI, sa StateAPI) (api.EthTx, error) { +func newEthTxFromFilecoinMessageLookup(ctx context.Context, msgLookup *api.MsgLookup, cs *store.ChainStore, ca ChainAPI, sa StateAPI) (ethtypes.EthTx, error) { if msgLookup == nil { - return api.EthTx{}, fmt.Errorf("msg does not exist") + return ethtypes.EthTx{}, fmt.Errorf("msg does not exist") } cid := msgLookup.Message - txHash, err := api.NewEthHashFromCid(cid) + txHash, err := ethtypes.NewEthHashFromCid(cid) if err != nil { - return api.EthTx{}, err + return ethtypes.EthTx{}, err } ts, err := cs.LoadTipSet(ctx, msgLookup.TipSet) if err != nil { - return api.EthTx{}, err + return ethtypes.EthTx{}, err } // This tx is located in the parent tipset parentTs, err := cs.LoadTipSet(ctx, ts.Parents()) if err != nil { - return api.EthTx{}, err + return ethtypes.EthTx{}, err } parentTsCid, err := parentTs.Key().Cid() if err != nil { - return api.EthTx{}, err + return ethtypes.EthTx{}, err } // lookup the transactionIndex txIdx := -1 msgs, err := cs.MessagesForTipset(ctx, parentTs) if err != nil { - return api.EthTx{}, err + return ethtypes.EthTx{}, err } for i, msg := range msgs { if msg.Cid() == msgLookup.Message { @@ -1409,27 +1410,27 @@ func newEthTxFromFilecoinMessageLookup(ctx context.Context, msgLookup *api.MsgLo } } if txIdx == -1 { - return api.EthTx{}, fmt.Errorf("cannot find the msg in the tipset") + return ethtypes.EthTx{}, fmt.Errorf("cannot find the msg in the tipset") } - blkHash, err := api.NewEthHashFromCid(parentTsCid) + blkHash, err := ethtypes.NewEthHashFromCid(parentTsCid) if err != nil { - return api.EthTx{}, err + return ethtypes.EthTx{}, err } msg, err := ca.ChainGetMessage(ctx, msgLookup.Message) if err != nil { - return api.EthTx{}, err + return ethtypes.EthTx{}, err } fromEthAddr, err := lookupEthAddress(ctx, msg.From, sa) if err != nil { - return api.EthTx{}, err + return ethtypes.EthTx{}, err } toEthAddr, err := lookupEthAddress(ctx, msg.To, sa) if err != nil { - return api.EthTx{}, err + return ethtypes.EthTx{}, err } toAddr := &toEthAddr @@ -1450,7 +1451,7 @@ func newEthTxFromFilecoinMessageLookup(ctx context.Context, msgLookup *api.MsgLo input = params.Initcode } if err != nil { - return api.EthTx{}, err + return ethtypes.EthTx{}, err } } // Otherwise, try to decode as a cbor byte array. @@ -1461,28 +1462,28 @@ func newEthTxFromFilecoinMessageLookup(ctx context.Context, msgLookup *api.MsgLo } } - tx := api.EthTx{ - ChainID: api.EthUint64(build.Eip155ChainId), + tx := ethtypes.EthTx{ + ChainID: ethtypes.EthUint64(build.Eip155ChainId), Hash: txHash, BlockHash: blkHash, - BlockNumber: api.EthUint64(parentTs.Height()), + BlockNumber: ethtypes.EthUint64(parentTs.Height()), From: fromEthAddr, To: toAddr, - Value: api.EthBigInt(msg.Value), - Type: api.EthUint64(2), - TransactionIndex: api.EthUint64(txIdx), - Gas: api.EthUint64(msg.GasLimit), - MaxFeePerGas: api.EthBigInt(msg.GasFeeCap), - MaxPriorityFeePerGas: api.EthBigInt(msg.GasPremium), - V: api.EthBytes{}, - R: api.EthBytes{}, - S: api.EthBytes{}, + Value: ethtypes.EthBigInt(msg.Value), + Type: ethtypes.EthUint64(2), + TransactionIndex: ethtypes.EthUint64(txIdx), + Gas: ethtypes.EthUint64(msg.GasLimit), + MaxFeePerGas: ethtypes.EthBigInt(msg.GasFeeCap), + MaxPriorityFeePerGas: ethtypes.EthBigInt(msg.GasPremium), + V: ethtypes.EthBytes{}, + R: ethtypes.EthBytes{}, + S: ethtypes.EthBytes{}, Input: input, } return tx, nil } -func newEthTxReceipt(ctx context.Context, tx api.EthTx, lookup *api.MsgLookup, replay *api.InvocResult, events []types.Event, sa StateAPI) (api.EthTxReceipt, error) { +func newEthTxReceipt(ctx context.Context, tx ethtypes.EthTx, lookup *api.MsgLookup, replay *api.InvocResult, events []types.Event, sa StateAPI) (api.EthTxReceipt, error) { receipt := api.EthTxReceipt{ TransactionHash: tx.Hash, TransactionIndex: tx.TransactionIndex, @@ -1490,7 +1491,7 @@ func newEthTxReceipt(ctx context.Context, tx api.EthTx, lookup *api.MsgLookup, r BlockNumber: tx.BlockNumber, From: tx.From, To: tx.To, - Type: api.EthUint64(2), + Type: ethtypes.EthUint64(2), LogsBloom: []byte{0}, } @@ -1500,7 +1501,7 @@ func newEthTxReceipt(ctx context.Context, tx api.EthTx, lookup *api.MsgLookup, r if err := ret.UnmarshalCBOR(bytes.NewReader(lookup.Receipt.Return)); err != nil { return api.EthTxReceipt{}, xerrors.Errorf("failed to parse contract creation result: %w", err) } - addr := api.EthAddress(ret.EthAddress) + addr := ethtypes.EthAddress(ret.EthAddress) receipt.ContractAddress = &addr } @@ -1518,11 +1519,11 @@ func newEthTxReceipt(ctx context.Context, tx api.EthTx, lookup *api.MsgLookup, r receipt.LogsBloom = make([]byte, 256) receipt.LogsBloom[255] = 0x01 - receipt.Logs = make([]api.EthLog, 0, len(events)) + receipt.Logs = make([]ethtypes.EthLog, 0, len(events)) for i, evt := range events { - l := api.EthLog{ + l := ethtypes.EthLog{ Removed: false, - LogIndex: api.EthUint64(i), + LogIndex: ethtypes.EthUint64(i), TransactionIndex: tx.TransactionIndex, TransactionHash: tx.Hash, BlockHash: tx.BlockHash, @@ -1530,8 +1531,8 @@ func newEthTxReceipt(ctx context.Context, tx api.EthTx, lookup *api.MsgLookup, r } for _, entry := range evt.Entries { - value := api.EthBytes(leftpad32(decodeLogBytes(entry.Value))) - if entry.Key == api.EthTopic1 || entry.Key == api.EthTopic2 || entry.Key == api.EthTopic3 || entry.Key == api.EthTopic4 { + value := ethtypes.EthBytes(leftpad32(decodeLogBytes(entry.Value))) + if entry.Key == ethtypes.EthTopic1 || entry.Key == ethtypes.EthTopic2 || entry.Key == ethtypes.EthTopic3 || entry.Key == ethtypes.EthTopic4 { l.Topics = append(l.Topics, value) } else { l.Data = value @@ -1552,13 +1553,13 @@ func newEthTxReceipt(ctx context.Context, tx api.EthTx, lookup *api.MsgLookup, r } } - receipt.GasUsed = api.EthUint64(lookup.Receipt.GasUsed) + receipt.GasUsed = ethtypes.EthUint64(lookup.Receipt.GasUsed) // TODO: handle CumulativeGasUsed - receipt.CumulativeGasUsed = api.EmptyEthInt + receipt.CumulativeGasUsed = ethtypes.EmptyEthInt effectiveGasPrice := big.Div(replay.GasCost.TotalCost, big.NewInt(lookup.Receipt.GasUsed)) - receipt.EffectiveGasPrice = api.EthBigInt(effectiveGasPrice) + receipt.EffectiveGasPrice = ethtypes.EthBigInt(effectiveGasPrice) return receipt, nil } diff --git a/node/impl/full/state.go b/node/impl/full/state.go index b63f044a9..8898c9c56 100644 --- a/node/impl/full/state.go +++ b/node/impl/full/state.go @@ -1055,6 +1055,7 @@ func (a *StateAPI) StateSectorPreCommitInfo(ctx context.Context, maddr address.A return pci, err } +// Returns nil, nil if sector is not found func (m *StateModule) StateSectorGetInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorOnChainInfo, error) { ts, err := m.Chain.GetTipSetFromKey(ctx, tsk) if err != nil { diff --git a/node/modules/lp2p/pubsub.go b/node/modules/lp2p/pubsub.go index 9f1b58c2b..5376d93c8 100644 --- a/node/modules/lp2p/pubsub.go +++ b/node/modules/lp2p/pubsub.go @@ -21,6 +21,7 @@ import ( "github.com/filecoin-project/lotus/node/config" "github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/modules/helpers" + "github.com/filecoin-project/lotus/node/modules/tracer" ) func init() { @@ -49,6 +50,30 @@ func ScoreKeeper() *dtypes.ScoreKeeper { return new(dtypes.ScoreKeeper) } +type PeerScoreTracker interface { + UpdatePeerScore(scores map[peer.ID]*pubsub.PeerScoreSnapshot) +} + +type peerScoreTracker struct { + sk *dtypes.ScoreKeeper + lt tracer.LotusTracer +} + +func newPeerScoreTracker(lt tracer.LotusTracer, sk *dtypes.ScoreKeeper) PeerScoreTracker { + return &peerScoreTracker{ + sk: sk, + lt: lt, + } +} + +func (pst *peerScoreTracker) UpdatePeerScore(scores map[peer.ID]*pubsub.PeerScoreSnapshot) { + if pst.lt != nil { + pst.lt.PeerScores(scores) + } + + pst.sk.Update(scores) +} + type GossipIn struct { fx.In Mctx helpers.MetricsCtx @@ -291,7 +316,6 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) { OpportunisticGraftThreshold: OpportunisticGraftScoreThreshold, }, ), - pubsub.WithPeerScoreInspect(in.Sk.Update, 10*time.Second), } // enable Peer eXchange on bootstrappers @@ -361,6 +385,27 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) { pubsub.NewAllowlistSubscriptionFilter(allowTopics...), 100))) + var transports []tracer.TracerTransport + if in.Cfg.JsonTracer != "" { + jsonTransport, err := tracer.NewJsonTracerTransport(in.Cfg.JsonTracer) + if err != nil { + return nil, err + } + + transports = append(transports, jsonTransport) + } + if in.Cfg.ElasticSearchTracer != "" { + elasticSearchTransport, err := tracer.NewElasticSearchTransport( + in.Cfg.ElasticSearchTracer, + in.Cfg.ElasticSearchIndex, + ) + if err != nil { + return nil, err + } + transports = append(transports, elasticSearchTransport) + } + lt := tracer.NewLotusTracer(transports, in.Host.ID(), in.Cfg.TracerSourceAuth) + // tracer if in.Cfg.RemoteTracer != "" { a, err := ma.NewMultiaddr(in.Cfg.RemoteTracer) @@ -378,12 +423,18 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) { return nil, err } - trw := newTracerWrapper(tr, build.BlocksTopic(in.Nn)) + pst := newPeerScoreTracker(lt, in.Sk) + trw := newTracerWrapper(tr, lt, build.BlocksTopic(in.Nn)) + options = append(options, pubsub.WithEventTracer(trw)) + options = append(options, pubsub.WithPeerScoreInspect(pst.UpdatePeerScore, 10*time.Second)) } else { // still instantiate a tracer for collecting metrics - trw := newTracerWrapper(nil) + trw := newTracerWrapper(nil, lt) options = append(options, pubsub.WithEventTracer(trw)) + + pst := newPeerScoreTracker(lt, in.Sk) + options = append(options, pubsub.WithPeerScoreInspect(pst.UpdatePeerScore, 10*time.Second)) } return pubsub.NewGossipSub(helpers.LifecycleCtx(in.Mctx, in.Lc), in.Host, options...) @@ -394,7 +445,11 @@ func HashMsgId(m *pubsub_pb.Message) string { return string(hash[:]) } -func newTracerWrapper(tr pubsub.EventTracer, topics ...string) pubsub.EventTracer { +func newTracerWrapper( + lp2pTracer pubsub.EventTracer, + lotusTracer pubsub.EventTracer, + topics ...string, +) pubsub.EventTracer { var topicsMap map[string]struct{} if len(topics) > 0 { topicsMap = make(map[string]struct{}) @@ -403,12 +458,13 @@ func newTracerWrapper(tr pubsub.EventTracer, topics ...string) pubsub.EventTrace } } - return &tracerWrapper{tr: tr, topics: topicsMap} + return &tracerWrapper{lp2pTracer: lp2pTracer, lotusTracer: lotusTracer, topics: topicsMap} } type tracerWrapper struct { - tr pubsub.EventTracer - topics map[string]struct{} + lp2pTracer pubsub.EventTracer + lotusTracer pubsub.EventTracer + topics map[string]struct{} } func (trw *tracerWrapper) traceMessage(topic string) bool { @@ -426,33 +482,70 @@ func (trw *tracerWrapper) Trace(evt *pubsub_pb.TraceEvent) { switch evt.GetType() { case pubsub_pb.TraceEvent_PUBLISH_MESSAGE: stats.Record(context.TODO(), metrics.PubsubPublishMessage.M(1)) - if trw.tr != nil && trw.traceMessage(evt.GetPublishMessage().GetTopic()) { - trw.tr.Trace(evt) + if trw.traceMessage(evt.GetPublishMessage().GetTopic()) { + if trw.lp2pTracer != nil { + trw.lp2pTracer.Trace(evt) + } + + if trw.lotusTracer != nil { + trw.lotusTracer.Trace(evt) + } } case pubsub_pb.TraceEvent_DELIVER_MESSAGE: stats.Record(context.TODO(), metrics.PubsubDeliverMessage.M(1)) - if trw.tr != nil && trw.traceMessage(evt.GetDeliverMessage().GetTopic()) { - trw.tr.Trace(evt) + if trw.traceMessage(evt.GetDeliverMessage().GetTopic()) { + if trw.lp2pTracer != nil { + trw.lp2pTracer.Trace(evt) + } + + if trw.lotusTracer != nil { + trw.lotusTracer.Trace(evt) + } } case pubsub_pb.TraceEvent_REJECT_MESSAGE: stats.Record(context.TODO(), metrics.PubsubRejectMessage.M(1)) + if trw.traceMessage(evt.GetRejectMessage().GetTopic()) { + if trw.lp2pTracer != nil { + trw.lp2pTracer.Trace(evt) + } + + if trw.lotusTracer != nil { + trw.lotusTracer.Trace(evt) + } + } case pubsub_pb.TraceEvent_DUPLICATE_MESSAGE: stats.Record(context.TODO(), metrics.PubsubDuplicateMessage.M(1)) case pubsub_pb.TraceEvent_JOIN: - if trw.tr != nil { - trw.tr.Trace(evt) + if trw.lp2pTracer != nil { + trw.lp2pTracer.Trace(evt) + } + + if trw.lotusTracer != nil { + trw.lotusTracer.Trace(evt) } case pubsub_pb.TraceEvent_LEAVE: - if trw.tr != nil { - trw.tr.Trace(evt) + if trw.lp2pTracer != nil { + trw.lp2pTracer.Trace(evt) + } + + if trw.lotusTracer != nil { + trw.lotusTracer.Trace(evt) } case pubsub_pb.TraceEvent_GRAFT: - if trw.tr != nil { - trw.tr.Trace(evt) + if trw.lp2pTracer != nil { + trw.lp2pTracer.Trace(evt) + } + + if trw.lotusTracer != nil { + trw.lotusTracer.Trace(evt) } case pubsub_pb.TraceEvent_PRUNE: - if trw.tr != nil { - trw.tr.Trace(evt) + if trw.lp2pTracer != nil { + trw.lp2pTracer.Trace(evt) + } + + if trw.lotusTracer != nil { + trw.lotusTracer.Trace(evt) } case pubsub_pb.TraceEvent_RECV_RPC: stats.Record(context.TODO(), metrics.PubsubRecvRPC.M(1)) diff --git a/node/modules/storageminer.go b/node/modules/storageminer.go index 04814ffdc..dff9c1415 100644 --- a/node/modules/storageminer.go +++ b/node/modules/storageminer.go @@ -233,7 +233,7 @@ func PreflightChecks(mctx helpers.MetricsCtx, lc fx.Lifecycle, api v1api.FullNod return xerrors.New("key for worker not found in local wallet") } - log.Infof("starting up miner %s, worker addr %s", maddr, workerKey) + log.Infof("starting up miner %s, worker addr %s", address.Address(maddr), workerKey) return nil }}) diff --git a/node/modules/tracer/elasticsearch_transport.go b/node/modules/tracer/elasticsearch_transport.go new file mode 100644 index 000000000..1f6f9a157 --- /dev/null +++ b/node/modules/tracer/elasticsearch_transport.go @@ -0,0 +1,97 @@ +package tracer + +import ( + "context" + "encoding/json" + "fmt" + "net/url" + "strings" + + "github.com/elastic/go-elasticsearch/v7" + "github.com/elastic/go-elasticsearch/v7/esapi" +) + +const ( + ElasticSearchDefaultIndex = "lotus-pubsub" +) + +func NewElasticSearchTransport(connectionString string, elasticsearchIndex string) (TracerTransport, error) { + conUrl, err := url.Parse(connectionString) + + if err != nil { + return nil, err + } + + username := conUrl.User.Username() + password, _ := conUrl.User.Password() + cfg := elasticsearch.Config{ + Addresses: []string{ + conUrl.Scheme + "://" + conUrl.Host, + }, + Username: username, + Password: password, + } + + es, err := elasticsearch.NewClient(cfg) + + if err != nil { + return nil, err + } + + var esIndex string + if elasticsearchIndex != "" { + esIndex = elasticsearchIndex + } else { + esIndex = ElasticSearchDefaultIndex + } + + return &elasticSearchTransport{ + cl: es, + esIndex: esIndex, + }, nil +} + +type elasticSearchTransport struct { + cl *elasticsearch.Client + esIndex string +} + +func (est *elasticSearchTransport) Transport(evt TracerTransportEvent) error { + var e interface{} + + if evt.lotusTraceEvent != nil { + e = *evt.lotusTraceEvent + } else if evt.pubsubTraceEvent != nil { + e = *evt.pubsubTraceEvent + } else { + return nil + } + + jsonEvt, err := json.Marshal(e) + if err != nil { + return fmt.Errorf("error while marshaling event: %s", err) + } + + req := esapi.IndexRequest{ + Index: est.esIndex, + Body: strings.NewReader(string(jsonEvt)), + Refresh: "true", + } + + // Perform the request with the client. + res, err := req.Do(context.Background(), est.cl) + if err != nil { + return err + } + + err = res.Body.Close() + if err != nil { + return err + } + + if res.IsError() { + return fmt.Errorf("[%s] Error indexing document ID=%s", res.Status(), req.DocumentID) + } + + return nil +} diff --git a/node/modules/tracer/json_transport.go b/node/modules/tracer/json_transport.go new file mode 100644 index 000000000..ca8535f4b --- /dev/null +++ b/node/modules/tracer/json_transport.go @@ -0,0 +1,41 @@ +package tracer + +import ( + "encoding/json" + "fmt" + "os" +) + +type jsonTracerTransport struct { + out *os.File +} + +func NewJsonTracerTransport(file string) (TracerTransport, error) { + out, err := os.OpenFile(file, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0660) + if err != nil { + return nil, err + } + + return &jsonTracerTransport{ + out: out, + }, nil +} + +func (jtt *jsonTracerTransport) Transport(evt TracerTransportEvent) error { + var e interface{} + if evt.lotusTraceEvent != nil { + e = *evt.lotusTraceEvent + } else if evt.pubsubTraceEvent != nil { + e = *evt.pubsubTraceEvent + } else { + return nil + } + + jsonEvt, err := json.Marshal(e) + if err != nil { + return fmt.Errorf("error while marshaling event: %s", err) + } + + _, err = jtt.out.WriteString(string(jsonEvt) + "\n") + return err +} diff --git a/node/modules/tracer/tracer.go b/node/modules/tracer/tracer.go new file mode 100644 index 000000000..0d0a156d9 --- /dev/null +++ b/node/modules/tracer/tracer.go @@ -0,0 +1,120 @@ +package tracer + +import ( + "time" + + logging "github.com/ipfs/go-log/v2" + pubsub "github.com/libp2p/go-libp2p-pubsub" + pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb" + "github.com/libp2p/go-libp2p/core/peer" +) + +var log = logging.Logger("lotus-tracer") + +func NewLotusTracer(tt []TracerTransport, pid peer.ID, sourceAuth string) LotusTracer { + return &lotusTracer{ + tt: tt, + pid: pid, + sa: sourceAuth, + } +} + +type lotusTracer struct { + tt []TracerTransport + pid peer.ID + sa string +} + +const ( + TraceEventPeerScores pubsub_pb.TraceEvent_Type = 100 +) + +type LotusTraceEvent struct { + Type pubsub_pb.TraceEvent_Type `json:"type,omitempty"` + PeerID string `json:"peerID,omitempty"` + Timestamp *int64 `json:"timestamp,omitempty"` + PeerScore TraceEventPeerScore `json:"peerScore,omitempty"` + SourceAuth string `json:"sourceAuth,omitempty"` +} + +type TopicScore struct { + Topic string `json:"topic"` + TimeInMesh time.Duration `json:"timeInMesh"` + FirstMessageDeliveries float64 `json:"firstMessageDeliveries"` + MeshMessageDeliveries float64 `json:"meshMessageDeliveries"` + InvalidMessageDeliveries float64 `json:"invalidMessageDeliveries"` +} + +type TraceEventPeerScore struct { + PeerID string `json:"peerID"` + Score float64 `json:"score"` + AppSpecificScore float64 `json:"appSpecificScore"` + IPColocationFactor float64 `json:"ipColocationFactor"` + BehaviourPenalty float64 `json:"behaviourPenalty"` + Topics []TopicScore `json:"topics"` +} + +type LotusTracer interface { + Trace(evt *pubsub_pb.TraceEvent) + TraceLotusEvent(evt *LotusTraceEvent) + + PeerScores(scores map[peer.ID]*pubsub.PeerScoreSnapshot) +} + +func (lt *lotusTracer) PeerScores(scores map[peer.ID]*pubsub.PeerScoreSnapshot) { + now := time.Now().UnixNano() + for pid, score := range scores { + var topics []TopicScore + for topic, snapshot := range score.Topics { + topics = append(topics, TopicScore{ + Topic: topic, + TimeInMesh: snapshot.TimeInMesh, + FirstMessageDeliveries: snapshot.FirstMessageDeliveries, + MeshMessageDeliveries: snapshot.MeshMessageDeliveries, + InvalidMessageDeliveries: snapshot.InvalidMessageDeliveries, + }) + } + + evt := &LotusTraceEvent{ + Type: *TraceEventPeerScores.Enum(), + PeerID: lt.pid.Pretty(), + Timestamp: &now, + SourceAuth: lt.sa, + PeerScore: TraceEventPeerScore{ + PeerID: pid.Pretty(), + Score: score.Score, + AppSpecificScore: score.AppSpecificScore, + IPColocationFactor: score.IPColocationFactor, + BehaviourPenalty: score.BehaviourPenalty, + Topics: topics, + }, + } + + lt.TraceLotusEvent(evt) + } +} + +func (lt *lotusTracer) TraceLotusEvent(evt *LotusTraceEvent) { + for _, t := range lt.tt { + err := t.Transport(TracerTransportEvent{ + lotusTraceEvent: evt, + pubsubTraceEvent: nil, + }) + if err != nil { + log.Errorf("error while transporting peer scores: %s", err) + } + } + +} + +func (lt *lotusTracer) Trace(evt *pubsub_pb.TraceEvent) { + for _, t := range lt.tt { + err := t.Transport(TracerTransportEvent{ + lotusTraceEvent: nil, + pubsubTraceEvent: evt, + }) + if err != nil { + log.Errorf("error while transporting trace event: %s", err) + } + } +} diff --git a/node/modules/tracer/tracer_test.go b/node/modules/tracer/tracer_test.go new file mode 100644 index 000000000..7ade67861 --- /dev/null +++ b/node/modules/tracer/tracer_test.go @@ -0,0 +1,109 @@ +package tracer + +import ( + "testing" + "time" + + pubsub "github.com/libp2p/go-libp2p-pubsub" + pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb" + "github.com/libp2p/go-libp2p/core/peer" + "github.com/stretchr/testify/require" +) + +type testTracerTransport struct { + t *testing.T + executeTest func(t *testing.T, evt TracerTransportEvent) +} + +const peerIDA peer.ID = "12D3KooWAbSVMgRejb6ECg6fRTkCPGCfu8396msZVryu8ivcz44G" + +func NewTestTraceTransport(t *testing.T, executeTest func(t *testing.T, evt TracerTransportEvent)) TracerTransport { + return &testTracerTransport{ + t: t, + executeTest: executeTest, + } +} + +func (ttt *testTracerTransport) Transport(evt TracerTransportEvent) error { + ttt.executeTest(ttt.t, evt) + return nil +} + +func TestTracer_PeerScores(t *testing.T) { + + testTransport := NewTestTraceTransport(t, func(t *testing.T, evt TracerTransportEvent) { + require.Equal(t, peerIDA.Pretty(), evt.lotusTraceEvent.PeerID) + require.Equal(t, "source-auth-token-test", evt.lotusTraceEvent.SourceAuth) + require.Equal(t, float64(32), evt.lotusTraceEvent.PeerScore.Score) + + n := time.Now().UnixNano() + require.LessOrEqual(t, *evt.lotusTraceEvent.Timestamp, n) + + require.Equal(t, peerIDA.Pretty(), evt.lotusTraceEvent.PeerScore.PeerID) + require.Equal(t, 1, len(evt.lotusTraceEvent.PeerScore.Topics)) + + topic := evt.lotusTraceEvent.PeerScore.Topics[0] + require.Equal(t, "topicA", topic.Topic) + require.Equal(t, float64(100), topic.FirstMessageDeliveries) + }) + + lt := NewLotusTracer( + []TracerTransport{testTransport}, + peerIDA, + "source-auth-token-test", + ) + + topics := make(map[string]*pubsub.TopicScoreSnapshot) + topics["topicA"] = &pubsub.TopicScoreSnapshot{ + FirstMessageDeliveries: float64(100), + } + + m := make(map[peer.ID]*pubsub.PeerScoreSnapshot) + m[peerIDA] = &pubsub.PeerScoreSnapshot{ + Score: float64(32), + Topics: topics, + } + + lt.PeerScores(m) +} + +func TestTracer_PubSubTrace(t *testing.T) { + n := time.Now().Unix() + + testTransport := NewTestTraceTransport(t, func(t *testing.T, evt TracerTransportEvent) { + require.Equal(t, []byte(peerIDA), evt.pubsubTraceEvent.PeerID) + require.Equal(t, &n, evt.pubsubTraceEvent.Timestamp) + }) + + lt := NewLotusTracer( + []TracerTransport{testTransport}, + "pid", + "source-auth", + ) + + lt.Trace(&pubsub_pb.TraceEvent{ + PeerID: []byte(peerIDA), + Timestamp: &n, + }) + +} + +func TestTracer_MultipleTransports(t *testing.T) { + testTransportA := NewTestTraceTransport(t, func(t *testing.T, evt TracerTransportEvent) { + require.Equal(t, []byte(peerIDA), evt.pubsubTraceEvent.PeerID) + }) + + testTransportB := NewTestTraceTransport(t, func(t *testing.T, evt TracerTransportEvent) { + require.Equal(t, []byte(peerIDA), evt.pubsubTraceEvent.PeerID) + }) + + executeTest := NewLotusTracer( + []TracerTransport{testTransportA, testTransportB}, + "pid", + "source-auth", + ) + + executeTest.Trace(&pubsub_pb.TraceEvent{ + PeerID: []byte(peerIDA), + }) +} diff --git a/node/modules/tracer/transport.go b/node/modules/tracer/transport.go new file mode 100644 index 000000000..56d926afc --- /dev/null +++ b/node/modules/tracer/transport.go @@ -0,0 +1,12 @@ +package tracer + +import pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb" + +type TracerTransport interface { + Transport(evt TracerTransportEvent) error +} + +type TracerTransportEvent struct { + lotusTraceEvent *LotusTraceEvent + pubsubTraceEvent *pubsub_pb.TraceEvent +} diff --git a/node/shutdown.go b/node/shutdown.go index e630031da..f44ca0857 100644 --- a/node/shutdown.go +++ b/node/shutdown.go @@ -51,6 +51,7 @@ func MonitorShutdown(triggerCh <-chan struct{}, handlers ...ShutdownHandler) <-c close(out) }() + signal.Reset(syscall.SIGTERM, syscall.SIGINT) signal.Notify(sigCh, syscall.SIGTERM, syscall.SIGINT) return out } diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 8c7323a2b..2b9862808 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -36,7 +36,7 @@ parts: - libhwloc15 - ocl-icd-libopencl1 override-build: | - LDFLAGS="" make lotus lotus-miner lotus-worker + LDFLAGS="-z noexecstack" make lotus lotus-miner lotus-worker cp lotus lotus-miner lotus-worker $SNAPCRAFT_PART_INSTALL cp scripts/snap-lotus-entrypoint.sh $SNAPCRAFT_PART_INSTALL diff --git a/storage/pipeline/input.go b/storage/pipeline/input.go index 3499c855c..25c752e5f 100644 --- a/storage/pipeline/input.go +++ b/storage/pipeline/input.go @@ -449,6 +449,9 @@ func (m *Sealing) updateInput(ctx context.Context, sp abi.RegisteredSealProof) e if err != nil { return 0, big.Zero(), err } + if onChainInfo == nil { + return 0, big.Zero(), xerrors.Errorf("sector info for sector %d not found", sn) + } memo[sn] = struct { e abi.ChainEpoch p abi.TokenAmount @@ -494,10 +497,6 @@ func (m *Sealing) updateInput(ctx context.Context, sp abi.RegisteredSealProof) e continue } if !ok { - exp, _, _ := getExpirationCached(sector.number) - - // todo move this log into checkDealAssignable, make more detailed about the reason - log.Debugf("CC update sector %d cannot fit deal, expiration %d before deal end epoch %d", id, exp, piece.deal.DealProposal.EndEpoch) continue } diff --git a/storage/pipeline/sealing.go b/storage/pipeline/sealing.go index 6caa9ddc6..0fadb6131 100644 --- a/storage/pipeline/sealing.go +++ b/storage/pipeline/sealing.go @@ -142,8 +142,21 @@ type openSector struct { } func (o *openSector) checkDealAssignable(piece *pendingPiece, expF expFn) (bool, error) { + log := log.With( + "sector", o.number, + + "deal", piece.deal.DealID, + "dealEnd", piece.deal.DealProposal.EndEpoch, + "dealStart", piece.deal.DealProposal.StartEpoch, + "dealClaimEnd", piece.claimTerms.claimTermEnd, + + "lastAssignedDealEnd", o.lastDealEnd, + "update", o.ccUpdate, + ) + // if there are deals assigned, check that no assigned deal expires after termMax if o.lastDealEnd > piece.claimTerms.claimTermEnd { + log.Debugw("deal not assignable to sector", "reason", "term end beyond last assigned deal end") return false, nil } @@ -153,15 +166,26 @@ func (o *openSector) checkDealAssignable(piece *pendingPiece, expF expFn) (bool, } sectorExpiration, _, err := expF(o.number) if err != nil { + log.Debugw("deal not assignable to sector", "reason", "error getting sector expiranion", "error", err) return false, err } + log = log.With( + "sectorExpiration", sectorExpiration, + ) + // check that in case of upgrade sector, it's expiration isn't above deals claim TermMax if sectorExpiration > piece.claimTerms.claimTermEnd { + log.Debugw("deal not assignable to sector", "reason", "term end beyond sector expiration") return false, nil } - return sectorExpiration >= piece.deal.DealProposal.EndEpoch, nil + if sectorExpiration < piece.deal.DealProposal.EndEpoch { + log.Debugw("deal not assignable to sector", "reason", "sector expiration less than deal expiration") + return false, nil + } + + return true, nil } type pieceAcceptResp struct { diff --git a/storage/pipeline/states_replica_update.go b/storage/pipeline/states_replica_update.go index b42820f48..e1b9cfc30 100644 --- a/storage/pipeline/states_replica_update.go +++ b/storage/pipeline/states_replica_update.go @@ -143,6 +143,10 @@ func (m *Sealing) handleSubmitReplicaUpdate(ctx statemachine.Context, sector Sec log.Errorf("handleSubmitReplicaUpdate: api error, not proceeding: %+v", err) return nil } + if onChainInfo == nil { + return xerrors.Errorf("sector not found %d", sector.SectorNumber) + } + sp, err := m.currentSealProof(ctx.Context()) if err != nil { log.Errorf("sealer failed to return current seal proof not proceeding: %+v", err) diff --git a/storage/pipeline/upgrade_queue.go b/storage/pipeline/upgrade_queue.go index 309e59573..9d9e1ca46 100644 --- a/storage/pipeline/upgrade_queue.go +++ b/storage/pipeline/upgrade_queue.go @@ -33,6 +33,9 @@ func (m *Sealing) MarkForUpgrade(ctx context.Context, id abi.SectorNumber) error if err != nil { return xerrors.Errorf("failed to read sector on chain info: %w", err) } + if onChainInfo == nil { + return xerrors.Errorf("sector not found %d", id) + } active, err := m.sectorActive(ctx, ts.Key(), id) if err != nil { diff --git a/storage/wdpost/wdpost_run_test.go b/storage/wdpost/wdpost_run_test.go index 140e0886e..64d470dba 100644 --- a/storage/wdpost/wdpost_run_test.go +++ b/storage/wdpost/wdpost_run_test.go @@ -19,6 +19,7 @@ import ( minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner" "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/go-state-types/network" prooftypes "github.com/filecoin-project/go-state-types/proof" tutils "github.com/filecoin-project/specs-actors/v2/support/testing" @@ -570,7 +571,7 @@ func (m *mockStorageMinerAPI) StateMinerProvingDeadline(ctx context.Context, add } func (m *mockStorageMinerAPI) StateGetActor(ctx context.Context, actor address.Address, ts types.TipSetKey) (*types.Actor, error) { - code, ok := actors.GetActorCodeID(actorstypes.Version7, actors.MinerKey) + code, ok := actors.GetActorCodeID(actorstypes.Version7, manifest.MinerKey) if !ok { return nil, xerrors.Errorf("failed to get miner actor code ID for actors version %d", actors.Version7) } diff --git a/tools/kibana/README.md b/tools/kibana/README.md new file mode 100644 index 000000000..c556ae10c --- /dev/null +++ b/tools/kibana/README.md @@ -0,0 +1,20 @@ +## Lotus Kibana Dashboard + +This folder contains configuration files to create Kibana dashboards to track peer scores and block propagation +throughout Filecoin network. + +### Importing index template + +Index template needs to be imported into Elasticsearch for score weights and to +prevent Elasticsearch from infering wrong field type. + +The [template](./index-template.json) is loaded via [Kibana Index Management](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-mgmt.html) and pasted +into newly created Index Template. + +### Importing dashboard + +The peer score and block propagation dashboard configuration is imported via Kibana import saved object [functionality](https://www.elastic.co/guide/en/kibana/current/managing-saved-objects.html#managing-saved-objects-export-objects). + +#### Custom index + +By default, the dashboards and index template target `lotus-pubsub` index which is the default one when running node. The index can be customised via edit on dashboard visualizations and also index template needs to be updated to target new index. diff --git a/tools/kibana/block-propagation-dashboard.ndjson b/tools/kibana/block-propagation-dashboard.ndjson new file mode 100644 index 000000000..c7b14c0c3 --- /dev/null +++ b/tools/kibana/block-propagation-dashboard.ndjson @@ -0,0 +1,2 @@ +{"attributes":{"description":"Force layout vega graph where link force distance between peers is block propagation","hits":0,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"optionsJSON":"{\"useMargins\":true,\"syncColors\":false,\"hidePanelTitles\":false}","panelsJSON":"[{\"version\":\"7.14.1\",\"type\":\"visualization\",\"gridData\":{\"x\":0,\"y\":0,\"w\":48,\"h\":42,\"i\":\"c7e4001d-38c9-4fa0-a488-e069dd50d274\"},\"panelIndex\":\"c7e4001d-38c9-4fa0-a488-e069dd50d274\",\"embeddableConfig\":{\"savedVis\":{\"title\":\"Block propagation\",\"description\":\"\",\"type\":\"vega\",\"params\":{\"spec\":\"{\\n $schema: https://vega.github.io/schema/vega/v5.json\\n title: Node block propagation\\n\\n\\n \\\"signals\\\": [\\n { \\\"name\\\": \\\"cx\\\", \\\"update\\\": \\\"width / 2\\\" },\\n { \\\"name\\\": \\\"cy\\\", \\\"update\\\": \\\"height / 2\\\" },\\n { \\\"name\\\": \\\"nodeRadius\\\", \\\"value\\\": 10,\\n \\\"bind\\\": {\\\"input\\\": \\\"range\\\", \\\"min\\\": 1, \\\"max\\\": 20, \\\"step\\\": 1} },\\n { \\\"name\\\": \\\"propagationMultiplier\\\", \\\"value\\\": 1,\\n \\\"bind\\\": {\\\"input\\\": \\\"range\\\", \\\"min\\\": 1, \\\"max\\\": 100, \\\"step\\\": 1} },\\n ],\\n\\n data: [\\n {\\n \\n name: \\\"node-data\\\",\\n url: {\\n index: lotus-pubsub\\n body: {\\n size: 0,\\n aggs: {\\n unique_peerID: {\\n terms: { \\n field: \\\"peerID\\\",\\n size: 10000\\n },\\n }\\n }\\n }\\n },\\n format: {\\\"property\\\": \\\"aggregations.unique_peerID.buckets\\\"},\\n transform: [\\n {\\n \\\"type\\\": \\\"project\\\",\\n \\\"fields\\\": [\\\"key\\\"],\\n \\\"as\\\": [\\\"peerID\\\"]\\n },\\n {\\n type: \\\"identifier\\\",\\n as: \\\"id\\\"\\n },\\n {\\n type: \\\"formula\\\",\\n expr: \\\"datum.id - 1\\\",\\n as: \\\"index\\\"\\n }\\n ]\\n },\\n {\\n name: \\\"published-message-data\\\",\\n url: {\\n index: lotus-pubsub\\n body: {\\n size: 10000,\\n query: {\\n bool: {\\n must: [\\n {\\n match: {\\n type: 0\\n }\\n }\\n ]\\n }\\n }\\n }\\n },\\n format: {\\\"property\\\": \\\"hits.hits\\\"},\\n },\\n {\\n name: \\\"link-data\\\",\\n url: {\\n index: lotus-pubsub\\n body: {\\n size: 10000,\\n query: {\\n bool: {\\n must: [\\n {\\n match: {\\n type: 1\\n }\\n }\\n ]\\n }\\n }\\n }\\n },\\n format: {\\\"property\\\": \\\"hits.hits\\\"},\\n transform: [\\n {\\n \\\"type\\\": \\\"lookup\\\",\\n \\\"from\\\": \\\"published-message-data\\\",\\n \\\"key\\\": \\\"_source.publishMessage.messageID\\\",\\n \\\"fields\\\": [\\\"_source.deliverMessage.messageID\\\"],\\n \\\"as\\\": [\\\"publishedMessage\\\"],\\n },\\n {\\n \\\"type\\\": \\\"filter\\\",\\n \\\"expr\\\": \\\"datum.publishedMessage != null\\\"\\n },\\n {\\n \\\"type\\\": \\\"lookup\\\",\\n \\\"from\\\": \\\"node-data\\\",\\n \\\"key\\\": \\\"peerID\\\",\\n \\\"fields\\\": [\\\"_source.peerID\\\"],\\n \\\"as\\\": [\\\"source\\\"],\\n },\\n {\\n \\\"type\\\": \\\"lookup\\\",\\n \\\"from\\\": \\\"node-data\\\",\\n \\\"key\\\": \\\"peerID\\\",\\n \\\"fields\\\": [\\\"publishedMessage._source.peerID\\\"],\\n \\\"as\\\": [\\\"target\\\"],\\n },\\n {\\n \\\"type\\\": \\\"formula\\\",\\n \\\"expr\\\": \\\"(datum._source.timestamp - datum.publishedMessage._source.timestamp) * propagationMultiplier\\\",\\n \\\"as\\\": \\\"distance\\\"\\n },\\n {\\n \\\"type\\\": \\\"project\\\",\\n \\\"fields\\\": [\\\"source.index\\\", \\\"target.index\\\", \\\"distance\\\"]\\n \\\"as\\\": [\\\"source\\\", \\\"target\\\", \\\"distance\\\"]\\n },\\n {\\n \\\"type\\\": \\\"aggregate\\\",\\n \\\"ops\\\": [\\\"average\\\"],\\n \\\"fields\\\": [\\\"distance\\\"],\\n \\\"groupby\\\": [\\\"source\\\", \\\"target\\\"],\\n \\\"as\\\": [\\\"distance\\\"]\\n }\\n ]\\n }\\n ]\\n\\n scales: [\\n {\\n \\\"name\\\": \\\"color\\\",\\n \\\"type\\\": \\\"ordinal\\\",\\n \\\"domain\\\": {\\\"data\\\": \\\"node-data\\\", \\\"field\\\": \\\"id\\\"},\\n \\\"range\\\": {\\\"scheme\\\": \\\"category20c\\\"}\\n }\\n ]\\n\\n marks: [\\n {\\n \\\"name\\\": \\\"nodes\\\",\\n \\\"type\\\": \\\"symbol\\\",\\n \\\"zindex\\\": 1,\\n \\n \\\"encode\\\": {\\n \\\"enter\\\": {\\n \\\"fill\\\": {\\\"scale\\\": \\\"color\\\", \\\"field\\\": \\\"id\\\"},\\n \\\"stroke\\\": {\\\"value\\\": \\\"black\\\"},\\n \\\"tooltip\\\": {\\\"signal\\\": \\\"{'PeerID': datum.peerID}\\\"}\\n },\\n \\\"update\\\": {\\n \\\"size\\\": {\\\"signal\\\": \\\"2 * nodeRadius * nodeRadius\\\"},\\n \\\"fill\\\": {\\\"scale\\\": \\\"color\\\", \\\"field\\\": \\\"id\\\"},\\n },\\n \\\"hover\\\": { \\\"fill\\\": {\\\"value\\\": \\\"red\\\"} },\\n },\\n\\n \\\"from\\\": {\\\"data\\\": \\\"node-data\\\"},\\n \\\"transform\\\": [\\n {\\n \\\"type\\\": \\\"force\\\",\\n \\\"restart\\\": false,\\n \\\"static\\\": true,\\n \\\"signal\\\": \\\"force\\\",\\n \\\"forces\\\": [\\n {\\\"force\\\": \\\"link\\\", \\\"links\\\": \\\"link-data\\\", distance: {field: \\\"distance\\\"}},\\n {\\\"force\\\": \\\"center\\\", \\\"x\\\": {\\\"signal\\\": \\\"cx\\\"}, \\\"y\\\": {\\\"signal\\\": \\\"cy\\\"}},\\n ]\\n }\\n ]\\n },\\n {\\n \\\"type\\\": \\\"path\\\",\\n \\\"from\\\": {\\\"data\\\": \\\"link-data\\\"},\\n \\\"encode\\\": {\\n \\\"enter\\\": {\\n \\\"tooltip\\\": {\\\"signal\\\": \\\"{'Block propagation': datum.distance}\\\"}\\n },\\n \\\"update\\\": {\\n \\\"stroke\\\": {\\\"value\\\": \\\"#ccc\\\"},\\n \\\"strokeWidth\\\": {\\\"value\\\": 1.5}\\n },\\n \\\"hover\\\": { \\\"stroke\\\": { \\\"value\\\": \\\"#0B33A0\\\" }}\\n },\\n \\\"transform\\\": [\\n {\\n \\\"type\\\": \\\"linkpath\\\",\\n \\\"require\\\": {\\\"signal\\\": \\\"force\\\"},\\n \\\"shape\\\": \\\"line\\\",\\n \\\"sourceX\\\": \\\"datum.source.x\\\", \\\"sourceY\\\": \\\"datum.source.y\\\",\\n \\\"targetX\\\": \\\"datum.target.x\\\", \\\"targetY\\\": \\\"datum.target.y\\\"\\n }\\n ]\\n }\\n ]\\n}\\n\"},\"uiState\":{},\"data\":{\"aggs\":[],\"searchSource\":{\"query\":{\"language\":\"kuery\",\"query\":\"\"},\"filter\":[]}}},\"enhancements\":{}}}]","timeRestore":false,"title":"Peer block propagation","version":1},"coreMigrationVersion":"7.14.1","id":"937b1470-212b-11ec-99f4-75d57f0cd0d8","migrationVersion":{"dashboard":"7.14.0"},"references":[],"type":"dashboard","updated_at":"2021-09-29T13:45:58.342Z","version":"Wzg4NzMsMV0="} +{"excludedObjects":[],"excludedObjectsCount":0,"exportedCount":1,"missingRefCount":0,"missingReferences":[]} diff --git a/tools/kibana/index-template.json b/tools/kibana/index-template.json new file mode 100644 index 000000000..f08298ad1 --- /dev/null +++ b/tools/kibana/index-template.json @@ -0,0 +1,66 @@ +{ + "template": { + "settings": {}, + "mappings": { + "runtime": { + "peerScore.weightedScore": { + "type": "double", + "script": { + "source": "if (doc['type'].value == 100) {\n def score = doc['peerScore.score'].value;\n if (doc['sourceAuth'] == \"\") {\n\n emit(score * 1.2)\n } else {\n emit(score)\n }\n}\n", + "lang": "painless" + } + } + }, + "properties": { + "peerScore": { + "properties": { + "appSpecificScore": { + "type": "double" + }, + "behaviourPenalty": { + "type": "double" + }, + "ipColocationFactor": { + "type": "double" + }, + "score": { + "type": "double" + }, + "topics": { + "type": "nested", + "properties": { + "firstMessageDeliveries": { + "type": "double", + "ignore_malformed": false, + "coerce": true + }, + "invalidMessageDeliveries": { + "type": "double", + "ignore_malformed": false, + "coerce": true + }, + "meshMessageDeliveries": { + "type": "double", + "ignore_malformed": false, + "coerce": true + }, + "timeInMesh": { + "type": "double", + "ignore_malformed": false, + "coerce": true + }, + "topic": { + "type": "keyword" + } + } + } + } + }, + "sourceAuth": { + "type": "keyword" + } + } + }, + "aliases": {} + } +} diff --git a/tools/kibana/peer-scores-dashboard.ndjson b/tools/kibana/peer-scores-dashboard.ndjson new file mode 100644 index 000000000..4df376ab3 --- /dev/null +++ b/tools/kibana/peer-scores-dashboard.ndjson @@ -0,0 +1,2 @@ +{"attributes":{"description":"Average peer score table per node peerID","hits":0,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"optionsJSON":"{\"useMargins\":true,\"syncColors\":false,\"hidePanelTitles\":false}","panelsJSON":"[{\"version\":\"7.14.1\",\"type\":\"lens\",\"gridData\":{\"x\":0,\"y\":0,\"w\":48,\"h\":43,\"i\":\"cddc98a5-45f3-4ba7-a7c6-6b9d216b19da\"},\"panelIndex\":\"cddc98a5-45f3-4ba7-a7c6-6b9d216b19da\",\"embeddableConfig\":{\"attributes\":{\"title\":\"\",\"type\":\"lens\",\"visualizationType\":\"lnsDatatable\",\"state\":{\"datasourceStates\":{\"indexpattern\":{\"layers\":{\"666e2f39-8868-45ad-b747-fe124830b0ae\":{\"columns\":{\"504c50bd-14c1-4119-820e-c961866fc3b4\":{\"label\":\"peerID\",\"dataType\":\"string\",\"operationType\":\"terms\",\"scale\":\"ordinal\",\"sourceField\":\"peerScore.peerID.keyword\",\"isBucketed\":true,\"params\":{\"size\":100,\"orderBy\":{\"type\":\"column\",\"columnId\":\"ec82c5f7-b3c4-4715-8646-a8fe584400fc\"},\"orderDirection\":\"desc\",\"otherBucket\":false,\"missingBucket\":false},\"customLabel\":true},\"ec82c5f7-b3c4-4715-8646-a8fe584400fc\":{\"label\":\"Score\",\"dataType\":\"number\",\"operationType\":\"average\",\"sourceField\":\"peerScore.score\",\"isBucketed\":false,\"scale\":\"ratio\",\"customLabel\":true},\"e22a19e8-1d71-43d6-9ca0-b30ddd423447\":{\"label\":\"Weighted Score\",\"dataType\":\"number\",\"operationType\":\"average\",\"sourceField\":\"peerScore.weightedScore\",\"isBucketed\":false,\"scale\":\"ratio\",\"customLabel\":true}},\"columnOrder\":[\"504c50bd-14c1-4119-820e-c961866fc3b4\",\"ec82c5f7-b3c4-4715-8646-a8fe584400fc\",\"e22a19e8-1d71-43d6-9ca0-b30ddd423447\"],\"incompleteColumns\":{}}}}},\"visualization\":{\"columns\":[{\"isTransposed\":false,\"columnId\":\"504c50bd-14c1-4119-820e-c961866fc3b4\"},{\"isTransposed\":false,\"columnId\":\"ec82c5f7-b3c4-4715-8646-a8fe584400fc\",\"colorMode\":\"cell\",\"palette\":{\"type\":\"palette\",\"name\":\"positive\",\"params\":{\"stops\":[{\"color\":\"#d6e9e4\",\"stop\":20},{\"color\":\"#aed3ca\",\"stop\":40},{\"color\":\"#85bdb1\",\"stop\":60},{\"color\":\"#5aa898\",\"stop\":80},{\"color\":\"#209280\",\"stop\":100}]}}},{\"columnId\":\"e22a19e8-1d71-43d6-9ca0-b30ddd423447\",\"isTransposed\":false,\"colorMode\":\"cell\",\"palette\":{\"type\":\"palette\",\"name\":\"positive\",\"params\":{\"stops\":[{\"color\":\"#d6e9e4\",\"stop\":20},{\"color\":\"#aed3ca\",\"stop\":40},{\"color\":\"#85bdb1\",\"stop\":60},{\"color\":\"#5aa898\",\"stop\":80},{\"color\":\"#209280\",\"stop\":100}]}}}],\"layerId\":\"666e2f39-8868-45ad-b747-fe124830b0ae\"},\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filters\":[]},\"references\":[{\"type\":\"index-pattern\",\"id\":\"9890c040-17b7-11ec-99f4-75d57f0cd0d8\",\"name\":\"indexpattern-datasource-current-indexpattern\"},{\"type\":\"index-pattern\",\"id\":\"2c407db0-1acb-11ec-99f4-75d57f0cd0d8\",\"name\":\"indexpattern-datasource-layer-666e2f39-8868-45ad-b747-fe124830b0ae\"}]},\"hidePanelTitles\":false,\"enhancements\":{}},\"title\":\"Peer Scores\"}]","timeRestore":false,"title":"Peer Scores","version":1},"coreMigrationVersion":"7.14.1","id":"e7e4fd70-1acb-11ec-99f4-75d57f0cd0d8","migrationVersion":{"dashboard":"7.14.0"},"references":[{"id":"2c407db0-1acb-11ec-99f4-75d57f0cd0d8","name":"cddc98a5-45f3-4ba7-a7c6-6b9d216b19da:indexpattern-datasource-current-indexpattern","type":"index-pattern"},{"id":"2c407db0-1acb-11ec-99f4-75d57f0cd0d8","name":"cddc98a5-45f3-4ba7-a7c6-6b9d216b19da:indexpattern-datasource-layer-666e2f39-8868-45ad-b747-fe124830b0ae","type":"index-pattern"}],"type":"dashboard","updated_at":"2021-09-24T12:06:00.625Z","version":"WzczNDgsMV0="} +{"excludedObjects":[],"excludedObjectsCount":0,"exportedCount":1,"missingRefCount":0,"missingReferences":[]}