Compare commits
441
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
031bfaf120 | ||
|
|
f15a1edbf2 | ||
|
|
1bf7e6a408 | ||
|
|
59351c8cb8 | ||
|
|
230b8554f6 | ||
|
|
b47cde70fa | ||
|
|
7e7844f169 | ||
|
|
296eab3045 | ||
|
|
c1b2080f4e | ||
|
|
eedcf910eb | ||
|
|
b72cd90c19 | ||
|
|
1e37185d74 | ||
|
|
3f3d61b043 | ||
|
|
f0accce286 | ||
|
|
9481fa0a4b | ||
|
|
681ce94a34 | ||
|
|
3ff209d95d | ||
|
|
a62e027002 | ||
|
|
cc61650f86 | ||
|
|
b2805823ce | ||
|
|
1dc6a2fea6 | ||
|
|
399a1afd94 | ||
|
|
eb8296120b | ||
|
|
daac7f2988 | ||
|
|
ca46a79144 | ||
|
|
e155eb9fa3 | ||
|
|
4691b2b809 | ||
|
|
3ecf478ff0 | ||
|
|
c084130d3e | ||
|
|
f4af6b670c | ||
|
|
d9c763437e | ||
|
|
e78c4ab9b3 | ||
|
|
7247f8e41f | ||
|
|
b6b5046cce | ||
|
|
dde2ab59ae | ||
|
|
bb6235733d | ||
|
|
595ad44ee7 | ||
|
|
20fc5ffa38 | ||
|
|
6ef0c382c3 | ||
|
|
575e6add43 | ||
|
|
235377585d | ||
|
|
c3d41d4e17 | ||
|
|
faa3a79a5f | ||
|
|
03dd33dbbe | ||
|
|
79403f169e | ||
|
|
2790cf35af | ||
|
|
f9b63c5f8c | ||
|
|
db5e4da268 | ||
|
|
ad348c8e2f | ||
|
|
51643caf60 | ||
|
|
ff10e0eaf1 | ||
|
|
6b8f526df3 | ||
|
|
e51ce5c508 | ||
|
|
8c41e17c93 | ||
|
|
5d72ebe0cc | ||
|
|
f07ce297f6 | ||
|
|
a87239e802 | ||
|
|
3e6c482229 | ||
|
|
176ecd4c3b | ||
|
|
211ad166af | ||
|
|
fe47d6a1a4 | ||
|
|
4dd93e5bbb | ||
|
|
10f2445a99 | ||
|
|
f1b24598f5 | ||
|
|
2d0929e305 | ||
|
|
8e01e73de4 | ||
|
|
7c8edf5632 | ||
|
|
25284b5325 | ||
|
|
06d2ac65b5 | ||
|
|
e3888b38bb | ||
|
|
5da2995bcd | ||
|
|
92e6f29cc8 | ||
|
|
a2468656e4 | ||
|
|
0358ad83cb | ||
|
|
3aab77af8d | ||
|
|
85447abe7f | ||
|
|
71c6d05902 | ||
|
|
8d062bc880 | ||
|
|
9e2d46b33f | ||
|
|
6080431383 | ||
|
|
5cafdc2f29 | ||
|
|
ff845aa793 | ||
|
|
cdeac2bca0 | ||
|
|
6e5f521463 | ||
|
|
abdad1f6d3 | ||
|
|
752f4a3d67 | ||
|
|
7508d96327 | ||
|
|
b8bf2af3e3 | ||
|
|
9ee940098d | ||
|
|
c315111bc7 | ||
|
|
8a47a71772 | ||
|
|
73ec10a49e | ||
|
|
325a4c0e5b | ||
|
|
b360c9403f | ||
|
|
ca4ee1e8cf | ||
|
|
2e5474e864 | ||
|
|
19c8ea3288 | ||
|
|
6260271b78 | ||
|
|
83427c478f | ||
|
|
0870f48b5c | ||
|
|
c3fb68545a | ||
|
|
aa599bfaf9 | ||
|
|
62c0f35b5a | ||
|
|
0de1566eaf | ||
|
|
39bf59d372 | ||
|
|
554848fe6b | ||
|
|
d05d5bcb70 | ||
|
|
8d3f98fe38 | ||
|
|
826cdb2186 | ||
|
|
c394fbdfc3 | ||
|
|
2fb5837a55 | ||
|
|
04ce49130a | ||
|
|
3ff23ecbfa | ||
|
|
ab8bf393c2 | ||
|
|
d0390181ec | ||
|
|
2f5c036faa | ||
|
|
c41ccb6c37 | ||
|
|
9e40e246ec | ||
|
|
c0f29ea9c6 | ||
|
|
7dba12fc81 | ||
|
|
95442094df | ||
|
|
1ce1dbbc50 | ||
|
|
d677826312 | ||
|
|
9ec1abf880 | ||
|
|
92d56d82f4 | ||
|
|
f628e121df | ||
|
|
2b29ceab83 | ||
|
|
da6752eccb | ||
|
|
8459d75597 | ||
|
|
b780a64ed9 | ||
|
|
60fae3a59d | ||
|
|
c1d04a9d13 | ||
|
|
424c27bada | ||
|
|
3c57b980e5 | ||
|
|
52411b12e3 | ||
|
|
6f8d00310b | ||
|
|
f955084572 | ||
|
|
d923620d5a | ||
|
|
2a862d497f | ||
|
|
bda4e5be95 | ||
|
|
ae12c70afe | ||
|
|
efe9ec4906 | ||
|
|
b161f56bd2 | ||
|
|
3464dc2fdf | ||
|
|
893998cb70 | ||
|
|
083c5b003c | ||
|
|
8c8652e7bb | ||
|
|
051d993d62 | ||
|
|
07c842d6e0 | ||
|
|
b9d3585f4c | ||
|
|
05afaf6094 | ||
|
|
3a52f05692 | ||
|
|
64bf3fccd2 | ||
|
|
dec79c70a1 | ||
|
|
21a8f71859 | ||
|
|
edfc2c215c | ||
|
|
16d491a134 | ||
|
|
7559e4311e | ||
|
|
a41b4acec3 | ||
|
|
fd50cd128a | ||
|
|
e99b98873c | ||
|
|
6b953a03d0 | ||
|
|
37a3e610b7 | ||
|
|
f87d8d0b7f | ||
|
|
5ff6148444 | ||
|
|
0130b28879 | ||
|
|
4cdd830003 | ||
|
|
f1425dcb26 | ||
|
|
cd8d3a0c88 | ||
|
|
8729ee4fa2 | ||
|
|
544cfa63ab | ||
|
|
0b9a2cc11c | ||
|
|
25768a291e | ||
|
|
19bd9cf945 | ||
|
|
8aabe1b488 | ||
|
|
3a0f80da74 | ||
|
|
5911780735 | ||
|
|
1e24ef4d0d | ||
|
|
207d33eaba | ||
|
|
d645c5fbab | ||
|
|
960759d22b | ||
|
|
5b7da270c9 | ||
|
|
58edb1b15d | ||
|
|
655051ef98 | ||
|
|
93653d9a58 | ||
|
|
4e16d600b0 | ||
|
|
fa8372a83b | ||
|
|
9614f6db8d | ||
|
|
3fb71cdfea | ||
|
|
a01f5d4495 | ||
|
|
d16c5d0e93 | ||
|
|
825e2c9527 | ||
|
|
c309686679 | ||
|
|
3dc3f55ecb | ||
|
|
f59bfd65da | ||
|
|
33f2d24f54 | ||
|
|
03a4316dcd | ||
|
|
4cb5622d18 | ||
|
|
4abcdd80bf | ||
|
|
4963fe7809 | ||
|
|
a64cf77e84 | ||
|
|
57fa377730 | ||
|
|
d4f46122f7 | ||
|
|
bf23e59900 | ||
|
|
c578efaabd | ||
|
|
a98ca86a45 | ||
|
|
b26d952d09 | ||
|
|
736fb5c5b0 | ||
|
|
a777cf7166 | ||
|
|
6ff889c8d6 | ||
|
|
5ec5ebac31 | ||
|
|
237d0bb1b0 | ||
|
|
61e173215b | ||
|
|
6f316cddbb | ||
|
|
75d8c52004 | ||
|
|
572114b8ba | ||
|
|
1215f26a84 | ||
|
|
d4fa5a0f1d | ||
|
|
2c3d0d826d | ||
|
|
100e198eb3 | ||
|
|
63d7ca328f | ||
|
|
b72b12a960 | ||
|
|
0523c946f9 | ||
|
|
4172a3c8b7 | ||
|
|
9b11c4b319 | ||
|
|
f82a262ffe | ||
|
|
921fda94c7 | ||
|
|
1078dff3a9 | ||
|
|
8a923fb420 | ||
|
|
ced22687eb | ||
|
|
177282d9f9 | ||
|
|
cddf63efe9 | ||
|
|
1bc987772c | ||
|
|
c755ceeffa | ||
|
|
6db8a862bb | ||
|
|
6311e53a76 | ||
|
|
ef65ddf351 | ||
|
|
a54ac2ef79 | ||
|
|
86cf17c1f4 | ||
|
|
daa2d89ef5 | ||
|
|
0e53275d40 | ||
|
|
dda1a42a2a | ||
|
|
a259c7bd75 | ||
|
|
d10d0a20b1 | ||
|
|
dd20829dbe | ||
|
|
670bd993f3 | ||
|
|
6f6f5d79fb | ||
|
|
3f4eaa99d5 | ||
|
|
94e1a833d6 | ||
|
|
27e48d73dd | ||
|
|
aa1b770974 | ||
|
|
bb56e97177 | ||
|
|
0f22d51309 | ||
|
|
b1734f84b3 | ||
|
|
839fc8df7d | ||
|
|
a4728d3c72 | ||
|
|
6806bff57b | ||
|
|
66f8f8aff2 | ||
|
|
bc384c01e3 | ||
|
|
976a3a5e7b | ||
|
|
122b319520 | ||
|
|
29d5976c01 | ||
|
|
cd266a05d2 | ||
|
|
6ba2533e2b | ||
|
|
dd327f0b22 | ||
|
|
927448601c | ||
|
|
1f04cc1f23 | ||
|
|
ec6580d840 | ||
|
|
9e7d9affbe | ||
|
|
52fbee6749 | ||
|
|
0f0a70e251 | ||
|
|
fac769ff17 | ||
|
|
690be5bf7f | ||
|
|
1d8de2791a | ||
|
|
3e32aa896c | ||
|
|
65ecca2904 | ||
|
|
62de84d5b6 | ||
|
|
2f30322a4e | ||
|
|
145c862ee0 | ||
|
|
bd1bec5c93 | ||
|
|
2f1f35cc71 | ||
|
|
be1123b5df | ||
|
|
5ccb4586b5 | ||
|
|
d8d708704d | ||
|
|
063eefe896 | ||
|
|
65819140dd | ||
|
|
0e2278cc76 | ||
|
|
bdd56d2516 | ||
|
|
7fb590208c | ||
|
|
02b00c025a | ||
|
|
8935c4386c | ||
|
|
bcd2c71031 | ||
|
|
69495f5b59 | ||
|
|
3f703ff8a4 | ||
|
|
46d8ae47dc | ||
|
|
5bc4ee257f | ||
|
|
aac6d88f72 | ||
|
|
f00698aafd | ||
|
|
e1634128c1 | ||
|
|
a3ea3ad911 | ||
|
|
0eec00055f | ||
|
|
e8df325796 | ||
|
|
ec8baf23d8 | ||
|
|
63487e1d69 | ||
|
|
a0353c8627 | ||
|
|
6ecbcebd44 | ||
|
|
0f83a0a634 | ||
|
|
e6a8c278f5 | ||
|
|
780dfa0c7c | ||
|
|
5e692f9071 | ||
|
|
40c61a310f | ||
|
|
22ce395130 | ||
|
|
716b4a3b09 | ||
|
|
eb48dc9b68 | ||
|
|
fc7d4a13b0 | ||
|
|
73ca65a6ff | ||
|
|
f157ac9b68 | ||
|
|
773f896bcd | ||
|
|
0001a6bad0 | ||
|
|
a64f2421d2 | ||
|
|
8a42462271 | ||
|
|
b08bf32040 | ||
|
|
a45803d8a0 | ||
|
|
ec00e73c9d | ||
|
|
dd20cb7301 | ||
|
|
ac3cdf75fa | ||
|
|
3e288f1066 | ||
|
|
80d5e52923 | ||
|
|
a51b08e386 | ||
|
|
6b7b9793ab | ||
|
|
e4233e45be | ||
|
|
47bac4a0c9 | ||
|
|
b31480232b | ||
|
|
73c7e9edf1 | ||
|
|
5eb5fcd0f4 | ||
|
|
fbcb05388e | ||
|
|
0addca1070 | ||
|
|
a8fcaeb141 | ||
|
|
2e057b8f52 | ||
|
|
84710cf27e | ||
|
|
7ed40c1ec7 | ||
|
|
97a91f23f1 | ||
|
|
5065626984 | ||
|
|
15263bc0d7 | ||
|
|
8c4c2eeffc | ||
|
|
d7528557df | ||
|
|
dc26f3bd74 | ||
|
|
8652f80ab3 | ||
|
|
e5895af4a2 | ||
|
|
dfb65ed89f | ||
|
|
6c31cecc7d | ||
|
|
095361bead | ||
|
|
9108828aeb | ||
|
|
8e376c84cf | ||
|
|
0169d0dafd | ||
|
|
a0d76bda99 | ||
|
|
36f1a8f3ca | ||
|
|
f04bae3f0b | ||
|
|
95f86f9de0 | ||
|
|
e8ef39e734 | ||
|
|
702a7815b9 | ||
|
|
276eabd4e5 | ||
|
|
509aea5d04 | ||
|
|
f7a49e7be7 | ||
|
|
21e6c963ab | ||
|
|
74d3ba6b5e | ||
|
|
43cde484f4 | ||
|
|
c31f4de7d5 | ||
|
|
6fd1609410 | ||
|
|
9c75a3aaa8 | ||
|
|
a3d8494a04 | ||
|
|
a9e22df765 | ||
|
|
b9b4a2659d | ||
|
|
072297e661 | ||
|
|
13b260e7f7 | ||
|
|
ac31651a42 | ||
|
|
49c619d65d | ||
|
|
b0a9a27288 | ||
|
|
c9a557e0d9 | ||
|
|
fcb7cd0eb0 | ||
|
|
9ccd4ee240 | ||
|
|
84c48de5d9 | ||
|
|
9f6265e0b4 | ||
|
|
a5be80828a | ||
|
|
3969d6b767 | ||
|
|
dad9190142 | ||
|
|
9d143426ee | ||
|
|
727765b248 | ||
|
|
780c40329e | ||
|
|
489782e21b | ||
|
|
5d6398f20e | ||
|
|
6ce5879071 | ||
|
|
05c1325885 | ||
|
|
9331714089 | ||
|
|
d5e1cc095c | ||
|
|
c2437b7bf2 | ||
|
|
bfd1099ef3 | ||
|
|
f3b691d618 | ||
|
|
66c8c66f40 | ||
|
|
0cfc344f82 | ||
|
|
c3ecf8355d | ||
|
|
a09aa0aa72 | ||
|
|
91f6d4b013 | ||
|
|
40d16a8f88 | ||
|
|
f88fcdbcfc | ||
|
|
e16e9ad343 | ||
|
|
7d2b3f05db | ||
|
|
9d4489360b | ||
|
|
5f1783c9a5 | ||
|
|
7655e660f3 | ||
|
|
a5847fd06f | ||
|
|
91fb111462 | ||
|
|
8665e32221 | ||
|
|
07f1be0ff6 | ||
|
|
1449644c34 | ||
|
|
5454aebf13 | ||
|
|
a4fd3de0b0 | ||
|
|
599a6bfb24 | ||
|
|
60fe55cdc0 | ||
|
|
501308239f | ||
|
|
21e27b8034 | ||
|
|
8d3017febb | ||
|
|
d196c236b8 | ||
|
|
f8c675bc5e | ||
|
|
caf3cfa7d8 | ||
|
|
bfee6699d2 | ||
|
|
627d4fbf74 | ||
|
|
a633f93707 | ||
|
|
588d6ec828 | ||
|
|
025d8ebc59 | ||
|
|
189f5f8aae | ||
|
|
3c37078a85 | ||
|
|
e309293a47 | ||
|
|
4d87f16e95 | ||
|
|
053317e334 | ||
|
|
662c51605f | ||
|
|
f01015bac5 | ||
|
|
ad16bafa66 | ||
|
|
b45924a234 | ||
|
|
fb911a4542 | ||
|
|
9297e1b90d |
@@ -785,6 +785,11 @@ workflows:
|
||||
suite: itest-deals_512mb
|
||||
target: "./itests/deals_512mb_test.go"
|
||||
|
||||
- test:
|
||||
name: test-itest-deals_anycid
|
||||
suite: itest-deals_anycid
|
||||
target: "./itests/deals_anycid_test.go"
|
||||
|
||||
- test:
|
||||
name: test-itest-deals_concurrent
|
||||
suite: itest-deals_concurrent
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
|
||||
Before you mark the PR ready for review, please make sure that:
|
||||
- [ ] All commits have a clear commit message.
|
||||
- [ ] The PR title is in the form of `<PR type>: <area>: <change being made>`
|
||||
- [ ] The PR title is in the form of of `<PR type>: <area>: <change being made>`
|
||||
- example: ` fix: mempool: Introduce a cache for valid signatures`
|
||||
- `PR type`: _fix_, _feat_, _INTERFACE BREAKING CHANGE_, _CONSENSUS BREAKING_, _build_, _chore_, _ci_, _docs_, _misc_,_perf_, _refactor_, _revert_, _style_, _test_
|
||||
- `area`: _api_, _chain_, _state_, _vm_, _data transfer_, _market_, _mempool_, _message_, _block production_, _multisig_, _networking_, _paychan_, _proving_, _sealing_, _wallet_
|
||||
- `PR type`: _fix_, _feat_, _INTERFACE BREAKING CHANGE_, _CONSENSUS BREAKING_, _build_, _chore_, _ci_, _docs_,_perf_, _refactor_, _revert_, _style_, _test_
|
||||
- `area`: _api_, _chain_, _state_, _vm_, _data transfer_, _market_, _mempool_, _message_, _block production_, _multisig_, _networking_, _paychan_, _proving_, _sealing_, _wallet_, _deps_
|
||||
- [ ] This PR has tests for new functionality or change in behaviour
|
||||
- [ ] If new user-facing features are introduced, clear usage guidelines and / or documentation updates should be included in https://lotus.filecoin.io or [Discussion Tutorials.](https://github.com/filecoin-project/lotus/discussions/categories/tutorials)
|
||||
- [ ] CI is green
|
||||
|
||||
@@ -1,89 +1,5 @@
|
||||
# Lotus changelog
|
||||
|
||||
# 1.14.0-rc1 / 2022-01-12
|
||||
|
||||
This is the first release candidate for the mandatory release v1.14.0 of Lotus that introduces [Filecoin network v15,
|
||||
codenamed the OhSnap upgrade](https://github.com/filecoin-project/community/discussions/74?sort=new#discussioncomment-1922550).
|
||||
|
||||
The OhSnap upgrade introduces the following FIPs, delivered in [actors v7-rc1](https://github.com/filecoin-project/specs-actors/releases/tag/v7.0.0-rc1):
|
||||
- [FIP-0019 Snap Deals](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0019.md)
|
||||
- [FIP-0028 Remove Datacap from Verified clients](https://github.com/filecoin-project/FIPs/pull/226)
|
||||
|
||||
Note:
|
||||
- This release is built on top of lotus v1.13.2. Enterprising users like storage providers, data brokers and others
|
||||
are recommended to test out v1.15.0-rc1(coming on Jan 18th, 2022) for latest new features, improvements and bug
|
||||
fixes and be ready for the upgrade!
|
||||
- This release candidate uses temporary proof params for Snap Deals.
|
||||
- It only sets upgrade epoch for Butterfly-SnapNet, and it does not set the upgrade epochs for calibration and mainnet.
|
||||
|
||||
## Butterfly - SnapNet
|
||||
|
||||
The ButterFly-SnapNet will be upgraded to Network v15 OhSnap at epoch 30262, around 2022-01-17T19:00:00Z.
|
||||
|
||||
To join the network, simply build lotus by running `make butterflynet`.
|
||||
|
||||
The network supports three sector sizes, 512MiB, 32GiB and 64GiB. Temporary proof params for Snap Deals should be downloaded upon your node restarts.
|
||||
- The parameters are pinged on IPFS gateway https://proofs.filecoin.io/ipfs/ and the CIDs can be found [here](https://github.com/filecoin-project/lotus/blob/edd3486d2cf53b960382e9cda6671e647844aa41/build/proof-params/parameters.json), please let the lotus team know in #lotus-ohsnap if the params are not fetched automatically. You can also download the params manually from s3://proof-params-ap/filecoin-snapdeal-parameters/.
|
||||
|
||||
*SnapNet Resources*:
|
||||
- [Faucet](https://faucet.butterfly.fildev.network/)
|
||||
- [Stats Dashboard](https://stats.butterfly.fildev.network/d/z6FtI92Zz/chain?orgId=1&refresh=25s&from=now-30m&to=now&kiosk)
|
||||
- For questions and feedbacks:
|
||||
- Primary: [Discussion](https://github.com/filecoin-project/lotus/discussions/7935)
|
||||
- Secondary: #lotus-ohsnap in Filecoin Slack
|
||||
|
||||
## New Features and Changes
|
||||
- Integrate actor v7-rc1:
|
||||
- Integrate v7 actors ([#7617](https://github.com/filecoin-project/lotus/pull/7617))
|
||||
- feat: state: Fast migration for v15 ([#7933](https://github.com/filecoin-project/lotus/pull/7933))
|
||||
- fix: blockstore: Add missing locks to autobatch::Get() [#7939](https://github.com/filecoin-project/lotus/pull/7939))
|
||||
- correctness fixes for the autobatch blockstore ([#7940](https://github.com/filecoin-project/lotus/pull/7940))
|
||||
- Implement and support [FIP-0019 Snap Deals](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0019.md)
|
||||
- chore: deps: Integrate proof v11.0.0 ([#7923](https://github.com/filecoin-project/lotus/pull/7923))
|
||||
- Snap Deals Lotus Integration: FSM Posting and integration test ([#7810](https://github.com/filecoin-project/lotus/pull/7810))
|
||||
- Feat/sector storage unseal ([#7730](https://github.com/filecoin-project/lotus/pull/7730))
|
||||
- Feat/snap deals storage ([#7615](https://github.com/filecoin-project/lotus/pull/7615))
|
||||
- fix: sealing: Add more deal expiration checks during PRU pipeline ([#7871](https://github.com/filecoin-project/lotus/pull/7871))
|
||||
- chore: deps: Update go-paramfetch ([#7917](https://github.com/filecoin-project/lotus/pull/7917))
|
||||
- feat: #7880 gas: add gas charge for VerifyReplicaUpdate ([#7897](https://github.com/filecoin-project/lotus/pull/7897))
|
||||
- enhancement: sectors: disable existing cc upgrade path 2 days before the upgrade epoch ([#7900](https://github.com/filecoin-project/lotus/pull/7900))
|
||||
|
||||
## Improvements
|
||||
- updating to new datastore/blockstore code with contexts ([#7646](https://github.com/filecoin-project/lotus/pull/7646))
|
||||
- reorder transfer checks so as to ensure sending 2B FIL to yourself fails if you don't have that amount ([#7637](https://github.com/filecoin-project/lotus/pull/7637))
|
||||
- VM: Circ supply should be constant per epoch ([#7811](https://github.com/filecoin-project/lotus/pull/7811))
|
||||
|
||||
## Bug Fixes
|
||||
- Fix: state: circsuypply calc around null blocks ([#7890](https://github.com/filecoin-project/lotus/pull/7890))
|
||||
- Mempool msg selection should respect block message limits ([#7321](https://github.com/filecoin-project/lotus/pull/7321))
|
||||
SplitStore: supress compaction near upgrades ([#7734](https://github.com/filecoin-project/lotus/pull/7734))
|
||||
|
||||
## Others
|
||||
- chore: create pull_request_template.md ([#7726](https://github.com/filecoin-project/lotus/pull/7726))
|
||||
|
||||
## Contributors
|
||||
|
||||
| Contributor | Commits | Lines ± | Files Changed |
|
||||
|-------------|---------|---------|---------------|
|
||||
| Aayush Rajasekaran | 56 | +5866/-2523 | 316 |
|
||||
| zenground0 | 11 | +3316/-524 | 124 |
|
||||
| vyzo | 38 | +722/-485 | 117 |
|
||||
| Rod Vagg | 2 | +6/-941 | 4 |
|
||||
| whyrusleeping | 2 | +376/-339 | 27 |
|
||||
| ZenGround0 | 3 | +263/-25 | 11 |
|
||||
| c r | 2 | +198/-30 | 6 |
|
||||
| Łukasz Magiera | 2 | +184/-3 | 3 |
|
||||
| Jennifer Wang | 14 | +97/-69 | 41 |
|
||||
| Whyrusleeping | 1 | +76/-70 | 8 |
|
||||
| web3-bot | 10 | +99/-17 | 10 |
|
||||
| Steven Allen | 1 | +55/-37 | 1 |
|
||||
| Jiaying Wang | 5 | +30/-8 | 5 |
|
||||
| Hannah Howard | 1 | +4/-29 | 3 |
|
||||
| dirkmc | 1 | +11/-0 | 1 |
|
||||
| Jakub Sztandera | 2 | +8/-3 | 3 |
|
||||
| Colin Kennedy | 1 | +4/-2 | 1 |
|
||||
|
||||
|
||||
# v1.13.2 / 2022-01-09
|
||||
|
||||
Lotus v1.13.2 is a *highly recommended* feature release with remarkable retrieval improvements, new features like
|
||||
|
||||
@@ -900,6 +900,7 @@ type QueryOffer struct {
|
||||
Size uint64
|
||||
MinPrice types.BigInt
|
||||
UnsealPrice types.BigInt
|
||||
PricePerByte abi.TokenAmount
|
||||
PaymentInterval uint64
|
||||
PaymentIntervalIncrease uint64
|
||||
Miner address.Address
|
||||
|
||||
@@ -51,6 +51,15 @@ type Net interface {
|
||||
NetBlockRemove(ctx context.Context, acl NetBlockList) error //perm:admin
|
||||
NetBlockList(ctx context.Context) (NetBlockList, error) //perm:read
|
||||
|
||||
NetProtectAdd(ctx context.Context, acl []peer.ID) error //perm:admin
|
||||
NetProtectRemove(ctx context.Context, acl []peer.ID) error //perm:admin
|
||||
NetProtectList(ctx context.Context) ([]peer.ID, error) //perm:read
|
||||
|
||||
// ResourceManager API
|
||||
NetStat(ctx context.Context, scope string) (NetStat, error) //perm:read
|
||||
NetLimit(ctx context.Context, scope string) (NetLimit, error) //perm:read
|
||||
NetSetLimit(ctx context.Context, scope string, limit NetLimit) error //perm:admin
|
||||
|
||||
// ID returns peerID of libp2p node backing this API
|
||||
ID(context.Context) (peer.ID, error) //perm:read
|
||||
}
|
||||
|
||||
@@ -151,6 +151,7 @@ type StorageMiner interface {
|
||||
StorageLock(ctx context.Context, sector abi.SectorID, read storiface.SectorFileType, write storiface.SectorFileType) error //perm:admin
|
||||
StorageTryLock(ctx context.Context, sector abi.SectorID, read storiface.SectorFileType, write storiface.SectorFileType) (bool, error) //perm:admin
|
||||
StorageList(ctx context.Context) (map[stores.ID][]stores.Decl, error) //perm:admin
|
||||
StorageGetLocks(ctx context.Context) (storiface.SectorLocks, error) //perm:admin
|
||||
|
||||
StorageLocal(ctx context.Context) (map[stores.ID]string, error) //perm:admin
|
||||
StorageStat(ctx context.Context, id stores.ID) (fsutil.FsStat, error) //perm:admin
|
||||
@@ -166,6 +167,8 @@ type StorageMiner interface {
|
||||
MarketGetRetrievalAsk(ctx context.Context) (*retrievalmarket.Ask, error) //perm:read
|
||||
MarketListDataTransfers(ctx context.Context) ([]DataTransferChannel, error) //perm:write
|
||||
MarketDataTransferUpdates(ctx context.Context) (<-chan DataTransferChannel, error) //perm:write
|
||||
// MarketDataTransferDiagnostics generates debugging information about current data transfers over graphsync
|
||||
MarketDataTransferDiagnostics(ctx context.Context, p peer.ID) (*TransferDiagnostics, error) //perm:write
|
||||
// MarketRestartDataTransfer 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 //perm:write
|
||||
// MarketCancelDataTransfer cancels a data transfer with the given transfer ID and other peer
|
||||
@@ -216,6 +219,19 @@ type StorageMiner interface {
|
||||
// DagstoreGC runs garbage collection on the DAG store.
|
||||
DagstoreGC(ctx context.Context) ([]DagstoreShardResult, error) //perm:admin
|
||||
|
||||
// IndexerAnnounceDeal informs indexer nodes that a new deal was received,
|
||||
// so they can download its index
|
||||
IndexerAnnounceDeal(ctx context.Context, proposalCid cid.Cid) error //perm:admin
|
||||
|
||||
// IndexerAnnounceAllDeals informs the indexer nodes aboutall active deals.
|
||||
IndexerAnnounceAllDeals(ctx context.Context) error //perm:admin
|
||||
|
||||
// DagstorePieceIndexSize returns the size of the piece index.
|
||||
DagstorePieceIndexSize(ctx context.Context) (int64, error) //perm:admin
|
||||
|
||||
// DagstoreLookupPieces returns information about shards that contain the given CID.
|
||||
DagstoreLookupPieces(ctx context.Context, cid cid.Cid) ([]DagstoreShardInfo, error) //perm:admin
|
||||
|
||||
// RuntimeSubsystems returns the subsystems that are enabled
|
||||
// in this instance.
|
||||
RuntimeSubsystems(ctx context.Context) (MinerSubsystems, error) //perm:read
|
||||
|
||||
+40
-1
@@ -1,6 +1,7 @@
|
||||
package docgen
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"go/ast"
|
||||
"go/parser"
|
||||
@@ -15,6 +16,7 @@ import (
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
"github.com/google/uuid"
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/ipfs/go-graphsync"
|
||||
"github.com/libp2p/go-libp2p-core/metrics"
|
||||
"github.com/libp2p/go-libp2p-core/network"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
@@ -120,6 +122,7 @@ func init() {
|
||||
addExample(api.FullAPIVersion1)
|
||||
addExample(api.PCHInbound)
|
||||
addExample(time.Minute)
|
||||
addExample(graphsync.RequestID(4))
|
||||
addExample(datatransfer.TransferID(3))
|
||||
addExample(datatransfer.Ongoing)
|
||||
addExample(storeIDExample)
|
||||
@@ -250,10 +253,18 @@ func init() {
|
||||
addExample(map[abi.SectorNumber]string{
|
||||
123: "can't acquire read lock",
|
||||
})
|
||||
addExample(json.RawMessage(`"json raw message"`))
|
||||
addExample(map[api.SectorState]int{
|
||||
api.SectorState(sealing.Proving): 120,
|
||||
})
|
||||
addExample([]abi.SectorNumber{123, 124})
|
||||
addExample([]storiface.SectorLock{
|
||||
{
|
||||
Sector: abi.SectorID{Number: 123, Miner: 1000},
|
||||
Write: [storiface.FileTypes]uint{0, 0, 1},
|
||||
Read: [storiface.FileTypes]uint{2, 3, 0},
|
||||
},
|
||||
})
|
||||
|
||||
// worker specific
|
||||
addExample(storiface.AcquireMove)
|
||||
@@ -289,6 +300,34 @@ func init() {
|
||||
Error: "<error>",
|
||||
})
|
||||
addExample(storiface.ResourceTable)
|
||||
addExample(network.ScopeStat{
|
||||
Memory: 123,
|
||||
NumStreamsInbound: 1,
|
||||
NumStreamsOutbound: 2,
|
||||
NumConnsInbound: 3,
|
||||
NumConnsOutbound: 4,
|
||||
NumFD: 5,
|
||||
})
|
||||
addExample(map[string]network.ScopeStat{
|
||||
"abc": {
|
||||
Memory: 123,
|
||||
NumStreamsInbound: 1,
|
||||
NumStreamsOutbound: 2,
|
||||
NumConnsInbound: 3,
|
||||
NumConnsOutbound: 4,
|
||||
NumFD: 5,
|
||||
}})
|
||||
addExample(api.NetLimit{
|
||||
Memory: 123,
|
||||
StreamsInbound: 1,
|
||||
StreamsOutbound: 2,
|
||||
Streams: 3,
|
||||
ConnsInbound: 3,
|
||||
ConnsOutbound: 4,
|
||||
Conns: 4,
|
||||
FD: 5,
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func GetAPIType(name, pkg string) (i interface{}, t reflect.Type, permStruct []reflect.Type) {
|
||||
@@ -339,7 +378,7 @@ func ExampleValue(method string, t, parent reflect.Type) interface{} {
|
||||
switch t.Kind() {
|
||||
case reflect.Slice:
|
||||
out := reflect.New(t).Elem()
|
||||
reflect.Append(out, reflect.ValueOf(ExampleValue(method, t.Elem(), t)))
|
||||
out = reflect.Append(out, reflect.ValueOf(ExampleValue(method, t.Elem(), t)))
|
||||
return out.Interface()
|
||||
case reflect.Chan:
|
||||
return ExampleValue(method, t.Elem(), nil)
|
||||
|
||||
@@ -1811,6 +1811,21 @@ func (mr *MockFullNodeMockRecorder) NetFindPeer(arg0, arg1 interface{}) *gomock.
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetFindPeer", reflect.TypeOf((*MockFullNode)(nil).NetFindPeer), arg0, arg1)
|
||||
}
|
||||
|
||||
// NetLimit mocks base method.
|
||||
func (m *MockFullNode) NetLimit(arg0 context.Context, arg1 string) (api.NetLimit, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "NetLimit", arg0, arg1)
|
||||
ret0, _ := ret[0].(api.NetLimit)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// NetLimit indicates an expected call of NetLimit.
|
||||
func (mr *MockFullNodeMockRecorder) NetLimit(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetLimit", reflect.TypeOf((*MockFullNode)(nil).NetLimit), arg0, arg1)
|
||||
}
|
||||
|
||||
// NetPeerInfo mocks base method.
|
||||
func (m *MockFullNode) NetPeerInfo(arg0 context.Context, arg1 peer.ID) (*api.ExtendedPeerInfo, error) {
|
||||
m.ctrl.T.Helper()
|
||||
@@ -1841,6 +1856,49 @@ func (mr *MockFullNodeMockRecorder) NetPeers(arg0 interface{}) *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetPeers", reflect.TypeOf((*MockFullNode)(nil).NetPeers), arg0)
|
||||
}
|
||||
|
||||
// NetProtectAdd mocks base method.
|
||||
func (m *MockFullNode) NetProtectAdd(arg0 context.Context, arg1 []peer.ID) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "NetProtectAdd", arg0, arg1)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// NetProtectAdd indicates an expected call of NetProtectAdd.
|
||||
func (mr *MockFullNodeMockRecorder) NetProtectAdd(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetProtectAdd", reflect.TypeOf((*MockFullNode)(nil).NetProtectAdd), arg0, arg1)
|
||||
}
|
||||
|
||||
// NetProtectList mocks base method.
|
||||
func (m *MockFullNode) NetProtectList(arg0 context.Context) ([]peer.ID, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "NetProtectList", arg0)
|
||||
ret0, _ := ret[0].([]peer.ID)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// NetProtectList indicates an expected call of NetProtectList.
|
||||
func (mr *MockFullNodeMockRecorder) NetProtectList(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetProtectList", reflect.TypeOf((*MockFullNode)(nil).NetProtectList), arg0)
|
||||
}
|
||||
|
||||
// NetProtectRemove mocks base method.
|
||||
func (m *MockFullNode) NetProtectRemove(arg0 context.Context, arg1 []peer.ID) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "NetProtectRemove", arg0, arg1)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// NetProtectRemove indicates an expected call of NetProtectRemove.
|
||||
func (mr *MockFullNodeMockRecorder) NetProtectRemove(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetProtectRemove", reflect.TypeOf((*MockFullNode)(nil).NetProtectRemove), arg0, arg1)
|
||||
}
|
||||
|
||||
// NetPubsubScores mocks base method.
|
||||
func (m *MockFullNode) NetPubsubScores(arg0 context.Context) ([]api.PubsubScore, error) {
|
||||
m.ctrl.T.Helper()
|
||||
@@ -1856,6 +1914,35 @@ func (mr *MockFullNodeMockRecorder) NetPubsubScores(arg0 interface{}) *gomock.Ca
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetPubsubScores", reflect.TypeOf((*MockFullNode)(nil).NetPubsubScores), arg0)
|
||||
}
|
||||
|
||||
// NetSetLimit mocks base method.
|
||||
func (m *MockFullNode) NetSetLimit(arg0 context.Context, arg1 string, arg2 api.NetLimit) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "NetSetLimit", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// NetSetLimit indicates an expected call of NetSetLimit.
|
||||
func (mr *MockFullNodeMockRecorder) NetSetLimit(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetSetLimit", reflect.TypeOf((*MockFullNode)(nil).NetSetLimit), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// NetStat mocks base method.
|
||||
func (m *MockFullNode) NetStat(arg0 context.Context, arg1 string) (api.NetStat, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "NetStat", arg0, arg1)
|
||||
ret0, _ := ret[0].(api.NetStat)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// NetStat indicates an expected call of NetStat.
|
||||
func (mr *MockFullNodeMockRecorder) NetStat(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetStat", reflect.TypeOf((*MockFullNode)(nil).NetStat), arg0, arg1)
|
||||
}
|
||||
|
||||
// NodeStatus mocks base method.
|
||||
func (m *MockFullNode) NodeStatus(arg0 context.Context, arg1 bool) (api.NodeStatus, error) {
|
||||
m.ctrl.T.Helper()
|
||||
|
||||
@@ -587,11 +587,23 @@ type NetStruct struct {
|
||||
|
||||
NetFindPeer func(p0 context.Context, p1 peer.ID) (peer.AddrInfo, error) `perm:"read"`
|
||||
|
||||
NetLimit func(p0 context.Context, p1 string) (NetLimit, error) `perm:"read"`
|
||||
|
||||
NetPeerInfo func(p0 context.Context, p1 peer.ID) (*ExtendedPeerInfo, error) `perm:"read"`
|
||||
|
||||
NetPeers func(p0 context.Context) ([]peer.AddrInfo, error) `perm:"read"`
|
||||
|
||||
NetProtectAdd func(p0 context.Context, p1 []peer.ID) error `perm:"admin"`
|
||||
|
||||
NetProtectList func(p0 context.Context) ([]peer.ID, error) `perm:"read"`
|
||||
|
||||
NetProtectRemove func(p0 context.Context, p1 []peer.ID) error `perm:"admin"`
|
||||
|
||||
NetPubsubScores func(p0 context.Context) ([]PubsubScore, error) `perm:"read"`
|
||||
|
||||
NetSetLimit func(p0 context.Context, p1 string, p2 NetLimit) error `perm:"admin"`
|
||||
|
||||
NetStat func(p0 context.Context, p1 string) (NetStat, error) `perm:"read"`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -633,6 +645,10 @@ type StorageMinerStruct struct {
|
||||
|
||||
DagstoreListShards func(p0 context.Context) ([]DagstoreShardInfo, error) `perm:"read"`
|
||||
|
||||
DagstoreLookupPieces func(p0 context.Context, p1 cid.Cid) ([]DagstoreShardInfo, error) `perm:"admin"`
|
||||
|
||||
DagstorePieceIndexSize func(p0 context.Context) (int64, error) `perm:"admin"`
|
||||
|
||||
DagstoreRecoverShard func(p0 context.Context, p1 string) error `perm:"write"`
|
||||
|
||||
DealsConsiderOfflineRetrievalDeals func(p0 context.Context) (bool, error) `perm:"admin"`
|
||||
@@ -667,8 +683,14 @@ type StorageMinerStruct struct {
|
||||
|
||||
DealsSetPieceCidBlocklist func(p0 context.Context, p1 []cid.Cid) error `perm:"admin"`
|
||||
|
||||
IndexerAnnounceAllDeals func(p0 context.Context) error `perm:"admin"`
|
||||
|
||||
IndexerAnnounceDeal func(p0 context.Context, p1 cid.Cid) error `perm:"admin"`
|
||||
|
||||
MarketCancelDataTransfer func(p0 context.Context, p1 datatransfer.TransferID, p2 peer.ID, p3 bool) error `perm:"write"`
|
||||
|
||||
MarketDataTransferDiagnostics func(p0 context.Context, p1 peer.ID) (*TransferDiagnostics, error) `perm:"write"`
|
||||
|
||||
MarketDataTransferUpdates func(p0 context.Context) (<-chan DataTransferChannel, error) `perm:"write"`
|
||||
|
||||
MarketGetAsk func(p0 context.Context) (*storagemarket.SignedStorageAsk, error) `perm:"read"`
|
||||
@@ -805,6 +827,8 @@ type StorageMinerStruct struct {
|
||||
|
||||
StorageFindSector func(p0 context.Context, p1 abi.SectorID, p2 storiface.SectorFileType, p3 abi.SectorSize, p4 bool) ([]stores.SectorStorageInfo, error) `perm:"admin"`
|
||||
|
||||
StorageGetLocks func(p0 context.Context) (storiface.SectorLocks, error) `perm:"admin"`
|
||||
|
||||
StorageInfo func(p0 context.Context, p1 stores.ID) (stores.StorageInfo, error) `perm:"admin"`
|
||||
|
||||
StorageList func(p0 context.Context) (map[stores.ID][]stores.Decl, error) `perm:"admin"`
|
||||
@@ -3621,6 +3645,17 @@ func (s *NetStub) NetFindPeer(p0 context.Context, p1 peer.ID) (peer.AddrInfo, er
|
||||
return *new(peer.AddrInfo), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *NetStruct) NetLimit(p0 context.Context, p1 string) (NetLimit, error) {
|
||||
if s.Internal.NetLimit == nil {
|
||||
return *new(NetLimit), ErrNotSupported
|
||||
}
|
||||
return s.Internal.NetLimit(p0, p1)
|
||||
}
|
||||
|
||||
func (s *NetStub) NetLimit(p0 context.Context, p1 string) (NetLimit, error) {
|
||||
return *new(NetLimit), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *NetStruct) NetPeerInfo(p0 context.Context, p1 peer.ID) (*ExtendedPeerInfo, error) {
|
||||
if s.Internal.NetPeerInfo == nil {
|
||||
return nil, ErrNotSupported
|
||||
@@ -3643,6 +3678,39 @@ func (s *NetStub) NetPeers(p0 context.Context) ([]peer.AddrInfo, error) {
|
||||
return *new([]peer.AddrInfo), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *NetStruct) NetProtectAdd(p0 context.Context, p1 []peer.ID) error {
|
||||
if s.Internal.NetProtectAdd == nil {
|
||||
return ErrNotSupported
|
||||
}
|
||||
return s.Internal.NetProtectAdd(p0, p1)
|
||||
}
|
||||
|
||||
func (s *NetStub) NetProtectAdd(p0 context.Context, p1 []peer.ID) error {
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *NetStruct) NetProtectList(p0 context.Context) ([]peer.ID, error) {
|
||||
if s.Internal.NetProtectList == nil {
|
||||
return *new([]peer.ID), ErrNotSupported
|
||||
}
|
||||
return s.Internal.NetProtectList(p0)
|
||||
}
|
||||
|
||||
func (s *NetStub) NetProtectList(p0 context.Context) ([]peer.ID, error) {
|
||||
return *new([]peer.ID), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *NetStruct) NetProtectRemove(p0 context.Context, p1 []peer.ID) error {
|
||||
if s.Internal.NetProtectRemove == nil {
|
||||
return ErrNotSupported
|
||||
}
|
||||
return s.Internal.NetProtectRemove(p0, p1)
|
||||
}
|
||||
|
||||
func (s *NetStub) NetProtectRemove(p0 context.Context, p1 []peer.ID) error {
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *NetStruct) NetPubsubScores(p0 context.Context) ([]PubsubScore, error) {
|
||||
if s.Internal.NetPubsubScores == nil {
|
||||
return *new([]PubsubScore), ErrNotSupported
|
||||
@@ -3654,6 +3722,28 @@ func (s *NetStub) NetPubsubScores(p0 context.Context) ([]PubsubScore, error) {
|
||||
return *new([]PubsubScore), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *NetStruct) NetSetLimit(p0 context.Context, p1 string, p2 NetLimit) error {
|
||||
if s.Internal.NetSetLimit == nil {
|
||||
return ErrNotSupported
|
||||
}
|
||||
return s.Internal.NetSetLimit(p0, p1, p2)
|
||||
}
|
||||
|
||||
func (s *NetStub) NetSetLimit(p0 context.Context, p1 string, p2 NetLimit) error {
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *NetStruct) NetStat(p0 context.Context, p1 string) (NetStat, error) {
|
||||
if s.Internal.NetStat == nil {
|
||||
return *new(NetStat), ErrNotSupported
|
||||
}
|
||||
return s.Internal.NetStat(p0, p1)
|
||||
}
|
||||
|
||||
func (s *NetStub) NetStat(p0 context.Context, p1 string) (NetStat, error) {
|
||||
return *new(NetStat), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *SignableStruct) Sign(p0 context.Context, p1 SignFunc) error {
|
||||
if s.Internal.Sign == nil {
|
||||
return ErrNotSupported
|
||||
@@ -3775,6 +3865,28 @@ func (s *StorageMinerStub) DagstoreListShards(p0 context.Context) ([]DagstoreSha
|
||||
return *new([]DagstoreShardInfo), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *StorageMinerStruct) DagstoreLookupPieces(p0 context.Context, p1 cid.Cid) ([]DagstoreShardInfo, error) {
|
||||
if s.Internal.DagstoreLookupPieces == nil {
|
||||
return *new([]DagstoreShardInfo), ErrNotSupported
|
||||
}
|
||||
return s.Internal.DagstoreLookupPieces(p0, p1)
|
||||
}
|
||||
|
||||
func (s *StorageMinerStub) DagstoreLookupPieces(p0 context.Context, p1 cid.Cid) ([]DagstoreShardInfo, error) {
|
||||
return *new([]DagstoreShardInfo), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *StorageMinerStruct) DagstorePieceIndexSize(p0 context.Context) (int64, error) {
|
||||
if s.Internal.DagstorePieceIndexSize == nil {
|
||||
return 0, ErrNotSupported
|
||||
}
|
||||
return s.Internal.DagstorePieceIndexSize(p0)
|
||||
}
|
||||
|
||||
func (s *StorageMinerStub) DagstorePieceIndexSize(p0 context.Context) (int64, error) {
|
||||
return 0, ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *StorageMinerStruct) DagstoreRecoverShard(p0 context.Context, p1 string) error {
|
||||
if s.Internal.DagstoreRecoverShard == nil {
|
||||
return ErrNotSupported
|
||||
@@ -3962,6 +4074,28 @@ func (s *StorageMinerStub) DealsSetPieceCidBlocklist(p0 context.Context, p1 []ci
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *StorageMinerStruct) IndexerAnnounceAllDeals(p0 context.Context) error {
|
||||
if s.Internal.IndexerAnnounceAllDeals == nil {
|
||||
return ErrNotSupported
|
||||
}
|
||||
return s.Internal.IndexerAnnounceAllDeals(p0)
|
||||
}
|
||||
|
||||
func (s *StorageMinerStub) IndexerAnnounceAllDeals(p0 context.Context) error {
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *StorageMinerStruct) IndexerAnnounceDeal(p0 context.Context, p1 cid.Cid) error {
|
||||
if s.Internal.IndexerAnnounceDeal == nil {
|
||||
return ErrNotSupported
|
||||
}
|
||||
return s.Internal.IndexerAnnounceDeal(p0, p1)
|
||||
}
|
||||
|
||||
func (s *StorageMinerStub) IndexerAnnounceDeal(p0 context.Context, p1 cid.Cid) error {
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *StorageMinerStruct) MarketCancelDataTransfer(p0 context.Context, p1 datatransfer.TransferID, p2 peer.ID, p3 bool) error {
|
||||
if s.Internal.MarketCancelDataTransfer == nil {
|
||||
return ErrNotSupported
|
||||
@@ -3973,6 +4107,17 @@ func (s *StorageMinerStub) MarketCancelDataTransfer(p0 context.Context, p1 datat
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *StorageMinerStruct) MarketDataTransferDiagnostics(p0 context.Context, p1 peer.ID) (*TransferDiagnostics, error) {
|
||||
if s.Internal.MarketDataTransferDiagnostics == nil {
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
return s.Internal.MarketDataTransferDiagnostics(p0, p1)
|
||||
}
|
||||
|
||||
func (s *StorageMinerStub) MarketDataTransferDiagnostics(p0 context.Context, p1 peer.ID) (*TransferDiagnostics, error) {
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *StorageMinerStruct) MarketDataTransferUpdates(p0 context.Context) (<-chan DataTransferChannel, error) {
|
||||
if s.Internal.MarketDataTransferUpdates == nil {
|
||||
return nil, ErrNotSupported
|
||||
@@ -4721,6 +4866,17 @@ func (s *StorageMinerStub) StorageFindSector(p0 context.Context, p1 abi.SectorID
|
||||
return *new([]stores.SectorStorageInfo), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *StorageMinerStruct) StorageGetLocks(p0 context.Context) (storiface.SectorLocks, error) {
|
||||
if s.Internal.StorageGetLocks == nil {
|
||||
return *new(storiface.SectorLocks), ErrNotSupported
|
||||
}
|
||||
return s.Internal.StorageGetLocks(p0)
|
||||
}
|
||||
|
||||
func (s *StorageMinerStub) StorageGetLocks(p0 context.Context) (storiface.SectorLocks, error) {
|
||||
return *new(storiface.SectorLocks), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *StorageMinerStruct) StorageInfo(p0 context.Context, p1 stores.ID) (stores.StorageInfo, error) {
|
||||
if s.Internal.StorageInfo == nil {
|
||||
return *new(stores.StorageInfo), ErrNotSupported
|
||||
|
||||
@@ -10,7 +10,9 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/ipfs/go-graphsync"
|
||||
|
||||
"github.com/libp2p/go-libp2p-core/network"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
@@ -53,6 +55,30 @@ type MessageSendSpec struct {
|
||||
MaxFee abi.TokenAmount
|
||||
}
|
||||
|
||||
// GraphSyncDataTransfer provides diagnostics on a data transfer happening over graphsync
|
||||
type GraphSyncDataTransfer struct {
|
||||
// GraphSync request id for this transfer
|
||||
RequestID graphsync.RequestID
|
||||
// Graphsync state for this transfer
|
||||
RequestState string
|
||||
// If a channel ID is present, indicates whether this is the current graphsync request for this channel
|
||||
// (could have changed in a restart)
|
||||
IsCurrentChannelRequest bool
|
||||
// Data transfer channel ID for this transfer
|
||||
ChannelID *datatransfer.ChannelID
|
||||
// Data transfer state for this transfer
|
||||
ChannelState *DataTransferChannel
|
||||
// Diagnostic information about this request -- and unexpected inconsistencies in
|
||||
// request state
|
||||
Diagnostics []string
|
||||
}
|
||||
|
||||
// TransferDiagnostics give current information about transfers going over graphsync that may be helpful for debugging
|
||||
type TransferDiagnostics struct {
|
||||
ReceivingTransfers []*GraphSyncDataTransfer
|
||||
SendingTransfers []*GraphSyncDataTransfer
|
||||
}
|
||||
|
||||
type DataTransferChannel struct {
|
||||
TransferID datatransfer.TransferID
|
||||
Status datatransfer.Status
|
||||
@@ -104,6 +130,28 @@ type NetBlockList struct {
|
||||
IPSubnets []string
|
||||
}
|
||||
|
||||
type NetStat struct {
|
||||
System *network.ScopeStat `json:",omitempty"`
|
||||
Transient *network.ScopeStat `json:",omitempty"`
|
||||
Services map[string]network.ScopeStat `json:",omitempty"`
|
||||
Protocols map[string]network.ScopeStat `json:",omitempty"`
|
||||
Peers map[string]network.ScopeStat `json:",omitempty"`
|
||||
}
|
||||
|
||||
type NetLimit struct {
|
||||
Dynamic bool `json:",omitempty"`
|
||||
// set if Dynamic is false
|
||||
Memory int64 `json:",omitempty"`
|
||||
// set if Dynamic is true
|
||||
MemoryFraction float64 `json:",omitempty"`
|
||||
MinMemory int64 `json:",omitempty"`
|
||||
MaxMemory int64 `json:",omitempty"`
|
||||
|
||||
Streams, StreamsInbound, StreamsOutbound int
|
||||
Conns, ConnsInbound, ConnsOutbound int
|
||||
FD int
|
||||
}
|
||||
|
||||
type ExtendedPeerInfo struct {
|
||||
ID peer.ID
|
||||
Agent string
|
||||
|
||||
@@ -1724,6 +1724,21 @@ func (mr *MockFullNodeMockRecorder) NetFindPeer(arg0, arg1 interface{}) *gomock.
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetFindPeer", reflect.TypeOf((*MockFullNode)(nil).NetFindPeer), arg0, arg1)
|
||||
}
|
||||
|
||||
// NetLimit mocks base method.
|
||||
func (m *MockFullNode) NetLimit(arg0 context.Context, arg1 string) (api.NetLimit, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "NetLimit", arg0, arg1)
|
||||
ret0, _ := ret[0].(api.NetLimit)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// NetLimit indicates an expected call of NetLimit.
|
||||
func (mr *MockFullNodeMockRecorder) NetLimit(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetLimit", reflect.TypeOf((*MockFullNode)(nil).NetLimit), arg0, arg1)
|
||||
}
|
||||
|
||||
// NetPeerInfo mocks base method.
|
||||
func (m *MockFullNode) NetPeerInfo(arg0 context.Context, arg1 peer.ID) (*api.ExtendedPeerInfo, error) {
|
||||
m.ctrl.T.Helper()
|
||||
@@ -1754,6 +1769,49 @@ func (mr *MockFullNodeMockRecorder) NetPeers(arg0 interface{}) *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetPeers", reflect.TypeOf((*MockFullNode)(nil).NetPeers), arg0)
|
||||
}
|
||||
|
||||
// NetProtectAdd mocks base method.
|
||||
func (m *MockFullNode) NetProtectAdd(arg0 context.Context, arg1 []peer.ID) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "NetProtectAdd", arg0, arg1)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// NetProtectAdd indicates an expected call of NetProtectAdd.
|
||||
func (mr *MockFullNodeMockRecorder) NetProtectAdd(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetProtectAdd", reflect.TypeOf((*MockFullNode)(nil).NetProtectAdd), arg0, arg1)
|
||||
}
|
||||
|
||||
// NetProtectList mocks base method.
|
||||
func (m *MockFullNode) NetProtectList(arg0 context.Context) ([]peer.ID, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "NetProtectList", arg0)
|
||||
ret0, _ := ret[0].([]peer.ID)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// NetProtectList indicates an expected call of NetProtectList.
|
||||
func (mr *MockFullNodeMockRecorder) NetProtectList(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetProtectList", reflect.TypeOf((*MockFullNode)(nil).NetProtectList), arg0)
|
||||
}
|
||||
|
||||
// NetProtectRemove mocks base method.
|
||||
func (m *MockFullNode) NetProtectRemove(arg0 context.Context, arg1 []peer.ID) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "NetProtectRemove", arg0, arg1)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// NetProtectRemove indicates an expected call of NetProtectRemove.
|
||||
func (mr *MockFullNodeMockRecorder) NetProtectRemove(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetProtectRemove", reflect.TypeOf((*MockFullNode)(nil).NetProtectRemove), arg0, arg1)
|
||||
}
|
||||
|
||||
// NetPubsubScores mocks base method.
|
||||
func (m *MockFullNode) NetPubsubScores(arg0 context.Context) ([]api.PubsubScore, error) {
|
||||
m.ctrl.T.Helper()
|
||||
@@ -1769,6 +1827,35 @@ func (mr *MockFullNodeMockRecorder) NetPubsubScores(arg0 interface{}) *gomock.Ca
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetPubsubScores", reflect.TypeOf((*MockFullNode)(nil).NetPubsubScores), arg0)
|
||||
}
|
||||
|
||||
// NetSetLimit mocks base method.
|
||||
func (m *MockFullNode) NetSetLimit(arg0 context.Context, arg1 string, arg2 api.NetLimit) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "NetSetLimit", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// NetSetLimit indicates an expected call of NetSetLimit.
|
||||
func (mr *MockFullNodeMockRecorder) NetSetLimit(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetSetLimit", reflect.TypeOf((*MockFullNode)(nil).NetSetLimit), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// NetStat mocks base method.
|
||||
func (m *MockFullNode) NetStat(arg0 context.Context, arg1 string) (api.NetStat, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "NetStat", arg0, arg1)
|
||||
ret0, _ := ret[0].(api.NetStat)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// NetStat indicates an expected call of NetStat.
|
||||
func (mr *MockFullNodeMockRecorder) NetStat(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetStat", reflect.TypeOf((*MockFullNode)(nil).NetStat), arg0, arg1)
|
||||
}
|
||||
|
||||
// PaychAllocateLane mocks base method.
|
||||
func (m *MockFullNode) PaychAllocateLane(arg0 context.Context, arg1 address.Address) (uint64, error) {
|
||||
m.ctrl.T.Helper()
|
||||
|
||||
@@ -10,20 +10,12 @@ import (
|
||||
|
||||
var errMarkSetClosed = errors.New("markset closed")
|
||||
|
||||
// MarkSet is a utility to keep track of seen CID, and later query for them.
|
||||
//
|
||||
// * If the expected dataset is large, it can be backed by a datastore (e.g. bbolt).
|
||||
// * If a probabilistic result is acceptable, it can be backed by a bloom filter
|
||||
// MarkSet is an interface for tracking CIDs during chain and object walks
|
||||
type MarkSet interface {
|
||||
ObjectVisitor
|
||||
Mark(cid.Cid) error
|
||||
Has(cid.Cid) (bool, error)
|
||||
Close() error
|
||||
SetConcurrent()
|
||||
}
|
||||
|
||||
type MarkSetVisitor interface {
|
||||
MarkSet
|
||||
ObjectVisitor
|
||||
}
|
||||
|
||||
type MarkSetEnv interface {
|
||||
@@ -31,11 +23,7 @@ type MarkSetEnv interface {
|
||||
// name is a unique name for this markset, mapped to the filesystem in disk-backed environments
|
||||
// sizeHint is a hint about the expected size of the markset
|
||||
Create(name string, sizeHint int64) (MarkSet, error)
|
||||
// CreateVisitor is like Create, but returns a wider interface that supports atomic visits.
|
||||
// It may not be supported by some markset types (e.g. bloom).
|
||||
CreateVisitor(name string, sizeHint int64) (MarkSetVisitor, error)
|
||||
// SupportsVisitor returns true if the marksets created by this environment support the visitor interface.
|
||||
SupportsVisitor() bool
|
||||
// Close closes the markset
|
||||
Close() error
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ type BadgerMarkSet struct {
|
||||
}
|
||||
|
||||
var _ MarkSet = (*BadgerMarkSet)(nil)
|
||||
var _ MarkSetVisitor = (*BadgerMarkSet)(nil)
|
||||
|
||||
var badgerMarkSetBatchSize = 16384
|
||||
|
||||
@@ -48,7 +47,7 @@ func NewBadgerMarkSetEnv(path string) (MarkSetEnv, error) {
|
||||
return &BadgerMarkSetEnv{path: msPath}, nil
|
||||
}
|
||||
|
||||
func (e *BadgerMarkSetEnv) create(name string, sizeHint int64) (*BadgerMarkSet, error) {
|
||||
func (e *BadgerMarkSetEnv) Create(name string, sizeHint int64) (MarkSet, error) {
|
||||
name += ".tmp"
|
||||
path := filepath.Join(e.path, name)
|
||||
|
||||
@@ -68,16 +67,6 @@ func (e *BadgerMarkSetEnv) create(name string, sizeHint int64) (*BadgerMarkSet,
|
||||
return ms, nil
|
||||
}
|
||||
|
||||
func (e *BadgerMarkSetEnv) Create(name string, sizeHint int64) (MarkSet, error) {
|
||||
return e.create(name, sizeHint)
|
||||
}
|
||||
|
||||
func (e *BadgerMarkSetEnv) CreateVisitor(name string, sizeHint int64) (MarkSetVisitor, error) {
|
||||
return e.create(name, sizeHint)
|
||||
}
|
||||
|
||||
func (e *BadgerMarkSetEnv) SupportsVisitor() bool { return true }
|
||||
|
||||
func (e *BadgerMarkSetEnv) Close() error {
|
||||
return os.RemoveAll(e.path)
|
||||
}
|
||||
|
||||
@@ -13,42 +13,27 @@ var _ MarkSetEnv = (*MapMarkSetEnv)(nil)
|
||||
type MapMarkSet struct {
|
||||
mx sync.RWMutex
|
||||
set map[string]struct{}
|
||||
|
||||
ts bool
|
||||
}
|
||||
|
||||
var _ MarkSet = (*MapMarkSet)(nil)
|
||||
var _ MarkSetVisitor = (*MapMarkSet)(nil)
|
||||
|
||||
func NewMapMarkSetEnv() (*MapMarkSetEnv, error) {
|
||||
return &MapMarkSetEnv{}, nil
|
||||
}
|
||||
|
||||
func (e *MapMarkSetEnv) create(name string, sizeHint int64) (*MapMarkSet, error) {
|
||||
func (e *MapMarkSetEnv) Create(name string, sizeHint int64) (MarkSet, error) {
|
||||
return &MapMarkSet{
|
||||
set: make(map[string]struct{}, sizeHint),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (e *MapMarkSetEnv) Create(name string, sizeHint int64) (MarkSet, error) {
|
||||
return e.create(name, sizeHint)
|
||||
}
|
||||
|
||||
func (e *MapMarkSetEnv) CreateVisitor(name string, sizeHint int64) (MarkSetVisitor, error) {
|
||||
return e.create(name, sizeHint)
|
||||
}
|
||||
|
||||
func (e *MapMarkSetEnv) SupportsVisitor() bool { return true }
|
||||
|
||||
func (e *MapMarkSetEnv) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *MapMarkSet) Mark(cid cid.Cid) error {
|
||||
if s.ts {
|
||||
s.mx.Lock()
|
||||
defer s.mx.Unlock()
|
||||
}
|
||||
s.mx.Lock()
|
||||
defer s.mx.Unlock()
|
||||
|
||||
if s.set == nil {
|
||||
return errMarkSetClosed
|
||||
@@ -59,10 +44,8 @@ func (s *MapMarkSet) Mark(cid cid.Cid) error {
|
||||
}
|
||||
|
||||
func (s *MapMarkSet) Has(cid cid.Cid) (bool, error) {
|
||||
if s.ts {
|
||||
s.mx.RLock()
|
||||
defer s.mx.RUnlock()
|
||||
}
|
||||
s.mx.RLock()
|
||||
defer s.mx.RUnlock()
|
||||
|
||||
if s.set == nil {
|
||||
return false, errMarkSetClosed
|
||||
@@ -73,10 +56,8 @@ func (s *MapMarkSet) Has(cid cid.Cid) (bool, error) {
|
||||
}
|
||||
|
||||
func (s *MapMarkSet) Visit(c cid.Cid) (bool, error) {
|
||||
if s.ts {
|
||||
s.mx.Lock()
|
||||
defer s.mx.Unlock()
|
||||
}
|
||||
s.mx.Lock()
|
||||
defer s.mx.Unlock()
|
||||
|
||||
if s.set == nil {
|
||||
return false, errMarkSetClosed
|
||||
@@ -92,14 +73,9 @@ func (s *MapMarkSet) Visit(c cid.Cid) (bool, error) {
|
||||
}
|
||||
|
||||
func (s *MapMarkSet) Close() error {
|
||||
if s.ts {
|
||||
s.mx.Lock()
|
||||
defer s.mx.Unlock()
|
||||
}
|
||||
s.mx.Lock()
|
||||
defer s.mx.Unlock()
|
||||
|
||||
s.set = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *MapMarkSet) SetConcurrent() {
|
||||
s.ts = true
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ func testMarkSetVisitor(t *testing.T, lsType string) {
|
||||
}
|
||||
defer env.Close() //nolint:errcheck
|
||||
|
||||
visitor, err := env.CreateVisitor("test", 0)
|
||||
visitor, err := env.Create("test", 0)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -186,10 +186,6 @@ func Open(path string, ds dstore.Datastore, hot, cold bstore.Blockstore, cfg *Co
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !markSetEnv.SupportsVisitor() {
|
||||
return nil, xerrors.Errorf("markset type does not support atomic visitors")
|
||||
}
|
||||
|
||||
// and now we can make a SplitStore
|
||||
ss := &SplitStore{
|
||||
cfg: cfg,
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
@@ -67,7 +68,10 @@ func (s *SplitStore) doCheck(curTs *types.TipSet) error {
|
||||
}
|
||||
defer output.Close() //nolint:errcheck
|
||||
|
||||
var mx sync.Mutex
|
||||
write := func(format string, args ...interface{}) {
|
||||
mx.Lock()
|
||||
defer mx.Unlock()
|
||||
_, err := fmt.Fprintf(output, format+"\n", args...)
|
||||
if err != nil {
|
||||
log.Warnf("error writing check output: %s", err)
|
||||
@@ -82,9 +86,10 @@ func (s *SplitStore) doCheck(curTs *types.TipSet) error {
|
||||
write("compaction index: %d", s.compactionIndex)
|
||||
write("--")
|
||||
|
||||
var coldCnt, missingCnt int64
|
||||
coldCnt := new(int64)
|
||||
missingCnt := new(int64)
|
||||
|
||||
visitor, err := s.markSetEnv.CreateVisitor("check", 0)
|
||||
visitor, err := s.markSetEnv.Create("check", 0)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("error creating visitor: %w", err)
|
||||
}
|
||||
@@ -111,10 +116,10 @@ func (s *SplitStore) doCheck(curTs *types.TipSet) error {
|
||||
}
|
||||
|
||||
if has {
|
||||
coldCnt++
|
||||
atomic.AddInt64(coldCnt, 1)
|
||||
write("cold object reference: %s", c)
|
||||
} else {
|
||||
missingCnt++
|
||||
atomic.AddInt64(missingCnt, 1)
|
||||
write("missing object reference: %s", c)
|
||||
return errStopWalk
|
||||
}
|
||||
@@ -128,9 +133,9 @@ func (s *SplitStore) doCheck(curTs *types.TipSet) error {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Infow("check done", "cold", coldCnt, "missing", missingCnt)
|
||||
log.Infow("check done", "cold", *coldCnt, "missing", *missingCnt)
|
||||
write("--")
|
||||
write("cold: %d missing: %d", coldCnt, missingCnt)
|
||||
write("cold: %d missing: %d", *coldCnt, *missingCnt)
|
||||
write("DONE")
|
||||
|
||||
return nil
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"runtime"
|
||||
"sort"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
@@ -227,7 +228,7 @@ func (s *SplitStore) trackTxnRefMany(cids []cid.Cid) {
|
||||
}
|
||||
|
||||
// protect all pending transactional references
|
||||
func (s *SplitStore) protectTxnRefs(markSet MarkSetVisitor) error {
|
||||
func (s *SplitStore) protectTxnRefs(markSet MarkSet) error {
|
||||
for {
|
||||
var txnRefs map[cid.Cid]struct{}
|
||||
|
||||
@@ -299,14 +300,14 @@ func (s *SplitStore) protectTxnRefs(markSet MarkSetVisitor) error {
|
||||
|
||||
// transactionally protect a reference by walking the object and marking.
|
||||
// concurrent markings are short circuited by checking the markset.
|
||||
func (s *SplitStore) doTxnProtect(root cid.Cid, markSet MarkSetVisitor) error {
|
||||
func (s *SplitStore) doTxnProtect(root cid.Cid, markSet MarkSet) error {
|
||||
if err := s.checkClosing(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Note: cold objects are deleted heaviest first, so the consituents of an object
|
||||
// cannot be deleted before the object itself.
|
||||
return s.walkObjectIncomplete(root, tmpVisitor(),
|
||||
return s.walkObjectIncomplete(root, newTmpVisitor(),
|
||||
func(c cid.Cid) error {
|
||||
if isUnitaryObject(c) {
|
||||
return errStopWalk
|
||||
@@ -397,7 +398,7 @@ func (s *SplitStore) doCompact(curTs *types.TipSet) error {
|
||||
|
||||
log.Infow("running compaction", "currentEpoch", currentEpoch, "baseEpoch", s.baseEpoch, "boundaryEpoch", boundaryEpoch, "inclMsgsEpoch", inclMsgsEpoch, "compactionIndex", s.compactionIndex)
|
||||
|
||||
markSet, err := s.markSetEnv.CreateVisitor("live", s.markSetSize)
|
||||
markSet, err := s.markSetEnv.Create("live", s.markSetSize)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("error creating mark set: %w", err)
|
||||
}
|
||||
@@ -602,8 +603,8 @@ func (s *SplitStore) beginTxnProtect() {
|
||||
s.txnMissing = make(map[cid.Cid]struct{})
|
||||
}
|
||||
|
||||
func (s *SplitStore) beginTxnMarking(markSet MarkSetVisitor) {
|
||||
markSet.SetConcurrent()
|
||||
func (s *SplitStore) beginTxnMarking(markSet MarkSet) {
|
||||
log.Info("beginning transactional marking")
|
||||
}
|
||||
|
||||
func (s *SplitStore) endTxnProtect() {
|
||||
@@ -621,26 +622,33 @@ func (s *SplitStore) endTxnProtect() {
|
||||
|
||||
func (s *SplitStore) walkChain(ts *types.TipSet, inclState, inclMsgs abi.ChainEpoch,
|
||||
visitor ObjectVisitor, f func(cid.Cid) error) error {
|
||||
var walked *cid.Set
|
||||
toWalk := ts.Cids()
|
||||
walkCnt := 0
|
||||
scanCnt := 0
|
||||
var walked ObjectVisitor
|
||||
var mx sync.Mutex
|
||||
// we copy the tipset first into a new slice, which allows us to reuse it in every epoch.
|
||||
toWalk := make([]cid.Cid, len(ts.Cids()))
|
||||
copy(toWalk, ts.Cids())
|
||||
walkCnt := new(int64)
|
||||
scanCnt := new(int64)
|
||||
|
||||
stopWalk := func(_ cid.Cid) error { return errStopWalk }
|
||||
|
||||
walkBlock := func(c cid.Cid) error {
|
||||
if !walked.Visit(c) {
|
||||
visit, err := walked.Visit(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !visit {
|
||||
return nil
|
||||
}
|
||||
|
||||
walkCnt++
|
||||
atomic.AddInt64(walkCnt, 1)
|
||||
|
||||
if err := f(c); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var hdr types.BlockHeader
|
||||
err := s.view(c, func(data []byte) error {
|
||||
err = s.view(c, func(data []byte) error {
|
||||
return hdr.UnmarshalCBOR(bytes.NewBuffer(data))
|
||||
})
|
||||
|
||||
@@ -676,11 +684,13 @@ func (s *SplitStore) walkChain(ts *types.TipSet, inclState, inclMsgs abi.ChainEp
|
||||
if err := s.walkObject(hdr.ParentStateRoot, visitor, f); err != nil {
|
||||
return xerrors.Errorf("error walking state root (cid: %s): %w", hdr.ParentStateRoot, err)
|
||||
}
|
||||
scanCnt++
|
||||
atomic.AddInt64(scanCnt, 1)
|
||||
}
|
||||
|
||||
if hdr.Height > 0 {
|
||||
mx.Lock()
|
||||
toWalk = append(toWalk, hdr.Parents...)
|
||||
mx.Unlock()
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -692,20 +702,43 @@ func (s *SplitStore) walkChain(ts *types.TipSet, inclState, inclMsgs abi.ChainEp
|
||||
return err
|
||||
}
|
||||
|
||||
workers := len(toWalk)
|
||||
if workers > runtime.NumCPU()/2 {
|
||||
workers = runtime.NumCPU() / 2
|
||||
}
|
||||
if workers < 2 {
|
||||
workers = 2
|
||||
}
|
||||
|
||||
// the walk is BFS, so we can reset the walked set in every iteration and avoid building up
|
||||
// a set that contains all blocks (1M epochs -> 5M blocks -> 200MB worth of memory and growing
|
||||
// over time)
|
||||
walked = cid.NewSet()
|
||||
walking := toWalk
|
||||
toWalk = nil
|
||||
for _, c := range walking {
|
||||
if err := walkBlock(c); err != nil {
|
||||
return xerrors.Errorf("error walking block (cid: %s): %w", c, err)
|
||||
}
|
||||
walked = newConcurrentVisitor()
|
||||
workch := make(chan cid.Cid, len(toWalk))
|
||||
for _, c := range toWalk {
|
||||
workch <- c
|
||||
}
|
||||
close(workch)
|
||||
toWalk = toWalk[:0]
|
||||
|
||||
g := new(errgroup.Group)
|
||||
for i := 0; i < workers; i++ {
|
||||
g.Go(func() error {
|
||||
for c := range workch {
|
||||
if err := walkBlock(c); err != nil {
|
||||
return xerrors.Errorf("error walking block (cid: %s): %w", c, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
if err := g.Wait(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
log.Infow("chain walk done", "walked", walkCnt, "scanned", scanCnt)
|
||||
log.Infow("chain walk done", "walked", *walkCnt, "scanned", *scanCnt)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1011,7 +1044,7 @@ func (s *SplitStore) purgeBatch(cids []cid.Cid, deleteBatch func([]cid.Cid) erro
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *SplitStore) purge(cids []cid.Cid, markSet MarkSetVisitor) error {
|
||||
func (s *SplitStore) purge(cids []cid.Cid, markSet MarkSet) error {
|
||||
deadCids := make([]cid.Cid, 0, batchSize)
|
||||
var purgeCnt, liveCnt int
|
||||
defer func() {
|
||||
@@ -1077,7 +1110,7 @@ func (s *SplitStore) purge(cids []cid.Cid, markSet MarkSetVisitor) error {
|
||||
// have this gem[TM].
|
||||
// My best guess is that they are parent message receipts or yet to be computed state roots; magik
|
||||
// thinks the cause may be block validation.
|
||||
func (s *SplitStore) waitForMissingRefs(markSet MarkSetVisitor) {
|
||||
func (s *SplitStore) waitForMissingRefs(markSet MarkSet) {
|
||||
s.txnLk.Lock()
|
||||
missing := s.txnMissing
|
||||
s.txnMissing = nil
|
||||
@@ -1106,7 +1139,7 @@ func (s *SplitStore) waitForMissingRefs(markSet MarkSetVisitor) {
|
||||
}
|
||||
|
||||
towalk := missing
|
||||
visitor := tmpVisitor()
|
||||
visitor := newTmpVisitor()
|
||||
missing = make(map[cid.Cid]struct{})
|
||||
|
||||
for c := range towalk {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package splitstore
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
@@ -55,12 +56,13 @@ func (s *SplitStore) doWarmup(curTs *types.TipSet) error {
|
||||
if WarmupBoundary < epoch {
|
||||
boundaryEpoch = epoch - WarmupBoundary
|
||||
}
|
||||
var mx sync.Mutex
|
||||
batchHot := make([]blocks.Block, 0, batchSize)
|
||||
count := int64(0)
|
||||
xcount := int64(0)
|
||||
missing := int64(0)
|
||||
count := new(int64)
|
||||
xcount := new(int64)
|
||||
missing := new(int64)
|
||||
|
||||
visitor, err := s.markSetEnv.CreateVisitor("warmup", 0)
|
||||
visitor, err := s.markSetEnv.Create("warmup", 0)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("error creating visitor: %w", err)
|
||||
}
|
||||
@@ -73,7 +75,7 @@ func (s *SplitStore) doWarmup(curTs *types.TipSet) error {
|
||||
return errStopWalk
|
||||
}
|
||||
|
||||
count++
|
||||
atomic.AddInt64(count, 1)
|
||||
|
||||
has, err := s.hot.Has(s.ctx, c)
|
||||
if err != nil {
|
||||
@@ -87,22 +89,25 @@ func (s *SplitStore) doWarmup(curTs *types.TipSet) error {
|
||||
blk, err := s.cold.Get(s.ctx, c)
|
||||
if err != nil {
|
||||
if err == bstore.ErrNotFound {
|
||||
missing++
|
||||
atomic.AddInt64(missing, 1)
|
||||
return errStopWalk
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
xcount++
|
||||
atomic.AddInt64(xcount, 1)
|
||||
|
||||
mx.Lock()
|
||||
batchHot = append(batchHot, blk)
|
||||
if len(batchHot) == batchSize {
|
||||
err = s.hot.PutMany(s.ctx, batchHot)
|
||||
if err != nil {
|
||||
mx.Unlock()
|
||||
return err
|
||||
}
|
||||
batchHot = batchHot[:0]
|
||||
}
|
||||
mx.Unlock()
|
||||
|
||||
return nil
|
||||
})
|
||||
@@ -118,9 +123,9 @@ func (s *SplitStore) doWarmup(curTs *types.TipSet) error {
|
||||
}
|
||||
}
|
||||
|
||||
log.Infow("warmup stats", "visited", count, "warm", xcount, "missing", missing)
|
||||
log.Infow("warmup stats", "visited", *count, "warm", *xcount, "missing", *missing)
|
||||
|
||||
s.markSetSize = count + count>>2 // overestimate a bit
|
||||
s.markSetSize = *count + *count>>2 // overestimate a bit
|
||||
err = s.ds.Put(s.ctx, markSetSizeKey, int64ToBytes(s.markSetSize))
|
||||
if err != nil {
|
||||
log.Warnf("error saving mark set size: %s", err)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package splitstore
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
cid "github.com/ipfs/go-cid"
|
||||
)
|
||||
|
||||
@@ -17,16 +19,34 @@ func (v *noopVisitor) Visit(_ cid.Cid) (bool, error) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
type cidSetVisitor struct {
|
||||
type tmpVisitor struct {
|
||||
set *cid.Set
|
||||
}
|
||||
|
||||
var _ ObjectVisitor = (*cidSetVisitor)(nil)
|
||||
var _ ObjectVisitor = (*tmpVisitor)(nil)
|
||||
|
||||
func (v *cidSetVisitor) Visit(c cid.Cid) (bool, error) {
|
||||
func (v *tmpVisitor) Visit(c cid.Cid) (bool, error) {
|
||||
return v.set.Visit(c), nil
|
||||
}
|
||||
|
||||
func tmpVisitor() ObjectVisitor {
|
||||
return &cidSetVisitor{set: cid.NewSet()}
|
||||
func newTmpVisitor() ObjectVisitor {
|
||||
return &tmpVisitor{set: cid.NewSet()}
|
||||
}
|
||||
|
||||
type concurrentVisitor struct {
|
||||
mx sync.Mutex
|
||||
set *cid.Set
|
||||
}
|
||||
|
||||
var _ ObjectVisitor = (*concurrentVisitor)(nil)
|
||||
|
||||
func newConcurrentVisitor() *concurrentVisitor {
|
||||
return &concurrentVisitor{set: cid.NewSet()}
|
||||
}
|
||||
|
||||
func (v *concurrentVisitor) Visit(c cid.Cid) (bool, error) {
|
||||
v.mx.Lock()
|
||||
defer v.mx.Unlock()
|
||||
|
||||
return v.set.Visit(c), nil
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -90,6 +90,7 @@ func init() {
|
||||
UpgradeTurboHeight = getUpgradeHeight("LOTUS_ACTORSV4_HEIGHT", UpgradeTurboHeight)
|
||||
UpgradeHyperdriveHeight = getUpgradeHeight("LOTUS_HYPERDRIVE_HEIGHT", UpgradeHyperdriveHeight)
|
||||
UpgradeChocolateHeight = getUpgradeHeight("LOTUS_CHOCOLATE_HEIGHT", UpgradeChocolateHeight)
|
||||
UpgradeOhSnapHeight = getUpgradeHeight("LOTUS_OHSNAP_HEIGHT", UpgradeOhSnapHeight)
|
||||
|
||||
BuildType |= Build2k
|
||||
|
||||
|
||||
@@ -13,6 +13,17 @@ import (
|
||||
|
||||
func BlocksTopic(netName dtypes.NetworkName) string { return "/fil/blocks/" + string(netName) }
|
||||
func MessagesTopic(netName dtypes.NetworkName) string { return "/fil/msgs/" + string(netName) }
|
||||
func IndexerIngestTopic(netName dtypes.NetworkName) string {
|
||||
|
||||
nn := string(netName)
|
||||
// The network name testnetnet is here for historical reasons.
|
||||
// Going forward we aim to use the name `mainnet` where possible.
|
||||
if nn == "testnetnet" {
|
||||
nn = "mainnet"
|
||||
}
|
||||
|
||||
return "/indexer/ingest/" + nn
|
||||
}
|
||||
func DhtProtocolName(netName dtypes.NetworkName) protocol.ID {
|
||||
return protocol.ID("/fil/kad/" + string(netName))
|
||||
}
|
||||
|
||||
@@ -1,54 +1,4 @@
|
||||
{
|
||||
"v28-empty-sector-update-merkletree-poseidon_hasher-8-0-0-61fa69f38b9cc771ba27b670124714b4ea77fbeae05e377fb859c4a43b73a30c.params": {
|
||||
"cid": "Qma5WL6abSqYg9uUQAZ3EHS286bsNsha7oAGsJBD48Bq2q",
|
||||
"digest": "c3ad7bb549470b82ad52ed070aebb4f4",
|
||||
"sector_size": 536870912
|
||||
},
|
||||
"v28-empty-sector-update-merkletree-poseidon_hasher-8-0-0-61fa69f38b9cc771ba27b670124714b4ea77fbeae05e377fb859c4a43b73a30c.vk": {
|
||||
"cid": "QmUa7f9JtJMsqJJ3s3ZXk6WyF4xJLE8FiqYskZGgk8GCDv",
|
||||
"digest": "994c5b7d450ca9da348c910689f2dc7f",
|
||||
"sector_size": 536870912
|
||||
},
|
||||
"v28-empty-sector-update-merkletree-poseidon_hasher-8-0-0-92180959e1918d26350b8e6cfe217bbdd0a2d8de51ebec269078b364b715ad63.params": {
|
||||
"cid": "QmQiT4qBGodrVNEgVTDXxBNDdPbaD8Ag7Sx3ZTq1zHX79S",
|
||||
"digest": "5aedd2cf3e5c0a15623d56a1b43110ad",
|
||||
"sector_size": 8388608
|
||||
},
|
||||
"v28-empty-sector-update-merkletree-poseidon_hasher-8-0-0-92180959e1918d26350b8e6cfe217bbdd0a2d8de51ebec269078b364b715ad63.vk": {
|
||||
"cid": "QmdcpKUQvHM8RFRVKbk1yHfEqMcBzhtFWKRp9SNEmWq37i",
|
||||
"digest": "abd80269054d391a734febdac0d2e687",
|
||||
"sector_size": 8388608
|
||||
},
|
||||
"v28-empty-sector-update-merkletree-poseidon_hasher-8-0-0-fb9e095bebdd77511c0269b967b4d87ba8b8a525edaa0e165de23ba454510194.params": {
|
||||
"cid": "QmYM6Hg7mjmvA3ZHTsqkss1fkdyDju5dDmLiBZGJ5pz9y9",
|
||||
"digest": "311f92a3e75036ced01b1c0025f1fa0c",
|
||||
"sector_size": 2048
|
||||
},
|
||||
"v28-empty-sector-update-merkletree-poseidon_hasher-8-0-0-fb9e095bebdd77511c0269b967b4d87ba8b8a525edaa0e165de23ba454510194.vk": {
|
||||
"cid": "QmaQsTLL3nc5dw6wAvaioJSBfd1jhQrA2o6ucFf7XeV74P",
|
||||
"digest": "eadad9784969890d30f2749708c79771",
|
||||
"sector_size": 2048
|
||||
},
|
||||
"v28-empty-sector-update-merkletree-poseidon_hasher-8-8-0-3b7f44a9362e3985369454947bc94022e118211e49fd672d52bec1cbfd599d18.params": {
|
||||
"cid": "QmeNqDvsvyam4vqwCkstbxgb9S7RZEUeBDrJvBWKcpFKr6",
|
||||
"digest": "532b53883ed4f794cb9d0db583d0df59",
|
||||
"sector_size": 34359738368
|
||||
},
|
||||
"v28-empty-sector-update-merkletree-poseidon_hasher-8-8-0-3b7f44a9362e3985369454947bc94022e118211e49fd672d52bec1cbfd599d18.vk": {
|
||||
"cid": "QmdLWr6moLUPScJZwoBckWqAeJkrBPAJPNLz8mWAfTdmXH",
|
||||
"digest": "46990eb1bf5159c394a10309f269c1b6",
|
||||
"sector_size": 34359738368
|
||||
},
|
||||
"v28-empty-sector-update-merkletree-poseidon_hasher-8-8-2-102e1444a7e9a97ebf1e3d6855dcc77e66c011ea66f936d9b2c508f87f2f83a7.params": {
|
||||
"cid": "QmdQsi9uFhxK9cGwuK4rHuwKQoHkz6upYTCz4UdLiy1vA2",
|
||||
"digest": "4223c63dbd94de1538006a14f37179e3",
|
||||
"sector_size": 68719476736
|
||||
},
|
||||
"v28-empty-sector-update-merkletree-poseidon_hasher-8-8-2-102e1444a7e9a97ebf1e3d6855dcc77e66c011ea66f936d9b2c508f87f2f83a7.vk": {
|
||||
"cid": "QmPirFX9wX99iMGA6zFY2CvcrdcDkj73X4MP6DLduvpbk9",
|
||||
"digest": "ce39b614d788d3aef26bac1b28521d94",
|
||||
"sector_size": 68719476736
|
||||
},
|
||||
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-0170db1f394b35d995252228ee359194b13199d259380541dc529fb0099096b0.params": {
|
||||
"cid": "QmVxjFRyhmyQaZEtCh7nk2abc7LhFkzhnRX4rcHqCCpikR",
|
||||
"digest": "7610b9f82bfc88405b7a832b651ce2f6",
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ func BuildTypeString() string {
|
||||
}
|
||||
|
||||
// BuildVersion is the local build version
|
||||
const BuildVersion = "1.14.0-rc1"
|
||||
const BuildVersion = "1.15.0-dev"
|
||||
|
||||
func UserVersion() string {
|
||||
if os.Getenv("LOTUS_VERSION_IGNORE_COMMIT") == "1" {
|
||||
|
||||
@@ -92,16 +92,16 @@ func (t *TipSetExecutor) ApplyBlocks(ctx context.Context, sm *stmgr.StateManager
|
||||
partDone()
|
||||
}()
|
||||
|
||||
makeVmWithBaseState := func(base cid.Cid) (*vm.VM, error) {
|
||||
makeVmWithBaseStateAndEpoch := func(base cid.Cid, e abi.ChainEpoch) (*vm.VM, error) {
|
||||
vmopt := &vm.VMOpts{
|
||||
StateBase: base,
|
||||
Epoch: epoch,
|
||||
Epoch: e,
|
||||
Rand: r,
|
||||
Bstore: sm.ChainStore().StateBlockstore(),
|
||||
Actors: NewActorRegistry(),
|
||||
Syscalls: sm.Syscalls,
|
||||
CircSupplyCalc: sm.GetVMCirculatingSupply,
|
||||
NtwkVersion: sm.GetNtwkVersion,
|
||||
NetworkVersion: sm.GetNetworkVersion(ctx, e),
|
||||
BaseFee: baseFee,
|
||||
LookbackState: stmgr.LookbackStateGetterForTipset(sm, ts),
|
||||
}
|
||||
@@ -109,12 +109,7 @@ func (t *TipSetExecutor) ApplyBlocks(ctx context.Context, sm *stmgr.StateManager
|
||||
return sm.VMConstructor()(ctx, vmopt)
|
||||
}
|
||||
|
||||
vmi, err := makeVmWithBaseState(pstate)
|
||||
if err != nil {
|
||||
return cid.Undef, cid.Undef, xerrors.Errorf("making vm: %w", err)
|
||||
}
|
||||
|
||||
runCron := func(epoch abi.ChainEpoch) error {
|
||||
runCron := func(vmCron *vm.VM, epoch abi.ChainEpoch) error {
|
||||
cronMsg := &types.Message{
|
||||
To: cron.Address,
|
||||
From: builtin.SystemActorAddr,
|
||||
@@ -126,59 +121,58 @@ func (t *TipSetExecutor) ApplyBlocks(ctx context.Context, sm *stmgr.StateManager
|
||||
Method: cron.Methods.EpochTick,
|
||||
Params: nil,
|
||||
}
|
||||
ret, err := vmi.ApplyImplicitMessage(ctx, cronMsg)
|
||||
ret, err := vmCron.ApplyImplicitMessage(ctx, cronMsg)
|
||||
if err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("running cron: %w", err)
|
||||
}
|
||||
|
||||
if em != nil {
|
||||
if err := em.MessageApplied(ctx, ts, cronMsg.Cid(), cronMsg, ret, true); err != nil {
|
||||
return xerrors.Errorf("callback failed on cron message: %w", err)
|
||||
}
|
||||
}
|
||||
if ret.ExitCode != 0 {
|
||||
return xerrors.Errorf("CheckProofSubmissions exit was non-zero: %d", ret.ExitCode)
|
||||
return xerrors.Errorf("cron exit was non-zero: %d", ret.ExitCode)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := parentEpoch; i < epoch; i++ {
|
||||
var err error
|
||||
if i > parentEpoch {
|
||||
// run cron for null rounds if any
|
||||
if err := runCron(i); err != nil {
|
||||
return cid.Undef, cid.Undef, err
|
||||
vmCron, err := makeVmWithBaseStateAndEpoch(pstate, i)
|
||||
if err != nil {
|
||||
return cid.Undef, cid.Undef, xerrors.Errorf("making cron vm: %w", err)
|
||||
}
|
||||
|
||||
pstate, err = vmi.Flush(ctx)
|
||||
// run cron for null rounds if any
|
||||
if err = runCron(vmCron, i); err != nil {
|
||||
return cid.Undef, cid.Undef, xerrors.Errorf("running cron: %w", err)
|
||||
}
|
||||
|
||||
pstate, err = vmCron.Flush(ctx)
|
||||
if err != nil {
|
||||
return cid.Undef, cid.Undef, xerrors.Errorf("flushing vm: %w", err)
|
||||
return cid.Undef, cid.Undef, xerrors.Errorf("flushing cron vm: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
// handle state forks
|
||||
// XXX: The state tree
|
||||
newState, err := sm.HandleStateForks(ctx, pstate, i, em, ts)
|
||||
pstate, err = sm.HandleStateForks(ctx, pstate, i, em, ts)
|
||||
if err != nil {
|
||||
return cid.Undef, cid.Undef, xerrors.Errorf("error handling state forks: %w", err)
|
||||
}
|
||||
|
||||
if pstate != newState {
|
||||
vmi, err = makeVmWithBaseState(newState)
|
||||
if err != nil {
|
||||
return cid.Undef, cid.Undef, xerrors.Errorf("making vm: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if err = vmi.SetBlockHeight(ctx, i+1); err != nil {
|
||||
return cid.Undef, cid.Undef, xerrors.Errorf("error advancing vm an epoch: %w", err)
|
||||
}
|
||||
|
||||
pstate = newState
|
||||
}
|
||||
|
||||
partDone()
|
||||
partDone = metrics.Timer(ctx, metrics.VMApplyMessages)
|
||||
|
||||
vmi, err := makeVmWithBaseStateAndEpoch(pstate, epoch)
|
||||
if err != nil {
|
||||
return cid.Undef, cid.Undef, xerrors.Errorf("making vm: %w", err)
|
||||
}
|
||||
|
||||
var receipts []cbg.CBORMarshaler
|
||||
processedMsgs := make(map[cid.Cid]struct{})
|
||||
for _, b := range bms {
|
||||
@@ -246,7 +240,7 @@ func (t *TipSetExecutor) ApplyBlocks(ctx context.Context, sm *stmgr.StateManager
|
||||
partDone()
|
||||
partDone = metrics.Timer(ctx, metrics.VMApplyCron)
|
||||
|
||||
if err := runCron(epoch); err != nil {
|
||||
if err := runCron(vmi, epoch); err != nil {
|
||||
return cid.Cid{}, cid.Cid{}, err
|
||||
}
|
||||
|
||||
@@ -302,7 +296,7 @@ func (t *TipSetExecutor) ExecuteTipSet(ctx context.Context, sm *stmgr.StateManag
|
||||
parentEpoch = parent.Height
|
||||
}
|
||||
|
||||
r := rand.NewStateRand(sm.ChainStore(), ts.Cids(), sm.Beacon())
|
||||
r := rand.NewStateRand(sm.ChainStore(), ts.Cids(), sm.Beacon(), sm.GetNetworkVersion)
|
||||
|
||||
blkmsgs, err := sm.ChainStore().BlockMsgsForTipset(ctx, ts)
|
||||
if err != nil {
|
||||
|
||||
@@ -95,7 +95,7 @@ func (filec *FilecoinEC) ValidateBlock(ctx context.Context, b *types.FullBlock)
|
||||
return xerrors.Errorf("load parent tipset failed (%s): %w", h.Parents, err)
|
||||
}
|
||||
|
||||
winPoStNv := filec.sm.GetNtwkVersion(ctx, baseTs.Height())
|
||||
winPoStNv := filec.sm.GetNetworkVersion(ctx, baseTs.Height())
|
||||
|
||||
lbts, lbst, err := stmgr.GetLookbackTipSetForRound(ctx, filec.sm, baseTs, h.Height)
|
||||
if err != nil {
|
||||
@@ -182,7 +182,7 @@ func (filec *FilecoinEC) ValidateBlock(ctx context.Context, b *types.FullBlock)
|
||||
}
|
||||
}
|
||||
|
||||
return xerrors.Errorf("parent state root did not match computed state (%s != %s)", stateroot, h.ParentStateRoot)
|
||||
return xerrors.Errorf("parent state root did not match computed state (%s != %s)", h.ParentStateRoot, stateroot)
|
||||
}
|
||||
|
||||
if precp != h.ParentMessageReceipts {
|
||||
@@ -458,7 +458,7 @@ func (filec *FilecoinEC) checkBlockMessages(ctx context.Context, b *types.FullBl
|
||||
|
||||
stateroot, _, err := filec.sm.TipSetState(ctx, baseTs)
|
||||
if err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("failed to compute tipsettate for %s: %w", baseTs.Key(), err)
|
||||
}
|
||||
|
||||
st, err := state.LoadStateTree(filec.store.ActorStore(ctx), stateroot)
|
||||
@@ -466,7 +466,7 @@ func (filec *FilecoinEC) checkBlockMessages(ctx context.Context, b *types.FullBl
|
||||
return xerrors.Errorf("failed to load base state tree: %w", err)
|
||||
}
|
||||
|
||||
nv := filec.sm.GetNtwkVersion(ctx, b.Header.Height)
|
||||
nv := filec.sm.GetNetworkVersion(ctx, b.Header.Height)
|
||||
pl := vm.PricelistByEpoch(baseTs.Height())
|
||||
var sumGasLimit int64
|
||||
checkMsg := func(msg types.ChainMsg) error {
|
||||
@@ -475,7 +475,7 @@ func (filec *FilecoinEC) checkBlockMessages(ctx context.Context, b *types.FullBl
|
||||
// Phase 1: syntactic validation, as defined in the spec
|
||||
minGas := pl.OnChainMessage(msg.ChainLength())
|
||||
if err := m.ValidForBlockInclusion(minGas.Total(), nv); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("msg %s invalid for block inclusion: %w", m.Cid(), err)
|
||||
}
|
||||
|
||||
// ValidForBlockInclusion checks if any single message does not exceed BlockGasLimit
|
||||
@@ -488,10 +488,10 @@ func (filec *FilecoinEC) checkBlockMessages(ctx context.Context, b *types.FullBl
|
||||
// Phase 2: (Partial) semantic validation:
|
||||
// the sender exists and is an account actor, and the nonces make sense
|
||||
var sender address.Address
|
||||
if filec.sm.GetNtwkVersion(ctx, b.Header.Height) >= network.Version13 {
|
||||
if filec.sm.GetNetworkVersion(ctx, b.Header.Height) >= network.Version13 {
|
||||
sender, err = st.LookupID(m.From)
|
||||
if err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("failed to lookup sender %s: %w", m.From, err)
|
||||
}
|
||||
} else {
|
||||
sender = m.From
|
||||
@@ -541,7 +541,7 @@ func (filec *FilecoinEC) checkBlockMessages(ctx context.Context, b *types.FullBl
|
||||
|
||||
smArr := blockadt.MakeEmptyArray(tmpstore)
|
||||
for i, m := range b.SecpkMessages {
|
||||
if filec.sm.GetNtwkVersion(ctx, b.Header.Height) >= network.Version14 {
|
||||
if filec.sm.GetNetworkVersion(ctx, b.Header.Height) >= network.Version14 {
|
||||
if m.Signature.Type != crypto.SigTypeSecp256k1 {
|
||||
return xerrors.Errorf("block had invalid secpk message at index %d: %w", i, err)
|
||||
}
|
||||
@@ -574,12 +574,13 @@ func (filec *FilecoinEC) checkBlockMessages(ctx context.Context, b *types.FullBl
|
||||
|
||||
bmroot, err := bmArr.Root()
|
||||
if err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("failed to root bls msgs: %w", err)
|
||||
|
||||
}
|
||||
|
||||
smroot, err := smArr.Root()
|
||||
if err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("failed to root secp msgs: %w", err)
|
||||
}
|
||||
|
||||
mrcid, err := tmpstore.Put(ctx, &types.MsgMeta{
|
||||
@@ -587,7 +588,7 @@ func (filec *FilecoinEC) checkBlockMessages(ctx context.Context, b *types.FullBl
|
||||
SecpkMessages: smroot,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("failed to put msg meta: %w", err)
|
||||
}
|
||||
|
||||
if b.Header.Messages != mrcid {
|
||||
@@ -595,7 +596,12 @@ func (filec *FilecoinEC) checkBlockMessages(ctx context.Context, b *types.FullBl
|
||||
}
|
||||
|
||||
// Finally, flush.
|
||||
return vm.Copy(ctx, tmpbs, filec.store.ChainBlockstore(), mrcid)
|
||||
err = vm.Copy(ctx, tmpbs, filec.store.ChainBlockstore(), mrcid)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to flush:%w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (filec *FilecoinEC) IsEpochBeyondCurrMax(epoch abi.ChainEpoch) bool {
|
||||
|
||||
@@ -491,10 +491,8 @@ func VerifyPreSealedData(ctx context.Context, cs *store.ChainStore, sys vm.Sysca
|
||||
Actors: filcns.NewActorRegistry(),
|
||||
Syscalls: mkFakedSigSyscalls(sys),
|
||||
CircSupplyCalc: csc,
|
||||
NtwkVersion: func(_ context.Context, _ abi.ChainEpoch) network.Version {
|
||||
return nv
|
||||
},
|
||||
BaseFee: types.NewInt(0),
|
||||
NetworkVersion: nv,
|
||||
BaseFee: types.NewInt(0),
|
||||
}
|
||||
vm, err := vm.NewVM(ctx, &vmopt)
|
||||
if err != nil {
|
||||
|
||||
@@ -94,10 +94,8 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sys vm.Syscal
|
||||
Actors: filcns.NewActorRegistry(),
|
||||
Syscalls: mkFakedSigSyscalls(sys),
|
||||
CircSupplyCalc: csc,
|
||||
NtwkVersion: func(_ context.Context, _ abi.ChainEpoch) network.Version {
|
||||
return nv
|
||||
},
|
||||
BaseFee: types.NewInt(0),
|
||||
NetworkVersion: nv,
|
||||
BaseFee: types.NewInt(0),
|
||||
}
|
||||
|
||||
vm, err := vm.NewVM(ctx, vmopt)
|
||||
@@ -510,31 +508,13 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sys vm.Syscal
|
||||
// TODO: copied from actors test harness, deduplicate or remove from here
|
||||
type fakeRand struct{}
|
||||
|
||||
func (fr *fakeRand) GetChainRandomnessV2(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
func (fr *fakeRand) GetChainRandomness(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
out := make([]byte, 32)
|
||||
_, _ = rand.New(rand.NewSource(int64(randEpoch * 1000))).Read(out) //nolint
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (fr *fakeRand) GetChainRandomnessV1(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
out := make([]byte, 32)
|
||||
_, _ = rand.New(rand.NewSource(int64(randEpoch * 1000))).Read(out) //nolint
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (fr *fakeRand) GetBeaconRandomnessV3(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
out := make([]byte, 32)
|
||||
_, _ = rand.New(rand.NewSource(int64(randEpoch))).Read(out) //nolint
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (fr *fakeRand) GetBeaconRandomnessV2(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
out := make([]byte, 32)
|
||||
_, _ = rand.New(rand.NewSource(int64(randEpoch))).Read(out) //nolint
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (fr *fakeRand) GetBeaconRandomnessV1(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
func (fr *fakeRand) GetBeaconRandomness(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
out := make([]byte, 32)
|
||||
_, _ = rand.New(rand.NewSource(int64(randEpoch))).Read(out) //nolint
|
||||
return out, nil
|
||||
|
||||
@@ -173,10 +173,17 @@ type MessagePool struct {
|
||||
|
||||
sigValCache *lru.TwoQueueCache
|
||||
|
||||
nonceCache *lru.Cache
|
||||
|
||||
evtTypes [3]journal.EventType
|
||||
journal journal.Journal
|
||||
}
|
||||
|
||||
type nonceCacheKey struct {
|
||||
tsk types.TipSetKey
|
||||
addr address.Address
|
||||
}
|
||||
|
||||
type msgSet struct {
|
||||
msgs map[uint64]*types.SignedMessage
|
||||
nextNonce uint64
|
||||
@@ -196,10 +203,10 @@ func ComputeMinRBF(curPrem abi.TokenAmount) abi.TokenAmount {
|
||||
return types.BigAdd(minPrice, types.NewInt(1))
|
||||
}
|
||||
|
||||
func CapGasFee(mff dtypes.DefaultMaxFeeFunc, msg *types.Message, sendSepc *api.MessageSendSpec) {
|
||||
func CapGasFee(mff dtypes.DefaultMaxFeeFunc, msg *types.Message, sendSpec *api.MessageSendSpec) {
|
||||
var maxFee abi.TokenAmount
|
||||
if sendSepc != nil {
|
||||
maxFee = sendSepc.MaxFee
|
||||
if sendSpec != nil {
|
||||
maxFee = sendSpec.MaxFee
|
||||
}
|
||||
if maxFee.Int == nil || maxFee.Equals(big.Zero()) {
|
||||
mf, err := mff()
|
||||
@@ -361,6 +368,7 @@ func (ms *msgSet) toSlice() []*types.SignedMessage {
|
||||
func New(ctx context.Context, api Provider, ds dtypes.MetadataDS, us stmgr.UpgradeSchedule, netName dtypes.NetworkName, j journal.Journal) (*MessagePool, error) {
|
||||
cache, _ := lru.New2Q(build.BlsSignatureCacheSize)
|
||||
verifcache, _ := lru.New2Q(build.VerifSigCacheSize)
|
||||
noncecache, _ := lru.New(256)
|
||||
|
||||
cfg, err := loadConfig(ctx, ds)
|
||||
if err != nil {
|
||||
@@ -386,6 +394,7 @@ func New(ctx context.Context, api Provider, ds dtypes.MetadataDS, us stmgr.Upgra
|
||||
pruneCooldown: make(chan struct{}, 1),
|
||||
blsSigCache: cache,
|
||||
sigValCache: verifcache,
|
||||
nonceCache: noncecache,
|
||||
changes: lps.New(50),
|
||||
localMsgs: namespace.Wrap(ds, datastore.NewKey(localMsgsDs)),
|
||||
api: api,
|
||||
@@ -1016,11 +1025,23 @@ func (mp *MessagePool) getStateNonce(ctx context.Context, addr address.Address,
|
||||
done := metrics.Timer(ctx, metrics.MpoolGetNonceDuration)
|
||||
defer done()
|
||||
|
||||
nk := nonceCacheKey{
|
||||
tsk: ts.Key(),
|
||||
addr: addr,
|
||||
}
|
||||
|
||||
n, ok := mp.nonceCache.Get(nk)
|
||||
if ok {
|
||||
return n.(uint64), nil
|
||||
}
|
||||
|
||||
act, err := mp.api.GetActorAfter(addr, ts)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
mp.nonceCache.Add(nk, act.Nonce)
|
||||
|
||||
return act.Nonce, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//stm: #unit
|
||||
package messagepool
|
||||
|
||||
import (
|
||||
@@ -206,6 +207,7 @@ func (tma *testMpoolAPI) ChainComputeBaseFee(ctx context.Context, ts *types.TipS
|
||||
|
||||
func assertNonce(t *testing.T, mp *MessagePool, addr address.Address, val uint64) {
|
||||
t.Helper()
|
||||
//stm: @CHAIN_MEMPOOL_GET_NONCE_001
|
||||
n, err := mp.GetNonce(context.TODO(), addr, types.EmptyTSK)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -366,8 +368,10 @@ func TestMessagePoolMessagesInEachBlock(t *testing.T) {
|
||||
tma.applyBlock(t, a)
|
||||
tsa := mock.TipSet(a)
|
||||
|
||||
//stm: @CHAIN_MEMPOOL_PENDING_001
|
||||
_, _ = mp.Pending(context.TODO())
|
||||
|
||||
//stm: @CHAIN_MEMPOOL_SELECT_001
|
||||
selm, _ := mp.SelectMessages(context.Background(), tsa, 1)
|
||||
if len(selm) == 0 {
|
||||
t.Fatal("should have returned the rest of the messages")
|
||||
@@ -428,6 +432,7 @@ func TestRevertMessages(t *testing.T) {
|
||||
|
||||
assertNonce(t, mp, sender, 4)
|
||||
|
||||
//stm: @CHAIN_MEMPOOL_PENDING_001
|
||||
p, _ := mp.Pending(context.TODO())
|
||||
fmt.Printf("%+v\n", p)
|
||||
if len(p) != 3 {
|
||||
@@ -486,6 +491,7 @@ func TestPruningSimple(t *testing.T) {
|
||||
|
||||
mp.Prune()
|
||||
|
||||
//stm: @CHAIN_MEMPOOL_PENDING_001
|
||||
msgs, _ := mp.Pending(context.TODO())
|
||||
if len(msgs) != 5 {
|
||||
t.Fatal("expected only 5 messages in pool, got: ", len(msgs))
|
||||
@@ -528,6 +534,7 @@ func TestLoadLocal(t *testing.T) {
|
||||
msgs := make(map[cid.Cid]struct{})
|
||||
for i := 0; i < 10; i++ {
|
||||
m := makeTestMessage(w1, a1, a2, uint64(i), gasLimit, uint64(i+1))
|
||||
//stm: @CHAIN_MEMPOOL_PUSH_001
|
||||
cid, err := mp.Push(context.TODO(), m)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -544,6 +551,7 @@ func TestLoadLocal(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
//stm: @CHAIN_MEMPOOL_PENDING_001
|
||||
pmsgs, _ := mp.Pending(context.TODO())
|
||||
if len(msgs) != len(pmsgs) {
|
||||
t.Fatalf("expected %d messages, but got %d", len(msgs), len(pmsgs))
|
||||
@@ -599,6 +607,7 @@ func TestClearAll(t *testing.T) {
|
||||
gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin2.StorageMarketActorCodeID, M: 2}]
|
||||
for i := 0; i < 10; i++ {
|
||||
m := makeTestMessage(w1, a1, a2, uint64(i), gasLimit, uint64(i+1))
|
||||
//stm: @CHAIN_MEMPOOL_PUSH_001
|
||||
_, err := mp.Push(context.TODO(), m)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -610,8 +619,10 @@ func TestClearAll(t *testing.T) {
|
||||
mustAdd(t, mp, m)
|
||||
}
|
||||
|
||||
//stm: @CHAIN_MEMPOOL_CLEAR_001
|
||||
mp.Clear(context.Background(), true)
|
||||
|
||||
//stm: @CHAIN_MEMPOOL_PENDING_001
|
||||
pending, _ := mp.Pending(context.TODO())
|
||||
if len(pending) > 0 {
|
||||
t.Fatalf("cleared the mpool, but got %d pending messages", len(pending))
|
||||
@@ -654,6 +665,7 @@ func TestClearNonLocal(t *testing.T) {
|
||||
gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin2.StorageMarketActorCodeID, M: 2}]
|
||||
for i := 0; i < 10; i++ {
|
||||
m := makeTestMessage(w1, a1, a2, uint64(i), gasLimit, uint64(i+1))
|
||||
//stm: @CHAIN_MEMPOOL_PUSH_001
|
||||
_, err := mp.Push(context.TODO(), m)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -665,8 +677,10 @@ func TestClearNonLocal(t *testing.T) {
|
||||
mustAdd(t, mp, m)
|
||||
}
|
||||
|
||||
//stm: @CHAIN_MEMPOOL_CLEAR_001
|
||||
mp.Clear(context.Background(), false)
|
||||
|
||||
//stm: @CHAIN_MEMPOOL_PENDING_001
|
||||
pending, _ := mp.Pending(context.TODO())
|
||||
if len(pending) != 10 {
|
||||
t.Fatalf("expected 10 pending messages, but got %d instead", len(pending))
|
||||
@@ -724,6 +738,7 @@ func TestUpdates(t *testing.T) {
|
||||
|
||||
for i := 0; i < 10; i++ {
|
||||
m := makeTestMessage(w1, a1, a2, uint64(i), gasLimit, uint64(i+1))
|
||||
//stm: @CHAIN_MEMPOOL_PUSH_001
|
||||
_, err := mp.Push(context.TODO(), m)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//stm: #unit
|
||||
package messagesigner
|
||||
|
||||
import (
|
||||
@@ -60,6 +61,7 @@ func TestMessageSignerSignMessage(t *testing.T) {
|
||||
to2, err := w.WalletNew(ctx, types.KTSecp256k1)
|
||||
require.NoError(t, err)
|
||||
|
||||
//stm: @CHAIN_MESSAGE_SIGNER_NEW_SIGNER_001, @CHAIN_MESSAGE_SIGNER_SIGN_MESSAGE_001, @CHAIN_MESSAGE_SIGNER_SIGN_MESSAGE_005
|
||||
type msgSpec struct {
|
||||
msg *types.Message
|
||||
mpoolNonce [1]uint64
|
||||
|
||||
+40
-22
@@ -4,6 +4,8 @@ import (
|
||||
"context"
|
||||
"encoding/binary"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/beacon"
|
||||
@@ -70,7 +72,7 @@ func (sr *stateRand) GetBeaconRandomnessTipset(ctx context.Context, round abi.Ch
|
||||
return randTs, nil
|
||||
}
|
||||
|
||||
func (sr *stateRand) GetChainRandomness(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte, lookback bool) ([]byte, error) {
|
||||
func (sr *stateRand) getChainRandomness(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte, lookback bool) ([]byte, error) {
|
||||
_, span := trace.StartSpan(ctx, "store.GetChainRandomness")
|
||||
defer span.End()
|
||||
span.AddAttributes(trace.Int64Attribute("round", int64(round)))
|
||||
@@ -101,32 +103,26 @@ func (sr *stateRand) GetChainRandomness(ctx context.Context, pers crypto.DomainS
|
||||
return DrawRandomness(mtb.Ticket.VRFProof, pers, round, entropy)
|
||||
}
|
||||
|
||||
type NetworkVersionGetter func(context.Context, abi.ChainEpoch) network.Version
|
||||
|
||||
type stateRand struct {
|
||||
cs *store.ChainStore
|
||||
blks []cid.Cid
|
||||
beacon beacon.Schedule
|
||||
cs *store.ChainStore
|
||||
blks []cid.Cid
|
||||
beacon beacon.Schedule
|
||||
networkVersionGetter NetworkVersionGetter
|
||||
}
|
||||
|
||||
func NewStateRand(cs *store.ChainStore, blks []cid.Cid, b beacon.Schedule) vm.Rand {
|
||||
func NewStateRand(cs *store.ChainStore, blks []cid.Cid, b beacon.Schedule, networkVersionGetter NetworkVersionGetter) vm.Rand {
|
||||
return &stateRand{
|
||||
cs: cs,
|
||||
blks: blks,
|
||||
beacon: b,
|
||||
cs: cs,
|
||||
blks: blks,
|
||||
beacon: b,
|
||||
networkVersionGetter: networkVersionGetter,
|
||||
}
|
||||
}
|
||||
|
||||
// network v0-12
|
||||
func (sr *stateRand) GetChainRandomnessV1(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
return sr.GetChainRandomness(ctx, pers, round, entropy, true)
|
||||
}
|
||||
|
||||
// network v13 and on
|
||||
func (sr *stateRand) GetChainRandomnessV2(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
return sr.GetChainRandomness(ctx, pers, round, entropy, false)
|
||||
}
|
||||
|
||||
// network v0-12
|
||||
func (sr *stateRand) GetBeaconRandomnessV1(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
func (sr *stateRand) getBeaconRandomnessV1(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
randTs, err := sr.GetBeaconRandomnessTipset(ctx, round, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -143,7 +139,7 @@ func (sr *stateRand) GetBeaconRandomnessV1(ctx context.Context, pers crypto.Doma
|
||||
}
|
||||
|
||||
// network v13
|
||||
func (sr *stateRand) GetBeaconRandomnessV2(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
func (sr *stateRand) getBeaconRandomnessV2(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
randTs, err := sr.GetBeaconRandomnessTipset(ctx, round, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -160,9 +156,9 @@ func (sr *stateRand) GetBeaconRandomnessV2(ctx context.Context, pers crypto.Doma
|
||||
}
|
||||
|
||||
// network v14 and on
|
||||
func (sr *stateRand) GetBeaconRandomnessV3(ctx context.Context, pers crypto.DomainSeparationTag, filecoinEpoch abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
func (sr *stateRand) getBeaconRandomnessV3(ctx context.Context, pers crypto.DomainSeparationTag, filecoinEpoch abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
if filecoinEpoch < 0 {
|
||||
return sr.GetBeaconRandomnessV2(ctx, pers, filecoinEpoch, entropy)
|
||||
return sr.getBeaconRandomnessV2(ctx, pers, filecoinEpoch, entropy)
|
||||
}
|
||||
|
||||
be, err := sr.extractBeaconEntryForEpoch(ctx, filecoinEpoch)
|
||||
@@ -174,6 +170,28 @@ func (sr *stateRand) GetBeaconRandomnessV3(ctx context.Context, pers crypto.Doma
|
||||
return DrawRandomness(be.Data, pers, filecoinEpoch, entropy)
|
||||
}
|
||||
|
||||
func (sr *stateRand) GetChainRandomness(ctx context.Context, pers crypto.DomainSeparationTag, filecoinEpoch abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
nv := sr.networkVersionGetter(ctx, filecoinEpoch)
|
||||
|
||||
if nv >= network.Version13 {
|
||||
return sr.getChainRandomness(ctx, pers, filecoinEpoch, entropy, false)
|
||||
}
|
||||
|
||||
return sr.getChainRandomness(ctx, pers, filecoinEpoch, entropy, true)
|
||||
}
|
||||
|
||||
func (sr *stateRand) GetBeaconRandomness(ctx context.Context, pers crypto.DomainSeparationTag, filecoinEpoch abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
nv := sr.networkVersionGetter(ctx, filecoinEpoch)
|
||||
|
||||
if nv >= network.Version14 {
|
||||
return sr.getBeaconRandomnessV3(ctx, pers, filecoinEpoch, entropy)
|
||||
} else if nv == network.Version13 {
|
||||
return sr.getBeaconRandomnessV2(ctx, pers, filecoinEpoch, entropy)
|
||||
} else {
|
||||
return sr.getBeaconRandomnessV1(ctx, pers, filecoinEpoch, entropy)
|
||||
}
|
||||
}
|
||||
|
||||
func (sr *stateRand) extractBeaconEntryForEpoch(ctx context.Context, filecoinEpoch abi.ChainEpoch) (*types.BeaconEntry, error) {
|
||||
randTs, err := sr.GetBeaconRandomnessTipset(ctx, filecoinEpoch, false)
|
||||
if err != nil {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//stm:#unit
|
||||
package rand_test
|
||||
|
||||
import (
|
||||
@@ -55,11 +56,13 @@ func TestNullRandomnessV1(t *testing.T) {
|
||||
|
||||
randEpoch := ts.TipSet.TipSet().Height() - 2
|
||||
|
||||
//stm: @BLOCKCHAIN_RAND_GET_BEACON_RANDOMNESS_V1_01, @BLOCKCHAIN_RAND_EXTRACT_BEACON_ENTRY_FOR_EPOCH_01, @BLOCKCHAIN_RAND_GET_BEACON_RANDOMNESS_TIPSET_02
|
||||
rand1, err := cg.StateManager().GetRandomnessFromBeacon(ctx, pers, randEpoch, entropy, ts.TipSet.TipSet().Key())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
//stm: @BLOCKCHAIN_BEACON_GET_BEACON_FOR_EPOCH_01
|
||||
bch := cg.BeaconSchedule().BeaconForEpoch(randEpoch).Entry(ctx, uint64(beforeNullHeight)+offset)
|
||||
|
||||
select {
|
||||
@@ -68,6 +71,7 @@ func TestNullRandomnessV1(t *testing.T) {
|
||||
t.Fatal(resp.Err)
|
||||
}
|
||||
|
||||
//stm: @BLOCKCHAIN_RAND_DRAW_RANDOMNESS_01
|
||||
rand2, err := rand.DrawRandomness(resp.Entry.Data, pers, randEpoch, entropy)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -131,11 +135,13 @@ func TestNullRandomnessV2(t *testing.T) {
|
||||
|
||||
randEpoch := ts.TipSet.TipSet().Height() - 2
|
||||
|
||||
//stm: @BLOCKCHAIN_RAND_GET_BEACON_RANDOMNESS_V2_01
|
||||
rand1, err := cg.StateManager().GetRandomnessFromBeacon(ctx, pers, randEpoch, entropy, ts.TipSet.TipSet().Key())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
//stm: @BLOCKCHAIN_BEACON_GET_BEACON_FOR_EPOCH_01
|
||||
bch := cg.BeaconSchedule().BeaconForEpoch(randEpoch).Entry(ctx, uint64(ts.TipSet.TipSet().Height())+offset)
|
||||
|
||||
select {
|
||||
@@ -144,6 +150,7 @@ func TestNullRandomnessV2(t *testing.T) {
|
||||
t.Fatal(resp.Err)
|
||||
}
|
||||
|
||||
//stm: @BLOCKCHAIN_RAND_DRAW_RANDOMNESS_01, @BLOCKCHAIN_RAND_EXTRACT_BEACON_ENTRY_FOR_EPOCH_01, @BLOCKCHAIN_RAND_GET_BEACON_RANDOMNESS_TIPSET_03
|
||||
// note that the randEpoch passed to DrawRandomness is still randEpoch (not the latest ts height)
|
||||
rand2, err := rand.DrawRandomness(resp.Entry.Data, pers, randEpoch, entropy)
|
||||
if err != nil {
|
||||
@@ -212,11 +219,13 @@ func TestNullRandomnessV3(t *testing.T) {
|
||||
|
||||
randEpoch := ts.TipSet.TipSet().Height() - 2
|
||||
|
||||
//stm: @BLOCKCHAIN_RAND_GET_BEACON_RANDOMNESS_V3_01, @BLOCKCHAIN_RAND_EXTRACT_BEACON_ENTRY_FOR_EPOCH_01
|
||||
rand1, err := cg.StateManager().GetRandomnessFromBeacon(ctx, pers, randEpoch, entropy, ts.TipSet.TipSet().Key())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
//stm: @BLOCKCHAIN_BEACON_GET_BEACON_FOR_EPOCH_01
|
||||
bch := cg.BeaconSchedule().BeaconForEpoch(randEpoch).Entry(ctx, uint64(randEpoch)+offset)
|
||||
|
||||
select {
|
||||
@@ -225,6 +234,7 @@ func TestNullRandomnessV3(t *testing.T) {
|
||||
t.Fatal(resp.Err)
|
||||
}
|
||||
|
||||
//stm: @BLOCKCHAIN_RAND_DRAW_RANDOMNESS_01
|
||||
rand2, err := rand.DrawRandomness(resp.Entry.Data, pers, randEpoch, entropy)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -359,7 +359,7 @@ func MinerGetBaseInfo(ctx context.Context, sm *StateManager, bcs beacon.Schedule
|
||||
return nil, xerrors.Errorf("failed to get randomness for winning post: %w", err)
|
||||
}
|
||||
|
||||
nv := sm.GetNtwkVersion(ctx, ts.Height())
|
||||
nv := sm.GetNetworkVersion(ctx, ts.Height())
|
||||
|
||||
sectors, err := GetSectorsForWinningPoSt(ctx, nv, pv, sm, lbst, maddr, prand)
|
||||
if err != nil {
|
||||
@@ -421,7 +421,7 @@ func MinerEligibleToMine(ctx context.Context, sm *StateManager, addr address.Add
|
||||
hmp, err := minerHasMinPower(ctx, sm, addr, lookbackTs)
|
||||
|
||||
// TODO: We're blurring the lines between a "runtime network version" and a "Lotus upgrade epoch", is that unavoidable?
|
||||
if sm.GetNtwkVersion(ctx, baseTs.Height()) <= network.Version3 {
|
||||
if sm.GetNetworkVersion(ctx, baseTs.Height()) <= network.Version3 {
|
||||
return hmp, err
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -75,12 +75,12 @@ func (sm *StateManager) Call(ctx context.Context, msg *types.Message, ts *types.
|
||||
vmopt := &vm.VMOpts{
|
||||
StateBase: bstate,
|
||||
Epoch: pheight + 1,
|
||||
Rand: rand.NewStateRand(sm.cs, ts.Cids(), sm.beacon),
|
||||
Rand: rand.NewStateRand(sm.cs, ts.Cids(), sm.beacon, sm.GetNetworkVersion),
|
||||
Bstore: sm.cs.StateBlockstore(),
|
||||
Actors: sm.tsExec.NewActorRegistry(),
|
||||
Syscalls: sm.Syscalls,
|
||||
CircSupplyCalc: sm.GetVMCirculatingSupply,
|
||||
NtwkVersion: sm.GetNtwkVersion,
|
||||
NetworkVersion: sm.GetNetworkVersion(ctx, pheight+1),
|
||||
BaseFee: types.NewInt(0),
|
||||
LookbackState: LookbackStateGetterForTipset(sm, ts),
|
||||
}
|
||||
@@ -186,7 +186,7 @@ func (sm *StateManager) CallWithGas(ctx context.Context, msg *types.Message, pri
|
||||
return nil, fmt.Errorf("failed to handle fork: %w", err)
|
||||
}
|
||||
|
||||
r := rand.NewStateRand(sm.cs, ts.Cids(), sm.beacon)
|
||||
r := rand.NewStateRand(sm.cs, ts.Cids(), sm.beacon, sm.GetNetworkVersion)
|
||||
|
||||
if span.IsRecordingEvents() {
|
||||
span.AddAttributes(
|
||||
@@ -204,7 +204,7 @@ func (sm *StateManager) CallWithGas(ctx context.Context, msg *types.Message, pri
|
||||
Actors: sm.tsExec.NewActorRegistry(),
|
||||
Syscalls: sm.Syscalls,
|
||||
CircSupplyCalc: sm.GetVMCirculatingSupply,
|
||||
NtwkVersion: sm.GetNtwkVersion,
|
||||
NetworkVersion: sm.GetNetworkVersion(ctx, ts.Height()+1),
|
||||
BaseFee: ts.Blocks()[0].ParentBaseFee,
|
||||
LookbackState: LookbackStateGetterForTipset(sm, ts),
|
||||
}
|
||||
|
||||
+5
-17
@@ -357,7 +357,7 @@ func (sm *StateManager) VMConstructor() func(context.Context, *vm.VMOpts) (*vm.V
|
||||
}
|
||||
}
|
||||
|
||||
func (sm *StateManager) GetNtwkVersion(ctx context.Context, height abi.ChainEpoch) network.Version {
|
||||
func (sm *StateManager) GetNetworkVersion(ctx context.Context, height abi.ChainEpoch) network.Version {
|
||||
// The epochs here are the _last_ epoch for every version, or -1 if the
|
||||
// version is disabled.
|
||||
for _, spec := range sm.networkVersions {
|
||||
@@ -378,16 +378,9 @@ func (sm *StateManager) GetRandomnessFromBeacon(ctx context.Context, personaliza
|
||||
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||
}
|
||||
|
||||
r := rand.NewStateRand(sm.ChainStore(), pts.Cids(), sm.beacon)
|
||||
rnv := sm.GetNtwkVersion(ctx, randEpoch)
|
||||
r := rand.NewStateRand(sm.ChainStore(), pts.Cids(), sm.beacon, sm.GetNetworkVersion)
|
||||
|
||||
if rnv >= network.Version14 {
|
||||
return r.GetBeaconRandomnessV3(ctx, personalization, randEpoch, entropy)
|
||||
} else if rnv == network.Version13 {
|
||||
return r.GetBeaconRandomnessV2(ctx, personalization, randEpoch, entropy)
|
||||
}
|
||||
|
||||
return r.GetBeaconRandomnessV1(ctx, personalization, randEpoch, entropy)
|
||||
return r.GetBeaconRandomness(ctx, personalization, randEpoch, entropy)
|
||||
|
||||
}
|
||||
|
||||
@@ -397,12 +390,7 @@ func (sm *StateManager) GetRandomnessFromTickets(ctx context.Context, personaliz
|
||||
return nil, xerrors.Errorf("loading tipset key: %w", err)
|
||||
}
|
||||
|
||||
r := rand.NewStateRand(sm.ChainStore(), pts.Cids(), sm.beacon)
|
||||
rnv := sm.GetNtwkVersion(ctx, randEpoch)
|
||||
r := rand.NewStateRand(sm.ChainStore(), pts.Cids(), sm.beacon, sm.GetNetworkVersion)
|
||||
|
||||
if rnv >= network.Version13 {
|
||||
return r.GetChainRandomnessV2(ctx, personalization, randEpoch, entropy)
|
||||
}
|
||||
|
||||
return r.GetChainRandomnessV1(ctx, personalization, randEpoch, entropy)
|
||||
return r.GetChainRandomness(ctx, personalization, randEpoch, entropy)
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ func ComputeState(ctx context.Context, sm *StateManager, height abi.ChainEpoch,
|
||||
// future. It's not guaranteed to be accurate... but that's fine.
|
||||
}
|
||||
|
||||
r := rand.NewStateRand(sm.cs, ts.Cids(), sm.beacon)
|
||||
r := rand.NewStateRand(sm.cs, ts.Cids(), sm.beacon, sm.GetNetworkVersion)
|
||||
vmopt := &vm.VMOpts{
|
||||
StateBase: base,
|
||||
Epoch: height,
|
||||
@@ -88,7 +88,7 @@ func ComputeState(ctx context.Context, sm *StateManager, height abi.ChainEpoch,
|
||||
Actors: sm.tsExec.NewActorRegistry(),
|
||||
Syscalls: sm.Syscalls,
|
||||
CircSupplyCalc: sm.GetVMCirculatingSupply,
|
||||
NtwkVersion: sm.GetNtwkVersion,
|
||||
NetworkVersion: sm.GetNetworkVersion(ctx, height),
|
||||
BaseFee: ts.Blocks()[0].ParentBaseFee,
|
||||
LookbackState: LookbackStateGetterForTipset(sm, ts),
|
||||
}
|
||||
@@ -128,7 +128,7 @@ func LookbackStateGetterForTipset(sm *StateManager, ts *types.TipSet) vm.Lookbac
|
||||
|
||||
func GetLookbackTipSetForRound(ctx context.Context, sm *StateManager, ts *types.TipSet, round abi.ChainEpoch) (*types.TipSet, cid.Cid, error) {
|
||||
var lbr abi.ChainEpoch
|
||||
lb := policy.GetWinningPoStSectorSetLookback(sm.GetNtwkVersion(ctx, round))
|
||||
lb := policy.GetWinningPoStSectorSetLookback(sm.GetNetworkVersion(ctx, round))
|
||||
if round > lb {
|
||||
lbr = round - lb
|
||||
}
|
||||
|
||||
+174
-4
@@ -1,19 +1,24 @@
|
||||
package sub
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"encoding/binary"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
address "github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-legs/dtsync"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain"
|
||||
"github.com/filecoin-project/lotus/chain/consensus"
|
||||
"github.com/filecoin-project/lotus/chain/messagepool"
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
"github.com/filecoin-project/lotus/chain/sub/ratelimit"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/metrics"
|
||||
"github.com/filecoin-project/lotus/node/impl/client"
|
||||
"github.com/filecoin-project/lotus/node/impl/full"
|
||||
lru "github.com/hashicorp/golang-lru"
|
||||
blocks "github.com/ipfs/go-block-format"
|
||||
bserv "github.com/ipfs/go-blockservice"
|
||||
@@ -168,12 +173,12 @@ func fetchCids(
|
||||
cidIndex := make(map[cid.Cid]int)
|
||||
for i, c := range cids {
|
||||
if c.Prefix() != msgCidPrefix {
|
||||
return fmt.Errorf("invalid msg CID: %s", c)
|
||||
return xerrors.Errorf("invalid msg CID: %s", c)
|
||||
}
|
||||
cidIndex[c] = i
|
||||
}
|
||||
if len(cids) != len(cidIndex) {
|
||||
return fmt.Errorf("duplicate CIDs in fetchCids input")
|
||||
return xerrors.Errorf("duplicate CIDs in fetchCids input")
|
||||
}
|
||||
|
||||
for block := range bserv.GetBlocks(ctx, cids) {
|
||||
@@ -196,7 +201,7 @@ func fetchCids(
|
||||
if len(cidIndex) > 0 {
|
||||
err := ctx.Err()
|
||||
if err == nil {
|
||||
err = fmt.Errorf("failed to fetch %d messages for unknown reasons", len(cidIndex))
|
||||
err = xerrors.Errorf("failed to fetch %d messages for unknown reasons", len(cidIndex))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -444,3 +449,168 @@ func recordFailure(ctx context.Context, metric *stats.Int64Measure, failureType
|
||||
)
|
||||
stats.Record(ctx, metric.M(1))
|
||||
}
|
||||
|
||||
type peerMsgInfo struct {
|
||||
peerID peer.ID
|
||||
lastCid cid.Cid
|
||||
lastSeqno uint64
|
||||
rateLimit *ratelimit.Window
|
||||
mutex sync.Mutex
|
||||
}
|
||||
|
||||
type IndexerMessageValidator struct {
|
||||
self peer.ID
|
||||
|
||||
peerCache *lru.TwoQueueCache
|
||||
chainApi full.ChainModuleAPI
|
||||
stateApi full.StateModuleAPI
|
||||
}
|
||||
|
||||
func NewIndexerMessageValidator(self peer.ID, chainApi full.ChainModuleAPI, stateApi full.StateModuleAPI) *IndexerMessageValidator {
|
||||
peerCache, _ := lru.New2Q(8192)
|
||||
|
||||
return &IndexerMessageValidator{
|
||||
self: self,
|
||||
peerCache: peerCache,
|
||||
chainApi: chainApi,
|
||||
stateApi: stateApi,
|
||||
}
|
||||
}
|
||||
|
||||
func (v *IndexerMessageValidator) Validate(ctx context.Context, pid peer.ID, msg *pubsub.Message) pubsub.ValidationResult {
|
||||
// This chain-node should not be publishing its own messages. These are
|
||||
// relayed from market-nodes. If a node appears to be local, reject it.
|
||||
if pid == v.self {
|
||||
log.Debug("ignoring indexer message from self")
|
||||
stats.Record(ctx, metrics.IndexerMessageValidationFailure.M(1))
|
||||
return pubsub.ValidationIgnore
|
||||
}
|
||||
originPeer := msg.GetFrom()
|
||||
if originPeer == v.self {
|
||||
log.Debug("ignoring indexer message originating from self")
|
||||
stats.Record(ctx, metrics.IndexerMessageValidationFailure.M(1))
|
||||
return pubsub.ValidationIgnore
|
||||
}
|
||||
|
||||
idxrMsg := dtsync.Message{}
|
||||
err := idxrMsg.UnmarshalCBOR(bytes.NewBuffer(msg.Data))
|
||||
if err != nil {
|
||||
log.Errorw("Could not decode indexer pubsub message", "err", err)
|
||||
return pubsub.ValidationReject
|
||||
}
|
||||
if len(idxrMsg.ExtraData) == 0 {
|
||||
log.Debugw("ignoring messsage missing miner id", "peer", originPeer)
|
||||
return pubsub.ValidationIgnore
|
||||
}
|
||||
|
||||
// Get miner info from lotus
|
||||
minerAddr, err := address.NewFromBytes(idxrMsg.ExtraData)
|
||||
if err != nil {
|
||||
log.Warnw("cannot parse extra data as miner address", "err", err, "extraData", idxrMsg.ExtraData)
|
||||
return pubsub.ValidationReject
|
||||
}
|
||||
|
||||
minerID := minerAddr.String()
|
||||
msgCid := idxrMsg.Cid
|
||||
|
||||
var msgInfo *peerMsgInfo
|
||||
val, ok := v.peerCache.Get(minerID)
|
||||
if !ok {
|
||||
msgInfo = &peerMsgInfo{}
|
||||
} else {
|
||||
msgInfo = val.(*peerMsgInfo)
|
||||
}
|
||||
|
||||
// Lock this peer's message info.
|
||||
msgInfo.mutex.Lock()
|
||||
defer msgInfo.mutex.Unlock()
|
||||
|
||||
if ok {
|
||||
// Reject replayed messages.
|
||||
seqno := binary.BigEndian.Uint64(msg.Message.GetSeqno())
|
||||
if seqno <= msgInfo.lastSeqno {
|
||||
log.Debugf("ignoring replayed indexer message")
|
||||
return pubsub.ValidationIgnore
|
||||
}
|
||||
msgInfo.lastSeqno = seqno
|
||||
}
|
||||
|
||||
if !ok || originPeer != msgInfo.peerID {
|
||||
// Check that the miner ID maps to the peer that sent the message.
|
||||
err = v.authenticateMessage(ctx, minerAddr, originPeer)
|
||||
if err != nil {
|
||||
log.Warnw("cannot authenticate messsage", "err", err, "peer", originPeer, "minerID", minerID)
|
||||
stats.Record(ctx, metrics.IndexerMessageValidationFailure.M(1))
|
||||
return pubsub.ValidationReject
|
||||
}
|
||||
msgInfo.peerID = originPeer
|
||||
if !ok {
|
||||
// Add msgInfo to cache only after being authenticated. If two
|
||||
// messages from the same peer are handled concurrently, there is a
|
||||
// small chance that one msgInfo could replace the other here when
|
||||
// the info is first cached. This is OK, so no need to prevent it.
|
||||
v.peerCache.Add(minerID, msgInfo)
|
||||
}
|
||||
}
|
||||
|
||||
// See if message needs to be ignored due to rate limiting.
|
||||
if v.rateLimitPeer(msgInfo, msgCid) {
|
||||
return pubsub.ValidationIgnore
|
||||
}
|
||||
|
||||
stats.Record(ctx, metrics.IndexerMessageValidationSuccess.M(1))
|
||||
return pubsub.ValidationAccept
|
||||
}
|
||||
|
||||
func (v *IndexerMessageValidator) rateLimitPeer(msgInfo *peerMsgInfo, msgCid cid.Cid) bool {
|
||||
const (
|
||||
msgLimit = 5
|
||||
msgTimeLimit = 10 * time.Second
|
||||
repeatTimeLimit = 2 * time.Hour
|
||||
)
|
||||
|
||||
timeWindow := msgInfo.rateLimit
|
||||
|
||||
// Check overall message rate.
|
||||
if timeWindow == nil {
|
||||
timeWindow = ratelimit.NewWindow(msgLimit, msgTimeLimit)
|
||||
msgInfo.rateLimit = timeWindow
|
||||
} else if msgInfo.lastCid == msgCid {
|
||||
// Check if this is a repeat of the previous message data.
|
||||
if time.Since(timeWindow.Newest()) < repeatTimeLimit {
|
||||
log.Warnw("ignoring repeated indexer message", "sender", msgInfo.peerID)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
err := timeWindow.Add()
|
||||
if err != nil {
|
||||
log.Warnw("ignoring indexer message", "sender", msgInfo.peerID, "err", err)
|
||||
return true
|
||||
}
|
||||
|
||||
msgInfo.lastCid = msgCid
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (v *IndexerMessageValidator) authenticateMessage(ctx context.Context, minerAddress address.Address, peerID peer.ID) error {
|
||||
ts, err := v.chainApi.ChainHead(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
minerInfo, err := v.stateApi.StateMinerInfo(ctx, minerAddress, ts.Key())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if minerInfo.PeerId == nil {
|
||||
return xerrors.New("no peer id for miner")
|
||||
}
|
||||
if *minerInfo.PeerId != peerID {
|
||||
return xerrors.New("miner id does not map to peer that sent message")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
//stm: #unit
|
||||
package sub
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
address "github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-legs/dtsync"
|
||||
"github.com/filecoin-project/lotus/api/mocks"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/golang/mock/gomock"
|
||||
blocks "github.com/ipfs/go-block-format"
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||
pb "github.com/libp2p/go-libp2p-pubsub/pb"
|
||||
)
|
||||
|
||||
type getter struct {
|
||||
@@ -49,6 +57,7 @@ func TestFetchCidsWithDedup(t *testing.T) {
|
||||
}
|
||||
g := &getter{msgs}
|
||||
|
||||
//stm: @CHAIN_INCOMING_FETCH_MESSAGES_BY_CID_001
|
||||
// the cids have a duplicate
|
||||
res, err := FetchMessagesByCids(context.TODO(), g, append(cids, cids[0]))
|
||||
|
||||
@@ -61,3 +70,65 @@ func TestFetchCidsWithDedup(t *testing.T) {
|
||||
t.Fatalf("there is a nil message: first %p, last %p", res[0], res[len(res)-1])
|
||||
}
|
||||
}
|
||||
|
||||
func TestIndexerMessageValidator_Validate(t *testing.T) {
|
||||
validCid, err := cid.Decode("QmbpDgg5kRLDgMxS8vPKNFXEcA6D5MC4CkuUdSWDVtHPGK")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
selfPID string
|
||||
senderPID string
|
||||
extraData []byte
|
||||
wantValidation pubsub.ValidationResult
|
||||
}{
|
||||
{
|
||||
name: "invalid extra data is rejected",
|
||||
selfPID: "12D3KooWQiCbqEStCkdqUvr69gQsrp9urYJZUCkzsQXia7mbqbFW",
|
||||
senderPID: "12D3KooWE8yt84RVwW3sFcd6WMjbUdWrZer2YtT4dmtj3dHdahSZ",
|
||||
extraData: []byte("f0127896"), // note, casting encoded address to byte is invalid.
|
||||
wantValidation: pubsub.ValidationReject,
|
||||
},
|
||||
{
|
||||
name: "same sender and receiver is ignored",
|
||||
selfPID: "12D3KooWQiCbqEStCkdqUvr69gQsrp9urYJZUCkzsQXia7mbqbFW",
|
||||
senderPID: "12D3KooWQiCbqEStCkdqUvr69gQsrp9urYJZUCkzsQXia7mbqbFW",
|
||||
wantValidation: pubsub.ValidationIgnore,
|
||||
},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
mc := gomock.NewController(t)
|
||||
node := mocks.NewMockFullNode(mc)
|
||||
subject := NewIndexerMessageValidator(peer.ID(tc.selfPID), node, node)
|
||||
message := dtsync.Message{
|
||||
Cid: validCid,
|
||||
Addrs: nil,
|
||||
ExtraData: tc.extraData,
|
||||
}
|
||||
buf := bytes.NewBuffer(nil)
|
||||
if err := message.MarshalCBOR(buf); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
topic := "topic"
|
||||
pbm := &pb.Message{
|
||||
Data: buf.Bytes(),
|
||||
Topic: &topic,
|
||||
From: nil,
|
||||
Seqno: nil,
|
||||
}
|
||||
validate := subject.Validate(context.Background(), peer.ID(tc.senderPID), &pubsub.Message{
|
||||
Message: pbm,
|
||||
ReceivedFrom: peer.ID(tc.senderPID),
|
||||
ValidatorData: nil,
|
||||
})
|
||||
|
||||
if validate != tc.wantValidation {
|
||||
t.Fatalf("expected %v but got %v", tc.wantValidation, validate)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
package ratelimit
|
||||
|
||||
import "errors"
|
||||
|
||||
var ErrRateLimitExceeded = errors.New("rate limit exceeded")
|
||||
|
||||
type queue struct {
|
||||
buf []int64
|
||||
count int
|
||||
head int
|
||||
tail int
|
||||
}
|
||||
|
||||
// cap returns the queue capacity
|
||||
func (q *queue) cap() int {
|
||||
return len(q.buf)
|
||||
}
|
||||
|
||||
// len returns the number of items in the queue
|
||||
func (q *queue) len() int {
|
||||
return q.count
|
||||
}
|
||||
|
||||
// push adds an element to the end of the queue.
|
||||
func (q *queue) push(elem int64) error {
|
||||
if q.count == len(q.buf) {
|
||||
return ErrRateLimitExceeded
|
||||
}
|
||||
|
||||
q.buf[q.tail] = elem
|
||||
// Calculate new tail position.
|
||||
q.tail = q.next(q.tail)
|
||||
q.count++
|
||||
return nil
|
||||
}
|
||||
|
||||
// pop removes and returns the element from the front of the queue.
|
||||
func (q *queue) pop() int64 {
|
||||
if q.count <= 0 {
|
||||
panic("pop from empty queue")
|
||||
}
|
||||
ret := q.buf[q.head]
|
||||
|
||||
// Calculate new head position.
|
||||
q.head = q.next(q.head)
|
||||
q.count--
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
// front returns the element at the front of the queue. This is the element
|
||||
// that would be returned by pop(). This call panics if the queue is empty.
|
||||
func (q *queue) front() int64 {
|
||||
if q.count <= 0 {
|
||||
panic("front() called when empty")
|
||||
}
|
||||
return q.buf[q.head]
|
||||
}
|
||||
|
||||
// back returns the element at the back of the queue. This call panics if the
|
||||
// queue is empty.
|
||||
func (q *queue) back() int64 {
|
||||
if q.count <= 0 {
|
||||
panic("back() called when empty")
|
||||
}
|
||||
return q.buf[q.prev(q.tail)]
|
||||
}
|
||||
|
||||
// prev returns the previous buffer position wrapping around buffer.
|
||||
func (q *queue) prev(i int) int {
|
||||
if i == 0 {
|
||||
return len(q.buf) - 1
|
||||
}
|
||||
return (i - 1) % len(q.buf)
|
||||
}
|
||||
|
||||
// next returns the next buffer position wrapping around buffer.
|
||||
func (q *queue) next(i int) int {
|
||||
return (i + 1) % len(q.buf)
|
||||
}
|
||||
|
||||
// truncate pops values that are less than or equal the specified threshold.
|
||||
func (q *queue) truncate(threshold int64) {
|
||||
for q.count != 0 && q.buf[q.head] <= threshold {
|
||||
// pop() without returning a value
|
||||
q.head = q.next(q.head)
|
||||
q.count--
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package ratelimit
|
||||
|
||||
import "time"
|
||||
|
||||
// Window is a time windows for counting events within a span of time. The
|
||||
// windows slides forward in time so that it spans from the most recent event
|
||||
// to size time in the past.
|
||||
type Window struct {
|
||||
q *queue
|
||||
size int64
|
||||
}
|
||||
|
||||
// NewWindow creates a new Window that limits the number of events to maximum
|
||||
// count of events within a duration of time. The capacity sets the maximum
|
||||
// number of events, and size sets the span of time over which the events are
|
||||
// counted.
|
||||
func NewWindow(capacity int, size time.Duration) *Window {
|
||||
return &Window{
|
||||
q: &queue{
|
||||
buf: make([]int64, capacity),
|
||||
},
|
||||
size: int64(size),
|
||||
}
|
||||
}
|
||||
|
||||
// Add attempts to append a new timestamp into the current window. Previously
|
||||
// added values that are not not within `size` difference from the value being
|
||||
// added are first removed. Add fails if adding the value would cause the
|
||||
// window to exceed capacity.
|
||||
func (w *Window) Add() error {
|
||||
now := time.Now().UnixNano()
|
||||
if w.Len() != 0 {
|
||||
w.q.truncate(now - w.size)
|
||||
}
|
||||
return w.q.push(now)
|
||||
}
|
||||
|
||||
// Cap returns the maximum number of items the window can hold.
|
||||
func (w *Window) Cap() int {
|
||||
return w.q.cap()
|
||||
}
|
||||
|
||||
// Len returns the number of elements currently in the window.
|
||||
func (w *Window) Len() int {
|
||||
return w.q.len()
|
||||
}
|
||||
|
||||
// Span returns the distance from the first to the last item in the window.
|
||||
func (w *Window) Span() time.Duration {
|
||||
if w.q.len() < 2 {
|
||||
return 0
|
||||
}
|
||||
return time.Duration(w.q.back() - w.q.front())
|
||||
}
|
||||
|
||||
// Oldest returns the oldest timestamp in the window.
|
||||
func (w *Window) Oldest() time.Time {
|
||||
if w.q.len() == 0 {
|
||||
return time.Time{}
|
||||
}
|
||||
return time.Unix(0, w.q.front())
|
||||
}
|
||||
|
||||
// Newest returns the newest timestamp in the window.
|
||||
func (w *Window) Newest() time.Time {
|
||||
if w.q.len() == 0 {
|
||||
return time.Time{}
|
||||
}
|
||||
return time.Unix(0, w.q.back())
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package ratelimit
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestWindow(t *testing.T) {
|
||||
const (
|
||||
maxEvents = 3
|
||||
timeLimit = 100 * time.Millisecond
|
||||
)
|
||||
w := NewWindow(maxEvents, timeLimit)
|
||||
if w.Len() != 0 {
|
||||
t.Fatal("q.Len() =", w.Len(), "expect 0")
|
||||
}
|
||||
if w.Cap() != maxEvents {
|
||||
t.Fatal("q.Cap() =", w.Cap(), "expect 3")
|
||||
}
|
||||
if !w.Newest().IsZero() {
|
||||
t.Fatal("expected newest to be zero time with empty window")
|
||||
}
|
||||
if !w.Oldest().IsZero() {
|
||||
t.Fatal("expected oldest to be zero time with empty window")
|
||||
}
|
||||
if w.Span() != 0 {
|
||||
t.Fatal("expected span to be zero time with empty window")
|
||||
}
|
||||
|
||||
var err error
|
||||
for i := 0; i < maxEvents; i++ {
|
||||
err = w.Add()
|
||||
if err != nil {
|
||||
t.Fatalf("cannot add event %d", i)
|
||||
}
|
||||
}
|
||||
if w.Len() != maxEvents {
|
||||
t.Fatalf("q.Len() is %d, expected %d", w.Len(), maxEvents)
|
||||
}
|
||||
if err = w.Add(); err != ErrRateLimitExceeded {
|
||||
t.Fatalf("add event %d within time limit should have failed with err: %s", maxEvents+1, ErrRateLimitExceeded)
|
||||
}
|
||||
|
||||
time.Sleep(timeLimit)
|
||||
if err = w.Add(); err != nil {
|
||||
t.Fatalf("cannot add event after time limit: %s", err)
|
||||
}
|
||||
|
||||
prev := w.Newest()
|
||||
time.Sleep(timeLimit)
|
||||
err = w.Add()
|
||||
if err != nil {
|
||||
t.Fatalf("cannot add event")
|
||||
}
|
||||
if w.Newest().Before(prev) {
|
||||
t.Fatal("newest is before previous value")
|
||||
}
|
||||
if w.Oldest().Before(prev) {
|
||||
t.Fatal("oldest is before previous value")
|
||||
}
|
||||
}
|
||||
+45
-2
@@ -1,3 +1,4 @@
|
||||
//stm: #unit
|
||||
package chain_test
|
||||
|
||||
import (
|
||||
@@ -103,7 +104,7 @@ func prepSyncTest(t testing.TB, h int) *syncTestUtil {
|
||||
ctx: ctx,
|
||||
cancel: cancel,
|
||||
|
||||
mn: mocknet.New(ctx),
|
||||
mn: mocknet.New(),
|
||||
g: g,
|
||||
us: filcns.DefaultUpgradeSchedule(),
|
||||
}
|
||||
@@ -157,7 +158,7 @@ func prepSyncTestWithV5Height(t testing.TB, h int, v5height abi.ChainEpoch) *syn
|
||||
ctx: ctx,
|
||||
cancel: cancel,
|
||||
|
||||
mn: mocknet.New(ctx),
|
||||
mn: mocknet.New(),
|
||||
g: g,
|
||||
us: sched,
|
||||
}
|
||||
@@ -462,6 +463,8 @@ func (tu *syncTestUtil) waitUntilSyncTarget(to int, target *types.TipSet) {
|
||||
}
|
||||
|
||||
func TestSyncSimple(t *testing.T) {
|
||||
//stm: @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01, @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001, @CHAIN_SYNCER_START_001
|
||||
//stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001
|
||||
H := 50
|
||||
tu := prepSyncTest(t, H)
|
||||
|
||||
@@ -478,6 +481,8 @@ func TestSyncSimple(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSyncMining(t *testing.T) {
|
||||
//stm: @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01, @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001, @CHAIN_SYNCER_START_001
|
||||
//stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001
|
||||
H := 50
|
||||
tu := prepSyncTest(t, H)
|
||||
|
||||
@@ -500,6 +505,8 @@ func TestSyncMining(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSyncBadTimestamp(t *testing.T) {
|
||||
//stm: @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01, @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001, @CHAIN_SYNCER_START_001
|
||||
//stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001
|
||||
H := 50
|
||||
tu := prepSyncTest(t, H)
|
||||
|
||||
@@ -554,6 +561,8 @@ func (wpp badWpp) ComputeProof(context.Context, []proof7.ExtendedSectorInfo, abi
|
||||
}
|
||||
|
||||
func TestSyncBadWinningPoSt(t *testing.T) {
|
||||
//stm: @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01, @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001, @CHAIN_SYNCER_START_001
|
||||
//stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001
|
||||
H := 15
|
||||
tu := prepSyncTest(t, H)
|
||||
|
||||
@@ -583,6 +592,9 @@ func (tu *syncTestUtil) loadChainToNode(to int) {
|
||||
}
|
||||
|
||||
func TestSyncFork(t *testing.T) {
|
||||
//stm: @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01, @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001, @CHAIN_SYNCER_START_001
|
||||
//stm: @CHAIN_SYNCER_SYNC_001, @CHAIN_SYNCER_COLLECT_CHAIN_001, @CHAIN_SYNCER_COLLECT_HEADERS_001, @CHAIN_SYNCER_VALIDATE_TIPSET_001
|
||||
//stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001
|
||||
H := 10
|
||||
tu := prepSyncTest(t, H)
|
||||
|
||||
@@ -650,6 +662,9 @@ func TestSyncFork(t *testing.T) {
|
||||
// A and B both include _different_ messages from sender X with nonce N (where N is the correct nonce for X).
|
||||
// We can confirm that the state can be correctly computed, and that `MessagesForTipset` behaves as expected.
|
||||
func TestDuplicateNonce(t *testing.T) {
|
||||
//stm: @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01, @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001, @CHAIN_SYNCER_START_001
|
||||
//stm: @CHAIN_SYNCER_SYNC_001, @CHAIN_SYNCER_COLLECT_CHAIN_001, @CHAIN_SYNCER_COLLECT_HEADERS_001, @CHAIN_SYNCER_VALIDATE_TIPSET_001
|
||||
//stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001
|
||||
H := 10
|
||||
tu := prepSyncTest(t, H)
|
||||
|
||||
@@ -704,6 +719,7 @@ func TestDuplicateNonce(t *testing.T) {
|
||||
|
||||
var includedMsg cid.Cid
|
||||
var skippedMsg cid.Cid
|
||||
//stm: @CHAIN_STATE_SEARCH_MSG_001
|
||||
r0, err0 := tu.nds[0].StateSearchMsg(context.TODO(), ts2.TipSet().Key(), msgs[0][0].Cid(), api.LookbackNoLimit, true)
|
||||
r1, err1 := tu.nds[0].StateSearchMsg(context.TODO(), ts2.TipSet().Key(), msgs[1][0].Cid(), api.LookbackNoLimit, true)
|
||||
|
||||
@@ -745,6 +761,9 @@ func TestDuplicateNonce(t *testing.T) {
|
||||
// This test asserts that a block that includes a message with bad nonce can't be synced. A nonce is "bad" if it can't
|
||||
// be applied on the parent state.
|
||||
func TestBadNonce(t *testing.T) {
|
||||
//stm: @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01, @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001, @CHAIN_SYNCER_START_001
|
||||
//stm: @CHAIN_SYNCER_SYNC_001, @CHAIN_SYNCER_COLLECT_CHAIN_001, @CHAIN_SYNCER_COLLECT_HEADERS_001
|
||||
//stm: @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_VALIDATE_TIPSET_001, @CHAIN_SYNCER_STOP_001
|
||||
H := 10
|
||||
tu := prepSyncTest(t, H)
|
||||
|
||||
@@ -792,6 +811,9 @@ func TestBadNonce(t *testing.T) {
|
||||
// One of the messages uses the sender's robust address, the other uses the ID address.
|
||||
// Such a block is invalid and should not sync.
|
||||
func TestMismatchedNoncesRobustID(t *testing.T) {
|
||||
//stm: @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01, @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001, @CHAIN_SYNCER_START_001
|
||||
//stm: @CHAIN_SYNCER_SYNC_001, @CHAIN_SYNCER_COLLECT_CHAIN_001, @CHAIN_SYNCER_COLLECT_HEADERS_001
|
||||
//stm: @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_VALIDATE_TIPSET_001, @CHAIN_SYNCER_STOP_001
|
||||
v5h := abi.ChainEpoch(4)
|
||||
tu := prepSyncTestWithV5Height(t, int(v5h+5), v5h)
|
||||
|
||||
@@ -804,6 +826,7 @@ func TestMismatchedNoncesRobustID(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
// Produce a message from the banker
|
||||
//stm: @CHAIN_STATE_LOOKUP_ID_001
|
||||
makeMsg := func(id bool) *types.SignedMessage {
|
||||
sender := tu.g.Banker()
|
||||
if id {
|
||||
@@ -846,6 +869,9 @@ func TestMismatchedNoncesRobustID(t *testing.T) {
|
||||
// One of the messages uses the sender's robust address, the other uses the ID address.
|
||||
// Such a block is valid and should sync.
|
||||
func TestMatchedNoncesRobustID(t *testing.T) {
|
||||
//stm: @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01, @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001, @CHAIN_SYNCER_START_001
|
||||
//stm: @CHAIN_SYNCER_SYNC_001, @CHAIN_SYNCER_COLLECT_CHAIN_001, @CHAIN_SYNCER_COLLECT_HEADERS_001
|
||||
//stm: @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_VALIDATE_TIPSET_001, @CHAIN_SYNCER_STOP_001
|
||||
v5h := abi.ChainEpoch(4)
|
||||
tu := prepSyncTestWithV5Height(t, int(v5h+5), v5h)
|
||||
|
||||
@@ -858,6 +884,7 @@ func TestMatchedNoncesRobustID(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
// Produce a message from the banker with specified nonce
|
||||
//stm: @CHAIN_STATE_LOOKUP_ID_001
|
||||
makeMsg := func(n uint64, id bool) *types.SignedMessage {
|
||||
sender := tu.g.Banker()
|
||||
if id {
|
||||
@@ -917,6 +944,8 @@ func runSyncBenchLength(b *testing.B, l int) {
|
||||
}
|
||||
|
||||
func TestSyncInputs(t *testing.T) {
|
||||
//stm: @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001, @CHAIN_SYNCER_VALIDATE_BLOCK_001,
|
||||
//stm: @CHAIN_SYNCER_START_001, @CHAIN_SYNCER_STOP_001
|
||||
H := 10
|
||||
tu := prepSyncTest(t, H)
|
||||
|
||||
@@ -944,6 +973,9 @@ func TestSyncInputs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSyncCheckpointHead(t *testing.T) {
|
||||
//stm: @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01, @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001, @CHAIN_SYNCER_START_001
|
||||
//stm: @CHAIN_SYNCER_SYNC_001, @CHAIN_SYNCER_COLLECT_CHAIN_001, @CHAIN_SYNCER_COLLECT_HEADERS_001
|
||||
//stm: @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_VALIDATE_TIPSET_001, @CHAIN_SYNCER_STOP_001
|
||||
H := 10
|
||||
tu := prepSyncTest(t, H)
|
||||
|
||||
@@ -963,6 +995,7 @@ func TestSyncCheckpointHead(t *testing.T) {
|
||||
a = tu.mineOnBlock(a, p1, []int{0}, true, false, nil, 0, true)
|
||||
|
||||
tu.waitUntilSyncTarget(p1, a.TipSet())
|
||||
//stm: @CHAIN_SYNCER_CHECKPOINT_001
|
||||
tu.checkpointTs(p1, a.TipSet().Key())
|
||||
|
||||
require.NoError(t, tu.g.ResyncBankerNonce(a1.TipSet()))
|
||||
@@ -982,15 +1015,20 @@ func TestSyncCheckpointHead(t *testing.T) {
|
||||
tu.waitUntilNodeHasTs(p1, b.TipSet().Key())
|
||||
p1Head := tu.getHead(p1)
|
||||
require.True(tu.t, p1Head.Equals(a.TipSet()))
|
||||
//stm: @CHAIN_SYNCER_CHECK_BAD_001
|
||||
tu.assertBad(p1, b.TipSet())
|
||||
|
||||
// Should be able to switch forks.
|
||||
//stm: @CHAIN_SYNCER_CHECKPOINT_001
|
||||
tu.checkpointTs(p1, b.TipSet().Key())
|
||||
p1Head = tu.getHead(p1)
|
||||
require.True(tu.t, p1Head.Equals(b.TipSet()))
|
||||
}
|
||||
|
||||
func TestSyncCheckpointEarlierThanHead(t *testing.T) {
|
||||
//stm: @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01, @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001, @CHAIN_SYNCER_START_001
|
||||
//stm: @CHAIN_SYNCER_SYNC_001, @CHAIN_SYNCER_COLLECT_CHAIN_001, @CHAIN_SYNCER_COLLECT_HEADERS_001
|
||||
//stm: @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_VALIDATE_TIPSET_001, @CHAIN_SYNCER_STOP_001
|
||||
H := 10
|
||||
tu := prepSyncTest(t, H)
|
||||
|
||||
@@ -1010,6 +1048,7 @@ func TestSyncCheckpointEarlierThanHead(t *testing.T) {
|
||||
a = tu.mineOnBlock(a, p1, []int{0}, true, false, nil, 0, true)
|
||||
|
||||
tu.waitUntilSyncTarget(p1, a.TipSet())
|
||||
//stm: @CHAIN_SYNCER_CHECKPOINT_001
|
||||
tu.checkpointTs(p1, a1.TipSet().Key())
|
||||
|
||||
require.NoError(t, tu.g.ResyncBankerNonce(a1.TipSet()))
|
||||
@@ -1029,15 +1068,19 @@ func TestSyncCheckpointEarlierThanHead(t *testing.T) {
|
||||
tu.waitUntilNodeHasTs(p1, b.TipSet().Key())
|
||||
p1Head := tu.getHead(p1)
|
||||
require.True(tu.t, p1Head.Equals(a.TipSet()))
|
||||
//stm: @CHAIN_SYNCER_CHECK_BAD_001
|
||||
tu.assertBad(p1, b.TipSet())
|
||||
|
||||
// Should be able to switch forks.
|
||||
//stm: @CHAIN_SYNCER_CHECKPOINT_001
|
||||
tu.checkpointTs(p1, b.TipSet().Key())
|
||||
p1Head = tu.getHead(p1)
|
||||
require.True(tu.t, p1Head.Equals(b.TipSet()))
|
||||
}
|
||||
|
||||
func TestInvalidHeight(t *testing.T) {
|
||||
//stm: @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001, @CHAIN_SYNCER_START_001
|
||||
//stm: @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001
|
||||
H := 50
|
||||
tu := prepSyncTest(t, H)
|
||||
|
||||
|
||||
+7
-4
@@ -10,8 +10,9 @@ import (
|
||||
addr "github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
)
|
||||
|
||||
type GasCharge struct {
|
||||
@@ -81,7 +82,9 @@ type Pricelist interface {
|
||||
OnVerifyConsensusFault() GasCharge
|
||||
}
|
||||
|
||||
var prices = map[abi.ChainEpoch]Pricelist{
|
||||
// Prices are the price lists per starting epoch. Public for testing purposes
|
||||
// (concretely to allow the test vector runner to rebase prices).
|
||||
var Prices = map[abi.ChainEpoch]Pricelist{
|
||||
abi.ChainEpoch(0): &pricelistV0{
|
||||
computeGasMulti: 1,
|
||||
storageGasMulti: 1000,
|
||||
@@ -216,8 +219,8 @@ func PricelistByEpoch(epoch abi.ChainEpoch) Pricelist {
|
||||
// since we are storing the prices as map or epoch to price
|
||||
// we need to get the price with the highest epoch that is lower or equal to the `epoch` arg
|
||||
bestEpoch := abi.ChainEpoch(0)
|
||||
bestPrice := prices[bestEpoch]
|
||||
for e, pl := range prices {
|
||||
bestPrice := Prices[bestEpoch]
|
||||
for e, pl := range Prices {
|
||||
// if `e` happened after `bestEpoch` and `e` is earlier or equal to the target `epoch`
|
||||
if e > bestEpoch && e <= epoch {
|
||||
bestEpoch = e
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package vm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"testing"
|
||||
@@ -136,9 +135,7 @@ func TestInvokerBasic(t *testing.T) {
|
||||
|
||||
{
|
||||
_, aerr := code[1](&Runtime{
|
||||
vm: &VM{ntwkVersion: func(ctx context.Context, epoch abi.ChainEpoch) network.Version {
|
||||
return network.Version0
|
||||
}},
|
||||
vm: &VM{networkVersion: network.Version0},
|
||||
Message: &basicRtMessage{},
|
||||
}, []byte{99})
|
||||
if aerrors.IsFatal(aerr) {
|
||||
@@ -149,9 +146,7 @@ func TestInvokerBasic(t *testing.T) {
|
||||
|
||||
{
|
||||
_, aerr := code[1](&Runtime{
|
||||
vm: &VM{ntwkVersion: func(ctx context.Context, epoch abi.ChainEpoch) network.Version {
|
||||
return network.Version7
|
||||
}},
|
||||
vm: &VM{networkVersion: network.Version7},
|
||||
Message: &basicRtMessage{},
|
||||
}, []byte{99})
|
||||
if aerrors.IsFatal(aerr) {
|
||||
|
||||
+5
-23
@@ -5,6 +5,7 @@ import (
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"os"
|
||||
gruntime "runtime"
|
||||
"time"
|
||||
|
||||
@@ -56,7 +57,7 @@ func (m *Message) ValueReceived() abi.TokenAmount {
|
||||
}
|
||||
|
||||
// EnableGasTracing, if true, outputs gas tracing in execution traces.
|
||||
var EnableGasTracing = false
|
||||
var EnableGasTracing = os.Getenv("LOTUS_VM_ENABLE_GAS_TRACING_VERY_SLOW") == "1"
|
||||
|
||||
type Runtime struct {
|
||||
rt7.Message
|
||||
@@ -91,7 +92,7 @@ func (rt *Runtime) BaseFee() abi.TokenAmount {
|
||||
}
|
||||
|
||||
func (rt *Runtime) NetworkVersion() network.Version {
|
||||
return rt.vm.GetNtwkVersion(rt.ctx, rt.CurrEpoch())
|
||||
return rt.vm.networkVersion
|
||||
}
|
||||
|
||||
func (rt *Runtime) TotalFilCircSupply() abi.TokenAmount {
|
||||
@@ -223,16 +224,7 @@ func (rt *Runtime) GetActorCodeCID(addr address.Address) (ret cid.Cid, ok bool)
|
||||
}
|
||||
|
||||
func (rt *Runtime) GetRandomnessFromTickets(personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) abi.Randomness {
|
||||
var err error
|
||||
var res []byte
|
||||
|
||||
rnv := rt.vm.ntwkVersion(rt.ctx, randEpoch)
|
||||
|
||||
if rnv >= network.Version13 {
|
||||
res, err = rt.vm.rand.GetChainRandomnessV2(rt.ctx, personalization, randEpoch, entropy)
|
||||
} else {
|
||||
res, err = rt.vm.rand.GetChainRandomnessV1(rt.ctx, personalization, randEpoch, entropy)
|
||||
}
|
||||
res, err := rt.vm.rand.GetChainRandomness(rt.ctx, personalization, randEpoch, entropy)
|
||||
|
||||
if err != nil {
|
||||
panic(aerrors.Fatalf("could not get ticket randomness: %s", err))
|
||||
@@ -241,17 +233,7 @@ func (rt *Runtime) GetRandomnessFromTickets(personalization crypto.DomainSeparat
|
||||
}
|
||||
|
||||
func (rt *Runtime) GetRandomnessFromBeacon(personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) abi.Randomness {
|
||||
var err error
|
||||
var res []byte
|
||||
|
||||
rnv := rt.vm.ntwkVersion(rt.ctx, randEpoch)
|
||||
if rnv >= network.Version14 {
|
||||
res, err = rt.vm.rand.GetBeaconRandomnessV3(rt.ctx, personalization, randEpoch, entropy)
|
||||
} else if rnv == network.Version13 {
|
||||
res, err = rt.vm.rand.GetBeaconRandomnessV2(rt.ctx, personalization, randEpoch, entropy)
|
||||
} else {
|
||||
res, err = rt.vm.rand.GetBeaconRandomnessV1(rt.ctx, personalization, randEpoch, entropy)
|
||||
}
|
||||
res, err := rt.vm.rand.GetBeaconRandomness(rt.ctx, personalization, randEpoch, entropy)
|
||||
|
||||
if err != nil {
|
||||
panic(aerrors.Fatalf("could not get beacon randomness: %s", err))
|
||||
|
||||
+10
-28
@@ -169,7 +169,7 @@ func (vm *VM) makeRuntime(ctx context.Context, msg *types.Message, parent *Runti
|
||||
}
|
||||
vmm.From = resF
|
||||
|
||||
if vm.ntwkVersion(ctx, vm.blockHeight) <= network.Version3 {
|
||||
if vm.networkVersion <= network.Version3 {
|
||||
rt.Message = &vmm
|
||||
} else {
|
||||
resT, _ := rt.ResolveAddress(msg.To)
|
||||
@@ -209,7 +209,7 @@ type VM struct {
|
||||
areg *ActorRegistry
|
||||
rand Rand
|
||||
circSupplyCalc CircSupplyCalculator
|
||||
ntwkVersion NtwkVersionGetter
|
||||
networkVersion network.Version
|
||||
baseFee abi.TokenAmount
|
||||
lbStateGet LookbackStateGetter
|
||||
baseCircSupply abi.TokenAmount
|
||||
@@ -225,7 +225,7 @@ type VMOpts struct {
|
||||
Actors *ActorRegistry
|
||||
Syscalls SyscallBuilder
|
||||
CircSupplyCalc CircSupplyCalculator
|
||||
NtwkVersion NtwkVersionGetter // TODO: stebalien: In what cases do we actually need this? It seems like even when creating new networks we want to use the 'global'/build-default version getter
|
||||
NetworkVersion network.Version
|
||||
BaseFee abi.TokenAmount
|
||||
LookbackState LookbackStateGetter
|
||||
}
|
||||
@@ -251,7 +251,7 @@ func NewVM(ctx context.Context, opts *VMOpts) (*VM, error) {
|
||||
areg: opts.Actors,
|
||||
rand: opts.Rand, // TODO: Probably should be a syscall
|
||||
circSupplyCalc: opts.CircSupplyCalc,
|
||||
ntwkVersion: opts.NtwkVersion,
|
||||
networkVersion: opts.NetworkVersion,
|
||||
Syscalls: opts.Syscalls,
|
||||
baseFee: opts.BaseFee,
|
||||
baseCircSupply: baseCirc,
|
||||
@@ -260,11 +260,8 @@ func NewVM(ctx context.Context, opts *VMOpts) (*VM, error) {
|
||||
}
|
||||
|
||||
type Rand interface {
|
||||
GetChainRandomnessV1(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error)
|
||||
GetChainRandomnessV2(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error)
|
||||
GetBeaconRandomnessV1(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error)
|
||||
GetBeaconRandomnessV2(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error)
|
||||
GetBeaconRandomnessV3(ctx context.Context, pers crypto.DomainSeparationTag, filecoinEpoch abi.ChainEpoch, entropy []byte) ([]byte, error)
|
||||
GetChainRandomness(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error)
|
||||
GetBeaconRandomness(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error)
|
||||
}
|
||||
|
||||
type ApplyRet struct {
|
||||
@@ -316,7 +313,7 @@ func (vm *VM) send(ctx context.Context, msg *types.Message, parent *Runtime,
|
||||
return nil, aerrors.Wrapf(err, "could not create account")
|
||||
}
|
||||
toActor = a
|
||||
if vm.ntwkVersion(ctx, vm.blockHeight) <= network.Version3 {
|
||||
if vm.networkVersion <= network.Version3 {
|
||||
// Leave the rt.Message as is
|
||||
} else {
|
||||
nmsg := Message{
|
||||
@@ -343,7 +340,7 @@ func (vm *VM) send(ctx context.Context, msg *types.Message, parent *Runtime,
|
||||
defer rt.chargeGasSafe(newGasCharge("OnMethodInvocationDone", 0, 0))
|
||||
|
||||
if types.BigCmp(msg.Value, types.NewInt(0)) != 0 {
|
||||
if err := vm.transfer(msg.From, msg.To, msg.Value, vm.ntwkVersion(ctx, vm.blockHeight)); err != nil {
|
||||
if err := vm.transfer(msg.From, msg.To, msg.Value, vm.networkVersion); err != nil {
|
||||
return nil, aerrors.Wrap(err, "failed to transfer funds")
|
||||
}
|
||||
}
|
||||
@@ -620,7 +617,7 @@ func (vm *VM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet,
|
||||
}
|
||||
|
||||
func (vm *VM) ShouldBurn(ctx context.Context, st *state.StateTree, msg *types.Message, errcode exitcode.ExitCode) (bool, error) {
|
||||
if vm.ntwkVersion(ctx, vm.blockHeight) <= network.Version12 {
|
||||
if vm.networkVersion <= network.Version12 {
|
||||
// Check to see if we should burn funds. We avoid burning on successful
|
||||
// window post. This won't catch _indirect_ window post calls, but this
|
||||
// is the best we can get for now.
|
||||
@@ -827,17 +824,6 @@ func (vm *VM) StateTree() types.StateTree {
|
||||
return vm.cstate
|
||||
}
|
||||
|
||||
func (vm *VM) SetBlockHeight(ctx context.Context, h abi.ChainEpoch) error {
|
||||
vm.blockHeight = h
|
||||
ncirc, err := vm.circSupplyCalc(ctx, vm.blockHeight, vm.cstate)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
vm.baseCircSupply = ncirc
|
||||
return nil
|
||||
}
|
||||
|
||||
func (vm *VM) Invoke(act *types.Actor, rt *Runtime, method abi.MethodNum, params []byte) ([]byte, aerrors.ActorError) {
|
||||
ctx, span := trace.StartSpan(rt.ctx, "vm.Invoke")
|
||||
defer span.End()
|
||||
@@ -865,13 +851,9 @@ func (vm *VM) SetInvoker(i *ActorRegistry) {
|
||||
vm.areg = i
|
||||
}
|
||||
|
||||
func (vm *VM) GetNtwkVersion(ctx context.Context, ce abi.ChainEpoch) network.Version {
|
||||
return vm.ntwkVersion(ctx, ce)
|
||||
}
|
||||
|
||||
func (vm *VM) GetCircSupply(ctx context.Context) (abi.TokenAmount, error) {
|
||||
// Before v15, this was recalculated on each invocation as the state tree was mutated
|
||||
if vm.GetNtwkVersion(ctx, vm.blockHeight) <= network.Version14 {
|
||||
if vm.networkVersion <= network.Version14 {
|
||||
return vm.circSupplyCalc(ctx, vm.blockHeight, vm.cstate)
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,7 @@ var clientCmd = &cli.Command{
|
||||
WithCategory("data", clientLocalCmd),
|
||||
WithCategory("data", clientStat),
|
||||
WithCategory("retrieval", clientFindCmd),
|
||||
WithCategory("retrieval", clientQueryRetrievalAskCmd),
|
||||
WithCategory("retrieval", clientRetrieveCmd),
|
||||
WithCategory("retrieval", clientRetrieveCatCmd),
|
||||
WithCategory("retrieval", clientRetrieveLsCmd),
|
||||
@@ -1030,6 +1031,67 @@ var clientFindCmd = &cli.Command{
|
||||
},
|
||||
}
|
||||
|
||||
var clientQueryRetrievalAskCmd = &cli.Command{
|
||||
Name: "retrieval-ask",
|
||||
Usage: "Get a miner's retrieval ask",
|
||||
ArgsUsage: "[minerAddress] [data CID]",
|
||||
Flags: []cli.Flag{
|
||||
&cli.Int64Flag{
|
||||
Name: "size",
|
||||
Usage: "data size in bytes",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
afmt := NewAppFmt(cctx.App)
|
||||
if cctx.NArg() != 2 {
|
||||
afmt.Println("Usage: retrieval-ask [minerAddress] [data CID]")
|
||||
return nil
|
||||
}
|
||||
|
||||
maddr, err := address.NewFromString(cctx.Args().First())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
dataCid, err := cid.Parse(cctx.Args().Get(1))
|
||||
if err != nil {
|
||||
return fmt.Errorf("parsing data cid: %w", err)
|
||||
}
|
||||
|
||||
api, closer, err := GetFullNodeAPI(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closer()
|
||||
ctx := ReqContext(cctx)
|
||||
|
||||
ask, err := api.ClientMinerQueryOffer(ctx, maddr, dataCid, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
afmt.Printf("Ask: %s\n", maddr)
|
||||
afmt.Printf("Unseal price: %s\n", types.FIL(ask.UnsealPrice))
|
||||
afmt.Printf("Price per byte: %s\n", types.FIL(ask.PricePerByte))
|
||||
afmt.Printf("Payment interval: %s\n", types.SizeStr(types.NewInt(ask.PaymentInterval)))
|
||||
afmt.Printf("Payment interval increase: %s\n", types.SizeStr(types.NewInt(ask.PaymentIntervalIncrease)))
|
||||
|
||||
size := cctx.Uint64("size")
|
||||
if size == 0 {
|
||||
if ask.Size == 0 {
|
||||
return nil
|
||||
}
|
||||
size = ask.Size
|
||||
afmt.Printf("Size: %s\n", types.SizeStr(types.NewInt(ask.Size)))
|
||||
}
|
||||
transferPrice := types.BigMul(ask.PricePerByte, types.NewInt(size))
|
||||
totalPrice := types.BigAdd(ask.UnsealPrice, transferPrice)
|
||||
afmt.Printf("Total price for %d bytes: %s\n", size, types.FIL(totalPrice))
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
var clientListRetrievalsCmd = &cli.Command{
|
||||
Name: "list-retrievals",
|
||||
Usage: "List retrieval market deals",
|
||||
|
||||
+210
@@ -36,6 +36,11 @@ var NetCmd = &cli.Command{
|
||||
NetReachability,
|
||||
NetBandwidthCmd,
|
||||
NetBlockCmd,
|
||||
NetStatCmd,
|
||||
NetLimitCmd,
|
||||
NetProtectAdd,
|
||||
NetProtectRemove,
|
||||
NetProtectList,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -606,3 +611,208 @@ var NetBlockListCmd = &cli.Command{
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
var NetStatCmd = &cli.Command{
|
||||
Name: "stat",
|
||||
Usage: "Report resource usage for a scope",
|
||||
ArgsUsage: "scope",
|
||||
Description: `Report resource usage for a scope.
|
||||
|
||||
The scope can be one of the following:
|
||||
- system -- reports the system aggregate resource usage.
|
||||
- transient -- reports the transient resource usage.
|
||||
- svc:<service> -- reports the resource usage of a specific service.
|
||||
- proto:<proto> -- reports the resource usage of a specific protocol.
|
||||
- peer:<peer> -- reports the resource usage of a specific peer.
|
||||
- all -- reports the resource usage for all currently active scopes.
|
||||
`,
|
||||
Action: func(cctx *cli.Context) error {
|
||||
api, closer, err := GetAPI(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closer()
|
||||
ctx := ReqContext(cctx)
|
||||
|
||||
args := cctx.Args().Slice()
|
||||
if len(args) != 1 {
|
||||
return xerrors.Errorf("must specify exactly one scope")
|
||||
}
|
||||
scope := args[0]
|
||||
|
||||
result, err := api.NetStat(ctx, scope)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
enc := json.NewEncoder(os.Stdout)
|
||||
return enc.Encode(result)
|
||||
},
|
||||
}
|
||||
|
||||
var NetLimitCmd = &cli.Command{
|
||||
Name: "limit",
|
||||
Usage: "Get or set resource limits for a scope",
|
||||
ArgsUsage: "scope [limit]",
|
||||
Description: `Get or set resource limits for a scope.
|
||||
|
||||
The scope can be one of the following:
|
||||
- system -- reports the system aggregate resource usage.
|
||||
- transient -- reports the transient resource usage.
|
||||
- svc:<service> -- reports the resource usage of a specific service.
|
||||
- proto:<proto> -- reports the resource usage of a specific protocol.
|
||||
- peer:<peer> -- reports the resource usage of a specific peer.
|
||||
|
||||
The limit is json-formatted, with the same structure as the limits file.
|
||||
`,
|
||||
Flags: []cli.Flag{
|
||||
&cli.BoolFlag{
|
||||
Name: "set",
|
||||
Usage: "set the limit for a scope",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
api, closer, err := GetAPI(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closer()
|
||||
ctx := ReqContext(cctx)
|
||||
args := cctx.Args().Slice()
|
||||
|
||||
if cctx.Bool("set") {
|
||||
if len(args) != 2 {
|
||||
return xerrors.Errorf("must specify exactly a scope and a limit")
|
||||
}
|
||||
scope := args[0]
|
||||
limitStr := args[1]
|
||||
|
||||
var limit atypes.NetLimit
|
||||
err := json.Unmarshal([]byte(limitStr), &limit)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("error decoding limit: %w", err)
|
||||
}
|
||||
|
||||
return api.NetSetLimit(ctx, scope, limit)
|
||||
|
||||
}
|
||||
|
||||
if len(args) != 1 {
|
||||
return xerrors.Errorf("must specify exactly one scope")
|
||||
}
|
||||
scope := args[0]
|
||||
|
||||
result, err := api.NetLimit(ctx, scope)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
enc := json.NewEncoder(os.Stdout)
|
||||
return enc.Encode(result)
|
||||
},
|
||||
}
|
||||
|
||||
var NetProtectAdd = &cli.Command{
|
||||
Name: "protect",
|
||||
Usage: "Add one or more peer IDs to the list of protected peer connections",
|
||||
ArgsUsage: "<peer-id> [<peer-id>...]",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
api, closer, err := GetAPI(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closer()
|
||||
ctx := ReqContext(cctx)
|
||||
|
||||
pids, err := decodePeerIDsFromArgs(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = api.NetProtectAdd(ctx, pids)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Println("added to protected peers:")
|
||||
for _, pid := range pids {
|
||||
fmt.Printf(" %s\n", pid)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
var NetProtectRemove = &cli.Command{
|
||||
Name: "unprotect",
|
||||
Usage: "Remove one or more peer IDs from the list of protected peer connections.",
|
||||
ArgsUsage: "<peer-id> [<peer-id>...]",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
api, closer, err := GetAPI(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closer()
|
||||
ctx := ReqContext(cctx)
|
||||
|
||||
pids, err := decodePeerIDsFromArgs(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = api.NetProtectRemove(ctx, pids)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Printf("removed from protected peers:")
|
||||
for _, pid := range pids {
|
||||
fmt.Printf(" %s\n", pid)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
// decodePeerIDsFromArgs decodes all the arguments present in cli.Context.Args as peer.ID.
|
||||
//
|
||||
// This function requires at least one argument to be present, and arguments must not be empty
|
||||
// string. Otherwise, an error is returned.
|
||||
func decodePeerIDsFromArgs(cctx *cli.Context) ([]peer.ID, error) {
|
||||
pidArgs := cctx.Args().Slice()
|
||||
if len(pidArgs) == 0 {
|
||||
return nil, xerrors.Errorf("must specify at least one peer ID as an argument")
|
||||
}
|
||||
var pids []peer.ID
|
||||
for _, pidStr := range pidArgs {
|
||||
if pidStr == "" {
|
||||
return nil, xerrors.Errorf("peer ID must not be empty")
|
||||
}
|
||||
pid, err := peer.Decode(pidStr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pids = append(pids, pid)
|
||||
}
|
||||
return pids, nil
|
||||
}
|
||||
|
||||
var NetProtectList = &cli.Command{
|
||||
Name: "list-protected",
|
||||
Usage: "List the peer IDs with protected connection.",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
api, closer, err := GetAPI(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closer()
|
||||
ctx := ReqContext(cctx)
|
||||
pids, err := api.NetProtectList(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, pid := range pids {
|
||||
fmt.Printf("%s\n", pid)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
+116
-32
@@ -4,7 +4,9 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/fatih/color"
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/urfave/cli/v2"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
@@ -21,6 +23,8 @@ var dagstoreCmd = &cli.Command{
|
||||
dagstoreRecoverShardCmd,
|
||||
dagstoreInitializeAllCmd,
|
||||
dagstoreGcCmd,
|
||||
dagstorePieceIndexSizeCmd,
|
||||
dagstoreLookupPiecesCmd,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -52,38 +56,7 @@ var dagstoreListShardsCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
if len(shards) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
tw := tablewriter.New(
|
||||
tablewriter.Col("Key"),
|
||||
tablewriter.Col("State"),
|
||||
tablewriter.Col("Error"),
|
||||
)
|
||||
|
||||
colors := map[string]color.Attribute{
|
||||
"ShardStateAvailable": color.FgGreen,
|
||||
"ShardStateServing": color.FgBlue,
|
||||
"ShardStateErrored": color.FgRed,
|
||||
"ShardStateNew": color.FgYellow,
|
||||
}
|
||||
|
||||
for _, s := range shards {
|
||||
m := map[string]interface{}{
|
||||
"Key": s.Key,
|
||||
"State": func() string {
|
||||
if c, ok := colors[s.State]; ok {
|
||||
return color.New(c).Sprint(s.State)
|
||||
}
|
||||
return s.State
|
||||
}(),
|
||||
"Error": s.Error,
|
||||
}
|
||||
tw.Write(m)
|
||||
}
|
||||
|
||||
return tw.Flush(os.Stdout)
|
||||
return printTableShards(shards)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -265,3 +238,114 @@ var dagstoreGcCmd = &cli.Command{
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
func printTableShards(shards []api.DagstoreShardInfo) error {
|
||||
if len(shards) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
tw := tablewriter.New(
|
||||
tablewriter.Col("Key"),
|
||||
tablewriter.Col("State"),
|
||||
tablewriter.Col("Error"),
|
||||
)
|
||||
|
||||
colors := map[string]color.Attribute{
|
||||
"ShardStateAvailable": color.FgGreen,
|
||||
"ShardStateServing": color.FgBlue,
|
||||
"ShardStateErrored": color.FgRed,
|
||||
"ShardStateNew": color.FgYellow,
|
||||
}
|
||||
|
||||
for _, s := range shards {
|
||||
m := map[string]interface{}{
|
||||
"Key": s.Key,
|
||||
"State": func() string {
|
||||
if c, ok := colors[s.State]; ok {
|
||||
return color.New(c).Sprint(s.State)
|
||||
}
|
||||
return s.State
|
||||
}(),
|
||||
"Error": s.Error,
|
||||
}
|
||||
tw.Write(m)
|
||||
}
|
||||
return tw.Flush(os.Stdout)
|
||||
}
|
||||
|
||||
var dagstorePieceIndexSizeCmd = &cli.Command{
|
||||
Name: "piece-index-size",
|
||||
Usage: "Inspect the dagstore piece index size",
|
||||
Flags: []cli.Flag{
|
||||
&cli.BoolFlag{
|
||||
Name: "color",
|
||||
Usage: "use color in display output",
|
||||
DefaultText: "depends on output being a TTY",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.IsSet("color") {
|
||||
color.NoColor = !cctx.Bool("color")
|
||||
}
|
||||
|
||||
marketsApi, closer, err := lcli.GetMarketsAPI(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closer()
|
||||
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
|
||||
size, err := marketsApi.DagstorePieceIndexSize(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Println(humanize.Bytes(uint64(size)))
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
var dagstoreLookupPiecesCmd = &cli.Command{
|
||||
Name: "lookup-pieces",
|
||||
Usage: "Lookup pieces that a given CID belongs to",
|
||||
ArgsUsage: "<cid>",
|
||||
Flags: []cli.Flag{
|
||||
&cli.BoolFlag{
|
||||
Name: "color",
|
||||
Usage: "use color in display output",
|
||||
DefaultText: "depends on output being a TTY",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.IsSet("color") {
|
||||
color.NoColor = !cctx.Bool("color")
|
||||
}
|
||||
|
||||
if cctx.NArg() != 1 {
|
||||
return fmt.Errorf("must provide a CID")
|
||||
}
|
||||
|
||||
cidStr := cctx.Args().First()
|
||||
cid, err := cid.Parse(cidStr)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid CID: %w", err)
|
||||
}
|
||||
|
||||
marketsApi, closer, err := lcli.GetMarketsAPI(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closer()
|
||||
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
|
||||
shards, err := marketsApi.DagstoreLookupPieces(ctx, cid)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return printTableShards(shards)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/urfave/cli/v2"
|
||||
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
)
|
||||
|
||||
var indexProvCmd = &cli.Command{
|
||||
Name: "index",
|
||||
Usage: "Manage the index provider on the markets subsystem",
|
||||
Subcommands: []*cli.Command{
|
||||
indexProvAnnounceCmd,
|
||||
indexProvAnnounceAllCmd,
|
||||
},
|
||||
}
|
||||
|
||||
var indexProvAnnounceCmd = &cli.Command{
|
||||
Name: "announce",
|
||||
ArgsUsage: "<deal proposal cid>",
|
||||
Usage: "Announce a deal to indexers so they can download its index",
|
||||
Flags: []cli.Flag{
|
||||
&cli.BoolFlag{
|
||||
Name: "color",
|
||||
Usage: "use color in display output",
|
||||
DefaultText: "depends on output being a TTY",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.IsSet("color") {
|
||||
color.NoColor = !cctx.Bool("color")
|
||||
}
|
||||
|
||||
if cctx.NArg() != 1 {
|
||||
return fmt.Errorf("must provide the deal proposal CID")
|
||||
}
|
||||
|
||||
proposalCidStr := cctx.Args().First()
|
||||
proposalCid, err := cid.Parse(proposalCidStr)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid deal proposal CID: %w", err)
|
||||
}
|
||||
|
||||
marketsApi, closer, err := lcli.GetMarketsAPI(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closer()
|
||||
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
|
||||
return marketsApi.IndexerAnnounceDeal(ctx, proposalCid)
|
||||
},
|
||||
}
|
||||
|
||||
var indexProvAnnounceAllCmd = &cli.Command{
|
||||
Name: "announce-all",
|
||||
Usage: "Announce all active deals to indexers so they can download its indices",
|
||||
Flags: []cli.Flag{
|
||||
&cli.BoolFlag{
|
||||
Name: "color",
|
||||
Usage: "use color in display output",
|
||||
DefaultText: "depends on output being a TTY",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.IsSet("color") {
|
||||
color.NoColor = !cctx.Bool("color")
|
||||
}
|
||||
|
||||
marketsApi, closer, err := lcli.GetMarketsAPI(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closer()
|
||||
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
|
||||
return marketsApi.IndexerAnnounceAllDeals(ctx)
|
||||
},
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/fatih/color"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
"github.com/urfave/cli/v2"
|
||||
"go.opencensus.io/trace"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
cliutil "github.com/filecoin-project/lotus/cli/util"
|
||||
@@ -49,16 +48,18 @@ func main() {
|
||||
lcli.WithCategory("market", retrievalDealsCmd),
|
||||
lcli.WithCategory("market", dataTransfersCmd),
|
||||
lcli.WithCategory("market", dagstoreCmd),
|
||||
lcli.WithCategory("market", indexProvCmd),
|
||||
lcli.WithCategory("storage", sectorsCmd),
|
||||
lcli.WithCategory("storage", provingCmd),
|
||||
lcli.WithCategory("storage", storageCmd),
|
||||
lcli.WithCategory("storage", sealingCmd),
|
||||
lcli.WithCategory("retrieval", piecesCmd),
|
||||
}
|
||||
|
||||
jaeger := tracing.SetupJaegerTracing("lotus")
|
||||
defer func() {
|
||||
if jaeger != nil {
|
||||
jaeger.Flush()
|
||||
_ = jaeger.ForceFlush(context.Background())
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -66,7 +67,9 @@ func main() {
|
||||
cmd := cmd
|
||||
originBefore := cmd.Before
|
||||
cmd.Before = func(cctx *cli.Context) error {
|
||||
trace.UnregisterExporter(jaeger)
|
||||
if jaeger != nil {
|
||||
_ = jaeger.Shutdown(cctx.Context)
|
||||
}
|
||||
jaeger = tracing.SetupJaegerTracing("lotus/" + cmd.Name)
|
||||
|
||||
if cctx.IsSet("color") {
|
||||
|
||||
@@ -638,6 +638,7 @@ var dataTransfersCmd = &cli.Command{
|
||||
transfersListCmd,
|
||||
marketRestartTransfer,
|
||||
marketCancelTransfer,
|
||||
transfersDiagnosticsCmd,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -857,6 +858,38 @@ var transfersListCmd = &cli.Command{
|
||||
},
|
||||
}
|
||||
|
||||
var transfersDiagnosticsCmd = &cli.Command{
|
||||
Name: "diagnostics",
|
||||
Usage: "Get detailed diagnostics on active transfers with a specific peer",
|
||||
Flags: []cli.Flag{},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if !cctx.Args().Present() {
|
||||
return cli.ShowCommandHelp(cctx, cctx.Command.Name)
|
||||
}
|
||||
api, closer, err := lcli.GetMarketsAPI(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closer()
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
|
||||
targetPeer, err := peer.Decode(cctx.Args().First())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
diagnostics, err := api.MarketDataTransferDiagnostics(ctx, targetPeer)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
out, err := json.MarshalIndent(diagnostics, "", "\t")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(string(out))
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
var dealsPendingPublish = &cli.Command{
|
||||
Name: "pending-publish",
|
||||
Usage: "list deals waiting in publish queue",
|
||||
|
||||
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"sort"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/docker/go-units"
|
||||
@@ -137,6 +138,10 @@ var retrievalDealsListCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
sort.Slice(deals, func(i, j int) bool {
|
||||
return deals[i].ID < deals[j].ID
|
||||
})
|
||||
|
||||
w := tabwriter.NewWriter(os.Stdout, 2, 4, 2, ' ', 0)
|
||||
|
||||
_, _ = fmt.Fprintf(w, "Receiver\tDealID\tPayload\tState\tPricePerByte\tBytesSent\tMessage\n")
|
||||
|
||||
@@ -1556,7 +1556,6 @@ var sectorsMarkForUpgradeCmd = &cli.Command{
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to get chain head: %w", err)
|
||||
}
|
||||
|
||||
twoDays := abi.ChainEpoch(2 * builtin.EpochsInDay)
|
||||
if head.Height() > (build.UpgradeOhSnapHeight - twoDays) {
|
||||
return xerrors.Errorf("OhSnap is coming soon, " +
|
||||
@@ -1719,6 +1718,11 @@ var sectorsUpdateCmd = &cli.Command{
|
||||
return xerrors.Errorf("could not parse sector number: %w", err)
|
||||
}
|
||||
|
||||
_, err = nodeApi.SectorsStatus(ctx, abi.SectorNumber(id), false)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("sector %d not found, could not change state", id)
|
||||
}
|
||||
|
||||
newState := cctx.Args().Get(1)
|
||||
if _, ok := sealing.ExistSectorStateList[sealing.SectorState(newState)]; !ok {
|
||||
fmt.Printf(" \"%s\" is not a valid state. Possible states for sectors are: \n", newState)
|
||||
|
||||
@@ -48,6 +48,7 @@ stored while moving through the sealing pipeline (references as 'seal').`,
|
||||
storageListCmd,
|
||||
storageFindCmd,
|
||||
storageCleanupCmd,
|
||||
storageLocks,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -758,3 +759,43 @@ func cleanupRemovedSectorData(ctx context.Context, api api.StorageMiner, napi v0
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var storageLocks = &cli.Command{
|
||||
Name: "locks",
|
||||
Usage: "show active sector locks",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
api, closer, err := lcli.GetStorageMinerAPI(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closer()
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
|
||||
locks, err := api.StorageGetLocks(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, lock := range locks.Locks {
|
||||
st, err := api.SectorsStatus(ctx, lock.Sector.Number, false)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getting sector status(%d): %w", lock.Sector.Number, err)
|
||||
}
|
||||
|
||||
lockstr := fmt.Sprintf("%d\t%s\t", lock.Sector.Number, color.New(stateOrder[sealing.SectorState(st.State)].col).Sprint(st.State))
|
||||
|
||||
for i := 0; i < storiface.FileTypes; i++ {
|
||||
if lock.Write[i] > 0 {
|
||||
lockstr += fmt.Sprintf("%s(%s) ", storiface.SectorFileType(1<<i).String(), color.RedString("W"))
|
||||
}
|
||||
if lock.Read[i] > 0 {
|
||||
lockstr += fmt.Sprintf("%s(%s:%d) ", storiface.SectorFileType(1<<i).String(), color.GreenString("R"), lock.Read[i])
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println(lockstr)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ func main() {
|
||||
fr32Cmd,
|
||||
chainCmd,
|
||||
balancerCmd,
|
||||
sendCsvCmd,
|
||||
terminationsCmd,
|
||||
migrationsCmd,
|
||||
}
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/csv"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/urfave/cli/v2"
|
||||
"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/exitcode"
|
||||
|
||||
lapi "github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
)
|
||||
|
||||
var sendCsvCmd = &cli.Command{
|
||||
Name: "send-csv",
|
||||
Usage: "Utility for sending a batch of balance transfers",
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "from",
|
||||
Usage: "specify the account to send funds from",
|
||||
Required: true,
|
||||
},
|
||||
},
|
||||
ArgsUsage: "[csvfile]",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.NArg() != 1 {
|
||||
return xerrors.New("must supply path to csv file")
|
||||
}
|
||||
|
||||
api, closer, err := lcli.GetFullNodeAPIV1(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer closer()
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
|
||||
srv, err := lcli.GetFullNodeServices(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer srv.Close() //nolint:errcheck
|
||||
|
||||
sender, err := address.NewFromString(cctx.String("from"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fileReader, err := os.Open(cctx.Args().First())
|
||||
if err != nil {
|
||||
return xerrors.Errorf("read csv: %w", err)
|
||||
}
|
||||
|
||||
defer fileReader.Close() //nolint:errcheck
|
||||
r := csv.NewReader(fileReader)
|
||||
records, err := r.ReadAll()
|
||||
if err != nil {
|
||||
return xerrors.Errorf("read csv: %w", err)
|
||||
}
|
||||
|
||||
if strings.TrimSpace(records[0][0]) != "Recipient" ||
|
||||
strings.TrimSpace(records[0][1]) != "FIL" ||
|
||||
strings.TrimSpace(records[0][2]) != "Method" ||
|
||||
strings.TrimSpace(records[0][3]) != "Params" {
|
||||
return xerrors.Errorf("expected header row to be \"Recipient, FIL, Method, Params\"")
|
||||
}
|
||||
|
||||
var msgs []*types.Message
|
||||
for i, e := range records[1:] {
|
||||
addr, err := address.NewFromString(e[0])
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to parse address in row %d: %w", i, err)
|
||||
}
|
||||
|
||||
value, err := types.ParseFIL(strings.TrimSpace(e[1]))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to parse value balance: %w", err)
|
||||
}
|
||||
|
||||
method, err := strconv.Atoi(strings.TrimSpace(e[2]))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to parse method number: %w", err)
|
||||
}
|
||||
|
||||
var params []byte
|
||||
if strings.TrimSpace(e[3]) != "nil" {
|
||||
params, err = hex.DecodeString(strings.TrimSpace(e[3]))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to parse hexparams: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
msgs = append(msgs, &types.Message{
|
||||
To: addr,
|
||||
From: sender,
|
||||
Value: abi.TokenAmount(value),
|
||||
Method: abi.MethodNum(method),
|
||||
Params: params,
|
||||
})
|
||||
}
|
||||
|
||||
if len(msgs) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var msgCids []cid.Cid
|
||||
for i, msg := range msgs {
|
||||
smsg, err := api.MpoolPushMessage(ctx, msg, nil)
|
||||
if err != nil {
|
||||
fmt.Printf("%d, ERROR %s\n", i, err)
|
||||
continue
|
||||
}
|
||||
|
||||
fmt.Printf("%d, %s\n", i, smsg.Cid())
|
||||
|
||||
if i > 0 && i%100 == 0 {
|
||||
fmt.Printf("catching up until latest message lands")
|
||||
_, err := api.StateWaitMsg(ctx, smsg.Cid(), 1, lapi.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
msgCids = append(msgCids, smsg.Cid())
|
||||
}
|
||||
|
||||
fmt.Println("waiting on messages...")
|
||||
|
||||
for _, msgCid := range msgCids {
|
||||
ml, err := api.StateWaitMsg(ctx, msgCid, 5, lapi.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if ml.Receipt.ExitCode != exitcode.Ok {
|
||||
fmt.Printf("MSG %s NON-ZERO EXITCODE: %s\n", msgCid, ml.Receipt.ExitCode)
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println("all sent messages succeeded")
|
||||
return nil
|
||||
},
|
||||
}
|
||||
@@ -79,7 +79,7 @@ func NewBlockBuilder(ctx context.Context, logger *zap.SugaredLogger, sm *stmgr.S
|
||||
// 1. We don't charge a fee.
|
||||
// 2. The runtime has "fake" proof logic.
|
||||
// 3. We don't actually save any of the results.
|
||||
r := lrand.NewStateRand(sm.ChainStore(), parentTs.Cids(), sm.Beacon())
|
||||
r := lrand.NewStateRand(sm.ChainStore(), parentTs.Cids(), sm.Beacon(), sm.GetNetworkVersion)
|
||||
vmopt := &vm.VMOpts{
|
||||
StateBase: parentState,
|
||||
Epoch: parentTs.Height() + 1,
|
||||
@@ -88,7 +88,7 @@ func NewBlockBuilder(ctx context.Context, logger *zap.SugaredLogger, sm *stmgr.S
|
||||
Actors: filcns.NewActorRegistry(),
|
||||
Syscalls: sm.VMSys(),
|
||||
CircSupplyCalc: sm.GetVMCirculatingSupply,
|
||||
NtwkVersion: sm.GetNtwkVersion,
|
||||
NetworkVersion: sm.GetNetworkVersion(ctx, parentTs.Height()+1),
|
||||
BaseFee: abi.NewTokenAmount(0),
|
||||
LookbackState: stmgr.LookbackStateGetterForTipset(sm, parentTs),
|
||||
}
|
||||
@@ -265,7 +265,7 @@ func (bb *BlockBuilder) Height() abi.ChainEpoch {
|
||||
|
||||
// NetworkVersion returns the network version for the target block.
|
||||
func (bb *BlockBuilder) NetworkVersion() network.Version {
|
||||
return bb.sm.GetNtwkVersion(bb.ctx, bb.Height())
|
||||
return bb.sm.GetNetworkVersion(bb.ctx, bb.Height())
|
||||
}
|
||||
|
||||
// StateManager returns the stmgr.StateManager.
|
||||
|
||||
@@ -159,7 +159,7 @@ func (sim *Simulation) GetStart() *types.TipSet {
|
||||
|
||||
// GetNetworkVersion returns the current network version for the simulation.
|
||||
func (sim *Simulation) GetNetworkVersion() network.Version {
|
||||
return sim.StateManager.GetNtwkVersion(context.TODO(), sim.head.Height())
|
||||
return sim.StateManager.GetNetworkVersion(context.TODO(), sim.head.Height())
|
||||
}
|
||||
|
||||
// SetHead updates the current head of the simulation and stores it in the metadata store. This is
|
||||
|
||||
@@ -41,8 +41,8 @@ func (sim *Simulation) popNextMessages(ctx context.Context) ([]*types.Message, e
|
||||
// This isn't what the network does, but it makes things easier. Otherwise, we'd need to run
|
||||
// migrations before this epoch and I'd rather not deal with that.
|
||||
nextHeight := parentTs.Height() + 1
|
||||
prevVer := sim.StateManager.GetNtwkVersion(ctx, nextHeight-1)
|
||||
nextVer := sim.StateManager.GetNtwkVersion(ctx, nextHeight)
|
||||
prevVer := sim.StateManager.GetNetworkVersion(ctx, nextHeight-1)
|
||||
nextVer := sim.StateManager.GetNetworkVersion(ctx, nextHeight)
|
||||
if nextVer != prevVer {
|
||||
log.Warnw("packing no messages for version upgrade block",
|
||||
"old", prevVer,
|
||||
|
||||
+4
-2
@@ -39,7 +39,7 @@ func main() {
|
||||
jaeger := tracing.SetupJaegerTracing("lotus")
|
||||
defer func() {
|
||||
if jaeger != nil {
|
||||
jaeger.Flush()
|
||||
_ = jaeger.ForceFlush(context.Background())
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -47,7 +47,9 @@ func main() {
|
||||
cmd := cmd
|
||||
originBefore := cmd.Before
|
||||
cmd.Before = func(cctx *cli.Context) error {
|
||||
trace.UnregisterExporter(jaeger)
|
||||
if jaeger != nil {
|
||||
_ = jaeger.Shutdown(cctx.Context)
|
||||
}
|
||||
jaeger = tracing.SetupJaegerTracing("lotus/" + cmd.Name)
|
||||
|
||||
if originBefore != nil {
|
||||
|
||||
@@ -24,6 +24,15 @@ var ProtocolCodenames = []struct {
|
||||
{build.UpgradeTapeHeight + 1, "tape"},
|
||||
{build.UpgradeLiftoffHeight + 1, "liftoff"},
|
||||
{build.UpgradeKumquatHeight + 1, "postliftoff"},
|
||||
{build.UpgradeCalicoHeight + 1, "calico"},
|
||||
{build.UpgradePersianHeight + 1, "persian"},
|
||||
{build.UpgradeOrangeHeight + 1, "orange"},
|
||||
{build.UpgradeTrustHeight + 1, "trust"},
|
||||
{build.UpgradeNorwegianHeight + 1, "norwegian"},
|
||||
{build.UpgradeTurboHeight + 1, "turbo"},
|
||||
{build.UpgradeHyperdriveHeight + 1, "hyperdrive"},
|
||||
{build.UpgradeChocolateHeight + 1, "chocolate"},
|
||||
{build.UpgradeOhSnapHeight + 1, "ohsnap"},
|
||||
}
|
||||
|
||||
// GetProtocolCodename gets the protocol codename associated with a height.
|
||||
|
||||
+17
-10
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/fs"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -136,25 +137,31 @@ func processTipsetOpts() error {
|
||||
}
|
||||
|
||||
func execVectorDir(path string, outdir string) error {
|
||||
files, err := filepath.Glob(filepath.Join(path, "*"))
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to glob input directory %s: %w", path, err)
|
||||
}
|
||||
for _, f := range files {
|
||||
outfile := strings.TrimSuffix(filepath.Base(f), filepath.Ext(f)) + ".out"
|
||||
return filepath.WalkDir(path, func(path string, d fs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed while visiting path %s: %w", path, err)
|
||||
}
|
||||
if d.IsDir() || !strings.HasSuffix(path, "json") {
|
||||
return nil
|
||||
}
|
||||
// Create an output file to capture the output from the run of the vector.
|
||||
outfile := strings.TrimSuffix(filepath.Base(path), filepath.Ext(path)) + ".out"
|
||||
outpath := filepath.Join(outdir, outfile)
|
||||
outw, err := os.Create(outpath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create file %s: %w", outpath, err)
|
||||
}
|
||||
|
||||
log.Printf("processing vector %s; sending output to %s", f, outpath)
|
||||
log.Printf("processing vector %s; sending output to %s", path, outpath)
|
||||
|
||||
// Actually run the vector.
|
||||
log.SetOutput(io.MultiWriter(os.Stderr, outw)) // tee the output.
|
||||
_, _ = execVectorFile(new(conformance.LogReporter), f)
|
||||
_, _ = execVectorFile(new(conformance.LogReporter), path)
|
||||
log.SetOutput(os.Stderr)
|
||||
_ = outw.Close()
|
||||
}
|
||||
return nil
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func execVectorsStdin() error {
|
||||
|
||||
+20
-14
@@ -8,12 +8,11 @@ import (
|
||||
"io"
|
||||
"log"
|
||||
|
||||
"github.com/filecoin-project/lotus/api/v0api"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/filecoin-project/go-address"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/api/v0api"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/reward"
|
||||
@@ -43,6 +42,15 @@ func doExtractMessage(opts extractOpts) error {
|
||||
return fmt.Errorf("failed to resolve message and tipsets from chain: %w", err)
|
||||
}
|
||||
|
||||
// Assumes that the desired message isn't at the boundary of network versions.
|
||||
// Otherwise this will be inaccurate. But it's such a tiny edge case that
|
||||
// it's not worth spending the time to support boundary messages unless
|
||||
// actually needed.
|
||||
nv, err := FullAPI.StateNetworkVersion(ctx, incTs.Key())
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to resolve network version from inclusion height: %w", err)
|
||||
}
|
||||
|
||||
// get the circulating supply before the message was executed.
|
||||
circSupplyDetail, err := FullAPI.StateVMCirculatingSupplyInternal(ctx, incTs.Key())
|
||||
if err != nil {
|
||||
@@ -53,6 +61,7 @@ func doExtractMessage(opts extractOpts) error {
|
||||
|
||||
log.Printf("message was executed in tipset: %s", execTs.Key())
|
||||
log.Printf("message was included in tipset: %s", incTs.Key())
|
||||
log.Printf("network version at inclusion: %d", nv)
|
||||
log.Printf("circulating supply at inclusion tipset: %d", circSupply)
|
||||
log.Printf("finding precursor messages using mode: %s", opts.precursor)
|
||||
|
||||
@@ -110,7 +119,8 @@ func doExtractMessage(opts extractOpts) error {
|
||||
CircSupply: circSupplyDetail.FilCirculating,
|
||||
BaseFee: basefee,
|
||||
// recorded randomness will be discarded.
|
||||
Rand: conformance.NewRecordingRand(new(conformance.LogReporter), FullAPI),
|
||||
Rand: conformance.NewRecordingRand(new(conformance.LogReporter), FullAPI),
|
||||
NetworkVersion: nv,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to execute precursor message: %w", err)
|
||||
@@ -140,12 +150,13 @@ func doExtractMessage(opts extractOpts) error {
|
||||
|
||||
preroot = root
|
||||
applyret, postroot, err = driver.ExecuteMessage(pst.Blockstore, conformance.ExecuteMessageParams{
|
||||
Preroot: preroot,
|
||||
Epoch: execTs.Height(),
|
||||
Message: msg,
|
||||
CircSupply: circSupplyDetail.FilCirculating,
|
||||
BaseFee: basefee,
|
||||
Rand: recordingRand,
|
||||
Preroot: preroot,
|
||||
Epoch: execTs.Height(),
|
||||
Message: msg,
|
||||
CircSupply: circSupplyDetail.FilCirculating,
|
||||
BaseFee: basefee,
|
||||
Rand: recordingRand,
|
||||
NetworkVersion: nv,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to execute message: %w", err)
|
||||
@@ -263,11 +274,6 @@ func doExtractMessage(opts extractOpts) error {
|
||||
return err
|
||||
}
|
||||
|
||||
nv, err := FullAPI.StateNetworkVersion(ctx, execTs.Key())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
codename := GetProtocolCodename(execTs.Height())
|
||||
|
||||
// Write out the test vector.
|
||||
|
||||
@@ -129,6 +129,7 @@ func runSimulateCmd(_ *cli.Context) error {
|
||||
CircSupply: circSupply.FilCirculating,
|
||||
BaseFee: baseFee,
|
||||
Rand: rand,
|
||||
// TODO NetworkVersion
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to apply message: %w", err)
|
||||
|
||||
+11
-15
@@ -5,6 +5,8 @@ import (
|
||||
gobig "math/big"
|
||||
"os"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
|
||||
"github.com/filecoin-project/lotus/blockstore"
|
||||
"github.com/filecoin-project/lotus/chain/consensus/filcns"
|
||||
"github.com/filecoin-project/lotus/chain/state"
|
||||
@@ -187,11 +189,12 @@ func (d *Driver) ExecuteTipset(bs blockstore.Blockstore, ds ds.Batching, params
|
||||
}
|
||||
|
||||
type ExecuteMessageParams struct {
|
||||
Preroot cid.Cid
|
||||
Epoch abi.ChainEpoch
|
||||
Message *types.Message
|
||||
CircSupply abi.TokenAmount
|
||||
BaseFee abi.TokenAmount
|
||||
Preroot cid.Cid
|
||||
Epoch abi.ChainEpoch
|
||||
Message *types.Message
|
||||
CircSupply abi.TokenAmount
|
||||
BaseFee abi.TokenAmount
|
||||
NetworkVersion network.Version
|
||||
|
||||
// Rand is an optional vm.Rand implementation to use. If nil, the driver
|
||||
// will use a vm.Rand that returns a fixed value for all calls.
|
||||
@@ -210,13 +213,6 @@ func (d *Driver) ExecuteMessage(bs blockstore.Blockstore, params ExecuteMessageP
|
||||
params.Rand = NewFixedRand()
|
||||
}
|
||||
|
||||
// dummy state manager; only to reference the GetNetworkVersion method,
|
||||
// which does not depend on state.
|
||||
sm, err := stmgr.NewStateManager(nil, filcns.NewTipSetExecutor(), nil, filcns.DefaultUpgradeSchedule(), nil)
|
||||
if err != nil {
|
||||
return nil, cid.Cid{}, err
|
||||
}
|
||||
|
||||
vmOpts := &vm.VMOpts{
|
||||
StateBase: params.Preroot,
|
||||
Epoch: params.Epoch,
|
||||
@@ -225,9 +221,9 @@ func (d *Driver) ExecuteMessage(bs blockstore.Blockstore, params ExecuteMessageP
|
||||
CircSupplyCalc: func(_ context.Context, _ abi.ChainEpoch, _ *state.StateTree) (abi.TokenAmount, error) {
|
||||
return params.CircSupply, nil
|
||||
},
|
||||
Rand: params.Rand,
|
||||
BaseFee: params.BaseFee,
|
||||
NtwkVersion: sm.GetNtwkVersion,
|
||||
Rand: params.Rand,
|
||||
BaseFee: params.BaseFee,
|
||||
NetworkVersion: params.NetworkVersion,
|
||||
}
|
||||
|
||||
lvm, err := vm.NewVM(context.TODO(), vmOpts)
|
||||
|
||||
@@ -19,22 +19,10 @@ func NewFixedRand() vm.Rand {
|
||||
return &fixedRand{}
|
||||
}
|
||||
|
||||
func (r *fixedRand) GetChainRandomnessV1(_ context.Context, _ crypto.DomainSeparationTag, _ abi.ChainEpoch, _ []byte) ([]byte, error) {
|
||||
func (r *fixedRand) GetChainRandomness(_ context.Context, _ crypto.DomainSeparationTag, _ abi.ChainEpoch, _ []byte) ([]byte, error) {
|
||||
return []byte("i_am_random_____i_am_random_____"), nil // 32 bytes.
|
||||
}
|
||||
|
||||
func (r *fixedRand) GetChainRandomnessV2(_ context.Context, _ crypto.DomainSeparationTag, _ abi.ChainEpoch, _ []byte) ([]byte, error) {
|
||||
return []byte("i_am_random_____i_am_random_____"), nil // 32 bytes.
|
||||
}
|
||||
|
||||
func (r *fixedRand) GetBeaconRandomnessV3(_ context.Context, _ crypto.DomainSeparationTag, _ abi.ChainEpoch, _ []byte) ([]byte, error) {
|
||||
return []byte("i_am_random_____i_am_random_____"), nil // 32 bytes.
|
||||
}
|
||||
|
||||
func (r *fixedRand) GetBeaconRandomnessV1(_ context.Context, _ crypto.DomainSeparationTag, _ abi.ChainEpoch, _ []byte) ([]byte, error) {
|
||||
return []byte("i_am_random_____i_am_random_____"), nil // 32 bytes.
|
||||
}
|
||||
|
||||
func (r *fixedRand) GetBeaconRandomnessV2(_ context.Context, _ crypto.DomainSeparationTag, _ abi.ChainEpoch, _ []byte) ([]byte, error) {
|
||||
func (r *fixedRand) GetBeaconRandomness(_ context.Context, _ crypto.DomainSeparationTag, _ abi.ChainEpoch, _ []byte) ([]byte, error) {
|
||||
return []byte("i_am_random_____i_am_random_____"), nil // 32 bytes.
|
||||
}
|
||||
|
||||
@@ -45,17 +45,9 @@ func (r *RecordingRand) loadHead() {
|
||||
r.head = head.Key()
|
||||
}
|
||||
|
||||
func (r *RecordingRand) GetChainRandomnessV2(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
return r.getChainRandomness(ctx, pers, round, entropy)
|
||||
}
|
||||
|
||||
func (r *RecordingRand) GetChainRandomnessV1(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
return r.getChainRandomness(ctx, pers, round, entropy)
|
||||
}
|
||||
|
||||
func (r *RecordingRand) getChainRandomness(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
func (r *RecordingRand) GetChainRandomness(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
r.once.Do(r.loadHead)
|
||||
// FullNode's ChainGetRandomnessFromTickets handles whether we should be looking forward or back
|
||||
// FullNode's v0 ChainGetRandomnessFromTickets handles whether we should be looking forward or back
|
||||
ret, err := r.api.ChainGetRandomnessFromTickets(ctx, r.head, pers, round, entropy)
|
||||
if err != nil {
|
||||
return ret, err
|
||||
@@ -79,19 +71,7 @@ func (r *RecordingRand) getChainRandomness(ctx context.Context, pers crypto.Doma
|
||||
return ret, err
|
||||
}
|
||||
|
||||
func (r *RecordingRand) GetBeaconRandomnessV3(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
return r.getBeaconRandomness(ctx, pers, round, entropy)
|
||||
}
|
||||
|
||||
func (r *RecordingRand) GetBeaconRandomnessV1(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
return r.getBeaconRandomness(ctx, pers, round, entropy)
|
||||
}
|
||||
|
||||
func (r *RecordingRand) GetBeaconRandomnessV2(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
return r.getBeaconRandomness(ctx, pers, round, entropy)
|
||||
}
|
||||
|
||||
func (r *RecordingRand) getBeaconRandomness(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
func (r *RecordingRand) GetBeaconRandomness(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
r.once.Do(r.loadHead)
|
||||
ret, err := r.api.StateGetRandomnessFromBeacon(ctx, pers, round, entropy, r.head)
|
||||
if err != nil {
|
||||
|
||||
@@ -43,15 +43,7 @@ func (r *ReplayingRand) match(requested schema.RandomnessRule) ([]byte, bool) {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
func (r *ReplayingRand) GetChainRandomnessV1(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
return r.getChainRandomness(ctx, pers, round, entropy, false)
|
||||
}
|
||||
|
||||
func (r *ReplayingRand) GetChainRandomnessV2(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
return r.getChainRandomness(ctx, pers, round, entropy, true)
|
||||
}
|
||||
|
||||
func (r *ReplayingRand) getChainRandomness(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte, lookback bool) ([]byte, error) {
|
||||
func (r *ReplayingRand) GetChainRandomness(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
rule := schema.RandomnessRule{
|
||||
Kind: schema.RandomnessChain,
|
||||
DomainSeparationTag: int64(pers),
|
||||
@@ -66,26 +58,10 @@ func (r *ReplayingRand) getChainRandomness(ctx context.Context, pers crypto.Doma
|
||||
|
||||
r.reporter.Logf("returning fallback chain randomness: dst=%d, epoch=%d, entropy=%x", pers, round, entropy)
|
||||
|
||||
if lookback {
|
||||
return r.fallback.GetChainRandomnessV1(ctx, pers, round, entropy)
|
||||
}
|
||||
|
||||
return r.fallback.GetChainRandomnessV2(ctx, pers, round, entropy)
|
||||
return r.fallback.GetChainRandomness(ctx, pers, round, entropy)
|
||||
}
|
||||
|
||||
func (r *ReplayingRand) GetBeaconRandomnessV3(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
return r.getBeaconRandomness(ctx, pers, round, entropy, false)
|
||||
}
|
||||
|
||||
func (r *ReplayingRand) GetBeaconRandomnessV1(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
return r.getBeaconRandomness(ctx, pers, round, entropy, true)
|
||||
}
|
||||
|
||||
func (r *ReplayingRand) GetBeaconRandomnessV2(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
return r.getBeaconRandomness(ctx, pers, round, entropy, true)
|
||||
}
|
||||
|
||||
func (r *ReplayingRand) getBeaconRandomness(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte, lookback bool) ([]byte, error) {
|
||||
func (r *ReplayingRand) GetBeaconRandomness(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) {
|
||||
rule := schema.RandomnessRule{
|
||||
Kind: schema.RandomnessBeacon,
|
||||
DomainSeparationTag: int64(pers),
|
||||
@@ -100,9 +76,5 @@ func (r *ReplayingRand) getBeaconRandomness(ctx context.Context, pers crypto.Dom
|
||||
|
||||
r.reporter.Logf("returning fallback beacon randomness: dst=%d, epoch=%d, entropy=%x", pers, round, entropy)
|
||||
|
||||
if lookback {
|
||||
return r.fallback.GetBeaconRandomnessV1(ctx, pers, round, entropy)
|
||||
}
|
||||
|
||||
return r.fallback.GetBeaconRandomnessV3(ctx, pers, round, entropy)
|
||||
return r.fallback.GetBeaconRandomness(ctx, pers, round, entropy)
|
||||
}
|
||||
|
||||
+65
-8
@@ -7,6 +7,7 @@ import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
@@ -14,6 +15,7 @@ import (
|
||||
"github.com/fatih/color"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/exitcode"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
"github.com/hashicorp/go-multierror"
|
||||
blocks "github.com/ipfs/go-block-format"
|
||||
"github.com/ipfs/go-blockservice"
|
||||
@@ -27,6 +29,7 @@ import (
|
||||
"github.com/filecoin-project/test-vectors/schema"
|
||||
|
||||
"github.com/filecoin-project/lotus/blockstore"
|
||||
"github.com/filecoin-project/lotus/chain/consensus/filcns"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/vm"
|
||||
)
|
||||
@@ -50,11 +53,58 @@ var TipsetVectorOpts struct {
|
||||
OnTipsetApplied []func(bs blockstore.Blockstore, params *ExecuteTipsetParams, res *ExecuteTipsetResult)
|
||||
}
|
||||
|
||||
type GasPricingRestoreFn func()
|
||||
|
||||
// adjustGasPricing adjusts the global gas price mapping to make sure that the
|
||||
// gas pricelist for vector's network version is used at the vector's epoch.
|
||||
// Because it manipulates a global, it returns a function that reverts the
|
||||
// change. The caller MUST invoke this function or the test vector runner will
|
||||
// become invalid.
|
||||
func adjustGasPricing(vectorEpoch abi.ChainEpoch, vectorNv network.Version) GasPricingRestoreFn {
|
||||
// Stash the current pricing mapping.
|
||||
// Ok to take a reference instead of a copy, because we override the map
|
||||
// with a new one below.
|
||||
var old = vm.Prices
|
||||
|
||||
// Resolve the epoch at which the vector network version kicks in.
|
||||
var epoch abi.ChainEpoch = math.MaxInt64
|
||||
if vectorNv == network.Version0 {
|
||||
// genesis is not an upgrade.
|
||||
epoch = 0
|
||||
} else {
|
||||
for _, u := range filcns.DefaultUpgradeSchedule() {
|
||||
if u.Network == vectorNv {
|
||||
epoch = u.Height
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if epoch == math.MaxInt64 {
|
||||
panic(fmt.Sprintf("could not resolve network version %d to height", vectorNv))
|
||||
}
|
||||
|
||||
// Find the right pricelist for this network version.
|
||||
pricelist := vm.PricelistByEpoch(epoch)
|
||||
|
||||
// Override the pricing mapping by setting the relevant pricelist for the
|
||||
// network version at the epoch where the vector runs.
|
||||
vm.Prices = map[abi.ChainEpoch]vm.Pricelist{
|
||||
vectorEpoch: pricelist,
|
||||
}
|
||||
|
||||
// Return a function to restore the original mapping.
|
||||
return func() {
|
||||
vm.Prices = old
|
||||
}
|
||||
}
|
||||
|
||||
// ExecuteMessageVector executes a message-class test vector.
|
||||
func ExecuteMessageVector(r Reporter, vector *schema.TestVector, variant *schema.Variant) (diffs []string, err error) {
|
||||
var (
|
||||
ctx = context.Background()
|
||||
baseEpoch = variant.Epoch
|
||||
baseEpoch = abi.ChainEpoch(variant.Epoch)
|
||||
nv = network.Version(variant.NetworkVersion)
|
||||
root = vector.Pre.StateTree.RootCID
|
||||
)
|
||||
|
||||
@@ -67,6 +117,10 @@ func ExecuteMessageVector(r Reporter, vector *schema.TestVector, variant *schema
|
||||
// Create a new Driver.
|
||||
driver := NewDriver(ctx, vector.Selector, DriverOpts{DisableVMFlush: true})
|
||||
|
||||
// Monkey patch the gas pricing.
|
||||
revertFn := adjustGasPricing(baseEpoch, nv)
|
||||
defer revertFn()
|
||||
|
||||
// Apply every message.
|
||||
for i, m := range vector.ApplyMessages {
|
||||
msg, err := types.DecodeMessage(m.Bytes)
|
||||
@@ -76,18 +130,19 @@ func ExecuteMessageVector(r Reporter, vector *schema.TestVector, variant *schema
|
||||
|
||||
// add the epoch offset if one is set.
|
||||
if m.EpochOffset != nil {
|
||||
baseEpoch += *m.EpochOffset
|
||||
baseEpoch += abi.ChainEpoch(*m.EpochOffset)
|
||||
}
|
||||
|
||||
// Execute the message.
|
||||
var ret *vm.ApplyRet
|
||||
ret, root, err = driver.ExecuteMessage(bs, ExecuteMessageParams{
|
||||
Preroot: root,
|
||||
Epoch: abi.ChainEpoch(baseEpoch),
|
||||
Message: msg,
|
||||
BaseFee: BaseFeeOrDefault(vector.Pre.BaseFee),
|
||||
CircSupply: CircSupplyOrDefault(vector.Pre.CircSupply),
|
||||
Rand: NewReplayingRand(r, vector.Randomness),
|
||||
Preroot: root,
|
||||
Epoch: baseEpoch,
|
||||
Message: msg,
|
||||
BaseFee: BaseFeeOrDefault(vector.Pre.BaseFee),
|
||||
CircSupply: CircSupplyOrDefault(vector.Pre.CircSupply),
|
||||
Rand: NewReplayingRand(r, vector.Randomness),
|
||||
NetworkVersion: nv,
|
||||
})
|
||||
if err != nil {
|
||||
r.Fatalf("fatal failure when executing message: %s", err)
|
||||
@@ -184,8 +239,10 @@ func ExecuteTipsetVector(r Reporter, vector *schema.TestVector, variant *schema.
|
||||
func AssertMsgResult(r Reporter, expected *schema.Receipt, actual *vm.ApplyRet, label string) {
|
||||
r.Helper()
|
||||
|
||||
applyret := actual
|
||||
if expected, actual := exitcode.ExitCode(expected.ExitCode), actual.ExitCode; expected != actual {
|
||||
r.Errorf("exit code of msg %s did not match; expected: %s, got: %s", label, expected, actual)
|
||||
r.Errorf("\t\\==> actor error: %s", applyret.ActorErr)
|
||||
}
|
||||
if expected, actual := expected.GasUsed, actual.GasUsed; expected != actual {
|
||||
r.Errorf("gas used of msg %s did not match; expected: %d, got: %d", label, expected, actual)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -103,7 +103,9 @@ Response:
|
||||
"MemSwap": 42,
|
||||
"MemSwapUsed": 42,
|
||||
"CPUs": 42,
|
||||
"GPUs": null,
|
||||
"GPUs": [
|
||||
"string value"
|
||||
],
|
||||
"Resources": {
|
||||
"seal/v0/addpiece": {
|
||||
"0": {
|
||||
@@ -597,6 +599,334 @@ Response:
|
||||
"BaseMinMemory": 1073741824
|
||||
}
|
||||
},
|
||||
"seal/v0/provereplicaupdate/1": {
|
||||
"0": {
|
||||
"MinMemory": 2048,
|
||||
"MaxMemory": 2048,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 0,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 2048
|
||||
},
|
||||
"1": {
|
||||
"MinMemory": 8388608,
|
||||
"MaxMemory": 8388608,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 0,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 8388608
|
||||
},
|
||||
"2": {
|
||||
"MinMemory": 1073741824,
|
||||
"MaxMemory": 1073741824,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 0,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 1073741824
|
||||
},
|
||||
"3": {
|
||||
"MinMemory": 1073741824,
|
||||
"MaxMemory": 1073741824,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 0,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 1073741824
|
||||
},
|
||||
"4": {
|
||||
"MinMemory": 1073741824,
|
||||
"MaxMemory": 1073741824,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 0,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 1073741824
|
||||
},
|
||||
"5": {
|
||||
"MinMemory": 2048,
|
||||
"MaxMemory": 2048,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 0,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 2048
|
||||
},
|
||||
"6": {
|
||||
"MinMemory": 8388608,
|
||||
"MaxMemory": 8388608,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 0,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 8388608
|
||||
},
|
||||
"7": {
|
||||
"MinMemory": 1073741824,
|
||||
"MaxMemory": 1073741824,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 0,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 1073741824
|
||||
},
|
||||
"8": {
|
||||
"MinMemory": 1073741824,
|
||||
"MaxMemory": 1073741824,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 0,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 1073741824
|
||||
},
|
||||
"9": {
|
||||
"MinMemory": 1073741824,
|
||||
"MaxMemory": 1073741824,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 0,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 1073741824
|
||||
}
|
||||
},
|
||||
"seal/v0/provereplicaupdate/2": {
|
||||
"0": {
|
||||
"MinMemory": 2048,
|
||||
"MaxMemory": 2048,
|
||||
"GPUUtilization": 1,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 2048
|
||||
},
|
||||
"1": {
|
||||
"MinMemory": 8388608,
|
||||
"MaxMemory": 8388608,
|
||||
"GPUUtilization": 1,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 8388608
|
||||
},
|
||||
"2": {
|
||||
"MinMemory": 1073741824,
|
||||
"MaxMemory": 1610612736,
|
||||
"GPUUtilization": 1,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 10737418240
|
||||
},
|
||||
"3": {
|
||||
"MinMemory": 32212254720,
|
||||
"MaxMemory": 161061273600,
|
||||
"GPUUtilization": 1,
|
||||
"MaxParallelism": -1,
|
||||
"MaxParallelismGPU": 6,
|
||||
"BaseMinMemory": 34359738368
|
||||
},
|
||||
"4": {
|
||||
"MinMemory": 64424509440,
|
||||
"MaxMemory": 204010946560,
|
||||
"GPUUtilization": 1,
|
||||
"MaxParallelism": -1,
|
||||
"MaxParallelismGPU": 6,
|
||||
"BaseMinMemory": 68719476736
|
||||
},
|
||||
"5": {
|
||||
"MinMemory": 2048,
|
||||
"MaxMemory": 2048,
|
||||
"GPUUtilization": 1,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 2048
|
||||
},
|
||||
"6": {
|
||||
"MinMemory": 8388608,
|
||||
"MaxMemory": 8388608,
|
||||
"GPUUtilization": 1,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 8388608
|
||||
},
|
||||
"7": {
|
||||
"MinMemory": 1073741824,
|
||||
"MaxMemory": 1610612736,
|
||||
"GPUUtilization": 1,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 10737418240
|
||||
},
|
||||
"8": {
|
||||
"MinMemory": 32212254720,
|
||||
"MaxMemory": 161061273600,
|
||||
"GPUUtilization": 1,
|
||||
"MaxParallelism": -1,
|
||||
"MaxParallelismGPU": 6,
|
||||
"BaseMinMemory": 34359738368
|
||||
},
|
||||
"9": {
|
||||
"MinMemory": 64424509440,
|
||||
"MaxMemory": 204010946560,
|
||||
"GPUUtilization": 1,
|
||||
"MaxParallelism": -1,
|
||||
"MaxParallelismGPU": 6,
|
||||
"BaseMinMemory": 68719476736
|
||||
}
|
||||
},
|
||||
"seal/v0/regensectorkey": {
|
||||
"0": {
|
||||
"MinMemory": 2048,
|
||||
"MaxMemory": 2048,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 2048
|
||||
},
|
||||
"1": {
|
||||
"MinMemory": 8388608,
|
||||
"MaxMemory": 8388608,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 8388608
|
||||
},
|
||||
"2": {
|
||||
"MinMemory": 1073741824,
|
||||
"MaxMemory": 1073741824,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 1073741824
|
||||
},
|
||||
"3": {
|
||||
"MinMemory": 4294967296,
|
||||
"MaxMemory": 4294967296,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 1073741824
|
||||
},
|
||||
"4": {
|
||||
"MinMemory": 8589934592,
|
||||
"MaxMemory": 8589934592,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 1073741824
|
||||
},
|
||||
"5": {
|
||||
"MinMemory": 2048,
|
||||
"MaxMemory": 2048,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 2048
|
||||
},
|
||||
"6": {
|
||||
"MinMemory": 8388608,
|
||||
"MaxMemory": 8388608,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 8388608
|
||||
},
|
||||
"7": {
|
||||
"MinMemory": 1073741824,
|
||||
"MaxMemory": 1073741824,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 1073741824
|
||||
},
|
||||
"8": {
|
||||
"MinMemory": 4294967296,
|
||||
"MaxMemory": 4294967296,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 1073741824
|
||||
},
|
||||
"9": {
|
||||
"MinMemory": 8589934592,
|
||||
"MaxMemory": 8589934592,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 1073741824
|
||||
}
|
||||
},
|
||||
"seal/v0/replicaupdate": {
|
||||
"0": {
|
||||
"MinMemory": 2048,
|
||||
"MaxMemory": 2048,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 2048
|
||||
},
|
||||
"1": {
|
||||
"MinMemory": 8388608,
|
||||
"MaxMemory": 8388608,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 8388608
|
||||
},
|
||||
"2": {
|
||||
"MinMemory": 1073741824,
|
||||
"MaxMemory": 1073741824,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 1073741824
|
||||
},
|
||||
"3": {
|
||||
"MinMemory": 4294967296,
|
||||
"MaxMemory": 4294967296,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 1073741824
|
||||
},
|
||||
"4": {
|
||||
"MinMemory": 8589934592,
|
||||
"MaxMemory": 8589934592,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 1073741824
|
||||
},
|
||||
"5": {
|
||||
"MinMemory": 2048,
|
||||
"MaxMemory": 2048,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 2048
|
||||
},
|
||||
"6": {
|
||||
"MinMemory": 8388608,
|
||||
"MaxMemory": 8388608,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 8388608
|
||||
},
|
||||
"7": {
|
||||
"MinMemory": 1073741824,
|
||||
"MaxMemory": 1073741824,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 1073741824
|
||||
},
|
||||
"8": {
|
||||
"MinMemory": 4294967296,
|
||||
"MaxMemory": 4294967296,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 1073741824
|
||||
},
|
||||
"9": {
|
||||
"MinMemory": 8589934592,
|
||||
"MaxMemory": 8589934592,
|
||||
"GPUUtilization": 0,
|
||||
"MaxParallelism": 1,
|
||||
"MaxParallelismGPU": 0,
|
||||
"BaseMinMemory": 1073741824
|
||||
}
|
||||
},
|
||||
"seal/v0/unseal": {
|
||||
"0": {
|
||||
"MinMemory": 2048,
|
||||
@@ -691,7 +1021,18 @@ Perms: admin
|
||||
|
||||
Inputs: `null`
|
||||
|
||||
Response: `null`
|
||||
Response:
|
||||
```json
|
||||
[
|
||||
{
|
||||
"ID": "76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8",
|
||||
"Weight": 42,
|
||||
"LocalPath": "string value",
|
||||
"CanSeal": true,
|
||||
"CanStore": true
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### Remove
|
||||
Storage / Other
|
||||
@@ -749,7 +1090,9 @@ Inputs:
|
||||
},
|
||||
"ProofType": 8
|
||||
},
|
||||
null,
|
||||
[
|
||||
1024
|
||||
],
|
||||
1024,
|
||||
{}
|
||||
]
|
||||
@@ -784,7 +1127,12 @@ Inputs:
|
||||
},
|
||||
"ProofType": 8
|
||||
},
|
||||
null
|
||||
[
|
||||
{
|
||||
"Offset": 1024,
|
||||
"Size": 1024
|
||||
}
|
||||
]
|
||||
]
|
||||
```
|
||||
|
||||
@@ -946,7 +1294,9 @@ Inputs:
|
||||
{
|
||||
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
|
||||
},
|
||||
null
|
||||
[
|
||||
"Ynl0ZSBhcnJheQ=="
|
||||
]
|
||||
]
|
||||
```
|
||||
|
||||
@@ -979,7 +1329,12 @@ Inputs:
|
||||
},
|
||||
"ProofType": 8
|
||||
},
|
||||
null
|
||||
[
|
||||
{
|
||||
"Offset": 1024,
|
||||
"Size": 1024
|
||||
}
|
||||
]
|
||||
]
|
||||
```
|
||||
|
||||
@@ -1012,7 +1367,14 @@ Inputs:
|
||||
},
|
||||
"ProofType": 8
|
||||
},
|
||||
null
|
||||
[
|
||||
{
|
||||
"Size": 1032,
|
||||
"PieceCID": {
|
||||
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
```
|
||||
|
||||
@@ -1045,9 +1407,16 @@ Inputs:
|
||||
},
|
||||
"ProofType": 8
|
||||
},
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
"Bw==",
|
||||
"Bw==",
|
||||
[
|
||||
{
|
||||
"Size": 1032,
|
||||
"PieceCID": {
|
||||
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
|
||||
}
|
||||
}
|
||||
],
|
||||
{
|
||||
"Unsealed": {
|
||||
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
|
||||
@@ -1085,7 +1454,7 @@ Inputs:
|
||||
},
|
||||
"ProofType": 8
|
||||
},
|
||||
null
|
||||
"Bw=="
|
||||
]
|
||||
```
|
||||
|
||||
@@ -1115,8 +1484,15 @@ Inputs:
|
||||
},
|
||||
"ProofType": 8
|
||||
},
|
||||
null,
|
||||
null
|
||||
"Bw==",
|
||||
[
|
||||
{
|
||||
"Size": 1032,
|
||||
"PieceCID": {
|
||||
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
```
|
||||
|
||||
@@ -1146,7 +1522,7 @@ Inputs:
|
||||
},
|
||||
"ProofType": 8
|
||||
},
|
||||
null
|
||||
"Bw=="
|
||||
]
|
||||
```
|
||||
|
||||
@@ -1263,7 +1639,7 @@ Inputs:
|
||||
},
|
||||
1040384,
|
||||
1024,
|
||||
null,
|
||||
"Bw==",
|
||||
{
|
||||
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
|
||||
}
|
||||
|
||||
+1596
-107
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+277
-105
@@ -7,7 +7,7 @@ USAGE:
|
||||
lotus-miner [global options] command [command options] [arguments...]
|
||||
|
||||
VERSION:
|
||||
1.14.0-rc1
|
||||
1.15.0-dev
|
||||
|
||||
COMMANDS:
|
||||
init Initialize a lotus miner repo
|
||||
@@ -30,6 +30,7 @@ COMMANDS:
|
||||
retrieval-deals Manage retrieval deals and related configuration
|
||||
data-transfers Manage data transfers
|
||||
dagstore Manage the dagstore on the markets subsystem
|
||||
index Manage the index provider on the markets subsystem
|
||||
NETWORK:
|
||||
net Manage P2P Network
|
||||
RETRIEVAL:
|
||||
@@ -78,7 +79,6 @@ OPTIONS:
|
||||
--gas-premium value set gas premium for initialization messages in AttoFIL (default: "0")
|
||||
--from value select which address to send actor creation message from
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -160,8 +160,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -203,11 +202,11 @@ USAGE:
|
||||
|
||||
DESCRIPTION:
|
||||
The backup command writes a copy of node metadata under the specified path
|
||||
|
||||
Online backups:
|
||||
For security reasons, the daemon must be have LOTUS_BACKUP_BASE_PATH env var set
|
||||
to a path where backup files are supposed to be saved, and the path specified in
|
||||
this command must be within this base path
|
||||
|
||||
Online backups:
|
||||
For security reasons, the daemon must be have LOTUS_BACKUP_BASE_PATH env var set
|
||||
to a path where backup files are supposed to be saved, and the path specified in
|
||||
this command must be within this base path
|
||||
|
||||
OPTIONS:
|
||||
--offline create backup without the node running (default: false)
|
||||
@@ -249,8 +248,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -339,8 +337,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -433,7 +430,6 @@ OPTIONS:
|
||||
--hide-sectors-info hide sectors info (default: false)
|
||||
--blocks value Log of produced <blocks> newest blocks and rewards(Miner Fee excluded) (default: 0)
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -464,8 +460,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -512,8 +507,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -540,23 +534,22 @@ USAGE:
|
||||
|
||||
DESCRIPTION:
|
||||
Set the log level for logging systems:
|
||||
|
||||
The system flag can be specified multiple times.
|
||||
|
||||
eg) log set-level --system chain --system chainxchg debug
|
||||
|
||||
Available Levels:
|
||||
debug
|
||||
info
|
||||
warn
|
||||
error
|
||||
|
||||
Environment Variables:
|
||||
GOLOG_LOG_LEVEL - Default log level for all log systems
|
||||
GOLOG_LOG_FMT - Change output log format (json, nocolor)
|
||||
GOLOG_FILE - Write logs to file
|
||||
GOLOG_OUTPUT - Specify whether to output to file, stderr, stdout or a combination, i.e. file+stderr
|
||||
|
||||
|
||||
The system flag can be specified multiple times.
|
||||
|
||||
eg) log set-level --system chain --system chainxchg debug
|
||||
|
||||
Available Levels:
|
||||
debug
|
||||
info
|
||||
warn
|
||||
error
|
||||
|
||||
Environment Variables:
|
||||
GOLOG_LOG_LEVEL - Default log level for all log systems
|
||||
GOLOG_LOG_FMT - Change output log format (json, nocolor)
|
||||
GOLOG_FILE - Write logs to file
|
||||
GOLOG_OUTPUT - Specify whether to output to file, stderr, stdout or a combination, i.e. file+stderr
|
||||
|
||||
OPTIONS:
|
||||
--system value limit to log system
|
||||
@@ -634,8 +627,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -683,8 +675,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -856,8 +847,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -876,8 +866,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -974,14 +963,14 @@ USAGE:
|
||||
lotus-miner data-transfers command [command options] [arguments...]
|
||||
|
||||
COMMANDS:
|
||||
list List ongoing data transfers for this miner
|
||||
restart Force restart a stalled data transfer
|
||||
cancel Force cancel a data transfer
|
||||
help, h Shows a list of commands or help for one command
|
||||
list List ongoing data transfers for this miner
|
||||
restart Force restart a stalled data transfer
|
||||
cancel Force cancel a data transfer
|
||||
diagnostics Get detailed diagnostics on active transfers with a specific peer
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -1034,6 +1023,19 @@ OPTIONS:
|
||||
|
||||
```
|
||||
|
||||
### lotus-miner data-transfers diagnostics
|
||||
```
|
||||
NAME:
|
||||
lotus-miner data-transfers diagnostics - Get detailed diagnostics on active transfers with a specific peer
|
||||
|
||||
USAGE:
|
||||
lotus-miner data-transfers diagnostics [command options] [arguments...]
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
## lotus-miner dagstore
|
||||
```
|
||||
NAME:
|
||||
@@ -1048,11 +1050,12 @@ COMMANDS:
|
||||
recover-shard Attempt to recover a shard in errored state
|
||||
initialize-all Initialize all uninitialized shards, streaming results as they're produced; only shards for unsealed pieces are initialized by default
|
||||
gc Garbage collect the dagstore
|
||||
piece-index-size Inspect the dagstore piece index size
|
||||
lookup-pieces Lookup pieces that a given CID belongs to
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -1128,6 +1131,80 @@ OPTIONS:
|
||||
|
||||
```
|
||||
|
||||
### lotus-miner dagstore piece-index-size
|
||||
```
|
||||
NAME:
|
||||
lotus-miner dagstore piece-index-size - Inspect the dagstore piece index size
|
||||
|
||||
USAGE:
|
||||
lotus-miner dagstore piece-index-size [command options] [arguments...]
|
||||
|
||||
OPTIONS:
|
||||
--color use color in display output (default: depends on output being a TTY)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
### lotus-miner dagstore lookup-pieces
|
||||
```
|
||||
NAME:
|
||||
lotus-miner dagstore lookup-pieces - Lookup pieces that a given CID belongs to
|
||||
|
||||
USAGE:
|
||||
lotus-miner dagstore lookup-pieces [command options] <cid>
|
||||
|
||||
OPTIONS:
|
||||
--color use color in display output (default: depends on output being a TTY)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
## lotus-miner index
|
||||
```
|
||||
NAME:
|
||||
lotus-miner index - Manage the index provider on the markets subsystem
|
||||
|
||||
USAGE:
|
||||
lotus-miner index command [command options] [arguments...]
|
||||
|
||||
COMMANDS:
|
||||
announce Announce a deal to indexers so they can download its index
|
||||
announce-all Announce all active deals to indexers so they can download its indices
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
### lotus-miner index announce
|
||||
```
|
||||
NAME:
|
||||
lotus-miner index announce - Announce a deal to indexers so they can download its index
|
||||
|
||||
USAGE:
|
||||
lotus-miner index announce [command options] <deal proposal cid>
|
||||
|
||||
OPTIONS:
|
||||
--color use color in display output (default: depends on output being a TTY)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
### lotus-miner index announce-all
|
||||
```
|
||||
NAME:
|
||||
lotus-miner index announce-all - Announce all active deals to indexers so they can download its indices
|
||||
|
||||
USAGE:
|
||||
lotus-miner index announce-all [command options] [arguments...]
|
||||
|
||||
OPTIONS:
|
||||
--color use color in display output (default: depends on output being a TTY)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
## lotus-miner net
|
||||
```
|
||||
NAME:
|
||||
@@ -1137,20 +1214,24 @@ USAGE:
|
||||
lotus-miner net command [command options] [arguments...]
|
||||
|
||||
COMMANDS:
|
||||
peers Print peers
|
||||
connect Connect to a peer
|
||||
listen List listen addresses
|
||||
id Get node identity
|
||||
findpeer Find the addresses of a given peerID
|
||||
scores Print peers' pubsub scores
|
||||
reachability Print information about reachability from the internet
|
||||
bandwidth Print bandwidth usage information
|
||||
block Manage network connection gating rules
|
||||
help, h Shows a list of commands or help for one command
|
||||
peers Print peers
|
||||
connect Connect to a peer
|
||||
listen List listen addresses
|
||||
id Get node identity
|
||||
findpeer Find the addresses of a given peerID
|
||||
scores Print peers' pubsub scores
|
||||
reachability Print information about reachability from the internet
|
||||
bandwidth Print bandwidth usage information
|
||||
block Manage network connection gating rules
|
||||
stat Report resource usage for a scope
|
||||
limit Get or set resource limits for a scope
|
||||
protect Add one or more peer IDs to the list of protected peer connections
|
||||
unprotect Remove one or more peer IDs from the list of protected peer connections.
|
||||
list-protected List the peer IDs with protected connection.
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -1278,8 +1359,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -1298,8 +1378,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -1357,8 +1436,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -1414,6 +1492,95 @@ OPTIONS:
|
||||
|
||||
```
|
||||
|
||||
### lotus-miner net stat
|
||||
```
|
||||
NAME:
|
||||
lotus-miner net stat - Report resource usage for a scope
|
||||
|
||||
USAGE:
|
||||
lotus-miner net stat [command options] scope
|
||||
|
||||
DESCRIPTION:
|
||||
Report resource usage for a scope.
|
||||
|
||||
The scope can be one of the following:
|
||||
- system -- reports the system aggregate resource usage.
|
||||
- transient -- reports the transient resource usage.
|
||||
- svc:<service> -- reports the resource usage of a specific service.
|
||||
- proto:<proto> -- reports the resource usage of a specific protocol.
|
||||
- peer:<peer> -- reports the resource usage of a specific peer.
|
||||
- all -- reports the resource usage for all currently active scopes.
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
### lotus-miner net limit
|
||||
```
|
||||
NAME:
|
||||
lotus-miner net limit - Get or set resource limits for a scope
|
||||
|
||||
USAGE:
|
||||
lotus-miner net limit [command options] scope [limit]
|
||||
|
||||
DESCRIPTION:
|
||||
Get or set resource limits for a scope.
|
||||
|
||||
The scope can be one of the following:
|
||||
- system -- reports the system aggregate resource usage.
|
||||
- transient -- reports the transient resource usage.
|
||||
- svc:<service> -- reports the resource usage of a specific service.
|
||||
- proto:<proto> -- reports the resource usage of a specific protocol.
|
||||
- peer:<peer> -- reports the resource usage of a specific peer.
|
||||
|
||||
The limit is json-formatted, with the same structure as the limits file.
|
||||
|
||||
OPTIONS:
|
||||
--set set the limit for a scope (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
### lotus-miner net protect
|
||||
```
|
||||
NAME:
|
||||
lotus-miner net protect - Add one or more peer IDs to the list of protected peer connections
|
||||
|
||||
USAGE:
|
||||
lotus-miner net protect [command options] <peer-id> [<peer-id>...]
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
### lotus-miner net unprotect
|
||||
```
|
||||
NAME:
|
||||
lotus-miner net unprotect - Remove one or more peer IDs from the list of protected peer connections.
|
||||
|
||||
USAGE:
|
||||
lotus-miner net unprotect [command options] <peer-id> [<peer-id>...]
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
### lotus-miner net list-protected
|
||||
```
|
||||
NAME:
|
||||
lotus-miner net list-protected - List the peer IDs with protected connection.
|
||||
|
||||
USAGE:
|
||||
lotus-miner net list-protected [command options] [arguments...]
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
## lotus-miner pieces
|
||||
```
|
||||
NAME:
|
||||
@@ -1433,8 +1600,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -1521,8 +1687,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -1690,7 +1855,6 @@ COMMANDS:
|
||||
OPTIONS:
|
||||
--really-do-it pass this flag if you know what you are doing (default: false)
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -1814,8 +1978,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -1877,8 +2040,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -1960,20 +2122,20 @@ USAGE:
|
||||
|
||||
DESCRIPTION:
|
||||
Sectors can be stored across many filesystem paths. These
|
||||
commands provide ways to manage the storage the miner will used to store sectors
|
||||
long term for proving (references as 'store') as well as how sectors will be
|
||||
stored while moving through the sealing pipeline (references as 'seal').
|
||||
commands provide ways to manage the storage the miner will used to store sectors
|
||||
long term for proving (references as 'store') as well as how sectors will be
|
||||
stored while moving through the sealing pipeline (references as 'seal').
|
||||
|
||||
COMMANDS:
|
||||
attach attach local storage path
|
||||
list list local storage paths
|
||||
find find sector in the storage system
|
||||
cleanup trigger cleanup actions
|
||||
locks show active sector locks
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -1987,24 +2149,23 @@ USAGE:
|
||||
|
||||
DESCRIPTION:
|
||||
Storage can be attached to the miner using this command. The storage volume
|
||||
list is stored local to the miner in $LOTUS_MINER_PATH/storage.json. We do not
|
||||
recommend manually modifying this value without further understanding of the
|
||||
storage system.
|
||||
|
||||
Each storage volume contains a configuration file which describes the
|
||||
capabilities of the volume. When the '--init' flag is provided, this file will
|
||||
be created using the additional flags.
|
||||
|
||||
Weight
|
||||
A high weight value means data will be more likely to be stored in this path
|
||||
|
||||
Seal
|
||||
Data for the sealing process will be stored here
|
||||
|
||||
Store
|
||||
Finalized sectors that will be moved here for long term storage and be proven
|
||||
over time
|
||||
list is stored local to the miner in $LOTUS_MINER_PATH/storage.json. We do not
|
||||
recommend manually modifying this value without further understanding of the
|
||||
storage system.
|
||||
|
||||
Each storage volume contains a configuration file which describes the
|
||||
capabilities of the volume. When the '--init' flag is provided, this file will
|
||||
be created using the additional flags.
|
||||
|
||||
Weight
|
||||
A high weight value means data will be more likely to be stored in this path
|
||||
|
||||
Seal
|
||||
Data for the sealing process will be stored here
|
||||
|
||||
Store
|
||||
Finalized sectors that will be moved here for long term storage and be proven
|
||||
over time
|
||||
|
||||
OPTIONS:
|
||||
--init initialize the path first (default: false)
|
||||
@@ -2031,9 +2192,8 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--color use color in display output (default: depends on output being a TTY)
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--color use color in display output (default: depends on output being a TTY)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -2078,6 +2238,19 @@ OPTIONS:
|
||||
|
||||
```
|
||||
|
||||
### lotus-miner storage locks
|
||||
```
|
||||
NAME:
|
||||
lotus-miner storage locks - show active sector locks
|
||||
|
||||
USAGE:
|
||||
lotus-miner storage locks [command options] [arguments...]
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
## lotus-miner sealing
|
||||
```
|
||||
NAME:
|
||||
@@ -2094,8 +2267,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ USAGE:
|
||||
lotus-worker [global options] command [command options] [arguments...]
|
||||
|
||||
VERSION:
|
||||
1.14.0-rc1
|
||||
1.15.0-dev
|
||||
|
||||
COMMANDS:
|
||||
run Start lotus worker
|
||||
@@ -78,8 +78,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -159,8 +158,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
|
||||
+241
-157
@@ -7,7 +7,7 @@ USAGE:
|
||||
lotus [global options] command [command options] [arguments...]
|
||||
|
||||
VERSION:
|
||||
1.14.0-rc1
|
||||
1.15.0-dev
|
||||
|
||||
COMMANDS:
|
||||
daemon Start a lotus daemon process
|
||||
@@ -71,7 +71,6 @@ OPTIONS:
|
||||
--restore value restore from backup file
|
||||
--restore-config value config file to use when restoring from backup
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -98,11 +97,11 @@ USAGE:
|
||||
|
||||
DESCRIPTION:
|
||||
The backup command writes a copy of node metadata under the specified path
|
||||
|
||||
Online backups:
|
||||
For security reasons, the daemon must be have LOTUS_BACKUP_BASE_PATH env var set
|
||||
to a path where backup files are supposed to be saved, and the path specified in
|
||||
this command must be within this base path
|
||||
|
||||
Online backups:
|
||||
For security reasons, the daemon must be have LOTUS_BACKUP_BASE_PATH env var set
|
||||
to a path where backup files are supposed to be saved, and the path specified in
|
||||
this command must be within this base path
|
||||
|
||||
OPTIONS:
|
||||
--offline create backup without the node running (default: false)
|
||||
@@ -124,8 +123,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -218,8 +216,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -372,8 +369,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -425,6 +421,7 @@ COMMANDS:
|
||||
stat Print information about a locally stored file (piece size, etc)
|
||||
RETRIEVAL:
|
||||
find Find data in the network
|
||||
retrieval-ask Get a miner's retrieval ask
|
||||
retrieve Retrieve data from network
|
||||
cat Show data from network
|
||||
ls List object links
|
||||
@@ -447,8 +444,7 @@ COMMANDS:
|
||||
cancel-transfer Force cancel a data transfer
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -535,6 +531,23 @@ OPTIONS:
|
||||
|
||||
```
|
||||
|
||||
### lotus client retrieval-ask
|
||||
```
|
||||
NAME:
|
||||
lotus client retrieval-ask - Get a miner's retrieval ask
|
||||
|
||||
USAGE:
|
||||
lotus client retrieval-ask [command options] [minerAddress] [data CID]
|
||||
|
||||
CATEGORY:
|
||||
RETRIEVAL
|
||||
|
||||
OPTIONS:
|
||||
--size value data size in bytes (default: 0)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
### lotus client retrieve
|
||||
```
|
||||
NAME:
|
||||
@@ -548,37 +561,36 @@ CATEGORY:
|
||||
|
||||
DESCRIPTION:
|
||||
Retrieve data from the Filecoin network.
|
||||
|
||||
The retrieve command will attempt to find a provider make a retrieval deal with
|
||||
them. In case a provider can't be found, it can be specified with the --provider
|
||||
flag.
|
||||
|
||||
By default the data will be interpreted as DAG-PB UnixFSv1 File. Alternatively
|
||||
a CAR file containing the raw IPLD graph can be exported by setting the --car
|
||||
flag.
|
||||
|
||||
Partial Retrieval:
|
||||
|
||||
The --data-selector flag can be used to specify a sub-graph to fetch. The
|
||||
selector can be specified as either IPLD datamodel text-path selector, or IPLD
|
||||
json selector.
|
||||
|
||||
In case of unixfs retrieval, the selector must point at a single root node, and
|
||||
match the entire graph under that node.
|
||||
|
||||
In case of CAR retrieval, the selector must have one common "sub-root" node.
|
||||
|
||||
Examples:
|
||||
|
||||
- Retrieve a file by CID
|
||||
$ lotus client retrieve Qm... my-file.txt
|
||||
|
||||
- Retrieve a file by CID from f0123
|
||||
$ lotus client retrieve --provider f0123 Qm... my-file.txt
|
||||
|
||||
- Retrieve a first file from a specified directory
|
||||
$ lotus client retrieve --data-selector /Links/0/Hash Qm... my-file.txt
|
||||
|
||||
|
||||
The retrieve command will attempt to find a provider make a retrieval deal with
|
||||
them. In case a provider can't be found, it can be specified with the --provider
|
||||
flag.
|
||||
|
||||
By default the data will be interpreted as DAG-PB UnixFSv1 File. Alternatively
|
||||
a CAR file containing the raw IPLD graph can be exported by setting the --car
|
||||
flag.
|
||||
|
||||
Partial Retrieval:
|
||||
|
||||
The --data-selector flag can be used to specify a sub-graph to fetch. The
|
||||
selector can be specified as either IPLD datamodel text-path selector, or IPLD
|
||||
json selector.
|
||||
|
||||
In case of unixfs retrieval, the selector must point at a single root node, and
|
||||
match the entire graph under that node.
|
||||
|
||||
In case of CAR retrieval, the selector must have one common "sub-root" node.
|
||||
|
||||
Examples:
|
||||
|
||||
- Retrieve a file by CID
|
||||
$ lotus client retrieve Qm... my-file.txt
|
||||
|
||||
- Retrieve a file by CID from f0123
|
||||
$ lotus client retrieve --provider f0123 Qm... my-file.txt
|
||||
|
||||
- Retrieve a first file from a specified directory
|
||||
$ lotus client retrieve --data-selector /Links/0/Hash Qm... my-file.txt
|
||||
|
||||
OPTIONS:
|
||||
--car Export to a car file instead of a regular file (default: false)
|
||||
@@ -691,13 +703,13 @@ CATEGORY:
|
||||
|
||||
DESCRIPTION:
|
||||
Make a deal with a miner.
|
||||
dataCid comes from running 'lotus client import'.
|
||||
miner is the address of the miner you wish to make a deal with.
|
||||
price is measured in FIL/Epoch. Miners usually don't accept a bid
|
||||
lower than their advertised ask (which is in FIL/GiB/Epoch). You can check a miners listed price
|
||||
with 'lotus client query-ask <miner address>'.
|
||||
duration is how long the miner should store the data for, in blocks.
|
||||
The minimum value is 518400 (6 months).
|
||||
dataCid comes from running 'lotus client import'.
|
||||
miner is the address of the miner you wish to make a deal with.
|
||||
price is measured in FIL/Epoch. Miners usually don't accept a bid
|
||||
lower than their advertised ask (which is in FIL/GiB/Epoch). You can check a miners listed price
|
||||
with 'lotus client query-ask <miner address>'.
|
||||
duration is how long the miner should store the data for, in blocks.
|
||||
The minimum value is 518400 (6 months).
|
||||
|
||||
OPTIONS:
|
||||
--manual-piece-cid value manually specify piece commitment for data (dataCid must be to a car file)
|
||||
@@ -958,7 +970,6 @@ COMMANDS:
|
||||
OPTIONS:
|
||||
--confidence value number of block confirmations to wait for (default: 5)
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -1224,8 +1235,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -1314,8 +1324,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -1364,8 +1373,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -1516,8 +1524,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -1569,8 +1576,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -1730,7 +1736,6 @@ COMMANDS:
|
||||
OPTIONS:
|
||||
--tipset value specify tipset to call method on (pass comma separated array of cids)
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -2015,8 +2020,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -2101,8 +2105,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -2173,10 +2176,9 @@ USAGE:
|
||||
|
||||
DESCRIPTION:
|
||||
Collect object size and ipld link count for an object.
|
||||
|
||||
When a base is provided it will be walked first, and all links visisted
|
||||
will be ignored when the passed in object is walked.
|
||||
|
||||
|
||||
When a base is provided it will be walked first, and all links visisted
|
||||
will be ignored when the passed in object is walked.
|
||||
|
||||
OPTIONS:
|
||||
--base value ignore links found in this obj
|
||||
@@ -2226,34 +2228,33 @@ USAGE:
|
||||
|
||||
DESCRIPTION:
|
||||
Get ipld node under a specified path:
|
||||
|
||||
lotus chain get /ipfs/[cid]/some/path
|
||||
|
||||
Path prefixes:
|
||||
- /ipfs/[cid], /ipld/[cid] - traverse IPLD path
|
||||
- /pstate - traverse from head.ParentStateRoot
|
||||
|
||||
Note:
|
||||
You can use special path elements to traverse through some data structures:
|
||||
- /ipfs/[cid]/@H:elem - get 'elem' from hamt
|
||||
- /ipfs/[cid]/@Hi:123 - get varint elem 123 from hamt
|
||||
- /ipfs/[cid]/@Hu:123 - get uvarint elem 123 from hamt
|
||||
- /ipfs/[cid]/@Ha:t01 - get element under Addr(t01).Bytes
|
||||
- /ipfs/[cid]/@A:10 - get 10th amt element
|
||||
- .../@Ha:t01/@state - get pretty map-based actor state
|
||||
|
||||
List of --as-type types:
|
||||
- raw
|
||||
- block
|
||||
- message
|
||||
- smessage, signedmessage
|
||||
- actor
|
||||
- amt
|
||||
- hamt-epoch
|
||||
- hamt-address
|
||||
- cronevent
|
||||
- account-state
|
||||
|
||||
|
||||
lotus chain get /ipfs/[cid]/some/path
|
||||
|
||||
Path prefixes:
|
||||
- /ipfs/[cid], /ipld/[cid] - traverse IPLD path
|
||||
- /pstate - traverse from head.ParentStateRoot
|
||||
|
||||
Note:
|
||||
You can use special path elements to traverse through some data structures:
|
||||
- /ipfs/[cid]/@H:elem - get 'elem' from hamt
|
||||
- /ipfs/[cid]/@Hi:123 - get varint elem 123 from hamt
|
||||
- /ipfs/[cid]/@Hu:123 - get uvarint elem 123 from hamt
|
||||
- /ipfs/[cid]/@Ha:t01 - get element under Addr(t01).Bytes
|
||||
- /ipfs/[cid]/@A:10 - get 10th amt element
|
||||
- .../@Ha:t01/@state - get pretty map-based actor state
|
||||
|
||||
List of --as-type types:
|
||||
- raw
|
||||
- block
|
||||
- message
|
||||
- smessage, signedmessage
|
||||
- actor
|
||||
- amt
|
||||
- hamt-epoch
|
||||
- hamt-address
|
||||
- cronevent
|
||||
- account-state
|
||||
|
||||
OPTIONS:
|
||||
--as-type value specify type to interpret output as
|
||||
@@ -2273,18 +2274,17 @@ USAGE:
|
||||
|
||||
DESCRIPTION:
|
||||
Bisect the chain state tree:
|
||||
|
||||
lotus chain bisect [min height] [max height] '1/2/3/state/path' 'shell command' 'args'
|
||||
|
||||
Returns the first tipset in which condition is true
|
||||
v
|
||||
[start] FFFFFFFTTT [end]
|
||||
|
||||
Example: find height at which deal ID 100 000 appeared
|
||||
- lotus chain bisect 1 32000 '@Ha:t03/1' jq -e '.[2] > 100000'
|
||||
|
||||
For special path elements see 'chain get' help
|
||||
|
||||
|
||||
lotus chain bisect [min height] [max height] '1/2/3/state/path' 'shell command' 'args'
|
||||
|
||||
Returns the first tipset in which condition is true
|
||||
v
|
||||
[start] FFFFFFFTTT [end]
|
||||
|
||||
Example: find height at which deal ID 100 000 appeared
|
||||
- lotus chain bisect 1 32000 '@Ha:t03/1' jq -e '.[2] > 100000'
|
||||
|
||||
For special path elements see 'chain get' help
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
@@ -2364,8 +2364,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -2397,8 +2396,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -2435,7 +2433,6 @@ OPTIONS:
|
||||
--max-fee value Spend up to X FIL per DisputeWindowedPoSt message
|
||||
--from value optionally specify the account to send messages from
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -2481,8 +2478,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -2509,23 +2505,22 @@ USAGE:
|
||||
|
||||
DESCRIPTION:
|
||||
Set the log level for logging systems:
|
||||
|
||||
The system flag can be specified multiple times.
|
||||
|
||||
eg) log set-level --system chain --system chainxchg debug
|
||||
|
||||
Available Levels:
|
||||
debug
|
||||
info
|
||||
warn
|
||||
error
|
||||
|
||||
Environment Variables:
|
||||
GOLOG_LOG_LEVEL - Default log level for all log systems
|
||||
GOLOG_LOG_FMT - Change output log format (json, nocolor)
|
||||
GOLOG_FILE - Write logs to file
|
||||
GOLOG_OUTPUT - Specify whether to output to file, stderr, stdout or a combination, i.e. file+stderr
|
||||
|
||||
|
||||
The system flag can be specified multiple times.
|
||||
|
||||
eg) log set-level --system chain --system chainxchg debug
|
||||
|
||||
Available Levels:
|
||||
debug
|
||||
info
|
||||
warn
|
||||
error
|
||||
|
||||
Environment Variables:
|
||||
GOLOG_LOG_LEVEL - Default log level for all log systems
|
||||
GOLOG_LOG_FMT - Change output log format (json, nocolor)
|
||||
GOLOG_FILE - Write logs to file
|
||||
GOLOG_OUTPUT - Specify whether to output to file, stderr, stdout or a combination, i.e. file+stderr
|
||||
|
||||
OPTIONS:
|
||||
--system value limit to log system
|
||||
@@ -2589,20 +2584,24 @@ USAGE:
|
||||
lotus net command [command options] [arguments...]
|
||||
|
||||
COMMANDS:
|
||||
peers Print peers
|
||||
connect Connect to a peer
|
||||
listen List listen addresses
|
||||
id Get node identity
|
||||
findpeer Find the addresses of a given peerID
|
||||
scores Print peers' pubsub scores
|
||||
reachability Print information about reachability from the internet
|
||||
bandwidth Print bandwidth usage information
|
||||
block Manage network connection gating rules
|
||||
help, h Shows a list of commands or help for one command
|
||||
peers Print peers
|
||||
connect Connect to a peer
|
||||
listen List listen addresses
|
||||
id Get node identity
|
||||
findpeer Find the addresses of a given peerID
|
||||
scores Print peers' pubsub scores
|
||||
reachability Print information about reachability from the internet
|
||||
bandwidth Print bandwidth usage information
|
||||
block Manage network connection gating rules
|
||||
stat Report resource usage for a scope
|
||||
limit Get or set resource limits for a scope
|
||||
protect Add one or more peer IDs to the list of protected peer connections
|
||||
unprotect Remove one or more peer IDs from the list of protected peer connections.
|
||||
list-protected List the peer IDs with protected connection.
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -2730,8 +2729,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -2750,8 +2748,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -2809,8 +2806,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
@@ -2866,6 +2862,95 @@ OPTIONS:
|
||||
|
||||
```
|
||||
|
||||
### lotus net stat
|
||||
```
|
||||
NAME:
|
||||
lotus net stat - Report resource usage for a scope
|
||||
|
||||
USAGE:
|
||||
lotus net stat [command options] scope
|
||||
|
||||
DESCRIPTION:
|
||||
Report resource usage for a scope.
|
||||
|
||||
The scope can be one of the following:
|
||||
- system -- reports the system aggregate resource usage.
|
||||
- transient -- reports the transient resource usage.
|
||||
- svc:<service> -- reports the resource usage of a specific service.
|
||||
- proto:<proto> -- reports the resource usage of a specific protocol.
|
||||
- peer:<peer> -- reports the resource usage of a specific peer.
|
||||
- all -- reports the resource usage for all currently active scopes.
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
### lotus net limit
|
||||
```
|
||||
NAME:
|
||||
lotus net limit - Get or set resource limits for a scope
|
||||
|
||||
USAGE:
|
||||
lotus net limit [command options] scope [limit]
|
||||
|
||||
DESCRIPTION:
|
||||
Get or set resource limits for a scope.
|
||||
|
||||
The scope can be one of the following:
|
||||
- system -- reports the system aggregate resource usage.
|
||||
- transient -- reports the transient resource usage.
|
||||
- svc:<service> -- reports the resource usage of a specific service.
|
||||
- proto:<proto> -- reports the resource usage of a specific protocol.
|
||||
- peer:<peer> -- reports the resource usage of a specific peer.
|
||||
|
||||
The limit is json-formatted, with the same structure as the limits file.
|
||||
|
||||
OPTIONS:
|
||||
--set set the limit for a scope (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
### lotus net protect
|
||||
```
|
||||
NAME:
|
||||
lotus net protect - Add one or more peer IDs to the list of protected peer connections
|
||||
|
||||
USAGE:
|
||||
lotus net protect [command options] <peer-id> [<peer-id>...]
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
### lotus net unprotect
|
||||
```
|
||||
NAME:
|
||||
lotus net unprotect - Remove one or more peer IDs from the list of protected peer connections.
|
||||
|
||||
USAGE:
|
||||
lotus net unprotect [command options] <peer-id> [<peer-id>...]
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
### lotus net list-protected
|
||||
```
|
||||
NAME:
|
||||
lotus net list-protected - List the peer IDs with protected connection.
|
||||
|
||||
USAGE:
|
||||
lotus net list-protected [command options] [arguments...]
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
## lotus sync
|
||||
```
|
||||
NAME:
|
||||
@@ -2884,8 +2969,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
|
||||
@@ -207,6 +207,17 @@
|
||||
# env var: LOTUS_DEALMAKING_SIMULTANEOUSTRANSFERSFORSTORAGE
|
||||
#SimultaneousTransfersForStorage = 20
|
||||
|
||||
# The maximum number of simultaneous data transfers from any single client
|
||||
# for storage deals.
|
||||
# Unset by default (0), and values higher than SimultaneousTransfersForStorage
|
||||
# will have no effect; i.e. the total number of simultaneous data transfers
|
||||
# across all storage clients is bound by SimultaneousTransfersForStorage
|
||||
# regardless of this number.
|
||||
#
|
||||
# type: uint64
|
||||
# env var: LOTUS_DEALMAKING_SIMULTANEOUSTRANSFERSFORSTORAGEPERCLIENT
|
||||
#SimultaneousTransfersForStoragePerClient = 0
|
||||
|
||||
# The maximum number of parallel online data transfers for retrieval deals
|
||||
#
|
||||
# type: uint64
|
||||
@@ -246,6 +257,51 @@
|
||||
#Path = ""
|
||||
|
||||
|
||||
[IndexProvider]
|
||||
# env var: LOTUS_INDEXPROVIDER_LINKCACHESIZE
|
||||
#LinkCacheSize = 1024
|
||||
|
||||
# env var: LOTUS_INDEXPROVIDER_LINKEDCHUNKSIZE
|
||||
#LinkedChunkSize = 16384
|
||||
|
||||
# env var: LOTUS_INDEXPROVIDER_PUBSUBTOPIC
|
||||
#PubSubTopic = "/indexer/ingest/mainnet"
|
||||
|
||||
# env var: LOTUS_INDEXPROVIDER_PURGELINKCACHE
|
||||
#PurgeLinkCache = false
|
||||
|
||||
# env var: LOTUS_INDEXPROVIDER_PUBLISHERKIND
|
||||
#PublisherKind = "dtsync"
|
||||
|
||||
# Binding address for the libp2p host contacted by indexer nodes to sync the list of advertised
|
||||
# multihashes. Note that when port is set to 0 a random port is generated at runtime and may be
|
||||
# different on every restart. The format of the strings specified must conform to multiaddress;
|
||||
# see https://multiformats.io/multiaddr/
|
||||
#
|
||||
# type: []string
|
||||
# env var: LOTUS_INDEXPROVIDER_LISTENADDRESSES
|
||||
#ListenAddresses = ["/ip4/0.0.0.0/tcp/0", "/ip6/::/tcp/0"]
|
||||
|
||||
# The address the endpoints at which the data associated to the advertised
|
||||
# multihashes can be retrieved. If not specified, the ListenAddresses are used instead. The format
|
||||
# of the strings specified must conform to multiaddress; see https://multiformats.io/multiaddr/
|
||||
#
|
||||
# type: []string
|
||||
# env var: LOTUS_INDEXPROVIDER_ANNOUNCEADDRESSES
|
||||
#AnnounceAddresses = []
|
||||
|
||||
# The maximum number of simultaneous requests syncing the list of advertised multihashes between
|
||||
# the indexers and the index provider.
|
||||
#
|
||||
# type: uint64
|
||||
# env var: LOTUS_INDEXPROVIDER_MAXSIMULTANEOUSTRANSFERS
|
||||
#MaxSimultaneousTransfers = 20
|
||||
|
||||
[IndexProvider.HttpPublisher]
|
||||
# env var: LOTUS_INDEXPROVIDER_HTTPPUBLISHER_LISTENMULTIADDR
|
||||
#ListenMultiaddr = "/ip4/0.0.0.0/tcp/3104/http"
|
||||
|
||||
|
||||
[Sealing]
|
||||
# Upper bound on how many sectors can be waiting for more deals to be packed in it before it begins sealing at any given time.
|
||||
# If the miner is accepting multiple deals in parallel, up to MaxWaitDealsSectors of new sectors will be created.
|
||||
@@ -539,6 +595,14 @@
|
||||
# env var: LOTUS_DAGSTORE_MAXCONCURRENTREADYFETCHES
|
||||
#MaxConcurrentReadyFetches = 0
|
||||
|
||||
# The maximum amount of unseals that can be processed simultaneously
|
||||
# from the storage subsystem. 0 means unlimited.
|
||||
# Default value: 0 (unlimited).
|
||||
#
|
||||
# type: int
|
||||
# env var: LOTUS_DAGSTORE_MAXCONCURRENTUNSEALS
|
||||
#MaxConcurrentUnseals = 5
|
||||
|
||||
# The maximum number of simultaneous inflight API calls to the storage
|
||||
# subsystem.
|
||||
# Default value: 100.
|
||||
|
||||
@@ -34,6 +34,12 @@ func (b *Provider) AcquireSector(ctx context.Context, id storage.SectorRef, exis
|
||||
if err := os.Mkdir(filepath.Join(b.Root, storiface.FTCache.String()), 0755); err != nil && !os.IsExist(err) { // nolint
|
||||
return storiface.SectorPaths{}, nil, err
|
||||
}
|
||||
if err := os.Mkdir(filepath.Join(b.Root, storiface.FTUpdate.String()), 0755); err != nil && !os.IsExist(err) { // nolint
|
||||
return storiface.SectorPaths{}, nil, err
|
||||
}
|
||||
if err := os.Mkdir(filepath.Join(b.Root, storiface.FTUpdateCache.String()), 0755); err != nil && !os.IsExist(err) { // nolint
|
||||
return storiface.SectorPaths{}, nil, err
|
||||
}
|
||||
|
||||
done := func() {}
|
||||
|
||||
|
||||
+4
-4
@@ -669,7 +669,7 @@ func (sb *Sealer) SealCommit2(ctx context.Context, sector storage.SectorRef, pha
|
||||
|
||||
func (sb *Sealer) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, pieces []abi.PieceInfo) (storage.ReplicaUpdateOut, error) {
|
||||
empty := storage.ReplicaUpdateOut{}
|
||||
paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTSealed|storiface.FTUnsealed|storiface.FTCache, storiface.FTUpdate|storiface.FTUpdateCache, storiface.PathSealing)
|
||||
paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTUnsealed|storiface.FTSealed|storiface.FTCache, storiface.FTUpdate|storiface.FTUpdateCache, storiface.PathSealing)
|
||||
if err != nil {
|
||||
return empty, xerrors.Errorf("failed to acquire sector paths: %w", err)
|
||||
}
|
||||
@@ -697,10 +697,10 @@ func (sb *Sealer) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, p
|
||||
|
||||
if err := os.Mkdir(paths.UpdateCache, 0755); err != nil { // nolint
|
||||
if os.IsExist(err) {
|
||||
log.Warnf("existing cache in %s; removing", paths.Cache)
|
||||
log.Warnf("existing cache in %s; removing", paths.UpdateCache)
|
||||
|
||||
if err := os.RemoveAll(paths.UpdateCache); err != nil {
|
||||
return empty, xerrors.Errorf("remove existing sector cache from %s (sector %d): %w", paths.Cache, sector, err)
|
||||
return empty, xerrors.Errorf("remove existing sector cache from %s (sector %d): %w", paths.UpdateCache, sector, err)
|
||||
}
|
||||
|
||||
if err := os.Mkdir(paths.UpdateCache, 0755); err != nil { // nolint:gosec
|
||||
@@ -718,7 +718,7 @@ func (sb *Sealer) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, p
|
||||
}
|
||||
|
||||
func (sb *Sealer) ProveReplicaUpdate1(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storage.ReplicaVanillaProofs, error) {
|
||||
paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTSealed|storiface.FTCache|storiface.FTUpdateCache|storiface.FTUpdate, storiface.FTNone, storiface.PathSealing)
|
||||
paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTSealed|storiface.FTCache|storiface.FTUpdate|storiface.FTUpdateCache, storiface.FTNone, storiface.PathSealing)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to acquire sector paths: %w", err)
|
||||
}
|
||||
|
||||
Vendored
+7
-5
@@ -715,14 +715,13 @@ func (m *Manager) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, p
|
||||
return out, waitErr
|
||||
}
|
||||
|
||||
if err := m.index.StorageLock(ctx, sector.ID, storiface.FTSealed|storiface.FTCache, storiface.FTUpdate|storiface.FTUpdateCache); err != nil {
|
||||
if err := m.index.StorageLock(ctx, sector.ID, storiface.FTUnsealed|storiface.FTSealed|storiface.FTCache, storiface.FTUpdate|storiface.FTUpdateCache); err != nil {
|
||||
return storage.ReplicaUpdateOut{}, xerrors.Errorf("acquiring sector lock: %w", err)
|
||||
}
|
||||
|
||||
selector := newAllocSelector(m.index, storiface.FTUpdate|storiface.FTUpdateCache, storiface.PathSealing)
|
||||
|
||||
err = m.sched.Schedule(ctx, sector, sealtasks.TTReplicaUpdate, selector, m.schedFetch(sector, storiface.FTSealed, storiface.PathSealing, storiface.AcquireCopy), func(ctx context.Context, w Worker) error {
|
||||
log.Errorf("scheduled work for replica update")
|
||||
err = m.sched.Schedule(ctx, sector, sealtasks.TTReplicaUpdate, selector, m.schedFetch(sector, storiface.FTUnsealed|storiface.FTSealed|storiface.FTCache, storiface.PathSealing, storiface.AcquireCopy), func(ctx context.Context, w Worker) error {
|
||||
err := m.startWork(ctx, w, wk)(w.ReplicaUpdate(ctx, sector, pieces))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("startWork: %w", err)
|
||||
@@ -768,9 +767,12 @@ func (m *Manager) ProveReplicaUpdate1(ctx context.Context, sector storage.Sector
|
||||
return nil, xerrors.Errorf("acquiring sector lock: %w", err)
|
||||
}
|
||||
|
||||
selector := newExistingSelector(m.index, sector.ID, storiface.FTUpdate|storiface.FTUpdateCache|storiface.FTSealed|storiface.FTCache, true)
|
||||
// NOTE: We set allowFetch to false in so that we always execute on a worker
|
||||
// with direct access to the data. We want to do that because this step is
|
||||
// generally very cheap / fast, and transferring data is not worth the effort
|
||||
selector := newExistingSelector(m.index, sector.ID, storiface.FTUpdate|storiface.FTUpdateCache|storiface.FTSealed|storiface.FTCache, false)
|
||||
|
||||
err = m.sched.Schedule(ctx, sector, sealtasks.TTProveReplicaUpdate1, selector, m.schedFetch(sector, storiface.FTSealed, storiface.PathSealing, storiface.AcquireCopy), func(ctx context.Context, w Worker) error {
|
||||
err = m.sched.Schedule(ctx, sector, sealtasks.TTProveReplicaUpdate1, selector, m.schedFetch(sector, storiface.FTSealed|storiface.FTCache|storiface.FTUpdate|storiface.FTUpdateCache, storiface.PathSealing, storiface.AcquireCopy), func(ctx context.Context, w Worker) error {
|
||||
|
||||
err := m.startWork(ctx, w, wk)(w.ProveReplicaUpdate1(ctx, sector, sectorKey, newSealed, newUnsealed))
|
||||
if err != nil {
|
||||
|
||||
+4
@@ -1,3 +1,4 @@
|
||||
//stm: #unit
|
||||
package sectorstorage
|
||||
|
||||
import (
|
||||
@@ -363,6 +364,7 @@ func TestRedoPC1(t *testing.T) {
|
||||
|
||||
// Manager restarts in the middle of a task, restarts it, it completes
|
||||
func TestRestartManager(t *testing.T) {
|
||||
//stm: @WORKER_JOBS_001
|
||||
test := func(returnBeforeCall bool) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
logging.SetAllLoggers(logging.LevelDebug)
|
||||
@@ -507,6 +509,7 @@ func TestRestartWorker(t *testing.T) {
|
||||
<-arch
|
||||
require.NoError(t, w.Close())
|
||||
|
||||
//stm: @WORKER_STATS_001
|
||||
for {
|
||||
if len(m.WorkerStats()) == 0 {
|
||||
break
|
||||
@@ -569,6 +572,7 @@ func TestReenableWorker(t *testing.T) {
|
||||
// disable
|
||||
atomic.StoreInt64(&w.testDisable, 1)
|
||||
|
||||
//stm: @WORKER_STATS_001
|
||||
for i := 0; i < 100; i++ {
|
||||
if !m.WorkerStats()[w.session].Enabled {
|
||||
break
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ func CreatePartialFile(maxPieceSize abi.PaddedPieceSize, path string) (*PartialF
|
||||
err := fallocate.Fallocate(f, 0, int64(maxPieceSize))
|
||||
if errno, ok := err.(syscall.Errno); ok {
|
||||
if errno == syscall.EOPNOTSUPP || errno == syscall.ENOSYS {
|
||||
log.Warnf("could not allocated space, ignoring: %v", errno)
|
||||
log.Warnf("could not allocate space, ignoring: %v", errno)
|
||||
err = nil // log and ignore
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
@@ -1,3 +1,4 @@
|
||||
//stm: #unit
|
||||
package sectorstorage
|
||||
|
||||
import (
|
||||
@@ -206,6 +207,7 @@ func TestSchedStartStop(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSched(t *testing.T) {
|
||||
//stm: @WORKER_JOBS_001
|
||||
storiface.ParallelNum = 1
|
||||
storiface.ParallelDenom = 1
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ const (
|
||||
TTAddPiece TaskType = "seal/v0/addpiece"
|
||||
TTPreCommit1 TaskType = "seal/v0/precommit/1"
|
||||
TTPreCommit2 TaskType = "seal/v0/precommit/2"
|
||||
TTCommit1 TaskType = "seal/v0/commit/1" // NOTE: We use this to transfer the sector into miner-local storage for now; Don't use on workers!
|
||||
TTCommit1 TaskType = "seal/v0/commit/1"
|
||||
TTCommit2 TaskType = "seal/v0/commit/2"
|
||||
|
||||
TTFinalize TaskType = "seal/v0/finalize"
|
||||
|
||||
+1
@@ -76,6 +76,7 @@ type SectorIndex interface { // part of storage-miner api
|
||||
// atomically acquire locks on all sector file types. close ctx to unlock
|
||||
StorageLock(ctx context.Context, sector abi.SectorID, read storiface.SectorFileType, write storiface.SectorFileType) error
|
||||
StorageTryLock(ctx context.Context, sector abi.SectorID, read storiface.SectorFileType, write storiface.SectorFileType) (bool, error)
|
||||
StorageGetLocks(ctx context.Context) (storiface.SectorLocks, error)
|
||||
|
||||
StorageList(ctx context.Context) (map[ID][]Decl, error)
|
||||
}
|
||||
|
||||
+30
@@ -2,6 +2,7 @@ package stores
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
@@ -154,3 +155,32 @@ func (i *indexLocks) StorageLock(ctx context.Context, sector abi.SectorID, read
|
||||
func (i *indexLocks) StorageTryLock(ctx context.Context, sector abi.SectorID, read storiface.SectorFileType, write storiface.SectorFileType) (bool, error) {
|
||||
return i.lockWith(ctx, (*sectorLock).tryLockSafe, sector, read, write)
|
||||
}
|
||||
|
||||
func (i *indexLocks) StorageGetLocks(context.Context) (storiface.SectorLocks, error) {
|
||||
i.lk.Lock()
|
||||
defer i.lk.Unlock()
|
||||
|
||||
out := storiface.SectorLocks{
|
||||
Locks: []storiface.SectorLock{},
|
||||
}
|
||||
|
||||
for id, lock := range i.locks {
|
||||
l := storiface.SectorLock{Sector: id}
|
||||
|
||||
for t, b := range lock.w.All() {
|
||||
if b {
|
||||
l.Write[t]++
|
||||
}
|
||||
}
|
||||
|
||||
copy(l.Read[:], lock.r[:])
|
||||
|
||||
out.Locks = append(out.Locks, l)
|
||||
}
|
||||
|
||||
sort.Slice(out.Locks, func(i, j int) bool {
|
||||
return out.Locks[i].Sector.Number < out.Locks[j].Sector.Number
|
||||
})
|
||||
|
||||
return out, nil
|
||||
}
|
||||
|
||||
+15
@@ -110,6 +110,21 @@ func (mr *MockSectorIndexMockRecorder) StorageFindSector(arg0, arg1, arg2, arg3,
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StorageFindSector", reflect.TypeOf((*MockSectorIndex)(nil).StorageFindSector), arg0, arg1, arg2, arg3, arg4)
|
||||
}
|
||||
|
||||
// StorageGetLocks mocks base method.
|
||||
func (m *MockSectorIndex) StorageGetLocks(arg0 context.Context) (storiface.SectorLocks, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StorageGetLocks", arg0)
|
||||
ret0, _ := ret[0].(storiface.SectorLocks)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StorageGetLocks indicates an expected call of StorageGetLocks.
|
||||
func (mr *MockSectorIndexMockRecorder) StorageGetLocks(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StorageGetLocks", reflect.TypeOf((*MockSectorIndex)(nil).StorageGetLocks), arg0)
|
||||
}
|
||||
|
||||
// StorageInfo mocks base method.
|
||||
func (m *MockSectorIndex) StorageInfo(arg0 context.Context, arg1 stores.ID) (stores.StorageInfo, error) {
|
||||
m.ctrl.T.Helper()
|
||||
|
||||
+2
@@ -1,3 +1,4 @@
|
||||
//stm: #unit
|
||||
package stores_test
|
||||
|
||||
import (
|
||||
@@ -154,6 +155,7 @@ func TestMoveShared(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestReader(t *testing.T) {
|
||||
//stm: @STORAGE_INFO_001
|
||||
logging.SetAllLoggers(logging.LevelDebug)
|
||||
bz := []byte("Hello World")
|
||||
|
||||
|
||||
+136
@@ -331,10 +331,146 @@ var ResourceTable = map[sealtasks.TaskType]map[abi.RegisteredSealProof]Resources
|
||||
BaseMinMemory: 0,
|
||||
},
|
||||
},
|
||||
// TODO: this should ideally be the actual replica update proof types
|
||||
// TODO: actually measure this (and all the other replica update work)
|
||||
sealtasks.TTReplicaUpdate: { // copied from addpiece
|
||||
abi.RegisteredSealProof_StackedDrg64GiBV1: Resources{
|
||||
MaxMemory: 8 << 30,
|
||||
MinMemory: 8 << 30,
|
||||
|
||||
MaxParallelism: 1,
|
||||
|
||||
BaseMinMemory: 1 << 30,
|
||||
},
|
||||
abi.RegisteredSealProof_StackedDrg32GiBV1: Resources{
|
||||
MaxMemory: 4 << 30,
|
||||
MinMemory: 4 << 30,
|
||||
|
||||
MaxParallelism: 1,
|
||||
|
||||
BaseMinMemory: 1 << 30,
|
||||
},
|
||||
abi.RegisteredSealProof_StackedDrg512MiBV1: Resources{
|
||||
MaxMemory: 1 << 30,
|
||||
MinMemory: 1 << 30,
|
||||
|
||||
MaxParallelism: 1,
|
||||
|
||||
BaseMinMemory: 1 << 30,
|
||||
},
|
||||
abi.RegisteredSealProof_StackedDrg2KiBV1: Resources{
|
||||
MaxMemory: 2 << 10,
|
||||
MinMemory: 2 << 10,
|
||||
|
||||
MaxParallelism: 1,
|
||||
|
||||
BaseMinMemory: 2 << 10,
|
||||
},
|
||||
abi.RegisteredSealProof_StackedDrg8MiBV1: Resources{
|
||||
MaxMemory: 8 << 20,
|
||||
MinMemory: 8 << 20,
|
||||
|
||||
MaxParallelism: 1,
|
||||
|
||||
BaseMinMemory: 8 << 20,
|
||||
},
|
||||
},
|
||||
sealtasks.TTProveReplicaUpdate1: { // copied from commit1
|
||||
abi.RegisteredSealProof_StackedDrg64GiBV1: Resources{
|
||||
MaxMemory: 1 << 30,
|
||||
MinMemory: 1 << 30,
|
||||
|
||||
MaxParallelism: 0,
|
||||
|
||||
BaseMinMemory: 1 << 30,
|
||||
},
|
||||
abi.RegisteredSealProof_StackedDrg32GiBV1: Resources{
|
||||
MaxMemory: 1 << 30,
|
||||
MinMemory: 1 << 30,
|
||||
|
||||
MaxParallelism: 0,
|
||||
|
||||
BaseMinMemory: 1 << 30,
|
||||
},
|
||||
abi.RegisteredSealProof_StackedDrg512MiBV1: Resources{
|
||||
MaxMemory: 1 << 30,
|
||||
MinMemory: 1 << 30,
|
||||
|
||||
MaxParallelism: 0,
|
||||
|
||||
BaseMinMemory: 1 << 30,
|
||||
},
|
||||
abi.RegisteredSealProof_StackedDrg2KiBV1: Resources{
|
||||
MaxMemory: 2 << 10,
|
||||
MinMemory: 2 << 10,
|
||||
|
||||
MaxParallelism: 0,
|
||||
|
||||
BaseMinMemory: 2 << 10,
|
||||
},
|
||||
abi.RegisteredSealProof_StackedDrg8MiBV1: Resources{
|
||||
MaxMemory: 8 << 20,
|
||||
MinMemory: 8 << 20,
|
||||
|
||||
MaxParallelism: 0,
|
||||
|
||||
BaseMinMemory: 8 << 20,
|
||||
},
|
||||
},
|
||||
sealtasks.TTProveReplicaUpdate2: { // copied from commit2
|
||||
abi.RegisteredSealProof_StackedDrg64GiBV1: Resources{
|
||||
MaxMemory: 190 << 30, // TODO: Confirm
|
||||
MinMemory: 60 << 30,
|
||||
|
||||
MaxParallelism: -1,
|
||||
MaxParallelismGPU: 6,
|
||||
GPUUtilization: 1.0,
|
||||
|
||||
BaseMinMemory: 64 << 30, // params
|
||||
},
|
||||
abi.RegisteredSealProof_StackedDrg32GiBV1: Resources{
|
||||
MaxMemory: 150 << 30, // TODO: ~30G of this should really be BaseMaxMemory
|
||||
MinMemory: 30 << 30,
|
||||
|
||||
MaxParallelism: -1,
|
||||
MaxParallelismGPU: 6,
|
||||
GPUUtilization: 1.0,
|
||||
|
||||
BaseMinMemory: 32 << 30, // params
|
||||
},
|
||||
abi.RegisteredSealProof_StackedDrg512MiBV1: Resources{
|
||||
MaxMemory: 3 << 29, // 1.5G
|
||||
MinMemory: 1 << 30,
|
||||
|
||||
MaxParallelism: 1, // This is fine
|
||||
GPUUtilization: 1.0,
|
||||
|
||||
BaseMinMemory: 10 << 30,
|
||||
},
|
||||
abi.RegisteredSealProof_StackedDrg2KiBV1: Resources{
|
||||
MaxMemory: 2 << 10,
|
||||
MinMemory: 2 << 10,
|
||||
|
||||
MaxParallelism: 1,
|
||||
GPUUtilization: 1.0,
|
||||
|
||||
BaseMinMemory: 2 << 10,
|
||||
},
|
||||
abi.RegisteredSealProof_StackedDrg8MiBV1: Resources{
|
||||
MaxMemory: 8 << 20,
|
||||
MinMemory: 8 << 20,
|
||||
|
||||
MaxParallelism: 1,
|
||||
GPUUtilization: 1.0,
|
||||
|
||||
BaseMinMemory: 8 << 20,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
ResourceTable[sealtasks.TTUnseal] = ResourceTable[sealtasks.TTPreCommit1] // TODO: measure accurately
|
||||
ResourceTable[sealtasks.TTRegenSectorKey] = ResourceTable[sealtasks.TTReplicaUpdate]
|
||||
|
||||
// V1_1 is the same as V1
|
||||
for _, m := range ResourceTable {
|
||||
|
||||
+16
@@ -1,5 +1,7 @@
|
||||
package storiface
|
||||
|
||||
import "github.com/filecoin-project/go-state-types/abi"
|
||||
|
||||
type PathType string
|
||||
|
||||
const (
|
||||
@@ -13,3 +15,17 @@ const (
|
||||
AcquireMove AcquireMode = "move"
|
||||
AcquireCopy AcquireMode = "copy"
|
||||
)
|
||||
|
||||
type Refs struct {
|
||||
RefCount [FileTypes]uint
|
||||
}
|
||||
|
||||
type SectorLock struct {
|
||||
Sector abi.SectorID
|
||||
Write [FileTypes]uint
|
||||
Read [FileTypes]uint
|
||||
}
|
||||
|
||||
type SectorLocks struct {
|
||||
Locks []SectorLock
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -213,7 +213,7 @@ func checkReplicaUpdate(ctx context.Context, maddr address.Address, si SectorInf
|
||||
return &ErrBadRU{xerrors.Errorf("nil sealed cid")}
|
||||
}
|
||||
if si.ReplicaUpdateProof == nil {
|
||||
return ErrBadPR{xerrors.Errorf("nil PR2 proof")}
|
||||
return &ErrBadPR{xerrors.Errorf("nil PR2 proof")}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
+3
@@ -1,3 +1,4 @@
|
||||
//stm: #unit
|
||||
package sealing_test
|
||||
|
||||
import (
|
||||
@@ -28,6 +29,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCommitBatcher(t *testing.T) {
|
||||
//stm: @CHAIN_STATE_MINER_PRE_COM_INFO_001, @CHAIN_STATE_MINER_INFO_001, @CHAIN_STATE_NETWORK_VERSION_001
|
||||
t0123, err := address.NewFromString("t0123")
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -147,6 +149,7 @@ func TestCommitBatcher(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_INFO_001, @CHAIN_STATE_NETWORK_VERSION_001, @CHAIN_STATE_MINER_GET_COLLATERAL_001
|
||||
expectSend := func(expect []abi.SectorNumber, aboveBalancer, failOnePCI bool) action {
|
||||
return func(t *testing.T, s *mocks.MockCommitBatcherApi, pcb *sealing.CommitBatcher) promise {
|
||||
s.EXPECT().StateMinerInfo(gomock.Any(), gomock.Any(), gomock.Any()).Return(miner.MinerInfo{Owner: t0123, Worker: t0123}, nil)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//stm: #unit
|
||||
package sealing_test
|
||||
|
||||
import (
|
||||
@@ -38,6 +39,7 @@ var fc = config.MinerFeeConfig{
|
||||
}
|
||||
|
||||
func TestPrecommitBatcher(t *testing.T) {
|
||||
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
|
||||
t0123, err := address.NewFromString("t0123")
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -151,6 +153,7 @@ func TestPrecommitBatcher(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_INFO_001, @CHAIN_STATE_NETWORK_VERSION_001
|
||||
expectSend := func(expect []abi.SectorNumber) action {
|
||||
return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *sealing.PreCommitBatcher) promise {
|
||||
s.EXPECT().ChainHead(gomock.Any()).Return(nil, abi.ChainEpoch(1), nil)
|
||||
@@ -171,6 +174,7 @@ func TestPrecommitBatcher(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_INFO_001, @CHAIN_STATE_NETWORK_VERSION_001
|
||||
expectSendsSingle := func(expect []abi.SectorNumber) action {
|
||||
return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *sealing.PreCommitBatcher) promise {
|
||||
s.EXPECT().ChainHead(gomock.Any()).Return(nil, abi.ChainEpoch(1), nil)
|
||||
|
||||
+1
-1
@@ -233,7 +233,7 @@ func (m *Sealing) handleSubmitReplicaUpdateFailed(ctx statemachine.Context, sect
|
||||
return ctx.Send(SectorDealsExpired{xerrors.Errorf("expired dealIDs in sector: %w", err)})
|
||||
default:
|
||||
log.Errorf("sanity check error, not proceeding: +%v", err)
|
||||
return xerrors.Errorf("checkPieces sanity check error: %w", err)
|
||||
return xerrors.Errorf("checkReplica sanity check error: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//stm: #unit
|
||||
package sealing_test
|
||||
|
||||
import (
|
||||
@@ -49,6 +50,7 @@ func TestStateRecoverDealIDs(t *testing.T) {
|
||||
PieceCID: idCid("newPieceCID"),
|
||||
}
|
||||
|
||||
//stm: @CHAIN_STATE_MARKET_STORAGE_DEAL_001, @CHAIN_STATE_NETWORK_VERSION_001
|
||||
api.EXPECT().StateMarketStorageDealProposal(ctx, dealId, nil).Return(dealProposal, nil)
|
||||
|
||||
pc := idCid("publishCID")
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user