Compare commits

...
276 Commits
Author SHA1 Message Date
jennijuju 94d9dee0dd update changelog 2022-05-02 11:33:46 -04:00
Jiaying Wang 8d0b28bda4 Merge pull request #8577 from filecoin-project/jen/logfix
deps: ffi: update ffi that includes the log fix
2022-05-02 11:24:56 -04:00
jennijuju 4d5e850aa9 update ffi that includes the log fix 2022-05-02 10:59:21 -04:00
Jiaying Wang ece51c5372 Merge pull request #8533 from filecoin-project/jen/v1522
chore: release: v1.15.2-rc2
2022-05-02 10:54:58 -04:00
jennijuju 48c54605ae release v1.15.2-rc2 2022-04-26 21:19:03 +02:00
Steven Allen 5b1800556b ci: fix linting 2022-04-25 14:13:16 +02:00
jennijuju bd9e8c7663 update go version thats needed by the new libp2p 2022-04-23 22:20:07 +02:00
vyzo efad692353 go mod tidy 2022-04-22 02:54:30 +02:00
vyzo 357da15e5c update go-libp2p@v0.19 2022-04-22 02:53:05 +02:00
vyzo cc328689e1 dear linter, using xerrors is what we want to do. 2022-04-22 02:51:15 +02:00
Masih H. Derkani d044e30e12 Infer index provider topic from network name by default
Index provider integration uses a gossipsub topic to announce changes to
the advertised content. The topic name was fixed to the default topic
which is `/indexer/ingest/mainnet`.

In the case of lotus, the gossipsub validators enforce a list of topics
the instance is permitted to join by setting subscription filter option
when `PubSub` instance is constructed via DI.

Having the fixed topic name meant that any SP starting up a node on a
network other than `mainnet` would have to override the default config
to avoid the node crashing when index provider is enabled.

Instead of a fixed default, the changes here infer the allowed indexer
topic name from network name automatically if the topic configuration is
left empty.

Fixes #8510
2022-04-22 02:46:05 +02:00
Jiaying Wang dcf6f64143 Merge pull request #8482 from filecoin-project/jen/11521
build: release: v1.15.2-rc1
2022-04-13 19:29:24 +02:00
jennijuju 372dd2ced9 v1.15.2-rc1 2022-04-13 19:11:02 +02:00
Jiaying Wang ce3c6472fb Merge pull request #8470 from filecoin-project/feat/enable-rcmgr-by-default
enable rcmgr by default
2022-04-12 16:12:03 +02:00
Łukasz Magiera cf92776c64 Merge pull request #8468 from filecoin-project/jen/mergeback
chore: merge releases back to master
2022-04-12 15:41:36 +02:00
Jiaying WangandŁukasz Magiera 1fc94e33b2 Co-authored-by: Łukasz Magiera <magik6k@users.noreply.github.com>
fix merge error
Co-authored-by: Łukasz Magiera <magik6k@users.noreply.github.com>
2022-04-12 15:29:54 +02:00
jennijuju 137f494619 tidy and gen 2022-04-12 13:53:03 +02:00
Łukasz Magiera df7e2a884b Merge pull request #8469 from filecoin-project/update-libp2p-rcmgr-optout
Update libp2p to v0.18.1
2022-04-12 12:02:24 +02:00
Łukasz Magiera ac57797904 Merge pull request #8464 from filecoin-project/feat/getask-protos
feat: cli: lotus client list-asks --protocols
2022-04-12 10:47:52 +02:00
vyzo 3c8aa18f70 enabled rcmgr by default; disable with LOTUS_RCMGR=0 2022-04-12 11:32:37 +03:00
vyzo 0f4019cbb7 update go-libp2p@v0.18.1 2022-04-12 11:30:24 +03:00
Aayush Rajasekaran 656a33863f Fixup merge 2022-04-11 20:45:13 -04:00
jennijuju 0dcad9cc18 Merge branch 'releases' into jen/mergeback 2022-04-12 01:25:02 +02:00
Łukasz Magiera 6bef1aeb82 feat: cli: lotus client list-asks --protocols 2022-04-11 19:49:52 +02:00
Łukasz Magiera 3cd563622e Merge pull request #8439 from filecoin-project/revert-appimage-removal
Revert appimage removal
2022-04-11 19:24:36 +02:00
Łukasz Magiera 66f88773c0 Merge pull request #8461 from filecoin-project/fix/release-unseal-nosnap-panic
sealing: Don't panic in ReleaseUnsealed with no ranges
2022-04-09 21:40:35 +02:00
Łukasz Magiera 3ecb1fd5d9 sealing: Don't panic in ReleaseUnsealed with no ranges 2022-04-09 20:58:47 +02:00
Łukasz Magiera 7900479e9c Merge pull request #8447 from filecoin-project/feat/sched-better
feat: sched: Improve worker assigning logic
2022-04-09 20:50:31 +02:00
Łukasz Magiera e2f4c70b70 Merge pull request #8452 from filecoin-project/asr/fvm-consensus-fault
fix: FVM: add finality check for consensus faults
2022-04-07 13:07:40 -04:00
Aayush d1c0b8b0c9 fix: FVM: add finality check for consensus faults 2022-04-07 12:22:07 -04:00
Łukasz Magiera 20698a7843 Merge pull request #8446 from filecoin-project/disable-publish-packer
chore: ci: disable publish-packer
2022-04-07 10:44:13 -04:00
Cory Schwartz a4c24985e8 disable publish-packer 2022-04-07 10:32:15 -04:00
Łukasz Magiera b26ac2bd0e Merge pull request #8450 from filecoin-project/fix/testkit-rpc-shutdown
testkit: give up on waiting for the RPC server to shutdown after 1s
2022-04-07 08:06:46 -04:00
dirkmcandAnton Evangelatov c34ade9ffb Update itests/kit/rpc.go
Co-authored-by: Anton Evangelatov <anton.evangelatov@gmail.com>
2022-04-07 13:32:00 +02:00
Dirk McCormick 5f0489ace0 fix: testkit: give up on waiting for the RPC server to shutdown after 1 second 2022-04-07 12:22:36 +02:00
Łukasz Magiera 80133aaa79 feat: sched: Improve worker assigning logic 2022-04-06 18:24:14 -04:00
Łukasz Magiera 6de4e3d4cd feat: sched: Cache worker tasks 2022-04-06 18:24:14 -04:00
Łukasz Magiera f652dd3436 Merge pull request #8441 from filecoin-project/frrist/observer-deregister
chore: events: implement event observer deregister method
2022-04-06 18:22:41 -04:00
Łukasz Magiera 9f98d0ae4a Merge pull request #8443 from filecoin-project/masih/idxprov-reuse-pubsub
fix: market: Reuse the market `PubSub` in index provider
2022-04-06 17:51:46 -04:00
Masih H. Derkani f369d99138 Fix DI of PubSub in markets by binding dependencies it needs
Bind drand and bootstrap peers config so that `PubSub` instantiated by
`ConfigCommon` has all the dependencies it needs when `PubSub` instance
is needed in markets. In ths case, the instance is needed by the index
provider engine to announce new indexing advertisements.
2022-04-06 20:04:39 +01:00
Masih H. Derkani 7e7e88e330 Reuse the market process PubSub instance in index provider engine
The markets process instantiates its own `PubSub` instance with all
validators, peer scoring, etc. set up. Use that instane to join the
indexing topic, otherwise the default topic instantiated by
index-provider internally (via go-legs) has no validators.
2022-04-06 19:39:12 +01:00
frrist 20bf46f309 chore: events: implement event observer deregister method 2022-04-06 11:01:18 -07:00
Łukasz Magiera f378c6d3ee Merge pull request #8444 from filecoin-project/masih/fix-idxprov-config
fix: market: set all index provider options based on lotus config
2022-04-06 11:59:37 -04:00
Masih H. Derkani b88307f875 Set index provider options based on lotus config
Always set index provider options based on the lotus configuration.
Otherwise, they will have no effect.
2022-04-06 16:08:10 +01:00
Łukasz Magiera 8a16e1ca7d Merge pull request #8440 from filecoin-project/chore/update-fvm
chore: ffi: update the FFI to update the FVM
2022-04-05 21:36:42 -04:00
Steven Allen 39dee1410b chore: ffi: update the FFI to update the FVM
This fixes the build on aarch64.
2022-04-05 21:25:00 -04:00
Cory Schwartz c715254d54 Revert "stop publishing appimagine since its disabled by #7707"
This reverts commit 6b0868089b.
2022-04-05 17:26:44 -07:00
Cory Schwartz d1f3ab5dec Revert "remove from the bundlde"
This reverts commit 7d65a2664d.
2022-04-05 17:26:39 -07:00
Łukasz Magiera 0fa74a7712 Merge pull request #8438 from filecoin-project/fix/release-unseal-snap-abort
fix: sealing: Release unsealed sector files after snapdeals abort
2022-04-05 18:26:20 -04:00
Łukasz Magiera 68f3e4483f fix: sealing: Release unsealed sector files after snapdeals abort 2022-04-05 16:45:07 -04:00
Łukasz Magiera e1ef1b759e Merge pull request #8206 from firesWu/fix/optimize-worker-tracker-lock
release worker tracker lock when call cb func
2022-04-05 12:53:09 -04:00
Łukasz Magiera 1bd0f55945 Merge pull request #8425 from filecoin-project/fix/market-node-startup
fix: node: Fix market node startup
2022-04-03 14:55:19 -04:00
Łukasz Magiera a40381a700 Merge pull request #8426 from filecoin-project/feat/multi-vlog2car
feat: shed: Multi-file vlog2car
2022-04-02 18:00:21 -04:00
Łukasz Magiera 9a34f5803c feat: shed: Multi-file vlog2car 2022-04-02 13:25:14 -04:00
Łukasz Magiera 2b3fad1261 fix: node: Fix market node startup 2022-04-01 17:32:55 -04:00
Jiaying Wang e74e56947b Merge pull request #8424 from filecoin-project/jen/ffibump
deps: ffi: pull ffi that includes the latest fvm
2022-04-01 17:01:49 -04:00
Jennifer Wang ce0b8149e9 pull ffi that includes the latest fvm 2022-04-01 15:58:15 -04:00
Aayush Rajasekaran 940505569c Merge pull request #8422 from filecoin-project/asr/log
Update to go-log 2.5.1
2022-04-01 09:41:26 -04:00
Aayush Rajasekaran 8c46d00ee7 Update to go-log 2.5.1 2022-04-01 01:13:55 -04:00
Łukasz Magiera e19c5bfcd7 Merge pull request #8413 from filecoin-project/packer-publish-copy-orb
Packer publish copy orb
2022-03-31 18:45:40 -04:00
Łukasz Magiera f9ae5c0cb3 Merge pull request #8420 from filecoin-project/fix/8226
fix: sealing: Fix PR1 worker selection
2022-03-31 17:52:45 -04:00
Łukasz Magiera ac82366b9e fix: sealing: Fix PR1 worker selection 2022-03-31 17:01:33 -04:00
Cory Schwartz b493855195 fix template 2022-03-30 23:10:17 -07:00
Cory Schwartz 4bb8865e2f fix template 2022-03-30 22:57:02 -07:00
Cory Schwartz 9c25aea327 restore filters 2022-03-30 22:53:57 -07:00
Cory Schwartz cc5e96b23f use 1.8 2022-03-30 22:35:20 -07:00
Cory Schwartz 0095d93686 add packer executor 2022-03-30 22:30:17 -07:00
Cory Schwartz 1da3e2c711 copy packer_build source 2022-03-30 22:27:18 -07:00
Cory Schwartz 73468e706e tmp: remove filters 2022-03-30 22:03:41 -07:00
Cory Schwartz 4894e0b18d add debug 2022-03-30 22:02:43 -07:00
Łukasz Magiera f155b3003b Merge pull request #8411 from filecoin-project/deps/update-data-transfer-fix-master
chore(deps): update go-data-transfer with fixes (master edition)
2022-03-30 15:11:26 -04:00
hannahhoward 4974b6874e chore(deps): update go-data-transfer with fixes 2022-03-30 14:59:31 -04:00
Łukasz Magiera 1fac7981a4 Merge pull request #8410 from filecoin-project/feat/go-1.18
fix: go: make Go 1.18 builds work
2022-03-30 14:56:19 -04:00
Łukasz Magiera 0c6f3ee19c fix lotus-sim build 2022-03-30 14:34:20 -04:00
Łukasz Magiera 12752c6970 Merge github.com:koalacxr/lotus into feat/go-1.18 2022-03-30 14:31:32 -04:00
Łukasz Magiera 39c38c44a3 Merge pull request #8404 from simlecode/fix/not_check_error
fix: sealing: Added error checking
2022-03-29 22:57:35 -04:00
simlecode f0944030b7 Added error checking 2022-03-30 10:28:56 +08:00
Aayush Rajasekaran 7eb7edb950 Merge pull request #8402 from filecoin-project/jen/ffiupdate
deps: update ffi with actor v7.1.0 and fvm that uses the bundle that includes the new manifest
2022-03-29 21:17:33 -04:00
Jennifer Wang b8e412884b deps: update ffi with actor v7.1.0 and fvm that uses the bundle that includes the new manifest 2022-03-29 20:49:40 -04:00
Łukasz Magiera 3ce467a25f Merge pull request #8391 from filecoin-project/feat/parallel-fault-check
feat: storage: Parallel proving checks
2022-03-29 16:36:12 -04:00
Łukasz Magiera 0710342317 fix waiting in sector proving checks 2022-03-29 15:28:37 -04:00
Łukasz Magiera d95f24b9d2 config: Sane default parallel sector read defaults 2022-03-29 14:52:37 -04:00
Łukasz Magiera c456836ad5 Merge pull request #8400 from filecoin-project/asr/update
Update to specs-storage v0.2.2
2022-03-29 14:23:07 -04:00
Aayush be418e77f9 Update to specs-storage v0.2.2 2022-03-29 14:08:55 -04:00
Łukasz Magiera ebd34f1884 feat: storage: Parallel proving checks 2022-03-29 11:45:08 -04:00
Łukasz Magiera ba2596e318 Merge pull request #8397 from filecoin-project/feat/thread-safe-piecereader
Thread safe piecereader
2022-03-29 11:22:19 -04:00
Aarsh Shah d0af0eff9f thread safe piecereader 2022-03-29 19:41:06 +05:30
Łukasz Magiera d502eeba2b Merge pull request #8389 from filecoin-project/feat/manual-wdpost
feat: miner: API/CLI to compute window-post
2022-03-28 21:20:06 -04:00
Łukasz Magiera 064c3d473c Merge pull request #8390 from filecoin-project/feat/worker-ulimitn-check
feat: worker: check fd limit on startup
2022-03-28 18:33:26 -04:00
Łukasz Magiera 5a42083abd feat: worker: check fd limit on startup 2022-03-28 18:07:54 -04:00
Łukasz Magiera 54cb55a7ae feat: miner: API/CLI to compute window-post 2022-03-28 17:06:51 -04:00
Łukasz Magiera a709a0a682 Merge pull request #8384 from rjan90/fix/change-worker-msg
fix: ux: Change Propose-worker msg
2022-03-28 12:57:01 -04:00
Łukasz Magiera 029610fb40 Merge pull request #8386 from zl03jsj/fix/dead_loop_on_remove_sector
fix: miner: dead loop on removing sector
2022-03-28 12:51:53 -04:00
zl 1646edf513 fix: dead loop on removing a sector 2022-03-28 20:51:57 +08:00
Rjan e2781ea0f2 Change test to reflect renaming
Change what string the TestWorkerKeyChange-test is looking for, to reflect the new Propose-worker msg-changes
2022-03-28 10:04:47 +02:00
Rjan 555ff81cbf Add punctuation. 2022-03-28 09:46:08 +02:00
Rjan bfc2cc3aa3 fix: ux: Change Propose-worker msg
Changes the message so it´s clear that it´s only Storage Providers without active deadlines that needs to call 'confirm-change-worker'.
2022-03-28 08:18:30 +02:00
Jiaying Wang b8b33c4f06 Merge pull request #8381 from filecoin-project/jen/ffi
chore: ffi: the latest fvm release
2022-03-26 22:57:02 -04:00
Jennifer Wang f2fa2f5067 chore: ffi: the latest fvm release 2022-03-26 22:45:47 -04:00
Łukasz Magiera 001de1a915 Merge pull request #8379 from filecoin-project/feat/proving-workers-cli
feat: miner cli: Separate proving workers command
2022-03-26 16:36:00 -04:00
Łukasz Magiera f0f0fe38a3 Merge pull request #8380 from filecoin-project/feat/worker-type-logic
fix: worker: Fix default value handling
2022-03-26 16:35:38 -04:00
Łukasz Magiera 2498da742d fix: worker: Fix default value handling 2022-03-26 16:26:19 -04:00
Łukasz Magiera ad684ed0ea feat: miner cli: Separate proving workers command 2022-03-26 16:16:25 -04:00
Łukasz Magiera 0d7d02da35 Merge pull request #8378 from filecoin-project/feat/move-makedealsector-cfg
feat: config: Move MakeNewSectorForDeals config into the Sealing sectoin
2022-03-26 16:08:21 -04:00
Łukasz Magiera b78892934b feat: config: Move MakeNewSectorForDeals config into the Sealing sectoin 2022-03-26 15:50:21 -04:00
Aayush Rajasekaran c50b63c5f6 Merge pull request #8374 from filecoin-project/revert-8119-travis/fvm-interopnet
Revert "Update params for interopnet for fvm"
2022-03-25 22:26:35 -04:00
Aayush Rajasekaran b0ff3dfb90 Revert "Update params for interopnet for fvm" 2022-03-25 22:21:36 -04:00
Łukasz Magiera 7401fa234e Merge pull request #7971 from filecoin-project/feat/post-worker
feat: PoSt workers
2022-03-25 20:31:49 -04:00
Łukasz Magiera 7a009abcdd sealing: Fix TaskType.WorkerType 2022-03-25 18:54:59 -04:00
Aayush Rajasekaran b305244405 Merge pull request #8119 from filecoin-project/travis/fvm-interopnet
Update params for interopnet for fvm
2022-03-25 17:28:41 -04:00
Aayush 02a0770436 Caterpillarnet 2022-03-25 17:05:45 -04:00
Florian Ruen 196030bee2 fix: cli: Reset miner/ask lists in interactive deal 'miner' step (#8155)
* Update client.go

Bug fixed : if hitting return instead of filling with a valid value, the CLI crashed (line 796)
Change return err by continue to ask a valid value again

* Fix #8100

Bug fixed : if hitting return instead of filling with a valid value, the CLI crashed (line 796)
Change return err by continue to ask a valid value again

* lint reported errors on CircleCI

Commit to fix lint reported errors during tests on CircleCI
(remove blank lines x2)

* lint reported errors on CircleCI

Commit to fix lint reported errors during tests on CircleCI
(remove trailling whitespace)

* Fix #8095
Clear the list of miner addresses and successfull get-asked before asking for new ones
Previous behavior : if get-ask failed for miner(s), the faulty miner will be retried each time,
so you have to stop the command and start again to change this faulty miner (instead of removing from the list on the new attempt)

* Clear the list of miner addresses and successfull get-asked before asking for new ones
Previous behavior : if get-ask failed for miner(s), the faulty miner will be retried each time,
so you have to stop the command and start again to change this faulty miner (instead of removing from the list on the new attempt)
2022-03-25 17:05:19 -04:00
Łukasz Magiera d49297f898 Merge pull request #8371 from filecoin-project/raulk/shed-compute-state-range
feat: lotus-shed: add command to compute state over a range of tipsets.
2022-03-25 17:00:35 -04:00
Łukasz Magiera b5ce847579 Merge pull request #8372 from filecoin-project/chore/gomock-temp-cleanup
chore: Remove temp gomock reflect file
2022-03-25 16:57:13 -04:00
Łukasz Magiera 7dc19bb26e Merge pull request #8369 from filecoin-project/asr/pricelist
VM: Refactor pricelist to be based on network versions
2022-03-25 16:50:52 -04:00
Łukasz Magiera 82343a06e7 Merge remote-tracking branch 'origin/master' into feat/post-worker 2022-03-25 16:49:46 -04:00
Łukasz Magiera 5f9753933a chore: Remove temp gomock reflect file 2022-03-25 16:46:50 -04:00
Łukasz Magiera fcaad20ecc cli: Update docs 2022-03-25 16:28:08 -04:00
Łukasz Magiera f1ddb55252 worker: Fix challengeThrottle 2022-03-25 16:07:47 -04:00
Łukasz Magiera 69e8516d1f stores: log 404 in remote.GenerateSingleVanillaProof 2022-03-25 15:37:35 -04:00
Łukasz Magiera d437f19aae Merge pull request #8349 from filecoin-project/feat/faulty-cli-utils
feat: miner cli: proving check --faulty, faults in storage list sectors
2022-03-25 15:29:27 -04:00
Raúl Kripalani 977e302e0c lotus-shed: add command to compute state over a range of tipsets. 2022-03-25 19:12:16 +00:00
Aayush 0bfbcfb5e9 stmgr: GetNtwkVersion: return genesis network version before the first upgrade 2022-03-25 15:09:14 -04:00
Łukasz Magiera 7c4d3a457c Merge pull request #8343 from filecoin-project/feat/more-snap-config
feat: sealing: More SnapDeals config knobs
2022-03-25 15:07:00 -04:00
Aayush 25b2e144b8 VM: Refactor pricelist to be based on network versions 2022-03-25 15:06:10 -04:00
Łukasz Magiera 11db419735 Merge pull request #8357 from filecoin-project/feat/net-ping
feat: cli/net: implement 'net ping' command
2022-03-25 14:57:21 -04:00
Łukasz Magiera 4e2d7fe1db Merge pull request #8370 from rjan90/ux/sectors-snap-up
fix:snapup: Rename error message
2022-03-25 14:33:20 -04:00
Rjan 910d3caacf fix:snapup: Rename error message
Renaming the the error-message you get if you try to snap-up the same sector twice, to better reflect that you are snapping a sector, and not marki-for-upgrade, which now has been deprecated.
2022-03-25 16:39:53 +01:00
Jiaying Wang a449937682 Merge pull request #8368 from rjan90/fix/ux-msig-create
fix: multisig: Print "waiting for confirmation.."
2022-03-25 11:15:15 -04:00
Łukasz Magiera 0b3144f566 workers: PoSt challenge throttle/timeout config 2022-03-24 19:42:44 -04:00
Łukasz Magiera 13701c7ce2 wdpost: Lock update files in snapped sectors 2022-03-24 18:43:08 -04:00
Łukasz Magiera 3f152ae2bf workers: cmd/lotus-seal-worker->cmd/lotus-worker 2022-03-24 18:37:01 -04:00
Łukasz Magiera a53dc5a7c7 workers: WorkerType mehdod on SealTask 2022-03-24 18:28:45 -04:00
Rjan da64f241eb Print "waiting for confirmation.." in msigCreateCmd
Prints an addition "waiting for confirmation.." when running `lotus msig create [address1 address2]` to indicate that command is waiting for the msg to be mined into block, and not just hanging.

Should fix #4053
2022-03-24 16:11:24 +01:00
Jiaying Wang caeeb6a7d9 Merge pull request #8363 from filecoin-project/asr/fvm-log
chore: FVM: log when fvm is used
2022-03-23 13:43:35 -04:00
Aayush 694c45cd65 FVM: log when fvm is used 2022-03-23 13:19:28 -04:00
Łukasz Magiera dbc6b32a4c Merge pull request #8361 from filecoin-project/gstuart/set-ask-optional-params
--max-piece-size in set-ask is no longer required
2022-03-23 16:08:35 +01:00
Geoff Stuart 5ba4a78657 --max-piece-size in set-ask is no longer required 2022-03-22 22:05:06 -04:00
Steven Allen 1609317ac8 Merge pull request #8358 from filecoin-project/asr/vm-memstore
feat: stmgr: call: use a buffered concurrent-access blockstore
2022-03-21 21:08:12 -04:00
Aayush 3a121f99c7 stmgr: call: use a buffered concurrent-access blockstore 2022-03-21 19:32:18 -04:00
Łukasz Magiera 56b97e1386 lotus-worker: default non-exclusive flags to false when exclusive flag is set 2022-03-21 19:53:43 +01:00
Aayush Rajasekaran 3a62c8b4a2 Merge pull request #8356 from filecoin-project/fix/wallet-init-type
fix: lotus-wallet: pass correct repo type to repo.Init
2022-03-21 11:59:39 -04:00
Łukasz Magiera 1a0fc75325 Merge pull request #8353 from filecoin-project/fix/ru-retry-loop
fix: sealing: always do cooldown in handleSubmitReplicaUpdateFailed
2022-03-21 16:38:44 +01:00
Łukasz Magiera 945b93590d ping: Match go-ipfs in cmd output 2022-03-21 15:11:19 +01:00
Łukasz Magiera 701d0a111e Merge branch 'feat/net-ping' of github.com:ychiaoli18/lotus into feat/net-ping 2022-03-21 13:06:11 +01:00
Łukasz Magiera 3c1edca902 Merge pull request #8351 from filecoin-project/asr/vm-memstore
fix: avoid racy memstores when estimating gas
2022-03-21 12:12:28 +01:00
Łukasz Magiera 92e4caa151 Merge remote-tracking branch 'origin/master' into feat/post-worker 2022-03-21 12:09:47 +01:00
Łukasz Magiera e767981aaf itests: Fix ccupgrade post test 2022-03-21 12:07:00 +01:00
Łukasz Magiera 0536eb898d itests: Share WaitForSectorActive correctly 2022-03-21 12:07:00 +01:00
Łukasz Magiera 433e9c351d config: Fix doc on PreferNewSectorsForDeals; gofmt 2022-03-21 12:07:00 +01:00
Łukasz Magiera 49a6d7ebcc itests: Breakup ccupgrade_test.go 2022-03-21 12:07:00 +01:00
Łukasz Magiera 4c25358a08 itests: Test Sealing.MakeCCSectorsAvailable 2022-03-21 12:07:00 +01:00
Łukasz Magiera ecd1ab4b42 itests: Test Sealing.PreferNewSectorsForDeals 2022-03-21 12:07:00 +01:00
Łukasz Magiera 97a73f1c29 sealing: More SnapDeals config knobs 2022-03-21 12:04:23 +01:00
Łukasz Magiera d118ef9202 Merge pull request #8355 from filecoin-project/deps/update-libp2p
deps: update go-libp2p to v0.18 release
2022-03-21 12:00:49 +01:00
Łukasz Magiera 3cd17f0ee4 fix: lotus-wallet: pass correct repo type to repo.Init 2022-03-21 12:00:37 +01:00
Łukasz Magiera fc34d9ba1c Merge pull request #8086 from filecoin-project/nonsense/refactor-nodetype
refactor: convert RepoType from int to interface
2022-03-21 11:57:39 +01:00
Łukasz Magiera 1eb101d70e Merge pull request #8354 from filecoin-project/nonsense/extract-unixfs-filestore
lib: extract unixfs filestore into lib
2022-03-21 11:47:14 +01:00
vyzo 7fea2e4d6c update go-libp2p to v0.18 2022-03-21 12:33:07 +02:00
Łukasz Magiera cca69a6c16 gen 2022-03-21 10:49:30 +01:00
Anton Evangelatov 0ed8647b6f extract unixfs filestore into lib 2022-03-21 10:48:52 +01:00
Łukasz Magiera 58843857e5 fix: sealing: always do cooldown in handleSubmitReplicaUpdateFailed 2022-03-21 10:32:03 +01:00
Łukasz Magiera efdcd00da4 Merge pull request #7956 from filecoin-project/nonsense/add-lotus-test-image-building
feat: infra/ci: add `lotus-test` image as CI build step
2022-03-21 10:26:37 +01:00
Anton Evangelatov fee69a889b modify .circleci/template.yml 2022-03-21 08:41:30 +01:00
Aayush 4af8b8ecf3 fix: avoid racy memstores when estimating gas 2022-03-20 16:25:38 -04:00
Łukasz Magiera 9a31b65cd0 feat: miner cli: proving check --faulty, faults in storage list sectors 2022-03-19 12:55:52 +01:00
Łukasz Magiera 5365ccfdb1 cli: Show separate worker types in miner info 2022-03-18 21:31:15 +01:00
Łukasz Magiera 36f1dd7bb3 itests: Fix flaky TestWindowPostWorkerSkipBadSector 2022-03-18 20:51:47 +01:00
Łukasz Magiera 7b81369c8c wdpost: Don't attempt to snark with skipped sectors 2022-03-18 19:45:25 +01:00
Łukasz Magiera 7a1beacd00 ffiwrapper: Test some assumptions about GeneratePoStFallbackSectorChallenges 2022-03-18 13:11:14 +01:00
Łukasz Magiera 32818c528f wdpost: Test repro broken challenge skipping 2022-03-18 12:32:16 +01:00
Anton Evangelatov 0d6493ec3f resolve merge conflicts with master 2022-03-18 12:28:22 +01:00
Łukasz Magiera 8715745feb wdpost: Dedupe skipped sectors in generateWindowPoSt 2022-03-18 12:10:42 +01:00
Łukasz Magiera aa124cf414 fix lint issues 2022-03-18 11:38:27 +01:00
Łukasz Magiera a94e47c6be Merge pull request #8345 from filecoin-project/fix/itest-minepost-hang
fix: itests: Don't hang on exit in MineBlocksMustPost
2022-03-18 11:27:51 +01:00
Łukasz Magiera 6ddbe41376 Merge remote-tracking branch 'origin/master' into feat/post-worker 2022-03-18 10:54:44 +01:00
Łukasz Magiera 42b2adddee fix: itests: Don't hang on exit in MineBlocksMustPost 2022-03-18 10:42:21 +01:00
Łukasz Magiera 18987f92ee Merge pull request #8340 from filecoin-project/arajasek-patch-1
Shed: fix error message
2022-03-17 17:48:02 +01:00
Łukasz Magiera b26405226e Merge pull request #8336 from filecoin-project/fix/snap-list-estimate
fix: miner cli: Estimate deal weight in sector list when upgrading
2022-03-17 17:30:41 +01:00
Aayush Rajasekaran e1c7f30e60 Shed: fix error message 2022-03-17 12:24:32 -04:00
Łukasz Magiera b366e2c91f Merge pull request #8337 from filecoin-project/fix/fin-sealed-acc
fix: sealing: FinalizeSector doesn't need sealed replica access
2022-03-17 16:58:51 +01:00
Łukasz Magiera eb4bda2302 Merge pull request #8338 from filecoin-project/fix/fsm-badevt-loop
fix: storagefsm: Fix error loop on bad event
2022-03-17 16:58:17 +01:00
Łukasz Magiera d9a1ecd387 fix: storagefsm: Fix error loop on bad event 2022-03-17 15:40:11 +01:00
Łukasz Magiera 9debd14b6c fix: sealing: FinalizeSector doesn't need sealed replica access 2022-03-17 15:15:54 +01:00
Łukasz Magiera ff14cd3f9d fix: Estimate deal weight in sector list when upgrading 2022-03-17 14:52:54 +01:00
Łukasz Magiera e0481bbeca Merge pull request #8281 from spark8899/change-worker
feat:  multisig: lotus-sheed miner-multisig change-worker command.
2022-03-17 13:55:30 +01:00
Łukasz Magiera 73ab064137 Merge pull request #8295 from Juneezee/test/t.TempDir
test: use `T.TempDir` to create temporary test directory
2022-03-17 12:30:41 +01:00
Łukasz Magiera 2cf0e4cb32 #8281: Apply suggestions from code review 2022-03-17 12:30:02 +01:00
Łukasz Magiera 7123b29f06 Merge pull request #8241 from rjan90/master
fix: cli: add ArgsUsage field to clientGetDealCmd
2022-03-17 12:19:49 +01:00
Łukasz Magiera 037e80c70c gofmt 2022-03-17 12:10:24 +01:00
Łukasz Magiera 1c055fe83b Merge branch 'master' into test/t.TempDir 2022-03-17 12:06:52 +01:00
Łukasz Magiera 858538284f Merge pull request #8305 from filecoin-project/asr/shed-label
Shed: Add a tool to check UTF-8 validity of labels
2022-03-17 12:05:52 +01:00
Aayush Rajasekaran 97c95a4e82 Update FFI 2022-03-16 17:30:47 -04:00
Łukasz Magiera a3bdd29615 Merge pull request #8330 from filecoin-project/feat/snap-queue
feat: sealing: Sector upgrade queue
2022-03-16 22:24:45 +01:00
Łukasz Magiera a431fdbdde miner cli: Treat Activating sectors like Proving in sectors list 2022-03-16 22:16:39 +01:00
Łukasz Magiera 60ba133fc8 sealing: Rename Sealing.creating to a less confusing name 2022-03-16 21:29:57 +01:00
Aayush Rajasekaran 90d78f924f Merge pull request #8293 from filecoin-project/feat/fvm
Filecoin Virtual Machine integration
2022-03-16 15:51:56 -04:00
Łukasz Magiera 3b2a1ea41d sealing: fix lint issues 2022-03-16 20:28:15 +01:00
Łukasz Magiera 2961f3b864 sealing: regenerate mocks 2022-03-16 20:20:07 +01:00
Łukasz Magiera 3f23cf0c1e sealing: Enforce minimum expiration in tryGetUpgradeSector 2022-03-16 20:17:20 +01:00
Łukasz Magiera aac1f5abef sealing: Fix build 2022-03-16 20:09:18 +01:00
Łukasz Magiera 724d80cf02 sealing: Address snap queue review 2022-03-16 20:04:48 +01:00
Łukasz Magiera e7ee5b5932 sealing: Run more checks when considering Available sectors 2022-03-16 19:57:37 +01:00
Łukasz Magiera 4d4739497d sealing: Use bitfields in sectorActive 2022-03-16 19:53:00 +01:00
Łukasz Magiera 4ded059a1c sealing: Add MakeCCSectorsAvailable config 2022-03-16 19:29:47 +01:00
Łukasz Magiera 799d3ebe5e itests: Test reverting Available sectors to Proving 2022-03-16 19:05:53 +01:00
Łukasz Magiera 628102ab6c sealing: Support abort uprade for Available sectors 2022-03-16 18:53:54 +01:00
Łukasz Magiera f2c0ba1df5 Merge pull request #8329 from filecoin-project/fix/snap-worker-cleanup
fix: sealing: Remove sector copies from workers after snapdeals
2022-03-16 18:48:21 +01:00
79453663b3 feat: Add additional test annotations (#8272)
* Annotate api,proxy_util,blockstore_badger, policy tests

* Annotate splitstore: bsbadger / markset

* Annotate splitstore feature

* Annotate union/timed blockstore tests

* Annotate openrpc, diff_adt tests

* Annotate error,drand,events tests

* Annotate predicates_test

* Fix annotations

* Annotate tscache, gen tests

* Annotate fundmanager test

* Annotate repub and selection tests

* Annotate statetree_test

* Annotate forks_test

* Annotate searchwait_test.go

* Fix duplicated @@ symbols

* Annotate chain stmgr/store tests

* Annotate more (types) tests

* More tests annotated

* Annotate conformance chaos actor tests

* Annotate more integration tests

* Annotate journal system tests

* Annotate more tests.

* Annotate gas,head buffer behaviors

* Fix markset annotations

* doc: test annotations for the markets dagstore wrapper

* Annotate miner_api test in dagstore

* Annotate more test files

* Remove bad annotations from fsrepo

* Annotate wdpost system

* Remove bad annotations

* Renamce "conformance" to "chaos_actor" tests

* doc: stm annotations for blockheader & election proof tests

* Annotate remaining "A" tests

* annotate: stm for error_test

* memrepo_test.go

* Annotate "b" file tests

* message_test.go

* doc: stm annotate for fsrepo_test

* Annotate "c" file tests

* Annotate "D" test files

* message_test.go

* doc: stm annotate for chain, node/config & client

* docs: stm annotate node_test

* Annotate u,v,wl tests

* doc: stm annotations for various test files

* Annotate "T" test files

* doc: stm annotate for proxy_util_test & policy_test

* doc: stm annotate for various tests

* doc: final few stm annotations

* Add mempool unit tests

* Add two more memPool Add tests

* Update submodules

* Add check function tests

* Add stm annotations, refactor test helper

* Annotate api,proxy_util,blockstore_badger, policy tests

* Annotate splitstore: bsbadger / markset

solving merge conflicts

* Annotate splitstore feature

* Annotate union/timed blockstore tests

* Annotate openrpc, diff_adt tests

* Annotate error,drand,events tests

* Annotate predicates_test

* Fix annotations

* Annotate tscache, gen tests

* Annotate fundmanager test

* Annotate statetree_test

* Annotate forks_test

* Annotate searchwait_test.go

* Fix duplicated @@ symbols

* Annotate chain stmgr/store tests

* Annotate more (types) tests

* More tests annotated

* Annotate conformance chaos actor tests

* Annotate more integration tests

* Annotate journal system tests

* Annotate more tests.

* Annotate gas,head buffer behaviors

solve merge conflict

* Fix markset annotations

* Annotate miner_api test in dagstore

* Annotate more test files

* doc: test annotations for the markets dagstore wrapper

* Annotate wdpost system

* Renamce "conformance" to "chaos_actor" tests

* Annotate remaining "A" tests

* doc: stm annotations for blockheader & election proof tests

* annotate: stm for error_test

* Annotate "b" file tests

* memrepo_test.go

* Annotate "c" file tests

* message_test.go

* Annotate "D" test files

* doc: stm annotate for fsrepo_test

* Annotate u,v,wl tests

* message_test.go

* doc: stm annotate for chain, node/config & client

* docs: stm annotate node_test

* Annotate "T" test files

* doc: stm annotations for various test files

* Add mempool unit tests

solve merge conflict

* doc: stm annotate for proxy_util_test & policy_test

* doc: stm annotate for various tests

* doc: final few stm annotations

* Add two more memPool Add tests

* Update submodules

* Add check function tests

solve conflict

* Add stm annotations, refactor test helper

solve merge conflict

* Change CLI test kinds to "unit"

* Fix double merged test

* Fix ccupgrade_test merge

* Fix lint issues

* Add stm annotation to types_Test

* Test vectors submodule

* Add file annotation to burn_test

Co-authored-by: Nikola Divic <divicnikola@gmail.com>
Co-authored-by: TheMenko <themenkoprojects@gmail.com>
2022-03-16 18:37:34 +01:00
Łukasz Magiera 8600ae2ac4 itests: TestTooManyMarkedForUpgrade is not applicable anymore 2022-03-16 17:48:02 +01:00
Łukasz Magiera 193c84811a feat: sealing: Linter did have a good point 2022-03-16 17:45:22 +01:00
Łukasz Magiera aef2ec513f feat: sealing: Sector upgrade queue 2022-03-16 17:33:05 +01:00
Aayush 37539ccb84 CircSupply: Remove unused method 2022-03-16 11:58:23 -04:00
Aayush 16128a0212 Merge branch 'master' into feat/fvm 2022-03-16 11:57:46 -04:00
KAYUII 159da73fcd Update Dockerfile.lotus
fix docker can't find gpus
2022-03-16 09:19:47 -06:00
Łukasz Magiera 9f6f94bd02 Merge pull request #8215 from filecoin-project/feat/remove-mark-for-upgrade
chore:sealing:remove endpoint from cli
2022-03-16 15:33:21 +01:00
Łukasz Magiera c4259cb594 worker: RemoveCopies expects one type at a time 2022-03-16 12:28:56 +01:00
Łukasz Magiera 5ed5744cb6 storagemgr: MoveStorage in separate steps 2022-03-16 12:28:56 +01:00
Łukasz Magiera a88edeb79d worker: Call RemoveCopies in MoveStorage 2022-03-16 12:28:56 +01:00
Łukasz Magiera 4d65e0101d stores: Support RemoveCopies on remote store 2022-03-16 12:28:56 +01:00
Łukasz Magiera 45b07674e5 stores: http: Support multiple storage IDs in ?keep 2022-03-16 12:28:56 +01:00
Łukasz Magiera 4906962da0 Merge pull request #8322 from filecoin-project/jen/versionbump
chore: build: bump the master version to v1.15.2-dev
2022-03-16 11:34:02 +01:00
Rjan 3ad1ea386c Merge branch 'filecoin-project:master' into master 2022-03-16 09:09:20 +01:00
koalacxr 7f26ce614b modify quantile imports error 2022-03-16 13:10:03 +08:00
Jennifer Wang 56b80c41b6 bump the master version to v1.15.2-dev 2022-03-15 19:32:28 -04:00
Eng Zer Jun c229842f57 test: use T.TempDir to create temporary test directory
The directory created by `T.TempDir` is automatically removed when the
test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-03-15 00:21:31 +08:00
Aayush 9a1a89d98c Shed: Add a tool to check UTF-8 validity of labels 2022-03-12 18:11:10 -05:00
Łukasz Magiera 6401363ef1 docsgen 2022-03-11 18:17:29 +01:00
Łukasz Magiera ce99aad438 Fix provingCheckProvableCmd 2022-03-11 18:13:51 +01:00
Łukasz Magiera 135aef78d7 Merge remote-tracking branch 'origin/master' into feat/post-worker 2022-03-11 17:04:58 +01:00
spark8899 3c96dcaec7 add minerMultisigs ProposeControlSet 2022-03-11 09:37:38 +08:00
Łukasz Magiera 9c4f8254ee post workers: Fix build post-merge 2022-03-10 14:20:07 +01:00
spark8899 b6278d2a6c add miner-multisig change-worker command. 2022-03-10 14:11:30 +08:00
Łukasz Magiera 046a9f8af0 Merge remote-tracking branch 'origin/master' into feat/post-worker 2022-03-09 16:27:03 +01:00
Anton Evangelatov 7cdf6dc680 remove .Type() now that we have singletons for repos 2022-03-07 13:00:26 +01:00
Anton Evangelatov b9fe61f9da Merge branch 'master' into nonsense/refactor-nodetype 2022-03-07 11:51:28 +01:00
Anton Evangelatov 5734a39e8e move DealmakingConfiger and SealingConfiger away from config/types.go 2022-03-03 16:51:47 +01:00
Anton Evangelatov 62e352ef88 move APIInfoEnvVars, RepoFlags, APIFlags under RepoType 2022-03-03 16:45:11 +01:00
Anton Evangelatov e1c2cf446e add lotus-test image as CI build step 2022-03-03 15:50:23 +01:00
Rjan c5dc898ed0 fix: cli: add ArgsUsage field to clientGetDealCmd
Adds [proposalCID] as ArgsUsage field in the 'lotus client get-deal' command. Fixes #8133
2022-03-03 15:40:16 +01:00
Anton Evangelatov acbfc879aa config: extract DealmakingConfig and Sealing config from Lotus for Boost (#8172)
* refactor sealingCfg and dealmakingCfg to be able to abstract Config

* fix error messages
2022-03-03 15:37:23 +01:00
Anton Evangelatov 066d0edf51 add SupportsStagingDeals trait 2022-03-03 15:37:23 +01:00
Anton Evangelatov 949ec65118 drop defConfForType 2022-03-03 15:37:23 +01:00
Anton Evangelatov f1f878a000 unexport repo types; use a global var for every repo type 2022-03-03 15:37:23 +01:00
Anton Evangelatov e3edab66e3 refactor RepoType 2022-03-03 15:37:23 +01:00
zenground0 59ef2fe1b8 Remove unused fields from sealing 2022-03-01 11:46:36 -07:00
zenground0 a463c90057 remove endpoint from cli 2022-03-01 11:27:03 -07:00
Jerry 8f95cd4149 release worker tracker lock when call cb func 2022-02-28 16:55:04 +08:00
Kevin Li bc88a02fe2 fix docsgen-cli 2022-02-17 17:29:09 +08:00
Kevin Li ba72eff3e6 feat: cli/net: implement 'net ping' command 2022-02-17 17:22:52 +08:00
Łukasz Magiera b74e085272 don't sort 2022-02-02 19:08:21 +00:00
Łukasz Magiera efdb854a7c fix some races 2022-01-31 20:53:25 +00:00
Łukasz Magiera 98f4d37f1a Merge remote-tracking branch 'origin/master' into feat/post-worker 2022-01-31 19:50:52 +00:00
Łukasz Magiera 55c9271695 post workers: Test skips 2022-01-21 13:33:47 +01:00
Łukasz Magiera f148397e1b post workers: Fix race in setting vproofs 2022-01-21 12:31:24 +01:00
Łukasz Magiera 82c9e72aab post workers: Fix skipped handling 2022-01-21 10:39:14 +01:00
Łukasz Magiera 4682e72cf4 Address review 2022-01-21 10:11:04 +01:00
Łukasz MagieraandAayush Rajasekaran 1e5e69ec9d Typos
Co-authored-by: Aayush Rajasekaran <arajasek94@gmail.com>
2022-01-21 10:02:00 +01:00
Łukasz Magiera 33dfcf2663 stores: Fix single post proof reading with updated sectors 2022-01-20 15:27:42 +01:00
Łukasz Magiera e476cf7968 Merge remote-tracking branch 'origin/master' into feat/post-worker 2022-01-20 13:15:48 +01:00
Łukasz Magiera b115e2879a don't defer in a loop 2022-01-20 11:19:57 +01:00
Łukasz Magiera fa09b9afb1 post workers: Share resource accounting code 2022-01-18 16:02:37 +01:00
Łukasz Magiera 8ac20305df Fix double unlock in WorkerStats 2022-01-18 12:40:04 +01:00
Łukasz Magiera 98fed009d7 docsgen 2022-01-18 12:21:30 +01:00
Łukasz Magiera c79f2b9d38 post workers: Fix lint 2022-01-18 12:11:59 +01:00
Łukasz Magiera b38141601c Untangle ffi from api 2022-01-18 11:57:04 +01:00
Łukasz Magiera 03fa955e9e Cleanup imports 2022-01-18 11:37:24 +01:00
Łukasz Magiera f41dd4feb6 gen 2022-01-18 11:28:55 +01:00
Łukasz Magiera f2496d87c9 post workers: Snapdeals updates 2022-01-18 11:25:04 +01:00
Łukasz Magiera 0c062f9c08 Merge remote-tracking branch 'origin/master' into feat/post-worker 2022-01-18 10:49:42 +01:00
Łukasz Magiera 4a874eff70 post workers: Cleanup, tests 2022-01-14 14:17:52 +01:00
Łukasz Magiera e216aefd23 fix make gen 2022-01-10 18:24:00 +01:00
Łukasz Magiera cf7dd36829 Merge branch 'feat/decoupling-post-worker' of github.com:wusirdcenter/lotus into feat/decoupling-post-worker 2022-01-10 15:06:04 +01:00
mz-sirius 793b5c7cc3 fix ci err 2022-01-05 21:41:21 +08:00
mz-sirius 6867f017ec update ffi 2022-01-05 01:50:53 +08:00
mz-sirius 3fd55fa56b decoupling winningpost and windowpost from lotus-miner 2022-01-05 01:50:49 +08:00
264 changed files with 6969 additions and 2215 deletions
+33 -23
View File
@@ -1,12 +1,11 @@
version: 2.1
orbs:
go: gotest/tools@0.0.13
aws-cli: circleci/aws-cli@1.3.2
executors:
golang:
docker:
- image: circleci/golang:1.16.4
- image: cimg/go:1.17.9
resource_class: 2xlarge
ubuntu:
docker:
@@ -25,8 +24,9 @@ executors:
commands:
install-deps:
steps:
- go/install-ssh
- go/install: {package: git}
- run: |
sudo apt update
sudo apt install python-is-python3
prepare:
parameters:
linux:
@@ -110,8 +110,12 @@ jobs:
steps:
- install-deps
- prepare
- go/mod-tidy-check
- run: go mod tidy -v
- run:
name: Check git diff
command: |
git --no-pager diff go.mod go.sum
git --no-pager diff --quiet go.mod go.sum
build-all:
executor: golang
steps:
@@ -188,9 +192,6 @@ jobs:
command: make deps lotus
no_output_timeout: 30m
- download-params
- go/install-gotestsum:
gobin: $HOME/.local/bin
version: 0.5.2
- run:
name: go test
environment:
@@ -215,8 +216,6 @@ jobs:
- when:
condition: << parameters.codecov-upload >>
steps:
- go/install: {package: bash}
- go/install: {package: curl}
- run:
shell: /bin/bash -eo pipefail
command: |
@@ -255,9 +254,6 @@ jobs:
cd extern/test-vectors
git fetch
git checkout origin/<< parameters.vectors-branch >>
- go/install-gotestsum:
gobin: $HOME/.local/bin
version: 0.5.2
- run:
name: install statediff globally
command: |
@@ -370,8 +366,8 @@ jobs:
- run:
name: Install go
command: |
curl -O https://dl.google.com/go/go1.16.4.darwin-amd64.pkg && \
sudo installer -pkg go1.16.4.darwin-amd64.pkg -target /
curl -O https://dl.google.com/go/go1.17.9.darwin-amd64.pkg && \
sudo installer -pkg go1.17.9.darwin-amd64.pkg -target /
- run:
name: Install pkg-config
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config
@@ -512,9 +508,6 @@ jobs:
executor:
type: executor
default: golang
golangci-lint-version:
type: string
default: 1.27.0
concurrency:
type: string
default: '2'
@@ -533,13 +526,10 @@ jobs:
- run:
command: make deps
no_output_timeout: 30m
- go/install-golangci-lint:
gobin: $HOME/.local/bin
version: << parameters.golangci-lint-version >>
- run:
name: Lint
command: |
$HOME/.local/bin/golangci-lint run -v --timeout 2m \
golangci-lint run -v --timeout 2m \
--concurrency << parameters.concurrency >> << parameters.args >>
lint-all:
<<: *lint
@@ -909,6 +899,11 @@ workflows:
suite: itest-sector_finalize_early
target: "./itests/sector_finalize_early_test.go"
- test:
name: test-itest-sector_make_cc_avail
suite: itest-sector_make_cc_avail
target: "./itests/sector_make_cc_avail_test.go"
- test:
name: test-itest-sector_miner_collateral
suite: itest-sector_miner_collateral
@@ -919,6 +914,16 @@ workflows:
suite: itest-sector_pledge
target: "./itests/sector_pledge_test.go"
- test:
name: test-itest-sector_prefer_no_upgrade
suite: itest-sector_prefer_no_upgrade
target: "./itests/sector_prefer_no_upgrade_test.go"
- test:
name: test-itest-sector_revert_available
suite: itest-sector_revert_available
target: "./itests/sector_revert_available_test.go"
- test:
name: test-itest-sector_terminate
suite: itest-sector_terminate
@@ -949,6 +954,11 @@ workflows:
suite: itest-wdpost
target: "./itests/wdpost_test.go"
- test:
name: test-itest-worker
suite: itest-worker
target: "./itests/worker_test.go"
- test:
name: test-unit-cli
suite: utest-unit-cli
+13 -23
View File
@@ -1,12 +1,11 @@
version: 2.1
orbs:
go: gotest/tools@0.0.13
aws-cli: circleci/aws-cli@1.3.2
executors:
golang:
docker:
- image: circleci/golang:1.16.4
- image: cimg/go:1.17.9
resource_class: 2xlarge
ubuntu:
docker:
@@ -25,8 +24,9 @@ executors:
commands:
install-deps:
steps:
- go/install-ssh
- go/install: {package: git}
- run: |
sudo apt update
sudo apt install python-is-python3
prepare:
parameters:
linux:
@@ -110,8 +110,12 @@ jobs:
steps:
- install-deps
- prepare
- go/mod-tidy-check
- run: go mod tidy -v
- run:
name: Check git diff
command: |
git --no-pager diff go.mod go.sum
git --no-pager diff --quiet go.mod go.sum
build-all:
executor: golang
steps:
@@ -188,9 +192,6 @@ jobs:
command: make deps lotus
no_output_timeout: 30m
- download-params
- go/install-gotestsum:
gobin: $HOME/.local/bin
version: 0.5.2
- run:
name: go test
environment:
@@ -215,8 +216,6 @@ jobs:
- when:
condition: << parameters.codecov-upload >>
steps:
- go/install: {package: bash}
- go/install: {package: curl}
- run:
shell: /bin/bash -eo pipefail
command: |
@@ -255,9 +254,6 @@ jobs:
cd extern/test-vectors
git fetch
git checkout origin/<< parameters.vectors-branch >>
- go/install-gotestsum:
gobin: $HOME/.local/bin
version: 0.5.2
- run:
name: install statediff globally
command: |
@@ -370,8 +366,8 @@ jobs:
- run:
name: Install go
command: |
curl -O https://dl.google.com/go/go1.16.4.darwin-amd64.pkg && \
sudo installer -pkg go1.16.4.darwin-amd64.pkg -target /
curl -O https://dl.google.com/go/go1.17.9.darwin-amd64.pkg && \
sudo installer -pkg go1.17.9.darwin-amd64.pkg -target /
- run:
name: Install pkg-config
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config
@@ -512,9 +508,6 @@ jobs:
executor:
type: executor
default: golang
golangci-lint-version:
type: string
default: 1.27.0
concurrency:
type: string
default: '2'
@@ -533,13 +526,10 @@ jobs:
- run:
command: make deps
no_output_timeout: 30m
- go/install-golangci-lint:
gobin: $HOME/.local/bin
version: << parameters.golangci-lint-version >>
- run:
name: Lint
command: |
$HOME/.local/bin/golangci-lint run -v --timeout 2m \
golangci-lint run -v --timeout 2m \
--concurrency << parameters.concurrency >> << parameters.args >>
lint-all:
<<: *lint
+1 -1
View File
@@ -37,7 +37,7 @@ jobs:
- uses: actions/setup-go@v1
with:
go-version: '1.16.4'
go-version: '1.17.9'
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
+5 -2
View File
@@ -25,7 +25,7 @@ skip-dirs:
issues:
exclude:
- "func name will be used as test\\.Test.* by other packages, and that stutters; consider calling this"
- "by other packages, and that stutters; consider calling this"
- "Potential file inclusion via variable"
- "should have( a package)? comment"
- "Error return value of `logging.SetLogLevel` is not checked"
@@ -37,6 +37,9 @@ issues:
- "string .* has .* occurrences, make it a constant"
- "a blank import should be only in a main or test package, or have a comment justifying it"
- "package comment should be of the form"
- "Potential hardcoded credentials"
- "Use of weak random number generator"
- "xerrors.* is deprecated"
exclude-use-default: false
exclude-rules:
@@ -51,7 +54,7 @@ issues:
- path: build/params_.*\.go
linters:
- golint
- path: api/apistruct/struct.go
linters:
- golint
+146
View File
@@ -1,5 +1,151 @@
# Lotus changelog
# 1.15.2-rc2 / 2022-05-02
This is the second release candidate of the next highly recommended feature release v1.15.2. This feature release introduces many new features and for SPs, including PoSt workers, sealing scheduler, snap deal queue and so on.
## Highlights
### ❣️❣️❣️ PoSt Workers ❣️❣️❣️
‼️Attention - the long-awaited yet highly requested PoSt workers, they are here! And they come in as a combo: you may setup PoSt workers for both winningPoSt or/and windowPoSt worker. You can also setup any number of PoSt workers as long as you have the hardware resources!
For more details and learn how to set it up, see the (WIP) docs [here](https://deploy-preview-158--lotus-docs.netlify.app/storage-providers/seal-workers/post-workers/). You can also find early result of the PoSt workers performance by the community [here](https://github.com/filecoin-project/lotus/discussions/8375).
- feat: PoSt workers ([filecoin-project/lotus#7971](https://github.com/filecoin-project/lotus/pull/7971))
- feat: storage: Parallel proving checks ([filecoin-project/lotus#8391](https://github.com/filecoin-project/lotus/pull/8391))
- adjust `ParallelCheckLimit` according to your resource setup to get pre-post checkers run faster!
In addition, we also added some handy toolings:
- feat: miner: API/CLI to compute window-post ([filecoin-project/lotus#8389](https://github.com/filecoin-project/lotus/pull/8389))
- run `lotus-miner proving compute window-post` to manually trigger a full windowPoSt computation for a specific deadline for full sanity checks.
- feat: miner cli: Separate proving workers command ([filecoin-project/lotus#8379](https://github.com/filecoin-project/lotus/pull/8379))
- run `lotus-miner proving workers` to list all the PoSt workers that's attached
- feat: miner cli: proving check --faulty, faults in storage list sectors ([filecoin-project/lotus#8349](https://github.com/filecoin-project/lotus/pull/8349))
- run `lotus-miner proving check --faulty` to identify the sectors that might be bad.
### 🔥🔥🔥 Sealing Scheduler Enhancement 🔥🔥🔥
Have you ever got a couple workers but only a few of them are super packed, while the rest are idling waiting for jobs? Now the task can be distributed more evenly with:
- feat: sched: Improve worker assigning logic ([filecoin-project/lotus#8447](https://github.com/filecoin-project/lotus/pull/8447))
### 🌟🌟🌟 Snap Deal Enhancements 🌟🌟🌟
The Filecoin Network introduced Snap Deal with the network v15 OhSnap upgrade, and lotus shipped v1.14.0 with basic snappy support for SP to use this feature. Since then, we have received good ux feedbacks and bug reports from the community, and we are introducing a couple enhancement for SPs to better leverage this feature.
- feat: sealing: Sector upgrade queue ([filecoin-project/lotus#8330](https://github.com/filecoin-project/lotus/pull/8330))
- Snap up CCs to be ready for deals automatically, learn more [here](https://lotus.filecoin.io/storage-providers/operate/snap-deals/#snap-deal-queue)
- feat: sealing: More SnapDeals config knobs ([filecoin-project/lotus#8343](https://github.com/filecoin-project/lotus/pull/8343))
- SPs can now set `PreferNewSectorsForDeals` and `MaxUpgradingSectors` to better manage their sealing/dealing pipeline.
- feat: config: Move MakeNewSectorForDeals config into the Sealing sectoin ([filecoin-project/lotus#8378](https://github.com/filecoin-project/lotus/pull/8378))
- fix: sealing: Release unsealed sector files after snapdeals abort ([filecoin-project/lotus#8438](https://github.com/filecoin-project/lotus/pull/8438))
- fix: sealing: always do cooldown in handleSubmitReplicaUpdateFailed ([filecoin-project/lotus#8353](https://github.com/filecoin-project/lotus/pull/8353))
- fix: storagefsm: Fix error loop on bad event ([filecoin-project/lotus#8338](https://github.com/filecoin-project/lotus/pull/8338))
- fix: sealing: Remove sector copies from workers after snapdeals ([filecoin-project/lotus#8329](https://github.com/filecoin-project/lotus/pull/8329))
## New Features
- enable rcmgr by default ([filecoin-project/lotus#8470](https://github.com/filecoin-project/lotus/pull/8470))
- feat: cli: lotus client list-asks --protocols ([filecoin-project/lotus#8464](https://github.com/filecoin-project/lotus/pull/8464))
- feat: shed: Multi-file vlog2car ([filecoin-project/lotus#8426](https://github.com/filecoin-project/lotus/pull/8426))
- feat: worker: check fd limit on startup ([filecoin-project/lotus#8390](https://github.com/filecoin-project/lotus/pull/8390))
- feat: lotus-shed: add command to compute state over a range of tipsets. ([filecoin-project/lotus#8371](https://github.com/filecoin-project/lotus/pull/8371))
- feat: cli/net: implement 'net ping' command ([filecoin-project/lotus#8357](https://github.com/filecoin-project/lotus/pull/8357))
- feat: stmgr: call: use a buffered concurrent-access blockstore ([filecoin-project/lotus#8358](https://github.com/filecoin-project/lotus/pull/8358))
- feat: infra/ci: add `lotus-test` image as CI build step ([filecoin-project/lotus#7956](https://github.com/filecoin-project/lotus/pull/7956))
- feat: multisig: lotus-sheed miner-multisig change-worker command. ([filecoin-project/lotus#8281](https://github.com/filecoin-project/lotus/pull/8281))
- feat: Add additional test annotations (#8272) ([filecoin-project/lotus#8272](https://github.com/filecoin-project/lotus/pull/8272))
## Improvements
- Revert appimage removal ([filecoin-project/lotus#8439](https://github.com/filecoin-project/lotus/pull/8439))
- sealing: Don't panic in ReleaseUnsealed with no ranges ([filecoin-project/lotus#8461](https://github.com/filecoin-project/lotus/pull/8461))
- testkit: give up on waiting for the RPC server to shutdown after 1s ([filecoin-project/lotus#8450](https://github.com/filecoin-project/lotus/pull/8450))
- chore: events: implement event observer deregister method ([filecoin-project/lotus#8441](https://github.com/filecoin-project/lotus/pull/8441))
- Thread safe piecereader ([filecoin-project/lotus#8397](https://github.com/filecoin-project/lotus/pull/8397))
- VM: Refactor pricelist to be based on network versions ([filecoin-project/lotus#8369](https://github.com/filecoin-project/lotus/pull/8369))
- --max-piece-size in set-ask is no longer required ([filecoin-project/lotus#8361](https://github.com/filecoin-project/lotus/pull/8361))
- refactor: convert RepoType from int to interface ([filecoin-project/lotus#8086](https://github.com/filecoin-project/lotus/pull/8086))
- Shed: fix error message ([filecoin-project/lotus#8340](https://github.com/filecoin-project/lotus/pull/8340))
## Bug Fixes
- fix: FVM: add finality check for consensus faults ([filecoin-project/lotus#8452](https://github.com/filecoin-project/lotus/pull/8452))
- fix: market: Reuse the market `PubSub` in index provider ([filecoin-project/lotus#8443](https://github.com/filecoin-project/lotus/pull/8443))
- fix: market: set all index provider options based on lotus config ([filecoin-project/lotus#8444](https://github.com/filecoin-project/lotus/pull/8444))
- release worker tracker lock when call cb func ([filecoin-project/lotus#8206](https://github.com/filecoin-project/lotus/pull/8206))
- fix: node: Fix market node startup ([filecoin-project/lotus#8425](https://github.com/filecoin-project/lotus/pull/8425))
- fix: sealing: Fix PR1 worker selection ([filecoin-project/lotus#8420](https://github.com/filecoin-project/lotus/pull/8420))
- fix: go: make Go 1.18 builds work ([filecoin-project/lotus#8410](https://github.com/filecoin-project/lotus/pull/8410))
- fix: sealing: Added error checking ([filecoin-project/lotus#8404](https://github.com/filecoin-project/lotus/pull/8404))
- fix: ux: Change Propose-worker msg ([filecoin-project/lotus#8384](https://github.com/filecoin-project/lotus/pull/8384))
- fix: miner: dead loop on removing sector ([filecoin-project/lotus#8386](https://github.com/filecoin-project/lotus/pull/8386))
- fix: worker: Fix default value handling ([filecoin-project/lotus#8380](https://github.com/filecoin-project/lotus/pull/8380))
- Revert "Update params for interopnet for fvm" ([filecoin-project/lotus#8374](https://github.com/filecoin-project/lotus/pull/8374))
- fix: cli: Reset miner/ask lists in interactive deal 'miner' step (#8155) ([filecoin-project/lotus#8155](https://github.com/filecoin-project/lotus/pull/8155))
- fix:snapup: Rename error message ([filecoin-project/lotus#8370](https://github.com/filecoin-project/lotus/pull/8370))
- fix: multisig: Print "waiting for confirmation.." ([filecoin-project/lotus#8368](https://github.com/filecoin-project/lotus/pull/8368))
- fix: lotus-wallet: pass correct repo type to repo.Init ([filecoin-project/lotus#8356](https://github.com/filecoin-project/lotus/pull/8356))
- fix: avoid racy memstores when estimating gas ([filecoin-project/lotus#8351](https://github.com/filecoin-project/lotus/pull/8351))
- fix: itests: Don't hang on exit in MineBlocksMustPost ([filecoin-project/lotus#8345](https://github.com/filecoin-project/lotus/pull/8345))
- fix: miner cli: Estimate deal weight in sector list when upgrading ([filecoin-project/lotus#8336](https://github.com/filecoin-project/lotus/pull/8336))
- fix: sealing: FinalizeSector doesn't need sealed replica access ([filecoin-project/lotus#8337](https://github.com/filecoin-project/lotus/pull/8337))
- fix: cli: add ArgsUsage field to clientGetDealCmd ([filecoin-project/lotus#8241](https://github.com/filecoin-project/lotus/pull/8241))
- fix: market: Infer index provider topic from network name by default #8533
-
## Dependency Updates
- deps: update go-libp2p@v0.19 #8533
- deps: ffi: update ffi that includes the log fix #8577
- deps: ffi: pull ffi that includes the latest fvm ([filecoin-project/lotus#8424](https://github.com/filecoin-project/lotus/pull/8424))
- Update to go-log 2.5.1 ([filecoin-project/lotus#8422](https://github.com/filecoin-project/lotus/pull/8422))
- chore(deps): update go-data-transfer with fixes (master edition) ([filecoin-project/lotus#8411](https://github.com/filecoin-project/lotus/pull/8411))
- deps: update ffi with actor v7.1.0 and fvm that uses the bundle that includes the new manifest ([filecoin-project/lotus#8402](https://github.com/filecoin-project/lotus/pull/8402))
- Update to specs-storage v0.2.2 ([filecoin-project/lotus#8400](https://github.com/filecoin-project/lotus/pull/8400))
- chore: ffi: the latest fvm release ([filecoin-project/lotus#8381](https://github.com/filecoin-project/lotus/pull/8381))
- Update params for interopnet for fvm ([filecoin-project/lotus#8119](https://github.com/filecoin-project/lotus/pull/8119))
- github.com/filecoin-project/specs-storage (v0.2.0 -> v0.2.2):
## Others
- chore: merge releases back to master ([filecoin-project/lotus#8468](https://github.com/filecoin-project/lotus/pull/8468))
- Packer publish copy orb ([filecoin-project/lotus#8413](https://github.com/filecoin-project/lotus/pull/8413))
- chore: Remove temp gomock reflect file ([filecoin-project/lotus#8372](https://github.com/filecoin-project/lotus/pull/8372))
- chore: FVM: log when fvm is used ([filecoin-project/lotus#8363](https://github.com/filecoin-project/lotus/pull/8363))
- lib: extract unixfs filestore into lib ([filecoin-project/lotus#8354](https://github.com/filecoin-project/lotus/pull/8354))
- test: use `T.TempDir` to create temporary test directory ([filecoin-project/lotus#8295](https://github.com/filecoin-project/lotus/pull/8295))
- Update Dockerfile.lotus
- chore:sealing:remove endpoint from cli ([filecoin-project/lotus#8215](https://github.com/filecoin-project/lotus/pull/8215))
- chore: build: bump the master version to v1.15.2-dev ([filecoin-project/lotus#8322](https://github.com/filecoin-project/lotus/pull/8322))
- chore: fix lint issue #8533
## Contributors
| Contributor | Commits | Lines ± | Files Changed |
|-------------|---------|---------|---------------|
| Łukasz Magiera | 95 | +5147/-2922 | 401 |
| mz-sirius | 3 | +1789/-546 | 48 |
| Anton Evangelatov | 11 | +777/-567 | 121 |
| Aayush | 11 | +336/-231 | 28 |
| Darko Brdareski | 1 | +463/-13 | 95 |
| Cory Schwartz | 11 | +147/-217 | 13 |
| spark8899 | 2 | +300/-0 | 2 |
| zenground0 | 2 | +6/-193 | 7 |
| Eng Zer Jun | 1 | +31/-158 | 11 |
| Kevin Li | 2 | +174/-0 | 14 |
| Aayush Rajasekaran | 5 | +85/-86 | 18 |
| Jiaying Wang | 1 | +0/-119 | 3 |
| jennijuju | 1 | +0/-98 | 6 |
| Raúl Kripalani | 1 | +60/-1 | 1 |
| frrist | 1 | +56/-0 | 2 |
| vyzo | 3 | +18/-16 | 5 |
| Masih H. Derkani | 3 | +29/-4 | 3 |
| Jennifer Wang | 4 | +18/-11 | 11 |
| hannahhoward | 1 | +13/-10 | 2 |
| Dirk McCormick | 1 | +21/-1 | 1 |
| koalacxr | 1 | +10/-11 | 4 |
| Aarsh Shah | 1 | +19/-1 | 1 |
| Rjan | 6 | +10/-8 | 7 |
| zl | 1 | +7/-1 | 1 |
| KAYUII | 1 | +3/-2 | 1 |
| simlecode | 1 | +4/-0 | 1 |
| dirkmc | 1 | +1/-3 | 1 |
| Jerry | 1 | +3/-0 | 1 |
| Steven Allen | 1 | +1/-1 | 1 |
| Geoff Stuart | 1 | +1/-0 | 1 |
| Florian Ruen | 1 | +0/-1 | 1 |
# 1.15.1 / 2022-04-07
This is a *HIGHLY recommended* feature release v1.15.1, especially for node operators and storage providers who want to be a part of the content addressing network of Filecoin and IPFS.
+6 -4
View File
@@ -1,4 +1,4 @@
FROM golang:1.16.4 AS builder-deps
FROM golang:1.17.9-buster AS builder-deps
MAINTAINER Lotus Development Team
RUN apt-get update && apt-get install -y ca-certificates build-essential clang ocl-icd-opencl-dev ocl-icd-libopencl1 jq libhwloc-dev
@@ -61,8 +61,9 @@ COPY --from=builder /usr/lib/x86_64-linux-gnu/libnuma.so.1 /lib/
COPY --from=builder /usr/lib/x86_64-linux-gnu/libhwloc.so.5 /lib/
COPY --from=builder /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 /lib/
RUN useradd -r -u 532 -U fc
RUN useradd -r -u 532 -U fc \
&& mkdir -p /etc/OpenCL/vendors \
&& echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd
###
FROM base AS lotus
@@ -251,4 +252,5 @@ VOLUME /var/lib/lotus-wallet
EXPOSE 1234
EXPOSE 2345
EXPOSE 3456
EXPOSE 1777
EXPOSE 1777
+2 -2
View File
@@ -10,7 +10,7 @@ GOCC?=go
GOVERSION:=$(shell $(GOCC) version | tr ' ' '\n' | grep go1 | sed 's/^go//' | awk -F. '{printf "%d%03d%03d", $$1, $$2, $$3}')
ifeq ($(shell expr $(GOVERSION) \< 1016000), 1)
$(warning Your Golang version is go$(shell expr $(GOVERSION) / 1000000).$(shell expr $(GOVERSION) % 1000000 / 1000).$(shell expr $(GOVERSION) % 1000))
$(error Update Golang to version to at least 1.16.0)
$(error Update Golang to version to at least 1.17.9)
endif
# git modules that need to be loaded
@@ -97,7 +97,7 @@ BINS+=lotus-miner
lotus-worker: $(BUILD_DEPS)
rm -f lotus-worker
$(GOCC) build $(GOFLAGS) -o lotus-worker ./cmd/lotus-seal-worker
$(GOCC) build $(GOFLAGS) -o lotus-worker ./cmd/lotus-worker
.PHONY: lotus-worker
BINS+=lotus-worker
+2 -2
View File
@@ -71,10 +71,10 @@ For other distributions you can find the required dependencies [here.](https://d
#### Go
To build Lotus, you need a working installation of [Go 1.16.4 or higher](https://golang.org/dl/):
To build Lotus, you need a working installation of [Go 1.17.9 or higher](https://golang.org/dl/):
```bash
wget -c https://golang.org/dl/go1.16.4.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
wget -c https://golang.org/dl/go1.17.9.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
```
**TIP:**
+7 -1
View File
@@ -360,7 +360,7 @@ type FullNode interface {
// ClientGetRetrievalUpdates returns status of updated retrieval deals
ClientGetRetrievalUpdates(ctx context.Context) (<-chan RetrievalInfo, error) //perm:write
// ClientQueryAsk returns a signed StorageAsk from the specified miner.
ClientQueryAsk(ctx context.Context, p peer.ID, miner address.Address) (*storagemarket.StorageAsk, error) //perm:read
ClientQueryAsk(ctx context.Context, p peer.ID, miner address.Address) (*StorageAsk, error) //perm:read
// ClientCalcCommP calculates the CommP and data size of the specified CID
ClientDealPieceCID(ctx context.Context, root cid.Cid) (DataCIDSize, error) //perm:read
// ClientCalcCommP calculates the CommP for a specified file
@@ -728,6 +728,12 @@ type FullNode interface {
CreateBackup(ctx context.Context, fpath string) error //perm:admin
}
type StorageAsk struct {
Response *storagemarket.StorageAsk
DealProtocols []string
}
type FileRef struct {
Path string
IsCAR bool
+2
View File
@@ -2,6 +2,7 @@ package api
import (
"context"
"time"
metrics "github.com/libp2p/go-libp2p-core/metrics"
"github.com/libp2p/go-libp2p-core/network"
@@ -25,6 +26,7 @@ type Net interface {
NetConnectedness(context.Context, peer.ID) (network.Connectedness, error) //perm:read
NetPeers(context.Context) ([]peer.AddrInfo, error) //perm:read
NetPing(context.Context, peer.ID) (time.Duration, error) //perm:read
NetConnect(context.Context, peer.AddrInfo) error //perm:write
NetAddrsListen(context.Context) (peer.AddrInfo, error) //perm:read
NetDisconnect(context.Context, peer.ID) error //perm:write
+35 -33
View File
@@ -6,6 +6,7 @@ import (
"time"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/google/uuid"
"github.com/ipfs/go-cid"
@@ -24,7 +25,6 @@ import (
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/extern/sector-storage/fsutil"
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface"
)
@@ -52,6 +52,8 @@ type StorageMiner interface {
MiningBase(context.Context) (*types.TipSet, error) //perm:read
ComputeWindowPoSt(ctx context.Context, dlIdx uint64, tsk types.TipSetKey) ([]miner.SubmitWindowedPoStParams, error) //perm:admin
// Temp api for testing
PledgeSector(context.Context) (abi.SectorID, error) //perm:write
@@ -92,7 +94,8 @@ type StorageMiner interface {
SectorsUpdate(context.Context, abi.SectorNumber, SectorState) error //perm:admin
// SectorRemove removes the sector from storage. It doesn't terminate it on-chain, which can
// be done with SectorTerminate. Removing and not terminating live sectors will cause additional penalties.
SectorRemove(context.Context, abi.SectorNumber) error //perm:admin
SectorRemove(context.Context, abi.SectorNumber) error //perm:admin
SectorMarkForUpgrade(ctx context.Context, id abi.SectorNumber, snap bool) error //perm:admin
// SectorTerminate terminates the sector on-chain (adding it to a termination batch first), then
// automatically removes it from storage
SectorTerminate(context.Context, abi.SectorNumber) error //perm:admin
@@ -100,8 +103,7 @@ type StorageMiner interface {
// Returns null if message wasn't sent
SectorTerminateFlush(ctx context.Context) (*cid.Cid, error) //perm:admin
// SectorTerminatePending returns a list of pending sector terminations to be sent in the next batch message
SectorTerminatePending(ctx context.Context) ([]abi.SectorID, error) //perm:admin
SectorMarkForUpgrade(ctx context.Context, id abi.SectorNumber, snap bool) error //perm:admin
SectorTerminatePending(ctx context.Context) ([]abi.SectorID, error) //perm:admin
// SectorPreCommitFlush immediately sends a PreCommit message with sectors batched for PreCommit.
// Returns null if message wasn't sent
SectorPreCommitFlush(ctx context.Context) ([]sealiface.PreCommitBatchRes, error) //perm:admin
@@ -143,21 +145,21 @@ type StorageMiner interface {
SealingSchedDiag(ctx context.Context, doSched bool) (interface{}, error) //perm:admin
SealingAbort(ctx context.Context, call storiface.CallID) error //perm:admin
//stores.SectorIndex
StorageAttach(context.Context, stores.StorageInfo, fsutil.FsStat) error //perm:admin
StorageInfo(context.Context, stores.ID) (stores.StorageInfo, error) //perm:admin
StorageReportHealth(context.Context, stores.ID, stores.HealthReport) error //perm:admin
StorageDeclareSector(ctx context.Context, storageID stores.ID, s abi.SectorID, ft storiface.SectorFileType, primary bool) error //perm:admin
StorageDropSector(ctx context.Context, storageID stores.ID, s abi.SectorID, ft storiface.SectorFileType) error //perm:admin
StorageFindSector(ctx context.Context, sector abi.SectorID, ft storiface.SectorFileType, ssize abi.SectorSize, allowFetch bool) ([]stores.SectorStorageInfo, error) //perm:admin
StorageBestAlloc(ctx context.Context, allocate storiface.SectorFileType, ssize abi.SectorSize, pathType storiface.PathType) ([]stores.StorageInfo, error) //perm:admin
StorageLock(ctx context.Context, sector abi.SectorID, read storiface.SectorFileType, write storiface.SectorFileType) error //perm:admin
StorageTryLock(ctx context.Context, sector abi.SectorID, read storiface.SectorFileType, write storiface.SectorFileType) (bool, error) //perm:admin
StorageList(ctx context.Context) (map[stores.ID][]stores.Decl, error) //perm:admin
StorageGetLocks(ctx context.Context) (storiface.SectorLocks, error) //perm:admin
// SectorIndex
StorageAttach(context.Context, storiface.StorageInfo, fsutil.FsStat) error //perm:admin
StorageInfo(context.Context, storiface.ID) (storiface.StorageInfo, error) //perm:admin
StorageReportHealth(context.Context, storiface.ID, storiface.HealthReport) error //perm:admin
StorageDeclareSector(ctx context.Context, storageID storiface.ID, s abi.SectorID, ft storiface.SectorFileType, primary bool) error //perm:admin
StorageDropSector(ctx context.Context, storageID storiface.ID, s abi.SectorID, ft storiface.SectorFileType) error //perm:admin
StorageFindSector(ctx context.Context, sector abi.SectorID, ft storiface.SectorFileType, ssize abi.SectorSize, allowFetch bool) ([]storiface.SectorStorageInfo, error) //perm:admin
StorageBestAlloc(ctx context.Context, allocate storiface.SectorFileType, ssize abi.SectorSize, pathType storiface.PathType) ([]storiface.StorageInfo, error) //perm:admin
StorageLock(ctx context.Context, sector abi.SectorID, read storiface.SectorFileType, write storiface.SectorFileType) error //perm:admin
StorageTryLock(ctx context.Context, sector abi.SectorID, read storiface.SectorFileType, write storiface.SectorFileType) (bool, error) //perm:admin
StorageList(ctx context.Context) (map[storiface.ID][]storiface.Decl, error) //perm:admin
StorageGetLocks(ctx context.Context) (storiface.SectorLocks, error) //perm:admin
StorageLocal(ctx context.Context) (map[stores.ID]string, error) //perm:admin
StorageStat(ctx context.Context, id stores.ID) (fsutil.FsStat, error) //perm:admin
StorageLocal(ctx context.Context) (map[storiface.ID]string, error) //perm:admin
StorageStat(ctx context.Context, id storiface.ID) (fsutil.FsStat, error) //perm:admin
MarketImportDealData(ctx context.Context, propcid cid.Cid, path string) error //perm:write
MarketListDeals(ctx context.Context) ([]MarketDeal, error) //perm:read
@@ -266,13 +268,12 @@ type StorageMiner interface {
// the path specified when calling CreateBackup is within the base path
CreateBackup(ctx context.Context, fpath string) error //perm:admin
CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storage.SectorRef, update []bool, expensive bool) (map[abi.SectorNumber]string, error) //perm:admin
CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storage.SectorRef, expensive bool) (map[abi.SectorNumber]string, error) //perm:admin
ComputeProof(ctx context.Context, ssi []builtin.ExtendedSectorInfo, rand abi.PoStRandomness, poStEpoch abi.ChainEpoch, nv abinetwork.Version) ([]builtin.PoStProof, error) //perm:read
}
var _ storiface.WorkerReturn = *new(StorageMiner)
var _ stores.SectorIndex = *new(StorageMiner)
type SealRes struct {
Err string
@@ -296,19 +297,20 @@ type SectorPiece struct {
}
type SectorInfo struct {
SectorID abi.SectorNumber
State SectorState
CommD *cid.Cid
CommR *cid.Cid
Proof []byte
Deals []abi.DealID
Pieces []SectorPiece
Ticket SealTicket
Seed SealSeed
PreCommitMsg *cid.Cid
CommitMsg *cid.Cid
Retries uint64
ToUpgrade bool
SectorID abi.SectorNumber
State SectorState
CommD *cid.Cid
CommR *cid.Cid
Proof []byte
Deals []abi.DealID
Pieces []SectorPiece
Ticket SealTicket
Seed SealSeed
PreCommitMsg *cid.Cid
CommitMsg *cid.Cid
Retries uint64
ToUpgrade bool
ReplicaUpdateMessage *cid.Cid
LastErr string
+5
View File
@@ -1,3 +1,4 @@
//stm: #unit
package api
import (
@@ -26,6 +27,7 @@ func goCmd() string {
}
func TestDoesntDependOnFFI(t *testing.T) {
//stm: @OTHER_IMPLEMENTATION_FFI_DEPENDENCE_001
deps, err := exec.Command(goCmd(), "list", "-deps", "github.com/filecoin-project/lotus/api").Output()
if err != nil {
t.Fatal(err)
@@ -38,6 +40,7 @@ func TestDoesntDependOnFFI(t *testing.T) {
}
func TestDoesntDependOnBuild(t *testing.T) {
//stm: @OTHER_IMPLEMENTATION_FFI_DEPENDENCE_002
deps, err := exec.Command(goCmd(), "list", "-deps", "github.com/filecoin-project/lotus/api").Output()
if err != nil {
t.Fatal(err)
@@ -50,6 +53,7 @@ func TestDoesntDependOnBuild(t *testing.T) {
}
func TestReturnTypes(t *testing.T) {
//stm: @OTHER_IMPLEMENTATION_001
errType := reflect.TypeOf(new(error)).Elem()
bareIface := reflect.TypeOf(new(interface{})).Elem()
jmarsh := reflect.TypeOf(new(json.Marshaler)).Elem()
@@ -115,6 +119,7 @@ func TestReturnTypes(t *testing.T) {
}
func TestPermTags(t *testing.T) {
//stm: @OTHER_IMPLEMENTATION_PERM_TAGS_001
_ = PermissionedFullAPI(&FullNodeStruct{})
_ = PermissionedStorMinerAPI(&StorageMinerStruct{})
_ = PermissionedWorkerAPI(&WorkerStruct{})
+6 -2
View File
@@ -7,8 +7,9 @@ import (
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/specs-actors/v5/actors/runtime/proof"
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
"github.com/filecoin-project/specs-storage/storage"
)
@@ -29,7 +30,7 @@ type Worker interface {
// TaskType -> Weight
TaskTypes(context.Context) (map[sealtasks.TaskType]struct{}, error) //perm:admin
Paths(context.Context) ([]stores.StoragePath, error) //perm:admin
Paths(context.Context) ([]storiface.StoragePath, error) //perm:admin
Info(context.Context) (storiface.WorkerInfo, error) //perm:admin
// storiface.WorkerCalls
@@ -49,6 +50,9 @@ type Worker interface {
UnsealPiece(context.Context, storage.SectorRef, storiface.UnpaddedByteIndex, abi.UnpaddedPieceSize, abi.SealRandomness, cid.Cid) (storiface.CallID, error) //perm:admin
Fetch(context.Context, storage.SectorRef, storiface.SectorFileType, storiface.PathType, storiface.AcquireMode) (storiface.CallID, error) //perm:admin
GenerateWinningPoSt(ctx context.Context, ppt abi.RegisteredPoStProof, mid abi.ActorID, sectors []storiface.PostSectorChallenge, randomness abi.PoStRandomness) ([]proof.PoStProof, error) //perm:admin
GenerateWindowPoSt(ctx context.Context, ppt abi.RegisteredPoStProof, mid abi.ActorID, sectors []storiface.PostSectorChallenge, partitionIdx int, randomness abi.PoStRandomness) (storiface.WindowPoStResult, error) //perm:admin
TaskDisable(ctx context.Context, tt sealtasks.TaskType) error //perm:admin
TaskEnable(ctx context.Context, tt sealtasks.TaskType) error //perm:admin
+3 -4
View File
@@ -40,7 +40,6 @@ import (
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
"github.com/filecoin-project/lotus/node/modules/dtypes"
@@ -199,10 +198,10 @@ func init() {
},
})
addExample(api.SectorState(sealing.Proving))
addExample(stores.ID("76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8"))
addExample(storiface.ID("76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8"))
addExample(storiface.FTUnsealed)
addExample(storiface.PathSealing)
addExample(map[stores.ID][]stores.Decl{
addExample(map[storiface.ID][]storiface.Decl{
"76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8": {
{
SectorID: abi.SectorID{Miner: 1000, Number: 100},
@@ -210,7 +209,7 @@ func init() {
},
},
})
addExample(map[stores.ID]string{
addExample(map[storiface.ID]string{
"76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8": "/data/path",
})
addExample(map[uuid.UUID][]storiface.WorkerJob{
+18 -3
View File
@@ -8,12 +8,12 @@ import (
context "context"
json "encoding/json"
reflect "reflect"
time "time"
address "github.com/filecoin-project/go-address"
bitfield "github.com/filecoin-project/go-bitfield"
datatransfer "github.com/filecoin-project/go-data-transfer"
retrievalmarket "github.com/filecoin-project/go-fil-markets/retrievalmarket"
storagemarket "github.com/filecoin-project/go-fil-markets/storagemarket"
auth "github.com/filecoin-project/go-jsonrpc/auth"
abi "github.com/filecoin-project/go-state-types/abi"
big "github.com/filecoin-project/go-state-types/big"
@@ -745,10 +745,10 @@ func (mr *MockFullNodeMockRecorder) ClientMinerQueryOffer(arg0, arg1, arg2, arg3
}
// ClientQueryAsk mocks base method.
func (m *MockFullNode) ClientQueryAsk(arg0 context.Context, arg1 peer.ID, arg2 address.Address) (*storagemarket.StorageAsk, error) {
func (m *MockFullNode) ClientQueryAsk(arg0 context.Context, arg1 peer.ID, arg2 address.Address) (*api.StorageAsk, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ClientQueryAsk", arg0, arg1, arg2)
ret0, _ := ret[0].(*storagemarket.StorageAsk)
ret0, _ := ret[0].(*api.StorageAsk)
ret1, _ := ret[1].(error)
return ret0, ret1
}
@@ -1856,6 +1856,21 @@ func (mr *MockFullNodeMockRecorder) NetPeers(arg0 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetPeers", reflect.TypeOf((*MockFullNode)(nil).NetPeers), arg0)
}
// NetPing mocks base method.
func (m *MockFullNode) NetPing(arg0 context.Context, arg1 peer.ID) (time.Duration, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "NetPing", arg0, arg1)
ret0, _ := ret[0].(time.Duration)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// NetPing indicates an expected call of NetPing.
func (mr *MockFullNodeMockRecorder) NetPing(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetPing", reflect.TypeOf((*MockFullNode)(nil).NetPing), arg0, arg1)
}
// NetProtectAdd mocks base method.
func (m *MockFullNode) NetProtectAdd(arg0 context.Context, arg1 []peer.ID) error {
m.ctrl.T.Helper()
+105 -53
View File
@@ -25,12 +25,12 @@ import (
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/extern/sector-storage/fsutil"
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface"
"github.com/filecoin-project/lotus/journal/alerting"
"github.com/filecoin-project/lotus/node/modules/dtypes"
"github.com/filecoin-project/lotus/node/repo/imports"
"github.com/filecoin-project/specs-actors/v5/actors/runtime/proof"
"github.com/filecoin-project/specs-storage/storage"
"github.com/google/uuid"
"github.com/ipfs/go-cid"
@@ -190,7 +190,7 @@ type FullNodeStruct struct {
ClientMinerQueryOffer func(p0 context.Context, p1 address.Address, p2 cid.Cid, p3 *cid.Cid) (QueryOffer, error) `perm:"read"`
ClientQueryAsk func(p0 context.Context, p1 peer.ID, p2 address.Address) (*storagemarket.StorageAsk, error) `perm:"read"`
ClientQueryAsk func(p0 context.Context, p1 peer.ID, p2 address.Address) (*StorageAsk, error) `perm:"read"`
ClientRemoveImport func(p0 context.Context, p1 imports.ID) error `perm:"admin"`
@@ -597,6 +597,8 @@ type NetStruct struct {
NetPeers func(p0 context.Context) ([]peer.AddrInfo, error) `perm:"read"`
NetPing func(p0 context.Context, p1 peer.ID) (time.Duration, error) `perm:"read"`
NetProtectAdd func(p0 context.Context, p1 []peer.ID) error `perm:"admin"`
NetProtectList func(p0 context.Context) ([]peer.ID, error) `perm:"read"`
@@ -635,10 +637,12 @@ type StorageMinerStruct struct {
ActorSectorSize func(p0 context.Context, p1 address.Address) (abi.SectorSize, error) `perm:"read"`
CheckProvable func(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storage.SectorRef, p3 []bool, p4 bool) (map[abi.SectorNumber]string, error) `perm:"admin"`
CheckProvable func(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storage.SectorRef, p3 bool) (map[abi.SectorNumber]string, error) `perm:"admin"`
ComputeProof func(p0 context.Context, p1 []builtin.ExtendedSectorInfo, p2 abi.PoStRandomness, p3 abi.ChainEpoch, p4 abinetwork.Version) ([]builtin.PoStProof, error) `perm:"read"`
ComputeWindowPoSt func(p0 context.Context, p1 uint64, p2 types.TipSetKey) ([]miner.SubmitWindowedPoStParams, error) `perm:"admin"`
CreateBackup func(p0 context.Context, p1 string) error `perm:"admin"`
DagstoreGC func(p0 context.Context) ([]DagstoreShardResult, error) `perm:"admin"`
@@ -823,29 +827,29 @@ type StorageMinerStruct struct {
StorageAddLocal func(p0 context.Context, p1 string) error `perm:"admin"`
StorageAttach func(p0 context.Context, p1 stores.StorageInfo, p2 fsutil.FsStat) error `perm:"admin"`
StorageAttach func(p0 context.Context, p1 storiface.StorageInfo, p2 fsutil.FsStat) error `perm:"admin"`
StorageBestAlloc func(p0 context.Context, p1 storiface.SectorFileType, p2 abi.SectorSize, p3 storiface.PathType) ([]stores.StorageInfo, error) `perm:"admin"`
StorageBestAlloc func(p0 context.Context, p1 storiface.SectorFileType, p2 abi.SectorSize, p3 storiface.PathType) ([]storiface.StorageInfo, error) `perm:"admin"`
StorageDeclareSector func(p0 context.Context, p1 stores.ID, p2 abi.SectorID, p3 storiface.SectorFileType, p4 bool) error `perm:"admin"`
StorageDeclareSector func(p0 context.Context, p1 storiface.ID, p2 abi.SectorID, p3 storiface.SectorFileType, p4 bool) error `perm:"admin"`
StorageDropSector func(p0 context.Context, p1 stores.ID, p2 abi.SectorID, p3 storiface.SectorFileType) error `perm:"admin"`
StorageDropSector func(p0 context.Context, p1 storiface.ID, p2 abi.SectorID, p3 storiface.SectorFileType) error `perm:"admin"`
StorageFindSector func(p0 context.Context, p1 abi.SectorID, p2 storiface.SectorFileType, p3 abi.SectorSize, p4 bool) ([]stores.SectorStorageInfo, error) `perm:"admin"`
StorageFindSector func(p0 context.Context, p1 abi.SectorID, p2 storiface.SectorFileType, p3 abi.SectorSize, p4 bool) ([]storiface.SectorStorageInfo, error) `perm:"admin"`
StorageGetLocks func(p0 context.Context) (storiface.SectorLocks, error) `perm:"admin"`
StorageInfo func(p0 context.Context, p1 stores.ID) (stores.StorageInfo, error) `perm:"admin"`
StorageInfo func(p0 context.Context, p1 storiface.ID) (storiface.StorageInfo, error) `perm:"admin"`
StorageList func(p0 context.Context) (map[stores.ID][]stores.Decl, error) `perm:"admin"`
StorageList func(p0 context.Context) (map[storiface.ID][]storiface.Decl, error) `perm:"admin"`
StorageLocal func(p0 context.Context) (map[stores.ID]string, error) `perm:"admin"`
StorageLocal func(p0 context.Context) (map[storiface.ID]string, error) `perm:"admin"`
StorageLock func(p0 context.Context, p1 abi.SectorID, p2 storiface.SectorFileType, p3 storiface.SectorFileType) error `perm:"admin"`
StorageReportHealth func(p0 context.Context, p1 stores.ID, p2 stores.HealthReport) error `perm:"admin"`
StorageReportHealth func(p0 context.Context, p1 storiface.ID, p2 storiface.HealthReport) error `perm:"admin"`
StorageStat func(p0 context.Context, p1 stores.ID) (fsutil.FsStat, error) `perm:"admin"`
StorageStat func(p0 context.Context, p1 storiface.ID) (fsutil.FsStat, error) `perm:"admin"`
StorageTryLock func(p0 context.Context, p1 abi.SectorID, p2 storiface.SectorFileType, p3 storiface.SectorFileType) (bool, error) `perm:"admin"`
@@ -898,11 +902,15 @@ type WorkerStruct struct {
GenerateSectorKeyFromData func(p0 context.Context, p1 storage.SectorRef, p2 cid.Cid) (storiface.CallID, error) `perm:"admin"`
GenerateWindowPoSt func(p0 context.Context, p1 abi.RegisteredPoStProof, p2 abi.ActorID, p3 []storiface.PostSectorChallenge, p4 int, p5 abi.PoStRandomness) (storiface.WindowPoStResult, error) `perm:"admin"`
GenerateWinningPoSt func(p0 context.Context, p1 abi.RegisteredPoStProof, p2 abi.ActorID, p3 []storiface.PostSectorChallenge, p4 abi.PoStRandomness) ([]proof.PoStProof, error) `perm:"admin"`
Info func(p0 context.Context) (storiface.WorkerInfo, error) `perm:"admin"`
MoveStorage func(p0 context.Context, p1 storage.SectorRef, p2 storiface.SectorFileType) (storiface.CallID, error) `perm:"admin"`
Paths func(p0 context.Context) ([]stores.StoragePath, error) `perm:"admin"`
Paths func(p0 context.Context) ([]storiface.StoragePath, error) `perm:"admin"`
ProcessSession func(p0 context.Context) (uuid.UUID, error) `perm:"admin"`
@@ -1563,14 +1571,14 @@ func (s *FullNodeStub) ClientMinerQueryOffer(p0 context.Context, p1 address.Addr
return *new(QueryOffer), ErrNotSupported
}
func (s *FullNodeStruct) ClientQueryAsk(p0 context.Context, p1 peer.ID, p2 address.Address) (*storagemarket.StorageAsk, error) {
func (s *FullNodeStruct) ClientQueryAsk(p0 context.Context, p1 peer.ID, p2 address.Address) (*StorageAsk, error) {
if s.Internal.ClientQueryAsk == nil {
return nil, ErrNotSupported
}
return s.Internal.ClientQueryAsk(p0, p1, p2)
}
func (s *FullNodeStub) ClientQueryAsk(p0 context.Context, p1 peer.ID, p2 address.Address) (*storagemarket.StorageAsk, error) {
func (s *FullNodeStub) ClientQueryAsk(p0 context.Context, p1 peer.ID, p2 address.Address) (*StorageAsk, error) {
return nil, ErrNotSupported
}
@@ -3708,6 +3716,17 @@ func (s *NetStub) NetPeers(p0 context.Context) ([]peer.AddrInfo, error) {
return *new([]peer.AddrInfo), ErrNotSupported
}
func (s *NetStruct) NetPing(p0 context.Context, p1 peer.ID) (time.Duration, error) {
if s.Internal.NetPing == nil {
return *new(time.Duration), ErrNotSupported
}
return s.Internal.NetPing(p0, p1)
}
func (s *NetStub) NetPing(p0 context.Context, p1 peer.ID) (time.Duration, error) {
return *new(time.Duration), ErrNotSupported
}
func (s *NetStruct) NetProtectAdd(p0 context.Context, p1 []peer.ID) error {
if s.Internal.NetProtectAdd == nil {
return ErrNotSupported
@@ -3818,14 +3837,14 @@ func (s *StorageMinerStub) ActorSectorSize(p0 context.Context, p1 address.Addres
return *new(abi.SectorSize), ErrNotSupported
}
func (s *StorageMinerStruct) CheckProvable(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storage.SectorRef, p3 []bool, p4 bool) (map[abi.SectorNumber]string, error) {
func (s *StorageMinerStruct) CheckProvable(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storage.SectorRef, p3 bool) (map[abi.SectorNumber]string, error) {
if s.Internal.CheckProvable == nil {
return *new(map[abi.SectorNumber]string), ErrNotSupported
}
return s.Internal.CheckProvable(p0, p1, p2, p3, p4)
return s.Internal.CheckProvable(p0, p1, p2, p3)
}
func (s *StorageMinerStub) CheckProvable(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storage.SectorRef, p3 []bool, p4 bool) (map[abi.SectorNumber]string, error) {
func (s *StorageMinerStub) CheckProvable(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storage.SectorRef, p3 bool) (map[abi.SectorNumber]string, error) {
return *new(map[abi.SectorNumber]string), ErrNotSupported
}
@@ -3840,6 +3859,17 @@ func (s *StorageMinerStub) ComputeProof(p0 context.Context, p1 []builtin.Extende
return *new([]builtin.PoStProof), ErrNotSupported
}
func (s *StorageMinerStruct) ComputeWindowPoSt(p0 context.Context, p1 uint64, p2 types.TipSetKey) ([]miner.SubmitWindowedPoStParams, error) {
if s.Internal.ComputeWindowPoSt == nil {
return *new([]miner.SubmitWindowedPoStParams), ErrNotSupported
}
return s.Internal.ComputeWindowPoSt(p0, p1, p2)
}
func (s *StorageMinerStub) ComputeWindowPoSt(p0 context.Context, p1 uint64, p2 types.TipSetKey) ([]miner.SubmitWindowedPoStParams, error) {
return *new([]miner.SubmitWindowedPoStParams), ErrNotSupported
}
func (s *StorageMinerStruct) CreateBackup(p0 context.Context, p1 string) error {
if s.Internal.CreateBackup == nil {
return ErrNotSupported
@@ -4852,59 +4882,59 @@ func (s *StorageMinerStub) StorageAddLocal(p0 context.Context, p1 string) error
return ErrNotSupported
}
func (s *StorageMinerStruct) StorageAttach(p0 context.Context, p1 stores.StorageInfo, p2 fsutil.FsStat) error {
func (s *StorageMinerStruct) StorageAttach(p0 context.Context, p1 storiface.StorageInfo, p2 fsutil.FsStat) error {
if s.Internal.StorageAttach == nil {
return ErrNotSupported
}
return s.Internal.StorageAttach(p0, p1, p2)
}
func (s *StorageMinerStub) StorageAttach(p0 context.Context, p1 stores.StorageInfo, p2 fsutil.FsStat) error {
func (s *StorageMinerStub) StorageAttach(p0 context.Context, p1 storiface.StorageInfo, p2 fsutil.FsStat) error {
return ErrNotSupported
}
func (s *StorageMinerStruct) StorageBestAlloc(p0 context.Context, p1 storiface.SectorFileType, p2 abi.SectorSize, p3 storiface.PathType) ([]stores.StorageInfo, error) {
func (s *StorageMinerStruct) StorageBestAlloc(p0 context.Context, p1 storiface.SectorFileType, p2 abi.SectorSize, p3 storiface.PathType) ([]storiface.StorageInfo, error) {
if s.Internal.StorageBestAlloc == nil {
return *new([]stores.StorageInfo), ErrNotSupported
return *new([]storiface.StorageInfo), ErrNotSupported
}
return s.Internal.StorageBestAlloc(p0, p1, p2, p3)
}
func (s *StorageMinerStub) StorageBestAlloc(p0 context.Context, p1 storiface.SectorFileType, p2 abi.SectorSize, p3 storiface.PathType) ([]stores.StorageInfo, error) {
return *new([]stores.StorageInfo), ErrNotSupported
func (s *StorageMinerStub) StorageBestAlloc(p0 context.Context, p1 storiface.SectorFileType, p2 abi.SectorSize, p3 storiface.PathType) ([]storiface.StorageInfo, error) {
return *new([]storiface.StorageInfo), ErrNotSupported
}
func (s *StorageMinerStruct) StorageDeclareSector(p0 context.Context, p1 stores.ID, p2 abi.SectorID, p3 storiface.SectorFileType, p4 bool) error {
func (s *StorageMinerStruct) StorageDeclareSector(p0 context.Context, p1 storiface.ID, p2 abi.SectorID, p3 storiface.SectorFileType, p4 bool) error {
if s.Internal.StorageDeclareSector == nil {
return ErrNotSupported
}
return s.Internal.StorageDeclareSector(p0, p1, p2, p3, p4)
}
func (s *StorageMinerStub) StorageDeclareSector(p0 context.Context, p1 stores.ID, p2 abi.SectorID, p3 storiface.SectorFileType, p4 bool) error {
func (s *StorageMinerStub) StorageDeclareSector(p0 context.Context, p1 storiface.ID, p2 abi.SectorID, p3 storiface.SectorFileType, p4 bool) error {
return ErrNotSupported
}
func (s *StorageMinerStruct) StorageDropSector(p0 context.Context, p1 stores.ID, p2 abi.SectorID, p3 storiface.SectorFileType) error {
func (s *StorageMinerStruct) StorageDropSector(p0 context.Context, p1 storiface.ID, p2 abi.SectorID, p3 storiface.SectorFileType) error {
if s.Internal.StorageDropSector == nil {
return ErrNotSupported
}
return s.Internal.StorageDropSector(p0, p1, p2, p3)
}
func (s *StorageMinerStub) StorageDropSector(p0 context.Context, p1 stores.ID, p2 abi.SectorID, p3 storiface.SectorFileType) error {
func (s *StorageMinerStub) StorageDropSector(p0 context.Context, p1 storiface.ID, p2 abi.SectorID, p3 storiface.SectorFileType) error {
return ErrNotSupported
}
func (s *StorageMinerStruct) StorageFindSector(p0 context.Context, p1 abi.SectorID, p2 storiface.SectorFileType, p3 abi.SectorSize, p4 bool) ([]stores.SectorStorageInfo, error) {
func (s *StorageMinerStruct) StorageFindSector(p0 context.Context, p1 abi.SectorID, p2 storiface.SectorFileType, p3 abi.SectorSize, p4 bool) ([]storiface.SectorStorageInfo, error) {
if s.Internal.StorageFindSector == nil {
return *new([]stores.SectorStorageInfo), ErrNotSupported
return *new([]storiface.SectorStorageInfo), ErrNotSupported
}
return s.Internal.StorageFindSector(p0, p1, p2, p3, p4)
}
func (s *StorageMinerStub) StorageFindSector(p0 context.Context, p1 abi.SectorID, p2 storiface.SectorFileType, p3 abi.SectorSize, p4 bool) ([]stores.SectorStorageInfo, error) {
return *new([]stores.SectorStorageInfo), ErrNotSupported
func (s *StorageMinerStub) StorageFindSector(p0 context.Context, p1 abi.SectorID, p2 storiface.SectorFileType, p3 abi.SectorSize, p4 bool) ([]storiface.SectorStorageInfo, error) {
return *new([]storiface.SectorStorageInfo), ErrNotSupported
}
func (s *StorageMinerStruct) StorageGetLocks(p0 context.Context) (storiface.SectorLocks, error) {
@@ -4918,37 +4948,37 @@ func (s *StorageMinerStub) StorageGetLocks(p0 context.Context) (storiface.Sector
return *new(storiface.SectorLocks), ErrNotSupported
}
func (s *StorageMinerStruct) StorageInfo(p0 context.Context, p1 stores.ID) (stores.StorageInfo, error) {
func (s *StorageMinerStruct) StorageInfo(p0 context.Context, p1 storiface.ID) (storiface.StorageInfo, error) {
if s.Internal.StorageInfo == nil {
return *new(stores.StorageInfo), ErrNotSupported
return *new(storiface.StorageInfo), ErrNotSupported
}
return s.Internal.StorageInfo(p0, p1)
}
func (s *StorageMinerStub) StorageInfo(p0 context.Context, p1 stores.ID) (stores.StorageInfo, error) {
return *new(stores.StorageInfo), ErrNotSupported
func (s *StorageMinerStub) StorageInfo(p0 context.Context, p1 storiface.ID) (storiface.StorageInfo, error) {
return *new(storiface.StorageInfo), ErrNotSupported
}
func (s *StorageMinerStruct) StorageList(p0 context.Context) (map[stores.ID][]stores.Decl, error) {
func (s *StorageMinerStruct) StorageList(p0 context.Context) (map[storiface.ID][]storiface.Decl, error) {
if s.Internal.StorageList == nil {
return *new(map[stores.ID][]stores.Decl), ErrNotSupported
return *new(map[storiface.ID][]storiface.Decl), ErrNotSupported
}
return s.Internal.StorageList(p0)
}
func (s *StorageMinerStub) StorageList(p0 context.Context) (map[stores.ID][]stores.Decl, error) {
return *new(map[stores.ID][]stores.Decl), ErrNotSupported
func (s *StorageMinerStub) StorageList(p0 context.Context) (map[storiface.ID][]storiface.Decl, error) {
return *new(map[storiface.ID][]storiface.Decl), ErrNotSupported
}
func (s *StorageMinerStruct) StorageLocal(p0 context.Context) (map[stores.ID]string, error) {
func (s *StorageMinerStruct) StorageLocal(p0 context.Context) (map[storiface.ID]string, error) {
if s.Internal.StorageLocal == nil {
return *new(map[stores.ID]string), ErrNotSupported
return *new(map[storiface.ID]string), ErrNotSupported
}
return s.Internal.StorageLocal(p0)
}
func (s *StorageMinerStub) StorageLocal(p0 context.Context) (map[stores.ID]string, error) {
return *new(map[stores.ID]string), ErrNotSupported
func (s *StorageMinerStub) StorageLocal(p0 context.Context) (map[storiface.ID]string, error) {
return *new(map[storiface.ID]string), ErrNotSupported
}
func (s *StorageMinerStruct) StorageLock(p0 context.Context, p1 abi.SectorID, p2 storiface.SectorFileType, p3 storiface.SectorFileType) error {
@@ -4962,25 +4992,25 @@ func (s *StorageMinerStub) StorageLock(p0 context.Context, p1 abi.SectorID, p2 s
return ErrNotSupported
}
func (s *StorageMinerStruct) StorageReportHealth(p0 context.Context, p1 stores.ID, p2 stores.HealthReport) error {
func (s *StorageMinerStruct) StorageReportHealth(p0 context.Context, p1 storiface.ID, p2 storiface.HealthReport) error {
if s.Internal.StorageReportHealth == nil {
return ErrNotSupported
}
return s.Internal.StorageReportHealth(p0, p1, p2)
}
func (s *StorageMinerStub) StorageReportHealth(p0 context.Context, p1 stores.ID, p2 stores.HealthReport) error {
func (s *StorageMinerStub) StorageReportHealth(p0 context.Context, p1 storiface.ID, p2 storiface.HealthReport) error {
return ErrNotSupported
}
func (s *StorageMinerStruct) StorageStat(p0 context.Context, p1 stores.ID) (fsutil.FsStat, error) {
func (s *StorageMinerStruct) StorageStat(p0 context.Context, p1 storiface.ID) (fsutil.FsStat, error) {
if s.Internal.StorageStat == nil {
return *new(fsutil.FsStat), ErrNotSupported
}
return s.Internal.StorageStat(p0, p1)
}
func (s *StorageMinerStub) StorageStat(p0 context.Context, p1 stores.ID) (fsutil.FsStat, error) {
func (s *StorageMinerStub) StorageStat(p0 context.Context, p1 storiface.ID) (fsutil.FsStat, error) {
return *new(fsutil.FsStat), ErrNotSupported
}
@@ -5171,6 +5201,28 @@ func (s *WorkerStub) GenerateSectorKeyFromData(p0 context.Context, p1 storage.Se
return *new(storiface.CallID), ErrNotSupported
}
func (s *WorkerStruct) GenerateWindowPoSt(p0 context.Context, p1 abi.RegisteredPoStProof, p2 abi.ActorID, p3 []storiface.PostSectorChallenge, p4 int, p5 abi.PoStRandomness) (storiface.WindowPoStResult, error) {
if s.Internal.GenerateWindowPoSt == nil {
return *new(storiface.WindowPoStResult), ErrNotSupported
}
return s.Internal.GenerateWindowPoSt(p0, p1, p2, p3, p4, p5)
}
func (s *WorkerStub) GenerateWindowPoSt(p0 context.Context, p1 abi.RegisteredPoStProof, p2 abi.ActorID, p3 []storiface.PostSectorChallenge, p4 int, p5 abi.PoStRandomness) (storiface.WindowPoStResult, error) {
return *new(storiface.WindowPoStResult), ErrNotSupported
}
func (s *WorkerStruct) GenerateWinningPoSt(p0 context.Context, p1 abi.RegisteredPoStProof, p2 abi.ActorID, p3 []storiface.PostSectorChallenge, p4 abi.PoStRandomness) ([]proof.PoStProof, error) {
if s.Internal.GenerateWinningPoSt == nil {
return *new([]proof.PoStProof), ErrNotSupported
}
return s.Internal.GenerateWinningPoSt(p0, p1, p2, p3, p4)
}
func (s *WorkerStub) GenerateWinningPoSt(p0 context.Context, p1 abi.RegisteredPoStProof, p2 abi.ActorID, p3 []storiface.PostSectorChallenge, p4 abi.PoStRandomness) ([]proof.PoStProof, error) {
return *new([]proof.PoStProof), ErrNotSupported
}
func (s *WorkerStruct) Info(p0 context.Context) (storiface.WorkerInfo, error) {
if s.Internal.Info == nil {
return *new(storiface.WorkerInfo), ErrNotSupported
@@ -5193,15 +5245,15 @@ func (s *WorkerStub) MoveStorage(p0 context.Context, p1 storage.SectorRef, p2 st
return *new(storiface.CallID), ErrNotSupported
}
func (s *WorkerStruct) Paths(p0 context.Context) ([]stores.StoragePath, error) {
func (s *WorkerStruct) Paths(p0 context.Context) ([]storiface.StoragePath, error) {
if s.Internal.Paths == nil {
return *new([]stores.StoragePath), ErrNotSupported
return *new([]storiface.StoragePath), ErrNotSupported
}
return s.Internal.Paths(p0)
}
func (s *WorkerStub) Paths(p0 context.Context) ([]stores.StoragePath, error) {
return *new([]stores.StoragePath), ErrNotSupported
func (s *WorkerStub) Paths(p0 context.Context) ([]storiface.StoragePath, error) {
return *new([]storiface.StoragePath), ErrNotSupported
}
func (s *WorkerStruct) ProcessSession(p0 context.Context) (uuid.UUID, error) {
+3
View File
@@ -1,3 +1,4 @@
//stm: #unit
package api
import (
@@ -29,6 +30,7 @@ type StrC struct {
}
func TestGetInternalStructs(t *testing.T) {
//stm: @OTHER_IMPLEMENTATION_API_STRUCTS_001
var proxy StrA
sts := GetInternalStructs(&proxy)
@@ -44,6 +46,7 @@ func TestGetInternalStructs(t *testing.T) {
}
func TestNestedInternalStructs(t *testing.T) {
//stm: @OTHER_IMPLEMENTATION_API_STRUCTS_001
var proxy StrC
// check that only the top-level internal struct gets picked up
+16
View File
@@ -7,6 +7,7 @@ package v0mocks
import (
context "context"
reflect "reflect"
time "time"
address "github.com/filecoin-project/go-address"
bitfield "github.com/filecoin-project/go-bitfield"
@@ -1769,6 +1770,21 @@ func (mr *MockFullNodeMockRecorder) NetPeers(arg0 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetPeers", reflect.TypeOf((*MockFullNode)(nil).NetPeers), arg0)
}
// NetPing mocks base method.
func (m *MockFullNode) NetPing(arg0 context.Context, arg1 peer.ID) (time.Duration, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "NetPing", arg0, arg1)
ret0, _ := ret[0].(time.Duration)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// NetPing indicates an expected call of NetPing.
func (mr *MockFullNodeMockRecorder) NetPing(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetPing", reflect.TypeOf((*MockFullNode)(nil).NetPing), arg0, arg1)
}
// NetProtectAdd mocks base method.
func (m *MockFullNode) NetProtectAdd(arg0 context.Context, arg1 []peer.ID) error {
m.ctrl.T.Helper()
+11
View File
@@ -3,6 +3,9 @@ package v0api
import (
"context"
"github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/crypto"
@@ -341,4 +344,12 @@ func (w *WrapperV1Full) PaychGet(ctx context.Context, from, to address.Address,
return w.FullNode.PaychFund(ctx, from, to, amt)
}
func (w *WrapperV1Full) ClientQueryAsk(ctx context.Context, p peer.ID, miner address.Address) (*storagemarket.StorageAsk, error) {
a, err := w.FullNode.ClientQueryAsk(ctx, p, miner)
if err != nil {
return nil, err
}
return a.Response, nil
}
var _ FullNode = &WrapperV1Full{}
+13 -17
View File
@@ -1,10 +1,10 @@
//stm: #unit
package badgerbs
import (
"bytes"
"context"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
@@ -20,6 +20,8 @@ import (
)
func TestBadgerBlockstore(t *testing.T) {
//stm: @SPLITSTORE_BADGER_PUT_001, @SPLITSTORE_BADGER_POOLED_STORAGE_KEY_001
//stm: @SPLITSTORE_BADGER_OPEN_001, @SPLITSTORE_BADGER_CLOSE_001
(&Suite{
NewBlockstore: newBlockstore(DefaultOptions),
OpenBlockstore: openBlockstore(DefaultOptions),
@@ -38,6 +40,8 @@ func TestBadgerBlockstore(t *testing.T) {
}
func TestStorageKey(t *testing.T) {
//stm: @SPLITSTORE_BADGER_OPEN_001, @SPLITSTORE_BADGER_CLOSE_001
//stm: @SPLITSTORE_BADGER_STORAGE_KEY_001
bs, _ := newBlockstore(DefaultOptions)(t)
bbs := bs.(*Blockstore)
defer bbs.Close() //nolint:errcheck
@@ -73,20 +77,13 @@ func newBlockstore(optsSupplier func(path string) Options) func(tb testing.TB) (
return func(tb testing.TB) (bs blockstore.BasicBlockstore, path string) {
tb.Helper()
path, err := ioutil.TempDir("", "")
if err != nil {
tb.Fatal(err)
}
path = tb.TempDir()
db, err := Open(optsSupplier(path))
if err != nil {
tb.Fatal(err)
}
tb.Cleanup(func() {
_ = os.RemoveAll(path)
})
return db, path
}
}
@@ -100,17 +97,10 @@ func openBlockstore(optsSupplier func(path string) Options) func(tb testing.TB,
func testMove(t *testing.T, optsF func(string) Options) {
ctx := context.Background()
basePath, err := ioutil.TempDir("", "")
if err != nil {
t.Fatal(err)
}
basePath := t.TempDir()
dbPath := filepath.Join(basePath, "db")
t.Cleanup(func() {
_ = os.RemoveAll(basePath)
})
db, err := Open(optsF(dbPath))
if err != nil {
t.Fatal(err)
@@ -265,10 +255,16 @@ func testMove(t *testing.T, optsF func(string) Options) {
}
func TestMoveNoPrefix(t *testing.T) {
//stm: @SPLITSTORE_BADGER_OPEN_001, @SPLITSTORE_BADGER_CLOSE_001
//stm: @SPLITSTORE_BADGER_PUT_001, @SPLITSTORE_BADGER_POOLED_STORAGE_KEY_001
//stm: @SPLITSTORE_BADGER_DELETE_001, @SPLITSTORE_BADGER_COLLECT_GARBAGE_001
testMove(t, DefaultOptions)
}
func TestMoveWithPrefix(t *testing.T) {
//stm: @SPLITSTORE_BADGER_OPEN_001, @SPLITSTORE_BADGER_CLOSE_001
//stm: @SPLITSTORE_BADGER_PUT_001, @SPLITSTORE_BADGER_POOLED_STORAGE_KEY_001
//stm: @SPLITSTORE_BADGER_DELETE_001, @SPLITSTORE_BADGER_COLLECT_GARBAGE_001
testMove(t, func(path string) Options {
opts := DefaultOptions(path)
opts.Prefix = "/prefixed/"
@@ -1,3 +1,4 @@
//stm: #unit
package badgerbs
import (
@@ -44,6 +45,8 @@ func (s *Suite) RunTests(t *testing.T, prefix string) {
}
func (s *Suite) TestGetWhenKeyNotPresent(t *testing.T) {
//stm: @SPLITSTORE_BADGER_OPEN_001, @SPLITSTORE_BADGER_CLOSE_001
//stm: @SPLITSTORE_BADGER_GET_001, @SPLITSTORE_BADGER_POOLED_STORAGE_KEY_001
ctx := context.Background()
bs, _ := s.NewBlockstore(t)
if c, ok := bs.(io.Closer); ok {
@@ -57,6 +60,8 @@ func (s *Suite) TestGetWhenKeyNotPresent(t *testing.T) {
}
func (s *Suite) TestGetWhenKeyIsNil(t *testing.T) {
//stm: @SPLITSTORE_BADGER_OPEN_001, @SPLITSTORE_BADGER_CLOSE_001
//stm: @SPLITSTORE_BADGER_GET_001
ctx := context.Background()
bs, _ := s.NewBlockstore(t)
if c, ok := bs.(io.Closer); ok {
@@ -68,6 +73,9 @@ func (s *Suite) TestGetWhenKeyIsNil(t *testing.T) {
}
func (s *Suite) TestPutThenGetBlock(t *testing.T) {
//stm: @SPLITSTORE_BADGER_OPEN_001, @SPLITSTORE_BADGER_CLOSE_001
//stm: @SPLITSTORE_BADGER_PUT_001, @SPLITSTORE_BADGER_POOLED_STORAGE_KEY_001
//stm: @SPLITSTORE_BADGER_GET_001
ctx := context.Background()
bs, _ := s.NewBlockstore(t)
if c, ok := bs.(io.Closer); ok {
@@ -85,6 +93,8 @@ func (s *Suite) TestPutThenGetBlock(t *testing.T) {
}
func (s *Suite) TestHas(t *testing.T) {
//stm: @SPLITSTORE_BADGER_OPEN_001, @SPLITSTORE_BADGER_CLOSE_001
//stm: @SPLITSTORE_BADGER_HAS_001, @SPLITSTORE_BADGER_POOLED_STORAGE_KEY_001
ctx := context.Background()
bs, _ := s.NewBlockstore(t)
if c, ok := bs.(io.Closer); ok {
@@ -106,6 +116,9 @@ func (s *Suite) TestHas(t *testing.T) {
}
func (s *Suite) TestCidv0v1(t *testing.T) {
//stm: @SPLITSTORE_BADGER_OPEN_001, @SPLITSTORE_BADGER_CLOSE_001
//stm: @SPLITSTORE_BADGER_PUT_001, @SPLITSTORE_BADGER_POOLED_STORAGE_KEY_001
//stm: @SPLITSTORE_BADGER_GET_001
ctx := context.Background()
bs, _ := s.NewBlockstore(t)
if c, ok := bs.(io.Closer); ok {
@@ -123,6 +136,9 @@ func (s *Suite) TestCidv0v1(t *testing.T) {
}
func (s *Suite) TestPutThenGetSizeBlock(t *testing.T) {
//stm: @SPLITSTORE_BADGER_OPEN_001, @SPLITSTORE_BADGER_CLOSE_001
//stm: @SPLITSTORE_BADGER_PUT_001, @SPLITSTORE_BADGER_POOLED_STORAGE_KEY_001
//stm: @SPLITSTORE_BADGER_GET_SIZE_001
ctx := context.Background()
bs, _ := s.NewBlockstore(t)
@@ -154,6 +170,8 @@ func (s *Suite) TestPutThenGetSizeBlock(t *testing.T) {
}
func (s *Suite) TestAllKeysSimple(t *testing.T) {
//stm: @SPLITSTORE_BADGER_OPEN_001, @SPLITSTORE_BADGER_CLOSE_001
//stm: @SPLITSTORE_BADGER_PUT_001, @SPLITSTORE_BADGER_POOLED_STORAGE_KEY_001
bs, _ := s.NewBlockstore(t)
if c, ok := bs.(io.Closer); ok {
defer func() { require.NoError(t, c.Close()) }()
@@ -170,6 +188,9 @@ func (s *Suite) TestAllKeysSimple(t *testing.T) {
}
func (s *Suite) TestAllKeysRespectsContext(t *testing.T) {
//stm: @SPLITSTORE_BADGER_OPEN_001, @SPLITSTORE_BADGER_CLOSE_001
//stm: @SPLITSTORE_BADGER_PUT_001, @SPLITSTORE_BADGER_POOLED_STORAGE_KEY_001
//stm: @SPLITSTORE_BADGER_ALL_KEYS_CHAN_001
bs, _ := s.NewBlockstore(t)
if c, ok := bs.(io.Closer); ok {
defer func() { require.NoError(t, c.Close()) }()
@@ -200,6 +221,7 @@ func (s *Suite) TestAllKeysRespectsContext(t *testing.T) {
}
func (s *Suite) TestDoubleClose(t *testing.T) {
//stm: @SPLITSTORE_BADGER_OPEN_001, @SPLITSTORE_BADGER_CLOSE_001
bs, _ := s.NewBlockstore(t)
c, ok := bs.(io.Closer)
if !ok {
@@ -210,6 +232,9 @@ func (s *Suite) TestDoubleClose(t *testing.T) {
}
func (s *Suite) TestReopenPutGet(t *testing.T) {
//stm: @SPLITSTORE_BADGER_OPEN_001, @SPLITSTORE_BADGER_CLOSE_001
//stm: @SPLITSTORE_BADGER_PUT_001, @SPLITSTORE_BADGER_POOLED_STORAGE_KEY_001
//stm: @SPLITSTORE_BADGER_GET_001
ctx := context.Background()
bs, path := s.NewBlockstore(t)
c, ok := bs.(io.Closer)
@@ -236,6 +261,10 @@ func (s *Suite) TestReopenPutGet(t *testing.T) {
}
func (s *Suite) TestPutMany(t *testing.T) {
//stm: @SPLITSTORE_BADGER_OPEN_001, @SPLITSTORE_BADGER_CLOSE_001
//stm: @SPLITSTORE_BADGER_HAS_001, @SPLITSTORE_BADGER_POOLED_STORAGE_KEY_001
//stm: @SPLITSTORE_BADGER_GET_001, @SPLITSTORE_BADGER_PUT_MANY_001
//stm: @SPLITSTORE_BADGER_ALL_KEYS_CHAN_001
ctx := context.Background()
bs, _ := s.NewBlockstore(t)
if c, ok := bs.(io.Closer); ok {
@@ -268,6 +297,11 @@ func (s *Suite) TestPutMany(t *testing.T) {
}
func (s *Suite) TestDelete(t *testing.T) {
//stm: @SPLITSTORE_BADGER_PUT_001, @SPLITSTORE_BADGER_POOLED_STORAGE_KEY_001
//stm: @SPLITSTORE_BADGER_DELETE_001, @SPLITSTORE_BADGER_POOLED_STORAGE_HAS_001
//stm: @SPLITSTORE_BADGER_ALL_KEYS_CHAN_001, @SPLITSTORE_BADGER_HAS_001
//stm: @SPLITSTORE_BADGER_PUT_MANY_001
ctx := context.Background()
bs, _ := s.NewBlockstore(t)
if c, ok := bs.(io.Closer); ok {
+1 -10
View File
@@ -1,8 +1,6 @@
package splitstore
import (
"io/ioutil"
"os"
"path/filepath"
"testing"
@@ -11,14 +9,7 @@ import (
)
func TestCheckpoint(t *testing.T) {
dir, err := ioutil.TempDir("", "checkpoint.*")
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() {
_ = os.RemoveAll(dir)
})
dir := t.TempDir()
path := filepath.Join(dir, "checkpoint")
+1 -10
View File
@@ -2,8 +2,6 @@ package splitstore
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"testing"
@@ -12,14 +10,7 @@ import (
)
func TestColdSet(t *testing.T) {
dir, err := ioutil.TempDir("", "coldset.*")
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() {
_ = os.RemoveAll(dir)
})
dir := t.TempDir()
path := filepath.Join(dir, "coldset")
+15 -42
View File
@@ -1,8 +1,7 @@
//stm: #unit
package splitstore
import (
"io/ioutil"
"os"
"testing"
cid "github.com/ipfs/go-cid"
@@ -10,6 +9,8 @@ import (
)
func TestMapMarkSet(t *testing.T) {
//stm: @SPLITSTORE_MARKSET_CREATE_001, @SPLITSTORE_MARKSET_HAS_001, @@SPLITSTORE_MARKSET_MARK_001
//stm: @SPLITSTORE_MARKSET_CLOSE_001, @SPLITSTORE_MARKSET_CREATE_VISITOR_001
testMarkSet(t, "map")
testMarkSetRecovery(t, "map")
testMarkSetMarkMany(t, "map")
@@ -18,6 +19,8 @@ func TestMapMarkSet(t *testing.T) {
}
func TestBadgerMarkSet(t *testing.T) {
//stm: @SPLITSTORE_MARKSET_CREATE_001, @SPLITSTORE_MARKSET_HAS_001, @@SPLITSTORE_MARKSET_MARK_001
//stm: @SPLITSTORE_MARKSET_CLOSE_001, @SPLITSTORE_MARKSET_CREATE_VISITOR_001
bs := badgerMarkSetBatchSize
badgerMarkSetBatchSize = 1
t.Cleanup(func() {
@@ -31,14 +34,7 @@ func TestBadgerMarkSet(t *testing.T) {
}
func testMarkSet(t *testing.T, lsType string) {
path, err := ioutil.TempDir("", "markset.*")
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() {
_ = os.RemoveAll(path)
})
path := t.TempDir()
env, err := OpenMarkSetEnv(path, lsType)
if err != nil {
@@ -46,6 +42,7 @@ func testMarkSet(t *testing.T, lsType string) {
}
defer env.Close() //nolint:errcheck
// stm: @SPLITSTORE_MARKSET_CREATE_001
hotSet, err := env.New("hot", 0)
if err != nil {
t.Fatal(err)
@@ -65,6 +62,7 @@ func testMarkSet(t *testing.T, lsType string) {
return cid.NewCidV1(cid.Raw, h)
}
// stm: @SPLITSTORE_MARKSET_HAS_001
mustHave := func(s MarkSet, cid cid.Cid) {
t.Helper()
has, err := s.Has(cid)
@@ -94,6 +92,7 @@ func testMarkSet(t *testing.T, lsType string) {
k3 := makeCid("c")
k4 := makeCid("d")
// stm: @SPLITSTORE_MARKSET_MARK_001
hotSet.Mark(k1) //nolint
hotSet.Mark(k2) //nolint
coldSet.Mark(k3) //nolint
@@ -144,6 +143,7 @@ func testMarkSet(t *testing.T, lsType string) {
mustNotHave(coldSet, k3)
mustNotHave(coldSet, k4)
//stm: @SPLITSTORE_MARKSET_CLOSE_001
err = hotSet.Close()
if err != nil {
t.Fatal(err)
@@ -156,14 +156,7 @@ func testMarkSet(t *testing.T, lsType string) {
}
func testMarkSetVisitor(t *testing.T, lsType string) {
path, err := ioutil.TempDir("", "markset.*")
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() {
_ = os.RemoveAll(path)
})
path := t.TempDir()
env, err := OpenMarkSetEnv(path, lsType)
if err != nil {
@@ -171,6 +164,7 @@ func testMarkSetVisitor(t *testing.T, lsType string) {
}
defer env.Close() //nolint:errcheck
//stm: @SPLITSTORE_MARKSET_CREATE_VISITOR_001
visitor, err := env.New("test", 0)
if err != nil {
t.Fatal(err)
@@ -225,14 +219,7 @@ func testMarkSetVisitor(t *testing.T, lsType string) {
}
func testMarkSetVisitorRecovery(t *testing.T, lsType string) {
path, err := ioutil.TempDir("", "markset.*")
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() {
_ = os.RemoveAll(path)
})
path := t.TempDir()
env, err := OpenMarkSetEnv(path, lsType)
if err != nil {
@@ -324,14 +311,7 @@ func testMarkSetVisitorRecovery(t *testing.T, lsType string) {
}
func testMarkSetRecovery(t *testing.T, lsType string) {
path, err := ioutil.TempDir("", "markset.*")
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() {
_ = os.RemoveAll(path)
})
path := t.TempDir()
env, err := OpenMarkSetEnv(path, lsType)
if err != nil {
@@ -437,14 +417,7 @@ func testMarkSetRecovery(t *testing.T, lsType string) {
}
func testMarkSetMarkMany(t *testing.T, lsType string) {
path, err := ioutil.TempDir("", "markset.*")
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() {
_ = os.RemoveAll(path)
})
path := t.TempDir()
env, err := OpenMarkSetEnv(path, lsType)
if err != nil {
+14 -34
View File
@@ -1,12 +1,11 @@
//stm: #unit
package splitstore
import (
"context"
"errors"
"fmt"
"io/ioutil"
"math/rand"
"os"
"sync"
"sync/atomic"
"testing"
@@ -85,14 +84,7 @@ func testSplitStore(t *testing.T, cfg *Config) {
t.Fatal(err)
}
path, err := ioutil.TempDir("", "splitstore.*")
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() {
_ = os.RemoveAll(path)
})
path := t.TempDir()
// open the splitstore
ss, err := Open(path, ds, hot, cold, cfg)
@@ -228,10 +220,16 @@ func testSplitStore(t *testing.T, cfg *Config) {
}
func TestSplitStoreCompaction(t *testing.T) {
//stm: @SPLITSTORE_SPLITSTORE_OPEN_001, @SPLITSTORE_SPLITSTORE_CLOSE_001
//stm: @SPLITSTORE_SPLITSTORE_PUT_001, @SPLITSTORE_SPLITSTORE_ADD_PROTECTOR_001
//stm: @SPLITSTORE_SPLITSTORE_CLOSE_001
testSplitStore(t, &Config{MarkSetType: "map"})
}
func TestSplitStoreCompactionWithBadger(t *testing.T) {
//stm: @SPLITSTORE_SPLITSTORE_OPEN_001, @SPLITSTORE_SPLITSTORE_CLOSE_001
//stm: @SPLITSTORE_SPLITSTORE_PUT_001, @SPLITSTORE_SPLITSTORE_ADD_PROTECTOR_001
//stm: @SPLITSTORE_SPLITSTORE_CLOSE_001
bs := badgerMarkSetBatchSize
badgerMarkSetBatchSize = 1
t.Cleanup(func() {
@@ -241,6 +239,9 @@ func TestSplitStoreCompactionWithBadger(t *testing.T) {
}
func TestSplitStoreSuppressCompactionNearUpgrade(t *testing.T) {
//stm: @SPLITSTORE_SPLITSTORE_OPEN_001, @SPLITSTORE_SPLITSTORE_CLOSE_001
//stm: @SPLITSTORE_SPLITSTORE_PUT_001, @SPLITSTORE_SPLITSTORE_ADD_PROTECTOR_001
//stm: @SPLITSTORE_SPLITSTORE_CLOSE_001
ctx := context.Background()
chain := &mockChain{t: t}
@@ -277,14 +278,7 @@ func TestSplitStoreSuppressCompactionNearUpgrade(t *testing.T) {
t.Fatal(err)
}
path, err := ioutil.TempDir("", "splitstore.*")
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() {
_ = os.RemoveAll(path)
})
path := t.TempDir()
// open the splitstore
ss, err := Open(path, ds, hot, cold, &Config{MarkSetType: "map"})
@@ -424,14 +418,7 @@ func testSplitStoreReification(t *testing.T, f func(context.Context, blockstore.
}
}
path, err := ioutil.TempDir("", "splitstore.*")
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() {
_ = os.RemoveAll(path)
})
path := t.TempDir()
ss, err := Open(path, ds, hot, cold, &Config{MarkSetType: "map"})
if err != nil {
@@ -531,14 +518,7 @@ func testSplitStoreReificationLimit(t *testing.T, f func(context.Context, blocks
}
}
path, err := ioutil.TempDir("", "splitstore.*")
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() {
_ = os.RemoveAll(path)
})
path := t.TempDir()
ss, err := Open(path, ds, hot, cold, &Config{MarkSetType: "map"})
if err != nil {
+4
View File
@@ -1,3 +1,4 @@
//stm: #unit
package blockstore
import (
@@ -13,6 +14,9 @@ import (
)
func TestTimedCacheBlockstoreSimple(t *testing.T) {
//stm: @SPLITSTORE_TIMED_BLOCKSTORE_START_001
//stm: @SPLITSTORE_TIMED_BLOCKSTORE_PUT_001, @SPLITSTORE_TIMED_BLOCKSTORE_HAS_001, @SPLITSTORE_TIMED_BLOCKSTORE_GET_001
//stm: @SPLITSTORE_TIMED_BLOCKSTORE_ALL_KEYS_CHAN_001
tc := NewTimedCacheBlockstore(10 * time.Millisecond)
mClock := clock.NewMock()
mClock.Set(time.Now())
+5
View File
@@ -1,3 +1,4 @@
//stm: #unit
package blockstore
import (
@@ -15,6 +16,7 @@ var (
)
func TestUnionBlockstore_Get(t *testing.T) {
//stm: @SPLITSTORE_UNION_BLOCKSTORE_GET_001
ctx := context.Background()
m1 := NewMemory()
m2 := NewMemory()
@@ -34,6 +36,9 @@ func TestUnionBlockstore_Get(t *testing.T) {
}
func TestUnionBlockstore_Put_PutMany_Delete_AllKeysChan(t *testing.T) {
//stm: @SPLITSTORE_UNION_BLOCKSTORE_PUT_001, @SPLITSTORE_UNION_BLOCKSTORE_HAS_001
//stm: @SPLITSTORE_UNION_BLOCKSTORE_PUT_MANY_001, @SPLITSTORE_UNION_BLOCKSTORE_DELETE_001
//stm: @SPLITSTORE_UNION_BLOCKSTORE_ALL_KEYS_CHAN_001
ctx := context.Background()
m1 := NewMemory()
m2 := NewMemory()
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2
View File
@@ -1,3 +1,4 @@
//stm: #unit
package build
import (
@@ -7,6 +8,7 @@ import (
)
func TestOpenRPCDiscoverJSON_Version(t *testing.T) {
//stm: @OTHER_IMPLEMENTATION_OPENRPC_VERSION_001
// openRPCDocVersion is the current OpenRPC version of the API docs.
openRPCDocVersion := "1.2.6"
+1 -1
View File
@@ -37,7 +37,7 @@ func BuildTypeString() string {
}
// BuildVersion is the local build version
const BuildVersion = "1.15.1"
const BuildVersion = "1.15.2-rc2"
func UserVersion() string {
if os.Getenv("LOTUS_VERSION_IGNORE_COMMIT") == "1" {
+3
View File
@@ -1,3 +1,4 @@
//stm: #unit
package adt
import (
@@ -44,6 +45,7 @@ func TestDiffAdtArray(t *testing.T) {
changes := new(TestDiffArray)
//stm: @CHAIN_ADT_ARRAY_DIFF_001
assert.NoError(t, DiffAdtArray(arrA, arrB, changes))
assert.NotNil(t, changes)
@@ -98,6 +100,7 @@ func TestDiffAdtMap(t *testing.T) {
changes := new(TestDiffMap)
//stm: @CHAIN_ADT_MAP_DIFF_001
assert.NoError(t, DiffAdtMap(mapA, mapB, changes))
assert.NotNil(t, changes)
+3
View File
@@ -1,3 +1,4 @@
//stm: #unit
package aerrors_test
import (
@@ -11,6 +12,7 @@ import (
)
func TestFatalError(t *testing.T) {
//stm: @OTHER_IMPLEMENTATION_ACTOR_ERRORS_001
e1 := xerrors.New("out of disk space")
e2 := xerrors.Errorf("could not put node: %w", e1)
e3 := xerrors.Errorf("could not save head: %w", e2)
@@ -24,6 +26,7 @@ func TestFatalError(t *testing.T) {
assert.True(t, IsFatal(aw4), "should be fatal")
}
func TestAbsorbeError(t *testing.T) {
//stm: @OTHER_IMPLEMENTATION_ACTOR_ERRORS_001
e1 := xerrors.New("EOF")
e2 := xerrors.Errorf("could not decode: %w", e1)
ae := Absorb(e2, 35, "failed to decode CBOR")
+6
View File
@@ -1,3 +1,4 @@
//stm: #unit
package policy
import (
@@ -22,6 +23,7 @@ func TestSupportedProofTypes(t *testing.T) {
for t := range miner0.SupportedProofTypes {
oldTypes = append(oldTypes, t)
}
//stm: @BLOCKCHAIN_POLICY_SET_MAX_SUPPORTED_PROOF_TYPES_001
t.Cleanup(func() {
SetSupportedProofTypes(oldTypes...)
})
@@ -33,6 +35,7 @@ func TestSupportedProofTypes(t *testing.T) {
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
},
)
//stm: @BLOCKCHAIN_POLICY_ADD_MAX_SUPPORTED_PROOF_TYPES_001
AddSupportedProofTypes(abi.RegisteredSealProof_StackedDrg8MiBV1)
require.EqualValues(t,
miner0.SupportedProofTypes,
@@ -45,6 +48,7 @@ func TestSupportedProofTypes(t *testing.T) {
// Tests assumptions about policies being the same between actor versions.
func TestAssumptions(t *testing.T) {
//stm: @BLOCKCHAIN_POLICY_ASSUMPTIONS_001
require.EqualValues(t, miner0.SupportedProofTypes, miner2.PreCommitSealProofTypesV0)
require.Equal(t, miner0.PreCommitChallengeDelay, miner2.PreCommitChallengeDelay)
require.Equal(t, miner0.MaxSectorExpirationExtension, miner2.MaxSectorExpirationExtension)
@@ -58,6 +62,7 @@ func TestAssumptions(t *testing.T) {
}
func TestPartitionSizes(t *testing.T) {
//stm: @CHAIN_ACTOR_PARTITION_SIZES_001
for _, p := range abi.SealProofInfos {
sizeNew, err := builtin2.PoStProofWindowPoStPartitionSectors(p.WindowPoStProof)
require.NoError(t, err)
@@ -71,6 +76,7 @@ func TestPartitionSizes(t *testing.T) {
}
func TestPoStSize(t *testing.T) {
//stm: @BLOCKCHAIN_POLICY_GET_MAX_POST_PARTITIONS_001
v12PoStSize, err := GetMaxPoStPartitions(network.Version12, abi.RegisteredPoStProof_StackedDrgWindow64GiBV1)
require.Equal(t, 4, v12PoStSize)
require.NoError(t, err)
+2
View File
@@ -1,3 +1,5 @@
//stm: ignore
//Only tests external library behavior, therefore it should not be annotated
package drand
import (
+1 -1
View File
@@ -467,7 +467,7 @@ func (filec *FilecoinEC) checkBlockMessages(ctx context.Context, b *types.FullBl
}
nv := filec.sm.GetNetworkVersion(ctx, b.Header.Height)
pl := vm.PricelistByEpoch(b.Header.Height)
pl := vm.PricelistByEpochAndNetworkVersion(b.Header.Height, nv)
var sumGasLimit int64
checkMsg := func(msg types.ChainMsg) error {
m := msg.VMMessage()
+52
View File
@@ -1,3 +1,4 @@
//stm: #unit
package events
import (
@@ -358,6 +359,7 @@ func (fcs *fakeCS) advance(rev, app, drop int, msgs map[int]cid.Cid, nulls ...in
var _ EventAPI = &fakeCS{}
func TestAt(t *testing.T) {
//stm: @EVENTS_HEIGHT_CHAIN_AT_001, @EVENTS_HEIGHT_REVERT_001
fcs := newFakeCS(t)
events, err := NewEvents(context.Background(), fcs)
require.NoError(t, err)
@@ -418,6 +420,7 @@ func TestAt(t *testing.T) {
}
func TestAtNullTrigger(t *testing.T) {
//stm: @EVENTS_HEIGHT_CHAIN_AT_001
fcs := newFakeCS(t)
events, err := NewEvents(context.Background(), fcs)
require.NoError(t, err)
@@ -447,6 +450,7 @@ func TestAtNullTrigger(t *testing.T) {
}
func TestAtNullConf(t *testing.T) {
//stm: @EVENTS_HEIGHT_CHAIN_AT_001, @EVENTS_HEIGHT_REVERT_001
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -485,6 +489,7 @@ func TestAtNullConf(t *testing.T) {
}
func TestAtStart(t *testing.T) {
//stm: @EVENTS_HEIGHT_CHAIN_AT_001
fcs := newFakeCS(t)
events, err := NewEvents(context.Background(), fcs)
@@ -515,6 +520,7 @@ func TestAtStart(t *testing.T) {
}
func TestAtStartConfidence(t *testing.T) {
//stm: @EVENTS_HEIGHT_CHAIN_AT_001
fcs := newFakeCS(t)
events, err := NewEvents(context.Background(), fcs)
@@ -541,6 +547,7 @@ func TestAtStartConfidence(t *testing.T) {
}
func TestAtChained(t *testing.T) {
//stm: @EVENTS_HEIGHT_CHAIN_AT_001
fcs := newFakeCS(t)
events, err := NewEvents(context.Background(), fcs)
@@ -571,6 +578,7 @@ func TestAtChained(t *testing.T) {
}
func TestAtChainedConfidence(t *testing.T) {
//stm: @EVENTS_HEIGHT_CHAIN_AT_001
fcs := newFakeCS(t)
events, err := NewEvents(context.Background(), fcs)
@@ -601,6 +609,7 @@ func TestAtChainedConfidence(t *testing.T) {
}
func TestAtChainedConfidenceNull(t *testing.T) {
//stm: @EVENTS_HEIGHT_CHAIN_AT_001
fcs := newFakeCS(t)
events, err := NewEvents(context.Background(), fcs)
@@ -632,6 +641,7 @@ func matchAddrMethod(to address.Address, m abi.MethodNum) func(msg *types.Messag
}
func TestCalled(t *testing.T) {
//stm: @EVENTS_EVENTS_CALLED_001, @EVENTS_HEIGHT_REVERT_001
fcs := newFakeCS(t)
events, err := NewEvents(context.Background(), fcs)
@@ -837,6 +847,7 @@ func TestCalled(t *testing.T) {
}
func TestCalledTimeout(t *testing.T) {
//stm: @EVENTS_EVENTS_CALLED_001, @EVENTS_HEIGHT_REVERT_001
fcs := newFakeCS(t)
events, err := NewEvents(context.Background(), fcs)
@@ -897,6 +908,7 @@ func TestCalledTimeout(t *testing.T) {
}
func TestCalledOrder(t *testing.T) {
//stm: @EVENTS_EVENTS_CALLED_001, @EVENTS_HEIGHT_REVERT_001
fcs := newFakeCS(t)
events, err := NewEvents(context.Background(), fcs)
@@ -953,6 +965,7 @@ func TestCalledOrder(t *testing.T) {
}
func TestCalledNull(t *testing.T) {
//stm: @EVENTS_EVENTS_CALLED_001, @EVENTS_HEIGHT_REVERT_001
fcs := newFakeCS(t)
events, err := NewEvents(context.Background(), fcs)
@@ -1011,6 +1024,7 @@ func TestCalledNull(t *testing.T) {
}
func TestRemoveTriggersOnMessage(t *testing.T) {
//stm: @EVENTS_EVENTS_CALLED_001, @EVENTS_HEIGHT_REVERT_001
fcs := newFakeCS(t)
events, err := NewEvents(context.Background(), fcs)
@@ -1094,6 +1108,7 @@ type testStateChange struct {
}
func TestStateChanged(t *testing.T) {
//stm: @EVENTS_EVENTS_CALLED_001, @EVENTS_HEIGHT_REVERT_001
fcs := newFakeCS(t)
events, err := NewEvents(context.Background(), fcs)
@@ -1179,6 +1194,7 @@ func TestStateChanged(t *testing.T) {
}
func TestStateChangedRevert(t *testing.T) {
//stm: @EVENTS_EVENTS_CALLED_001, @EVENTS_HEIGHT_REVERT_001
fcs := newFakeCS(t)
events, err := NewEvents(context.Background(), fcs)
@@ -1255,6 +1271,7 @@ func TestStateChangedRevert(t *testing.T) {
}
func TestStateChangedTimeout(t *testing.T) {
//stm: @EVENTS_EVENTS_CALLED_001, @EVENTS_HEIGHT_REVERT_001
timeoutHeight := abi.ChainEpoch(20)
confidence := 3
@@ -1332,6 +1349,7 @@ func TestStateChangedTimeout(t *testing.T) {
}
func TestCalledMultiplePerEpoch(t *testing.T) {
//stm: @EVENTS_EVENTS_CALLED_001, @EVENTS_HEIGHT_REVERT_001
fcs := newFakeCS(t)
events, err := NewEvents(context.Background(), fcs)
@@ -1384,6 +1402,7 @@ func TestCalledMultiplePerEpoch(t *testing.T) {
}
func TestCachedSameBlock(t *testing.T) {
//stm: @EVENTS_EVENTS_CALLED_001, @EVENTS_HEIGHT_REVERT_001
fcs := newFakeCS(t)
_, err := NewEvents(context.Background(), fcs)
@@ -1418,6 +1437,7 @@ func (t *testObserver) Revert(_ context.Context, from, to *types.TipSet) error {
}
func TestReconnect(t *testing.T) {
//stm: @EVENTS_EVENTS_CALLED_001, @EVENTS_HEIGHT_REVERT_001
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -1449,3 +1469,35 @@ func TestReconnect(t *testing.T) {
fcs.advance(0, 5, 2, nil, 0, 1, 3)
require.True(t, fcs.callNumber["ChainGetPath"] == 4)
}
func TestUnregister(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
fcs := newFakeCS(t)
events, err := NewEvents(ctx, fcs)
require.NoError(t, err)
tsObs := &testObserver{t: t}
events.Observe(tsObs)
// observer receives heads as the chain advances
fcs.advance(0, 1, 0, nil)
headBeforeDeregister := events.lastTs
require.Equal(t, tsObs.head, headBeforeDeregister)
// observer unregistered successfully
found := events.Unregister(tsObs)
require.True(t, found)
// observer stops receiving heads as the chain advances
fcs.advance(0, 1, 0, nil)
require.Equal(t, tsObs.head, headBeforeDeregister)
require.NotEqual(t, tsObs.head, events.lastTs)
// unregistering an invalid observer returns false
dneObs := &testObserver{t: t}
found = events.Unregister(dneObs)
require.False(t, found)
}
+24
View File
@@ -253,3 +253,27 @@ func (o *observer) Observe(obs TipSetObserver) *types.TipSet {
o.observers = append(o.observers, obs)
return o.head
}
// Unregister unregisters an observer. Returns true if we successfully removed the observer.
//
// NOTE: The observer _may_ be called after being removed. Observers MUST handle this case
// internally.
func (o *observer) Unregister(obs TipSetObserver) (found bool) {
o.lk.Lock()
defer o.lk.Unlock()
// We _copy_ the observers list because we may be concurrently reading it from a headChange
// handler.
//
// This should happen infrequently, so it's fine if we spend a bit of time here.
newObservers := make([]TipSetObserver, 0, len(o.observers))
for _, existingObs := range o.observers {
if existingObs == obs {
found = true
continue
}
newObservers = append(newObservers, existingObs)
}
o.observers = newObservers
return found
}
+9
View File
@@ -1,3 +1,4 @@
//stm: #unit
package state
import (
@@ -35,6 +36,12 @@ func init() {
}
func TestMarketPredicates(t *testing.T) {
//stm: @EVENTS_PREDICATES_ON_ACTOR_STATE_CHANGED_001, @EVENTS_PREDICATES_DEAL_STATE_CHANGED_001
//stm: @EVENTS_PREDICATES_DEAL_CHANGED_FOR_IDS
//stm: @EVENTS_PREDICATES_ON_BALANCE_CHANGED_001, @EVENTS_PREDICATES_BALANCE_CHANGED_FOR_ADDRESS_001
//stm: @EVENTS_PREDICATES_ON_DEAL_PROPOSAL_CHANGED_001, @EVENTS_PREDICATES_PROPOSAL_AMT_CHANGED_001
//stm: @EVENTS_PREDICATES_DEAL_STATE_CHANGED_001, @EVENTS_PREDICATES_DEAL_AMT_CHANGED_001
ctx := context.Background()
bs := bstore.NewMemorySync()
store := adt2.WrapStore(ctx, cbornode.NewCborStore(bs))
@@ -333,6 +340,8 @@ func TestMarketPredicates(t *testing.T) {
}
func TestMinerSectorChange(t *testing.T) {
//stm: @EVENTS_PREDICATES_ON_ACTOR_STATE_CHANGED_001, @EVENTS_PREDICATES_MINER_ACTOR_CHANGE_001
//stm: @EVENTS_PREDICATES_MINER_SECTOR_CHANGE_001
ctx := context.Background()
bs := bstore.NewMemorySync()
store := adt2.WrapStore(ctx, cbornode.NewCborStore(bs))
+6
View File
@@ -1,3 +1,4 @@
//stm: #unit
package events
import (
@@ -92,6 +93,7 @@ func (h *cacheHarness) skip(n abi.ChainEpoch) {
}
func TestTsCache(t *testing.T) {
//stm: @EVENTS_CACHE_GET_CHAIN_HEAD_001, @EVENTS_CACHE_GET_001, @EVENTS_CACHE_ADD_001
h := newCacheharness(t)
for i := 0; i < 9000; i++ {
@@ -104,6 +106,8 @@ func TestTsCache(t *testing.T) {
}
func TestTsCacheNulls(t *testing.T) {
//stm: @EVENTS_CACHE_GET_CHAIN_HEAD_001, @EVENTS_CACHE_GET_CHAIN_TIPSET_BEFORE_001, @EVENTS_CACHE_GET_CHAIN_TIPSET_AFTER_001
//stm: @EVENTS_CACHE_GET_001, @EVENTS_CACHE_ADD_001
ctx := context.Background()
h := newCacheharness(t)
@@ -182,6 +186,7 @@ func (tc *tsCacheAPIStorageCallCounter) ChainGetTipSet(ctx context.Context, tsk
}
func TestTsCacheEmpty(t *testing.T) {
//stm: @EVENTS_CACHE_GET_CHAIN_HEAD_001
// Calling best on an empty cache should just call out to the chain API
callCounter := &tsCacheAPIStorageCallCounter{t: t}
tsc := newTSCache(callCounter, 50)
@@ -191,6 +196,7 @@ func TestTsCacheEmpty(t *testing.T) {
}
func TestTsCacheSkip(t *testing.T) {
//stm: @EVENTS_CACHE_GET_CHAIN_HEAD_001, @EVENTS_CACHE_GET_001, @EVENTS_CACHE_ADD_001
h := newCacheharness(t)
ts, err := types.NewTipSet([]*types.BlockHeader{{
+2
View File
@@ -1,3 +1,4 @@
//stm: #unit
package gen
import (
@@ -34,6 +35,7 @@ func testGeneration(t testing.TB, n int, msgs int, sectors int) {
}
func TestChainGeneration(t *testing.T) {
//stm: @CHAIN_GEN_NEW_GEN_WITH_SECTORS_001, @CHAIN_GEN_NEXT_TIPSET_001
t.Run("10-20-1", func(t *testing.T) { testGeneration(t, 10, 20, 1) })
t.Run("10-20-25", func(t *testing.T) { testGeneration(t, 10, 20, 25) })
}
+8
View File
@@ -1,3 +1,4 @@
//stm: #unit
package market
import (
@@ -22,6 +23,7 @@ import (
// TestFundManagerBasic verifies that the basic fund manager operations work
func TestFundManagerBasic(t *testing.T) {
//stm: @MARKET_RESERVE_FUNDS_001, @MARKET_RELEASE_FUNDS_001, @MARKET_WITHDRAW_FUNDS_001
s := setup(t)
defer s.fm.Stop()
@@ -106,6 +108,7 @@ func TestFundManagerBasic(t *testing.T) {
// TestFundManagerParallel verifies that operations can be run in parallel
func TestFundManagerParallel(t *testing.T) {
//stm: @MARKET_RESERVE_FUNDS_001, @MARKET_RELEASE_FUNDS_001, @MARKET_WITHDRAW_FUNDS_001
s := setup(t)
defer s.fm.Stop()
@@ -197,6 +200,7 @@ func TestFundManagerParallel(t *testing.T) {
// TestFundManagerReserveByWallet verifies that reserve requests are grouped by wallet
func TestFundManagerReserveByWallet(t *testing.T) {
//stm: @MARKET_RESERVE_FUNDS_001
s := setup(t)
defer s.fm.Stop()
@@ -290,6 +294,7 @@ func TestFundManagerReserveByWallet(t *testing.T) {
// TestFundManagerWithdrawal verifies that as many withdraw operations as
// possible are processed
func TestFundManagerWithdrawalLimit(t *testing.T) {
//stm: @MARKET_RESERVE_FUNDS_001, @MARKET_RELEASE_FUNDS_001, @MARKET_WITHDRAW_FUNDS_001
s := setup(t)
defer s.fm.Stop()
@@ -384,6 +389,7 @@ func TestFundManagerWithdrawalLimit(t *testing.T) {
// TestFundManagerWithdrawByWallet verifies that withdraw requests are grouped by wallet
func TestFundManagerWithdrawByWallet(t *testing.T) {
//stm: @MARKET_RESERVE_FUNDS_001, @MARKET_RELEASE_FUNDS_001, @MARKET_WITHDRAW_FUNDS_001
s := setup(t)
defer s.fm.Stop()
@@ -493,6 +499,7 @@ func TestFundManagerWithdrawByWallet(t *testing.T) {
// TestFundManagerRestart verifies that waiting for incomplete requests resumes
// on restart
func TestFundManagerRestart(t *testing.T) {
//stm: @MARKET_RESERVE_FUNDS_001
s := setup(t)
defer s.fm.Stop()
@@ -559,6 +566,7 @@ func TestFundManagerRestart(t *testing.T) {
// 3. Deal B completes, reducing addr1 by 7: reserved 12 available 12 -> 5
// 4. Deal A releases 5 from addr1: reserved 12 -> 7 available 5
func TestFundManagerReleaseAfterPublish(t *testing.T) {
//stm: @MARKET_RESERVE_FUNDS_001, @MARKET_RELEASE_FUNDS_001
s := setup(t)
defer s.fm.Stop()
+3
View File
@@ -1,3 +1,4 @@
//stm: #unit
package messagepool
import (
@@ -8,6 +9,7 @@ import (
)
func TestBlockProbability(t *testing.T) {
//stm: @OTHER_IMPLEMENTATION_BLOCK_PROB_001
mp := &MessagePool{}
bp := mp.blockProbabilities(1 - 0.15)
t.Logf("%+v\n", bp)
@@ -20,6 +22,7 @@ func TestBlockProbability(t *testing.T) {
}
func TestWinnerProba(t *testing.T) {
//stm: @OTHER_IMPLEMENTATION_BLOCK_PROB_002
rand.Seed(time.Now().UnixNano())
const N = 1000000
winnerProba := noWinnersProb()
+2 -3
View File
@@ -281,12 +281,11 @@ func (mp *MessagePool) checkMessages(ctx context.Context, msgs []*types.Message,
// gas checks
// 4. Min Gas
minGas := vm.PricelistByEpoch(epoch).OnChainMessage(m.ChainLength())
minGas := vm.PricelistByEpochAndNetworkVersion(epoch, nv).OnChainMessage(m.ChainLength())
check = api.MessageCheckStatus{
Cid: m.Cid(),
CheckStatus: api.CheckStatus{
Code: api.CheckStatusMessageMinGas,
CheckStatus: api.CheckStatus{Code: api.CheckStatusMessageMinGas,
Hint: map[string]interface{}{
"minGas": minGas,
},
+5 -1
View File
@@ -629,7 +629,11 @@ func (mp *MessagePool) addLocal(ctx context.Context, m *types.SignedMessage) err
// a (soft) validation error.
func (mp *MessagePool) verifyMsgBeforeAdd(m *types.SignedMessage, curTs *types.TipSet, local bool) (bool, error) {
epoch := curTs.Height() + 1
minGas := vm.PricelistByEpoch(epoch).OnChainMessage(m.ChainLength())
nv, err := mp.getNtwkVersion(epoch)
if err != nil {
return false, xerrors.Errorf("getting network version: %w", err)
}
minGas := vm.PricelistByEpochAndNetworkVersion(epoch, nv).OnChainMessage(m.ChainLength())
if err := m.VMMessage().ValidForBlockInclusion(minGas.Total(), build.NewestNetworkVersion); err != nil {
return false, xerrors.Errorf("message will not be included in a block: %w", err)
+22 -10
View File
@@ -854,7 +854,6 @@ func TestMessageValueTooHigh(t *testing.T) {
Message: *msg,
Signature: *sig,
}
err = mp.Add(context.TODO(), sm)
assert.Error(t, err)
}
@@ -901,8 +900,7 @@ func TestMessageSignatureInvalid(t *testing.T) {
}
err = mp.Add(context.TODO(), sm)
assert.Error(t, err)
// assert.Contains(t, err.Error(), "invalid signature length")
assert.Error(t, err)
assert.Contains(t, err.Error(), "invalid signature length")
}
}
@@ -926,14 +924,29 @@ func TestAddMessageTwice(t *testing.T) {
to := mock.Address(1001)
{
// create a valid messages
sm := makeTestMessage(w, from, to, 0, 50_000_000, minimumBaseFee.Uint64())
msg := &types.Message{
To: to,
From: from,
Value: types.NewInt(1),
Nonce: 0,
GasLimit: 50000000,
GasFeeCap: types.NewInt(minimumBaseFee.Uint64()),
GasPremium: types.NewInt(1),
Params: make([]byte, 32<<10),
}
sig, err := w.WalletSign(context.TODO(), from, msg.Cid().Bytes(), api.MsgMeta{})
if err != nil {
panic(err)
}
sm := &types.SignedMessage{
Message: *msg,
Signature: *sig,
}
mustAdd(t, mp, sm)
// try to add it twice
err = mp.Add(context.TODO(), sm)
// assert.Contains(t, err.Error(), "with nonce 0 already in mpool")
assert.Error(t, err)
assert.Contains(t, err.Error(), "with nonce 0 already in mpool")
}
}
@@ -963,8 +976,7 @@ func TestAddMessageTwiceNonceGap(t *testing.T) {
// then try to add message again
err = mp.Add(context.TODO(), sm)
// assert.Contains(t, err.Error(), "unfulfilled nonce gap")
assert.Error(t, err)
assert.Contains(t, err.Error(), "unfulfilled nonce gap")
}
}
+8 -1
View File
@@ -781,6 +781,7 @@ func (mp *MessagePool) createMessageChains(actor address.Address, mset map[uint6
// cannot exceed the block limit; drop all messages that exceed the limit
// - the total gasReward cannot exceed the actor's balance; drop all messages that exceed
// the balance
a, err := mp.api.GetActorAfter(actor, ts)
if err != nil {
log.Errorf("failed to load actor state, not building chain for %s: %v", actor, err)
@@ -793,6 +794,12 @@ func (mp *MessagePool) createMessageChains(actor address.Address, mset map[uint6
skip := 0
i := 0
rewards := make([]*big.Int, 0, len(msgs))
nv, err := mp.getNtwkVersion(ts.Height())
if err != nil {
log.Errorf("getting network version: %v", err)
return nil
}
for i = 0; i < len(msgs); i++ {
m := msgs[i]
@@ -808,7 +815,7 @@ func (mp *MessagePool) createMessageChains(actor address.Address, mset map[uint6
}
curNonce++
minGas := vm.PricelistByEpoch(ts.Height()).OnChainMessage(m.ChainLength()).Total()
minGas := vm.PricelistByEpochAndNetworkVersion(ts.Height(), nv).OnChainMessage(m.ChainLength()).Total()
if m.Message.GasLimit < minGas {
break
}
+11
View File
@@ -1,3 +1,4 @@
//stm: #unit
package state
import (
@@ -18,6 +19,7 @@ import (
)
func BenchmarkStateTreeSet(b *testing.B) {
//stm: @CHAIN_STATETREE_SET_ACTOR_001
cst := cbor.NewMemCborStore()
st, err := NewStateTree(cst, types.StateTreeVersion1)
if err != nil {
@@ -45,6 +47,7 @@ func BenchmarkStateTreeSet(b *testing.B) {
}
func BenchmarkStateTreeSetFlush(b *testing.B) {
//stm: @CHAIN_STATETREE_SET_ACTOR_001
cst := cbor.NewMemCborStore()
sv, err := VersionForNetwork(build.NewestNetworkVersion)
if err != nil {
@@ -80,6 +83,8 @@ func BenchmarkStateTreeSetFlush(b *testing.B) {
}
func TestResolveCache(t *testing.T) {
//stm: @CHAIN_STATETREE_SET_ACTOR_001, @CHAIN_STATETREE_GET_ACTOR_001, @CHAIN_STATETREE_VERSION_FOR_NETWORK_001
//stm: @CHAIN_STATETREE_SNAPSHOT_001, @CHAIN_STATETREE_SNAPSHOT_CLEAR_001
cst := cbor.NewMemCborStore()
sv, err := VersionForNetwork(build.NewestNetworkVersion)
if err != nil {
@@ -182,6 +187,8 @@ func TestResolveCache(t *testing.T) {
}
func BenchmarkStateTree10kGetActor(b *testing.B) {
//stm: @CHAIN_STATETREE_SET_ACTOR_001, @CHAIN_STATETREE_GET_ACTOR_001, @CHAIN_STATETREE_VERSION_FOR_NETWORK_001
//stm: @CHAIN_STATETREE_FLUSH_001
cst := cbor.NewMemCborStore()
sv, err := VersionForNetwork(build.NewestNetworkVersion)
if err != nil {
@@ -229,6 +236,7 @@ func BenchmarkStateTree10kGetActor(b *testing.B) {
}
func TestSetCache(t *testing.T) {
//stm: @CHAIN_STATETREE_SET_ACTOR_001, @CHAIN_STATETREE_GET_ACTOR_001, @CHAIN_STATETREE_VERSION_FOR_NETWORK_001
cst := cbor.NewMemCborStore()
sv, err := VersionForNetwork(build.NewestNetworkVersion)
if err != nil {
@@ -270,6 +278,8 @@ func TestSetCache(t *testing.T) {
}
func TestSnapshots(t *testing.T) {
//stm: @CHAIN_STATETREE_SET_ACTOR_001, @CHAIN_STATETREE_GET_ACTOR_001, @CHAIN_STATETREE_VERSION_FOR_NETWORK_001
//stm: @CHAIN_STATETREE_FLUSH_001, @CHAIN_STATETREE_SNAPSHOT_REVERT_001, CHAIN_STATETREE_SNAPSHOT_CLEAR_001
ctx := context.Background()
cst := cbor.NewMemCborStore()
@@ -360,6 +370,7 @@ func assertNotHas(t *testing.T, st *StateTree, addr address.Address) {
}
func TestStateTreeConsistency(t *testing.T) {
//stm: @CHAIN_STATETREE_SET_ACTOR_001, @CHAIN_STATETREE_VERSION_FOR_NETWORK_001, @CHAIN_STATETREE_FLUSH_001
cst := cbor.NewMemCborStore()
// TODO: ActorUpgrade: this test tests pre actors v2
+4 -1
View File
@@ -8,6 +8,8 @@ import (
"sync"
"time"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/specs-actors/v7/actors/migration/nv15"
"github.com/ipfs/go-cid"
@@ -161,7 +163,8 @@ func (us UpgradeSchedule) GetNtwkVersion(e abi.ChainEpoch) (network.Version, err
return u.Network, nil
}
}
return network.Version0, xerrors.Errorf("Epoch %d has no defined network version", e)
return build.GenesisNetworkVersion, nil
}
func (sm *StateManager) HandleStateForks(ctx context.Context, root cid.Cid, height abi.ChainEpoch, cb ExecMonitor, ts *types.TipSet) (cid.Cid, error) {
+8
View File
@@ -1,3 +1,4 @@
//stm: #integration
package stmgr_test
import (
@@ -106,6 +107,9 @@ func (ta *testActor) TestMethod(rt rt2.Runtime, params *abi.EmptyValue) *abi.Emp
}
func TestForkHeightTriggers(t *testing.T) {
//stm: @CHAIN_STATETREE_GET_ACTOR_001, @CHAIN_STATETREE_FLUSH_001, @TOKEN_WALLET_SIGN_001
//stm: @CHAIN_GEN_NEXT_TIPSET_001
//stm: @CHAIN_STATE_RESOLVE_TO_KEY_ADDR_001, @CHAIN_STATE_SET_VM_CONSTRUCTOR_001
logging.SetAllLoggers(logging.LevelInfo)
ctx := context.TODO()
@@ -241,6 +245,8 @@ func TestForkHeightTriggers(t *testing.T) {
}
func TestForkRefuseCall(t *testing.T) {
//stm: @CHAIN_GEN_NEXT_TIPSET_001, @CHAIN_GEN_NEXT_TIPSET_FROM_MINERS_001
//stm: @CHAIN_STATE_RESOLVE_TO_KEY_ADDR_001, @CHAIN_STATE_SET_VM_CONSTRUCTOR_001, @CHAIN_STATE_CALL_001
logging.SetAllLoggers(logging.LevelInfo)
for after := 0; after < 3; after++ {
@@ -360,6 +366,8 @@ func testForkRefuseCall(t *testing.T, nullsBefore, nullsAfter int) {
}
func TestForkPreMigration(t *testing.T) {
//stm: @CHAIN_GEN_NEXT_TIPSET_001,
//stm: @CHAIN_STATE_RESOLVE_TO_KEY_ADDR_001, @CHAIN_STATE_SET_VM_CONSTRUCTOR_001
logging.SetAllLoggers(logging.LevelInfo)
cg, err := gen.NewGenerator()
+3
View File
@@ -1,3 +1,4 @@
//stm: #unit
package stmgr_test
import (
@@ -12,6 +13,8 @@ import (
)
func TestSearchForMessageReplacements(t *testing.T) {
//stm: @CHAIN_GEN_NEXT_TIPSET_001
//stm: @CHAIN_STATE_SEARCH_MSG_001
ctx := context.Background()
cg, err := gen.NewGenerator()
if err != nil {
+3
View File
@@ -1,3 +1,5 @@
//stm: #unit
package store
import (
@@ -10,6 +12,7 @@ import (
)
func TestBaseFee(t *testing.T) {
//stm: @CHAIN_STORE_COMPUTE_NEXT_BASE_FEE_001
tests := []struct {
basefee uint64
limitUsed int64
+4
View File
@@ -1,3 +1,4 @@
//stm: #unit
package store_test
import (
@@ -10,6 +11,9 @@ import (
)
func TestChainCheckpoint(t *testing.T) {
//stm: @CHAIN_GEN_NEXT_TIPSET_FROM_MINERS_001
//stm: @CHAIN_STORE_GET_TIPSET_FROM_KEY_001, @CHAIN_STORE_SET_HEAD_001, @CHAIN_STORE_GET_HEAVIEST_TIPSET_001
//stm: @CHAIN_STORE_SET_CHECKPOINT_001, @CHAIN_STORE_MAYBE_TAKE_HEAVIER_TIPSET_001, @CHAIN_STORE_REMOVE_CHECKPOINT_001
ctx := context.Background()
cg, err := gen.NewGenerator()
+2
View File
@@ -1,3 +1,4 @@
//stm: #unit
package store
import (
@@ -9,6 +10,7 @@ import (
)
func TestHeadChangeCoalescer(t *testing.T) {
//stm: @CHAIN_STORE_COALESCE_HEAD_CHANGE_001
notif := make(chan headChange, 1)
c := NewHeadChangeCoalescer(func(revert, apply []*types.TipSet) error {
notif <- headChange{apply: apply, revert: revert}
+4
View File
@@ -1,3 +1,4 @@
//stm: #unit
package store_test
import (
@@ -17,6 +18,9 @@ import (
)
func TestIndexSeeks(t *testing.T) {
//stm: @CHAIN_STORE_IMPORT_001
//stm: @CHAIN_STORE_GET_TIPSET_BY_HEIGHT_001, @CHAIN_STORE_PUT_TIPSET_001, @CHAIN_STORE_SET_GENESIS_BLOCK_001
//stm: @CHAIN_STORE_CLOSE_001
cg, err := gen.NewGenerator()
if err != nil {
t.Fatal(err)
+8
View File
@@ -1,3 +1,4 @@
//stm: #unit
package store_test
import (
@@ -28,6 +29,8 @@ func init() {
}
func BenchmarkGetRandomness(b *testing.B) {
//stm: @CHAIN_GEN_NEXT_TIPSET_001
//stm: @CHAIN_STATE_GET_RANDOMNESS_FROM_TICKETS_001
cg, err := gen.NewGenerator()
if err != nil {
b.Fatal(err)
@@ -85,6 +88,8 @@ func BenchmarkGetRandomness(b *testing.B) {
}
func TestChainExportImport(t *testing.T) {
//stm: @CHAIN_GEN_NEXT_TIPSET_001
//stm: @CHAIN_STORE_IMPORT_001
cg, err := gen.NewGenerator()
if err != nil {
t.Fatal(err)
@@ -120,6 +125,9 @@ func TestChainExportImport(t *testing.T) {
}
func TestChainExportImportFull(t *testing.T) {
//stm: @CHAIN_GEN_NEXT_TIPSET_001
//stm: @CHAIN_STORE_IMPORT_001, @CHAIN_STORE_EXPORT_001, @CHAIN_STORE_SET_HEAD_001
//stm: @CHAIN_STORE_GET_TIPSET_BY_HEIGHT_001
cg, err := gen.NewGenerator()
if err != nil {
t.Fatal(err)
+3
View File
@@ -1,3 +1,4 @@
//stm: #unit
package chain
import (
@@ -78,6 +79,7 @@ func assertGetSyncOp(t *testing.T, c chan *syncOp, ts *types.TipSet) {
}
func TestSyncManagerEdgeCase(t *testing.T) {
//stm: @CHAIN_SYNCER_SET_PEER_HEAD_001
ctx := context.Background()
a := mock.TipSet(mock.MkBlock(genTs, 1, 1))
@@ -161,6 +163,7 @@ func TestSyncManagerEdgeCase(t *testing.T) {
}
func TestSyncManager(t *testing.T) {
//stm: @CHAIN_SYNCER_SET_PEER_HEAD_001
ctx := context.Background()
a := mock.TipSet(mock.MkBlock(genTs, 1, 1))
+6
View File
@@ -1,3 +1,4 @@
//stm: #unit
package types
import (
@@ -14,6 +15,7 @@ import (
)
func TestBigIntSerializationRoundTrip(t *testing.T) {
//stm: @CHAIN_TYPES_PARSE_BIGINT_001
testValues := []string{
"0", "1", "10", "-10", "9999", "12345678901234567891234567890123456789012345678901234567890",
}
@@ -42,6 +44,7 @@ func TestBigIntSerializationRoundTrip(t *testing.T) {
}
func TestFilRoundTrip(t *testing.T) {
//stm: @TYPES_FIL_PARSE_001
testValues := []string{
"0 FIL", "1 FIL", "1.001 FIL", "100.10001 FIL", "101100 FIL", "5000.01 FIL", "5000 FIL",
}
@@ -59,6 +62,7 @@ func TestFilRoundTrip(t *testing.T) {
}
func TestSizeStr(t *testing.T) {
//stm: @CHAIN_TYPES_SIZE_BIGINT_001
cases := []struct {
in uint64
out string
@@ -79,6 +83,7 @@ func TestSizeStr(t *testing.T) {
}
func TestSizeStrUnitsSymmetry(t *testing.T) {
//stm: @CHAIN_TYPES_SIZE_BIGINT_001
s := rand.NewSource(time.Now().UnixNano())
r := rand.New(s)
@@ -95,6 +100,7 @@ func TestSizeStrUnitsSymmetry(t *testing.T) {
}
func TestSizeStrBig(t *testing.T) {
//stm: @CHAIN_TYPES_SIZE_BIGINT_001
ZiB := big.NewInt(50000)
ZiB = ZiB.Lsh(ZiB, 70)
+3
View File
@@ -1,3 +1,4 @@
//stm: #unit
package types
import (
@@ -51,6 +52,7 @@ func testBlockHeader(t testing.TB) *BlockHeader {
}
func TestBlockHeaderSerialization(t *testing.T) {
//stm: @CHAIN_TYPES_BLOCK_HEADER_FROM_CBOR_001, @CHAIN_TYPES_BLOCK_HEADER_TO_CBOR_001
bh := testBlockHeader(t)
buf := new(bytes.Buffer)
@@ -71,6 +73,7 @@ func TestBlockHeaderSerialization(t *testing.T) {
}
func TestInteropBH(t *testing.T) {
//stm: @OTHER_IMPLEMENTATION_BLOCK_INTEROP_001
newAddr, err := address.NewSecp256k1Address([]byte("address0"))
if err != nil {
+6
View File
@@ -1,3 +1,4 @@
//stm: #unit
package types
import (
@@ -11,6 +12,7 @@ import (
)
func TestPoissonFunction(t *testing.T) {
//stm: @CHAIN_TYPES_POISSON_001
tests := []struct {
lambdaBase uint64
lambdaShift uint
@@ -47,6 +49,7 @@ func TestPoissonFunction(t *testing.T) {
}
func TestLambdaFunction(t *testing.T) {
//stm: @CHAIN_TYPES_LAMBDA_001
tests := []struct {
power string
totalPower string
@@ -72,6 +75,7 @@ func TestLambdaFunction(t *testing.T) {
}
func TestExpFunction(t *testing.T) {
//stm: @CHAIN_TYPES_NEGATIVE_EXP_001
const N = 256
step := big.NewInt(5)
@@ -100,6 +104,7 @@ func q256ToF(x *big.Int) float64 {
}
func TestElectionLam(t *testing.T) {
//stm: @CHAIN_TYPES_LAMBDA_001
p := big.NewInt(64)
tot := big.NewInt(128)
lam := lambda(p, tot)
@@ -128,6 +133,7 @@ func BenchmarkWinCounts(b *testing.B) {
}
func TestWinCounts(t *testing.T) {
//stm: @TYPES_ELECTION_PROOF_COMPUTE_WIN_COUNT_001
totalPower := NewInt(100)
power := NewInt(20)
+2
View File
@@ -1,3 +1,4 @@
//stm: #unit
package types
import (
@@ -7,6 +8,7 @@ import (
)
func TestFilShort(t *testing.T) {
//stm: @TYPES_FIL_PARSE_001
for _, s := range []struct {
fil string
expect string
+6
View File
@@ -1,3 +1,4 @@
//stm: #unit
package types
import (
@@ -71,6 +72,7 @@ func TestEqualCall(t *testing.T) {
Params: []byte("hai"),
}
//stm: @TYPES_MESSAGE_EQUAL_CALL_001
require.True(t, m1.EqualCall(m2))
require.True(t, m1.EqualCall(m3))
require.False(t, m1.EqualCall(m4))
@@ -97,11 +99,13 @@ func TestMessageJson(t *testing.T) {
exp := []byte("{\"Version\":0,\"To\":\"f04\",\"From\":\"f00\",\"Nonce\":34,\"Value\":\"0\",\"GasLimit\":123,\"GasFeeCap\":\"234\",\"GasPremium\":\"234\",\"Method\":6,\"Params\":\"aGFp\",\"CID\":{\"/\":\"bafy2bzaced5rdpz57e64sc7mdwjn3blicglhpialnrph2dlbufhf6iha63dmc\"}}")
fmt.Println(string(b))
//stm: @TYPES_MESSAGE_JSON_EQUAL_CALL_001
require.Equal(t, exp, b)
var um Message
require.NoError(t, json.Unmarshal(b, &um))
//stm: @TYPES_MESSAGE_JSON_EQUAL_CALL_002
require.EqualValues(t, *m, um)
}
@@ -131,10 +135,12 @@ func TestSignedMessageJson(t *testing.T) {
exp := []byte("{\"Message\":{\"Version\":0,\"To\":\"f04\",\"From\":\"f00\",\"Nonce\":34,\"Value\":\"0\",\"GasLimit\":123,\"GasFeeCap\":\"234\",\"GasPremium\":\"234\",\"Method\":6,\"Params\":\"aGFp\",\"CID\":{\"/\":\"bafy2bzaced5rdpz57e64sc7mdwjn3blicglhpialnrph2dlbufhf6iha63dmc\"}},\"Signature\":{\"Type\":0,\"Data\":null},\"CID\":{\"/\":\"bafy2bzacea5ainifngxj3rygaw2hppnyz2cw72x5pysqty2x6dxmjs5qg2uus\"}}")
fmt.Println(string(b))
//stm: @TYPES_MESSAGE_JSON_EQUAL_CALL_001
require.Equal(t, exp, b)
var um SignedMessage
require.NoError(t, json.Unmarshal(b, &um))
//stm: @TYPES_MESSAGE_JSON_EQUAL_CALL_002
require.EqualValues(t, *sm, um)
}
+2
View File
@@ -1,3 +1,4 @@
//stm: #unit
package types
import (
@@ -8,6 +9,7 @@ import (
)
func TestSignatureSerializeRoundTrip(t *testing.T) {
//stm: @CHAIN_TYPES_SIGNATURE_SERIALIZATION_001
s := &crypto.Signature{
Data: []byte("foo bar cat dog"),
Type: crypto.SigTypeBLS,
+2
View File
@@ -1,3 +1,4 @@
//stm: #unit
package types
import (
@@ -12,6 +13,7 @@ import (
)
func TestTipSetKey(t *testing.T) {
//stm: @TYPES_TIPSETKEY_FROM_BYTES_001, @TYPES_TIPSETKEY_NEW_001
cb := cid.V1Builder{Codec: cid.DagCBOR, MhType: multihash.BLAKE2B_MIN + 31}
c1, _ := cb.Sum([]byte("a"))
c2, _ := cb.Sum([]byte("b"))
+1
View File
@@ -1,3 +1,4 @@
//stm: #unit
package types
import (
+3
View File
@@ -1,3 +1,4 @@
//stm: #unit
package chain
import (
@@ -12,6 +13,7 @@ import (
)
func TestSignedMessageJsonRoundtrip(t *testing.T) {
//stm: @TYPES_MESSAGE_JSON_EQUAL_CALL_002
to, _ := address.NewIDAddress(5234623)
from, _ := address.NewIDAddress(603911192)
smsg := &types.SignedMessage{
@@ -40,6 +42,7 @@ func TestSignedMessageJsonRoundtrip(t *testing.T) {
}
func TestAddressType(t *testing.T) {
//stm: @CHAIN_TYPES_ADDRESS_PREFIX_001
build.SetAddressNetwork(address.Testnet)
addr, err := makeRandomAddress()
if err != nil {
+4
View File
@@ -1,3 +1,4 @@
//stm: #unit
package vectors
import (
@@ -26,6 +27,7 @@ func LoadVector(t *testing.T, f string, out interface{}) {
}
func TestBlockHeaderVectors(t *testing.T) {
//stm: @CHAIN_TYPES_SERIALIZATION_BLOCK_001
var headers []HeaderVector
LoadVector(t, "block_headers.json", &headers)
@@ -46,6 +48,7 @@ func TestBlockHeaderVectors(t *testing.T) {
}
func TestMessageSigningVectors(t *testing.T) {
//stm: @CHAIN_TYPES_SERIALIZATION_SIGNED_MESSAGE_001
var msvs []MessageSigningVector
LoadVector(t, "message_signing.json", &msvs)
@@ -64,6 +67,7 @@ func TestMessageSigningVectors(t *testing.T) {
}
func TestUnsignedMessageVectors(t *testing.T) {
//stm: @CHAIN_TYPES_SERIALIZATION_MESSAGE_001
var msvs []UnsignedMessageVector
LoadVector(t, "unsigned_messages.json", &msvs)
+3
View File
@@ -1,3 +1,4 @@
//stm: #unit
package vm
import (
@@ -9,6 +10,7 @@ import (
)
func TestGasBurn(t *testing.T) {
//stm: @BURN_ESTIMATE_GAS_OVERESTIMATION_BURN_001
tests := []struct {
used int64
limit int64
@@ -40,6 +42,7 @@ func TestGasBurn(t *testing.T) {
}
func TestGasOutputs(t *testing.T) {
//stm: @BURN_ESTIMATE_GAS_OUTPUTS_001
baseFee := types.NewInt(10)
tests := []struct {
used int64
+6 -4
View File
@@ -5,6 +5,9 @@ import (
"context"
"time"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/go-state-types/network"
@@ -15,7 +18,6 @@ import (
"github.com/filecoin-project/lotus/chain/state"
cbor "github.com/ipfs/go-ipld-cbor"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/exitcode"
"github.com/filecoin-project/lotus/lib/sigs"
@@ -30,7 +32,6 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/types"
"github.com/ipfs/go-cid"
)
var _ Interface = (*FVM)(nil)
@@ -40,6 +41,7 @@ type FvmExtern struct {
Rand
blockstore.Blockstore
epoch abi.ChainEpoch
nv network.Version
lbState LookbackStateGetter
base cid.Cid
}
@@ -181,7 +183,7 @@ func (x *FvmExtern) workerKeyAtLookback(ctx context.Context, minerId address.Add
}
cstWithoutGas := cbor.NewCborStore(x.Blockstore)
cbb := &gasChargingBlocks{gasAdder, PricelistByEpoch(x.epoch), x.Blockstore}
cbb := &gasChargingBlocks{gasAdder, PricelistByEpochAndNetworkVersion(x.epoch, x.nv), x.Blockstore}
cstWithGas := cbor.NewCborStore(cbb)
lbState, err := x.lbState(ctx, height)
@@ -241,7 +243,7 @@ func NewFVM(ctx context.Context, opts *VMOpts) (*FVM, error) {
fvmOpts := ffi.FVMOpts{
FVMVersion: 0,
Externs: &FvmExtern{Rand: opts.Rand, Blockstore: opts.Bstore, lbState: opts.LookbackState, base: opts.StateBase, epoch: opts.Epoch},
Externs: &FvmExtern{Rand: opts.Rand, Blockstore: opts.Bstore, lbState: opts.LookbackState, base: opts.StateBase, epoch: opts.Epoch, nv: opts.NetworkVersion},
Epoch: opts.Epoch,
BaseFee: opts.BaseFee,
BaseCircSupply: circToReport,
+132 -122
View File
@@ -3,6 +3,8 @@ package vm
import (
"fmt"
"github.com/filecoin-project/go-state-types/network"
vmr "github.com/filecoin-project/specs-actors/v7/actors/runtime"
proof7 "github.com/filecoin-project/specs-actors/v7/actors/runtime/proof"
@@ -82,145 +84,153 @@ type Pricelist interface {
OnVerifyConsensusFault() GasCharge
}
// Prices are the price lists per starting epoch. Public for testing purposes
// (concretely to allow the test vector runner to rebase prices).
var Prices = map[abi.ChainEpoch]Pricelist{
abi.ChainEpoch(0): &pricelistV0{
computeGasMulti: 1,
storageGasMulti: 1000,
var priceListGenesis = pricelistV0{
computeGasMulti: 1,
storageGasMulti: 1000,
onChainMessageComputeBase: 38863,
onChainMessageStorageBase: 36,
onChainMessageStoragePerByte: 1,
onChainMessageComputeBase: 38863,
onChainMessageStorageBase: 36,
onChainMessageStoragePerByte: 1,
onChainReturnValuePerByte: 1,
onChainReturnValuePerByte: 1,
sendBase: 29233,
sendTransferFunds: 27500,
sendTransferOnlyPremium: 159672,
sendInvokeMethod: -5377,
sendBase: 29233,
sendTransferFunds: 27500,
sendTransferOnlyPremium: 159672,
sendInvokeMethod: -5377,
ipldGetBase: 75242,
ipldPutBase: 84070,
ipldPutPerByte: 1,
ipldGetBase: 75242,
ipldPutBase: 84070,
ipldPutPerByte: 1,
createActorCompute: 1108454,
createActorStorage: 36 + 40,
deleteActor: -(36 + 40), // -createActorStorage
createActorCompute: 1108454,
createActorStorage: 36 + 40,
deleteActor: -(36 + 40), // -createActorStorage
verifySignature: map[crypto.SigType]int64{
crypto.SigTypeBLS: 16598605,
crypto.SigTypeSecp256k1: 1637292,
},
hashingBase: 31355,
computeUnsealedSectorCidBase: 98647,
verifySealBase: 2000, // TODO gas , it VerifySeal syscall is not used
verifyAggregateSealBase: 0,
verifyPostLookup: map[abi.RegisteredPoStProof]scalingCost{
abi.RegisteredPoStProof_StackedDrgWindow512MiBV1: {
flat: 123861062,
scale: 9226981,
},
abi.RegisteredPoStProof_StackedDrgWindow32GiBV1: {
flat: 748593537,
scale: 85639,
},
abi.RegisteredPoStProof_StackedDrgWindow64GiBV1: {
flat: 748593537,
scale: 85639,
},
},
verifyPostDiscount: true,
verifyConsensusFault: 495422,
verifySignature: map[crypto.SigType]int64{
crypto.SigTypeBLS: 16598605,
crypto.SigTypeSecp256k1: 1637292,
},
abi.ChainEpoch(build.UpgradeCalicoHeight): &pricelistV0{
computeGasMulti: 1,
storageGasMulti: 1300,
onChainMessageComputeBase: 38863,
onChainMessageStorageBase: 36,
onChainMessageStoragePerByte: 1,
onChainReturnValuePerByte: 1,
sendBase: 29233,
sendTransferFunds: 27500,
sendTransferOnlyPremium: 159672,
sendInvokeMethod: -5377,
ipldGetBase: 114617,
ipldPutBase: 353640,
ipldPutPerByte: 1,
createActorCompute: 1108454,
createActorStorage: 36 + 40,
deleteActor: -(36 + 40), // -createActorStorage
verifySignature: map[crypto.SigType]int64{
crypto.SigTypeBLS: 16598605,
crypto.SigTypeSecp256k1: 1637292,
hashingBase: 31355,
computeUnsealedSectorCidBase: 98647,
verifySealBase: 2000, // TODO gas , it VerifySeal syscall is not used
verifyAggregateSealBase: 0,
verifyPostLookup: map[abi.RegisteredPoStProof]scalingCost{
abi.RegisteredPoStProof_StackedDrgWindow512MiBV1: {
flat: 123861062,
scale: 9226981,
},
hashingBase: 31355,
computeUnsealedSectorCidBase: 98647,
verifySealBase: 2000, // TODO gas, it VerifySeal syscall is not used
verifyAggregateSealPer: map[abi.RegisteredSealProof]int64{
abi.RegisteredSealProof_StackedDrg32GiBV1_1: 449900,
abi.RegisteredSealProof_StackedDrg64GiBV1_1: 359272,
abi.RegisteredPoStProof_StackedDrgWindow32GiBV1: {
flat: 748593537,
scale: 85639,
},
verifyAggregateSealSteps: map[abi.RegisteredSealProof]stepCost{
abi.RegisteredSealProof_StackedDrg32GiBV1_1: {
{4, 103994170},
{7, 112356810},
{13, 122912610},
{26, 137559930},
{52, 162039100},
{103, 210960780},
{205, 318351180},
{410, 528274980},
},
abi.RegisteredSealProof_StackedDrg64GiBV1_1: {
{4, 102581240},
{7, 110803030},
{13, 120803700},
{26, 134642130},
{52, 157357890},
{103, 203017690},
{205, 304253590},
{410, 509880640},
},
abi.RegisteredPoStProof_StackedDrgWindow64GiBV1: {
flat: 748593537,
scale: 85639,
},
verifyPostLookup: map[abi.RegisteredPoStProof]scalingCost{
abi.RegisteredPoStProof_StackedDrgWindow512MiBV1: {
flat: 117680921,
scale: 43780,
},
abi.RegisteredPoStProof_StackedDrgWindow32GiBV1: {
flat: 117680921,
scale: 43780,
},
abi.RegisteredPoStProof_StackedDrgWindow64GiBV1: {
flat: 117680921,
scale: 43780,
},
},
verifyPostDiscount: false,
verifyConsensusFault: 495422,
verifyReplicaUpdate: 36316136,
},
verifyPostDiscount: true,
verifyConsensusFault: 495422,
}
// PricelistByEpoch finds the latest prices for the given epoch
func PricelistByEpoch(epoch abi.ChainEpoch) Pricelist {
var priceListCalico = pricelistV0{
computeGasMulti: 1,
storageGasMulti: 1300,
onChainMessageComputeBase: 38863,
onChainMessageStorageBase: 36,
onChainMessageStoragePerByte: 1,
onChainReturnValuePerByte: 1,
sendBase: 29233,
sendTransferFunds: 27500,
sendTransferOnlyPremium: 159672,
sendInvokeMethod: -5377,
ipldGetBase: 114617,
ipldPutBase: 353640,
ipldPutPerByte: 1,
createActorCompute: 1108454,
createActorStorage: 36 + 40,
deleteActor: -(36 + 40), // -createActorStorage
verifySignature: map[crypto.SigType]int64{
crypto.SigTypeBLS: 16598605,
crypto.SigTypeSecp256k1: 1637292,
},
hashingBase: 31355,
computeUnsealedSectorCidBase: 98647,
verifySealBase: 2000, // TODO gas, it VerifySeal syscall is not used
verifyAggregateSealPer: map[abi.RegisteredSealProof]int64{
abi.RegisteredSealProof_StackedDrg32GiBV1_1: 449900,
abi.RegisteredSealProof_StackedDrg64GiBV1_1: 359272,
},
verifyAggregateSealSteps: map[abi.RegisteredSealProof]stepCost{
abi.RegisteredSealProof_StackedDrg32GiBV1_1: {
{4, 103994170},
{7, 112356810},
{13, 122912610},
{26, 137559930},
{52, 162039100},
{103, 210960780},
{205, 318351180},
{410, 528274980},
},
abi.RegisteredSealProof_StackedDrg64GiBV1_1: {
{4, 102581240},
{7, 110803030},
{13, 120803700},
{26, 134642130},
{52, 157357890},
{103, 203017690},
{205, 304253590},
{410, 509880640},
},
},
verifyPostLookup: map[abi.RegisteredPoStProof]scalingCost{
abi.RegisteredPoStProof_StackedDrgWindow512MiBV1: {
flat: 117680921,
scale: 43780,
},
abi.RegisteredPoStProof_StackedDrgWindow32GiBV1: {
flat: 117680921,
scale: 43780,
},
abi.RegisteredPoStProof_StackedDrgWindow64GiBV1: {
flat: 117680921,
scale: 43780,
},
},
verifyPostDiscount: false,
verifyConsensusFault: 495422,
verifyReplicaUpdate: 36316136,
}
// Prices are the price lists per starting epoch.
// For network v8 and onwards, this is disregarded; the pricelist is selected by network version.
var pricesByEpoch = map[abi.ChainEpoch]Pricelist{
abi.ChainEpoch(0): &priceListGenesis,
abi.ChainEpoch(build.UpgradeCalicoHeight): &priceListCalico,
}
// PricelistByEpochAndNetworkVersion finds the latest prices for the given epoch
func PricelistByEpochAndNetworkVersion(epoch abi.ChainEpoch, nv network.Version) Pricelist {
if nv >= network.Version8 {
return &priceListCalico
}
// since we are storing the prices as map or epoch to price
// we need to get the price with the highest epoch that is lower or equal to the `epoch` arg
bestEpoch := abi.ChainEpoch(0)
bestPrice := Prices[bestEpoch]
for e, pl := range Prices {
bestPrice := pricesByEpoch[bestEpoch]
for e, pl := range pricesByEpoch {
// if `e` happened after `bestEpoch` and `e` is earlier or equal to the target `epoch`
if e > bestEpoch && e <= epoch {
bestEpoch = e
+1
View File
@@ -1,3 +1,4 @@
//stm: #unit
package vm
import (
+2
View File
@@ -1,3 +1,4 @@
//stm: #unit
package vm
import (
@@ -106,6 +107,7 @@ func (*basicRtMessage) ValueReceived() abi.TokenAmount {
}
func TestInvokerBasic(t *testing.T) {
//stm: @INVOKER_TRANSFORM_001
inv := ActorRegistry{}
code, err := inv.transform(basicContract{})
assert.NoError(t, err)
+1 -1
View File
@@ -51,7 +51,7 @@ var EmptyObjectCid cid.Cid
// TryCreateAccountActor creates account actors from only BLS/SECP256K1 addresses.
func TryCreateAccountActor(rt *Runtime, addr address.Address) (*types.Actor, address.Address, aerrors.ActorError) {
if err := rt.chargeGasSafe(PricelistByEpoch(rt.height).OnCreateActor()); err != nil {
if err := rt.chargeGasSafe(PricelistByEpochAndNetworkVersion(rt.height, rt.NetworkVersion()).OnCreateActor()); err != nil {
return nil, address.Undef, err
}
+2
View File
@@ -1,3 +1,4 @@
//stm: #unit
package vm
import (
@@ -22,6 +23,7 @@ func (*NotAVeryGoodMarshaler) MarshalCBOR(writer io.Writer) error {
var _ cbg.CBORMarshaler = &NotAVeryGoodMarshaler{}
func TestRuntimePutErrors(t *testing.T) {
//stm: @CHAIN_VM_STORE_PUT_002
defer func() {
err := recover()
if err == nil {
+3 -3
View File
@@ -42,7 +42,7 @@ const MaxCallDepth = 4096
var (
log = logging.Logger("vm")
actorLog = logging.Logger("actors")
actorLog = logging.WithSkip(logging.Logger("actors"), 1)
gasOnActorExec = newGasCharge("OnActorExec", 0, 0)
)
@@ -135,7 +135,7 @@ func (vm *LegacyVM) makeRuntime(ctx context.Context, msg *types.Message, parent
gasAvailable: msg.GasLimit,
depth: 0,
numActorsCreated: 0,
pricelist: PricelistByEpoch(vm.blockHeight),
pricelist: PricelistByEpochAndNetworkVersion(vm.blockHeight, vm.networkVersion),
allowInternal: true,
callerValidated: false,
executionTrace: types.ExecutionTrace{Msg: msg},
@@ -431,7 +431,7 @@ func (vm *LegacyVM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*App
return nil, err
}
pl := PricelistByEpoch(vm.blockHeight)
pl := PricelistByEpochAndNetworkVersion(vm.blockHeight, vm.networkVersion)
msgGas := pl.OnChainMessage(cmsg.ChainLength())
msgGasCost := msgGas.Total()
+1 -2
View File
@@ -9,7 +9,6 @@ import (
"github.com/filecoin-project/go-jsonrpc/auth"
"github.com/filecoin-project/lotus/api"
cliutil "github.com/filecoin-project/lotus/cli/util"
"github.com/filecoin-project/lotus/node/repo"
)
@@ -128,7 +127,7 @@ var AuthApiInfoToken = &cli.Command{
// TODO: Log in audit log when it is implemented
currentEnv, _, _ := cliutil.EnvsForAPIInfos(t)
currentEnv, _, _ := t.APIInfoEnvVars()
fmt.Printf("%s=%s:%s\n", currentEnv, string(token), ainfo.Addr)
return nil
},
+1 -1
View File
@@ -1,4 +1,4 @@
//stm: #cli
//stm: #unit
package cli
import (
+26 -12
View File
@@ -515,7 +515,7 @@ The minimum value is 518400 (6 months).`,
}
func interactiveDeal(cctx *cli.Context) error {
api, closer, err := GetFullNodeAPI(cctx)
api, closer, err := GetFullNodeAPIV1(cctx)
if err != nil {
return err
}
@@ -873,8 +873,7 @@ uiLoop:
continue uiLoop
}
ask = append(ask, *a)
ask = append(ask, *a.Response)
}
// TODO: run more validation
@@ -1404,9 +1403,13 @@ var clientListAsksCmd = &cli.Command{
Value: "text",
Usage: "Either 'text' or 'csv'",
},
&cli.BoolFlag{
Name: "protocols",
Usage: "Output supported deal protocols",
},
},
Action: func(cctx *cli.Context) error {
api, closer, err := GetFullNodeAPI(cctx)
api, closer, err := GetFullNodeAPIV1(cctx)
if err != nil {
return err
}
@@ -1423,21 +1426,27 @@ var clientListAsksCmd = &cli.Command{
return asks[i].Ping < asks[j].Ping
})
}
pfmt := "%s: min:%s max:%s price:%s/GiB/Epoch verifiedPrice:%s/GiB/Epoch ping:%s\n"
pfmt := "%s: min:%s max:%s price:%s/GiB/Epoch verifiedPrice:%s/GiB/Epoch ping:%s protos:%s\n"
if cctx.String("output-format") == "csv" {
fmt.Printf("Miner,Min,Max,Price,VerifiedPrice,Ping\n")
pfmt = "%s,%s,%s,%s,%s,%s\n"
fmt.Printf("Miner,Min,Max,Price,VerifiedPrice,Ping,Protocols")
pfmt = "%s,%s,%s,%s,%s,%s,%s\n"
}
for _, a := range asks {
ask := a.Ask
protos := ""
if cctx.Bool("protocols") {
protos = "[" + strings.Join(a.DealProtocols, ",") + "]"
}
fmt.Printf(pfmt, ask.Miner,
types.SizeStr(types.NewInt(uint64(ask.MinPieceSize))),
types.SizeStr(types.NewInt(uint64(ask.MaxPieceSize))),
types.FIL(ask.Price),
types.FIL(ask.VerifiedPrice),
a.Ping,
protos,
)
}
@@ -1446,11 +1455,13 @@ var clientListAsksCmd = &cli.Command{
}
type QueriedAsk struct {
Ask *storagemarket.StorageAsk
Ask *storagemarket.StorageAsk
DealProtocols []string
Ping time.Duration
}
func GetAsks(ctx context.Context, api v0api.FullNode) ([]QueriedAsk, error) {
func GetAsks(ctx context.Context, api lapi.FullNode) ([]QueriedAsk, error) {
isTTY := true
if fileInfo, _ := os.Stdout.Stat(); (fileInfo.Mode() & os.ModeCharDevice) == 0 {
isTTY = false
@@ -1561,7 +1572,9 @@ loop:
atomic.AddInt64(&got, 1)
lk.Lock()
asks = append(asks, QueriedAsk{
Ask: ask,
Ask: ask.Response,
DealProtocols: ask.DealProtocols,
Ping: pingDuration,
})
lk.Unlock()
@@ -1913,8 +1926,9 @@ type deal struct {
}
var clientGetDealCmd = &cli.Command{
Name: "get-deal",
Usage: "Print detailed deal information",
Name: "get-deal",
Usage: "Print detailed deal information",
ArgsUsage: "[proposalCID]",
Action: func(cctx *cli.Context) error {
if !cctx.Args().Present() {
return cli.ShowCommandHelp(cctx, cctx.Command.Name)
+1 -1
View File
@@ -1,4 +1,4 @@
//stm: #cli
//stm: #unit
package cli
import (
+1
View File
@@ -161,6 +161,7 @@ var msigCreateCmd = &cli.Command{
msgCid := sm.Cid()
fmt.Println("sent create in message: ", msgCid)
fmt.Println("waiting for confirmation..")
// wait for it to get mined into a block
wait, err := api.StateWaitMsg(ctx, msgCid, uint64(cctx.Int("confidence")), build.Finality, true)
+126 -38
View File
@@ -1,12 +1,14 @@
package cli
import (
"context"
"encoding/json"
"fmt"
"os"
"sort"
"strings"
"text/tabwriter"
"time"
"github.com/dustin/go-humanize"
"github.com/urfave/cli/v2"
@@ -28,6 +30,7 @@ var NetCmd = &cli.Command{
Usage: "Manage P2P Network",
Subcommands: []*cli.Command{
NetPeers,
NetPing,
NetConnect,
NetListen,
NetId,
@@ -117,6 +120,82 @@ var NetPeers = &cli.Command{
},
}
var NetPing = &cli.Command{
Name: "ping",
Usage: "Ping peers",
Flags: []cli.Flag{
&cli.IntFlag{
Name: "count",
Value: 10,
Aliases: []string{"c"},
Usage: "specify the number of times it should ping",
},
&cli.DurationFlag{
Name: "interval",
Value: time.Second,
Aliases: []string{"i"},
Usage: "minimum time between pings",
},
},
Action: func(cctx *cli.Context) error {
if cctx.Args().Len() != 1 {
return xerrors.Errorf("please provide a peerID")
}
api, closer, err := GetAPI(cctx)
if err != nil {
return err
}
defer closer()
ctx := ReqContext(cctx)
pis, err := addrInfoFromArg(ctx, cctx)
if err != nil {
return err
}
count := cctx.Int("count")
interval := cctx.Duration("interval")
for _, pi := range pis {
err := api.NetConnect(ctx, pi)
if err != nil {
return xerrors.Errorf("connect: %w", err)
}
fmt.Printf("PING %s\n", pi.ID)
var avg time.Duration
var successful int
for i := 0; i < count && ctx.Err() == nil; i++ {
start := time.Now()
rtt, err := api.NetPing(ctx, pi.ID)
if err != nil {
if ctx.Err() != nil {
break
}
log.Errorf("Ping failed: error=%v", err)
continue
}
fmt.Printf("Pong received: time=%v\n", rtt)
avg = avg + rtt
successful++
wctx, cancel := context.WithTimeout(ctx, time.Until(start.Add(interval)))
<-wctx.Done()
cancel()
}
if successful > 0 {
fmt.Printf("Average latency: %v\n", avg/time.Duration(successful))
}
}
return nil
},
}
var NetScores = &cli.Command{
Name: "scores",
Usage: "Print peers' pubsub scores",
@@ -192,45 +271,9 @@ var NetConnect = &cli.Command{
defer closer()
ctx := ReqContext(cctx)
pis, err := addrutil.ParseAddresses(ctx, cctx.Args().Slice())
pis, err := addrInfoFromArg(ctx, cctx)
if err != nil {
a, perr := address.NewFromString(cctx.Args().First())
if perr != nil {
return err
}
na, fc, err := GetFullNodeAPI(cctx)
if err != nil {
return err
}
defer fc()
mi, err := na.StateMinerInfo(ctx, a, types.EmptyTSK)
if err != nil {
return xerrors.Errorf("getting miner info: %w", err)
}
if mi.PeerId == nil {
return xerrors.Errorf("no PeerID for miner")
}
multiaddrs := make([]multiaddr.Multiaddr, 0, len(mi.Multiaddrs))
for i, a := range mi.Multiaddrs {
maddr, err := multiaddr.NewMultiaddrBytes(a)
if err != nil {
log.Warnf("parsing multiaddr %d (%x): %s", i, a, err)
continue
}
multiaddrs = append(multiaddrs, maddr)
}
pi := peer.AddrInfo{
ID: *mi.PeerId,
Addrs: multiaddrs,
}
fmt.Printf("%s -> %s\n", a, pi)
pis = append(pis, pi)
return err
}
for _, pi := range pis {
@@ -247,6 +290,51 @@ var NetConnect = &cli.Command{
},
}
func addrInfoFromArg(ctx context.Context, cctx *cli.Context) ([]peer.AddrInfo, error) {
pis, err := addrutil.ParseAddresses(ctx, cctx.Args().Slice())
if err != nil {
a, perr := address.NewFromString(cctx.Args().First())
if perr != nil {
return nil, err
}
na, fc, err := GetFullNodeAPI(cctx)
if err != nil {
return nil, err
}
defer fc()
mi, err := na.StateMinerInfo(ctx, a, types.EmptyTSK)
if err != nil {
return nil, xerrors.Errorf("getting miner info: %w", err)
}
if mi.PeerId == nil {
return nil, xerrors.Errorf("no PeerID for miner")
}
multiaddrs := make([]multiaddr.Multiaddr, 0, len(mi.Multiaddrs))
for i, a := range mi.Multiaddrs {
maddr, err := multiaddr.NewMultiaddrBytes(a)
if err != nil {
log.Warnf("parsing multiaddr %d (%x): %s", i, a, err)
continue
}
multiaddrs = append(multiaddrs, maddr)
}
pi := peer.AddrInfo{
ID: *mi.PeerId,
Addrs: multiaddrs,
}
fmt.Printf("%s -> %s\n", a, pi)
pis = append(pis, pi)
}
return pis, err
}
var NetId = &cli.Command{
Name: "id",
Usage: "Get node identity",
+2
View File
@@ -1,3 +1,5 @@
//stm: ignore
//stm: #unit
package cli
import (
+2
View File
@@ -1,3 +1,5 @@
//stm: ignore
//stm: #unit
package cli
import (
+1
View File
@@ -1,3 +1,4 @@
//stm: #unit
package cli
import (
+5 -64
View File
@@ -28,63 +28,6 @@ const (
metadataTraceContext = "traceContext"
)
// flagsForAPI returns flags passed on the command line with the listen address
// of the API server (only used by the tests), in the order of precedence they
// should be applied for the requested kind of node.
func flagsForAPI(t repo.RepoType) []string {
switch t {
case repo.FullNode:
return []string{"api-url"}
case repo.StorageMiner:
return []string{"miner-api-url"}
case repo.Worker:
return []string{"worker-api-url"}
case repo.Markets:
// support split markets-miner and monolith deployments.
return []string{"markets-api-url", "miner-api-url"}
default:
panic(fmt.Sprintf("Unknown repo type: %v", t))
}
}
func flagsForRepo(t repo.RepoType) []string {
switch t {
case repo.FullNode:
return []string{"repo"}
case repo.StorageMiner:
return []string{"miner-repo"}
case repo.Worker:
return []string{"worker-repo"}
case repo.Markets:
// support split markets-miner and monolith deployments.
return []string{"markets-repo", "miner-repo"}
default:
panic(fmt.Sprintf("Unknown repo type: %v", t))
}
}
// EnvsForAPIInfos returns the environment variables to use in order of precedence
// to determine the API endpoint of the specified node type.
//
// It returns the current variables and deprecated ones separately, so that
// the user can log a warning when deprecated ones are found to be in use.
func EnvsForAPIInfos(t repo.RepoType) (primary string, fallbacks []string, deprecated []string) {
switch t {
case repo.FullNode:
return "FULLNODE_API_INFO", nil, nil
case repo.StorageMiner:
// TODO remove deprecated deprecation period
return "MINER_API_INFO", nil, []string{"STORAGE_API_INFO"}
case repo.Worker:
return "WORKER_API_INFO", nil, nil
case repo.Markets:
// support split markets-miner and monolith deployments.
return "MARKETS_API_INFO", []string{"MINER_API_INFO"}, nil
default:
panic(fmt.Sprintf("Unknown repo type: %v", t))
}
}
// GetAPIInfo returns the API endpoint to use for the specified kind of repo.
//
// The order of precedence is as follows:
@@ -96,8 +39,7 @@ func EnvsForAPIInfos(t repo.RepoType) (primary string, fallbacks []string, depre
func GetAPIInfo(ctx *cli.Context, t repo.RepoType) (APIInfo, error) {
// Check if there was a flag passed with the listen address of the API
// server (only used by the tests)
apiFlags := flagsForAPI(t)
for _, f := range apiFlags {
for _, f := range t.APIFlags() {
if !ctx.IsSet(f) {
continue
}
@@ -111,7 +53,7 @@ func GetAPIInfo(ctx *cli.Context, t repo.RepoType) (APIInfo, error) {
// Note: it is not correct/intuitive to prefer environment variables over
// CLI flags (repo flags below).
//
primaryEnv, fallbacksEnvs, deprecatedEnvs := EnvsForAPIInfos(t)
primaryEnv, fallbacksEnvs, deprecatedEnvs := t.APIInfoEnvVars()
env, ok := os.LookupEnv(primaryEnv)
if ok {
return ParseApiInfo(env), nil
@@ -125,8 +67,7 @@ func GetAPIInfo(ctx *cli.Context, t repo.RepoType) (APIInfo, error) {
}
}
repoFlags := flagsForRepo(t)
for _, f := range repoFlags {
for _, f := range t.RepoFlags() {
// cannot use ctx.IsSet because it ignores default values
path := ctx.String(f)
if path == "" {
@@ -175,13 +116,13 @@ func GetAPIInfo(ctx *cli.Context, t repo.RepoType) (APIInfo, error) {
}
}
return APIInfo{}, fmt.Errorf("could not determine API endpoint for node type: %v", t)
return APIInfo{}, fmt.Errorf("could not determine API endpoint for node type: %v", t.Type())
}
func GetRawAPI(ctx *cli.Context, t repo.RepoType, version string) (string, http.Header, error) {
ainfo, err := GetAPIInfo(ctx, t)
if err != nil {
return "", nil, xerrors.Errorf("could not get API info for %s: %w", t, err)
return "", nil, xerrors.Errorf("could not get API info for %s: %w", t.Type(), err)
}
addr, err := ainfo.DialArgs(version)
+1 -1
View File
@@ -1,4 +1,4 @@
//stm: #cli
//stm: #unit
package cli
import (
+1
View File
@@ -1,3 +1,4 @@
//stm: #unit
package main
import (
+2
View File
@@ -1,3 +1,4 @@
//stm: #unit
package main
import (
@@ -8,6 +9,7 @@ import (
)
func TestRateLimit(t *testing.T) {
//stm: @CMD_LIMITER_GET_IP_LIMITER_001, @CMD_LIMITER_GET_WALLET_LIMITER_001
limiter := NewLimiter(LimiterConfig{
TotalRate: time.Second,
TotalBurst: 20,
+3
View File
@@ -1,3 +1,4 @@
//stm: #unit
package main
import (
@@ -9,6 +10,7 @@ import (
)
func TestAppendCIDsToWindow(t *testing.T) {
//stm: @CMD_HEALTH_APPEND_CIDS_001
assert := assert.New(t)
var window CidWindow
threshold := 3
@@ -27,6 +29,7 @@ func TestAppendCIDsToWindow(t *testing.T) {
}
func TestCheckWindow(t *testing.T) {
//stm: @CMD_HEALTH_APPEND_CIDS_001, @CMD_HEALTH_CHECK_WINDOW_001
assert := assert.New(t)
threshold := 3
+2 -2
View File
@@ -916,8 +916,8 @@ var actorProposeChangeWorker = &cli.Command{
return fmt.Errorf("Proposed worker address change not reflected on chain: expected '%s', found '%s'", na, mi.NewWorker)
}
fmt.Fprintf(cctx.App.Writer, "Worker key change to %s successfully proposed.\n", na)
fmt.Fprintf(cctx.App.Writer, "Call 'confirm-change-worker' at or after height %d to complete.\n", mi.WorkerChangeEpoch)
fmt.Fprintf(cctx.App.Writer, "Worker key change to %s successfully sent, change happens at height %d.\n", na, mi.WorkerChangeEpoch)
fmt.Fprintf(cctx.App.Writer, "If you have no active deadlines, call 'confirm-change-worker' at or after height %d to complete.\n", mi.WorkerChangeEpoch)
return nil
},
+3 -1
View File
@@ -1,3 +1,4 @@
//stm: #unit
package main
import (
@@ -23,6 +24,7 @@ import (
)
func TestWorkerKeyChange(t *testing.T) {
//stm: @OTHER_WORKER_KEY_CHANGE_001
if testing.Short() {
t.Skip("skipping test in short mode")
}
@@ -70,7 +72,7 @@ func TestWorkerKeyChange(t *testing.T) {
result := output.String()
output.Reset()
require.Contains(t, result, fmt.Sprintf("Worker key change to %s successfully proposed.", newKey))
require.Contains(t, result, fmt.Sprintf("Worker key change to %s successfully sent", newKey))
epochRe := regexp.MustCompile("at or after height (?P<epoch>[0-9]+) to complete")
matches := epochRe.FindStringSubmatch(result)
+2
View File
@@ -1,3 +1,4 @@
//stm: #integration
package main
import (
@@ -49,6 +50,7 @@ func TestMinerAllInfo(t *testing.T) {
t.Run("pre-info-all", run)
//stm: @CLIENT_DATA_IMPORT_001, @CLIENT_STORAGE_DEALS_GET_001
dh := kit.NewDealHarness(t, client, miner, miner)
deal, res, inPath := dh.MakeOnlineDeal(context.Background(), kit.MakeFullDealParams{Rseed: 6})
outPath := dh.PerformRetrieval(context.Background(), deal, res.Root, false)
+36 -3
View File
@@ -35,6 +35,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/builtin/reward"
"github.com/filecoin-project/lotus/chain/types"
lcli "github.com/filecoin-project/lotus/cli"
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
"github.com/filecoin-project/lotus/journal/alerting"
)
@@ -343,6 +344,41 @@ func handleMiningInfo(ctx context.Context, cctx *cli.Context, fullapi v0api.Full
}
}
{
fmt.Println()
ws, err := nodeApi.WorkerStats(ctx)
if err != nil {
return xerrors.Errorf("getting worker stats: %w", err)
}
workersByType := map[string]int{
sealtasks.WorkerSealing: 0,
sealtasks.WorkerWindowPoSt: 0,
sealtasks.WorkerWinningPoSt: 0,
}
wloop:
for _, st := range ws {
if !st.Enabled {
continue
}
for _, task := range st.Tasks {
if task.WorkerType() != sealtasks.WorkerSealing {
workersByType[task.WorkerType()]++
continue wloop
}
}
workersByType[sealtasks.WorkerSealing]++
}
fmt.Printf("Workers: Seal(%d) WdPoSt(%d) WinPoSt(%d)\n",
workersByType[sealtasks.WorkerSealing],
workersByType[sealtasks.WorkerWindowPoSt],
workersByType[sealtasks.WorkerWinningPoSt])
}
if cctx.IsSet("blocks") {
fmt.Println("Produced newest blocks:")
err = producedBlocks(ctx, cctx.Int("blocks"), maddr, fullapi)
@@ -350,9 +386,6 @@ func handleMiningInfo(ctx context.Context, cctx *cli.Context, fullapi v0api.Full
return err
}
}
// TODO: grab actr state / info
// * Sealed sectors (count / bytes)
// * Power
return nil
}
+7 -2
View File
@@ -50,8 +50,13 @@ var infoAllCmd = &cli.Command{
fmt.Println("ERROR: ", err)
}
fmt.Println("\n#: Worker List")
if err := sealingWorkersCmd.Action(cctx); err != nil {
fmt.Println("\n#: Sealing Worker List")
if err := workersCmd(true).Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
fmt.Println("\n#: Proving Worker List")
if err := workersCmd(false).Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
+3 -2
View File
@@ -34,6 +34,7 @@ import (
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage"
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
@@ -231,7 +232,7 @@ var initCmd = &cli.Command{
if !cctx.Bool("no-local-storage") {
b, err := json.MarshalIndent(&stores.LocalStorageMeta{
ID: stores.ID(uuid.New().String()),
ID: storiface.ID(uuid.New().String()),
Weight: 10,
CanSeal: true,
CanStore: true,
@@ -466,7 +467,7 @@ func storageMinerInit(ctx context.Context, cctx *cli.Context, api v1api.FullNode
}
stor := stores.NewRemote(lstor, si, http.Header(sa), 10, &stores.DefaultPartialFileHandler{})
smgr, err := sectorstorage.New(ctx, lstor, stor, lr, si, sectorstorage.SealerConfig{
smgr, err := sectorstorage.New(ctx, lstor, stor, lr, si, sectorstorage.Config{
ParallelFetchLimit: 10,
AllowAddPiece: true,
AllowPreCommit1: true,
+1
View File
@@ -212,6 +212,7 @@ var setAskCmd = &cli.Command{
Name: "max-piece-size",
Usage: "Set maximum piece size (w/bit-padding, in bytes) in ask to `SIZE`",
DefaultText: "miner sector size",
Value: "0",
},
},
Action: func(cctx *cli.Context) error {
+91 -6
View File
@@ -1,10 +1,12 @@
package main
import (
"encoding/json"
"fmt"
"os"
"strconv"
"text/tabwriter"
"time"
"github.com/fatih/color"
"github.com/urfave/cli/v2"
@@ -17,7 +19,7 @@ import (
"github.com/filecoin-project/lotus/chain/store"
"github.com/filecoin-project/lotus/chain/types"
lcli "github.com/filecoin-project/lotus/cli"
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
"github.com/filecoin-project/specs-storage/storage"
)
@@ -30,6 +32,8 @@ var provingCmd = &cli.Command{
provingDeadlineInfoCmd,
provingFaultsCmd,
provingCheckProvableCmd,
workersCmd(false),
provingComputeCmd,
},
}
@@ -365,6 +369,10 @@ var provingCheckProvableCmd = &cli.Command{
Name: "storage-id",
Usage: "filter sectors by storage path (path id)",
},
&cli.BoolFlag{
Name: "faulty",
Usage: "only check faulty sectors",
},
},
Action: func(cctx *cli.Context) error {
if cctx.Args().Len() != 1 {
@@ -376,7 +384,7 @@ var provingCheckProvableCmd = &cli.Command{
return xerrors.Errorf("could not parse deadline index: %w", err)
}
api, closer, err := lcli.GetFullNodeAPI(cctx)
api, closer, err := lcli.GetFullNodeAPIV1(cctx)
if err != nil {
return err
}
@@ -420,7 +428,7 @@ var provingCheckProvableCmd = &cli.Command{
if err != nil {
return err
}
decls := sl[stores.ID(cctx.String("storage-id"))]
decls := sl[storiface.ID(cctx.String("storage-id"))]
filter = map[abi.SectorID]struct{}{}
for _, decl := range decls {
@@ -428,6 +436,38 @@ var provingCheckProvableCmd = &cli.Command{
}
}
if cctx.Bool("faulty") {
parts, err := getAllPartitions(ctx, addr, api)
if err != nil {
return xerrors.Errorf("getting partitions: %w", err)
}
if filter != nil {
for k := range filter {
set, err := parts.FaultySectors.IsSet(uint64(k.Number))
if err != nil {
return err
}
if !set {
delete(filter, k)
}
}
} else {
filter = map[abi.SectorID]struct{}{}
err = parts.FaultySectors.ForEach(func(s uint64) error {
filter[abi.SectorID{
Miner: abi.ActorID(mid),
Number: abi.SectorNumber(s),
}] = struct{}{}
return nil
})
if err != nil {
return err
}
}
}
for parIdx, par := range partitions {
sectors := make(map[abi.SectorNumber]struct{})
@@ -437,7 +477,6 @@ var provingCheckProvableCmd = &cli.Command{
}
var tocheck []storage.SectorRef
var update []bool
for _, info := range sectorInfos {
si := abi.SectorID{
Miner: abi.ActorID(mid),
@@ -455,10 +494,9 @@ var provingCheckProvableCmd = &cli.Command{
ProofType: info.SealProof,
ID: si,
})
update = append(update, info.SectorKeyCID != nil)
}
bad, err := sapi.CheckProvable(ctx, info.WindowPoStProofType, tocheck, update, cctx.Bool("slow"))
bad, err := sapi.CheckProvable(ctx, info.WindowPoStProofType, tocheck, cctx.Bool("slow"))
if err != nil {
return err
}
@@ -475,3 +513,50 @@ var provingCheckProvableCmd = &cli.Command{
return tw.Flush()
},
}
var provingComputeCmd = &cli.Command{
Name: "compute",
Subcommands: []*cli.Command{
provingComputeWindowPoStCmd,
},
}
var provingComputeWindowPoStCmd = &cli.Command{
Name: "window-post",
Usage: "Compute WindowPoSt for a specific deadline",
Description: `Note: This command is intended to be used to verify PoSt compute performance.
It will not send any messages to the chain.`,
ArgsUsage: "[deadline index]",
Action: func(cctx *cli.Context) error {
if cctx.Args().Len() != 1 {
return xerrors.Errorf("must pass deadline index")
}
dlIdx, err := strconv.ParseUint(cctx.Args().Get(0), 10, 64)
if err != nil {
return xerrors.Errorf("could not parse deadline index: %w", err)
}
sapi, scloser, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err
}
defer scloser()
ctx := lcli.ReqContext(cctx)
start := time.Now()
res, err := sapi.ComputeWindowPoSt(ctx, dlIdx, types.EmptyTSK)
fmt.Printf("Took %s\n", time.Now().Sub(start))
if err != nil {
return err
}
jr, err := json.Marshal(res)
if err != nil {
return err
}
fmt.Println(string(jr))
return nil
},
}
+98 -89
View File
@@ -16,6 +16,7 @@ import (
"github.com/urfave/cli/v2"
"golang.org/x/xerrors"
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
"github.com/filecoin-project/lotus/chain/types"
@@ -27,7 +28,7 @@ var sealingCmd = &cli.Command{
Usage: "interact with sealing pipeline",
Subcommands: []*cli.Command{
sealingJobsCmd,
sealingWorkersCmd,
workersCmd(true),
sealingSchedDiagCmd,
sealingAbortCmd,
},
@@ -47,107 +48,115 @@ func barString(total, y, g float64) string {
return barString
}
var sealingWorkersCmd = &cli.Command{
Name: "workers",
Usage: "list workers",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
func workersCmd(sealing bool) *cli.Command {
return &cli.Command{
Name: "workers",
Usage: "list workers",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
},
},
},
Action: func(cctx *cli.Context) error {
if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err
}
defer closer()
ctx := lcli.ReqContext(cctx)
stats, err := nodeApi.WorkerStats(ctx)
if err != nil {
return err
}
type sortableStat struct {
id uuid.UUID
storiface.WorkerStats
}
st := make([]sortableStat, 0, len(stats))
for id, stat := range stats {
st = append(st, sortableStat{id, stat})
}
sort.Slice(st, func(i, j int) bool {
return st[i].id.String() < st[j].id.String()
})
for _, stat := range st {
gpuUse := "not "
gpuCol := color.FgBlue
if stat.GpuUsed > 0 {
gpuCol = color.FgGreen
gpuUse = ""
Action: func(cctx *cli.Context) error {
if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}
var disabled string
if !stat.Enabled {
disabled = color.RedString(" (disabled)")
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err
}
defer closer()
ctx := lcli.ReqContext(cctx)
stats, err := nodeApi.WorkerStats(ctx)
if err != nil {
return err
}
fmt.Printf("Worker %s, host %s%s\n", stat.id, color.MagentaString(stat.Info.Hostname), disabled)
fmt.Printf("\tCPU: [%s] %d/%d core(s) in use\n",
barString(float64(stat.Info.Resources.CPUs), 0, float64(stat.CpuUse)), stat.CpuUse, stat.Info.Resources.CPUs)
ramTotal := stat.Info.Resources.MemPhysical
ramTasks := stat.MemUsedMin
ramUsed := stat.Info.Resources.MemUsed
var ramReserved uint64 = 0
if ramUsed > ramTasks {
ramReserved = ramUsed - ramTasks
type sortableStat struct {
id uuid.UUID
storiface.WorkerStats
}
ramBar := barString(float64(ramTotal), float64(ramReserved), float64(ramTasks))
fmt.Printf("\tRAM: [%s] %d%% %s/%s\n", ramBar,
(ramTasks+ramReserved)*100/stat.Info.Resources.MemPhysical,
types.SizeStr(types.NewInt(ramTasks+ramUsed)),
types.SizeStr(types.NewInt(stat.Info.Resources.MemPhysical)))
st := make([]sortableStat, 0, len(stats))
for id, stat := range stats {
if len(stat.Tasks) > 0 {
if (stat.Tasks[0].WorkerType() != sealtasks.WorkerSealing) == sealing {
continue
}
}
vmemTotal := stat.Info.Resources.MemPhysical + stat.Info.Resources.MemSwap
vmemTasks := stat.MemUsedMax
vmemUsed := stat.Info.Resources.MemUsed + stat.Info.Resources.MemSwapUsed
var vmemReserved uint64 = 0
if vmemUsed > vmemTasks {
vmemReserved = vmemUsed - vmemTasks
st = append(st, sortableStat{id, stat})
}
vmemBar := barString(float64(vmemTotal), float64(vmemReserved), float64(vmemTasks))
fmt.Printf("\tVMEM: [%s] %d%% %s/%s\n", vmemBar,
(vmemTasks+vmemReserved)*100/vmemTotal,
types.SizeStr(types.NewInt(vmemTasks+vmemReserved)),
types.SizeStr(types.NewInt(vmemTotal)))
sort.Slice(st, func(i, j int) bool {
return st[i].id.String() < st[j].id.String()
})
if len(stat.Info.Resources.GPUs) > 0 {
gpuBar := barString(float64(len(stat.Info.Resources.GPUs)), 0, stat.GpuUsed)
fmt.Printf("\tGPU: [%s] %.f%% %.2f/%d gpu(s) in use\n", color.GreenString(gpuBar),
stat.GpuUsed*100/float64(len(stat.Info.Resources.GPUs)),
stat.GpuUsed, len(stat.Info.Resources.GPUs))
for _, stat := range st {
gpuUse := "not "
gpuCol := color.FgBlue
if stat.GpuUsed > 0 {
gpuCol = color.FgGreen
gpuUse = ""
}
var disabled string
if !stat.Enabled {
disabled = color.RedString(" (disabled)")
}
fmt.Printf("Worker %s, host %s%s\n", stat.id, color.MagentaString(stat.Info.Hostname), disabled)
fmt.Printf("\tCPU: [%s] %d/%d core(s) in use\n",
barString(float64(stat.Info.Resources.CPUs), 0, float64(stat.CpuUse)), stat.CpuUse, stat.Info.Resources.CPUs)
ramTotal := stat.Info.Resources.MemPhysical
ramTasks := stat.MemUsedMin
ramUsed := stat.Info.Resources.MemUsed
var ramReserved uint64 = 0
if ramUsed > ramTasks {
ramReserved = ramUsed - ramTasks
}
ramBar := barString(float64(ramTotal), float64(ramReserved), float64(ramTasks))
fmt.Printf("\tRAM: [%s] %d%% %s/%s\n", ramBar,
(ramTasks+ramReserved)*100/stat.Info.Resources.MemPhysical,
types.SizeStr(types.NewInt(ramTasks+ramUsed)),
types.SizeStr(types.NewInt(stat.Info.Resources.MemPhysical)))
vmemTotal := stat.Info.Resources.MemPhysical + stat.Info.Resources.MemSwap
vmemTasks := stat.MemUsedMax
vmemUsed := stat.Info.Resources.MemUsed + stat.Info.Resources.MemSwapUsed
var vmemReserved uint64 = 0
if vmemUsed > vmemTasks {
vmemReserved = vmemUsed - vmemTasks
}
vmemBar := barString(float64(vmemTotal), float64(vmemReserved), float64(vmemTasks))
fmt.Printf("\tVMEM: [%s] %d%% %s/%s\n", vmemBar,
(vmemTasks+vmemReserved)*100/vmemTotal,
types.SizeStr(types.NewInt(vmemTasks+vmemReserved)),
types.SizeStr(types.NewInt(vmemTotal)))
if len(stat.Info.Resources.GPUs) > 0 {
gpuBar := barString(float64(len(stat.Info.Resources.GPUs)), 0, stat.GpuUsed)
fmt.Printf("\tGPU: [%s] %.f%% %.2f/%d gpu(s) in use\n", color.GreenString(gpuBar),
stat.GpuUsed*100/float64(len(stat.Info.Resources.GPUs)),
stat.GpuUsed, len(stat.Info.Resources.GPUs))
}
for _, gpu := range stat.Info.Resources.GPUs {
fmt.Printf("\tGPU: %s\n", color.New(gpuCol).Sprintf("%s, %sused", gpu, gpuUse))
}
}
for _, gpu := range stat.Info.Resources.GPUs {
fmt.Printf("\tGPU: %s\n", color.New(gpuCol).Sprintf("%s, %sused", gpu, gpuUse))
}
}
return nil
},
return nil
},
}
}
var sealingJobsCmd = &cli.Command{
+1 -56
View File
@@ -11,9 +11,6 @@ import (
"strings"
"time"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/docker/go-units"
"github.com/fatih/color"
cbor "github.com/ipfs/go-ipld-cbor"
@@ -56,7 +53,6 @@ var sectorsCmd = &cli.Command{
sectorsRemoveCmd,
sectorsSnapUpCmd,
sectorsSnapAbortCmd,
sectorsMarkForUpgradeCmd,
sectorsStartSealCmd,
sectorsSealDelayCmd,
sectorsCapacityCollateralCmd,
@@ -437,7 +433,7 @@ var sectorsListCmd = &cli.Command{
const verifiedPowerGainMul = 9
dw, vp := .0, .0
estimate := st.Expiration-st.Activation <= 0
estimate := (st.Expiration-st.Activation <= 0) || sealing.IsUpgradeState(sealing.SectorState(st.State))
if !estimate {
rdw := big.Add(st.DealWeight, st.VerifiedDealWeight)
dw = float64(big.Div(rdw, big.NewInt(int64(st.Expiration-st.Activation))).Uint64())
@@ -1568,57 +1564,6 @@ var sectorsSnapAbortCmd = &cli.Command{
},
}
var sectorsMarkForUpgradeCmd = &cli.Command{
Name: "mark-for-upgrade",
Usage: "Mark a committed capacity sector for replacement by a sector with deals",
ArgsUsage: "<sectorNum>",
Action: func(cctx *cli.Context) error {
if cctx.Args().Len() != 1 {
return lcli.ShowHelp(cctx, xerrors.Errorf("must pass sector number"))
}
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err
}
defer closer()
api, nCloser, err := lcli.GetFullNodeAPI(cctx)
if err != nil {
return err
}
defer nCloser()
ctx := lcli.ReqContext(cctx)
nv, err := api.StateNetworkVersion(ctx, types.EmptyTSK)
if err != nil {
return xerrors.Errorf("failed to get network version: %w", err)
}
if nv >= network.Version15 {
return xerrors.Errorf("classic cc upgrades disabled v15 and beyond, use `snap-up`")
}
// disable mark for upgrade two days before the ntwk v15 upgrade
// TODO: remove the following block in v1.15.1
head, err := api.ChainHead(ctx)
if err != nil {
return xerrors.Errorf("failed to get chain head: %w", err)
}
twoDays := abi.ChainEpoch(2 * builtin.EpochsInDay)
if head.Height() > (build.UpgradeOhSnapHeight - twoDays) {
return xerrors.Errorf("OhSnap is coming soon, " +
"please use `snap-up` to upgrade your cc sectors after the network v15 upgrade!")
}
id, err := strconv.ParseUint(cctx.Args().Get(0), 10, 64)
if err != nil {
return xerrors.Errorf("could not parse sector number: %w", err)
}
return nodeApi.SectorMarkForUpgrade(ctx, abi.SectorNumber(id), false)
},
}
var sectorsStartSealCmd = &cli.Command{
Name: "seal",
Usage: "Manually start sealing a sector (filling any unused space with junk)",

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