chore: build: Merge/v22 into 21 for 23 (#10702)
* chore: update ffi to increase execution parallelism * Don't enforce walking receipt tree during compaction * fix: build: drop drand incentinet servers * chore: release lotus v1.20.4 * Apply suggestions from code review Co-authored-by: Jiaying Wang <42981373+jennijuju@users.noreply.github.com> * feat: Introduce nv19 skeleton Update to go-state-types v0.11.0-alpha-1 Introduce dummy v11 actor bundles Make new actors adapters Add upgrade to Upgrade Schedules make jen Update to go-state-types v0.11.0-alpha-2 * feat: vm: switch to the new exec trace format (#10372) This is now "FVM" native. Changes include: 1. Don't treat "trace" messages like off-chain messages. E.g., don't include CIDs, versions, etc. 2. Include IPLD codecs where applicable. 3. Remove fields that aren't filled by the FVM (timing, some errors, code locations, etc.). * feat: implement FIP-0061 * Address review * Add and test the FIP-0061 migration * Update actors bundles to fip/20230406 * Update to go-state-types master * Update to actors v11.0.0-rc1 * - Update go state types - Keep current expiration defaults on creation, extension some tests - Update ffi * ffi experiment * Integration nv19 migration - Open splitstore in migration shed tool - Update state root version * Post rebase fixup * Fix * gen * nv19 invariant checking * Try fixig blockstore so bundle is loaded * Debug * Fix * Make butterfly upgrades happen * Another ffi experiment * Fix copy paste error * Actually schedule migration (#10656) Co-authored-by: zenground0 <ZenGround0@users.noreply.github.com> * Butterfly artifacts * Set calibration net upgrade height * Review Response * Fix state tree version assert * Quick butterfly upgrade to sanity check (#10660) * Quick butterfly upgrade to sanity check * Update butterfly artifacts * Revert fake fix * Give butterfly net correct genesis * Butterfly artifacts * Give time before upgrade --------- Co-authored-by: zenground0 <ZenGround0@users.noreply.github.com> * chore:releasepolish v1.22 release (#10666) * Update butterfly artifacts * register actors v11 * Update calibration upgrade time * State inspection shed cmds * Fix * make gen * Fix swallowed errors * Lint fixup --------- Co-authored-by: zenground0 <ZenGround0@users.noreply.github.com> * v1.22.0-rc3 * bundle fix * Feat/expedite nv19 (#10681) * Update go-state-types * Modify upgrade schedule and params * Revert fip 0052 * Update gst * docsgen * fast butterfly migration to validate migration * Correct epoch to match specified date * Update actors v11 * Update changelog build version * Update butterfly artifacts * Fix lotus-miner init to work after upgrade --------- Co-authored-by: zenground0 <ZenGround0@users.noreply.github.com> * fix:deps:stable ffi for stable release (#10698) * Point to stable ffi for stable lotus release * go mod tidy --------- Co-authored-by: zenground0 <ZenGround0@users.noreply.github.com> * Update CHANGELOG.md Co-authored-by: Jiaying Wang <42981373+jennijuju@users.noreply.github.com> --------- Co-authored-by: Aayush Rajasekaran <arajasek94@gmail.com> Co-authored-by: zenground0 <ZenGround0@users.noreply.github.com> Co-authored-by: Jiaying Wang <42981373+jennijuju@users.noreply.github.com> Co-authored-by: Steven Allen <steven@stebalien.com> Co-authored-by: jennijuju <jiayingw703@gmail.com>
This commit is contained in:
parent
c6968f8d61
commit
327760acff
@ -795,17 +795,11 @@ workflows:
|
||||
suite: itest-mempool
|
||||
target: "./itests/mempool_test.go"
|
||||
- test:
|
||||
name: test-itest-migration_nv17
|
||||
name: test-itest-migration
|
||||
requires:
|
||||
- build
|
||||
suite: itest-migration_nv17
|
||||
target: "./itests/migration_nv17_test.go"
|
||||
- test:
|
||||
name: test-itest-migration_nv18
|
||||
requires:
|
||||
- build
|
||||
suite: itest-migration_nv18
|
||||
target: "./itests/migration_nv18_test.go"
|
||||
suite: itest-migration
|
||||
target: "./itests/migration_test.go"
|
||||
- test:
|
||||
name: test-itest-mpool_msg_uuid
|
||||
requires:
|
||||
|
363
CHANGELOG.md
363
CHANGELOG.md
@ -1,9 +1,11 @@
|
||||
# Lotus changelog
|
||||
|
||||
# v1.21.0-rc3 / 2023-04-10
|
||||
# v1.23.0-rc1 / 2023-04-19
|
||||
|
||||
This is an optional but highly recommended feature release of Lotus. It includes numerous improvements and enhancements for node operators, ETH RPC-providers and storage providers.
|
||||
|
||||
Note: this release includes all the changes from v1.22.0 that supports the upcoming nv19 upgrade, scheduled on Apr 27th. You can find more details about the upgrade [here](https://github.com/filecoin-project/lotus/discussions/10686)
|
||||
|
||||
## ☢️ Upgrade Warnings ☢️
|
||||
|
||||
Before upgrading to this feature release read carefully through these bullet points:
|
||||
@ -18,6 +20,158 @@ Before upgrading to this feature release read carefully through these bullet poi
|
||||
|
||||
## Highlights
|
||||
|
||||
### Execution Trace Format Changes
|
||||
|
||||
Execution traces (returned from `lotus state exec-trace`, `lotus state replay`, etc.), has changed to account for changes introduced by the FVM. Specifically:
|
||||
|
||||
- The `Msg` field no longer matches the Filecoin message format as many of the message fields didn't make sense in on-chain sub-calls. Instead, it now has the fields `To`, `From`, `Value`, `Method`, `Params`, and `ParamsCodec` where `ParamsCodec` is a new field indicating the IPLD codec of the parameters.
|
||||
- Importantly, the `Msg.CID` field has been removed. This field is still present in top-level invocation results, just not inside the execution trace itself.
|
||||
- The `MsgRct` field no longer includes a `GasUsed` field and now has a `ReturnCodec` field to indicating the IPLD codec of the return value.
|
||||
- The `Error` and `Duration` fields have been removed as these are not set by the FVM. The top-level message "invocation result" retains the `Error` and `Duration` fields, they've only been removed from the trace itself.
|
||||
- Gas Charges no longer include "virtual" gas fields (those starting with `v...`) or source location information (`loc`) as neither field is set by the FVM.
|
||||
|
||||
A note on "codecs": FVM parameters and return values are IPLD blocks where the "codec" specifies the data encoding. The codec will generally be one of:
|
||||
|
||||
- `0x51`, `0x71` - CBOR or DagCBOR. You should generally treat these as equivalent.
|
||||
- `0x55` - Raw bytes.
|
||||
- `0x00` - Nothing. If the codec is `0x00`, the parameter and/or return value should be empty and should be treated as "void" (not specified).
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
Old <code>ExecutionTrace</code>:
|
||||
</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"Msg": {
|
||||
"Version": 0,
|
||||
"To": "f01234",
|
||||
"From": "f04321",
|
||||
"Nonce": 1,
|
||||
"Value": "0",
|
||||
"GasLimit": 0,
|
||||
"GasFeeCap": "1234",
|
||||
"GasPremium": "1234",
|
||||
"Method": 42,
|
||||
"Params": "<base64-data-or-null>",
|
||||
"CID": {
|
||||
"/": "bafyxyz....."
|
||||
},
|
||||
},
|
||||
"MsgRct": {
|
||||
"ExitCode": 0,
|
||||
"Return": "<base64-data-or-null>",
|
||||
"GasUsed": 12345,
|
||||
},
|
||||
"Error": "",
|
||||
"Duration": 568191845,
|
||||
"GasCharges": [
|
||||
{
|
||||
"Name": "OnMethodInvocation",
|
||||
"loc": null,
|
||||
"tg": 23856,
|
||||
"cg": 23856,
|
||||
"sg": 0,
|
||||
"vtg": 0,
|
||||
"vcg": 0,
|
||||
"vsg": 0,
|
||||
"tt": 0
|
||||
},
|
||||
{
|
||||
"Name": "wasm_exec",
|
||||
"loc": null,
|
||||
"tg": 1764,
|
||||
"cg": 1764,
|
||||
"sg": 0,
|
||||
"vtg": 0,
|
||||
"vcg": 0,
|
||||
"vsg": 0,
|
||||
"tt": 0
|
||||
},
|
||||
{
|
||||
"Name": "OnSyscall",
|
||||
"loc": null,
|
||||
"tg": 14000,
|
||||
"cg": 14000,
|
||||
"sg": 0,
|
||||
"vtg": 0,
|
||||
"vcg": 0,
|
||||
"vsg": 0,
|
||||
"tt": 0
|
||||
},
|
||||
],
|
||||
"Subcalls": [
|
||||
{
|
||||
"Msg": { },
|
||||
"MsgRct": { },
|
||||
"Error": "",
|
||||
"Duration": 1235,
|
||||
"GasCharges": [],
|
||||
"Subcalls": [],
|
||||
},
|
||||
]
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
New <code>ExecutionTrace</code>:
|
||||
</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"Msg": {
|
||||
"To": "f01234",
|
||||
"From": "f04321",
|
||||
"Value": "0",
|
||||
"Method": 42,
|
||||
"Params": "<base64-data-or-null>",
|
||||
"ParamsCodec": 81
|
||||
},
|
||||
"MsgRct": {
|
||||
"ExitCode": 0,
|
||||
"Return": "<base64-data-or-null>",
|
||||
"ReturnCodec": 81
|
||||
},
|
||||
"GasCharges": [
|
||||
{
|
||||
"Name": "OnMethodInvocation",
|
||||
"loc": null,
|
||||
"tg": 23856,
|
||||
"cg": 23856,
|
||||
"tt": 0
|
||||
},
|
||||
{
|
||||
"Name": "wasm_exec",
|
||||
"loc": null,
|
||||
"tg": 1764,
|
||||
"cg": 1764,
|
||||
"sg": 0,
|
||||
"tt": 0
|
||||
},
|
||||
{
|
||||
"Name": "OnSyscall",
|
||||
"loc": null,
|
||||
"tg": 14000,
|
||||
"cg": 14000,
|
||||
"sg": 0,
|
||||
"tt": 0
|
||||
},
|
||||
],
|
||||
"Subcalls": [
|
||||
{
|
||||
"Msg": { },
|
||||
"MsgRct": { },
|
||||
"GasCharges": [],
|
||||
"Subcalls": [],
|
||||
},
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
**SplitStore**
|
||||
|
||||
This feature release introduces numerous improvements and fixes to tackle SplitStore related issues that has been reported. With this feature release SplitStore is automatically activated by default on new nodes. However, for existing Lotus users, you need to explicitly configure SplitStore by uncommenting the `EnableSplitstore` option in your `config.toml` file. To enable SplitStore, set `EnableSplitstore=true`, and to disable it, set `EnableSplitstore=false`. **It's important to note that your Lotus node will not start unless this configuration is properly set. Set it to false if you are running a full archival node!**
|
||||
@ -242,158 +396,6 @@ The `lotus-miner sector list` is now running in parallel - which should speed up
|
||||
- feat: ci: make ci more efficient ([filecoin-project/lotus#9910](https://github.com/filecoin-project/lotus/pull/9910))
|
||||
- feat: scripts: go.mod dep diff script ([filecoin-project/lotus#9711](https://github.com/filecoin-project/lotus/pull/9711))
|
||||
|
||||
## Execution Trace Format Changes
|
||||
|
||||
Execution traces (returned from `lotus state exec-trace`, `lotus state replay`, etc.), has changed to account for changes introduced by the FVM. Specifically:
|
||||
|
||||
- The `Msg` field no longer matches the Filecoin message format as many of the message fields didn't make sense in on-chain sub-calls. Instead, it now has the fields `To`, `From`, `Value`, `Method`, `Params`, and `ParamsCodec` where `ParamsCodec` is a new field indicating the IPLD codec of the parameters.
|
||||
- Importantly, the `Msg.CID` field has been removed. This field is still present in top-level invocation results, just not inside the execution trace itself.
|
||||
- The `MsgRct` field no longer includes a `GasUsed` field and now has a `ReturnCodec` field to indicating the IPLD codec of the return value.
|
||||
- The `Error` and `Duration` fields have been removed as these are not set by the FVM. The top-level message "invocation result" retains the `Error` and `Duration` fields, they've only been removed from the trace itself.
|
||||
- Gas Charges no longer include "virtual" gas fields (those starting with `v...`) or source location information (`loc`) as neither field is set by the FVM.
|
||||
|
||||
A note on "codecs": FVM parameters and return values are IPLD blocks where the "codec" specifies the data encoding. The codec will generally be one of:
|
||||
|
||||
- `0x51`, `0x71` - CBOR or DagCBOR. You should generally treat these as equivalent.
|
||||
- `0x55` - Raw bytes.
|
||||
- `0x00` - Nothing. If the codec is `0x00`, the parameter and/or return value should be empty and should be treated as "void" (not specified).
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
Old <code>ExecutionTrace</code>:
|
||||
</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"Msg": {
|
||||
"Version": 0,
|
||||
"To": "f01234",
|
||||
"From": "f04321",
|
||||
"Nonce": 1,
|
||||
"Value": "0",
|
||||
"GasLimit": 0,
|
||||
"GasFeeCap": "1234",
|
||||
"GasPremium": "1234",
|
||||
"Method": 42,
|
||||
"Params": "<base64-data-or-null>",
|
||||
"CID": {
|
||||
"/": "bafyxyz....."
|
||||
},
|
||||
},
|
||||
"MsgRct": {
|
||||
"ExitCode": 0,
|
||||
"Return": "<base64-data-or-null>",
|
||||
"GasUsed": 12345,
|
||||
},
|
||||
"Error": "",
|
||||
"Duration": 568191845,
|
||||
"GasCharges": [
|
||||
{
|
||||
"Name": "OnMethodInvocation",
|
||||
"loc": null,
|
||||
"tg": 23856,
|
||||
"cg": 23856,
|
||||
"sg": 0,
|
||||
"vtg": 0,
|
||||
"vcg": 0,
|
||||
"vsg": 0,
|
||||
"tt": 0
|
||||
},
|
||||
{
|
||||
"Name": "wasm_exec",
|
||||
"loc": null,
|
||||
"tg": 1764,
|
||||
"cg": 1764,
|
||||
"sg": 0,
|
||||
"vtg": 0,
|
||||
"vcg": 0,
|
||||
"vsg": 0,
|
||||
"tt": 0
|
||||
},
|
||||
{
|
||||
"Name": "OnSyscall",
|
||||
"loc": null,
|
||||
"tg": 14000,
|
||||
"cg": 14000,
|
||||
"sg": 0,
|
||||
"vtg": 0,
|
||||
"vcg": 0,
|
||||
"vsg": 0,
|
||||
"tt": 0
|
||||
},
|
||||
],
|
||||
"Subcalls": [
|
||||
{
|
||||
"Msg": { },
|
||||
"MsgRct": { },
|
||||
"Error": "",
|
||||
"Duration": 1235,
|
||||
"GasCharges": [],
|
||||
"Subcalls": [],
|
||||
},
|
||||
]
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
New <code>ExecutionTrace</code>:
|
||||
</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"Msg": {
|
||||
"To": "f01234",
|
||||
"From": "f04321",
|
||||
"Value": "0",
|
||||
"Method": 42,
|
||||
"Params": "<base64-data-or-null>",
|
||||
"ParamsCodec": 81
|
||||
},
|
||||
"MsgRct": {
|
||||
"ExitCode": 0,
|
||||
"Return": "<base64-data-or-null>",
|
||||
"ReturnCodec": 81
|
||||
},
|
||||
"GasCharges": [
|
||||
{
|
||||
"Name": "OnMethodInvocation",
|
||||
"loc": null,
|
||||
"tg": 23856,
|
||||
"cg": 23856,
|
||||
"tt": 0
|
||||
},
|
||||
{
|
||||
"Name": "wasm_exec",
|
||||
"loc": null,
|
||||
"tg": 1764,
|
||||
"cg": 1764,
|
||||
"sg": 0,
|
||||
"tt": 0
|
||||
},
|
||||
{
|
||||
"Name": "OnSyscall",
|
||||
"loc": null,
|
||||
"tg": 14000,
|
||||
"cg": 14000,
|
||||
"sg": 0,
|
||||
"tt": 0
|
||||
},
|
||||
],
|
||||
"Subcalls": [
|
||||
{
|
||||
"Msg": { },
|
||||
"MsgRct": { },
|
||||
"GasCharges": [],
|
||||
"Subcalls": [],
|
||||
},
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Contributors
|
||||
|
||||
| Contributor | Commits | Lines ± | Files Changed |
|
||||
@ -440,6 +442,59 @@ New <code>ExecutionTrace</code>:
|
||||
| vyzo | 1 | +3/-3 | 2 |
|
||||
| 0x5459 | 1 | +1/-1 | 1 |
|
||||
|
||||
# v1.22.0-rc4 / 2023-04-17
|
||||
|
||||
This is the fourth release candidate for MANDATORY 1.22.0 release of lotus.
|
||||
|
||||
Diff from previous RCs:
|
||||
- REVERT [Activation bug fix](https://github.com/filecoin-project/builtin-actors/issues/914)
|
||||
- REVERT [FIP 0052](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0052.md)
|
||||
|
||||
Activation bug fix is reverted to reduce upgrade risk in order to expedite the upgrade. This is in hopes of helping improve recent chain quality degregadation along with other long syncing time related issues. FIP 0052 requires the activation bug fix to maintain security invariants and so must also be reverted.
|
||||
|
||||
# v1.22.0-rc1 / 2023-04-13
|
||||
|
||||
|
||||
This is the third release candidate for the upcoming MANDATORY 1.22.0 release of Lotus. This release will deliver the nv19 Lighting and nv20 Thunder network upgrade.
|
||||
|
||||
Note that this release candidate sets the calibration upgrade epoch, and does NOT set the epoch at which mainnet will upgrade; that detail will be finalized in the 1.22.0 release.
|
||||
|
||||
The Lighting and Thunder upgrade introduces the following Filecoin Improvement Proposals (FIPs), delivered by builtin-actors v11 (see actors [v11.0.0-rc.1](https://github.com/filecoin-project/builtin-actors/releases/tag/v11.0.0-rc1)):
|
||||
|
||||
- [FIP 0060](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0060.md) - Thirty day market deal maintenance interval
|
||||
- [FIP 0061](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0061.md) - WindowPoSt grindability fix
|
||||
- [FIP 0062](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0062.md) - Fallback method handler for multisig actor
|
||||
- [FIP 0052](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0052.md) - Deals and sectors can be created and extended in 3.5 year intervals (+2 years from current params)
|
||||
- [Activation bug fix](https://github.com/filecoin-project/builtin-actors/issues/914) - internal refactor of sector info fields fixing several outstanding bugs
|
||||
|
||||
## Lighting and Thunder
|
||||
|
||||
As you may have noticed, that we are doing a two-stage incremental network upgrades in this release. This essentially means that there will be two network versions rolled out together -- nv19 and nv20.
|
||||
The two stage roll out is required for FIP-0061 - which introduces a new proof that reduces the grindability of windowPoSt and furthur secures the network. At the first upgrade, the new proof type will start to be accepted by the protocol, while the second upgrade (nv20) marks the spot when the old proof type will no longer be accepted. This allows for a smooth rollover period during which both proof types are accepted. Lotus will start generating the new proof types immediately after the nv19 upgrade.
|
||||
This is something we've safely done before. The second upgrade is something of a "ghost" upgrade -- no migration runs, and no code changes, except that clients will start reporting the new network version of nv20 to the FVM.
|
||||
|
||||
## Calibration nv19 Lighting and nv20 Thunder Upgrade
|
||||
|
||||
This release candidate sets the calibration-net nv19 Lighting upgrade at epoch 489394, 2023-04-20T16:30:00Z and nv20 Thunder upgrade will be triggered automatically 11520 epoch later. The bundle the network will be using is [v10.0.0 actors](https://github.com/filecoin-project/builtin-actors/releases/tag/v10.0.0-rc.1)
|
||||
(located at `build/actors/v11.tar.zst`) upon/post migration, manifest CID `bafy2bzacedyne7vbddp2inj64ubztcvkmfkdnahwo353sltkqtsyzckioneuu`.
|
||||
|
||||
# v1.20.4 / 2023-03-17
|
||||
|
||||
This is a patch release intended to alleviate performance issues reported by some users since the nv18 upgrade.
|
||||
The primary change is to update the FFI to allow for FVM parallelism of 4 by default, and make this user-configurable.
|
||||
through the `LOTUS_FVM_CONCURRENCY` env var.
|
||||
|
||||
Users with higher memory specs can experiment with setting `LOTUS_FVM_CONCURRENCY` to higher values, up to 48, to allow for more concurrent FVM execution.
|
||||
|
||||
## Bug fixes
|
||||
|
||||
- Splitstore: Don't enforce walking receipt tree during compaction #10505
|
||||
- fix: build: drop drand incentinet servers #10506
|
||||
|
||||
## Improvement
|
||||
|
||||
- chore: update ffi to increase execution parallelism #10503
|
||||
|
||||
# v1.20.3 / 2023-03-09
|
||||
|
||||
A 🐈 stepped on the ⌨️ and made a mistake while resolving conflicts 😨. This releases only includes #10439 to fix that mistake. v1.20.2 is retracted - Please skip v1.20.2 and **only** update to v1.20.3!!!
|
||||
@ -461,6 +516,8 @@ This is a HIGHLY RECOMMENDED patch release for node operators/API service provid
|
||||
|
||||
# v1.20.2 / 2023-03-09
|
||||
|
||||
DO NOT USE: Use 1.20.3 instead!
|
||||
|
||||
This is a HIGHLY RECOMMENDED patch release for node operators/API service providers that run ETH RPC service and an optional release for Storage Providers.
|
||||
|
||||
## Bug fixes
|
||||
|
@ -337,6 +337,8 @@ type ForkUpgradeParams struct {
|
||||
UpgradeSkyrHeight abi.ChainEpoch
|
||||
UpgradeSharkHeight abi.ChainEpoch
|
||||
UpgradeHyggeHeight abi.ChainEpoch
|
||||
UpgradeLightningHeight abi.ChainEpoch
|
||||
UpgradeThunderHeight abi.ChainEpoch
|
||||
}
|
||||
|
||||
type NonceMapType map[address.Address]uint64
|
||||
|
BIN
build/actors/v11.tar.zst
Normal file
BIN
build/actors/v11.tar.zst
Normal file
Binary file not shown.
@ -1,2 +1,2 @@
|
||||
/dns4/bootstrap-0.butterfly.fildev.network/tcp/1347/p2p/12D3KooWCa1wgMMBB9JjA2kYqaN1v5uh7xvcsc2gQJBHzPp7G57H
|
||||
/dns4/bootstrap-1.butterfly.fildev.network/tcp/1347/p2p/12D3KooWD6fCvo1dyci6wsjTLyv7eJK73pCVz6RCQjbtPvbc8LYw
|
||||
/dns4/bootstrap-0.butterfly.fildev.network/tcp/1347/p2p/12D3KooWD5mtdmjHQ1Puj9Md7SEfoa7kWMpwqUhAKsyYsBP56LQC
|
||||
/dns4/bootstrap-1.butterfly.fildev.network/tcp/1347/p2p/12D3KooWEoYPkm6o87ES6AppFY7d7WHJUQg7XVPRAyQZjEU31efQ
|
||||
|
@ -49,10 +49,10 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
||||
"verifiedregistry": MustParseCid("bafk2bzacecjkesz766626ab4svnzpq3jfs26a75vfktlfaku5fjdao2eyiqyq"),
|
||||
},
|
||||
}, {
|
||||
Network: "butterflynet",
|
||||
Version: 10,
|
||||
BundleGitTag: "v10.0.0",
|
||||
ManifestCid: MustParseCid("bafy2bzaceckjhsggacixv2d377zfdcnuio4hzkveprio3xnhm3gohi3zy3zco"),
|
||||
Network: "butterflynet",
|
||||
Version: 10,
|
||||
|
||||
ManifestCid: MustParseCid("bafy2bzaceckjhsggacixv2d377zfdcnuio4hzkveprio3xnhm3gohi3zy3zco"),
|
||||
Actors: map[string]cid.Cid{
|
||||
"account": MustParseCid("bafk2bzacedkt3uzgugcsdrcsyfvizcpyr5eshltmienbyhjne2t7t3ktkihny"),
|
||||
"cron": MustParseCid("bafk2bzacecrehknegmfnhmhwy2g43cw52mvl7ptfpp44syus4iph7az7uveuq"),
|
||||
@ -71,6 +71,29 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
||||
"system": MustParseCid("bafk2bzacebojf25kc5yo7gskdbdgg5f52oppej2jp6nknzlvrww4ue5vkddd2"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzaceavue3zekq4wmvttck2vgxlcensrsgh5niu5qhna2owejycorftcc"),
|
||||
},
|
||||
}, {
|
||||
Network: "butterflynet",
|
||||
Version: 11,
|
||||
BundleGitTag: "v11.0.0-rc2",
|
||||
ManifestCid: MustParseCid("bafy2bzaceajj76ms4q2ka3ckzj2iiifl7ewxqdpolshcmhml32sqwolrmsh6e"),
|
||||
Actors: map[string]cid.Cid{
|
||||
"account": MustParseCid("bafk2bzacecsf7v7mm4osq7cqbygyudg5zkwqbpbkmi3iluakugzvbd2cuucfw"),
|
||||
"cron": MustParseCid("bafk2bzacediqvwudrujh7ejowrcumrnara7k2fonr35vulnggpwwwh3o32pmu"),
|
||||
"datacap": MustParseCid("bafk2bzaceb7jkx5kxwwbkw5ehz63sq2b6urouegn4cdczlziaw5ea44u67ock"),
|
||||
"eam": MustParseCid("bafk2bzacebq2zzzkcra7ahantiq7xlkgcrkoq2azmeqpwhoie5gxcxhurbdp2"),
|
||||
"ethaccount": MustParseCid("bafk2bzacebrtwz4nyl3nkgjfpvtqjrjixnbujkr72fwzf5bqhpqfo4hgbjqo2"),
|
||||
"evm": MustParseCid("bafk2bzacecoxcwxbukue76b4rrqhnjywgzjdlhbbemma4kqdzalpkgtdpog7q"),
|
||||
"init": MustParseCid("bafk2bzacebwfs5wna2dculc4mpl4a25cjrmguoscbebeb5g5yft4ntfpku7cu"),
|
||||
"multisig": MustParseCid("bafk2bzaceavnestm7obwlj3moeewcnuomzigfzys4lt26s3l3psjeligf4hju"),
|
||||
"paymentchannel": MustParseCid("bafk2bzaceb4vefsbgswrciqo26wnacvqwpicqjfyicwsdjmv4rbcc4zeae72g"),
|
||||
"placeholder": MustParseCid("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"),
|
||||
"reward": MustParseCid("bafk2bzacedyl4uerjbw3tu5mcgkn7ftvr3j3poy4uv5tuzyuvcdinjb75cz3w"),
|
||||
"storagemarket": MustParseCid("bafk2bzacechvhqru32tw7zii2raii3upjrkybiubepjtartyhzibnac57gxyo"),
|
||||
"storageminer": MustParseCid("bafk2bzacedu6tzfpxwzqym3z2j252d57gqj3jduap7ijf5mczvhmsirs6wxfs"),
|
||||
"storagepower": MustParseCid("bafk2bzacebdoeoiayvshg4zaxygmpuituux3ccd4gxfl3ile7ckpsyy7kpnms"),
|
||||
"system": MustParseCid("bafk2bzaceatn5cj3jqmrug65ur26jhrzcgmishv5hjfswvsyxsieccchhwies"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzacecjshlgoyim3r2uvhtjthu5udxpq5fvjy4pmpi3sy4v6a4chjvb4k"),
|
||||
},
|
||||
}, {
|
||||
Network: "calibrationnet",
|
||||
Version: 8,
|
||||
@ -109,10 +132,10 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
||||
"verifiedregistry": MustParseCid("bafk2bzacebh7dj6j7yi5vadh7lgqjtq42qi2uq4n6zy2g5vjeathacwn2tscu"),
|
||||
},
|
||||
}, {
|
||||
Network: "calibrationnet",
|
||||
Version: 10,
|
||||
BundleGitTag: "v10.0.0-rc.1",
|
||||
ManifestCid: MustParseCid("bafy2bzaced25ta3j6ygs34roprilbtb3f6mxifyfnm7z7ndquaruxzdq3y7lo"),
|
||||
Network: "calibrationnet",
|
||||
Version: 10,
|
||||
|
||||
ManifestCid: MustParseCid("bafy2bzaced25ta3j6ygs34roprilbtb3f6mxifyfnm7z7ndquaruxzdq3y7lo"),
|
||||
Actors: map[string]cid.Cid{
|
||||
"account": MustParseCid("bafk2bzacebhfuz3sv7duvk653544xsxhdn4lsmy7ol7k6gdgancyctvmd7lnq"),
|
||||
"cron": MustParseCid("bafk2bzacecw2yjb6ysieffa7lk7xd32b3n4ssowvafolt7eq52lp6lk4lkhji"),
|
||||
@ -131,6 +154,29 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
||||
"system": MustParseCid("bafk2bzacea4mtukm5zazygkdbgdf26cpnwwif5n2no7s6tknpxlwy6fpq3mug"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzacec67wuchq64k7kgrujguukjvdlsl24pgighqdx5vgjhyk6bycrwnc"),
|
||||
},
|
||||
}, {
|
||||
Network: "calibrationnet",
|
||||
Version: 11,
|
||||
BundleGitTag: "v11.0.0-rc2",
|
||||
ManifestCid: MustParseCid("bafy2bzacedhuowetjy2h4cxnijz2l64h4mzpk5m256oywp4evarpono3cjhco"),
|
||||
Actors: map[string]cid.Cid{
|
||||
"account": MustParseCid("bafk2bzacebor5mnjnsav34cmm5pcd3dy4wubbv4wtcrvba7depy3sct7ie4sy"),
|
||||
"cron": MustParseCid("bafk2bzacebetehhedh55alfn4rcx2mhjhvuiustxlhtxc3drkemnpttws5eqw"),
|
||||
"datacap": MustParseCid("bafk2bzaced6uhmrh5jjexhw4lco4ipesi2iutl7uupnyspgmnbydyo3amtu4i"),
|
||||
"eam": MustParseCid("bafk2bzacea6wzcnflfnaxqnwydoghh7ezg5au32ew3bnzljzpiw6fimhlpoiu"),
|
||||
"ethaccount": MustParseCid("bafk2bzacedrbpvjvyzif2cjxosm4pliyq2m6wzndvrg7r6hzdhixplzvgubbw"),
|
||||
"evm": MustParseCid("bafk2bzaceabftmhejmvjvpzmbsv4cvaew6v5juj5sqtq7cfijugwsnahnsy5w"),
|
||||
"init": MustParseCid("bafk2bzaceduyjd35y7o2lhvevtysqf45rp5ot7x5f36q6iond6dyiz6773g5q"),
|
||||
"multisig": MustParseCid("bafk2bzacebcb72fmbpocetnzgni2wnbrduamlqx6fl3yelrlzu7id6bu5ib5g"),
|
||||
"paymentchannel": MustParseCid("bafk2bzaceazwhm63kyp47pste5i5acnuhosrgythyagf3kc5clogiqqx6vkzk"),
|
||||
"placeholder": MustParseCid("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"),
|
||||
"reward": MustParseCid("bafk2bzacecp7xo5ev46y64zr5osnn5fxo7itpoqw235tcfv6eo4rymzdemet2"),
|
||||
"storagemarket": MustParseCid("bafk2bzacedjt5mueomasx7dijooxnwxsbtzu2dj2ppp45rtle4kiinkmgzeei"),
|
||||
"storageminer": MustParseCid("bafk2bzacebkjnjp5okqjhjxzft5qkuv36u4tz7inawseiwi2kw4j43xpxvhpm"),
|
||||
"storagepower": MustParseCid("bafk2bzaced2qsypqwore3jrdtaesh4itst2fyeepdsozvtffc2pianzmphdum"),
|
||||
"system": MustParseCid("bafk2bzacedqvik2n3phnj3cni3h2k5mtvz43nyq7mdmv7k7euejysvajywdug"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzaceceoo5jlom2zweh7kpye2vkj33wgqnkjshlsw2neemqkfg5g2rmvg"),
|
||||
},
|
||||
}, {
|
||||
Network: "caterpillarnet",
|
||||
Version: 8,
|
||||
@ -178,10 +224,10 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
||||
"verifiedregistry": MustParseCid("bafk2bzacebzndvdqtdck2y35smcxezldgh6nm6rbkj3g3fmiknsgg2uah235y"),
|
||||
},
|
||||
}, {
|
||||
Network: "caterpillarnet",
|
||||
Version: 10,
|
||||
BundleGitTag: "v10.0.0",
|
||||
ManifestCid: MustParseCid("bafy2bzaceajftd7jawqnwf4kzkotksrwy6ag7mu2apkvypzrrmxboheuum5oi"),
|
||||
Network: "caterpillarnet",
|
||||
Version: 10,
|
||||
|
||||
ManifestCid: MustParseCid("bafy2bzaceajftd7jawqnwf4kzkotksrwy6ag7mu2apkvypzrrmxboheuum5oi"),
|
||||
Actors: map[string]cid.Cid{
|
||||
"account": MustParseCid("bafk2bzacecsbx4tovnr5x2ifcpqbpx33oht74mgtvmaauzrqcq2wnm7prr7ak"),
|
||||
"cron": MustParseCid("bafk2bzacecpzfajba6m4v4ty342jw6lcu6n63bwtldmzko733wpd2q5jzfdvu"),
|
||||
@ -200,6 +246,29 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
||||
"system": MustParseCid("bafk2bzacecfivztuulqqv4o5oyvvvrkblwix4hqt24pqru6ivnpioefhuhria"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzacecdhw6x7dfrxfysmn6tdbn2ny464omgqppxhjuawxauscidppd7pc"),
|
||||
},
|
||||
}, {
|
||||
Network: "caterpillarnet",
|
||||
Version: 11,
|
||||
BundleGitTag: "v11.0.0-rc2",
|
||||
ManifestCid: MustParseCid("bafy2bzacedeberqleewemblnbpwufbs6hnric73jy2anlb2sef4o72jf6mxsu"),
|
||||
Actors: map[string]cid.Cid{
|
||||
"account": MustParseCid("bafk2bzacearzuvg6ugk4evuvgjkap2cyln2efrpano75ecgam4bzyl5l2enn6"),
|
||||
"cron": MustParseCid("bafk2bzaceas3ku3ol6pwlab7g7zgttfn5bhdo2qbc6vpkbgb2wbrzqsldsv6u"),
|
||||
"datacap": MustParseCid("bafk2bzacebyrneejblvplw6if36hhxx765hx7efnk7a4sj3lqsuupz6m7rgqm"),
|
||||
"eam": MustParseCid("bafk2bzaceaclwxphuqwymjozzomza3q2jhf6ib4mqewlrrgmkkqzupvpbaksk"),
|
||||
"ethaccount": MustParseCid("bafk2bzacebikzogkoy4fzkqrc3vdirr4h7eq3zzty7csc7aaabevocf65nfds"),
|
||||
"evm": MustParseCid("bafk2bzacectdxa4ctrobwmq5h42aqbras42b6hjea7krgkc3ghatuitgset4i"),
|
||||
"init": MustParseCid("bafk2bzacecdtsmhlxakdoyojcntubtj7kdplwq67dlodihs22zlz762ljkico"),
|
||||
"multisig": MustParseCid("bafk2bzacebgwns6gt4sv44ey7hz7nfqmk2z6g3yjrr32ovz5iuklrrc6xujn6"),
|
||||
"paymentchannel": MustParseCid("bafk2bzacedxwn53sstmkmakev6yjvwezfsozbeoljnk2ls2yfmndvytkcw3iq"),
|
||||
"placeholder": MustParseCid("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"),
|
||||
"reward": MustParseCid("bafk2bzacedjwx5vlghmudjd4zbgzjs7cgk5yyzn7hxb5usqyfwhhumhfse2wq"),
|
||||
"storagemarket": MustParseCid("bafk2bzacedxnxuwq64g5jsoz6dejx2lm6gjis5evzglaxdnb2rrb4oh2tvjhg"),
|
||||
"storageminer": MustParseCid("bafk2bzacedpmjackp3e3wucnu2kx4r6gl7cues2ogyfffvuv4x7ec5mwbwlie"),
|
||||
"storagepower": MustParseCid("bafk2bzacecjlefvghymezg6lrccaedviwirjg3vmu5sd5qz6aps3khjjvhlxm"),
|
||||
"system": MustParseCid("bafk2bzacec6p5l2no77yiaznaxogzg5zwgocfn32h7ebzry7vyxnbfqvn3oqa"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzacebmi44uxzpu3xhzlkjkczrjz2sv4brj3thxwc7c6nvhcjoc4divca"),
|
||||
},
|
||||
}, {
|
||||
Network: "devnet",
|
||||
Version: 8,
|
||||
@ -238,10 +307,10 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
||||
"verifiedregistry": MustParseCid("bafk2bzacednorhcy446agy7ecpmfms2u4aoa3mj2eqomffuoerbik5yavrxyi"),
|
||||
},
|
||||
}, {
|
||||
Network: "devnet",
|
||||
Version: 10,
|
||||
BundleGitTag: "v10.0.0",
|
||||
ManifestCid: MustParseCid("bafy2bzacebzz376j5kizfck56366kdz5aut6ktqrvqbi3efa2d4l2o2m653ts"),
|
||||
Network: "devnet",
|
||||
Version: 10,
|
||||
|
||||
ManifestCid: MustParseCid("bafy2bzacebzz376j5kizfck56366kdz5aut6ktqrvqbi3efa2d4l2o2m653ts"),
|
||||
Actors: map[string]cid.Cid{
|
||||
"account": MustParseCid("bafk2bzacedkj5dqs5xxamnlug2d5dyjl6askf7wlmvwzhmsrzcvogv7acqfe6"),
|
||||
"cron": MustParseCid("bafk2bzaceabslrigld2vshng6sppbp3bsptjtttvbxctwqe5lkyl2efom2wu4"),
|
||||
@ -260,6 +329,29 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
||||
"system": MustParseCid("bafk2bzaceairk5qz5hyzt4yyaxa356aszyifswiust5ilxizwxujcmtzvjzoa"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzaced2mkyqobpgna5jevosym3adv2bvraggigyz2jgn5cxymirxj4x3i"),
|
||||
},
|
||||
}, {
|
||||
Network: "devnet",
|
||||
Version: 11,
|
||||
BundleGitTag: "v11.0.0-rc2",
|
||||
ManifestCid: MustParseCid("bafy2bzacec2nca2tmntojbsjmi6gpt7gnslv3phratoara3lpamv5w3do2qh2"),
|
||||
Actors: map[string]cid.Cid{
|
||||
"account": MustParseCid("bafk2bzacedxucublg7o7zdy4vw4zr46vngpiflysif333saptv3tfzrh7ktcs"),
|
||||
"cron": MustParseCid("bafk2bzacebnihuzok7gxzmopayqmou42j3uwfpsdzpqkzxf4xvxbxco76cx42"),
|
||||
"datacap": MustParseCid("bafk2bzacebcz2agc2pojoqecllda5bytbtfns7uxozk6hexuzgktl3d447k3g"),
|
||||
"eam": MustParseCid("bafk2bzacedmy4fvb26m7rxom55tcjlekpprxieecgfqpxivum6cv72ca5ld3k"),
|
||||
"ethaccount": MustParseCid("bafk2bzacedlthlzuuaay4ouhvrdbcmljhudihgwtguxlqc5bqwem3hcymeiee"),
|
||||
"evm": MustParseCid("bafk2bzaceboozl4smxva6g6z6dqegtzszq2qheewgr3gbvd32bbvs64simorc"),
|
||||
"init": MustParseCid("bafk2bzacectfoykh2du5w2odxgtcu6jttdeup3j3sh6tke6zbgqzzmhqlc7vw"),
|
||||
"multisig": MustParseCid("bafk2bzaceawofhfckab5zwthkgyos5ornbrg7aeudhavgd6jglfb67tezjxpo"),
|
||||
"paymentchannel": MustParseCid("bafk2bzacebmw7foxdepc44p6wtwkoshvczi6lagspwivfy3o5zc6xcq7e2uzw"),
|
||||
"placeholder": MustParseCid("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"),
|
||||
"reward": MustParseCid("bafk2bzacebeclhjkqqstbnvhzsqf5b54257sblr673kuaqemz7mm4kapyepgw"),
|
||||
"storagemarket": MustParseCid("bafk2bzacea6jtlm65dcihroldmnfk6qxqrsjxxfw5hniftm4rnhuopm2gk6yg"),
|
||||
"storageminer": MustParseCid("bafk2bzacebpzfxjn2z2fk3ariehjldy6l5yker3o57etnup3thqmiqd4vbbdo"),
|
||||
"storagepower": MustParseCid("bafk2bzaceced2xdnoob5yb4tgyhdr2y2f5c5xo7k2ghe5kna5xuevapbvjwpw"),
|
||||
"system": MustParseCid("bafk2bzacea356un67ewdbot57dqreil7gqatzj6uy333xbgah5j6zpdwnpu2k"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzacea6jep5uswr6rfwuizfliy5bzbqahuednohmbgeo2lk443yugq2ho"),
|
||||
},
|
||||
}, {
|
||||
Network: "hyperspace",
|
||||
Version: 8,
|
||||
@ -321,10 +413,10 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
||||
"verifiedregistry": MustParseCid("bafk2bzacecf3yodlyudzukumehbuabgqljyhjt5ifiv4vetcfohnvsxzynwga"),
|
||||
},
|
||||
}, {
|
||||
Network: "mainnet",
|
||||
Version: 10,
|
||||
BundleGitTag: "v10.0.0",
|
||||
ManifestCid: MustParseCid("bafy2bzacecsuyf7mmvrhkx2evng5gnz5canlnz2fdlzu2lvcgptiq2pzuovos"),
|
||||
Network: "mainnet",
|
||||
Version: 10,
|
||||
|
||||
ManifestCid: MustParseCid("bafy2bzacecsuyf7mmvrhkx2evng5gnz5canlnz2fdlzu2lvcgptiq2pzuovos"),
|
||||
Actors: map[string]cid.Cid{
|
||||
"account": MustParseCid("bafk2bzaceampw4romta75hyz5p4cqriypmpbgnkxncgxgqn6zptv5lsp2w2bo"),
|
||||
"cron": MustParseCid("bafk2bzacedcbtsifegiu432m5tysjzkxkmoczxscb6hqpmrr6img7xzdbbs2g"),
|
||||
@ -343,6 +435,29 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
||||
"system": MustParseCid("bafk2bzacedakk5nofebyup4m7nvx6djksfwhnxzrfuq4oyemhpl4lllaikr64"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzacedfel6edzqpe5oujno7fog4i526go4dtcs6vwrdtbpy2xq6htvcg6"),
|
||||
},
|
||||
}, {
|
||||
Network: "mainnet",
|
||||
Version: 11,
|
||||
BundleGitTag: "v11.0.0-rc2",
|
||||
ManifestCid: MustParseCid("bafy2bzacebgfsebvidddy6l6zplsgmibmuqiyfwxotnvoxknvnnhxerjnrgke"),
|
||||
Actors: map[string]cid.Cid{
|
||||
"account": MustParseCid("bafk2bzacecrtbcv3sgamwajiigx4j6v3zd6ycdzicycfjheduxksntymovj72"),
|
||||
"cron": MustParseCid("bafk2bzacecdxzej5q7yodb6zkxjkfrmmuuemu2ykgh4qepnagis6j3gfo73zk"),
|
||||
"datacap": MustParseCid("bafk2bzacecsvwqyxiotzin33zkeqdmt63uokfww6ren6wqvynhow6kwl52oma"),
|
||||
"eam": MustParseCid("bafk2bzaceccgh7emq3a2f46l4buukmwchlggbdcdvxjt34snx64h7tq37vkya"),
|
||||
"ethaccount": MustParseCid("bafk2bzaceahuwxxcpnzzcxqkqa5247pvoojxq72koy36qlq223yyn7mhul7xk"),
|
||||
"evm": MustParseCid("bafk2bzaceafofne3osqnbupdosg23ixb4lsssnd6yo7rdj5gqvfwwxxnwxt22"),
|
||||
"init": MustParseCid("bafk2bzacedxf5bwugxllkuwpyg4ddleckryydoojbcirngbckmlxpdcrmtkw2"),
|
||||
"multisig": MustParseCid("bafk2bzaceakw5rdw67ok44cssjlr655th2kgzjjbcbadbymsl35feplyoljea"),
|
||||
"paymentchannel": MustParseCid("bafk2bzacecj5g34lvlq72wttc65dqdxebrmph4yjftygopsgo6ifabguuf5rm"),
|
||||
"placeholder": MustParseCid("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"),
|
||||
"reward": MustParseCid("bafk2bzacebnz62vsryganusdr4gwhhtm7vj5q5ev43tpcp4usgieh2xnk7dzk"),
|
||||
"storagemarket": MustParseCid("bafk2bzacecprtjtwkfbdzcqglg6bwbqzosamebta7darvistsareszgsxf6ig"),
|
||||
"storageminer": MustParseCid("bafk2bzacedomhrky77hoodiworfnh7imh66entqwsudm2hsmedfx2ymsprd6e"),
|
||||
"storagepower": MustParseCid("bafk2bzacecyri3krbroak66cpccmnjwjzjtzyv7a3qbqjscgnhb46yadtp36w"),
|
||||
"system": MustParseCid("bafk2bzacedehzsjoy5msxblwnkzi7hzuuohdzugh3j3bp427jcnef57xkqevc"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzaceazvpyoiqrsmitkjsaei3r6746d2fqoiy7yjo7htguvwo5ntlxfrq"),
|
||||
},
|
||||
}, {
|
||||
Network: "testing",
|
||||
Version: 8,
|
||||
@ -381,10 +496,10 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
||||
"verifiedregistry": MustParseCid("bafk2bzaceatmqip2o3ausbntvdhj7yemu6hb3b5yqv6hm42gylbbmz7geocpm"),
|
||||
},
|
||||
}, {
|
||||
Network: "testing",
|
||||
Version: 10,
|
||||
BundleGitTag: "v10.0.0",
|
||||
ManifestCid: MustParseCid("bafy2bzacebsp3bkxwsijenqeimhvhtg52d6o76hn6qhzxveqfq7d5hdd5l2ee"),
|
||||
Network: "testing",
|
||||
Version: 10,
|
||||
|
||||
ManifestCid: MustParseCid("bafy2bzacebsp3bkxwsijenqeimhvhtg52d6o76hn6qhzxveqfq7d5hdd5l2ee"),
|
||||
Actors: map[string]cid.Cid{
|
||||
"account": MustParseCid("bafk2bzaceazxb6p2xg6caivmie6k2bvutyesngwyvhwv4eemwu7ia4vnqkcuy"),
|
||||
"cron": MustParseCid("bafk2bzaceax6ym73boyl5zdpbcr6zmbajzylmcdvlapz5zcqgzcshakz44jbq"),
|
||||
@ -403,6 +518,29 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
||||
"system": MustParseCid("bafk2bzacecf2jimdz7knhngs64ximfz3eaud6s3kiunmkybgrkupdjyo2dw7o"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzacecdmek2htsgcyoyl35glakyab66cojqo2y335njnm7krleb6yfbps"),
|
||||
},
|
||||
}, {
|
||||
Network: "testing",
|
||||
Version: 11,
|
||||
BundleGitTag: "v11.0.0-rc2",
|
||||
ManifestCid: MustParseCid("bafy2bzacedsxzhzzkfbexqyspkiwqyyn27xplscxtpria4babxsxqmvwvgzmg"),
|
||||
Actors: map[string]cid.Cid{
|
||||
"account": MustParseCid("bafk2bzacecn3i4m2utctacfctwf3tord3a2z364yffacydc6h3mtv37exehxo"),
|
||||
"cron": MustParseCid("bafk2bzacedpt2d3ckjirv45esiug4hoousgqixdu3ya6yydhebjuklx6lkzuw"),
|
||||
"datacap": MustParseCid("bafk2bzacebfp7bklbkomcexam2r5aawv2ucuqzkdmeamch7bigsprmadfvxvk"),
|
||||
"eam": MustParseCid("bafk2bzaceds3dguvp5pvqnq7cwvz46mqbqem35nfril5frwumcauzdliamvam"),
|
||||
"ethaccount": MustParseCid("bafk2bzaceab3egffns45nwvvgtbncoq6jyqgyt4czvwrayz6x6isotbob55ve"),
|
||||
"evm": MustParseCid("bafk2bzacealplkpnbvap6qrz4vuiebkuutum3e5nasnscepfx5pw4grrvkfpe"),
|
||||
"init": MustParseCid("bafk2bzaced7mmznvvjh3vrlm3s3iostm7iwwvust3lcpujbldh4dmmrecoxia"),
|
||||
"multisig": MustParseCid("bafk2bzaceajadbzimbpdjzddi56p6hih5ro6p7pvwb635ivk6byktbjy2a3rq"),
|
||||
"paymentchannel": MustParseCid("bafk2bzacech2ns3zv7j3xxmbw37zldh5brg4j4shurf5scnf2q74ksow7f6tg"),
|
||||
"placeholder": MustParseCid("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"),
|
||||
"reward": MustParseCid("bafk2bzacearazt2oxjp5vbzymu2zfur2p5wj7giabxunj42w5embrmgi2byh2"),
|
||||
"storagemarket": MustParseCid("bafk2bzacecqtfzdcwygdjo7jyeonkfvhuyit6hv6an2bit6t6xdmliyiaxpyy"),
|
||||
"storageminer": MustParseCid("bafk2bzaceah46gbb5ls2dor2ajr7quofchee3bwghtq3btcjve3dpyrxo56tc"),
|
||||
"storagepower": MustParseCid("bafk2bzacedmz4i6cslncm65si47tnpmdbn5owvvm7kjisvbfvvkvdv2viucck"),
|
||||
"system": MustParseCid("bafk2bzaceably72ppjsvbtm2pmc7zzczvxsc7qaab5off6jy2qntwhax3klqa"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzacecozu2vc3tqk7az7koqdiejcgk2q476542pnv7tmx5beomtvtjbzc"),
|
||||
},
|
||||
}, {
|
||||
Network: "testing-fake-proofs",
|
||||
Version: 8,
|
||||
@ -441,10 +579,10 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
||||
"verifiedregistry": MustParseCid("bafk2bzaceatmqip2o3ausbntvdhj7yemu6hb3b5yqv6hm42gylbbmz7geocpm"),
|
||||
},
|
||||
}, {
|
||||
Network: "testing-fake-proofs",
|
||||
Version: 10,
|
||||
BundleGitTag: "v10.0.0",
|
||||
ManifestCid: MustParseCid("bafy2bzacedwap2uuii4luljckrnb4vkur2unb6fyinn7xjie6xlva2wmlygj2"),
|
||||
Network: "testing-fake-proofs",
|
||||
Version: 10,
|
||||
|
||||
ManifestCid: MustParseCid("bafy2bzacedwap2uuii4luljckrnb4vkur2unb6fyinn7xjie6xlva2wmlygj2"),
|
||||
Actors: map[string]cid.Cid{
|
||||
"account": MustParseCid("bafk2bzaceazxb6p2xg6caivmie6k2bvutyesngwyvhwv4eemwu7ia4vnqkcuy"),
|
||||
"cron": MustParseCid("bafk2bzaceax6ym73boyl5zdpbcr6zmbajzylmcdvlapz5zcqgzcshakz44jbq"),
|
||||
@ -463,4 +601,27 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet
|
||||
"system": MustParseCid("bafk2bzacecf2jimdz7knhngs64ximfz3eaud6s3kiunmkybgrkupdjyo2dw7o"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzacecdmek2htsgcyoyl35glakyab66cojqo2y335njnm7krleb6yfbps"),
|
||||
},
|
||||
}, {
|
||||
Network: "testing-fake-proofs",
|
||||
Version: 11,
|
||||
BundleGitTag: "v11.0.0-rc2",
|
||||
ManifestCid: MustParseCid("bafy2bzacebebmxp3bmls3erhyyothy243ljtet4wtey54ufbygat3nhs6rody"),
|
||||
Actors: map[string]cid.Cid{
|
||||
"account": MustParseCid("bafk2bzacecn3i4m2utctacfctwf3tord3a2z364yffacydc6h3mtv37exehxo"),
|
||||
"cron": MustParseCid("bafk2bzacedpt2d3ckjirv45esiug4hoousgqixdu3ya6yydhebjuklx6lkzuw"),
|
||||
"datacap": MustParseCid("bafk2bzacebfp7bklbkomcexam2r5aawv2ucuqzkdmeamch7bigsprmadfvxvk"),
|
||||
"eam": MustParseCid("bafk2bzaceds3dguvp5pvqnq7cwvz46mqbqem35nfril5frwumcauzdliamvam"),
|
||||
"ethaccount": MustParseCid("bafk2bzaceab3egffns45nwvvgtbncoq6jyqgyt4czvwrayz6x6isotbob55ve"),
|
||||
"evm": MustParseCid("bafk2bzacealplkpnbvap6qrz4vuiebkuutum3e5nasnscepfx5pw4grrvkfpe"),
|
||||
"init": MustParseCid("bafk2bzaced7mmznvvjh3vrlm3s3iostm7iwwvust3lcpujbldh4dmmrecoxia"),
|
||||
"multisig": MustParseCid("bafk2bzaceajadbzimbpdjzddi56p6hih5ro6p7pvwb635ivk6byktbjy2a3rq"),
|
||||
"paymentchannel": MustParseCid("bafk2bzacech2ns3zv7j3xxmbw37zldh5brg4j4shurf5scnf2q74ksow7f6tg"),
|
||||
"placeholder": MustParseCid("bafk2bzacedfvut2myeleyq67fljcrw4kkmn5pb5dpyozovj7jpoez5irnc3ro"),
|
||||
"reward": MustParseCid("bafk2bzacearazt2oxjp5vbzymu2zfur2p5wj7giabxunj42w5embrmgi2byh2"),
|
||||
"storagemarket": MustParseCid("bafk2bzacecqtfzdcwygdjo7jyeonkfvhuyit6hv6an2bit6t6xdmliyiaxpyy"),
|
||||
"storageminer": MustParseCid("bafk2bzacec6ntijn67h3gnn5htgbnlpwfp7g47t4nlkr3llr6trnaj35p3kas"),
|
||||
"storagepower": MustParseCid("bafk2bzaceasdxhi4r4ksy6ageji3xhajr5m5rgixk2w6ojp456kbacmjvxqai"),
|
||||
"system": MustParseCid("bafk2bzaceably72ppjsvbtm2pmc7zzczvxsc7qaab5off6jy2qntwhax3klqa"),
|
||||
"verifiedregistry": MustParseCid("bafk2bzacecozu2vc3tqk7az7koqdiejcgk2q476542pnv7tmx5beomtvtjbzc"),
|
||||
},
|
||||
}}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -23,7 +23,7 @@ var NetworkBundle = "devnet"
|
||||
var BundleOverrides map[actorstypes.Version]string
|
||||
var ActorDebugging = true
|
||||
|
||||
const GenesisNetworkVersion = network.Version17
|
||||
const GenesisNetworkVersion = network.Version18
|
||||
|
||||
var UpgradeBreezeHeight = abi.ChainEpoch(-1)
|
||||
|
||||
@ -59,7 +59,11 @@ var UpgradeSkyrHeight = abi.ChainEpoch(-19)
|
||||
|
||||
var UpgradeSharkHeight = abi.ChainEpoch(-20)
|
||||
|
||||
var UpgradeHyggeHeight = abi.ChainEpoch(30)
|
||||
var UpgradeHyggeHeight = abi.ChainEpoch(-21)
|
||||
|
||||
var UpgradeLightningHeight = abi.ChainEpoch(30)
|
||||
|
||||
var UpgradeThunderHeight = abi.ChainEpoch(1000)
|
||||
|
||||
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
||||
0: DrandMainnet,
|
||||
@ -114,6 +118,8 @@ func init() {
|
||||
UpgradeSkyrHeight = getUpgradeHeight("LOTUS_SKYR_HEIGHT", UpgradeSkyrHeight)
|
||||
UpgradeSharkHeight = getUpgradeHeight("LOTUS_SHARK_HEIGHT", UpgradeSharkHeight)
|
||||
UpgradeHyggeHeight = getUpgradeHeight("LOTUS_HYGGE_HEIGHT", UpgradeHyggeHeight)
|
||||
UpgradeLightningHeight = getUpgradeHeight("LOTUS_LIGHTNING_HEIGHT", UpgradeLightningHeight)
|
||||
UpgradeThunderHeight = getUpgradeHeight("LOTUS_THUNDER_HEIGHT", UpgradeThunderHeight)
|
||||
|
||||
BuildType |= Build2k
|
||||
|
||||
|
@ -19,7 +19,7 @@ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
||||
0: DrandMainnet,
|
||||
}
|
||||
|
||||
const GenesisNetworkVersion = network.Version17
|
||||
const GenesisNetworkVersion = network.Version18
|
||||
|
||||
var NetworkBundle = "butterflynet"
|
||||
var BundleOverrides map[actorstypes.Version]string
|
||||
@ -50,8 +50,12 @@ const UpgradeHyperdriveHeight = -16
|
||||
const UpgradeChocolateHeight = -17
|
||||
const UpgradeOhSnapHeight = -18
|
||||
const UpgradeSkyrHeight = -19
|
||||
const UpgradeSharkHeight = abi.ChainEpoch(-20)
|
||||
const UpgradeHyggeHeight = abi.ChainEpoch(600)
|
||||
const UpgradeSharkHeight = -20
|
||||
const UpgradeHyggeHeight = -21
|
||||
|
||||
const UpgradeLightningHeight = 50
|
||||
|
||||
const UpgradeThunderHeight = UpgradeLightningHeight + 360
|
||||
|
||||
var SupportedProofTypes = []abi.RegisteredSealProof{
|
||||
abi.RegisteredSealProof_StackedDrg512MiBV1,
|
||||
|
@ -73,6 +73,12 @@ const UpgradeSharkHeight = 16800 // 6 days after genesis
|
||||
// 2023-02-21T16:30:00Z
|
||||
const UpgradeHyggeHeight = 322354
|
||||
|
||||
// 2023-04-20T14:00:00Z
|
||||
const UpgradeLightningHeight = 489094
|
||||
|
||||
// 2023-04-21T16:00:00Z
|
||||
const UpgradeThunderHeight = UpgradeLightningHeight + 3120
|
||||
|
||||
var SupportedProofTypes = []abi.RegisteredSealProof{
|
||||
abi.RegisteredSealProof_StackedDrg32GiBV1,
|
||||
abi.RegisteredSealProof_StackedDrg64GiBV1,
|
||||
|
@ -52,7 +52,13 @@ var UpgradeSkyrHeight = abi.ChainEpoch(-19)
|
||||
|
||||
const UpgradeSharkHeight = abi.ChainEpoch(-20)
|
||||
|
||||
const UpgradeHyggeHeight = abi.ChainEpoch(99999999999999)
|
||||
const UpgradeHyggeHeight = abi.ChainEpoch(100)
|
||||
|
||||
// ??????????
|
||||
const UpgradeLightningHeight = 200
|
||||
|
||||
// ??????????????????
|
||||
const UpgradeThunderHeight = 300
|
||||
|
||||
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
||||
0: DrandMainnet,
|
||||
|
@ -87,7 +87,13 @@ const UpgradeSkyrHeight = 1960320
|
||||
const UpgradeSharkHeight = 2383680
|
||||
|
||||
// 2023-03-14T15:14:00Z
|
||||
var UpgradeHyggeHeight = abi.ChainEpoch(2683348)
|
||||
const UpgradeHyggeHeight = 2683348
|
||||
|
||||
// ??????????
|
||||
var UpgradeLightningHeight = abi.ChainEpoch(9999999999)
|
||||
|
||||
// ??????????
|
||||
var UpgradeThunderHeight = UpgradeLightningHeight + 1
|
||||
|
||||
var SupportedProofTypes = []abi.RegisteredSealProof{
|
||||
abi.RegisteredSealProof_StackedDrg32GiBV1,
|
||||
@ -102,8 +108,12 @@ func init() {
|
||||
SetAddressNetwork(address.Mainnet)
|
||||
}
|
||||
|
||||
if os.Getenv("LOTUS_DISABLE_HYGGE") == "1" {
|
||||
UpgradeHyggeHeight = math.MaxInt64
|
||||
if os.Getenv("LOTUS_DISABLE_LIGHTNING") == "1" {
|
||||
UpgradeLightningHeight = math.MaxInt64
|
||||
}
|
||||
|
||||
if os.Getenv("LOTUS_DISABLE_THUNDER") == "1" {
|
||||
UpgradeThunderHeight = math.MaxInt64
|
||||
}
|
||||
|
||||
// NOTE: DO NOT change this unless you REALLY know what you're doing. This is not consensus critical, however,
|
||||
|
@ -26,16 +26,17 @@ const UnixfsLinksPerLevel = 1024
|
||||
|
||||
const AllowableClockDriftSecs = uint64(1)
|
||||
|
||||
// Used by tests and some obscure tooling
|
||||
/* inline-gen template
|
||||
|
||||
const TestNetworkVersion = network.Version{{.latestNetworkVersion}}
|
||||
|
||||
/* inline-gen start */
|
||||
// TODO: nv19: Re-enable when migration is setup
|
||||
//// Used by tests and some obscure tooling
|
||||
///* inline-gen template
|
||||
//
|
||||
//const TestNetworkVersion = network.Version{{.latestNetworkVersion}}
|
||||
//
|
||||
///* inline-gen start */
|
||||
|
||||
const TestNetworkVersion = network.Version18
|
||||
|
||||
/* inline-gen end */
|
||||
///* inline-gen end */
|
||||
|
||||
// Epochs
|
||||
const ForkLengthThreshold = Finality
|
||||
|
@ -106,6 +106,8 @@ var (
|
||||
UpgradeSkyrHeight abi.ChainEpoch = -18
|
||||
UpgradeSharkHeight abi.ChainEpoch = -19
|
||||
UpgradeHyggeHeight abi.ChainEpoch = -20
|
||||
UpgradeLightningHeight abi.ChainEpoch = -21
|
||||
UpgradeThunderHeight abi.ChainEpoch = -22
|
||||
|
||||
DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
||||
0: DrandMainnet,
|
||||
|
@ -37,7 +37,7 @@ func BuildTypeString() string {
|
||||
}
|
||||
|
||||
// BuildVersion is the local build version
|
||||
const BuildVersion = "1.21.0-rc3"
|
||||
const BuildVersion = "1.23.0-rc1"
|
||||
|
||||
func UserVersion() string {
|
||||
if os.Getenv("LOTUS_VERSION_IGNORE_COMMIT") == "1" {
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin10 "github.com/filecoin-project/go-state-types/builtin"
|
||||
builtin11 "github.com/filecoin-project/go-state-types/builtin"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
@ -22,7 +22,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
var Methods = builtin10.MethodsAccount
|
||||
var Methods = builtin11.MethodsAccount
|
||||
|
||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||
@ -41,6 +41,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
case actorstypes.Version10:
|
||||
return load10(store, act.Head)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return load11(store, act.Head)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,6 +108,9 @@ func MakeState(store adt.Store, av actorstypes.Version, addr address.Address) (S
|
||||
case actorstypes.Version10:
|
||||
return make10(store, addr)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return make11(store, addr)
|
||||
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
@ -132,5 +138,6 @@ func AllCodes() []cid.Cid {
|
||||
(&state8{}).Code(),
|
||||
(&state9{}).Code(),
|
||||
(&state10{}).Code(),
|
||||
(&state11{}).Code(),
|
||||
}
|
||||
}
|
||||
|
62
chain/actors/builtin/account/v11.go
generated
Normal file
62
chain/actors/builtin/account/v11.go
generated
Normal file
@ -0,0 +1,62 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
account11 "github.com/filecoin-project/go-state-types/builtin/v11/account"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
var _ State = (*state11)(nil)
|
||||
|
||||
func load11(store adt.Store, root cid.Cid) (State, error) {
|
||||
out := state11{store: store}
|
||||
err := store.Get(store.Context(), root, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make11(store adt.Store, addr address.Address) (State, error) {
|
||||
out := state11{store: store}
|
||||
out.State = account11.State{Address: addr}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state11 struct {
|
||||
account11.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *state11) PubkeyAddress() (address.Address, error) {
|
||||
return s.Address, nil
|
||||
}
|
||||
|
||||
func (s *state11) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state11) ActorKey() string {
|
||||
return manifest.AccountKey
|
||||
}
|
||||
|
||||
func (s *state11) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version11
|
||||
}
|
||||
|
||||
func (s *state11) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
@ -5,7 +5,7 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin10 "github.com/filecoin-project/go-state-types/builtin"
|
||||
builtin11 "github.com/filecoin-project/go-state-types/builtin"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||
@ -37,6 +37,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
case actorstypes.Version10:
|
||||
return load10(store, act.Head)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return load11(store, act.Head)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,13 +104,16 @@ func MakeState(store adt.Store, av actorstypes.Version) (State, error) {
|
||||
case actorstypes.Version10:
|
||||
return make10(store)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return make11(store)
|
||||
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
|
||||
var (
|
||||
Address = builtin10.CronActorAddr
|
||||
Methods = builtin10.MethodsCron
|
||||
Address = builtin11.CronActorAddr
|
||||
Methods = builtin11.MethodsCron
|
||||
)
|
||||
|
||||
type State interface {
|
||||
@ -130,5 +136,6 @@ func AllCodes() []cid.Cid {
|
||||
(&state8{}).Code(),
|
||||
(&state9{}).Code(),
|
||||
(&state10{}).Code(),
|
||||
(&state11{}).Code(),
|
||||
}
|
||||
}
|
||||
|
57
chain/actors/builtin/cron/v11.go
generated
Normal file
57
chain/actors/builtin/cron/v11.go
generated
Normal file
@ -0,0 +1,57 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
cron11 "github.com/filecoin-project/go-state-types/builtin/v11/cron"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
var _ State = (*state11)(nil)
|
||||
|
||||
func load11(store adt.Store, root cid.Cid) (State, error) {
|
||||
out := state11{store: store}
|
||||
err := store.Get(store.Context(), root, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make11(store adt.Store) (State, error) {
|
||||
out := state11{store: store}
|
||||
out.State = *cron11.ConstructState(cron11.BuiltInEntries())
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state11 struct {
|
||||
cron11.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *state11) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state11) ActorKey() string {
|
||||
return manifest.CronKey
|
||||
}
|
||||
|
||||
func (s *state11) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version11
|
||||
}
|
||||
|
||||
func (s *state11) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
@ -7,7 +7,7 @@ import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin10 "github.com/filecoin-project/go-state-types/builtin"
|
||||
builtin11 "github.com/filecoin-project/go-state-types/builtin"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
|
||||
@ -17,8 +17,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
Address = builtin10.DatacapActorAddr
|
||||
Methods = builtin10.MethodsDatacap
|
||||
Address = builtin11.DatacapActorAddr
|
||||
Methods = builtin11.MethodsDatacap
|
||||
)
|
||||
|
||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
@ -35,6 +35,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
case actorstypes.Version10:
|
||||
return load10(store, act.Head)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return load11(store, act.Head)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,6 +53,9 @@ func MakeState(store adt.Store, av actorstypes.Version, governor address.Address
|
||||
case actorstypes.Version10:
|
||||
return make10(store, governor, bitwidth)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return make11(store, governor, bitwidth)
|
||||
|
||||
default:
|
||||
return nil, xerrors.Errorf("datacap actor only valid for actors v9 and above, got %d", av)
|
||||
}
|
||||
@ -72,5 +78,6 @@ func AllCodes() []cid.Cid {
|
||||
return []cid.Cid{
|
||||
(&state9{}).Code(),
|
||||
(&state10{}).Code(),
|
||||
(&state11{}).Code(),
|
||||
}
|
||||
}
|
||||
|
82
chain/actors/builtin/datacap/v11.go
generated
Normal file
82
chain/actors/builtin/datacap/v11.go
generated
Normal file
@ -0,0 +1,82 @@
|
||||
package datacap
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
datacap11 "github.com/filecoin-project/go-state-types/builtin/v11/datacap"
|
||||
adt11 "github.com/filecoin-project/go-state-types/builtin/v11/util/adt"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
var _ State = (*state11)(nil)
|
||||
|
||||
func load11(store adt.Store, root cid.Cid) (State, error) {
|
||||
out := state11{store: store}
|
||||
err := store.Get(store.Context(), root, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make11(store adt.Store, governor address.Address, bitwidth uint64) (State, error) {
|
||||
out := state11{store: store}
|
||||
s, err := datacap11.ConstructState(store, governor, bitwidth)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *s
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state11 struct {
|
||||
datacap11.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *state11) Governor() (address.Address, error) {
|
||||
return s.State.Governor, nil
|
||||
}
|
||||
|
||||
func (s *state11) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state11) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
return forEachClient(s.store, actors.Version11, s.verifiedClients, cb)
|
||||
}
|
||||
|
||||
func (s *state11) verifiedClients() (adt.Map, error) {
|
||||
return adt11.AsMap(s.store, s.Token.Balances, int(s.Token.HamtBitWidth))
|
||||
}
|
||||
|
||||
func (s *state11) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
return getDataCap(s.store, actors.Version11, s.verifiedClients, addr)
|
||||
}
|
||||
|
||||
func (s *state11) ActorKey() string {
|
||||
return manifest.DatacapKey
|
||||
}
|
||||
|
||||
func (s *state11) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version11
|
||||
}
|
||||
|
||||
func (s *state11) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
@ -5,7 +5,7 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin10 "github.com/filecoin-project/go-state-types/builtin"
|
||||
builtin11 "github.com/filecoin-project/go-state-types/builtin"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
|
||||
@ -14,7 +14,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
var Methods = builtin10.MethodsEVM
|
||||
var Methods = builtin11.MethodsEVM
|
||||
|
||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||
@ -27,6 +27,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
case actorstypes.Version10:
|
||||
return load10(store, act.Head)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return load11(store, act.Head)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,6 +42,9 @@ func MakeState(store adt.Store, av actorstypes.Version, bytecode cid.Cid) (State
|
||||
case actorstypes.Version10:
|
||||
return make10(store, bytecode)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return make11(store, bytecode)
|
||||
|
||||
default:
|
||||
return nil, xerrors.Errorf("evm actor only valid for actors v10 and above, got %d", av)
|
||||
}
|
||||
|
72
chain/actors/builtin/evm/v11.go
generated
Normal file
72
chain/actors/builtin/evm/v11.go
generated
Normal file
@ -0,0 +1,72 @@
|
||||
package evm
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
evm11 "github.com/filecoin-project/go-state-types/builtin/v11/evm"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
var _ State = (*state11)(nil)
|
||||
|
||||
func load11(store adt.Store, root cid.Cid) (State, error) {
|
||||
out := state11{store: store}
|
||||
err := store.Get(store.Context(), root, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make11(store adt.Store, bytecode cid.Cid) (State, error) {
|
||||
out := state11{store: store}
|
||||
s, err := evm11.ConstructState(store, bytecode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *s
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state11 struct {
|
||||
evm11.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *state11) Nonce() (uint64, error) {
|
||||
return s.State.Nonce, nil
|
||||
}
|
||||
|
||||
func (s *state11) IsAlive() (bool, error) {
|
||||
return s.State.Tombstone == nil, nil
|
||||
}
|
||||
|
||||
func (s *state11) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state11) GetBytecodeCID() (cid.Cid, error) {
|
||||
return s.State.Bytecode, nil
|
||||
}
|
||||
|
||||
func (s *state11) GetBytecodeHash() ([32]byte, error) {
|
||||
return s.State.BytecodeHash, nil
|
||||
}
|
||||
|
||||
func (s *state11) GetBytecode() ([]byte, error) {
|
||||
bc, err := s.GetBytecodeCID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var byteCode abi.CborBytesTransparent
|
||||
if err := s.store.Get(s.store.Context(), bc, &byteCode); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return byteCode, nil
|
||||
}
|
@ -7,7 +7,7 @@ import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin10 "github.com/filecoin-project/go-state-types/builtin"
|
||||
builtin11 "github.com/filecoin-project/go-state-types/builtin"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
@ -25,8 +25,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
Address = builtin10.InitActorAddr
|
||||
Methods = builtin10.MethodsInit
|
||||
Address = builtin11.InitActorAddr
|
||||
Methods = builtin11.MethodsInit
|
||||
)
|
||||
|
||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
@ -46,6 +46,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
case actorstypes.Version10:
|
||||
return load10(store, act.Head)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return load11(store, act.Head)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,6 +113,9 @@ func MakeState(store adt.Store, av actorstypes.Version, networkName string) (Sta
|
||||
case actorstypes.Version10:
|
||||
return make10(store, networkName)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return make11(store, networkName)
|
||||
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
@ -160,5 +166,6 @@ func AllCodes() []cid.Cid {
|
||||
(&state8{}).Code(),
|
||||
(&state9{}).Code(),
|
||||
(&state10{}).Code(),
|
||||
(&state11{}).Code(),
|
||||
}
|
||||
}
|
||||
|
147
chain/actors/builtin/init/v11.go
generated
Normal file
147
chain/actors/builtin/init/v11.go
generated
Normal file
@ -0,0 +1,147 @@
|
||||
package init
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin11 "github.com/filecoin-project/go-state-types/builtin"
|
||||
init11 "github.com/filecoin-project/go-state-types/builtin/v11/init"
|
||||
adt11 "github.com/filecoin-project/go-state-types/builtin/v11/util/adt"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
)
|
||||
|
||||
var _ State = (*state11)(nil)
|
||||
|
||||
func load11(store adt.Store, root cid.Cid) (State, error) {
|
||||
out := state11{store: store}
|
||||
err := store.Get(store.Context(), root, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make11(store adt.Store, networkName string) (State, error) {
|
||||
out := state11{store: store}
|
||||
|
||||
s, err := init11.ConstructState(store, networkName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *s
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state11 struct {
|
||||
init11.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *state11) ResolveAddress(address address.Address) (address.Address, bool, error) {
|
||||
return s.State.ResolveAddress(s.store, address)
|
||||
}
|
||||
|
||||
func (s *state11) MapAddressToNewID(address address.Address) (address.Address, error) {
|
||||
return s.State.MapAddressToNewID(s.store, address)
|
||||
}
|
||||
|
||||
func (s *state11) ForEachActor(cb func(id abi.ActorID, address address.Address) error) error {
|
||||
addrs, err := adt11.AsMap(s.store, s.State.AddressMap, builtin11.DefaultHamtBitwidth)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var actorID cbg.CborInt
|
||||
return addrs.ForEach(&actorID, func(key string) error {
|
||||
addr, err := address.NewFromBytes([]byte(key))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cb(abi.ActorID(actorID), addr)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *state11) NetworkName() (dtypes.NetworkName, error) {
|
||||
return dtypes.NetworkName(s.State.NetworkName), nil
|
||||
}
|
||||
|
||||
func (s *state11) SetNetworkName(name string) error {
|
||||
s.State.NetworkName = name
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state11) SetNextID(id abi.ActorID) error {
|
||||
s.State.NextID = id
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state11) Remove(addrs ...address.Address) (err error) {
|
||||
m, err := adt11.AsMap(s.store, s.State.AddressMap, builtin11.DefaultHamtBitwidth)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, addr := range addrs {
|
||||
if err = m.Delete(abi.AddrKey(addr)); err != nil {
|
||||
return xerrors.Errorf("failed to delete entry for address: %s; err: %w", addr, err)
|
||||
}
|
||||
}
|
||||
amr, err := m.Root()
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to get address map root: %w", err)
|
||||
}
|
||||
s.State.AddressMap = amr
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state11) SetAddressMap(mcid cid.Cid) error {
|
||||
s.State.AddressMap = mcid
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state11) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state11) AddressMap() (adt.Map, error) {
|
||||
return adt11.AsMap(s.store, s.State.AddressMap, builtin11.DefaultHamtBitwidth)
|
||||
}
|
||||
|
||||
func (s *state11) AddressMapBitWidth() int {
|
||||
return builtin11.DefaultHamtBitwidth
|
||||
}
|
||||
|
||||
func (s *state11) AddressMapHashFunction() func(input []byte) []byte {
|
||||
return func(input []byte) []byte {
|
||||
res := sha256.Sum256(input)
|
||||
return res[:]
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state11) ActorKey() string {
|
||||
return manifest.InitKey
|
||||
}
|
||||
|
||||
func (s *state11) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version11
|
||||
}
|
||||
|
||||
func (s *state11) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
@ -52,6 +52,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
case actorstypes.Version10:
|
||||
return load10(store, act.Head)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return load11(store, act.Head)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,6 +119,9 @@ func MakeState(store adt.Store, av actorstypes.Version) (State, error) {
|
||||
case actorstypes.Version10:
|
||||
return make10(store)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return make11(store)
|
||||
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
@ -208,6 +214,9 @@ func DecodePublishStorageDealsReturn(b []byte, nv network.Version) (PublishStora
|
||||
case actorstypes.Version10:
|
||||
return decodePublishStorageDealsReturn10(b)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return decodePublishStorageDealsReturn11(b)
|
||||
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
@ -293,5 +302,6 @@ func AllCodes() []cid.Cid {
|
||||
(&state8{}).Code(),
|
||||
(&state9{}).Code(),
|
||||
(&state10{}).Code(),
|
||||
(&state11{}).Code(),
|
||||
}
|
||||
}
|
||||
|
377
chain/actors/builtin/market/v11.go
generated
Normal file
377
chain/actors/builtin/market/v11.go
generated
Normal file
@ -0,0 +1,377 @@
|
||||
package market
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/builtin"
|
||||
market11 "github.com/filecoin-project/go-state-types/builtin/v11/market"
|
||||
adt11 "github.com/filecoin-project/go-state-types/builtin/v11/util/adt"
|
||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
var _ State = (*state11)(nil)
|
||||
|
||||
func load11(store adt.Store, root cid.Cid) (State, error) {
|
||||
out := state11{store: store}
|
||||
err := store.Get(store.Context(), root, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make11(store adt.Store) (State, error) {
|
||||
out := state11{store: store}
|
||||
|
||||
s, err := market11.ConstructState(store)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *s
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state11 struct {
|
||||
market11.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *state11) TotalLocked() (abi.TokenAmount, error) {
|
||||
fml := types.BigAdd(s.TotalClientLockedCollateral, s.TotalProviderLockedCollateral)
|
||||
fml = types.BigAdd(fml, s.TotalClientStorageFee)
|
||||
return fml, nil
|
||||
}
|
||||
|
||||
func (s *state11) BalancesChanged(otherState State) (bool, error) {
|
||||
otherState11, ok := otherState.(*state11)
|
||||
if !ok {
|
||||
// there's no way to compare different versions of the state, so let's
|
||||
// just say that means the state of balances has changed
|
||||
return true, nil
|
||||
}
|
||||
return !s.State.EscrowTable.Equals(otherState11.State.EscrowTable) || !s.State.LockedTable.Equals(otherState11.State.LockedTable), nil
|
||||
}
|
||||
|
||||
func (s *state11) StatesChanged(otherState State) (bool, error) {
|
||||
otherState11, ok := otherState.(*state11)
|
||||
if !ok {
|
||||
// there's no way to compare different versions of the state, so let's
|
||||
// just say that means the state of balances has changed
|
||||
return true, nil
|
||||
}
|
||||
return !s.State.States.Equals(otherState11.State.States), nil
|
||||
}
|
||||
|
||||
func (s *state11) States() (DealStates, error) {
|
||||
stateArray, err := adt11.AsArray(s.store, s.State.States, market11.StatesAmtBitwidth)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &dealStates11{stateArray}, nil
|
||||
}
|
||||
|
||||
func (s *state11) ProposalsChanged(otherState State) (bool, error) {
|
||||
otherState11, ok := otherState.(*state11)
|
||||
if !ok {
|
||||
// there's no way to compare different versions of the state, so let's
|
||||
// just say that means the state of balances has changed
|
||||
return true, nil
|
||||
}
|
||||
return !s.State.Proposals.Equals(otherState11.State.Proposals), nil
|
||||
}
|
||||
|
||||
func (s *state11) Proposals() (DealProposals, error) {
|
||||
proposalArray, err := adt11.AsArray(s.store, s.State.Proposals, market11.ProposalsAmtBitwidth)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &dealProposals11{proposalArray}, nil
|
||||
}
|
||||
|
||||
func (s *state11) EscrowTable() (BalanceTable, error) {
|
||||
bt, err := adt11.AsBalanceTable(s.store, s.State.EscrowTable)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &balanceTable11{bt}, nil
|
||||
}
|
||||
|
||||
func (s *state11) LockedTable() (BalanceTable, error) {
|
||||
bt, err := adt11.AsBalanceTable(s.store, s.State.LockedTable)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &balanceTable11{bt}, nil
|
||||
}
|
||||
|
||||
func (s *state11) VerifyDealsForActivation(
|
||||
minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch,
|
||||
) (weight, verifiedWeight abi.DealWeight, err error) {
|
||||
w, vw, _, err := market11.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch)
|
||||
return w, vw, err
|
||||
}
|
||||
|
||||
func (s *state11) NextID() (abi.DealID, error) {
|
||||
return s.State.NextID, nil
|
||||
}
|
||||
|
||||
type balanceTable11 struct {
|
||||
*adt11.BalanceTable
|
||||
}
|
||||
|
||||
func (bt *balanceTable11) ForEach(cb func(address.Address, abi.TokenAmount) error) error {
|
||||
asMap := (*adt11.Map)(bt.BalanceTable)
|
||||
var ta abi.TokenAmount
|
||||
return asMap.ForEach(&ta, func(key string) error {
|
||||
a, err := address.NewFromBytes([]byte(key))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cb(a, ta)
|
||||
})
|
||||
}
|
||||
|
||||
type dealStates11 struct {
|
||||
adt.Array
|
||||
}
|
||||
|
||||
func (s *dealStates11) Get(dealID abi.DealID) (*DealState, bool, error) {
|
||||
var deal11 market11.DealState
|
||||
found, err := s.Array.Get(uint64(dealID), &deal11)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
if !found {
|
||||
return nil, false, nil
|
||||
}
|
||||
deal := fromV11DealState(deal11)
|
||||
return &deal, true, nil
|
||||
}
|
||||
|
||||
func (s *dealStates11) ForEach(cb func(dealID abi.DealID, ds DealState) error) error {
|
||||
var ds11 market11.DealState
|
||||
return s.Array.ForEach(&ds11, func(idx int64) error {
|
||||
return cb(abi.DealID(idx), fromV11DealState(ds11))
|
||||
})
|
||||
}
|
||||
|
||||
func (s *dealStates11) decode(val *cbg.Deferred) (*DealState, error) {
|
||||
var ds11 market11.DealState
|
||||
if err := ds11.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ds := fromV11DealState(ds11)
|
||||
return &ds, nil
|
||||
}
|
||||
|
||||
func (s *dealStates11) array() adt.Array {
|
||||
return s.Array
|
||||
}
|
||||
|
||||
func fromV11DealState(v11 market11.DealState) DealState {
|
||||
ret := DealState{
|
||||
SectorStartEpoch: v11.SectorStartEpoch,
|
||||
LastUpdatedEpoch: v11.LastUpdatedEpoch,
|
||||
SlashEpoch: v11.SlashEpoch,
|
||||
VerifiedClaim: 0,
|
||||
}
|
||||
|
||||
ret.VerifiedClaim = verifregtypes.AllocationId(v11.VerifiedClaim)
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
type dealProposals11 struct {
|
||||
adt.Array
|
||||
}
|
||||
|
||||
func (s *dealProposals11) Get(dealID abi.DealID) (*DealProposal, bool, error) {
|
||||
var proposal11 market11.DealProposal
|
||||
found, err := s.Array.Get(uint64(dealID), &proposal11)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
if !found {
|
||||
return nil, false, nil
|
||||
}
|
||||
|
||||
proposal, err := fromV11DealProposal(proposal11)
|
||||
if err != nil {
|
||||
return nil, true, xerrors.Errorf("decoding proposal: %w", err)
|
||||
}
|
||||
|
||||
return &proposal, true, nil
|
||||
}
|
||||
|
||||
func (s *dealProposals11) ForEach(cb func(dealID abi.DealID, dp DealProposal) error) error {
|
||||
var dp11 market11.DealProposal
|
||||
return s.Array.ForEach(&dp11, func(idx int64) error {
|
||||
dp, err := fromV11DealProposal(dp11)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("decoding proposal: %w", err)
|
||||
}
|
||||
|
||||
return cb(abi.DealID(idx), dp)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *dealProposals11) decode(val *cbg.Deferred) (*DealProposal, error) {
|
||||
var dp11 market11.DealProposal
|
||||
if err := dp11.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
dp, err := fromV11DealProposal(dp11)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &dp, nil
|
||||
}
|
||||
|
||||
func (s *dealProposals11) array() adt.Array {
|
||||
return s.Array
|
||||
}
|
||||
|
||||
func fromV11DealProposal(v11 market11.DealProposal) (DealProposal, error) {
|
||||
|
||||
label, err := fromV11Label(v11.Label)
|
||||
|
||||
if err != nil {
|
||||
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
|
||||
}
|
||||
|
||||
return DealProposal{
|
||||
PieceCID: v11.PieceCID,
|
||||
PieceSize: v11.PieceSize,
|
||||
VerifiedDeal: v11.VerifiedDeal,
|
||||
Client: v11.Client,
|
||||
Provider: v11.Provider,
|
||||
|
||||
Label: label,
|
||||
|
||||
StartEpoch: v11.StartEpoch,
|
||||
EndEpoch: v11.EndEpoch,
|
||||
StoragePricePerEpoch: v11.StoragePricePerEpoch,
|
||||
|
||||
ProviderCollateral: v11.ProviderCollateral,
|
||||
ClientCollateral: v11.ClientCollateral,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func fromV11Label(v11 market11.DealLabel) (DealLabel, error) {
|
||||
if v11.IsString() {
|
||||
str, err := v11.ToString()
|
||||
if err != nil {
|
||||
return markettypes.EmptyDealLabel, xerrors.Errorf("failed to convert string label to string: %w", err)
|
||||
}
|
||||
return markettypes.NewLabelFromString(str)
|
||||
}
|
||||
|
||||
bs, err := v11.ToBytes()
|
||||
if err != nil {
|
||||
return markettypes.EmptyDealLabel, xerrors.Errorf("failed to convert bytes label to bytes: %w", err)
|
||||
}
|
||||
return markettypes.NewLabelFromBytes(bs)
|
||||
}
|
||||
|
||||
func (s *state11) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
var _ PublishStorageDealsReturn = (*publishStorageDealsReturn11)(nil)
|
||||
|
||||
func decodePublishStorageDealsReturn11(b []byte) (PublishStorageDealsReturn, error) {
|
||||
var retval market11.PublishStorageDealsReturn
|
||||
if err := retval.UnmarshalCBOR(bytes.NewReader(b)); err != nil {
|
||||
return nil, xerrors.Errorf("failed to unmarshal PublishStorageDealsReturn: %w", err)
|
||||
}
|
||||
|
||||
return &publishStorageDealsReturn11{retval}, nil
|
||||
}
|
||||
|
||||
type publishStorageDealsReturn11 struct {
|
||||
market11.PublishStorageDealsReturn
|
||||
}
|
||||
|
||||
func (r *publishStorageDealsReturn11) IsDealValid(index uint64) (bool, int, error) {
|
||||
|
||||
set, err := r.ValidDeals.IsSet(index)
|
||||
if err != nil || !set {
|
||||
return false, -1, err
|
||||
}
|
||||
maskBf, err := bitfield.NewFromIter(&rlepluslazy.RunSliceIterator{
|
||||
Runs: []rlepluslazy.Run{rlepluslazy.Run{Val: true, Len: index}}})
|
||||
if err != nil {
|
||||
return false, -1, err
|
||||
}
|
||||
before, err := bitfield.IntersectBitField(maskBf, r.ValidDeals)
|
||||
if err != nil {
|
||||
return false, -1, err
|
||||
}
|
||||
outIdx, err := before.Count()
|
||||
if err != nil {
|
||||
return false, -1, err
|
||||
}
|
||||
return set, int(outIdx), nil
|
||||
|
||||
}
|
||||
|
||||
func (r *publishStorageDealsReturn11) DealIDs() ([]abi.DealID, error) {
|
||||
return r.IDs, nil
|
||||
}
|
||||
|
||||
func (s *state11) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes.AllocationId, error) {
|
||||
|
||||
allocations, err := adt11.AsMap(s.store, s.PendingDealAllocationIds, builtin.DefaultHamtBitwidth)
|
||||
if err != nil {
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("failed to load allocation id for %d: %w", dealId, err)
|
||||
}
|
||||
|
||||
var allocationId cbg.CborInt
|
||||
found, err := allocations.Get(abi.UIntKey(uint64(dealId)), &allocationId)
|
||||
if err != nil {
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("failed to load allocation id for %d: %w", dealId, err)
|
||||
}
|
||||
if !found {
|
||||
return verifregtypes.NoAllocationID, nil
|
||||
}
|
||||
|
||||
return verifregtypes.AllocationId(allocationId), nil
|
||||
|
||||
}
|
||||
|
||||
func (s *state11) ActorKey() string {
|
||||
return manifest.MarketKey
|
||||
}
|
||||
|
||||
func (s *state11) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version11
|
||||
}
|
||||
|
||||
func (s *state11) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
@ -175,15 +175,15 @@ func PreferredSealProofTypeFromWindowPoStType(nver network.Version, proof abi.Re
|
||||
}
|
||||
|
||||
switch proof {
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1:
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1, abi.RegisteredPoStProof_StackedDrgWindow2KiBV1_1:
|
||||
return abi.RegisteredSealProof_StackedDrg2KiBV1_1, nil
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow8MiBV1:
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow8MiBV1, abi.RegisteredPoStProof_StackedDrgWindow8MiBV1_1:
|
||||
return abi.RegisteredSealProof_StackedDrg8MiBV1_1, nil
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow512MiBV1:
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow512MiBV1, abi.RegisteredPoStProof_StackedDrgWindow512MiBV1_1:
|
||||
return abi.RegisteredSealProof_StackedDrg512MiBV1_1, nil
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow32GiBV1:
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow32GiBV1, abi.RegisteredPoStProof_StackedDrgWindow32GiBV1_1:
|
||||
return abi.RegisteredSealProof_StackedDrg32GiBV1_1, nil
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow64GiBV1:
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow64GiBV1, abi.RegisteredPoStProof_StackedDrgWindow64GiBV1_1:
|
||||
return abi.RegisteredSealProof_StackedDrg64GiBV1_1, nil
|
||||
default:
|
||||
return -1, xerrors.Errorf("unrecognized window post type: %d", proof)
|
||||
@ -192,15 +192,15 @@ func PreferredSealProofTypeFromWindowPoStType(nver network.Version, proof abi.Re
|
||||
|
||||
func WinningPoStProofTypeFromWindowPoStProofType(nver network.Version, proof abi.RegisteredPoStProof) (abi.RegisteredPoStProof, error) {
|
||||
switch proof {
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1:
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1, abi.RegisteredPoStProof_StackedDrgWindow2KiBV1_1:
|
||||
return abi.RegisteredPoStProof_StackedDrgWinning2KiBV1, nil
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow8MiBV1:
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow8MiBV1, abi.RegisteredPoStProof_StackedDrgWindow8MiBV1_1:
|
||||
return abi.RegisteredPoStProof_StackedDrgWinning8MiBV1, nil
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow512MiBV1:
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow512MiBV1, abi.RegisteredPoStProof_StackedDrgWindow512MiBV1_1:
|
||||
return abi.RegisteredPoStProof_StackedDrgWinning512MiBV1, nil
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow32GiBV1:
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow32GiBV1, abi.RegisteredPoStProof_StackedDrgWindow32GiBV1_1:
|
||||
return abi.RegisteredPoStProof_StackedDrgWinning32GiBV1, nil
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow64GiBV1:
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow64GiBV1, abi.RegisteredPoStProof_StackedDrgWindow64GiBV1_1:
|
||||
return abi.RegisteredPoStProof_StackedDrgWinning64GiBV1, nil
|
||||
default:
|
||||
return -1, xerrors.Errorf("unknown proof type %d", proof)
|
||||
|
@ -45,6 +45,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
case actorstypes.Version10:
|
||||
return load10(store, act.Head)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return load11(store, act.Head)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,6 +112,9 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
|
||||
case actors.Version10:
|
||||
return make10(store)
|
||||
|
||||
case actors.Version11:
|
||||
return make11(store)
|
||||
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
@ -223,15 +229,15 @@ func PreferredSealProofTypeFromWindowPoStType(nver network.Version, proof abi.Re
|
||||
}
|
||||
|
||||
switch proof {
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1:
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1, abi.RegisteredPoStProof_StackedDrgWindow2KiBV1_1:
|
||||
return abi.RegisteredSealProof_StackedDrg2KiBV1_1, nil
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow8MiBV1:
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow8MiBV1, abi.RegisteredPoStProof_StackedDrgWindow8MiBV1_1:
|
||||
return abi.RegisteredSealProof_StackedDrg8MiBV1_1, nil
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow512MiBV1:
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow512MiBV1, abi.RegisteredPoStProof_StackedDrgWindow512MiBV1_1:
|
||||
return abi.RegisteredSealProof_StackedDrg512MiBV1_1, nil
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow32GiBV1:
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow32GiBV1, abi.RegisteredPoStProof_StackedDrgWindow32GiBV1_1:
|
||||
return abi.RegisteredSealProof_StackedDrg32GiBV1_1, nil
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow64GiBV1:
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow64GiBV1, abi.RegisteredPoStProof_StackedDrgWindow64GiBV1_1:
|
||||
return abi.RegisteredSealProof_StackedDrg64GiBV1_1, nil
|
||||
default:
|
||||
return -1, xerrors.Errorf("unrecognized window post type: %d", proof)
|
||||
@ -240,15 +246,15 @@ func PreferredSealProofTypeFromWindowPoStType(nver network.Version, proof abi.Re
|
||||
|
||||
func WinningPoStProofTypeFromWindowPoStProofType(nver network.Version, proof abi.RegisteredPoStProof) (abi.RegisteredPoStProof, error) {
|
||||
switch proof {
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1:
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow2KiBV1, abi.RegisteredPoStProof_StackedDrgWindow2KiBV1_1:
|
||||
return abi.RegisteredPoStProof_StackedDrgWinning2KiBV1, nil
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow8MiBV1:
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow8MiBV1, abi.RegisteredPoStProof_StackedDrgWindow8MiBV1_1:
|
||||
return abi.RegisteredPoStProof_StackedDrgWinning8MiBV1, nil
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow512MiBV1:
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow512MiBV1, abi.RegisteredPoStProof_StackedDrgWindow512MiBV1_1:
|
||||
return abi.RegisteredPoStProof_StackedDrgWinning512MiBV1, nil
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow32GiBV1:
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow32GiBV1, abi.RegisteredPoStProof_StackedDrgWindow32GiBV1_1:
|
||||
return abi.RegisteredPoStProof_StackedDrgWinning32GiBV1, nil
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow64GiBV1:
|
||||
case abi.RegisteredPoStProof_StackedDrgWindow64GiBV1, abi.RegisteredPoStProof_StackedDrgWindow64GiBV1_1:
|
||||
return abi.RegisteredPoStProof_StackedDrgWinning64GiBV1, nil
|
||||
default:
|
||||
return -1, xerrors.Errorf("unknown proof type %d", proof)
|
||||
@ -314,5 +320,6 @@ func AllCodes() []cid.Cid {
|
||||
(&state8{}).Code(),
|
||||
(&state9{}).Code(),
|
||||
(&state10{}).Code(),
|
||||
(&state11{}).Code(),
|
||||
}
|
||||
}
|
||||
|
@ -70,19 +70,38 @@ func SealProofTypeFromSectorSize(ssize abi.SectorSize, nv network.Version) (abi.
|
||||
|
||||
// WindowPoStProofTypeFromSectorSize returns preferred post proof type for creating
|
||||
// new miner actors and new sectors
|
||||
func WindowPoStProofTypeFromSectorSize(ssize abi.SectorSize) (abi.RegisteredPoStProof, error) {
|
||||
switch ssize {
|
||||
case 2 << 10:
|
||||
return abi.RegisteredPoStProof_StackedDrgWindow2KiBV1, nil
|
||||
case 8 << 20:
|
||||
return abi.RegisteredPoStProof_StackedDrgWindow8MiBV1, nil
|
||||
case 512 << 20:
|
||||
return abi.RegisteredPoStProof_StackedDrgWindow512MiBV1, nil
|
||||
case 32 << 30:
|
||||
return abi.RegisteredPoStProof_StackedDrgWindow32GiBV1, nil
|
||||
case 64 << 30:
|
||||
return abi.RegisteredPoStProof_StackedDrgWindow64GiBV1, nil
|
||||
default:
|
||||
return 0, xerrors.Errorf("unsupported sector size for miner: %v", ssize)
|
||||
func WindowPoStProofTypeFromSectorSize(ssize abi.SectorSize, nv network.Version) (abi.RegisteredPoStProof, error) {
|
||||
switch {
|
||||
case nv < network.Version19:
|
||||
switch ssize {
|
||||
case 2 << 10:
|
||||
return abi.RegisteredPoStProof_StackedDrgWindow2KiBV1, nil
|
||||
case 8 << 20:
|
||||
return abi.RegisteredPoStProof_StackedDrgWindow8MiBV1, nil
|
||||
case 512 << 20:
|
||||
return abi.RegisteredPoStProof_StackedDrgWindow512MiBV1, nil
|
||||
case 32 << 30:
|
||||
return abi.RegisteredPoStProof_StackedDrgWindow32GiBV1, nil
|
||||
case 64 << 30:
|
||||
return abi.RegisteredPoStProof_StackedDrgWindow64GiBV1, nil
|
||||
default:
|
||||
return 0, xerrors.Errorf("unsupported sector size for miner: %v", ssize)
|
||||
}
|
||||
case nv >= network.Version19:
|
||||
switch ssize {
|
||||
case 2 << 10:
|
||||
return abi.RegisteredPoStProof_StackedDrgWindow2KiBV1_1, nil
|
||||
case 8 << 20:
|
||||
return abi.RegisteredPoStProof_StackedDrgWindow8MiBV1_1, nil
|
||||
case 512 << 20:
|
||||
return abi.RegisteredPoStProof_StackedDrgWindow512MiBV1_1, nil
|
||||
case 32 << 30:
|
||||
return abi.RegisteredPoStProof_StackedDrgWindow32GiBV1_1, nil
|
||||
case 64 << 30:
|
||||
return abi.RegisteredPoStProof_StackedDrgWindow64GiBV1_1, nil
|
||||
default:
|
||||
return 0, xerrors.Errorf("unsupported sector size for miner: %v", ssize)
|
||||
}
|
||||
}
|
||||
return 0, xerrors.Errorf("unsupported network version")
|
||||
}
|
||||
|
591
chain/actors/builtin/miner/v11.go
generated
Normal file
591
chain/actors/builtin/miner/v11.go
generated
Normal file
@ -0,0 +1,591 @@
|
||||
package miner
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
rle "github.com/filecoin-project/go-bitfield/rle"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin11 "github.com/filecoin-project/go-state-types/builtin"
|
||||
miner11 "github.com/filecoin-project/go-state-types/builtin/v11/miner"
|
||||
adt11 "github.com/filecoin-project/go-state-types/builtin/v11/util/adt"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
var _ State = (*state11)(nil)
|
||||
|
||||
func load11(store adt.Store, root cid.Cid) (State, error) {
|
||||
out := state11{store: store}
|
||||
err := store.Get(store.Context(), root, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make11(store adt.Store) (State, error) {
|
||||
out := state11{store: store}
|
||||
out.State = miner11.State{}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state11 struct {
|
||||
miner11.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
type deadline11 struct {
|
||||
miner11.Deadline
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
type partition11 struct {
|
||||
miner11.Partition
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *state11) AvailableBalance(bal abi.TokenAmount) (available abi.TokenAmount, err error) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
err = xerrors.Errorf("failed to get available balance: %w", r)
|
||||
available = abi.NewTokenAmount(0)
|
||||
}
|
||||
}()
|
||||
// this panics if the miner doesnt have enough funds to cover their locked pledge
|
||||
available, err = s.GetAvailableBalance(bal)
|
||||
return available, err
|
||||
}
|
||||
|
||||
func (s *state11) VestedFunds(epoch abi.ChainEpoch) (abi.TokenAmount, error) {
|
||||
return s.CheckVestedFunds(s.store, epoch)
|
||||
}
|
||||
|
||||
func (s *state11) LockedFunds() (LockedFunds, error) {
|
||||
return LockedFunds{
|
||||
VestingFunds: s.State.LockedFunds,
|
||||
InitialPledgeRequirement: s.State.InitialPledge,
|
||||
PreCommitDeposits: s.State.PreCommitDeposits,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *state11) FeeDebt() (abi.TokenAmount, error) {
|
||||
return s.State.FeeDebt, nil
|
||||
}
|
||||
|
||||
func (s *state11) InitialPledge() (abi.TokenAmount, error) {
|
||||
return s.State.InitialPledge, nil
|
||||
}
|
||||
|
||||
func (s *state11) PreCommitDeposits() (abi.TokenAmount, error) {
|
||||
return s.State.PreCommitDeposits, nil
|
||||
}
|
||||
|
||||
// Returns nil, nil if sector is not found
|
||||
func (s *state11) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) {
|
||||
info, ok, err := s.State.GetSector(s.store, num)
|
||||
if !ok || err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ret := fromV11SectorOnChainInfo(*info)
|
||||
return &ret, nil
|
||||
}
|
||||
|
||||
func (s *state11) FindSector(num abi.SectorNumber) (*SectorLocation, error) {
|
||||
dlIdx, partIdx, err := s.State.FindSector(s.store, num)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SectorLocation{
|
||||
Deadline: dlIdx,
|
||||
Partition: partIdx,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *state11) NumLiveSectors() (uint64, error) {
|
||||
dls, err := s.State.LoadDeadlines(s.store)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
var total uint64
|
||||
if err := dls.ForEach(s.store, func(dlIdx uint64, dl *miner11.Deadline) error {
|
||||
total += dl.LiveSectors
|
||||
return nil
|
||||
}); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return total, nil
|
||||
}
|
||||
|
||||
// GetSectorExpiration returns the effective expiration of the given sector.
|
||||
//
|
||||
// If the sector does not expire early, the Early expiration field is 0.
|
||||
func (s *state11) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, error) {
|
||||
dls, err := s.State.LoadDeadlines(s.store)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// NOTE: this can be optimized significantly.
|
||||
// 1. If the sector is non-faulty, it will expire on-time (can be
|
||||
// learned from the sector info).
|
||||
// 2. If it's faulty, it will expire early within the first 42 entries
|
||||
// of the expiration queue.
|
||||
|
||||
stopErr := errors.New("stop")
|
||||
out := SectorExpiration{}
|
||||
err = dls.ForEach(s.store, func(dlIdx uint64, dl *miner11.Deadline) error {
|
||||
partitions, err := dl.PartitionsArray(s.store)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
quant := s.State.QuantSpecForDeadline(dlIdx)
|
||||
var part miner11.Partition
|
||||
return partitions.ForEach(&part, func(partIdx int64) error {
|
||||
if found, err := part.Sectors.IsSet(uint64(num)); err != nil {
|
||||
return err
|
||||
} else if !found {
|
||||
return nil
|
||||
}
|
||||
if found, err := part.Terminated.IsSet(uint64(num)); err != nil {
|
||||
return err
|
||||
} else if found {
|
||||
// already terminated
|
||||
return stopErr
|
||||
}
|
||||
|
||||
q, err := miner11.LoadExpirationQueue(s.store, part.ExpirationsEpochs, quant, miner11.PartitionExpirationAmtBitwidth)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var exp miner11.ExpirationSet
|
||||
return q.ForEach(&exp, func(epoch int64) error {
|
||||
if early, err := exp.EarlySectors.IsSet(uint64(num)); err != nil {
|
||||
return err
|
||||
} else if early {
|
||||
out.Early = abi.ChainEpoch(epoch)
|
||||
return nil
|
||||
}
|
||||
if onTime, err := exp.OnTimeSectors.IsSet(uint64(num)); err != nil {
|
||||
return err
|
||||
} else if onTime {
|
||||
out.OnTime = abi.ChainEpoch(epoch)
|
||||
return stopErr
|
||||
}
|
||||
return nil
|
||||
})
|
||||
})
|
||||
})
|
||||
if err == stopErr {
|
||||
err = nil
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if out.Early == 0 && out.OnTime == 0 {
|
||||
return nil, xerrors.Errorf("failed to find sector %d", num)
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (s *state11) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
|
||||
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
|
||||
if !ok || err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ret := fromV11SectorPreCommitOnChainInfo(*info)
|
||||
|
||||
return &ret, nil
|
||||
}
|
||||
|
||||
func (s *state11) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
||||
precommitted, err := adt11.AsMap(s.store, s.State.PreCommittedSectors, builtin11.DefaultHamtBitwidth)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var info miner11.SectorPreCommitOnChainInfo
|
||||
if err := precommitted.ForEach(&info, func(_ string) error {
|
||||
return cb(fromV11SectorPreCommitOnChainInfo(info))
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state11) LoadSectors(snos *bitfield.BitField) ([]*SectorOnChainInfo, error) {
|
||||
sectors, err := miner11.LoadSectors(s.store, s.State.Sectors)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// If no sector numbers are specified, load all.
|
||||
if snos == nil {
|
||||
infos := make([]*SectorOnChainInfo, 0, sectors.Length())
|
||||
var info11 miner11.SectorOnChainInfo
|
||||
if err := sectors.ForEach(&info11, func(_ int64) error {
|
||||
info := fromV11SectorOnChainInfo(info11)
|
||||
infos = append(infos, &info)
|
||||
return nil
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return infos, nil
|
||||
}
|
||||
|
||||
// Otherwise, load selected.
|
||||
infos11, err := sectors.Load(*snos)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
infos := make([]*SectorOnChainInfo, len(infos11))
|
||||
for i, info11 := range infos11 {
|
||||
info := fromV11SectorOnChainInfo(*info11)
|
||||
infos[i] = &info
|
||||
}
|
||||
return infos, nil
|
||||
}
|
||||
|
||||
func (s *state11) loadAllocatedSectorNumbers() (bitfield.BitField, error) {
|
||||
var allocatedSectors bitfield.BitField
|
||||
err := s.store.Get(s.store.Context(), s.State.AllocatedSectors, &allocatedSectors)
|
||||
return allocatedSectors, err
|
||||
}
|
||||
|
||||
func (s *state11) IsAllocated(num abi.SectorNumber) (bool, error) {
|
||||
allocatedSectors, err := s.loadAllocatedSectorNumbers()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return allocatedSectors.IsSet(uint64(num))
|
||||
}
|
||||
|
||||
func (s *state11) GetProvingPeriodStart() (abi.ChainEpoch, error) {
|
||||
return s.State.ProvingPeriodStart, nil
|
||||
}
|
||||
|
||||
func (s *state11) UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error) {
|
||||
allocatedSectors, err := s.loadAllocatedSectorNumbers()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
allocatedRuns, err := allocatedSectors.RunIterator()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
unallocatedRuns, err := rle.Subtract(
|
||||
&rle.RunSliceIterator{Runs: []rle.Run{{Val: true, Len: abi.MaxSectorNumber}}},
|
||||
allocatedRuns,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
iter, err := rle.BitsFromRuns(unallocatedRuns)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
sectors := make([]abi.SectorNumber, 0, count)
|
||||
for iter.HasNext() && len(sectors) < count {
|
||||
nextNo, err := iter.Next()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sectors = append(sectors, abi.SectorNumber(nextNo))
|
||||
}
|
||||
|
||||
return sectors, nil
|
||||
}
|
||||
|
||||
func (s *state11) GetAllocatedSectors() (*bitfield.BitField, error) {
|
||||
var allocatedSectors bitfield.BitField
|
||||
if err := s.store.Get(s.store.Context(), s.State.AllocatedSectors, &allocatedSectors); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &allocatedSectors, nil
|
||||
}
|
||||
|
||||
func (s *state11) LoadDeadline(idx uint64) (Deadline, error) {
|
||||
dls, err := s.State.LoadDeadlines(s.store)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dl, err := dls.LoadDeadline(s.store, idx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &deadline11{*dl, s.store}, nil
|
||||
}
|
||||
|
||||
func (s *state11) ForEachDeadline(cb func(uint64, Deadline) error) error {
|
||||
dls, err := s.State.LoadDeadlines(s.store)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return dls.ForEach(s.store, func(i uint64, dl *miner11.Deadline) error {
|
||||
return cb(i, &deadline11{*dl, s.store})
|
||||
})
|
||||
}
|
||||
|
||||
func (s *state11) NumDeadlines() (uint64, error) {
|
||||
return miner11.WPoStPeriodDeadlines, nil
|
||||
}
|
||||
|
||||
func (s *state11) DeadlinesChanged(other State) (bool, error) {
|
||||
other11, ok := other.(*state11)
|
||||
if !ok {
|
||||
// treat an upgrade as a change, always
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return !s.State.Deadlines.Equals(other11.Deadlines), nil
|
||||
}
|
||||
|
||||
func (s *state11) MinerInfoChanged(other State) (bool, error) {
|
||||
other0, ok := other.(*state11)
|
||||
if !ok {
|
||||
// treat an upgrade as a change, always
|
||||
return true, nil
|
||||
}
|
||||
return !s.State.Info.Equals(other0.State.Info), nil
|
||||
}
|
||||
|
||||
func (s *state11) Info() (MinerInfo, error) {
|
||||
info, err := s.State.GetInfo(s.store)
|
||||
if err != nil {
|
||||
return MinerInfo{}, err
|
||||
}
|
||||
|
||||
mi := MinerInfo{
|
||||
Owner: info.Owner,
|
||||
Worker: info.Worker,
|
||||
ControlAddresses: info.ControlAddresses,
|
||||
|
||||
PendingWorkerKey: (*WorkerKeyChange)(info.PendingWorkerKey),
|
||||
|
||||
PeerId: info.PeerId,
|
||||
Multiaddrs: info.Multiaddrs,
|
||||
WindowPoStProofType: info.WindowPoStProofType,
|
||||
SectorSize: info.SectorSize,
|
||||
WindowPoStPartitionSectors: info.WindowPoStPartitionSectors,
|
||||
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
|
||||
|
||||
Beneficiary: info.Beneficiary,
|
||||
BeneficiaryTerm: BeneficiaryTerm(info.BeneficiaryTerm),
|
||||
PendingBeneficiaryTerm: (*PendingBeneficiaryChange)(info.PendingBeneficiaryTerm),
|
||||
}
|
||||
|
||||
return mi, nil
|
||||
}
|
||||
|
||||
func (s *state11) DeadlineInfo(epoch abi.ChainEpoch) (*dline.Info, error) {
|
||||
return s.State.RecordedDeadlineInfo(epoch), nil
|
||||
}
|
||||
|
||||
func (s *state11) DeadlineCronActive() (bool, error) {
|
||||
return s.State.DeadlineCronActive, nil
|
||||
}
|
||||
|
||||
func (s *state11) sectors() (adt.Array, error) {
|
||||
return adt11.AsArray(s.store, s.Sectors, miner11.SectorsAmtBitwidth)
|
||||
}
|
||||
|
||||
func (s *state11) decodeSectorOnChainInfo(val *cbg.Deferred) (SectorOnChainInfo, error) {
|
||||
var si miner11.SectorOnChainInfo
|
||||
err := si.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
||||
if err != nil {
|
||||
return SectorOnChainInfo{}, err
|
||||
}
|
||||
|
||||
return fromV11SectorOnChainInfo(si), nil
|
||||
}
|
||||
|
||||
func (s *state11) precommits() (adt.Map, error) {
|
||||
return adt11.AsMap(s.store, s.PreCommittedSectors, builtin11.DefaultHamtBitwidth)
|
||||
}
|
||||
|
||||
func (s *state11) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
|
||||
var sp miner11.SectorPreCommitOnChainInfo
|
||||
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
||||
if err != nil {
|
||||
return SectorPreCommitOnChainInfo{}, err
|
||||
}
|
||||
|
||||
return fromV11SectorPreCommitOnChainInfo(sp), nil
|
||||
}
|
||||
|
||||
func (s *state11) EraseAllUnproven() error {
|
||||
|
||||
dls, err := s.State.LoadDeadlines(s.store)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = dls.ForEach(s.store, func(dindx uint64, dl *miner11.Deadline) error {
|
||||
ps, err := dl.PartitionsArray(s.store)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var part miner11.Partition
|
||||
err = ps.ForEach(&part, func(pindx int64) error {
|
||||
_ = part.ActivateUnproven()
|
||||
err = ps.Set(uint64(pindx), &part)
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
dl.Partitions, err = ps.Root()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return dls.UpdateDeadline(s.store, dindx, dl)
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return s.State.SaveDeadlines(s.store, dls)
|
||||
|
||||
}
|
||||
|
||||
func (d *deadline11) LoadPartition(idx uint64) (Partition, error) {
|
||||
p, err := d.Deadline.LoadPartition(d.store, idx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &partition11{*p, d.store}, nil
|
||||
}
|
||||
|
||||
func (d *deadline11) ForEachPartition(cb func(uint64, Partition) error) error {
|
||||
ps, err := d.Deadline.PartitionsArray(d.store)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var part miner11.Partition
|
||||
return ps.ForEach(&part, func(i int64) error {
|
||||
return cb(uint64(i), &partition11{part, d.store})
|
||||
})
|
||||
}
|
||||
|
||||
func (d *deadline11) PartitionsChanged(other Deadline) (bool, error) {
|
||||
other11, ok := other.(*deadline11)
|
||||
if !ok {
|
||||
// treat an upgrade as a change, always
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return !d.Deadline.Partitions.Equals(other11.Deadline.Partitions), nil
|
||||
}
|
||||
|
||||
func (d *deadline11) PartitionsPoSted() (bitfield.BitField, error) {
|
||||
return d.Deadline.PartitionsPoSted, nil
|
||||
}
|
||||
|
||||
func (d *deadline11) DisputableProofCount() (uint64, error) {
|
||||
|
||||
ops, err := d.OptimisticProofsSnapshotArray(d.store)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return ops.Length(), nil
|
||||
|
||||
}
|
||||
|
||||
func (p *partition11) AllSectors() (bitfield.BitField, error) {
|
||||
return p.Partition.Sectors, nil
|
||||
}
|
||||
|
||||
func (p *partition11) FaultySectors() (bitfield.BitField, error) {
|
||||
return p.Partition.Faults, nil
|
||||
}
|
||||
|
||||
func (p *partition11) RecoveringSectors() (bitfield.BitField, error) {
|
||||
return p.Partition.Recoveries, nil
|
||||
}
|
||||
|
||||
func (p *partition11) UnprovenSectors() (bitfield.BitField, error) {
|
||||
return p.Partition.Unproven, nil
|
||||
}
|
||||
|
||||
func fromV11SectorOnChainInfo(v11 miner11.SectorOnChainInfo) SectorOnChainInfo {
|
||||
info := SectorOnChainInfo{
|
||||
SectorNumber: v11.SectorNumber,
|
||||
SealProof: v11.SealProof,
|
||||
SealedCID: v11.SealedCID,
|
||||
DealIDs: v11.DealIDs,
|
||||
Activation: v11.Activation,
|
||||
Expiration: v11.Expiration,
|
||||
DealWeight: v11.DealWeight,
|
||||
VerifiedDealWeight: v11.VerifiedDealWeight,
|
||||
InitialPledge: v11.InitialPledge,
|
||||
ExpectedDayReward: v11.ExpectedDayReward,
|
||||
ExpectedStoragePledge: v11.ExpectedStoragePledge,
|
||||
|
||||
SectorKeyCID: v11.SectorKeyCID,
|
||||
}
|
||||
return info
|
||||
}
|
||||
|
||||
func fromV11SectorPreCommitOnChainInfo(v11 miner11.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
|
||||
ret := SectorPreCommitOnChainInfo{
|
||||
Info: SectorPreCommitInfo{
|
||||
SealProof: v11.Info.SealProof,
|
||||
SectorNumber: v11.Info.SectorNumber,
|
||||
SealedCID: v11.Info.SealedCID,
|
||||
SealRandEpoch: v11.Info.SealRandEpoch,
|
||||
DealIDs: v11.Info.DealIDs,
|
||||
Expiration: v11.Info.Expiration,
|
||||
UnsealedCid: nil,
|
||||
},
|
||||
PreCommitDeposit: v11.PreCommitDeposit,
|
||||
PreCommitEpoch: v11.PreCommitEpoch,
|
||||
}
|
||||
|
||||
ret.Info.UnsealedCid = v11.Info.UnsealedCid
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
func (s *state11) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state11) ActorKey() string {
|
||||
return manifest.MinerKey
|
||||
}
|
||||
|
||||
func (s *state11) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version11
|
||||
}
|
||||
|
||||
func (s *state11) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
4
chain/actors/builtin/multisig/message10.go
generated
4
chain/actors/builtin/multisig/message10.go
generated
@ -7,8 +7,8 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||
init10 "github.com/filecoin-project/go-state-types/builtin/v10/init"
|
||||
multisig10 "github.com/filecoin-project/go-state-types/builtin/v10/multisig"
|
||||
init11 "github.com/filecoin-project/go-state-types/builtin/v11/init"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
@ -57,7 +57,7 @@ func (m message10) Create(
|
||||
}
|
||||
|
||||
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
||||
execParams := &init10.ExecParams{
|
||||
execParams := &init11.ExecParams{
|
||||
CodeCID: code,
|
||||
ConstructorParams: enc,
|
||||
}
|
||||
|
77
chain/actors/builtin/multisig/message11.go
generated
Normal file
77
chain/actors/builtin/multisig/message11.go
generated
Normal file
@ -0,0 +1,77 @@
|
||||
package multisig
|
||||
|
||||
import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||
init11 "github.com/filecoin-project/go-state-types/builtin/v11/init"
|
||||
multisig11 "github.com/filecoin-project/go-state-types/builtin/v11/multisig"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
type message11 struct{ message0 }
|
||||
|
||||
func (m message11) Create(
|
||||
signers []address.Address, threshold uint64,
|
||||
unlockStart, unlockDuration abi.ChainEpoch,
|
||||
initialAmount abi.TokenAmount,
|
||||
) (*types.Message, error) {
|
||||
|
||||
lenAddrs := uint64(len(signers))
|
||||
|
||||
if lenAddrs < threshold {
|
||||
return nil, xerrors.Errorf("cannot require signing of more addresses than provided for multisig")
|
||||
}
|
||||
|
||||
if threshold == 0 {
|
||||
threshold = lenAddrs
|
||||
}
|
||||
|
||||
if m.from == address.Undef {
|
||||
return nil, xerrors.Errorf("must provide source address")
|
||||
}
|
||||
|
||||
// Set up constructor parameters for multisig
|
||||
msigParams := &multisig11.ConstructorParams{
|
||||
Signers: signers,
|
||||
NumApprovalsThreshold: threshold,
|
||||
UnlockDuration: unlockDuration,
|
||||
StartEpoch: unlockStart,
|
||||
}
|
||||
|
||||
enc, actErr := actors.SerializeParams(msigParams)
|
||||
if actErr != nil {
|
||||
return nil, actErr
|
||||
}
|
||||
|
||||
code, ok := actors.GetActorCodeID(actorstypes.Version11, manifest.MultisigKey)
|
||||
if !ok {
|
||||
return nil, xerrors.Errorf("failed to get multisig code ID")
|
||||
}
|
||||
|
||||
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
||||
execParams := &init11.ExecParams{
|
||||
CodeCID: code,
|
||||
ConstructorParams: enc,
|
||||
}
|
||||
|
||||
enc, actErr = actors.SerializeParams(execParams)
|
||||
if actErr != nil {
|
||||
return nil, actErr
|
||||
}
|
||||
|
||||
return &types.Message{
|
||||
To: init_.Address,
|
||||
From: m.from,
|
||||
Method: builtintypes.MethodsInit.Exec,
|
||||
Params: enc,
|
||||
Value: initialAmount,
|
||||
}, nil
|
||||
}
|
4
chain/actors/builtin/multisig/message8.go
generated
4
chain/actors/builtin/multisig/message8.go
generated
@ -7,7 +7,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||
init10 "github.com/filecoin-project/go-state-types/builtin/v10/init"
|
||||
init11 "github.com/filecoin-project/go-state-types/builtin/v11/init"
|
||||
multisig8 "github.com/filecoin-project/go-state-types/builtin/v8/multisig"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
|
||||
@ -57,7 +57,7 @@ func (m message8) Create(
|
||||
}
|
||||
|
||||
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
||||
execParams := &init10.ExecParams{
|
||||
execParams := &init11.ExecParams{
|
||||
CodeCID: code,
|
||||
ConstructorParams: enc,
|
||||
}
|
||||
|
4
chain/actors/builtin/multisig/message9.go
generated
4
chain/actors/builtin/multisig/message9.go
generated
@ -7,7 +7,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||
init10 "github.com/filecoin-project/go-state-types/builtin/v10/init"
|
||||
init11 "github.com/filecoin-project/go-state-types/builtin/v11/init"
|
||||
multisig9 "github.com/filecoin-project/go-state-types/builtin/v9/multisig"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
|
||||
@ -57,7 +57,7 @@ func (m message9) Create(
|
||||
}
|
||||
|
||||
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
||||
execParams := &init10.ExecParams{
|
||||
execParams := &init11.ExecParams{
|
||||
CodeCID: code,
|
||||
ConstructorParams: enc,
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||
msig10 "github.com/filecoin-project/go-state-types/builtin/v10/multisig"
|
||||
msig11 "github.com/filecoin-project/go-state-types/builtin/v11/multisig"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
@ -45,6 +45,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
case actorstypes.Version10:
|
||||
return load10(store, act.Head)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return load11(store, act.Head)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,6 +112,9 @@ func MakeState(store adt.Store, av actorstypes.Version, signers []address.Addres
|
||||
case actorstypes.Version10:
|
||||
return make10(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return make11(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
|
||||
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
@ -135,7 +141,7 @@ type State interface {
|
||||
GetState() interface{}
|
||||
}
|
||||
|
||||
type Transaction = msig10.Transaction
|
||||
type Transaction = msig11.Transaction
|
||||
|
||||
var Methods = builtintypes.MethodsMultisig
|
||||
|
||||
@ -171,6 +177,9 @@ func Message(version actorstypes.Version, from address.Address) MessageBuilder {
|
||||
|
||||
case actorstypes.Version10:
|
||||
return message10{message0{from}}
|
||||
|
||||
case actorstypes.Version11:
|
||||
return message11{message0{from}}
|
||||
default:
|
||||
panic(fmt.Sprintf("unsupported actors version: %d", version))
|
||||
}
|
||||
@ -194,13 +203,13 @@ type MessageBuilder interface {
|
||||
}
|
||||
|
||||
// this type is the same between v0 and v2
|
||||
type ProposalHashData = msig10.ProposalHashData
|
||||
type ProposeReturn = msig10.ProposeReturn
|
||||
type ProposeParams = msig10.ProposeParams
|
||||
type ApproveReturn = msig10.ApproveReturn
|
||||
type ProposalHashData = msig11.ProposalHashData
|
||||
type ProposeReturn = msig11.ProposeReturn
|
||||
type ProposeParams = msig11.ProposeParams
|
||||
type ApproveReturn = msig11.ApproveReturn
|
||||
|
||||
func txnParams(id uint64, data *ProposalHashData) ([]byte, error) {
|
||||
params := msig10.TxnIDParams{ID: msig10.TxnID(id)}
|
||||
params := msig11.TxnIDParams{ID: msig11.TxnID(id)}
|
||||
if data != nil {
|
||||
if data.Requester.Protocol() != address.ID {
|
||||
return nil, xerrors.Errorf("proposer address must be an ID address, was %s", data.Requester)
|
||||
@ -234,5 +243,6 @@ func AllCodes() []cid.Cid {
|
||||
(&state8{}).Code(),
|
||||
(&state9{}).Code(),
|
||||
(&state10{}).Code(),
|
||||
(&state11{}).Code(),
|
||||
}
|
||||
}
|
||||
|
138
chain/actors/builtin/multisig/v11.go
generated
Normal file
138
chain/actors/builtin/multisig/v11.go
generated
Normal file
@ -0,0 +1,138 @@
|
||||
package multisig
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin11 "github.com/filecoin-project/go-state-types/builtin"
|
||||
msig11 "github.com/filecoin-project/go-state-types/builtin/v11/multisig"
|
||||
adt11 "github.com/filecoin-project/go-state-types/builtin/v11/util/adt"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
var _ State = (*state11)(nil)
|
||||
|
||||
func load11(store adt.Store, root cid.Cid) (State, error) {
|
||||
out := state11{store: store}
|
||||
err := store.Get(store.Context(), root, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make11(store adt.Store, signers []address.Address, threshold uint64, startEpoch abi.ChainEpoch, unlockDuration abi.ChainEpoch, initialBalance abi.TokenAmount) (State, error) {
|
||||
out := state11{store: store}
|
||||
out.State = msig11.State{}
|
||||
out.State.Signers = signers
|
||||
out.State.NumApprovalsThreshold = threshold
|
||||
out.State.StartEpoch = startEpoch
|
||||
out.State.UnlockDuration = unlockDuration
|
||||
out.State.InitialBalance = initialBalance
|
||||
|
||||
em, err := adt11.StoreEmptyMap(store, builtin11.DefaultHamtBitwidth)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State.PendingTxns = em
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state11 struct {
|
||||
msig11.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *state11) LockedBalance(currEpoch abi.ChainEpoch) (abi.TokenAmount, error) {
|
||||
return s.State.AmountLocked(currEpoch - s.State.StartEpoch), nil
|
||||
}
|
||||
|
||||
func (s *state11) StartEpoch() (abi.ChainEpoch, error) {
|
||||
return s.State.StartEpoch, nil
|
||||
}
|
||||
|
||||
func (s *state11) UnlockDuration() (abi.ChainEpoch, error) {
|
||||
return s.State.UnlockDuration, nil
|
||||
}
|
||||
|
||||
func (s *state11) InitialBalance() (abi.TokenAmount, error) {
|
||||
return s.State.InitialBalance, nil
|
||||
}
|
||||
|
||||
func (s *state11) Threshold() (uint64, error) {
|
||||
return s.State.NumApprovalsThreshold, nil
|
||||
}
|
||||
|
||||
func (s *state11) Signers() ([]address.Address, error) {
|
||||
return s.State.Signers, nil
|
||||
}
|
||||
|
||||
func (s *state11) ForEachPendingTxn(cb func(id int64, txn Transaction) error) error {
|
||||
arr, err := adt11.AsMap(s.store, s.State.PendingTxns, builtin11.DefaultHamtBitwidth)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var out msig11.Transaction
|
||||
return arr.ForEach(&out, func(key string) error {
|
||||
txid, n := binary.Varint([]byte(key))
|
||||
if n <= 0 {
|
||||
return xerrors.Errorf("invalid pending transaction key: %v", key)
|
||||
}
|
||||
return cb(txid, (Transaction)(out)) //nolint:unconvert
|
||||
})
|
||||
}
|
||||
|
||||
func (s *state11) PendingTxnChanged(other State) (bool, error) {
|
||||
other11, ok := other.(*state11)
|
||||
if !ok {
|
||||
// treat an upgrade as a change, always
|
||||
return true, nil
|
||||
}
|
||||
return !s.State.PendingTxns.Equals(other11.PendingTxns), nil
|
||||
}
|
||||
|
||||
func (s *state11) transactions() (adt.Map, error) {
|
||||
return adt11.AsMap(s.store, s.PendingTxns, builtin11.DefaultHamtBitwidth)
|
||||
}
|
||||
|
||||
func (s *state11) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
||||
var tx msig11.Transaction
|
||||
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||
return Transaction{}, err
|
||||
}
|
||||
return Transaction(tx), nil
|
||||
}
|
||||
|
||||
func (s *state11) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state11) ActorKey() string {
|
||||
return manifest.MultisigKey
|
||||
}
|
||||
|
||||
func (s *state11) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version11
|
||||
}
|
||||
|
||||
func (s *state11) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
109
chain/actors/builtin/paych/message11.go
generated
Normal file
109
chain/actors/builtin/paych/message11.go
generated
Normal file
@ -0,0 +1,109 @@
|
||||
package paych
|
||||
|
||||
import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin11 "github.com/filecoin-project/go-state-types/builtin"
|
||||
init11 "github.com/filecoin-project/go-state-types/builtin/v11/init"
|
||||
paych11 "github.com/filecoin-project/go-state-types/builtin/v11/paych"
|
||||
paychtypes "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
type message11 struct{ from address.Address }
|
||||
|
||||
func (m message11) Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error) {
|
||||
|
||||
actorCodeID, ok := actors.GetActorCodeID(actorstypes.Version11, "paymentchannel")
|
||||
if !ok {
|
||||
return nil, xerrors.Errorf("error getting actor paymentchannel code id for actor version %d", 11)
|
||||
}
|
||||
|
||||
params, aerr := actors.SerializeParams(&paych11.ConstructorParams{From: m.from, To: to})
|
||||
if aerr != nil {
|
||||
return nil, aerr
|
||||
}
|
||||
enc, aerr := actors.SerializeParams(&init11.ExecParams{
|
||||
CodeCID: actorCodeID,
|
||||
ConstructorParams: params,
|
||||
})
|
||||
if aerr != nil {
|
||||
return nil, aerr
|
||||
}
|
||||
|
||||
return &types.Message{
|
||||
To: init_.Address,
|
||||
From: m.from,
|
||||
Value: initialAmount,
|
||||
Method: builtin11.MethodsInit.Exec,
|
||||
Params: enc,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (m message11) Update(paych address.Address, sv *paychtypes.SignedVoucher, secret []byte) (*types.Message, error) {
|
||||
params, aerr := actors.SerializeParams(&paych11.UpdateChannelStateParams{
|
||||
|
||||
Sv: toV11SignedVoucher(*sv),
|
||||
|
||||
Secret: secret,
|
||||
})
|
||||
if aerr != nil {
|
||||
return nil, aerr
|
||||
}
|
||||
|
||||
return &types.Message{
|
||||
To: paych,
|
||||
From: m.from,
|
||||
Value: abi.NewTokenAmount(0),
|
||||
Method: builtin11.MethodsPaych.UpdateChannelState,
|
||||
Params: params,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func toV11SignedVoucher(sv paychtypes.SignedVoucher) paych11.SignedVoucher {
|
||||
merges := make([]paych11.Merge, len(sv.Merges))
|
||||
for i := range sv.Merges {
|
||||
merges[i] = paych11.Merge{
|
||||
Lane: sv.Merges[i].Lane,
|
||||
Nonce: sv.Merges[i].Nonce,
|
||||
}
|
||||
}
|
||||
|
||||
return paych11.SignedVoucher{
|
||||
ChannelAddr: sv.ChannelAddr,
|
||||
TimeLockMin: sv.TimeLockMin,
|
||||
TimeLockMax: sv.TimeLockMax,
|
||||
SecretHash: sv.SecretHash,
|
||||
Extra: (*paych11.ModVerifyParams)(sv.Extra),
|
||||
Lane: sv.Lane,
|
||||
Nonce: sv.Nonce,
|
||||
Amount: sv.Amount,
|
||||
MinSettleHeight: sv.MinSettleHeight,
|
||||
Merges: merges,
|
||||
Signature: sv.Signature,
|
||||
}
|
||||
}
|
||||
|
||||
func (m message11) Settle(paych address.Address) (*types.Message, error) {
|
||||
return &types.Message{
|
||||
To: paych,
|
||||
From: m.from,
|
||||
Value: abi.NewTokenAmount(0),
|
||||
Method: builtin11.MethodsPaych.Settle,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (m message11) Collect(paych address.Address) (*types.Message, error) {
|
||||
return &types.Message{
|
||||
To: paych,
|
||||
From: m.from,
|
||||
Value: abi.NewTokenAmount(0),
|
||||
Method: builtin11.MethodsPaych.Collect,
|
||||
}, nil
|
||||
}
|
@ -47,6 +47,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
case actorstypes.Version10:
|
||||
return load10(store, act.Head)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return load11(store, act.Head)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,6 +164,9 @@ func Message(version actorstypes.Version, from address.Address) MessageBuilder {
|
||||
case actorstypes.Version10:
|
||||
return message10{from}
|
||||
|
||||
case actorstypes.Version11:
|
||||
return message11{from}
|
||||
|
||||
default:
|
||||
panic(fmt.Sprintf("unsupported actors version: %d", version))
|
||||
}
|
||||
@ -201,5 +207,6 @@ func AllCodes() []cid.Cid {
|
||||
(&state8{}).Code(),
|
||||
(&state9{}).Code(),
|
||||
(&state10{}).Code(),
|
||||
(&state11{}).Code(),
|
||||
}
|
||||
}
|
||||
|
135
chain/actors/builtin/paych/v11.go
generated
Normal file
135
chain/actors/builtin/paych/v11.go
generated
Normal file
@ -0,0 +1,135 @@
|
||||
package paych
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
paych11 "github.com/filecoin-project/go-state-types/builtin/v11/paych"
|
||||
adt11 "github.com/filecoin-project/go-state-types/builtin/v11/util/adt"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
var _ State = (*state11)(nil)
|
||||
|
||||
func load11(store adt.Store, root cid.Cid) (State, error) {
|
||||
out := state11{store: store}
|
||||
err := store.Get(store.Context(), root, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make11(store adt.Store) (State, error) {
|
||||
out := state11{store: store}
|
||||
out.State = paych11.State{}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state11 struct {
|
||||
paych11.State
|
||||
store adt.Store
|
||||
lsAmt *adt11.Array
|
||||
}
|
||||
|
||||
// Channel owner, who has funded the actor
|
||||
func (s *state11) From() (address.Address, error) {
|
||||
return s.State.From, nil
|
||||
}
|
||||
|
||||
// Recipient of payouts from channel
|
||||
func (s *state11) To() (address.Address, error) {
|
||||
return s.State.To, nil
|
||||
}
|
||||
|
||||
// Height at which the channel can be `Collected`
|
||||
func (s *state11) SettlingAt() (abi.ChainEpoch, error) {
|
||||
return s.State.SettlingAt, nil
|
||||
}
|
||||
|
||||
// Amount successfully redeemed through the payment channel, paid out on `Collect()`
|
||||
func (s *state11) ToSend() (abi.TokenAmount, error) {
|
||||
return s.State.ToSend, nil
|
||||
}
|
||||
|
||||
func (s *state11) getOrLoadLsAmt() (*adt11.Array, error) {
|
||||
if s.lsAmt != nil {
|
||||
return s.lsAmt, nil
|
||||
}
|
||||
|
||||
// Get the lane state from the chain
|
||||
lsamt, err := adt11.AsArray(s.store, s.State.LaneStates, paych11.LaneStatesAmtBitwidth)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
s.lsAmt = lsamt
|
||||
return lsamt, nil
|
||||
}
|
||||
|
||||
// Get total number of lanes
|
||||
func (s *state11) LaneCount() (uint64, error) {
|
||||
lsamt, err := s.getOrLoadLsAmt()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return lsamt.Length(), nil
|
||||
}
|
||||
|
||||
func (s *state11) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
// Iterate lane states
|
||||
func (s *state11) ForEachLaneState(cb func(idx uint64, dl LaneState) error) error {
|
||||
// Get the lane state from the chain
|
||||
lsamt, err := s.getOrLoadLsAmt()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Note: we use a map instead of an array to store laneStates because the
|
||||
// client sets the lane ID (the index) and potentially they could use a
|
||||
// very large index.
|
||||
var ls paych11.LaneState
|
||||
return lsamt.ForEach(&ls, func(i int64) error {
|
||||
return cb(uint64(i), &laneState11{ls})
|
||||
})
|
||||
}
|
||||
|
||||
type laneState11 struct {
|
||||
paych11.LaneState
|
||||
}
|
||||
|
||||
func (ls *laneState11) Redeemed() (big.Int, error) {
|
||||
return ls.LaneState.Redeemed, nil
|
||||
}
|
||||
|
||||
func (ls *laneState11) Nonce() (uint64, error) {
|
||||
return ls.LaneState.Nonce, nil
|
||||
}
|
||||
|
||||
func (s *state11) ActorKey() string {
|
||||
return manifest.PaychKey
|
||||
}
|
||||
|
||||
func (s *state11) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version11
|
||||
}
|
||||
|
||||
func (s *state11) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
@ -9,7 +9,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
builtin10 "github.com/filecoin-project/go-state-types/builtin"
|
||||
builtin11 "github.com/filecoin-project/go-state-types/builtin"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
@ -27,8 +27,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
Address = builtin10.StoragePowerActorAddr
|
||||
Methods = builtin10.MethodsPower
|
||||
Address = builtin11.StoragePowerActorAddr
|
||||
Methods = builtin11.MethodsPower
|
||||
)
|
||||
|
||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
@ -48,6 +48,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
case actorstypes.Version10:
|
||||
return load10(store, act.Head)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return load11(store, act.Head)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,6 +115,9 @@ func MakeState(store adt.Store, av actorstypes.Version) (State, error) {
|
||||
case actorstypes.Version10:
|
||||
return make10(store)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return make11(store)
|
||||
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
@ -176,5 +182,6 @@ func AllCodes() []cid.Cid {
|
||||
(&state8{}).Code(),
|
||||
(&state9{}).Code(),
|
||||
(&state10{}).Code(),
|
||||
(&state11{}).Code(),
|
||||
}
|
||||
}
|
||||
|
207
chain/actors/builtin/power/v11.go
generated
Normal file
207
chain/actors/builtin/power/v11.go
generated
Normal file
@ -0,0 +1,207 @@
|
||||
package power
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin11 "github.com/filecoin-project/go-state-types/builtin"
|
||||
power11 "github.com/filecoin-project/go-state-types/builtin/v11/power"
|
||||
adt11 "github.com/filecoin-project/go-state-types/builtin/v11/util/adt"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
)
|
||||
|
||||
var _ State = (*state11)(nil)
|
||||
|
||||
func load11(store adt.Store, root cid.Cid) (State, error) {
|
||||
out := state11{store: store}
|
||||
err := store.Get(store.Context(), root, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make11(store adt.Store) (State, error) {
|
||||
out := state11{store: store}
|
||||
|
||||
s, err := power11.ConstructState(store)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *s
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state11 struct {
|
||||
power11.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *state11) TotalLocked() (abi.TokenAmount, error) {
|
||||
return s.TotalPledgeCollateral, nil
|
||||
}
|
||||
|
||||
func (s *state11) TotalPower() (Claim, error) {
|
||||
return Claim{
|
||||
RawBytePower: s.TotalRawBytePower,
|
||||
QualityAdjPower: s.TotalQualityAdjPower,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Committed power to the network. Includes miners below the minimum threshold.
|
||||
func (s *state11) TotalCommitted() (Claim, error) {
|
||||
return Claim{
|
||||
RawBytePower: s.TotalBytesCommitted,
|
||||
QualityAdjPower: s.TotalQABytesCommitted,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *state11) MinerPower(addr address.Address) (Claim, bool, error) {
|
||||
claims, err := s.claims()
|
||||
if err != nil {
|
||||
return Claim{}, false, err
|
||||
}
|
||||
var claim power11.Claim
|
||||
ok, err := claims.Get(abi.AddrKey(addr), &claim)
|
||||
if err != nil {
|
||||
return Claim{}, false, err
|
||||
}
|
||||
return Claim{
|
||||
RawBytePower: claim.RawBytePower,
|
||||
QualityAdjPower: claim.QualityAdjPower,
|
||||
}, ok, nil
|
||||
}
|
||||
|
||||
func (s *state11) MinerNominalPowerMeetsConsensusMinimum(a address.Address) (bool, error) {
|
||||
return s.State.MinerNominalPowerMeetsConsensusMinimum(s.store, a)
|
||||
}
|
||||
|
||||
func (s *state11) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
||||
return builtin.FilterEstimate(s.State.ThisEpochQAPowerSmoothed), nil
|
||||
}
|
||||
|
||||
func (s *state11) MinerCounts() (uint64, uint64, error) {
|
||||
return uint64(s.State.MinerAboveMinPowerCount), uint64(s.State.MinerCount), nil
|
||||
}
|
||||
|
||||
func (s *state11) ListAllMiners() ([]address.Address, error) {
|
||||
claims, err := s.claims()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var miners []address.Address
|
||||
err = claims.ForEach(nil, func(k string) error {
|
||||
a, err := address.NewFromBytes([]byte(k))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
miners = append(miners, a)
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return miners, nil
|
||||
}
|
||||
|
||||
func (s *state11) ForEachClaim(cb func(miner address.Address, claim Claim) error) error {
|
||||
claims, err := s.claims()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var claim power11.Claim
|
||||
return claims.ForEach(&claim, func(k string) error {
|
||||
a, err := address.NewFromBytes([]byte(k))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cb(a, Claim{
|
||||
RawBytePower: claim.RawBytePower,
|
||||
QualityAdjPower: claim.QualityAdjPower,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
func (s *state11) ClaimsChanged(other State) (bool, error) {
|
||||
other11, ok := other.(*state11)
|
||||
if !ok {
|
||||
// treat an upgrade as a change, always
|
||||
return true, nil
|
||||
}
|
||||
return !s.State.Claims.Equals(other11.State.Claims), nil
|
||||
}
|
||||
|
||||
func (s *state11) SetTotalQualityAdjPower(p abi.StoragePower) error {
|
||||
s.State.TotalQualityAdjPower = p
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state11) SetTotalRawBytePower(p abi.StoragePower) error {
|
||||
s.State.TotalRawBytePower = p
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state11) SetThisEpochQualityAdjPower(p abi.StoragePower) error {
|
||||
s.State.ThisEpochQualityAdjPower = p
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state11) SetThisEpochRawBytePower(p abi.StoragePower) error {
|
||||
s.State.ThisEpochRawBytePower = p
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *state11) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state11) claims() (adt.Map, error) {
|
||||
return adt11.AsMap(s.store, s.Claims, builtin11.DefaultHamtBitwidth)
|
||||
}
|
||||
|
||||
func (s *state11) decodeClaim(val *cbg.Deferred) (Claim, error) {
|
||||
var ci power11.Claim
|
||||
if err := ci.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||
return Claim{}, err
|
||||
}
|
||||
return fromV11Claim(ci), nil
|
||||
}
|
||||
|
||||
func fromV11Claim(v11 power11.Claim) Claim {
|
||||
return Claim{
|
||||
RawBytePower: v11.RawBytePower,
|
||||
QualityAdjPower: v11.QualityAdjPower,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state11) ActorKey() string {
|
||||
return manifest.PowerKey
|
||||
}
|
||||
|
||||
func (s *state11) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version11
|
||||
}
|
||||
|
||||
func (s *state11) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
@ -26,6 +26,22 @@ import (
|
||||
reward10 "github.com/filecoin-project/go-state-types/builtin/v10/reward"
|
||||
system10 "github.com/filecoin-project/go-state-types/builtin/v10/system"
|
||||
verifreg10 "github.com/filecoin-project/go-state-types/builtin/v10/verifreg"
|
||||
account11 "github.com/filecoin-project/go-state-types/builtin/v11/account"
|
||||
cron11 "github.com/filecoin-project/go-state-types/builtin/v11/cron"
|
||||
datacap11 "github.com/filecoin-project/go-state-types/builtin/v11/datacap"
|
||||
eam11 "github.com/filecoin-project/go-state-types/builtin/v11/eam"
|
||||
ethaccount11 "github.com/filecoin-project/go-state-types/builtin/v11/ethaccount"
|
||||
evm11 "github.com/filecoin-project/go-state-types/builtin/v11/evm"
|
||||
_init11 "github.com/filecoin-project/go-state-types/builtin/v11/init"
|
||||
market11 "github.com/filecoin-project/go-state-types/builtin/v11/market"
|
||||
miner11 "github.com/filecoin-project/go-state-types/builtin/v11/miner"
|
||||
multisig11 "github.com/filecoin-project/go-state-types/builtin/v11/multisig"
|
||||
paych11 "github.com/filecoin-project/go-state-types/builtin/v11/paych"
|
||||
placeholder11 "github.com/filecoin-project/go-state-types/builtin/v11/placeholder"
|
||||
power11 "github.com/filecoin-project/go-state-types/builtin/v11/power"
|
||||
reward11 "github.com/filecoin-project/go-state-types/builtin/v11/reward"
|
||||
system11 "github.com/filecoin-project/go-state-types/builtin/v11/system"
|
||||
verifreg11 "github.com/filecoin-project/go-state-types/builtin/v11/verifreg"
|
||||
account8 "github.com/filecoin-project/go-state-types/builtin/v8/account"
|
||||
cron8 "github.com/filecoin-project/go-state-types/builtin/v8/cron"
|
||||
_init8 "github.com/filecoin-project/go-state-types/builtin/v8/init"
|
||||
@ -377,6 +393,110 @@ func MakeRegistry(av actorstypes.Version) []RegistryEntry {
|
||||
}
|
||||
}
|
||||
|
||||
case actorstypes.Version11:
|
||||
for key, codeID := range codeIDs {
|
||||
switch key {
|
||||
case manifest.AccountKey:
|
||||
registry = append(registry, RegistryEntry{
|
||||
code: codeID,
|
||||
methods: account11.Methods,
|
||||
state: new(account11.State),
|
||||
})
|
||||
case manifest.CronKey:
|
||||
registry = append(registry, RegistryEntry{
|
||||
code: codeID,
|
||||
methods: cron11.Methods,
|
||||
state: new(cron11.State),
|
||||
})
|
||||
case manifest.InitKey:
|
||||
registry = append(registry, RegistryEntry{
|
||||
code: codeID,
|
||||
methods: _init11.Methods,
|
||||
state: new(_init11.State),
|
||||
})
|
||||
case manifest.MarketKey:
|
||||
registry = append(registry, RegistryEntry{
|
||||
code: codeID,
|
||||
methods: market11.Methods,
|
||||
state: new(market11.State),
|
||||
})
|
||||
case manifest.MinerKey:
|
||||
registry = append(registry, RegistryEntry{
|
||||
code: codeID,
|
||||
methods: miner11.Methods,
|
||||
state: new(miner11.State),
|
||||
})
|
||||
case manifest.MultisigKey:
|
||||
registry = append(registry, RegistryEntry{
|
||||
code: codeID,
|
||||
methods: multisig11.Methods,
|
||||
state: new(multisig11.State),
|
||||
})
|
||||
case manifest.PaychKey:
|
||||
registry = append(registry, RegistryEntry{
|
||||
code: codeID,
|
||||
methods: paych11.Methods,
|
||||
state: new(paych11.State),
|
||||
})
|
||||
case manifest.PowerKey:
|
||||
registry = append(registry, RegistryEntry{
|
||||
code: codeID,
|
||||
methods: power11.Methods,
|
||||
state: new(power11.State),
|
||||
})
|
||||
case manifest.RewardKey:
|
||||
registry = append(registry, RegistryEntry{
|
||||
code: codeID,
|
||||
methods: reward11.Methods,
|
||||
state: new(reward11.State),
|
||||
})
|
||||
case manifest.SystemKey:
|
||||
registry = append(registry, RegistryEntry{
|
||||
code: codeID,
|
||||
methods: system11.Methods,
|
||||
state: new(system11.State),
|
||||
})
|
||||
case manifest.VerifregKey:
|
||||
registry = append(registry, RegistryEntry{
|
||||
code: codeID,
|
||||
methods: verifreg11.Methods,
|
||||
state: new(verifreg11.State),
|
||||
})
|
||||
case manifest.DatacapKey:
|
||||
registry = append(registry, RegistryEntry{
|
||||
code: codeID,
|
||||
methods: datacap11.Methods,
|
||||
state: new(datacap11.State),
|
||||
})
|
||||
|
||||
case manifest.EvmKey:
|
||||
registry = append(registry, RegistryEntry{
|
||||
code: codeID,
|
||||
methods: evm11.Methods,
|
||||
state: new(evm11.State),
|
||||
})
|
||||
case manifest.EamKey:
|
||||
registry = append(registry, RegistryEntry{
|
||||
code: codeID,
|
||||
methods: eam11.Methods,
|
||||
state: nil,
|
||||
})
|
||||
case manifest.PlaceholderKey:
|
||||
registry = append(registry, RegistryEntry{
|
||||
code: codeID,
|
||||
methods: placeholder11.Methods,
|
||||
state: nil,
|
||||
})
|
||||
case manifest.EthAccountKey:
|
||||
registry = append(registry, RegistryEntry{
|
||||
code: codeID,
|
||||
methods: ethaccount11.Methods,
|
||||
state: nil,
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
panic("expected version v8 and up only, use specs-actors for v0-7")
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin10 "github.com/filecoin-project/go-state-types/builtin"
|
||||
builtin11 "github.com/filecoin-project/go-state-types/builtin"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
@ -25,8 +25,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
Address = builtin10.RewardActorAddr
|
||||
Methods = builtin10.MethodsReward
|
||||
Address = builtin11.RewardActorAddr
|
||||
Methods = builtin11.MethodsReward
|
||||
)
|
||||
|
||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
@ -46,6 +46,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
case actorstypes.Version10:
|
||||
return load10(store, act.Head)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return load11(store, act.Head)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,6 +113,9 @@ func MakeState(store adt.Store, av actorstypes.Version, currRealizedPower abi.St
|
||||
case actorstypes.Version10:
|
||||
return make10(store, currRealizedPower)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return make11(store, currRealizedPower)
|
||||
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
@ -152,5 +158,6 @@ func AllCodes() []cid.Cid {
|
||||
(&state8{}).Code(),
|
||||
(&state9{}).Code(),
|
||||
(&state10{}).Code(),
|
||||
(&state11{}).Code(),
|
||||
}
|
||||
}
|
||||
|
120
chain/actors/builtin/reward/v11.go
generated
Normal file
120
chain/actors/builtin/reward/v11.go
generated
Normal file
@ -0,0 +1,120 @@
|
||||
package reward
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
miner11 "github.com/filecoin-project/go-state-types/builtin/v11/miner"
|
||||
reward11 "github.com/filecoin-project/go-state-types/builtin/v11/reward"
|
||||
smoothing11 "github.com/filecoin-project/go-state-types/builtin/v11/util/smoothing"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
)
|
||||
|
||||
var _ State = (*state11)(nil)
|
||||
|
||||
func load11(store adt.Store, root cid.Cid) (State, error) {
|
||||
out := state11{store: store}
|
||||
err := store.Get(store.Context(), root, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make11(store adt.Store, currRealizedPower abi.StoragePower) (State, error) {
|
||||
out := state11{store: store}
|
||||
out.State = *reward11.ConstructState(currRealizedPower)
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state11 struct {
|
||||
reward11.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *state11) ThisEpochReward() (abi.TokenAmount, error) {
|
||||
return s.State.ThisEpochReward, nil
|
||||
}
|
||||
|
||||
func (s *state11) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
|
||||
|
||||
return builtin.FilterEstimate{
|
||||
PositionEstimate: s.State.ThisEpochRewardSmoothed.PositionEstimate,
|
||||
VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate,
|
||||
}, nil
|
||||
|
||||
}
|
||||
|
||||
func (s *state11) ThisEpochBaselinePower() (abi.StoragePower, error) {
|
||||
return s.State.ThisEpochBaselinePower, nil
|
||||
}
|
||||
|
||||
func (s *state11) TotalStoragePowerReward() (abi.TokenAmount, error) {
|
||||
return s.State.TotalStoragePowerReward, nil
|
||||
}
|
||||
|
||||
func (s *state11) EffectiveBaselinePower() (abi.StoragePower, error) {
|
||||
return s.State.EffectiveBaselinePower, nil
|
||||
}
|
||||
|
||||
func (s *state11) EffectiveNetworkTime() (abi.ChainEpoch, error) {
|
||||
return s.State.EffectiveNetworkTime, nil
|
||||
}
|
||||
|
||||
func (s *state11) CumsumBaseline() (reward11.Spacetime, error) {
|
||||
return s.State.CumsumBaseline, nil
|
||||
}
|
||||
|
||||
func (s *state11) CumsumRealized() (reward11.Spacetime, error) {
|
||||
return s.State.CumsumRealized, nil
|
||||
}
|
||||
|
||||
func (s *state11) InitialPledgeForPower(qaPower abi.StoragePower, networkTotalPledge abi.TokenAmount, networkQAPower *builtin.FilterEstimate, circSupply abi.TokenAmount) (abi.TokenAmount, error) {
|
||||
return miner11.InitialPledgeForPower(
|
||||
qaPower,
|
||||
s.State.ThisEpochBaselinePower,
|
||||
s.State.ThisEpochRewardSmoothed,
|
||||
smoothing11.FilterEstimate{
|
||||
PositionEstimate: networkQAPower.PositionEstimate,
|
||||
VelocityEstimate: networkQAPower.VelocityEstimate,
|
||||
},
|
||||
circSupply,
|
||||
), nil
|
||||
}
|
||||
|
||||
func (s *state11) PreCommitDepositForPower(networkQAPower builtin.FilterEstimate, sectorWeight abi.StoragePower) (abi.TokenAmount, error) {
|
||||
return miner11.PreCommitDepositForPower(s.State.ThisEpochRewardSmoothed,
|
||||
smoothing11.FilterEstimate{
|
||||
PositionEstimate: networkQAPower.PositionEstimate,
|
||||
VelocityEstimate: networkQAPower.VelocityEstimate,
|
||||
},
|
||||
sectorWeight), nil
|
||||
}
|
||||
|
||||
func (s *state11) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state11) ActorKey() string {
|
||||
return manifest.RewardKey
|
||||
}
|
||||
|
||||
func (s *state11) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version11
|
||||
}
|
||||
|
||||
func (s *state11) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
@ -5,7 +5,7 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin10 "github.com/filecoin-project/go-state-types/builtin"
|
||||
builtin11 "github.com/filecoin-project/go-state-types/builtin"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||
@ -21,7 +21,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
Address = builtin10.SystemActorAddr
|
||||
Address = builtin11.SystemActorAddr
|
||||
)
|
||||
|
||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
@ -41,6 +41,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
case actorstypes.Version10:
|
||||
return load10(store, act.Head)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return load11(store, act.Head)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,6 +108,9 @@ func MakeState(store adt.Store, av actorstypes.Version, builtinActors cid.Cid) (
|
||||
case actorstypes.Version10:
|
||||
return make10(store, builtinActors)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return make11(store, builtinActors)
|
||||
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
@ -131,5 +137,6 @@ func AllCodes() []cid.Cid {
|
||||
(&state8{}).Code(),
|
||||
(&state9{}).Code(),
|
||||
(&state10{}).Code(),
|
||||
(&state11{}).Code(),
|
||||
}
|
||||
}
|
||||
|
72
chain/actors/builtin/system/v11.go
generated
Normal file
72
chain/actors/builtin/system/v11.go
generated
Normal file
@ -0,0 +1,72 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
system11 "github.com/filecoin-project/go-state-types/builtin/v11/system"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
var _ State = (*state11)(nil)
|
||||
|
||||
func load11(store adt.Store, root cid.Cid) (State, error) {
|
||||
out := state11{store: store}
|
||||
err := store.Get(store.Context(), root, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make11(store adt.Store, builtinActors cid.Cid) (State, error) {
|
||||
out := state11{store: store}
|
||||
out.State = system11.State{
|
||||
BuiltinActors: builtinActors,
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state11 struct {
|
||||
system11.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *state11) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state11) GetBuiltinActors() cid.Cid {
|
||||
|
||||
return s.State.BuiltinActors
|
||||
|
||||
}
|
||||
|
||||
func (s *state11) SetBuiltinActors(c cid.Cid) error {
|
||||
|
||||
s.State.BuiltinActors = c
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
func (s *state11) ActorKey() string {
|
||||
return manifest.SystemKey
|
||||
}
|
||||
|
||||
func (s *state11) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version11
|
||||
}
|
||||
|
||||
func (s *state11) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
170
chain/actors/builtin/verifreg/v11.go
generated
Normal file
170
chain/actors/builtin/verifreg/v11.go
generated
Normal file
@ -0,0 +1,170 @@
|
||||
package verifreg
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
builtin11 "github.com/filecoin-project/go-state-types/builtin"
|
||||
adt11 "github.com/filecoin-project/go-state-types/builtin/v11/util/adt"
|
||||
verifreg11 "github.com/filecoin-project/go-state-types/builtin/v11/verifreg"
|
||||
verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
var _ State = (*state11)(nil)
|
||||
|
||||
func load11(store adt.Store, root cid.Cid) (State, error) {
|
||||
out := state11{store: store}
|
||||
err := store.Get(store.Context(), root, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func make11(store adt.Store, rootKeyAddress address.Address) (State, error) {
|
||||
out := state11{store: store}
|
||||
|
||||
s, err := verifreg11.ConstructState(store, rootKeyAddress)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *s
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
type state11 struct {
|
||||
verifreg11.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *state11) RootKey() (address.Address, error) {
|
||||
return s.State.RootKey, nil
|
||||
}
|
||||
|
||||
func (s *state11) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
|
||||
return false, big.Zero(), xerrors.Errorf("unsupported in actors v11")
|
||||
|
||||
}
|
||||
|
||||
func (s *state11) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
return getDataCap(s.store, actors.Version11, s.verifiers, addr)
|
||||
}
|
||||
|
||||
func (s *state11) RemoveDataCapProposalID(verifier address.Address, client address.Address) (bool, uint64, error) {
|
||||
return getRemoveDataCapProposalID(s.store, actors.Version11, s.removeDataCapProposalIDs, verifier, client)
|
||||
}
|
||||
|
||||
func (s *state11) ForEachVerifier(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
return forEachCap(s.store, actors.Version11, s.verifiers, cb)
|
||||
}
|
||||
|
||||
func (s *state11) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
|
||||
return xerrors.Errorf("unsupported in actors v11")
|
||||
|
||||
}
|
||||
|
||||
func (s *state11) verifiedClients() (adt.Map, error) {
|
||||
|
||||
return nil, xerrors.Errorf("unsupported in actors v11")
|
||||
|
||||
}
|
||||
|
||||
func (s *state11) verifiers() (adt.Map, error) {
|
||||
return adt11.AsMap(s.store, s.Verifiers, builtin11.DefaultHamtBitwidth)
|
||||
}
|
||||
|
||||
func (s *state11) removeDataCapProposalIDs() (adt.Map, error) {
|
||||
return adt11.AsMap(s.store, s.RemoveDataCapProposalIDs, builtin11.DefaultHamtBitwidth)
|
||||
}
|
||||
|
||||
func (s *state11) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state11) GetAllocation(clientIdAddr address.Address, allocationId verifreg9.AllocationId) (*Allocation, bool, error) {
|
||||
|
||||
alloc, ok, err := s.FindAllocation(s.store, clientIdAddr, verifreg11.AllocationId(allocationId))
|
||||
return (*Allocation)(alloc), ok, err
|
||||
}
|
||||
|
||||
func (s *state11) GetAllocations(clientIdAddr address.Address) (map[AllocationId]Allocation, error) {
|
||||
|
||||
v11Map, err := s.LoadAllocationsToMap(s.store, clientIdAddr)
|
||||
|
||||
retMap := make(map[AllocationId]Allocation, len(v11Map))
|
||||
for k, v := range v11Map {
|
||||
retMap[AllocationId(k)] = Allocation(v)
|
||||
}
|
||||
|
||||
return retMap, err
|
||||
|
||||
}
|
||||
|
||||
func (s *state11) GetClaim(providerIdAddr address.Address, claimId verifreg9.ClaimId) (*Claim, bool, error) {
|
||||
|
||||
claim, ok, err := s.FindClaim(s.store, providerIdAddr, verifreg11.ClaimId(claimId))
|
||||
return (*Claim)(claim), ok, err
|
||||
|
||||
}
|
||||
|
||||
func (s *state11) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, error) {
|
||||
|
||||
v11Map, err := s.LoadClaimsToMap(s.store, providerIdAddr)
|
||||
|
||||
retMap := make(map[ClaimId]Claim, len(v11Map))
|
||||
for k, v := range v11Map {
|
||||
retMap[ClaimId(k)] = Claim(v)
|
||||
}
|
||||
|
||||
return retMap, err
|
||||
|
||||
}
|
||||
|
||||
func (s *state11) GetClaimIdsBySector(providerIdAddr address.Address) (map[abi.SectorNumber][]ClaimId, error) {
|
||||
|
||||
v11Map, err := s.LoadClaimsToMap(s.store, providerIdAddr)
|
||||
|
||||
retMap := make(map[abi.SectorNumber][]ClaimId)
|
||||
for k, v := range v11Map {
|
||||
claims, ok := retMap[v.Sector]
|
||||
if !ok {
|
||||
retMap[v.Sector] = []ClaimId{ClaimId(k)}
|
||||
} else {
|
||||
retMap[v.Sector] = append(claims, ClaimId(k))
|
||||
}
|
||||
}
|
||||
|
||||
return retMap, err
|
||||
|
||||
}
|
||||
|
||||
func (s *state11) ActorKey() string {
|
||||
return manifest.VerifregKey
|
||||
}
|
||||
|
||||
func (s *state11) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version11
|
||||
}
|
||||
|
||||
func (s *state11) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
13
chain/actors/builtin/verifreg/verifreg.go
generated
13
chain/actors/builtin/verifreg/verifreg.go
generated
@ -7,7 +7,7 @@ import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin10 "github.com/filecoin-project/go-state-types/builtin"
|
||||
builtin11 "github.com/filecoin-project/go-state-types/builtin"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
@ -25,8 +25,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
Address = builtin10.VerifiedRegistryActorAddr
|
||||
Methods = builtin10.MethodsVerifiedRegistry
|
||||
Address = builtin11.VerifiedRegistryActorAddr
|
||||
Methods = builtin11.MethodsVerifiedRegistry
|
||||
)
|
||||
|
||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
@ -46,6 +46,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
case actorstypes.Version10:
|
||||
return load10(store, act.Head)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return load11(store, act.Head)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,6 +113,9 @@ func MakeState(store adt.Store, av actorstypes.Version, rootKeyAddress address.A
|
||||
case actorstypes.Version10:
|
||||
return make10(store, rootKeyAddress)
|
||||
|
||||
case actorstypes.Version11:
|
||||
return make11(store, rootKeyAddress)
|
||||
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||
}
|
||||
@ -147,6 +153,7 @@ func AllCodes() []cid.Cid {
|
||||
(&state8{}).Code(),
|
||||
(&state9{}).Code(),
|
||||
(&state10{}).Code(),
|
||||
(&state11{}).Code(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,12 +7,16 @@ import (
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
builtin10 "github.com/filecoin-project/go-state-types/builtin"
|
||||
builtin11 "github.com/filecoin-project/go-state-types/builtin"
|
||||
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||
builtin9 "github.com/filecoin-project/go-state-types/builtin"
|
||||
market10 "github.com/filecoin-project/go-state-types/builtin/v10/market"
|
||||
miner10 "github.com/filecoin-project/go-state-types/builtin/v10/miner"
|
||||
paych10 "github.com/filecoin-project/go-state-types/builtin/v10/paych"
|
||||
verifreg10 "github.com/filecoin-project/go-state-types/builtin/v10/verifreg"
|
||||
market11 "github.com/filecoin-project/go-state-types/builtin/v11/market"
|
||||
miner11 "github.com/filecoin-project/go-state-types/builtin/v11/miner"
|
||||
paych11 "github.com/filecoin-project/go-state-types/builtin/v11/paych"
|
||||
verifreg11 "github.com/filecoin-project/go-state-types/builtin/v11/verifreg"
|
||||
market8 "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||
miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||
verifreg8 "github.com/filecoin-project/go-state-types/builtin/v8/verifreg"
|
||||
@ -51,10 +55,10 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
ChainFinality = miner10.ChainFinality
|
||||
ChainFinality = miner11.ChainFinality
|
||||
SealRandomnessLookback = ChainFinality
|
||||
PaychSettleDelay = paych10.SettleDelay
|
||||
MaxPreCommitRandomnessLookback = builtin10.EpochsInDay + SealRandomnessLookback
|
||||
PaychSettleDelay = paych11.SettleDelay
|
||||
MaxPreCommitRandomnessLookback = builtin11.EpochsInDay + SealRandomnessLookback
|
||||
)
|
||||
|
||||
// SetSupportedProofTypes sets supported proof types, across all actor versions.
|
||||
@ -165,11 +169,13 @@ func SetPreCommitChallengeDelay(delay abi.ChainEpoch) {
|
||||
|
||||
miner10.PreCommitChallengeDelay = delay
|
||||
|
||||
miner11.PreCommitChallengeDelay = delay
|
||||
|
||||
}
|
||||
|
||||
// TODO: this function shouldn't really exist. Instead, the API should expose the precommit delay.
|
||||
func GetPreCommitChallengeDelay() abi.ChainEpoch {
|
||||
return miner10.PreCommitChallengeDelay
|
||||
return miner11.PreCommitChallengeDelay
|
||||
}
|
||||
|
||||
// SetConsensusMinerMinPower sets the minimum power of an individual miner must
|
||||
@ -215,6 +221,10 @@ func SetConsensusMinerMinPower(p abi.StoragePower) {
|
||||
policy.ConsensusMinerMinPower = p
|
||||
}
|
||||
|
||||
for _, policy := range builtin11.PoStProofPolicies {
|
||||
policy.ConsensusMinerMinPower = p
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// SetMinVerifiedDealSize sets the minimum size of a verified deal. This should
|
||||
@ -241,6 +251,8 @@ func SetMinVerifiedDealSize(size abi.StoragePower) {
|
||||
|
||||
verifreg10.MinVerifiedDealSize = size
|
||||
|
||||
verifreg11.MinVerifiedDealSize = size
|
||||
|
||||
}
|
||||
|
||||
func GetMaxProveCommitDuration(ver actorstypes.Version, t abi.RegisteredSealProof) (abi.ChainEpoch, error) {
|
||||
@ -286,6 +298,10 @@ func GetMaxProveCommitDuration(ver actorstypes.Version, t abi.RegisteredSealProo
|
||||
|
||||
return miner10.MaxProveCommitDuration[t], nil
|
||||
|
||||
case actorstypes.Version11:
|
||||
|
||||
return miner11.MaxProveCommitDuration[t], nil
|
||||
|
||||
default:
|
||||
return 0, xerrors.Errorf("unsupported actors version")
|
||||
}
|
||||
@ -341,6 +357,11 @@ func SetProviderCollateralSupplyTarget(num, denom big.Int) {
|
||||
Denominator: denom,
|
||||
}
|
||||
|
||||
market11.ProviderCollateralSupplyTarget = builtin11.BigFrac{
|
||||
Numerator: num,
|
||||
Denominator: denom,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func DealProviderCollateralBounds(
|
||||
@ -404,13 +425,18 @@ func DealProviderCollateralBounds(
|
||||
min, max := market10.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
||||
return min, max, nil
|
||||
|
||||
case actorstypes.Version11:
|
||||
|
||||
min, max := market11.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
||||
return min, max, nil
|
||||
|
||||
default:
|
||||
return big.Zero(), big.Zero(), xerrors.Errorf("unsupported actors version")
|
||||
}
|
||||
}
|
||||
|
||||
func DealDurationBounds(pieceSize abi.PaddedPieceSize) (min, max abi.ChainEpoch) {
|
||||
return market10.DealDurationBounds(pieceSize)
|
||||
return market11.DealDurationBounds(pieceSize)
|
||||
}
|
||||
|
||||
// Sets the challenge window and scales the proving period to match (such that
|
||||
@ -479,6 +505,13 @@ func SetWPoStChallengeWindow(period abi.ChainEpoch) {
|
||||
// scale it if we're scaling the challenge period.
|
||||
miner10.WPoStDisputeWindow = period * 30
|
||||
|
||||
miner11.WPoStChallengeWindow = period
|
||||
miner11.WPoStProvingPeriod = period * abi.ChainEpoch(miner11.WPoStPeriodDeadlines)
|
||||
|
||||
// by default, this is 2x finality which is 30 periods.
|
||||
// scale it if we're scaling the challenge period.
|
||||
miner11.WPoStDisputeWindow = period * 30
|
||||
|
||||
}
|
||||
|
||||
func GetWinningPoStSectorSetLookback(nwVer network.Version) abi.ChainEpoch {
|
||||
@ -491,15 +524,15 @@ func GetWinningPoStSectorSetLookback(nwVer network.Version) abi.ChainEpoch {
|
||||
}
|
||||
|
||||
func GetMaxSectorExpirationExtension() abi.ChainEpoch {
|
||||
return miner10.MaxSectorExpirationExtension
|
||||
return miner11.MaxSectorExpirationExtension
|
||||
}
|
||||
|
||||
func GetMinSectorExpiration() abi.ChainEpoch {
|
||||
return miner10.MinSectorExpiration
|
||||
return miner11.MinSectorExpiration
|
||||
}
|
||||
|
||||
func GetMaxPoStPartitions(nv network.Version, p abi.RegisteredPoStProof) (int, error) {
|
||||
sectorsPerPart, err := builtin10.PoStProofWindowPoStPartitionSectors(p)
|
||||
sectorsPerPart, err := builtin11.PoStProofWindowPoStPartitionSectors(p)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@ -519,7 +552,7 @@ func GetSectorMaxLifetime(proof abi.RegisteredSealProof, nwVer network.Version)
|
||||
return builtin4.SealProofPoliciesV0[proof].SectorMaxLifetime
|
||||
}
|
||||
|
||||
return builtin10.SealProofPoliciesV11[proof].SectorMaxLifetime
|
||||
return builtin11.SealProofPoliciesV11[proof].SectorMaxLifetime
|
||||
}
|
||||
|
||||
func GetAddressedSectorsMax(nwVer network.Version) (int, error) {
|
||||
@ -559,6 +592,9 @@ func GetAddressedSectorsMax(nwVer network.Version) (int, error) {
|
||||
case actorstypes.Version10:
|
||||
return miner10.AddressedSectorsMax, nil
|
||||
|
||||
case actorstypes.Version11:
|
||||
return miner11.AddressedSectorsMax, nil
|
||||
|
||||
default:
|
||||
return 0, xerrors.Errorf("unsupported network version")
|
||||
}
|
||||
@ -612,6 +648,10 @@ func GetDeclarationsMax(nwVer network.Version) (int, error) {
|
||||
|
||||
return miner10.DeclarationsMax, nil
|
||||
|
||||
case actorstypes.Version11:
|
||||
|
||||
return miner11.DeclarationsMax, nil
|
||||
|
||||
default:
|
||||
return 0, xerrors.Errorf("unsupported network version")
|
||||
}
|
||||
@ -664,6 +704,10 @@ func AggregateProveCommitNetworkFee(nwVer network.Version, aggregateSize int, ba
|
||||
|
||||
return miner10.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
|
||||
|
||||
case actorstypes.Version11:
|
||||
|
||||
return miner11.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
|
||||
|
||||
default:
|
||||
return big.Zero(), xerrors.Errorf("unsupported network version")
|
||||
}
|
||||
@ -716,6 +760,10 @@ func AggregatePreCommitNetworkFee(nwVer network.Version, aggregateSize int, base
|
||||
|
||||
return miner10.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
|
||||
|
||||
case actorstypes.Version11:
|
||||
|
||||
return miner11.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
|
||||
|
||||
default:
|
||||
return big.Zero(), xerrors.Errorf("unsupported network version")
|
||||
}
|
||||
|
@ -14,9 +14,9 @@ const ({{range .actorVersions}}
|
||||
|
||||
/* inline-gen start */
|
||||
|
||||
var LatestVersion = 10
|
||||
var LatestVersion = 11
|
||||
|
||||
var Versions = []int{0, 2, 3, 4, 5, 6, 7, 8, 9, 10}
|
||||
var Versions = []int{0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
|
||||
|
||||
const (
|
||||
Version0 Version = 0
|
||||
@ -29,6 +29,7 @@ const (
|
||||
Version8 Version = 8
|
||||
Version9 Version = 9
|
||||
Version10 Version = 10
|
||||
Version11 Version = 11
|
||||
)
|
||||
|
||||
/* inline-gen end */
|
||||
|
@ -51,6 +51,7 @@ func NewActorRegistry() *vm.ActorRegistry {
|
||||
inv.Register(actorstypes.Version8, vm.ActorsVersionPredicate(actorstypes.Version8), builtin.MakeRegistry(actorstypes.Version8))
|
||||
inv.Register(actorstypes.Version9, vm.ActorsVersionPredicate(actorstypes.Version9), builtin.MakeRegistry(actorstypes.Version9))
|
||||
inv.Register(actorstypes.Version10, vm.ActorsVersionPredicate(actorstypes.Version10), builtin.MakeRegistry(actorstypes.Version10))
|
||||
inv.Register(actorstypes.Version11, vm.ActorsVersionPredicate(actorstypes.Version11), builtin.MakeRegistry(actorstypes.Version11))
|
||||
|
||||
return inv
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
nv18 "github.com/filecoin-project/go-state-types/builtin/v10/migration"
|
||||
nv19 "github.com/filecoin-project/go-state-types/builtin/v11/migration"
|
||||
nv17 "github.com/filecoin-project/go-state-types/builtin/v9/migration"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
"github.com/filecoin-project/go-state-types/migration"
|
||||
@ -245,6 +246,21 @@ func DefaultUpgradeSchedule() stmgr.UpgradeSchedule {
|
||||
StopWithin: 5,
|
||||
}},
|
||||
Expensive: true,
|
||||
}, {
|
||||
Height: build.UpgradeLightningHeight,
|
||||
Network: network.Version19,
|
||||
Migration: UpgradeActorsV11,
|
||||
PreMigrations: []stmgr.PreMigration{{
|
||||
PreMigration: PreUpgradeActorsV11,
|
||||
StartWithin: 120,
|
||||
DontStartWithin: 15,
|
||||
StopWithin: 10,
|
||||
}},
|
||||
Expensive: true,
|
||||
}, {
|
||||
Height: build.UpgradeThunderHeight,
|
||||
Network: network.Version20,
|
||||
Migration: nil,
|
||||
},
|
||||
}
|
||||
|
||||
@ -1588,29 +1604,6 @@ func upgradeActorsV9Common(
|
||||
return newRoot, nil
|
||||
}
|
||||
|
||||
func UpgradeActorsV10(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, cb stmgr.ExecMonitor,
|
||||
root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error) {
|
||||
// Use all the CPUs except 3.
|
||||
workerCount := MigrationMaxWorkerCount - 3
|
||||
if workerCount <= 0 {
|
||||
workerCount = 1
|
||||
}
|
||||
|
||||
config := migration.Config{
|
||||
MaxWorkers: uint(workerCount),
|
||||
JobQueueSize: 1000,
|
||||
ResultQueueSize: 100,
|
||||
ProgressLogPeriod: 10 * time.Second,
|
||||
}
|
||||
|
||||
newRoot, err := upgradeActorsV10Common(ctx, sm, cache, root, epoch, ts, config)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("migrating actors v10 state: %w", err)
|
||||
}
|
||||
|
||||
return newRoot, nil
|
||||
}
|
||||
|
||||
func PreUpgradeActorsV10(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) error {
|
||||
// Use half the CPUs for pre-migration, but leave at least 3.
|
||||
workerCount := MigrationMaxWorkerCount
|
||||
@ -1634,6 +1627,29 @@ func PreUpgradeActorsV10(ctx context.Context, sm *stmgr.StateManager, cache stmg
|
||||
return err
|
||||
}
|
||||
|
||||
func UpgradeActorsV10(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, cb stmgr.ExecMonitor,
|
||||
root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error) {
|
||||
// Use all the CPUs except 3.
|
||||
workerCount := MigrationMaxWorkerCount - 3
|
||||
if workerCount <= 0 {
|
||||
workerCount = 1
|
||||
}
|
||||
|
||||
config := migration.Config{
|
||||
MaxWorkers: uint(workerCount),
|
||||
JobQueueSize: 1000,
|
||||
ResultQueueSize: 100,
|
||||
ProgressLogPeriod: 10 * time.Second,
|
||||
}
|
||||
|
||||
newRoot, err := upgradeActorsV10Common(ctx, sm, cache, root, epoch, ts, config)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("migrating actors v10 state: %w", err)
|
||||
}
|
||||
|
||||
return newRoot, nil
|
||||
}
|
||||
|
||||
func upgradeActorsV10Common(
|
||||
ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache,
|
||||
root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet,
|
||||
@ -1696,6 +1712,108 @@ func upgradeActorsV10Common(
|
||||
return newRoot, nil
|
||||
}
|
||||
|
||||
func PreUpgradeActorsV11(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) error {
|
||||
// Use half the CPUs for pre-migration, but leave at least 3.
|
||||
workerCount := MigrationMaxWorkerCount
|
||||
if workerCount <= 4 {
|
||||
workerCount = 1
|
||||
} else {
|
||||
workerCount /= 2
|
||||
}
|
||||
|
||||
lbts, lbRoot, err := stmgr.GetLookbackTipSetForRound(ctx, sm, ts, epoch)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("error getting lookback ts for premigration: %w", err)
|
||||
}
|
||||
|
||||
config := migration.Config{
|
||||
MaxWorkers: uint(workerCount),
|
||||
ProgressLogPeriod: time.Minute * 5,
|
||||
}
|
||||
|
||||
_, err = upgradeActorsV11Common(ctx, sm, cache, lbRoot, epoch, lbts, config)
|
||||
return err
|
||||
}
|
||||
|
||||
func UpgradeActorsV11(ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, cb stmgr.ExecMonitor,
|
||||
root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error) {
|
||||
// Use all the CPUs except 2.
|
||||
workerCount := MigrationMaxWorkerCount - 3
|
||||
if workerCount <= 0 {
|
||||
workerCount = 1
|
||||
}
|
||||
config := migration.Config{
|
||||
MaxWorkers: uint(workerCount),
|
||||
JobQueueSize: 1000,
|
||||
ResultQueueSize: 100,
|
||||
ProgressLogPeriod: 10 * time.Second,
|
||||
}
|
||||
newRoot, err := upgradeActorsV11Common(ctx, sm, cache, root, epoch, ts, config)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("migrating actors v11 state: %w", err)
|
||||
}
|
||||
return newRoot, nil
|
||||
}
|
||||
|
||||
func upgradeActorsV11Common(
|
||||
ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache,
|
||||
root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet,
|
||||
config migration.Config,
|
||||
) (cid.Cid, error) {
|
||||
writeStore := blockstore.NewAutobatch(ctx, sm.ChainStore().StateBlockstore(), units.GiB/4)
|
||||
adtStore := store.ActorStore(ctx, writeStore)
|
||||
// ensure that the manifest is loaded in the blockstore
|
||||
if err := bundle.LoadBundles(ctx, writeStore, actorstypes.Version11); err != nil {
|
||||
return cid.Undef, xerrors.Errorf("failed to load manifest bundle: %w", err)
|
||||
}
|
||||
|
||||
// Load the state root.
|
||||
var stateRoot types.StateRoot
|
||||
if err := adtStore.Get(ctx, root, &stateRoot); err != nil {
|
||||
return cid.Undef, xerrors.Errorf("failed to decode state root: %w", err)
|
||||
}
|
||||
|
||||
if stateRoot.Version != types.StateTreeVersion5 {
|
||||
return cid.Undef, xerrors.Errorf(
|
||||
"expected state root version 5 for actors v11 upgrade, got %d",
|
||||
stateRoot.Version,
|
||||
)
|
||||
}
|
||||
|
||||
manifest, ok := actors.GetManifest(actorstypes.Version11)
|
||||
if !ok {
|
||||
return cid.Undef, xerrors.Errorf("no manifest CID for v11 upgrade")
|
||||
}
|
||||
|
||||
// Perform the migration
|
||||
newHamtRoot, err := nv19.MigrateStateTree(ctx, adtStore, manifest, stateRoot.Actors, epoch, config,
|
||||
migrationLogger{}, cache)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("upgrading to actors v11: %w", err)
|
||||
}
|
||||
|
||||
// Persist the result.
|
||||
newRoot, err := adtStore.Put(ctx, &types.StateRoot{
|
||||
Version: types.StateTreeVersion5,
|
||||
Actors: newHamtRoot,
|
||||
Info: stateRoot.Info,
|
||||
})
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("failed to persist new state root: %w", err)
|
||||
}
|
||||
|
||||
// Persists the new tree and shuts down the flush worker
|
||||
if err := writeStore.Flush(ctx); err != nil {
|
||||
return cid.Undef, xerrors.Errorf("writeStore flush failed: %w", err)
|
||||
}
|
||||
|
||||
if err := writeStore.Shutdown(ctx); err != nil {
|
||||
return cid.Undef, xerrors.Errorf("writeStore shutdown failed: %w", err)
|
||||
}
|
||||
|
||||
return newRoot, nil
|
||||
}
|
||||
|
||||
// Example upgrade function if upgrade requires only code changes
|
||||
//func UpgradeActorsV9(ctx context.Context, sm *stmgr.StateManager, _ stmgr.MigrationCache, _ stmgr.ExecMonitor, root cid.Cid, _ abi.ChainEpoch, _ *types.TipSet) (cid.Cid, error) {
|
||||
// buf := blockstore.NewTieredBstore(sm.ChainStore().StateBlockstore(), blockstore.NewMemorySync())
|
||||
|
@ -17,6 +17,7 @@ import (
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||
power11 "github.com/filecoin-project/go-state-types/builtin/v11/power"
|
||||
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||
miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
@ -27,6 +28,7 @@ import (
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
|
||||
power2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/power"
|
||||
reward2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/reward"
|
||||
power4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/power"
|
||||
reward4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/reward"
|
||||
@ -135,14 +137,32 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sys vm.Syscal
|
||||
}
|
||||
|
||||
{
|
||||
constructorParams := &power0.CreateMinerParams{
|
||||
Owner: m.Worker,
|
||||
Worker: m.Worker,
|
||||
Peer: []byte(m.PeerId),
|
||||
SealProofType: spt,
|
||||
var params []byte
|
||||
if nv <= network.Version10 {
|
||||
constructorParams := &power2.CreateMinerParams{
|
||||
Owner: m.Worker,
|
||||
Worker: m.Worker,
|
||||
Peer: []byte(m.PeerId),
|
||||
SealProofType: spt,
|
||||
}
|
||||
|
||||
params = mustEnc(constructorParams)
|
||||
} else {
|
||||
ppt, err := spt.RegisteredWindowPoStProofByNetworkVersion(nv)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("failed to convert spt to wpt: %w", err)
|
||||
}
|
||||
|
||||
constructorParams := &power11.CreateMinerParams{
|
||||
Owner: m.Worker,
|
||||
Worker: m.Worker,
|
||||
Peer: []byte(m.PeerId),
|
||||
WindowPoStProofType: ppt,
|
||||
}
|
||||
|
||||
params = mustEnc(constructorParams)
|
||||
}
|
||||
|
||||
params := mustEnc(constructorParams)
|
||||
rval, err := doExecValue(ctx, genesisVm, power.Address, m.Owner, m.PowerBalance, power.Methods.CreateMiner, params)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("failed to create genesis miner: %w", err)
|
||||
|
@ -156,7 +156,7 @@ func VersionForNetwork(ver network.Version) (types.StateTreeVersion, error) {
|
||||
case network.Version13, network.Version14, network.Version15, network.Version16, network.Version17:
|
||||
return types.StateTreeVersion4, nil
|
||||
|
||||
case network.Version18:
|
||||
case network.Version18, network.Version19, network.Version20:
|
||||
return types.StateTreeVersion5, nil
|
||||
|
||||
default:
|
||||
|
@ -406,8 +406,18 @@ var sealBenchCmd = &cli.Command{
|
||||
}
|
||||
verifyWinningPost2 := time.Now()
|
||||
|
||||
ppt, err := sealedSectors[0].SealProof.RegisteredWindowPoStProof()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ppt, err = ppt.ToV1_1PostProof()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Info("computing window post snark (cold)")
|
||||
wproof1, _, err := sb.GenerateWindowPoSt(context.TODO(), mid, extendedSealedSectors, challenge[:])
|
||||
wproof1, _, err := sb.GenerateWindowPoSt(context.TODO(), mid, ppt, extendedSealedSectors, challenge[:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -415,7 +425,7 @@ var sealBenchCmd = &cli.Command{
|
||||
windowpost1 := time.Now()
|
||||
|
||||
log.Info("computing window post snark (hot)")
|
||||
wproof2, _, err := sb.GenerateWindowPoSt(context.TODO(), mid, extendedSealedSectors, challenge[:])
|
||||
wproof2, _, err := sb.GenerateWindowPoSt(context.TODO(), mid, ppt, extendedSealedSectors, challenge[:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -713,7 +713,11 @@ func createStorageMiner(ctx context.Context, api v1api.FullNode, ssize abi.Secto
|
||||
}
|
||||
|
||||
// Note: the correct thing to do would be to call SealProofTypeFromSectorSize if actors version is v3 or later, but this still works
|
||||
spt, err := miner.WindowPoStProofTypeFromSectorSize(ssize)
|
||||
nv, err := api.StateNetworkVersion(ctx, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return address.Undef, xerrors.Errorf("failed to get network version: %w", err)
|
||||
}
|
||||
spt, err := miner.WindowPoStProofTypeFromSectorSize(ssize, nv)
|
||||
if err != nil {
|
||||
return address.Undef, xerrors.Errorf("getting post proof type: %w", err)
|
||||
}
|
||||
|
@ -2,21 +2,28 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/ipfs/go-datastore"
|
||||
dsq "github.com/ipfs/go-datastore/query"
|
||||
levelds "github.com/ipfs/go-ds-leveldb"
|
||||
ipldcbor "github.com/ipfs/go-ipld-cbor"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
ldbopts "github.com/syndtr/goleveldb/leveldb/opt"
|
||||
"github.com/urfave/cli/v2"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/builtin"
|
||||
market11 "github.com/filecoin-project/go-state-types/builtin/v11/market"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v11/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
@ -34,6 +41,85 @@ var marketCmd = &cli.Command{
|
||||
marketExportDatastoreCmd,
|
||||
marketImportDatastoreCmd,
|
||||
marketDealsTotalStorageCmd,
|
||||
marketCronStateCmd,
|
||||
},
|
||||
}
|
||||
|
||||
var marketCronStateCmd = &cli.Command{
|
||||
Name: "cron-state",
|
||||
Usage: "Display summary of all deal operation state scheduled for cron processing",
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "tipset",
|
||||
Usage: "specify tipset to call method on (pass comma separated array of cids)",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
api, closer, err := lcli.GetFullNodeAPI(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closer()
|
||||
ts, err := lcli.LoadTipSet(ctx, cctx, api)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
a, err := api.StateReadState(ctx, builtin.StorageMarketActorAddr, ts.Key())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
st, ok := a.State.(map[string]interface{})
|
||||
if !ok {
|
||||
return xerrors.Errorf("failed to cast state map to expected form")
|
||||
}
|
||||
dealOpsRaw, ok := st["DealOpsByEpoch"].(map[string]interface{})
|
||||
if !ok {
|
||||
return xerrors.Errorf("failed to read sectors root from state")
|
||||
}
|
||||
// string is of the form "/:bafy.." so [2:] to drop the path
|
||||
dealOpsRoot, err := cid.Parse(dealOpsRaw["/"])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
bs := ReadOnlyAPIBlockstore{api}
|
||||
adtStore := adt.WrapStore(ctx, ipldcbor.NewCborStore(&bs))
|
||||
dealOpsEpochSet, err := adt.AsMap(adtStore, dealOpsRoot, builtin.DefaultHamtBitwidth)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dealOpsRecord := make(map[uint64][]abi.DealID)
|
||||
if err := dealOpsEpochSet.ForEach(&cbg.Deferred{}, func(eKey string) error {
|
||||
e, err := abi.ParseUIntKey(eKey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dealOpsRecord[e] = make([]abi.DealID, 0)
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
dealOpsMultiMap, err := market11.AsSetMultimap(adtStore, dealOpsRoot, builtin.DefaultHamtBitwidth, builtin.DefaultHamtBitwidth)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for e := range dealOpsRecord {
|
||||
e := e
|
||||
err := dealOpsMultiMap.ForEach(abi.ChainEpoch(e), func(id abi.DealID) error {
|
||||
dealOpsRecord[e] = append(dealOpsRecord[e], id)
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
jsonStr, err := json.Marshal(dealOpsRecord)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("%s\n", jsonStr)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,8 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
@ -19,6 +20,7 @@ import (
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/builtin"
|
||||
v10 "github.com/filecoin-project/go-state-types/builtin/v10"
|
||||
v11 "github.com/filecoin-project/go-state-types/builtin/v11"
|
||||
market8 "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
|
||||
v9 "github.com/filecoin-project/go-state-types/builtin/v9"
|
||||
@ -32,6 +34,8 @@ import (
|
||||
"github.com/filecoin-project/specs-actors/v7/actors/migration/nv15"
|
||||
|
||||
"github.com/filecoin-project/lotus/blockstore"
|
||||
badgerbs "github.com/filecoin-project/lotus/blockstore/badger"
|
||||
"github.com/filecoin-project/lotus/blockstore/splitstore"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
lbuiltin "github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
@ -101,24 +105,52 @@ var migrationsCmd = &cli.Command{
|
||||
|
||||
defer lkrepo.Close() //nolint:errcheck
|
||||
|
||||
bs, err := lkrepo.Blockstore(ctx, repo.UniversalBlockstore)
|
||||
cold, err := lkrepo.Blockstore(ctx, repo.UniversalBlockstore)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open blockstore: %w", err)
|
||||
return fmt.Errorf("failed to open universal blockstore %w", err)
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if c, ok := bs.(io.Closer); ok {
|
||||
if err := c.Close(); err != nil {
|
||||
log.Warnf("failed to close blockstore: %s", err)
|
||||
}
|
||||
}
|
||||
}()
|
||||
path, err := lkrepo.SplitstorePath()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
path = filepath.Join(path, "hot.badger")
|
||||
if err := os.MkdirAll(path, 0755); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
opts, err := repo.BadgerBlockstoreOptions(repo.HotBlockstore, path, lkrepo.Readonly())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
hot, err := badgerbs.Open(opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mds, err := lkrepo.Datastore(context.Background(), "/metadata")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cfg := &splitstore.Config{
|
||||
MarkSetType: "map",
|
||||
DiscardColdBlocks: true,
|
||||
}
|
||||
ss, err := splitstore.Open(path, mds, hot, cold, cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if err := ss.Close(); err != nil {
|
||||
log.Warnf("failed to close blockstore: %s", err)
|
||||
|
||||
}
|
||||
}()
|
||||
bs := ss
|
||||
|
||||
cs := store.NewChainStore(bs, bs, mds, filcns.Weight, nil)
|
||||
defer cs.Close() //nolint:errcheck
|
||||
|
||||
@ -168,6 +200,7 @@ var migrationsCmd = &cli.Command{
|
||||
}
|
||||
|
||||
preMigrationTime := time.Since(startTime)
|
||||
fmt.Println("completed premigration, took ", preMigrationTime)
|
||||
|
||||
startTime = time.Now()
|
||||
|
||||
@ -182,7 +215,7 @@ var migrationsCmd = &cli.Command{
|
||||
return xerrors.Errorf("got different results with and without the cache: %s, %s", newCid1,
|
||||
newCid2)
|
||||
}
|
||||
fmt.Println("completed premigration, took ", preMigrationTime)
|
||||
|
||||
fmt.Println("completed round actual (with cache), took ", cachedMigrationTime)
|
||||
}
|
||||
|
||||
@ -206,6 +239,8 @@ func getMigrationFuncsForNetwork(nv network.Version) (UpgradeActorsFunc, PreUpgr
|
||||
return filcns.UpgradeActorsV9, filcns.PreUpgradeActorsV9, checkNv17Invariants, nil
|
||||
case network.Version18:
|
||||
return filcns.UpgradeActorsV10, filcns.PreUpgradeActorsV10, checkNv18Invariants, nil
|
||||
case network.Version19:
|
||||
return filcns.UpgradeActorsV11, filcns.PreUpgradeActorsV11, checkNv19Invariants, nil
|
||||
default:
|
||||
return nil, nil, nil, xerrors.Errorf("migration not implemented for nv%d", nv)
|
||||
}
|
||||
@ -215,6 +250,39 @@ type UpgradeActorsFunc = func(context.Context, *stmgr.StateManager, stmgr.Migrat
|
||||
type PreUpgradeActorsFunc = func(context.Context, *stmgr.StateManager, stmgr.MigrationCache, cid.Cid, abi.ChainEpoch, *types.TipSet) error
|
||||
type CheckInvariantsFunc = func(context.Context, cid.Cid, cid.Cid, blockstore.Blockstore, abi.ChainEpoch) error
|
||||
|
||||
func checkNv19Invariants(ctx context.Context, oldStateRootCid cid.Cid, newStateRootCid cid.Cid, bs blockstore.Blockstore, epoch abi.ChainEpoch) error {
|
||||
|
||||
actorStore := store.ActorStore(ctx, bs)
|
||||
startTime := time.Now()
|
||||
|
||||
// Load the new state root.
|
||||
var newStateRoot types.StateRoot
|
||||
if err := actorStore.Get(ctx, newStateRootCid, &newStateRoot); err != nil {
|
||||
return xerrors.Errorf("failed to decode state root: %w", err)
|
||||
}
|
||||
|
||||
actorCodeCids, err := actors.GetActorCodeIDs(actorstypes.Version11)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
newActorTree, err := builtin.LoadTree(actorStore, newStateRoot.Actors)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
messages, err := v11.CheckStateInvariants(newActorTree, epoch, actorCodeCids)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("checking state invariants: %w", err)
|
||||
}
|
||||
|
||||
for _, message := range messages.Messages() {
|
||||
fmt.Println("got the following error: ", message)
|
||||
}
|
||||
|
||||
fmt.Println("completed invariant checks, took ", time.Since(startTime))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func checkNv18Invariants(ctx context.Context, oldStateRootCid cid.Cid, newStateRootCid cid.Cid, bs blockstore.Blockstore, epoch abi.ChainEpoch) error {
|
||||
actorStore := store.ActorStore(ctx, bs)
|
||||
startTime := time.Now()
|
||||
|
@ -3,16 +3,21 @@ package main
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/go-units"
|
||||
"github.com/ipfs/go-cid"
|
||||
ipldcbor "github.com/ipfs/go-ipld-cbor"
|
||||
block "github.com/ipfs/go-libipfs/blocks"
|
||||
"github.com/mitchellh/go-homedir"
|
||||
"github.com/urfave/cli/v2"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
@ -20,11 +25,13 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/builtin"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v11/util/adt"
|
||||
miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
power7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/power"
|
||||
"github.com/filecoin-project/specs-actors/v7/actors/runtime/proof"
|
||||
|
||||
"github.com/filecoin-project/lotus/api/v0api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
@ -42,6 +49,93 @@ var minerCmd = &cli.Command{
|
||||
minerFaultsCmd,
|
||||
sendInvalidWindowPoStCmd,
|
||||
generateAndSendConsensusFaultCmd,
|
||||
sectorInfoCmd,
|
||||
},
|
||||
}
|
||||
|
||||
var _ ipldcbor.IpldBlockstore = new(ReadOnlyAPIBlockstore)
|
||||
|
||||
type ReadOnlyAPIBlockstore struct {
|
||||
v0api.FullNode
|
||||
}
|
||||
|
||||
func (b *ReadOnlyAPIBlockstore) Get(ctx context.Context, c cid.Cid) (block.Block, error) {
|
||||
bs, err := b.ChainReadObj(ctx, c)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return block.NewBlock(bs), nil
|
||||
}
|
||||
|
||||
func (b *ReadOnlyAPIBlockstore) Put(context.Context, block.Block) error {
|
||||
return xerrors.Errorf("cannot put block, the backing blockstore is readonly")
|
||||
}
|
||||
|
||||
var sectorInfoCmd = &cli.Command{
|
||||
Name: "sectorinfo",
|
||||
Usage: "Display cbor of sector info at <minerAddress> <sectorNumber>",
|
||||
ArgsUsage: "[minerAddress] [sector number]",
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "tipset",
|
||||
Usage: "specify tipset to call method on (pass comma separated array of cids)",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.Args().Len() != 2 {
|
||||
return fmt.Errorf("must pass miner address and sector number")
|
||||
}
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
api, closer, err := lcli.GetFullNodeAPI(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closer()
|
||||
maddr, err := address.NewFromString(cctx.Args().First())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sn, err := strconv.ParseUint(cctx.Args().Slice()[1], 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ts, err := lcli.LoadTipSet(ctx, cctx, api)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
a, err := api.StateReadState(ctx, maddr, ts.Key())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
st, ok := a.State.(map[string]interface{})
|
||||
if !ok {
|
||||
return xerrors.Errorf("failed to cast state map to expected form")
|
||||
}
|
||||
sectorsRaw, ok := st["Sectors"].(map[string]interface{})
|
||||
if !ok {
|
||||
return xerrors.Errorf("failed to read sectors root from state")
|
||||
}
|
||||
// string is of the form "/:bafy.." so [2:] to drop the path
|
||||
sectorsRoot, err := cid.Parse(sectorsRaw["/"])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
bs := ReadOnlyAPIBlockstore{api}
|
||||
sectorsAMT, err := adt.AsArray(adt.WrapStore(ctx, ipldcbor.NewCborStore(&bs)), sectorsRoot, miner8.SectorsAmtBitwidth)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
out := cbg.Deferred{}
|
||||
found, err := sectorsAMT.Get(sn, &out)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !found {
|
||||
return xerrors.Errorf("sector number %d not found", sn)
|
||||
}
|
||||
fmt.Printf("%x\n", out.Raw)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
@ -216,7 +310,11 @@ var minerCreateCmd = &cli.Command{
|
||||
}
|
||||
|
||||
// Note: the correct thing to do would be to call SealProofTypeFromSectorSize if actors version is v3 or later, but this still works
|
||||
spt, err := miner.WindowPoStProofTypeFromSectorSize(abi.SectorSize(ssize))
|
||||
nv, err := wapi.StateNetworkVersion(ctx, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to get network version: %w", err)
|
||||
}
|
||||
spt, err := miner.WindowPoStProofTypeFromSectorSize(abi.SectorSize(ssize), nv)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getting post proof type: %w", err)
|
||||
}
|
||||
|
@ -5442,7 +5442,9 @@ Response:
|
||||
"UpgradeOhSnapHeight": 10101,
|
||||
"UpgradeSkyrHeight": 10101,
|
||||
"UpgradeSharkHeight": 10101,
|
||||
"UpgradeHyggeHeight": 10101
|
||||
"UpgradeHyggeHeight": 10101,
|
||||
"UpgradeLightningHeight": 10101,
|
||||
"UpgradeThunderHeight": 10101
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -6942,7 +6942,9 @@ Response:
|
||||
"UpgradeOhSnapHeight": 10101,
|
||||
"UpgradeSkyrHeight": 10101,
|
||||
"UpgradeSharkHeight": 10101,
|
||||
"UpgradeHyggeHeight": 10101
|
||||
"UpgradeHyggeHeight": 10101,
|
||||
"UpgradeLightningHeight": 10101,
|
||||
"UpgradeThunderHeight": 10101
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -7,7 +7,7 @@ USAGE:
|
||||
lotus-miner [global options] command [command options] [arguments...]
|
||||
|
||||
VERSION:
|
||||
1.21.0-rc3
|
||||
1.23.0-rc1
|
||||
|
||||
COMMANDS:
|
||||
init Initialize a lotus miner repo
|
||||
|
@ -7,7 +7,7 @@ USAGE:
|
||||
lotus-worker [global options] command [command options] [arguments...]
|
||||
|
||||
VERSION:
|
||||
1.21.0-rc3
|
||||
1.23.0-rc1
|
||||
|
||||
COMMANDS:
|
||||
run Start lotus worker
|
||||
|
@ -7,7 +7,7 @@ USAGE:
|
||||
lotus [global options] command [command options] [arguments...]
|
||||
|
||||
VERSION:
|
||||
1.21.0-rc3
|
||||
1.23.0-rc1
|
||||
|
||||
COMMANDS:
|
||||
daemon Start a lotus daemon process
|
||||
|
@ -4,11 +4,9 @@
|
||||
- [ ] Define upgrade heights in `build/params_`
|
||||
- [ ] Generate adapters
|
||||
- [ ] Update `gen/inlinegen-data.json`
|
||||
- [ ] Update `chain/actors/version.go`
|
||||
- [ ] Update adapter code in `chain/actors/builtin` if needed
|
||||
- [ ] Run `make actors-gen`
|
||||
- [ ] Update `chain/consensus/filcns/upgrades.go`
|
||||
- [ ] Schedule
|
||||
- [ ] Migration
|
||||
- [ ] Update upgrade schedule in `chain/sync_test.go`
|
||||
- [ ] Add upgrade field to `api/types.go/ForkUpgradeParams` and update the implementation of StateGetNetworkParams
|
||||
|
2
extern/filecoin-ffi
vendored
2
extern/filecoin-ffi
vendored
@ -1 +1 @@
|
||||
Subproject commit 28e3cd44d91681c074aba362d1e5c954db110ad9
|
||||
Subproject commit 70bc9fbefd2d4513c45aa1c092c057d1660ca3a8
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"actorVersions": [0, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||
"latestActorsVersion": 10,
|
||||
"actorVersions": [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
|
||||
"latestActorsVersion": 11,
|
||||
|
||||
"networkVersions": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18],
|
||||
"latestNetworkVersion": 18
|
||||
"networkVersions": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
|
||||
"latestNetworkVersion": 20
|
||||
}
|
||||
|
2
go.mod
2
go.mod
@ -45,7 +45,7 @@ require (
|
||||
github.com/filecoin-project/go-jsonrpc v0.2.3
|
||||
github.com/filecoin-project/go-padreader v0.0.1
|
||||
github.com/filecoin-project/go-paramfetch v0.0.4
|
||||
github.com/filecoin-project/go-state-types v0.11.0-alpha-3
|
||||
github.com/filecoin-project/go-state-types v0.11.0-rc2
|
||||
github.com/filecoin-project/go-statemachine v1.0.3
|
||||
github.com/filecoin-project/go-statestore v0.2.0
|
||||
github.com/filecoin-project/go-storedcounter v0.1.0
|
||||
|
27
go.sum
27
go.sum
@ -290,7 +290,6 @@ github.com/filecoin-project/dagstore v0.5.2 h1:Nd6oXdnolbbVhpMpkYT5PJHOjQp4OBSnt
|
||||
github.com/filecoin-project/dagstore v0.5.2/go.mod h1:mdqKzYrRBHf1pRMthYfMv3n37oOw0Tkx7+TxPt240M0=
|
||||
github.com/filecoin-project/go-address v0.0.3/go.mod h1:jr8JxKsYx+lQlQZmF5i2U0Z+cGQ59wMIps/8YW/lDj8=
|
||||
github.com/filecoin-project/go-address v0.0.5/go.mod h1:jr8JxKsYx+lQlQZmF5i2U0Z+cGQ59wMIps/8YW/lDj8=
|
||||
github.com/filecoin-project/go-address v0.0.6/go.mod h1:7B0/5DA13n6nHkB8bbGx1gWzG/dbTsZ0fgOJVGsM3TE=
|
||||
github.com/filecoin-project/go-address v1.1.0 h1:ofdtUtEsNxkIxkDw67ecSmvtzaVSdcea4boAmLbnHfE=
|
||||
github.com/filecoin-project/go-address v1.1.0/go.mod h1:5t3z6qPmIADZBtuE9EIzi0EwzcRy2nVhpo0I/c1r0OA=
|
||||
github.com/filecoin-project/go-amt-ipld/v2 v2.1.0 h1:t6qDiuGYYngDqaLc2ZUvdtAg4UNxPeOYaXhBWSNsVaM=
|
||||
@ -345,10 +344,10 @@ github.com/filecoin-project/go-state-types v0.0.0-20200928172055-2df22083d8ab/go
|
||||
github.com/filecoin-project/go-state-types v0.0.0-20201102161440-c8033295a1fc/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
|
||||
github.com/filecoin-project/go-state-types v0.1.0/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
|
||||
github.com/filecoin-project/go-state-types v0.1.6/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
|
||||
github.com/filecoin-project/go-state-types v0.1.8/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
|
||||
github.com/filecoin-project/go-state-types v0.1.10/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
|
||||
github.com/filecoin-project/go-state-types v0.11.0-alpha-3 h1:LupJwuS2BdUEZbc0Q8N84N43O37XwTREDsdSTpzF1hg=
|
||||
github.com/filecoin-project/go-state-types v0.11.0-alpha-3/go.mod h1:aLIas+W8BWAfpLWEPUOGMPBdhcVwoCG4pIQSQk26024=
|
||||
github.com/filecoin-project/go-state-types v0.11.0-rc1/go.mod h1:SyNPwTsU7I22gL2r0OAPcImvLoTVfgRwdK/Y5rR1zz8=
|
||||
github.com/filecoin-project/go-state-types v0.11.0-rc2 h1:zUx7aRxEGn56n4A1RS2J8FZzpzAozEMsqF11aXjtmkc=
|
||||
github.com/filecoin-project/go-state-types v0.11.0-rc2/go.mod h1:SyNPwTsU7I22gL2r0OAPcImvLoTVfgRwdK/Y5rR1zz8=
|
||||
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig=
|
||||
github.com/filecoin-project/go-statemachine v1.0.3 h1:N07o6alys+V1tNoSTi4WuuoeNC4erS/6jE74+NsgQuk=
|
||||
github.com/filecoin-project/go-statemachine v1.0.3/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54=
|
||||
@ -388,6 +387,7 @@ github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVB
|
||||
github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=
|
||||
github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k=
|
||||
github.com/frankban/quicktest v1.14.0/go.mod h1:NeW+ay9A/U67EYXNFA1nPE8e/tnQv/09mUdL/ijj8og=
|
||||
github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps=
|
||||
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
@ -539,6 +539,7 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
|
||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
|
||||
@ -698,6 +699,7 @@ github.com/ipfs/go-cid v0.0.6/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqg
|
||||
github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I=
|
||||
github.com/ipfs/go-cid v0.1.0/go.mod h1:rH5/Xv83Rfy8Rw6xG+id3DYAMUVmem1MowoKwdXmN2o=
|
||||
github.com/ipfs/go-cid v0.2.0/go.mod h1:P+HXFDF4CVhaVayiEb4wkAy7zBHxBwsJyt0Y5U6MLro=
|
||||
github.com/ipfs/go-cid v0.3.2/go.mod h1:gQ8pKqT/sUxGY+tIwy1RPpAojYu7jAyCp5Tz1svoupw=
|
||||
github.com/ipfs/go-cid v0.4.0 h1:a4pdZq0sx6ZSxbCizebnKiMCx/xI/aBBFlB73IgH4rA=
|
||||
github.com/ipfs/go-cid v0.4.0/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk=
|
||||
github.com/ipfs/go-cidutil v0.1.0 h1:RW5hO7Vcf16dplUU60Hs0AKDkQAVPVplr7lk97CFL+Q=
|
||||
@ -874,6 +876,7 @@ github.com/ipld/go-ipld-prime v0.9.1-0.20210324083106-dc342a9917db/go.mod h1:KvB
|
||||
github.com/ipld/go-ipld-prime v0.10.0/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8=
|
||||
github.com/ipld/go-ipld-prime v0.11.0/go.mod h1:+WIAkokurHmZ/KwzDOMUuoeJgaRQktHtEaLglS3ZeV8=
|
||||
github.com/ipld/go-ipld-prime v0.14.0/go.mod h1:9ASQLwUFLptCov6lIYc70GRB4V7UTyLD0IJtrDJe6ZM=
|
||||
github.com/ipld/go-ipld-prime v0.19.0/go.mod h1:Q9j3BaVXwaA3o5JUDNvptDDr/x8+F7FG6XJ8WI3ILg4=
|
||||
github.com/ipld/go-ipld-prime v0.20.0 h1:Ud3VwE9ClxpO2LkCYP7vWPc0Fo+dYdYzgxUJZ3uRG4g=
|
||||
github.com/ipld/go-ipld-prime v0.20.0/go.mod h1:PzqZ/ZR981eKbgdr3y2DJYeD/8bgMawdGVlJDE8kK+M=
|
||||
github.com/ipld/go-ipld-prime-proto v0.0.0-20191113031812-e32bd156a1e5/go.mod h1:gcvzoEDBjwycpXt3LBE061wT9f46szXGHAmj9uoP6fU=
|
||||
@ -1322,6 +1325,7 @@ github.com/multiformats/go-multibase v0.1.1 h1:3ASCDsuLX8+j4kx58qnJ4YFq/JWTJpCyD
|
||||
github.com/multiformats/go-multibase v0.1.1/go.mod h1:ZEjHE+IsUrgp5mhlEAYjMtZwK1k4haNkcaPg9aoe1a8=
|
||||
github.com/multiformats/go-multicodec v0.3.0/go.mod h1:qGGaQmioCDh+TeFOnxrbU0DaIPw8yFgAZgFG0V7p1qQ=
|
||||
github.com/multiformats/go-multicodec v0.3.1-0.20210902112759-1539a079fd61/go.mod h1:1Hj/eHRaVWSXiSNNfcEPcwZleTmdNP81xlxDLnWU9GQ=
|
||||
github.com/multiformats/go-multicodec v0.6.0/go.mod h1:GUC8upxSBE4oG+q3kWZRw/+6yC1BqO550bjhWsJbZlw=
|
||||
github.com/multiformats/go-multicodec v0.8.0 h1:evBmgkbSQux+Ds2IgfhkO38Dl2GDtRW8/Rp6YiSHX/Q=
|
||||
github.com/multiformats/go-multicodec v0.8.0/go.mod h1:GUC8upxSBE4oG+q3kWZRw/+6yC1BqO550bjhWsJbZlw=
|
||||
github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U=
|
||||
@ -1636,6 +1640,7 @@ github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPU
|
||||
github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU=
|
||||
github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM=
|
||||
github.com/warpfork/go-testmark v0.3.0/go.mod h1:jhEf8FVxd+F17juRubpmut64NEG6I2rgkUhlcqqXwE0=
|
||||
github.com/warpfork/go-testmark v0.10.0/go.mod h1:jhEf8FVxd+F17juRubpmut64NEG6I2rgkUhlcqqXwE0=
|
||||
github.com/warpfork/go-testmark v0.11.0 h1:J6LnV8KpceDvo7spaNU4+DauH2n1x+6RaO2rJrmpQ9U=
|
||||
github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw=
|
||||
github.com/warpfork/go-wish v0.0.0-20190328234359-8b3e70f8e830/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw=
|
||||
@ -1697,6 +1702,7 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
|
||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
github.com/zondax/hid v0.9.0/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM=
|
||||
github.com/zondax/hid v0.9.1 h1:gQe66rtmyZ8VeGFcOpbuH3r7erYtNEAezCAYu8LdkJo=
|
||||
github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM=
|
||||
@ -1821,8 +1827,9 @@ golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm
|
||||
golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
|
||||
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
|
||||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
|
||||
golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE=
|
||||
golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
@ -1865,6 +1872,7 @@ golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hM
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA=
|
||||
golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@ -1926,6 +1934,8 @@ golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qx
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
|
||||
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
|
||||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
@ -2042,21 +2052,24 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211209171907-798191bca915/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@ -2067,6 +2080,7 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
@ -2135,6 +2149,7 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
||||
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.3.0 h1:SrNbZl6ECOS1qFzgTdQfWXZM9XBkiA6tkFrH9YSTPHM=
|
||||
golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
@ -513,7 +513,7 @@ func (n *Ensemble) Start() *Ensemble {
|
||||
// this is a miner created after genesis, so it won't have a preseal.
|
||||
// we need to create it on chain.
|
||||
|
||||
proofType, err := miner.WindowPoStProofTypeFromSectorSize(m.options.sectorSize)
|
||||
proofType, err := miner.WindowPoStProofTypeFromSectorSize(m.options.sectorSize, n.genesis.version)
|
||||
require.NoError(n.t, err)
|
||||
|
||||
params, aerr := actors.SerializeParams(&power3.CreateMinerParams{
|
||||
|
@ -38,16 +38,17 @@ func SDRUpgradeAt(calico, persian abi.ChainEpoch) EnsembleOpt {
|
||||
}
|
||||
|
||||
func LatestActorsAt(upgradeHeight abi.ChainEpoch) EnsembleOpt {
|
||||
/* inline-gen template
|
||||
return UpgradeSchedule(stmgr.Upgrade{
|
||||
Network: network.Version{{add .latestNetworkVersion -1}},
|
||||
Height: -1,
|
||||
}, stmgr.Upgrade{
|
||||
Network: network.Version{{.latestNetworkVersion}},
|
||||
Height: upgradeHeight,
|
||||
Migration: filcns.UpgradeActorsV{{.latestActorsVersion}},
|
||||
})
|
||||
/* inline-gen start */
|
||||
// TODO: nv19: Re-enable when migration is setup
|
||||
///* inline-gen template
|
||||
// return UpgradeSchedule(stmgr.Upgrade{
|
||||
// Network: network.Version{{add .latestNetworkVersion -1}},
|
||||
// Height: -1,
|
||||
// }, stmgr.Upgrade{
|
||||
// Network: network.Version{{.latestNetworkVersion}},
|
||||
// Height: upgradeHeight,
|
||||
// Migration: filcns.UpgradeActorsV{{.latestActorsVersion}},
|
||||
// })
|
||||
///* inline-gen start */
|
||||
return UpgradeSchedule(stmgr.Upgrade{
|
||||
Network: network.Version17,
|
||||
Height: -1,
|
||||
@ -56,7 +57,7 @@ func LatestActorsAt(upgradeHeight abi.ChainEpoch) EnsembleOpt {
|
||||
Height: upgradeHeight,
|
||||
Migration: filcns.UpgradeActorsV10,
|
||||
})
|
||||
/* inline-gen end */
|
||||
///* inline-gen end */
|
||||
}
|
||||
|
||||
func TurboUpgradeAt(upgradeHeight abi.ChainEpoch) EnsembleOpt {
|
||||
|
@ -1,98 +0,0 @@
|
||||
package itests
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/builtin"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
gstStore "github.com/filecoin-project/go-state-types/store"
|
||||
|
||||
"github.com/filecoin-project/lotus/blockstore"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
builtin2 "github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
"github.com/filecoin-project/lotus/chain/consensus/filcns"
|
||||
"github.com/filecoin-project/lotus/chain/state"
|
||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/types/ethtypes"
|
||||
"github.com/filecoin-project/lotus/chain/vm"
|
||||
"github.com/filecoin-project/lotus/itests/kit"
|
||||
"github.com/filecoin-project/lotus/node/impl"
|
||||
)
|
||||
|
||||
func TestMigrationNV18(t *testing.T) {
|
||||
kit.QuietMiningLogs()
|
||||
|
||||
nv18epoch := abi.ChainEpoch(100)
|
||||
testClient, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(),
|
||||
kit.UpgradeSchedule(stmgr.Upgrade{
|
||||
Network: network.Version17,
|
||||
Height: -1,
|
||||
}, stmgr.Upgrade{
|
||||
Network: network.Version18,
|
||||
Height: nv18epoch,
|
||||
Migration: filcns.UpgradeActorsV10,
|
||||
},
|
||||
))
|
||||
|
||||
ens.InterconnectAll().BeginMining(10 * time.Millisecond)
|
||||
|
||||
clientApi := testClient.FullNode.(*impl.FullNodeAPI)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
testClient.WaitTillChain(ctx, kit.HeightAtLeast(nv18epoch+5))
|
||||
|
||||
// Now that we have upgraded, we need to:
|
||||
// - the EAM exists, has "empty" state
|
||||
// - the EthZeroAddress exists
|
||||
// - all actors have nil Address fields
|
||||
|
||||
bs := blockstore.NewAPIBlockstore(testClient)
|
||||
ctxStore := gstStore.WrapBlockStore(ctx, bs)
|
||||
|
||||
currTs, err := clientApi.ChainHead(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
newStateTree, err := state.LoadStateTree(ctxStore, currTs.Blocks()[0].ParentStateRoot)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, types.StateTreeVersion5, newStateTree.Version())
|
||||
|
||||
codeIDsv10, ok := actors.GetActorCodeIDsFromManifest(actorstypes.Version10)
|
||||
require.True(t, ok)
|
||||
|
||||
// check the EAM actor
|
||||
EAMActor, err := newStateTree.GetActor(builtin.EthereumAddressManagerActorAddr)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, vm.EmptyObjectCid, EAMActor.Head)
|
||||
EAMCodeID, ok := codeIDsv10[manifest.EamKey]
|
||||
require.True(t, ok)
|
||||
require.Equal(t, EAMCodeID, EAMActor.Code)
|
||||
|
||||
// check the EthZeroAddress
|
||||
ethZeroAddr, err := (ethtypes.EthAddress{}).ToFilecoinAddress()
|
||||
require.NoError(t, err)
|
||||
ethZeroAddrID, err := newStateTree.LookupID(ethZeroAddr)
|
||||
require.NoError(t, err)
|
||||
ethZeroActor, err := newStateTree.GetActor(ethZeroAddrID)
|
||||
require.NoError(t, err)
|
||||
require.True(t, builtin2.IsEthAccountActor(ethZeroActor.Code))
|
||||
require.Equal(t, vm.EmptyObjectCid, ethZeroActor.Head)
|
||||
|
||||
// check all actor's Address fields
|
||||
require.NoError(t, newStateTree.ForEach(func(address address.Address, actor *types.Actor) error {
|
||||
if address != ethZeroAddrID {
|
||||
require.Nil(t, actor.Address)
|
||||
}
|
||||
return nil
|
||||
}))
|
||||
}
|
@ -11,19 +11,26 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/builtin"
|
||||
miner11 "github.com/filecoin-project/go-state-types/builtin/v11/miner"
|
||||
power11 "github.com/filecoin-project/go-state-types/builtin/v11/power"
|
||||
adt11 "github.com/filecoin-project/go-state-types/builtin/v11/util/adt"
|
||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||
migration "github.com/filecoin-project/go-state-types/builtin/v9/migration/test"
|
||||
miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
verifregst "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
"github.com/filecoin-project/go-state-types/manifest"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
gstStore "github.com/filecoin-project/go-state-types/store"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/blockstore"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
builtin2 "github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/datacap"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
@ -32,6 +39,8 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/state"
|
||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/types/ethtypes"
|
||||
"github.com/filecoin-project/lotus/chain/vm"
|
||||
"github.com/filecoin-project/lotus/chain/wallet/key"
|
||||
"github.com/filecoin-project/lotus/itests/kit"
|
||||
"github.com/filecoin-project/lotus/node/impl"
|
||||
@ -520,3 +529,236 @@ func TestMigrationNV17(t *testing.T) {
|
||||
|
||||
require.Nil(t, dc)
|
||||
}
|
||||
|
||||
func TestMigrationNV18(t *testing.T) {
|
||||
kit.QuietMiningLogs()
|
||||
|
||||
nv18epoch := abi.ChainEpoch(100)
|
||||
testClient, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(),
|
||||
kit.UpgradeSchedule(stmgr.Upgrade{
|
||||
Network: network.Version17,
|
||||
Height: -1,
|
||||
}, stmgr.Upgrade{
|
||||
Network: network.Version18,
|
||||
Height: nv18epoch,
|
||||
Migration: filcns.UpgradeActorsV10,
|
||||
},
|
||||
))
|
||||
|
||||
ens.InterconnectAll().BeginMining(10 * time.Millisecond)
|
||||
|
||||
clientApi := testClient.FullNode.(*impl.FullNodeAPI)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
testClient.WaitTillChain(ctx, kit.HeightAtLeast(nv18epoch+5))
|
||||
|
||||
// Now that we have upgraded, we need to:
|
||||
// - the EAM exists, has "empty" state
|
||||
// - the EthZeroAddress exists
|
||||
// - all actors have nil Address fields
|
||||
|
||||
bs := blockstore.NewAPIBlockstore(testClient)
|
||||
ctxStore := gstStore.WrapBlockStore(ctx, bs)
|
||||
|
||||
currTs, err := clientApi.ChainHead(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
newStateTree, err := state.LoadStateTree(ctxStore, currTs.Blocks()[0].ParentStateRoot)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, types.StateTreeVersion5, newStateTree.Version())
|
||||
|
||||
codeIDsv10, ok := actors.GetActorCodeIDsFromManifest(actorstypes.Version10)
|
||||
require.True(t, ok)
|
||||
|
||||
// check the EAM actor
|
||||
EAMActor, err := newStateTree.GetActor(builtin.EthereumAddressManagerActorAddr)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, vm.EmptyObjectCid, EAMActor.Head)
|
||||
EAMCodeID, ok := codeIDsv10[manifest.EamKey]
|
||||
require.True(t, ok)
|
||||
require.Equal(t, EAMCodeID, EAMActor.Code)
|
||||
|
||||
// check the EthZeroAddress
|
||||
ethZeroAddr, err := (ethtypes.EthAddress{}).ToFilecoinAddress()
|
||||
require.NoError(t, err)
|
||||
ethZeroAddrID, err := newStateTree.LookupID(ethZeroAddr)
|
||||
require.NoError(t, err)
|
||||
ethZeroActor, err := newStateTree.GetActor(ethZeroAddrID)
|
||||
require.NoError(t, err)
|
||||
require.True(t, builtin2.IsEthAccountActor(ethZeroActor.Code))
|
||||
require.Equal(t, vm.EmptyObjectCid, ethZeroActor.Head)
|
||||
|
||||
// check all actor's Address fields
|
||||
require.NoError(t, newStateTree.ForEach(func(address address.Address, actor *types.Actor) error {
|
||||
if address != ethZeroAddrID {
|
||||
require.Nil(t, actor.Address)
|
||||
}
|
||||
return nil
|
||||
}))
|
||||
}
|
||||
|
||||
func TestMigrationNV19(t *testing.T) {
|
||||
kit.QuietMiningLogs()
|
||||
|
||||
blockTime := 5 * time.Millisecond
|
||||
nv19epoch := abi.ChainEpoch(100)
|
||||
nv20epoch := nv19epoch + builtin.EpochsInDay
|
||||
testClient, testMiner, ens := kit.EnsembleMinimal(t, kit.MockProofs(),
|
||||
kit.UpgradeSchedule(stmgr.Upgrade{
|
||||
Network: network.Version18,
|
||||
Height: -1,
|
||||
}, stmgr.Upgrade{
|
||||
Network: network.Version19,
|
||||
Height: nv19epoch,
|
||||
Migration: filcns.UpgradeActorsV11,
|
||||
}, stmgr.Upgrade{
|
||||
Network: network.Version20,
|
||||
Height: nv20epoch,
|
||||
Migration: nil,
|
||||
},
|
||||
))
|
||||
|
||||
ens.InterconnectAll().BeginMining(blockTime)
|
||||
|
||||
clientApi := testClient.FullNode.(*impl.FullNodeAPI)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
testClient.WaitTillChain(ctx, kit.HeightAtLeast(nv19epoch+5))
|
||||
|
||||
bs := blockstore.NewAPIBlockstore(testClient)
|
||||
ctxStore := gstStore.WrapBlockStore(ctx, bs)
|
||||
|
||||
postMigrationTs, err := clientApi.ChainHead(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
newStateTree, err := state.LoadStateTree(ctxStore, postMigrationTs.Blocks()[0].ParentStateRoot)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, types.StateTreeVersion5, newStateTree.Version())
|
||||
|
||||
// Now that we have upgraded, we need to check that:
|
||||
|
||||
// - a PoSt is successfully submitted in nv19
|
||||
// - a PoSt is successfully submitted in nv20
|
||||
// - all claims in the Power actor are of v1_1 type
|
||||
// - the miner's info has been updated to the v1_1 type
|
||||
|
||||
// Wait for an nv19 PoSt
|
||||
|
||||
mi, err := testClient.StateMinerInfo(ctx, testMiner.ActorAddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
|
||||
wact19, err := testClient.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
en19 := wact19.Nonce
|
||||
|
||||
// wait for a new message to be sent from worker address, it will be a PoSt
|
||||
|
||||
waitForProof19:
|
||||
for {
|
||||
//stm: @CHAIN_STATE_GET_ACTOR_001
|
||||
wact, err := testClient.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
if wact.Nonce > en19 {
|
||||
break waitForProof19
|
||||
}
|
||||
|
||||
build.Clock.Sleep(blockTime)
|
||||
}
|
||||
|
||||
slm19, err := testClient.StateListMessages(ctx, &api.MessageMatch{To: testMiner.ActorAddr}, types.EmptyTSK, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
pmr19, err := testClient.StateSearchMsg(ctx, types.EmptyTSK, slm19[0], -1, false)
|
||||
require.NoError(t, err)
|
||||
|
||||
nv19, err := testClient.StateNetworkVersion(ctx, pmr19.TipSet)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, network.Version19, nv19)
|
||||
|
||||
require.True(t, pmr19.Receipt.ExitCode.IsSuccess())
|
||||
|
||||
slmsg19, err := testClient.ChainGetMessage(ctx, slm19[0])
|
||||
require.NoError(t, err)
|
||||
|
||||
var params19 miner11.SubmitWindowedPoStParams
|
||||
require.NoError(t, params19.UnmarshalCBOR(bytes.NewBuffer(slmsg19.Params)))
|
||||
require.Equal(t, abi.RegisteredPoStProof_StackedDrgWindow2KiBV1_1, params19.Proofs[0].PoStProof)
|
||||
|
||||
// Wait for nv20
|
||||
|
||||
testClient.WaitTillChain(ctx, kit.HeightAtLeast(nv20epoch+5))
|
||||
|
||||
// Wait for an nv20 PoSt
|
||||
|
||||
wact20, err := testClient.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
en20 := wact20.Nonce
|
||||
|
||||
// wait for a new message to be sent from worker address, it will be a PoSt
|
||||
|
||||
waitForProof20:
|
||||
for {
|
||||
//stm: @CHAIN_STATE_GET_ACTOR_001
|
||||
wact, err := testClient.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
if wact.Nonce > en20 {
|
||||
break waitForProof20
|
||||
}
|
||||
|
||||
build.Clock.Sleep(blockTime)
|
||||
}
|
||||
|
||||
slm20, err := testClient.StateListMessages(ctx, &api.MessageMatch{To: testMiner.ActorAddr}, types.EmptyTSK, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
pmr20, err := testClient.StateSearchMsg(ctx, types.EmptyTSK, slm20[0], -1, false)
|
||||
require.NoError(t, err)
|
||||
|
||||
nv20, err := testClient.StateNetworkVersion(ctx, pmr20.TipSet)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, network.Version20, nv20)
|
||||
|
||||
require.True(t, pmr20.Receipt.ExitCode.IsSuccess())
|
||||
|
||||
slmsg20, err := testClient.ChainGetMessage(ctx, slm20[0])
|
||||
require.NoError(t, err)
|
||||
|
||||
var params20 miner11.SubmitWindowedPoStParams
|
||||
require.NoError(t, params20.UnmarshalCBOR(bytes.NewBuffer(slmsg20.Params)))
|
||||
require.Equal(t, abi.RegisteredPoStProof_StackedDrgWindow2KiBV1_1, params20.Proofs[0].PoStProof)
|
||||
|
||||
// check claims in the Power actor
|
||||
|
||||
powerActor, err := newStateTree.GetActor(builtin.StoragePowerActorAddr)
|
||||
require.NoError(t, err)
|
||||
|
||||
var powerSt power11.State
|
||||
require.NoError(t, ctxStore.Get(ctx, powerActor.Head, &powerSt))
|
||||
|
||||
powerClaims, err := adt11.AsMap(ctxStore, powerSt.Claims, builtin.DefaultHamtBitwidth)
|
||||
require.NoError(t, err)
|
||||
|
||||
var claim power11.Claim
|
||||
require.NoError(t, powerClaims.ForEach(&claim, func(key string) error {
|
||||
v1proof, err := claim.WindowPoStProofType.ToV1_1PostProof()
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, v1proof, claim.WindowPoStProofType)
|
||||
return nil
|
||||
}))
|
||||
|
||||
// check MinerInfo
|
||||
|
||||
minerInfo, err := testClient.StateMinerInfo(ctx, testMiner.ActorAddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
|
||||
v1proof, err := minerInfo.WindowPoStProofType.ToV1_1PostProof()
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, v1proof, minerInfo.WindowPoStProofType)
|
||||
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
package itests
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
@ -12,6 +13,7 @@ import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
miner11 "github.com/filecoin-project/go-state-types/builtin/v11/miner"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
@ -343,3 +345,143 @@ waitForProof:
|
||||
|
||||
require.NotEqual(t, pmr.GasCost.BaseFeeBurn, big.Zero())
|
||||
}
|
||||
|
||||
// Tests that V1_1 proofs are generated and accepted in nv19, and V1 proofs are accepted
|
||||
func TestWindowPostV1P1NV19(t *testing.T) {
|
||||
kit.QuietMiningLogs()
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
blocktime := 2 * time.Millisecond
|
||||
|
||||
client, miner, ens := kit.EnsembleMinimal(t, kit.GenesisNetworkVersion(network.Version19))
|
||||
ens.InterconnectAll().BeginMining(blocktime)
|
||||
|
||||
maddr, err := miner.ActorAddress(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
mi, err := client.StateMinerInfo(ctx, maddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
|
||||
wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
en := wact.Nonce
|
||||
|
||||
// wait for a new message to be sent from worker address, it will be a PoSt
|
||||
|
||||
waitForProof:
|
||||
for {
|
||||
wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
if wact.Nonce > en {
|
||||
break waitForProof
|
||||
}
|
||||
|
||||
build.Clock.Sleep(blocktime)
|
||||
}
|
||||
|
||||
slm, err := client.StateListMessages(ctx, &api.MessageMatch{To: maddr}, types.EmptyTSK, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
pmr, err := client.StateSearchMsg(ctx, types.EmptyTSK, slm[0], -1, false)
|
||||
require.NoError(t, err)
|
||||
|
||||
inclTs, err := client.ChainGetTipSet(ctx, pmr.TipSet)
|
||||
require.NoError(t, err)
|
||||
|
||||
nv, err := client.StateNetworkVersion(ctx, pmr.TipSet)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, network.Version19, nv)
|
||||
|
||||
require.True(t, pmr.Receipt.ExitCode.IsSuccess())
|
||||
|
||||
slmsg, err := client.ChainGetMessage(ctx, slm[0])
|
||||
require.NoError(t, err)
|
||||
|
||||
var params miner11.SubmitWindowedPoStParams
|
||||
require.NoError(t, params.UnmarshalCBOR(bytes.NewBuffer(slmsg.Params)))
|
||||
require.Equal(t, abi.RegisteredPoStProof_StackedDrgWindow2KiBV1_1, params.Proofs[0].PoStProof)
|
||||
|
||||
// "Turn" this into a V1 proof -- the proof will be invalid, but won't be validated, and so the call should succeed
|
||||
params.Proofs[0].PoStProof = abi.RegisteredPoStProof_StackedDrgWindow2KiBV1
|
||||
v1PostParams := new(bytes.Buffer)
|
||||
require.NoError(t, params.MarshalCBOR(v1PostParams))
|
||||
|
||||
slmsg.Params = v1PostParams.Bytes()
|
||||
|
||||
// Simulate call on inclTs's parents, so that the partition isn't already proven
|
||||
call, err := client.StateCall(ctx, slmsg, inclTs.Parents())
|
||||
require.NoError(t, err)
|
||||
require.True(t, call.MsgRct.ExitCode.IsSuccess())
|
||||
}
|
||||
|
||||
// Tests that V1_1 proofs are generated and accepted in nv20, and that V1 proofs are NOT
|
||||
func TestWindowPostV1P1NV20(t *testing.T) {
|
||||
kit.QuietMiningLogs()
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
blocktime := 2 * time.Millisecond
|
||||
|
||||
client, miner, ens := kit.EnsembleMinimal(t, kit.GenesisNetworkVersion(network.Version20))
|
||||
ens.InterconnectAll().BeginMining(blocktime)
|
||||
|
||||
maddr, err := miner.ActorAddress(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
mi, err := client.StateMinerInfo(ctx, maddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
|
||||
wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
en := wact.Nonce
|
||||
|
||||
// wait for a new message to be sent from worker address, it will be a PoSt
|
||||
|
||||
waitForProof:
|
||||
for {
|
||||
//stm: @CHAIN_STATE_GET_ACTOR_001
|
||||
wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
if wact.Nonce > en {
|
||||
break waitForProof
|
||||
}
|
||||
|
||||
build.Clock.Sleep(blocktime)
|
||||
}
|
||||
|
||||
slm, err := client.StateListMessages(ctx, &api.MessageMatch{To: maddr}, types.EmptyTSK, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
pmr, err := client.StateSearchMsg(ctx, types.EmptyTSK, slm[0], -1, false)
|
||||
require.NoError(t, err)
|
||||
|
||||
inclTs, err := client.ChainGetTipSet(ctx, pmr.TipSet)
|
||||
require.NoError(t, err)
|
||||
|
||||
nv, err := client.StateNetworkVersion(ctx, pmr.TipSet)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, network.Version20, nv)
|
||||
|
||||
require.True(t, pmr.Receipt.ExitCode.IsSuccess())
|
||||
|
||||
slmsg, err := client.ChainGetMessage(ctx, slm[0])
|
||||
require.NoError(t, err)
|
||||
|
||||
var params miner11.SubmitWindowedPoStParams
|
||||
require.NoError(t, params.UnmarshalCBOR(bytes.NewBuffer(slmsg.Params)))
|
||||
require.Equal(t, abi.RegisteredPoStProof_StackedDrgWindow2KiBV1_1, params.Proofs[0].PoStProof)
|
||||
|
||||
// "Turn" this into a V1 proof -- the proof will be invalid, but we won't get that far
|
||||
params.Proofs[0].PoStProof = abi.RegisteredPoStProof_StackedDrgWindow2KiBV1
|
||||
v1PostParams := new(bytes.Buffer)
|
||||
require.NoError(t, params.MarshalCBOR(v1PostParams))
|
||||
|
||||
slmsg.Params = v1PostParams.Bytes()
|
||||
|
||||
// Simulate call on inclTs's parents, so that the partition isn't already proven
|
||||
_, err = client.StateCall(ctx, slmsg, inclTs.Parents())
|
||||
require.ErrorContains(t, err, "expected proof of type StackedDRGWindow2KiBV1P1, got StackedDRGWindow2KiBV1")
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package bundle
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
|
||||
@ -53,6 +54,7 @@ func LoadBundles(ctx context.Context, bs blockstore.Blockstore, versions ...acto
|
||||
// All manifests are registered on start, so this must succeed.
|
||||
return xerrors.Errorf("unknown actor version v%d", av)
|
||||
}
|
||||
fmt.Printf("manifest cid: %s\n", manifestCid)
|
||||
|
||||
if haveManifest, err := bs.Has(ctx, manifestCid); err != nil {
|
||||
return xerrors.Errorf("blockstore error when loading manifest %s: %w", manifestCid, err)
|
||||
|
@ -1808,6 +1808,8 @@ func (a *StateAPI) StateGetNetworkParams(ctx context.Context) (*api.NetworkParam
|
||||
UpgradeSkyrHeight: build.UpgradeSkyrHeight,
|
||||
UpgradeSharkHeight: build.UpgradeSharkHeight,
|
||||
UpgradeHyggeHeight: build.UpgradeHyggeHeight,
|
||||
UpgradeLightningHeight: build.UpgradeLightningHeight,
|
||||
UpgradeThunderHeight: build.UpgradeThunderHeight,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ func (p *BasicPreCommitPolicy) getCCSectorLifetime() (abi.ChainEpoch, error) {
|
||||
}
|
||||
|
||||
var ccLifetimeEpochs = abi.ChainEpoch(uint64(c.CommittedCapacitySectorLifetime.Seconds()) / builtin.EpochDurationSeconds)
|
||||
// if zero value in config, assume maximum sector extension
|
||||
// if zero value in config, assume default sector extension
|
||||
if ccLifetimeEpochs == 0 {
|
||||
ccLifetimeEpochs = policy.GetMaxSectorExpirationExtension()
|
||||
}
|
||||
|
@ -97,13 +97,7 @@ func (m *Manager) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof,
|
||||
return
|
||||
}
|
||||
|
||||
wpp, err := sector.ProofType.RegisteredWindowPoStProof()
|
||||
if err != nil {
|
||||
addBad(sector.ID, fmt.Sprint("can't get proof type"))
|
||||
return
|
||||
}
|
||||
|
||||
ch, err := ffi.GeneratePoStFallbackSectorChallenges(wpp, sector.ID.Miner, postRand, []abi.SectorNumber{
|
||||
ch, err := ffi.GeneratePoStFallbackSectorChallenges(pp, sector.ID.Miner, postRand, []abi.SectorNumber{
|
||||
sector.ID.Number,
|
||||
})
|
||||
if err != nil {
|
||||
@ -126,7 +120,7 @@ func (m *Manager) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof,
|
||||
SealedCID: commr,
|
||||
Challenge: ch.Challenges[sector.ID.Number],
|
||||
Update: update,
|
||||
}, wpp)
|
||||
}, pp)
|
||||
if err != nil {
|
||||
log.Warnw("CheckProvable Sector FAULT: generating vanilla proof", "sector", sector, "err", err)
|
||||
addBad(sector.ID, fmt.Sprintf("generating vanilla proof: %s", err))
|
||||
|
@ -189,7 +189,18 @@ func post(t *testing.T, sealer *Sealer, skipped []abi.SectorID, seals ...seal) {
|
||||
}
|
||||
}
|
||||
|
||||
proofs, skp, err := sealer.GenerateWindowPoSt(context.TODO(), seals[0].ref.ID.Miner, xsis, randomness)
|
||||
ppt, err := xsis[0].SealProof.RegisteredWindowPoStProof()
|
||||
if err != nil {
|
||||
t.Fatalf("%+v", err)
|
||||
}
|
||||
|
||||
ppt, err = ppt.ToV1_1PostProof()
|
||||
if err != nil {
|
||||
|
||||
t.Fatalf("%+v", err)
|
||||
}
|
||||
|
||||
proofs, skp, err := sealer.GenerateWindowPoSt(context.TODO(), seals[0].ref.ID.Miner, ppt, xsis, randomness)
|
||||
if len(skipped) > 0 {
|
||||
require.Error(t, err)
|
||||
require.EqualValues(t, skipped, skp)
|
||||
|
@ -18,7 +18,15 @@ import (
|
||||
|
||||
func (sb *Sealer) GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) ([]proof.PoStProof, error) {
|
||||
randomness[31] &= 0x3f
|
||||
privsectors, skipped, done, err := sb.pubExtendedSectorToPriv(ctx, minerID, sectorInfo, nil, abi.RegisteredSealProof.RegisteredWinningPoStProof) // TODO: FAULTS?
|
||||
if len(sectorInfo) == 0 {
|
||||
return nil, xerrors.Errorf("must provide sectors for winning post")
|
||||
}
|
||||
ppt, err := sectorInfo[0].SealProof.RegisteredWinningPoStProof()
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to convert to winning post proof: %w", err)
|
||||
}
|
||||
|
||||
privsectors, skipped, done, err := sb.pubExtendedSectorToPriv(ctx, minerID, sectorInfo, nil, ppt) // TODO: FAULTS?
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -30,9 +38,9 @@ func (sb *Sealer) GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID,
|
||||
return ffi.GenerateWinningPoSt(minerID, privsectors, randomness)
|
||||
}
|
||||
|
||||
func (sb *Sealer) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) ([]proof.PoStProof, []abi.SectorID, error) {
|
||||
func (sb *Sealer) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, postProofType abi.RegisteredPoStProof, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) ([]proof.PoStProof, []abi.SectorID, error) {
|
||||
randomness[31] &= 0x3f
|
||||
privsectors, skipped, done, err := sb.pubExtendedSectorToPriv(ctx, minerID, sectorInfo, nil, abi.RegisteredSealProof.RegisteredWindowPoStProof)
|
||||
privsectors, skipped, done, err := sb.pubExtendedSectorToPriv(ctx, minerID, sectorInfo, nil, postProofType)
|
||||
if err != nil {
|
||||
return nil, nil, xerrors.Errorf("gathering sector info: %w", err)
|
||||
}
|
||||
@ -55,7 +63,7 @@ func (sb *Sealer) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, s
|
||||
return proof, faultyIDs, err
|
||||
}
|
||||
|
||||
func (sb *Sealer) pubExtendedSectorToPriv(ctx context.Context, mid abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, faults []abi.SectorNumber, rpt func(abi.RegisteredSealProof) (abi.RegisteredPoStProof, error)) (ffi.SortedPrivateSectorInfo, []abi.SectorID, func(), error) {
|
||||
func (sb *Sealer) pubExtendedSectorToPriv(ctx context.Context, mid abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, faults []abi.SectorNumber, postProofType abi.RegisteredPoStProof) (ffi.SortedPrivateSectorInfo, []abi.SectorID, func(), error) {
|
||||
fmap := map[abi.SectorNumber]struct{}{}
|
||||
for _, fault := range faults {
|
||||
fmap[fault] = struct{}{}
|
||||
@ -106,12 +114,6 @@ func (sb *Sealer) pubExtendedSectorToPriv(ctx context.Context, mid abi.ActorID,
|
||||
sealed = paths.Sealed
|
||||
}
|
||||
|
||||
postProofType, err := rpt(s.SealProof)
|
||||
if err != nil {
|
||||
done()
|
||||
return ffi.SortedPrivateSectorInfo{}, nil, nil, xerrors.Errorf("acquiring registered PoSt proof from sector info %+v: %w", s, err)
|
||||
}
|
||||
|
||||
ffiInfo := proof.SectorInfo{
|
||||
SealProof: s.SealProof,
|
||||
SectorNumber: s.SectorNumber,
|
||||
|
@ -78,12 +78,12 @@ func (m *Manager) generateWinningPoSt(ctx context.Context, minerID abi.ActorID,
|
||||
return proofs, nil
|
||||
}
|
||||
|
||||
func (m *Manager) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) (proof []proof.PoStProof, skipped []abi.SectorID, err error) {
|
||||
func (m *Manager) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, postProofType abi.RegisteredPoStProof, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) (proof []proof.PoStProof, skipped []abi.SectorID, err error) {
|
||||
if !m.disableBuiltinWindowPoSt && !m.windowPoStSched.CanSched(ctx) {
|
||||
// if builtin PoSt isn't disabled, and there are no workers, compute the PoSt locally
|
||||
|
||||
log.Info("GenerateWindowPoSt run at lotus-miner")
|
||||
p, s, err := m.localProver.GenerateWindowPoSt(ctx, minerID, sectorInfo, randomness)
|
||||
p, s, err := m.localProver.GenerateWindowPoSt(ctx, minerID, postProofType, sectorInfo, randomness)
|
||||
if err != nil {
|
||||
return nil, nil, xerrors.Errorf("local prover: %w", err)
|
||||
}
|
||||
@ -91,7 +91,7 @@ func (m *Manager) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, s
|
||||
return p, s, nil
|
||||
}
|
||||
|
||||
return m.generateWindowPoSt(ctx, minerID, sectorInfo, randomness)
|
||||
return m.generateWindowPoSt(ctx, minerID, postProofType, sectorInfo, randomness)
|
||||
}
|
||||
|
||||
func dedupeSectorInfo(sectorInfo []proof.ExtendedSectorInfo) []proof.ExtendedSectorInfo {
|
||||
@ -107,7 +107,7 @@ func dedupeSectorInfo(sectorInfo []proof.ExtendedSectorInfo) []proof.ExtendedSec
|
||||
return out
|
||||
}
|
||||
|
||||
func (m *Manager) generateWindowPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) ([]proof.PoStProof, []abi.SectorID, error) {
|
||||
func (m *Manager) generateWindowPoSt(ctx context.Context, minerID abi.ActorID, ppt abi.RegisteredPoStProof, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) ([]proof.PoStProof, []abi.SectorID, error) {
|
||||
var retErr error = nil
|
||||
randomness[31] &= 0x3f
|
||||
|
||||
@ -119,11 +119,6 @@ func (m *Manager) generateWindowPoSt(ctx context.Context, minerID abi.ActorID, s
|
||||
|
||||
spt := sectorInfo[0].SealProof
|
||||
|
||||
ppt, err := spt.RegisteredWindowPoStProof()
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
maxPartitionSize, err := builtin.PoStProofWindowPoStPartitionSectors(ppt) // todo proxy through chain/actors
|
||||
if err != nil {
|
||||
return nil, nil, xerrors.Errorf("get sectors count of partition failed:%+v", err)
|
||||
|
@ -349,10 +349,15 @@ func (mgr *SectorMgr) GenerateWinningPoSt(ctx context.Context, minerID abi.Actor
|
||||
}
|
||||
}
|
||||
|
||||
return generateFakePoSt(sectorInfo, abi.RegisteredSealProof.RegisteredWinningPoStProof, randomness), nil
|
||||
ppt, err := sectorInfo[0].SealProof.RegisteredWinningPoStProof()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return generateFakePoSt(sectorInfo, ppt, randomness), nil
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, xSectorInfo []prooftypes.ExtendedSectorInfo, randomness abi.PoStRandomness) ([]prooftypes.PoStProof, []abi.SectorID, error) {
|
||||
func (mgr *SectorMgr) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, ppt abi.RegisteredPoStProof, xSectorInfo []prooftypes.ExtendedSectorInfo, randomness abi.PoStRandomness) ([]prooftypes.PoStProof, []abi.SectorID, error) {
|
||||
mgr.lk.Lock()
|
||||
defer mgr.lk.Unlock()
|
||||
|
||||
@ -395,7 +400,7 @@ func (mgr *SectorMgr) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorI
|
||||
}
|
||||
}
|
||||
|
||||
return generateFakePoSt(sectorInfo, abi.RegisteredSealProof.RegisteredWindowPoStProof, randomness), skipped, nil
|
||||
return generateFakePoSt(sectorInfo, ppt, randomness), skipped, nil
|
||||
}
|
||||
|
||||
func generateFakePoStProof(sectorInfo []prooftypes.SectorInfo, randomness abi.PoStRandomness) []byte {
|
||||
@ -413,15 +418,10 @@ func generateFakePoStProof(sectorInfo []prooftypes.SectorInfo, randomness abi.Po
|
||||
|
||||
}
|
||||
|
||||
func generateFakePoSt(sectorInfo []prooftypes.SectorInfo, rpt func(abi.RegisteredSealProof) (abi.RegisteredPoStProof, error), randomness abi.PoStRandomness) []prooftypes.PoStProof {
|
||||
wp, err := rpt(sectorInfo[0].SealProof)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
func generateFakePoSt(sectorInfo []prooftypes.SectorInfo, ppt abi.RegisteredPoStProof, randomness abi.PoStRandomness) []prooftypes.PoStProof {
|
||||
return []prooftypes.PoStProof{
|
||||
{
|
||||
PoStProof: wp,
|
||||
PoStProof: ppt,
|
||||
ProofBytes: generateFakePoStProof(sectorInfo, randomness),
|
||||
},
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ var NoSectorRef = SectorRef{}
|
||||
|
||||
type ProverPoSt interface {
|
||||
GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) ([]proof.PoStProof, error)
|
||||
GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) (proof []proof.PoStProof, skipped []abi.SectorID, err error)
|
||||
GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, ppt abi.RegisteredPoStProof, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) (proof []proof.PoStProof, skipped []abi.SectorID, err error)
|
||||
|
||||
GenerateWinningPoStWithVanilla(ctx context.Context, proofType abi.RegisteredPoStProof, minerID abi.ActorID, randomness abi.PoStRandomness, proofs [][]byte) ([]proof.PoStProof, error)
|
||||
GenerateWindowPoStWithVanilla(ctx context.Context, proofType abi.RegisteredPoStProof, minerID abi.ActorID, randomness abi.PoStRandomness, proofs [][]byte, partitionIdx int) (proof.PoStProof, error)
|
||||
|
@ -33,7 +33,7 @@ func (t *testExec) GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID,
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (t *testExec) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) (miner []proof.PoStProof, skipped []abi.SectorID, err error) {
|
||||
func (t *testExec) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, ppt abi.RegisteredPoStProof, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) (miner []proof.PoStProof, skipped []abi.SectorID, err error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
|
@ -189,12 +189,12 @@ func (s *WindowPoStScheduler) runSubmitPoST(
|
||||
func (s *WindowPoStScheduler) checkSectors(ctx context.Context, check bitfield.BitField, tsk types.TipSetKey) (bitfield.BitField, error) {
|
||||
mid, err := address.IDFromAddress(s.actor)
|
||||
if err != nil {
|
||||
return bitfield.BitField{}, err
|
||||
return bitfield.BitField{}, xerrors.Errorf("failed to convert to ID addr: %w", err)
|
||||
}
|
||||
|
||||
sectorInfos, err := s.api.StateMinerSectors(ctx, s.actor, &check, tsk)
|
||||
if err != nil {
|
||||
return bitfield.BitField{}, err
|
||||
return bitfield.BitField{}, xerrors.Errorf("failed to get sector infos: %w", err)
|
||||
}
|
||||
|
||||
type checkSector struct {
|
||||
@ -218,7 +218,21 @@ func (s *WindowPoStScheduler) checkSectors(ctx context.Context, check bitfield.B
|
||||
})
|
||||
}
|
||||
|
||||
bad, err := s.faultTracker.CheckProvable(ctx, s.proofType, tocheck, func(ctx context.Context, id abi.SectorID) (cid.Cid, bool, error) {
|
||||
nv, err := s.api.StateNetworkVersion(ctx, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return bitfield.BitField{}, xerrors.Errorf("failed to get network version: %w", err)
|
||||
}
|
||||
|
||||
pp := s.proofType
|
||||
// TODO: Drop after nv19 comes and goes
|
||||
if nv >= network.Version19 {
|
||||
pp, err = pp.ToV1_1PostProof()
|
||||
if err != nil {
|
||||
return bitfield.BitField{}, xerrors.Errorf("failed to convert to v1_1 post proof: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
bad, err := s.faultTracker.CheckProvable(ctx, pp, tocheck, func(ctx context.Context, id abi.SectorID) (cid.Cid, bool, error) {
|
||||
s, ok := sectors[id.Number]
|
||||
if !ok {
|
||||
return cid.Undef, false, xerrors.Errorf("sealed CID not found")
|
||||
@ -407,7 +421,12 @@ func (s *WindowPoStScheduler) runPoStCycle(ctx context.Context, manual bool, di
|
||||
return nil, err
|
||||
}
|
||||
|
||||
postOut, ps, err := s.prover.GenerateWindowPoSt(ctx, abi.ActorID(mid), xsinfos, append(abi.PoStRandomness{}, rand...))
|
||||
ppt, err := xsinfos[0].SealProof.RegisteredWindowPoStProofByNetworkVersion(nv)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to get window post type: %w", err)
|
||||
}
|
||||
|
||||
postOut, ps, err := s.prover.GenerateWindowPoSt(ctx, abi.ActorID(mid), ppt, xsinfos, append(abi.PoStRandomness{}, rand...))
|
||||
elapsed := time.Since(tsStart)
|
||||
log.Infow("computing window post", "batch", batchIdx, "elapsed", elapsed, "skip", len(ps), "err", err)
|
||||
if err != nil {
|
||||
|
@ -125,10 +125,10 @@ func (m *mockProver) GenerateWinningPoSt(context.Context, abi.ActorID, []proofty
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (m *mockProver) GenerateWindowPoSt(ctx context.Context, aid abi.ActorID, sis []prooftypes.ExtendedSectorInfo, pr abi.PoStRandomness) ([]prooftypes.PoStProof, []abi.SectorID, error) {
|
||||
func (m *mockProver) GenerateWindowPoSt(ctx context.Context, aid abi.ActorID, ppt abi.RegisteredPoStProof, sis []prooftypes.ExtendedSectorInfo, pr abi.PoStRandomness) ([]prooftypes.PoStProof, []abi.SectorID, error) {
|
||||
return []prooftypes.PoStProof{
|
||||
{
|
||||
PoStProof: abi.RegisteredPoStProof_StackedDrgWindow2KiBV1,
|
||||
PoStProof: ppt,
|
||||
ProofBytes: []byte("post-proof"),
|
||||
},
|
||||
}, nil, nil
|
||||
|
Loading…
Reference in New Issue
Block a user