Compare commits

...
1720 Commits
Author SHA1 Message Date
Aayush Rajasekaran 15fe726e65 Correct CHANGELOG 2020-11-13 04:24:35 -05:00
Aayush Rajasekaran 17c2c0d1c8 Merge pull request #4845 from filecoin-project/asr/changelog
Lotus version 1.1.3
2020-11-13 04:23:21 -05:00
Aayush Rajasekaran 2971dd4317 Lotus version 1.1.3 2020-11-13 04:09:48 -05:00
Łukasz Magiera 6742a74260 Merge pull request #4814 from filecoin-project/feat/rw-close
update libp2p for stream interface changes
2020-11-13 00:23:29 +01:00
Łukasz Magiera 41af94f1b7 Merge pull request #4835 from filecoin-project/feat/fast-pred-wrap
predicates: Fast StateGetActor wrapper
2020-11-13 00:07:27 +01:00
Łukasz Magiera 6bb67f2fe9 Merge pull request #4834 from filecoin-project/feat/sector-gc
miner: Basic storage cleanup command
2020-11-13 00:03:17 +01:00
Łukasz Magiera 961a25298b predicates: Fast StateGetActor wrapper 2020-11-12 23:45:06 +01:00
Steven Allen 5f1737379a update libp2p for stream interface changes 2020-11-12 13:57:19 -08:00
Łukasz Magiera c5c0185943 miner: Basic storage cleanup command 2020-11-12 21:27:16 +01:00
Łukasz Magiera 8fdb9148e4 Merge pull request #4832 from filecoin-project/fix/logging-quieter
drop a few logs down to debug
2020-11-12 20:57:35 +01:00
Łukasz Magiera d3d5f8d7f0 Merge branch 'master' into fix/logging-quieter 2020-11-12 20:45:41 +01:00
Łukasz Magiera 99031bae17 Merge pull request #4709 from filecoin-project/feat/mute-logs
Make some logs quieter
2020-11-12 20:40:10 +01:00
Łukasz Magiera 56373b0d46 Merge pull request #4817 from filecoin-project/feat/docsgen-miner
docsgen: Support miner/worker
2020-11-12 20:31:48 +01:00
whyrusleeping 7921f8d713 drop a few logs down to debug 2020-11-12 11:25:22 -08:00
Łukasz Magiera 6d3e59e047 Merge pull request #4824 from filecoin-project/feat/winpost-warmup
miner: Winning PoSt Warmup
2020-11-12 20:23:07 +01:00
Łukasz Magiera 63f13977ce Make docsgen more deterministic 2020-11-12 20:18:39 +01:00
Łukasz Magiera 408183c7a6 docsgen: Fix CI 2020-11-12 20:15:57 +01:00
Łukasz Magiera 11b041224e fsm: Allow manually resurrecting removed sectors 2020-11-12 19:37:54 +01:00
Łukasz Magiera 36b78b1891 Merge pull request #4831 from filecoin-project/feat/miner-storagelistsectors
miner: Storage list sectors command
2020-11-12 19:26:01 +01:00
Łukasz Magiera a6d061d0f6 Merge pull request #4827 from filecoin-project/fix/startup-migration-crash
Fix: dont crash on startup if funds migration fails
2020-11-12 19:17:21 +01:00
Łukasz Magiera bf547112de miner: Storage list sectors command 2020-11-12 19:11:58 +01:00
Łukasz Magiera 28ffa8ca06 Merge pull request #4819 from liyue201/master
Delete the duplicate output
2020-11-12 18:13:51 +01:00
Łukasz Magiera 55240b3e07 Merge pull request #4826 from filecoin-project/test/stop-mining
Stop mining at the end of tests
2020-11-12 17:40:13 +01:00
Łukasz Magiera 697a0a3b95 Merge pull request #4825 from filecoin-project/test/fund-mgr-panic
test for FundManager panic to ensure it is fixed
2020-11-12 17:39:30 +01:00
Dirk McCormick 26e12e6f6a fix: dont crash on startup if funds migration fails 2020-11-12 17:15:05 +01:00
Dirk McCormick 0e3e449bf8 test: stop mining at the end of tests 2020-11-12 16:23:46 +01:00
Dirk McCormick f3922e7485 test: for FundManager panic to ensure it is fixed 2020-11-12 15:35:43 +01:00
Łukasz Magiera fb05bb7f07 miner: Winning PoSt Warmup 2020-11-12 15:34:16 +01:00
stirlingx 8246149544 Delete unnecessary output 2020-11-12 18:59:36 +08:00
Łukasz Magiera d525acdeda Merge pull request #4797 from zgfzgf/fix-2k-chain-syn
2k sync BootstrapPeerThreshold
2020-11-12 10:33:04 +01:00
Łukasz Magiera 2f0075752d docsgen: generate miner/worker docs 2020-11-12 10:31:12 +01:00
Łukasz Magiera 8409e155d4 docsgen: Support miner/worker structs 2020-11-12 10:29:42 +01:00
Aayush Rajasekaran 3a3986320c Merge pull request #4804 from filecoin-project/feat/storage-retwait-cleanup
Expand sched-diag; Command to abort sealing calls
2020-11-12 02:11:15 -05:00
Aayush Rajasekaran 498477da04 Nit: ArgsUsage param rename 2020-11-12 02:04:55 -05:00
Jakub Sztandera a389622ac6 Merge pull request #4811 from filecoin-project/raulk/badger-ctx-tests
badger blockstore: minor improvements
2020-11-12 03:55:31 +01:00
Raúl Kripalani 72547f9ec3 badger tests: fix fd leak. 2020-11-11 23:12:57 +00:00
Raúl Kripalani 04a866121e badger/AllKeysChan(): respect context. 2020-11-11 23:12:16 +00:00
Travis Person f4df58ed0f Merge pull request #4810 from filecoin-project/fix/lotus-stats-flags
lotus-stats: fix influx flags
2020-11-11 14:36:37 -08:00
Aayush Rajasekaran bc7eaee6d3 Merge pull request #4808 from filecoin-project/fix/fund-mgr-panic
Fix panic in FundManager
2020-11-11 16:43:13 -05:00
Travis Person ff7bdb5140 lotus-stats: fix influx flags 2020-11-11 21:17:36 +00:00
Dirk McCormick 6184d228c1 fix: panic in FundManager 2020-11-11 20:32:26 +01:00
Łukasz Magiera 8ac495723e gofmt 2020-11-11 17:42:23 +01:00
Łukasz Magiera 09f9f871a3 Create a command to abort sealing calls 2020-11-11 17:39:12 +01:00
Łukasz Magiera 2a3d930933 Hide ret-done tasks in sealing jobs by default 2020-11-11 16:48:04 +01:00
Łukasz Magiera bd71bf2379 Expand sched-diag 2020-11-11 16:47:44 +01:00
Łukasz Magiera 6f593d53d0 Merge pull request #4795 from liyue201/master
Modify printf format
2020-11-11 16:03:26 +01:00
Łukasz Magiera d1e4211f4b Merge pull request #4803 from filecoin-project/fix/paych-mgr-ctx-cancel-race
Fix race in paych manager when req context is cancelled
2020-11-11 15:58:16 +01:00
Dirk McCormick 9745f676ed fix: race in paych manager when req context is cancelled 2020-11-11 14:40:48 +01:00
Aayush Rajasekaran 90dd39d581 Merge pull request #4787 from filecoin-project/refactor/fund-mgr-integ
refactor: integrate new FundManager
2020-11-11 03:58:59 -05:00
Dirk McCormick 9011e88f9f fix: go mod tidy 2020-11-11 09:45:32 +01:00
Dirk McCormick 0e20a65a0b feat: upgrade markets to v1.0.4 2020-11-11 09:41:27 +01:00
Aayush Rajasekaran 28c4a2d8fa Merge pull request #4798 from filecoin-project/asr/address-update
Update to latest go-address
2020-11-11 03:39:02 -05:00
Dirk McCormick ea810ac806 fix: order of addresses in storage adapter reserve funds 2020-11-11 08:59:14 +01:00
zgfzgf 11ed015dca update BootstrapPeerThreshold = 1 2020-11-11 14:44:35 +08:00
Aayush Rajasekaran 029c516cbc Update to latest go-address 2020-11-11 00:46:02 -05:00
zgfzgf c6b9e4951f add testground BootstrapPeerThreshold 2020-11-11 13:20:59 +08:00
hannahhoward ebd6b0da49 fix(deps): update to tagged go-graphsync 2020-11-10 21:18:29 -08:00
hannahhoward cceb74a66e docs(apidocs): update for new funcs 2020-11-10 21:11:05 -08:00
hannahhoward 9f7204ee26 feat(builder): finish new FundManager setup
Finish setup of new FundManager and provide a migration for previously reserved funds
2020-11-10 21:11:05 -08:00
Dirk McCormick 0d243bb824 refactor: integrate new FundManager 2020-11-10 21:11:05 -08:00
Aayush Rajasekaran e53b0ef068 Merge pull request #4736 from filecoin-project/refactor/fund-mgr
Refactor FundManager
2020-11-10 23:36:56 -05:00
zgfzgf 1301fd6ddb 2k sync BootstrapPeerThreshold 2020-11-11 12:20:31 +08:00
Dirk McCormick 0101436933 fix: flaky TestFundManagerWithdrawalLimit test 2020-11-10 19:44:26 -08:00
Dirk McCormick 0e0ffc9c10 refactor: remove FundManager.Wait 2020-11-10 19:44:26 -08:00
Dirk McCormick a51a62cb42 fix: batch withdrawal requests by wallet 2020-11-10 19:44:26 -08:00
Dirk McCormick 86c204d8a8 refactor: improve FundManager naming and docs 2020-11-10 19:44:26 -08:00
Dirk McCormick 1182927fe5 refactor: add wallet param to FundManager methods 2020-11-10 19:44:26 -08:00
Dirk McCormick 4d3cd7dcb8 refactor: FundManager 2020-11-10 19:44:26 -08:00
stirlingx 8b889139e9 Modify printf format 2020-11-11 10:39:13 +08:00
Aayush Rajasekaran 1323dbddfe Merge pull request #4793 from filecoin-project/asr/bitfield-update
Update to latest go-bitfield
2020-11-10 20:36:08 -05:00
Aayush Rajasekaran c02341c85f Merge pull request #4788 from filecoin-project/feat/client-dealstats
Add client deal-stats CLI
2020-11-10 18:09:58 -05:00
Aayush Rajasekaran 735c04f999 Merge pull request #4681 from filecoin-project/badger-viewable
move to native badger blockstore; leverage zero-copy View() to deserialize in-place
2020-11-10 18:08:12 -05:00
Raúl Kripalani bc6965c86f skip callers in badger log for useful line info. 2020-11-10 22:50:53 +00:00
Aayush Rajasekaran 075297d8ad Update to latest go-bitfield 2020-11-10 17:43:50 -05:00
Raúl Kripalani 8f5847b8e3 fix condition. 2020-11-10 22:34:13 +00:00
Łukasz Magiera ab7ee2f8a9 Merge pull request #4730 from filecoin-project/feat/deal-id-change-in-sector-committed
Handle deal id changes in OnDealSectorCommitted
2020-11-10 22:18:28 +01:00
Łukasz Magiera 18aa97f962 Merge pull request #4779 from filecoin-project/feat/work-track-hostname
storage: Track worker hostnames with work
2020-11-10 20:38:44 +01:00
Łukasz Magiera 2ae0edc4df Merge pull request #4688 from filecoin-project/feat/head-change-coalscer
head change coalescer
2020-11-10 19:40:54 +01:00
Łukasz Magiera 89632416ba Merge pull request #4786 from zgfzgf/fix-sectors-cmd-list
cmd sectors commitIDs len debug
2020-11-10 19:18:17 +01:00
Łukasz Magiera 61fa94617d Merge pull request #4778 from filecoin-project/fix/miner-fixes
Fix scheduler lockups after storage is freed
2020-11-10 19:17:10 +01:00
Raúl Kripalani 659ceaabdd fix comment. 2020-11-10 17:51:11 +00:00
Raúl Kripalani d79ff24014 remove benchmark. 2020-11-10 17:50:21 +00:00
Łukasz Magiera 1df7318450 Merge pull request #4785 from strahe/fix/fast-connect-bootstrappers
async connect to bootstrappers
2020-11-10 17:45:06 +01:00
Łukasz Magiera 60debfb0a6 Add client deal-stats CLI 2020-11-10 17:33:05 +01:00
Raúl Kripalani 379dd02fb6 upgrade dependencies. 2020-11-10 16:32:23 +00:00
Raúl Kripalani 339391ecfb Revert "(to be reverted) add debug.PrintStack."
This reverts commit f8c3756ac0.
2020-11-10 16:08:41 +00:00
Raúl Kripalani 38c404e04e vm: construct CBOR store properly. 2020-11-10 15:49:33 +00:00
Raúl Kripalani f8c3756ac0 (to be reverted) add debug.PrintStack. 2020-11-10 15:22:17 +00:00
Raúl Kripalani 360194b29b fix comment. 2020-11-10 15:02:55 +00:00
Raúl Kripalani af7236f7e7 migrate direct usages blockstore.{Get=>View}. 2020-11-10 13:35:36 +00:00
Raúl Kripalani 6d78de95a1 remove unused and misleading cachebs store. 2020-11-10 13:34:56 +00:00
Raúl Kripalani 577476b8fe import Viewable non-terminal blockstores. 2020-11-10 13:16:24 +00:00
Raúl Kripalani 54bf7c99d7 add the viewable trait to our gazillion blockstores. 2020-11-10 12:40:32 +00:00
少爷 e340996919 delete new context 2020-11-10 17:40:48 +08:00
zgfzgf f5401317c9 cmd sectors commitIDs len 2020-11-10 17:37:36 +08:00
少爷 de2637b4fa async connect to bootstrappers 2020-11-10 17:23:46 +08:00
hannahhoward ea726c9f17 feat(markets): update to 1.0.1
update to tagged 1.0.1 release & also fix lint error
2020-11-09 20:02:02 -08:00
hannahhoward 314dda08e8 fix(markets): correct deal equality check
correct comparison of deal equality (a strict == is not enough)
2020-11-09 19:23:58 -08:00
hannahhoward b010ac21d3 style(lint): fix lint issues 2020-11-09 18:48:28 -08:00
hannahhoward 7519bdde42 feat(markets): check deal equality
in OnDealSectorCommitted, verify that deals looked up match the deal proposals which were made
2020-11-09 18:48:28 -08:00
hannahhoward 09a0d6e607 style(lint): fix lint issues 2020-11-09 18:48:28 -08:00
hannahhoward a3e93554e5 refactor(markets): refactor OnDealSectorCommitted
extract OnDealSectorCommitted from adapters and test
2020-11-09 18:48:28 -08:00
hannahhoward d2acc78787 feat(markets): handle deal ID changes
make OnDealSectorCommitted handle changes to deal ids
2020-11-09 18:48:28 -08:00
Lucas Molas 3ec25cbece restrict parse fil string length (#4780) 2020-11-09 22:12:32 -03:00
Łukasz Magiera 5caa277261 storage: Track abandoned work more correctly 2020-11-09 23:38:20 +01:00
Łukasz Magiera f819e71d12 storage: Separate returned jobs in jobs cli 2020-11-09 23:13:29 +01:00
Łukasz Magiera 27a9dd3bbb storage: Track worker hostnames with work 2020-11-09 23:09:04 +01:00
Łukasz Magiera 5b8f555221 sched: Update after tasks finish preparing 2020-11-09 21:44:28 +01:00
Łukasz Magiera fbc05fa5a8 stores: Report storage changes quickly 2020-11-09 21:43:52 +01:00
Łukasz Magiera 95d9084899 Merge pull request #4765 from zgfzgf/feat-sealing-garbage
optimize pledge sector
2020-11-09 21:06:33 +01:00
Łukasz Magiera f31383516e Merge pull request #4769 from zgfzgf/feat-storage-work-returntype
optimize code replace strings with constants
2020-11-09 21:05:23 +01:00
Łukasz Magiera 82e88a3239 Merge pull request #4775 from filecoin-project/fix/pond
Make pond work again
2020-11-09 21:03:58 +01:00
Łukasz Magiera 290414e935 wallet: Don't return null from WalletList 2020-11-09 18:42:43 +01:00
Łukasz Magiera e1122404d1 pond: Fix MpoolPushMessage call 2020-11-09 18:42:22 +01:00
vyzo 185653f85a improve coalescing 2020-11-09 13:35:42 +02:00
zgfzgf 5bcc6339b4 optimize code replace strings with constants 2020-11-09 16:21:16 +08:00
zgfzgf 3665f90795 optimize pledge sector 2020-11-08 16:24:50 +08:00
Whyrusleeping f225b7b928 Merge pull request #4758 from filecoin-project/steb/update-yamux
update yamux
2020-11-06 13:34:11 -08:00
Steven Allen 4a3ff8ff9e update yamux
This new release:

* Ensures we send window updates on-time to avoid sawtooth bandwidth utilization.
* Limits the number of outgoing pings to 1 (no need to send any more at a time).
* Limits the number of buffered pongs to 32 (there should never be more than 1,
  maybe 2, at a time).
* Fast-tracks outgoing pings so they don't get stuck behind large queued writes.
2020-11-06 12:51:50 -08:00
vyzo 378d7a1ad9 stupid linter 2020-11-06 22:26:47 +02:00
vyzo 9a76c648f1 unit test for head change coalescer 2020-11-06 22:26:47 +02:00
vyzo 6660f81363 minimize coalesce delay for tests 2020-11-06 22:26:47 +02:00
vyzo 84c9d1dbb7 hook head change coalescer to mpool 2020-11-06 22:26:24 +02:00
vyzo 08aab1c48a make Close satisfy io.Closer 2020-11-06 22:26:24 +02:00
vyzo 9149ae2164 godoc and final dispatch when closing the coalescer 2020-11-06 22:26:24 +02:00
vyzo ec13c5f80d coalesce both reverts and applys in the same manner 2020-11-06 22:26:24 +02:00
vyzo 4058f5642f head change coalescer 2020-11-06 22:26:24 +02:00
Łukasz Magiera 48bdf79b5b Merge pull request #4756 from filecoin-project/feat/upgr-bitfield
Update go-bitfield
2020-11-06 21:18:47 +01:00
Jakub Sztandera 5a34e5b2bf Merge pull request #4599 from filecoin-project/feat/sync-manager-redux
rewrite sync manager
2020-11-06 21:01:26 +01:00
Raúl Kripalani 3577300aee Merge branch 'master' into badger-viewable 2020-11-06 19:34:25 +00:00
Jakub Sztandera 258cc0067b Update go-bitfield v0.2.2
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-11-06 20:16:05 +01:00
Raúl Kripalani 0b2a02c8ea remove redundant import. 2020-11-06 18:57:04 +00:00
Raúl Kripalani 7c442e1a98 godocs. 2020-11-06 18:55:13 +00:00
Raúl Kripalani 85e37e4b70 make the value log loading mode mmap, to leverage zero-copy access. 2020-11-06 18:39:08 +00:00
Raúl Kripalani de4a0725f3 rename files. 2020-11-06 18:32:44 +00:00
Łukasz Magiera 426c2e8c2b Merge pull request #4717 from filecoin-project/feat/optional-chain-bitswap
Optional chain Bitswap
2020-11-06 16:49:39 +01:00
Łukasz Magiera db1159414f Merge pull request #4734 from filecoin-project/asr/devnet-kumquat
Run kumquat upgrade on devnets
2020-11-06 16:48:29 +01:00
Łukasz Magiera 6bb8521a55 Merge pull request #4719 from filecoin-project/frrist/msig-diffing
polish: add msig pendingtxn diffing and comp
2020-11-06 16:47:29 +01:00
Łukasz Magiera 3c9e438a68 Merge pull request #4617 from filecoin-project/termination-penalty
Add `termination-estimate` to get an estimation for how much a termination penalty will be
2020-11-06 16:44:44 +01:00
Łukasz Magiera 2f9d19c42c Merge pull request #4726 from filecoin-project/feat/shed-id-cid
shed: Util for creating ID CIDs
2020-11-06 16:03:45 +01:00
Łukasz Magiera ee9df63221 shed: Util for creating ID CIDs 2020-11-06 15:42:09 +01:00
Łukasz Magiera 2076abf0c1 Merge pull request #4745 from filcloud/reward-data-type
match data type for reward state api
2020-11-06 15:29:38 +01:00
Łukasz Magiera 273da38bdd Merge pull request #4739 from filecoin-project/feat/gas-estim-limit-ts
Use TSK passed to GasEstimateGasLimit
2020-11-06 11:59:55 +01:00
Frank a3f5d0f590 match data type for reward state api 2020-11-06 11:06:57 +08:00
Jakub Sztandera 94438bf3cd Use TSK passed to GasEstimateGasLimit
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-11-05 21:14:38 +01:00
Travis Person df7f13d069 Merge pull request #4718 from filecoin-project/feat/stats-update
Update lotus-stats with a richer cli
2020-11-05 11:55:31 -08:00
Raúl Kripalani 8befc0c1f5 export metrics from bench. 2020-11-05 19:09:47 +00:00
Raúl Kripalani b1aa43741a remove file that sneaked in. 2020-11-05 13:34:41 +00:00
Jakub Sztandera c966054bf6 Merge pull request #4728 from filecoin-project/feat/storage-gas-multi-conf
Move gas multiplier as property of pricelist
2020-11-05 13:41:44 +01:00
Aayush Rajasekaran 105f0fd49a Run kumquat upgrade on devnets 2020-11-05 04:21:03 -05:00
Jakub Sztandera fe95d19e29 Move gas multiplier as property of pricelist
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-11-04 20:13:17 +01:00
Jakub Sztandera 2a294f048a Merge pull request #4713 from filecoin-project/fix/gitmodules
Fix .gitmodules
2020-11-04 19:58:37 +01:00
Travis Person bd4322f56f Update lotus-stats with a richer cli
This updates lotus stats to use urfave instead of the golang flags
package. This brings with it some common features from other lotus tools
such as the use of the `FULLNODE_API_INFO` env and other parts of the
lotus cli package.

This also includes the latest dashboard.
2020-11-04 18:06:17 +00:00
Raúl Kripalani a411342f0c export more metrics. 2020-11-04 17:09:01 +00:00
Raúl Kripalani 370ef93db6 chainstore: new ForceHeadSilent to support benchmarks. 2020-11-04 14:39:01 +00:00
frrist 7d540fc0d8 polish: add msig pendingtxn diffing and comp 2020-11-03 17:25:53 -08:00
Raúl Kripalani fd1439f284 fix lint. 2020-11-03 22:49:55 +00:00
Łukasz Magiera a1e1b03ca4 Optionally allow bitswap for chainstore 2020-11-03 23:44:44 +01:00
Raúl Kripalani 87ce2f774d lotus-bench: write separate profiles for import and validation. 2020-11-03 22:40:21 +00:00
Łukasz Magiera 9deda06ec6 Merge pull request #4710 from filecoin-project/feat/https-gh-blst
Use https for blst submodule
2020-11-03 23:05:42 +01:00
Łukasz Magiera b0824ada15 bufbs: Get from write blockstore first 2020-11-03 23:02:01 +01:00
Raúl Kripalani 5487356370 fix lint errors. 2020-11-03 21:23:41 +00:00
Jakub Sztandera 97a06444f2 Fix .gitmodules
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-11-03 20:21:55 +01:00
Raúl Kripalani 809111336a Merge branch 'master' into badger-viewable 2020-11-03 18:29:10 +00:00
Raúl Kripalani 18418128c3 lotus-bench: make start tipset walkback start from end tipset. 2020-11-03 18:15:59 +00:00
Raúl Kripalani 581ac5b019 lotus-bench: add ability to specify tipsets. 2020-11-03 18:11:43 +00:00
Raúl Kripalani 842c8ca056 improve lotus-bench; support running validation on a store without a CAR. 2020-11-03 17:35:31 +00:00
Łukasz Magiera fe4298674f Use https for blst submodule 2020-11-03 15:51:33 +01:00
Łukasz Magiera 9270ac6358 Make some logs quieter 2020-11-03 13:28:41 +01:00
Łukasz Magiera d421274dcd Merge pull request #4619 from filecoin-project/feat/fix-memory-leaks-data-transfer
Fix memory leaks in data transfer
2020-11-03 13:06:09 +01:00
Łukasz Magiera 1df02d5a93 Merge pull request #4691 from filecoin-project/fix/metrics
fix metrics wiring.
2020-11-03 11:50:43 +01:00
Łukasz Magiera fdd90e036f Merge pull request #4697 from filecoin-project/asr/rename-builtins
Rename builtin actor generators
2020-11-03 11:47:55 +01:00
Łukasz Magiera 761c9ee2b6 Merge pull request #4699 from blockchain-lib/master
struct name incorrect
2020-11-03 11:47:18 +01:00
Łukasz Magiera c215615da3 Merge pull request #4704 from zgfzgf/fix-runtime-gas-print
modify runtime gasUsed printf
2020-11-03 11:46:26 +01:00
Łukasz Magiera b7b6252048 Merge pull request #4705 from filecoin-project/asr/delete-default
Correctly delete the default wallet address
2020-11-03 11:44:25 +01:00
Łukasz Magiera 6d27531663 Merge pull request #4630 from filecoin-project/feat/new-blst
feat: integrate new optional blst backend and verification optimizations from proofs
2020-11-03 11:43:12 +01:00
Łukasz Magiera 3c44407c57 circle: Fix lotus-soup build 2020-11-03 11:29:54 +01:00
Łukasz Magiera bfa04da572 Merge pull request #4692 from filecoin-project/feat/shed-rpc
sched: Interactive RPC Shell
2020-11-03 11:24:05 +01:00
Łukasz Magiera e547710c6d Merge pull request #4696 from filecoin-project/feat/optim-heaviest-sync
Call GetHeaviestTipSet() only once when syncing
2020-11-03 11:23:23 +01:00
dignifiedquire 5c3055219c update filecoin-ffi to master 2020-11-03 11:02:58 +01:00
Aayush Rajasekaran 46619fbb8d Correctly delete the default wallet address 2020-11-03 03:00:18 -05:00
zgfzgf 4d9c90ed4a modify runtime gasUsed printf 2020-11-03 15:46:35 +08:00
hannahhoward af1743f9f3 fix(datatransfer): update with memory leak fixes 2020-11-02 17:25:02 -08:00
stirlingx b5d2f01993 Update selector_task.go 2020-11-03 09:20:48 +08:00
Aayush Rajasekaran af8cc3d29f Rename builtin actor generators 2020-11-02 18:42:30 -05:00
Jakub Sztandera e68f69b63b Call GetHeaviestTipSet() only once when syncing
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-11-02 22:56:26 +01:00
Łukasz Magiera a4cf6fa715 sched: Interactive RPC Shell 2020-11-02 20:38:15 +01:00
Raúl Kripalani 656ece06e5 fix metrics wiring.
Some components like go-ds-measure, go-ipfs-blockstore and go-bitswap
expose metrics via ipfs/go-metrics-interface, but Lotus never injects
the Prometheus exporter (ipfs/go-metrics-prometheus). Therefore, those
metrics never surface in instrumentation.

Instead, Lotus uses OpenCensus directly.

This commit injects the Prometheus exporter for go-metrics-interface, and
instructs the OpenCensus Prometheus exporter to use the DefaultRegistry.

This has the effect of exposing blending the metrics of both metrics
libraries.

With this patch, the datastore, cache utilisation, and bitswap metrics
are now exported via the /debug/metrics endpoint.

This commit also fixes an issue where the metrics scope was empty, making
go-metrics-interface default to "<no-scope>". Angle brackets are inadmissible
characters for Prometheus, so it was refusing to export the affected metrics.
(These were the ARC cache metrics.)
2020-11-02 17:56:49 +00:00
dignifiedquire 1d17d61dbc update filecoin-ffi 2020-11-02 17:05:52 +01:00
dignifiedquire d457b7a5e3 update filecoin-ffi 2020-11-02 17:05:52 +01:00
dignifiedquire 398a831701 update blst and filecoin-ffi 2020-11-02 17:05:52 +01:00
dignifiedquire 61fa03b1ad use supranation/blst@0.2.0 directly 2020-11-02 17:05:52 +01:00
dignifiedquire 56980ffc1f remove extern/fil-blst 2020-11-02 17:05:52 +01:00
Raúl Kripalani d1ebf3c769 introduce non-pooled StorageKey method. 2020-11-02 13:32:07 +00:00
Raúl Kripalani 7facdf63c9 support legacy keying: base32 multihashes *sigh*. 2020-11-02 12:55:56 +00:00
Raúl Kripalani f4e13ffd80 actually register prometheus gauge. 2020-11-01 20:01:57 +00:00
Raúl Kripalani 44e34d9606 lotus-bench: native badger SyncWrites=false. 2020-11-01 19:54:47 +00:00
Raúl Kripalani 35ccd73a86 lotus-bench: improve for observability. 2020-11-01 19:52:53 +00:00
Raúl Kripalani aece624d1c lotus-bench: add support for native badger blockstore. 2020-11-01 18:54:35 +00:00
Raúl Kripalani c2355b18f9 write heap and allocs profile in lotus-bench. 2020-11-01 18:00:08 +00:00
Raúl Kripalani 634467d24b go mod tidy. 2020-11-01 17:38:38 +00:00
Raúl Kripalani 0b8a21ee16 badger: restore prev. max table size (64MiB; default). 2020-11-01 17:26:37 +00:00
Raúl Kripalani 72e573d98d fix lint. 2020-11-01 17:09:14 +00:00
Raúl Kripalani 5a98660d1b make repo.Blockstore() idempotent; wrap in IDStore. 2020-11-01 16:56:20 +00:00
Raúl Kripalani d8d85373f5 fix lotus-shed datastore commands. 2020-11-01 13:50:41 +00:00
Raúl Kripalani a16d7f221e Merge branch 'master' into badger-viewable 2020-11-01 13:10:56 +00:00
Raúl Kripalani 95f512aa69 update/add dependencies. 2020-11-01 13:05:07 +00:00
Raúl Kripalani 099c4b5e1d migrate repo.Datastore(/chain) to repo.Blockstore(). 2020-11-01 13:03:21 +00:00
Raúl Kripalani 9437136f84 fixup. 2020-11-01 13:01:38 +00:00
Raúl Kripalani d2e2322fd2 make the lotus node use the new native badger blockstore. 2020-11-01 13:01:26 +00:00
Raúl Kripalani ce27b13076 add a native badger blockstore with View() method. 2020-11-01 12:55:49 +00:00
Łukasz Magiera a5c05f87f1 Merge pull request #4105 from filecoin-project/asr/decode-params
Add a StateDecodeParams method
2020-10-31 01:05:50 +01:00
Łukasz Magiera 7cba0b25fd Merge pull request #4618 from filecoin-project/4360
Add miner available balance and power info to state minor info
2020-10-31 01:03:39 +01:00
Łukasz Magiera 978192233d Merge pull request #4498 from filecoin-project/feat/try-election
Add election run-dummy command
2020-10-31 01:02:25 +01:00
Łukasz Magiera c6a8efff7d Merge pull request #4623 from filecoin-project/feat/cache-deal-state-matcher
Cache deal states for most recent old/new tipset
2020-10-31 01:00:11 +01:00
Łukasz Magiera 0f8dadadf5 Merge pull request #4664 from filecoin-project/refactor/events-api-call-matcher
Simplify chain event Called API
2020-10-31 00:48:45 +01:00
Łukasz Magiera 862c5b61a4 Merge pull request #4628 from filecoin-project/frrist/power-claims-changed
polish: add ClaimsChanged and DiffClaims method to power shim
2020-10-31 00:30:03 +01:00
Łukasz Magiera 6fcdf3c7ed Merge pull request #4615 from filecoin-project/feat/worker-pause
worker: Commands to pause/resume task processing
2020-10-31 00:26:37 +01:00
Łukasz Magiera 8eae921cbf Merge pull request #4633 from filecoin-project/steb/rick-roll
keep retrying the proof until we run out of sectors to skip
2020-10-31 00:15:04 +01:00
Łukasz Magiera 5a7863d21a Merge pull request #4626 from filecoin-project/fix/drand-peerid-loop
bootstrap: don't return early when one drand resolution fails
2020-10-30 23:53:11 +01:00
Steven Allen 077bc83f7f explicitly abort PoSt on context cancellation 2020-10-30 14:00:54 -07:00
Jakub Sztandera 22742a9ba0 bootstrap: don't return early when one drand resolution fails
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-30 21:58:17 +01:00
Łukasz Magiera 3b16faddad Merge pull request #4652 from filecoin-project/feat/default-max-fee-cfg
Config for default max gas fee
2020-10-30 21:35:10 +01:00
Łukasz Magiera 094ea3fe97 Merge pull request #4666 from filecoin-project/fix/sched-issues
Fix worker reenabling, handle multiple restarts in worker
2020-10-30 21:34:07 +01:00
Steven Allen 6985af5e88 keep retrying the proof until we run out of sectors to skip
If we have a bunch of corrupted but not missing sectors on disk, we may need to
retry many times before we get a proof to pass. Simply giving up doesn't help anyone.
2020-10-30 13:21:34 -07:00
Łukasz Magiera 6cdbf5216e Merge pull request #4629 from filecoin-project/fix/badger-lsm-trsh
Reduce badger ValueTreshold to 128
2020-10-30 21:10:18 +01:00
Łukasz Magiera f380d6be43 Merge pull request #4651 from filecoin-project/feat/prep-for-gasb
Prep for gas balancing
2020-10-30 20:18:03 +01:00
Łukasz Magiera fb492d9acb Merge pull request #4662 from filecoin-project/feat/force-sched-cli
Debug flag to force running sealing scheduler
2020-10-30 20:15:49 +01:00
Łukasz Magiera a7ff906e17 Merge pull request #4669 from filecoin-project/feat/minerinfo-sync
Add sync status to miner info command
2020-10-30 20:15:01 +01:00
Łukasz Magiera 696a6867dd Merge pull request #4668 from filecoin-project/fix/mpool-pricing
Fix messagepool accounting
2020-10-30 20:14:33 +01:00
vyzo 12f6119739 don't include messages that drop the balance below zero 2020-10-30 20:56:33 +02:00
Łukasz Magiera 885c6c94d3 Add sync status to miner info command 2020-10-30 19:39:31 +01:00
Jakub Sztandera 8afceee7a9 Fix messagepool accounting
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-30 19:21:25 +01:00
vyzo d6e2c80608 if noone is working pick the last worker in sync wait 2020-10-30 19:45:59 +02:00
jennijuju 2f4582147a Add termination-estimate to get an estimation for how much a termination penalty will be:
- Usage example: `./lotus-shed sectors termation-estimate 5 8 10`.
2020-10-30 13:34:03 -04:00
Łukasz Magiera 69e44ebf07 sched: re-register worker windows after re-enabling correctly 2020-10-30 18:32:59 +01:00
Łukasz Magiera f90a387f96 sched: Print worker UUIDs in shed-diag correctly 2020-10-30 18:32:16 +01:00
vyzo 5dcf339840 fix sync wait cli 2020-10-30 19:28:32 +02:00
Łukasz Magiera 774e2ecebf sched: Fix worker reenabling 2020-10-30 18:01:37 +01:00
Łukasz Magiera af1d45d969 worker: Handle multiple manager restarts while waiting for tasks 2020-10-30 18:00:48 +01:00
Dirk McCormick 79a8ff04fd refactor: simplify chain event Called API 2020-10-30 14:00:32 +01:00
Łukasz Magiera 7fbb868513 Debug flag to force running sealing scheduler 2020-10-30 11:07:35 +01:00
vyzo f6ecff0e26 check recent syncs in selectSyncTarget/selectDeferredSyncTarget 2020-10-30 07:50:26 +02:00
Aayush Rajasekaran 5ff42505e8 Add a StateDecodeParams method 2020-10-29 22:04:33 -04:00
Łukasz Magiera c3d00b0ac6 Merge pull request #4650 from jsign/jsign/offlinemode
make IPFS online mode configurable
2020-10-29 22:24:58 +01:00
Łukasz Magiera ae7889f830 Config for default max gas fee 2020-10-29 20:50:11 +01:00
Jakub Sztandera d8d9291402 Prep for gas balancing
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-29 20:34:48 +01:00
Łukasz Magiera 7d02cd6679 Merge pull request #4649 from filecoin-project/feat/sectorslist-utils
miner sectors list: flags for events/seal time
2020-10-29 19:55:16 +01:00
Ignacio Hagopian 7d0f279353 make IPFS online mode configurable
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
2020-10-29 15:16:45 -03:00
Łukasz Magiera ad9a5acb7f miner sectors list: flags for events/seal time 2020-10-29 19:10:20 +01:00
vyzo 8d25fd39cf set BootstrapPeerThreshold to 1 for tests 2020-10-29 19:32:09 +02:00
Łukasz Magiera ee814fb48e Merge pull request #4643 from filecoin-project/fix/fsm-ticket-loop
storagefsm: Fix GetTicket loop when the sector is already precommitted
2020-10-29 18:25:14 +01:00
vyzo 57234d8ef3 fix spelling in comment to satisfy linter
this is ridiculous; since when do linters apply spellchecking on comments???
2020-10-29 19:13:45 +02:00
vyzo 47830efbf5 set BootstrapPeerThreshold to 4, add env variable to override 2020-10-29 19:08:58 +02:00
Łukasz Magiera dc5d6316c9 Merge pull request #4645 from filecoin-project/fix/miner-restart-edgecase
sectorstorage: Fix manager restart edge-case
2020-10-29 18:07:18 +01:00
vyzo a650641813 transition out of initial sync only if sync finishes within 15min 2020-10-29 17:27:13 +02:00
vyzo 8702ff8b7e rename initialSync to initialSyncDone 2020-10-29 17:12:47 +02:00
Łukasz Magiera c6b03ce62b sectorstorage: Missing unlock in waitWork 2020-10-29 15:18:51 +01:00
Łukasz Magiera ea5bb5cdab sectorstorage: Fix manager restart edge-case 2020-10-29 12:14:21 +01:00
Łukasz Magiera e168f7a917 cli: miner-info review 2020-10-29 10:33:08 +01:00
Łukasz Magiera 33459f1b36 storagefsm: Fix GetTicket loop when the sector is already precommitted 2020-10-29 10:26:02 +01:00
Łukasz Magiera f0f75e2d2c Merge pull request #4627 from karalabe/fix-gpu-usage-tracking
extern/sector-storage: fix GPU usage overwrite bug
2020-10-29 10:13:54 +01:00
vyzo a26420f6e8 add missing return for deferrals during initial sync 2020-10-29 09:40:41 +02:00
Jakub Sztandera ae905bd056 Fix closing
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-29 01:05:31 +01:00
frrist 7b8dae92d9 feat: add power actor claim diff method 2020-10-28 16:52:52 -07:00
jennijuju c80e8cb7d3 Add miner available balance and power info to state minor info 2020-10-28 19:04:03 -04:00
Jakub Sztandera a2c66dd102 make linter happy
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-28 23:30:28 +01:00
Jakub Sztandera 0297be4b9a Add lotus-shed datastore rewrite command
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-28 23:24:45 +01:00
Jakub Sztandera ecc1d94b3a Reduce badger ValueTreshold to 128
It should significntly size of the LSM index, and thus increase the
performance with bigger datastores

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-28 22:17:01 +01:00
Łukasz Magiera 553408d573 worker: Commands to pause/resume task processing 2020-10-28 22:10:17 +01:00
frrist e33cc5ee12 polish: add ClaimsChanged method to power shim 2020-10-28 13:56:02 -07:00
Łukasz Magiera 32ea060e99 Merge pull request #3618 from filecoin-project/feat/async-restartable-workers
Track sealing processes across lotus-miner restarts
2020-10-28 21:55:45 +01:00
Jakub Sztandera ad905fc310 Expose WorkerID
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-28 20:22:07 +01:00
Péter Szilágyi 5f657b4333 extern/sector-storage: fix GPU usage overwrite bug 2020-10-28 20:52:33 +02:00
Łukasz Magiera 704bef5dfc Merge pull request #4613 from filecoin-project/feat/proofs-5.2.3-1
Update FFI
2020-10-28 17:37:22 +01:00
Dirk McCormick f79652c28c feat: cache deal states for most recent old/new tipset 2020-10-28 16:55:48 +01:00
Jakub Sztandera e575b5fe8a Add error if weights are the same
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-28 16:53:13 +01:00
Łukasz Magiera da7ecc1527 Fix flaky sealing manager tests 2020-10-28 16:15:17 +01:00
Łukasz Magiera 86f9abda0d circle: Install hwloc 2020-10-28 15:46:57 +01:00
Łukasz Magiera 4475b9ac05 Use filecoin-ffi master 2020-10-28 15:31:15 +01:00
Łukasz Magiera 4100f6eead fix TestWDPostDoPost 2020-10-28 15:23:21 +01:00
Łukasz Magiera ed2f81da2f sched: Fix tests 2020-10-28 14:34:28 +01:00
Łukasz Magiera 4cf00b8b42 worker_local: address review 2020-10-28 14:29:17 +01:00
Łukasz Magiera 96c5ff7e7f sched: use more letters for variables 2020-10-28 14:23:38 +01:00
Łukasz Magiera 8731fe9112 sched: split worker handling into more funcs 2020-10-28 14:14:50 +01:00
Łukasz Magiera 84b567c790 sched: move worker funcs to a separate file 2020-10-28 13:39:28 +01:00
vyzo ba2512655e track last few worker states for debug purposes 2020-10-28 14:08:06 +02:00
vyzo 6266bae1d3 log worker spawning from initial sync deferrals 2020-10-28 11:44:16 +02:00
vyzo 188d1649d3 stop the ticker when done with it 2020-10-28 11:41:40 +02:00
vyzo 9ddf7bbd15 better handling of initial sync 2020-10-28 11:36:34 +02:00
vyzo 469666de82 limit max active sync workers 2020-10-28 10:33:22 +02:00
vyzo fc1ac3e752 simplify circular buffer code
we don't care about order of checks!
2020-10-28 00:02:08 +02:00
vyzo ab7a66b90d track recently synced tipsets to avoid unnecessary worker spawning 2020-10-27 23:48:31 +02:00
Jakub Sztandera 2b82e5a118 Fix tipset coalescing in case of repeated blocks
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-27 21:23:16 +01:00
Jakub Sztandera 16d2cb6309 Add flag to coalesce Tipsets in pending queue
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-27 18:00:34 +01:00
Łukasz Magiera 413643a712 Merge remote-tracking branch 'origin/master' into feat/async-restartable-workers 2020-10-27 16:56:29 +01:00
Łukasz Magiera 843c0719e0 Update FFI 2020-10-27 15:37:11 +01:00
Łukasz Magiera 3d02dba5dc Merge pull request #4609 from filecoin-project/fix/flaky-testMiningReal
Fix flaky testMiningReal
2020-10-27 14:27:52 +01:00
Łukasz Magiera efc8d90bc1 Fix flaky testMiningReal 2020-10-27 12:19:12 +01:00
Łukasz Magiera 1db69acbc0 Merge pull request #4608 from filecoin-project/fix/flaky-TestCLIDealFlow
Fix flaky TestCLIDealFlow
2020-10-27 12:07:02 +01:00
Dirk McCormick c0f6f834b7 fix: flaky TestCLIDealFlow 2020-10-27 11:07:54 +01:00
Łukasz Magiera 8c60069bb8 Merge pull request #4535 from filecoin-project/feat/clientdeal-cache-commd
client deal: Cache CommD when creating multiple deals
2020-10-27 03:58:25 +01:00
Łukasz Magiera e1da874258 Merge remote-tracking branch 'origin/master' into feat/async-restartable-workers 2020-10-27 03:31:07 +01:00
Łukasz Magiera 616e0e8eb5 Merge pull request #4569 from filecoin-project/feat/client-deal-size-cli
Expose ClientDealSize via CLI
2020-10-27 03:28:31 +01:00
Steven Allen 89f6da14bc Merge pull request #4513 from filecoin-project/steb/feat-change-worker-key
Add commands to change the worker key
2020-10-26 18:41:04 -07:00
Steven Allen 832c0998e4 validate that block propagation works after a worker key change 2020-10-26 18:16:25 -07:00
Steven Allen 0d06f8fa2b Add commands to change the worker key 2020-10-26 18:16:24 -07:00
Whyrusleeping 2b6bc7d59a Merge pull request #4604 from filecoin-project/frrist/miner-shim-info-equal
polish: add Equals method to MinerInfo shim
2020-10-26 17:54:30 -07:00
frrist 0d384050fa polish: add Equals method to MinerInfo shim 2020-10-26 14:45:02 -07:00
Ingar Shu 8141f7b6a6 Expose ClientDealSize API via client stat CLI 2020-10-26 11:28:01 -07:00
Jakub Sztandera cced3bf9ee Randomize seed
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-26 17:44:55 +01:00
Jakub Sztandera ea6afe84db Add election run-dummy command
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-26 17:44:51 +01:00
Łukasz Magiera 382dcf9a37 Merge pull request #4600 from filecoin-project/fix/sector-list-less-sracy
Make EarlyExpiration in sectors list less scary
2020-10-26 16:17:20 +01:00
Łukasz Magiera 8923524f6a Make EarlyExpiration in sectors list less scary 2020-10-26 15:33:15 +01:00
Łukasz Magiera 31a474a1ca Move CommPWriter to lib/ 2020-10-26 15:16:28 +01:00
Łukasz Magiera 1afd3a41cb Merge pull request #4595 from GFZRZK/GFZRZK/bugfix/fix_workerkey_error_in_wdpost_setsender
worker key should change when set sender found key not equal with the value on chain
2020-10-26 14:55:48 +01:00
Łukasz Magiera 5a6195feb6 Merge pull request #4598 from filecoin-project/refactor/paych-cli-test
refactor: share code between CLI tests
2020-10-26 14:51:03 +01:00
vyzo 2fd0d430c8 set BootstrapPeerThreshold to 1, to mimic old code
which incidentally fixes tests
2020-10-26 15:49:24 +02:00
vyzo f055681972 fix test 2020-10-26 15:43:22 +02:00
Dirk McCormick 1fefcc2b46 refactor: simplify cli test RunCmd 2020-10-26 14:26:46 +01:00
vyzo c0a039ee11 fix logging 2020-10-26 15:19:09 +02:00
Łukasz Magiera 09f1d00733 Merge pull request #4533 from filecoin-project/msig-inspect-jen
Updated msig inspect:
2020-10-26 14:11:21 +01:00
vyzo f26385d0c6 use weight as the sync target selector 2020-10-26 14:51:26 +02:00
Dirk McCormick b097a5fb0c refactor: share code between CLI tests 2020-10-26 13:50:07 +01:00
vyzo af53b72eb8 fix typo 2020-10-26 14:36:34 +02:00
Łukasz Magiera a37c372d06 Merge pull request #4572 from filecoin-project/feat/data-transfer-utils
Flesh out data transfer features
2020-10-26 13:29:26 +01:00
Łukasz Magiera 8fe7db107a Merge pull request #4584 from jsign/jsign/chffi
update filecoin-ffi in go mod
2020-10-26 13:17:19 +01:00
vyzo 5d34b7d618 rewrite sync manager 2020-10-26 14:11:19 +02:00
Łukasz Magiera 43b492204c Merge pull request #4597 from filecoin-project/fix/paych-mgr-add-funds-race
fix race in paych manager add funds
2020-10-26 13:09:47 +01:00
Łukasz Magiera ce9cce921d Merge pull request #4589 from cerblue/cerblue
Do not fail wallet delete because of pre-existing trashed key
2020-10-26 12:47:23 +01:00
Dirk McCormick 5ed57d34f0 fix: race in paych manager add funds 2020-10-26 11:09:56 +01:00
wangchao e65aa4cf17 worker key should change when set sender found key not equal with the value on chain 2020-10-26 15:20:09 +08:00
Jinsub Moon bfbf6a2711 Do not fail wallet delete because of pre-existing trashed key 2020-10-25 06:25:28 +00:00
Ignacio Hagopian 6b76371d64 update filecoin-ffi
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
2020-10-24 17:15:44 -03:00
Łukasz Magiera d4cdc6d334 Merge pull request #4580 from filecoin-project/asr/changelog
Lotus version 1.1.2
2020-10-24 12:37:40 +02:00
Aayush Rajasekaran 7b3f1c2b85 Lotus version 1.1.2 2020-10-24 06:33:31 -04:00
Łukasz Magiera 9972f19240 Merge pull request #4579 from filecoin-project/steb/worker-key-change-runtime
Handle worker key changes correctly in runtime
2020-10-24 12:28:01 +02:00
Steven Allen f23034305f Handle worker key changes correctly in runtime 2020-10-24 02:57:17 -07:00
Aayush Rajasekaran 2663d6c3cb Merge pull request #4574 from filecoin-project/asr/changelog
Lotus version 1.1.1
2020-10-24 00:24:26 -04:00
Aayush Rajasekaran 8b8d81e767 Lotus version 1.1.1 2020-10-24 00:22:20 -04:00
Aayush Rajasekaran d43bc79050 Merge pull request #4573 from filecoin-project/steb/remove-worker-key-cache
Fetch worker key from correct block on sync
2020-10-23 23:59:43 -04:00
Steven Allen 06af2fb52b Remove the worker key cache and use the correct worker key
We need to use the worker key from the lookback tipset state. We can't
reasonably maintain this cache, unfortunately (unless we kept some form of
"per-height" cache).
2020-10-23 19:40:05 -07:00
Steven Allen 8bb69f1e9c Use pre-computed parent state root for lookback info
There's no need to call TipSetState and recompute it.
2020-10-23 19:40:01 -07:00
hannahhoward b98b2d4310 docs(docsgen): update api docs 2020-10-23 18:35:01 -07:00
jennijuju f05b03f02c Updated msig inspect:
- Show account address of signer if the id address is corresponding to  an account address.
- When a message receiver is a new account, do not lookup method name.
2020-10-23 17:40:51 -04:00
Łukasz Magiera 4d87473053 Fix lint 2020-10-23 23:31:18 +02:00
Łukasz Magiera 660236b224 Merge remote-tracking branch 'origin/master' into feat/async-restartable-workers 2020-10-23 23:25:35 +02:00
Łukasz Magiera 194f56377e Merge pull request #4565 from filecoin-project/feat/shed-msg-decode
shed: Commad to decode messages
2020-10-23 22:35:24 +02:00
Łukasz Magiera 2023615f55 Merge pull request #4563 from filecoin-project/steb/post-lookback
Use older randomness for the PoSt commit on specs-actors version 2
2020-10-23 22:21:51 +02:00
Łukasz Magiera de2cbfa8a9 client deal: Cache CommD when creating multiple deals 2020-10-23 22:20:17 +02:00
Łukasz Magiera 067de4508b shed: Commad to decode messages 2020-10-23 22:17:46 +02:00
Łukasz Magiera 74bf4c5e71 Merge pull request #4556 from filecoin-project/fix/marketwithdraw-miner
Make wallet market withdraw usable with miner addresses
2020-10-23 22:15:28 +02:00
Jakub Sztandera 099bb2cbaa Merge pull request #4561 from filecoin-project/fix/timedbs-flaky
Fix flaky TestTimedBSSimple
2020-10-23 22:14:32 +02:00
Łukasz Magiera e395559f75 Merge pull request #4564 from filecoin-project/fix/chain-import-flake
Fix flaky TestChainExportImportFull
2020-10-23 22:00:03 +02:00
Łukasz Magiera b7b6ab779a Make wallet market withdraw usable with miner addresses 2020-10-23 21:54:41 +02:00
Steven Allen 109b326ae2 Use older randomness for the PoSt commit on specs-actors version 2
After the upgrade, we're allowed to use randomness up to the challenge epoch.
This safe-guards us against very large reorgs where a miner computes a PoSt very
quickly.
2020-10-23 12:45:11 -07:00
Jakub Sztandera c7e6c8eacc Fix flaky TestChainExportImportFull
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-23 21:45:08 +02:00
Jakub Sztandera 9fbd2a50ff Fix lint
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-23 20:50:17 +02:00
Jakub Sztandera ea69386519 Fix flaky TestTimedBSSimple
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-23 20:46:06 +02:00
Łukasz Magiera 8124fe98c7 Merge pull request #4559 from filecoin-project/fix/beyond-genesis
Fix random test failures
2020-10-23 19:52:10 +02:00
Jakub Sztandera 16a911bc39 Fix random test failures
If block 1 was a null block then blockSet would include genesis which
would lead to us trying to load parent of a genesis block.

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-23 19:33:30 +02:00
Łukasz Magiera c81db5a21c Merge pull request #4420 from filecoin-project/deps/drand-v1.2.0
Chore: update drand to v1.2.0
2020-10-23 18:25:00 +02:00
Łukasz Magiera dbcba6477e Merge pull request #4263 from filecoin-project/feat/lite-market-client
lite-mode - market storage and retrieval clients
2020-10-23 17:23:06 +02:00
Łukasz Magiera 36816fb4f3 Fix list-asks, deals with non-genesis miners in lite-mode 2020-10-23 17:08:21 +02:00
Łukasz Magiera 1ec8252412 Merge pull request #4497 from filecoin-project/feat/lite-market-client-cli
lotus-lite: CLI tests for `lotus client` commands
2020-10-23 16:18:23 +02:00
Łukasz Magiera 91fae36b86 Merge pull request #4554 from filecoin-project/tvx-simulate-2
tvx simulate command; tvx extract --ignore-sanity-checks
2020-10-23 15:58:22 +02:00
Łukasz Magiera 623ffebe62 Merge pull request #4555 from filecoin-project/feat/walletlist-id-market
wallet list: Add market balance and ID address flags
2020-10-23 15:35:03 +02:00
Dirk McCormick 906286fdbe feat: lite-mode - CLI tests for lotus client commands 2020-10-23 15:02:49 +02:00
Dirk McCormick 92942d44d1 feat: lite-mode - market storage and retrieval clients 2020-10-23 15:02:26 +02:00
Łukasz Magiera 9caa6ae69c wallet list: Add market balance and ID address flags 2020-10-23 14:42:19 +02:00
Raúl Kripalani 39d9150175 fix tvx init. 2020-10-23 13:30:04 +01:00
Raúl Kripalani 5301c416bc tvx extract: --ignore-sanity-checks flag. 2020-10-23 10:47:22 +01:00
Raúl Kripalani 92395745d3 tvx simulate: execute raw message against height. 2020-10-23 10:46:32 +01:00
Łukasz Magiera 7d9e8f9d92 Merge pull request #4524 from filecoin-project/feat/withdraw-market-funds-cli
Add a market WithdrawBalance CLI
2020-10-23 11:33:38 +02:00
Łukasz Magiera 6842c03399 wallet cli: rename withdraw-market-funds -> market withdraw 2020-10-23 11:17:03 +02:00
Łukasz Magiera 2c3d80494f Merge pull request #4538 from filecoin-project/steb/test-cleanup-proofs
Cleanup test initialization and always validate VRFs in tests
2020-10-23 10:53:54 +02:00
Steven Allen 2cf770cc91 Merge pull request #4539 from filecoin-project/steb/fix-worker-key-lookback
Use the correct lookback for the worker key when creating blocks
2020-10-22 21:10:25 -07:00
Jakub Sztandera bfdb74bfee Merge pull request #4541 from filecoin-project/feat/maybe-fix-something
Fix chain sync stopping to sync
2020-10-23 02:10:43 +02:00
Jakub Sztandera 580a2f4dc6 Add option to join by common parents
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-23 01:35:26 +02:00
Jakub Sztandera c8fe21c1ef PopRelated aggretates the bucket
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-23 01:18:13 +02:00
Steven Allen 59cfabf8a4 don't resolve the worker key twice 2020-10-22 15:48:09 -07:00
Jakub Sztandera 810feee5a1 PopRelated should pop all
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-23 00:39:08 +02:00
Jakub Sztandera 24fc7d4cbd Add reproduction test and fix the issue
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-23 00:34:04 +02:00
Jakub Sztandera 5edfc527b0 More than one bucket
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-23 00:34:03 +02:00
Jakub Sztandera febc28f83f Add log and Insert
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-22 23:39:54 +02:00
hannahhoward 98297cef4d feat(data-transfer): fill in utils 2020-10-22 13:40:26 -07:00
Łukasz Magiera 0289c39850 Merge pull request #4516 from filecoin-project/feat/api-request-metrics-wrapper
Feat/api request metrics wrapper
2020-10-22 21:40:47 +02:00
Łukasz Magiera 29e334de54 Merge pull request #4511 from filecoin-project/steb/generalize-window-post
Manage sectors by size instead of proof type.
2020-10-22 21:27:48 +02:00
Łukasz Magiera f9723ca3c1 Merge pull request #4521 from filecoin-project/feat/fix-shed-ledger-list
Fix lotus-shed ledger list
2020-10-22 19:59:18 +02:00
Łukasz Magiera c17e8e778d Merge pull request #4526 from filecoin-project/wallet-4464
Delete wallet from local wallet cache
2020-10-22 19:50:01 +02:00
Łukasz Magiera b2510e5fc5 Merge pull request #4508 from filecoin-project/fix/actor-not-found-mininig-base
MinerGetBaseInfo: if miner is not found in lookback, check current
2020-10-22 19:45:43 +02:00
Łukasz Magiera 6c800bd0e3 Merge pull request #4501 from filecoin-project/feat/gateway-oni-needs
add some methods that oni needs
2020-10-22 19:44:47 +02:00
Łukasz Magiera 88ac85b6ae Merge pull request #4500 from filecoin-project/fix/mpool-push-atomicity
make push and addLocal atomic
2020-10-22 19:43:52 +02:00
Łukasz Magiera 6bdf9935bf Merge pull request #4475 from filecoin-project/fix/miner-init-createworker
miner: fix init --create-worker-key
2020-10-22 18:55:25 +02:00
Łukasz Magiera 29cda82eac Merge pull request #4449 from austinabell/austin/confcircsupplyfix
Fix circ supply default in conformance
2020-10-22 18:53:10 +02:00
Steven Allen b05613445e Sign blocks with the worker key from the correct lookback epoch 2020-10-22 09:26:58 -07:00
Steven Allen defeba5576 Fix lookback for worker key when computing ticket
We need to compute the ticket based on our worker key from the lookback epoch,
not the current epoch.
2020-10-22 09:26:58 -07:00
Steven Allen 4a550d12d4 Always validate VRFs, even when insecure post validation is enabled
We always generate them, we might as well validate them.
2020-10-22 09:19:46 -07:00
Steven Allen 70c39fe78c Fix global test options
Set BELLMAN_NO_GPU on init.
Set InsecurePoStValidation once in an obvious place.
2020-10-22 09:19:46 -07:00
Łukasz Magiera 6fc8550c19 Merge pull request #4314 from filecoin-project/feat/lotus-pcr-block-list
Add block list to pcr
2020-10-22 17:59:23 +02:00
Łukasz Magiera 6b9a4c4a34 Merge pull request #4536 from filecoin-project/zgfzgf-fix-chain-export
Small chain export optimization
2020-10-22 17:35:58 +02:00
Łukasz Magiera 041762a34f Merge pull request #4383 from filecoin-project/steb/actor-v2-imports
Remove most v0 actor imports
2020-10-22 17:17:56 +02:00
Łukasz Magiera 25c4a1bd8d Merge pull request #4523 from filecoin-project/misc/remove-log-sync
heaviestTipSet reurning nil is a ok
2020-10-22 17:16:02 +02:00
Łukasz Magiera 05b459e4c5 Merge pull request #4379 from zgfzgf/feat-mining
optimize mining code
2020-10-22 16:12:40 +02:00
Łukasz Magiera 1665d61c89 Merge pull request #4339 from filecoin-project/shed/borked-cmd
Shed/borked cmd
2020-10-22 16:10:05 +02:00
Łukasz Magiera 9a58763a4e shed: Rename the command to frozen-miners 2020-10-22 16:07:42 +02:00
ZenGround0 f9707ba344 add borked inspection command
hook up new command

Fix head call

Debug internal error

Debug moa

Debug 0

Fix 0

Fix 1

Better print

Don't ignore error
2020-10-22 16:03:11 +02:00
Łukasz Magiera ae04f3029b chain: Add more robust test for ChainExport 2020-10-22 16:01:11 +02:00
Łukasz Magiera 40872e9d90 Merge branch 'fix-chain-export' of github.com:zgfzgf/lotus into zgfzgf-fix-chain-export 2020-10-22 15:56:42 +02:00
Łukasz Magiera ee8d8bf5e5 pcr: Fix lint 2020-10-22 15:42:46 +02:00
Łukasz Magiera b85bf82d00 Merge pull request #4318 from filecoin-project/asr/shed-won-power
Add a shed util to determine % of power that has won a block
2020-10-22 15:40:55 +02:00
Travis Person 6fb3dafa95 lotus-pcr: add blocklist 2020-10-22 15:35:01 +02:00
Łukasz Magiera f5960df544 Merge pull request #4313 from filecoin-project/fix/pcr-basefee
Look at block base fee for PCR
2020-10-22 15:32:01 +02:00
Łukasz Magiera 93227bfd4d Merge pull request #4302 from filecoin-project/feat/import-bench-ds-measure
add measure datastore wrapper around bench chain datastore
2020-10-22 15:16:31 +02:00
Łukasz Magiera 0832d5a7d5 bench: Fix lint warnings 2020-10-22 15:00:31 +02:00
whyrusleeping 602d2b8ad5 record datastore metrics after successful run 2020-10-22 14:57:06 +02:00
Jakub Sztandera 0341944350 Inject prometheus
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-22 14:57:05 +02:00
whyrusleeping 00d1e6b549 add measure datastore wrapper around bench chain datastore 2020-10-22 14:57:04 +02:00
Łukasz Magiera 9c17ac5bde Merge branch 'hunjixin-hunjixin/feat/batchmsg' into master 2020-10-22 14:46:23 +02:00
Łukasz Magiera 90ce1c018e docsgen 2020-10-22 14:46:10 +02:00
Łukasz Magiera 618fed75fe Merge branch 'hunjixin/feat/batchmsg' of github.com:hunjixin/lotus into hunjixin-hunjixin/feat/batchmsg 2020-10-22 14:45:33 +02:00
Łukasz Magiera ef9eea470c Merge branch 'animesh2049-animesh2049/status-api' into master 2020-10-22 14:16:15 +02:00
Łukasz Magiera 9d9da1a3e8 docsgen 2020-10-22 14:15:11 +02:00
Łukasz Magiera 7c16f2182c Merge branch 'animesh2049/status-api' of github.com:animesh2049/lotus into animesh2049-animesh2049/status-api 2020-10-22 14:14:50 +02:00
Will Scott 9dc9bf5eb0 go mod tidy 2020-10-21 19:49:38 -07:00
Will Scott 035a762358 update drand to v1.2.1
* stop autowatching
* set user-agent
2020-10-21 16:49:59 -07:00
jennijuju 7f98be2920 Delete wallet from local wallet cache 2020-10-21 17:53:26 -04:00
Ingar Shu 7bdc7aa527 Add a market WithdrawBalance CLI 2020-10-21 14:09:39 -07:00
Jakub Sztandera 5c9c08ef85 heaviestTipSet reurning nil is a ok
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-21 22:16:01 +02:00
Steven Allen 5e23933757 fix import of v0 for test
We're still on actors v0 in this test.
2020-10-21 12:18:38 -07:00
Steven Allen 9d15a08d27 correctly mark new actors as "important" 2020-10-21 12:18:38 -07:00
Steven Allen 0c2ec04c09 use upgrade schedule from node when getting the network name
It doesn't matter now, but may in the future.
2020-10-21 12:18:38 -07:00
Steven Allen 30bda0b4c4 set network name everywhere 2020-10-21 12:18:38 -07:00
Steven Allen 710ac9d544 use the correct network version in genesis
1. Version 0 upgrades happen _after_ genesis.
2. Get rid of UseNewestNetwork. It's not useful and quite dangerous.
2020-10-21 12:18:38 -07:00
Steven Allen bcabe7b3b5 migrate methods to abstracted methods
Method numbers never change anyways. At worst, we'll deprecate old methods and
have to explicitly import them from the correct actors version to use them.
2020-10-21 12:18:37 -07:00
Steven Allen 4e730b5ec8 port to v2 imports 2020-10-21 12:16:23 -07:00
Jakub Sztandera f0d966a595 Fix lotus-shed ledger list
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-21 19:40:51 +02:00
Łukasz Magiera 8cad245f80 Merge pull request #4512 from filecoin-project/feat/disable-bloom
Disable blockstore bloom filter
2020-10-21 17:27:33 +02:00
lanzafame 7cbd4d49c3 gofmt 2020-10-21 18:39:57 +10:00
lanzafame 7a33d5bb34 register all apis with metric wrapper 2020-10-21 18:37:50 +10:00
lanzafame 3e767ca5c8 wrap api in metrics proxy 2020-10-21 18:27:13 +10:00
Łukasz Magiera c767399fc6 Merge pull request #4504 from filecoin-project/feat/clientdeal-miner-picker
Miner finder for interactive client deal CLI
2020-10-21 05:46:07 +02:00
Jakub Sztandera 3a46c15c4a Disable blockstore bloom filter
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-21 04:22:49 +02:00
Steven Allen 00dcb1bce9 Manage sectors by size instead of proof type.
* We may have multiple sectors with the same size and different proof types, but all these management functions stay the same.
* This simplifies PoSt logic.
2020-10-20 18:30:56 -07:00
Aayush Rajasekaran 420ec18c5b Merge pull request #4509 from filecoin-project/asr/changelog
Lotus version 1.1.0
2020-10-20 18:35:12 -04:00
Aayush Rajasekaran d78dd42ed4 Lotus version 1.1.0 2020-10-20 18:30:41 -04:00
Aayush Rajasekaran 547c01f5ff Merge pull request #4506 from filecoin-project/release/1.1.0
Introduce Network version 6
2020-10-20 18:29:49 -04:00
Aayush Rajasekaran 75eb644108 Merge pull request #4507 from filecoin-project/lotus-shed-terminate-1475
Add a terminate sectors command to lotus-shed
2020-10-20 18:28:09 -04:00
jennijuju ee5dcbc1d8 Add wait message 2020-10-20 18:26:17 -04:00
Aayush Rajasekaran 7f46ad19ac VM: Enforce a call depth limit 2020-10-20 18:19:50 -04:00
Jakub Sztandera 6530431995 MinerGetBaseInfo: if miner is not found in lookback, check current
If miner is found in current state, just return nil base info as miner
cannot mine if he is not found in the lookback.

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-20 23:54:35 +02:00
Steven Allen ed1645109a Add lotus storage miner API support to lotus-shed 2020-10-20 17:38:15 -04:00
jennijuju 277d3e9ab4 Add terminate sectors based on 1475's #4433 implementation in lotus-shed:
-  Moving the cmd to lotus-shed so that miners can use this right away without waiting for fsm changes.- Note: this should only be used when the miner is 100% sure that they want to terminate the sector on chain and they will be lose the power and pay a big one-time termination penalty for the sectors.
- Only live sectors can be terminated.
- To use, run `./lotus-shed sectors terminate --really-do-it=true sectorNum1 sectorNum2`.
- A message will be sent and after the message is landed on chain, miner can run `lotus-miner sectors status --on-chain-info <terminated sector number>`, and check Expiration Info at the bottom. Both `OnTime` and `Early` are 0 indicates the sector is terminated.
2020-10-20 17:38:09 -04:00
Aayush Rajasekaran 556f92a823 Update to actors v2.2.0 at PostLiftoff epoch 2020-10-20 17:23:35 -04:00
Aayush Rajasekaran ef32449309 Merge pull request #4505 from filecoin-project/feat/markets-1.0.0
Update markets v1.0.0
2020-10-20 17:22:57 -04:00
hannahhoward e08032da93 feat(markets): update markets v1.0.0 2020-10-20 13:56:13 -07:00
Łukasz Magiera dc40469cb3 Miner finder for interactive client deal CLI 2020-10-20 21:54:39 +02:00
whyrusleeping abc3e783ff bump lookback cap to 24 hours 2020-10-20 10:09:21 -07:00
whyrusleeping 6bc56c549a add some methods that oni needs 2020-10-20 10:04:51 -07:00
vyzo 580980d149 make push and addLocal atomic 2020-10-20 19:13:17 +03:00
Łukasz Magiera c779e4e8ee Merge pull request #4496 from filecoin-project/ci/address-flaky-tests
circle: Run tests for some subsystems separately
2020-10-20 14:18:54 +02:00
Łukasz Magiera ee0078f7c1 make: Drop npm calls from buildall 2020-10-20 13:48:32 +02:00
Łukasz Magiera da044d8b00 Merge pull request #4486 from filecoin-project/feat/better-sync-logs
add some extra logging to try and debug sync issues
2020-10-20 13:29:20 +02:00
Łukasz Magiera 09e92f98ff circle: Run tests for some subsystems separately 2020-10-20 13:11:53 +02:00
Łukasz Magiera 0dbf10ce69 Merge pull request #4491 from filecoin-project/one-liner
Add a comment to BlockMessages to address #4446.
2020-10-20 12:49:37 +02:00
jennijuju e7a68dba58 Add a comment to BlockMessages to address #4446. 2020-10-20 02:28:43 -04:00
whyrusleeping 608010c35d add some extra logging to try and debug sync issues 2020-10-19 19:09:49 -07:00
Aayush Rajasekaran 1c6ea75f4b Merge pull request #4456 from filecoin-project/asr/changelog
Lotus version 1.0.0
2020-10-19 20:12:21 -04:00
Aayush Rajasekaran 1ee9fb44e2 Lotus version 1.0.0 2020-10-19 20:09:35 -04:00
Łukasz Magiera 473afc41e7 Merge pull request #4481 from filecoin-project/feat/optim-state-cache
state: optimize state snapshot address cache
2020-10-20 02:03:37 +02:00
Jakub Sztandera a055540c25 Fix lint
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-20 01:32:51 +02:00
Jakub Sztandera cb0513f4c1 Add test
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-20 01:30:40 +02:00
Jakub Sztandera be42dd824b state: optimize state snapshot address cache
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-20 00:43:51 +02:00
Łukasz Magiera 06c0444d45 Merge pull request #4480 from filecoin-project/fix/max-piece-size-reverting-to-default
Don't overwrite previously-configured maxPieceSize for a persisted ask
2020-10-19 22:55:55 +02:00
Łukasz Magiera bae735447d Merge pull request #4477 from filecoin-project/asr/state-api-fix
Fix StateReplay to use provided tipset
2020-10-19 22:54:03 +02:00
Ingar Shu 1974490ab0 Don't overwrite previously-configured maxPieceSize for a persisted ask 2020-10-19 13:12:28 -07:00
Aayush Rajasekaran d24d3e420d Fix StateReplay to use provided tipset 2020-10-19 14:27:04 -04:00
Łukasz Magiera 869d71446d miner: fix init --create-worker-key 2020-10-19 16:08:46 +02:00
Łukasz Magiera 268d29222a docsgen 2020-10-18 20:10:39 +02:00
Łukasz Magiera 1a10f95973 worker: Better miner connectivity check on startup 2020-10-18 19:53:23 +02:00
Łukasz Magiera 8c86ea6b75 localworker: Try very hard to get ruselts to manager 2020-10-18 19:45:11 +02:00
Łukasz Magiera dbb421c4f7 localworker: Use better context for calling returnFunc 2020-10-18 19:32:43 +02:00
Łukasz Magiera 879aa9512d worker: Use miner session for connectivity check 2020-10-18 17:56:29 +02:00
Łukasz Magiera cf4dfa3a05 worker: Use http rpc for miner API 2020-10-18 13:59:38 +02:00
Łukasz Magiera f933e1d2b7 miner cli: Update to uuid worker IDs 2020-10-18 13:03:17 +02:00
Łukasz Magiera 8d06cca073 sched: Handle workers using sessions instead of connections 2020-10-18 12:36:06 +02:00
Łukasz Magiera 7ac5dc55d0 Merge remote-tracking branch 'origin/master' into feat/async-restartable-workers 2020-10-17 13:45:11 +02:00
Łukasz Magiera 0f5aa9ba5c Merge pull request #4447 from filecoin-project/feat/mainnet-bootstrap-peers
replace bootstrap peers
2020-10-17 13:27:09 +02:00
Łukasz Magiera 68be28ca6d Add Session API 2020-10-17 12:53:42 +02:00
austinabell 70e2170e3e Fix circ supply default in conformance 2020-10-16 21:14:36 -04:00
Travis Person 4de8f50642 replace bootstrap peers 2020-10-16 19:13:33 +00:00
Łukasz Magiera 4a057d84b8 Merge pull request #4422 from filecoin-project/fix/message-list
fix message list api
2020-10-16 20:52:34 +02:00
Łukasz Magiera 111942b50b Merge pull request #4424 from filecoin-project/feat/retrieval-cli-deal-filter
Custom filters for retrieval deals
2020-10-16 18:41:40 +02:00
Łukasz Magiera 40e34b334a Merge pull request #4423 from filecoin-project/asr/shed-robust
Make audit balances capable of printing robust addresses
2020-10-16 17:52:10 +02:00
Łukasz Magiera 1a049a4f8e Merge pull request #4426 from filecoin-project/feat/lotus-gateway-spacegap
add endpoints needed by spacegap
2020-10-16 17:50:43 +02:00
Ingar Shu d0e4150cea Use separate config for Retrieval Filter 2020-10-16 08:30:55 -07:00
Aayush Rajasekaran 0775c6c9d5 Merge pull request #4429 from filecoin-project/asr/state-apis
Improve StateMsg APIs
2020-10-16 00:51:34 -04:00
Aayush Rajasekaran 2fd4a97698 Remove StateTransplant, modify StateReplay 2020-10-15 22:54:29 -04:00
Aayush Rajasekaran 89f46cb5cc Make ApplyRet's GasOutputs a pointer, return nil when unused 2020-10-15 21:20:53 -04:00
Aayush Rajasekaran 6f86b95f62 Remove StateMsgGasCost 2020-10-15 21:03:02 -04:00
whyrusleeping a71fbee2d1 bump lookback limit to 12 hours 2020-10-15 16:49:25 -07:00
Aayush Rajasekaran 99c07703f8 Add a new StateReplay CLI/API endpoint 2020-10-15 19:47:02 -04:00
whyrusleeping af1a422ddd statevminternal circ supply 2020-10-15 16:36:45 -07:00
whyrusleeping 8351420404 Add more endpoints for spacegap 2020-10-15 16:27:49 -07:00
Aayush Rajasekaran 7826cc0bab Rename StateReplay to StateTransplant 2020-10-15 19:14:53 -04:00
Aayush Rajasekaran cb801d47c7 Add GasCost to InvocResult 2020-10-15 18:48:51 -04:00
whyrusleeping 726eacbe03 add endpoints needed by spacegap 2020-10-15 13:54:58 -07:00
Whyrusleeping 17fcf30edd Merge pull request #4373 from filecoin-project/feat/gateway-wallet-verify
add WalletVerify to lotus-gateway
2020-10-15 15:42:38 -05:00
whyrusleeping eae7d62a2b docsgen 2020-10-15 12:07:41 -07:00
whyrusleeping 5bee85d57a incremental output for list-messages 2020-10-15 09:38:27 -07:00
Ingar Shu 0b7dc6971d Rebasing 2020-10-15 09:33:01 -07:00
Aayush Rajasekaran 8c7d2efe72 Make audit balances capable of printing robust addresses 2020-10-15 12:17:54 -04:00
whyrusleeping a931ff94e9 fix message list api 2020-10-15 08:54:36 -07:00
Łukasz Magiera c56ef260d5 Merge pull request #4421 from filecoin-project/fix/lite-msig-inspect
Ensure msig inspect cli works with lotus-lite
2020-10-15 15:11:34 +02:00
Łukasz Magiera 955d7f9c54 Merge pull request #4393 from filecoin-project/vectors/support-multiple-versions
conformance: support multiple protocol versions.
2020-10-15 14:29:23 +02:00
Raúl Kripalani 1fb9ed1c9a remove TODO. 2020-10-15 12:58:43 +01:00
Raúl Kripalani 7e6ede7563 update schema; test-vectors submodule. 2020-10-15 12:49:23 +01:00
Raúl Kripalani 4e659e30c5 fix lint errors. 2020-10-15 12:14:16 +01:00
Dirk McCormick f5d48b0e86 fix: lotus-gateway api tests 2020-10-15 12:47:24 +02:00
Dirk McCormick f74852bd73 test: add more msig cli tests 2020-10-15 12:45:02 +02:00
Dirk McCormick 9c99171cb8 fix: ensure msig inspect cli works with lotus-lite 2020-10-15 12:15:21 +02:00
Hector Sanjuan 925606ff26 Chore: update drand to v1.2.0 2020-10-15 12:02:12 +02:00
Łukasz Magiera 90d2a92a2d Merge pull request #4415 from filecoin-project/feat/use-build-seconds-delay
Use build.BlockDelaySecs for deal start buffer
2020-10-15 11:56:43 +02:00
Łukasz Magiera 2818353418 Merge pull request #4398 from filecoin-project/feat/improve-msig-ux
improve the UX of multisig approves
2020-10-15 11:54:12 +02:00
whyrusleeping ccc780f35a fix wrong index 2020-10-14 23:16:31 -07:00
whyrusleeping fdb115e369 add command to propose changing multisig threshold 2020-10-14 23:10:00 -07:00
whyrusleeping 3bd2e2f777 fix typo 2020-10-14 23:04:15 -07:00
whyrusleeping 6d771d29c7 improve the UX of multisig approves 2020-10-14 23:04:15 -07:00
hannahhoward b29e3b5242 feat(markets): use build.BlockDelaySecs for start buffer
instead of constant from spec-actors which uses hardcoded start epoch, use one that factors in
possibility of different block time
2020-10-14 21:28:36 -07:00
Łukasz Magiera 8340124786 Merge pull request #4411 from filecoin-project/fix/slow-mpool-stortup
mpool: Don't block node startup loading messages
2020-10-15 03:58:36 +02:00
Łukasz Magiera 8f98c7d960 Merge pull request #4410 from filecoin-project/steb/fix-codecov-ignore
Increase code coverage!
2020-10-15 03:37:06 +02:00
Łukasz Magiera 3fb5334959 mpool: Don't block node startup loading messages 2020-10-15 03:36:55 +02:00
Steven Allen a40fc98e56 fix code coverage ignore
It looks like we need to use globs.
2020-10-14 18:21:16 -07:00
Aayush Rajasekaran 8bb84acbc5 Merge pull request #4409 from filecoin-project/asr/changelog
Lotus version 0.10.2
2020-10-14 21:18:53 -04:00
Łukasz Magiera 22f49f8946 Merge pull request #4366 from zgfzgf/feat-applyblocks-map
optimize map use struct{}
2020-10-15 03:04:57 +02:00
Łukasz Magiera 1350079503 Merge pull request #4353 from zgfzgf/feat-compute-tipSet-state
optimize code use ts.Cids
2020-10-15 03:03:39 +02:00
Aayush Rajasekaran 251374eca7 Lotus version 0.10.2 2020-10-14 21:01:26 -04:00
Łukasz Magiera a50a5366b2 Merge pull request #4392 from filecoin-project/daviddias-patch-1
Update SECURITY.md
2020-10-15 02:58:52 +02:00
Łukasz Magiera 52800f5dca Merge pull request #4222 from filecoin-project/feat/increase-inclusion-premium
Change default gas premium to for 10 block inclusion
2020-10-15 02:57:12 +02:00
Łukasz Magiera 958f169267 Merge pull request #4408 from filecoin-project/feat/better-gas-defaults
Improve gas defaults
2020-10-15 02:54:07 +02:00
Jakub Sztandera df6f4a572c Change default gas premium to for 6 block inclusion
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-15 02:53:40 +02:00
Łukasz Magiera 698b49b7ef Improve gas defaults 2020-10-15 02:46:47 +02:00
Łukasz Magiera 7e5b1ac272 Merge pull request #4407 from filecoin-project/steb/fix-blockcache-test-flake
give the TimeCacheBS tests a bit more time
2020-10-15 02:06:11 +02:00
Steven Allen 86e30729bf give the TimeCacheBS tests a bit more time
Otherwise, they flake once in a while.
2020-10-14 16:51:26 -07:00
Łukasz Magiera 7ccb2aabf0 Merge pull request #4406 from filecoin-project/steb/reduce-garbage
reduce garbage in blockstore
2020-10-15 01:49:01 +02:00
Steven Allen 811f1304e6 test timed cache blockstore 2020-10-14 16:17:55 -07:00
Łukasz Magiera 6de82364e9 Merge pull request #4396 from filecoin-project/feat/syncwait-watch
sync wait --watch
2020-10-15 00:14:02 +02:00
Łukasz Magiera d02d4bc275 Merge pull request #4403 from filecoin-project/frrist/fix-miner-shim-impls
fix: return true when deadlines changed
2020-10-15 00:13:36 +02:00
Łukasz Magiera 39670df6af Merge pull request #4125 from filecoin-project/feat/drand-cloudflare
Update drand endpoints
2020-10-15 00:01:06 +02:00
frrist 28823fb8e9 fix: bad indirection of deadline diffing 2020-10-14 14:50:59 -07:00
Steven Allen ddade32bd3 write bitswap blocks into a temporary, in-memory block cache
If they end up validating, we'll write them back to the underlying blockstore.
Otherwise, there's no reason to keep them.
2020-10-14 14:43:58 -07:00
Steven Allen 15fe998c68 add an timed-cache blockstore
This blockstore lets us write to a temporary scratch location where blocks older
than the specified cache time are automatically cleared.
2020-10-14 14:43:58 -07:00
Steven Allen 4b38809c0b in-memory blockstore
Instead of using an in-memory datastore and dealing with the overhead of
computing datastore keys, creating new blocks, etc, use an in-memory blockstore.
2020-10-14 14:43:58 -07:00
Steven Allen e2fbbdcb15 reject messages with invalid CIDs
These can't possibly be valid messages, so we should just drop the block.
2020-10-14 14:43:58 -07:00
Steven Allen bbc6de94fc write messages to a temp blockstore when validating 2020-10-14 14:43:52 -07:00
frrist ea1349205b fix: return true when partitions changed 2020-10-14 14:37:33 -07:00
frrist 470a565c34 fix: return true when deadlines changed 2020-10-14 14:27:35 -07:00
Łukasz Magiera 04bbeface6 Merge pull request #4402 from filecoin-project/feat/upgrade-markets-v0.9.1
Update to 0.9.1 bugfix release
2020-10-14 23:22:17 +02:00
hannahhoward 8df58064e3 feat(markets): update to 0.9.1 bugfix release 2020-10-14 13:20:18 -07:00
Łukasz Magiera 01de4cb2ec Merge pull request #4397 from filecoin-project/revert-4391-feat/https-api
Revert "Add support for /https, /http, /wss API multiaddresses."
2020-10-14 19:56:52 +02:00
Łukasz Magiera b060569fe9 Revert "Add support for /https, /http, /wss API multiaddresses." 2020-10-14 19:55:36 +02:00
Whyrusleeping dfd6fbfaa4 Merge pull request #4311 from filecoin-project/feat/msig-remove-cmd
Add propose remove
2020-10-14 11:36:55 -05:00
Łukasz Magiera d3d304bfd7 Merge pull request #4391 from filecoin-project/feat/https-api
Add support for /https, /http, /wss API multiaddresses.
2020-10-14 18:22:29 +02:00
Łukasz Magiera ab4f051b83 sync wait --watch 2020-10-14 18:17:18 +02:00
Whyrusleepinganddirkmc 12f36c5bda Update cmd/lotus-gateway/api.go
Co-authored-by: dirkmc <dirkmdev@gmail.com>
2020-10-14 09:22:25 -05:00
Raúl Kripalani 45cd510da1 conformance: support multiple protocol versions.
This PR introduces support for running multiple variants of a vector,
each of which targets a unique protocol version.

tvx tooling has been adapted to produce and parse the new version
of the schema.
2020-10-14 14:39:43 +01:00
David Dias 00a5083146 Update SECURITY.md 2020-10-14 15:11:30 +02:00
Hector Sanjuan c6ed6a0d65 Add support for /https, /http, /wss API multiaddresses.
Lotus API endpoint are by default expressed as multiaddresses (i.e. lotus auth
api-info) which end in /http, although they can be provided as standard URLs too.

There is an inconsistency here because despite the "http" part, Lotus will use "ws" protocol.

This lets lotus default to "ws" but honor whatever the user puts in the multiaddress (i.e.
/dns4/my.lotus.node/tcp/443/https) would work now using https, where before it uses "ws".
2020-10-14 14:58:58 +02:00
Łukasz Magiera 4ad8d85b13 Merge pull request #4278 from filecoin-project/tvx/trace-puts
tvx: trace puts to blockstore for inclusion in CAR.
2020-10-14 12:08:06 +02:00
Łukasz Magiera 465703b618 Merge pull request #4384 from filecoin-project/feat/4220
Use updated stored ask API
2020-10-14 12:03:07 +02:00
Aarsh Shah 30dd5d9644 use updated stored ask api 2020-10-14 11:39:57 +02:00
Aayush Rajasekaran 41bfeb56e2 Merge pull request #4386 from filecoin-project/asr/changelog
Lotus version 0.10.1
2020-10-14 02:34:18 -04:00
Aayush Rajasekaran 2e7cd024df Lotus version 0.10.1 2020-10-14 02:22:02 -04:00
Aayush Rajasekaran bf619862c3 Merge pull request #4382 from filecoin-project/asr/invoc-result
Add message CID to InvocResult
2020-10-14 02:06:09 -04:00
Aayush Rajasekaran 29e54c40be Merge pull request #4363 from filecoin-project/feat/update-markets-0.9.0
feat(markets): update markets 0.9.0 and add data transfer restart com…
2020-10-14 01:38:05 -04:00
Aayush Rajasekaran 308144ee6a Merge pull request #4350 from filecoin-project/asr/improve-fork
Avoid having the same message CID show up in execution traces
2020-10-14 01:22:16 -04:00
Aayush Rajasekaran ce54110228 Add message CID to InvocResult 2020-10-14 00:06:22 -04:00
Aayush Rajasekaran 458ea277fc Aggregate irregular state transitions into a single EexcutionTrace 2020-10-13 22:59:42 -04:00
hannahhoward 58662b79b3 fix(deps): use tagged go-fil-markets 0.9.0 2020-10-13 19:50:13 -07:00
Aayush Rajasekaran 7dbc8965be Apply nonces to implicit messages 2020-10-13 22:06:06 -04:00
Aayush Rajasekaran 2426700821 Don't transfer zero FIL during rebalancing fork 2020-10-13 22:06:06 -04:00
zgfzgf 51aca86e98 optimize mining code 2020-10-14 08:44:42 +08:00
Łukasz Magiera 9c6ee802cc Merge pull request #4376 from filecoin-project/steb/fix-load-panic
fix a panic on startup when we fail to load the tipset
2020-10-14 01:02:01 +02:00
Steven Allen b61281ba4b fix a panic on startup when we fail to load the tipset
There may be a deeper issue here, but we need to handle this more gracefully
somehow. See #4358.
2020-10-13 15:06:47 -07:00
whyrusleeping 3d80c38064 support stateReadState in gateway 2020-10-13 14:23:08 -07:00
whyrusleeping 98c1aa7988 add WalletVerify to lotus-gateway 2020-10-13 13:31:20 -07:00
Łukasz Magiera d5cea9f402 Merge pull request #4367 from filecoin-project/fix/msg-search-off-by-one
Fix off by one tipset in searchBackForMsg
2020-10-13 22:11:24 +02:00
Łukasz Magiera b74a3229f8 fsm: process expired-ticket sectors 2020-10-13 21:35:41 +02:00
Łukasz Magiera 71b3b9075d Merge remote-tracking branch 'origin/master' into feat/async-restartable-workers 2020-10-13 21:33:21 +02:00
Jakub Sztandera ce548c8f95 Add test
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-13 20:02:43 +02:00
Jakub Sztandera 8987defb9d Fix BLS message ChainLength add more detail to ValidForBlockInclusion
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-13 20:02:42 +02:00
Łukasz Magiera 1a70dbe37d Merge pull request #4347 from filecoin-project/fix/sync/message-validation-state-height
fix(sync state): set state height to actual tipset height
2020-10-13 17:55:51 +02:00
Jakub Sztandera 87cd8c6725 Fix off by one tipset in searchBackForMsg
This way we will return the tipset the message was executed in

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-13 17:48:54 +02:00
zgfzgf 1eb2d0ae50 optimize map use struct{} 2020-10-13 22:34:07 +08:00
Jakub Sztandera 5fd0bf11ba Merge pull request #4338 from filecoin-project/feat/message-json-cids
types: Add CID fields to messages in json marshalers
2020-10-13 14:59:22 +02:00
hannahhoward 4edebcec2b feat(markets): update markets 0.9.0 and add data transfer restart command 2020-10-13 03:41:08 -07:00
zgfzgf 07d0b67628 optimize code use ts.Cids 2020-10-13 10:46:41 +08:00
Lucas Molas 9b4cac9612 fix(sync state): set state height to actual tipset height 2020-10-12 21:14:16 -03:00
Travis Person 8232cc8415 Merge pull request #4341 from filecoin-project/fix/lotus-pcr-skip-non-processes
lotus-pcr: ignore all other market messages
2020-10-12 16:07:57 -07:00
Travis Person be74a13736 lotus-pcr: ignore all other market messages 2020-10-12 21:41:48 +00:00
Aayush Rajasekaran 195d96ccc0 Merge pull request #4148 from filecoin-project/asr/circ-supply
Add a StateExactCirculatingSupply command
2020-10-12 17:02:07 -04:00
Ingar Shu 49155ace62 Use seal-duration in calculating the earliest StartEpoch that we will consider (#4337) 2020-10-12 17:45:37 -03:00
Aayush Rajasekaran 83624a8858 Rename StateVMCirculatingSupply to StateVMCirculatingSupplyInternal 2020-10-12 16:41:27 -04:00
Aayush Rajasekaran 96e1dfd8d7 Add an endpoint for precise circulating supply 2020-10-12 16:38:29 -04:00
Łukasz Magiera 61661fb1f0 docsgen 2020-10-12 20:47:09 +02:00
Łukasz Magiera 6c08120628 types: Add CID fields to messages in json marshalers 2020-10-12 20:46:47 +02:00
Łukasz Magiera 8d769f0c07 Merge pull request #4336 from filecoin-project/steb/params-mainnet
Rename params_testnet to params_mainnet
2020-10-12 20:18:23 +02:00
Steven Allen 79c5d2c6d2 Rename params_testnet to params_mainnet 2020-10-12 11:04:46 -07:00
Łukasz Magiera 224a96431f Merge pull request #4319 from filecoin-project/asr/repay-debt-cli
Add a CLI tool for miner's to repay debt
2020-10-12 19:24:40 +02:00
Hector Sanjuan 8001ed3030 Drand: add cloudflare. Use HTTP for PL nodes.
Adding Cloudflare ensures additional redundancy.

Switching to HTTP for PL nodes reduces latency and cost. Randomness is
verified after being received.
2020-10-12 19:15:56 +02:00
Łukasz Magiera 2855c2bc49 Merge pull request #4329 from shaodan/ux-workers-cores
Improve the UX for `lotus-miner sealing workers`
2020-10-12 16:45:26 +02:00
Łukasz Magiera 65883cbb6b Merge pull request #4290 from filecoin-project/feat/ledger-integration
adding in ledger support
2020-10-12 15:09:27 +02:00
zgfzgf b7726c4ca8 optimize walkSnapshot recurseLinks 2020-10-12 16:44:39 +08:00
Steven Allen 443131b214 Merge pull request #4328 from filecoin-project/steb/test-tape-upgrade
Test the tape upgrade
2020-10-12 00:27:18 -07:00
Łukasz Magiera 8b648cf77c ledger: Close device in WalletNew 2020-10-12 09:21:42 +02:00
Dan Shao c0961fb63d Improve the UX for lotus-miner sealing workers: add total number of cores 2020-10-12 15:07:56 +08:00
Steven Allen dc4e73c737 Test the tape upgrade 2020-10-12 00:01:25 -07:00
Aayush Rajasekaran a6b2180756 Merge pull request #4323 from filecoin-project/asr/changelog
Lotus version 0.10.0
2020-10-12 02:27:55 -04:00
Aayush Rajasekaran 160f209f6a Lotus version 0.10.0 2020-10-12 02:14:36 -04:00
Aayush Rajasekaran a9d8bc7c45 Merge pull request #4322 from filecoin-project/steb/tape-upgrade
implement tape upgrade
2020-10-12 02:14:13 -04:00
Steven Allen 92177b5738 implement tape upgrade
Upgrade to specs-actors v2.1 and network version 5. This fixes the bug where
prove commits were not accepted.
2020-10-12 02:00:27 -04:00
Łukasz Magiera 4ac2bee81c Update oni 2020-10-12 06:34:45 +02:00
Łukasz Magiera a2e0832a12 Fix lint 2020-10-12 06:17:00 +02:00
Łukasz Magiera 8fd9b5f235 Merge pull request #4315 from filecoin-project/feat/stats-ops
lotus-stats: optmize getting miner power
2020-10-12 06:01:52 +02:00
Jakub Sztandera a95e343dee Merge pull request #4321 from filecoin-project/feat/love
Chain is love
2020-10-12 05:44:34 +02:00
Steven Allen c296e1bbca use actor abstraction in metrics command 2020-10-11 20:31:20 -07:00
Jakub Sztandera ae366972a9 Chain is love
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-12 05:11:04 +02:00
Aayush Rajasekaran b4215e5f46 Add a CLI tool for miner's to repay debt 2020-10-11 19:57:30 -04:00
Jakub Sztandera df7ee610cd Re-enable repub
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-12 01:29:19 +02:00
Jakub Sztandera fda8b932ba Ask for confirmation when creating a key
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-12 01:27:15 +02:00
Aayush Rajasekaran bae3b7d594 add a shed util to determine % of power that has won a block 2020-10-11 19:05:54 -04:00
Jakub Sztandera 7b4a5fc7ca Fixup off by one
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-12 00:50:29 +02:00
Jakub Sztandera d6c8276c7a Add support for WalletNew to ledger
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-12 00:48:23 +02:00
Jakub Sztandera 2b21fdef33 Refactor from crypto.SigType to types.KeyType
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-12 00:07:53 +02:00
Łukasz Magiera 6a232e7214 Basic multi-wallet support
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-12 00:07:41 +02:00
Jakub Sztandera 7ee6bafd23 Fix lint warn
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-12 00:07:41 +02:00
Jakub Sztandera 753d7b71a9 Fix hardened path printing, show 20 addresses after empty
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-12 00:07:40 +02:00
Łukasz Magiera bb6a354b62 chain cli: decode params command
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-12 00:07:40 +02:00
Łukasz Magiera 8ae66d6c6a Fix lint warnings
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-12 00:07:40 +02:00
Łukasz Magiera 2c92157233 shed ledger: Some UX improvements
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-12 00:07:40 +02:00
Łukasz Magiera 66d6113340 ledgerwallet: Validate signing bytes
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-12 00:07:40 +02:00
Łukasz Magiera 99791a6953 lotus-wallet: ledger flag
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-12 00:07:40 +02:00
whyrusleeping b35f9b56b4 WIP: adding in ledger support
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-12 00:07:40 +02:00
Travis Person 23470bc38f lotus-stats: optmize getting miner power 2020-10-11 20:27:36 +00:00
Jakub Sztandera a36ec27230 Look at block base fee
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-11 21:14:51 +02:00
Whyrusleeping 40b2e2d0c1 Merge pull request #4312 from filecoin-project/feat/msig-inspect-decode
decode parameters for multisig transactions in inspect
2020-10-11 11:51:32 -05:00
Jakub Sztandera 85be11fb75 Add propose remove
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-11 18:10:02 +02:00
Łukasz Magiera 00620aac57 Merge pull request #4296 from filecoin-project/feat/sync-unmarkbad-all
sync unmark-bad --all
2020-10-10 22:35:56 +02:00
Łukasz Magiera 32d95fc97a docsgen, gofmt 2020-10-10 20:46:06 +02:00
Łukasz Magiera a491fc97b9 Merge pull request #4301 from filecoin-project/steb/fix-two-races
Fix two races
2020-10-10 20:37:13 +02:00
Łukasz Magiera 151577f04e Merge pull request #4287 from filecoin-project/feat/flush_validation_cache_on_chain_import
Dump the block validation cache whenever we perform an import
2020-10-10 20:33:17 +02:00
Steven Allen c463582528 fix a race and optimize hello messages
LifecycleCtx can _only_ be called during startup as it appends an fx hook.
Worse, this was causing us to append an fx hook on every single hello message,
leaking memory (and probably causing other shutdown issues...).
2020-10-10 08:33:06 -07:00
Steven Allen 7245ac2b69 fix a race in the sync manager
1. SyncerState contains a mutex and should never be copied. Honestly, this case
was probably fine but it's just as easy to create a separate snapshot type and
easier to reason about.

2. We need to initialize the syncStates array once at start, before accessing
it. By each syncer state inside each worker, we were racing with calls to
`State()`. Again, this was probably benign, but I don't trust optimizing
compilers.
2020-10-10 08:31:04 -07:00
Łukasz Magiera 58f13a7d5a Merge pull request #4299 from filecoin-project/fix/wallet-export-panic
Fix panic in wallet export when key is not found
2020-10-10 16:25:40 +02:00
Peter Rabbitson e7d3b2503e Merge tag 'v0.9.1' 2020-10-10 15:54:51 +02:00
Łukasz Magiera ee8b8b8174 Merge pull request #4298 from filecoin-project/fix/cli-stderr-errors
cli: Don't output errors to stdout
2020-10-10 15:52:43 +02:00
Łukasz Magiera 4fa6afad13 Fix panic in wallet export when key is not found 2020-10-10 15:44:22 +02:00
Łukasz Magiera a80e98dc05 cli: Don't output errors to stdout 2020-10-10 15:38:14 +02:00
Peter Rabbitson 23f5a99117 Add comment clarifying current codepath 2020-10-10 15:36:32 +02:00
Łukasz Magiera 651522cbaa Merge pull request #4274 from filecoin-project/feat/msig-remove-api
add an api for removing multisig signers
2020-10-10 12:56:07 +02:00
Łukasz Magiera 388c9afce0 docsgen 2020-10-10 12:28:59 +02:00
Łukasz Magiera 9a26896c69 Merge pull request #4282 from filecoin-project/steb/fix-tipset-cache-race
fix a race in tipset cache usage
2020-10-10 12:27:15 +02:00
Łukasz Magiera 2db8b7efa7 Merge pull request #4291 from filecoin-project/steb/node-test-races
make pledge test pass with the race detector
2020-10-10 11:54:25 +02:00
Łukasz Magiera 18e58467f8 sync unmark-bad --all 2020-10-10 10:26:42 +02:00
Łukasz Magiera 1401efb115 Merge pull request #4294 from filecoin-project/feat/v0.9.1
Bump the version to 0.9.1
2020-10-10 09:15:04 +02:00
Łukasz Magiera f417d39a08 Bump the version to 0.9.1 2020-10-10 09:13:52 +02:00
Łukasz Magiera 11e35cf911 Merge pull request #4293 from filecoin-project/steb/actors-fixes
upgrade specs-actors
2020-10-10 08:53:20 +02:00
Steven Allen 10d464a1eb upgrade to specs-actors v2.0.3 2020-10-09 21:52:01 -07:00
Steven Allen d84f5dabab remove upgrade invariant checks
These checks may be _too_ strict and could cause the upgrade to fail unnecessarily.
2020-10-09 21:51:58 -07:00
Steven Allen f3abd1ae82 make pledge test pass with the race detector 2020-10-09 20:32:09 -07:00
Peter Rabbitson 85abca4b16 Delint 2020-10-10 04:00:12 +02:00
Peter Rabbitson 6610a247cf Dump the block validation cache whenever we perform an import
This solves a problem with folks resurrecting long-out-of-sync nodes via
snapshot imports.

The interface switch to Batching is necessary: startup is too long otherwise
( 8 minutes just to clear everything on a relatively old node )
2020-10-10 03:41:04 +02:00
Łukasz Magiera a6d9b302fa Merge pull request #3583 from filecoin-project/feat/signing-backends
Remote wallet backends
2020-10-10 02:58:02 +02:00
Steven Allen f32b3bf99b fix a race in tipset cache usage
This tipset cache is shared between multiple services and is called from
multiple places.
2020-10-09 17:32:45 -07:00
Łukasz Magiera 114a1aaffd Merge pull request #4281 from filecoin-project/steb/seal-race
fix race in unseal
2020-10-10 02:23:02 +02:00
Łukasz Magiera 83ba7ec8cc Merge pull request #4280 from filecoin-project/fix/market-deal-race
fix a race when retrieving pieces
2020-10-10 02:15:47 +02:00
Steven Allen 83dfc460d4 fix race in unseal
1. Remove an invalid error check.
2. Make sure to shadow the outer error type from within the goroutine instead or
reading the outer type.

This may have been causing test issues (caught in TestMinerAllInfo with the race
detector).
2020-10-09 15:39:41 -07:00
Steven Allen 283fd054e8 fix a race when retrieving pieces
We'd read the deal ID without synchronizing. This could (and probably did given
the history of flaky deal tests) cause us to miss events.

This patch also makes sure to always unsubscribe from events, even on error.
2020-10-09 15:35:44 -07:00
Łukasz Magiera 09bff14d85 Merge pull request #4269 from filecoin-project/steb/simplify-sync
simplify message syncing logic
2020-10-10 00:00:26 +02:00
Łukasz Magiera 3cb1abba4f Merge pull request #4276 from filecoin-project/steb/fix-bad-error
return the correct err from iterFullTipset
2020-10-09 23:26:54 +02:00
Raúl Kripalani e0dcb0ec49 tvx: trace puts to blockstore for inclusion in CAR. 2020-10-09 22:20:15 +01:00
Łukasz Magiera d4c92942e7 Merge pull request #4275 from filecoin-project/steb/unshare-journal
unshare the journal
2020-10-09 23:16:27 +02:00
Aayush Rajasekaran f773ab4b28 Correct docs 2020-10-09 17:14:21 -04:00
Steven Allen c0182f8301 return the correct err from iterFullTipset 2020-10-09 13:59:56 -07:00
Łukasz Magiera c06f394b81 Merge pull request #4273 from filecoin-project/fix/fundsmgr-incorrect-cached-value
Revert cached "available" amount if the AddFunds message send fails
2020-10-09 22:52:40 +02:00
Steven Allen 748d2e82a7 unshare the journal
Motivation:

* Run lotus with the race detector enabled (primary motivation).
* Allow multiple lotus nodes in a process (not a high priority).

Previously, the journal was shared between all lotus instances, but it was
initialized for every new node. This caused safety problems in tests (at a
minimum).

This patch explicitly passes the journal to all services that need it.
2020-10-09 13:23:07 -07:00
Steven Allen a5c78371fd Merge pull request #4270 from filecoin-project/steb/test-fix-paychstatus-race
fix a race in the payment channel status test
2020-10-09 13:22:16 -07:00
Ingar Shu d80e7eda93 Revert cached "available" amount if the AddFunds message send fails 2020-10-09 13:18:43 -07:00
Steven Allen 9f9d5cb2a5 fix a race in the payment channel status test
We should not be clobbering the cmd variable.
2020-10-09 11:50:16 -07:00
Łukasz Magiera fdaa9c14ad Merge remote-tracking branch 'origin/master' into feat/signing-backends 2020-10-09 20:36:51 +02:00
Łukasz Magiera 9d8932d395 Merge pull request #4268 from iand/fix/rewardv2-cumsumrealized
fix: spec actors 2 reward shim uses correct field for CumsumRealized
2020-10-09 20:32:14 +02:00
Steven Allen 105aa40007 simplify message syncing logic
1. Allow duplicate blocks from bitswap. This shouldn't happen, but there's no
reason to bail (just log loudly).
2. Simplify logic to very explicitly check to make sure we're fetching every
block.
2020-10-09 11:06:49 -07:00
Łukasz Magiera 110f033c83 Merge pull request #4095 from filecoin-project/feat/daemon-lite
lotus-lite: replace wallet / msig calls with thin client to gateway
2020-10-09 19:22:43 +02:00
Ian Davis f87d325b6f fix: spec actors 2 reward shim uses correct field for CumsumRealized 2020-10-09 17:48:20 +01:00
Łukasz Magiera ab8286fa38 Fix docsgen, lotus-soup build 2020-10-09 18:43:22 +02:00
whyrusleeping 4cca3f19a3 add an api for removing multisig signers 2020-10-09 09:40:25 -07:00
Łukasz Magiera feb4b3c8b4 Merge remote-tracking branch 'origin/master' into feat/signing-backends 2020-10-09 15:51:25 +02:00
Dirk McCormick 7f7c9e978f feat: hide lite mode flag 2020-10-09 11:56:25 +02:00
Dirk McCormick 200a95f824 refactor: unify test builder full node options 2020-10-09 11:56:25 +02:00
Dirk McCormick d69e4c7cf2 refactor: lite-mode - simplify organization of dep injection 2020-10-09 11:54:42 +02:00
Dirk McCormick b2834baa4b feat: add msig available balance and vested to lite mode 2020-10-09 11:51:20 +02:00
Dirk McCormick e9e27cbbb0 feat: put gateway in middle of end-to-end test for lite mode 2020-10-09 11:48:35 +02:00
Dirk McCormick ef73b964fb feat: add end-to-end test for lite mode 2020-10-09 11:48:35 +02:00
Dirk McCormick 7b1bec91ed feat: add tests for gateway ChainGetTipsetByHeight 2020-10-09 11:45:16 +02:00
Dirk McCormick b32d25c562 feat: add RPC for GasEstimateMessageGas 2020-10-09 11:45:16 +02:00
Dirk McCormick 767611247c feat: add RPC for StateWaitMsg 2020-10-09 11:45:16 +02:00
Dirk McCormick be09a8a00a feat: lite-mode - check that gateway API implements required chain, mpool, state methods 2020-10-09 11:43:03 +02:00
Dirk McCormick 2719adc1b1 feat: lite-mode - thin client for chan & state 2020-10-09 11:43:03 +02:00
Dirk McCormick f1b1d8cec6 fix: MpoolAPI DI 2020-10-09 11:43:03 +02:00
Dirk McCormick 8fa4c0a970 feat: gateway - MpoolPush 2020-10-09 11:43:03 +02:00
Dirk McCormick 00a14de094 feat: gateway - StateLookupID 2020-10-09 11:43:03 +02:00
Dirk McCormick eec13ff8dc refactor: daemon - simplify gateway cleanup 2020-10-09 11:43:03 +02:00
Dirk McCormick 1ffdd7d5b3 fix: gateway - remove tracing (JsonRPC automatically traces all calls) 2020-10-09 11:43:03 +02:00
Dirk McCormick e19cd9ed01 feat: lotus-lite - replace wallet StateManager with thin client to gateway 2020-10-09 11:43:03 +02:00
Łukasz Magiera bacac245c7 Merge pull request #4256 from filecoin-project/steb/call-stop
cleanup tests on finish
2020-10-09 10:20:33 +02:00
Łukasz Magiera e1792ffe4d Merge pull request #4260 from filecoin-project/asr/wallet-abstract
Fix deletion of addresses from wallet
2020-10-09 09:55:25 +02:00
Aayush Rajasekaran 9c35762966 Fix deletion of addresses from wallet 2020-10-09 03:26:51 -04:00
Animesh 4832cad1f1 sanity fix 2020-10-09 10:18:32 +05:30
Animesh 5930bf6d93 minor fix 2020-10-09 10:00:53 +05:30
Animesh d37389162e Add docs 2020-10-09 09:55:38 +05:30
Łukasz Magiera 356137439f apistruct: Drop unused WalletSignMessage 2020-10-09 03:12:33 +02:00
Łukasz Magiera 6cc7559b04 Fix APIInfo import cycle in tests 2020-10-09 02:58:12 +02:00
Łukasz Magiera 3cd53ad9d9 Use APIInfo parser for RemoteBacked wallet config 2020-10-09 02:21:37 +02:00
Łukasz Magiera 6c54d2445d Appease the linter 2020-10-09 01:53:12 +02:00
Łukasz Magiera 6a10af626c Nicer message logging in lotus-wallet 2020-10-09 01:50:46 +02:00
Łukasz Magiera 597d065e05 Update go-jsonrpc with http(s) client support 2020-10-09 01:39:06 +02:00
Łukasz Magiera 791aa5c6c8 Add lotus-wallet to Makefile 2020-10-09 01:37:17 +02:00
Steven Allen 82b15d2637 cleanup tests on finish 2020-10-08 16:36:02 -07:00
Łukasz Magiera 7d2f06cfbd Fix WalletSign in tests 2020-10-09 01:34:48 +02:00
Łukasz Magiera 6e8efb9d2c gofmt 2020-10-09 01:27:49 +02:00
Łukasz Magiera f3dc730b05 wallet: Add metadata to WalletAPI.WalletSign 2020-10-09 01:27:38 +02:00
Łukasz Magiera 114776f2c5 wallet: Drop WalletSignMessage from WalletAPI 2020-10-09 01:04:59 +02:00
Łukasz Magiera 4835109470 wallet: Post-merge fixes 2020-10-09 00:51:04 +02:00
Łukasz Magiera 8783c7434e Merge remote-tracking branch 'origin/master' into feat/signing-backends 2020-10-09 00:50:41 +02:00
Łukasz Magiera 2d3b61675b Merge pull request #3444 from IPFSMain-Official/fix-GetBestMiningCandidate-bug
fix GetBestMiningCandidate bug
2020-10-08 23:55:19 +02:00
刘林欣 a23ab123d7 fix GetBestMiningCandidate bug
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-08 23:39:33 +02:00
Łukasz Magiera 26ed6af040 Merge pull request #4227 from filecoin-project/par-upper-bounds
Increase the message fee cap upper bounds in PCR.
2020-10-08 23:34:32 +02:00
Łukasz Magiera 82bd7bd2ec Merge pull request #4224 from filecoin-project/fix/repub-journal
Fix Messages field in MessagePoolEvtMessage journal entry
2020-10-08 23:33:57 +02:00
Łukasz Magiera cd0a43b7f4 Merge pull request #4253 from filecoin-project/fix/syncwait-applied-offset
sync wait: Handle processed message offset
2020-10-08 23:30:55 +02:00
Łukasz Magiera b14632b750 Merge pull request #4250 from filecoin-project/asr/vesting-params-api
Add some new endpoints for querying Msig info
2020-10-08 23:25:23 +02:00
Łukasz Magiera ebcf77e830 Merge pull request #4254 from filecoin-project/feat/update-markets-0.7.1
Update markets v0.7.1
2020-10-08 23:24:08 +02:00
Łukasz Magiera 344d30e960 Merge pull request #4252 from filecoin-project/devnet-jennijuju
Update address prefix in client cli.
2020-10-08 23:23:40 +02:00
Łukasz Magiera efb13a0d9b Merge pull request #4246 from filecoin-project/feat/optim-search-msg
Optimize SearchForMessage and GetReceipt
2020-10-08 23:22:49 +02:00
Łukasz Magiera 0223582d41 sync wait: Handle processed message offset 2020-10-08 23:14:12 +02:00
Jakub Sztandera 973f61bc10 Optimize chain and message sync
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-08 23:10:07 +02:00
Jakub Sztandera 60768f4863 Optimize SearchForMessage and GetReceipt
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-08 23:10:06 +02:00
hannahhoward c60d13ee56 feat(markets): update markets v0.7.1 2020-10-08 13:52:39 -07:00
jennijuju 0f8fc119f3 Update address prefix in client cli. 2020-10-08 16:45:24 -04:00
Łukasz Magiera e4d2e6e01d Merge pull request #4249 from filecoin-project/feat/ux-enhancements
Feat/ux enhancements
2020-10-08 22:30:20 +02:00
Łukasz Magiera d55f10bed6 Merge pull request #4251 from filecoin-project/upgrade/noise
upgrade go-libp2p-noise to v0.1.2.
2020-10-08 22:26:46 +02:00
Raúl Kripalani 21de538d09 upgrade go-libp2p-noise to v0.1.2.
Improves throughput in large and/or fast transfers
and reduces syscalls when data is queued in receive
buffer, by using bufio.Reader.
2020-10-08 21:19:09 +01:00
Aayush Rajasekaran fe5b32026a Add some new endpoints for querying Msig info 2020-10-08 15:51:21 -04:00
Łukasz Magiera 91c10c2df5 Merge pull request #4248 from filecoin-project/feat/update-libp2p
Update libp2p things
2020-10-08 21:08:38 +02:00
Ingar Shu c3420c0ceb Display price, verified-price with units in lotus-miner storage-deals get-ask 2020-10-08 12:08:01 -07:00
vyzo 7933cf094f allow all drand topics 2020-10-08 21:48:55 +03:00
vyzo 4cd73f1560 use subscription filter in pubsub 2020-10-08 21:40:36 +03:00
vyzo 8a175a7465 update go-libp2p-pubsub and go-libp2p-quic-transport 2020-10-08 21:32:10 +03:00
Ingar Shu f7f229ae54 Show verified status in client list-deals 2020-10-08 11:31:33 -07:00
Ingar Shu 1323e07a2c Don't show failed deals by default in client list-deals, add option to to show failed deals. 2020-10-08 11:31:33 -07:00
Ingar Shu 2ad671649c Use FIL units for miner set-ask 2020-10-08 11:31:32 -07:00
Łukasz Magiera d26ece10b8 Merge pull request #4241 from filecoin-project/fix/daemon-flag-clash
fix: clash between daemon --api flag and cli tests
2020-10-08 18:30:47 +02:00
Raúl Kripalani 4c8084dcb0 Merge pull request #4243 from filecoin-project/conformance/rm-faked-syscalls 2020-10-08 17:06:25 +01:00
Raúl Kripalani 98d702fb5a add signature imports. 2020-10-08 16:44:20 +01:00
Łukasz Magiera 17f61ac212 Merge pull request #4245 from filecoin-project/debug/chain-sync-lookback
add more info to chain sync lookback failure
2020-10-08 17:05:08 +02:00
Łukasz Magiera df67576b89 Merge pull request #4233 from filecoin-project/fix/balances-audit-no-suffix
Some improvements to the lotus-shed balance audit commands
2020-10-08 17:02:21 +02:00
whyrusleeping cdc2f86f5a add more info to chain sync lookback failure 2020-10-08 09:45:07 -05:00
Raúl Kripalani 67b3a55e30 update test-vectors submodule. 2020-10-08 15:44:11 +01:00
Raúl Kripalani 3201e0eb8f Merge branch 'master' into conformance/rm-faked-syscalls 2020-10-08 15:17:26 +01:00
Raúl Kripalani 8d2d74438b Merge pull request #4221 from filecoin-project/conformance/randomness 2020-10-08 15:16:32 +01:00
Raúl Kripalani 1f9446f91f upgrade to test vectors schema v0.0.4. 2020-10-08 15:00:35 +01:00
Raúl Kripalani 4937ca1a96 conformance: remove usage of fake syscalls. 2020-10-08 14:55:03 +01:00
Łukasz Magiera 264fe4edb9 Merge pull request #4230 from filecoin-project/feat/inspect-counts
Add message counts to inspect chain output
2020-10-08 15:12:28 +02:00
Dirk McCormick cb7d99fcc7 fix: clash between daemon --api flag and cli tests 2020-10-08 14:24:50 +02:00
Łukasz Magiera 7332a39f00 Merge remote-tracking branch 'origin/master' into fix/balances-audit-no-suffix 2020-10-08 13:58:40 +02:00
Łukasz Magiera 0de3051821 Merge remote-tracking branch 'origin/master' into feat/async-restartable-workers 2020-10-08 13:10:41 +02:00
Aayush Rajasekaran 8f35a5c036 Merge pull request #4238 from filecoin-project/asr/changelog
Lotus version 0.9.0
2020-10-07 23:25:02 -04:00
Aayush Rajasekaran dea7042668 Lotus version 0.9.0 2020-10-07 23:09:08 -04:00
Aayush Rajasekaran bd8f3f05be Merge pull request #4237 from filecoin-project/next
Merge next into master
2020-10-07 23:08:48 -04:00
Aayush Rajasekaran 304d835739 Merge branch 'master' into next 2020-10-07 23:03:59 -04:00
hunjixin 0f53eca883 add batch api for push messages 2020-10-08 10:04:43 +08:00
Łukasz Magiera cb8678e4c2 Merge pull request #4235 from filecoin-project/asr/set-head-unmark-valid
Set head should unmark blocks as valid
2020-10-08 03:58:05 +02:00
Aayush Rajasekaran da34548a05 Set head should unmark blocks as valid 2020-10-07 21:52:29 -04:00
whyrusleeping cd9af278b4 more info in audit outputs 2020-10-07 17:01:01 -07:00
Łukasz Magiera b1fe92f8ff Merge pull request #4201 from filecoin-project/feat/faster-v2-upgrade
stmgr: Make v2 upgrade faster
2020-10-08 01:56:05 +02:00
Łukasz Magiera 8dd8892b81 Merge remote-tracking branch 'origin/next' into feat/faster-v2-upgrade 2020-10-08 01:54:29 +02:00
Łukasz Magiera 79dba816c7 Merge pull request #4232 from filecoin-project/steb/fix-v2-actor-error
return an illegal actor error when we see an unsupported actor version
2020-10-08 01:47:10 +02:00
Aayush Rajasekaran 14bb4c9a0b Merge pull request #4196 from filecoin-project/asr/update-epoch
Set actorsv2 upgrade epoch
2020-10-07 19:45:56 -04:00
Łukasz Magiera f9f54819d4 Env var to control v2 actor migration
Env var to control v2 actor migration
2020-10-07 19:41:36 -04:00
Aayush Rajasekaran d1555106a4 Set actorsv2 upgrade epoch 2020-10-07 19:41:36 -04:00
Steven Allen 413c357361 Merge pull request #4231 from filecoin-project/steb/call-at-upgrade
reject explicit "calls" at the upgrade height
2020-10-07 16:33:51 -07:00
Steven Allen d97eb10349 fix spelling nit 2020-10-07 16:32:54 -07:00
Steven Allen e8253d22c6 only forbid Call* at expensive forks 2020-10-07 16:14:11 -07:00
Steven Allen a4e954197c retry StateCall at different height if we're at an expensive fork height 2020-10-07 16:03:42 -07:00
whyrusleeping 8f4911ac0d dont print fil suffix in lotus shed audit balances 2020-10-07 16:00:52 -07:00
Steven Allen b0bea5f145 return an illegal actor error when we see an unsupported actor version
As far as the chain is concerned, this actor does not exist.
2020-10-07 15:46:56 -07:00
Travis Person 7c7e0d73d5 Merge pull request #4229 from filecoin-project/fix/lotus-pcr-zero-refund
lotus-pcr: zero refund
2020-10-07 15:33:28 -07:00
Steven Allen 1fea550ce5 test that we refuse explicit calls at the migration epochs 2020-10-07 15:33:14 -07:00
Steven Allen 9b7b6146eb construct the new vm with the state manager's vm constructor 2020-10-07 15:31:14 -07:00
Steven Allen dab1107f5b avoid estimating gas and explicitly calling blocks on fork tipsets
These tipsets can be slow.
2020-10-07 15:31:14 -07:00
Steven Allen fe912223bd pass an explicit upgrade height to migrations
The tipset height may not be the correct one, given null blocks.
2020-10-07 15:31:12 -07:00
whyrusleeping 12cd478e11 Add message counts to inspect chain output 2020-10-07 15:14:46 -07:00
Travis Person ae3691e0a2 lotus-pcr: zero refund 2020-10-07 21:53:56 +00:00
Jennifer e55b00f358 Increase the message fee cap upper bounds in PCR. 2020-10-07 17:07:19 -04:00
Steven Allen de3f4111f4 Merge pull request #4197 from filecoin-project/steb/state-tree-version
introduce separate state-tree versions
2020-10-07 12:29:14 -07:00
Steven Allen 767c346cf8 update test-vectors 2020-10-07 12:17:32 -07:00
Jakub Sztandera 6f4a762664 Fix Messages field in MessagePoolEvtMessage journal entry
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-07 21:13:04 +02:00
Raúl Kripalani c02daca9e9 work around #4223. 2020-10-07 20:12:35 +01:00
Steven Allen cca17f6078 fix state tree version in v2 upgrade 2020-10-07 12:04:32 -07:00
Steven Allen c17fa4bc35 update test-vectors for StateManager constructor change 2020-10-07 12:04:32 -07:00
Steven Allen e803cf151f introduce separate state-tree versions
Instead of versioning the state tree along with the actors, version it
separately. This structure may not upgrade every time we update actors.
2020-10-07 12:04:32 -07:00
Łukasz Magiera 1268cfbfcd Merge pull request #4218 from filecoin-project/fix/lotus-pcr-ignore-other-messages
lotus-pcr: ignore all other messages
2020-10-07 21:03:53 +02:00
Łukasz Magiera 5ef929f130 Merge pull request #4219 from filecoin-project/merge-master-to-next
Merge branch 'master' into merge-master-to-next
2020-10-07 21:02:57 +02:00
Raúl Kripalani 5bd6a3cdad conformance: record randomness in tvx; replay in driver. 2020-10-07 19:57:42 +01:00
Steven Allen df4b068d0e Merge branch 'master' into next 2020-10-07 11:55:00 -07:00
Travis Person 0d34881a0c lotus-pcr: ignore all other messages 2020-10-07 18:50:50 +00:00
Steven Allen 6eb49b717f Merge pull request #4214 from filecoin-project/gas-tracing-public
make vm.EnableGasTracing public.
2020-10-07 11:12:55 -07:00
Whyrusleeping 099b982ea8 Merge pull request #4178 from filecoin-project/frrist/miner-diff-deadlines
feat(miner): add miner deadline diffing logic.
2020-10-07 12:00:31 -05:00
Łukasz Magiera 10c120bd3c Merge pull request #4213 from filecoin-project/feat/test-addrs-envvar
build: Env var to keep test address output
2020-10-07 18:49:55 +02:00
Raúl Kripalani 7cd1330acd make vm.EnableGasTracing public. 2020-10-07 15:52:03 +01:00
Łukasz Magiera 39bc816a79 build: Env var to keep test address output 2020-10-07 15:01:30 +02:00
Łukasz Magiera 81fb552e1d Merge pull request #4211 from filecoin-project/conformance/minor-refactors
conformance: minor driver refactors.
2020-10-07 14:57:00 +02:00
Łukasz Magiera cfd126ee9f Merge pull request #3961 from filecoin-project/docs/miner-storage
lotus-miner: add more help text to storage / attach
2020-10-07 14:55:42 +02:00
Łukasz Magiera d6fa644974 Fix lint 2020-10-07 14:19:04 +02:00
Raúl Kripalani d3dc560f53 conformance: minor refactors. 2020-10-07 13:01:08 +01:00
Animesh 673de6aeb6 Add perm tag to ClientGetDealStatus 2020-10-07 12:35:42 +05:30
Łukasz Magiera 25bc00eec8 Merge pull request #4200 from filecoin-project/feat/state-exec-trace
implement command to get execution traces of any message
2020-10-07 08:14:08 +02:00
Animesh bf959e45fb Add api for getting status given a code 2020-10-07 11:43:30 +05:30
whyrusleeping 3b12a9f425 Add flag to accept previous output of compute-state as input 2020-10-07 08:12:39 +02:00
Łukasz Magiera b7c8f65af5 stmgr: Make v2 upgrade faster 2020-10-07 08:12:05 +02:00
Łukasz Magiera c6e0cb4ff2 Merge pull request #4205 from filecoin-project/feat/noncefix-manual-fee-cap
allow manual setting of noncefix fee cap
2020-10-07 08:08:52 +02:00
Łukasz Magiera f6eb530cba Merge pull request #4203 from filecoin-project/fix/pond-actorsv2
Fix pond
2020-10-07 07:55:38 +02:00
Animesh ce247bcab3 Add api for getting status given a code 2020-10-07 10:27:51 +05:30
Travis Person f4991e868e Merge pull request #4198 from filecoin-project/feat/lotus-pcr-cap-limit
Limit the fee cap of messages we will process, refund gas fees for windowed post and storage deals
2020-10-06 21:03:43 -07:00
Aayush Rajasekaran 0ec2a10ebc Merge branch 'master' into next 2020-10-06 21:09:20 -04:00
whyrusleeping be92dd9e63 allow manual setting of noncefix fee cap 2020-10-06 18:07:34 -07:00
Aayush Rajasekaran e90ca96289 Merge pull request #4199 from filecoin-project/asr/specs-update
Update to actors v2.0.1
2020-10-06 21:06:20 -04:00
Aayush Rajasekaran c23f1623a1 Fix test 2020-10-06 20:48:00 -04:00
Aayush Rajasekaran 839d1121ce Update to actors v2.0.1 2020-10-06 20:37:54 -04:00
Łukasz Magiera a98b0f18fc Merge pull request #4202 from filecoin-project/fix/nonce-gap-fixer
fix noncefix
2020-10-07 01:58:29 +02:00
Łukasz Magiera 15670942c3 Fix pond 2020-10-07 01:50:11 +02:00
whyrusleeping 74016ab1cc fix noncefix 2020-10-06 16:46:47 -07:00
whyrusleeping bd474617ed implement command to get execution traces of any message 2020-10-06 16:06:24 -07:00
Travis Person 087030fe37 lotus-pcr: refund windowed post and storage deal gas fees 2020-10-06 22:35:04 +00:00
Łukasz Magiera 2f70a91665 Merge remote-tracking branch 'origin/master' into next 2020-10-06 23:54:59 +02:00
Aayush Rajasekaran 60ad339033 Merge pull request #4194 from filecoin-project/steb/test-amt-update
update the AMT implementation
2020-10-06 17:44:08 -04:00
Steven Allen 00187d4aa8 update the AMT implementation
This change ensures the bitmap is reset on flush.
2020-10-06 17:43:45 -04:00
Aayush Rajasekaran dfaabb4596 Merge pull request #3697 from filecoin-project/fix/actor-panic-fatal
fix: error when actor panics directly
2020-10-06 17:41:31 -04:00
Aayush Rajasekaran 0edecbd043 Merge pull request #4190 from filecoin-project/asr/post-lookback-finality
Set WinningPoStSectorSetLookback to finality post-v2 actors
2020-10-06 17:41:08 -04:00
Aayush Rajasekaran 4d6a0f7b8c Set WinningPoStSectorSetLookback to finality post-v2 actors 2020-10-06 17:40:37 -04:00
Aayush Rajasekaran 5043247958 Merge pull request #4189 from filecoin-project/asr/cli-change-owner
Add a CLI command to set a miner's owner address
2020-10-06 17:39:31 -04:00
Aayush Rajasekaran 282c99bdbd Merge pull request #4160 from filecoin-project/asr/reserve-funds-cric-supply
Add funds that have left FilReserve to circ supply
2020-10-06 17:39:05 -04:00
Aayush Rajasekaran 9857e42206 Merge pull request #4188 from filecoin-project/asr/miner-eligible
Update miner eligibility checks for v2 actors
2020-10-06 17:38:46 -04:00
Aayush Rajasekaran 6919ff3881 Merge pull request #3589 from filecoin-project/asr/rt-fix
Bugfix: Runtime's Receiver() should only return ID addresses
2020-10-06 17:38:20 -04:00
Aayush Rajasekaran d9fad5fad0 Move rt.Message fixes behind fork logic 2020-10-06 17:37:50 -04:00
Aayush Rajasekaran 757aa1039f Panic if runtime's Message has non-ID caller or receiver 2020-10-06 17:37:50 -04:00
Aayush Rajasekaran b71b743420 Bugfix: Runtime's Receiver() should only return ID addresses 2020-10-06 17:37:50 -04:00
Aayush Rajasekaran 8739b938db Merge pull request #3936 from filecoin-project/asr/spec-v1
Introduce v2 actors
2020-10-06 17:34:28 -04:00
Travis Person 4a3081c77a lotus-pcr: limit refunds to properly priced messages 2020-10-06 20:13:48 +00:00
Steven Allen b1818a1055 fix base fee tests for different smoke heights 2020-10-06 13:12:16 -07:00
Steven Allen 256be285ba only enable gas tampering if the breeze upgrade is enabled 2020-10-06 13:00:06 -07:00
Steven Allen 4a6e9c920d set genesis name in test 2020-10-06 11:42:04 -07:00
frrist d4cbd4fb55 feat(miner): add miner deadline diffing
- logic gathering all removed, faulted, recovered, and recovering
sectors for a miner.
2020-10-06 11:39:38 -07:00
Łukasz Magiera 15330396bb Fix circ supply before v2 upgrade epoch 2020-10-06 16:53:49 +02:00
Łukasz Magiera 2bf42d5318 Merge pull request #4186 from filecoin-project/asr/default-address
Support addresses with mainnet prefixes
2020-10-06 13:59:13 +02:00
Łukasz Magiera a179cadf0e wallet: Don't output duplicate keys from WalletList 2020-10-06 13:35:31 +02:00
Jakub Sztandera 405aba4d8f Merge pull request #4179 from filecoin-project/fix/export-unclean-exit
chain export: Error with unfinished exports
2020-10-06 13:30:53 +02:00
Aayush Rajasekaran 7b556252db Use SysErrReserved1 in the event of an actors panic 2020-10-06 05:34:53 -04:00
Aayush Rajasekaran 7a80e356de Add a CLI command to set a miner's owner address 2020-10-06 05:11:52 -04:00
Aayush Rajasekaran c53cef1526 Update docs 2020-10-06 04:47:00 -04:00
Aayush Rajasekaran 4a9155ba85 Use new MinerEligibleToMine method post-v2 actors 2020-10-06 04:43:55 -04:00
Łukasz Magiera 1a170e18ad Merge pull request #4183 from filecoin-project/fix/relax-colocation-factor
relax pubsub IPColocationFactorThreshold to 5
2020-10-06 10:37:25 +02:00
Aayush Rajasekaran f8c886a611 Rename MiningBaseInfo.HasMinPower to EligibleForMining 2020-10-06 03:49:11 -04:00
Aayush Rajasekaran b5907c665b Fix test 2020-10-06 03:43:20 -04:00
Aayush Rajasekaran ba25806fbd Update docs 2020-10-06 03:30:40 -04:00
Aayush Rajasekaran d02fc08ca4 Support both testnet and mainnet addresses in the internal wallet 2020-10-06 03:27:46 -04:00
vyzo de390749fc set pubsub IPColocationFactor to 5 2020-10-06 09:11:44 +03:00
Aayush Rajasekaran 3672f2cc44 Set default address type to mainnet 2020-10-06 01:59:15 -04:00
Aayush Rajasekaran 14ad91c53f Add type assertion for v2 runtime 2020-10-06 01:27:45 -04:00
Aayush Rajasekaran f55b18eabe Add funds that have left FilReserve to circ supply 2020-10-05 23:54:57 -04:00
Łukasz Magiera c920257a33 chain export: Error with unfinished exports 2020-10-06 02:59:19 +02:00
Łukasz Magiera 0e2f697217 Merge pull request #4133 from filecoin-project/feat/backup
Miner backup/restore commands
2020-10-06 02:05:03 +02:00
Steven Allen 16243b97aa make state diffing work with partial state trees 2020-10-05 17:03:28 -07:00
Steven Allen 89b88c1e0d fix conformance tests 2020-10-05 17:03:28 -07:00
Łukasz Magiera 8cdf078999 backup: append checksum 2020-10-06 01:50:54 +02:00
Łukasz Magiera 70d88f226e Add usage to repo-type in shed datastore 2020-10-06 01:33:51 +02:00
Łukasz Magiera 937d7fcca9 Merge pull request #4170 from filecoin-project/feat/mstat-base
Add mpool stats for base fee
2020-10-06 01:28:14 +02:00
Łukasz Magiera c8822fc9b6 Merge pull request #4177 from filecoin-project/feat/chain-usage-cmd
allow usage inspection on a chain segment
2020-10-06 01:21:01 +02:00
Łukasz Magiera dd1661c0b1 Merge pull request #4173 from filecoin-project/feat/basic-filter-on-start-epoch
Reject deals that are > 90 days in the future in the BasicDealFilter
2020-10-06 00:57:08 +02:00
whyrusleeping e9417562e0 allow usage inspection on a chain segment 2020-10-05 15:53:43 -07:00
Łukasz Magiera 40f4266070 Merge pull request #4176 from filecoin-project/feat/chain-usage-cmd
add a command to view block space utilization
2020-10-06 00:52:55 +02:00
Aayush Rajasekaran 6d25f3d2ae Add some comments 2020-10-05 18:39:39 -04:00
Steven Allen 1e78cd21ec fix lotus soup build 2020-10-05 14:37:08 -07:00
Steven Allen 17846aad2f add some more policy toggles for testground 2020-10-05 14:28:47 -07:00
whyrusleeping bd0633ff90 add a command to view block space utilization 2020-10-05 14:06:03 -07:00
Steven Allen 9621dbb4f1 fix tests to use v2 types 2020-10-05 13:27:34 -07:00
Łukasz Magiera c55b9baf37 Merge pull request #4166 from filecoin-project/test/miner-allinfo
Test lotus-miner info all
2020-10-05 22:04:12 +02:00
Ingar Shu 1227bf2893 Change max time in future for StartEpoch to 7 days 2020-10-05 12:35:58 -07:00
Ingar Shu 550f3771ea Reject deals that are > 90 days in the future in the BasicDealFilter 2020-10-05 11:39:02 -07:00
Steven Allen f8b2022f82 fix linters 2020-10-05 11:14:05 -07:00
Steven Allen 5a08b881d6 Test upgrade before/during/after cc upgrade 2020-10-05 11:05:00 -07:00
Steven Allen 8bcc201fc0 fix v2 GetSectorExpiration 2020-10-05 10:54:22 -07:00
Steven Allen 420c44ed2c fix msig start height 2020-10-05 10:35:21 -07:00
Steven Allen b6500beaab Merge branch 'master' into asr/spec-v1 2020-10-05 10:29:09 -07:00
Steven Allen d0c52535a6 Merge pull request #4171 from filecoin-project/upd/bitfield
Update go-bitfield
2020-10-05 10:27:55 -07:00
Jakub Sztandera 4be8964062 Add stats for base fee
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-05 19:15:51 +02:00
Jakub Sztandera feb85a272c Update go-bitfield
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-05 19:14:21 +02:00
Łukasz Magiera fee84c4b44 Merge pull request #4165 from filecoin-project/fix/message-signer-nonce-generation
fix: make message signer nonce generation transactional
2020-10-05 18:56:35 +02:00
Steven AllenandŁukasz Magiera b9f8831aaf fix specs-actors import in payment channel abstraction
Co-authored-by: Łukasz Magiera <magik6k@users.noreply.github.com>
2020-10-05 09:51:04 -07:00
Dirk McCormick 7c3f622fae refactor: message signer - always store *next* nonce in datastore 2020-10-05 14:54:22 +02:00
Dirk McCormick 140671599c fix: make message signer nonce generation transactional 2020-10-05 14:19:31 +02:00
Łukasz Magiera ed03202c1d Test lotus-miner info all 2020-10-05 14:15:14 +02:00
Łukasz Magiera 0162a485d8 Merge pull request #4142 from filecoin-project/steb/bs-sessions
use bitswap sessions when fetching messages, and cancel them
2020-10-05 11:33:21 +02:00
Łukasz Magiera 97087fe576 Merge pull request #4122 from filecoin-project/asr/client-wallet
Convert ID addresses to key addresses before checking wallet
2020-10-04 17:20:04 +02:00
Łukasz Magiera e3269770d8 Merge pull request #4153 from filecoin-project/asr/verbose-verification
Add verified status to api.DealInfo
2020-10-04 17:13:49 +02:00
Łukasz Magiera 0fee5dab8a Merge pull request #4077 from filecoin-project/4076-remove-ask-duration
Always use default 720h for setask duration and hide the duration param option
2020-10-04 13:59:41 +02:00
Łukasz Magiera 921d78f820 Merge remote-tracking branch 'origin/master' into feat/async-restartable-workers 2020-10-04 10:39:55 +02:00
Łukasz Magiera 1fc23fb466 lotus-miner: Cleanup storage attach helptext a bit 2020-10-03 11:30:22 +02:00
Aayush Rajasekaran 306dfaa11f Update docs 2020-10-03 03:41:01 -04:00
Aayush Rajasekaran 8fe8da6f4c Add verified status to api.DealInfo 2020-10-03 03:39:59 -04:00
Aayush Rajasekaran 4631cee564 Merge pull request #4114 from filecoin-project/fix/fork-after-cron
Run fork function after cron for null block safety
2020-10-02 23:05:36 -04:00
Steven Allen 8292d60196 Merge branch 'master' into asr/spec-v1 2020-10-02 18:03:03 -07:00
Steven Allen f6ccab1c6c ignore context canceled error in window post test 2020-10-02 17:47:01 -07:00
Steven Allen 6aba3e3b94 fix deal error message logging 2020-10-02 17:45:15 -07:00
Steven Allen 863a6ed38c fix lints 2020-10-02 17:45:01 -07:00
Steven Allen f1e5e9fe72 better upgrade test times 2020-10-02 17:31:26 -07:00
Steven Allen a57288a4b9 run post before, while, and after upgrading 2020-10-02 17:27:44 -07:00
Steven Allen c5de617af6 decouple network version and upgrades
Not all upgrades require network version bumps.
2020-10-02 17:10:57 -07:00
Łukasz Magiera bd964b4c3e Merge pull request #4124 from filecoin-project/asr/verifreg
Some helpers for verifreg work
2020-10-03 00:20:45 +02:00
Łukasz Magiera 5e256be81e Merge pull request #4141 from filecoin-project/feat/cap-market-provider-msgs
Cap market provider messages
2020-10-03 00:15:08 +02:00
Łukasz Magiera 04db9ea72d Merge pull request #3743 from filecoin-project/3692-config-default-update
Increased ExpectedSealDuration and and WaitDealsDelay.
2020-10-03 00:14:48 +02:00
Łukasz Magiera 6f33706025 Merge remote-tracking branch 'origin/master' into feat/backup 2020-10-03 00:08:23 +02:00
Łukasz Magiera 44e352cd8e Merge pull request #3876 from filecoin-project/feat/pruning-command
add command to (slowly) prune lotus chain datastore
2020-10-03 00:04:08 +02:00
Łukasz Magiera 1319d7072e shed: Fix lint 2020-10-02 23:54:03 +02:00
whyrusleeping ef3987e2ab decode parameters for multisig transactions in inspect 2020-10-02 14:51:32 -07:00
Łukasz Magiera f147072284 Merge remote-tracking branch 'origin/master' into feat/pruning-command 2020-10-02 23:37:25 +02:00
Łukasz Magiera 43bd7cb055 Merge pull request #4145 from filecoin-project/feat/cli-interactive-verified-deal
Add verified flag to interactive deal creation
2020-10-02 23:32:01 +02:00
Łukasz Magiera a3a3df9b30 Merge pull request #3915 from filecoin-project/feat/mpool-gateway-api
MpoolPushUntrusted API for gateway
2020-10-02 23:30:25 +02:00
Łukasz Magiera d3effe52a5 Merge pull request #3821 from filecoin-project/fix/paych-voucher-verify
paych: fix voucher amount verification
2020-10-02 23:27:18 +02:00
Łukasz Magieraanddirkmc 0591bac768 Compare more accurately
Co-authored-by: dirkmc <dirkmdev@gmail.com>
2020-10-02 23:18:37 +02:00
Łukasz Magiera db91d22a8a docsgen 2020-10-02 23:14:47 +02:00
ZenGround0 fecc1ee0ef Review cleanup 2020-10-02 17:12:12 -04:00
Łukasz Magiera 3bebdb3882 Merge remote-tracking branch 'origin/master' into feat/mpool-gateway-api 2020-10-02 23:09:55 +02:00
Ingar Shu 73b9fe36e3 Use verified price for verified deals 2020-10-02 13:07:40 -07:00
Ingar Shu 2c1ef3708e Add verified flag to interactive deal creation 2020-10-02 12:41:27 -07:00
Steven Allen 53cc1f18d0 use bitswap sessions when fetching messages, and cancel them
1. Explicitly use a session when fetching messages for a block. Technically,
GetBlocks would use an internal session so we'd only end up with two, but one
per block is even better.
2. Actually cancel sessions after a timeout (threading through the context).

NOTE: We should seriously consider having a single session for all blocks, but
we can do that in a followup as it may have unintended consequences (e.g., leaks).
2020-10-02 10:49:35 -07:00
Łukasz Magiera e848c13ff1 client: bump default deal start buffer 2020-10-02 19:39:34 +02:00
Łukasz Magiera 8fe8a5df45 Cap market provider messages 2020-10-02 18:35:52 +02:00
Łukasz Magiera a572bef8b2 Merge remote-tracking branch 'origin/master' into 3692-config-default-update 2020-10-02 13:33:17 +02:00
Steven Allen ed86ac14a1 use upgrade epochs from upgrade schedule 2020-10-01 20:37:14 -07:00
Steven Allen 101d07f704 fix version off by one error 2020-10-01 15:33:32 -07:00
Steven Allen 8ad8a945fb make it possible to override options when testing 2020-10-01 15:26:00 -07:00
Steven Allen e865ba0c64 improve upgrade schedule configurable
Unfortunately, it looks like functional ops cannot be passed in via lotus's
di system.
2020-10-01 15:18:59 -07:00
Steven Allen 1cc0f74744 make the upgrade schedule fully configurable
This should help with testing.
2020-10-01 15:02:40 -07:00
Łukasz Magiera efc1b24f4e Merge pull request #3714 from filecoin-project/feat/lotus-pcr-miner-recovery
lotus-pcr: add recover-miners command
2020-10-01 21:27:42 +02:00
Łukasz Magiera 078044153f pcr: Appease the linter 2020-10-01 21:07:39 +02:00
Łukasz Magiera 9b4274638c pcr: fix build 2020-10-01 20:51:36 +02:00
Łukasz Magiera 1253a5600e Merge remote-tracking branch 'origin/master' into feat/lotus-pcr-miner-recovery 2020-10-01 20:41:30 +02:00
Łukasz Magiera bceb880ee2 Merge pull request #4134 from filecoin-project/feat/better-replace-ux
improve the UX for replacing messages
2020-10-01 18:05:25 +02:00
Łukasz Magiera 15885ad535 docsgen 2020-10-01 18:00:24 +02:00
Łukasz Magiera ec7282ff09 miner restore: Resolve worker key for wallet check 2020-10-01 17:55:48 +02:00
Łukasz Magiera 738efe3f9a miner restore: Add progerss bar for metadata import 2020-10-01 17:55:48 +02:00
Łukasz Magiera e444977891 Full node metadata backup 2020-10-01 17:55:48 +02:00
Łukasz Magiera 5c33982f72 miner restore: storage config flag 2020-10-01 17:55:48 +02:00
Łukasz Magiera 44747446a9 miner restore: config flag 2020-10-01 17:55:48 +02:00
Łukasz Magiera d7ec5e3618 lotus-miner init restore 2020-10-01 17:55:48 +02:00
Łukasz Magiera 9b5a0815fc backup: open datastores in readonly in offline mode 2020-10-01 17:55:47 +02:00
Łukasz Magiera deac7166b5 Support offline backups 2020-10-01 17:55:47 +02:00
Łukasz Magiera c8a3269c4b shed: utils to read datastore backups 2020-10-01 17:55:47 +02:00
Łukasz Magiera 2dc9a1ee4e lotus-miner backup command 2020-10-01 17:55:47 +02:00
Łukasz Magiera d20ebe93b9 shed: gofmt 2020-10-01 17:55:47 +02:00
Łukasz Magiera 6875527224 shed: Datastore utils 2020-10-01 17:55:46 +02:00
whyrusleeping 889dd3cb3f improve the UX for replacing messages 2020-10-01 08:51:01 -07:00
Dirk McCormick 594ec8855c fix: read lane state from chain as well as datastore 2020-10-01 12:08:11 +02:00
Dirk McCormick e2ecc35dff test: add test for voucher after add-funds 2020-10-01 11:35:41 +02:00
Dirk McCormick 9dc75a7bc4 fix: verify voucher amount check 2020-10-01 11:35:41 +02:00
Aayush Rajasekaran 3d91633699 Update to v2/actors master 2020-10-01 05:07:00 -04:00
Aayush Rajasekaran 93e4eae94c Some helpers for verifreg work 2020-10-01 04:49:38 -04:00
Aayush Rajasekaran 6f0453c581 Convert ID addresses to key addresses before checking wallet 2020-10-01 04:41:24 -04:00
Aayush Rajasekaran 60d442e36a Slash filter shouldn't be trigerred if the same block is submitted multiple times 2020-09-30 22:05:16 -04:00
Aayush Rajasekaran 1ebad94da9 Merge pull request #4117 from filecoin-project/asr/changelog
Lotus version 0.8.1
2020-09-30 21:40:08 -04:00
Aayush Rajasekaran 636810daa5 Lotus version 0.8.1 2020-09-30 21:30:52 -04:00
Łukasz Magiera 5932f28519 Merge remote-tracking branch 'origin/master' into feat/async-restartable-workers 2020-10-01 02:39:48 +02:00
Steven Allen 196bf39574 use non-faulty sectors, instead of active, in post proof
In actors v2, active doesn't include "new" (unproven) sectors.
2020-09-30 17:35:14 -07:00
Łukasz Magiera 954d806367 Merge pull request #4116 from filecoin-project/feat/sched-par-pcc2
sched: Allow some single-thread tasks to run in parallel with PC2/C2
2020-10-01 01:35:05 +02:00
Aayush Rajasekaran 7699f195f1 Merge pull request #4108 from filecoin-project/feat/nice-sectorslist
Improve miner sectors list UX
2020-09-30 19:07:23 -04:00
Łukasz Magiera 6981f776f4 Lower PC2 memory requirements 2020-10-01 00:54:53 +02:00
Łukasz Magiera 1b7cdb9341 Fix storage manager tests 2020-10-01 00:54:34 +02:00
Steven Allen 47a83b422e handle state forks in gas estimation 2020-09-30 15:52:32 -07:00
Łukasz Magiera 5e08d56630 sched: Allow some single-thread tasks to run in parallel with PC2/C2 2020-10-01 00:28:44 +02:00
Steven Allen 9705b25bbd fix testground actor versions 2020-09-30 15:15:34 -07:00
Steven Allen 9d59635b42 fix error messages 2020-09-30 15:04:16 -07:00
Steven Allen 42d5d8d784 run upgrade logic on stmgr.Call 2020-09-30 14:56:16 -07:00
Steven Allen 486812e082 name test networks
Necessary to get upgrades to run.
2020-09-30 14:55:50 -07:00
Steven Allen 6825a485eb update message extraction tool for specs-actors update 2020-09-30 14:28:25 -07:00
ZenGround0 8091bb3117 Run fork function after cron 2020-09-30 17:19:58 -04:00
Steven Allen 8dcbd525da abstract over deal collateral 2020-09-30 13:30:24 -07:00
Steven Allen 35e606d397 remove direct specs-actors miner access from expiration calculation 2020-09-30 13:17:56 -07:00
Steven Allen 99fe63716b regen lotuspond info 2020-09-30 13:12:17 -07:00
Steven Allen 941c1947be Merge branch 'master' into asr/spec-v1 2020-09-30 13:03:58 -07:00
Łukasz Magiera feecee310d Merge pull request #4089 from filecoin-project/feat/update-markets-0.7.0
Markets 0.7.0 with updated data stores
2020-09-30 21:49:14 +02:00
Steven Allen b01a1d457a abstract multisig calls 2020-09-30 12:30:02 -07:00
Łukasz Magiera 79d2ddf24f Review 2020-09-30 21:18:12 +02:00
Łukasz Magiera 2cfe22d4e5 Merge remote-tracking branch 'origin/master' into feat/async-restartable-workers 2020-09-30 20:48:16 +02:00
Łukasz Magiera e3ee4e4718 Fix lint errors 2020-09-30 20:24:03 +02:00
Steven Allen 2e9915ac28 move common from message param into message builder constructor 2020-09-30 10:58:34 -07:00
hannahhoward be884e27be feat(markets): update markets 0.7.0 2020-09-30 10:26:50 -07:00
Łukasz Magiera 2d16af6ee6 sectorstorage: Fix TestRedoPC1 2020-09-30 19:18:38 +02:00
Łukasz Magiera 4f97d9637e Fix storage-fsm tests 2020-09-30 19:11:58 +02:00
Steven Allen 5253c0d959 fix: import the correct v2 methods 2020-09-30 10:11:48 -07:00
Steven Allen 4c60d7b5ce abstract over paych messages 2020-09-30 10:04:10 -07:00
Steven Allen 23b729a056 remove proof parameter from payment channels
It never worked properly, and will be removed in actors v2.
2020-09-30 09:35:42 -07:00
Steven Allen 724306c110 update specs-actors 2020-09-30 09:23:04 -07:00
Steven Allen 4989b1cc90 Merge branch 'master' into asr/spec-v1 2020-09-30 09:19:12 -07:00
Łukasz Magiera c228598098 sectorstorage: Variable scopes are really hard 2020-09-30 18:16:07 +02:00
Łukasz Magiera a783bf9b8b storagefsm: Handle PC2 with missing replica 2020-09-30 17:53:15 +02:00
Łukasz Magiera 54fdd6ba5a sectorstorage: Variable scopes are hard 2020-09-30 17:48:48 +02:00
Łukasz Magiera 6ddea62d09 shed: gofmt 2020-09-30 17:26:24 +02:00
Łukasz Magiera 6855284d88 sectorstorage: Cancel non-running work in case of abort in sched 2020-09-30 17:26:09 +02:00
Łukasz Magiera 46a5beafe4 shed: Datastore utils 2020-09-30 17:25:33 +02:00
Łukasz Magiera 5bffea6f54 Merge pull request #4064 from filecoin-project/tvx
tvx: a test vector extraction and execution tool
2020-09-30 17:22:42 +02:00
Raúl Kripalani 1c4f8e83d7 tvx/extract-many: add batch id, change generated filename. 2020-09-30 16:11:44 +01:00
Raúl Kripalani ff8663faa0 update test-vectors submodule. 2020-09-30 14:58:22 +01:00
Raúl Kripalani f58881e966 minor fixes. 2020-09-30 14:57:24 +01:00
Łukasz Magiera d2f279c3de Print heman-readable transferred bytes in client list-transfers 2020-09-30 13:51:52 +02:00
Łukasz Magiera 4d4bab12eb Improve miner sectors list UX 2020-09-30 13:34:05 +02:00
Raúl Kripalani eb6191d0ff tvx: precursor selection modes; canonical message fetching; basefee. 2020-09-30 11:02:10 +01:00
Łukasz Magiera 54dfeb1fd9 Merge pull request #4043 from zgfzgf/test-post
add printf in TestWindowPost
2020-09-30 10:53:16 +02:00
Łukasz Magiera c2c64caefe Merge pull request #4020 from zgfzgf/post-trace
add trace wdpost
2020-09-30 10:46:05 +02:00
Łukasz Magiera 90be8d801b Merge branch 'master' into post-trace 2020-09-30 10:03:54 +02:00
Łukasz Magiera 430897c9ac Merge pull request #3445 from filecoin-project/asr/precommit-failed-fix
Fix some failed precommit handling
2020-09-30 09:35:41 +02:00
Aayush Rajasekaran c77ab47cb5 Merge pull request #4103 from filecoin-project/asr/config
Add an option to set config
2020-09-30 03:33:52 -04:00
Łukasz Magiera bc85e3ce50 Merge pull request #4107 from shaodan/worker-no-swap
Add --no-swap flag for worker
2020-09-30 09:25:57 +02:00
Łukasz Magiera 76b1ec1de0 Merge pull request #4065 from filecoin-project/asr/sync-validate
Add lotus shed util to validate a tipset
2020-09-30 09:24:47 +02:00
Aayush Rajasekaran 6abccc4d5e Add an option to set config 2020-09-30 03:19:04 -04:00
Łukasz Magiera 7a3a2f8db9 Merge pull request #3924 from filecoin-project/feat/dont-recompute-PoST-redux
Dont recompute post on revert <<redux>>
2020-09-30 09:18:46 +02:00
Łukasz Magiera 4e8ccb2158 Merge pull request #4092 from filecoin-project/fix/finalize-uns-panic
sectorstorage: Fix potential panic in FinalizeSector
2020-09-30 09:18:01 +02:00
Dan Shao 1affd498c1 Add --no-swap flag for worker 2020-09-30 14:23:35 +08:00
Aayush Rajasekaran e250429f56 Merge pull request #4106 from filecoin-project/asr/validate-address
Add an endpoint to validate whether a string is a well-formed address
2020-09-30 01:58:29 -04:00
Aayush Rajasekaran bc4cbdc895 Update docs 2020-09-30 01:45:03 -04:00
Aayush Rajasekaran a388bcfad6 Add an endpoint to validate whether a string is a well-formed address 2020-09-30 01:43:10 -04:00
Łukasz Magiera e39c5dc372 Merge pull request #4104 from filecoin-project/asr/wallet-fix
Fix wallet list
2020-09-30 07:41:10 +02:00
Aayush Rajasekaran c45c8f34a1 Parametrise whether sync validators should use cache 2020-09-30 01:39:06 -04:00
Aayush Rajasekaran 73d193bd9c Update docs 2020-09-30 01:29:04 -04:00
Aayush Rajasekaran a4e7117429 Add lotus shed util to validate a tipset 2020-09-30 01:29:04 -04:00
Aayush Rajasekaran 9fe32b7777 Fix wallet list 2020-09-30 01:25:47 -04:00
Łukasz Magiera 6025bceaa1 Merge pull request #3431 from filecoin-project/feat/docs-reorg
Docs review and re-organization
2020-09-29 22:29:58 +02:00
Łukasz Magiera 91d04ede0f Merge pull request #4051 from filecoin-project/chore/final-dealstat-version
Chore/final dealstat version
2020-09-29 19:39:16 +02:00
Łukasz Magiera 237c8c4deb Merge pull request #3868 from austinabell/async/stransition
Make state transition in validation async
2020-09-29 16:50:52 +02:00
Łukasz Magiera 0ba911279a Merge pull request #3888 from filecoin-project/feat/bench-cache
Implement caching syscalls for import-bench
2020-09-29 16:38:05 +02:00
Łukasz Magiera baef3c8dd2 sectorstorage: Fix potential panic in FinalizeSector 2020-09-29 15:22:46 +02:00
Łukasz Magiera 867ca2f25d Merge pull request #3434 from filecoin-project/feat/shed-import-object-cmd
add a command to import an ipld object into the chainstore
2020-09-29 15:02:31 +02:00
Jakub Sztandera 247a5e2c49 Go mod tidy
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:50:08 +02:00
Jakub Sztandera 7e8c6e5070 Remove statediff, fix lint, go mod tidy
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:49:47 +02:00
Jakub Sztandera 0d914ac1d4 Switch to badger
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:49:47 +02:00
Jakub Sztandera 76db65b1af Update pebble
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:49:47 +02:00
Jakub Sztandera ff8c0af8c8 Add only-import option
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:49:47 +02:00
Jakub Sztandera 55c6b88537 Add toggle for badger, flag out gas tracing
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:49:46 +02:00
Jakub Sztandera 0771c23fb0 Use pebble
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:49:46 +02:00
Jakub Sztandera 1c6214b76d Usage go-bitfield with buffer pool
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:49:45 +02:00
Jakub Sztandera b7f18b4601 Disable callers
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:49:18 +02:00
Jakub Sztandera 242a77b391 go mod tidy
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:49:18 +02:00
Jakub Sztandera 35cf69ae64 Disable bloomcache
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:49:18 +02:00
Jakub Sztandera ebc8489ff1 Add global-profile option
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:49:18 +02:00
Jakub Sztandera f21c5cbbe2 Add start-at
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:49:18 +02:00
Jakub Sztandera 01386a206c Update options
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:49:18 +02:00
Jakub Sztandera 3858309368 Add http to import bench
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:49:17 +02:00
Jakub Sztandera 782717948a Add logs
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:49:17 +02:00
Jakub Sztandera 108fe7823c Add command to trigger gc
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:49:17 +02:00
Jakub Sztandera 12a0dd3d0a <3 to linter
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:49:17 +02:00
Jakub Sztandera 1f4d1dcc58 Do not sync
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:49:17 +02:00
Jakub Sztandera 53ab17cf50 Add no import to import-bench
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:49:17 +02:00
Jakub Sztandera 79ba4598d6 Implement cache
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:49:17 +02:00
Jakub Sztandera 96193c2044 Implement bench-cache
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-29 14:49:11 +02:00
Hector Sanjuan 09e5cc90a4 Add README to documentation/en with explanations 2020-09-29 14:45:55 +02:00
Łukasz Magiera edf1875e88 Merge pull request #4003 from filecoin-project/option-to-hide-sectors
Added an option to show or not show sector info for `lotus-miner info`
2020-09-29 14:26:23 +02:00
Łukasz Magiera 1479142047 Merge pull request #3970 from filecoin-project/feat/mpool-to-wallet
refactor: move nonce generation out of mpool
2020-09-29 13:24:35 +02:00
Dirk McCormick d1c10a61dd fix: message signer - always compare with mpool nonce 2020-09-29 12:20:09 +02:00
Łukasz Magiera 8205149675 Merge pull request #4088 from filecoin-project/feat/walletlist-ux
wallet list cli: Print balances/nonces
2020-09-29 11:33:29 +02:00
Łukasz Magiera eaece306b6 wallet list cli: Print balances/nonces 2020-09-29 11:21:08 +02:00
Łukasz Magiera 0f2dcf28b1 fsm: Reuse tickets in PC1 on retry 2020-09-29 10:07:49 +02:00
Aayush Rajasekaran be9d23b329 Centralize some params in builtin 2020-09-29 02:25:43 -04:00
Steven Allen dd65e57d4b set policy correctly from test vectors 2020-09-28 17:53:11 -07:00
Steven Allen e658ab3287 fix policy test 2020-09-28 17:44:34 -07:00
Steven Allen c0e190344d check state invariants after upgrade 2020-09-28 17:42:29 -07:00
Steven Allen 1c03862854 fix policy for specs-actors update 2020-09-28 17:28:16 -07:00
Steven Allen 2315db161b cleanup state-tree loading
And remove incorrect comment.
2020-09-28 16:46:29 -07:00
Steven Allen 9344bc4e9b update api docs for new network version 2020-09-28 16:27:47 -07:00
Steven Allen 01272f850d fix state test 2020-09-28 16:23:46 -07:00
Steven Allen b95b871943 actually upgrade to actors v2 2020-09-28 16:14:51 -07:00
Steven Allen a314cfd237 process error when setting network name 2020-09-28 15:59:11 -07:00
Steven Allen c0b316fd9c finish wiring up actors v2 2020-09-28 15:58:07 -07:00
Steven Allen 3e6323a503 make setNetworkName work with any actors version 2020-09-28 15:54:48 -07:00
Steven Allen d1000e38d7 wire up network upgrade logic for v2 actors upgrade 2020-09-28 15:50:54 -07:00
Raúl Kripalani 044674487e fix double mutex. 2020-09-28 23:14:37 +01:00
Raúl Kripalani 0070d2716c Merge pull request #4078 from filecoin-project/tvx-circsupply 2020-09-28 23:12:43 +01:00
Raúl Kripalani 9b403e26e5 fix lint. 2020-09-28 23:07:45 +01:00
Raúl Kripalani 4b3b35c9de conformance: record and feed circulating supply. 2020-09-28 23:04:52 +01:00
Steven Allen c88d124954 use built-in actor ID
The init actor will not allow the account actor to exec an arbitrary actor.
2020-09-28 14:43:55 -07:00
Steven Allen 233d8a9b72 update even more imports 2020-09-28 14:25:58 -07:00
Steven Allen 52e064dabb add gas numbers for v2 2020-09-28 14:09:46 -07:00
Steven Allen 1a7fb06dd9 improve lotuspond
There's still some work to do here, but it should now work better with the
network upgrade.
2020-09-28 14:09:04 -07:00
Steven Allen 6fcf57ed1f use actor state abstraction in payment channel test 2020-09-28 13:34:14 -07:00
Steven Allen ca9448bc11 rename actors v1 -> actors v2
The actual actors version is v2, not v1. Using Version1 internally was really confusing.
2020-09-28 13:13:18 -07:00
Steven Allen 2049daa008 fix actor imports 2020-09-28 13:12:41 -07:00
Łukasz Magiera 1e6a69f8aa localworker: Don't mark calls as returned when returning fails 2020-09-28 22:10:02 +02:00
Łukasz Magiera 9bd2537971 stores: Fix error printing in http handler 2020-09-28 22:06:03 +02:00
Steven Allen 947d1e2902 Merge branch 'master' into asr/spec-v1 2020-09-28 12:53:40 -07:00
Steven Allen 5f3160cf5b continue expanding vm abstraction layer 2020-09-28 12:48:08 -07:00
jennijuju 64f24fd276 Added an option to hide sector info for lotus-miner info 2020-09-28 15:42:50 -04:00
Łukasz Magiera bf554d0e43 worker: Redeclare storage early on reconnect 2020-09-28 21:11:25 +02:00
Łukasz Magiera 810c767200 worker: Redeclare storage on reconnect 2020-09-28 21:06:49 +02:00
jennijuju 124bd0c765 Always use default 720h for setask duration and hide the duration param option. 2020-09-28 14:58:46 -04:00
Łukasz Magiera 4ba7af6061 worker: Mark return methods as retry-safe 2020-09-28 20:46:44 +02:00
Łukasz Magiera 4b61f1756e Merge pull request #4070 from filecoin-project/feat/import-ux
snapshot import progress bar, http support
2020-09-28 20:25:53 +02:00
Jakub Sztandera 2633198e6c Merge pull request #4056 from zgfzgf/tipset-equals
optimize Tipset equals
2020-09-28 20:15:54 +02:00
Łukasz Magiera b84cc46c3d Merge pull request #4074 from filecoin-project/refactor/chain-store-ts-parallel
fetch tipset blocks in parallel
2020-09-28 18:43:43 +02:00
Łukasz Magiera 86cf3c835e worker: Reconnect correctly 2020-09-28 18:30:45 +02:00
Raúl Kripalani 96f882860f add extract-many command. 2020-09-28 17:02:56 +01:00
Dirk McCormick cfe6f595b0 fix: unsafe append in LoadTipSet 2020-09-28 16:54:18 +02:00
Dirk McCormick 6b16d48bad refactor: fetch tipset blocks in parallel 2020-09-28 15:56:44 +02:00
Raúl Kripalani 9f6862a456 fix lint. 2020-09-28 13:22:56 +01:00
Raúl Kripalani 4c9717187f tvx/extract: small refactor. 2020-09-28 13:19:45 +01:00
Raúl Kripalani a0dffb44d3 tvx/extract: perform sanity check on receipt. 2020-09-28 13:11:34 +01:00
Raúl Kripalani 8f3be78667 tvx/extract: allow passing in block to speed things up. 2020-09-28 13:00:07 +01:00
Raúl Kripalani dfdcbd184d add --repo flag. 2020-09-28 12:35:01 +01:00
Łukasz Magiera 9e7d6823b1 sectorstorage: Cleanup callToWork mapping after work is done 2020-09-28 13:34:45 +02:00
Raúl Kripalani f05a40feed use lotus CLI package; document API endpoint setting in usage. 2020-09-28 12:27:42 +01:00
Łukasz Magiera aa7090df49 Merge remote-tracking branch 'origin/master' into feat/async-restartable-workers 2020-09-28 12:55:57 +02:00
Łukasz Magiera f809529699 daemon cmd: Support imports straight from http 2020-09-28 12:30:12 +02:00
Łukasz Magiera a3145bae07 daemon cmd: Add progress bar to chain import 2020-09-28 12:17:54 +02:00
Łukasz Magiera a9d1ca4d83 Change order in miner sectors list 2020-09-28 12:08:09 +02:00
Łukasz Magiera b14afba859 Merge pull request #4058 from zgfzgf/miner-debug
miner debug where injectNulls != 0
2020-09-28 11:52:42 +02:00
Łukasz Magiera c33b3dfa55 Merge pull request #4022 from filecoin-project/feat/dont-recompute-PoST-abstract
Use abstract types for Dont recompute post on revert
2020-09-28 11:44:38 +02:00
Łukasz Magiera c448d85cf5 Merge pull request #4050 from filecoin-project/fix/stats-network-power
Add back network power to stats
2020-09-28 11:33:03 +02:00
Łukasz Magiera bc495a5c8c Merge pull request #4049 from filecoin-project/fix/miner-power-cli
fix GetPower with no miner address
2020-09-28 11:30:54 +02:00
Łukasz Magiera 18dac6d415 Merge pull request #4067 from IPFSMain-Official/master
add ipfsmain bootstrapper
2020-09-28 09:35:23 +02:00
Łukasz Magiera 5a72662d26 Merge branch 'master' into master 2020-09-28 09:22:21 +02:00
Łukasz Magiera b479988044 Merge pull request #4061 from filecoin-project/dev
Post-upgrade staging branch
2020-09-28 09:20:47 +02:00
刘林欣 a2d24b5b33 add ipfsmain bootstrapper 2020-09-28 13:53:29 +08:00
Raúl Kripalani 9a355c4bc5 fix lint errors. 2020-09-27 21:11:32 +01:00
Raúl Kripalani fe869c9c22 address review comments; lint. 2020-09-27 21:06:07 +01:00
Raúl Kripalani f5f23f7291 driver: option for VM flushing. 2020-09-27 20:55:09 +01:00
Raúl Kripalani a712c109d8 tvx/extract: print confirmation. 2020-09-27 20:30:32 +01:00
Raúl Kripalani e5c56da321 move conformance tvx tool to lotus. 2020-09-27 20:10:05 +01:00
Peter Rabbitson be5dc2c57f Walk back 10 epochs for stat generation 2020-09-27 20:45:45 +02:00
Peter Rabbitson e4c1f090af Disable exclusion of miner-associated addresses 2020-09-27 20:44:50 +02:00
zgfzgf 7a14455ac8 miner debug where injectNulls != 0 2020-09-27 15:01:42 +08:00
zgfzgf 04876c663e modify tipset Equals 2020-09-27 10:17:06 +08:00
zgfzgf 70071e273d optimize tipset Equals func 2020-09-27 09:58:37 +08:00
Peter Rabbitson fb3bcc4ce5 Add startup warning 2020-09-26 21:49:05 +02:00
Peter Rabbitson 1483f1e59a Add filtering of addresses associated with miners 2020-09-26 21:45:34 +02:00
Peter Rabbitson 10cdbadd82 Arrange json as the frontend expects it 2020-09-26 21:44:40 +02:00
Peter Rabbitson 8955b8d8a7 Centralize filtering, output wallet addresses 2020-09-26 21:44:36 +02:00
Travis Person 1c5cb50da3 Add back network power to stats 2020-09-26 17:09:16 +00:00
whyrusleeping bddd6dd8a8 fix GetPower with no miner address 2020-09-26 11:06:16 -05:00
Łukasz Magiera cf71f034dc Merge remote-tracking branch 'origin/dev' into feat/async-restartable-workers 2020-09-26 12:35:32 +02:00
zgfzgf 650725d71e add printf 2020-09-26 17:30:58 +08:00
Łukasz Magiera c243378cab Merge pull request #4032 from filecoin-project/fix/bench-2k
Move policy change to seal bench
2020-09-26 10:27:03 +02:00
Łukasz Magiera e15065b142 Merge pull request #4038 from filecoin-project/feat/state-compute-json
add json output to state compute
2020-09-26 10:20:30 +02:00
Łukasz Magiera 71fa198eee Merge pull request #4004 from ArseniiPetrovich/patch-1
Add glif node to bootstrap peers
2020-09-26 10:19:02 +02:00
Łukasz Magiera ca1715616f Merge branch 'dev' into patch-1 2020-09-26 10:18:47 +02:00
Łukasz Magiera b12bade989 Merge pull request #4007 from maobisheng/master
Add new booststrappers
2020-09-26 10:18:04 +02:00
Łukasz Magiera 28566b4d64 Merge branch 'dev' into master 2020-09-26 10:17:45 +02:00
Łukasz Magiera dfd1473384 Merge pull request #4041 from ipfs-force-community/master
Add one more node located in China
2020-09-26 10:16:01 +02:00
Łukasz Magiera 3fe0aa5026 Merge pull request #4030 from filecoin-project/feat/export-logging
add logging to chain export
2020-09-26 10:14:32 +02:00
Łukasz Magiera 6a502090f4 Merge pull request #4028 from filecoin-project/asr/address-update
Add an envvar to set address network version
2020-09-26 10:14:10 +02:00
Łukasz Magiera 3d40fb294e Merge pull request #3998 from filecoin-project/deps/update-ffi-blst-fix
update ffi to code with blst fixes
2020-09-26 10:12:34 +02:00
Steven Li 81a30cbf06 Add one more node located in China 2020-09-26 16:01:10 +08:00
Łukasz Magiera 2c1d96bcaa Merge pull request #4040 from filecoin-project/asr/changelog
Lotus version 0.8.0
2020-09-26 09:16:49 +02:00
Aayush Rajasekaran 45eadc1b3a Lotus version 0.8.0 2020-09-26 03:13:20 -04:00
Łukasz Magiera b453b8da99 Merge pull request #4039 from filecoin-project/feat/v0.8-actors
Ignition upgrades, for release v0.8.0
2020-09-26 09:13:07 +02:00
whyrusleeping 567261e2c7 set upgrade heights for testground builds 2020-09-26 00:03:03 -07:00
Aayush Rajasekaran 12e97dbea7 Fix docs and linter 2020-09-26 02:59:24 -04:00
Łukasz Magiera ef28ebb14a Ignition upgrades, much excite. 2020-09-25 23:55:37 -07:00
whyrusleeping 8545c08f30 add json output to state compute 2020-09-25 23:47:59 -07:00
Jakub Sztandera eaf3424938 Merge pull request #4033 from filecoin-project/asr/add-supported-proof
Fix AddSupportedProofTypes
2020-09-26 00:13:53 +02:00
Steven Allen a5f13a5b31 Test supported proof types. 2020-09-25 14:36:36 -07:00
Aayush Rajasekaran d8431ff611 Fix AddSupportedProofTypes 2020-09-25 17:33:25 -04:00
Jakub Sztandera 4eec4a0141 Move policy change to seal bench
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-25 23:28:12 +02:00
Steven Allen 6db6a90b1e Merge pull request #4026 from filecoin-project/steb/fix-status-inactive
return an error when we fail to find a sector when checking sector expiration
2020-09-25 13:28:27 -07:00
Travis Person a13d10e42d add logging to chain export 2020-09-25 20:20:18 +00:00
Steven Allen 271ceb968a add v1 support to the state tree 2020-09-25 12:55:10 -07:00
Steven Allen b8d9d7894f fix vm version 2020-09-25 12:52:16 -07:00
Steven Allen 7d3bd146e6 rebase fixup 2020-09-25 12:51:02 -07:00
Steven Allen 8b35f480c4 initial vm conversion
We're probably going to want to change some of these design decisions down the
road, but this is a good starting point.

* We may want to use a more general test for "is actor valid at epoch". Maybe
just a function?
* I'd like to push some of the actor metadata down into the actor types
themselves. Ideally, we'd be able to register actors with a simple
`Register(validation, manyActors...)` call.
2020-09-25 12:49:39 -07:00
Steven Allen d9656f5220 add a generic load method for actor state
This will make it easier to load arbitrary actors. We can:

* Type switch (sort of unsafe, may want marker methods?)
* Use this with `vm.MutateActorState`.
2020-09-25 12:49:39 -07:00
Steven Allen 87351fa35c move version to actors, from builtin
Otherwise, we're going to end up with an import cycle between the adt and this
version.
2020-09-25 12:49:39 -07:00
Steven Allen edb31e606a correctly load new actors 2020-09-25 12:49:39 -07:00
Steven Allen 8806f27220 fix runtime reflection for upgrade 2020-09-25 12:49:39 -07:00
Steven Allen 858f11992f compile fix 2020-09-25 12:49:39 -07:00
Steven Allen 35562bd2f9 fixup v1 actors for new methods
Also, correctly handle multiple ADT versions.
2020-09-25 12:49:39 -07:00
Aayush Rajasekaran ebad0ded3d Introduce v1 actors 2020-09-25 12:49:39 -07:00
Aayush Rajasekaran 60e43ccbb1 Add an envvar to set address network version 2020-09-25 15:45:27 -04:00
Steven Allen ddcbcdea48 test sector status on expiring sectors 2020-09-25 12:16:35 -07:00
Łukasz Magiera 3491e7b707 Merge pull request #4013 from filecoin-project/feat/update-markets-0.6.3
Update markets to 0.6.3
2020-09-25 20:42:04 +02:00
Steven Allen bdc782617f return an error when we fail to find a sector when checking sector expiration
Returning nil, nil is a footgun.

fix: https://github.com/filecoin-project/lotus/issues/3984
2020-09-25 11:28:38 -07:00
Dirk McCormick 80a7ed8116 refactor: use abstract types instead of specs-actors 2020-09-25 15:54:27 +02:00
zgfzgf 13b38815c2 add trace wdpost 2020-09-25 20:31:07 +08:00
MaoBisheng-IPFSUNION 9dfce400a7 delate 2020-09-25 17:36:57 +08:00
hannahhoward 4ff38aa856 feat(markets): update to 0.6.3 2020-09-25 02:35:34 -07:00
Łukasz Magiera e5873d5dea Merge pull request #4009 from filecoin-project/asr/fractional-asks
Correct helptext
2020-09-25 09:00:02 +02:00
Aayush Rajasekaran 8fbbebbaf1 Correct helptext around set ask 2020-09-25 00:11:10 -04:00
MaoBisheng-IPFSUNION 89bfe84f36 add new booststrappers
we hope to add two booststrappers for the filecoin network to improve the network synchronization
2020-09-25 10:18:12 +08:00
Arsenii Petrovich 585b8cc51d Add glif node to bootstrap peers 2020-09-25 03:54:29 +03:00
Łukasz Magiera a8fcb86c10 miner allinfo: Don't fail if sector status fails 2020-09-24 22:17:20 +02:00
whyrusleeping 306c098d30 also update our vendored blst repo 2020-09-24 11:32:38 -07:00
whyrusleeping 6db37b72a8 update ffi to code with blst fixes 2020-09-24 11:05:21 -07:00
Łukasz Magiera 80ee3be4d0 Merge pull request #3870 from filecoin-project/asr/msig-set-locked
Add CLIs for new multisig LockBalance method
2020-09-24 19:42:47 +02:00
Hector Sanjuan e48c525053 Re-add jaeger-tracing 2020-09-24 19:41:14 +02:00
Łukasz Magiera cf9dfdb972 Multisig: fix build 2020-09-24 19:26:32 +02:00
Łukasz Magiera 6ca5308c82 Merge pull request #3996 from filecoin-project/conformance-ntwork-upgrade-adjustments
small adjustments following network upgradability changes
2020-09-24 19:24:45 +02:00
Raúl Kripalani 68663060dc add state.StateTree#Version() accessor. 2020-09-24 17:58:49 +01:00
Raúl Kripalani 87b48c94a6 conformance: supply network version to driver. 2020-09-24 17:58:34 +01:00
Jakub Sztandera 45d8cb08ba Merge pull request #3995 from filecoin-project/feat/more-stateroot-stats
add some more big pictures stats to stateroot stat
2020-09-24 18:57:05 +02:00
Łukasz Magiera 130ae3ccb3 Multisig: Fix from flag descriptions 2020-09-24 18:46:21 +02:00
whyrusleeping 4eaa05db52 add some more big pictures stats to stateroot stat 2020-09-24 09:40:49 -07:00
Łukasz Magiera a19023fada Merge remote-tracking branch 'origin/master' into asr/msig-set-locked 2020-09-24 18:38:02 +02:00
Łukasz Magiera 85caa48814 Merge pull request #3991 from filecoin-project/feat/nicer-syncwait
Make sync wait nicer
2020-09-24 17:03:21 +02:00
Łukasz Magiera cdda66a154 Merge pull request #3942 from filecoin-project/3941-deadline-info
3941: Added cmd `lotus-miner proving deadline <deadline index>`
2020-09-24 16:25:45 +02:00
jennijuju f8f335df55 3941: Added cmd `lotus-miner proving deadline <deadline index>"
- To show the current proving period deadline information of given deadline index.
- It outputs the following:
        - number of partitions in this deadline
        - partitions numbers has submitted PoSt since the current proving period started
        - if the deadline is the current proving deadline
        - for each patition, shows the amount of the sectors in this partition, and their numbers. Also, shows the number of fault sectors and corresponding sector numbers.
2020-09-24 16:23:12 +02:00
Łukasz Magiera 28b46ad08c Merge branch 'zgfzgf-miner-break' into master 2020-09-24 16:03:47 +02:00
Łukasz Magiera 43323b2188 Use continue instead of goto 2020-09-24 16:03:24 +02:00
Łukasz Magiera 17a84c9a2c Merge pull request #3975 from filecoin-project/steb/abstract-actor-policy
Add some actors policy setters for testing
2020-09-24 15:51:41 +02:00
Dirk McCormick 7eb9bec13f feat: dont recompute post on submit redux 2020-09-24 14:38:33 +02:00
Łukasz Magiera 2867b31d2b Merge pull request #3208 from austinabell/extratsload
Update beacon entry load error message
2020-09-24 14:19:00 +02:00
Dirk McCormick 3c524ac0e0 refactor: move nonce generation from mpool to wallet 2020-09-24 14:09:42 +02:00
Łukasz Magiera 1a70dd4fb4 Merge pull request #3977 from filecoin-project/steb/remove-cbor-abstraction
Remove a misleading miner actor abstraction
2020-09-24 14:02:59 +02:00
Łukasz Magiera 15eddf0c96 Make sync wait nicer 2020-09-24 13:39:49 +02:00
Łukasz Magiera bbcad52ce0 Merge pull request #3980 from filecoin-project/feat/batch-blockstore-copy
batch blockstore copies after block validation
2020-09-24 13:07:16 +02:00
Łukasz Magiera ded3a30f55 fix lint 2020-09-24 11:56:54 +02:00
Łukasz Magiera 04ee53e061 sectorstorage: Show task type of ret-wait jobs 2020-09-24 11:55:11 +02:00
whyrusleeping 38e256cece add some tracing to the vm's blockstore copy 2020-09-23 20:19:20 -07:00
whyrusleeping b4e03d1759 batch blockstore copies after block validation 2020-09-23 18:53:28 -07:00
Aayush Rajasekaran efd2dff0ca Merge pull request #3978 from filecoin-project/asr/changelog
Lotus version 0.7.2
2020-09-23 20:50:12 -04:00
Aayush Rajasekaran 44748775ff Fixup changelog: 2020-09-23 20:49:31 -04:00
Aayush Rajasekaran f729c6b7f5 Update docs 2020-09-23 18:25:45 -04:00
Aayush Rajasekaran 22fafc7054 Lotus version 0.7.2 2020-09-23 18:09:01 -04:00
Steven Allen 32a699d6a3 Add some actors policy setters for testing
Addresses:
* https://github.com/filecoin-project/lotus/pull/3781/files/a307e4593a005888395db34e5af4691ee50d765d#r491966115
* https://github.com/filecoin-project/lotus/pull/3781/files/a307e4593a005888395db34e5af4691ee50d765d#r491966634

Note: This puts everything into a policy package to avoid a dependency cycle
between the build package, the miner package, and the types package. This is
also why I introduced a GetPreCommitChallengeDelay function and removed the
variable.
2020-09-23 15:00:52 -07:00
Steven Allen 46f5b62a76 Remove a misleading miner actor abstraction
We shouldn't implement CBOR functions on the "abstract" miner info. Otherwise,
we could end up trying to actually _use_ this "abstract" info when decoding
state (which won't work across version).

Also remove the use of these CBOR functions, and instead explicitly use miner0
types. We'll have to abstract over versions eventually, but we'll probably need
some form of abstract miner builder (or maybe even adding some "add sector",
etc. functions to the current miner abstraction?
2020-09-23 14:49:53 -07:00
Aayush Rajasekaran e09d291e5d Merge pull request #3939 from filecoin-project/fix/chain-sync-validation
Validate chain sync response indices when fetching messages
2020-09-23 17:35:14 -04:00
Łukasz Magiera f57652524c Merge remote-tracking branch 'origin/master' into feat/async-restartable-workers 2020-09-23 22:31:27 +02:00
Łukasz Magiera 97a97fe992 Merge pull request #3944 from filecoin-project/update-state-arg-name
When doing `sectors update-state`, show a list of existing states if user inputs an invalid one.
2020-09-23 22:19:15 +02:00
Łukasz Magiera f4f5ef6f83 Merge pull request #3963 from filecoin-project/feat/dealstats
Add basic deal stats api server for spacerace slingshot
2020-09-23 22:17:03 +02:00
Łukasz Magiera a1281273bc shed dealtracker: fix lint, env var filter 2020-09-23 22:10:02 +02:00
Łukasz Magiera 42216184e1 Merge pull request #3974 from filecoin-project/feat/update-markets-0.6.2
Update markets v0.6.2
2020-09-23 22:00:15 +02:00
Łukasz Magiera 2c945d33ee Merge pull request #3976 from filecoin-project/fix/state-miner-sectors
fix out-of-bounds when loading all sector infos
2020-09-23 21:56:12 +02:00
Steven Allen 1c1d23d142 fix out-of-bounds when loading all sector infos
fixes #3972
2020-09-23 12:40:44 -07:00
hannahhoward 3fc791b0e8 feat(markets): update markets v0.6.2 2020-09-23 12:17:16 -07:00
Łukasz Magiera 7d39542522 Merge pull request #3741 from filecoin-project/feat/chain-delete-obj
Delete a chain store object
2020-09-23 19:34:02 +02:00
Łukasz Magiera 6c5ed3f07f Some safeguards on chain delete-obj 2020-09-23 19:31:46 +02:00
Łukasz Magiera d817dceb05 Show lost calls in sealing jobs cli 2020-09-23 19:26:35 +02:00
Łukasz Magiera a2278e26af Merge pull request #3887 from filecoin-project/feat/parallel-sync
Parallel fetch for chain sync
2020-09-23 19:24:54 +02:00
Łukasz Magiera b28b8b9649 Merge pull request #3971 from filecoin-project/init-remove
add init.State#Remove() for testing.
2020-09-23 19:22:12 +02:00
Raúl Kripalani f1ab1af617 add init.State#Remove() for testing. 2020-09-23 17:42:01 +01:00
jennijuju 91a43c477c When doing sectors update-state, show a list of existing states if user inputs an invalid one. 2020-09-23 12:34:34 -04:00
Łukasz Magiera c17f0d7e61 sectorstorage: Fix panic in returnResult 2020-09-23 17:37:05 +02:00
Łukasz Magiera 3003789288 worker: Use a real datastore for keeping track of calls 2020-09-23 16:12:15 +02:00
Łukasz Magiera 86c222ab58 sectorstorage: fix work tracking 2020-09-23 14:56:50 +02:00
zgfzgf a4ade158f4 change minerStop to minerLoop 2020-09-23 20:24:19 +08:00
Łukasz Magiera ce6b92484f Merge remote-tracking branch 'origin/master' into feat/async-restartable-workers 2020-09-23 11:31:21 +02:00
Łukasz Magiera c46e1574dd Merge pull request #3781 from filecoin-project/refactor/net-upgrade
Network upgrade support
2020-09-23 11:24:24 +02:00
Aayush Rajasekaran a876a0ba44 Use actor state addresses 2020-09-23 02:32:40 -04:00
Aayush Rajasekaran 819180f739 Implement inefficient OnAddressMapChange predicate 2020-09-23 02:15:01 -04:00
Aayush Rajasekaran 476e7992e8 Add an error return to all actor state interface methods 2020-09-23 01:51:38 -04:00
Aayush Rajasekaran e27fc03f55 Reward state interface only needs cbor.Marshaler 2020-09-23 01:42:10 -04:00
Aayush Rajasekaran ed4bf9b8fe API shouldn't depend on actors directly 2020-09-23 00:51:12 -04:00
Steven Allen 773714792f update oni 2020-09-22 18:40:03 -07:00
Lucas Molas dcf2735836 move validation from protocol to API 2020-09-22 20:19:31 -03:00
Aayush Rajasekaran 77f81fc49b Test fix 2020-09-22 19:07:32 -04:00
Łukasz Magiera 6185e157e9 sectorstorage: calltracker: work around cbor-gen bytearray len limit 2020-09-23 00:29:10 +02:00
Łukasz Magiera 04ad1791b0 localworker: Fix contexts 2020-09-23 00:10:36 +02:00
Łukasz Magiera bb5cc06677 Fix workid param hash 2020-09-22 23:33:13 +02:00
Steven Allen 46fb0e74cd add deal state iterator 2020-09-22 14:09:33 -07:00
Steven Allen 2967c4ec10 use abstract actor type methods 2020-09-22 12:02:29 -07:00
whyrusleeping 88ada66280 finish up the total bytes endpoint 2020-09-22 13:31:01 -05:00
whyrusleeping 3cf2fd595f fix appending to array 2020-09-22 13:27:58 -05:00
whyrusleeping 3153ab9ae3 allow graceful shutdown 2020-09-22 13:24:49 -05:00
Steven Allen c91774be3b remove old comment 2020-09-22 11:19:28 -07:00
Travis Person c66f087f4c lotus-miner: add more help text to storage / attach 2020-09-22 18:15:42 +00:00
Steven Allen 441d7ff790 cleanup imports some more 2020-09-22 11:14:55 -07:00
Steven Allen bc24fdbd14 finish migrating statemanager 2020-09-22 11:09:56 -07:00
Steven Allen ab070f2ebe copy actor object when iterating over actors
This is a pretty big footgun.
2020-09-22 11:09:41 -07:00
Steven Allen 5314ba8c6d remove ptr indirection 2020-09-22 10:55:29 -07:00
whyrusleeping f96698b54d finish up other endpoints 2020-09-22 12:54:39 -05:00
Steven Allen fc15888697 fixup some imports 2020-09-22 10:52:23 -07:00
Łukasz Magiera 706f4f2ef5 worker: Don't die with the connection 2020-09-22 18:36:44 +02:00
whyrusleeping 9b91628d85 begin adding simple api server for deal stats 2020-09-22 11:05:12 -05:00
zgfzgf 001ba17d37 break error 2020-09-22 15:21:35 +08:00
Aayush Rajasekaran 1dc69e397e Resolve some unnecessary actor upgrade TODOs 2020-09-22 01:34:21 -04:00
Aayush Rajasekaran d56da1b014 Refinements to stmgr and utils 2020-09-22 01:34:20 -04:00
Steven Allen d33dd4f7bc more renames 2020-09-21 16:01:29 -07:00
Łukasz Magiera b8865fb182 workers: Mark on-restart-failed returned tasks as returned 2020-09-22 01:00:28 +02:00
Łukasz Magiera 03c3d8bdb3 workers: Return unfinished tasks on restart 2020-09-22 00:52:33 +02:00
Steven Allen 63f026f7c3 migrate some more imports 2020-09-21 15:24:45 -07:00
Steven Allen 3f0106cfe5 migrate lotus-shed/genesis-verify to actor abstraction 2020-09-21 15:18:30 -07:00
Steven Allen 4bab784e40 migrate lotus-shed verifreg to specs-actors abstractions 2020-09-21 15:04:39 -07:00
Steven Allen 916421b247 convert lotus-shed balances 2020-09-21 13:43:47 -07:00
Łukasz Magiera aa5bd7bc17 Merge remote-tracking branch 'origin/master' into feat/async-restartable-workers 2020-09-21 22:36:16 +02:00
Steven Allen a41bf74bad fix: remove incorrect variable 2020-09-21 13:25:03 -07:00
Steven Allen 0ab2459fce convert multisig to new actor abstractions 2020-09-21 13:13:38 -07:00
Steven Allen f9a896f6f2 fix compile 2020-09-21 13:10:41 -07:00
Steven Allen 24ae9205fe cross-version state tree diff 2020-09-21 12:50:12 -07:00
Steven Allen 4cf0c105eb optimize sector loading
And avoid exposing "arrays" via the miner abstraction. We may change these
structures later.
2020-09-21 12:12:08 -07:00
Steven Allen 025663118f non-destructive diff 2020-09-21 10:30:33 -07:00
Łukasz Magiera f7934b083c Merge remote-tracking branch 'origin/master' into refactor/net-upgrade 2020-09-21 19:10:18 +02:00
Łukasz Magiera 46ed0142db Merge pull request #3898 from kenshyx/patch-1
replace Requires with Wants
2020-09-21 19:06:31 +02:00
Hector Sanjuan ad3db0e83c Move unclassified docs back to the docs root 2020-09-21 19:05:49 +02:00
Łukasz Magiera 29913f4c41 Merge pull request #3903 from filecoin-project/3605-sector-list-option
Add an option to hide sectors in Removed from `sectors list`.
2020-09-21 19:04:11 +02:00
Łukasz Magiera 1096f8acc6 miner: Invert show-removed option in sectors list 2020-09-21 18:59:05 +02:00
Łukasz Magiera 14588d1fd2 Merge pull request #3933 from filecoin-project/feat/lotus-shed-consensus
lotus-shed: add consensus check command
2020-09-21 18:54:36 +02:00
Łukasz Magiera 901f7d2b4c Merge pull request #3926 from shepf/master
sync wait add heightDiff maybe useful!
2020-09-21 18:51:45 +02:00
Hector Sanjuan a5e7fd8f5c Re-add docs-check step to circle 2020-09-21 18:43:57 +02:00
Łukasz Magiera 0b5e4a9612 Make GetSectorsForWinningPoSt fast again 2020-09-21 18:28:32 +02:00
vyzo 5663b2d697 change GetChainMessages api to include tipsets for validation 2020-09-21 18:58:52 +03:00
vyzo 44b52941f7 add option to validate messages against expected tipset 2020-09-21 18:50:41 +03:00
vyzo 58a85f378c refactor response compressed index validation into its own function 2020-09-21 18:33:31 +03:00
Raúl Kripalani d3ddd3bff9 Merge pull request #3860 from filecoin-project/refactor/chaos-caller-validation2 2020-09-21 12:55:39 +01:00
Alan Shaw d9f2b909ac chore: update test-vectors 2020-09-21 11:58:45 +01:00
Alan Shaw a79291070e chore: update test-vectors 2020-09-21 11:53:38 +01:00
Alan Shaw d9951cdff4 fix: regen 2020-09-21 10:10:31 +01:00
Alan Shaw c1a9cf7edd refactor: renames 2020-09-21 10:09:05 +01:00
Alan Shaw dfaad08a8b fix: update cbor gen file 2020-09-21 10:09:05 +01:00
Alan Shaw d607ca6118 refactor: remove IsReceiver branch 2020-09-21 10:09:05 +01:00
Alan Shaw 49a94b7cba chore: appease linter 2020-09-21 10:09:05 +01:00
Alan Shaw ab53abf04e feat: add CallerValidationBranchIsReceiver and tests 2020-09-21 10:09:05 +01:00
Alan Shaw cfa041ca8a refactor: chaos caller validation 2020-09-21 10:09:01 +01:00
Łukasz Magiera a307e4593a wdpost: Fix TestWDPostDoPost 2020-09-21 10:06:19 +02:00
Aayush Rajasekaran 286fe04271 Add some TODOs 2020-09-21 02:52:45 -04:00
vyzo f135ec8468 fix handling of end of sync 2020-09-21 09:21:25 +03:00
Aayush Rajasekaran b355eb75eb Add compile-time checks that actors interfaces are correctly implemented 2020-09-21 02:19:32 -04:00
Aayush Rajasekaran a95e34f742 Fix build 2020-09-21 02:02:33 -04:00
Aayush Rajasekaran ed285f1114 Abstract SectorOnChainInfo and SectorPreCommitOnChainInfo 2020-09-21 01:09:42 -04:00
Łukasz Magiera b25dd2a00d More correct / fasterer GetSectorsForWinningPoSt 2020-09-20 23:04:45 +02:00
Travis Person b3d0a5fb4a lotus-shed: add consensus check command 2020-09-20 20:26:20 +00:00
Łukasz Magiera 0d2c8196c6 Merge pull request #3927 from firesWu/master
fix `lotus-miner storage find` error
2020-09-20 12:47:48 +02:00
Jerry c401d2ec4e fix storage find error 2020-09-19 15:48:02 +08:00
shepf 6b40e1e30d sync wait add heightDiff maybe useful! 2020-09-19 14:04:48 +08:00
Aayush Rajasekaran 7c3f638f68 Abstract FilterEstimate, PreCommitDepositForPower, and InitialPledgeForPower 2020-09-19 00:41:24 -04:00
Travis Person e6bbc03ca8 lotus-pcr: update miner recovery 2020-09-19 02:09:05 +00:00
Travis Person e39036dd49 lotus-pcr: find miners command 2020-09-18 23:17:04 +00:00
Travis Person 26de0db757 lotus-pcr: add recover-miners command 2020-09-18 23:17:04 +00:00
Steven Allen 35bce5a5c6 revert post changes
1. Calling the specific partition/deadline APIs is faster.
2. It's _much_ easier to test this way.
2020-09-18 15:40:49 -07:00
Steven Allen 1bf3b4989d rename imports to match actors code
`sed -i 's/\bv0\(\w\)\(\w*\)/\L\1\E\20/g' **/*.go`
2020-09-18 14:59:27 -07:00
Steven Allen c130806c37 compile fix 2020-09-18 14:59:14 -07:00
Steven Allen f741ce6e30 fixup some more imports 2020-09-18 14:51:18 -07:00
Steven Allen 4a7055c328 fix state loading in vm 2020-09-18 14:46:55 -07:00
Steven Allen 8285eda8e5 migrate storage miner info 2020-09-18 14:46:42 -07:00
Steven Allen e60027c00a remove todo 2020-09-18 14:22:38 -07:00
Steven Allen 24df873498 rename imports 2020-09-18 14:21:05 -07:00
Steven Allen 8747c6083e abstract over account actor 2020-09-18 14:20:53 -07:00
Łukasz Magiera 6050401652 Merge pull request #3925 from filecoin-project/feat/log-shutdown
log shutdown method for lotus daemon and miner
2020-09-18 23:15:41 +02:00
Steven Allen 298efa221c fix lint errors 2020-09-18 13:52:07 -07:00
Steven Allen fb2b25c297 finish upgrading chainwatch 2020-09-18 13:43:30 -07:00
Łukasz Magiera 7109e95f5e Merge pull request #3881 from filcloud/issue-3626-SectorState
fix SectorState
2020-09-18 21:30:18 +02:00
Aayush Rajasekaran c3046f487c Don't use -1 as default sector number 2020-09-18 14:41:03 -04:00
Łukasz Magiera ccd0a67b01 wip fixing wdpost tests 2020-09-18 20:34:23 +02:00
Travis Person eadc61c37a log shutdown method for lotus daemon and miner 2020-09-18 18:07:58 +00:00
Łukasz Magiera 70faa36b7f Merge remote-tracking branch 'origin/master' into refactor/net-upgrade 2020-09-18 19:29:06 +02:00
Raúl Kripalani 9afdda4584 Merge pull request #3892 from filcloud/fix-gen
fix conformance gen
2020-09-18 14:23:57 +01:00
Hector Sanjuan 9e2df907f8 Merge remote-tracking branch 'origin/master' into feat/docs-reorg 2020-09-18 15:23:42 +02:00
Łukasz Magiera 0dfd4f3e63 Merge pull request #3914 from filecoin-project/feat/lotus-shed-more
Add keyinfo verify and jwt token command to lotus-shed
2020-09-18 12:34:52 +02:00
Łukasz Magiera 0cd45ab82b Merge pull request #3919 from filecoin-project/jennijuju-patch-1
Update build and setup instruction link
2020-09-18 12:31:52 +02:00
Jennifer 37108ebf8f Update build and setup instruction link
Update the link since we deprecated lotus.sh and migrates it to doc.Filecoin
2020-09-18 04:36:27 -04:00
Aayush Rajasekaran 694463ffbe More lint fixes 2020-09-18 03:06:28 -04:00
vyzo 3c72461969 MpoolPushUntrusted API for gateway 2020-09-18 09:40:43 +03:00
Aayush Rajasekaran fce423c743 Appease the linter and get everything building 2020-09-18 02:14:18 -04:00
Aayush Rajasekaran 37de154a7c Fixup tests 2020-09-18 01:56:21 -04:00
Steven Allen daa441b989 simplify market diff 2020-09-17 21:48:50 -07:00
Steven Allen 8bd6791e58 more fixups 2020-09-17 21:44:10 -07:00
Steven Allen f2a0779bb9 remove specs-actors import 2020-09-17 21:41:36 -07:00
Steven Allen b2ee59024f improve diff logic
* Make diffing work across versions.
* Start porting more chainwatch logic.
2020-09-17 21:39:34 -07:00
Travis Person ac7007d1d0 lotus-shed: add jwt token command 2020-09-18 04:05:03 +00:00
Travis Person db2a20da6c lotus-shed: add keyinfo verify 2020-09-18 03:59:00 +00:00
Aayush Rajasekaran 4121063ca4 Merge pull request #3905 from filecoin-project/asr/changelog
Lotus version 0.7.1
2020-09-17 21:32:04 -04:00
Aayush Rajasekaran aa081dbc6d Lotus version 0.7.1 2020-09-17 21:31:47 -04:00
Łukasz Magiera 984eee8cd6 Merge pull request #3909 from filecoin-project/fix/post-no-skip
wdpost: Only add proven partitions to message params
2020-09-18 03:14:05 +02:00
Łukasz Magiera 26bbd9fb9d wdpost: append is hard 2020-09-18 03:00:31 +02:00
Łukasz Magiera 57c1eac37a gofmt 2020-09-18 02:40:01 +02:00
Łukasz Magiera 8419dda84b wdpost: Only add proven partitions to message params 2020-09-18 02:39:08 +02:00
Łukasz Magiera dcc5643473 shed: Even more bitfield utils 2020-09-18 02:38:30 +02:00
Steven Allen 5bcfee0042 make market diffs work across version upgrades 2020-09-17 16:08:54 -07:00
Steven Allen dc58f71604 remove unnecessary code
Go does have some nice features, once in a while.
2020-09-17 14:59:10 -07:00
Steven Allen ae38970526 remove WpostProvignPeriod function 2020-09-17 14:56:11 -07:00
Steven Allen 708aa368e1 remove dep on v0 miner 2020-09-17 13:53:18 -07:00
Steven Allen 18bc59b93b uncruft 2020-09-17 13:52:16 -07:00
Aayush Rajasekaran 1a101e53a6 Merge pull request #3906 from filecoin-project/feat/upgrade-markets-v0.6.1
Upgrade markets v0.6.1
2020-09-17 15:45:53 -04:00
hannahhoward a894c1e8e6 feat(markets): upgrade markets v0.6.1 2020-09-17 12:30:26 -07:00
Hector Sanjuan dfd28ab0c4 Fix links in READMEs. 2020-09-17 20:56:43 +02:00
Hector Sanjuan 784399738a Keep api-methods.md even if not part of the docs 2020-09-17 20:50:37 +02:00
Hector Sanjuan bc9232544c Remove faqs too 2020-09-17 20:48:09 +02:00
Hector Sanjuan 591e32af48 Remove circle_ci docs-check. 2020-09-17 20:46:14 +02:00
Łukasz Magiera b85b50afbc shed: bitfield intersect command 2020-09-17 20:37:35 +02:00
Hector Sanjuan a4fd356fcb Delete most docs. Update about page with links to docs.filecoin.io 2020-09-17 20:35:19 +02:00
Hector Sanjuan 6849d18b03 Merge branch 'master' into feat/docs-reorg 2020-09-17 19:28:54 +02:00
jennijuju 14a4acec8c Add an option to hide sectors in Removed for sectors list. 2020-09-17 13:19:50 -04:00
Dirk McCormick c40c1361f0 fix: paych To() 2020-09-17 18:14:07 +02:00
Łukasz Magiera 82b95e34b7 cbor gen 2020-09-17 17:37:16 +02:00
Łukasz Magiera 68e884ee44 docsgen 2020-09-17 17:31:09 +02:00
Łukasz Magiera 6eda53565f Most tests passing 2020-09-17 17:30:24 +02:00
vyzo 6dfc40abc1 error is nil at end, so return batch, nil 2020-09-17 18:23:50 +03:00
vyzo 2946561dec clean up return code 2020-09-17 18:07:01 +03:00
vyzo d7948fcbcd fix log; we want to log time when we succeed! 2020-09-17 18:07:01 +03:00
vyzo fb605f6d7f refactor parallel fetch logic into a separate function 2020-09-17 18:07:01 +03:00
vyzo 2a428f09e6 increase exchange ShufflePeersPrefix to 16, use that as the value of concurrent sync requests 2020-09-17 18:07:01 +03:00
vyzo 8a4b629f40 increase sync request batch size to 8 2020-09-17 18:07:01 +03:00
vyzo b984e94a87 fix bug 2020-09-17 18:07:01 +03:00
vyzo 05a233f84d add some more logging 2020-09-17 18:07:01 +03:00
vyzo 35f6e10646 parallel chain sync 2020-09-17 18:07:01 +03:00
vyzo 61c0b8c3db properly close streams in blocksync
we were leaking streams right and left...
2020-09-17 18:07:01 +03:00
Łukasz Magiera e632643801 api: Test return types 2020-09-17 12:24:50 +02:00
Marius Darila 12e76bc1af replace Requires with Wants
Prevent lotus-miner shutdown when daemon restarts.
2020-09-17 12:17:18 +02:00
Aayush Rajasekaran 31ff5230bb Get State API almost working 2020-09-17 05:05:32 -04:00
Łukasz Magiera 97064f1d15 Merge pull request #3886 from filecoin-project/feat/retrieval-set-get-ask
Add get-ask, set-ask retrieval commands
2020-09-17 10:32:41 +02:00
Aayush Rajasekaran 053cfc1cc7 Migrate verifreg actor 2020-09-17 03:55:23 -04:00
Aayush Rajasekaran 7bf165c73a Remove miner-related specs actors types from API 2020-09-17 03:54:22 -04:00
hannahhoward 691bd9f442 feat(markets): complete markets conversion
complete markets conversion to using chain/actors types, also replacing DealProposal/DealState
interfaces with structs
2020-09-17 00:43:14 -07:00
Aayush Rajasekaran e2295c372a Migrate multisig actor 2020-09-17 02:57:45 -04:00
Aayush Rajasekaran b60614982e Migrate reward actor 2020-09-17 02:42:39 -04:00
Aayush Rajasekaran 9e48dd211a Fixups 2020-09-17 02:34:15 -04:00
Aayush Rajasekaran b5ba7a0fad Miner migration 2020-09-17 02:21:16 -04:00
Aayush Rajasekaran 81004ea39e Merge pull request #3889 from filecoin-project/refactor/net-upgrade-markets-deal-states
feat(market): update state diffing for market actor
2020-09-17 00:31:45 -04:00
Frank bf2e3baa8f fix conformance gen 2020-09-17 11:49:23 +08:00
Frank d5af25b76c update init sector state list 2020-09-17 10:38:07 +08:00
hannahhoward 80b6994fe2 feat(market): update state diffing for market actor
Update to abstract actor for markets state diffing. Also move the diff adt functions inside the
abstract actors
2020-09-16 19:14:07 -07:00
Aayush Rajasekaran 7115485b0a Add a getter for network version 2020-09-16 21:56:02 -04:00
Łukasz Magiera 17680fff55 gofmt 2020-09-17 00:35:57 +02:00
Łukasz Magiera d9d644b27f sectorstorage: handle restarting manager, test that 2020-09-17 00:35:09 +02:00
Ingar Shu f56602c588 Specify retrieval price in FIL/GiB 2020-09-16 14:30:04 -07:00
Aayush Rajasekaran b530f25f09 Migrate miner actor 2020-09-16 17:20:25 -04:00
Łukasz Magiera c66ebc50c1 Merge pull request #3875 from filecoin-project/feat/break-on-stop-sleep
break out of mining loop when stop is called during niceSleep
2020-09-16 23:11:04 +02:00
Ingar Shu 2aef7f7c07 Clarify help text units 2020-09-16 13:56:46 -07:00
Ingar Shu 665d23cb8e Add set-ask, get-ask retrieval CLI 2020-09-16 13:56:46 -07:00
Łukasz Magiera 3b00c6838a Merge remote-tracking branch 'origin/master' into feat/break-on-stop-sleep 2020-09-16 22:56:21 +02:00
Łukasz Magiera a6b7791d32 lint 2020-09-16 22:56:04 +02:00
Łukasz Magiera 34d31d8124 Merge pull request #3856 from filecoin-project/compile-lotus-soup-testplan
add filecoin-project oni as submodule and compile lotus-soup
2020-09-16 22:54:34 +02:00
Łukasz Magiera 6656e5a6c8 circle: test-lotus-soup -> build-lotus-soup 2020-09-16 22:47:06 +02:00
Łukasz Magiera 487765548e Merge remote-tracking branch 'origin/master' into compile-lotus-soup-testplan 2020-09-16 22:42:54 +02:00
Łukasz Magiera ecd115c002 Merge pull request #3862 from filecoin-project/compile-with-build-flag-testground
make sure lotus compiles with +testground build flag
2020-09-16 22:41:24 +02:00
Łukasz Magiera 5e09581256 sectorstorage: get new work tracker to run 2020-09-16 22:33:58 +02:00
Łukasz Magiera ccce1a9715 Merge pull request #3877 from filecoin-project/refactor/net-upgrade-paych
Support Network Upgrades: Payment Channel
2020-09-16 20:25:16 +02:00
austinabell ca956ca57e Merge branch 'master' of github.com:filecoin-project/lotus into async/stransition 2020-09-16 11:23:55 -04:00
Łukasz Magiera b1361aaf8b sectorstorage: wip manager work tracker 2020-09-16 17:08:05 +02:00
Raúl Kripalani 5a8ee0dd2a Merge pull request #3861 from filecoin-project/feat/chaos-inspect-runtime 2020-09-16 15:50:08 +01:00
Raúl Kripalani 4fbb322fa2 Merge branch 'master' into feat/chaos-inspect-runtime 2020-09-16 15:37:28 +01:00
Anton Evangelatov 56f223bfc3 add go mod edit for blst deps 2020-09-16 15:19:17 +02:00
Anton Evangelatov 0ff5a71114 update oni to master 2020-09-16 15:13:28 +02:00
Anton Evangelatov b0677ab38e replace lotus and filecoin-ffi deps 2020-09-16 15:12:41 +02:00
Anton Evangelatov f4f80b25d1 add test-lotus-soup to workflows 2020-09-16 15:12:41 +02:00
Anton Evangelatov 3f67c4524e add filecoin-project oni as submodule and compile lotus-soup 2020-09-16 15:12:41 +02:00
Frank ed74091c20 add exist sector state check 2020-09-16 19:49:45 +08:00
Anton Evangelatov b4115021c5 make sure lotus compiles with +testground build flag 2020-09-16 13:43:28 +02:00
Łukasz Magiera b78ffd18c6 Merge pull request #3883 from filcloud/Update-ignore
add lotus-pcr to ignore
2020-09-16 13:39:01 +02:00
Łukasz Magiera c9a8f3b8a0 Merge pull request #3874 from filecoin-project/asr/deal-duration
Make interactive deal CLI reject deals shorter than minimum duration
2020-09-16 13:08:47 +02:00
Frank d870c74a5e add lotus-pcr to ignore 2020-09-16 19:08:47 +08:00
Łukasz Magiera 3d61a37fcf Merge pull request #3880 from filecoin-project/fix/gas-outputs-regression
fix a regression caused by #3800 (GasOutputs zero values)
2020-09-16 12:24:22 +02:00
Łukasz Magiera 0c41522ebf Merge pull request #3873 from filecoin-project/unify-wdpost-log
Use `window post` for window PoSt related log messages.
2020-09-16 12:00:45 +02:00
Raúl Kripalani 362fc180ec fix a regression caused by #3800. 2020-09-16 10:54:26 +01:00
Łukasz Magiera 2db7b8c998 Merge pull request #3872 from zgfzgf/master
Replace fx.Extract with fx.Populate
2020-09-16 11:50:59 +02:00
Aayush Rajasekaran 72d19f369b Incremental progress towards using new power state interface 2020-09-16 01:57:18 -04:00
Aayush Rajasekaran 90853e24cf Add a boolean HasMinPower to return of GetPower 2020-09-16 01:47:24 -04:00
Aayush Rajasekaran b4ee519282 Partial progress towards switching to miner and power interfaces 2020-09-16 01:37:49 -04:00
Aayush Rajasekaran e04331b07c Merge pull request #3682 from filecoin-project/asr/chainstore-state-tree
Sever chainstore's dependence on the state tree
2020-09-16 00:39:26 -04:00
hannahhoward 05c11531b1 feat(paych): convert paych actor
build abstraction for paych actor and switch to using it in payment channel manager and state
predicates
2020-09-15 21:06:04 -07:00
whyrusleeping 6670d22fb5 add command to (slowly) prune lotus chain datastore 2020-09-15 20:20:48 -07:00
Travis Person 808051d34e break out of mining loop when stop is called during niceSleep 2020-09-16 02:06:40 +00:00
Aayush Rajasekaran e2cf0c4d4c Make interactive deal CLI reject deals shorter than minimum duration 2020-09-15 21:24:30 -04:00
jennijuju 5c69249ba3 Use window post for window PoSt related log messages. 2020-09-15 21:22:29 -04:00
zgfzgf fa9be9a627 Replace fx.Extract with fx.Populate 2020-09-16 09:14:56 +08:00
Steven Allen 454c382e7e migrate StateMinerInitialPledgeCollateral 2020-09-15 18:05:33 -07:00
Aayush Rajasekaran 937ff4e9ae Add a sync test around blocks with bad nonce messages 2020-09-15 20:55:11 -04:00
Aayush Rajasekaran 952f2c2f1e Sever chainstore's dependence on the state tree 2020-09-15 20:41:34 -04:00
Aayush Rajasekaran 2ca1d111c5 Multisig: Add a CLI command to cancel locking some balance 2020-09-15 19:52:58 -04:00
Aayush Rajasekaran b20f558abb Multisig: Add a CLI command to approve locking some balance 2020-09-15 19:51:18 -04:00
Steven Allen 92471d41d6 migrate precommit deposit function 2020-09-15 16:47:58 -07:00
Aayush Rajasekaran c2148ba106 Multisig: Add a CLI command to propose locking some balance 2020-09-15 19:27:36 -04:00
austinabell e53aee26a3 Make state transition in validation async 2020-09-15 18:36:06 -04:00
Steven Allen 02bc5fab26 add power actor address alias 2020-09-15 14:56:00 -07:00
Steven Allen e1ba4eb5c4 sub reward actor 2020-09-15 14:55:48 -07:00
Steven Allen 4e01fad0d4 start multisig abstraction 2020-09-15 14:44:03 -07:00
Alan Shaw ed4caac9bf fix: remove network version and total fil 2020-09-15 22:24:09 +01:00
Jakub Sztandera 0c1c19c6ef Merge pull request #3867 from filecoin-project/feat/lotus-bench-repo-dir
allow specification of repo directory in lotus-bench
2020-09-15 23:21:04 +02:00
Steven Allen 91e9573863 Compile fixes 2020-09-15 12:13:13 -07:00
Steven Allen c64f983900 migrate StateMinserSectorCount 2020-09-15 12:09:39 -07:00
whyrusleeping 24756ac056 allow specification of repo directory in lotus-bench 2020-09-15 11:55:54 -07:00
Steven Allen 53384e83d7 migrate wallet access 2020-09-15 11:16:35 -07:00
Steven Allen 4cd92d8576 remove final WithStateTree 2020-09-15 10:57:32 -07:00
Steven Allen 6bf7976add fix decode 2020-09-15 10:51:18 -07:00
Steven Allen 00c6397ec9 more progress 2020-09-15 10:46:44 -07:00
Łukasz Magiera d4a7732d0a Merge pull request #3800 from filecoin-project/asr/gascost
Add an API to get detailed gas costs for a message
2020-09-15 19:13:20 +02:00
Łukasz Magiera 03cf6cca40 Merge remote-tracking branch 'origin/master' into feat/async-restartable-workers 2020-09-15 17:47:03 +02:00
Alan Shaw ae326ce65d feat: add inspect runtime method to chaos actor 2020-09-15 15:43:37 +01:00
Łukasz Magiera 531b7bf92d Merge pull request #3848 from filecoin-project/feat/state-sector-cli
cli: state sector command
2020-09-15 15:30:04 +02:00
Łukasz Magiera 9dad38c9a5 gofmt 2020-09-15 15:29:39 +02:00
Łukasz Magiera 4419850195 state api impl fixes 2020-09-15 15:29:25 +02:00
Łukasz Magiera 4dabab5ce6 state manager progress 2020-09-15 13:04:45 +02:00
Łukasz Magiera 84fa22110f fix lint 2020-09-15 12:09:43 +02:00
Łukasz Magiera e22aa74865 Merge pull request #3780 from filecoin-project/feat/lotus-gateway
implement initial lotus-gateway program
2020-09-15 12:07:59 +02:00
Łukasz Magiera 285fc69f6a gateway: address review 2020-09-15 11:50:08 +02:00
Łukasz Magiera 72216fe917 Merge pull request #3647 from filecoin-project/fix/enable-strict-basefee-check
re-enable baseFee lower bound check
2020-09-15 11:38:28 +02:00
Łukasz Magiera 692027f625 Merge pull request #3819 from zgfzgf/zgfzgf
optimize Settings.nodeType
2020-09-15 10:42:23 +02:00
Łukasz Magiera 801e01bca0 Merge pull request #3778 from filecoin-project/feat/less-restrictive-read-piece-lock
Allow retrievals while sealing
2020-09-15 10:34:00 +02:00
Łukasz Magiera 6665a9ca69 Merge pull request #3845 from filecoin-project/sync-manager
syncer: make SyncManager an interface.
2020-09-15 10:28:48 +02:00
Łukasz Magiera 1c02a417db Merge pull request #3850 from filecoin-project/asr/msig-avail
Fix MsigGetAvailableBalance
2020-09-15 10:22:27 +02:00
Łukasz Magiera 9ec26e776d Merge pull request #3851 from filecoin-project/fix/paych-status-commands
Fix payment channel status commands
2020-09-15 10:21:16 +02:00
Łukasz Magiera cf82483420 Merge pull request #3689 from filecoin-project/feat/batch-window-PoST
storage: split window PoST submission into multiple messages
2020-09-15 10:17:22 +02:00
Dirk McCormick db998e9c0f fix: storage - move rand generation after proofs 2020-09-15 09:52:55 +02:00
Dirk McCormick f0f15f899c feat: split window PoST messages into batches 2020-09-15 09:43:18 +02:00
Steven Allen 36f920bcd7 progress 2020-09-14 21:55:49 -07:00
hannahhoward 7dc091052a feat(manager): less restrictive storage lock
Use initial less restrictive storage lock when trying to read unsealed data before acquiring more
restrictive lock needed for unsealing
2020-09-14 18:48:14 -07:00
hannahhoward 17e44af542 docs(api): fix api docs 2020-09-14 18:44:45 -07:00
hannahhoward ac8ef29d35 fix(paych): add paych status from to cmd
add missing from to status to list
2020-09-14 18:42:10 -07:00
hannahhoward 48e47ddc23 fix(paych): fix paych status command line 2020-09-14 18:42:10 -07:00
Aayush Rajasekaran 6acd3d6028 Fix MsigGetAvailableBalance 2020-09-14 21:12:32 -04:00
Łukasz Magiera 7fd5c81674 cli: state sector command 2020-09-15 01:36:49 +02:00
Steven Allen 7fa6c1e8d0 add info method to miner state API 2020-09-14 15:45:00 -07:00
Steven Allen cc4d5306eb Progress 2020-09-14 15:43:12 -07:00
Steven Allen 02dcb5e182 Merge branch 'master' into refactor/net-upgrade 2020-09-14 14:53:57 -07:00
Steven Allen f9ea3935ff Merge pull request #3846 from filecoin-project/steb/specs-actors-0.9.10
Update specs-actors to 0.9.10
2020-09-14 14:45:04 -07:00
Steven Allen 2088335b9d rename to simplify merge 2020-09-14 14:40:52 -07:00
Steven Allen 9804310cc8 Update specs-actors to 0.9.10
Moves the Keyer type (and helpers) into go-state-types.
2020-09-14 14:32:57 -07:00
Aayush Rajasekaran 07e574db44 Merge pull request #3844 from filecoin-project/steb/specs-actors-0.9.9
Update to specs-actors 0.9.9
2020-09-14 17:19:03 -04:00
Raúl Kripalani dd841f32db syncer: make SyncManager an interface. 2020-09-14 21:58:59 +01:00
Łukasz Magiera 665f93bbb7 Merge pull request #3839 from filecoin-project/fix/skipped-skipping
wdpost: Skip sectors correctly
2020-09-14 21:56:43 +02:00
Steven Allen 32eeb96ce7 Update to specs-actors 0.9.9
This patch changes the runtime interfaces, to make it possible to abstract over them.
2020-09-14 12:47:39 -07:00
vyzo 172bfacae0 compute baseFee for check even in null rounds 2020-09-14 22:20:26 +03:00
vyzo 0a5494dd79 use the factor in getBaseFeeLowerBound 2020-09-14 22:13:37 +03:00
vyzo 044202b37f use conservative base fee lower bound factor for strict checks 2020-09-14 22:13:37 +03:00
vyzo d68ec37942 reenable baseFee lower bound check 2020-09-14 22:13:37 +03:00
Aayush Rajasekaran 0edcae9e04 Fixup new command 2020-09-14 14:40:38 -04:00
Aayush Rajasekaran d1850ea27d Add an API to get detailed gas costs for a message 2020-09-14 14:40:13 -04:00
Aayush Rajasekaran 60a031a713 Lower devnet block time 2020-09-14 14:40:13 -04:00
Łukasz Magiera 8a05fe86d6 wdpost: Skip sectors correctly 2020-09-14 20:33:54 +02:00
Łukasz Magiera e9d25e5919 More fixes 2020-09-14 20:28:47 +02:00
Mike Greenberg 8a21198f56 Merge pull request #3765 from ggq89/master
optimize definition of state_heights
2020-09-14 14:19:31 -04:00
Whyrusleeping b212368a70 Merge pull request #2455 from filecoin-project/inmem-journal
make journal pluggable; record deals, sealing, wdpost, mempool events
2020-09-14 11:17:21 -07:00
Raúl Kripalani 954ff32503 fix transitive api dependency on ffi. 2020-09-14 19:01:35 +01:00
Łukasz Magiera 381a6cdfac Merge remote-tracking branch 'origin/master' into feat/async-restartable-workers 2020-09-14 19:11:50 +02:00
Łukasz Magiera 1ebca8f732 more working code 2020-09-14 19:09:01 +02:00
Raúl Kripalani 7c13fa95d1 Merge branch 'master' into inmem-journal 2020-09-14 17:01:36 +01:00
Raúl Kripalani 09e9d6d778 deal journal events: wire into markets subscriptions. 2020-09-14 16:20:01 +01:00
Łukasz Magiera fb3f710523 Some post-master merge fixes 2020-09-14 15:18:04 +02:00
Łukasz Magiera 06ec571c20 Merge remote-tracking branch 'origin/master' into refactor/net-upgrade 2020-09-14 15:09:52 +02:00
Łukasz Magiera 683a58195e More terraforming in chain/ 2020-09-14 14:46:38 +02:00
Raúl Kripalani 86607452d7 circleci: make lint expend all cores. (#3831)
* circleci: make lint expend all cores.

* i hate yaml.

* now i hate it even more.
2020-09-14 14:18:53 +02:00
Raúl Kripalani 05aa5f2d38 allow customizing disabled journal events + tests. 2020-09-14 13:01:03 +01:00
Łukasz Magiera 68097132fe Fix vm build 2020-09-14 13:45:20 +02:00
Raúl Kripalani 6d29d75724 Merge branch 'master' into inmem-journal 2020-09-14 12:17:45 +01:00
Łukasz Magiera 38f87981c1 Fix some build errors 2020-09-14 13:14:06 +02:00
Łukasz Magiera 3a34856dfe Merge pull request #3822 from filcloud/issue-2495-make-nested-dir
make nested dir
2020-09-14 13:06:14 +02:00
Aarsh Shah 973738d30f Merge pull request #3767 from filecoin-project/fix/addpiece-retry
Retry Add Piece.
2020-09-14 15:44:48 +05:30
Albert·Gou 747b34c2c8 Update sync.go 2020-09-14 18:00:17 +08:00
Frank dcae513487 make nested dir 2020-09-14 16:49:35 +08:00
Łukasz Magiera 18c025f10e Merge pull request #3777 from filecoin-project/feat/plan-20-blocks
Increase the FeeCap estimation to 20 blocks in a future
2020-09-14 10:20:17 +02:00
Albert·Gou e45a7749b0 Update sync.go 2020-09-14 16:20:01 +08:00
Albert·Gou b7ea145f38 Merge remote-tracking branch 'upstream/master' into master 2020-09-14 16:17:10 +08:00
Aarsh Shah 6c61ff0e9e log error 2020-09-14 12:04:50 +05:30
zgfzgf 45a5eaf913 optimize Settings.nodeType 2020-09-14 11:00:08 +08:00
whyrusleeping 3401cb349b add mpool push and chainHead 2020-09-11 23:07:20 -07:00
Steven Allen d3594835c4 [WIP] Network upgrade support
This patch starts adding support for network upgrades.

* It adds an actors abstraction layer for loading abstract (cross-version) actors.
* It starts switching over to a shared deadline type.
* It adds an abstraction for ADTs (hamt/amt).
* It removes the callback-based API in the StateManager (difficult to abstract
across actor versions).
* It _does not_ actually add support for actors v2. We can do that in a followup
patch but that should be relatively easy.

This patch is heavily WIP and does not compile. Feel free to push changes
directly to this branch.

Notes:

* State tree access now needs a network version, because the HAMT type will change.
* I haven't figured out a nice way to abstract over changes to the _message_
types. However, many of them will be type aliased to actors v0 in actors v2 so
we can likely continue using the v0 versions (or use the v2 versions
everywhere). I've been renaming imports to `v0*` to make it clear that we're
importing types from a _specific_ actors version.

TODO:

* Consider merging incremental improvements? We'd have to get this compiling
again first but we could merge in the new abstractions, and slowly switch over.
* Finish migrating to the new abstractions.
* Remove all actor state types from the public API. See `miner.State.Info()` for
the planned approach here.
* Fix the tests. This is likely going to be a massive pain.
2020-09-11 20:16:29 -07:00
whyrusleeping 8b9a3ea6c3 implement initial lotus-gateway program 2020-09-11 20:01:37 -07:00
Jakub Sztandera d5aef296ea Increase the FeeCap estimation to 20 blocks in a future
FeeCap will be set to 10x the current running rate

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-11 21:59:51 +02:00
Łukasz Magiera aa83a4c1f5 Merge pull request #3772 from filecoin-project/fix/prune-protect-local
don't prune locally published messages
2020-09-11 21:46:21 +02:00
Łukasz Magiera b83463ca76 Merge pull request #3774 from filecoin-project/fix/paych-status-missing
add paych status command to list
2020-09-11 21:45:25 +02:00
Łukasz Magiera c1ca24e8bc Merge pull request #3775 from filecoin-project/fix/markets-message-cid-update
Fix for PublishDeals message cid changing due to gas
2020-09-11 21:44:56 +02:00
vyzo b78fe0b898 fix deadlock 2020-09-11 21:40:25 +03:00
vyzo bf1036c78f rename priority variable to protected 2020-09-11 21:12:11 +03:00
Ingar Shu 2e3ff9e401 Update market client/provider adapters to WaitForMessage API 2020-09-11 11:00:42 -07:00
Aarsh Shah eabdf74946 changes as per review 2020-09-11 23:15:57 +05:30
vyzo cf9820137c don't prune locally published messages 2020-09-11 20:32:52 +03:00
Raúl Kripalani c017d0fbaf Merge pull request #3768 from filecoin-project/fix/chaos-tests
fix: chaos tests
2020-09-11 15:45:02 +01:00
Alan Shaw 16f7d5801b fix: chaos tests 2020-09-11 15:25:59 +01:00
Aarsh Shah 62b2963781 retry add piece 2020-09-11 16:58:09 +05:30
Raúl Kripalani cd9858420f Merge pull request #3736 from filecoin-project/test/chaos-tests 2020-09-11 12:18:27 +01:00
Łukasz Magiera 4410da98be Merge pull request #3766 from filecoin-project/fix/mpool-prune
refactor getBaseFeeLowerBound, use it to prune less aggressively
2020-09-11 11:40:26 +02:00
Łukasz Magiera b89aa02d77 Merge pull request #3710 from filecoin-project/feat/window-post-faulty-sectors
windowed post generation now returns faulty sectors
2020-09-11 11:15:32 +02:00
vyzo 3dfb3e641b refactor getBaseFeeLowerBound, use it to prune less aggressively 2020-09-11 12:15:03 +03:00
Łukasz Magiera a3f228d05a Merge pull request #3739 from filecoin-project/upd/badger
Upgrade badger
2020-09-11 11:14:39 +02:00
Łukasz Magiera eaf9ebc2ca Merge pull request #3752 from filecoin-project/fix/mpool-replace-auto
Fix mpool replace --auto
2020-09-11 11:12:35 +02:00
Łukasz Magiera 55e4183825 Merge pull request #3754 from filecoin-project/feat/shed-export
Add faster and slimmer option to chain export via lotus-shed
2020-09-11 11:10:41 +02:00
Łukasz Magiera aeb3437a9f lint, docsgen 2020-09-11 10:55:10 +02:00
Albert·Gou 6e7de3c8d9 optimize definition of state_heights
In the same parentstateroot, the one with the smallest height should be selected
2020-09-11 16:52:48 +08:00
Łukasz Magiera d0175392c0 Merge remote-tracking branch 'origin/master' into feat/window-post-faulty-sectors 2020-09-11 10:47:39 +02:00
Łukasz Magiera c4b3970c70 mod tidy 2020-09-11 10:41:24 +02:00
whyrusleeping 72eb17d314 wire skip old messages option through the api 2020-09-10 17:40:47 -07:00
whyrusleeping 0efe5ee7d5 include some other changes 2020-09-10 17:32:30 -07:00
whyrusleeping 0e3dd3cb3b Add faster and slimmer option to chain export via lotus-shed 2020-09-10 17:28:25 -07:00
hannahhoward 56b237e7b8 fix(paych): add status command to list
Add paych status cmd to list of payment channel sub commands
2020-09-10 16:00:23 -07:00
Jakub Sztandera 2865a0367b Fix mpool replace --auto
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-11 00:59:57 +02:00
Aayush Rajasekaran 232cc320bd Merge pull request #3747 from filecoin-project/ntwk-0.7.0
Ntwk 0.7.0
2020-09-10 18:07:06 -04:00
Aayush Rajasekaran e7edc46daf Lotus version 0.7.0 2020-09-10 17:56:54 -04:00
Jakub Sztandera 6813ab4e65 Add additional metrics
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-10 17:41:55 -04:00
Jakub Sztandera fd714cbceb Remove PackingEfficiency consideration from base fee in an upgrade
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-10 17:41:55 -04:00
whyrusleeping db6bd890d9 condition randomness changes on fork height
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-10 17:41:55 -04:00
Steven Allen 7a46c5ff31 [WIP] Fix ticket randomness
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-10 17:41:55 -04:00
Aayush Rajasekaran 98a9042c07 Use newest network version in genesiss setup stuff 2020-09-10 17:41:55 -04:00
Aayush Rajasekaran 4170e18dea fix testground build 2020-09-10 17:41:55 -04:00
Aayush Rajasekaran 230ef2484d fix tests 2020-09-10 17:41:55 -04:00
Aayush Rajasekaran beba92aed4 Improve network versioning logic 2020-09-10 17:41:55 -04:00
Aayush Rajasekaran cbb693e99e Update docs 2020-09-10 17:41:55 -04:00
Aayush Rajasekaran 774e068436 Update to specs-actors v0.9.8 2020-09-10 17:41:55 -04:00
Aayush Rajasekaran 86ba21029d Update to go state types 001afaca718c 2020-09-10 17:41:55 -04:00
Aayush Rajasekaran 316ac61875 Update to go state types 3ca0d2890090 2020-09-10 17:41:55 -04:00
Jakub Sztandera d5d264d13b Add fork point
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-10 17:41:55 -04:00
Jakub Sztandera c71e1adc93 Integrate multiple drand networks with pubsub
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-10 17:41:55 -04:00
Jakub Sztandera 564d0ae974 Upgrade drand
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-10 17:41:55 -04:00
Jakub Sztandera 9a48ec194e Add DrandSchedule to testground params
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-10 17:41:55 -04:00
Jakub Sztandera bb0a7f91cc Fix drand non-test
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-10 17:41:55 -04:00
Jakub Sztandera 73e54352cd Fix off by one
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-10 17:41:55 -04:00
Jakub Sztandera 64fa6fd9e5 Draw the rest of the owl
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-10 17:41:55 -04:00
Jakub Sztandera 2d3f92aeed Introduce beacon Schedule
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-10 17:41:55 -04:00
Jakub Sztandera df5750a21c go mod tidy
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-10 23:15:56 +02:00
Łukasz Magiera e996a5246b Merge remote-tracking branch 'origin/master' into feat/window-post-faulty-sectors 2020-09-10 22:18:17 +02:00
Łukasz Magiera bbac86f745 gofmt, mod tidy 2020-09-10 22:07:20 +02:00
Łukasz Magiera 22556fb24c Add fil-blst submodule 2020-09-10 22:04:08 +02:00
Łukasz Magiera 2374cb1bc5 Update ffi 2020-09-10 21:44:01 +02:00
Łukasz Magiera c7b0241a48 ffiwrapper: Test skipping corrupted sectors in PoSt 2020-09-10 21:19:26 +02:00
jennijuju c610bd818e Increased ExpectedSealDuration and and WaitDealsDelay. 2020-09-10 14:34:18 -04:00
hannahhoward 5e445f5a48 docs(apidocs): run docs gen 2020-09-10 10:47:38 -07:00
hannahhoward e86a74156e feat(cli): add command to list 2020-09-10 10:47:38 -07:00
hannahhoward 64d150e215 feat(cli): add chain delete cmd 2020-09-10 10:47:38 -07:00
Jakub Sztandera dc85a276cd Upgrade badger
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-10 19:17:48 +02:00
Łukasz Magiera 5f08fe7ead Merge remote-tracking branch 'origin/master' into feat/async-restartable-workers 2020-09-10 17:30:54 +02:00
Łukasz Magiera 9e9856bb45 Merge pull request #3590 from filecoin-project/asr/multisig
Multisig API additions
2020-09-10 17:04:48 +02:00
Łukasz Magiera 890e6280df Merge pull request #3669 from filecoin-project/feat/independent-version-numbers
build: Separate API versions per node type
2020-09-10 17:00:32 +02:00
Alan Shaw c94ff3430c refactor: use nil value 2020-09-10 14:51:30 +01:00
Łukasz Magiera da7e4b3a09 Merge pull request #3735 from filecoin-project/deps/update-pubsub
update go-libp2p-pubsub@master
2020-09-10 15:35:28 +02:00
Alan Shaw a214069586 chore: appease linter 2020-09-10 14:30:52 +01:00
Alan Shaw d4b185be5e test: add chaos actor tests 2020-09-10 14:23:39 +01:00
Raúl Kripalani 747a7de168 Merge pull request #3733 from filecoin-project/feat/chaos-abort-2 2020-09-10 14:20:34 +01:00
vyzo bfa47b3663 update go-libp2p-pubsub@master 2020-09-10 16:11:23 +03:00
Alan Shaw 0e7f14159a refactor: another rename 2020-09-10 12:06:00 +01:00
Alan Shaw b755ce9528 refactor: renames 2020-09-10 12:03:13 +01:00
Alan Shaw f3cae55bd4 feat: chaos abort 2020-09-10 11:31:34 +01:00
Łukasz Magiera f64bd55bc6 Merge pull request #3720 from filecoin-project/fix/increase-precommit2-retry-counter
Increase the number of times precommit2 is attempted before moving back to precommit1
2020-09-10 11:52:01 +02:00
Łukasz Magiera 4c8bb846ea Merge pull request #3724 from filecoin-project/fix/relax-strictness-push
relax mpool add strictness checks for local pushes
2020-09-10 11:51:02 +02:00
Łukasz Magiera bd14fb90fc Merge pull request #3729 from filecoin-project/fix/statediff-ci
ci: fix statediff build; make optional.
2020-09-10 11:49:04 +02:00
Raúl Kripalani 9e5bce90f4 ci: fix statediff build; make optional. 2020-09-10 10:41:18 +01:00
vyzo 72c7d4c886 relax mpool add strictness checks for local pushes
So that a node can have more than 1k pending messages for its own local addresses.
2020-09-10 09:55:50 +03:00
lanzafame 558b637b07 Increase the number of times precommit2 is attempted before moving back to precommit1 2020-09-10 13:52:21 +10:00
Whyrusleeping 767341b279 Merge pull request #3437 from filecoin-project/feat/mpool-stats-cmd
add a simple command to watch messages sitting in the mempool
2020-09-09 18:29:42 -07:00
Łukasz Magiera 5e7737f55d wdpost: Handle skipped sectors correctly 2020-09-10 02:59:37 +02:00
whyrusleeping c73916b4e7 fix the linter 2020-09-09 17:37:49 -07:00
whyrusleeping 0361ca1c39 add some bits about windowed post 2020-09-09 17:18:55 -07:00
Aayush Rajasekaran cd4cd22928 Merge pull request #3717 from filecoin-project/asr/checkpoint-msg
Fix IsAncestorOf
2020-09-09 19:49:47 -04:00
Aayush Rajasekaran e1a0cf6ca5 Add a checkpoint test 2020-09-09 19:21:48 -04:00
Łukasz Magiera 73bb9d5afb Merge pull request #3715 from filecoin-project/fix/chainwatch/partition-diff
fix(chainwatch): compare prev miner with cur miner
2020-09-10 01:19:58 +02:00
Aayush Rajasekaran 183df4c135 Fix IsAncestorOf 2020-09-09 19:09:55 -04:00
frrist f2b238f50a fix(chainwatch): compare prev miner with cur miner
- bug was comparing cur miner with cur miner
2020-09-09 15:30:30 -07:00
whyrusleeping 09194aa613 print better error when losing connection 2020-09-09 15:19:54 -07:00
whyrusleeping e58327d4ed rename LE tag to quantile 2020-09-09 15:19:54 -07:00
whyrusleeping 8414aa6e4b more metrics! 2020-09-09 15:19:54 -07:00
whyrusleeping 7d1d690eb7 lets get some metrics 2020-09-09 15:19:54 -07:00
whyrusleeping 47ad7ccb5f some more stats 2020-09-09 15:19:54 -07:00
whyrusleeping 679c4183e7 add a simple command to watch messages sitting in the mempool 2020-09-09 15:19:53 -07:00
Aayush Rajasekaran 8807c75c51 Fix warn message 2020-09-09 18:17:05 -04:00
Łukasz Magiera be9d8f7ce3 Merge pull request #3712 from filecoin-project/asr/devnet
Fix devnets
2020-09-09 23:15:36 +02:00
Aayush Rajasekaran a7a43a1124 Fix devnets 2020-09-09 17:10:35 -04:00
whyrusleeping 7a6ceebb34 windowed post generation now returns faulty sectors 2020-09-09 14:00:15 -07:00
Łukasz Magiera 38863d3025 build: Separate API versions per node type 2020-09-08 21:14:53 +02:00
Łukasz Magiera 554570f884 docsgen 2020-09-07 17:57:23 +02:00
Łukasz Magiera 231a9e4051 Fix sealing sched tests 2020-09-07 17:55:31 +02:00
Łukasz Magiera 9e6f974f3c storage: Fix build 2020-09-07 16:12:55 +02:00
Łukasz Magiera 06e3852cef storage: Integrate async workers in sealing manager 2020-09-07 12:20:50 +02:00
Łukasz Magiera 5d73943929 storage: Fix import cycle 2020-09-06 18:54:00 +02:00
Łukasz Magiera 159ce13f5e Async worker API 2020-09-06 18:47:16 +02:00
Aayush Rajasekaran 88c04ce959 Update docs 2020-09-06 03:51:06 -04:00
Aayush Rajasekaran 5ead23a8d4 Msig: Add CLI commands to propose, approve, or cancel adding signers 2020-09-06 03:46:07 -04:00
Aayush Rajasekaran d0ccb54aba Msig: Add RPC endpoints to propose, approve, or cancel adding signers 2020-09-06 01:52:30 -04:00
Aayush Rajasekaran aaad01105e Msig: Introduce an API & CLI to calculate amount that vests between 2 tipsets 2020-09-05 23:42:31 -04:00
Łukasz Magiera 780f6dba34 Remote wallet backends 2020-09-05 21:39:09 +02:00
Łukasz Magiera f90cfda2e6 wallet: Add interface layer 2020-09-04 22:18:03 +02:00
Raúl Kripalani 35a8f7ebca Merge branch 'master' into inmem-journal 2020-09-04 21:02:28 +01:00
Raúl Kripalani 0a4c473a7c fix dangling import. 2020-09-04 12:14:27 +01:00
Raúl Kripalani 1ec534d607 Merge branch 'master' into inmem-journal 2020-09-04 10:55:40 +01:00
Raúl Kripalani 905168e72e fix lint errors. 2020-09-04 10:54:56 +01:00
Raúl Kripalani d46f684bb8 fix test following merge. 2020-09-04 00:05:44 +01:00
Raúl Kripalani 97ff90f8fa fix imports. 2020-09-03 15:51:26 +01:00
Hector Sanjuan bd0c6a4ccc Fix filename 2020-09-03 16:35:55 +02:00
Hector Sanjuan af38c902f8 Fix architecture entry 2020-09-03 16:35:18 +02:00
Hector Sanjuan a153e1d586 Fix #2334: Specify seal options to disable with co-located storage worker 2020-09-03 16:35:18 +02:00
Hector Sanjuan fe52c47570 Docs review and re-organization
This:

* Re-organizes the docs into sections that align with what docs.filecoin.io becoming:
  * An installation section
  * A "getting started" section (lotus client focused)
  * A "storing" section (lotus client focused)
  * A "mining" section (miner focused)
  * A "build" section (developer focused)
  * An legacy "architecture" section is left in the last place.

A few high-value documentation pages have been reviewed and updated with the latest recommendations:

* Installation section and lotus setup
* Miner setup
* etc.
...

Other pages have been correctly merged into the new relevant sections. Some pages have not been touched. The filesystem layout of the documentation has been changed into folders corresponding to the sections (as requested by @cw). Some pages that were not linked at all and/or where hidden, have been moved to "unclassified".

This should make the porting of the Lotus documentation to docs.filecoin.io much easier, while ensuring it is more up to date than it was before.

For the moment, this breaks most links as link-aliasing is not supported in lotus-docs.
2020-09-03 16:35:16 +02:00
austinabell 6b63fa379f format 2020-09-02 16:45:50 -04:00
austinabell 485f13de12 Remove load check 2020-09-02 16:45:23 -04:00
austinabell 7f3ba0e6eb Merge branch 'master' of github.com:filecoin-project/lotus into extratsload 2020-09-02 16:44:06 -04:00
Raúl Kripalani 4554c4bda9 fix lotus-bench stale import. 2020-09-02 19:54:13 +01:00
Raúl Kripalani 3206f92063 Merge branch 'master' into inmem-journal 2020-09-02 19:50:52 +01:00
Raúl Kripalani fd04a19544 go mod tidy. 2020-09-02 19:46:57 +01:00
Raúl Kripalani f046af337a split wdpost event into finer-grained ones. 2020-09-02 19:45:25 +01:00
Raúl Kripalani ac152abc75 shuffle code to journal wdpost events. 2020-09-02 19:15:25 +01:00
Raúl Kripalani 0b6a182a44 move InitJournalKey to the top; add godcs on invoke order. 2020-09-02 19:15:07 +01:00
Aayush Rajasekaran f58e8bc9a3 Fix some failed precommit handling 2020-09-01 02:18:02 -04:00
whyrusleeping cac848c106 add a command to import an ipld object into the chainstore 2020-08-31 14:24:23 -07:00
Raúl Kripalani cb8e105a94 reduce diff noise. 2020-08-26 16:44:06 +01:00
Raúl Kripalani efdfd3ee3e Merge branch 'master' into inmem-journal 2020-08-26 16:38:23 +01:00
Raúl Kripalani 4e1ef09751 make journal a global var. 2020-08-26 16:09:37 +01:00
austinabell e4daadbfcf Remove extra tipset load from checking beacon entries 2020-08-20 17:54:59 -04:00
Raúl Kripalani cc859d3948 journal: wdpost: record proofs_processed even if no eligible partitions. 2020-08-11 16:49:18 +01:00
Raúl Kripalani 200b0f72cc mpool/repub: only record in journal if actually repubbing. 2020-08-11 15:06:13 +01:00
Raúl Kripalani 8f19fff1ec fix tests. 2020-08-11 14:47:02 +01:00
Raúl Kripalani b534ab9d3c panic recovery in MaybeRecordEvent; handle nil current tipsets in wdpost. 2020-08-11 14:28:00 +01:00
Raúl Kripalani 2ea5abdfb5 wire journal into miner. 2020-08-11 13:48:32 +01:00
Raúl Kripalani d53c6f2599 storage-fsm: emit sealing state transition notifications. 2020-08-11 13:23:40 +01:00
Raúl Kripalani 5e2c28d7e9 add comment. 2020-08-11 13:10:22 +01:00
Raúl Kripalani bca516b028 Merge remote-tracking branch 'origin/next' into inmem-journal 2020-08-11 12:42:39 +01:00
Raúl Kripalani 92598237c3 Merge branch 'next' into inmem-journal 2020-08-11 12:41:11 +01:00
Raúl Kripalani 5074ce5a38 move in-mem journal to Project Oni. 2020-08-10 15:02:15 +01:00
Raúl Kripalani b8475114ba Merge branch 'next' into inmem-journal 2020-07-21 17:42:51 +01:00
Raúl Kripalani 443473f833 fix tests. 2020-07-21 17:37:06 +01:00
Raúl Kripalani 4e82cf369c rename journal entries to journal events. 2020-07-21 17:32:01 +01:00
Raúl Kripalani d547c2588c record deals events in journal. 2020-07-21 17:26:44 +01:00
Raúl Kripalani cb8e209f78 journal: disable noisy message pool events. 2020-07-21 13:13:09 +01:00
Raúl Kripalani 3bd9d55a15 message pool: write message(s) in journal entries. 2020-07-21 13:10:29 +01:00
Raúl Kripalani d6e6eedd58 pipe sealing events to the journal. 2020-07-21 13:02:51 +01:00
Raúl Kripalani 7459ec6bba add mpool journal events; fix dependency injection. 2020-07-20 16:37:32 +01:00
Raúl Kripalani 226786c1da wip 2020-07-20 14:45:17 +01:00
Raúl Kripalani 4d2d8b2d11 Merge branch 'next' into inmem-journal 2020-07-20 10:38:58 +01:00
Raúl Kripalani becbff0b13 add NilJournal; fix call sites to ChainStore constructor. 2020-07-17 19:10:47 +01:00
Raúl Kripalani 4bcf01938c use new journal from chain/store pkg. 2020-07-17 18:54:26 +01:00
Raúl Kripalani bef7d64e66 refactor EventType construction. 2020-07-17 18:35:15 +01:00
Raúl Kripalani 695f6cfe45 wip in-memory journal. 2020-07-17 14:34:42 +01:00
538 changed files with 52167 additions and 13950 deletions
+50 -4
View File
@@ -34,7 +34,7 @@ commands:
condition: << parameters.linux >>
steps:
- run: sudo apt-get update
- run: sudo apt-get install ocl-icd-opencl-dev
- run: sudo apt-get install ocl-icd-opencl-dev libhwloc-dev
- run: git submodule sync
- run: git submodule update --init
download-params:
@@ -188,6 +188,14 @@ jobs:
command: |
bash <(curl -s https://codecov.io/bash)
test-chain:
<<: *test
test-node:
<<: *test
test-storage:
<<: *test
test-cli:
<<: *test
test-short:
<<: *test
test-window-post:
@@ -231,11 +239,11 @@ jobs:
- run:
name: install statediff globally
command: |
## statediff is optional; we succeed even if compilation fails.
mkdir -p /tmp/statediff
git clone https://github.com/filecoin-project/statediff.git /tmp/statediff
cd /tmp/statediff
go generate ./...
go install ./cmd/statediff
go install ./cmd/statediff || exit 0
- run:
name: go test
environment:
@@ -254,6 +262,25 @@ jobs:
path: /tmp/test-reports
- store_artifacts:
path: /tmp/test-artifacts/conformance-coverage.html
build-lotus-soup:
description: |
Compile `lotus-soup` Testground test plan using the current version of Lotus.
parameters:
<<: *test-params
executor: << parameters.executor >>
steps:
- install-deps
- prepare
- run: cd extern/oni && git submodule sync
- run: cd extern/oni && git submodule update --init
- run: cd extern/filecoin-ffi && make
- run:
name: "replace lotus, filecoin-ffi, blst and fil-blst deps"
command: cd extern/oni/lotus-soup && go mod edit -replace github.com/filecoin-project/lotus=../../../ && go mod edit -replace github.com/filecoin-project/filecoin-ffi=../../filecoin-ffi && go mod edit -replace github.com/supranational/blst=../../blst
- run:
name: "build lotus-soup testplan"
command: pushd extern/oni/lotus-soup && go build -tags=testground .
build-macos:
description: build darwin lotus binary
@@ -332,6 +359,7 @@ jobs:
steps:
- install-deps
- prepare
- run: make deps
- run: make docsgen
- run: git --no-pager diff
- run: git --no-pager diff --quiet
@@ -400,7 +428,8 @@ workflows:
version: 2.1
ci:
jobs:
- lint-all
- lint-all:
concurrency: "16" # expend all docker 2xlarge CPUs.
- mod-tidy-check
- gofmt
- cbor-gen-check
@@ -408,6 +437,22 @@ workflows:
- test:
codecov-upload: true
test-suite-name: full
- test-chain:
codecov-upload: true
test-suite-name: chain
packages: "./chain/..."
- test-node:
codecov-upload: true
test-suite-name: node
packages: "./node/..."
- test-storage:
codecov-upload: true
test-suite-name: storage
packages: "./storage/... ./extern/..."
- test-cli:
codecov-upload: true
test-suite-name: cli
packages: "./cli/... ./cmd/... ./api/..."
- test-window-post:
go-test-flags: "-run=TestWindowedPost"
winpost-test: "1"
@@ -427,6 +472,7 @@ workflows:
test-suite-name: conformance-bleeding-edge
packages: "./conformance"
vectors-branch: master
- build-lotus-soup
- build-debug
- build-all:
requires:
+5 -1
View File
@@ -1,5 +1,9 @@
comment: off
ignore:
- "cbor_gen.go"
- "**/cbor_gen.go"
- "api/test/**/*"
- "api/test/*"
- "gen/**/*"
- "gen/*"
github_checks:
annotations: false
+1
View File
@@ -13,3 +13,4 @@
### Conformance testing.
conformance/ @raulk
extern/test-vectors @raulk
cmd/tvx @raulk
+3
View File
@@ -10,6 +10,9 @@
/lotus-fountain
/lotus-stats
/lotus-bench
/lotus-gateway
/lotus-pcr
/lotus-wallet
/bench.json
/lotuspond/front/node_modules
/lotuspond/front/build
+7 -2
View File
@@ -1,10 +1,15 @@
[submodule "extern/filecoin-ffi"]
path = extern/filecoin-ffi
url = https://github.com/filecoin-project/filecoin-ffi.git
branch = master
[submodule "extern/serialization-vectors"]
path = extern/serialization-vectors
url = https://github.com/filecoin-project/serialization-vectors
url = https://github.com/filecoin-project/serialization-vectors.git
[submodule "extern/test-vectors"]
path = extern/test-vectors
url = https://github.com/filecoin-project/test-vectors.git
[submodule "extern/oni"]
path = extern/oni
url = https://github.com/filecoin-project/oni.git
[submodule "extern/blst"]
path = extern/blst
url = https://github.com/supranational/blst.git
+634 -1
View File
@@ -1,5 +1,639 @@
# Lotus changelog
# 1.1.3 / 2020-11-13
This is an optional release of Lotus that upgrades Lotus dependencies, and includes many performance enhancements, bugfixes, and UX improvements.
## Highlights
- Refactored much of the miner code (https://github.com/filecoin-project/lotus/pull/3618), improving its recovery from restarts and overall sector success rate
- Updated [proofs](https://github.com/filecoin-project/rust-fil-proofs) to v5.3.0, which brings significant performance improvements
- Updated [markets](https://github.com/filecoin-project/go-fil-markets/releases/tag/v1.0.4) to v1.0.4, which reduces failures due to reorgs (https://github.com/filecoin-project/lotus/pull/4730) and uses the newly refactored fund manager (https://github.com/filecoin-project/lotus/pull/4736)
## Changes
#### Core Lotus
- polish: add Equals method to MinerInfo shim (https://github.com/filecoin-project/lotus/pull/4604)
- Fix messagepool accounting (https://github.com/filecoin-project/lotus/pull/4668)
- Prep for gas balancing (https://github.com/filecoin-project/lotus/pull/4651)
- Reduce badger ValueThreshold to 128 (https://github.com/filecoin-project/lotus/pull/4629)
- Config for default max gas fee (https://github.com/filecoin-project/lotus/pull/4652)
- bootstrap: don't return early when one drand resolution fails (https://github.com/filecoin-project/lotus/pull/4626)
- polish: add ClaimsChanged and DiffClaims method to power shim (https://github.com/filecoin-project/lotus/pull/4628)
- Simplify chain event Called API (https://github.com/filecoin-project/lotus/pull/4664)
- Cache deal states for most recent old/new tipset (https://github.com/filecoin-project/lotus/pull/4623)
- Add miner available balance and power info to state miner info (https://github.com/filecoin-project/lotus/pull/4618)
- Call GetHeaviestTipSet() only once when syncing (https://github.com/filecoin-project/lotus/pull/4696)
- modify runtime gasUsed printf (https://github.com/filecoin-project/lotus/pull/4704)
- Rename builtin actor generators (https://github.com/filecoin-project/lotus/pull/4697)
- Move gas multiplier as property of pricelist (https://github.com/filecoin-project/lotus/pull/4728)
- polish: add msig pendingtxn diffing and comp (https://github.com/filecoin-project/lotus/pull/4719)
- Optional chain Bitswap (https://github.com/filecoin-project/lotus/pull/4717)
- rewrite sync manager (https://github.com/filecoin-project/lotus/pull/4599)
- async connect to bootstrappers (https://github.com/filecoin-project/lotus/pull/4785)
- head change coalescer (https://github.com/filecoin-project/lotus/pull/4688)
- move to native badger blockstore; leverage zero-copy View() to deserialize in-place (https://github.com/filecoin-project/lotus/pull/4681)
- badger blockstore: minor improvements (https://github.com/filecoin-project/lotus/pull/4811)
- Do not fail wallet delete because of pre-existing trashed key (https://github.com/filecoin-project/lotus/pull/4589)
- Correctly delete the default wallet address (https://github.com/filecoin-project/lotus/pull/4705)
- Reduce badger ValueTreshold to 128 (https://github.com/filecoin-project/lotus/pull/4629)
- predicates: Fast StateGetActor wrapper (https://github.com/filecoin-project/lotus/pull/4835)
#### Mining
- worker key should change when set sender found key not equal with the value on chain (https://github.com/filecoin-project/lotus/pull/4595)
- extern/sector-storage: fix GPU usage overwrite bug (https://github.com/filecoin-project/lotus/pull/4627)
- sectorstorage: Fix manager restart edge-case (https://github.com/filecoin-project/lotus/pull/4645)
- storagefsm: Fix GetTicket loop when the sector is already precommitted (https://github.com/filecoin-project/lotus/pull/4643)
- Debug flag to force running sealing scheduler (https://github.com/filecoin-project/lotus/pull/4662)
- Fix worker reenabling, handle multiple restarts in worker (https://github.com/filecoin-project/lotus/pull/4666)
- keep retrying the proof until we run out of sectors to skip (https://github.com/filecoin-project/lotus/pull/4633)
- worker: Commands to pause/resume task processing (https://github.com/filecoin-project/lotus/pull/4615)
- struct name incorrect (https://github.com/filecoin-project/lotus/pull/4699)
- optimize code replace strings with constants (https://github.com/filecoin-project/lotus/pull/4769)
- optimize pledge sector (https://github.com/filecoin-project/lotus/pull/4765)
- Track sealing processes across lotus-miner restarts (https://github.com/filecoin-project/lotus/pull/3618)
- Fix scheduler lockups after storage is freed (https://github.com/filecoin-project/lotus/pull/4778)
- storage: Track worker hostnames with work (https://github.com/filecoin-project/lotus/pull/4779)
- Expand sched-diag; Command to abort sealing calls (https://github.com/filecoin-project/lotus/pull/4804)
- miner: Winning PoSt Warmup (https://github.com/filecoin-project/lotus/pull/4824)
- docsgen: Support miner/worker (https://github.com/filecoin-project/lotus/pull/4817)
- miner: Basic storage cleanup command (https://github.com/filecoin-project/lotus/pull/4834)
#### Markets and Data Transfer
- Flesh out data transfer features (https://github.com/filecoin-project/lotus/pull/4572)
- Fix memory leaks in data transfer (https://github.com/filecoin-project/lotus/pull/4619)
- Handle deal id changes in OnDealSectorCommitted (https://github.com/filecoin-project/lotus/pull/4730)
- Refactor FundManager (https://github.com/filecoin-project/lotus/pull/4736)
- refactor: integrate new FundManager (https://github.com/filecoin-project/lotus/pull/4787)
- Fix race in paych manager when req context is cancelled (https://github.com/filecoin-project/lotus/pull/4803)
- fix race in paych manager add funds (https://github.com/filecoin-project/lotus/pull/4597)
- Fix panic in FundManager (https://github.com/filecoin-project/lotus/pull/4808)
- Fix: dont crash on startup if funds migration fails (https://github.com/filecoin-project/lotus/pull/4827)
#### UX
- Make EarlyExpiration in sectors list less scary (https://github.com/filecoin-project/lotus/pull/4600)
- Add commands to change the worker key (https://github.com/filecoin-project/lotus/pull/4513)
- Expose ClientDealSize via CLI (https://github.com/filecoin-project/lotus/pull/4569)
- client deal: Cache CommD when creating multiple deals (https://github.com/filecoin-project/lotus/pull/4535)
- miner sectors list: flags for events/seal time (https://github.com/filecoin-project/lotus/pull/4649)
- make IPFS online mode configurable (https://github.com/filecoin-project/lotus/pull/4650)
- Add sync status to miner info command (https://github.com/filecoin-project/lotus/pull/4669)
- Add a StateDecodeParams method (https://github.com/filecoin-project/lotus/pull/4105)
- sched: Interactive RPC Shell (https://github.com/filecoin-project/lotus/pull/4692)
- Add api for getting status given a code (https://github.com/filecoin-project/lotus/pull/4210)
- Update lotus-stats with a richer cli (https://github.com/filecoin-project/lotus/pull/4718)
- Use TSK passed to GasEstimateGasLimit (https://github.com/filecoin-project/lotus/pull/4739)
- match data type for reward state api (https://github.com/filecoin-project/lotus/pull/4745)
- Add `termination-estimate` to get an estimation for how much a termination penalty will be (https://github.com/filecoin-project/lotus/pull/4617)
- Restrict `ParseFIL` input length (https://github.com/filecoin-project/lotus/pull/4780)
- cmd sectors commitIDs len debug (https://github.com/filecoin-project/lotus/pull/4786)
- Add client deal-stats CLI (https://github.com/filecoin-project/lotus/pull/4788)
- Modify printf format (https://github.com/filecoin-project/lotus/pull/4795)
- Updated msig inspect (https://github.com/filecoin-project/lotus/pull/4533)
- Delete the duplicate output (https://github.com/filecoin-project/lotus/pull/4819)
- miner: Storage list sectors command (https://github.com/filecoin-project/lotus/pull/4831)
- drop a few logs down to debug (https://github.com/filecoin-project/lotus/pull/4832)
#### Testing and Tooling
- refactor: share code between CLI tests (https://github.com/filecoin-project/lotus/pull/4598)
- Fix flaky TestCLIDealFlow (https://github.com/filecoin-project/lotus/pull/4608)
- Fix flaky testMiningReal (https://github.com/filecoin-project/lotus/pull/4609)
- Add election run-dummy command (https://github.com/filecoin-project/lotus/pull/4498)
- Fix .gitmodules (https://github.com/filecoin-project/lotus/pull/4713)
- fix metrics wiring.(https://github.com/filecoin-project/lotus/pull/4691)
- shed: Util for creating ID CIDs (https://github.com/filecoin-project/lotus/pull/4726)
- Run kumquat upgrade on devnets (https://github.com/filecoin-project/lotus/pull/4734)
- Make pond work again (https://github.com/filecoin-project/lotus/pull/4775)
- lotus-stats: fix influx flags (https://github.com/filecoin-project/lotus/pull/4810)
- 2k sync BootstrapPeerThreshold (https://github.com/filecoin-project/lotus/pull/4797)
- test for FundManager panic to ensure it is fixed (https://github.com/filecoin-project/lotus/pull/4825)
- Stop mining at the end of tests (https://github.com/filecoin-project/lotus/pull/4826)
- Make some logs quieter (https://github.com/filecoin-project/lotus/pull/4709)
#### Dependencies
- update filecoin-ffi in go mod (https://github.com/filecoin-project/lotus/pull/4584)
- Update FFI (https://github.com/filecoin-project/lotus/pull/4613)
- feat: integrate new optional blst backend and verification optimizations from proofs (https://github.com/filecoin-project/lotus/pull/4630)
- Use https for blst submodule (https://github.com/filecoin-project/lotus/pull/4710)
- Update go-bitfield (https://github.com/filecoin-project/lotus/pull/4756)
- Update Yamux (https://github.com/filecoin-project/lotus/pull/4758)
- Update to latest go-bitfield (https://github.com/filecoin-project/lotus/pull/4793)
- Update to latest go-address (https://github.com/filecoin-project/lotus/pull/4798)
- update libp2p for stream interface changes (https://github.com/filecoin-project/lotus/pull/4814)
# 1.1.2 / 2020-10-24
This is a patch release of Lotus that builds on the fixes involving worker keys that was introduced in v1.1.1. Miners and node operators should update to this release as soon as possible in order to ensure their blocks are propagated and validated.
## Changes
- Handle worker key changes correctly in runtime (https://github.com/filecoin-project/lotus/pull/4579)
# 1.1.1 / 2020-10-24
This is a patch release of Lotus that addresses some issues caused by when miners change their worker keys. Miners and node operators should update to this release as soon as possible, especially any miner who has changed their worker key recently.
## Changes
- Miner finder for interactive client deal CLI (https://github.com/filecoin-project/lotus/pull/4504)
- Disable blockstore bloom filter (https://github.com/filecoin-project/lotus/pull/4512)
- Add api for getting status given a code (https://github.com/filecoin-project/lotus/pull/4210)
- add batch api for push messages (https://github.com/filecoin-project/lotus/pull/4236)
- add measure datastore wrapper around bench chain datastore (https://github.com/filecoin-project/lotus/pull/4302)
- Look at block base fee for PCR (https://github.com/filecoin-project/lotus/pull/4313)
- Add a shed util to determine % of power that has won a block (https://github.com/filecoin-project/lotus/pull/4318)
- Shed/borked cmd (https://github.com/filecoin-project/lotus/pull/4339)
- optimize mining code (https://github.com/filecoin-project/lotus/pull/4379)
- heaviestTipSet reurning nil is a ok (https://github.com/filecoin-project/lotus/pull/4523)
- Remove most v0 actor imports (https://github.com/filecoin-project/lotus/pull/4383)
- Small chain export optimization (https://github.com/filecoin-project/lotus/pull/4536)
- Add block list to pcr (https://github.com/filecoin-project/lotus/pull/4314)
- Fix circ supply default in conformance (https://github.com/filecoin-project/lotus/pull/4449)
- miner: fix init --create-worker-key (https://github.com/filecoin-project/lotus/pull/4475)
- make push and addLocal atomic (https://github.com/filecoin-project/lotus/pull/4500)
- add some methods that oni needs (https://github.com/filecoin-project/lotus/pull/4501)
- MinerGetBaseInfo: if miner is not found in lookback, check current (https://github.com/filecoin-project/lotus/pull/4508)
- Delete wallet from local wallet cache (https://github.com/filecoin-project/lotus/pull/4526)
- Fix lotus-shed ledger list (https://github.com/filecoin-project/lotus/pull/4521)
- Manage sectors by size instead of proof type (https://github.com/filecoin-project/lotus/pull/4511)
- Feat/api request metrics wrapper (https://github.com/filecoin-project/lotus/pull/4516)
- Fix chain sync stopping to sync (https://github.com/filecoin-project/lotus/pull/4541)
- Use the correct lookback for the worker key when creating blocks (https://github.com/filecoin-project/lotus/pull/4539)
- Cleanup test initialization and always validate VRFs in tests (https://github.com/filecoin-project/lotus/pull/4538)
- Add a market WithdrawBalance CLI (https://github.com/filecoin-project/lotus/pull/4524)
- wallet list: Add market balance and ID address flags (https://github.com/filecoin-project/lotus/pull/4555)
- tvx simulate command; tvx extract --ignore-sanity-checks (https://github.com/filecoin-project/lotus/pull/4554)
- lotus-lite: CLI tests for `lotus client` commands (https://github.com/filecoin-project/lotus/pull/4497)
- lite-mode - market storage and retrieval clients (https://github.com/filecoin-project/lotus/pull/4263)
- Chore: update drand to v1.2.0 (https://github.com/filecoin-project/lotus/pull/4420)
- Fix random test failures (https://github.com/filecoin-project/lotus/pull/4559)
- Fix flaky TestTimedBSSimple (https://github.com/filecoin-project/lotus/pull/4561)
- Make wallet market withdraw usable with miner addresses (https://github.com/filecoin-project/lotus/pull/4556)
- Fix flaky TestChainExportImportFull (https://github.com/filecoin-project/lotus/pull/4564)
- Use older randomness for the PoSt commit on specs-actors version 2 (https://github.com/filecoin-project/lotus/pull/4563)
- shed: Commad to decode messages (https://github.com/filecoin-project/lotus/pull/4565)
- Fetch worker key from correct block on sync (https://github.com/filecoin-project/lotus/pull/4573)
# 1.1.0 / 2020-10-20
This is a mandatory release that introduces the first post-liftoff upgrade to the Filecoin network. The changes that break consensus are an upgrade to specs-actors v2.2.0 at epoch 170000.
## Changes
- Introduce Network version 6 (https://github.com/filecoin-project/lotus/pull/4506)
- Update markets v1.0.0 (https://github.com/filecoin-project/lotus/pull/4505)
- Add some extra logging to try and debug sync issues (https://github.com/filecoin-project/lotus/pull/4486)
- Circle: Run tests for some subsystems separately (https://github.com/filecoin-project/lotus/pull/4496)
- Add a terminate sectors command to lotus-shed (https://github.com/filecoin-project/lotus/pull/4507)
- Add a comment to BlockMessages to address #4446 (https://github.com/filecoin-project/lotus/pull/4491)
# 1.0.0 / 2020-10-19
It's 1.0.0! This is an optional release of Lotus that introduces some UX improvements to the 0.10 series.
This very small release is largely cosmetic, and intended to flag the code that the Filecoin mainnet was launched with.
## API changes
- `StateMsgGasCost` has been removed. The equivalent information can be gained by calling `StateReplay`.
- A `GasCost` field has been added to the `InvocResult` type, meaning detailed gas costs will be returned when calling `StateReplay`, `StateCompute`, and `StateCall`.
- The behaviour of `StateReplay` in response to an empty tipset key has been changed. Instead of simply using the heaviest tipset (which is almost guaranteed to be an unsuccessful replay), we search now search the chain for the tipset that included the message, and replay the message in that tipset (we fail if no such tipset is found).
## Changes
- Increase code coverage! (https://github.com/filecoin-project/lotus/pull/4410)
- Mpool: Don't block node startup loading messages (https://github.com/filecoin-project/lotus/pull/4411)
- Improve the UX of multisig approves (https://github.com/filecoin-project/lotus/pull/4398)
- Use build.BlockDelaySecs for deal start buffer (https://github.com/filecoin-project/lotus/pull/4415)
- Conformance: support multiple protocol versions (https://github.com/filecoin-project/lotus/pull/4393)
- Ensure msig inspect cli works with lotus-lite (https://github.com/filecoin-project/lotus/pull/4421)
- Add command to (slowly) prune lotus chain datastore (https://github.com/filecoin-project/lotus/pull/3876)
- Add WalletVerify to lotus-gateway (https://github.com/filecoin-project/lotus/pull/4373)
- Improve StateMsg APIs (https://github.com/filecoin-project/lotus/pull/4429)
- Add endpoints needed by spacegap (https://github.com/filecoin-project/lotus/pull/4426)
- Make audit balances capable of printing robust addresses (https://github.com/filecoin-project/lotus/pull/4423)
- Custom filters for retrieval deals (https://github.com/filecoin-project/lotus/pull/4424)
- Fix message list api (https://github.com/filecoin-project/lotus/pull/4422)
- Replace bootstrap peers (https://github.com/filecoin-project/lotus/pull/4447)
- Don't overwrite previously-configured maxPieceSize for a persisted ask (https://github.com/filecoin-project/lotus/pull/4480)
- State: optimize state snapshot address cache (https://github.com/filecoin-project/lotus/pull/4481)
# 0.10.2 / 2020-10-14
This is an optional release of Lotus that updates markets to 0.9.1, which fixes an issue affecting deals that were mid-transfer when the node was upgraded to 0.9.0. This release also includes some tweaks to default gas values and minor performance improvements.
## Changes
- Use updated stored ask API (https://github.com/filecoin-project/lotus/pull/4384)
- tvx: trace puts to blockstore for inclusion in CAR. (https://github.com/filecoin-project/lotus/pull/4278)
- Add propose remove (https://github.com/filecoin-project/lotus/pull/4311)
- Update to 0.9.1 bugfix release (https://github.com/filecoin-project/lotus/pull/4402)
- Update drand endpoints (https://github.com/filecoin-project/lotus/pull/4125)
- fix: return true when deadlines changed (https://github.com/filecoin-project/lotus/pull/4403)
- sync wait --watch (https://github.com/filecoin-project/lotus/pull/4396)
- reduce garbage in blockstore (https://github.com/filecoin-project/lotus/pull/4406)
- give the TimeCacheBS tests a bit more time (https://github.com/filecoin-project/lotus/pull/4407)
- Improve gas defaults (https://github.com/filecoin-project/lotus/pull/4408)
- Change default gas premium to for 10 block inclusion (https://github.com/filecoin-project/lotus/pull/4222)
# 0.10.1 / 2020-10-14
This is an optional release of Lotus that updates markets to 0.9.0, which adds the ability to restart data transfers. This release also introduces Ledger support, and various UX improvements.
## Changes
- Test the tape upgrade (https://github.com/filecoin-project/lotus/pull/4328)
- Adding in Ledger support (https://github.com/filecoin-project/lotus/pull/4290)
- Improve the UX for lotus-miner sealing workers (https://github.com/filecoin-project/lotus/pull/4329)
- Add a CLI tool for miner's to repay debt (https://github.com/filecoin-project/lotus/pull/4319)
- Rename params_testnet to params_mainnet (https://github.com/filecoin-project/lotus/pull/4336)
- Use seal-duration in calculating the earliest StartEpoch (https://github.com/filecoin-project/lotus/pull/4337)
- Reject deals that are > 7 days in the future in the BasicDealFilter (https://github.com/filecoin-project/lotus/pull/4173)
- Add an API endpoint to calculate the exact circulating supply (https://github.com/filecoin-project/lotus/pull/4148)
- lotus-pcr: ignore all other market messages (https://github.com/filecoin-project/lotus/pull/4341)
- Add message CID to InvocResult (https://github.com/filecoin-project/lotus/pull/4382)
- types: Add CID fields to messages in json marshalers (https://github.com/filecoin-project/lotus/pull/4338)
- fix(sync state): set state height to actual tipset height (https://github.com/filecoin-project/lotus/pull/4347)
- Fix off by one tipset in searchBackForMsg (https://github.com/filecoin-project/lotus/pull/4367)
- fix a panic on startup when we fail to load the tipset (https://github.com/filecoin-project/lotus/pull/4376)
- Avoid having the same message CID show up in execution traces (https://github.com/filecoin-project/lotus/pull/4350)
- feat(markets): update markets 0.9.0 and add data transfer restart (https://github.com/filecoin-project/lotus/pull/4363)
# 0.10.0 / 2020-10-12
This is a consensus-breaking hotfix that addresses an issue in specs-actors v2.0.3 that made it impossible to pledge new 32GiB sectors. The change in Lotus is to update to actors v2.1.0, behind the new network version 5.
## Changes
- make pledge test pass with the race detector (https://github.com/filecoin-project/lotus/pull/4291)
- fix a race in tipset cache usage (https://github.com/filecoin-project/lotus/pull/4282)
- add an api for removing multisig signers (https://github.com/filecoin-project/lotus/pull/4274)
- cli: Don't output errors to stdout (https://github.com/filecoin-project/lotus/pull/4298)
- Fix panic in wallet export when key is not found (https://github.com/filecoin-project/lotus/pull/4299)
- Dump the block validation cache whenever we perform an import (https://github.com/filecoin-project/lotus/pull/4287)
- Fix two races (https://github.com/filecoin-project/lotus/pull/4301)
- sync unmark-bad --all (https://github.com/filecoin-project/lotus/pull/4296)
- decode parameters for multisig transactions in inspect (https://github.com/filecoin-project/lotus/pull/4312)
- Chain is love (https://github.com/filecoin-project/lotus/pull/4321)
- lotus-stats: optmize getting miner power (https://github.com/filecoin-project/lotus/pull/4315)
- implement tape upgrade (https://github.com/filecoin-project/lotus/pull/4322)
# 0.9.1 / 2020-10-10
This release fixes an issue which may cause the actors v2 migration to compute the state incorrectly when more than one migration is running in parallel.
## Changes
- Make concurrent actor migrations safe (https://github.com/filecoin-project/lotus/pull/4293)
- Remote wallet backends (https://github.com/filecoin-project/lotus/pull/3583)
- Track funds in FundMgr correctly in case of AddFunds failing (https://github.com/filecoin-project/lotus/pull/4273)
- Partial lite-node mode (https://github.com/filecoin-project/lotus/pull/4095)
- Fix potential infinite loop in GetBestMiningCandidate (https://github.com/filecoin-project/lotus/pull/3444)
- sync wait: Handle processed message offset (https://github.com/filecoin-project/lotus/pull/4253)
- Add some new endpoints for querying Msig info (https://github.com/filecoin-project/lotus/pull/4250)
- Update markets v0.7.1 (https://github.com/filecoin-project/lotus/pull/4254)
- Optimize SearchForMessage and GetReceipt (https://github.com/filecoin-project/lotus/pull/4246)
- Use FIL instead of attoFIL in CLI more consistently (https://github.com/filecoin-project/lotus/pull/4249)
- fix: clash between daemon --api flag and cli tests (https://github.com/filecoin-project/lotus/pull/4241)
- add more info to chain sync lookback failure (https://github.com/filecoin-project/lotus/pull/4245)
- Add message counts to inspect chain output (https://github.com/filecoin-project/lotus/pull/4230)
# 0.9.0 / 2020-10-07
This consensus-breaking release of Lotus upgrades the actors version to v2.0.0. This requires migrating actor state from v0 to v2. The changes that break consensus are:
- Introducing v2 actors and its migration (https://github.com/filecoin-project/lotus/pull/3936)
- Runtime's Receiver() should only return ID addresses (https://github.com/filecoin-project/lotus/pull/3589)
- Update miner eligibility checks for v2 actors (https://github.com/filecoin-project/lotus/pull/4188)
- Add funds that have left FilReserve to circ supply (https://github.com/filecoin-project/lotus/pull/4160)
- Set WinningPoStSectorSetLookback to finality post-v2 actors (https://github.com/filecoin-project/lotus/pull/4190)
- fix: error when actor panics directly (https://github.com/filecoin-project/lotus/pull/3697)
## Changes
#### Dependencies
- Update go-bitfield (https://github.com/filecoin-project/lotus/pull/4171)
- update the AMT implementation (https://github.com/filecoin-project/lotus/pull/4194)
- Update to actors v0.2.1 (https://github.com/filecoin-project/lotus/pull/4199)
#### Core Lotus
- Paych: fix voucher amount verification (https://github.com/filecoin-project/lotus/pull/3821)
- Cap market provider messages (https://github.com/filecoin-project/lotus/pull/4141)
- Run fork function after cron for null block safety (https://github.com/filecoin-project/lotus/pull/4114)
- use bitswap sessions when fetching messages, and cancel them (https://github.com/filecoin-project/lotus/pull/4142)
- relax pubsub IPColocationFactorThreshold to 5 (https://github.com/filecoin-project/lotus/pull/4183)
- Support addresses with mainnet prefixes (https://github.com/filecoin-project/lotus/pull/4186)
- fix: make message signer nonce generation transactional (https://github.com/filecoin-project/lotus/pull/4165)
- build: Env var to keep test address output (https://github.com/filecoin-project/lotus/pull/4213)
- make vm.EnableGasTracing public (https://github.com/filecoin-project/lotus/pull/4214)
- introduce separate state-tree versions (https://github.com/filecoin-project/lotus/pull/4197)
- reject explicit "calls" at the upgrade height (https://github.com/filecoin-project/lotus/pull/4231)
- return an illegal actor error when we see an unsupported actor version (https://github.com/filecoin-project/lotus/pull/4232)
- Set head should unmark blocks as valid (https://gist.github.com/travisperson/3c7cddd77a33979a519ccef4e6515f20)
#### Mining
- Increased ExpectedSealDuration and and WaitDealsDelay (https://github.com/filecoin-project/lotus/pull/3743)
- Miner backup/restore commands (https://github.com/filecoin-project/lotus/pull/4133)
- lotus-miner: add more help text to storage / attach (https://github.com/filecoin-project/lotus/pull/3961)
- Reject deals that are > 7 days in the future in the BasicDealFilter (https://github.com/filecoin-project/lotus/pull/4173)
- feat(miner): add miner deadline diffing logic (https://github.com/filecoin-project/lotus/pull/4178)
#### UX
- Improve the UX for replacing messages (https://github.com/filecoin-project/lotus/pull/4134)
- Add verified flag to interactive deal creation (https://github.com/filecoin-project/lotus/pull/4145)
- Add command to (slowly) prune lotus chain datastore (https://github.com/filecoin-project/lotus/pull/3876)
- Some helpers for verifreg work (https://github.com/filecoin-project/lotus/pull/4124)
- Always use default 720h for setask duration and hide the duration param option (https://github.com/filecoin-project/lotus/pull/4077)
- Convert ID addresses to key addresses before checking wallet (https://github.com/filecoin-project/lotus/pull/4122)
- add a command to view block space utilization (https://github.com/filecoin-project/lotus/pull/4176)
- allow usage inspection on a chain segment (https://github.com/filecoin-project/lotus/pull/4177)
- Add mpool stats for base fee (https://github.com/filecoin-project/lotus/pull/4170)
- Add verified status to api.DealInfo (https://github.com/filecoin-project/lotus/pull/4153)
- Add a CLI command to set a miner's owner address (https://github.com/filecoin-project/lotus/pull/4189)
#### Tooling and validation
- Lotus-pcr: add recover-miners command (https://github.com/filecoin-project/lotus/pull/3714)
- MpoolPushUntrusted API for gateway (https://github.com/filecoin-project/lotus/pull/3915)
- Test lotus-miner info all (https://github.com/filecoin-project/lotus/pull/4166)
- chain export: Error with unfinished exports (https://github.com/filecoin-project/lotus/pull/4179)
- add printf in TestWindowPost (https://github.com/filecoin-project/lotus/pull/4043)
- add trace wdpost (https://github.com/filecoin-project/lotus/pull/4020)
- Fix noncefix (https://github.com/filecoin-project/lotus/pull/4202)
- Lotus-pcr: Limit the fee cap of messages we will process, refund gas fees for windowed post and storage deals (https://github.com/filecoin-project/lotus/pull/4198)
- Fix pond (https://github.com/filecoin-project/lotus/pull/4203)
- allow manual setting of noncefix fee cap (https://github.com/filecoin-project/lotus/pull/4205)
- implement command to get execution traces of any message (https://github.com/filecoin-project/lotus/pull/4200)
- conformance: minor driver refactors (https://github.com/filecoin-project/lotus/pull/4211)
- lotus-pcr: ignore all other messages (https://github.com/filecoin-project/lotus/pull/4218)
- lotus-pcr: zero refund (https://github.com/filecoin-project/lotus/pull/4229)
## Contributors
The following contributors had 5 or more commits go into this release.
We are grateful for every contribution!
| Contributor | Commits | Lines ± |
|--------------------|---------|---------------|
| Stebalien | 84 | +3425/-2287 |
| magik6k | 41 | +2121/-506 |
| arajasek | 39 | +2467/-424 |
| Kubuxu | 25 | +2344/-775 |
| raulk | 21 | +287/-196 |
| whyrusleeping | 13 | +727/-71 |
| hsanjuan | 13 | +5886/-7956 |
| dirkmc | 11 | +2634/-576 |
| travisperson | 8 | +923/-202 |
| ribasushi | 6 | +188/-128 |
| zgfzgf | 5 | +21/-17 |
# 0.8.1 / 2020-09-30
This optional release of Lotus introduces a new version of markets which switches to CBOR-map encodings, and allows datastore migrations. The release also introduces several improvements to the mining process, a few performance optimizations, and a battery of UX additions and enhancements.
## Changes
#### Dependencies
- Markets 0.7.0 with updated data stores (https://github.com/filecoin-project/lotus/pull/4089)
- Update ffi to code with blst fixes (https://github.com/filecoin-project/lotus/pull/3998)
#### Core Lotus
- Fix GetPower with no miner address (https://github.com/filecoin-project/lotus/pull/4049)
- Refactor: Move nonce generation out of mpool (https://github.com/filecoin-project/lotus/pull/3970)
#### Performance
- Implement caching syscalls for import-bench (https://github.com/filecoin-project/lotus/pull/3888)
- Fetch tipset blocks in parallel (https://github.com/filecoin-project/lotus/pull/4074)
- Optimize Tipset equals() (https://github.com/filecoin-project/lotus/pull/4056)
- Make state transition in validation async (https://github.com/filecoin-project/lotus/pull/3868)
#### Mining
- Add trace window post (https://github.com/filecoin-project/lotus/pull/4020)
- Use abstract types for Dont recompute post on revert (https://github.com/filecoin-project/lotus/pull/4022)
- Fix injectNulls logic in test miner (https://github.com/filecoin-project/lotus/pull/4058)
- Fix potential panic in FinalizeSector (https://github.com/filecoin-project/lotus/pull/4092)
- Don't recompute post on revert (https://github.com/filecoin-project/lotus/pull/3924)
- Fix some failed precommit handling (https://github.com/filecoin-project/lotus/pull/3445)
- Add --no-swap flag for worker (https://github.com/filecoin-project/lotus/pull/4107)
- Allow some single-thread tasks to run in parallel with PC2/C2 (https://github.com/filecoin-project/lotus/pull/4116)
#### UX
- Add an envvar to set address network version (https://github.com/filecoin-project/lotus/pull/4028)
- Add logging to chain export (https://github.com/filecoin-project/lotus/pull/4030)
- Add JSON output to state compute (https://github.com/filecoin-project/lotus/pull/4038)
- Wallet list CLI: Print balances/nonces (https://github.com/filecoin-project/lotus/pull/4088)
- Added an option to show or not show sector info for `lotus-miner info` (https://github.com/filecoin-project/lotus/pull/4003)
- Add a command to import an ipld object into the chainstore (https://github.com/filecoin-project/lotus/pull/3434)
- Improve the lotus-shed dealtracker (https://github.com/filecoin-project/lotus/pull/4051)
- Docs review and re-organization (https://github.com/filecoin-project/lotus/pull/3431)
- Fix wallet list (https://github.com/filecoin-project/lotus/pull/4104)
- Add an endpoint to validate whether a string is a well-formed address (https://github.com/filecoin-project/lotus/pull/4106)
- Add an option to set config path (https://github.com/filecoin-project/lotus/pull/4103)
- Add printf in TestWindowPost (https://github.com/filecoin-project/lotus/pull/4043)
- Improve miner sectors list UX (https://github.com/filecoin-project/lotus/pull/4108)
#### Tooling
- Move policy change to seal bench (https://github.com/filecoin-project/lotus/pull/4032)
- Add back network power to stats (https://github.com/filecoin-project/lotus/pull/4050)
- Conformance: Record and feed circulating supply (https://github.com/filecoin-project/lotus/pull/4078)
- Snapshot import progress bar, add HTTP support (https://github.com/filecoin-project/lotus/pull/4070)
- Add lotus shed util to validate a tipset (https://github.com/filecoin-project/lotus/pull/4065)
- tvx: a test vector extraction and execution tool (https://github.com/filecoin-project/lotus/pull/4064)
#### Bootstrap
- Add new bootstrappers (https://github.com/filecoin-project/lotus/pull/4007)
- Add Glif node to bootstrap peers (https://github.com/filecoin-project/lotus/pull/4004)
- Add one more node located in China (https://github.com/filecoin-project/lotus/pull/4041)
- Add ipfsmain bootstrapper (https://github.com/filecoin-project/lotus/pull/4067)
# 0.8.0 / 2020-09-26
This consensus-breaking release of Lotus introduces an upgrade to the network. The changes that break consensus are:
- Upgrading to specs-actors v0.9.11, which reduces WindowPoSt faults per [FIP 0002](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0002.md) to reduce cost for honest miners with occasional faults (see https://github.com/filecoin-project/specs-actors/pull/1181)
- Revisions to some cryptoeconomics and network params
This release also updates go-fil-markets to fix an incompatibility issue between v0.7.2 and earlier versions.
## Changes
#### Dependencies
- Update spec actors to 0.9.11 (https://github.com/filecoin-project/lotus/pull/4039)
- Update markets to 0.6.3 (https://github.com/filecoin-project/lotus/pull/4013)
#### Core Lotus
- Network upgrade (https://github.com/filecoin-project/lotus/pull/4039)
- Fix AddSupportedProofTypes (https://github.com/filecoin-project/lotus/pull/4033)
- Return an error when we fail to find a sector when checking sector expiration (https://github.com/filecoin-project/lotus/pull/4026)
- Batch blockstore copies after block validation (https://github.com/filecoin-project/lotus/pull/3980)
- Remove a misleading miner actor abstraction (https://github.com/filecoin-project/lotus/pull/3977)
- Fix out-of-bounds when loading all sector infos (https://github.com/filecoin-project/lotus/pull/3976)
- Fix break condition in the miner (https://github.com/filecoin-project/lotus/pull/3953)
#### UX
- Correct helptext around miners setting ask (https://github.com/filecoin-project/lotus/pull/4009)
- Make sync wait nicer (https://github.com/filecoin-project/lotus/pull/3991)
#### Tooling and validation
- Small adjustments following network upgradability changes (https://github.com/filecoin-project/lotus/pull/3996)
- Add some more big pictures stats to stateroot stat (https://github.com/filecoin-project/lotus/pull/3995)
- Add some actors policy setters for testing (https://github.com/filecoin-project/lotus/pull/3975)
## Contributors
The following contributors had 5 or more commits go into this release.
We are grateful for every contribution!
| Contributor | Commits | Lines ± |
|--------------------|---------|---------------|
| arajasek | 66 | +3140/-1261 |
| Stebalien | 64 | +3797/-3434 |
| magik6k | 48 | +1892/-976 |
| raulk | 40 | +2412/-1549 |
| vyzo | 22 | +287/-196 |
| alanshaw | 15 | +761/-146 |
| whyrusleeping | 15 | +736/-52 |
| hannahhoward | 14 | +1237/-837 |
| anton | 6 | +32/-8 |
| travisperson | 5 | +502/-6 |
| Frank | 5 | +78/-39 |
| Jennifer | 5 | +148/-41 |
# 0.7.2 / 2020-09-23
This optional release of Lotus introduces a major refactor around how a Lotus node interacts with code from the specs-actors repo. We now use interfaces to read the state of actors, which is required to be able to reason about different versions of actors code at the same time.
Additionally, this release introduces various improvements to the sync process, as well as changes to better the overall UX experience.
## Changes
#### Core Lotus
- Network upgrade support (https://github.com/filecoin-project/lotus/pull/3781)
- Upgrade markets to `v0.6.2` (https://github.com/filecoin-project/lotus/pull/3974)
- Validate chain sync response indices when fetching messages (https://github.com/filecoin-project/lotus/pull/3939)
- Add height diff to sync wait (https://github.com/filecoin-project/lotus/pull/3926)
- Replace Requires with Wants (https://github.com/filecoin-project/lotus/pull/3898)
- Update state diffing for market actor (https://github.com/filecoin-project/lotus/pull/3889)
- Parallel fetch for sync (https://github.com/filecoin-project/lotus/pull/3887)
- Fix SectorState (https://github.com/filecoin-project/lotus/pull/3881)
#### User Experience
- Add basic deal stats api server for spacerace slingshot (https://github.com/filecoin-project/lotus/pull/3963)
- When doing `sectors update-state`, show a list of existing states if user inputs an invalid one (https://github.com/filecoin-project/lotus/pull/3944)
- Fix `lotus-miner storage find` error (https://github.com/filecoin-project/lotus/pull/3927)
- Log shutdown method for lotus daemon and miner (https://github.com/filecoin-project/lotus/pull/3925)
- Update build and setup instruction link (https://github.com/filecoin-project/lotus/pull/3919)
- Add an option to hide removed sectors from `sectors list` output (https://github.com/filecoin-project/lotus/pull/3903)
#### Testing and validation
- Add init.State#Remove() for testing (https://github.com/filecoin-project/lotus/pull/3971)
- lotus-shed: add consensus check command (https://github.com/filecoin-project/lotus/pull/3933)
- Add keyinfo verify and jwt token command to lotus-shed (https://github.com/filecoin-project/lotus/pull/3914)
- Fix conformance gen (https://github.com/filecoin-project/lotus/pull/3892)
# 0.7.1 / 2020-09-17
This optional release of Lotus introduces some critical fixes to the window PoSt process. It also upgrades some core dependencies, and introduces many improvements to the mining process, deal-making cycle, and overall User Experience.
## Changes
#### Some notable improvements:
- Correctly construct params for `SubmitWindowedPoSt` messages (https://github.com/filecoin-project/lotus/pull/3909)
- Skip sectors correctly for Window PoSt (https://github.com/filecoin-project/lotus/pull/3839)
- Split window PoST submission into multiple messages (https://github.com/filecoin-project/lotus/pull/3689)
- Improve journal coverage (https://github.com/filecoin-project/lotus/pull/2455)
- Allow retrievals while sealing (https://github.com/filecoin-project/lotus/pull/3778)
- Don't prune locally published messages (https://github.com/filecoin-project/lotus/pull/3772)
- Add get-ask, set-ask retrieval commands (https://github.com/filecoin-project/lotus/pull/3886)
- Consistently name winning and window post in logs (https://github.com/filecoin-project/lotus/pull/3873))
- Add auto flag to mpool replace (https://github.com/filecoin-project/lotus/pull/3752))
#### Dependencies
- Upgrade markets to `v0.6.1` (https://github.com/filecoin-project/lotus/pull/3906)
- Upgrade specs-actors to `v0.9.10` (https://github.com/filecoin-project/lotus/pull/3846)
- Upgrade badger (https://github.com/filecoin-project/lotus/pull/3739)
# 0.7.0 / 2020-09-10
This consensus-breaking release of Lotus is designed to test a network upgrade on the space race testnet. The changes that break consensus are:
- Upgrading the Drand network used from the test Drand network to the League of Entropy main drand network. This is the same Drand network that will be used in the Filecoin mainnet.
- Upgrading to specs-actors v0.9.8, which adds a new method to the Multisig actor.
## Changes
#### Core Lotus
- Fix IsAncestorOf (https://github.com/filecoin-project/lotus/pull/3717)
- Update to specs-actors v0.9.8 (https://github.com/filecoin-project/lotus/pull/3725)
- Increase chain throughput by 20% (https://github.com/filecoin-project/lotus/pull/3732)
- Updare to go-libp2p-pubsub `master` (https://github.com/filecoin-project/lotus/pull/3735)
- Drand upgrade (https://github.com/filecoin-project/lotus/pull/3670)
- Multisig API additions (https://github.com/filecoin-project/lotus/pull/3590)
#### Storage Miner
- Increase the number of times precommit2 is attempted before moving back to precommit1 (https://github.com/filecoin-project/lotus/pull/3720)
#### Message pool
- Relax mpool add strictness checks for local pushes (https://github.com/filecoin-project/lotus/pull/3724)
#### Maintenance
- Fix devnets (https://github.com/filecoin-project/lotus/pull/3712)
- Fix(chainwatch): compare prev miner with cur miner (https://github.com/filecoin-project/lotus/pull/3715)
- CI: fix statediff build; make optional (https://github.com/filecoin-project/lotus/pull/3729)
- Feat: Chaos abort (https://github.com/filecoin-project/lotus/pull/3733)
## Contributors
The following contributors had commits go into this release.
We are grateful for every contribution!
| Contributor | Commits | Lines ± |
|--------------------|---------|---------------|
| arajasek | 28 | +1144/-239 |
| Kubuxu | 19 | +452/-261 |
| whyrusleeping | 13 | +456/-87 |
| vyzo | 11 | +318/-20 |
| raulk | 10 | +1289/-350 |
| magik6k | 6 | +188/-55 |
| dirkmc | 3 | +31/-8 |
| alanshaw | 3 | +176/-37 |
| Stebalien | 2 | +9/-12 |
| lanzafame | 1 | +1/-1 |
| frrist | 1 | +1/-1 |
| mishmosh | 1 | +1/-1 |
| nonsense | 1 | +1/-0 |
# 0.6.2 / 2020-09-09
This release introduces some critical fixes to message selection and gas estimation logic. It also adds the ability for nodes to mark a certain tipset as checkpointed, as well as various minor improvements and bugfixes.
@@ -38,7 +672,6 @@ This release introduces some critical fixes to message selection and gas estimat
- Paych: add docs on how to use paych status (https://github.com/filecoin-project/lotus/pull/3690)
- Initial CODEOWNERS (https://github.com/filecoin-project/lotus/pull/3691)
# 0.6.1 / 2020-09-08
This optional release introduces a minor improvement to the sync process, ensuring nodes don't fall behind and then resync.
+31 -5
View File
@@ -92,6 +92,12 @@ lotus-shed: $(BUILD_DEPS)
.PHONY: lotus-shed
BINS+=lotus-shed
lotus-gateway: $(BUILD_DEPS)
rm -f lotus-gateway
go build $(GOFLAGS) -o lotus-gateway ./cmd/lotus-gateway
.PHONY: lotus-gateway
BINS+=lotus-gateway
build: lotus lotus-miner lotus-worker
@[[ $$(type -P "lotus") ]] && echo "Caution: you have \
an existing lotus binary in your PATH. This may cause problems if you don't run 'sudo make install'" || true
@@ -127,18 +133,30 @@ benchmarks:
lotus-pond: 2k
go build -o lotus-pond ./lotuspond
(cd lotuspond/front && npm i && CI=false npm run build)
.PHONY: lotus-pond
BINS+=lotus-pond
lotus-pond-front:
(cd lotuspond/front && npm i && CI=false npm run build)
.PHONY: lotus-pond-front
lotus-pond-app: lotus-pond-front lotus-pond
.PHONY: lotus-pond-app
lotus-townhall:
rm -f lotus-townhall
go build -o lotus-townhall ./cmd/lotus-townhall
(cd ./cmd/lotus-townhall/townhall && npm i && npm run build)
go run github.com/GeertJohan/go.rice/rice append --exec lotus-townhall -i ./cmd/lotus-townhall -i ./build
.PHONY: lotus-townhall
BINS+=lotus-townhall
lotus-townhall-front:
(cd ./cmd/lotus-townhall/townhall && npm i && npm run build)
.PHONY: lotus-townhall-front
lotus-townhall-app: lotus-touch lotus-townhall-front
go run github.com/GeertJohan/go.rice/rice append --exec lotus-townhall -i ./cmd/lotus-townhall -i ./build
.PHONY: lotus-townhall-app
lotus-fountain:
rm -f lotus-fountain
go build -o lotus-fountain ./cmd/lotus-fountain
@@ -161,7 +179,7 @@ BINS+=lotus-bench
lotus-stats:
rm -f lotus-stats
go build -o lotus-stats ./cmd/lotus-stats
go build $(GOFLAGS) -o lotus-stats ./cmd/lotus-stats
go run github.com/GeertJohan/go.rice/rice append --exec lotus-stats -i ./build
.PHONY: lotus-stats
BINS+=lotus-stats
@@ -180,6 +198,12 @@ lotus-health:
.PHONY: lotus-health
BINS+=lotus-health
lotus-wallet:
rm -f lotus-wallet
go build -o lotus-wallet ./cmd/lotus-wallet
.PHONY: lotus-wallet
BINS+=lotus-wallet
testground:
go build -tags testground -o /dev/null ./cmd/lotus
.PHONY: testground
@@ -280,7 +304,9 @@ method-gen:
gen: type-gen method-gen
docsgen:
go run ./api/docgen > documentation/en/api-methods.md
go run ./api/docgen "api/api_full.go" "FullNode" > documentation/en/api-methods.md
go run ./api/docgen "api/api_storage.go" "StorageMiner" > documentation/en/api-methods-miner.md
go run ./api/docgen "api/api_worker.go" "WorkerAPI" > documentation/en/api-methods-worker.md
print-%:
@echo $*=$($*)
+2 -2
View File
@@ -1,5 +1,5 @@
<p align="center">
<a href="https://lotu.sh/" title="Lotus Docs">
<a href="https://docs.filecoin.io/" title="Filecoin Docs">
<img src="documentation/images/lotus_logo_h.png" alt="Project Lotus Logo" width="244" />
</a>
</p>
@@ -18,7 +18,7 @@ Lotus is an implementation of the Filecoin Distributed Storage Network. For more
## Building & Documentation
For instructions on how to build lotus from source, please visit [https://lotu.sh](https://lotu.sh) or read the source [here](https://github.com/filecoin-project/lotus/tree/master/documentation).
For instructions on how to build, install and setup lotus, please visit [https://docs.filecoin.io/get-started/lotus](https://docs.filecoin.io/get-started/lotus/).
## Reporting a Vulnerability
+3 -9
View File
@@ -2,9 +2,7 @@
## Reporting a Vulnerability
For *critical* bugs, please send an email to security@filecoin.org.
The bug reporting process differs between bugs that are critical and may crash the network, and others that are unlikely to cause problems if malicious parties know about it. For non-critical bugs, please simply file a GitHub [issue](https://github.com/filecoin-project/lotus/issues/new?template=bug_report.md).
For *critical* bugs, please consult our Security Policy and Responsible Disclosure Program information at https://github.com/filecoin-project/community/blob/master/SECURITY.md
Please try to provide a clear description of any bugs reported, along with how to reproduce the bug if possible. More detailed bug reports (especially those with a PoC included) will help us move forward much faster. Additionally, please avoid reporting bugs that already have open issues. Take a moment to search the issue list of the related GitHub repositories before writing up a new report.
@@ -20,10 +18,6 @@ Here are some examples of bugs we would consider 'critical':
This is not an exhaustive list, but should provide some idea of what we consider 'critical'.
## Supported Versions
## Reporting a non security bug
* TODO: This should be defined and set up by Mainnet launch.
| Version | Supported |
| ------- | ------------------ |
| Testnet | :white_check_mark: |
For non-critical bugs, please simply file a GitHub [issue](https://github.com/filecoin-project/lotus/issues/new?template=bug_report.md).
+5
View File
@@ -4,6 +4,8 @@ import (
"context"
"fmt"
"github.com/google/uuid"
"github.com/filecoin-project/go-jsonrpc/auth"
metrics "github.com/libp2p/go-libp2p-core/metrics"
"github.com/libp2p/go-libp2p-core/network"
@@ -58,6 +60,9 @@ type Common interface {
// trigger graceful shutdown
Shutdown(context.Context) error
// Session returns a random UUID of api provider session
Session(context.Context) (uuid.UUID, error)
Closing(context.Context) (<-chan struct{}, error)
}
+207 -70
View File
@@ -5,7 +5,8 @@ import (
"fmt"
"time"
"github.com/filecoin-project/specs-actors/actors/runtime/proof"
datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-state-types/network"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/peer"
@@ -18,12 +19,13 @@ import (
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/specs-actors/actors/builtin/market"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/specs-actors/actors/builtin/paych"
"github.com/filecoin-project/specs-actors/actors/builtin/power"
"github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
"github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/actors/builtin/paych"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/builtin/power"
"github.com/filecoin-project/lotus/chain/types"
marketevents "github.com/filecoin-project/lotus/markets/loggers"
"github.com/filecoin-project/lotus/node/modules/dtypes"
@@ -75,6 +77,9 @@ type FullNode interface {
// blockstore and returns raw bytes.
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
// ChainDeleteObj deletes node referenced by the given CID
ChainDeleteObj(context.Context, cid.Cid) error
// ChainHasObj checks if a given CID exists in the chain blockstore.
ChainHasObj(context.Context, cid.Cid) (bool, error)
@@ -116,7 +121,8 @@ type FullNode interface {
// The exported chain data includes the header chain from the given tipset
// back to genesis, the entire genesis state, and the most recent 'nroots'
// state trees.
ChainExport(ctx context.Context, nroots abi.ChainEpoch, tsk types.TipSetKey) (<-chan []byte, error)
// If oldmsgskip is set, messages from before the requested roots are also not included.
ChainExport(ctx context.Context, nroots abi.ChainEpoch, oldmsgskip bool, tsk types.TipSetKey) (<-chan []byte, error)
// MethodGroup: Beacon
// The Beacon method group contains methods for interacting with the random beacon (DRAND)
@@ -167,10 +173,16 @@ type FullNode interface {
// SyncUnmarkBad unmarks a blocks as bad, making it possible to be validated and synced again.
SyncUnmarkBad(ctx context.Context, bcid cid.Cid) error
// SyncUnmarkAllBad purges bad block cache, making it possible to sync to chains previously marked as bad
SyncUnmarkAllBad(ctx context.Context) error
// SyncCheckBad checks if a block was marked as bad, and if it was, returns
// the reason.
SyncCheckBad(ctx context.Context, bcid cid.Cid) (string, error)
// SyncValidateTipset indicates whether the provided tipset is valid or not
SyncValidateTipset(ctx context.Context, tsk types.TipSetKey) (bool, error)
// MethodGroup: Mpool
// The Mpool methods are for interacting with the message pool. The message pool
// manages all incoming and outgoing 'messages' going over the network.
@@ -184,6 +196,9 @@ type FullNode interface {
// MpoolPush pushes a signed message to mempool.
MpoolPush(context.Context, *types.SignedMessage) (cid.Cid, error)
// MpoolPushUntrusted pushes a signed message to mempool from untrusted sources.
MpoolPushUntrusted(context.Context, *types.SignedMessage) (cid.Cid, error)
// MpoolPushMessage atomically assigns a nonce, signs, and pushes a message
// to mempool.
// maxFee is only used when GasFeeCap/GasPremium fields aren't specified
@@ -192,6 +207,15 @@ type FullNode interface {
// based on current chain conditions
MpoolPushMessage(ctx context.Context, msg *types.Message, spec *MessageSendSpec) (*types.SignedMessage, error)
// MpoolBatchPush batch pushes a signed message to mempool.
MpoolBatchPush(context.Context, []*types.SignedMessage) ([]cid.Cid, error)
// MpoolBatchPushUntrusted batch pushes a signed message to mempool from untrusted sources.
MpoolBatchPushUntrusted(context.Context, []*types.SignedMessage) ([]cid.Cid, error)
// MpoolBatchPushMessage batch pushes a unsigned message to mempool.
MpoolBatchPushMessage(context.Context, []*types.Message, *MessageSendSpec) ([]*types.SignedMessage, error)
// MpoolGetNonce gets next nonce for the specified sender.
// Note that this method may not be atomic. Use MpoolPushMessage instead.
MpoolGetNonce(context.Context, address.Address) (uint64, error)
@@ -215,7 +239,9 @@ type FullNode interface {
// MethodGroup: Wallet
// WalletNew creates a new address in the wallet with the given sigType.
WalletNew(context.Context, crypto.SigType) (address.Address, error)
// Available key types: bls, secp256k1, secp256k1-ledger
// Support for numerical types: 1 - secp256k1, 2 - BLS is deprecated
WalletNew(context.Context, types.KeyType) (address.Address, error)
// WalletHas indicates whether the given address is in the wallet.
WalletHas(context.Context, address.Address) (bool, error)
// WalletList lists all the addresses in the wallet.
@@ -228,7 +254,7 @@ type FullNode interface {
WalletSignMessage(context.Context, address.Address, *types.Message) (*types.SignedMessage, error)
// WalletVerify takes an address, a signature, and some bytes, and indicates whether the signature is valid.
// The address does not have to be in the wallet.
WalletVerify(context.Context, address.Address, []byte, *crypto.Signature) bool
WalletVerify(context.Context, address.Address, []byte, *crypto.Signature) (bool, error)
// WalletDefaultAddress returns the address marked as default in the wallet.
WalletDefaultAddress(context.Context) (address.Address, error)
// WalletSetDefault marks the given address as as the default one.
@@ -239,6 +265,8 @@ type FullNode interface {
WalletImport(context.Context, *types.KeyInfo) (address.Address, error)
// WalletDelete deletes an address from the wallet.
WalletDelete(context.Context, address.Address) error
// WalletValidateAddress validates whether a given string can be decoded as a well-formed address
WalletValidateAddress(context.Context, string) (address.Address, error)
// Other
@@ -258,6 +286,8 @@ type FullNode interface {
ClientListDeals(ctx context.Context) ([]DealInfo, error)
// ClientGetDealUpdates returns the status of updated deals
ClientGetDealUpdates(ctx context.Context) (<-chan DealInfo, error)
// ClientGetDealStatus returns status given a code
ClientGetDealStatus(ctx context.Context, statusCode uint64) (string, error)
// ClientHasLocal indicates whether a certain CID is locally stored.
ClientHasLocal(ctx context.Context, root cid.Cid) (bool, error)
// ClientFindData identifies peers that have a certain file, and returns QueryOffers (one per peer).
@@ -270,7 +300,9 @@ type FullNode interface {
// of status updates.
ClientRetrieveWithEvents(ctx context.Context, order RetrievalOrder, ref *FileRef) (<-chan marketevents.RetrievalEvent, error)
// ClientQueryAsk returns a signed StorageAsk from the specified miner.
ClientQueryAsk(ctx context.Context, p peer.ID, miner address.Address) (*storagemarket.SignedStorageAsk, error)
ClientQueryAsk(ctx context.Context, p peer.ID, miner address.Address) (*storagemarket.StorageAsk, error)
// ClientCalcCommP calculates the CommP and data size of the specified CID
ClientDealPieceCID(ctx context.Context, root cid.Cid) (DataCIDSize, error)
// ClientCalcCommP calculates the CommP for a specified file
ClientCalcCommP(ctx context.Context, inpath string) (*CommPRet, error)
// ClientGenCar generates a CAR file for the specified file.
@@ -280,6 +312,10 @@ type FullNode interface {
// ClientListTransfers returns the status of all ongoing transfers of data
ClientListDataTransfers(ctx context.Context) ([]DataTransferChannel, error)
ClientDataTransferUpdates(ctx context.Context) (<-chan DataTransferChannel, error)
// ClientRestartDataTransfer attempts to restart a data transfer with the given transfer ID and other peer
ClientRestartDataTransfer(ctx context.Context, transferID datatransfer.TransferID, otherPeer peer.ID, isInitiator bool) error
// ClientCancelDataTransfer cancels a data transfer with the given transfer ID and other peer
ClientCancelDataTransfer(ctx context.Context, transferID datatransfer.TransferID, otherPeer peer.ID, isInitiator bool) error
// ClientRetrieveTryRestartInsufficientFunds attempts to restart stalled retrievals on a given payment channel
// which are stuck due to insufficient funds
ClientRetrieveTryRestartInsufficientFunds(ctx context.Context, paymentChannel address.Address) error
@@ -294,39 +330,40 @@ type FullNode interface {
// MethodGroup: State
// The State methods are used to query, inspect, and interact with chain state.
// All methods take a TipSetKey as a parameter. The state looked up is the state at that tipset.
// Most methods take a TipSetKey as a parameter. The state looked up is the state at that tipset.
// A nil TipSetKey can be provided as a param, this will cause the heaviest tipset in the chain to be used.
// StateCall runs the given message and returns its result without any persisted changes.
StateCall(context.Context, *types.Message, types.TipSetKey) (*InvocResult, error)
// StateReplay returns the result of executing the indicated message, assuming it was executed in the indicated tipset.
// StateReplay replays a given message, assuming it was included in a block in the specified tipset.
// If no tipset key is provided, the appropriate tipset is looked up.
StateReplay(context.Context, types.TipSetKey, cid.Cid) (*InvocResult, error)
// StateGetActor returns the indicated actor's nonce and balance.
StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error)
// StateReadState returns the indicated actor's state.
StateReadState(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*ActorState, error)
// StateListMessages looks back and returns all messages with a matching to or from address, stopping at the given height.
StateListMessages(ctx context.Context, match *types.Message, tsk types.TipSetKey, toht abi.ChainEpoch) ([]cid.Cid, error)
StateListMessages(ctx context.Context, match *MessageMatch, tsk types.TipSetKey, toht abi.ChainEpoch) ([]cid.Cid, error)
// StateDecodeParams attempts to decode the provided params, based on the recipient actor address and method number.
StateDecodeParams(ctx context.Context, toAddr address.Address, method abi.MethodNum, params []byte, tsk types.TipSetKey) (interface{}, error)
// StateNetworkName returns the name of the network the node is synced to
StateNetworkName(context.Context) (dtypes.NetworkName, error)
// StateMinerSectors returns info about the given miner's sectors. If the filter bitfield is nil, all sectors are included.
// If the filterOut boolean is set to true, any sectors in the filter are excluded.
// If false, only those sectors in the filter are included.
StateMinerSectors(context.Context, address.Address, *bitfield.BitField, bool, types.TipSetKey) ([]*ChainSectorInfo, error)
StateMinerSectors(context.Context, address.Address, *bitfield.BitField, types.TipSetKey) ([]*miner.SectorOnChainInfo, error)
// StateMinerActiveSectors returns info about sectors that a given miner is actively proving.
StateMinerActiveSectors(context.Context, address.Address, types.TipSetKey) ([]*ChainSectorInfo, error)
StateMinerActiveSectors(context.Context, address.Address, types.TipSetKey) ([]*miner.SectorOnChainInfo, error)
// StateMinerProvingDeadline calculates the deadline at some epoch for a proving period
// and returns the deadline-related calculations.
StateMinerProvingDeadline(context.Context, address.Address, types.TipSetKey) (*miner.DeadlineInfo, error)
StateMinerProvingDeadline(context.Context, address.Address, types.TipSetKey) (*dline.Info, error)
// StateMinerPower returns the power of the indicated miner
StateMinerPower(context.Context, address.Address, types.TipSetKey) (*MinerPower, error)
// StateMinerInfo returns info about the indicated miner
StateMinerInfo(context.Context, address.Address, types.TipSetKey) (MinerInfo, error)
StateMinerInfo(context.Context, address.Address, types.TipSetKey) (miner.MinerInfo, error)
// StateMinerDeadlines returns all the proving deadlines for the given miner
StateMinerDeadlines(context.Context, address.Address, types.TipSetKey) ([]*miner.Deadline, error)
// StateMinerPartitions loads miner partitions for the specified miner/deadline
StateMinerPartitions(context.Context, address.Address, uint64, types.TipSetKey) ([]*miner.Partition, error)
StateMinerDeadlines(context.Context, address.Address, types.TipSetKey) ([]Deadline, error)
// StateMinerPartitions returns all partitions in the specified deadline
StateMinerPartitions(ctx context.Context, m address.Address, dlIdx uint64, tsk types.TipSetKey) ([]Partition, error)
// StateMinerFaults returns a bitfield indicating the faulty sectors of the given miner
StateMinerFaults(context.Context, address.Address, types.TipSetKey) (bitfield.BitField, error)
// StateAllMinerFaults returns all non-expired Faults that occur within lookback epochs of the given tipset
@@ -339,6 +376,8 @@ type FullNode interface {
StateMinerInitialPledgeCollateral(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (types.BigInt, error)
// StateMinerAvailableBalance returns the portion of a miner's balance that can be withdrawn or spent
StateMinerAvailableBalance(context.Context, address.Address, types.TipSetKey) (types.BigInt, error)
// StateMinerSectorAllocated checks if a sector is allocated
StateMinerSectorAllocated(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (bool, error)
// StateSectorPreCommitInfo returns the PreCommit info for the specified miner's sector
StateSectorPreCommitInfo(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (miner.SectorPreCommitOnChainInfo, error)
// StateSectorGetInfo returns the on-chain info for the specified miner's sector. Returns null in case the sector info isn't found
@@ -346,14 +385,18 @@ type FullNode interface {
// expiration epoch
StateSectorGetInfo(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*miner.SectorOnChainInfo, error)
// StateSectorExpiration returns epoch at which given sector will expire
StateSectorExpiration(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*SectorExpiration, error)
StateSectorExpiration(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*miner.SectorExpiration, error)
// StateSectorPartition finds deadline/partition with the specified sector
StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok types.TipSetKey) (*SectorLocation, error)
StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok types.TipSetKey) (*miner.SectorLocation, error)
// StateSearchMsg searches for a message in the chain, and returns its receipt and the tipset where it was executed
StateSearchMsg(context.Context, cid.Cid) (*MsgLookup, error)
// StateWaitMsg looks back in the chain for a message. If not found, it blocks until the
// message arrives on chain, and gets to the indicated confidence depth.
StateWaitMsg(ctx context.Context, cid cid.Cid, confidence uint64) (*MsgLookup, error)
// StateWaitMsgLimited looks back up to limit epochs in the chain for a message.
// If not found, it blocks until the message arrives on chain, and gets to the
// indicated confidence depth.
StateWaitMsgLimited(ctx context.Context, cid cid.Cid, confidence uint64, limit abi.ChainEpoch) (*MsgLookup, error)
// StateListMiners returns the addresses of every miner that has claimed power in the Power Actor
StateListMiners(context.Context, types.TipSetKey) ([]address.Address, error)
// StateListActors returns the addresses of every actor in the state
@@ -380,16 +423,28 @@ type FullNode interface {
// StateCompute is a flexible command that applies the given messages on the given tipset.
// The messages are run as though the VM were at the provided height.
StateCompute(context.Context, abi.ChainEpoch, []*types.Message, types.TipSetKey) (*ComputeStateOutput, error)
// StateVerifierStatus returns the data cap for the given address.
// Returns nil if there is no entry in the data cap table for the
// address.
StateVerifierStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error)
// StateVerifiedClientStatus returns the data cap for the given address.
// Returns nil if there is no entry in the data cap table for the
// address.
StateVerifiedClientStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*verifreg.DataCap, error)
StateVerifiedClientStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error)
// StateVerifiedClientStatus returns the address of the Verified Registry's root key
StateVerifiedRegistryRootKey(ctx context.Context, tsk types.TipSetKey) (address.Address, error)
// StateDealProviderCollateralBounds returns the min and max collateral a storage provider
// can issue. It takes the deal size and verified status as parameters.
StateDealProviderCollateralBounds(context.Context, abi.PaddedPieceSize, bool, types.TipSetKey) (DealCollateralBounds, error)
// StateCirculatingSupply returns the circulating supply of Filecoin at the given tipset
StateCirculatingSupply(context.Context, types.TipSetKey) (CirculatingSupply, error)
// StateCirculatingSupply returns the exact circulating supply of Filecoin at the given tipset.
// This is not used anywhere in the protocol itself, and is only for external consumption.
StateCirculatingSupply(context.Context, types.TipSetKey) (abi.TokenAmount, error)
// StateVMCirculatingSupplyInternal returns an approximation of the circulating supply of Filecoin at the given tipset.
// This is the value reported by the runtime interface to actors code.
StateVMCirculatingSupplyInternal(context.Context, types.TipSetKey) (CirculatingSupply, error)
// StateNetworkVersion returns the network version at the given tipset
StateNetworkVersion(context.Context, types.TipSetKey) (network.Version, error)
// MethodGroup: Msig
// The Msig methods are used to interact with multisig wallets on the
@@ -397,6 +452,11 @@ type FullNode interface {
// MsigGetAvailableBalance returns the portion of a multisig's balance that can be withdrawn or spent
MsigGetAvailableBalance(context.Context, address.Address, types.TipSetKey) (types.BigInt, error)
// MsigGetVestingSchedule returns the vesting details of a given multisig.
MsigGetVestingSchedule(context.Context, address.Address, types.TipSetKey) (MsigVesting, error)
// MsigGetVested returns the amount of FIL that vested in a multisig in a certain period.
// It takes the following params: <multisig address>, <start epoch>, <end epoch>
MsigGetVested(context.Context, address.Address, types.TipSetKey, types.TipSetKey) (types.BigInt, error)
// MsigCreate creates a multisig wallet
// It takes the following params: <required number of senders>, <approving addresses>, <unlock duration>
//<initial balance>, <sender address of the create msg>, <gas price>
@@ -405,37 +465,67 @@ type FullNode interface {
// It takes the following params: <multisig address>, <recipient address>, <value to transfer>,
// <sender address of the propose msg>, <method to call in the proposed message>, <params to include in the proposed message>
MsigPropose(context.Context, address.Address, address.Address, types.BigInt, address.Address, uint64, []byte) (cid.Cid, error)
// MsigApprove approves a previously-proposed multisig message
// MsigApprove approves a previously-proposed multisig message by transaction ID
// It takes the following params: <multisig address>, <proposed transaction ID> <signer address>
MsigApprove(context.Context, address.Address, uint64, address.Address) (cid.Cid, error)
// MsigApproveTxnHash approves a previously-proposed multisig message, specified
// using both transaction ID and a hash of the parameters used in the
// proposal. This method of approval can be used to ensure you only approve
// exactly the transaction you think you are.
// It takes the following params: <multisig address>, <proposed message ID>, <proposer address>, <recipient address>, <value to transfer>,
// <sender address of the approve msg>, <method to call in the proposed message>, <params to include in the proposed message>
MsigApprove(context.Context, address.Address, uint64, address.Address, address.Address, types.BigInt, address.Address, uint64, []byte) (cid.Cid, error)
MsigApproveTxnHash(context.Context, address.Address, uint64, address.Address, address.Address, types.BigInt, address.Address, uint64, []byte) (cid.Cid, error)
// MsigCancel cancels a previously-proposed multisig message
// It takes the following params: <multisig address>, <proposed message ID>, <recipient address>, <value to transfer>,
// It takes the following params: <multisig address>, <proposed transaction ID>, <recipient address>, <value to transfer>,
// <sender address of the cancel msg>, <method to call in the proposed message>, <params to include in the proposed message>
MsigCancel(context.Context, address.Address, uint64, address.Address, types.BigInt, address.Address, uint64, []byte) (cid.Cid, error)
// MsigAddPropose proposes adding a signer in the multisig
// It takes the following params: <multisig address>, <sender address of the propose msg>,
// <new signer>, <whether the number of required signers should be increased>
MsigAddPropose(context.Context, address.Address, address.Address, address.Address, bool) (cid.Cid, error)
// MsigAddApprove approves a previously proposed AddSigner message
// It takes the following params: <multisig address>, <sender address of the approve msg>, <proposed message ID>,
// <proposer address>, <new signer>, <whether the number of required signers should be increased>
MsigAddApprove(context.Context, address.Address, address.Address, uint64, address.Address, address.Address, bool) (cid.Cid, error)
// MsigAddCancel cancels a previously proposed AddSigner message
// It takes the following params: <multisig address>, <sender address of the cancel msg>, <proposed message ID>,
// <new signer>, <whether the number of required signers should be increased>
MsigAddCancel(context.Context, address.Address, address.Address, uint64, address.Address, bool) (cid.Cid, error)
// MsigSwapPropose proposes swapping 2 signers in the multisig
// It takes the following params: <multisig address>, <sender address of the propose msg>,
// <old signer> <new signer>
// <old signer>, <new signer>
MsigSwapPropose(context.Context, address.Address, address.Address, address.Address, address.Address) (cid.Cid, error)
// MsigSwapApprove approves a previously proposed SwapSigner
// It takes the following params: <multisig address>, <sender address of the approve msg>, <proposed message ID>,
// <proposer address>, <old signer> <new signer>
// <proposer address>, <old signer>, <new signer>
MsigSwapApprove(context.Context, address.Address, address.Address, uint64, address.Address, address.Address, address.Address) (cid.Cid, error)
// MsigSwapCancel cancels a previously proposed SwapSigner message
// It takes the following params: <multisig address>, <sender address of the cancel msg>, <proposed message ID>,
// <old signer> <new signer>
// <old signer>, <new signer>
MsigSwapCancel(context.Context, address.Address, address.Address, uint64, address.Address, address.Address) (cid.Cid, error)
MarketEnsureAvailable(context.Context, address.Address, address.Address, types.BigInt) (cid.Cid, error)
// MarketFreeBalance
// MsigRemoveSigner proposes the removal of a signer from the multisig.
// It accepts the multisig to make the change on, the proposer address to
// send the message from, the address to be removed, and a boolean
// indicating whether or not the signing threshold should be lowered by one
// along with the address removal.
MsigRemoveSigner(ctx context.Context, msig address.Address, proposer address.Address, toRemove address.Address, decrease bool) (cid.Cid, error)
// MarketReserveFunds reserves funds for a deal
MarketReserveFunds(ctx context.Context, wallet address.Address, addr address.Address, amt types.BigInt) (cid.Cid, error)
// MarketReleaseFunds releases funds reserved by MarketReserveFunds
MarketReleaseFunds(ctx context.Context, addr address.Address, amt types.BigInt) error
// MethodGroup: Paych
// The Paych methods are for interacting with and managing payment channels
PaychGet(ctx context.Context, from, to address.Address, amt types.BigInt) (*ChannelInfo, error)
PaychGetWaitReady(context.Context, cid.Cid) (address.Address, error)
PaychAvailableFunds(ch address.Address) (*ChannelAvailableFunds, error)
PaychAvailableFundsByFromTo(from, to address.Address) (*ChannelAvailableFunds, error)
PaychAvailableFunds(ctx context.Context, ch address.Address) (*ChannelAvailableFunds, error)
PaychAvailableFundsByFromTo(ctx context.Context, from, to address.Address) (*ChannelAvailableFunds, error)
PaychList(context.Context) ([]address.Address, error)
PaychStatus(context.Context, address.Address) (*PaychStatus, error)
PaychSettle(context.Context, address.Address) (cid.Cid, error)
@@ -448,6 +538,12 @@ type FullNode interface {
PaychVoucherAdd(context.Context, address.Address, *paych.SignedVoucher, []byte, types.BigInt) (types.BigInt, error)
PaychVoucherList(context.Context, address.Address) ([]*paych.SignedVoucher, error)
PaychVoucherSubmit(context.Context, address.Address, *paych.SignedVoucher, []byte, []byte) (cid.Cid, error)
// CreateBackup creates node backup onder the specified file name. The
// method requires that the lotus daemon is running with the
// LOTUS_BACKUP_BASE_PATH environment variable set to some path, and that
// the path specified when calling CreateBackup is within the base path
CreateBackup(ctx context.Context, fpath string) error
}
type FileRef struct {
@@ -456,21 +552,12 @@ type FileRef struct {
}
type MinerSectors struct {
Sectors uint64
Active uint64
}
type SectorExpiration struct {
OnTime abi.ChainEpoch
// non-zero if sector is faulty, epoch at which it will be permanently
// removed if it doesn't recover
Early abi.ChainEpoch
}
type SectorLocation struct {
Deadline uint64
Partition uint64
// Live sectors that should be proven.
Live uint64
// Sectors actively contributing to power.
Active uint64
// Sectors with failed proofs.
Faulty uint64
}
type ImportRes struct {
@@ -503,6 +590,7 @@ type DealInfo struct {
DealID abi.DealID
CreationTime time.Time
Verified bool
}
type MsgLookup struct {
@@ -513,6 +601,19 @@ type MsgLookup struct {
Height abi.ChainEpoch
}
type MsgGasCost struct {
Message cid.Cid // Can be different than requested, in case it was replaced, but only gas values changed
GasUsed abi.TokenAmount
BaseFeeBurn abi.TokenAmount
OverEstimationBurn abi.TokenAmount
MinerPenalty abi.TokenAmount
MinerTip abi.TokenAmount
Refund abi.TokenAmount
TotalCost abi.TokenAmount
}
// BlsMessages[x].cid = Cids[x]
// SecpkMessages[y].cid = Cids[BlsMessages.length + y]
type BlockMessages struct {
BlsMessages []*types.Message
SecpkMessages []*types.SignedMessage
@@ -525,11 +626,6 @@ type Message struct {
Message *types.Message
}
type ChainSectorInfo struct {
Info miner.SectorOnChainInfo
ID abi.SectorNumber
}
type ActorState struct {
Balance types.BigInt
State interface{}
@@ -601,8 +697,9 @@ type VoucherCreateResult struct {
}
type MinerPower struct {
MinerPower power.Claim
TotalPower power.Claim
MinerPower power.Claim
TotalPower power.Claim
HasMinPower bool
}
type QueryOffer struct {
@@ -662,8 +759,10 @@ type RetrievalOrder struct {
}
type InvocResult struct {
MsgCid cid.Cid
Msg *types.Message
MsgRct *types.MessageReceipt
GasCost MsgGasCost
ExecutionTrace types.ExecutionTrace
Error string
Duration time.Duration
@@ -692,8 +791,9 @@ type IpldObject struct {
}
type ActiveSync struct {
Base *types.TipSet
Target *types.TipSet
WorkerID uint64
Base *types.TipSet
Target *types.TipSet
Stage SyncStateStage
Height abi.ChainEpoch
@@ -705,6 +805,8 @@ type ActiveSync struct {
type SyncState struct {
ActiveSyncs []ActiveSync
VMApplied uint64
}
type SyncStateStage int
@@ -769,14 +871,14 @@ type CirculatingSupply struct {
}
type MiningBaseInfo struct {
MinerPower types.BigInt
NetworkPower types.BigInt
Sectors []proof.SectorInfo
WorkerKey address.Address
SectorSize abi.SectorSize
PrevBeaconEntry types.BeaconEntry
BeaconEntries []types.BeaconEntry
HasMinPower bool
MinerPower types.BigInt
NetworkPower types.BigInt
Sectors []builtin.SectorInfo
WorkerKey address.Address
SectorSize abi.SectorSize
PrevBeaconEntry types.BeaconEntry
BeaconEntries []types.BeaconEntry
EligibleForMining bool
}
type BlockTemplate struct {
@@ -788,7 +890,7 @@ type BlockTemplate struct {
Messages []*types.SignedMessage
Epoch abi.ChainEpoch
Timestamp uint64
WinningPoStProof []proof.PoStProof
WinningPoStProof []builtin.PoStProof
}
type DataSize struct {
@@ -796,6 +898,12 @@ type DataSize struct {
PieceSize abi.PaddedPieceSize
}
type DataCIDSize struct {
PayloadSize int64
PieceSize abi.PaddedPieceSize
PieceCID cid.Cid
}
type CommPRet struct {
Root cid.Cid
Size abi.UnpaddedPieceSize
@@ -812,7 +920,36 @@ const (
MsigCancel
)
type Deadline struct {
PostSubmissions bitfield.BitField
}
type Partition struct {
AllSectors bitfield.BitField
FaultySectors bitfield.BitField
RecoveringSectors bitfield.BitField
LiveSectors bitfield.BitField
ActiveSectors bitfield.BitField
}
type Fault struct {
Miner address.Address
Epoch abi.ChainEpoch
}
var EmptyVesting = MsigVesting{
InitialBalance: types.EmptyInt,
StartEpoch: -1,
UnlockDuration: -1,
}
type MsigVesting struct {
InitialBalance abi.TokenAmount
StartEpoch abi.ChainEpoch
UnlockDuration abi.ChainEpoch
}
type MessageMatch struct {
To address.Address
From address.Address
}
+44
View File
@@ -0,0 +1,44 @@
package api
import (
"context"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/types"
)
type GatewayAPI interface {
ChainHasObj(context.Context, cid.Cid) (bool, error)
ChainHead(ctx context.Context) (*types.TipSet, error)
ChainGetBlockMessages(context.Context, cid.Cid) (*BlockMessages, error)
ChainGetMessage(ctx context.Context, mc cid.Cid) (*types.Message, error)
ChainGetTipSet(ctx context.Context, tsk types.TipSetKey) (*types.TipSet, error)
ChainGetTipSetByHeight(ctx context.Context, h abi.ChainEpoch, tsk types.TipSetKey) (*types.TipSet, error)
ChainNotify(context.Context) (<-chan []*HeadChange, error)
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
GasEstimateMessageGas(ctx context.Context, msg *types.Message, spec *MessageSendSpec, tsk types.TipSetKey) (*types.Message, error)
MpoolPush(ctx context.Context, sm *types.SignedMessage) (cid.Cid, error)
MsigGetAvailableBalance(ctx context.Context, addr address.Address, tsk types.TipSetKey) (types.BigInt, error)
MsigGetVested(ctx context.Context, addr address.Address, start types.TipSetKey, end types.TipSetKey) (types.BigInt, error)
StateAccountKey(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error)
StateDealProviderCollateralBounds(ctx context.Context, size abi.PaddedPieceSize, verified bool, tsk types.TipSetKey) (DealCollateralBounds, error)
StateGetActor(ctx context.Context, actor address.Address, ts types.TipSetKey) (*types.Actor, error)
StateGetReceipt(context.Context, cid.Cid, types.TipSetKey) (*types.MessageReceipt, error)
StateListMiners(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error)
StateLookupID(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error)
StateMarketBalance(ctx context.Context, addr address.Address, tsk types.TipSetKey) (MarketBalance, error)
StateMarketStorageDeal(ctx context.Context, dealId abi.DealID, tsk types.TipSetKey) (*MarketDeal, error)
StateMinerInfo(ctx context.Context, actor address.Address, tsk types.TipSetKey) (miner.MinerInfo, error)
StateMinerProvingDeadline(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*dline.Info, error)
StateMinerPower(context.Context, address.Address, types.TipSetKey) (*MinerPower, error)
StateNetworkVersion(context.Context, types.TipSetKey) (network.Version, error)
StateVerifiedClientStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error)
StateWaitMsg(ctx context.Context, msg cid.Cid, confidence uint64) (*MsgLookup, error)
}
+20 -5
View File
@@ -5,7 +5,10 @@ import (
"context"
"time"
datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/google/uuid"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-fil-markets/piecestore"
@@ -62,16 +65,18 @@ type StorageMiner interface {
// WorkerConnect tells the node to connect to workers RPC
WorkerConnect(context.Context, string) error
WorkerStats(context.Context) (map[uint64]storiface.WorkerStats, error)
WorkerJobs(context.Context) (map[uint64][]storiface.WorkerJob, error)
WorkerStats(context.Context) (map[uuid.UUID]storiface.WorkerStats, error)
WorkerJobs(context.Context) (map[uuid.UUID][]storiface.WorkerJob, error)
storiface.WorkerReturn
// SealingSchedDiag dumps internal sealing scheduler state
SealingSchedDiag(context.Context) (interface{}, error)
SealingSchedDiag(ctx context.Context, doSched bool) (interface{}, error)
SealingAbort(ctx context.Context, call storiface.CallID) error
stores.SectorIndex
MarketImportDealData(ctx context.Context, propcid cid.Cid, path string) error
MarketListDeals(ctx context.Context) ([]storagemarket.StorageDeal, error)
MarketListDeals(ctx context.Context) ([]MarketDeal, error)
MarketListRetrievalDeals(ctx context.Context) ([]retrievalmarket.ProviderDealState, error)
MarketGetDealUpdates(ctx context.Context) (<-chan storagemarket.MinerDeal, error)
MarketListIncompleteDeals(ctx context.Context) ([]storagemarket.MinerDeal, error)
@@ -81,9 +86,13 @@ type StorageMiner interface {
MarketGetRetrievalAsk(ctx context.Context) (*retrievalmarket.Ask, error)
MarketListDataTransfers(ctx context.Context) ([]DataTransferChannel, error)
MarketDataTransferUpdates(ctx context.Context) (<-chan DataTransferChannel, error)
// MinerRestartDataTransfer attempts to restart a data transfer with the given transfer ID and other peer
MarketRestartDataTransfer(ctx context.Context, transferID datatransfer.TransferID, otherPeer peer.ID, isInitiator bool) error
// ClientCancelDataTransfer cancels a data transfer with the given transfer ID and other peer
MarketCancelDataTransfer(ctx context.Context, transferID datatransfer.TransferID, otherPeer peer.ID, isInitiator bool) error
DealsImportData(ctx context.Context, dealPropCid cid.Cid, file string) error
DealsList(ctx context.Context) ([]storagemarket.StorageDeal, error)
DealsList(ctx context.Context) ([]MarketDeal, error)
DealsConsiderOnlineStorageDeals(context.Context) (bool, error)
DealsSetConsiderOnlineStorageDeals(context.Context, bool) error
DealsConsiderOnlineRetrievalDeals(context.Context) (bool, error)
@@ -101,6 +110,12 @@ type StorageMiner interface {
PiecesListCidInfos(ctx context.Context) ([]cid.Cid, error)
PiecesGetPieceInfo(ctx context.Context, pieceCid cid.Cid) (*piecestore.PieceInfo, error)
PiecesGetCIDInfo(ctx context.Context, payloadCid cid.Cid) (*piecestore.CIDInfo, error)
// CreateBackup creates node backup onder the specified file name. The
// method requires that the lotus-miner is running with the
// LOTUS_BACKUP_BASE_PATH environment variable set to some path, and that
// the path specified when calling CreateBackup is within the base path
CreateBackup(ctx context.Context, fpath string) error
}
type SealRes struct {
+69
View File
@@ -1,12 +1,16 @@
package api
import (
"encoding/json"
"os"
"os/exec"
"path/filepath"
"reflect"
"runtime"
"strings"
"testing"
"github.com/stretchr/testify/require"
)
func goCmd() string {
@@ -32,3 +36,68 @@ func TestDoesntDependOnFFI(t *testing.T) {
}
}
}
func TestReturnTypes(t *testing.T) {
errType := reflect.TypeOf(new(error)).Elem()
bareIface := reflect.TypeOf(new(interface{})).Elem()
jmarsh := reflect.TypeOf(new(json.Marshaler)).Elem()
tst := func(api interface{}) func(t *testing.T) {
return func(t *testing.T) {
ra := reflect.TypeOf(api).Elem()
for i := 0; i < ra.NumMethod(); i++ {
m := ra.Method(i)
switch m.Type.NumOut() {
case 1: // if 1 return value, it must be an error
require.Equal(t, errType, m.Type.Out(0), m.Name)
case 2: // if 2 return values, first cant be an interface/function, second must be an error
seen := map[reflect.Type]struct{}{}
todo := []reflect.Type{m.Type.Out(0)}
for len(todo) > 0 {
typ := todo[len(todo)-1]
todo = todo[:len(todo)-1]
if _, ok := seen[typ]; ok {
continue
}
seen[typ] = struct{}{}
if typ.Kind() == reflect.Interface && typ != bareIface && !typ.Implements(jmarsh) {
t.Error("methods can't return interfaces", m.Name)
}
switch typ.Kind() {
case reflect.Ptr:
fallthrough
case reflect.Array:
fallthrough
case reflect.Slice:
fallthrough
case reflect.Chan:
todo = append(todo, typ.Elem())
case reflect.Map:
todo = append(todo, typ.Elem())
todo = append(todo, typ.Key())
case reflect.Struct:
for i := 0; i < typ.NumField(); i++ {
todo = append(todo, typ.Field(i).Type)
}
}
}
require.NotEqual(t, reflect.Func.String(), m.Type.Out(0).Kind().String(), m.Name)
require.Equal(t, errType, m.Type.Out(1), m.Name)
default:
t.Error("methods can only have 1 or 2 return values", m.Name)
}
}
}
}
t.Run("common", tst(new(Common)))
t.Run("full", tst(new(FullNode)))
t.Run("miner", tst(new(StorageMiner)))
t.Run("worker", tst(new(WorkerAPI)))
}
+47
View File
@@ -0,0 +1,47 @@
package api
import (
"context"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/lotus/chain/types"
)
type MsgType string
const (
MTUnknown = "unknown"
// Signing message CID. MsgMeta.Extra contains raw cbor message bytes
MTChainMsg = "message"
// Signing a blockheader. signing raw cbor block bytes (MsgMeta.Extra is empty)
MTBlock = "block"
// Signing a deal proposal. signing raw cbor proposal bytes (MsgMeta.Extra is empty)
MTDealProposal = "dealproposal"
// TODO: Deals, Vouchers, VRF
)
type MsgMeta struct {
Type MsgType
// Additional data related to what is signed. Should be verifiable with the
// signed bytes (e.g. CID(Extra).Bytes() == toSign)
Extra []byte
}
type WalletAPI interface {
WalletNew(context.Context, types.KeyType) (address.Address, error)
WalletHas(context.Context, address.Address) (bool, error)
WalletList(context.Context) ([]address.Address, error)
WalletSign(ctx context.Context, signer address.Address, toSign []byte, meta MsgMeta) (*crypto.Signature, error)
WalletExport(context.Context, address.Address) (*types.KeyInfo, error)
WalletImport(context.Context, *types.KeyInfo) (address.Address, error)
WalletDelete(context.Context, address.Address) error
}
+18 -12
View File
@@ -2,15 +2,13 @@ package api
import (
"context"
"io"
"github.com/ipfs/go-cid"
"github.com/google/uuid"
"github.com/filecoin-project/go-state-types/abi"
"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"
"github.com/filecoin-project/lotus/build"
)
@@ -23,18 +21,26 @@ type WorkerAPI interface {
Paths(context.Context) ([]stores.StoragePath, error)
Info(context.Context) (storiface.WorkerInfo, error)
AddPiece(ctx context.Context, sector abi.SectorID, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (abi.PieceInfo, error)
storiface.WorkerCalls
storage.Sealer
MoveStorage(ctx context.Context, sector abi.SectorID, types stores.SectorFileType) error
UnsealPiece(context.Context, abi.SectorID, storiface.UnpaddedByteIndex, abi.UnpaddedPieceSize, abi.SealRandomness, cid.Cid) error
ReadPiece(context.Context, io.Writer, abi.SectorID, storiface.UnpaddedByteIndex, abi.UnpaddedPieceSize) (bool, error)
// Storage / Other
Remove(ctx context.Context, sector abi.SectorID) error
StorageAddLocal(ctx context.Context, path string) error
Fetch(context.Context, abi.SectorID, stores.SectorFileType, stores.PathType, stores.AcquireMode) error
// SetEnabled marks the worker as enabled/disabled. Not that this setting
// may take a few seconds to propagate to task scheduler
SetEnabled(ctx context.Context, enabled bool) error
Closing(context.Context) (<-chan struct{}, error)
Enabled(ctx context.Context) (bool, error)
// WaitQuiet blocks until there are no tasks running
WaitQuiet(ctx context.Context) error
// returns a random UUID of worker session, generated randomly when worker
// process starts
ProcessSession(context.Context) (uuid.UUID, error)
// Like ProcessSession, but returns an error when worker is disabled
Session(context.Context) (uuid.UUID, error)
}
+6
View File
@@ -36,3 +36,9 @@ func PermissionedWorkerAPI(a api.WorkerAPI) api.WorkerAPI {
auth.PermissionedProxy(AllPermissions, DefaultPerms, a, &out.Internal)
return &out
}
func PermissionedWalletAPI(a api.WalletAPI) api.WalletAPI {
var out WalletStruct
auth.PermissionedProxy(AllPermissions, DefaultPerms, a, &out.Internal)
return &out
}
+552 -125
View File
File diff suppressed because it is too large Load Diff
+26
View File
@@ -82,3 +82,29 @@ func NewWorkerRPC(ctx context.Context, addr string, requestHeader http.Header) (
return &res, closer, err
}
// NewGatewayRPC creates a new http jsonrpc client for a gateway node.
func NewGatewayRPC(ctx context.Context, addr string, requestHeader http.Header, opts ...jsonrpc.Option) (api.GatewayAPI, jsonrpc.ClientCloser, error) {
var res apistruct.GatewayStruct
closer, err := jsonrpc.NewMergeClient(ctx, addr, "Filecoin",
[]interface{}{
&res.Internal,
},
requestHeader,
opts...,
)
return &res, closer, err
}
func NewWalletRPC(ctx context.Context, addr string, requestHeader http.Header) (api.WalletAPI, jsonrpc.ClientCloser, error) {
var res apistruct.WalletStruct
closer, err := jsonrpc.NewMergeClient(ctx, addr, "Filecoin",
[]interface{}{
&res.Internal,
},
requestHeader,
)
return &res, closer, err
}
+123 -28
View File
@@ -6,12 +6,14 @@ import (
"go/ast"
"go/parser"
"go/token"
"os"
"reflect"
"sort"
"strings"
"time"
"unicode"
"github.com/google/uuid"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-filestore"
metrics "github.com/libp2p/go-libp2p-core/metrics"
@@ -24,6 +26,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
datatransfer "github.com/filecoin-project/go-data-transfer"
filestore2 "github.com/filecoin-project/go-fil-markets/filestore"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-jsonrpc/auth"
"github.com/filecoin-project/go-multistore"
@@ -36,6 +39,10 @@ import (
"github.com/filecoin-project/lotus/api/apistruct"
"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"
)
@@ -87,6 +94,7 @@ func init() {
addExample(abi.RegisteredPoStProof_StackedDrgWindow32GiBV1)
addExample(abi.ChainEpoch(10101))
addExample(crypto.SigTypeBLS)
addExample(types.KTBLS)
addExample(int64(9))
addExample(12.3)
addExample(123)
@@ -105,7 +113,7 @@ func init() {
addExample(network.Connected)
addExample(dtypes.NetworkName("lotus"))
addExample(api.SyncStateStage(1))
addExample(build.APIVersion)
addExample(build.FullAPIVersion)
addExample(api.PCHInbound)
addExample(time.Minute)
addExample(datatransfer.TransferID(3))
@@ -114,18 +122,19 @@ func init() {
addExample(retrievalmarket.ClientEventDealAccepted)
addExample(retrievalmarket.DealStatusNew)
addExample(network.ReachabilityPublic)
addExample(build.NewestNetworkVersion)
addExample(&types.ExecutionTrace{
Msg: exampleValue(reflect.TypeOf(&types.Message{}), nil).(*types.Message),
MsgRct: exampleValue(reflect.TypeOf(&types.MessageReceipt{}), nil).(*types.MessageReceipt),
Msg: exampleValue("init", reflect.TypeOf(&types.Message{}), nil).(*types.Message),
MsgRct: exampleValue("init", reflect.TypeOf(&types.MessageReceipt{}), nil).(*types.MessageReceipt),
})
addExample(map[string]types.Actor{
"t01236": exampleValue(reflect.TypeOf(types.Actor{}), nil).(types.Actor),
"t01236": exampleValue("init", reflect.TypeOf(types.Actor{}), nil).(types.Actor),
})
addExample(map[string]api.MarketDeal{
"t026363": exampleValue(reflect.TypeOf(api.MarketDeal{}), nil).(api.MarketDeal),
"t026363": exampleValue("init", reflect.TypeOf(api.MarketDeal{}), nil).(api.MarketDeal),
})
addExample(map[string]api.MarketBalance{
"t026363": exampleValue(reflect.TypeOf(api.MarketBalance{}), nil).(api.MarketBalance),
"t026363": exampleValue("init", reflect.TypeOf(api.MarketBalance{}), nil).(api.MarketBalance),
})
addExample(map[string]*pubsub.TopicScoreSnapshot{
"/blocks": {
@@ -160,9 +169,80 @@ func init() {
// because reflect.TypeOf(maddr) returns the concrete type...
ExampleValues[reflect.TypeOf(struct{ A multiaddr.Multiaddr }{}).Field(0).Type] = maddr
// miner specific
addExample(filestore2.Path(".lotusminer/fstmp123"))
si := multistore.StoreID(12)
addExample(&si)
addExample(retrievalmarket.DealID(5))
addExample(abi.ActorID(1000))
addExample(map[string][]api.SealedRef{
"98000": {
api.SealedRef{
SectorID: 100,
Offset: 10 << 20,
Size: 1 << 20,
},
},
})
addExample(api.SectorState(sealing.Proving))
addExample(stores.ID("76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8"))
addExample(storiface.FTUnsealed)
addExample(storiface.PathSealing)
addExample(map[stores.ID][]stores.Decl{
"76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8": {
{
SectorID: abi.SectorID{Miner: 1000, Number: 100},
SectorFileType: storiface.FTSealed,
},
},
})
addExample(map[stores.ID]string{
"76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8": "/data/path",
})
addExample(map[uuid.UUID][]storiface.WorkerJob{
uuid.MustParse("ef8d99a2-6865-4189-8ffa-9fef0f806eee"): {
{
ID: storiface.CallID{
Sector: abi.SectorID{Miner: 1000, Number: 100},
ID: uuid.MustParse("76081ba0-61bd-45a5-bc08-af05f1c26e5d"),
},
Sector: abi.SectorID{Miner: 1000, Number: 100},
Task: sealtasks.TTPreCommit2,
RunWait: 0,
Start: time.Unix(1605172927, 0).UTC(),
Hostname: "host",
},
},
})
addExample(map[uuid.UUID]storiface.WorkerStats{
uuid.MustParse("ef8d99a2-6865-4189-8ffa-9fef0f806eee"): {
Info: storiface.WorkerInfo{
Hostname: "host",
Resources: storiface.WorkerResources{
MemPhysical: 256 << 30,
MemSwap: 120 << 30,
MemReserved: 2 << 30,
CPUs: 64,
GPUs: []string{"aGPU 1337"},
},
},
Enabled: true,
MemUsedMin: 0,
MemUsedMax: 0,
GpuUsed: false,
CpuUse: 0,
},
})
// worker specific
addExample(storiface.AcquireMove)
addExample(storiface.UnpaddedByteIndex(abi.PaddedPieceSize(1 << 20).Unpadded()))
addExample(map[sealtasks.TaskType]struct{}{
sealtasks.TTPreCommit2: {},
})
}
func exampleValue(t, parent reflect.Type) interface{} {
func exampleValue(method string, t, parent reflect.Type) interface{} {
v, ok := ExampleValues[t]
if ok {
return v
@@ -171,25 +251,25 @@ func exampleValue(t, parent reflect.Type) interface{} {
switch t.Kind() {
case reflect.Slice:
out := reflect.New(t).Elem()
reflect.Append(out, reflect.ValueOf(exampleValue(t.Elem(), t)))
reflect.Append(out, reflect.ValueOf(exampleValue(method, t.Elem(), t)))
return out.Interface()
case reflect.Chan:
return exampleValue(t.Elem(), nil)
return exampleValue(method, t.Elem(), nil)
case reflect.Struct:
es := exampleStruct(t, parent)
es := exampleStruct(method, t, parent)
v := reflect.ValueOf(es).Elem().Interface()
ExampleValues[t] = v
return v
case reflect.Array:
out := reflect.New(t).Elem()
for i := 0; i < t.Len(); i++ {
out.Index(i).Set(reflect.ValueOf(exampleValue(t.Elem(), t)))
out.Index(i).Set(reflect.ValueOf(exampleValue(method, t.Elem(), t)))
}
return out.Interface()
case reflect.Ptr:
if t.Elem().Kind() == reflect.Struct {
es := exampleStruct(t.Elem(), t)
es := exampleStruct(method, t.Elem(), t)
//ExampleValues[t] = es
return es
}
@@ -197,10 +277,10 @@ func exampleValue(t, parent reflect.Type) interface{} {
return struct{}{}
}
panic(fmt.Sprintf("No example value for type: %s", t))
panic(fmt.Sprintf("No example value for type: %s (method '%s')", t, method))
}
func exampleStruct(t, parent reflect.Type) interface{} {
func exampleStruct(method string, t, parent reflect.Type) interface{} {
ns := reflect.New(t)
for i := 0; i < t.NumField(); i++ {
f := t.Field(i)
@@ -208,7 +288,7 @@ func exampleStruct(t, parent reflect.Type) interface{} {
continue
}
if strings.Title(f.Name) == f.Name {
ns.Elem().Field(i).Set(reflect.ValueOf(exampleValue(f.Type, t)))
ns.Elem().Field(i).Set(reflect.ValueOf(exampleValue(method, f.Type, t)))
}
}
@@ -216,6 +296,7 @@ func exampleStruct(t, parent reflect.Type) interface{} {
}
type Visitor struct {
Root string
Methods map[string]ast.Node
}
@@ -225,7 +306,7 @@ func (v *Visitor) Visit(node ast.Node) ast.Visitor {
return v
}
if st.Name.Name != "FullNode" {
if st.Name.Name != v.Root {
return nil
}
@@ -241,7 +322,7 @@ func (v *Visitor) Visit(node ast.Node) ast.Visitor {
const noComment = "There are not yet any comments for this method."
func parseApiASTInfo() (map[string]string, map[string]string) { //nolint:golint
func parseApiASTInfo(apiFile, iface string) (map[string]string, map[string]string) { //nolint:golint
fset := token.NewFileSet()
pkgs, err := parser.ParseDir(fset, "./api", nil, parser.AllErrors|parser.ParseComments)
if err != nil {
@@ -250,11 +331,11 @@ func parseApiASTInfo() (map[string]string, map[string]string) { //nolint:golint
ap := pkgs["api"]
f := ap.Files["api/api_full.go"]
f := ap.Files[apiFile]
cmap := ast.NewCommentMap(fset, f, f.Comments)
v := &Visitor{make(map[string]ast.Node)}
v := &Visitor{iface, make(map[string]ast.Node)}
ast.Walk(v, pkgs["api"])
groupDocs := make(map[string]string)
@@ -310,13 +391,30 @@ func methodGroupFromName(mn string) string {
}
func main() {
comments, groupComments := parseApiASTInfo()
comments, groupComments := parseApiASTInfo(os.Args[1], os.Args[2])
groups := make(map[string]*MethodGroup)
var api struct{ api.FullNode }
t := reflect.TypeOf(api)
var t reflect.Type
var permStruct, commonPermStruct reflect.Type
switch os.Args[2] {
case "FullNode":
t = reflect.TypeOf(new(struct{ api.FullNode })).Elem()
permStruct = reflect.TypeOf(apistruct.FullNodeStruct{}.Internal)
commonPermStruct = reflect.TypeOf(apistruct.CommonStruct{}.Internal)
case "StorageMiner":
t = reflect.TypeOf(new(struct{ api.StorageMiner })).Elem()
permStruct = reflect.TypeOf(apistruct.StorageMinerStruct{}.Internal)
commonPermStruct = reflect.TypeOf(apistruct.CommonStruct{}.Internal)
case "WorkerAPI":
t = reflect.TypeOf(new(struct{ api.WorkerAPI })).Elem()
permStruct = reflect.TypeOf(apistruct.WorkerStruct{}.Internal)
commonPermStruct = reflect.TypeOf(apistruct.WorkerStruct{}.Internal)
default:
panic("unknown type")
}
for i := 0; i < t.NumMethod(); i++ {
m := t.Method(i)
@@ -334,7 +432,7 @@ func main() {
ft := m.Func.Type()
for j := 2; j < ft.NumIn(); j++ {
inp := ft.In(j)
args = append(args, exampleValue(inp, nil))
args = append(args, exampleValue(m.Name, inp, nil))
}
v, err := json.MarshalIndent(args, "", " ")
@@ -342,7 +440,7 @@ func main() {
panic(err)
}
outv := exampleValue(ft.Out(0), nil)
outv := exampleValue(m.Name, ft.Out(0), nil)
ov, err := json.MarshalIndent(outv, "", " ")
if err != nil {
@@ -375,9 +473,6 @@ func main() {
}
}
permStruct := reflect.TypeOf(apistruct.FullNodeStruct{}.Internal)
commonPermStruct := reflect.TypeOf(apistruct.CommonStruct{}.Internal)
for _, g := range groupslice {
g := g
fmt.Printf("## %s\n", g.GroupName)
+6 -1
View File
@@ -37,7 +37,12 @@ func (bm *BlockMiner) MineBlocks() {
go func() {
defer close(bm.done)
for atomic.LoadInt64(&bm.mine) == 1 {
time.Sleep(bm.blocktime)
select {
case <-bm.ctx.Done():
return
case <-time.After(bm.blocktime):
}
nulls := atomic.SwapInt64(&bm.nulls, 0)
if err := bm.miner.MineOne(bm.ctx, miner.MineReq{
InjectNulls: abi.ChainEpoch(nulls),
+32 -4
View File
@@ -3,7 +3,6 @@ package test
import (
"context"
"fmt"
"os"
"sync/atomic"
"testing"
"time"
@@ -17,10 +16,22 @@ import (
)
func TestCCUpgrade(t *testing.T, b APIBuilder, blocktime time.Duration) {
_ = os.Setenv("BELLMAN_NO_GPU", "1")
for _, height := range []abi.ChainEpoch{
1, // before
162, // while sealing
520, // after upgrade deal
5000, // after
} {
height := height // make linters happy by copying
t.Run(fmt.Sprintf("upgrade-%d", height), func(t *testing.T) {
testCCUpgrade(t, b, blocktime, height)
})
}
}
func testCCUpgrade(t *testing.T, b APIBuilder, blocktime time.Duration, upgradeHeight abi.ChainEpoch) {
ctx := context.Background()
n, sn := b(t, 1, OneMiner)
n, sn := b(t, []FullNodeOpts{FullNodeWithUpgradeAt(upgradeHeight)}, OneMiner)
client := n[0].FullNode.(*impl.FullNodeAPI)
miner := sn[0]
@@ -78,13 +89,14 @@ func TestCCUpgrade(t *testing.T, b APIBuilder, blocktime time.Duration) {
t.Fatal(err)
}
makeDeal(t, ctx, 6, client, miner, false, false)
MakeDeal(t, ctx, 6, client, miner, false, false)
// Validate upgrade
{
exp, err := client.StateSectorExpiration(ctx, maddr, CC, types.EmptyTSK)
require.NoError(t, err)
require.NotNil(t, exp)
require.Greater(t, 50000, int(exp.OnTime))
}
{
@@ -93,6 +105,22 @@ func TestCCUpgrade(t *testing.T, b APIBuilder, blocktime time.Duration) {
require.Less(t, 50000, int(exp.OnTime))
}
dlInfo, err := client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
require.NoError(t, err)
// Sector should expire.
for {
// Wait for the sector to expire.
status, err := miner.SectorsStatus(ctx, CC, true)
require.NoError(t, err)
if status.OnTime == 0 && status.Early == 0 {
break
}
t.Log("waiting for sector to expire")
// wait one deadline per loop.
time.Sleep(time.Duration(dlInfo.WPoStChallengeWindow) * blocktime)
}
fmt.Println("shutting down mining")
atomic.AddInt64(&mine, -1)
<-done
+39 -34
View File
@@ -16,15 +16,12 @@ import (
"github.com/ipfs/go-cid"
files "github.com/ipfs/go-ipfs-files"
logging "github.com/ipfs/go-log/v2"
"github.com/ipld/go-car"
"github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
"github.com/filecoin-project/lotus/miner"
dag "github.com/ipfs/go-merkledag"
dstest "github.com/ipfs/go-merkledag/test"
unixfile "github.com/ipfs/go-unixfs/file"
@@ -34,21 +31,10 @@ import (
ipld "github.com/ipfs/go-ipld-format"
)
var MineNext = miner.MineReq{
InjectNulls: 0,
Done: func(bool, abi.ChainEpoch, error) {},
}
func init() {
logging.SetAllLoggers(logging.LevelInfo)
build.InsecurePoStValidation = true
}
func TestDealFlow(t *testing.T, b APIBuilder, blocktime time.Duration, carExport, fastRet bool) {
_ = os.Setenv("BELLMAN_NO_GPU", "1")
ctx := context.Background()
n, sn := b(t, 1, OneMiner)
n, sn := b(t, OneFull, OneMiner)
client := n[0].FullNode.(*impl.FullNodeAPI)
miner := sn[0]
@@ -74,7 +60,7 @@ func TestDealFlow(t *testing.T, b APIBuilder, blocktime time.Duration, carExport
}
}()
makeDeal(t, ctx, 6, client, miner, carExport, fastRet)
MakeDeal(t, ctx, 6, client, miner, carExport, fastRet)
atomic.AddInt64(&mine, -1)
fmt.Println("shutting down mining")
@@ -82,10 +68,9 @@ func TestDealFlow(t *testing.T, b APIBuilder, blocktime time.Duration, carExport
}
func TestDoubleDealFlow(t *testing.T, b APIBuilder, blocktime time.Duration) {
_ = os.Setenv("BELLMAN_NO_GPU", "1")
ctx := context.Background()
n, sn := b(t, 1, OneMiner)
n, sn := b(t, OneFull, OneMiner)
client := n[0].FullNode.(*impl.FullNodeAPI)
miner := sn[0]
@@ -112,24 +97,21 @@ func TestDoubleDealFlow(t *testing.T, b APIBuilder, blocktime time.Duration) {
}
}()
makeDeal(t, ctx, 6, client, miner, false, false)
makeDeal(t, ctx, 7, client, miner, false, false)
MakeDeal(t, ctx, 6, client, miner, false, false)
MakeDeal(t, ctx, 7, client, miner, false, false)
atomic.AddInt64(&mine, -1)
fmt.Println("shutting down mining")
<-done
}
func makeDeal(t *testing.T, ctx context.Context, rseed int, client *impl.FullNodeAPI, miner TestStorageNode, carExport, fastRet bool) {
data := make([]byte, 1600)
rand.New(rand.NewSource(int64(rseed))).Read(data)
r := bytes.NewReader(data)
fcid, err := client.ClientImportLocal(ctx, r)
func MakeDeal(t *testing.T, ctx context.Context, rseed int, client api.FullNode, miner TestStorageNode, carExport, fastRet bool) {
res, data, err := CreateClientFile(ctx, client, rseed)
if err != nil {
t.Fatal(err)
}
fcid := res.Root
fmt.Println("FILE CID: ", fcid)
deal := startDeal(t, ctx, miner, client, fcid, fastRet)
@@ -145,11 +127,32 @@ func makeDeal(t *testing.T, ctx context.Context, rseed int, client *impl.FullNod
testRetrieval(t, ctx, client, fcid, &info.PieceCID, carExport, data)
}
func CreateClientFile(ctx context.Context, client api.FullNode, rseed int) (*api.ImportRes, []byte, error) {
data := make([]byte, 1600)
rand.New(rand.NewSource(int64(rseed))).Read(data)
dir, err := ioutil.TempDir(os.TempDir(), "test-make-deal-")
if err != nil {
return nil, nil, err
}
path := filepath.Join(dir, "sourcefile.dat")
err = ioutil.WriteFile(path, data, 0644)
if err != nil {
return nil, nil, err
}
res, err := client.ClientImport(ctx, api.FileRef{Path: path})
if err != nil {
return nil, nil, err
}
return res, data, nil
}
func TestFastRetrievalDealFlow(t *testing.T, b APIBuilder, blocktime time.Duration) {
_ = os.Setenv("BELLMAN_NO_GPU", "1")
ctx := context.Background()
n, sn := b(t, 1, OneMiner)
n, sn := b(t, OneFull, OneMiner)
client := n[0].FullNode.(*impl.FullNodeAPI)
miner := sn[0]
@@ -201,10 +204,9 @@ func TestFastRetrievalDealFlow(t *testing.T, b APIBuilder, blocktime time.Durati
}
func TestSenondDealRetrieval(t *testing.T, b APIBuilder, blocktime time.Duration) {
_ = os.Setenv("BELLMAN_NO_GPU", "1")
ctx := context.Background()
n, sn := b(t, 1, OneMiner)
n, sn := b(t, OneFull, OneMiner)
client := n[0].FullNode.(*impl.FullNodeAPI)
miner := sn[0]
@@ -276,7 +278,7 @@ func TestSenondDealRetrieval(t *testing.T, b APIBuilder, blocktime time.Duration
<-done
}
func startDeal(t *testing.T, ctx context.Context, miner TestStorageNode, client *impl.FullNodeAPI, fcid cid.Cid, fastRet bool) *cid.Cid {
func startDeal(t *testing.T, ctx context.Context, miner TestStorageNode, client api.FullNode, fcid cid.Cid, fastRet bool) *cid.Cid {
maddr, err := miner.ActorAddress(ctx)
if err != nil {
t.Fatal(err)
@@ -303,7 +305,7 @@ func startDeal(t *testing.T, ctx context.Context, miner TestStorageNode, client
return deal
}
func waitDealSealed(t *testing.T, ctx context.Context, miner TestStorageNode, client *impl.FullNodeAPI, deal *cid.Cid, noseal bool) {
func waitDealSealed(t *testing.T, ctx context.Context, miner TestStorageNode, client api.FullNode, deal *cid.Cid, noseal bool) {
loop:
for {
di, err := client.ClientGetDealInfo(ctx, *deal)
@@ -376,7 +378,7 @@ func startSealingWaiting(t *testing.T, ctx context.Context, miner TestStorageNod
}
}
func testRetrieval(t *testing.T, ctx context.Context, client *impl.FullNodeAPI, fcid cid.Cid, piece *cid.Cid, carExport bool, data []byte) {
func testRetrieval(t *testing.T, ctx context.Context, client api.FullNode, fcid cid.Cid, piece *cid.Cid, carExport bool, data []byte) {
offers, err := client.ClientFindData(ctx, fcid, piece)
if err != nil {
t.Fatal(err)
@@ -402,9 +404,12 @@ func testRetrieval(t *testing.T, ctx context.Context, client *impl.FullNodeAPI,
IsCAR: carExport,
}
updates, err := client.ClientRetrieveWithEvents(ctx, offers[0].Order(caddr), ref)
if err != nil {
t.Fatal(err)
}
for update := range updates {
if update.Err != "" {
t.Fatalf("%v", err)
t.Fatalf("retrieval failed: %s", update.Err)
}
}
+8 -14
View File
@@ -5,7 +5,6 @@ import (
"context"
"fmt"
"math/rand"
"os"
"sync/atomic"
"testing"
"time"
@@ -25,7 +24,7 @@ var log = logging.Logger("apitest")
func (ts *testSuite) testMining(t *testing.T) {
ctx := context.Background()
apis, sn := ts.makeNodes(t, 1, OneMiner)
apis, sn := ts.makeNodes(t, OneFull, OneMiner)
api := apis[0]
newHeads, err := api.ChainNotify(ctx)
@@ -54,19 +53,16 @@ func (ts *testSuite) testMiningReal(t *testing.T) {
}()
ctx := context.Background()
apis, sn := ts.makeNodes(t, 1, OneMiner)
apis, sn := ts.makeNodes(t, OneFull, OneMiner)
api := apis[0]
newHeads, err := api.ChainNotify(ctx)
require.NoError(t, err)
initHead := (<-newHeads)[0]
if initHead.Val.Height() != 2 {
<-newHeads
}
at := (<-newHeads)[0].Val.Height()
h1, err := api.ChainHead(ctx)
require.NoError(t, err)
require.Equal(t, abi.ChainEpoch(2), h1.Height())
require.Equal(t, int64(at), int64(h1.Height()))
MineUntilBlock(ctx, t, apis[0], sn[0], nil)
require.NoError(t, err)
@@ -75,25 +71,23 @@ func (ts *testSuite) testMiningReal(t *testing.T) {
h2, err := api.ChainHead(ctx)
require.NoError(t, err)
require.Equal(t, abi.ChainEpoch(3), h2.Height())
require.Greater(t, int64(h2.Height()), int64(h1.Height()))
MineUntilBlock(ctx, t, apis[0], sn[0], nil)
require.NoError(t, err)
<-newHeads
h2, err = api.ChainHead(ctx)
h3, err := api.ChainHead(ctx)
require.NoError(t, err)
require.Equal(t, abi.ChainEpoch(4), h2.Height())
require.Greater(t, int64(h3.Height()), int64(h2.Height()))
}
func TestDealMining(t *testing.T, b APIBuilder, blocktime time.Duration, carExport bool) {
_ = os.Setenv("BELLMAN_NO_GPU", "1")
// test making a deal with a fresh miner, and see if it starts to mine
ctx := context.Background()
n, sn := b(t, 1, []StorageMiner{
n, sn := b(t, OneFull, []StorageMiner{
{Full: 0, Preseal: PresealGenesis},
{Full: 0, Preseal: 0}, // TODO: Add support for miners on non-first full node
})
+68 -15
View File
@@ -3,33 +3,32 @@ package test
import (
"context"
"fmt"
"os"
"sync/atomic"
"testing"
"time"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/specs-actors/actors/builtin/paych"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-address"
cbor "github.com/ipfs/go-ipld-cbor"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/api/apibstore"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/builtin/paych"
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/events"
"github.com/filecoin-project/lotus/chain/events/state"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/chain/wallet"
)
func TestPaymentChannels(t *testing.T, b APIBuilder, blocktime time.Duration) {
_ = os.Setenv("BELLMAN_NO_GPU", "1")
ctx := context.Background()
n, sn := b(t, 2, OneMiner)
n, sn := b(t, TwoFull, OneMiner)
paymentCreator := n[0]
paymentReceiver := n[1]
@@ -54,7 +53,7 @@ func TestPaymentChannels(t *testing.T, b APIBuilder, blocktime time.Duration) {
bm.MineBlocks()
// send some funds to register the receiver
receiverAddr, err := paymentReceiver.WalletNew(ctx, wallet.ActSigType("secp256k1"))
receiverAddr, err := paymentReceiver.WalletNew(ctx, types.KTSecp256k1)
if err != nil {
t.Fatal(err)
}
@@ -67,7 +66,7 @@ func TestPaymentChannels(t *testing.T, b APIBuilder, blocktime time.Duration) {
t.Fatal(err)
}
channelAmt := int64(100000)
channelAmt := int64(7000)
channelInfo, err := paymentCreator.PaychGet(ctx, createrAddr, receiverAddr, abi.NewTokenAmount(channelAmt))
if err != nil {
t.Fatal(err)
@@ -133,17 +132,26 @@ func TestPaymentChannels(t *testing.T, b APIBuilder, blocktime time.Duration) {
t.Fatal("Unable to settle payment channel")
}
creatorStore := adt.WrapStore(ctx, cbor.NewCborStore(apibstore.NewAPIBlockstore(paymentCreator)))
// wait for the receiver to submit their vouchers
ev := events.NewEvents(ctx, paymentCreator)
preds := state.NewStatePredicates(paymentCreator)
finished := make(chan struct{})
err = ev.StateChanged(func(ts *types.TipSet) (done bool, more bool, err error) {
act, err := paymentCreator.StateReadState(ctx, channel, ts.Key())
act, err := paymentCreator.StateGetActor(ctx, channel, ts.Key())
if err != nil {
return false, false, err
}
state := act.State.(paych.State)
if state.ToSend.GreaterThanEqual(abi.NewTokenAmount(6000)) {
state, err := paych.Load(creatorStore, act)
if err != nil {
return false, false, err
}
toSend, err := state.ToSend()
if err != nil {
return false, false, err
}
if toSend.GreaterThanEqual(abi.NewTokenAmount(6000)) {
return true, false, nil
}
return false, true, nil
@@ -156,7 +164,7 @@ func TestPaymentChannels(t *testing.T, b APIBuilder, blocktime time.Duration) {
return true, nil
}, func(ctx context.Context, ts *types.TipSet) error {
return nil
}, int(build.MessageConfidence)+1, build.SealRandomnessLookbackLimit, func(oldTs, newTs *types.TipSet) (bool, events.StateChange, error) {
}, int(build.MessageConfidence)+1, build.Finality, func(oldTs, newTs *types.TipSet) (bool, events.StateChange, error) {
return preds.OnPaymentChannelActorChanged(channel, preds.OnToSendAmountChanges())(ctx, oldTs.Key(), newTs.Key())
})
if err != nil {
@@ -169,8 +177,53 @@ func TestPaymentChannels(t *testing.T, b APIBuilder, blocktime time.Duration) {
t.Fatal("Timed out waiting for receiver to submit vouchers")
}
// Create a new voucher now that some vouchers have already been submitted
vouchRes, err := paymentCreator.PaychVoucherCreate(ctx, channel, abi.NewTokenAmount(1000), 3)
if err != nil {
t.Fatal(err)
}
if vouchRes.Voucher == nil {
t.Fatal(fmt.Errorf("Not enough funds to create voucher: missing %d", vouchRes.Shortfall))
}
vdelta, err := paymentReceiver.PaychVoucherAdd(ctx, channel, vouchRes.Voucher, nil, abi.NewTokenAmount(1000))
if err != nil {
t.Fatal(err)
}
if !vdelta.Equals(abi.NewTokenAmount(1000)) {
t.Fatal("voucher didn't have the right amount")
}
// Create a new voucher whose value would exceed the channel balance
excessAmt := abi.NewTokenAmount(1000)
vouchRes, err = paymentCreator.PaychVoucherCreate(ctx, channel, excessAmt, 4)
if err != nil {
t.Fatal(err)
}
if vouchRes.Voucher != nil {
t.Fatal("Expected not to be able to create voucher whose value would exceed channel balance")
}
if !vouchRes.Shortfall.Equals(excessAmt) {
t.Fatal(fmt.Errorf("Expected voucher shortfall of %d, got %d", excessAmt, vouchRes.Shortfall))
}
// Add a voucher whose value would exceed the channel balance
vouch := &paych.SignedVoucher{ChannelAddr: channel, Amount: excessAmt, Lane: 4, Nonce: 1}
vb, err := vouch.SigningBytes()
if err != nil {
t.Fatal(err)
}
sig, err := paymentCreator.WalletSign(ctx, createrAddr, vb)
if err != nil {
t.Fatal(err)
}
vouch.Signature = sig
_, err = paymentReceiver.PaychVoucherAdd(ctx, channel, vouch, nil, abi.NewTokenAmount(1000))
if err == nil {
t.Fatal(fmt.Errorf("Expected shortfall error of %d", excessAmt))
}
// wait for the settlement period to pass before collecting
waitForBlocks(ctx, t, bm, paymentReceiver, receiverAddr, paych.SettleDelay)
waitForBlocks(ctx, t, bm, paymentReceiver, receiverAddr, policy.PaychSettleDelay)
creatorPreCollectBalance, err := paymentCreator.WalletBalance(ctx, createrAddr)
if err != nil {
+114
View File
@@ -0,0 +1,114 @@
package test
import (
"context"
"fmt"
"testing"
"time"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/stmgr"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
"github.com/filecoin-project/lotus/node"
"github.com/filecoin-project/lotus/node/impl"
"github.com/stretchr/testify/require"
)
func TestTapeFix(t *testing.T, b APIBuilder, blocktime time.Duration) {
t.Run("before", func(t *testing.T) { testTapeFix(t, b, blocktime, false) })
t.Run("after", func(t *testing.T) { testTapeFix(t, b, blocktime, true) })
}
func testTapeFix(t *testing.T, b APIBuilder, blocktime time.Duration, after bool) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
upgradeSchedule := stmgr.UpgradeSchedule{{
Network: build.ActorUpgradeNetworkVersion,
Height: 1,
Migration: stmgr.UpgradeActorsV2,
}}
if after {
upgradeSchedule = append(upgradeSchedule, stmgr.Upgrade{
Network: network.Version5,
Height: 2,
})
}
n, sn := b(t, []FullNodeOpts{{Opts: func(_ []TestNode) node.Option {
return node.Override(new(stmgr.UpgradeSchedule), upgradeSchedule)
}}}, OneMiner)
client := n[0].FullNode.(*impl.FullNodeAPI)
miner := sn[0]
addrinfo, err := client.NetAddrsListen(ctx)
if err != nil {
t.Fatal(err)
}
if err := miner.NetConnect(ctx, addrinfo); err != nil {
t.Fatal(err)
}
build.Clock.Sleep(time.Second)
done := make(chan struct{})
go func() {
defer close(done)
for ctx.Err() == nil {
build.Clock.Sleep(blocktime)
if err := sn[0].MineOne(ctx, MineNext); err != nil {
if ctx.Err() != nil {
// context was canceled, ignore the error.
return
}
t.Error(err)
}
}
}()
defer func() {
cancel()
<-done
}()
err = miner.PledgeSector(ctx)
require.NoError(t, err)
// Wait till done.
var sectorNo abi.SectorNumber
for {
s, err := miner.SectorsList(ctx) // Note - the test builder doesn't import genesis sectors into FSM
require.NoError(t, err)
fmt.Printf("Sectors: %d\n", len(s))
if len(s) == 1 {
sectorNo = s[0]
break
}
build.Clock.Sleep(100 * time.Millisecond)
}
fmt.Printf("All sectors is fsm\n")
// If before, we expect the precommit to fail
successState := api.SectorState(sealing.CommitFailed)
failureState := api.SectorState(sealing.Proving)
if after {
// otherwise, it should succeed.
successState, failureState = failureState, successState
}
for {
st, err := miner.SectorsStatus(ctx, sectorNo, false)
require.NoError(t, err)
if st.State == successState {
break
}
require.NotEqual(t, failureState, st.State)
build.Clock.Sleep(100 * time.Millisecond)
fmt.Println("WaitSeal")
}
}
+112 -4
View File
@@ -2,18 +2,38 @@ package test
import (
"context"
"fmt"
"os"
"testing"
"time"
"github.com/filecoin-project/lotus/chain/stmgr"
"github.com/filecoin-project/lotus/chain/types"
logging "github.com/ipfs/go-log/v2"
"github.com/multiformats/go-multiaddr"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/miner"
"github.com/filecoin-project/lotus/node"
)
func init() {
logging.SetAllLoggers(logging.LevelInfo)
err := os.Setenv("BELLMAN_NO_GPU", "1")
if err != nil {
panic(fmt.Sprintf("failed to set BELLMAN_NO_GPU env variable: %s", err))
}
build.InsecurePoStValidation = true
}
type TestNode struct {
api.FullNode
// ListenAddr is the address on which an API server is listening, if an
@@ -34,17 +54,27 @@ var PresealGenesis = -1
const GenesisPreseals = 2
// Options for setting up a mock storage miner
type StorageMiner struct {
Full int
Preseal int
}
type OptionGenerator func([]TestNode) node.Option
// Options for setting up a mock full node
type FullNodeOpts struct {
Lite bool // run node in "lite" mode
Opts OptionGenerator // generate dependency injection options
}
// APIBuilder is a function which is invoked in test suite to provide
// test nodes and networks
//
// fullOpts array defines options for each full node
// storage array defines storage nodes, numbers in the array specify full node
// index the storage node 'belongs' to
type APIBuilder func(t *testing.T, nFull int, storage []StorageMiner) ([]TestNode, []TestStorageNode)
type APIBuilder func(t *testing.T, full []FullNodeOpts, storage []StorageMiner) ([]TestNode, []TestStorageNode)
type testSuite struct {
makeNodes APIBuilder
}
@@ -60,13 +90,48 @@ func TestApis(t *testing.T, b APIBuilder) {
t.Run("testConnectTwo", ts.testConnectTwo)
t.Run("testMining", ts.testMining)
t.Run("testMiningReal", ts.testMiningReal)
t.Run("testSearchMsg", ts.testSearchMsg)
}
func DefaultFullOpts(nFull int) []FullNodeOpts {
full := make([]FullNodeOpts, nFull)
for i := range full {
full[i] = FullNodeOpts{
Opts: func(nodes []TestNode) node.Option {
return node.Options()
},
}
}
return full
}
var OneMiner = []StorageMiner{{Full: 0, Preseal: PresealGenesis}}
var OneFull = DefaultFullOpts(1)
var TwoFull = DefaultFullOpts(2)
var FullNodeWithUpgradeAt = func(upgradeHeight abi.ChainEpoch) FullNodeOpts {
return FullNodeOpts{
Opts: func(nodes []TestNode) node.Option {
return node.Override(new(stmgr.UpgradeSchedule), stmgr.UpgradeSchedule{{
// Skip directly to tape height so precommits work.
Network: network.Version5,
Height: upgradeHeight,
Migration: stmgr.UpgradeActorsV2,
}})
},
}
}
var MineNext = miner.MineReq{
InjectNulls: 0,
Done: func(bool, abi.ChainEpoch, error) {},
}
func (ts *testSuite) testVersion(t *testing.T) {
build.RunningNodeType = build.NodeFull
ctx := context.Background()
apis, _ := ts.makeNodes(t, 1, OneMiner)
apis, _ := ts.makeNodes(t, OneFull, OneMiner)
api := apis[0]
v, err := api.Version(ctx)
@@ -76,9 +141,52 @@ func (ts *testSuite) testVersion(t *testing.T) {
require.Equal(t, v.Version, build.BuildVersion)
}
func (ts *testSuite) testSearchMsg(t *testing.T) {
apis, miners := ts.makeNodes(t, OneFull, OneMiner)
api := apis[0]
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
senderAddr, err := api.WalletDefaultAddress(ctx)
if err != nil {
t.Fatal(err)
}
msg := &types.Message{
From: senderAddr,
To: senderAddr,
Value: big.Zero(),
}
bm := NewBlockMiner(ctx, t, miners[0], 100*time.Millisecond)
bm.MineBlocks()
defer bm.Stop()
sm, err := api.MpoolPushMessage(ctx, msg, nil)
if err != nil {
t.Fatal(err)
}
res, err := api.StateWaitMsg(ctx, sm.Cid(), 1)
if err != nil {
t.Fatal(err)
}
if res.Receipt.ExitCode != 0 {
t.Fatal("did not successfully send message")
}
searchRes, err := api.StateSearchMsg(ctx, sm.Cid())
if err != nil {
t.Fatal(err)
}
if searchRes.TipSet != res.TipSet {
t.Fatalf("search ts: %s, different from wait ts: %s", searchRes.TipSet, res.TipSet)
}
}
func (ts *testSuite) testID(t *testing.T) {
ctx := context.Background()
apis, _ := ts.makeNodes(t, 1, OneMiner)
apis, _ := ts.makeNodes(t, OneFull, OneMiner)
api := apis[0]
id, err := api.ID(ctx)
@@ -90,7 +198,7 @@ func (ts *testSuite) testID(t *testing.T) {
func (ts *testSuite) testConnectTwo(t *testing.T) {
ctx := context.Background()
apis, _ := ts.makeNodes(t, 2, OneMiner)
apis, _ := ts.makeNodes(t, TwoFull, OneMiner)
p, err := apis[0].NetPeers(ctx)
if err != nil {
+59 -44
View File
@@ -3,8 +3,8 @@ package test
import (
"context"
"fmt"
"sync/atomic"
"os"
"strings"
"testing"
"time"
@@ -15,7 +15,6 @@ import (
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/extern/sector-storage/mock"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
miner2 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build"
@@ -24,16 +23,11 @@ import (
"github.com/filecoin-project/lotus/node/impl"
)
func init() {
err := os.Setenv("BELLMAN_NO_GPU", "1")
if err != nil {
panic(fmt.Sprintf("failed to set BELLMAN_NO_GPU env variable: %s", err))
}
}
func TestPledgeSector(t *testing.T, b APIBuilder, blocktime time.Duration, nSectors int) {
ctx := context.Background()
n, sn := b(t, 1, OneMiner)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
n, sn := b(t, OneFull, OneMiner)
client := n[0].FullNode.(*impl.FullNodeAPI)
miner := sn[0]
@@ -47,11 +41,11 @@ func TestPledgeSector(t *testing.T, b APIBuilder, blocktime time.Duration, nSect
}
build.Clock.Sleep(time.Second)
mine := true
mine := int64(1)
done := make(chan struct{})
go func() {
defer close(done)
for mine {
for atomic.LoadInt64(&mine) != 0 {
build.Clock.Sleep(blocktime)
if err := sn[0].MineOne(ctx, bminer.MineReq{Done: func(bool, abi.ChainEpoch, error) {
@@ -63,7 +57,7 @@ func TestPledgeSector(t *testing.T, b APIBuilder, blocktime time.Duration, nSect
pledgeSectors(t, ctx, miner, nSectors, 0, nil)
mine = false
atomic.StoreInt64(&mine, 0)
<-done
}
@@ -115,8 +109,25 @@ func pledgeSectors(t *testing.T, ctx context.Context, miner TestStorageNode, n,
}
func TestWindowPost(t *testing.T, b APIBuilder, blocktime time.Duration, nSectors int) {
ctx := context.Background()
n, sn := b(t, 1, OneMiner)
for _, height := range []abi.ChainEpoch{
1, // before
162, // while sealing
5000, // while proving
} {
height := height // copy to satisfy lints
t.Run(fmt.Sprintf("upgrade-%d", height), func(t *testing.T) {
testWindowPostUpgrade(t, b, blocktime, nSectors, height)
})
}
}
func testWindowPostUpgrade(t *testing.T, b APIBuilder, blocktime time.Duration, nSectors int,
upgradeHeight abi.ChainEpoch) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
n, sn := b(t, []FullNodeOpts{FullNodeWithUpgradeAt(upgradeHeight)}, OneMiner)
client := n[0].FullNode.(*impl.FullNodeAPI)
miner := sn[0]
@@ -130,17 +141,24 @@ func TestWindowPost(t *testing.T, b APIBuilder, blocktime time.Duration, nSector
}
build.Clock.Sleep(time.Second)
mine := true
done := make(chan struct{})
go func() {
defer close(done)
for mine {
for ctx.Err() == nil {
build.Clock.Sleep(blocktime)
if err := sn[0].MineOne(ctx, MineNext); err != nil {
if ctx.Err() != nil {
// context was canceled, ignore the error.
return
}
t.Error(err)
}
}
}()
defer func() {
cancel()
<-done
}()
pledgeSectors(t, ctx, miner, nSectors, 0, nil)
@@ -154,18 +172,16 @@ func TestWindowPost(t *testing.T, b APIBuilder, blocktime time.Duration, nSector
require.NoError(t, err)
fmt.Printf("Running one proving period\n")
fmt.Printf("End for head.Height > %d\n", di.PeriodStart+di.WPoStProvingPeriod+2)
for {
head, err := client.ChainHead(ctx)
require.NoError(t, err)
if head.Height() > di.PeriodStart+(miner2.WPoStProvingPeriod)+2 {
if head.Height() > di.PeriodStart+di.WPoStProvingPeriod+2 {
fmt.Printf("Now head.Height = %d\n", head.Height())
break
}
if head.Height()%100 == 0 {
fmt.Printf("@%d\n", head.Height())
}
build.Clock.Sleep(blocktime)
}
@@ -186,13 +202,14 @@ func TestWindowPost(t *testing.T, b APIBuilder, blocktime time.Duration, nSector
require.NoError(t, err)
require.Greater(t, len(parts), 0)
n, err := parts[0].Sectors.Count()
secs := parts[0].AllSectors
n, err := secs.Count()
require.NoError(t, err)
require.Equal(t, uint64(2), n)
// Drop the partition
err = parts[0].Sectors.ForEach(func(sid uint64) error {
return miner.StorageMiner.(*impl.StorageMinerAPI).IStorageMgr.(*mock.SectorMgr).MarkFailed(abi.SectorID{
err = secs.ForEach(func(sid uint64) error {
return miner.StorageMiner.(*impl.StorageMinerAPI).IStorageMgr.(*mock.SectorMgr).MarkCorrupted(abi.SectorID{
Miner: abi.ActorID(mid),
Number: abi.SectorNumber(sid),
}, true)
@@ -208,15 +225,16 @@ func TestWindowPost(t *testing.T, b APIBuilder, blocktime time.Duration, nSector
require.NoError(t, err)
require.Greater(t, len(parts), 0)
n, err := parts[0].Sectors.Count()
secs := parts[0].AllSectors
n, err := secs.Count()
require.NoError(t, err)
require.Equal(t, uint64(2), n)
// Drop the sector
sn, err := parts[0].Sectors.First()
sn, err := secs.First()
require.NoError(t, err)
all, err := parts[0].Sectors.All(2)
all, err := secs.All(2)
require.NoError(t, err)
fmt.Println("the sectors", all)
@@ -233,18 +251,17 @@ func TestWindowPost(t *testing.T, b APIBuilder, blocktime time.Duration, nSector
require.NoError(t, err)
fmt.Printf("Go through another PP, wait for sectors to become faulty\n")
fmt.Printf("End for head.Height > %d\n", di.PeriodStart+di.WPoStProvingPeriod+2)
for {
head, err := client.ChainHead(ctx)
require.NoError(t, err)
if head.Height() > di.PeriodStart+(miner2.WPoStProvingPeriod)+2 {
if head.Height() > di.PeriodStart+(di.WPoStProvingPeriod)+2 {
fmt.Printf("Now head.Height = %d\n", head.Height())
break
}
if head.Height()%100 == 0 {
fmt.Printf("@%d\n", head.Height())
}
build.Clock.Sleep(blocktime)
}
@@ -264,17 +281,17 @@ func TestWindowPost(t *testing.T, b APIBuilder, blocktime time.Duration, nSector
di, err = client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
require.NoError(t, err)
fmt.Printf("End for head.Height > %d\n", di.PeriodStart+di.WPoStProvingPeriod+2)
for {
head, err := client.ChainHead(ctx)
require.NoError(t, err)
if head.Height() > di.PeriodStart+(miner2.WPoStProvingPeriod)+2 {
if head.Height() > di.PeriodStart+di.WPoStProvingPeriod+2 {
fmt.Printf("Now head.Height = %d\n", head.Height())
break
}
if head.Height()%100 == 0 {
fmt.Printf("@%d\n", head.Height())
}
build.Clock.Sleep(blocktime)
}
@@ -291,18 +308,19 @@ func TestWindowPost(t *testing.T, b APIBuilder, blocktime time.Duration, nSector
pledgeSectors(t, ctx, miner, 1, nSectors, nil)
{
// wait a bit more
head, err := client.ChainHead(ctx)
// Wait until proven.
di, err = client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
require.NoError(t, err)
waitUntil := head.Height() + 10
waitUntil := di.PeriodStart + di.WPoStProvingPeriod + 2
fmt.Printf("End for head.Height > %d\n", waitUntil)
for {
head, err := client.ChainHead(ctx)
require.NoError(t, err)
if head.Height() > waitUntil {
fmt.Printf("Now head.Height = %d\n", head.Height())
break
}
}
@@ -315,7 +333,4 @@ func TestWindowPost(t *testing.T, b APIBuilder, blocktime time.Duration, nSector
sectors = p.MinerPower.RawBytePower.Uint64() / uint64(ssz)
require.Equal(t, nSectors+GenesisPreseals-2+1, int(sectors)) // -2 not recovered sectors + 1 just pledged
mine = false
<-done
}
-44
View File
@@ -4,11 +4,9 @@ import (
"encoding/json"
"fmt"
"github.com/filecoin-project/go-address"
datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/peer"
@@ -49,48 +47,6 @@ type PubsubScore struct {
Score *pubsub.PeerScoreSnapshot
}
type MinerInfo struct {
Owner address.Address // Must be an ID-address.
Worker address.Address // Must be an ID-address.
NewWorker address.Address // Must be an ID-address.
ControlAddresses []address.Address // Must be an ID-addresses.
WorkerChangeEpoch abi.ChainEpoch
PeerId *peer.ID
Multiaddrs []abi.Multiaddrs
SealProofType abi.RegisteredSealProof
SectorSize abi.SectorSize
WindowPoStPartitionSectors uint64
}
func NewApiMinerInfo(info *miner.MinerInfo) MinerInfo {
var pid *peer.ID
if peerID, err := peer.IDFromBytes(info.PeerId); err == nil {
pid = &peerID
}
mi := MinerInfo{
Owner: info.Owner,
Worker: info.Worker,
ControlAddresses: info.ControlAddresses,
NewWorker: address.Undef,
WorkerChangeEpoch: -1,
PeerId: pid,
Multiaddrs: info.Multiaddrs,
SealProofType: info.SealProofType,
SectorSize: info.SectorSize,
WindowPoStPartitionSectors: info.WindowPoStPartitionSectors,
}
if info.PendingWorkerKey != nil {
mi.NewWorker = info.PendingWorkerKey.NewWorker
mi.WorkerChangeEpoch = info.PendingWorkerKey.EffectiveAt
}
return mi
}
type MessageSendSpec struct {
MaxFee abi.TokenAmount
}
+15 -6
View File
@@ -1,6 +1,15 @@
/dns4/bootstrap-0.testnet.fildev.network/tcp/1347/p2p/12D3KooWJTUBUjtzWJGWU1XSiY21CwmHaCNLNYn2E7jqHEHyZaP7
/dns4/bootstrap-1.testnet.fildev.network/tcp/1347/p2p/12D3KooW9yeKXha4hdrJKq74zEo99T8DhriQdWNoojWnnQbsgB3v
/dns4/bootstrap-2.testnet.fildev.network/tcp/1347/p2p/12D3KooWCrx8yVG9U9Kf7w8KLN3Edkj5ZKDhgCaeMqQbcQUoB6CT
/dns4/bootstrap-4.testnet.fildev.network/tcp/1347/p2p/12D3KooWPkL9LrKRQgHtq7kn9ecNhGU9QaziG8R5tX8v9v7t3h34
/dns4/bootstrap-3.testnet.fildev.network/tcp/1347/p2p/12D3KooWKYSsbpgZ3HAjax5M1BXCwXLa6gVkUARciz7uN3FNtr7T
/dns4/bootstrap-5.testnet.fildev.network/tcp/1347/p2p/12D3KooWQYzqnLASJAabyMpPb1GcWZvNSe7JDcRuhdRqonFoiK9W
/dns4/bootstrap-0.mainnet.filops.net/tcp/1347/p2p/12D3KooWCVe8MmsEMes2FzgTpt9fXtmCY7wrq91GRiaC8PHSCCBj
/dns4/bootstrap-1.mainnet.filops.net/tcp/1347/p2p/12D3KooWCwevHg1yLCvktf2nvLu7L9894mcrJR4MsBCcm4syShVc
/dns4/bootstrap-2.mainnet.filops.net/tcp/1347/p2p/12D3KooWEWVwHGn2yR36gKLozmb4YjDJGerotAPGxmdWZx2nxMC4
/dns4/bootstrap-3.mainnet.filops.net/tcp/1347/p2p/12D3KooWKhgq8c7NQ9iGjbyK7v7phXvG6492HQfiDaGHLHLQjk7R
/dns4/bootstrap-4.mainnet.filops.net/tcp/1347/p2p/12D3KooWL6PsFNPhYftrJzGgF5U18hFoaVhfGk7xwzD8yVrHJ3Uc
/dns4/bootstrap-5.mainnet.filops.net/tcp/1347/p2p/12D3KooWLFynvDQiUpXoHroV1YxKHhPJgysQGH2k3ZGwtWzR4dFH
/dns4/bootstrap-6.mainnet.filops.net/tcp/1347/p2p/12D3KooWP5MwCiqdMETF9ub1P3MbCvQCcfconnYHbWg6sUJcDRQQ
/dns4/bootstrap-7.mainnet.filops.net/tcp/1347/p2p/12D3KooWRs3aY1p3juFjPy8gPN95PEQChm2QKGUCAdcDCC4EBMKf
/dns4/bootstrap-8.mainnet.filops.net/tcp/1347/p2p/12D3KooWScFR7385LTyR4zU1bYdzSiiAb5rnNABfVahPvVSzyTkR
/dns4/lotus-bootstrap.forceup.cn/tcp/41778/p2p/12D3KooWFQsv3nRMUevZNWWsY1Wu6NUzUbawnWU5NcRhgKuJA37C
/dns4/bootstrap-0.starpool.in/tcp/12757/p2p/12D3KooWGHpBMeZbestVEWkfdnC9u7p6uFHXL1n7m1ZBqsEmiUzz
/dns4/bootstrap-1.starpool.in/tcp/12757/p2p/12D3KooWQZrGH1PxSNZPum99M1zNvjNFM33d1AAu5DcvdHptuU7u
/dns4/node.glif.io/tcp/1235/p2p/12D3KooWBF8cpp65hp2u9LK5mh19x67ftAam84z9LsfaquTDSBpt
/dns4/bootstrap-0.ipfsmain.cn/tcp/34721/p2p/12D3KooWQnwEGNqcM2nAcPtRR9rAX8Hrg4k9kJLCHoTR5chJfz6d
/dns4/bootstrap-1.ipfsmain.cn/tcp/34723/p2p/12D3KooWMKxMkD5DMpSWsW7dBddKxKT7L2GgbNuckz9otxvkvByP
+18 -16
View File
@@ -1,15 +1,26 @@
package build
import "github.com/filecoin-project/lotus/node/modules/dtypes"
import (
"sort"
var DrandNetwork = DrandIncentinet
func DrandConfig() dtypes.DrandConfig {
return DrandConfigs[DrandNetwork]
}
"github.com/filecoin-project/lotus/node/modules/dtypes"
)
type DrandEnum int
func DrandConfigSchedule() dtypes.DrandSchedule {
out := dtypes.DrandSchedule{}
for start, config := range DrandSchedule {
out = append(out, dtypes.DrandPoint{Start: start, Config: DrandConfigs[config]})
}
sort.Slice(out, func(i, j int) bool {
return out[i].Start < out[j].Start
})
return out
}
const (
DrandMainnet DrandEnum = iota + 1
DrandTestnet
@@ -24,6 +35,7 @@ var DrandConfigs = map[DrandEnum]dtypes.DrandConfig{
"https://api.drand.sh",
"https://api2.drand.sh",
"https://api3.drand.sh",
"https://drand.cloudflare.com",
},
Relays: []string{
"/dnsaddr/api.drand.sh/",
@@ -57,16 +69,6 @@ var DrandConfigs = map[DrandEnum]dtypes.DrandConfig{
ChainInfoJSON: `{"public_key":"8cda589f88914aa728fd183f383980b35789ce81b274e5daee1f338b77d02566ef4d3fb0098af1f844f10f9c803c1827","period":25,"genesis_time":1595348225,"hash":"e73b7dc3c4f6a236378220c0dd6aa110eb16eed26c11259606e07ee122838d4f","groupHash":"567d4785122a5a3e75a9bc9911d7ea807dd85ff76b78dc4ff06b075712898607"}`,
},
DrandIncentinet: {
Servers: []string{
"https://pl-eu.incentinet.drand.sh",
"https://pl-us.incentinet.drand.sh",
"https://pl-sin.incentinet.drand.sh",
},
Relays: []string{
"/dnsaddr/pl-eu.incentinet.drand.sh/",
"/dnsaddr/pl-us.incentinet.drand.sh/",
"/dnsaddr/pl-sin.incentinet.drand.sh/",
},
ChainInfoJSON: `{"public_key":"8cad0c72c606ab27d36ee06de1d5b2db1faf92e447025ca37575ab3a8aac2eaae83192f846fc9e158bc738423753d000","period":30,"genesis_time":1595873820,"hash":"80c8b872c714f4c00fdd3daa465d5514049f457f01f85a4caf68cdcd394ba039","groupHash":"d9406aaed487f7af71851b4399448e311f2328923d454e971536c05398ce2d9b"}`,
},
}
+28 -9
View File
@@ -3,22 +3,39 @@
package build
import (
"math"
"os"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/specs-actors/actors/builtin/power"
"github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
"github.com/filecoin-project/lotus/chain/actors/policy"
)
const UpgradeBreezeHeight = 0
const UpgradeBreezeHeight = -1
const BreezeGasTampingDuration = 0
const UpgradeSmokeHeight = -1
const UpgradeIgnitionHeight = -2
const UpgradeRefuelHeight = -3
const UpgradeTapeHeight = -4
var UpgradeActorsV2Height = abi.ChainEpoch(10)
var UpgradeLiftoffHeight = abi.ChainEpoch(-5)
const UpgradeKumquatHeight = 15
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
0: DrandMainnet,
}
func init() {
power.ConsensusMinerMinPower = big.NewInt(2048)
miner.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
policy.SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1)
policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048))
policy.SetMinVerifiedDealSize(abi.NewStoragePower(256))
if os.Getenv("LOTUS_DISABLE_V2_ACTOR_MIGRATION") == "1" {
UpgradeActorsV2Height = math.MaxInt64
UpgradeLiftoffHeight = 11
}
verifreg.MinVerifiedDealSize = big.NewInt(256)
BuildType |= Build2k
}
@@ -35,3 +52,5 @@ const SlashablePowerDelay = 20
// Epochs
const InteractivePoRepConfidence = 6
const BootstrapPeerThreshold = 1
+63
View File
@@ -0,0 +1,63 @@
// +build !debug
// +build !2k
// +build !testground
package build
import (
"math"
"os"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors/policy"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
)
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
0: DrandIncentinet,
UpgradeSmokeHeight: DrandMainnet,
}
const UpgradeBreezeHeight = 41280
const BreezeGasTampingDuration = 120
const UpgradeSmokeHeight = 51000
const UpgradeIgnitionHeight = 94000
const UpgradeRefuelHeight = 130800
var UpgradeActorsV2Height = abi.ChainEpoch(138720)
const UpgradeTapeHeight = 140760
// This signals our tentative epoch for mainnet launch. Can make it later, but not earlier.
// Miners, clients, developers, custodians all need time to prepare.
// We still have upgrades and state changes to do, but can happen after signaling timing here.
const UpgradeLiftoffHeight = 148888
const UpgradeKumquatHeight = 170000
func init() {
policy.SetConsensusMinerMinPower(abi.NewStoragePower(10 << 40))
policy.SetSupportedProofTypes(
abi.RegisteredSealProof_StackedDrg32GiBV1,
abi.RegisteredSealProof_StackedDrg64GiBV1,
)
if os.Getenv("LOTUS_USE_TEST_ADDRESSES") != "1" {
SetAddressNetwork(address.Mainnet)
}
if os.Getenv("LOTUS_DISABLE_V2_ACTOR_MIGRATION") == "1" {
UpgradeActorsV2Height = math.MaxInt64
}
Devnet = false
}
const BlockDelaySecs = uint64(builtin2.EpochDurationSeconds)
const PropagationDelaySecs = uint64(6)
const BootstrapPeerThreshold = 4
+5 -22
View File
@@ -1,34 +1,13 @@
package build
import (
"sort"
"github.com/filecoin-project/go-address"
"github.com/libp2p/go-libp2p-core/protocol"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/lotus/node/modules/dtypes"
)
func DefaultSectorSize() abi.SectorSize {
szs := make([]abi.SectorSize, 0, len(miner.SupportedProofTypes))
for spt := range miner.SupportedProofTypes {
ss, err := spt.SectorSize()
if err != nil {
panic(err)
}
szs = append(szs, ss)
}
sort.Slice(szs, func(i, j int) bool {
return szs[i] < szs[j]
})
return szs[0]
}
// Core network constants
func BlocksTopic(netName dtypes.NetworkName) string { return "/fil/blocks/" + string(netName) }
@@ -36,3 +15,7 @@ func MessagesTopic(netName dtypes.NetworkName) string { return "/fil/msgs/" + st
func DhtProtocolName(netName dtypes.NetworkName) protocol.ID {
return protocol.ID("/fil/kad/" + string(netName))
}
func SetAddressNetwork(n address.Network) {
address.CurrentNetwork = n
}
+29 -13
View File
@@ -4,10 +4,15 @@ package build
import (
"math/big"
"os"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/go-state-types/network"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/policy"
)
// /////
@@ -20,15 +25,17 @@ const UnixfsLinksPerLevel = 1024
// Consensus / Network
const AllowableClockDriftSecs = uint64(1)
const NewestNetworkVersion = network.Version6
const ActorUpgradeNetworkVersion = network.Version4
// Epochs
const ForkLengthThreshold = Finality
// Blocks (e)
var BlocksPerEpoch = uint64(builtin.ExpectedLeadersPerEpoch)
var BlocksPerEpoch = uint64(builtin2.ExpectedLeadersPerEpoch)
// Epochs
const Finality = miner.ChainFinality
const Finality = policy.ChainFinality
const MessageConfidence = uint64(5)
// constants for Weight calculation
@@ -40,13 +47,8 @@ const WRatioDen = uint64(2)
// Proofs
// Epochs
const SealRandomnessLookback = Finality
// Epochs
const SealRandomnessLookbackLimit = SealRandomnessLookback + 2000 // TODO: Get from spec specs-actors
// Maximum lookback that randomness can be sourced from for a seal proof submission
const MaxSealLookback = SealRandomnessLookbackLimit + 2000 // TODO: Get from specs-actors
// TODO: unused
const SealRandomnessLookback = policy.SealRandomnessLookback
// /////
// Mining
@@ -54,23 +56,37 @@ const MaxSealLookback = SealRandomnessLookbackLimit + 2000 // TODO: Get from spe
// Epochs
const TicketRandomnessLookback = abi.ChainEpoch(1)
const WinningPoStSectorSetLookback = abi.ChainEpoch(10)
// /////
// Address
const AddressMainnetEnvVar = "_mainnet_"
// /////
// Devnet settings
var Devnet = true
const FilBase = uint64(2_000_000_000)
const FilAllocStorageMining = uint64(1_100_000_000)
const FilecoinPrecision = uint64(1_000_000_000_000_000_000)
const FilReserved = uint64(300_000_000)
var InitialRewardBalance *big.Int
var InitialFilReserved *big.Int
// TODO: Move other important consts here
func init() {
InitialRewardBalance = big.NewInt(int64(FilAllocStorageMining))
InitialRewardBalance = InitialRewardBalance.Mul(InitialRewardBalance, big.NewInt(int64(FilecoinPrecision)))
InitialFilReserved = big.NewInt(int64(FilReserved))
InitialFilReserved = InitialFilReserved.Mul(InitialFilReserved, big.NewInt(int64(FilecoinPrecision)))
if os.Getenv("LOTUS_ADDRESS_TYPE") == AddressMainnetEnvVar {
SetAddressNetwork(address.Mainnet)
}
}
// Sync
@@ -100,4 +116,4 @@ const PackingEfficiencyDenom = 5
// Actor consts
// TODO: Pull from actors when its made not private
var MinDealDuration = abi.ChainEpoch(180 * builtin.EpochsInDay)
var MinDealDuration = abi.ChainEpoch(180 * builtin2.EpochsInDay)
+39 -12
View File
@@ -11,27 +11,30 @@ import (
"math/big"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/go-state-types/network"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/policy"
)
var (
UnixfsChunkSize = uint64(1 << 20)
UnixfsLinksPerLevel = 1024
BlocksPerEpoch = uint64(builtin.ExpectedLeadersPerEpoch)
BlocksPerEpoch = uint64(builtin2.ExpectedLeadersPerEpoch)
BlockMessageLimit = 512
BlockGasLimit = int64(100_000_000_000)
BlockGasTarget = int64(BlockGasLimit / 2)
BaseFeeMaxChangeDenom = int64(8) // 12.5%
InitialBaseFee = int64(100e6)
MinimumBaseFee = int64(100)
BlockDelaySecs = uint64(builtin.EpochDurationSeconds)
BlockDelaySecs = uint64(builtin2.EpochDurationSeconds)
PropagationDelaySecs = uint64(6)
AllowableClockDriftSecs = uint64(1)
Finality = miner.ChainFinality
Finality = policy.ChainFinality
ForkLengthThreshold = Finality
SlashablePowerDelay = 20
@@ -46,15 +49,13 @@ var (
BlsSignatureCacheSize = 40000
VerifSigCacheSize = 32000
SealRandomnessLookback = Finality
SealRandomnessLookbackLimit = SealRandomnessLookback + 2000
MaxSealLookback = SealRandomnessLookbackLimit + 2000
SealRandomnessLookback = policy.SealRandomnessLookback
TicketRandomnessLookback = abi.ChainEpoch(1)
WinningPoStSectorSetLookback = abi.ChainEpoch(10)
TicketRandomnessLookback = abi.ChainEpoch(1)
FilBase uint64 = 2_000_000_000
FilAllocStorageMining uint64 = 1_400_000_000
FilReserved uint64 = 300_000_000
FilecoinPrecision uint64 = 1_000_000_000_000_000_000
@@ -63,13 +64,39 @@ var (
v = v.Mul(v, big.NewInt(int64(FilecoinPrecision)))
return v
}()
InitialFilReserved = func() *big.Int {
v := big.NewInt(int64(FilReserved))
v = v.Mul(v, big.NewInt(int64(FilecoinPrecision)))
return v
}()
// Actor consts
// TODO: Pull from actors when its made not private
MinDealDuration = abi.ChainEpoch(180 * builtin.EpochsInDay)
MinDealDuration = abi.ChainEpoch(180 * builtin2.EpochsInDay)
PackingEfficiencyNum int64 = 4
PackingEfficiencyDenom int64 = 5
UpgradeBreezeHeight abi.ChainEpoch = 0
UpgradeBreezeHeight abi.ChainEpoch = -1
BreezeGasTampingDuration abi.ChainEpoch = 0
UpgradeSmokeHeight abi.ChainEpoch = -1
UpgradeIgnitionHeight abi.ChainEpoch = -2
UpgradeRefuelHeight abi.ChainEpoch = -3
UpgradeTapeHeight abi.ChainEpoch = -4
UpgradeActorsV2Height abi.ChainEpoch = 10
UpgradeLiftoffHeight abi.ChainEpoch = -5
UpgradeKumquatHeight abi.ChainEpoch = -6
DrandSchedule = map[abi.ChainEpoch]DrandEnum{
0: DrandMainnet,
}
NewestNetworkVersion = network.Version5
ActorUpgradeNetworkVersion = network.Version4
Devnet = true
)
const BootstrapPeerThreshold = 1
-28
View File
@@ -1,28 +0,0 @@
// +build !debug
// +build !2k
// +build !testground
package build
import (
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/specs-actors/actors/builtin/power"
)
const UpgradeBreezeHeight = 41280
const BreezeGasTampingDuration = 120
func init() {
power.ConsensusMinerMinPower = big.NewInt(10 << 40)
miner.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
abi.RegisteredSealProof_StackedDrg32GiBV1: {},
abi.RegisteredSealProof_StackedDrg64GiBV1: {},
}
}
const BlockDelaySecs = uint64(builtin.EpochDurationSeconds)
const PropagationDelaySecs = uint64(6)
+37 -4
View File
@@ -1,6 +1,10 @@
package build
import "fmt"
import (
"fmt"
"golang.org/x/xerrors"
)
var CurrentCommit string
var BuildType int
@@ -25,7 +29,7 @@ func buildType() string {
}
// BuildVersion is the local build version, set by build system
const BuildVersion = "0.6.2"
const BuildVersion = "1.1.3"
func UserVersion() string {
return BuildVersion + buildType() + CurrentCommit
@@ -52,8 +56,37 @@ func (ve Version) EqMajorMinor(v2 Version) bool {
return ve&minorMask == v2&minorMask
}
// APIVersion is a semver version of the rpc api exposed
var APIVersion Version = newVer(0, 14, 0)
type NodeType int
const (
NodeUnknown NodeType = iota
NodeFull
NodeMiner
NodeWorker
)
var RunningNodeType NodeType
func VersionForType(nodeType NodeType) (Version, error) {
switch nodeType {
case NodeFull:
return FullAPIVersion, nil
case NodeMiner:
return MinerAPIVersion, nil
case NodeWorker:
return WorkerAPIVersion, nil
default:
return Version(0), xerrors.Errorf("unknown node type %d", nodeType)
}
}
// semver versions of the rpc api exposed
var (
FullAPIVersion = newVer(0, 17, 0)
MinerAPIVersion = newVer(0, 17, 0)
WorkerAPIVersion = newVer(0, 16, 0)
)
//nolint:varcheck,deadcode
const (
+76
View File
@@ -0,0 +1,76 @@
package adt
import (
"github.com/ipfs/go-cid"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/cbor"
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/chain/actors"
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
)
type Map interface {
Root() (cid.Cid, error)
Put(k abi.Keyer, v cbor.Marshaler) error
Get(k abi.Keyer, v cbor.Unmarshaler) (bool, error)
Delete(k abi.Keyer) error
ForEach(v cbor.Unmarshaler, fn func(key string) error) error
}
func AsMap(store Store, root cid.Cid, version actors.Version) (Map, error) {
switch version {
case actors.Version0:
return adt0.AsMap(store, root)
case actors.Version2:
return adt2.AsMap(store, root)
}
return nil, xerrors.Errorf("unknown network version: %d", version)
}
func NewMap(store Store, version actors.Version) (Map, error) {
switch version {
case actors.Version0:
return adt0.MakeEmptyMap(store), nil
case actors.Version2:
return adt2.MakeEmptyMap(store), nil
}
return nil, xerrors.Errorf("unknown network version: %d", version)
}
type Array interface {
Root() (cid.Cid, error)
Set(idx uint64, v cbor.Marshaler) error
Get(idx uint64, v cbor.Unmarshaler) (bool, error)
Delete(idx uint64) error
Length() uint64
ForEach(v cbor.Unmarshaler, fn func(idx int64) error) error
}
func AsArray(store Store, root cid.Cid, version network.Version) (Array, error) {
switch actors.VersionForNetwork(version) {
case actors.Version0:
return adt0.AsArray(store, root)
case actors.Version2:
return adt2.AsArray(store, root)
}
return nil, xerrors.Errorf("unknown network version: %d", version)
}
func NewArray(store Store, version actors.Version) (Array, error) {
switch version {
case actors.Version0:
return adt0.MakeEmptyArray(store), nil
case actors.Version2:
return adt2.MakeEmptyArray(store), nil
}
return nil, xerrors.Errorf("unknown network version: %d", version)
}
@@ -1,9 +1,9 @@
package state
package adt
import (
"bytes"
"github.com/filecoin-project/specs-actors/actors/util/adt"
"github.com/filecoin-project/go-state-types/abi"
typegen "github.com/whyrusleeping/cbor-gen"
)
@@ -26,7 +26,8 @@ type AdtArrayDiff interface {
// - All values that exist in curArr nnd not in prevArr are passed to adtArrayDiff.Add()
// - All values that exist in preArr and in curArr are passed to AdtArrayDiff.Modify()
// - It is the responsibility of AdtArrayDiff.Modify() to determine if the values it was passed have been modified.
func DiffAdtArray(preArr, curArr *adt.Array, out AdtArrayDiff) error {
func DiffAdtArray(preArr, curArr Array, out AdtArrayDiff) error {
notNew := make(map[int64]struct{}, curArr.Length())
prevVal := new(typegen.Deferred)
if err := preArr.ForEach(prevVal, func(i int64) error {
curVal := new(typegen.Deferred)
@@ -47,14 +48,17 @@ func DiffAdtArray(preArr, curArr *adt.Array, out AdtArrayDiff) error {
return err
}
}
return curArr.Delete(uint64(i))
notNew[i] = struct{}{}
return nil
}); err != nil {
return err
}
curVal := new(typegen.Deferred)
return curArr.ForEach(curVal, func(i int64) error {
if _, ok := notNew[i]; ok {
return nil
}
return out.Add(uint64(i), curVal)
})
}
@@ -69,13 +73,14 @@ func DiffAdtArray(preArr, curArr *adt.Array, out AdtArrayDiff) error {
// Modify should be called when a value is modified in the map
// Remove should be called when a value is removed from the map
type AdtMapDiff interface {
AsKey(key string) (adt.Keyer, error)
AsKey(key string) (abi.Keyer, error)
Add(key string, val *typegen.Deferred) error
Modify(key string, from, to *typegen.Deferred) error
Remove(key string, val *typegen.Deferred) error
}
func DiffAdtMap(preMap, curMap *adt.Map, out AdtMapDiff) error {
func DiffAdtMap(preMap, curMap Map, out AdtMapDiff) error {
notNew := make(map[string]struct{})
prevVal := new(typegen.Deferred)
if err := preMap.ForEach(prevVal, func(key string) error {
curVal := new(typegen.Deferred)
@@ -101,14 +106,17 @@ func DiffAdtMap(preMap, curMap *adt.Map, out AdtMapDiff) error {
return err
}
}
return curMap.Delete(k)
notNew[key] = struct{}{}
return nil
}); err != nil {
return err
}
curVal := new(typegen.Deferred)
return curMap.ForEach(curVal, func(key string) error {
if _, ok := notNew[key]; ok {
return nil
}
return out.Add(key, curVal)
})
}
@@ -1,4 +1,4 @@
package state
package adt
import (
"bytes"
@@ -11,8 +11,10 @@ import (
cbornode "github.com/ipfs/go-ipld-cbor"
typegen "github.com/whyrusleeping/cbor-gen"
"github.com/filecoin-project/specs-actors/actors/runtime"
"github.com/filecoin-project/specs-actors/actors/util/adt"
"github.com/filecoin-project/go-state-types/abi"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
bstore "github.com/filecoin-project/lotus/lib/blockstore"
)
@@ -21,24 +23,24 @@ func TestDiffAdtArray(t *testing.T) {
ctxstoreA := newContextStore()
ctxstoreB := newContextStore()
arrA := adt.MakeEmptyArray(ctxstoreA)
arrB := adt.MakeEmptyArray(ctxstoreB)
arrA := adt2.MakeEmptyArray(ctxstoreA)
arrB := adt2.MakeEmptyArray(ctxstoreB)
require.NoError(t, arrA.Set(0, runtime.CBORBytes([]byte{0}))) // delete
require.NoError(t, arrA.Set(0, builtin2.CBORBytes([]byte{0}))) // delete
require.NoError(t, arrA.Set(1, runtime.CBORBytes([]byte{0}))) // modify
require.NoError(t, arrB.Set(1, runtime.CBORBytes([]byte{1})))
require.NoError(t, arrA.Set(1, builtin2.CBORBytes([]byte{0}))) // modify
require.NoError(t, arrB.Set(1, builtin2.CBORBytes([]byte{1})))
require.NoError(t, arrA.Set(2, runtime.CBORBytes([]byte{1}))) // delete
require.NoError(t, arrA.Set(2, builtin2.CBORBytes([]byte{1}))) // delete
require.NoError(t, arrA.Set(3, runtime.CBORBytes([]byte{0}))) // noop
require.NoError(t, arrB.Set(3, runtime.CBORBytes([]byte{0})))
require.NoError(t, arrA.Set(3, builtin2.CBORBytes([]byte{0}))) // noop
require.NoError(t, arrB.Set(3, builtin2.CBORBytes([]byte{0})))
require.NoError(t, arrA.Set(4, runtime.CBORBytes([]byte{0}))) // modify
require.NoError(t, arrB.Set(4, runtime.CBORBytes([]byte{6})))
require.NoError(t, arrA.Set(4, builtin2.CBORBytes([]byte{0}))) // modify
require.NoError(t, arrB.Set(4, builtin2.CBORBytes([]byte{6})))
require.NoError(t, arrB.Set(5, runtime.CBORBytes{8})) // add
require.NoError(t, arrB.Set(6, runtime.CBORBytes{9})) // add
require.NoError(t, arrB.Set(5, builtin2.CBORBytes{8})) // add
require.NoError(t, arrB.Set(6, builtin2.CBORBytes{9})) // add
changes := new(TestDiffArray)
@@ -75,24 +77,24 @@ func TestDiffAdtMap(t *testing.T) {
ctxstoreA := newContextStore()
ctxstoreB := newContextStore()
mapA := adt.MakeEmptyMap(ctxstoreA)
mapB := adt.MakeEmptyMap(ctxstoreB)
mapA := adt2.MakeEmptyMap(ctxstoreA)
mapB := adt2.MakeEmptyMap(ctxstoreB)
require.NoError(t, mapA.Put(adt.UIntKey(0), runtime.CBORBytes([]byte{0}))) // delete
require.NoError(t, mapA.Put(abi.UIntKey(0), builtin2.CBORBytes([]byte{0}))) // delete
require.NoError(t, mapA.Put(adt.UIntKey(1), runtime.CBORBytes([]byte{0}))) // modify
require.NoError(t, mapB.Put(adt.UIntKey(1), runtime.CBORBytes([]byte{1})))
require.NoError(t, mapA.Put(abi.UIntKey(1), builtin2.CBORBytes([]byte{0}))) // modify
require.NoError(t, mapB.Put(abi.UIntKey(1), builtin2.CBORBytes([]byte{1})))
require.NoError(t, mapA.Put(adt.UIntKey(2), runtime.CBORBytes([]byte{1}))) // delete
require.NoError(t, mapA.Put(abi.UIntKey(2), builtin2.CBORBytes([]byte{1}))) // delete
require.NoError(t, mapA.Put(adt.UIntKey(3), runtime.CBORBytes([]byte{0}))) // noop
require.NoError(t, mapB.Put(adt.UIntKey(3), runtime.CBORBytes([]byte{0})))
require.NoError(t, mapA.Put(abi.UIntKey(3), builtin2.CBORBytes([]byte{0}))) // noop
require.NoError(t, mapB.Put(abi.UIntKey(3), builtin2.CBORBytes([]byte{0})))
require.NoError(t, mapA.Put(adt.UIntKey(4), runtime.CBORBytes([]byte{0}))) // modify
require.NoError(t, mapB.Put(adt.UIntKey(4), runtime.CBORBytes([]byte{6})))
require.NoError(t, mapA.Put(abi.UIntKey(4), builtin2.CBORBytes([]byte{0}))) // modify
require.NoError(t, mapB.Put(abi.UIntKey(4), builtin2.CBORBytes([]byte{6})))
require.NoError(t, mapB.Put(adt.UIntKey(5), runtime.CBORBytes{8})) // add
require.NoError(t, mapB.Put(adt.UIntKey(6), runtime.CBORBytes{9})) // add
require.NoError(t, mapB.Put(abi.UIntKey(5), builtin2.CBORBytes{8})) // add
require.NoError(t, mapB.Put(abi.UIntKey(6), builtin2.CBORBytes{9})) // add
changes := new(TestDiffMap)
@@ -134,21 +136,21 @@ type TestDiffMap struct {
var _ AdtMapDiff = &TestDiffMap{}
func (t *TestDiffMap) AsKey(key string) (adt.Keyer, error) {
k, err := adt.ParseUIntKey(key)
func (t *TestDiffMap) AsKey(key string) (abi.Keyer, error) {
k, err := abi.ParseUIntKey(key)
if err != nil {
return nil, err
}
return adt.UIntKey(k), nil
return abi.UIntKey(k), nil
}
func (t *TestDiffMap) Add(key string, val *typegen.Deferred) error {
v := new(runtime.CBORBytes)
v := new(builtin2.CBORBytes)
err := v.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return err
}
k, err := adt.ParseUIntKey(key)
k, err := abi.ParseUIntKey(key)
if err != nil {
return err
}
@@ -160,19 +162,19 @@ func (t *TestDiffMap) Add(key string, val *typegen.Deferred) error {
}
func (t *TestDiffMap) Modify(key string, from, to *typegen.Deferred) error {
vFrom := new(runtime.CBORBytes)
vFrom := new(builtin2.CBORBytes)
err := vFrom.UnmarshalCBOR(bytes.NewReader(from.Raw))
if err != nil {
return err
}
vTo := new(runtime.CBORBytes)
vTo := new(builtin2.CBORBytes)
err = vTo.UnmarshalCBOR(bytes.NewReader(to.Raw))
if err != nil {
return err
}
k, err := adt.ParseUIntKey(key)
k, err := abi.ParseUIntKey(key)
if err != nil {
return err
}
@@ -193,12 +195,12 @@ func (t *TestDiffMap) Modify(key string, from, to *typegen.Deferred) error {
}
func (t *TestDiffMap) Remove(key string, val *typegen.Deferred) error {
v := new(runtime.CBORBytes)
v := new(builtin2.CBORBytes)
err := v.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return err
}
k, err := adt.ParseUIntKey(key)
k, err := abi.ParseUIntKey(key)
if err != nil {
return err
}
@@ -211,7 +213,7 @@ func (t *TestDiffMap) Remove(key string, val *typegen.Deferred) error {
type adtMapDiffResult struct {
key uint64
val runtime.CBORBytes
val builtin2.CBORBytes
}
type TestAdtMapDiffModified struct {
@@ -221,7 +223,7 @@ type TestAdtMapDiffModified struct {
type adtArrayDiffResult struct {
key uint64
val runtime.CBORBytes
val builtin2.CBORBytes
}
type TestDiffArray struct {
@@ -238,7 +240,7 @@ type TestAdtArrayDiffModified struct {
}
func (t *TestDiffArray) Add(key uint64, val *typegen.Deferred) error {
v := new(runtime.CBORBytes)
v := new(builtin2.CBORBytes)
err := v.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return err
@@ -251,13 +253,13 @@ func (t *TestDiffArray) Add(key uint64, val *typegen.Deferred) error {
}
func (t *TestDiffArray) Modify(key uint64, from, to *typegen.Deferred) error {
vFrom := new(runtime.CBORBytes)
vFrom := new(builtin2.CBORBytes)
err := vFrom.UnmarshalCBOR(bytes.NewReader(from.Raw))
if err != nil {
return err
}
vTo := new(runtime.CBORBytes)
vTo := new(builtin2.CBORBytes)
err = vTo.UnmarshalCBOR(bytes.NewReader(to.Raw))
if err != nil {
return err
@@ -279,7 +281,7 @@ func (t *TestDiffArray) Modify(key uint64, from, to *typegen.Deferred) error {
}
func (t *TestDiffArray) Remove(key uint64, val *typegen.Deferred) error {
v := new(runtime.CBORBytes)
v := new(builtin2.CBORBytes)
err := v.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return err
@@ -291,12 +293,9 @@ func (t *TestDiffArray) Remove(key uint64, val *typegen.Deferred) error {
return nil
}
func newContextStore() *contextStore {
func newContextStore() Store {
ctx := context.Background()
bs := bstore.NewTemporarySync()
store := cbornode.NewCborStore(bs)
return &contextStore{
ctx: ctx,
cst: store,
}
return WrapStore(ctx, store)
}
+17
View File
@@ -0,0 +1,17 @@
package adt
import (
"context"
adt "github.com/filecoin-project/specs-actors/actors/util/adt"
cbor "github.com/ipfs/go-ipld-cbor"
)
type Store interface {
Context() context.Context
cbor.IpldStore
}
func WrapStore(ctx context.Context, store cbor.IpldStore) Store {
return adt.WrapStore(ctx, store)
}
+29
View File
@@ -0,0 +1,29 @@
# Actors
This package contains shims for abstracting over different actor versions.
## Design
Shims in this package follow a few common design principles.
### Structure Agnostic
Shims interfaces defined in this package should (ideally) not change even if the
structure of the underlying data changes. For example:
* All shims store an internal "store" object. That way, state can be moved into
a separate object without needing to add a store to the function signature.
* All functions must return an error, even if unused for now.
### Minimal
These interfaces should be expanded only as necessary to reduce maintenance burden.
### Queries, not field assessors.
When possible, functions should query the state instead of simply acting as
field assessors. These queries are more likely to remain stable across
specs-actor upgrades than specific state fields.
Note: there is a trade-off here. Avoid implementing _complicated_ query logic
inside these shims, as it will need to be replicated in every shim.
+43
View File
@@ -0,0 +1,43 @@
package account
import (
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/cbor"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/types"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
)
func init() {
builtin.RegisterActorState(builtin0.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
builtin.RegisterActorState(builtin2.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
var Methods = builtin2.MethodsAccount
func Load(store adt.Store, act *types.Actor) (State, error) {
switch act.Code {
case builtin0.AccountActorCodeID:
return load0(store, act.Head)
case builtin2.AccountActorCodeID:
return load2(store, act.Head)
}
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
type State interface {
cbor.Marshaler
PubkeyAddress() (address.Address, error)
}
+30
View File
@@ -0,0 +1,30 @@
package account
import (
"github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/lotus/chain/actors/adt"
account0 "github.com/filecoin-project/specs-actors/actors/builtin/account"
)
var _ State = (*state0)(nil)
func load0(store adt.Store, root cid.Cid) (State, error) {
out := state0{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
type state0 struct {
account0.State
store adt.Store
}
func (s *state0) PubkeyAddress() (address.Address, error) {
return s.Address, nil
}
+30
View File
@@ -0,0 +1,30 @@
package account
import (
"github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/lotus/chain/actors/adt"
account2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/account"
)
var _ State = (*state2)(nil)
func load2(store adt.Store, root cid.Cid) (State, error) {
out := state2{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
type state2 struct {
account2.State
store adt.Store
}
func (s *state2) PubkeyAddress() (address.Address, error) {
return s.Address, nil
}
+118
View File
@@ -0,0 +1,118 @@
package builtin
import (
"github.com/filecoin-project/go-address"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
smoothing2 "github.com/filecoin-project/specs-actors/v2/actors/util/smoothing"
"github.com/ipfs/go-cid"
"golang.org/x/xerrors"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/cbor"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
proof0 "github.com/filecoin-project/specs-actors/actors/runtime/proof"
smoothing0 "github.com/filecoin-project/specs-actors/actors/util/smoothing"
)
var SystemActorAddr = builtin0.SystemActorAddr
var BurntFundsActorAddr = builtin0.BurntFundsActorAddr
var CronActorAddr = builtin0.CronActorAddr
var SaftAddress = makeAddress("t0122")
var ReserveAddress = makeAddress("t090")
var RootVerifierAddress = makeAddress("t080")
var (
ExpectedLeadersPerEpoch = builtin0.ExpectedLeadersPerEpoch
)
const (
EpochDurationSeconds = builtin0.EpochDurationSeconds
EpochsInDay = builtin0.EpochsInDay
SecondsInDay = builtin0.SecondsInDay
)
const (
MethodSend = builtin2.MethodSend
MethodConstructor = builtin2.MethodConstructor
)
// TODO: Why does actors have 2 different versions of this?
type SectorInfo = proof0.SectorInfo
type PoStProof = proof0.PoStProof
type FilterEstimate = smoothing0.FilterEstimate
func FromV0FilterEstimate(v0 smoothing0.FilterEstimate) FilterEstimate {
return (FilterEstimate)(v0)
}
// Doesn't change between actors v0 and v1
func QAPowerForWeight(size abi.SectorSize, duration abi.ChainEpoch, dealWeight, verifiedWeight abi.DealWeight) abi.StoragePower {
return miner0.QAPowerForWeight(size, duration, dealWeight, verifiedWeight)
}
func FromV2FilterEstimate(v1 smoothing2.FilterEstimate) FilterEstimate {
return (FilterEstimate)(v1)
}
type ActorStateLoader func(store adt.Store, root cid.Cid) (cbor.Marshaler, error)
var ActorStateLoaders = make(map[cid.Cid]ActorStateLoader)
func RegisterActorState(code cid.Cid, loader ActorStateLoader) {
ActorStateLoaders[code] = loader
}
func Load(store adt.Store, act *types.Actor) (cbor.Marshaler, error) {
loader, found := ActorStateLoaders[act.Code]
if !found {
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
return loader(store, act.Head)
}
func ActorNameByCode(c cid.Cid) string {
switch {
case builtin0.IsBuiltinActor(c):
return builtin0.ActorNameByCode(c)
case builtin2.IsBuiltinActor(c):
return builtin2.ActorNameByCode(c)
default:
return "<unknown>"
}
}
func IsBuiltinActor(c cid.Cid) bool {
return builtin0.IsBuiltinActor(c) || builtin2.IsBuiltinActor(c)
}
func IsAccountActor(c cid.Cid) bool {
return c == builtin0.AccountActorCodeID || c == builtin2.AccountActorCodeID
}
func IsStorageMinerActor(c cid.Cid) bool {
return c == builtin0.StorageMinerActorCodeID || c == builtin2.StorageMinerActorCodeID
}
func IsMultisigActor(c cid.Cid) bool {
return c == builtin0.MultisigActorCodeID || c == builtin2.MultisigActorCodeID
}
func IsPaymentChannelActor(c cid.Cid) bool {
return c == builtin0.PaymentChannelActorCodeID || c == builtin2.PaymentChannelActorCodeID
}
func makeAddress(addr string) address.Address {
ret, err := address.NewFromString(addr)
if err != nil {
panic(err)
}
return ret
}
+10
View File
@@ -0,0 +1,10 @@
package cron
import (
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
)
var (
Address = builtin2.CronActorAddr
Methods = builtin2.MethodsCron
)
+60
View File
@@ -0,0 +1,60 @@
package init
import (
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/cbor"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/node/modules/dtypes"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
)
func init() {
builtin.RegisterActorState(builtin0.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
builtin.RegisterActorState(builtin2.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
var (
Address = builtin2.InitActorAddr
Methods = builtin2.MethodsInit
)
func Load(store adt.Store, act *types.Actor) (State, error) {
switch act.Code {
case builtin0.InitActorCodeID:
return load0(store, act.Head)
case builtin2.InitActorCodeID:
return load2(store, act.Head)
}
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
type State interface {
cbor.Marshaler
ResolveAddress(address address.Address) (address.Address, bool, error)
MapAddressToNewID(address address.Address) (address.Address, error)
NetworkName() (dtypes.NetworkName, error)
ForEachActor(func(id abi.ActorID, address address.Address) error) error
// Remove exists to support tooling that manipulates state for testing.
// It should not be used in production code, as init actor entries are
// immutable.
Remove(addrs ...address.Address) error
// Sets the network's name. This should only be used on upgrade/fork.
SetNetworkName(name string) error
}
+81
View File
@@ -0,0 +1,81 @@
package init
import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/node/modules/dtypes"
init0 "github.com/filecoin-project/specs-actors/actors/builtin/init"
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
)
var _ State = (*state0)(nil)
func load0(store adt.Store, root cid.Cid) (State, error) {
out := state0{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
type state0 struct {
init0.State
store adt.Store
}
func (s *state0) ResolveAddress(address address.Address) (address.Address, bool, error) {
return s.State.ResolveAddress(s.store, address)
}
func (s *state0) MapAddressToNewID(address address.Address) (address.Address, error) {
return s.State.MapAddressToNewID(s.store, address)
}
func (s *state0) ForEachActor(cb func(id abi.ActorID, address address.Address) error) error {
addrs, err := adt0.AsMap(s.store, s.State.AddressMap)
if err != nil {
return err
}
var actorID cbg.CborInt
return addrs.ForEach(&actorID, func(key string) error {
addr, err := address.NewFromBytes([]byte(key))
if err != nil {
return err
}
return cb(abi.ActorID(actorID), addr)
})
}
func (s *state0) NetworkName() (dtypes.NetworkName, error) {
return dtypes.NetworkName(s.State.NetworkName), nil
}
func (s *state0) SetNetworkName(name string) error {
s.State.NetworkName = name
return nil
}
func (s *state0) Remove(addrs ...address.Address) (err error) {
m, err := adt0.AsMap(s.store, s.State.AddressMap)
if err != nil {
return err
}
for _, addr := range addrs {
if err = m.Delete(abi.AddrKey(addr)); err != nil {
return xerrors.Errorf("failed to delete entry for address: %s; err: %w", addr, err)
}
}
amr, err := m.Root()
if err != nil {
return xerrors.Errorf("failed to get address map root: %w", err)
}
s.State.AddressMap = amr
return nil
}
+81
View File
@@ -0,0 +1,81 @@
package init
import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/node/modules/dtypes"
init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init"
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
)
var _ State = (*state2)(nil)
func load2(store adt.Store, root cid.Cid) (State, error) {
out := state2{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
type state2 struct {
init2.State
store adt.Store
}
func (s *state2) ResolveAddress(address address.Address) (address.Address, bool, error) {
return s.State.ResolveAddress(s.store, address)
}
func (s *state2) MapAddressToNewID(address address.Address) (address.Address, error) {
return s.State.MapAddressToNewID(s.store, address)
}
func (s *state2) ForEachActor(cb func(id abi.ActorID, address address.Address) error) error {
addrs, err := adt2.AsMap(s.store, s.State.AddressMap)
if err != nil {
return err
}
var actorID cbg.CborInt
return addrs.ForEach(&actorID, func(key string) error {
addr, err := address.NewFromBytes([]byte(key))
if err != nil {
return err
}
return cb(abi.ActorID(actorID), addr)
})
}
func (s *state2) NetworkName() (dtypes.NetworkName, error) {
return dtypes.NetworkName(s.State.NetworkName), nil
}
func (s *state2) SetNetworkName(name string) error {
s.State.NetworkName = name
return nil
}
func (s *state2) Remove(addrs ...address.Address) (err error) {
m, err := adt2.AsMap(s.store, s.State.AddressMap)
if err != nil {
return err
}
for _, addr := range addrs {
if err = m.Delete(abi.AddrKey(addr)); err != nil {
return xerrors.Errorf("failed to delete entry for address: %s; err: %w", addr, err)
}
}
amr, err := m.Root()
if err != nil {
return xerrors.Errorf("failed to get address map root: %w", err)
}
s.State.AddressMap = amr
return nil
}
+91
View File
@@ -0,0 +1,91 @@
package market
import (
"fmt"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors/adt"
cbg "github.com/whyrusleeping/cbor-gen"
)
func DiffDealProposals(pre, cur DealProposals) (*DealProposalChanges, error) {
results := new(DealProposalChanges)
if err := adt.DiffAdtArray(pre.array(), cur.array(), &marketProposalsDiffer{results, pre, cur}); err != nil {
return nil, fmt.Errorf("diffing deal states: %w", err)
}
return results, nil
}
type marketProposalsDiffer struct {
Results *DealProposalChanges
pre, cur DealProposals
}
func (d *marketProposalsDiffer) Add(key uint64, val *cbg.Deferred) error {
dp, err := d.cur.decode(val)
if err != nil {
return err
}
d.Results.Added = append(d.Results.Added, ProposalIDState{abi.DealID(key), *dp})
return nil
}
func (d *marketProposalsDiffer) Modify(key uint64, from, to *cbg.Deferred) error {
// short circuit, DealProposals are static
return nil
}
func (d *marketProposalsDiffer) Remove(key uint64, val *cbg.Deferred) error {
dp, err := d.pre.decode(val)
if err != nil {
return err
}
d.Results.Removed = append(d.Results.Removed, ProposalIDState{abi.DealID(key), *dp})
return nil
}
func DiffDealStates(pre, cur DealStates) (*DealStateChanges, error) {
results := new(DealStateChanges)
if err := adt.DiffAdtArray(pre.array(), cur.array(), &marketStatesDiffer{results, pre, cur}); err != nil {
return nil, fmt.Errorf("diffing deal states: %w", err)
}
return results, nil
}
type marketStatesDiffer struct {
Results *DealStateChanges
pre, cur DealStates
}
func (d *marketStatesDiffer) Add(key uint64, val *cbg.Deferred) error {
ds, err := d.cur.decode(val)
if err != nil {
return err
}
d.Results.Added = append(d.Results.Added, DealIDState{abi.DealID(key), *ds})
return nil
}
func (d *marketStatesDiffer) Modify(key uint64, from, to *cbg.Deferred) error {
dsFrom, err := d.pre.decode(from)
if err != nil {
return err
}
dsTo, err := d.cur.decode(to)
if err != nil {
return err
}
if *dsFrom != *dsTo {
d.Results.Modified = append(d.Results.Modified, DealStateChange{abi.DealID(key), dsFrom, dsTo})
}
return nil
}
func (d *marketStatesDiffer) Remove(key uint64, val *cbg.Deferred) error {
ds, err := d.pre.decode(val)
if err != nil {
return err
}
d.Results.Removed = append(d.Results.Removed, DealIDState{abi.DealID(key), *ds})
return nil
}
+142
View File
@@ -0,0 +1,142 @@
package market
import (
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/cbor"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/types"
)
func init() {
builtin.RegisterActorState(builtin0.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
builtin.RegisterActorState(builtin2.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
var (
Address = builtin2.StorageMarketActorAddr
Methods = builtin2.MethodsMarket
)
func Load(store adt.Store, act *types.Actor) (st State, err error) {
switch act.Code {
case builtin0.StorageMarketActorCodeID:
return load0(store, act.Head)
case builtin2.StorageMarketActorCodeID:
return load2(store, act.Head)
}
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
type State interface {
cbor.Marshaler
BalancesChanged(State) (bool, error)
EscrowTable() (BalanceTable, error)
LockedTable() (BalanceTable, error)
TotalLocked() (abi.TokenAmount, error)
StatesChanged(State) (bool, error)
States() (DealStates, error)
ProposalsChanged(State) (bool, error)
Proposals() (DealProposals, error)
VerifyDealsForActivation(
minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch,
) (weight, verifiedWeight abi.DealWeight, err error)
}
type BalanceTable interface {
ForEach(cb func(address.Address, abi.TokenAmount) error) error
Get(key address.Address) (abi.TokenAmount, error)
}
type DealStates interface {
ForEach(cb func(id abi.DealID, ds DealState) error) error
Get(id abi.DealID) (*DealState, bool, error)
array() adt.Array
decode(*cbg.Deferred) (*DealState, error)
}
type DealProposals interface {
ForEach(cb func(id abi.DealID, dp DealProposal) error) error
Get(id abi.DealID) (*DealProposal, bool, error)
array() adt.Array
decode(*cbg.Deferred) (*DealProposal, error)
}
type PublishStorageDealsParams = market0.PublishStorageDealsParams
type PublishStorageDealsReturn = market0.PublishStorageDealsReturn
type VerifyDealsForActivationParams = market0.VerifyDealsForActivationParams
type WithdrawBalanceParams = market0.WithdrawBalanceParams
type ClientDealProposal = market0.ClientDealProposal
type DealState struct {
SectorStartEpoch abi.ChainEpoch // -1 if not yet included in proven sector
LastUpdatedEpoch abi.ChainEpoch // -1 if deal state never updated
SlashEpoch abi.ChainEpoch // -1 if deal never slashed
}
type DealProposal struct {
PieceCID cid.Cid
PieceSize abi.PaddedPieceSize
VerifiedDeal bool
Client address.Address
Provider address.Address
Label string
StartEpoch abi.ChainEpoch
EndEpoch abi.ChainEpoch
StoragePricePerEpoch abi.TokenAmount
ProviderCollateral abi.TokenAmount
ClientCollateral abi.TokenAmount
}
type DealStateChanges struct {
Added []DealIDState
Modified []DealStateChange
Removed []DealIDState
}
type DealIDState struct {
ID abi.DealID
Deal DealState
}
// DealStateChange is a change in deal state from -> to
type DealStateChange struct {
ID abi.DealID
From *DealState
To *DealState
}
type DealProposalChanges struct {
Added []ProposalIDState
Removed []ProposalIDState
}
type ProposalIDState struct {
ID abi.DealID
Proposal DealProposal
}
func EmptyDealState() *DealState {
return &DealState{
SectorStartEpoch: -1,
SlashEpoch: -1,
LastUpdatedEpoch: -1,
}
}
+204
View File
@@ -0,0 +1,204 @@
package market
import (
"bytes"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
)
var _ State = (*state0)(nil)
func load0(store adt.Store, root cid.Cid) (State, error) {
out := state0{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
type state0 struct {
market0.State
store adt.Store
}
func (s *state0) TotalLocked() (abi.TokenAmount, error) {
fml := types.BigAdd(s.TotalClientLockedCollateral, s.TotalProviderLockedCollateral)
fml = types.BigAdd(fml, s.TotalClientStorageFee)
return fml, nil
}
func (s *state0) BalancesChanged(otherState State) (bool, error) {
otherState0, ok := otherState.(*state0)
if !ok {
// there's no way to compare different versions of the state, so let's
// just say that means the state of balances has changed
return true, nil
}
return !s.State.EscrowTable.Equals(otherState0.State.EscrowTable) || !s.State.LockedTable.Equals(otherState0.State.LockedTable), nil
}
func (s *state0) StatesChanged(otherState State) (bool, error) {
otherState0, ok := otherState.(*state0)
if !ok {
// there's no way to compare different versions of the state, so let's
// just say that means the state of balances has changed
return true, nil
}
return !s.State.States.Equals(otherState0.State.States), nil
}
func (s *state0) States() (DealStates, error) {
stateArray, err := adt0.AsArray(s.store, s.State.States)
if err != nil {
return nil, err
}
return &dealStates0{stateArray}, nil
}
func (s *state0) ProposalsChanged(otherState State) (bool, error) {
otherState0, ok := otherState.(*state0)
if !ok {
// there's no way to compare different versions of the state, so let's
// just say that means the state of balances has changed
return true, nil
}
return !s.State.Proposals.Equals(otherState0.State.Proposals), nil
}
func (s *state0) Proposals() (DealProposals, error) {
proposalArray, err := adt0.AsArray(s.store, s.State.Proposals)
if err != nil {
return nil, err
}
return &dealProposals0{proposalArray}, nil
}
func (s *state0) EscrowTable() (BalanceTable, error) {
bt, err := adt0.AsBalanceTable(s.store, s.State.EscrowTable)
if err != nil {
return nil, err
}
return &balanceTable0{bt}, nil
}
func (s *state0) LockedTable() (BalanceTable, error) {
bt, err := adt0.AsBalanceTable(s.store, s.State.LockedTable)
if err != nil {
return nil, err
}
return &balanceTable0{bt}, nil
}
func (s *state0) VerifyDealsForActivation(
minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch,
) (weight, verifiedWeight abi.DealWeight, err error) {
return market0.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch)
}
type balanceTable0 struct {
*adt0.BalanceTable
}
func (bt *balanceTable0) ForEach(cb func(address.Address, abi.TokenAmount) error) error {
asMap := (*adt0.Map)(bt.BalanceTable)
var ta abi.TokenAmount
return asMap.ForEach(&ta, func(key string) error {
a, err := address.NewFromBytes([]byte(key))
if err != nil {
return err
}
return cb(a, ta)
})
}
type dealStates0 struct {
adt.Array
}
func (s *dealStates0) Get(dealID abi.DealID) (*DealState, bool, error) {
var deal0 market0.DealState
found, err := s.Array.Get(uint64(dealID), &deal0)
if err != nil {
return nil, false, err
}
if !found {
return nil, false, nil
}
deal := fromV0DealState(deal0)
return &deal, true, nil
}
func (s *dealStates0) ForEach(cb func(dealID abi.DealID, ds DealState) error) error {
var ds0 market0.DealState
return s.Array.ForEach(&ds0, func(idx int64) error {
return cb(abi.DealID(idx), fromV0DealState(ds0))
})
}
func (s *dealStates0) decode(val *cbg.Deferred) (*DealState, error) {
var ds0 market0.DealState
if err := ds0.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
return nil, err
}
ds := fromV0DealState(ds0)
return &ds, nil
}
func (s *dealStates0) array() adt.Array {
return s.Array
}
func fromV0DealState(v0 market0.DealState) DealState {
return (DealState)(v0)
}
type dealProposals0 struct {
adt.Array
}
func (s *dealProposals0) Get(dealID abi.DealID) (*DealProposal, bool, error) {
var proposal0 market0.DealProposal
found, err := s.Array.Get(uint64(dealID), &proposal0)
if err != nil {
return nil, false, err
}
if !found {
return nil, false, nil
}
proposal := fromV0DealProposal(proposal0)
return &proposal, true, nil
}
func (s *dealProposals0) ForEach(cb func(dealID abi.DealID, dp DealProposal) error) error {
var dp0 market0.DealProposal
return s.Array.ForEach(&dp0, func(idx int64) error {
return cb(abi.DealID(idx), fromV0DealProposal(dp0))
})
}
func (s *dealProposals0) decode(val *cbg.Deferred) (*DealProposal, error) {
var dp0 market0.DealProposal
if err := dp0.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
return nil, err
}
dp := fromV0DealProposal(dp0)
return &dp, nil
}
func (s *dealProposals0) array() adt.Array {
return s.Array
}
func fromV0DealProposal(v0 market0.DealProposal) DealProposal {
return (DealProposal)(v0)
}
+205
View File
@@ -0,0 +1,205 @@
package market
import (
"bytes"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
)
var _ State = (*state2)(nil)
func load2(store adt.Store, root cid.Cid) (State, error) {
out := state2{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
type state2 struct {
market2.State
store adt.Store
}
func (s *state2) TotalLocked() (abi.TokenAmount, error) {
fml := types.BigAdd(s.TotalClientLockedCollateral, s.TotalProviderLockedCollateral)
fml = types.BigAdd(fml, s.TotalClientStorageFee)
return fml, nil
}
func (s *state2) BalancesChanged(otherState State) (bool, error) {
otherState2, ok := otherState.(*state2)
if !ok {
// there's no way to compare different versions of the state, so let's
// just say that means the state of balances has changed
return true, nil
}
return !s.State.EscrowTable.Equals(otherState2.State.EscrowTable) || !s.State.LockedTable.Equals(otherState2.State.LockedTable), nil
}
func (s *state2) StatesChanged(otherState State) (bool, error) {
otherState2, ok := otherState.(*state2)
if !ok {
// there's no way to compare different versions of the state, so let's
// just say that means the state of balances has changed
return true, nil
}
return !s.State.States.Equals(otherState2.State.States), nil
}
func (s *state2) States() (DealStates, error) {
stateArray, err := adt2.AsArray(s.store, s.State.States)
if err != nil {
return nil, err
}
return &dealStates2{stateArray}, nil
}
func (s *state2) ProposalsChanged(otherState State) (bool, error) {
otherState2, ok := otherState.(*state2)
if !ok {
// there's no way to compare different versions of the state, so let's
// just say that means the state of balances has changed
return true, nil
}
return !s.State.Proposals.Equals(otherState2.State.Proposals), nil
}
func (s *state2) Proposals() (DealProposals, error) {
proposalArray, err := adt2.AsArray(s.store, s.State.Proposals)
if err != nil {
return nil, err
}
return &dealProposals2{proposalArray}, nil
}
func (s *state2) EscrowTable() (BalanceTable, error) {
bt, err := adt2.AsBalanceTable(s.store, s.State.EscrowTable)
if err != nil {
return nil, err
}
return &balanceTable2{bt}, nil
}
func (s *state2) LockedTable() (BalanceTable, error) {
bt, err := adt2.AsBalanceTable(s.store, s.State.LockedTable)
if err != nil {
return nil, err
}
return &balanceTable2{bt}, nil
}
func (s *state2) VerifyDealsForActivation(
minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch,
) (weight, verifiedWeight abi.DealWeight, err error) {
w, vw, _, err := market2.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch)
return w, vw, err
}
type balanceTable2 struct {
*adt2.BalanceTable
}
func (bt *balanceTable2) ForEach(cb func(address.Address, abi.TokenAmount) error) error {
asMap := (*adt2.Map)(bt.BalanceTable)
var ta abi.TokenAmount
return asMap.ForEach(&ta, func(key string) error {
a, err := address.NewFromBytes([]byte(key))
if err != nil {
return err
}
return cb(a, ta)
})
}
type dealStates2 struct {
adt.Array
}
func (s *dealStates2) Get(dealID abi.DealID) (*DealState, bool, error) {
var deal2 market2.DealState
found, err := s.Array.Get(uint64(dealID), &deal2)
if err != nil {
return nil, false, err
}
if !found {
return nil, false, nil
}
deal := fromV2DealState(deal2)
return &deal, true, nil
}
func (s *dealStates2) ForEach(cb func(dealID abi.DealID, ds DealState) error) error {
var ds1 market2.DealState
return s.Array.ForEach(&ds1, func(idx int64) error {
return cb(abi.DealID(idx), fromV2DealState(ds1))
})
}
func (s *dealStates2) decode(val *cbg.Deferred) (*DealState, error) {
var ds1 market2.DealState
if err := ds1.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
return nil, err
}
ds := fromV2DealState(ds1)
return &ds, nil
}
func (s *dealStates2) array() adt.Array {
return s.Array
}
func fromV2DealState(v1 market2.DealState) DealState {
return (DealState)(v1)
}
type dealProposals2 struct {
adt.Array
}
func (s *dealProposals2) Get(dealID abi.DealID) (*DealProposal, bool, error) {
var proposal2 market2.DealProposal
found, err := s.Array.Get(uint64(dealID), &proposal2)
if err != nil {
return nil, false, err
}
if !found {
return nil, false, nil
}
proposal := fromV2DealProposal(proposal2)
return &proposal, true, nil
}
func (s *dealProposals2) ForEach(cb func(dealID abi.DealID, dp DealProposal) error) error {
var dp1 market2.DealProposal
return s.Array.ForEach(&dp1, func(idx int64) error {
return cb(abi.DealID(idx), fromV2DealProposal(dp1))
})
}
func (s *dealProposals2) decode(val *cbg.Deferred) (*DealProposal, error) {
var dp1 market2.DealProposal
if err := dp1.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
return nil, err
}
dp := fromV2DealProposal(dp1)
return &dp, nil
}
func (s *dealProposals2) array() adt.Array {
return s.Array
}
func fromV2DealProposal(v1 market2.DealProposal) DealProposal {
return (DealProposal)(v1)
}
+127
View File
@@ -0,0 +1,127 @@
package miner
import (
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors/adt"
cbg "github.com/whyrusleeping/cbor-gen"
)
func DiffPreCommits(pre, cur State) (*PreCommitChanges, error) {
results := new(PreCommitChanges)
prep, err := pre.precommits()
if err != nil {
return nil, err
}
curp, err := cur.precommits()
if err != nil {
return nil, err
}
err = adt.DiffAdtMap(prep, curp, &preCommitDiffer{results, pre, cur})
if err != nil {
return nil, err
}
return results, nil
}
type preCommitDiffer struct {
Results *PreCommitChanges
pre, after State
}
func (m *preCommitDiffer) AsKey(key string) (abi.Keyer, error) {
sector, err := abi.ParseUIntKey(key)
if err != nil {
return nil, err
}
return abi.UIntKey(sector), nil
}
func (m *preCommitDiffer) Add(key string, val *cbg.Deferred) error {
sp, err := m.after.decodeSectorPreCommitOnChainInfo(val)
if err != nil {
return err
}
m.Results.Added = append(m.Results.Added, sp)
return nil
}
func (m *preCommitDiffer) Modify(key string, from, to *cbg.Deferred) error {
return nil
}
func (m *preCommitDiffer) Remove(key string, val *cbg.Deferred) error {
sp, err := m.pre.decodeSectorPreCommitOnChainInfo(val)
if err != nil {
return err
}
m.Results.Removed = append(m.Results.Removed, sp)
return nil
}
func DiffSectors(pre, cur State) (*SectorChanges, error) {
results := new(SectorChanges)
pres, err := pre.sectors()
if err != nil {
return nil, err
}
curs, err := cur.sectors()
if err != nil {
return nil, err
}
err = adt.DiffAdtArray(pres, curs, &sectorDiffer{results, pre, cur})
if err != nil {
return nil, err
}
return results, nil
}
type sectorDiffer struct {
Results *SectorChanges
pre, after State
}
func (m *sectorDiffer) Add(key uint64, val *cbg.Deferred) error {
si, err := m.after.decodeSectorOnChainInfo(val)
if err != nil {
return err
}
m.Results.Added = append(m.Results.Added, si)
return nil
}
func (m *sectorDiffer) Modify(key uint64, from, to *cbg.Deferred) error {
siFrom, err := m.pre.decodeSectorOnChainInfo(from)
if err != nil {
return err
}
siTo, err := m.after.decodeSectorOnChainInfo(to)
if err != nil {
return err
}
if siFrom.Expiration != siTo.Expiration {
m.Results.Extended = append(m.Results.Extended, SectorExtensions{
From: siFrom,
To: siTo,
})
}
return nil
}
func (m *sectorDiffer) Remove(key uint64, val *cbg.Deferred) error {
si, err := m.pre.decodeSectorOnChainInfo(val)
if err != nil {
return err
}
m.Results.Removed = append(m.Results.Removed, si)
return nil
}
@@ -0,0 +1,176 @@
package miner
import (
"errors"
"github.com/filecoin-project/go-bitfield"
"github.com/filecoin-project/go-state-types/exitcode"
)
type DeadlinesDiff map[uint64]DeadlineDiff
func DiffDeadlines(pre, cur State) (DeadlinesDiff, error) {
changed, err := pre.DeadlinesChanged(cur)
if err != nil {
return nil, err
}
if !changed {
return nil, nil
}
dlDiff := make(DeadlinesDiff)
if err := pre.ForEachDeadline(func(idx uint64, preDl Deadline) error {
curDl, err := cur.LoadDeadline(idx)
if err != nil {
return err
}
diff, err := DiffDeadline(preDl, curDl)
if err != nil {
return err
}
dlDiff[idx] = diff
return nil
}); err != nil {
return nil, err
}
return dlDiff, nil
}
type DeadlineDiff map[uint64]*PartitionDiff
func DiffDeadline(pre, cur Deadline) (DeadlineDiff, error) {
changed, err := pre.PartitionsChanged(cur)
if err != nil {
return nil, err
}
if !changed {
return nil, nil
}
partDiff := make(DeadlineDiff)
if err := pre.ForEachPartition(func(idx uint64, prePart Partition) error {
// try loading current partition at this index
curPart, err := cur.LoadPartition(idx)
if err != nil {
if errors.Is(err, exitcode.ErrNotFound) {
// TODO correctness?
return nil // the partition was removed.
}
return err
}
// compare it with the previous partition
diff, err := DiffPartition(prePart, curPart)
if err != nil {
return err
}
partDiff[idx] = diff
return nil
}); err != nil {
return nil, err
}
// all previous partitions have been walked.
// all partitions in cur and not in prev are new... can they be faulty already?
// TODO is this correct?
if err := cur.ForEachPartition(func(idx uint64, curPart Partition) error {
if _, found := partDiff[idx]; found {
return nil
}
faults, err := curPart.FaultySectors()
if err != nil {
return err
}
recovering, err := curPart.RecoveringSectors()
if err != nil {
return err
}
partDiff[idx] = &PartitionDiff{
Removed: bitfield.New(),
Recovered: bitfield.New(),
Faulted: faults,
Recovering: recovering,
}
return nil
}); err != nil {
return nil, err
}
return partDiff, nil
}
type PartitionDiff struct {
Removed bitfield.BitField
Recovered bitfield.BitField
Faulted bitfield.BitField
Recovering bitfield.BitField
}
func DiffPartition(pre, cur Partition) (*PartitionDiff, error) {
prevLiveSectors, err := pre.LiveSectors()
if err != nil {
return nil, err
}
curLiveSectors, err := cur.LiveSectors()
if err != nil {
return nil, err
}
removed, err := bitfield.SubtractBitField(prevLiveSectors, curLiveSectors)
if err != nil {
return nil, err
}
prevRecoveries, err := pre.RecoveringSectors()
if err != nil {
return nil, err
}
curRecoveries, err := cur.RecoveringSectors()
if err != nil {
return nil, err
}
recovering, err := bitfield.SubtractBitField(curRecoveries, prevRecoveries)
if err != nil {
return nil, err
}
prevFaults, err := pre.FaultySectors()
if err != nil {
return nil, err
}
curFaults, err := cur.FaultySectors()
if err != nil {
return nil, err
}
faulted, err := bitfield.SubtractBitField(curFaults, prevFaults)
if err != nil {
return nil, err
}
// all current good sectors
curActiveSectors, err := cur.ActiveSectors()
if err != nil {
return nil, err
}
// sectors that were previously fault and are now currently active are considered recovered.
recovered, err := bitfield.IntersectBitField(prevFaults, curActiveSectors)
if err != nil {
return nil, err
}
return &PartitionDiff{
Removed: removed,
Recovered: recovered,
Faulted: faulted,
Recovering: recovering,
}, nil
}
+206
View File
@@ -0,0 +1,206 @@
package miner
import (
"github.com/filecoin-project/go-state-types/big"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/peer"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/cbor"
"github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/types"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
)
func init() {
builtin.RegisterActorState(builtin0.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
builtin.RegisterActorState(builtin2.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
var Methods = builtin2.MethodsMiner
// Unchanged between v0 and v2 actors
var WPoStProvingPeriod = miner0.WPoStProvingPeriod
var WPoStPeriodDeadlines = miner0.WPoStPeriodDeadlines
var WPoStChallengeWindow = miner0.WPoStChallengeWindow
var WPoStChallengeLookback = miner0.WPoStChallengeLookback
var FaultDeclarationCutoff = miner0.FaultDeclarationCutoff
const MinSectorExpiration = miner0.MinSectorExpiration
func Load(store adt.Store, act *types.Actor) (st State, err error) {
switch act.Code {
case builtin0.StorageMinerActorCodeID:
return load0(store, act.Head)
case builtin2.StorageMinerActorCodeID:
return load2(store, act.Head)
}
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
type State interface {
cbor.Marshaler
// Total available balance to spend.
AvailableBalance(abi.TokenAmount) (abi.TokenAmount, error)
// Funds that will vest by the given epoch.
VestedFunds(abi.ChainEpoch) (abi.TokenAmount, error)
// Funds locked for various reasons.
LockedFunds() (LockedFunds, error)
FeeDebt() (abi.TokenAmount, error)
GetSector(abi.SectorNumber) (*SectorOnChainInfo, error)
FindSector(abi.SectorNumber) (*SectorLocation, error)
GetSectorExpiration(abi.SectorNumber) (*SectorExpiration, error)
GetPrecommittedSector(abi.SectorNumber) (*SectorPreCommitOnChainInfo, error)
LoadSectors(sectorNos *bitfield.BitField) ([]*SectorOnChainInfo, error)
NumLiveSectors() (uint64, error)
IsAllocated(abi.SectorNumber) (bool, error)
LoadDeadline(idx uint64) (Deadline, error)
ForEachDeadline(cb func(idx uint64, dl Deadline) error) error
NumDeadlines() (uint64, error)
DeadlinesChanged(State) (bool, error)
Info() (MinerInfo, error)
MinerInfoChanged(State) (bool, error)
DeadlineInfo(epoch abi.ChainEpoch) (*dline.Info, error)
// Diff helpers. Used by Diff* functions internally.
sectors() (adt.Array, error)
decodeSectorOnChainInfo(*cbg.Deferred) (SectorOnChainInfo, error)
precommits() (adt.Map, error)
decodeSectorPreCommitOnChainInfo(*cbg.Deferred) (SectorPreCommitOnChainInfo, error)
}
type Deadline interface {
LoadPartition(idx uint64) (Partition, error)
ForEachPartition(cb func(idx uint64, part Partition) error) error
PostSubmissions() (bitfield.BitField, error)
PartitionsChanged(Deadline) (bool, error)
}
type Partition interface {
AllSectors() (bitfield.BitField, error)
FaultySectors() (bitfield.BitField, error)
RecoveringSectors() (bitfield.BitField, error)
LiveSectors() (bitfield.BitField, error)
ActiveSectors() (bitfield.BitField, error)
}
type SectorOnChainInfo struct {
SectorNumber abi.SectorNumber
SealProof abi.RegisteredSealProof
SealedCID cid.Cid
DealIDs []abi.DealID
Activation abi.ChainEpoch
Expiration abi.ChainEpoch
DealWeight abi.DealWeight
VerifiedDealWeight abi.DealWeight
InitialPledge abi.TokenAmount
ExpectedDayReward abi.TokenAmount
ExpectedStoragePledge abi.TokenAmount
}
type SectorPreCommitInfo = miner0.SectorPreCommitInfo
type SectorPreCommitOnChainInfo struct {
Info SectorPreCommitInfo
PreCommitDeposit abi.TokenAmount
PreCommitEpoch abi.ChainEpoch
DealWeight abi.DealWeight
VerifiedDealWeight abi.DealWeight
}
type PoStPartition = miner0.PoStPartition
type RecoveryDeclaration = miner0.RecoveryDeclaration
type FaultDeclaration = miner0.FaultDeclaration
// Params
type DeclareFaultsParams = miner0.DeclareFaultsParams
type DeclareFaultsRecoveredParams = miner0.DeclareFaultsRecoveredParams
type SubmitWindowedPoStParams = miner0.SubmitWindowedPoStParams
type ProveCommitSectorParams = miner0.ProveCommitSectorParams
type MinerInfo struct {
Owner address.Address // Must be an ID-address.
Worker address.Address // Must be an ID-address.
NewWorker address.Address // Must be an ID-address.
ControlAddresses []address.Address // Must be an ID-addresses.
WorkerChangeEpoch abi.ChainEpoch
PeerId *peer.ID
Multiaddrs []abi.Multiaddrs
SealProofType abi.RegisteredSealProof
SectorSize abi.SectorSize
WindowPoStPartitionSectors uint64
ConsensusFaultElapsed abi.ChainEpoch
}
func (mi MinerInfo) IsController(addr address.Address) bool {
if addr == mi.Owner || addr == mi.Worker {
return true
}
for _, ca := range mi.ControlAddresses {
if addr == ca {
return true
}
}
return false
}
type SectorExpiration struct {
OnTime abi.ChainEpoch
// non-zero if sector is faulty, epoch at which it will be permanently
// removed if it doesn't recover
Early abi.ChainEpoch
}
type SectorLocation struct {
Deadline uint64
Partition uint64
}
type SectorChanges struct {
Added []SectorOnChainInfo
Extended []SectorExtensions
Removed []SectorOnChainInfo
}
type SectorExtensions struct {
From SectorOnChainInfo
To SectorOnChainInfo
}
type PreCommitChanges struct {
Added []SectorPreCommitOnChainInfo
Removed []SectorPreCommitOnChainInfo
}
type LockedFunds struct {
VestingFunds abi.TokenAmount
InitialPledgeRequirement abi.TokenAmount
PreCommitDeposits abi.TokenAmount
}
func (lf LockedFunds) TotalLockedFunds() abi.TokenAmount {
return big.Add(lf.VestingFunds, big.Add(lf.InitialPledgeRequirement, lf.PreCommitDeposits))
}
+28
View File
@@ -0,0 +1,28 @@
package miner
import (
"golang.org/x/xerrors"
"github.com/filecoin-project/go-bitfield"
)
func AllPartSectors(mas State, sget func(Partition) (bitfield.BitField, error)) (bitfield.BitField, error) {
var parts []bitfield.BitField
err := mas.ForEachDeadline(func(dlidx uint64, dl Deadline) error {
return dl.ForEachPartition(func(partidx uint64, part Partition) error {
s, err := sget(part)
if err != nil {
return xerrors.Errorf("getting sector list (dl: %d, part %d): %w", dlidx, partidx, err)
}
parts = append(parts, s)
return nil
})
})
if err != nil {
return bitfield.BitField{}, err
}
return bitfield.MultiMerge(parts...)
}
+407
View File
@@ -0,0 +1,407 @@
package miner
import (
"bytes"
"errors"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/dline"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/peer"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/lotus/chain/actors/adt"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
)
var _ State = (*state0)(nil)
func load0(store adt.Store, root cid.Cid) (State, error) {
out := state0{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
type state0 struct {
miner0.State
store adt.Store
}
type deadline0 struct {
miner0.Deadline
store adt.Store
}
type partition0 struct {
miner0.Partition
store adt.Store
}
func (s *state0) AvailableBalance(bal abi.TokenAmount) (available abi.TokenAmount, err error) {
defer func() {
if r := recover(); r != nil {
err = xerrors.Errorf("failed to get available balance: %w", r)
available = abi.NewTokenAmount(0)
}
}()
// this panics if the miner doesnt have enough funds to cover their locked pledge
available = s.GetAvailableBalance(bal)
return available, err
}
func (s *state0) VestedFunds(epoch abi.ChainEpoch) (abi.TokenAmount, error) {
return s.CheckVestedFunds(s.store, epoch)
}
func (s *state0) LockedFunds() (LockedFunds, error) {
return LockedFunds{
VestingFunds: s.State.LockedFunds,
InitialPledgeRequirement: s.State.InitialPledgeRequirement,
PreCommitDeposits: s.State.PreCommitDeposits,
}, nil
}
func (s *state0) FeeDebt() (abi.TokenAmount, error) {
return big.Zero(), nil
}
func (s *state0) InitialPledge() (abi.TokenAmount, error) {
return s.State.InitialPledgeRequirement, nil
}
func (s *state0) PreCommitDeposits() (abi.TokenAmount, error) {
return s.State.PreCommitDeposits, nil
}
func (s *state0) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) {
info, ok, err := s.State.GetSector(s.store, num)
if !ok || err != nil {
return nil, err
}
ret := fromV0SectorOnChainInfo(*info)
return &ret, nil
}
func (s *state0) FindSector(num abi.SectorNumber) (*SectorLocation, error) {
dlIdx, partIdx, err := s.State.FindSector(s.store, num)
if err != nil {
return nil, err
}
return &SectorLocation{
Deadline: dlIdx,
Partition: partIdx,
}, nil
}
func (s *state0) NumLiveSectors() (uint64, error) {
dls, err := s.State.LoadDeadlines(s.store)
if err != nil {
return 0, err
}
var total uint64
if err := dls.ForEach(s.store, func(dlIdx uint64, dl *miner0.Deadline) error {
total += dl.LiveSectors
return nil
}); err != nil {
return 0, err
}
return total, nil
}
// GetSectorExpiration returns the effective expiration of the given sector.
//
// If the sector does not expire early, the Early expiration field is 0.
func (s *state0) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, error) {
dls, err := s.State.LoadDeadlines(s.store)
if err != nil {
return nil, err
}
// NOTE: this can be optimized significantly.
// 1. If the sector is non-faulty, it will either expire on-time (can be
// learned from the sector info), or in the next quantized expiration
// epoch (i.e., the first element in the partition's expiration queue.
// 2. If it's faulty, it will expire early within the first 14 entries
// of the expiration queue.
stopErr := errors.New("stop")
out := SectorExpiration{}
err = dls.ForEach(s.store, func(dlIdx uint64, dl *miner0.Deadline) error {
partitions, err := dl.PartitionsArray(s.store)
if err != nil {
return err
}
quant := s.State.QuantSpecForDeadline(dlIdx)
var part miner0.Partition
return partitions.ForEach(&part, func(partIdx int64) error {
if found, err := part.Sectors.IsSet(uint64(num)); err != nil {
return err
} else if !found {
return nil
}
if found, err := part.Terminated.IsSet(uint64(num)); err != nil {
return err
} else if found {
// already terminated
return stopErr
}
q, err := miner0.LoadExpirationQueue(s.store, part.ExpirationsEpochs, quant)
if err != nil {
return err
}
var exp miner0.ExpirationSet
return q.ForEach(&exp, func(epoch int64) error {
if early, err := exp.EarlySectors.IsSet(uint64(num)); err != nil {
return err
} else if early {
out.Early = abi.ChainEpoch(epoch)
return nil
}
if onTime, err := exp.OnTimeSectors.IsSet(uint64(num)); err != nil {
return err
} else if onTime {
out.OnTime = abi.ChainEpoch(epoch)
return stopErr
}
return nil
})
})
})
if err == stopErr {
err = nil
}
if err != nil {
return nil, err
}
if out.Early == 0 && out.OnTime == 0 {
return nil, xerrors.Errorf("failed to find sector %d", num)
}
return &out, nil
}
func (s *state0) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
if !ok || err != nil {
return nil, err
}
ret := fromV0SectorPreCommitOnChainInfo(*info)
return &ret, nil
}
func (s *state0) LoadSectors(snos *bitfield.BitField) ([]*SectorOnChainInfo, error) {
sectors, err := miner0.LoadSectors(s.store, s.State.Sectors)
if err != nil {
return nil, err
}
// If no sector numbers are specified, load all.
if snos == nil {
infos := make([]*SectorOnChainInfo, 0, sectors.Length())
var info0 miner0.SectorOnChainInfo
if err := sectors.ForEach(&info0, func(_ int64) error {
info := fromV0SectorOnChainInfo(info0)
infos = append(infos, &info)
return nil
}); err != nil {
return nil, err
}
return infos, nil
}
// Otherwise, load selected.
infos0, err := sectors.Load(*snos)
if err != nil {
return nil, err
}
infos := make([]*SectorOnChainInfo, len(infos0))
for i, info0 := range infos0 {
info := fromV0SectorOnChainInfo(*info0)
infos[i] = &info
}
return infos, nil
}
func (s *state0) IsAllocated(num abi.SectorNumber) (bool, error) {
var allocatedSectors bitfield.BitField
if err := s.store.Get(s.store.Context(), s.State.AllocatedSectors, &allocatedSectors); err != nil {
return false, err
}
return allocatedSectors.IsSet(uint64(num))
}
func (s *state0) LoadDeadline(idx uint64) (Deadline, error) {
dls, err := s.State.LoadDeadlines(s.store)
if err != nil {
return nil, err
}
dl, err := dls.LoadDeadline(s.store, idx)
if err != nil {
return nil, err
}
return &deadline0{*dl, s.store}, nil
}
func (s *state0) ForEachDeadline(cb func(uint64, Deadline) error) error {
dls, err := s.State.LoadDeadlines(s.store)
if err != nil {
return err
}
return dls.ForEach(s.store, func(i uint64, dl *miner0.Deadline) error {
return cb(i, &deadline0{*dl, s.store})
})
}
func (s *state0) NumDeadlines() (uint64, error) {
return miner0.WPoStPeriodDeadlines, nil
}
func (s *state0) DeadlinesChanged(other State) (bool, error) {
other0, ok := other.(*state0)
if !ok {
// treat an upgrade as a change, always
return true, nil
}
return !s.State.Deadlines.Equals(other0.Deadlines), nil
}
func (s *state0) MinerInfoChanged(other State) (bool, error) {
other0, ok := other.(*state0)
if !ok {
// treat an upgrade as a change, always
return true, nil
}
return !s.State.Info.Equals(other0.State.Info), nil
}
func (s *state0) Info() (MinerInfo, error) {
info, err := s.State.GetInfo(s.store)
if err != nil {
return MinerInfo{}, err
}
var pid *peer.ID
if peerID, err := peer.IDFromBytes(info.PeerId); err == nil {
pid = &peerID
}
mi := MinerInfo{
Owner: info.Owner,
Worker: info.Worker,
ControlAddresses: info.ControlAddresses,
NewWorker: address.Undef,
WorkerChangeEpoch: -1,
PeerId: pid,
Multiaddrs: info.Multiaddrs,
SealProofType: info.SealProofType,
SectorSize: info.SectorSize,
WindowPoStPartitionSectors: info.WindowPoStPartitionSectors,
ConsensusFaultElapsed: -1,
}
if info.PendingWorkerKey != nil {
mi.NewWorker = info.PendingWorkerKey.NewWorker
mi.WorkerChangeEpoch = info.PendingWorkerKey.EffectiveAt
}
return mi, nil
}
func (s *state0) DeadlineInfo(epoch abi.ChainEpoch) (*dline.Info, error) {
return s.State.DeadlineInfo(epoch), nil
}
func (s *state0) sectors() (adt.Array, error) {
return adt0.AsArray(s.store, s.Sectors)
}
func (s *state0) decodeSectorOnChainInfo(val *cbg.Deferred) (SectorOnChainInfo, error) {
var si miner0.SectorOnChainInfo
err := si.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return SectorOnChainInfo{}, err
}
return fromV0SectorOnChainInfo(si), nil
}
func (s *state0) precommits() (adt.Map, error) {
return adt0.AsMap(s.store, s.PreCommittedSectors)
}
func (s *state0) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
var sp miner0.SectorPreCommitOnChainInfo
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return SectorPreCommitOnChainInfo{}, err
}
return fromV0SectorPreCommitOnChainInfo(sp), nil
}
func (d *deadline0) LoadPartition(idx uint64) (Partition, error) {
p, err := d.Deadline.LoadPartition(d.store, idx)
if err != nil {
return nil, err
}
return &partition0{*p, d.store}, nil
}
func (d *deadline0) ForEachPartition(cb func(uint64, Partition) error) error {
ps, err := d.Deadline.PartitionsArray(d.store)
if err != nil {
return err
}
var part miner0.Partition
return ps.ForEach(&part, func(i int64) error {
return cb(uint64(i), &partition0{part, d.store})
})
}
func (d *deadline0) PartitionsChanged(other Deadline) (bool, error) {
other0, ok := other.(*deadline0)
if !ok {
// treat an upgrade as a change, always
return true, nil
}
return !d.Deadline.Partitions.Equals(other0.Deadline.Partitions), nil
}
func (d *deadline0) PostSubmissions() (bitfield.BitField, error) {
return d.Deadline.PostSubmissions, nil
}
func (p *partition0) AllSectors() (bitfield.BitField, error) {
return p.Partition.Sectors, nil
}
func (p *partition0) FaultySectors() (bitfield.BitField, error) {
return p.Partition.Faults, nil
}
func (p *partition0) RecoveringSectors() (bitfield.BitField, error) {
return p.Partition.Recoveries, nil
}
func fromV0SectorOnChainInfo(v0 miner0.SectorOnChainInfo) SectorOnChainInfo {
return (SectorOnChainInfo)(v0)
}
func fromV0SectorPreCommitOnChainInfo(v0 miner0.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
return (SectorPreCommitOnChainInfo)(v0)
}
+424
View File
@@ -0,0 +1,424 @@
package miner
import (
"bytes"
"errors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/dline"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/peer"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/lotus/chain/actors/adt"
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
)
var _ State = (*state2)(nil)
func load2(store adt.Store, root cid.Cid) (State, error) {
out := state2{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
type state2 struct {
miner2.State
store adt.Store
}
type deadline2 struct {
miner2.Deadline
store adt.Store
}
type partition2 struct {
miner2.Partition
store adt.Store
}
func (s *state2) AvailableBalance(bal abi.TokenAmount) (available abi.TokenAmount, err error) {
defer func() {
if r := recover(); r != nil {
err = xerrors.Errorf("failed to get available balance: %w", r)
available = abi.NewTokenAmount(0)
}
}()
// this panics if the miner doesnt have enough funds to cover their locked pledge
available, err = s.GetAvailableBalance(bal)
return available, err
}
func (s *state2) VestedFunds(epoch abi.ChainEpoch) (abi.TokenAmount, error) {
return s.CheckVestedFunds(s.store, epoch)
}
func (s *state2) LockedFunds() (LockedFunds, error) {
return LockedFunds{
VestingFunds: s.State.LockedFunds,
InitialPledgeRequirement: s.State.InitialPledge,
PreCommitDeposits: s.State.PreCommitDeposits,
}, nil
}
func (s *state2) FeeDebt() (abi.TokenAmount, error) {
return s.State.FeeDebt, nil
}
func (s *state2) InitialPledge() (abi.TokenAmount, error) {
return s.State.InitialPledge, nil
}
func (s *state2) PreCommitDeposits() (abi.TokenAmount, error) {
return s.State.PreCommitDeposits, nil
}
func (s *state2) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) {
info, ok, err := s.State.GetSector(s.store, num)
if !ok || err != nil {
return nil, err
}
ret := fromV2SectorOnChainInfo(*info)
return &ret, nil
}
func (s *state2) FindSector(num abi.SectorNumber) (*SectorLocation, error) {
dlIdx, partIdx, err := s.State.FindSector(s.store, num)
if err != nil {
return nil, err
}
return &SectorLocation{
Deadline: dlIdx,
Partition: partIdx,
}, nil
}
func (s *state2) NumLiveSectors() (uint64, error) {
dls, err := s.State.LoadDeadlines(s.store)
if err != nil {
return 0, err
}
var total uint64
if err := dls.ForEach(s.store, func(dlIdx uint64, dl *miner2.Deadline) error {
total += dl.LiveSectors
return nil
}); err != nil {
return 0, err
}
return total, nil
}
// GetSectorExpiration returns the effective expiration of the given sector.
//
// If the sector does not expire early, the Early expiration field is 0.
func (s *state2) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, error) {
dls, err := s.State.LoadDeadlines(s.store)
if err != nil {
return nil, err
}
// NOTE: this can be optimized significantly.
// 1. If the sector is non-faulty, it will either expire on-time (can be
// learned from the sector info), or in the next quantized expiration
// epoch (i.e., the first element in the partition's expiration queue.
// 2. If it's faulty, it will expire early within the first 14 entries
// of the expiration queue.
stopErr := errors.New("stop")
out := SectorExpiration{}
err = dls.ForEach(s.store, func(dlIdx uint64, dl *miner2.Deadline) error {
partitions, err := dl.PartitionsArray(s.store)
if err != nil {
return err
}
quant := s.State.QuantSpecForDeadline(dlIdx)
var part miner2.Partition
return partitions.ForEach(&part, func(partIdx int64) error {
if found, err := part.Sectors.IsSet(uint64(num)); err != nil {
return err
} else if !found {
return nil
}
if found, err := part.Terminated.IsSet(uint64(num)); err != nil {
return err
} else if found {
// already terminated
return stopErr
}
q, err := miner2.LoadExpirationQueue(s.store, part.ExpirationsEpochs, quant)
if err != nil {
return err
}
var exp miner2.ExpirationSet
return q.ForEach(&exp, func(epoch int64) error {
if early, err := exp.EarlySectors.IsSet(uint64(num)); err != nil {
return err
} else if early {
out.Early = abi.ChainEpoch(epoch)
return nil
}
if onTime, err := exp.OnTimeSectors.IsSet(uint64(num)); err != nil {
return err
} else if onTime {
out.OnTime = abi.ChainEpoch(epoch)
return stopErr
}
return nil
})
})
})
if err == stopErr {
err = nil
}
if err != nil {
return nil, err
}
if out.Early == 0 && out.OnTime == 0 {
return nil, xerrors.Errorf("failed to find sector %d", num)
}
return &out, nil
}
func (s *state2) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
if !ok || err != nil {
return nil, err
}
ret := fromV2SectorPreCommitOnChainInfo(*info)
return &ret, nil
}
func (s *state2) LoadSectors(snos *bitfield.BitField) ([]*SectorOnChainInfo, error) {
sectors, err := miner2.LoadSectors(s.store, s.State.Sectors)
if err != nil {
return nil, err
}
// If no sector numbers are specified, load all.
if snos == nil {
infos := make([]*SectorOnChainInfo, 0, sectors.Length())
var info2 miner2.SectorOnChainInfo
if err := sectors.ForEach(&info2, func(_ int64) error {
info := fromV2SectorOnChainInfo(info2)
infos = append(infos, &info)
return nil
}); err != nil {
return nil, err
}
return infos, nil
}
// Otherwise, load selected.
infos2, err := sectors.Load(*snos)
if err != nil {
return nil, err
}
infos := make([]*SectorOnChainInfo, len(infos2))
for i, info2 := range infos2 {
info := fromV2SectorOnChainInfo(*info2)
infos[i] = &info
}
return infos, nil
}
func (s *state2) IsAllocated(num abi.SectorNumber) (bool, error) {
var allocatedSectors bitfield.BitField
if err := s.store.Get(s.store.Context(), s.State.AllocatedSectors, &allocatedSectors); err != nil {
return false, err
}
return allocatedSectors.IsSet(uint64(num))
}
func (s *state2) LoadDeadline(idx uint64) (Deadline, error) {
dls, err := s.State.LoadDeadlines(s.store)
if err != nil {
return nil, err
}
dl, err := dls.LoadDeadline(s.store, idx)
if err != nil {
return nil, err
}
return &deadline2{*dl, s.store}, nil
}
func (s *state2) ForEachDeadline(cb func(uint64, Deadline) error) error {
dls, err := s.State.LoadDeadlines(s.store)
if err != nil {
return err
}
return dls.ForEach(s.store, func(i uint64, dl *miner2.Deadline) error {
return cb(i, &deadline2{*dl, s.store})
})
}
func (s *state2) NumDeadlines() (uint64, error) {
return miner2.WPoStPeriodDeadlines, nil
}
func (s *state2) DeadlinesChanged(other State) (bool, error) {
other2, ok := other.(*state2)
if !ok {
// treat an upgrade as a change, always
return true, nil
}
return !s.State.Deadlines.Equals(other2.Deadlines), nil
}
func (s *state2) MinerInfoChanged(other State) (bool, error) {
other0, ok := other.(*state2)
if !ok {
// treat an upgrade as a change, always
return true, nil
}
return !s.State.Info.Equals(other0.State.Info), nil
}
func (s *state2) Info() (MinerInfo, error) {
info, err := s.State.GetInfo(s.store)
if err != nil {
return MinerInfo{}, err
}
var pid *peer.ID
if peerID, err := peer.IDFromBytes(info.PeerId); err == nil {
pid = &peerID
}
mi := MinerInfo{
Owner: info.Owner,
Worker: info.Worker,
ControlAddresses: info.ControlAddresses,
NewWorker: address.Undef,
WorkerChangeEpoch: -1,
PeerId: pid,
Multiaddrs: info.Multiaddrs,
SealProofType: info.SealProofType,
SectorSize: info.SectorSize,
WindowPoStPartitionSectors: info.WindowPoStPartitionSectors,
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
}
if info.PendingWorkerKey != nil {
mi.NewWorker = info.PendingWorkerKey.NewWorker
mi.WorkerChangeEpoch = info.PendingWorkerKey.EffectiveAt
}
return mi, nil
}
func (s *state2) DeadlineInfo(epoch abi.ChainEpoch) (*dline.Info, error) {
return s.State.DeadlineInfo(epoch), nil
}
func (s *state2) sectors() (adt.Array, error) {
return adt2.AsArray(s.store, s.Sectors)
}
func (s *state2) decodeSectorOnChainInfo(val *cbg.Deferred) (SectorOnChainInfo, error) {
var si miner2.SectorOnChainInfo
err := si.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return SectorOnChainInfo{}, err
}
return fromV2SectorOnChainInfo(si), nil
}
func (s *state2) precommits() (adt.Map, error) {
return adt2.AsMap(s.store, s.PreCommittedSectors)
}
func (s *state2) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
var sp miner2.SectorPreCommitOnChainInfo
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return SectorPreCommitOnChainInfo{}, err
}
return fromV2SectorPreCommitOnChainInfo(sp), nil
}
func (d *deadline2) LoadPartition(idx uint64) (Partition, error) {
p, err := d.Deadline.LoadPartition(d.store, idx)
if err != nil {
return nil, err
}
return &partition2{*p, d.store}, nil
}
func (d *deadline2) ForEachPartition(cb func(uint64, Partition) error) error {
ps, err := d.Deadline.PartitionsArray(d.store)
if err != nil {
return err
}
var part miner2.Partition
return ps.ForEach(&part, func(i int64) error {
return cb(uint64(i), &partition2{part, d.store})
})
}
func (d *deadline2) PartitionsChanged(other Deadline) (bool, error) {
other2, ok := other.(*deadline2)
if !ok {
// treat an upgrade as a change, always
return true, nil
}
return !d.Deadline.Partitions.Equals(other2.Deadline.Partitions), nil
}
func (d *deadline2) PostSubmissions() (bitfield.BitField, error) {
return d.Deadline.PostSubmissions, nil
}
func (p *partition2) AllSectors() (bitfield.BitField, error) {
return p.Partition.Sectors, nil
}
func (p *partition2) FaultySectors() (bitfield.BitField, error) {
return p.Partition.Faults, nil
}
func (p *partition2) RecoveringSectors() (bitfield.BitField, error) {
return p.Partition.Recoveries, nil
}
func fromV2SectorOnChainInfo(v2 miner2.SectorOnChainInfo) SectorOnChainInfo {
return SectorOnChainInfo{
SectorNumber: v2.SectorNumber,
SealProof: v2.SealProof,
SealedCID: v2.SealedCID,
DealIDs: v2.DealIDs,
Activation: v2.Activation,
Expiration: v2.Expiration,
DealWeight: v2.DealWeight,
VerifiedDealWeight: v2.VerifiedDealWeight,
InitialPledge: v2.InitialPledge,
ExpectedDayReward: v2.ExpectedDayReward,
ExpectedStoragePledge: v2.ExpectedStoragePledge,
}
}
func fromV2SectorPreCommitOnChainInfo(v2 miner2.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
return SectorPreCommitOnChainInfo{
Info: (SectorPreCommitInfo)(v2.Info),
PreCommitDeposit: v2.PreCommitDeposit,
PreCommitEpoch: v2.PreCommitEpoch,
DealWeight: v2.DealWeight,
VerifiedDealWeight: v2.VerifiedDealWeight,
}
}
+134
View File
@@ -0,0 +1,134 @@
package multisig
import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
cbg "github.com/whyrusleeping/cbor-gen"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
type PendingTransactionChanges struct {
Added []TransactionChange
Modified []TransactionModification
Removed []TransactionChange
}
type TransactionChange struct {
TxID int64
Tx Transaction
}
type TransactionModification struct {
TxID int64
From Transaction
To Transaction
}
func DiffPendingTransactions(pre, cur State) (*PendingTransactionChanges, error) {
results := new(PendingTransactionChanges)
if changed, err := pre.PendingTxnChanged(cur); err != nil {
return nil, err
} else if !changed { // if nothing has changed then return an empty result and bail.
return results, nil
}
pret, err := pre.transactions()
if err != nil {
return nil, err
}
curt, err := cur.transactions()
if err != nil {
return nil, err
}
if err := adt.DiffAdtMap(pret, curt, &transactionDiffer{results, pre, cur}); err != nil {
return nil, err
}
return results, nil
}
type transactionDiffer struct {
Results *PendingTransactionChanges
pre, after State
}
func (t *transactionDiffer) AsKey(key string) (abi.Keyer, error) {
txID, err := abi.ParseIntKey(key)
if err != nil {
return nil, err
}
return abi.IntKey(txID), nil
}
func (t *transactionDiffer) Add(key string, val *cbg.Deferred) error {
txID, err := abi.ParseIntKey(key)
if err != nil {
return err
}
tx, err := t.after.decodeTransaction(val)
if err != nil {
return err
}
t.Results.Added = append(t.Results.Added, TransactionChange{
TxID: txID,
Tx: tx,
})
return nil
}
func (t *transactionDiffer) Modify(key string, from, to *cbg.Deferred) error {
txID, err := abi.ParseIntKey(key)
if err != nil {
return err
}
txFrom, err := t.pre.decodeTransaction(from)
if err != nil {
return err
}
txTo, err := t.after.decodeTransaction(to)
if err != nil {
return err
}
if approvalsChanged(txFrom.Approved, txTo.Approved) {
t.Results.Modified = append(t.Results.Modified, TransactionModification{
TxID: txID,
From: txFrom,
To: txTo,
})
}
return nil
}
func approvalsChanged(from, to []address.Address) bool {
if len(from) != len(to) {
return true
}
for idx := range from {
if from[idx] != to[idx] {
return true
}
}
return false
}
func (t *transactionDiffer) Remove(key string, val *cbg.Deferred) error {
txID, err := abi.ParseIntKey(key)
if err != nil {
return err
}
tx, err := t.pre.decodeTransaction(val)
if err != nil {
return err
}
t.Results.Removed = append(t.Results.Removed, TransactionChange{
TxID: txID,
Tx: tx,
})
return nil
}
+74
View File
@@ -0,0 +1,74 @@
package multisig
import (
"fmt"
"github.com/minio/blake2b-simd"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
multisig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/types"
)
var Methods = builtin2.MethodsMultisig
func Message(version actors.Version, from address.Address) MessageBuilder {
switch version {
case actors.Version0:
return message0{from}
case actors.Version2:
return message2{message0{from}}
default:
panic(fmt.Sprintf("unsupported actors version: %d", version))
}
}
type MessageBuilder interface {
// Create a new multisig with the specified parameters.
Create(signers []address.Address, threshold uint64,
vestingStart, vestingDuration abi.ChainEpoch,
initialAmount abi.TokenAmount) (*types.Message, error)
// Propose a transaction to the given multisig.
Propose(msig, target address.Address, amt abi.TokenAmount,
method abi.MethodNum, params []byte) (*types.Message, error)
// Approve a multisig transaction. The "hash" is optional.
Approve(msig address.Address, txID uint64, hash *ProposalHashData) (*types.Message, error)
// Cancel a multisig transaction. The "hash" is optional.
Cancel(msig address.Address, txID uint64, hash *ProposalHashData) (*types.Message, error)
}
// this type is the same between v0 and v2
type ProposalHashData = multisig2.ProposalHashData
type ProposeReturn = multisig2.ProposeReturn
func txnParams(id uint64, data *ProposalHashData) ([]byte, error) {
params := multisig2.TxnIDParams{ID: multisig2.TxnID(id)}
if data != nil {
if data.Requester.Protocol() != address.ID {
return nil, xerrors.Errorf("proposer address must be an ID address, was %s", data.Requester)
}
if data.Value.Sign() == -1 {
return nil, xerrors.Errorf("proposal value must be non-negative, was %s", data.Value)
}
if data.To == address.Undef {
return nil, xerrors.Errorf("proposed destination address must be set")
}
pser, err := data.Serialize()
if err != nil {
return nil, err
}
hash := blake2b.Sum256(pser)
params.ProposalHash = hash[:]
}
return actors.SerializeParams(&params)
}
+142
View File
@@ -0,0 +1,142 @@
package multisig
import (
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
init0 "github.com/filecoin-project/specs-actors/actors/builtin/init"
multisig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
"github.com/filecoin-project/lotus/chain/actors"
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
"github.com/filecoin-project/lotus/chain/types"
)
type message0 struct{ from address.Address }
func (m message0) Create(
signers []address.Address, threshold uint64,
unlockStart, unlockDuration abi.ChainEpoch,
initialAmount abi.TokenAmount,
) (*types.Message, error) {
lenAddrs := uint64(len(signers))
if lenAddrs < threshold {
return nil, xerrors.Errorf("cannot require signing of more addresses than provided for multisig")
}
if threshold == 0 {
threshold = lenAddrs
}
if m.from == address.Undef {
return nil, xerrors.Errorf("must provide source address")
}
if unlockStart != 0 {
return nil, xerrors.Errorf("actors v0 does not support a non-zero vesting start time")
}
// Set up constructor parameters for multisig
msigParams := &multisig0.ConstructorParams{
Signers: signers,
NumApprovalsThreshold: threshold,
UnlockDuration: unlockDuration,
}
enc, actErr := actors.SerializeParams(msigParams)
if actErr != nil {
return nil, actErr
}
// new actors are created by invoking 'exec' on the init actor with the constructor params
execParams := &init0.ExecParams{
CodeCID: builtin0.MultisigActorCodeID,
ConstructorParams: enc,
}
enc, actErr = actors.SerializeParams(execParams)
if actErr != nil {
return nil, actErr
}
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin0.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil
}
func (m message0) Propose(msig, to address.Address, amt abi.TokenAmount,
method abi.MethodNum, params []byte) (*types.Message, error) {
if msig == address.Undef {
return nil, xerrors.Errorf("must provide a multisig address for proposal")
}
if to == address.Undef {
return nil, xerrors.Errorf("must provide a target address for proposal")
}
if amt.Sign() == -1 {
return nil, xerrors.Errorf("must provide a non-negative amount for proposed send")
}
if m.from == address.Undef {
return nil, xerrors.Errorf("must provide source address")
}
enc, actErr := actors.SerializeParams(&multisig0.ProposeParams{
To: to,
Value: amt,
Method: method,
Params: params,
})
if actErr != nil {
return nil, xerrors.Errorf("failed to serialize parameters: %w", actErr)
}
return &types.Message{
To: msig,
From: m.from,
Value: abi.NewTokenAmount(0),
Method: builtin0.MethodsMultisig.Propose,
Params: enc,
}, nil
}
func (m message0) Approve(msig address.Address, txID uint64, hashData *ProposalHashData) (*types.Message, error) {
enc, err := txnParams(txID, hashData)
if err != nil {
return nil, err
}
return &types.Message{
To: msig,
From: m.from,
Value: types.NewInt(0),
Method: builtin0.MethodsMultisig.Approve,
Params: enc,
}, nil
}
func (m message0) Cancel(msig address.Address, txID uint64, hashData *ProposalHashData) (*types.Message, error) {
enc, err := txnParams(txID, hashData)
if err != nil {
return nil, err
}
return &types.Message{
To: msig,
From: m.from,
Value: types.NewInt(0),
Method: builtin0.MethodsMultisig.Cancel,
Params: enc,
}, nil
}
+71
View File
@@ -0,0 +1,71 @@
package multisig
import (
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init"
multisig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig"
"github.com/filecoin-project/lotus/chain/actors"
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
"github.com/filecoin-project/lotus/chain/types"
)
type message2 struct{ message0 }
func (m message2) Create(
signers []address.Address, threshold uint64,
unlockStart, unlockDuration abi.ChainEpoch,
initialAmount abi.TokenAmount,
) (*types.Message, error) {
lenAddrs := uint64(len(signers))
if lenAddrs < threshold {
return nil, xerrors.Errorf("cannot require signing of more addresses than provided for multisig")
}
if threshold == 0 {
threshold = lenAddrs
}
if m.from == address.Undef {
return nil, xerrors.Errorf("must provide source address")
}
// Set up constructor parameters for multisig
msigParams := &multisig2.ConstructorParams{
Signers: signers,
NumApprovalsThreshold: threshold,
UnlockDuration: unlockDuration,
StartEpoch: unlockStart,
}
enc, actErr := actors.SerializeParams(msigParams)
if actErr != nil {
return nil, actErr
}
// new actors are created by invoking 'exec' on the init actor with the constructor params
execParams := &init2.ExecParams{
CodeCID: builtin2.MultisigActorCodeID,
ConstructorParams: enc,
}
enc, actErr = actors.SerializeParams(execParams)
if actErr != nil {
return nil, actErr
}
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin2.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil
}
+57
View File
@@ -0,0 +1,57 @@
package multisig
import (
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/cbor"
"github.com/ipfs/go-cid"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/types"
)
func init() {
builtin.RegisterActorState(builtin0.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
builtin.RegisterActorState(builtin2.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
func Load(store adt.Store, act *types.Actor) (State, error) {
switch act.Code {
case builtin0.MultisigActorCodeID:
return load0(store, act.Head)
case builtin2.MultisigActorCodeID:
return load2(store, act.Head)
}
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
type State interface {
cbor.Marshaler
LockedBalance(epoch abi.ChainEpoch) (abi.TokenAmount, error)
StartEpoch() (abi.ChainEpoch, error)
UnlockDuration() (abi.ChainEpoch, error)
InitialBalance() (abi.TokenAmount, error)
Threshold() (uint64, error)
Signers() ([]address.Address, error)
ForEachPendingTxn(func(id int64, txn Transaction) error) error
PendingTxnChanged(State) (bool, error)
transactions() (adt.Map, error)
decodeTransaction(val *cbg.Deferred) (Transaction, error)
}
type Transaction = msig0.Transaction
+94
View File
@@ -0,0 +1,94 @@
package multisig
import (
"bytes"
"encoding/binary"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/lotus/chain/actors/adt"
msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
multisig0 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig"
)
var _ State = (*state0)(nil)
func load0(store adt.Store, root cid.Cid) (State, error) {
out := state0{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
type state0 struct {
msig0.State
store adt.Store
}
func (s *state0) LockedBalance(currEpoch abi.ChainEpoch) (abi.TokenAmount, error) {
return s.State.AmountLocked(currEpoch - s.State.StartEpoch), nil
}
func (s *state0) StartEpoch() (abi.ChainEpoch, error) {
return s.State.StartEpoch, nil
}
func (s *state0) UnlockDuration() (abi.ChainEpoch, error) {
return s.State.UnlockDuration, nil
}
func (s *state0) InitialBalance() (abi.TokenAmount, error) {
return s.State.InitialBalance, nil
}
func (s *state0) Threshold() (uint64, error) {
return s.State.NumApprovalsThreshold, nil
}
func (s *state0) Signers() ([]address.Address, error) {
return s.State.Signers, nil
}
func (s *state0) ForEachPendingTxn(cb func(id int64, txn Transaction) error) error {
arr, err := adt0.AsMap(s.store, s.State.PendingTxns)
if err != nil {
return err
}
var out msig0.Transaction
return arr.ForEach(&out, func(key string) error {
txid, n := binary.Varint([]byte(key))
if n <= 0 {
return xerrors.Errorf("invalid pending transaction key: %v", key)
}
return cb(txid, (Transaction)(out))
})
}
func (s *state0) PendingTxnChanged(other State) (bool, error) {
other0, ok := other.(*state0)
if !ok {
// treat an upgrade as a change, always
return true, nil
}
return !s.State.PendingTxns.Equals(other0.PendingTxns), nil
}
func (s *state0) transactions() (adt.Map, error) {
return adt0.AsMap(s.store, s.PendingTxns)
}
func (s *state0) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
var tx multisig0.Transaction
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
return Transaction{}, err
}
return tx, nil
}
+93
View File
@@ -0,0 +1,93 @@
package multisig
import (
"bytes"
"encoding/binary"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/lotus/chain/actors/adt"
msig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig"
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
)
var _ State = (*state2)(nil)
func load2(store adt.Store, root cid.Cid) (State, error) {
out := state2{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
type state2 struct {
msig2.State
store adt.Store
}
func (s *state2) LockedBalance(currEpoch abi.ChainEpoch) (abi.TokenAmount, error) {
return s.State.AmountLocked(currEpoch - s.State.StartEpoch), nil
}
func (s *state2) StartEpoch() (abi.ChainEpoch, error) {
return s.State.StartEpoch, nil
}
func (s *state2) UnlockDuration() (abi.ChainEpoch, error) {
return s.State.UnlockDuration, nil
}
func (s *state2) InitialBalance() (abi.TokenAmount, error) {
return s.State.InitialBalance, nil
}
func (s *state2) Threshold() (uint64, error) {
return s.State.NumApprovalsThreshold, nil
}
func (s *state2) Signers() ([]address.Address, error) {
return s.State.Signers, nil
}
func (s *state2) ForEachPendingTxn(cb func(id int64, txn Transaction) error) error {
arr, err := adt2.AsMap(s.store, s.State.PendingTxns)
if err != nil {
return err
}
var out msig2.Transaction
return arr.ForEach(&out, func(key string) error {
txid, n := binary.Varint([]byte(key))
if n <= 0 {
return xerrors.Errorf("invalid pending transaction key: %v", key)
}
return cb(txid, (Transaction)(out))
})
}
func (s *state2) PendingTxnChanged(other State) (bool, error) {
other2, ok := other.(*state2)
if !ok {
// treat an upgrade as a change, always
return true, nil
}
return !s.State.PendingTxns.Equals(other2.PendingTxns), nil
}
func (s *state2) transactions() (adt.Map, error) {
return adt2.AsMap(s.store, s.PendingTxns)
}
func (s *state2) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
var tx msig2.Transaction
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
return Transaction{}, err
}
return tx, nil
}
+32
View File
@@ -0,0 +1,32 @@
package paych
import (
"fmt"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/types"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
)
var Methods = builtin2.MethodsPaych
func Message(version actors.Version, from address.Address) MessageBuilder {
switch version {
case actors.Version0:
return message0{from}
case actors.Version2:
return message2{from}
default:
panic(fmt.Sprintf("unsupported actors version: %d", version))
}
}
type MessageBuilder interface {
Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error)
Update(paych address.Address, voucher *SignedVoucher, secret []byte) (*types.Message, error)
Settle(paych address.Address) (*types.Message, error)
Collect(paych address.Address) (*types.Message, error)
}
+74
View File
@@ -0,0 +1,74 @@
package paych
import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
init0 "github.com/filecoin-project/specs-actors/actors/builtin/init"
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
"github.com/filecoin-project/lotus/chain/actors"
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
"github.com/filecoin-project/lotus/chain/types"
)
type message0 struct{ from address.Address }
func (m message0) Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error) {
params, aerr := actors.SerializeParams(&paych0.ConstructorParams{From: m.from, To: to})
if aerr != nil {
return nil, aerr
}
enc, aerr := actors.SerializeParams(&init0.ExecParams{
CodeCID: builtin0.PaymentChannelActorCodeID,
ConstructorParams: params,
})
if aerr != nil {
return nil, aerr
}
return &types.Message{
To: init_.Address,
From: m.from,
Value: initialAmount,
Method: builtin0.MethodsInit.Exec,
Params: enc,
}, nil
}
func (m message0) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
params, aerr := actors.SerializeParams(&paych0.UpdateChannelStateParams{
Sv: *sv,
Secret: secret,
})
if aerr != nil {
return nil, aerr
}
return &types.Message{
To: paych,
From: m.from,
Value: abi.NewTokenAmount(0),
Method: builtin0.MethodsPaych.UpdateChannelState,
Params: params,
}, nil
}
func (m message0) Settle(paych address.Address) (*types.Message, error) {
return &types.Message{
To: paych,
From: m.from,
Value: abi.NewTokenAmount(0),
Method: builtin0.MethodsPaych.Settle,
}, nil
}
func (m message0) Collect(paych address.Address) (*types.Message, error) {
return &types.Message{
To: paych,
From: m.from,
Value: abi.NewTokenAmount(0),
Method: builtin0.MethodsPaych.Collect,
}, nil
}
+74
View File
@@ -0,0 +1,74 @@
package paych
import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init"
paych2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/paych"
"github.com/filecoin-project/lotus/chain/actors"
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
"github.com/filecoin-project/lotus/chain/types"
)
type message2 struct{ from address.Address }
func (m message2) Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error) {
params, aerr := actors.SerializeParams(&paych2.ConstructorParams{From: m.from, To: to})
if aerr != nil {
return nil, aerr
}
enc, aerr := actors.SerializeParams(&init2.ExecParams{
CodeCID: builtin2.PaymentChannelActorCodeID,
ConstructorParams: params,
})
if aerr != nil {
return nil, aerr
}
return &types.Message{
To: init_.Address,
From: m.from,
Value: initialAmount,
Method: builtin2.MethodsInit.Exec,
Params: enc,
}, nil
}
func (m message2) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
params, aerr := actors.SerializeParams(&paych2.UpdateChannelStateParams{
Sv: *sv,
Secret: secret,
})
if aerr != nil {
return nil, aerr
}
return &types.Message{
To: paych,
From: m.from,
Value: abi.NewTokenAmount(0),
Method: builtin2.MethodsPaych.UpdateChannelState,
Params: params,
}, nil
}
func (m message2) Settle(paych address.Address) (*types.Message, error) {
return &types.Message{
To: paych,
From: m.from,
Value: abi.NewTokenAmount(0),
Method: builtin2.MethodsPaych.Settle,
}, nil
}
func (m message2) Collect(paych address.Address) (*types.Message, error) {
return &types.Message{
To: paych,
From: m.from,
Value: abi.NewTokenAmount(0),
Method: builtin2.MethodsPaych.Collect,
}, nil
}
+88
View File
@@ -0,0 +1,88 @@
package mock
import (
"io"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/lotus/chain/actors/builtin/paych"
)
type mockState struct {
from address.Address
to address.Address
settlingAt abi.ChainEpoch
toSend abi.TokenAmount
lanes map[uint64]paych.LaneState
}
type mockLaneState struct {
redeemed big.Int
nonce uint64
}
// NewMockPayChState constructs a state for a payment channel with the set fixed values
// that satisfies the paych.State interface.
func NewMockPayChState(from address.Address,
to address.Address,
settlingAt abi.ChainEpoch,
lanes map[uint64]paych.LaneState,
) paych.State {
return &mockState{from: from, to: to, settlingAt: settlingAt, toSend: big.NewInt(0), lanes: lanes}
}
// NewMockLaneState constructs a state for a payment channel lane with the set fixed values
// that satisfies the paych.LaneState interface. Useful for populating lanes when
// calling NewMockPayChState
func NewMockLaneState(redeemed big.Int, nonce uint64) paych.LaneState {
return &mockLaneState{redeemed, nonce}
}
func (ms *mockState) MarshalCBOR(io.Writer) error {
panic("not implemented")
}
// Channel owner, who has funded the actor
func (ms *mockState) From() (address.Address, error) {
return ms.from, nil
}
// Recipient of payouts from channel
func (ms *mockState) To() (address.Address, error) {
return ms.to, nil
}
// Height at which the channel can be `Collected`
func (ms *mockState) SettlingAt() (abi.ChainEpoch, error) {
return ms.settlingAt, nil
}
// Amount successfully redeemed through the payment channel, paid out on `Collect()`
func (ms *mockState) ToSend() (abi.TokenAmount, error) {
return ms.toSend, nil
}
// Get total number of lanes
func (ms *mockState) LaneCount() (uint64, error) {
return uint64(len(ms.lanes)), nil
}
// Iterate lane states
func (ms *mockState) ForEachLaneState(cb func(idx uint64, dl paych.LaneState) error) error {
var lastErr error
for lane, state := range ms.lanes {
if err := cb(lane, state); err != nil {
lastErr = err
}
}
return lastErr
}
func (mls *mockLaneState) Redeemed() (big.Int, error) {
return mls.redeemed, nil
}
func (mls *mockLaneState) Nonce() (uint64, error) {
return mls.nonce, nil
}
+88
View File
@@ -0,0 +1,88 @@
package paych
import (
"encoding/base64"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
big "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/cbor"
"github.com/ipfs/go-cid"
ipldcbor "github.com/ipfs/go-ipld-cbor"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/types"
)
func init() {
builtin.RegisterActorState(builtin0.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
builtin.RegisterActorState(builtin2.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
// Load returns an abstract copy of payment channel state, irregardless of actor version
func Load(store adt.Store, act *types.Actor) (State, error) {
switch act.Code {
case builtin0.PaymentChannelActorCodeID:
return load0(store, act.Head)
case builtin2.PaymentChannelActorCodeID:
return load2(store, act.Head)
}
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
// State is an abstract version of payment channel state that works across
// versions
type State interface {
cbor.Marshaler
// Channel owner, who has funded the actor
From() (address.Address, error)
// Recipient of payouts from channel
To() (address.Address, error)
// Height at which the channel can be `Collected`
SettlingAt() (abi.ChainEpoch, error)
// Amount successfully redeemed through the payment channel, paid out on `Collect()`
ToSend() (abi.TokenAmount, error)
// Get total number of lanes
LaneCount() (uint64, error)
// Iterate lane states
ForEachLaneState(cb func(idx uint64, dl LaneState) error) error
}
// LaneState is an abstract copy of the state of a single lane
type LaneState interface {
Redeemed() (big.Int, error)
Nonce() (uint64, error)
}
type SignedVoucher = paych0.SignedVoucher
type ModVerifyParams = paych0.ModVerifyParams
// DecodeSignedVoucher decodes base64 encoded signed voucher.
func DecodeSignedVoucher(s string) (*SignedVoucher, error) {
data, err := base64.RawURLEncoding.DecodeString(s)
if err != nil {
return nil, err
}
var sv SignedVoucher
if err := ipldcbor.DecodeInto(data, &sv); err != nil {
return nil, err
}
return &sv, nil
}
+104
View File
@@ -0,0 +1,104 @@
package paych
import (
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/lotus/chain/actors/adt"
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
)
var _ State = (*state0)(nil)
func load0(store adt.Store, root cid.Cid) (State, error) {
out := state0{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
type state0 struct {
paych0.State
store adt.Store
lsAmt *adt0.Array
}
// Channel owner, who has funded the actor
func (s *state0) From() (address.Address, error) {
return s.State.From, nil
}
// Recipient of payouts from channel
func (s *state0) To() (address.Address, error) {
return s.State.To, nil
}
// Height at which the channel can be `Collected`
func (s *state0) SettlingAt() (abi.ChainEpoch, error) {
return s.State.SettlingAt, nil
}
// Amount successfully redeemed through the payment channel, paid out on `Collect()`
func (s *state0) ToSend() (abi.TokenAmount, error) {
return s.State.ToSend, nil
}
func (s *state0) getOrLoadLsAmt() (*adt0.Array, error) {
if s.lsAmt != nil {
return s.lsAmt, nil
}
// Get the lane state from the chain
lsamt, err := adt0.AsArray(s.store, s.State.LaneStates)
if err != nil {
return nil, err
}
s.lsAmt = lsamt
return lsamt, nil
}
// Get total number of lanes
func (s *state0) LaneCount() (uint64, error) {
lsamt, err := s.getOrLoadLsAmt()
if err != nil {
return 0, err
}
return lsamt.Length(), nil
}
// Iterate lane states
func (s *state0) ForEachLaneState(cb func(idx uint64, dl LaneState) error) error {
// Get the lane state from the chain
lsamt, err := s.getOrLoadLsAmt()
if err != nil {
return err
}
// Note: we use a map instead of an array to store laneStates because the
// client sets the lane ID (the index) and potentially they could use a
// very large index.
var ls paych0.LaneState
return lsamt.ForEach(&ls, func(i int64) error {
return cb(uint64(i), &laneState0{ls})
})
}
type laneState0 struct {
paych0.LaneState
}
func (ls *laneState0) Redeemed() (big.Int, error) {
return ls.LaneState.Redeemed, nil
}
func (ls *laneState0) Nonce() (uint64, error) {
return ls.LaneState.Nonce, nil
}
+104
View File
@@ -0,0 +1,104 @@
package paych
import (
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/lotus/chain/actors/adt"
paych2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/paych"
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
)
var _ State = (*state2)(nil)
func load2(store adt.Store, root cid.Cid) (State, error) {
out := state2{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
type state2 struct {
paych2.State
store adt.Store
lsAmt *adt2.Array
}
// Channel owner, who has funded the actor
func (s *state2) From() (address.Address, error) {
return s.State.From, nil
}
// Recipient of payouts from channel
func (s *state2) To() (address.Address, error) {
return s.State.To, nil
}
// Height at which the channel can be `Collected`
func (s *state2) SettlingAt() (abi.ChainEpoch, error) {
return s.State.SettlingAt, nil
}
// Amount successfully redeemed through the payment channel, paid out on `Collect()`
func (s *state2) ToSend() (abi.TokenAmount, error) {
return s.State.ToSend, nil
}
func (s *state2) getOrLoadLsAmt() (*adt2.Array, error) {
if s.lsAmt != nil {
return s.lsAmt, nil
}
// Get the lane state from the chain
lsamt, err := adt2.AsArray(s.store, s.State.LaneStates)
if err != nil {
return nil, err
}
s.lsAmt = lsamt
return lsamt, nil
}
// Get total number of lanes
func (s *state2) LaneCount() (uint64, error) {
lsamt, err := s.getOrLoadLsAmt()
if err != nil {
return 0, err
}
return lsamt.Length(), nil
}
// Iterate lane states
func (s *state2) ForEachLaneState(cb func(idx uint64, dl LaneState) error) error {
// Get the lane state from the chain
lsamt, err := s.getOrLoadLsAmt()
if err != nil {
return err
}
// Note: we use a map instead of an array to store laneStates because the
// client sets the lane ID (the index) and potentially they could use a
// very large index.
var ls paych2.LaneState
return lsamt.ForEach(&ls, func(i int64) error {
return cb(uint64(i), &laneState2{ls})
})
}
type laneState2 struct {
paych2.LaneState
}
func (ls *laneState2) Redeemed() (big.Int, error) {
return ls.LaneState.Redeemed, nil
}
func (ls *laneState2) Nonce() (uint64, error) {
return ls.LaneState.Nonce, nil
}
+117
View File
@@ -0,0 +1,117 @@
package power
import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
cbg "github.com/whyrusleeping/cbor-gen"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
type ClaimChanges struct {
Added []ClaimInfo
Modified []ClaimModification
Removed []ClaimInfo
}
type ClaimModification struct {
Miner address.Address
From Claim
To Claim
}
type ClaimInfo struct {
Miner address.Address
Claim Claim
}
func DiffClaims(pre, cur State) (*ClaimChanges, error) {
results := new(ClaimChanges)
prec, err := pre.claims()
if err != nil {
return nil, err
}
curc, err := cur.claims()
if err != nil {
return nil, err
}
if err := adt.DiffAdtMap(prec, curc, &claimDiffer{results, pre, cur}); err != nil {
return nil, err
}
return results, nil
}
type claimDiffer struct {
Results *ClaimChanges
pre, after State
}
func (c *claimDiffer) AsKey(key string) (abi.Keyer, error) {
addr, err := address.NewFromBytes([]byte(key))
if err != nil {
return nil, err
}
return abi.AddrKey(addr), nil
}
func (c *claimDiffer) Add(key string, val *cbg.Deferred) error {
ci, err := c.after.decodeClaim(val)
if err != nil {
return err
}
addr, err := address.NewFromBytes([]byte(key))
if err != nil {
return err
}
c.Results.Added = append(c.Results.Added, ClaimInfo{
Miner: addr,
Claim: ci,
})
return nil
}
func (c *claimDiffer) Modify(key string, from, to *cbg.Deferred) error {
ciFrom, err := c.pre.decodeClaim(from)
if err != nil {
return err
}
ciTo, err := c.after.decodeClaim(to)
if err != nil {
return err
}
addr, err := address.NewFromBytes([]byte(key))
if err != nil {
return err
}
if ciFrom != ciTo {
c.Results.Modified = append(c.Results.Modified, ClaimModification{
Miner: addr,
From: ciFrom,
To: ciTo,
})
}
return nil
}
func (c *claimDiffer) Remove(key string, val *cbg.Deferred) error {
ci, err := c.after.decodeClaim(val)
if err != nil {
return err
}
addr, err := address.NewFromBytes([]byte(key))
if err != nil {
return err
}
c.Results.Removed = append(c.Results.Removed, ClaimInfo{
Miner: addr,
Claim: ci,
})
return nil
}
+80
View File
@@ -0,0 +1,80 @@
package power
import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/big"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/cbor"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/types"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
)
func init() {
builtin.RegisterActorState(builtin0.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
builtin.RegisterActorState(builtin2.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
var (
Address = builtin2.StoragePowerActorAddr
Methods = builtin2.MethodsPower
)
func Load(store adt.Store, act *types.Actor) (st State, err error) {
switch act.Code {
case builtin0.StoragePowerActorCodeID:
return load0(store, act.Head)
case builtin2.StoragePowerActorCodeID:
return load2(store, act.Head)
}
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
type State interface {
cbor.Marshaler
TotalLocked() (abi.TokenAmount, error)
TotalPower() (Claim, error)
TotalCommitted() (Claim, error)
TotalPowerSmoothed() (builtin.FilterEstimate, error)
// MinerCounts returns the number of miners. Participating is the number
// with power above the minimum miner threshold.
MinerCounts() (participating, total uint64, err error)
MinerPower(address.Address) (Claim, bool, error)
MinerNominalPowerMeetsConsensusMinimum(address.Address) (bool, error)
ListAllMiners() ([]address.Address, error)
ForEachClaim(func(miner address.Address, claim Claim) error) error
ClaimsChanged(State) (bool, error)
// Diff helpers. Used by Diff* functions internally.
claims() (adt.Map, error)
decodeClaim(*cbg.Deferred) (Claim, error)
}
type Claim struct {
// Sum of raw byte power for a miner's sectors.
RawBytePower abi.StoragePower
// Sum of quality adjusted power for a miner's sectors.
QualityAdjPower abi.StoragePower
}
func AddClaims(a Claim, b Claim) Claim {
return Claim{
RawBytePower: big.Add(a.RawBytePower, b.RawBytePower),
QualityAdjPower: big.Add(a.QualityAdjPower, b.QualityAdjPower),
}
}
+145
View File
@@ -0,0 +1,145 @@
package power
import (
"bytes"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
)
var _ State = (*state0)(nil)
func load0(store adt.Store, root cid.Cid) (State, error) {
out := state0{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
type state0 struct {
power0.State
store adt.Store
}
func (s *state0) TotalLocked() (abi.TokenAmount, error) {
return s.TotalPledgeCollateral, nil
}
func (s *state0) TotalPower() (Claim, error) {
return Claim{
RawBytePower: s.TotalRawBytePower,
QualityAdjPower: s.TotalQualityAdjPower,
}, nil
}
// Committed power to the network. Includes miners below the minimum threshold.
func (s *state0) TotalCommitted() (Claim, error) {
return Claim{
RawBytePower: s.TotalBytesCommitted,
QualityAdjPower: s.TotalQABytesCommitted,
}, nil
}
func (s *state0) MinerPower(addr address.Address) (Claim, bool, error) {
claims, err := adt0.AsMap(s.store, s.Claims)
if err != nil {
return Claim{}, false, err
}
var claim power0.Claim
ok, err := claims.Get(abi.AddrKey(addr), &claim)
if err != nil {
return Claim{}, false, err
}
return Claim{
RawBytePower: claim.RawBytePower,
QualityAdjPower: claim.QualityAdjPower,
}, ok, nil
}
func (s *state0) MinerNominalPowerMeetsConsensusMinimum(a address.Address) (bool, error) {
return s.State.MinerNominalPowerMeetsConsensusMinimum(s.store, a)
}
func (s *state0) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
return builtin.FromV0FilterEstimate(*s.State.ThisEpochQAPowerSmoothed), nil
}
func (s *state0) MinerCounts() (uint64, uint64, error) {
return uint64(s.State.MinerAboveMinPowerCount), uint64(s.State.MinerCount), nil
}
func (s *state0) ListAllMiners() ([]address.Address, error) {
claims, err := adt0.AsMap(s.store, s.Claims)
if err != nil {
return nil, err
}
var miners []address.Address
err = claims.ForEach(nil, func(k string) error {
a, err := address.NewFromBytes([]byte(k))
if err != nil {
return err
}
miners = append(miners, a)
return nil
})
if err != nil {
return nil, err
}
return miners, nil
}
func (s *state0) ForEachClaim(cb func(miner address.Address, claim Claim) error) error {
claims, err := adt0.AsMap(s.store, s.Claims)
if err != nil {
return err
}
var claim power0.Claim
return claims.ForEach(&claim, func(k string) error {
a, err := address.NewFromBytes([]byte(k))
if err != nil {
return err
}
return cb(a, Claim{
RawBytePower: claim.RawBytePower,
QualityAdjPower: claim.QualityAdjPower,
})
})
}
func (s *state0) ClaimsChanged(other State) (bool, error) {
other0, ok := other.(*state0)
if !ok {
// treat an upgrade as a change, always
return true, nil
}
return !s.State.Claims.Equals(other0.State.Claims), nil
}
func (s *state0) claims() (adt.Map, error) {
return adt0.AsMap(s.store, s.Claims)
}
func (s *state0) decodeClaim(val *cbg.Deferred) (Claim, error) {
var ci power0.Claim
if err := ci.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
return Claim{}, err
}
return fromV0Claim(ci), nil
}
func fromV0Claim(v0 power0.Claim) Claim {
return (Claim)(v0)
}
+148
View File
@@ -0,0 +1,148 @@
package power
import (
"bytes"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
power2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/power"
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
)
var _ State = (*state2)(nil)
func load2(store adt.Store, root cid.Cid) (State, error) {
out := state2{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
type state2 struct {
power2.State
store adt.Store
}
func (s *state2) TotalLocked() (abi.TokenAmount, error) {
return s.TotalPledgeCollateral, nil
}
func (s *state2) TotalPower() (Claim, error) {
return Claim{
RawBytePower: s.TotalRawBytePower,
QualityAdjPower: s.TotalQualityAdjPower,
}, nil
}
// Committed power to the network. Includes miners below the minimum threshold.
func (s *state2) TotalCommitted() (Claim, error) {
return Claim{
RawBytePower: s.TotalBytesCommitted,
QualityAdjPower: s.TotalQABytesCommitted,
}, nil
}
func (s *state2) MinerPower(addr address.Address) (Claim, bool, error) {
claims, err := adt2.AsMap(s.store, s.Claims)
if err != nil {
return Claim{}, false, err
}
var claim power2.Claim
ok, err := claims.Get(abi.AddrKey(addr), &claim)
if err != nil {
return Claim{}, false, err
}
return Claim{
RawBytePower: claim.RawBytePower,
QualityAdjPower: claim.QualityAdjPower,
}, ok, nil
}
func (s *state2) MinerNominalPowerMeetsConsensusMinimum(a address.Address) (bool, error) {
return s.State.MinerNominalPowerMeetsConsensusMinimum(s.store, a)
}
func (s *state2) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
return builtin.FromV2FilterEstimate(s.State.ThisEpochQAPowerSmoothed), nil
}
func (s *state2) MinerCounts() (uint64, uint64, error) {
return uint64(s.State.MinerAboveMinPowerCount), uint64(s.State.MinerCount), nil
}
func (s *state2) ListAllMiners() ([]address.Address, error) {
claims, err := adt2.AsMap(s.store, s.Claims)
if err != nil {
return nil, err
}
var miners []address.Address
err = claims.ForEach(nil, func(k string) error {
a, err := address.NewFromBytes([]byte(k))
if err != nil {
return err
}
miners = append(miners, a)
return nil
})
if err != nil {
return nil, err
}
return miners, nil
}
func (s *state2) ForEachClaim(cb func(miner address.Address, claim Claim) error) error {
claims, err := adt2.AsMap(s.store, s.Claims)
if err != nil {
return err
}
var claim power2.Claim
return claims.ForEach(&claim, func(k string) error {
a, err := address.NewFromBytes([]byte(k))
if err != nil {
return err
}
return cb(a, Claim{
RawBytePower: claim.RawBytePower,
QualityAdjPower: claim.QualityAdjPower,
})
})
}
func (s *state2) ClaimsChanged(other State) (bool, error) {
other2, ok := other.(*state2)
if !ok {
// treat an upgrade as a change, always
return true, nil
}
return !s.State.Claims.Equals(other2.State.Claims), nil
}
func (s *state2) claims() (adt.Map, error) {
return adt2.AsMap(s.store, s.Claims)
}
func (s *state2) decodeClaim(val *cbg.Deferred) (Claim, error) {
var ci power2.Claim
if err := ci.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
return Claim{}, err
}
return fromV2Claim(ci), nil
}
func fromV2Claim(v2 power2.Claim) Claim {
return Claim{
RawBytePower: v2.RawBytePower,
QualityAdjPower: v2.QualityAdjPower,
}
}
+61
View File
@@ -0,0 +1,61 @@
package reward
import (
"github.com/filecoin-project/go-state-types/abi"
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
"github.com/ipfs/go-cid"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-state-types/cbor"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/types"
)
func init() {
builtin.RegisterActorState(builtin0.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
builtin.RegisterActorState(builtin2.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
var (
Address = builtin2.RewardActorAddr
Methods = builtin2.MethodsReward
)
func Load(store adt.Store, act *types.Actor) (st State, err error) {
switch act.Code {
case builtin0.RewardActorCodeID:
return load0(store, act.Head)
case builtin2.RewardActorCodeID:
return load2(store, act.Head)
}
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
type State interface {
cbor.Marshaler
ThisEpochBaselinePower() (abi.StoragePower, error)
ThisEpochReward() (abi.StoragePower, error)
ThisEpochRewardSmoothed() (builtin.FilterEstimate, error)
EffectiveBaselinePower() (abi.StoragePower, error)
EffectiveNetworkTime() (abi.ChainEpoch, error)
TotalStoragePowerReward() (abi.TokenAmount, error)
CumsumBaseline() (abi.StoragePower, error)
CumsumRealized() (abi.StoragePower, error)
InitialPledgeForPower(abi.StoragePower, abi.TokenAmount, *builtin.FilterEstimate, abi.TokenAmount) (abi.TokenAmount, error)
PreCommitDepositForPower(builtin.FilterEstimate, abi.StoragePower) (abi.TokenAmount, error)
}
type AwardBlockRewardParams = reward0.AwardBlockRewardParams
+83
View File
@@ -0,0 +1,83 @@
package reward
import (
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
smoothing0 "github.com/filecoin-project/specs-actors/actors/util/smoothing"
)
var _ State = (*state0)(nil)
func load0(store adt.Store, root cid.Cid) (State, error) {
out := state0{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
type state0 struct {
reward0.State
store adt.Store
}
func (s *state0) ThisEpochReward() (abi.StoragePower, error) {
return s.State.ThisEpochReward, nil
}
func (s *state0) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
return builtin.FromV0FilterEstimate(*s.State.ThisEpochRewardSmoothed), nil
}
func (s *state0) ThisEpochBaselinePower() (abi.StoragePower, error) {
return s.State.ThisEpochBaselinePower, nil
}
func (s *state0) TotalStoragePowerReward() (abi.TokenAmount, error) {
return s.State.TotalMined, nil
}
func (s *state0) EffectiveBaselinePower() (abi.StoragePower, error) {
return s.State.EffectiveBaselinePower, nil
}
func (s *state0) EffectiveNetworkTime() (abi.ChainEpoch, error) {
return s.State.EffectiveNetworkTime, nil
}
func (s *state0) CumsumBaseline() (abi.StoragePower, error) {
return s.State.CumsumBaseline, nil
}
func (s *state0) CumsumRealized() (abi.StoragePower, error) {
return s.State.CumsumRealized, nil
}
func (s *state0) InitialPledgeForPower(sectorWeight abi.StoragePower, networkTotalPledge abi.TokenAmount, networkQAPower *builtin.FilterEstimate, circSupply abi.TokenAmount) (abi.TokenAmount, error) {
return miner0.InitialPledgeForPower(
sectorWeight,
s.State.ThisEpochBaselinePower,
networkTotalPledge,
s.State.ThisEpochRewardSmoothed,
&smoothing0.FilterEstimate{
PositionEstimate: networkQAPower.PositionEstimate,
VelocityEstimate: networkQAPower.VelocityEstimate,
},
circSupply), nil
}
func (s *state0) PreCommitDepositForPower(networkQAPower builtin.FilterEstimate, sectorWeight abi.StoragePower) (abi.TokenAmount, error) {
return miner0.PreCommitDepositForPower(s.State.ThisEpochRewardSmoothed,
&smoothing0.FilterEstimate{
PositionEstimate: networkQAPower.PositionEstimate,
VelocityEstimate: networkQAPower.VelocityEstimate,
},
sectorWeight), nil
}
+86
View File
@@ -0,0 +1,86 @@
package reward
import (
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
reward2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/reward"
smoothing2 "github.com/filecoin-project/specs-actors/v2/actors/util/smoothing"
)
var _ State = (*state2)(nil)
func load2(store adt.Store, root cid.Cid) (State, error) {
out := state2{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
type state2 struct {
reward2.State
store adt.Store
}
func (s *state2) ThisEpochReward() (abi.TokenAmount, error) {
return s.State.ThisEpochReward, nil
}
func (s *state2) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
return builtin.FilterEstimate{
PositionEstimate: s.State.ThisEpochRewardSmoothed.PositionEstimate,
VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate,
}, nil
}
func (s *state2) ThisEpochBaselinePower() (abi.StoragePower, error) {
return s.State.ThisEpochBaselinePower, nil
}
func (s *state2) TotalStoragePowerReward() (abi.TokenAmount, error) {
return s.State.TotalStoragePowerReward, nil
}
func (s *state2) EffectiveBaselinePower() (abi.StoragePower, error) {
return s.State.EffectiveBaselinePower, nil
}
func (s *state2) EffectiveNetworkTime() (abi.ChainEpoch, error) {
return s.State.EffectiveNetworkTime, nil
}
func (s *state2) CumsumBaseline() (reward2.Spacetime, error) {
return s.State.CumsumBaseline, nil
}
func (s *state2) CumsumRealized() (reward2.Spacetime, error) {
return s.State.CumsumRealized, nil
}
func (s *state2) InitialPledgeForPower(qaPower abi.StoragePower, networkTotalPledge abi.TokenAmount, networkQAPower *builtin.FilterEstimate, circSupply abi.TokenAmount) (abi.TokenAmount, error) {
return miner2.InitialPledgeForPower(
qaPower,
s.State.ThisEpochBaselinePower,
s.State.ThisEpochRewardSmoothed,
smoothing2.FilterEstimate{
PositionEstimate: networkQAPower.PositionEstimate,
VelocityEstimate: networkQAPower.VelocityEstimate,
},
circSupply,
), nil
}
func (s *state2) PreCommitDepositForPower(networkQAPower builtin.FilterEstimate, sectorWeight abi.StoragePower) (abi.TokenAmount, error) {
return miner2.PreCommitDepositForPower(s.State.ThisEpochRewardSmoothed,
smoothing2.FilterEstimate{
PositionEstimate: networkQAPower.PositionEstimate,
VelocityEstimate: networkQAPower.VelocityEstimate,
},
sectorWeight), nil
}
+46
View File
@@ -0,0 +1,46 @@
package verifreg
import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/ipfs/go-cid"
"golang.org/x/xerrors"
)
func getDataCap(store adt.Store, ver actors.Version, root cid.Cid, addr address.Address) (bool, abi.StoragePower, error) {
if addr.Protocol() != address.ID {
return false, big.Zero(), xerrors.Errorf("can only look up ID addresses")
}
vh, err := adt.AsMap(store, root, ver)
if err != nil {
return false, big.Zero(), xerrors.Errorf("loading verifreg: %w", err)
}
var dcap abi.StoragePower
if found, err := vh.Get(abi.AddrKey(addr), &dcap); err != nil {
return false, big.Zero(), xerrors.Errorf("looking up addr: %w", err)
} else if !found {
return false, big.Zero(), nil
}
return true, dcap, nil
}
func forEachCap(store adt.Store, ver actors.Version, root cid.Cid, cb func(addr address.Address, dcap abi.StoragePower) error) error {
vh, err := adt.AsMap(store, root, ver)
if err != nil {
return xerrors.Errorf("loading verified clients: %w", err)
}
var dcap abi.StoragePower
return vh.ForEach(&dcap, func(key string) error {
a, err := address.NewFromBytes([]byte(key))
if err != nil {
return err
}
return cb(a, dcap)
})
}
+48
View File
@@ -0,0 +1,48 @@
package verifreg
import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
)
var _ State = (*state0)(nil)
func load0(store adt.Store, root cid.Cid) (State, error) {
out := state0{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
type state0 struct {
verifreg0.State
store adt.Store
}
func (s *state0) RootKey() (address.Address, error) {
return s.State.RootKey, nil
}
func (s *state0) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
return getDataCap(s.store, actors.Version0, s.State.VerifiedClients, addr)
}
func (s *state0) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
return getDataCap(s.store, actors.Version0, s.State.Verifiers, addr)
}
func (s *state0) ForEachVerifier(cb func(addr address.Address, dcap abi.StoragePower) error) error {
return forEachCap(s.store, actors.Version0, s.State.Verifiers, cb)
}
func (s *state0) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
return forEachCap(s.store, actors.Version0, s.State.VerifiedClients, cb)
}
+48
View File
@@ -0,0 +1,48 @@
package verifreg
import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
verifreg2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/verifreg"
)
var _ State = (*state2)(nil)
func load2(store adt.Store, root cid.Cid) (State, error) {
out := state2{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
type state2 struct {
verifreg2.State
store adt.Store
}
func (s *state2) RootKey() (address.Address, error) {
return s.State.RootKey, nil
}
func (s *state2) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
return getDataCap(s.store, actors.Version2, s.State.VerifiedClients, addr)
}
func (s *state2) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
return getDataCap(s.store, actors.Version2, s.State.Verifiers, addr)
}
func (s *state2) ForEachVerifier(cb func(addr address.Address, dcap abi.StoragePower) error) error {
return forEachCap(s.store, actors.Version2, s.State.Verifiers, cb)
}
func (s *state2) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
return forEachCap(s.store, actors.Version2, s.State.VerifiedClients, cb)
}
+50
View File
@@ -0,0 +1,50 @@
package verifreg
import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-state-types/cbor"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/types"
)
func init() {
builtin.RegisterActorState(builtin0.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load0(store, root)
})
builtin.RegisterActorState(builtin2.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load2(store, root)
})
}
var (
Address = builtin2.VerifiedRegistryActorAddr
Methods = builtin2.MethodsVerifiedRegistry
)
func Load(store adt.Store, act *types.Actor) (State, error) {
switch act.Code {
case builtin0.VerifiedRegistryActorCodeID:
return load0(store, act.Head)
case builtin2.VerifiedRegistryActorCodeID:
return load2(store, act.Head)
}
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
type State interface {
cbor.Marshaler
RootKey() (address.Address, error)
VerifiedClientDataCap(address.Address) (bool, abi.StoragePower, error)
VerifierDataCap(address.Address) (bool, abi.StoragePower, error)
ForEachVerifier(func(addr address.Address, dcap abi.StoragePower) error) error
ForEachClient(func(addr address.Address, dcap abi.StoragePower) error) error
}
+152
View File
@@ -0,0 +1,152 @@
package policy
import (
"sort"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/chain/actors"
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
paych2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/paych"
verifreg2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/verifreg"
)
const (
ChainFinality = miner0.ChainFinality
SealRandomnessLookback = ChainFinality
PaychSettleDelay = paych2.SettleDelay
)
// SetSupportedProofTypes sets supported proof types, across all actor versions.
// This should only be used for testing.
func SetSupportedProofTypes(types ...abi.RegisteredSealProof) {
newTypes := make(map[abi.RegisteredSealProof]struct{}, len(types))
for _, t := range types {
newTypes[t] = struct{}{}
}
// Set for all miner versions.
miner0.SupportedProofTypes = newTypes
miner2.SupportedProofTypes = newTypes
}
// AddSupportedProofTypes sets supported proof types, across all actor versions.
// This should only be used for testing.
func AddSupportedProofTypes(types ...abi.RegisteredSealProof) {
for _, t := range types {
// Set for all miner versions.
miner0.SupportedProofTypes[t] = struct{}{}
miner2.SupportedProofTypes[t] = struct{}{}
}
}
// SetPreCommitChallengeDelay sets the pre-commit challenge delay across all
// actors versions. Use for testing.
func SetPreCommitChallengeDelay(delay abi.ChainEpoch) {
// Set for all miner versions.
miner0.PreCommitChallengeDelay = delay
miner2.PreCommitChallengeDelay = delay
}
// TODO: this function shouldn't really exist. Instead, the API should expose the precommit delay.
func GetPreCommitChallengeDelay() abi.ChainEpoch {
return miner0.PreCommitChallengeDelay
}
// SetConsensusMinerMinPower sets the minimum power of an individual miner must
// meet for leader election, across all actor versions. This should only be used
// for testing.
func SetConsensusMinerMinPower(p abi.StoragePower) {
power0.ConsensusMinerMinPower = p
for _, policy := range builtin2.SealProofPolicies {
policy.ConsensusMinerMinPower = p
}
}
// SetMinVerifiedDealSize sets the minimum size of a verified deal. This should
// only be used for testing.
func SetMinVerifiedDealSize(size abi.StoragePower) {
verifreg0.MinVerifiedDealSize = size
verifreg2.MinVerifiedDealSize = size
}
func GetMaxProveCommitDuration(ver actors.Version, t abi.RegisteredSealProof) abi.ChainEpoch {
switch ver {
case actors.Version0:
return miner0.MaxSealDuration[t]
case actors.Version2:
return miner2.MaxProveCommitDuration[t]
default:
panic("unsupported actors version")
}
}
func DealProviderCollateralBounds(
size abi.PaddedPieceSize, verified bool,
rawBytePower, qaPower, baselinePower abi.StoragePower,
circulatingFil abi.TokenAmount, nwVer network.Version,
) (min, max abi.TokenAmount) {
switch actors.VersionForNetwork(nwVer) {
case actors.Version0:
return market0.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil, nwVer)
case actors.Version2:
return market2.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
default:
panic("unsupported network version")
}
}
// Sets the challenge window and scales the proving period to match (such that
// there are always 48 challenge windows in a proving period).
func SetWPoStChallengeWindow(period abi.ChainEpoch) {
miner0.WPoStChallengeWindow = period
miner0.WPoStProvingPeriod = period * abi.ChainEpoch(miner0.WPoStPeriodDeadlines)
miner2.WPoStChallengeWindow = period
miner2.WPoStProvingPeriod = period * abi.ChainEpoch(miner2.WPoStPeriodDeadlines)
}
func GetWinningPoStSectorSetLookback(nwVer network.Version) abi.ChainEpoch {
if nwVer <= network.Version3 {
return 10
}
return ChainFinality
}
func GetMaxSectorExpirationExtension() abi.ChainEpoch {
return miner0.MaxSectorExpirationExtension
}
// TODO: we'll probably need to abstract over this better in the future.
func GetMaxPoStPartitions(p abi.RegisteredPoStProof) (int, error) {
sectorsPerPart, err := builtin2.PoStProofWindowPoStPartitionSectors(p)
if err != nil {
return 0, err
}
return int(miner2.AddressedSectorsMax / sectorsPerPart), nil
}
func GetDefaultSectorSize() abi.SectorSize {
// supported proof types are the same across versions.
szs := make([]abi.SectorSize, 0, len(miner2.SupportedProofTypes))
for spt := range miner2.SupportedProofTypes {
ss, err := spt.SectorSize()
if err != nil {
panic(err)
}
szs = append(szs, ss)
}
sort.Slice(szs, func(i, j int) bool {
return szs[i] < szs[j]
})
return szs[0]
}
+70
View File
@@ -0,0 +1,70 @@
package policy
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/filecoin-project/go-state-types/abi"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
paych2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/paych"
verifreg2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/verifreg"
)
func TestSupportedProofTypes(t *testing.T) {
var oldTypes []abi.RegisteredSealProof
for t := range miner0.SupportedProofTypes {
oldTypes = append(oldTypes, t)
}
t.Cleanup(func() {
SetSupportedProofTypes(oldTypes...)
})
SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1)
require.EqualValues(t,
miner0.SupportedProofTypes,
map[abi.RegisteredSealProof]struct{}{
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
},
)
AddSupportedProofTypes(abi.RegisteredSealProof_StackedDrg8MiBV1)
require.EqualValues(t,
miner0.SupportedProofTypes,
map[abi.RegisteredSealProof]struct{}{
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
abi.RegisteredSealProof_StackedDrg8MiBV1: {},
},
)
}
// Tests assumptions about policies being the same between actor versions.
func TestAssumptions(t *testing.T) {
require.EqualValues(t, miner0.SupportedProofTypes, miner2.SupportedProofTypes)
require.Equal(t, miner0.PreCommitChallengeDelay, miner2.PreCommitChallengeDelay)
require.Equal(t, miner0.MaxSectorExpirationExtension, miner2.MaxSectorExpirationExtension)
require.Equal(t, miner0.ChainFinality, miner2.ChainFinality)
require.Equal(t, miner0.WPoStChallengeWindow, miner2.WPoStChallengeWindow)
require.Equal(t, miner0.WPoStProvingPeriod, miner2.WPoStProvingPeriod)
require.Equal(t, miner0.WPoStPeriodDeadlines, miner2.WPoStPeriodDeadlines)
require.Equal(t, miner0.AddressedSectorsMax, miner2.AddressedSectorsMax)
require.Equal(t, paych0.SettleDelay, paych2.SettleDelay)
require.True(t, verifreg0.MinVerifiedDealSize.Equals(verifreg2.MinVerifiedDealSize))
}
func TestPartitionSizes(t *testing.T) {
for p := range abi.PoStSealProofTypes {
sizeNew, err := builtin2.PoStProofWindowPoStPartitionSectors(p)
require.NoError(t, err)
sizeOld, err := builtin0.PoStProofWindowPoStPartitionSectors(p)
if err != nil {
// new proof type.
continue
}
require.Equal(t, sizeOld, sizeNew)
}
}
+26
View File
@@ -0,0 +1,26 @@
package actors
import (
"fmt"
"github.com/filecoin-project/go-state-types/network"
)
type Version int
const (
Version0 Version = 0
Version2 Version = 2
)
// Converts a network version into an actors adt version.
func VersionForNetwork(version network.Version) Version {
switch version {
case network.Version0, network.Version1, network.Version2, network.Version3:
return Version0
case network.Version4, network.Version5, network.Version6:
return Version2
default:
panic(fmt.Sprintf("unsupported network version %d", version))
}
}
+4
View File
@@ -60,6 +60,10 @@ func (bts *BadBlockCache) Remove(c cid.Cid) {
bts.badBlocks.Remove(c)
}
func (bts *BadBlockCache) Purge() {
bts.badBlocks.Purge()
}
func (bts *BadBlockCache) Has(c cid.Cid) (BadBlockReason, bool) {
rval, ok := bts.badBlocks.Get(c)
if !ok {
+67 -6
View File
@@ -18,6 +18,23 @@ type Response struct {
Err error
}
type Schedule []BeaconPoint
func (bs Schedule) BeaconForEpoch(e abi.ChainEpoch) RandomBeacon {
for i := len(bs) - 1; i >= 0; i-- {
bp := bs[i]
if e >= bp.Start {
return bp.Beacon
}
}
return bs[0].Beacon
}
type BeaconPoint struct {
Start abi.ChainEpoch
Beacon RandomBeacon
}
// RandomBeacon represents a system that provides randomness to Lotus.
// Other components interrogate the RandomBeacon to acquire randomness that's
// valid for a specific chain epoch. Also to verify beacon entries that have
@@ -25,11 +42,30 @@ type Response struct {
type RandomBeacon interface {
Entry(context.Context, uint64) <-chan Response
VerifyEntry(types.BeaconEntry, types.BeaconEntry) error
MaxBeaconRoundForEpoch(abi.ChainEpoch, types.BeaconEntry) uint64
MaxBeaconRoundForEpoch(abi.ChainEpoch) uint64
}
func ValidateBlockValues(b RandomBeacon, h *types.BlockHeader, prevEntry types.BeaconEntry) error {
maxRound := b.MaxBeaconRoundForEpoch(h.Height, prevEntry)
func ValidateBlockValues(bSchedule Schedule, h *types.BlockHeader, parentEpoch abi.ChainEpoch,
prevEntry types.BeaconEntry) error {
{
parentBeacon := bSchedule.BeaconForEpoch(parentEpoch)
currBeacon := bSchedule.BeaconForEpoch(h.Height)
if parentBeacon != currBeacon {
if len(h.BeaconEntries) != 2 {
return xerrors.Errorf("expected two beacon entries at beacon fork, got %d", len(h.BeaconEntries))
}
err := currBeacon.VerifyEntry(h.BeaconEntries[1], h.BeaconEntries[0])
if err != nil {
return xerrors.Errorf("beacon at fork point invalid: (%v, %v): %w",
h.BeaconEntries[1], h.BeaconEntries[0], err)
}
return nil
}
}
// TODO: fork logic
b := bSchedule.BeaconForEpoch(h.Height)
maxRound := b.MaxBeaconRoundForEpoch(h.Height)
if maxRound == prevEntry.Round {
if len(h.BeaconEntries) != 0 {
return xerrors.Errorf("expected not to have any beacon entries in this block, got %d", len(h.BeaconEntries))
@@ -56,10 +92,35 @@ func ValidateBlockValues(b RandomBeacon, h *types.BlockHeader, prevEntry types.B
return nil
}
func BeaconEntriesForBlock(ctx context.Context, beacon RandomBeacon, round abi.ChainEpoch, prev types.BeaconEntry) ([]types.BeaconEntry, error) {
func BeaconEntriesForBlock(ctx context.Context, bSchedule Schedule, epoch abi.ChainEpoch, parentEpoch abi.ChainEpoch, prev types.BeaconEntry) ([]types.BeaconEntry, error) {
{
parentBeacon := bSchedule.BeaconForEpoch(parentEpoch)
currBeacon := bSchedule.BeaconForEpoch(epoch)
if parentBeacon != currBeacon {
// Fork logic
round := currBeacon.MaxBeaconRoundForEpoch(epoch)
out := make([]types.BeaconEntry, 2)
rch := currBeacon.Entry(ctx, round-1)
res := <-rch
if res.Err != nil {
return nil, xerrors.Errorf("getting entry %d returned error: %w", round-1, res.Err)
}
out[0] = res.Entry
rch = currBeacon.Entry(ctx, round)
res = <-rch
if res.Err != nil {
return nil, xerrors.Errorf("getting entry %d returned error: %w", round, res.Err)
}
out[1] = res.Entry
return out, nil
}
}
beacon := bSchedule.BeaconForEpoch(epoch)
start := build.Clock.Now()
maxRound := beacon.MaxBeaconRoundForEpoch(round, prev)
maxRound := beacon.MaxBeaconRoundForEpoch(epoch)
if maxRound == prev.Round {
return nil, nil
}
@@ -82,7 +143,7 @@ func BeaconEntriesForBlock(ctx context.Context, beacon RandomBeacon, round abi.C
out = append(out, resp.Entry)
cur = resp.Entry.Round - 1
case <-ctx.Done():
return nil, xerrors.Errorf("context timed out waiting on beacon entry to come back for round %d: %w", round, ctx.Err())
return nil, xerrors.Errorf("context timed out waiting on beacon entry to come back for epoch %d: %w", epoch, ctx.Err())
}
}
+7 -2
View File
@@ -65,6 +65,11 @@ type DrandBeacon struct {
localCache map[uint64]types.BeaconEntry
}
// DrandHTTPClient interface overrides the user agent used by drand
type DrandHTTPClient interface {
SetUserAgent(string)
}
func NewDrandBeacon(genesisTs, interval uint64, ps *pubsub.PubSub, config dtypes.DrandConfig) (*DrandBeacon, error) {
if genesisTs == 0 {
panic("what are you doing this cant be zero")
@@ -84,6 +89,7 @@ func NewDrandBeacon(genesisTs, interval uint64, ps *pubsub.PubSub, config dtypes
if err != nil {
return nil, xerrors.Errorf("could not create http drand client: %w", err)
}
hc.(DrandHTTPClient).SetUserAgent("drand-client-lotus/" + build.BuildVersion)
clients = append(clients, hc)
}
@@ -92,7 +98,6 @@ func NewDrandBeacon(genesisTs, interval uint64, ps *pubsub.PubSub, config dtypes
dclient.WithChainInfo(drandChain),
dclient.WithCacheSize(1024),
dclient.WithLogger(dlogger),
dclient.WithAutoWatch(),
}
if ps != nil {
@@ -187,7 +192,7 @@ func (db *DrandBeacon) VerifyEntry(curr types.BeaconEntry, prev types.BeaconEntr
return err
}
func (db *DrandBeacon) MaxBeaconRoundForEpoch(filEpoch abi.ChainEpoch, prevEntry types.BeaconEntry) uint64 {
func (db *DrandBeacon) MaxBeaconRoundForEpoch(filEpoch abi.ChainEpoch) uint64 {
// TODO: sometimes the genesis time for filecoin is zero and this goes negative
latestTs := ((uint64(filEpoch) * db.filRoundTime) + db.filGenTime) - db.filRoundTime
dround := (latestTs - db.drandGenTime) / uint64(db.interval.Seconds())
+1 -1
View File
@@ -12,7 +12,7 @@ import (
)
func TestPrintGroupInfo(t *testing.T) {
server := build.DrandConfig().Servers[0]
server := build.DrandConfigs[build.DrandDevnet].Servers[0]
c, err := hclient.New(server, nil, nil)
assert.NoError(t, err)
cg := c.(interface {
+1 -5
View File
@@ -53,11 +53,7 @@ func (mb *mockBeacon) VerifyEntry(from types.BeaconEntry, to types.BeaconEntry)
return nil
}
func (mb *mockBeacon) IsEntryForEpoch(e types.BeaconEntry, epoch abi.ChainEpoch, nulls int) (bool, error) {
return int64(e.Round) <= int64(epoch) && int64(epoch)-int64(nulls) >= int64(e.Round), nil
}
func (mb *mockBeacon) MaxBeaconRoundForEpoch(epoch abi.ChainEpoch, prevEntry types.BeaconEntry) uint64 {
func (mb *mockBeacon) MaxBeaconRoundForEpoch(epoch abi.ChainEpoch) uint64 {
return uint64(epoch)
}
+13 -22
View File
@@ -459,7 +459,7 @@ type messageEvents struct {
hcAPI headChangeAPI
lk sync.RWMutex
matchers map[triggerID][]MsgMatchFunc
matchers map[triggerID]MsgMatchFunc
}
func newMessageEvents(ctx context.Context, hcAPI headChangeAPI, cs eventAPI) messageEvents {
@@ -467,7 +467,7 @@ func newMessageEvents(ctx context.Context, hcAPI headChangeAPI, cs eventAPI) mes
ctx: ctx,
cs: cs,
hcAPI: hcAPI,
matchers: map[triggerID][]MsgMatchFunc{},
matchers: make(map[triggerID]MsgMatchFunc),
}
}
@@ -482,32 +482,23 @@ func (me *messageEvents) checkNewCalls(ts *types.TipSet) (map[triggerID]eventDat
me.lk.RLock()
defer me.lk.RUnlock()
// For each message in the tipset
res := make(map[triggerID]eventData)
me.messagesForTs(pts, func(msg *types.Message) {
// TODO: provide receipts
for tid, matchFns := range me.matchers {
var matched bool
var once bool
for _, matchFn := range matchFns {
matchOne, ok, err := matchFn(msg)
if err != nil {
log.Errorf("event matcher failed: %s", err)
continue
}
matched = ok
once = matchOne
if matched {
break
}
// Run each trigger's matcher against the message
for tid, matchFn := range me.matchers {
matched, err := matchFn(msg)
if err != nil {
log.Errorf("event matcher failed: %s", err)
continue
}
// If there was a match, include the message in the results for the
// trigger
if matched {
res[tid] = msg
if once {
break
}
}
}
})
@@ -555,7 +546,7 @@ func (me *messageEvents) messagesForTs(ts *types.TipSet, consume func(*types.Mes
// `curH`-`ts.Height` = `confidence`
type MsgHandler func(msg *types.Message, rec *types.MessageReceipt, ts *types.TipSet, curH abi.ChainEpoch) (more bool, err error)
type MsgMatchFunc func(msg *types.Message) (matchOnce bool, matched bool, err error)
type MsgMatchFunc func(msg *types.Message) (matched bool, err error)
// Called registers a callback which is triggered when a specified method is
// called on an actor, or a timeout is reached.
@@ -607,7 +598,7 @@ func (me *messageEvents) Called(check CheckFunc, msgHnd MsgHandler, rev RevertHa
me.lk.Lock()
defer me.lk.Unlock()
me.matchers[id] = append(me.matchers[id], mf)
me.matchers[id] = mf
return nil
}
+2 -4
View File
@@ -27,7 +27,6 @@ type heightEvents struct {
}
func (e *heightEvents) headChangeAt(rev, app []*types.TipSet) error {
ctx, span := trace.StartSpan(e.ctx, "events.HeightHeadChange")
defer span.End()
span.AddAttributes(trace.Int64Attribute("endHeight", int64(app[0].Height())))
@@ -145,12 +144,11 @@ func (e *heightEvents) headChangeAt(rev, app []*types.TipSet) error {
}
// ChainAt invokes the specified `HeightHandler` when the chain reaches the
// specified height+confidence threshold. If the chain is rolled-back under the
// specified height, `RevertHandler` will be called.
// specified height+confidence threshold. If the chain is rolled-back under the
// specified height, `RevertHandler` will be called.
//
// ts passed to handlers is the tipset at the specified, or above, if lower tipsets were null
func (e *heightEvents) ChainAt(hnd HeightHandler, rev RevertHandler, confidence int, h abi.ChainEpoch) error {
e.lk.Lock() // Tricky locking, check your locks if you modify this function!
best, err := e.tsc.best()
+3 -3
View File
@@ -572,9 +572,9 @@ func TestAtChainedConfidenceNull(t *testing.T) {
require.Equal(t, false, reverted)
}
func matchAddrMethod(to address.Address, m abi.MethodNum) func(msg *types.Message) (matchOnce bool, matched bool, err error) {
return func(msg *types.Message) (matchOnce bool, matched bool, err error) {
return true, to == msg.To && m == msg.Method, nil
func matchAddrMethod(to address.Address, m abi.MethodNum) func(msg *types.Message) (matched bool, err error) {
return func(msg *types.Message) (matched bool, err error) {
return to == msg.To && m == msg.Method, nil
}
}
+34
View File
@@ -0,0 +1,34 @@
package state
import (
"context"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/lotus/chain/types"
)
type FastChainApiAPI interface {
ChainAPI
ChainGetTipSet(context.Context, types.TipSetKey) (*types.TipSet, error)
}
type fastAPI struct {
FastChainApiAPI
}
func WrapFastAPI(api FastChainApiAPI) ChainAPI {
return &fastAPI{
api,
}
}
func (a *fastAPI) StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error) {
ts, err := a.FastChainApiAPI.ChainGetTipSet(ctx, tsk)
if err != nil {
return nil, err
}
return a.FastChainApiAPI.StateGetActor(ctx, actor, ts.Parents())
}
+69
View File
@@ -0,0 +1,69 @@
package test
import (
"context"
"sync"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/lib/blockstore"
"github.com/ipfs/go-cid"
"golang.org/x/xerrors"
)
type MockAPI struct {
bs blockstore.Blockstore
lk sync.Mutex
ts map[types.TipSetKey]*types.Actor
stateGetActorCalled int
}
func NewMockAPI(bs blockstore.Blockstore) *MockAPI {
return &MockAPI{
bs: bs,
ts: make(map[types.TipSetKey]*types.Actor),
}
}
func (m *MockAPI) ChainHasObj(ctx context.Context, c cid.Cid) (bool, error) {
return m.bs.Has(c)
}
func (m *MockAPI) ChainReadObj(ctx context.Context, c cid.Cid) ([]byte, error) {
blk, err := m.bs.Get(c)
if err != nil {
return nil, xerrors.Errorf("blockstore get: %w", err)
}
return blk.RawData(), nil
}
func (m *MockAPI) StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error) {
m.lk.Lock()
defer m.lk.Unlock()
m.stateGetActorCalled++
return m.ts[tsk], nil
}
func (m *MockAPI) StateGetActorCallCount() int {
m.lk.Lock()
defer m.lk.Unlock()
return m.stateGetActorCalled
}
func (m *MockAPI) ResetCallCounts() {
m.lk.Lock()
defer m.lk.Unlock()
m.stateGetActorCalled = 0
}
func (m *MockAPI) SetActor(tsk types.TipSetKey, act *types.Actor) {
m.lk.Lock()
defer m.lk.Unlock()
m.ts[tsk] = act
}
+32
View File
@@ -0,0 +1,32 @@
package test
import (
"context"
"testing"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
"github.com/filecoin-project/specs-actors/v2/actors/util/adt"
"github.com/stretchr/testify/require"
)
func CreateEmptyMarketState(t *testing.T, store adt.Store) *market.State {
emptyArrayCid, err := adt.MakeEmptyArray(store).Root()
require.NoError(t, err)
emptyMap, err := adt.MakeEmptyMap(store).Root()
require.NoError(t, err)
return market.ConstructState(emptyArrayCid, emptyMap, emptyMap)
}
func CreateDealAMT(ctx context.Context, t *testing.T, store adt.Store, deals map[abi.DealID]*market.DealState) cid.Cid {
root := adt.MakeEmptyArray(store)
for dealID, dealState := range deals {
err := root.Set(uint64(dealID), dealState)
require.NoError(t, err)
}
rootCid, err := root.Root()
require.NoError(t, err)
return rootCid
}

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