From 7b4c657e9030359a049f6695435e08e6e7bb178c Mon Sep 17 00:00:00 2001 From: Aayush Rajasekaran Date: Wed, 15 Sep 2021 17:22:25 +0200 Subject: [PATCH] Add v6 actors --- build/openrpc/full.json.gz | Bin 25412 -> 25412 bytes build/params_2k.go | 3 + build/params_butterfly.go | 3 +- build/params_calibnet.go | 2 + build/params_interop.go | 1 + build/params_mainnet.go | 7 +- build/params_nerpanet.go | 2 + build/params_shared_vals.go | 4 +- build/params_testground.go | 1 + chain/actors/builtin/account/account.go | 15 + chain/actors/builtin/account/v6.go | 40 ++ chain/actors/builtin/builtin.go | 60 ++- chain/actors/builtin/cron/cron.go | 12 +- chain/actors/builtin/cron/v6.go | 35 ++ chain/actors/builtin/init/init.go | 19 +- chain/actors/builtin/init/v6.go | 114 ++++ chain/actors/builtin/market/market.go | 19 +- chain/actors/builtin/market/v6.go | 226 ++++++++ chain/actors/builtin/miner/miner.go | 17 +- chain/actors/builtin/miner/v6.go | 570 ++++++++++++++++++++ chain/actors/builtin/multisig/message6.go | 71 +++ chain/actors/builtin/multisig/multisig.go | 32 +- chain/actors/builtin/multisig/v6.go | 119 ++++ chain/actors/builtin/paych/message6.go | 74 +++ chain/actors/builtin/paych/paych.go | 20 +- chain/actors/builtin/paych/v6.go | 114 ++++ chain/actors/builtin/power/power.go | 19 +- chain/actors/builtin/power/v6.go | 187 +++++++ chain/actors/builtin/reward/reward.go | 19 +- chain/actors/builtin/reward/v6.go | 98 ++++ chain/actors/builtin/system/system.go | 10 +- chain/actors/builtin/system/v6.go | 35 ++ chain/actors/builtin/verifreg/v6.go | 75 +++ chain/actors/builtin/verifreg/verifreg.go | 19 +- chain/actors/policy/policy.go | 80 ++- chain/actors/policy/policy.go.template | 11 +- chain/actors/version.go | 7 +- chain/consensus/filcns/compute_state.go | 2 + chain/consensus/filcns/upgrades.go | 108 +++- chain/state/statetree.go | 2 +- chain/sync_test.go | 6 +- chain/types/state.go | 2 +- chain/vm/mkactor.go | 3 + chain/vm/runtime.go | 2 + documentation/en/api-v0-methods.md | 2 +- documentation/en/api-v1-unstable-methods.md | 2 +- go.mod | 3 +- go.sum | 5 +- lotuspond/front/src/chain/methods.json | 106 ++++ testplans/lotus-soup/go.mod | 8 +- testplans/lotus-soup/go.sum | 23 + 51 files changed, 2347 insertions(+), 67 deletions(-) create mode 100644 chain/actors/builtin/account/v6.go create mode 100644 chain/actors/builtin/cron/v6.go create mode 100644 chain/actors/builtin/init/v6.go create mode 100644 chain/actors/builtin/market/v6.go create mode 100644 chain/actors/builtin/miner/v6.go create mode 100644 chain/actors/builtin/multisig/message6.go create mode 100644 chain/actors/builtin/multisig/v6.go create mode 100644 chain/actors/builtin/paych/message6.go create mode 100644 chain/actors/builtin/paych/v6.go create mode 100644 chain/actors/builtin/power/v6.go create mode 100644 chain/actors/builtin/reward/v6.go create mode 100644 chain/actors/builtin/system/v6.go create mode 100644 chain/actors/builtin/verifreg/v6.go diff --git a/build/openrpc/full.json.gz b/build/openrpc/full.json.gz index 606cd9ac23fc39ab7c67d7b228e2746833a6d39d..3aa5bc443d4af1c9ebfa4abaae110a79480b6c75 100644 GIT binary patch delta 5090 zcmV<86CLct#sS2}0kB6;f9$nBOITBWG^h(RafzU-QsuQ`MRD~d-AE603O&A9NXK1v z=R2Ang@J83p&%P|E4mU3#bAD6fQd3s)f8ZPVFUlpWce3ODw%gC7UL+Pkf3Dgeb4>9y4VQv;?TS;&lhzKe_^L&_zrfrj@oSVM!)S#26f-K7fpcQ%uGHb1;J}w*0D-#Gyx> z+hWKd1vj^D$PGCg0jPh2TQnDV#8>%w-M&0^gsN{x^r3qdg+??aE}#TB6NpLwhKL@f zh)<{sX4s3aeF8|-f9wJV=gPTH1K+5v8D!)auG-TC5n4%+s0n?srvoempDu?P@F=}S zE(m=^HXcPJ#od50WG@5c2iS?4qU5EdKPe_iA0j>9$OSI}CZZ*o_KP9yoG6BdT##Bs zTOZl@80)bU%E1(JXCjM>$5OEB;fZGs^gI-R86=zmP5~k;e++bbF?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mxK`ePg2?$h6~tsGgLg1#^kz5W_kix&Ipq*l#2cZL&J?cRK$h9SP6z;^EU z64+!IG~?%SlhmiNJjn8(mOLnZr#Zd$*B0t;YC!e3Z)%;Yqboqmc~$3HsZs*e=V^0T zkn3Qj2M5K$EHWhKsf#XPeSS%#i23)VCP*AUe|u9z5K) zweqiQM-R5QYdyhby2|Fshtrjt+bCtGx`K_!*r!c(+o@YyJd$*Ny4p>wXyEWR<3HX9 zFr5rb-l(QiqzszcyQb7HF0K^cnB2M{*Qu))E=5cxvzx%X=<4=UCGnkGKeK3UVkm3< dwEmD?aqpcSp_2Xhe*pjh|NkUt_;dO91OSzH0I~o8 diff --git a/build/params_2k.go b/build/params_2k.go index 479bd3b82..1c009b7e8 100644 --- a/build/params_2k.go +++ b/build/params_2k.go @@ -42,6 +42,8 @@ var UpgradeTurboHeight = abi.ChainEpoch(-15) var UpgradeHyperdriveHeight = abi.ChainEpoch(-16) +var UpgradeChocolateHeight = abi.ChainEpoch(-17) + var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ 0: DrandMainnet, } @@ -82,6 +84,7 @@ func init() { UpgradeNorwegianHeight = getUpgradeHeight("LOTUS_NORWEGIAN_HEIGHT", UpgradeNorwegianHeight) UpgradeTurboHeight = getUpgradeHeight("LOTUS_ACTORSV4_HEIGHT", UpgradeTurboHeight) UpgradeHyperdriveHeight = getUpgradeHeight("LOTUS_HYPERDRIVE_HEIGHT", UpgradeHyperdriveHeight) + UpgradeChocolateHeight = getUpgradeHeight("LOTUS_CHOCOLATE_HEIGHT", UpgradeChocolateHeight) BuildType |= Build2k } diff --git a/build/params_butterfly.go b/build/params_butterfly.go index 1477c363a..aa7e5c120 100644 --- a/build/params_butterfly.go +++ b/build/params_butterfly.go @@ -36,7 +36,8 @@ const UpgradeOrangeHeight = 210 const UpgradeTrustHeight = 240 const UpgradeNorwegianHeight = UpgradeTrustHeight + (builtin2.EpochsInHour * 12) const UpgradeTurboHeight = 8922 -const UpgradeHyperdriveHeight = 9999999 +const UpgradeHyperdriveHeight = 9999998 +const UpgradeChocolateHeight = 9999999 func init() { policy.SetConsensusMinerMinPower(abi.NewStoragePower(2 << 30)) diff --git a/build/params_calibnet.go b/build/params_calibnet.go index bafed3015..8c870aadf 100644 --- a/build/params_calibnet.go +++ b/build/params_calibnet.go @@ -49,6 +49,8 @@ const UpgradeTurboHeight = 390 const UpgradeHyperdriveHeight = 420 +const UpgradeChocolateHeight = 999999999 + func init() { policy.SetConsensusMinerMinPower(abi.NewStoragePower(32 << 30)) policy.SetSupportedProofTypes( diff --git a/build/params_interop.go b/build/params_interop.go index 0040bb9d0..201268492 100644 --- a/build/params_interop.go +++ b/build/params_interop.go @@ -44,6 +44,7 @@ var UpgradeNorwegianHeight = abi.ChainEpoch(-14) var UpgradeTurboHeight = abi.ChainEpoch(-15) var UpgradeHyperdriveHeight = abi.ChainEpoch(-16) +var UpgradeChocolateHeight = abi.ChainEpoch(-17) var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ 0: DrandMainnet, diff --git a/build/params_mainnet.go b/build/params_mainnet.go index 1e9996082..9a05e8b7a 100644 --- a/build/params_mainnet.go +++ b/build/params_mainnet.go @@ -60,13 +60,16 @@ const UpgradeTurboHeight = 712320 // 2021-06-30T22:00:00Z var UpgradeHyperdriveHeight = abi.ChainEpoch(892800) +// ??? +var UpgradeChocolateHeight = abi.ChainEpoch(999999999) + func init() { if os.Getenv("LOTUS_USE_TEST_ADDRESSES") != "1" { SetAddressNetwork(address.Mainnet) } - if os.Getenv("LOTUS_DISABLE_HYPERDRIVE") == "1" { - UpgradeHyperdriveHeight = math.MaxInt64 + if os.Getenv("LOTUS_DISABLE_CHOCOLATE") == "1" { + UpgradeChocolateHeight = math.MaxInt64 } Devnet = false diff --git a/build/params_nerpanet.go b/build/params_nerpanet.go index b7beb5953..8972a8752 100644 --- a/build/params_nerpanet.go +++ b/build/params_nerpanet.go @@ -45,6 +45,8 @@ const UpgradeNorwegianHeight = 201000 const UpgradeTurboHeight = 203000 const UpgradeHyperdriveHeight = 379178 +const UpgradeChocolateHeight = 999999999 + func init() { // Minimum block production power is set to 4 TiB // Rationale is to discourage small-scale miners from trying to take over the network diff --git a/build/params_shared_vals.go b/build/params_shared_vals.go index f3b6cb6a2..22d1c30e3 100644 --- a/build/params_shared_vals.go +++ b/build/params_shared_vals.go @@ -26,7 +26,9 @@ const UnixfsLinksPerLevel = 1024 // Consensus / Network const AllowableClockDriftSecs = uint64(1) -const NewestNetworkVersion = network.Version13 + +// TODO: This is still terrible...What's the impact of updating this before mainnet actually upgrades +const NewestNetworkVersion = network.Version14 // Epochs const ForkLengthThreshold = Finality diff --git a/build/params_testground.go b/build/params_testground.go index 0bb984a27..69ff19d8c 100644 --- a/build/params_testground.go +++ b/build/params_testground.go @@ -98,6 +98,7 @@ var ( UpgradeNorwegianHeight abi.ChainEpoch = -13 UpgradeTurboHeight abi.ChainEpoch = -14 UpgradeHyperdriveHeight abi.ChainEpoch = -15 + UpgradeChocolateHeight abi.ChainEpoch = -16 DrandSchedule = map[abi.ChainEpoch]DrandEnum{ 0: DrandMainnet, diff --git a/chain/actors/builtin/account/account.go b/chain/actors/builtin/account/account.go index 04c82b340..249ce133f 100644 --- a/chain/actors/builtin/account/account.go +++ b/chain/actors/builtin/account/account.go @@ -21,6 +21,8 @@ import ( builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin" builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" + + builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" ) func init() { @@ -44,6 +46,10 @@ func init() { builtin.RegisterActorState(builtin5.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) { return load5(store, root) }) + + builtin.RegisterActorState(builtin6.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) { + return load6(store, root) + }) } var Methods = builtin4.MethodsAccount @@ -66,6 +72,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) { case builtin5.AccountActorCodeID: return load5(store, act.Head) + case builtin6.AccountActorCodeID: + return load6(store, act.Head) + } return nil, xerrors.Errorf("unknown actor code %s", act.Code) } @@ -88,6 +97,9 @@ func MakeState(store adt.Store, av actors.Version, addr address.Address) (State, case actors.Version5: return make5(store, addr) + case actors.Version6: + return make6(store, addr) + } return nil, xerrors.Errorf("unknown actor version %d", av) } @@ -110,6 +122,9 @@ func GetActorCodeID(av actors.Version) (cid.Cid, error) { case actors.Version5: return builtin5.AccountActorCodeID, nil + case actors.Version6: + return builtin6.AccountActorCodeID, nil + } return cid.Undef, xerrors.Errorf("unknown actor version %d", av) diff --git a/chain/actors/builtin/account/v6.go b/chain/actors/builtin/account/v6.go new file mode 100644 index 000000000..a0d157ae5 --- /dev/null +++ b/chain/actors/builtin/account/v6.go @@ -0,0 +1,40 @@ +package account + +import ( + "github.com/filecoin-project/go-address" + "github.com/ipfs/go-cid" + + "github.com/filecoin-project/lotus/chain/actors/adt" + + account6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/account" +) + +var _ State = (*state6)(nil) + +func load6(store adt.Store, root cid.Cid) (State, error) { + out := state6{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make6(store adt.Store, addr address.Address) (State, error) { + out := state6{store: store} + out.State = account6.State{Address: addr} + return &out, nil +} + +type state6 struct { + account6.State + store adt.Store +} + +func (s *state6) PubkeyAddress() (address.Address, error) { + return s.Address, nil +} + +func (s *state6) GetState() interface{} { + return &s.State +} diff --git a/chain/actors/builtin/builtin.go b/chain/actors/builtin/builtin.go index 74d622819..ebfe2df2e 100644 --- a/chain/actors/builtin/builtin.go +++ b/chain/actors/builtin/builtin.go @@ -20,46 +20,49 @@ import ( builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" smoothing5 "github.com/filecoin-project/specs-actors/v5/actors/util/smoothing" + builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" + smoothing6 "github.com/filecoin-project/specs-actors/v6/actors/util/smoothing" + "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/cbor" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/types" - miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner" - proof5 "github.com/filecoin-project/specs-actors/v5/actors/runtime/proof" + miner6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/miner" + proof6 "github.com/filecoin-project/specs-actors/v6/actors/runtime/proof" ) -var SystemActorAddr = builtin5.SystemActorAddr -var BurntFundsActorAddr = builtin5.BurntFundsActorAddr -var CronActorAddr = builtin5.CronActorAddr +var SystemActorAddr = builtin6.SystemActorAddr +var BurntFundsActorAddr = builtin6.BurntFundsActorAddr +var CronActorAddr = builtin6.CronActorAddr var SaftAddress = makeAddress("t0122") var ReserveAddress = makeAddress("t090") var RootVerifierAddress = makeAddress("t080") var ( - ExpectedLeadersPerEpoch = builtin5.ExpectedLeadersPerEpoch + ExpectedLeadersPerEpoch = builtin6.ExpectedLeadersPerEpoch ) const ( - EpochDurationSeconds = builtin5.EpochDurationSeconds - EpochsInDay = builtin5.EpochsInDay - SecondsInDay = builtin5.SecondsInDay + EpochDurationSeconds = builtin6.EpochDurationSeconds + EpochsInDay = builtin6.EpochsInDay + SecondsInDay = builtin6.SecondsInDay ) const ( - MethodSend = builtin5.MethodSend - MethodConstructor = builtin5.MethodConstructor + MethodSend = builtin6.MethodSend + MethodConstructor = builtin6.MethodConstructor ) // These are all just type aliases across actor versions. In the future, that might change // and we might need to do something fancier. -type SectorInfo = proof5.SectorInfo -type PoStProof = proof5.PoStProof +type SectorInfo = proof6.SectorInfo +type PoStProof = proof6.PoStProof type FilterEstimate = smoothing0.FilterEstimate func QAPowerForWeight(size abi.SectorSize, duration abi.ChainEpoch, dealWeight, verifiedWeight abi.DealWeight) abi.StoragePower { - return miner5.QAPowerForWeight(size, duration, dealWeight, verifiedWeight) + return miner6.QAPowerForWeight(size, duration, dealWeight, verifiedWeight) } func FromV0FilterEstimate(v0 smoothing0.FilterEstimate) FilterEstimate { @@ -92,6 +95,12 @@ func FromV5FilterEstimate(v5 smoothing5.FilterEstimate) FilterEstimate { } +func FromV6FilterEstimate(v6 smoothing6.FilterEstimate) FilterEstimate { + + return (FilterEstimate)(v6) + +} + type ActorStateLoader func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) var ActorStateLoaders = make(map[cid.Cid]ActorStateLoader) @@ -126,6 +135,9 @@ func ActorNameByCode(c cid.Cid) string { case builtin5.IsBuiltinActor(c): return builtin5.ActorNameByCode(c) + case builtin6.IsBuiltinActor(c): + return builtin6.ActorNameByCode(c) + default: return "" } @@ -153,6 +165,10 @@ func IsBuiltinActor(c cid.Cid) bool { return true } + if builtin6.IsBuiltinActor(c) { + return true + } + return false } @@ -178,6 +194,10 @@ func IsAccountActor(c cid.Cid) bool { return true } + if c == builtin6.AccountActorCodeID { + return true + } + return false } @@ -203,6 +223,10 @@ func IsStorageMinerActor(c cid.Cid) bool { return true } + if c == builtin6.StorageMinerActorCodeID { + return true + } + return false } @@ -228,6 +252,10 @@ func IsMultisigActor(c cid.Cid) bool { return true } + if c == builtin6.MultisigActorCodeID { + return true + } + return false } @@ -253,6 +281,10 @@ func IsPaymentChannelActor(c cid.Cid) bool { return true } + if c == builtin6.PaymentChannelActorCodeID { + return true + } + return false } diff --git a/chain/actors/builtin/cron/cron.go b/chain/actors/builtin/cron/cron.go index 2275e747f..9178a44ab 100644 --- a/chain/actors/builtin/cron/cron.go +++ b/chain/actors/builtin/cron/cron.go @@ -15,6 +15,8 @@ import ( builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin" builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" + + builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" ) func MakeState(store adt.Store, av actors.Version) (State, error) { @@ -35,6 +37,9 @@ func MakeState(store adt.Store, av actors.Version) (State, error) { case actors.Version5: return make5(store) + case actors.Version6: + return make6(store) + } return nil, xerrors.Errorf("unknown actor version %d", av) } @@ -57,14 +62,17 @@ func GetActorCodeID(av actors.Version) (cid.Cid, error) { case actors.Version5: return builtin5.CronActorCodeID, nil + case actors.Version6: + return builtin6.CronActorCodeID, nil + } return cid.Undef, xerrors.Errorf("unknown actor version %d", av) } var ( - Address = builtin5.CronActorAddr - Methods = builtin5.MethodsCron + Address = builtin6.CronActorAddr + Methods = builtin6.MethodsCron ) type State interface { diff --git a/chain/actors/builtin/cron/v6.go b/chain/actors/builtin/cron/v6.go new file mode 100644 index 000000000..8bbadd79f --- /dev/null +++ b/chain/actors/builtin/cron/v6.go @@ -0,0 +1,35 @@ +package cron + +import ( + "github.com/ipfs/go-cid" + + "github.com/filecoin-project/lotus/chain/actors/adt" + + cron6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/cron" +) + +var _ State = (*state6)(nil) + +func load6(store adt.Store, root cid.Cid) (State, error) { + out := state6{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make6(store adt.Store) (State, error) { + out := state6{store: store} + out.State = *cron6.ConstructState(cron6.BuiltInEntries()) + return &out, nil +} + +type state6 struct { + cron6.State + store adt.Store +} + +func (s *state6) GetState() interface{} { + return &s.State +} diff --git a/chain/actors/builtin/init/init.go b/chain/actors/builtin/init/init.go index e1bd6f371..ee06eeab7 100644 --- a/chain/actors/builtin/init/init.go +++ b/chain/actors/builtin/init/init.go @@ -23,6 +23,8 @@ import ( builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin" builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" + + builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" ) func init() { @@ -46,11 +48,15 @@ func init() { builtin.RegisterActorState(builtin5.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) { return load5(store, root) }) + + builtin.RegisterActorState(builtin6.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) { + return load6(store, root) + }) } var ( - Address = builtin5.InitActorAddr - Methods = builtin5.MethodsInit + Address = builtin6.InitActorAddr + Methods = builtin6.MethodsInit ) func Load(store adt.Store, act *types.Actor) (State, error) { @@ -71,6 +77,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) { case builtin5.InitActorCodeID: return load5(store, act.Head) + case builtin6.InitActorCodeID: + return load6(store, act.Head) + } return nil, xerrors.Errorf("unknown actor code %s", act.Code) } @@ -93,6 +102,9 @@ func MakeState(store adt.Store, av actors.Version, networkName string) (State, e case actors.Version5: return make5(store, networkName) + case actors.Version6: + return make6(store, networkName) + } return nil, xerrors.Errorf("unknown actor version %d", av) } @@ -115,6 +127,9 @@ func GetActorCodeID(av actors.Version) (cid.Cid, error) { case actors.Version5: return builtin5.InitActorCodeID, nil + case actors.Version6: + return builtin6.InitActorCodeID, nil + } return cid.Undef, xerrors.Errorf("unknown actor version %d", av) diff --git a/chain/actors/builtin/init/v6.go b/chain/actors/builtin/init/v6.go new file mode 100644 index 000000000..a5bd9edfb --- /dev/null +++ b/chain/actors/builtin/init/v6.go @@ -0,0 +1,114 @@ +package init + +import ( + "github.com/filecoin-project/go-address" + "github.com/filecoin-project/go-state-types/abi" + "github.com/ipfs/go-cid" + cbg "github.com/whyrusleeping/cbor-gen" + "golang.org/x/xerrors" + + "github.com/filecoin-project/lotus/chain/actors/adt" + "github.com/filecoin-project/lotus/node/modules/dtypes" + + builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" + + init6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/init" + adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt" +) + +var _ State = (*state6)(nil) + +func load6(store adt.Store, root cid.Cid) (State, error) { + out := state6{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make6(store adt.Store, networkName string) (State, error) { + out := state6{store: store} + + s, err := init6.ConstructState(store, networkName) + if err != nil { + return nil, err + } + + out.State = *s + + return &out, nil +} + +type state6 struct { + init6.State + store adt.Store +} + +func (s *state6) ResolveAddress(address address.Address) (address.Address, bool, error) { + return s.State.ResolveAddress(s.store, address) +} + +func (s *state6) MapAddressToNewID(address address.Address) (address.Address, error) { + return s.State.MapAddressToNewID(s.store, address) +} + +func (s *state6) ForEachActor(cb func(id abi.ActorID, address address.Address) error) error { + addrs, err := adt6.AsMap(s.store, s.State.AddressMap, builtin6.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 *state6) NetworkName() (dtypes.NetworkName, error) { + return dtypes.NetworkName(s.State.NetworkName), nil +} + +func (s *state6) SetNetworkName(name string) error { + s.State.NetworkName = name + return nil +} + +func (s *state6) SetNextID(id abi.ActorID) error { + s.State.NextID = id + return nil +} + +func (s *state6) Remove(addrs ...address.Address) (err error) { + m, err := adt6.AsMap(s.store, s.State.AddressMap, builtin6.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 *state6) SetAddressMap(mcid cid.Cid) error { + s.State.AddressMap = mcid + return nil +} + +func (s *state6) AddressMap() (adt.Map, error) { + return adt6.AsMap(s.store, s.State.AddressMap, builtin6.DefaultHamtBitwidth) +} + +func (s *state6) GetState() interface{} { + return &s.State +} diff --git a/chain/actors/builtin/market/market.go b/chain/actors/builtin/market/market.go index 026e35d4e..7b451f27c 100644 --- a/chain/actors/builtin/market/market.go +++ b/chain/actors/builtin/market/market.go @@ -22,6 +22,8 @@ import ( builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" + builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" + "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin" @@ -49,11 +51,15 @@ func init() { builtin.RegisterActorState(builtin5.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) { return load5(store, root) }) + + builtin.RegisterActorState(builtin6.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) { + return load6(store, root) + }) } var ( - Address = builtin5.StorageMarketActorAddr - Methods = builtin5.MethodsMarket + Address = builtin6.StorageMarketActorAddr + Methods = builtin6.MethodsMarket ) func Load(store adt.Store, act *types.Actor) (State, error) { @@ -74,6 +80,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) { case builtin5.StorageMarketActorCodeID: return load5(store, act.Head) + case builtin6.StorageMarketActorCodeID: + return load6(store, act.Head) + } return nil, xerrors.Errorf("unknown actor code %s", act.Code) } @@ -96,6 +105,9 @@ func MakeState(store adt.Store, av actors.Version) (State, error) { case actors.Version5: return make5(store) + case actors.Version6: + return make6(store) + } return nil, xerrors.Errorf("unknown actor version %d", av) } @@ -118,6 +130,9 @@ func GetActorCodeID(av actors.Version) (cid.Cid, error) { case actors.Version5: return builtin5.StorageMarketActorCodeID, nil + case actors.Version6: + return builtin6.StorageMarketActorCodeID, nil + } return cid.Undef, xerrors.Errorf("unknown actor version %d", av) diff --git a/chain/actors/builtin/market/v6.go b/chain/actors/builtin/market/v6.go new file mode 100644 index 000000000..4d1f479d3 --- /dev/null +++ b/chain/actors/builtin/market/v6.go @@ -0,0 +1,226 @@ +package market + +import ( + "bytes" + + "github.com/filecoin-project/go-address" + "github.com/filecoin-project/go-state-types/abi" + "github.com/ipfs/go-cid" + cbg "github.com/whyrusleeping/cbor-gen" + + "github.com/filecoin-project/lotus/chain/actors/adt" + "github.com/filecoin-project/lotus/chain/types" + + market6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/market" + adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt" +) + +var _ State = (*state6)(nil) + +func load6(store adt.Store, root cid.Cid) (State, error) { + out := state6{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make6(store adt.Store) (State, error) { + out := state6{store: store} + + s, err := market6.ConstructState(store) + if err != nil { + return nil, err + } + + out.State = *s + + return &out, nil +} + +type state6 struct { + market6.State + store adt.Store +} + +func (s *state6) TotalLocked() (abi.TokenAmount, error) { + fml := types.BigAdd(s.TotalClientLockedCollateral, s.TotalProviderLockedCollateral) + fml = types.BigAdd(fml, s.TotalClientStorageFee) + return fml, nil +} + +func (s *state6) BalancesChanged(otherState State) (bool, error) { + otherState6, ok := otherState.(*state6) + 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(otherState6.State.EscrowTable) || !s.State.LockedTable.Equals(otherState6.State.LockedTable), nil +} + +func (s *state6) StatesChanged(otherState State) (bool, error) { + otherState6, ok := otherState.(*state6) + 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(otherState6.State.States), nil +} + +func (s *state6) States() (DealStates, error) { + stateArray, err := adt6.AsArray(s.store, s.State.States, market6.StatesAmtBitwidth) + if err != nil { + return nil, err + } + return &dealStates6{stateArray}, nil +} + +func (s *state6) ProposalsChanged(otherState State) (bool, error) { + otherState6, ok := otherState.(*state6) + 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(otherState6.State.Proposals), nil +} + +func (s *state6) Proposals() (DealProposals, error) { + proposalArray, err := adt6.AsArray(s.store, s.State.Proposals, market6.ProposalsAmtBitwidth) + if err != nil { + return nil, err + } + return &dealProposals6{proposalArray}, nil +} + +func (s *state6) EscrowTable() (BalanceTable, error) { + bt, err := adt6.AsBalanceTable(s.store, s.State.EscrowTable) + if err != nil { + return nil, err + } + return &balanceTable6{bt}, nil +} + +func (s *state6) LockedTable() (BalanceTable, error) { + bt, err := adt6.AsBalanceTable(s.store, s.State.LockedTable) + if err != nil { + return nil, err + } + return &balanceTable6{bt}, nil +} + +func (s *state6) VerifyDealsForActivation( + minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch, +) (weight, verifiedWeight abi.DealWeight, err error) { + w, vw, _, err := market6.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) + return w, vw, err +} + +func (s *state6) NextID() (abi.DealID, error) { + return s.State.NextID, nil +} + +type balanceTable6 struct { + *adt6.BalanceTable +} + +func (bt *balanceTable6) ForEach(cb func(address.Address, abi.TokenAmount) error) error { + asMap := (*adt6.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 dealStates6 struct { + adt.Array +} + +func (s *dealStates6) Get(dealID abi.DealID) (*DealState, bool, error) { + var deal6 market6.DealState + found, err := s.Array.Get(uint64(dealID), &deal6) + if err != nil { + return nil, false, err + } + if !found { + return nil, false, nil + } + deal := fromV6DealState(deal6) + return &deal, true, nil +} + +func (s *dealStates6) ForEach(cb func(dealID abi.DealID, ds DealState) error) error { + var ds6 market6.DealState + return s.Array.ForEach(&ds6, func(idx int64) error { + return cb(abi.DealID(idx), fromV6DealState(ds6)) + }) +} + +func (s *dealStates6) decode(val *cbg.Deferred) (*DealState, error) { + var ds6 market6.DealState + if err := ds6.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil { + return nil, err + } + ds := fromV6DealState(ds6) + return &ds, nil +} + +func (s *dealStates6) array() adt.Array { + return s.Array +} + +func fromV6DealState(v6 market6.DealState) DealState { + return (DealState)(v6) +} + +type dealProposals6 struct { + adt.Array +} + +func (s *dealProposals6) Get(dealID abi.DealID) (*DealProposal, bool, error) { + var proposal6 market6.DealProposal + found, err := s.Array.Get(uint64(dealID), &proposal6) + if err != nil { + return nil, false, err + } + if !found { + return nil, false, nil + } + proposal := fromV6DealProposal(proposal6) + return &proposal, true, nil +} + +func (s *dealProposals6) ForEach(cb func(dealID abi.DealID, dp DealProposal) error) error { + var dp6 market6.DealProposal + return s.Array.ForEach(&dp6, func(idx int64) error { + return cb(abi.DealID(idx), fromV6DealProposal(dp6)) + }) +} + +func (s *dealProposals6) decode(val *cbg.Deferred) (*DealProposal, error) { + var dp6 market6.DealProposal + if err := dp6.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil { + return nil, err + } + dp := fromV6DealProposal(dp6) + return &dp, nil +} + +func (s *dealProposals6) array() adt.Array { + return s.Array +} + +func fromV6DealProposal(v6 market6.DealProposal) DealProposal { + return (DealProposal)(v6) +} + +func (s *state6) GetState() interface{} { + return &s.State +} diff --git a/chain/actors/builtin/miner/miner.go b/chain/actors/builtin/miner/miner.go index e61b95eef..1c7f47e11 100644 --- a/chain/actors/builtin/miner/miner.go +++ b/chain/actors/builtin/miner/miner.go @@ -33,6 +33,8 @@ import ( builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin" builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" + + builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" ) func init() { @@ -57,9 +59,13 @@ func init() { return load5(store, root) }) + builtin.RegisterActorState(builtin6.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) { + return load6(store, root) + }) + } -var Methods = builtin5.MethodsMiner +var Methods = builtin6.MethodsMiner // Unchanged between v0, v2, v3, v4, and v5 actors var WPoStProvingPeriod = miner0.WPoStProvingPeriod @@ -93,6 +99,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) { case builtin5.StorageMinerActorCodeID: return load5(store, act.Head) + case builtin6.StorageMinerActorCodeID: + return load6(store, act.Head) + } return nil, xerrors.Errorf("unknown actor code %s", act.Code) } @@ -115,6 +124,9 @@ func MakeState(store adt.Store, av actors.Version) (State, error) { case actors.Version5: return make5(store) + case actors.Version6: + return make6(store) + } return nil, xerrors.Errorf("unknown actor version %d", av) } @@ -137,6 +149,9 @@ func GetActorCodeID(av actors.Version) (cid.Cid, error) { case actors.Version5: return builtin5.StorageMinerActorCodeID, nil + case actors.Version6: + return builtin6.StorageMinerActorCodeID, nil + } return cid.Undef, xerrors.Errorf("unknown actor version %d", av) diff --git a/chain/actors/builtin/miner/v6.go b/chain/actors/builtin/miner/v6.go new file mode 100644 index 000000000..de5a22a10 --- /dev/null +++ b/chain/actors/builtin/miner/v6.go @@ -0,0 +1,570 @@ +package miner + +import ( + "bytes" + "errors" + + "github.com/filecoin-project/go-address" + "github.com/filecoin-project/go-bitfield" + rle "github.com/filecoin-project/go-bitfield/rle" + "github.com/filecoin-project/go-state-types/abi" + "github.com/filecoin-project/go-state-types/dline" + "github.com/ipfs/go-cid" + "github.com/libp2p/go-libp2p-core/peer" + cbg "github.com/whyrusleeping/cbor-gen" + "golang.org/x/xerrors" + + "github.com/filecoin-project/lotus/chain/actors/adt" + + builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" + + miner6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/miner" + adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt" +) + +var _ State = (*state6)(nil) + +func load6(store adt.Store, root cid.Cid) (State, error) { + out := state6{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make6(store adt.Store) (State, error) { + out := state6{store: store} + out.State = miner6.State{} + return &out, nil +} + +type state6 struct { + miner6.State + store adt.Store +} + +type deadline6 struct { + miner6.Deadline + store adt.Store +} + +type partition6 struct { + miner6.Partition + store adt.Store +} + +func (s *state6) 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 *state6) VestedFunds(epoch abi.ChainEpoch) (abi.TokenAmount, error) { + return s.CheckVestedFunds(s.store, epoch) +} + +func (s *state6) LockedFunds() (LockedFunds, error) { + return LockedFunds{ + VestingFunds: s.State.LockedFunds, + InitialPledgeRequirement: s.State.InitialPledge, + PreCommitDeposits: s.State.PreCommitDeposits, + }, nil +} + +func (s *state6) FeeDebt() (abi.TokenAmount, error) { + return s.State.FeeDebt, nil +} + +func (s *state6) InitialPledge() (abi.TokenAmount, error) { + return s.State.InitialPledge, nil +} + +func (s *state6) PreCommitDeposits() (abi.TokenAmount, error) { + return s.State.PreCommitDeposits, nil +} + +func (s *state6) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { + info, ok, err := s.State.GetSector(s.store, num) + if !ok || err != nil { + return nil, err + } + + ret := fromV6SectorOnChainInfo(*info) + return &ret, nil +} + +func (s *state6) 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 *state6) 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 *miner6.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 *state6) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, error) { + dls, err := s.State.LoadDeadlines(s.store) + if err != nil { + return nil, err + } + // NOTE: this can be optimized significantly. + // 1. If the sector is non-faulty, it will either expire on-time (can be + // learned from the sector info), or in the next quantized expiration + // epoch (i.e., the first element in the partition's expiration queue. + // 2. If it's faulty, it will expire early within the first 14 entries + // of the expiration queue. + stopErr := errors.New("stop") + out := SectorExpiration{} + err = dls.ForEach(s.store, func(dlIdx uint64, dl *miner6.Deadline) error { + partitions, err := dl.PartitionsArray(s.store) + if err != nil { + return err + } + quant := s.State.QuantSpecForDeadline(dlIdx) + var part miner6.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 := miner6.LoadExpirationQueue(s.store, part.ExpirationsEpochs, quant, miner6.PartitionExpirationAmtBitwidth) + if err != nil { + return err + } + var exp miner6.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 *state6) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) { + info, ok, err := s.State.GetPrecommittedSector(s.store, num) + if !ok || err != nil { + return nil, err + } + + ret := fromV6SectorPreCommitOnChainInfo(*info) + + return &ret, nil +} + +func (s *state6) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error { + precommitted, err := adt6.AsMap(s.store, s.State.PreCommittedSectors, builtin6.DefaultHamtBitwidth) + if err != nil { + return err + } + + var info miner6.SectorPreCommitOnChainInfo + if err := precommitted.ForEach(&info, func(_ string) error { + return cb(fromV6SectorPreCommitOnChainInfo(info)) + }); err != nil { + return err + } + + return nil +} + +func (s *state6) LoadSectors(snos *bitfield.BitField) ([]*SectorOnChainInfo, error) { + sectors, err := miner6.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 info6 miner6.SectorOnChainInfo + if err := sectors.ForEach(&info6, func(_ int64) error { + info := fromV6SectorOnChainInfo(info6) + infos = append(infos, &info) + return nil + }); err != nil { + return nil, err + } + return infos, nil + } + + // Otherwise, load selected. + infos6, err := sectors.Load(*snos) + if err != nil { + return nil, err + } + infos := make([]*SectorOnChainInfo, len(infos6)) + for i, info6 := range infos6 { + info := fromV6SectorOnChainInfo(*info6) + infos[i] = &info + } + return infos, nil +} + +func (s *state6) loadAllocatedSectorNumbers() (bitfield.BitField, error) { + var allocatedSectors bitfield.BitField + err := s.store.Get(s.store.Context(), s.State.AllocatedSectors, &allocatedSectors) + return allocatedSectors, err +} + +func (s *state6) IsAllocated(num abi.SectorNumber) (bool, error) { + allocatedSectors, err := s.loadAllocatedSectorNumbers() + if err != nil { + return false, err + } + + return allocatedSectors.IsSet(uint64(num)) +} + +func (s *state6) GetProvingPeriodStart() (abi.ChainEpoch, error) { + return s.State.ProvingPeriodStart, nil +} + +func (s *state6) 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 *state6) 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 *state6) 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 &deadline6{*dl, s.store}, nil +} + +func (s *state6) 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 *miner6.Deadline) error { + return cb(i, &deadline6{*dl, s.store}) + }) +} + +func (s *state6) NumDeadlines() (uint64, error) { + return miner6.WPoStPeriodDeadlines, nil +} + +func (s *state6) DeadlinesChanged(other State) (bool, error) { + other6, ok := other.(*state6) + if !ok { + // treat an upgrade as a change, always + return true, nil + } + + return !s.State.Deadlines.Equals(other6.Deadlines), nil +} + +func (s *state6) MinerInfoChanged(other State) (bool, error) { + other0, ok := other.(*state6) + if !ok { + // treat an upgrade as a change, always + return true, nil + } + return !s.State.Info.Equals(other0.State.Info), nil +} + +func (s *state6) Info() (MinerInfo, error) { + info, err := s.State.GetInfo(s.store) + if err != nil { + return MinerInfo{}, err + } + + var pid *peer.ID + if peerID, err := peer.IDFromBytes(info.PeerId); err == nil { + pid = &peerID + } + + mi := MinerInfo{ + Owner: info.Owner, + Worker: info.Worker, + ControlAddresses: info.ControlAddresses, + + NewWorker: address.Undef, + WorkerChangeEpoch: -1, + + PeerId: pid, + Multiaddrs: info.Multiaddrs, + WindowPoStProofType: info.WindowPoStProofType, + SectorSize: info.SectorSize, + WindowPoStPartitionSectors: info.WindowPoStPartitionSectors, + ConsensusFaultElapsed: info.ConsensusFaultElapsed, + } + + if info.PendingWorkerKey != nil { + mi.NewWorker = info.PendingWorkerKey.NewWorker + mi.WorkerChangeEpoch = info.PendingWorkerKey.EffectiveAt + } + + return mi, nil +} + +func (s *state6) DeadlineInfo(epoch abi.ChainEpoch) (*dline.Info, error) { + return s.State.RecordedDeadlineInfo(epoch), nil +} + +func (s *state6) DeadlineCronActive() (bool, error) { + return s.State.DeadlineCronActive, nil +} + +func (s *state6) sectors() (adt.Array, error) { + return adt6.AsArray(s.store, s.Sectors, miner6.SectorsAmtBitwidth) +} + +func (s *state6) decodeSectorOnChainInfo(val *cbg.Deferred) (SectorOnChainInfo, error) { + var si miner6.SectorOnChainInfo + err := si.UnmarshalCBOR(bytes.NewReader(val.Raw)) + if err != nil { + return SectorOnChainInfo{}, err + } + + return fromV6SectorOnChainInfo(si), nil +} + +func (s *state6) precommits() (adt.Map, error) { + return adt6.AsMap(s.store, s.PreCommittedSectors, builtin6.DefaultHamtBitwidth) +} + +func (s *state6) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) { + var sp miner6.SectorPreCommitOnChainInfo + err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw)) + if err != nil { + return SectorPreCommitOnChainInfo{}, err + } + + return fromV6SectorPreCommitOnChainInfo(sp), nil +} + +func (s *state6) EraseAllUnproven() error { + + dls, err := s.State.LoadDeadlines(s.store) + if err != nil { + return err + } + + err = dls.ForEach(s.store, func(dindx uint64, dl *miner6.Deadline) error { + ps, err := dl.PartitionsArray(s.store) + if err != nil { + return err + } + + var part miner6.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 *deadline6) LoadPartition(idx uint64) (Partition, error) { + p, err := d.Deadline.LoadPartition(d.store, idx) + if err != nil { + return nil, err + } + return &partition6{*p, d.store}, nil +} + +func (d *deadline6) ForEachPartition(cb func(uint64, Partition) error) error { + ps, err := d.Deadline.PartitionsArray(d.store) + if err != nil { + return err + } + var part miner6.Partition + return ps.ForEach(&part, func(i int64) error { + return cb(uint64(i), &partition6{part, d.store}) + }) +} + +func (d *deadline6) PartitionsChanged(other Deadline) (bool, error) { + other6, ok := other.(*deadline6) + if !ok { + // treat an upgrade as a change, always + return true, nil + } + + return !d.Deadline.Partitions.Equals(other6.Deadline.Partitions), nil +} + +func (d *deadline6) PartitionsPoSted() (bitfield.BitField, error) { + return d.Deadline.PartitionsPoSted, nil +} + +func (d *deadline6) DisputableProofCount() (uint64, error) { + + ops, err := d.OptimisticProofsSnapshotArray(d.store) + if err != nil { + return 0, err + } + + return ops.Length(), nil + +} + +func (p *partition6) AllSectors() (bitfield.BitField, error) { + return p.Partition.Sectors, nil +} + +func (p *partition6) FaultySectors() (bitfield.BitField, error) { + return p.Partition.Faults, nil +} + +func (p *partition6) RecoveringSectors() (bitfield.BitField, error) { + return p.Partition.Recoveries, nil +} + +func (p *partition6) UnprovenSectors() (bitfield.BitField, error) { + return p.Partition.Unproven, nil +} + +func fromV6SectorOnChainInfo(v6 miner6.SectorOnChainInfo) SectorOnChainInfo { + + return SectorOnChainInfo{ + SectorNumber: v6.SectorNumber, + SealProof: v6.SealProof, + SealedCID: v6.SealedCID, + DealIDs: v6.DealIDs, + Activation: v6.Activation, + Expiration: v6.Expiration, + DealWeight: v6.DealWeight, + VerifiedDealWeight: v6.VerifiedDealWeight, + InitialPledge: v6.InitialPledge, + ExpectedDayReward: v6.ExpectedDayReward, + ExpectedStoragePledge: v6.ExpectedStoragePledge, + } + +} + +func fromV6SectorPreCommitOnChainInfo(v6 miner6.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo { + + return SectorPreCommitOnChainInfo{ + Info: (SectorPreCommitInfo)(v6.Info), + PreCommitDeposit: v6.PreCommitDeposit, + PreCommitEpoch: v6.PreCommitEpoch, + DealWeight: v6.DealWeight, + VerifiedDealWeight: v6.VerifiedDealWeight, + } + +} + +func (s *state6) GetState() interface{} { + return &s.State +} diff --git a/chain/actors/builtin/multisig/message6.go b/chain/actors/builtin/multisig/message6.go new file mode 100644 index 000000000..b2b95245e --- /dev/null +++ b/chain/actors/builtin/multisig/message6.go @@ -0,0 +1,71 @@ +package multisig + +import ( + "golang.org/x/xerrors" + + "github.com/filecoin-project/go-address" + "github.com/filecoin-project/go-state-types/abi" + + builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" + init6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/init" + multisig6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/multisig" + + "github.com/filecoin-project/lotus/chain/actors" + init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init" + "github.com/filecoin-project/lotus/chain/types" +) + +type message6 struct{ message0 } + +func (m message6) 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 := &multisig6.ConstructorParams{ + Signers: signers, + NumApprovalsThreshold: threshold, + UnlockDuration: unlockDuration, + StartEpoch: unlockStart, + } + + enc, actErr := actors.SerializeParams(msigParams) + if actErr != nil { + return nil, actErr + } + + // new actors are created by invoking 'exec' on the init actor with the constructor params + execParams := &init6.ExecParams{ + CodeCID: builtin6.MultisigActorCodeID, + ConstructorParams: enc, + } + + enc, actErr = actors.SerializeParams(execParams) + if actErr != nil { + return nil, actErr + } + + return &types.Message{ + To: init_.Address, + From: m.from, + Method: builtin6.MethodsInit.Exec, + Params: enc, + Value: initialAmount, + }, nil +} diff --git a/chain/actors/builtin/multisig/multisig.go b/chain/actors/builtin/multisig/multisig.go index c950ced90..ee725f7e5 100644 --- a/chain/actors/builtin/multisig/multisig.go +++ b/chain/actors/builtin/multisig/multisig.go @@ -13,7 +13,7 @@ import ( "github.com/ipfs/go-cid" msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig" - msig5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/multisig" + msig6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/multisig" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" @@ -25,6 +25,8 @@ import ( builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" + builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" + "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin" @@ -52,6 +54,10 @@ func init() { builtin.RegisterActorState(builtin5.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) { return load5(store, root) }) + + builtin.RegisterActorState(builtin6.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) { + return load6(store, root) + }) } func Load(store adt.Store, act *types.Actor) (State, error) { @@ -72,6 +78,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) { case builtin5.MultisigActorCodeID: return load5(store, act.Head) + case builtin6.MultisigActorCodeID: + return load6(store, act.Head) + } return nil, xerrors.Errorf("unknown actor code %s", act.Code) } @@ -94,6 +103,9 @@ func MakeState(store adt.Store, av actors.Version, signers []address.Address, th case actors.Version5: return make5(store, signers, threshold, startEpoch, unlockDuration, initialBalance) + case actors.Version6: + return make6(store, signers, threshold, startEpoch, unlockDuration, initialBalance) + } return nil, xerrors.Errorf("unknown actor version %d", av) } @@ -116,6 +128,9 @@ func GetActorCodeID(av actors.Version) (cid.Cid, error) { case actors.Version5: return builtin5.MultisigActorCodeID, nil + case actors.Version6: + return builtin6.MultisigActorCodeID, nil + } return cid.Undef, xerrors.Errorf("unknown actor version %d", av) @@ -141,7 +156,7 @@ type State interface { type Transaction = msig0.Transaction -var Methods = builtin5.MethodsMultisig +var Methods = builtin6.MethodsMultisig func Message(version actors.Version, from address.Address) MessageBuilder { switch version { @@ -160,6 +175,9 @@ func Message(version actors.Version, from address.Address) MessageBuilder { case actors.Version5: return message5{message0{from}} + + case actors.Version6: + return message6{message0{from}} default: panic(fmt.Sprintf("unsupported actors version: %d", version)) } @@ -183,13 +201,13 @@ type MessageBuilder interface { } // this type is the same between v0 and v2 -type ProposalHashData = msig5.ProposalHashData -type ProposeReturn = msig5.ProposeReturn -type ProposeParams = msig5.ProposeParams -type ApproveReturn = msig5.ApproveReturn +type ProposalHashData = msig6.ProposalHashData +type ProposeReturn = msig6.ProposeReturn +type ProposeParams = msig6.ProposeParams +type ApproveReturn = msig6.ApproveReturn func txnParams(id uint64, data *ProposalHashData) ([]byte, error) { - params := msig5.TxnIDParams{ID: msig5.TxnID(id)} + params := msig6.TxnIDParams{ID: msig6.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) diff --git a/chain/actors/builtin/multisig/v6.go b/chain/actors/builtin/multisig/v6.go new file mode 100644 index 000000000..fa16494f8 --- /dev/null +++ b/chain/actors/builtin/multisig/v6.go @@ -0,0 +1,119 @@ +package multisig + +import ( + "bytes" + "encoding/binary" + + adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt" + + "github.com/filecoin-project/go-address" + "github.com/filecoin-project/go-state-types/abi" + "github.com/ipfs/go-cid" + cbg "github.com/whyrusleeping/cbor-gen" + "golang.org/x/xerrors" + + "github.com/filecoin-project/lotus/chain/actors/adt" + + builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" + + msig6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/multisig" +) + +var _ State = (*state6)(nil) + +func load6(store adt.Store, root cid.Cid) (State, error) { + out := state6{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make6(store adt.Store, signers []address.Address, threshold uint64, startEpoch abi.ChainEpoch, unlockDuration abi.ChainEpoch, initialBalance abi.TokenAmount) (State, error) { + out := state6{store: store} + out.State = msig6.State{} + out.State.Signers = signers + out.State.NumApprovalsThreshold = threshold + out.State.StartEpoch = startEpoch + out.State.UnlockDuration = unlockDuration + out.State.InitialBalance = initialBalance + + em, err := adt6.StoreEmptyMap(store, builtin6.DefaultHamtBitwidth) + if err != nil { + return nil, err + } + + out.State.PendingTxns = em + + return &out, nil +} + +type state6 struct { + msig6.State + store adt.Store +} + +func (s *state6) LockedBalance(currEpoch abi.ChainEpoch) (abi.TokenAmount, error) { + return s.State.AmountLocked(currEpoch - s.State.StartEpoch), nil +} + +func (s *state6) StartEpoch() (abi.ChainEpoch, error) { + return s.State.StartEpoch, nil +} + +func (s *state6) UnlockDuration() (abi.ChainEpoch, error) { + return s.State.UnlockDuration, nil +} + +func (s *state6) InitialBalance() (abi.TokenAmount, error) { + return s.State.InitialBalance, nil +} + +func (s *state6) Threshold() (uint64, error) { + return s.State.NumApprovalsThreshold, nil +} + +func (s *state6) Signers() ([]address.Address, error) { + return s.State.Signers, nil +} + +func (s *state6) ForEachPendingTxn(cb func(id int64, txn Transaction) error) error { + arr, err := adt6.AsMap(s.store, s.State.PendingTxns, builtin6.DefaultHamtBitwidth) + if err != nil { + return err + } + var out msig6.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 *state6) PendingTxnChanged(other State) (bool, error) { + other6, ok := other.(*state6) + if !ok { + // treat an upgrade as a change, always + return true, nil + } + return !s.State.PendingTxns.Equals(other6.PendingTxns), nil +} + +func (s *state6) transactions() (adt.Map, error) { + return adt6.AsMap(s.store, s.PendingTxns, builtin6.DefaultHamtBitwidth) +} + +func (s *state6) decodeTransaction(val *cbg.Deferred) (Transaction, error) { + var tx msig6.Transaction + if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil { + return Transaction{}, err + } + return tx, nil +} + +func (s *state6) GetState() interface{} { + return &s.State +} diff --git a/chain/actors/builtin/paych/message6.go b/chain/actors/builtin/paych/message6.go new file mode 100644 index 000000000..aecf26983 --- /dev/null +++ b/chain/actors/builtin/paych/message6.go @@ -0,0 +1,74 @@ +package paych + +import ( + "github.com/filecoin-project/go-address" + "github.com/filecoin-project/go-state-types/abi" + + builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" + init6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/init" + paych6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/paych" + + "github.com/filecoin-project/lotus/chain/actors" + init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init" + "github.com/filecoin-project/lotus/chain/types" +) + +type message6 struct{ from address.Address } + +func (m message6) Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error) { + params, aerr := actors.SerializeParams(&paych6.ConstructorParams{From: m.from, To: to}) + if aerr != nil { + return nil, aerr + } + enc, aerr := actors.SerializeParams(&init6.ExecParams{ + CodeCID: builtin6.PaymentChannelActorCodeID, + ConstructorParams: params, + }) + if aerr != nil { + return nil, aerr + } + + return &types.Message{ + To: init_.Address, + From: m.from, + Value: initialAmount, + Method: builtin6.MethodsInit.Exec, + Params: enc, + }, nil +} + +func (m message6) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) { + params, aerr := actors.SerializeParams(&paych6.UpdateChannelStateParams{ + Sv: *sv, + Secret: secret, + }) + if aerr != nil { + return nil, aerr + } + + return &types.Message{ + To: paych, + From: m.from, + Value: abi.NewTokenAmount(0), + Method: builtin6.MethodsPaych.UpdateChannelState, + Params: params, + }, nil +} + +func (m message6) Settle(paych address.Address) (*types.Message, error) { + return &types.Message{ + To: paych, + From: m.from, + Value: abi.NewTokenAmount(0), + Method: builtin6.MethodsPaych.Settle, + }, nil +} + +func (m message6) Collect(paych address.Address) (*types.Message, error) { + return &types.Message{ + To: paych, + From: m.from, + Value: abi.NewTokenAmount(0), + Method: builtin6.MethodsPaych.Collect, + }, nil +} diff --git a/chain/actors/builtin/paych/paych.go b/chain/actors/builtin/paych/paych.go index d87f70f0c..eea3659f8 100644 --- a/chain/actors/builtin/paych/paych.go +++ b/chain/actors/builtin/paych/paych.go @@ -25,6 +25,8 @@ import ( builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" + builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" + "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin" @@ -52,6 +54,10 @@ func init() { builtin.RegisterActorState(builtin5.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) { return load5(store, root) }) + + builtin.RegisterActorState(builtin6.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) { + return load6(store, root) + }) } // Load returns an abstract copy of payment channel state, irregardless of actor version @@ -73,6 +79,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) { case builtin5.PaymentChannelActorCodeID: return load5(store, act.Head) + case builtin6.PaymentChannelActorCodeID: + return load6(store, act.Head) + } return nil, xerrors.Errorf("unknown actor code %s", act.Code) } @@ -95,6 +104,9 @@ func MakeState(store adt.Store, av actors.Version) (State, error) { case actors.Version5: return make5(store) + case actors.Version6: + return make6(store) + } return nil, xerrors.Errorf("unknown actor version %d", av) } @@ -117,6 +129,9 @@ func GetActorCodeID(av actors.Version) (cid.Cid, error) { case actors.Version5: return builtin5.PaymentChannelActorCodeID, nil + case actors.Version6: + return builtin6.PaymentChannelActorCodeID, nil + } return cid.Undef, xerrors.Errorf("unknown actor version %d", av) @@ -170,7 +185,7 @@ func DecodeSignedVoucher(s string) (*SignedVoucher, error) { return &sv, nil } -var Methods = builtin5.MethodsPaych +var Methods = builtin6.MethodsPaych func Message(version actors.Version, from address.Address) MessageBuilder { switch version { @@ -190,6 +205,9 @@ func Message(version actors.Version, from address.Address) MessageBuilder { case actors.Version5: return message5{from} + case actors.Version6: + return message6{from} + default: panic(fmt.Sprintf("unsupported actors version: %d", version)) } diff --git a/chain/actors/builtin/paych/v6.go b/chain/actors/builtin/paych/v6.go new file mode 100644 index 000000000..0d60b1f03 --- /dev/null +++ b/chain/actors/builtin/paych/v6.go @@ -0,0 +1,114 @@ +package paych + +import ( + "github.com/ipfs/go-cid" + + "github.com/filecoin-project/go-address" + "github.com/filecoin-project/go-state-types/abi" + "github.com/filecoin-project/go-state-types/big" + + "github.com/filecoin-project/lotus/chain/actors/adt" + + paych6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/paych" + adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt" +) + +var _ State = (*state6)(nil) + +func load6(store adt.Store, root cid.Cid) (State, error) { + out := state6{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make6(store adt.Store) (State, error) { + out := state6{store: store} + out.State = paych6.State{} + return &out, nil +} + +type state6 struct { + paych6.State + store adt.Store + lsAmt *adt6.Array +} + +// Channel owner, who has funded the actor +func (s *state6) From() (address.Address, error) { + return s.State.From, nil +} + +// Recipient of payouts from channel +func (s *state6) To() (address.Address, error) { + return s.State.To, nil +} + +// Height at which the channel can be `Collected` +func (s *state6) SettlingAt() (abi.ChainEpoch, error) { + return s.State.SettlingAt, nil +} + +// Amount successfully redeemed through the payment channel, paid out on `Collect()` +func (s *state6) ToSend() (abi.TokenAmount, error) { + return s.State.ToSend, nil +} + +func (s *state6) getOrLoadLsAmt() (*adt6.Array, error) { + if s.lsAmt != nil { + return s.lsAmt, nil + } + + // Get the lane state from the chain + lsamt, err := adt6.AsArray(s.store, s.State.LaneStates, paych6.LaneStatesAmtBitwidth) + if err != nil { + return nil, err + } + + s.lsAmt = lsamt + return lsamt, nil +} + +// Get total number of lanes +func (s *state6) LaneCount() (uint64, error) { + lsamt, err := s.getOrLoadLsAmt() + if err != nil { + return 0, err + } + return lsamt.Length(), nil +} + +func (s *state6) GetState() interface{} { + return &s.State +} + +// Iterate lane states +func (s *state6) 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 paych6.LaneState + return lsamt.ForEach(&ls, func(i int64) error { + return cb(uint64(i), &laneState6{ls}) + }) +} + +type laneState6 struct { + paych6.LaneState +} + +func (ls *laneState6) Redeemed() (big.Int, error) { + return ls.LaneState.Redeemed, nil +} + +func (ls *laneState6) Nonce() (uint64, error) { + return ls.LaneState.Nonce, nil +} diff --git a/chain/actors/builtin/power/power.go b/chain/actors/builtin/power/power.go index 5b4aa1b04..84bd6948a 100644 --- a/chain/actors/builtin/power/power.go +++ b/chain/actors/builtin/power/power.go @@ -24,6 +24,8 @@ import ( builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin" builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" + + builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" ) func init() { @@ -47,11 +49,15 @@ func init() { builtin.RegisterActorState(builtin5.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) { return load5(store, root) }) + + builtin.RegisterActorState(builtin6.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) { + return load6(store, root) + }) } var ( - Address = builtin5.StoragePowerActorAddr - Methods = builtin5.MethodsPower + Address = builtin6.StoragePowerActorAddr + Methods = builtin6.MethodsPower ) func Load(store adt.Store, act *types.Actor) (State, error) { @@ -72,6 +78,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) { case builtin5.StoragePowerActorCodeID: return load5(store, act.Head) + case builtin6.StoragePowerActorCodeID: + return load6(store, act.Head) + } return nil, xerrors.Errorf("unknown actor code %s", act.Code) } @@ -94,6 +103,9 @@ func MakeState(store adt.Store, av actors.Version) (State, error) { case actors.Version5: return make5(store) + case actors.Version6: + return make6(store) + } return nil, xerrors.Errorf("unknown actor version %d", av) } @@ -116,6 +128,9 @@ func GetActorCodeID(av actors.Version) (cid.Cid, error) { case actors.Version5: return builtin5.StoragePowerActorCodeID, nil + case actors.Version6: + return builtin6.StoragePowerActorCodeID, nil + } return cid.Undef, xerrors.Errorf("unknown actor version %d", av) diff --git a/chain/actors/builtin/power/v6.go b/chain/actors/builtin/power/v6.go new file mode 100644 index 000000000..4273c2c73 --- /dev/null +++ b/chain/actors/builtin/power/v6.go @@ -0,0 +1,187 @@ +package power + +import ( + "bytes" + + "github.com/filecoin-project/go-address" + "github.com/filecoin-project/go-state-types/abi" + "github.com/ipfs/go-cid" + cbg "github.com/whyrusleeping/cbor-gen" + + "github.com/filecoin-project/lotus/chain/actors/adt" + "github.com/filecoin-project/lotus/chain/actors/builtin" + + builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" + + power6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/power" + adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt" +) + +var _ State = (*state6)(nil) + +func load6(store adt.Store, root cid.Cid) (State, error) { + out := state6{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make6(store adt.Store) (State, error) { + out := state6{store: store} + + s, err := power6.ConstructState(store) + if err != nil { + return nil, err + } + + out.State = *s + + return &out, nil +} + +type state6 struct { + power6.State + store adt.Store +} + +func (s *state6) TotalLocked() (abi.TokenAmount, error) { + return s.TotalPledgeCollateral, nil +} + +func (s *state6) 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 *state6) TotalCommitted() (Claim, error) { + return Claim{ + RawBytePower: s.TotalBytesCommitted, + QualityAdjPower: s.TotalQABytesCommitted, + }, nil +} + +func (s *state6) MinerPower(addr address.Address) (Claim, bool, error) { + claims, err := s.claims() + if err != nil { + return Claim{}, false, err + } + var claim power6.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 *state6) MinerNominalPowerMeetsConsensusMinimum(a address.Address) (bool, error) { + return s.State.MinerNominalPowerMeetsConsensusMinimum(s.store, a) +} + +func (s *state6) TotalPowerSmoothed() (builtin.FilterEstimate, error) { + return builtin.FromV6FilterEstimate(s.State.ThisEpochQAPowerSmoothed), nil +} + +func (s *state6) MinerCounts() (uint64, uint64, error) { + return uint64(s.State.MinerAboveMinPowerCount), uint64(s.State.MinerCount), nil +} + +func (s *state6) 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 *state6) ForEachClaim(cb func(miner address.Address, claim Claim) error) error { + claims, err := s.claims() + if err != nil { + return err + } + + var claim power6.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 *state6) ClaimsChanged(other State) (bool, error) { + other6, ok := other.(*state6) + if !ok { + // treat an upgrade as a change, always + return true, nil + } + return !s.State.Claims.Equals(other6.State.Claims), nil +} + +func (s *state6) SetTotalQualityAdjPower(p abi.StoragePower) error { + s.State.TotalQualityAdjPower = p + return nil +} + +func (s *state6) SetTotalRawBytePower(p abi.StoragePower) error { + s.State.TotalRawBytePower = p + return nil +} + +func (s *state6) SetThisEpochQualityAdjPower(p abi.StoragePower) error { + s.State.ThisEpochQualityAdjPower = p + return nil +} + +func (s *state6) SetThisEpochRawBytePower(p abi.StoragePower) error { + s.State.ThisEpochRawBytePower = p + return nil +} + +func (s *state6) GetState() interface{} { + return &s.State +} + +func (s *state6) claims() (adt.Map, error) { + return adt6.AsMap(s.store, s.Claims, builtin6.DefaultHamtBitwidth) +} + +func (s *state6) decodeClaim(val *cbg.Deferred) (Claim, error) { + var ci power6.Claim + if err := ci.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil { + return Claim{}, err + } + return fromV6Claim(ci), nil +} + +func fromV6Claim(v6 power6.Claim) Claim { + return Claim{ + RawBytePower: v6.RawBytePower, + QualityAdjPower: v6.QualityAdjPower, + } +} diff --git a/chain/actors/builtin/reward/reward.go b/chain/actors/builtin/reward/reward.go index ebec85517..38d5b5b87 100644 --- a/chain/actors/builtin/reward/reward.go +++ b/chain/actors/builtin/reward/reward.go @@ -19,6 +19,8 @@ import ( builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" + builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" + "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/types" @@ -45,11 +47,15 @@ func init() { builtin.RegisterActorState(builtin5.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) { return load5(store, root) }) + + builtin.RegisterActorState(builtin6.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) { + return load6(store, root) + }) } var ( - Address = builtin5.RewardActorAddr - Methods = builtin5.MethodsReward + Address = builtin6.RewardActorAddr + Methods = builtin6.MethodsReward ) func Load(store adt.Store, act *types.Actor) (State, error) { @@ -70,6 +76,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) { case builtin5.RewardActorCodeID: return load5(store, act.Head) + case builtin6.RewardActorCodeID: + return load6(store, act.Head) + } return nil, xerrors.Errorf("unknown actor code %s", act.Code) } @@ -92,6 +101,9 @@ func MakeState(store adt.Store, av actors.Version, currRealizedPower abi.Storage case actors.Version5: return make5(store, currRealizedPower) + case actors.Version6: + return make6(store, currRealizedPower) + } return nil, xerrors.Errorf("unknown actor version %d", av) } @@ -114,6 +126,9 @@ func GetActorCodeID(av actors.Version) (cid.Cid, error) { case actors.Version5: return builtin5.RewardActorCodeID, nil + case actors.Version6: + return builtin6.RewardActorCodeID, nil + } return cid.Undef, xerrors.Errorf("unknown actor version %d", av) diff --git a/chain/actors/builtin/reward/v6.go b/chain/actors/builtin/reward/v6.go new file mode 100644 index 000000000..010a3a870 --- /dev/null +++ b/chain/actors/builtin/reward/v6.go @@ -0,0 +1,98 @@ +package reward + +import ( + "github.com/filecoin-project/go-state-types/abi" + "github.com/ipfs/go-cid" + + "github.com/filecoin-project/lotus/chain/actors/adt" + "github.com/filecoin-project/lotus/chain/actors/builtin" + + miner6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/miner" + reward6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/reward" + smoothing6 "github.com/filecoin-project/specs-actors/v6/actors/util/smoothing" +) + +var _ State = (*state6)(nil) + +func load6(store adt.Store, root cid.Cid) (State, error) { + out := state6{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make6(store adt.Store, currRealizedPower abi.StoragePower) (State, error) { + out := state6{store: store} + out.State = *reward6.ConstructState(currRealizedPower) + return &out, nil +} + +type state6 struct { + reward6.State + store adt.Store +} + +func (s *state6) ThisEpochReward() (abi.TokenAmount, error) { + return s.State.ThisEpochReward, nil +} + +func (s *state6) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) { + + return builtin.FilterEstimate{ + PositionEstimate: s.State.ThisEpochRewardSmoothed.PositionEstimate, + VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate, + }, nil + +} + +func (s *state6) ThisEpochBaselinePower() (abi.StoragePower, error) { + return s.State.ThisEpochBaselinePower, nil +} + +func (s *state6) TotalStoragePowerReward() (abi.TokenAmount, error) { + return s.State.TotalStoragePowerReward, nil +} + +func (s *state6) EffectiveBaselinePower() (abi.StoragePower, error) { + return s.State.EffectiveBaselinePower, nil +} + +func (s *state6) EffectiveNetworkTime() (abi.ChainEpoch, error) { + return s.State.EffectiveNetworkTime, nil +} + +func (s *state6) CumsumBaseline() (reward6.Spacetime, error) { + return s.State.CumsumBaseline, nil +} + +func (s *state6) CumsumRealized() (reward6.Spacetime, error) { + return s.State.CumsumRealized, nil +} + +func (s *state6) InitialPledgeForPower(qaPower abi.StoragePower, networkTotalPledge abi.TokenAmount, networkQAPower *builtin.FilterEstimate, circSupply abi.TokenAmount) (abi.TokenAmount, error) { + return miner6.InitialPledgeForPower( + qaPower, + s.State.ThisEpochBaselinePower, + s.State.ThisEpochRewardSmoothed, + smoothing6.FilterEstimate{ + PositionEstimate: networkQAPower.PositionEstimate, + VelocityEstimate: networkQAPower.VelocityEstimate, + }, + circSupply, + ), nil +} + +func (s *state6) PreCommitDepositForPower(networkQAPower builtin.FilterEstimate, sectorWeight abi.StoragePower) (abi.TokenAmount, error) { + return miner6.PreCommitDepositForPower(s.State.ThisEpochRewardSmoothed, + smoothing6.FilterEstimate{ + PositionEstimate: networkQAPower.PositionEstimate, + VelocityEstimate: networkQAPower.VelocityEstimate, + }, + sectorWeight), nil +} + +func (s *state6) GetState() interface{} { + return &s.State +} diff --git a/chain/actors/builtin/system/system.go b/chain/actors/builtin/system/system.go index 289fb4d5d..3d6105c38 100644 --- a/chain/actors/builtin/system/system.go +++ b/chain/actors/builtin/system/system.go @@ -15,10 +15,12 @@ import ( builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin" builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" + + builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" ) var ( - Address = builtin5.SystemActorAddr + Address = builtin6.SystemActorAddr ) func MakeState(store adt.Store, av actors.Version) (State, error) { @@ -39,6 +41,9 @@ func MakeState(store adt.Store, av actors.Version) (State, error) { case actors.Version5: return make5(store) + case actors.Version6: + return make6(store) + } return nil, xerrors.Errorf("unknown actor version %d", av) } @@ -61,6 +66,9 @@ func GetActorCodeID(av actors.Version) (cid.Cid, error) { case actors.Version5: return builtin5.SystemActorCodeID, nil + case actors.Version6: + return builtin6.SystemActorCodeID, nil + } return cid.Undef, xerrors.Errorf("unknown actor version %d", av) diff --git a/chain/actors/builtin/system/v6.go b/chain/actors/builtin/system/v6.go new file mode 100644 index 000000000..689620afb --- /dev/null +++ b/chain/actors/builtin/system/v6.go @@ -0,0 +1,35 @@ +package system + +import ( + "github.com/ipfs/go-cid" + + "github.com/filecoin-project/lotus/chain/actors/adt" + + system6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/system" +) + +var _ State = (*state6)(nil) + +func load6(store adt.Store, root cid.Cid) (State, error) { + out := state6{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make6(store adt.Store) (State, error) { + out := state6{store: store} + out.State = system6.State{} + return &out, nil +} + +type state6 struct { + system6.State + store adt.Store +} + +func (s *state6) GetState() interface{} { + return &s.State +} diff --git a/chain/actors/builtin/verifreg/v6.go b/chain/actors/builtin/verifreg/v6.go new file mode 100644 index 000000000..b2c5078e7 --- /dev/null +++ b/chain/actors/builtin/verifreg/v6.go @@ -0,0 +1,75 @@ +package verifreg + +import ( + "github.com/filecoin-project/go-address" + "github.com/filecoin-project/go-state-types/abi" + "github.com/ipfs/go-cid" + + "github.com/filecoin-project/lotus/chain/actors" + "github.com/filecoin-project/lotus/chain/actors/adt" + + builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" + verifreg6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/verifreg" + adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt" +) + +var _ State = (*state6)(nil) + +func load6(store adt.Store, root cid.Cid) (State, error) { + out := state6{store: store} + err := store.Get(store.Context(), root, &out) + if err != nil { + return nil, err + } + return &out, nil +} + +func make6(store adt.Store, rootKeyAddress address.Address) (State, error) { + out := state6{store: store} + + s, err := verifreg6.ConstructState(store, rootKeyAddress) + if err != nil { + return nil, err + } + + out.State = *s + + return &out, nil +} + +type state6 struct { + verifreg6.State + store adt.Store +} + +func (s *state6) RootKey() (address.Address, error) { + return s.State.RootKey, nil +} + +func (s *state6) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) { + return getDataCap(s.store, actors.Version6, s.verifiedClients, addr) +} + +func (s *state6) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) { + return getDataCap(s.store, actors.Version6, s.verifiers, addr) +} + +func (s *state6) ForEachVerifier(cb func(addr address.Address, dcap abi.StoragePower) error) error { + return forEachCap(s.store, actors.Version6, s.verifiers, cb) +} + +func (s *state6) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error { + return forEachCap(s.store, actors.Version6, s.verifiedClients, cb) +} + +func (s *state6) verifiedClients() (adt.Map, error) { + return adt6.AsMap(s.store, s.VerifiedClients, builtin6.DefaultHamtBitwidth) +} + +func (s *state6) verifiers() (adt.Map, error) { + return adt6.AsMap(s.store, s.Verifiers, builtin6.DefaultHamtBitwidth) +} + +func (s *state6) GetState() interface{} { + return &s.State +} diff --git a/chain/actors/builtin/verifreg/verifreg.go b/chain/actors/builtin/verifreg/verifreg.go index 88104ad69..31e8e5a08 100644 --- a/chain/actors/builtin/verifreg/verifreg.go +++ b/chain/actors/builtin/verifreg/verifreg.go @@ -19,6 +19,8 @@ import ( builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" + builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" + "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin" @@ -47,11 +49,15 @@ func init() { return load5(store, root) }) + builtin.RegisterActorState(builtin6.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) { + return load6(store, root) + }) + } var ( - Address = builtin5.VerifiedRegistryActorAddr - Methods = builtin5.MethodsVerifiedRegistry + Address = builtin6.VerifiedRegistryActorAddr + Methods = builtin6.MethodsVerifiedRegistry ) func Load(store adt.Store, act *types.Actor) (State, error) { @@ -72,6 +78,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) { case builtin5.VerifiedRegistryActorCodeID: return load5(store, act.Head) + case builtin6.VerifiedRegistryActorCodeID: + return load6(store, act.Head) + } return nil, xerrors.Errorf("unknown actor code %s", act.Code) } @@ -94,6 +103,9 @@ func MakeState(store adt.Store, av actors.Version, rootKeyAddress address.Addres case actors.Version5: return make5(store, rootKeyAddress) + case actors.Version6: + return make6(store, rootKeyAddress) + } return nil, xerrors.Errorf("unknown actor version %d", av) } @@ -116,6 +128,9 @@ func GetActorCodeID(av actors.Version) (cid.Cid, error) { case actors.Version5: return builtin5.VerifiedRegistryActorCodeID, nil + case actors.Version6: + return builtin6.VerifiedRegistryActorCodeID, nil + } return cid.Undef, xerrors.Errorf("unknown actor version %d", av) diff --git a/chain/actors/policy/policy.go b/chain/actors/policy/policy.go index a67415726..29be33ddf 100644 --- a/chain/actors/policy/policy.go +++ b/chain/actors/policy/policy.go @@ -35,14 +35,19 @@ import ( miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner" verifreg5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/verifreg" - paych5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/paych" + builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" + market6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/market" + miner6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/miner" + verifreg6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/verifreg" + + paych6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/paych" ) const ( - ChainFinality = miner5.ChainFinality + ChainFinality = miner6.ChainFinality SealRandomnessLookback = ChainFinality - PaychSettleDelay = paych5.SettleDelay - MaxPreCommitRandomnessLookback = builtin5.EpochsInDay + SealRandomnessLookback + PaychSettleDelay = paych6.SettleDelay + MaxPreCommitRandomnessLookback = builtin6.EpochsInDay + SealRandomnessLookback ) // SetSupportedProofTypes sets supported proof types, across all actor versions. @@ -65,6 +70,8 @@ func SetSupportedProofTypes(types ...abi.RegisteredSealProof) { miner5.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types)) + miner6.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types)) + AddSupportedProofTypes(types...) } @@ -103,6 +110,15 @@ func AddSupportedProofTypes(types ...abi.RegisteredSealProof) { miner5.WindowPoStProofTypes[wpp] = struct{}{} + miner6.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{} + wpp, err = t.RegisteredWindowPoStProof() + if err != nil { + // Fine to panic, this is a test-only method + panic(err) + } + + miner6.WindowPoStProofTypes[wpp] = struct{}{} + } } @@ -121,11 +137,13 @@ func SetPreCommitChallengeDelay(delay abi.ChainEpoch) { miner5.PreCommitChallengeDelay = delay + miner6.PreCommitChallengeDelay = delay + } // TODO: this function shouldn't really exist. Instead, the API should expose the precommit delay. func GetPreCommitChallengeDelay() abi.ChainEpoch { - return miner5.PreCommitChallengeDelay + return miner6.PreCommitChallengeDelay } // SetConsensusMinerMinPower sets the minimum power of an individual miner must @@ -151,6 +169,10 @@ func SetConsensusMinerMinPower(p abi.StoragePower) { policy.ConsensusMinerMinPower = p } + for _, policy := range builtin6.PoStProofPolicies { + policy.ConsensusMinerMinPower = p + } + } // SetMinVerifiedDealSize sets the minimum size of a verified deal. This should @@ -167,6 +189,8 @@ func SetMinVerifiedDealSize(size abi.StoragePower) { verifreg5.MinVerifiedDealSize = size + verifreg6.MinVerifiedDealSize = size + } func GetMaxProveCommitDuration(ver actors.Version, t abi.RegisteredSealProof) (abi.ChainEpoch, error) { @@ -192,6 +216,10 @@ func GetMaxProveCommitDuration(ver actors.Version, t abi.RegisteredSealProof) (a return miner5.MaxProveCommitDuration[t], nil + case actors.Version6: + + return miner6.MaxProveCommitDuration[t], nil + default: return 0, xerrors.Errorf("unsupported actors version") } @@ -222,6 +250,11 @@ func SetProviderCollateralSupplyTarget(num, denom big.Int) { Denominator: denom, } + market6.ProviderCollateralSupplyTarget = builtin6.BigFrac{ + Numerator: num, + Denominator: denom, + } + } func DealProviderCollateralBounds( @@ -260,13 +293,18 @@ func DealProviderCollateralBounds( min, max := market5.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil) return min, max, nil + case actors.Version6: + + min, max := market6.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 market5.DealDurationBounds(pieceSize) + return market6.DealDurationBounds(pieceSize) } // Sets the challenge window and scales the proving period to match (such that @@ -300,6 +338,13 @@ func SetWPoStChallengeWindow(period abi.ChainEpoch) { // scale it if we're scaling the challenge period. miner5.WPoStDisputeWindow = period * 30 + miner6.WPoStChallengeWindow = period + miner6.WPoStProvingPeriod = period * abi.ChainEpoch(miner6.WPoStPeriodDeadlines) + + // by default, this is 2x finality which is 30 periods. + // scale it if we're scaling the challenge period. + miner6.WPoStDisputeWindow = period * 30 + } func GetWinningPoStSectorSetLookback(nwVer network.Version) abi.ChainEpoch { @@ -312,15 +357,15 @@ func GetWinningPoStSectorSetLookback(nwVer network.Version) abi.ChainEpoch { } func GetMaxSectorExpirationExtension() abi.ChainEpoch { - return miner5.MaxSectorExpirationExtension + return miner6.MaxSectorExpirationExtension } func GetMinSectorExpiration() abi.ChainEpoch { - return miner5.MinSectorExpiration + return miner6.MinSectorExpiration } func GetMaxPoStPartitions(nv network.Version, p abi.RegisteredPoStProof) (int, error) { - sectorsPerPart, err := builtin5.PoStProofWindowPoStPartitionSectors(p) + sectorsPerPart, err := builtin6.PoStProofWindowPoStPartitionSectors(p) if err != nil { return 0, err } @@ -333,8 +378,8 @@ func GetMaxPoStPartitions(nv network.Version, p abi.RegisteredPoStProof) (int, e func GetDefaultSectorSize() abi.SectorSize { // supported sector sizes are the same across versions. - szs := make([]abi.SectorSize, 0, len(miner5.PreCommitSealProofTypesV8)) - for spt := range miner5.PreCommitSealProofTypesV8 { + szs := make([]abi.SectorSize, 0, len(miner6.PreCommitSealProofTypesV8)) + for spt := range miner6.PreCommitSealProofTypesV8 { ss, err := spt.SectorSize() if err != nil { panic(err) @@ -359,7 +404,7 @@ func GetSectorMaxLifetime(proof abi.RegisteredSealProof, nwVer network.Version) return builtin4.SealProofPoliciesV0[proof].SectorMaxLifetime } - return builtin5.SealProofPoliciesV11[proof].SectorMaxLifetime + return builtin6.SealProofPoliciesV11[proof].SectorMaxLifetime } func GetAddressedSectorsMax(nwVer network.Version) (int, error) { @@ -384,6 +429,9 @@ func GetAddressedSectorsMax(nwVer network.Version) (int, error) { case actors.Version5: return miner5.AddressedSectorsMax, nil + case actors.Version6: + return miner6.AddressedSectorsMax, nil + default: return 0, xerrors.Errorf("unsupported network version") } @@ -417,6 +465,10 @@ func GetDeclarationsMax(nwVer network.Version) (int, error) { return miner5.DeclarationsMax, nil + case actors.Version6: + + return miner6.DeclarationsMax, nil + default: return 0, xerrors.Errorf("unsupported network version") } @@ -449,6 +501,10 @@ func AggregateNetworkFee(nwVer network.Version, aggregateSize int, baseFee abi.T return miner5.AggregateNetworkFee(aggregateSize, baseFee), nil + case actors.Version6: + + return miner6.AggregateNetworkFee(aggregateSize, baseFee), nil + default: return big.Zero(), xerrors.Errorf("unsupported network version") } diff --git a/chain/actors/policy/policy.go.template b/chain/actors/policy/policy.go.template index 9da91f73f..4c13560d0 100644 --- a/chain/actors/policy/policy.go.template +++ b/chain/actors/policy/policy.go.template @@ -63,7 +63,7 @@ func AddSupportedProofTypes(types ...abi.RegisteredSealProof) { miner{{.}}.PreCommitSealProofTypesV7[t] = struct{}{} miner{{.}}.PreCommitSealProofTypesV7[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{} miner{{.}}.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{} - {{else}} + {{else if (eq . 5)}} miner{{.}}.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{} wpp, err := t.RegisteredWindowPoStProof() if err != nil { @@ -71,6 +71,15 @@ func AddSupportedProofTypes(types ...abi.RegisteredSealProof) { panic(err) } + miner{{.}}.WindowPoStProofTypes[wpp] = struct{}{} + {{else}} + miner{{.}}.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{} + wpp, err = t.RegisteredWindowPoStProof() + if err != nil { + // Fine to panic, this is a test-only method + panic(err) + } + miner{{.}}.WindowPoStProofTypes[wpp] = struct{}{} {{end}} {{end}} diff --git a/chain/actors/version.go b/chain/actors/version.go index 8787089af..95dd09126 100644 --- a/chain/actors/version.go +++ b/chain/actors/version.go @@ -8,9 +8,9 @@ import ( type Version int -var LatestVersion = 5 +var LatestVersion = 6 -var Versions = []int{0, 2, 3, 4, LatestVersion} +var Versions = []int{0, 2, 3, 4, 5, LatestVersion} const ( Version0 Version = 0 @@ -18,6 +18,7 @@ const ( Version3 Version = 3 Version4 Version = 4 Version5 Version = 5 + Version6 Version = 6 ) // Converts a network version into an actors adt version. @@ -33,6 +34,8 @@ func VersionForNetwork(version network.Version) (Version, error) { return Version4, nil case network.Version13: return Version5, nil + case network.Version14: + return Version6, nil default: return -1, fmt.Errorf("unsupported network version %d", version) } diff --git a/chain/consensus/filcns/compute_state.go b/chain/consensus/filcns/compute_state.go index e0557b797..e02c96096 100644 --- a/chain/consensus/filcns/compute_state.go +++ b/chain/consensus/filcns/compute_state.go @@ -19,6 +19,7 @@ import ( exported3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/exported" exported4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/exported" exported5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/exported" + exported6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/exported" "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/actors" @@ -42,6 +43,7 @@ func NewActorRegistry() *vm.ActorRegistry { inv.Register(vm.ActorsVersionPredicate(actors.Version3), exported3.BuiltinActors()...) inv.Register(vm.ActorsVersionPredicate(actors.Version4), exported4.BuiltinActors()...) inv.Register(vm.ActorsVersionPredicate(actors.Version5), exported5.BuiltinActors()...) + inv.Register(vm.ActorsVersionPredicate(actors.Version6), exported6.BuiltinActors()...) return inv } diff --git a/chain/consensus/filcns/upgrades.go b/chain/consensus/filcns/upgrades.go index c12bb2090..cf4c62bf3 100644 --- a/chain/consensus/filcns/upgrades.go +++ b/chain/consensus/filcns/upgrades.go @@ -5,6 +5,8 @@ import ( "runtime" "time" + "github.com/filecoin-project/specs-actors/v6/actors/migration/nv14" + "github.com/ipfs/go-cid" cbor "github.com/ipfs/go-ipld-cbor" "golang.org/x/xerrors" @@ -137,7 +139,25 @@ func DefaultUpgradeSchedule() stmgr.UpgradeSchedule { DontStartWithin: 15, StopWithin: 5, }}, - Expensive: true}} + Expensive: true, + }, { + Height: build.UpgradeChocolateHeight, + Network: network.Version14, + Migration: UpgradeActorsV6, + PreMigrations: []stmgr.PreMigration{{ + PreMigration: PreUpgradeActorsV6, + StartWithin: 120, + DontStartWithin: 60, + StopWithin: 35, + }, { + PreMigration: PreUpgradeActorsV6, + StartWithin: 30, + DontStartWithin: 15, + StopWithin: 5, + }}, + Expensive: true, + }, + } for _, u := range updates { if u.Height < 0 { @@ -1091,6 +1111,92 @@ func upgradeActorsV5Common( return newRoot, nil } +func UpgradeActorsV6(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 := runtime.NumCPU() - 3 + if workerCount <= 0 { + workerCount = 1 + } + + config := nv14.Config{ + MaxWorkers: uint(workerCount), + JobQueueSize: 1000, + ResultQueueSize: 100, + ProgressLogPeriod: 10 * time.Second, + } + + newRoot, err := upgradeActorsV6Common(ctx, sm, cache, root, epoch, ts, config) + if err != nil { + return cid.Undef, xerrors.Errorf("migrating actors v5 state: %w", err) + } + + return newRoot, nil +} + +func PreUpgradeActorsV6(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 := runtime.NumCPU() + if workerCount <= 4 { + workerCount = 1 + } else { + workerCount /= 2 + } + config := nv14.Config{MaxWorkers: uint(workerCount)} + _, err := upgradeActorsV6Common(ctx, sm, cache, root, epoch, ts, config) + return err +} + +func upgradeActorsV6Common( + ctx context.Context, sm *stmgr.StateManager, cache stmgr.MigrationCache, + root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet, + config nv14.Config, +) (cid.Cid, error) { + buf := blockstore.NewTieredBstore(sm.ChainStore().StateBlockstore(), blockstore.NewMemorySync()) + store := store.ActorStore(ctx, buf) + + // Load the state root. + var stateRoot types.StateRoot + if err := store.Get(ctx, root, &stateRoot); err != nil { + return cid.Undef, xerrors.Errorf("failed to decode state root: %w", err) + } + + if stateRoot.Version != types.StateTreeVersion4 { + return cid.Undef, xerrors.Errorf( + "expected state root version 4 for actors v6 upgrade, got %d", + stateRoot.Version, + ) + } + + // Perform the migration + newHamtRoot, err := nv14.MigrateStateTree(ctx, store, stateRoot.Actors, epoch, config, migrationLogger{}, cache) + if err != nil { + return cid.Undef, xerrors.Errorf("upgrading to actors v5: %w", err) + } + + // Persist the result. + newRoot, err := store.Put(ctx, &types.StateRoot{ + Version: types.StateTreeVersion4, + Actors: newHamtRoot, + Info: stateRoot.Info, + }) + if err != nil { + return cid.Undef, xerrors.Errorf("failed to persist new state root: %w", err) + } + + // Persist the new tree. + + { + from := buf + to := buf.Read() + + if err := vm.Copy(ctx, from, to, newRoot); err != nil { + return cid.Undef, xerrors.Errorf("copying migrated tree: %w", err) + } + } + + return newRoot, nil +} + type migrationLogger struct{} func (ml migrationLogger) Log(level rt.LogLevel, msg string, args ...interface{}) { diff --git a/chain/state/statetree.go b/chain/state/statetree.go index 8140cd4db..b4323c04b 100644 --- a/chain/state/statetree.go +++ b/chain/state/statetree.go @@ -152,7 +152,7 @@ func VersionForNetwork(ver network.Version) (types.StateTreeVersion, error) { return types.StateTreeVersion2, nil case network.Version12: return types.StateTreeVersion3, nil - case network.Version13: + case network.Version13, network.Version14: return types.StateTreeVersion4, nil default: panic(fmt.Sprintf("unsupported network version %d", ver)) diff --git a/chain/sync_test.go b/chain/sync_test.go index bf84512cf..0e4f3fd7a 100644 --- a/chain/sync_test.go +++ b/chain/sync_test.go @@ -139,6 +139,10 @@ func prepSyncTestWithV5Height(t testing.TB, h int, v5height abi.ChainEpoch) *syn Network: network.Version13, Height: v5height, Migration: filcns.UpgradeActorsV5, + }, { + Network: network.Version14, + Height: v5height + 10, + Migration: filcns.UpgradeActorsV6, }} g, err := gen.NewGeneratorWithUpgradeSchedule(sched) @@ -1071,7 +1075,7 @@ func TestDrandNull(t *testing.T) { postUpgrade := tu.mineOnBlock(afterNull, p0, nil, false, false, nil, v5h, true) nv, err := tu.nds[p0].StateNetworkVersion(tu.ctx, postUpgrade.TipSet().Key()) require.NoError(t, err) - if nv != network.Version13 { + if nv <= network.Version13 { t.Fatal("expect to be v13 by now") } diff --git a/chain/types/state.go b/chain/types/state.go index c8f8f1cd9..9381fa6f3 100644 --- a/chain/types/state.go +++ b/chain/types/state.go @@ -15,7 +15,7 @@ const ( StateTreeVersion2 // StateTreeVersion3 corresponds to actors v4. StateTreeVersion3 - // StateTreeVersion4 corresponds to actors v5. + // StateTreeVersion4 corresponds to actors v5, v6. StateTreeVersion4 ) diff --git a/chain/vm/mkactor.go b/chain/vm/mkactor.go index e461a2b4c..b75f290dc 100644 --- a/chain/vm/mkactor.go +++ b/chain/vm/mkactor.go @@ -19,6 +19,7 @@ import ( builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin" builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin" builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" + builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" "github.com/filecoin-project/go-address" "github.com/filecoin-project/lotus/chain/actors/aerrors" @@ -113,6 +114,8 @@ func newAccountActor(ver actors.Version) *types.Actor { code = builtin4.AccountActorCodeID case actors.Version5: code = builtin5.AccountActorCodeID + case actors.Version6: + code = builtin6.AccountActorCodeID default: panic("unsupported actors version") } diff --git a/chain/vm/runtime.go b/chain/vm/runtime.go index c0ace4907..6118eb2fa 100644 --- a/chain/vm/runtime.go +++ b/chain/vm/runtime.go @@ -17,6 +17,7 @@ import ( rtt "github.com/filecoin-project/go-state-types/rt" rt0 "github.com/filecoin-project/specs-actors/actors/runtime" rt5 "github.com/filecoin-project/specs-actors/v5/actors/runtime" + rt6 "github.com/filecoin-project/specs-actors/v6/actors/runtime" "github.com/ipfs/go-cid" ipldcbor "github.com/ipfs/go-ipld-cbor" "go.opencensus.io/trace" @@ -141,6 +142,7 @@ func (rt *Runtime) StorePut(x cbor.Marshaler) cid.Cid { var _ rt0.Runtime = (*Runtime)(nil) var _ rt5.Runtime = (*Runtime)(nil) +var _ rt6.Runtime = (*Runtime)(nil) func (rt *Runtime) shimCall(f func() interface{}) (rval []byte, aerr aerrors.ActorError) { defer func() { diff --git a/documentation/en/api-v0-methods.md b/documentation/en/api-v0-methods.md index a3693261a..545750eae 100644 --- a/documentation/en/api-v0-methods.md +++ b/documentation/en/api-v0-methods.md @@ -4696,7 +4696,7 @@ Inputs: ] ``` -Response: `13` +Response: `14` ### StateReadState StateReadState returns the indicated actor's state. diff --git a/documentation/en/api-v1-unstable-methods.md b/documentation/en/api-v1-unstable-methods.md index f03203314..19ab3f547 100644 --- a/documentation/en/api-v1-unstable-methods.md +++ b/documentation/en/api-v1-unstable-methods.md @@ -4946,7 +4946,7 @@ Inputs: ] ``` -Response: `13` +Response: `14` ### StateReadState StateReadState returns the indicated actor's state. diff --git a/go.mod b/go.mod index 45cbc17c9..1a53f03d1 100644 --- a/go.mod +++ b/go.mod @@ -40,7 +40,7 @@ require ( github.com/filecoin-project/go-jsonrpc v0.1.4-0.20210217175800-45ea43ac2bec github.com/filecoin-project/go-padreader v0.0.0-20210723183308-812a16dc01b1 github.com/filecoin-project/go-paramfetch v0.0.2-0.20210614165157-25a6c7769498 - github.com/filecoin-project/go-state-types v0.1.1-0.20210810190654-139e0e79e69e + github.com/filecoin-project/go-state-types v0.1.1-0.20210915140513-d354ccf10379 github.com/filecoin-project/go-statemachine v1.0.1 github.com/filecoin-project/go-statestore v0.1.1 github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b @@ -49,6 +49,7 @@ require ( github.com/filecoin-project/specs-actors/v3 v3.1.1 github.com/filecoin-project/specs-actors/v4 v4.0.1 github.com/filecoin-project/specs-actors/v5 v5.0.4 + github.com/filecoin-project/specs-actors/v6 v6.0.0-20210920194404-d0e4e92671fa github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506 github.com/filecoin-project/test-vectors/schema v0.0.5 github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1 diff --git a/go.sum b/go.sum index 05de56ed2..234931444 100644 --- a/go.sum +++ b/go.sum @@ -315,8 +315,9 @@ 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.1-0.20210506134452-99b279731c48/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g= -github.com/filecoin-project/go-state-types v0.1.1-0.20210810190654-139e0e79e69e h1:XAgb6HmgXaGRklNjhZoNMSIYriKLqjWXIqYMotg6iSs= github.com/filecoin-project/go-state-types v0.1.1-0.20210810190654-139e0e79e69e/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g= +github.com/filecoin-project/go-state-types v0.1.1-0.20210915140513-d354ccf10379 h1:UmKkt13NrtulubqfNXhG7SQ7Pjza8BeKdNBxngqAo64= +github.com/filecoin-project/go-state-types v0.1.1-0.20210915140513-d354ccf10379/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g= github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig= github.com/filecoin-project/go-statemachine v1.0.1 h1:LQ60+JDVjMdLxXmVFM2jjontzOYnfVE7u02CXV3WKSw= github.com/filecoin-project/go-statemachine v1.0.1/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54= @@ -343,6 +344,8 @@ github.com/filecoin-project/specs-actors/v4 v4.0.1/go.mod h1:TkHXf/l7Wyw4ZejyXIP github.com/filecoin-project/specs-actors/v5 v5.0.0-20210512015452-4fe3889fff57/go.mod h1:283yBMMUSDB2abcjP/hhrwTkhb9h3sfM6KGrep/ZlBI= github.com/filecoin-project/specs-actors/v5 v5.0.4 h1:OY7BdxJWlUfUFXWV/kpNBYGXNPasDIedf42T3sGx08s= github.com/filecoin-project/specs-actors/v5 v5.0.4/go.mod h1:5BAKRAMsOOlD8+qCw4UvT/lTLInCJ3JwOWZbX8Ipwq4= +github.com/filecoin-project/specs-actors/v6 v6.0.0-20210920194404-d0e4e92671fa h1:sSCa1OskxuMMeLaun9btVuyBJu3U5V0akp+JeuJB9QA= +github.com/filecoin-project/specs-actors/v6 v6.0.0-20210920194404-d0e4e92671fa/go.mod h1:lPcgekzy5rFamHRZtTo0ukLggIFex2ecEAWxrk5AT1o= github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506 h1:Ur/l2+6qN+lQiqjozWWc5p9UDaAMDZKTlDS98oRnlIw= github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506/go.mod h1:nJRRM7Aa9XVvygr3W9k6xGF46RWzr2zxF/iGoAIfA/g= github.com/filecoin-project/test-vectors/schema v0.0.5 h1:w3zHQhzM4pYxJDl21avXjOKBLF8egrvwUwjpT8TquDg= diff --git a/lotuspond/front/src/chain/methods.json b/lotuspond/front/src/chain/methods.json index 5aced814a..c0f69d58c 100644 --- a/lotuspond/front/src/chain/methods.json +++ b/lotuspond/front/src/chain/methods.json @@ -516,5 +516,111 @@ "AddVerifiedClient", "UseBytes", "RestoreBytes" + ], + "fil/6/account": [ + "Send", + "Constructor", + "PubkeyAddress" + ], + "fil/6/cron": [ + "Send", + "Constructor", + "EpochTick" + ], + "fil/6/init": [ + "Send", + "Constructor", + "Exec" + ], + "fil/6/multisig": [ + "Send", + "Constructor", + "Propose", + "Approve", + "Cancel", + "AddSigner", + "RemoveSigner", + "SwapSigner", + "ChangeNumApprovalsThreshold", + "LockBalance" + ], + "fil/6/paymentchannel": [ + "Send", + "Constructor", + "UpdateChannelState", + "Settle", + "Collect" + ], + "fil/6/reward": [ + "Send", + "Constructor", + "AwardBlockReward", + "ThisEpochReward", + "UpdateNetworkKPI" + ], + "fil/6/storagemarket": [ + "Send", + "Constructor", + "AddBalance", + "WithdrawBalance", + "PublishStorageDeals", + "VerifyDealsForActivation", + "ActivateDeals", + "OnMinerSectorsTerminate", + "ComputeDataCommitment", + "CronTick" + ], + "fil/6/storageminer": [ + "Send", + "Constructor", + "ControlAddresses", + "ChangeWorkerAddress", + "ChangePeerID", + "SubmitWindowedPoSt", + "PreCommitSector", + "ProveCommitSector", + "ExtendSectorExpiration", + "TerminateSectors", + "DeclareFaults", + "DeclareFaultsRecovered", + "OnDeferredCronEvent", + "CheckSectorProven", + "ApplyRewards", + "ReportConsensusFault", + "WithdrawBalance", + "ConfirmSectorProofsValid", + "ChangeMultiaddrs", + "CompactPartitions", + "CompactSectorNumbers", + "ConfirmUpdateWorkerKey", + "RepayDebt", + "ChangeOwnerAddress", + "DisputeWindowedPoSt", + "PreCommitSectorBatch", + "ProveCommitAggregate" + ], + "fil/6/storagepower": [ + "Send", + "Constructor", + "CreateMiner", + "UpdateClaimedPower", + "EnrollCronEvent", + "OnEpochTickEnd", + "UpdatePledgeTotal", + "SubmitPoRepForBulkVerify", + "CurrentTotalPower" + ], + "fil/6/system": [ + "Send", + "Constructor" + ], + "fil/6/verifiedregistry": [ + "Send", + "Constructor", + "AddVerifier", + "RemoveVerifier", + "AddVerifiedClient", + "UseBytes", + "RestoreBytes" ] } \ No newline at end of file diff --git a/testplans/lotus-soup/go.mod b/testplans/lotus-soup/go.mod index 953bc43c6..eda313fa3 100644 --- a/testplans/lotus-soup/go.mod +++ b/testplans/lotus-soup/go.mod @@ -8,10 +8,10 @@ require ( github.com/davecgh/go-spew v1.1.1 github.com/drand/drand v1.2.1 github.com/filecoin-project/go-address v0.0.5 - github.com/filecoin-project/go-data-transfer v1.7.8 - github.com/filecoin-project/go-fil-markets v1.8.1 + github.com/filecoin-project/go-data-transfer v1.10.1 + github.com/filecoin-project/go-fil-markets v1.12.0 github.com/filecoin-project/go-jsonrpc v0.1.4-0.20210217175800-45ea43ac2bec - github.com/filecoin-project/go-state-types v0.1.1-0.20210810190654-139e0e79e69e + github.com/filecoin-project/go-state-types v0.1.1-0.20210915140513-d354ccf10379 github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b github.com/filecoin-project/lotus v0.0.0-00010101000000-000000000000 github.com/filecoin-project/specs-actors v0.9.14 @@ -25,7 +25,7 @@ require ( github.com/ipfs/go-log/v2 v2.3.0 github.com/ipfs/go-merkledag v0.3.2 github.com/ipfs/go-unixfs v0.2.6 - github.com/ipld/go-car v0.1.1-0.20201119040415-11b6074b6d4d + github.com/ipld/go-car v0.3.1-0.20210601190600-f512dac51e8e github.com/kpacha/opencensus-influxdb v0.0.0-20181102202715-663e2683a27c github.com/libp2p/go-libp2p v0.14.2 github.com/libp2p/go-libp2p-core v0.8.6 diff --git a/testplans/lotus-soup/go.sum b/testplans/lotus-soup/go.sum index 28bb0d517..ff2012834 100644 --- a/testplans/lotus-soup/go.sum +++ b/testplans/lotus-soup/go.sum @@ -292,6 +292,8 @@ github.com/filecoin-project/go-data-transfer v1.0.1/go.mod h1:UxvfUAY9v3ub0a21BS github.com/filecoin-project/go-data-transfer v1.7.6/go.mod h1:Cbl9lzKOuAyyIxp1tE+VbV5Aix4bxzA7uJGA9wGM4fM= github.com/filecoin-project/go-data-transfer v1.7.8 h1:s4cF9nX9sEy7RgZd3NW92YN/hKyIy2fQl+7dVOAS8r8= github.com/filecoin-project/go-data-transfer v1.7.8/go.mod h1:Cbl9lzKOuAyyIxp1tE+VbV5Aix4bxzA7uJGA9wGM4fM= +github.com/filecoin-project/go-data-transfer v1.10.0/go.mod h1:uQtqy6vUAY5v70ZHdkF5mJ8CjVtjj/JA3aOoaqzWTVw= +github.com/filecoin-project/go-data-transfer v1.10.1/go.mod h1:CSDMCrPK2lVGodNB1wPEogjFvM9nVGyiL1GNbBRTSdw= github.com/filecoin-project/go-ds-versioning v0.1.0 h1:y/X6UksYTsK8TLCI7rttCKEvl8btmWxyFMEeeWGUxIQ= github.com/filecoin-project/go-ds-versioning v0.1.0/go.mod h1:mp16rb4i2QPmxBnmanUx8i/XANp+PFCCJWiAb+VW4/s= github.com/filecoin-project/go-fil-commcid v0.0.0-20200716160307-8f644712406f/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ= @@ -303,6 +305,7 @@ github.com/filecoin-project/go-fil-commp-hashhash v0.1.0/go.mod h1:73S8WSEWh9vr0 github.com/filecoin-project/go-fil-markets v1.0.5-0.20201113164554-c5eba40d5335/go.mod h1:AJySOJC00JRWEZzRG2KsfUnqEf5ITXxeX09BE9N4f9c= github.com/filecoin-project/go-fil-markets v1.8.1 h1:nNJB5EIp5c6yo/z51DloVaL7T24SslCoxSDOXwNQr9k= github.com/filecoin-project/go-fil-markets v1.8.1/go.mod h1:PIPyOhoDLWT5NcciJQeK6Hes7MIeczGLNWVO/2Vy0a4= +github.com/filecoin-project/go-fil-markets v1.12.0/go.mod h1:XuuZFaFujI47nrgfQJiq7jWB+6rRya6nm7Sj6uXQ80U= github.com/filecoin-project/go-hamt-ipld v0.1.5 h1:uoXrKbCQZ49OHpsTCkrThPNelC4W3LPEk0OrS/ytIBM= github.com/filecoin-project/go-hamt-ipld v0.1.5/go.mod h1:6Is+ONR5Cd5R6XZoCse1CWaXZc0Hdb/JeX+EQCQzX24= github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 h1:b3UDemBYN2HNfk3KOXNuxgTTxlWi3xVvbQP0IT38fvM= @@ -327,6 +330,7 @@ github.com/filecoin-project/go-state-types v0.1.0/go.mod h1:ezYnPf0bNkTsDibL/psS github.com/filecoin-project/go-state-types v0.1.1-0.20210506134452-99b279731c48/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g= github.com/filecoin-project/go-state-types v0.1.1-0.20210810190654-139e0e79e69e h1:XAgb6HmgXaGRklNjhZoNMSIYriKLqjWXIqYMotg6iSs= github.com/filecoin-project/go-state-types v0.1.1-0.20210810190654-139e0e79e69e/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g= +github.com/filecoin-project/go-state-types v0.1.1-0.20210915140513-d354ccf10379/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g= github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig= github.com/filecoin-project/go-statemachine v1.0.1 h1:LQ60+JDVjMdLxXmVFM2jjontzOYnfVE7u02CXV3WKSw= github.com/filecoin-project/go-statemachine v1.0.1/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54= @@ -353,6 +357,9 @@ github.com/filecoin-project/specs-actors/v4 v4.0.1/go.mod h1:TkHXf/l7Wyw4ZejyXIP github.com/filecoin-project/specs-actors/v5 v5.0.0-20210512015452-4fe3889fff57/go.mod h1:283yBMMUSDB2abcjP/hhrwTkhb9h3sfM6KGrep/ZlBI= github.com/filecoin-project/specs-actors/v5 v5.0.4 h1:OY7BdxJWlUfUFXWV/kpNBYGXNPasDIedf42T3sGx08s= github.com/filecoin-project/specs-actors/v5 v5.0.4/go.mod h1:5BAKRAMsOOlD8+qCw4UvT/lTLInCJ3JwOWZbX8Ipwq4= +github.com/filecoin-project/specs-actors/v6 v6.0.0-20210920180718-d47b07f41b17/go.mod h1:lPcgekzy5rFamHRZtTo0ukLggIFex2ecEAWxrk5AT1o= +github.com/filecoin-project/specs-actors/v6 v6.0.0-20210920193238-8bd17b82331a/go.mod h1:lPcgekzy5rFamHRZtTo0ukLggIFex2ecEAWxrk5AT1o= +github.com/filecoin-project/specs-actors/v6 v6.0.0-20210920194404-d0e4e92671fa/go.mod h1:lPcgekzy5rFamHRZtTo0ukLggIFex2ecEAWxrk5AT1o= github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506 h1:Ur/l2+6qN+lQiqjozWWc5p9UDaAMDZKTlDS98oRnlIw= github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506/go.mod h1:nJRRM7Aa9XVvygr3W9k6xGF46RWzr2zxF/iGoAIfA/g= github.com/filecoin-project/test-vectors/schema v0.0.5/go.mod h1:iQ9QXLpYWL3m7warwvK1JC/pTri8mnfEmKygNDqqY6E= @@ -365,6 +372,7 @@ github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJn github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= 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/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= @@ -650,6 +658,7 @@ github.com/ipfs/go-ds-badger v0.0.5/go.mod h1:g5AuuCGmr7efyzQhLL8MzwqcauPojGPUaH github.com/ipfs/go-ds-badger v0.0.7/go.mod h1:qt0/fWzZDoPW6jpQeqUjR5kBfhDNB65jd9YlmAvpQBk= github.com/ipfs/go-ds-badger v0.2.1/go.mod h1:Tx7l3aTph3FMFrRS838dcSJh+jjA7cX9DrGVwx/NOwE= github.com/ipfs/go-ds-badger v0.2.3/go.mod h1:pEYw0rgg3FIrywKKnL+Snr+w/LjJZVMTBRn4FS6UHUk= +github.com/ipfs/go-ds-badger v0.2.6/go.mod h1:02rnztVKA4aZwDuaRPTf8mpqcKmXP7mLl6JPxd14JHA= github.com/ipfs/go-ds-badger v0.2.7 h1:ju5REfIm+v+wgVnQ19xGLYPHYHbYLR6qJfmMbCDSK1I= github.com/ipfs/go-ds-badger v0.2.7/go.mod h1:02rnztVKA4aZwDuaRPTf8mpqcKmXP7mLl6JPxd14JHA= github.com/ipfs/go-ds-badger2 v0.1.0/go.mod h1:pbR1p817OZbdId9EvLOhKBgUVTM3BMCSTan78lDDVaw= @@ -673,6 +682,8 @@ github.com/ipfs/go-graphsync v0.4.3/go.mod h1:mPOwDYv128gf8gxPFgXnz4fNrSYPsWyqis github.com/ipfs/go-graphsync v0.6.8/go.mod h1:GdHT8JeuIZ0R4lSjFR16Oe4zPi5dXwKi9zR9ADVlcdk= github.com/ipfs/go-graphsync v0.6.9 h1:I15gVcZuqsaeaj64/SjlwiIAc9MkOgfSv0M1CgcoFRE= github.com/ipfs/go-graphsync v0.6.9/go.mod h1:GdHT8JeuIZ0R4lSjFR16Oe4zPi5dXwKi9zR9ADVlcdk= +github.com/ipfs/go-graphsync v0.9.0/go.mod h1:J62ahWT9JbPsFL2UWsUM5rOu0lZJ0LOIH1chHdxGGcw= +github.com/ipfs/go-graphsync v0.9.1/go.mod h1:J62ahWT9JbPsFL2UWsUM5rOu0lZJ0LOIH1chHdxGGcw= github.com/ipfs/go-hamt-ipld v0.1.1/go.mod h1:1EZCr2v0jlCnhpa+aZ0JZYp8Tt2w16+JJOAVz17YcDk= github.com/ipfs/go-ipfs-blockstore v0.0.1/go.mod h1:d3WClOmRQKFnJ0Jz/jj/zmksX0ma1gROTlovZKBmN08= github.com/ipfs/go-ipfs-blockstore v0.1.0/go.mod h1:5aD0AvHPi7mZc6Ci1WCAhiBQu2IsfTduLl+422H6Rqw= @@ -790,15 +801,21 @@ github.com/ipld/go-car v0.1.0/go.mod h1:RCWzaUh2i4mOEkB3W45Vc+9jnS/M6Qay5ooytiBH github.com/ipld/go-car v0.1.1-0.20200923150018-8cdef32e2da4/go.mod h1:xrMEcuSq+D1vEwl+YAXsg/JfA98XGpXDwnkIL4Aimqw= github.com/ipld/go-car v0.1.1-0.20201119040415-11b6074b6d4d h1:iphSzTuPqyDgH7WUVZsdqUnQNzYgIblsVr1zhVNA33U= github.com/ipld/go-car v0.1.1-0.20201119040415-11b6074b6d4d/go.mod h1:2Gys8L8MJ6zkh1gktTSXreY63t4UbyvNp5JaudTyxHQ= +github.com/ipld/go-car v0.3.1-0.20210601190600-f512dac51e8e/go.mod h1:wUxBdwOLA9/0HZBi3fnTBzla0MuwlqgJLyrhOg1XaKI= github.com/ipld/go-car/v2 v2.0.0-beta1.0.20210721090610-5a9d1b217d25/go.mod h1:I2ACeeg6XNBe5pdh5TaR7Ambhfa7If9KXxmXgZsYENU= github.com/ipld/go-car/v2 v2.0.2/go.mod h1:I2ACeeg6XNBe5pdh5TaR7Ambhfa7If9KXxmXgZsYENU= github.com/ipld/go-car/v2 v2.0.3-0.20210811121346-c514a30114d7 h1:6Z0beJSZNsRY+7udoqUl4gQ/tqtrPuRvDySrlsvbqZA= github.com/ipld/go-car/v2 v2.0.3-0.20210811121346-c514a30114d7/go.mod h1:I2ACeeg6XNBe5pdh5TaR7Ambhfa7If9KXxmXgZsYENU= +github.com/ipld/go-codec-dagpb v1.2.0/go.mod h1:6nBN7X7h8EOsEejZGqC7tej5drsdBAXbMHyBT+Fne5s= +github.com/ipld/go-codec-dagpb v1.3.0/go.mod h1:ga4JTU3abYApDC3pZ00BC2RSvC3qfBb9MSJkMLSwnhA= github.com/ipld/go-ipld-prime v0.0.2-0.20191108012745-28a82f04c785/go.mod h1:bDDSvVz7vaK12FNvMeRYnpRFkSUPNQOiCYQezMD/P3w= github.com/ipld/go-ipld-prime v0.0.2-0.20200428162820-8b59dc292b8e/go.mod h1:uVIwe/u0H4VdKv3kaN1ck7uCb6yD9cFLS9/ELyXbsw8= github.com/ipld/go-ipld-prime v0.5.1-0.20200828233916-988837377a7f/go.mod h1:0xEgdD6MKbZ1vF0GC+YcR/C4SQCAlRuOjIJ2i0HxqzM= github.com/ipld/go-ipld-prime v0.5.1-0.20201021195245-109253e8a018 h1:RbRHv8epkmvBYA5cGfz68GUSbOgx5j/7ObLIl4Rsif0= github.com/ipld/go-ipld-prime v0.5.1-0.20201021195245-109253e8a018/go.mod h1:0xEgdD6MKbZ1vF0GC+YcR/C4SQCAlRuOjIJ2i0HxqzM= +github.com/ipld/go-ipld-prime v0.9.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.12.0/go.mod h1:hy8b93WleDMRKumOJnTIrr0MbbFbx9GD6Kzxa53Xppc= github.com/ipld/go-ipld-prime-proto v0.0.0-20191113031812-e32bd156a1e5/go.mod h1:gcvzoEDBjwycpXt3LBE061wT9f46szXGHAmj9uoP6fU= github.com/ipld/go-ipld-prime-proto v0.0.0-20200428191222-c1ffdadc01e1/go.mod h1:OAV6xBmuTLsPZ+epzKkPB1e25FHk/vCtyatkdHcArLs= github.com/ipld/go-ipld-prime-proto v0.0.0-20200922192210-9a2bfd4440a6/go.mod h1:3pHYooM9Ea65jewRwrb2u5uHZCNkNTe9ABsVB+SrkH0= @@ -1515,6 +1532,7 @@ github.com/polydawn/refmt v0.0.0-20190408063855-01bf1e26dd14/go.mod h1:uIp+gprXx github.com/polydawn/refmt v0.0.0-20190807091052-3d65705ee9f1/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o= github.com/polydawn/refmt v0.0.0-20190809202753-05966cbd336a h1:hjZfReYVLbqFkAtr2us7vdy04YWz3LVAirzP7reh8+M= github.com/polydawn/refmt v0.0.0-20190809202753-05966cbd336a/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o= +github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -1707,6 +1725,7 @@ github.com/valyala/fasttemplate v1.0.1 h1:tY9CJiPnMXf1ERmG2EyK7gNUd+c6RKGD0IfU8W github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= 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-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= github.com/warpfork/go-wish v0.0.0-20190328234359-8b3e70f8e830/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a h1:G++j5e0OC488te356JvdhaM8YS6nMsjLAYF7JxCv07w= @@ -1733,6 +1752,7 @@ github.com/whyrusleeping/cbor-gen v0.0.0-20200810223238-211df3b9e24c/go.mod h1:f github.com/whyrusleeping/cbor-gen v0.0.0-20200812213548-958ddffe352c/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= github.com/whyrusleeping/cbor-gen v0.0.0-20200826160007-0b9f6c5fb163/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= github.com/whyrusleeping/cbor-gen v0.0.0-20210118024343-169e9d70c0c2/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= +github.com/whyrusleeping/cbor-gen v0.0.0-20210219115102-f37d292932f2/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= github.com/whyrusleeping/cbor-gen v0.0.0-20210713220151-be142a5ae1a8 h1:TEv7MId88TyIqIUL4hbf9otOookIolMxlEbN0ro671Y= github.com/whyrusleeping/cbor-gen v0.0.0-20210713220151-be142a5ae1a8/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E= @@ -1923,6 +1943,7 @@ golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 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.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180524181706-dfa909b99c79/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -2150,6 +2171,7 @@ golang.org/x/tools v0.0.0-20201112185108-eeaa07dd7696/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.1-0.20210225150353-54dc8c5edb56/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= @@ -2243,6 +2265,7 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=