agen
This commit is contained in:
parent
770608aef1
commit
cdd5420e0c
@ -27,6 +27,7 @@ import (
|
|||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -35,38 +36,122 @@ func init() {
|
|||||||
return load0(store, root)
|
return load0(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version0, "account"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load0(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin2.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin2.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load2(store, root)
|
return load2(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version2, "account"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load2(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin3.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin3.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load3(store, root)
|
return load3(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version3, "account"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load3(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin4.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin4.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load4(store, root)
|
return load4(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version4, "account"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load4(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin5.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin5.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load5(store, root)
|
return load5(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version5, "account"); ok {
|
||||||
|
builtin.RegisterActorState(c, 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) {
|
builtin.RegisterActorState(builtin6.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load6(store, root)
|
return load6(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version6, "account"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load6(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin7.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin7.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load7(store, root)
|
return load7(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version7, "account"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load7(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin8.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin8.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load8(store, root)
|
return load8(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version8, "account"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load8(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var Methods = builtin4.MethodsAccount
|
var Methods = builtin4.MethodsAccount
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
|
if name != "account" {
|
||||||
|
return nil, xerrors.Errorf("actor code is not account: %s", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version0:
|
||||||
|
return load0(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version2:
|
||||||
|
return load2(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version3:
|
||||||
|
return load3(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version4:
|
||||||
|
return load4(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version5:
|
||||||
|
return load5(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version6:
|
||||||
|
return load6(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
return load7(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version8:
|
||||||
|
return load8(store, act.Head)
|
||||||
|
|
||||||
|
default:
|
||||||
|
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch act.Code {
|
switch act.Code {
|
||||||
|
|
||||||
case builtin0.AccountActorCodeID:
|
case builtin0.AccountActorCodeID:
|
||||||
@ -124,11 +209,15 @@ func MakeState(store adt.Store, av actors.Version, addr address.Address) (State,
|
|||||||
case actors.Version8:
|
case actors.Version8:
|
||||||
return make8(store, addr)
|
return make8(store, addr)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, "account"); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
|
|
||||||
case actors.Version0:
|
case actors.Version0:
|
||||||
|
@ -22,7 +22,7 @@ func load0(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
|
|
||||||
func make0(store adt.Store, addr address.Address) (State, error) {
|
func make0(store adt.Store, addr address.Address) (State, error) {
|
||||||
out := state0{store: store}
|
out := state0{store: store}
|
||||||
out.State = account0.State{Address: addr}
|
out.State = account0.State{Address:addr}
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ func load2(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
|
|
||||||
func make2(store adt.Store, addr address.Address) (State, error) {
|
func make2(store adt.Store, addr address.Address) (State, error) {
|
||||||
out := state2{store: store}
|
out := state2{store: store}
|
||||||
out.State = account2.State{Address: addr}
|
out.State = account2.State{Address:addr}
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ func load3(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
|
|
||||||
func make3(store adt.Store, addr address.Address) (State, error) {
|
func make3(store adt.Store, addr address.Address) (State, error) {
|
||||||
out := state3{store: store}
|
out := state3{store: store}
|
||||||
out.State = account3.State{Address: addr}
|
out.State = account3.State{Address:addr}
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ func load4(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
|
|
||||||
func make4(store adt.Store, addr address.Address) (State, error) {
|
func make4(store adt.Store, addr address.Address) (State, error) {
|
||||||
out := state4{store: store}
|
out := state4{store: store}
|
||||||
out.State = account4.State{Address: addr}
|
out.State = account4.State{Address:addr}
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ func load5(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
|
|
||||||
func make5(store adt.Store, addr address.Address) (State, error) {
|
func make5(store adt.Store, addr address.Address) (State, error) {
|
||||||
out := state5{store: store}
|
out := state5{store: store}
|
||||||
out.State = account5.State{Address: addr}
|
out.State = account5.State{Address:addr}
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ func load6(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
|
|
||||||
func make6(store adt.Store, addr address.Address) (State, error) {
|
func make6(store adt.Store, addr address.Address) (State, error) {
|
||||||
out := state6{store: store}
|
out := state6{store: store}
|
||||||
out.State = account6.State{Address: addr}
|
out.State = account6.State{Address:addr}
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ func load7(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
|
|
||||||
func make7(store adt.Store, addr address.Address) (State, error) {
|
func make7(store adt.Store, addr address.Address) (State, error) {
|
||||||
out := state7{store: store}
|
out := state7{store: store}
|
||||||
out.State = account7.State{Address: addr}
|
out.State = account7.State{Address:addr}
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ func load8(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
|
|
||||||
func make8(store adt.Store, addr address.Address) (State, error) {
|
func make8(store adt.Store, addr address.Address) (State, error) {
|
||||||
out := state8{store: store}
|
out := state8{store: store}
|
||||||
out.State = account8.State{Address: addr}
|
out.State = account8.State{Address:addr}
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,33 +5,36 @@ import (
|
|||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
|
||||||
smoothing0 "github.com/filecoin-project/specs-actors/actors/util/smoothing"
|
|
||||||
|
|
||||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
smoothing2 "github.com/filecoin-project/specs-actors/v2/actors/util/smoothing"
|
smoothing0 "github.com/filecoin-project/specs-actors/actors/util/smoothing"
|
||||||
|
|
||||||
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||||
smoothing3 "github.com/filecoin-project/specs-actors/v3/actors/util/smoothing"
|
smoothing2 "github.com/filecoin-project/specs-actors/v2/actors/util/smoothing"
|
||||||
|
|
||||||
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
||||||
smoothing4 "github.com/filecoin-project/specs-actors/v4/actors/util/smoothing"
|
smoothing3 "github.com/filecoin-project/specs-actors/v3/actors/util/smoothing"
|
||||||
|
|
||||||
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
||||||
smoothing5 "github.com/filecoin-project/specs-actors/v5/actors/util/smoothing"
|
smoothing4 "github.com/filecoin-project/specs-actors/v4/actors/util/smoothing"
|
||||||
|
|
||||||
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
||||||
smoothing6 "github.com/filecoin-project/specs-actors/v6/actors/util/smoothing"
|
smoothing5 "github.com/filecoin-project/specs-actors/v5/actors/util/smoothing"
|
||||||
|
|
||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
||||||
smoothing7 "github.com/filecoin-project/specs-actors/v7/actors/util/smoothing"
|
smoothing6 "github.com/filecoin-project/specs-actors/v6/actors/util/smoothing"
|
||||||
|
|
||||||
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
smoothing7 "github.com/filecoin-project/specs-actors/v7/actors/util/smoothing"
|
||||||
|
|
||||||
|
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
||||||
|
smoothing8 "github.com/filecoin-project/specs-actors/v8/actors/util/smoothing"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
|
||||||
smoothing8 "github.com/filecoin-project/specs-actors/v8/actors/util/smoothing"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
|
||||||
@ -72,53 +75,55 @@ func QAPowerForWeight(size abi.SectorSize, duration abi.ChainEpoch, dealWeight,
|
|||||||
return miner8.QAPowerForWeight(size, duration, dealWeight, verifiedWeight)
|
return miner8.QAPowerForWeight(size, duration, dealWeight, verifiedWeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
func FromV0FilterEstimate(v0 smoothing0.FilterEstimate) FilterEstimate {
|
|
||||||
|
|
||||||
return (FilterEstimate)(v0) //nolint:unconvert
|
func FromV0FilterEstimate(v0 smoothing0.FilterEstimate) FilterEstimate {
|
||||||
|
|
||||||
}
|
return (FilterEstimate)(v0) //nolint:unconvert
|
||||||
|
|
||||||
func FromV2FilterEstimate(v2 smoothing2.FilterEstimate) FilterEstimate {
|
}
|
||||||
|
|
||||||
return (FilterEstimate)(v2)
|
func FromV2FilterEstimate(v2 smoothing2.FilterEstimate) FilterEstimate {
|
||||||
|
|
||||||
}
|
return (FilterEstimate)(v2)
|
||||||
|
|
||||||
func FromV3FilterEstimate(v3 smoothing3.FilterEstimate) FilterEstimate {
|
}
|
||||||
|
|
||||||
return (FilterEstimate)(v3)
|
func FromV3FilterEstimate(v3 smoothing3.FilterEstimate) FilterEstimate {
|
||||||
|
|
||||||
}
|
return (FilterEstimate)(v3)
|
||||||
|
|
||||||
func FromV4FilterEstimate(v4 smoothing4.FilterEstimate) FilterEstimate {
|
}
|
||||||
|
|
||||||
return (FilterEstimate)(v4)
|
func FromV4FilterEstimate(v4 smoothing4.FilterEstimate) FilterEstimate {
|
||||||
|
|
||||||
}
|
return (FilterEstimate)(v4)
|
||||||
|
|
||||||
func FromV5FilterEstimate(v5 smoothing5.FilterEstimate) FilterEstimate {
|
}
|
||||||
|
|
||||||
return (FilterEstimate)(v5)
|
func FromV5FilterEstimate(v5 smoothing5.FilterEstimate) FilterEstimate {
|
||||||
|
|
||||||
}
|
return (FilterEstimate)(v5)
|
||||||
|
|
||||||
func FromV6FilterEstimate(v6 smoothing6.FilterEstimate) FilterEstimate {
|
}
|
||||||
|
|
||||||
return (FilterEstimate)(v6)
|
func FromV6FilterEstimate(v6 smoothing6.FilterEstimate) FilterEstimate {
|
||||||
|
|
||||||
}
|
return (FilterEstimate)(v6)
|
||||||
|
|
||||||
func FromV7FilterEstimate(v7 smoothing7.FilterEstimate) FilterEstimate {
|
}
|
||||||
|
|
||||||
return (FilterEstimate)(v7)
|
func FromV7FilterEstimate(v7 smoothing7.FilterEstimate) FilterEstimate {
|
||||||
|
|
||||||
}
|
return (FilterEstimate)(v7)
|
||||||
|
|
||||||
func FromV8FilterEstimate(v8 smoothing8.FilterEstimate) FilterEstimate {
|
}
|
||||||
|
|
||||||
return (FilterEstimate)(v8)
|
func FromV8FilterEstimate(v8 smoothing8.FilterEstimate) FilterEstimate {
|
||||||
|
|
||||||
|
return (FilterEstimate)(v8)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
type ActorStateLoader func(store adt.Store, root cid.Cid) (cbor.Marshaler, error)
|
type ActorStateLoader func(store adt.Store, root cid.Cid) (cbor.Marshaler, error)
|
||||||
|
|
||||||
@ -137,31 +142,36 @@ func Load(store adt.Store, act *types.Actor) (cbor.Marshaler, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ActorNameByCode(c cid.Cid) string {
|
func ActorNameByCode(c cid.Cid) string {
|
||||||
|
name, _, ok := actors.GetActorMetaByCode(c)
|
||||||
|
if ok {
|
||||||
|
return name
|
||||||
|
}
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
|
|
||||||
case builtin0.IsBuiltinActor(c):
|
case builtin0.IsBuiltinActor(c):
|
||||||
return builtin0.ActorNameByCode(c)
|
return builtin0.ActorNameByCode(c)
|
||||||
|
|
||||||
case builtin2.IsBuiltinActor(c):
|
case builtin2.IsBuiltinActor(c):
|
||||||
return builtin2.ActorNameByCode(c)
|
return builtin2.ActorNameByCode(c)
|
||||||
|
|
||||||
case builtin3.IsBuiltinActor(c):
|
case builtin3.IsBuiltinActor(c):
|
||||||
return builtin3.ActorNameByCode(c)
|
return builtin3.ActorNameByCode(c)
|
||||||
|
|
||||||
case builtin4.IsBuiltinActor(c):
|
case builtin4.IsBuiltinActor(c):
|
||||||
return builtin4.ActorNameByCode(c)
|
return builtin4.ActorNameByCode(c)
|
||||||
|
|
||||||
case builtin5.IsBuiltinActor(c):
|
case builtin5.IsBuiltinActor(c):
|
||||||
return builtin5.ActorNameByCode(c)
|
return builtin5.ActorNameByCode(c)
|
||||||
|
|
||||||
case builtin6.IsBuiltinActor(c):
|
case builtin6.IsBuiltinActor(c):
|
||||||
return builtin6.ActorNameByCode(c)
|
return builtin6.ActorNameByCode(c)
|
||||||
|
|
||||||
case builtin7.IsBuiltinActor(c):
|
case builtin7.IsBuiltinActor(c):
|
||||||
return builtin7.ActorNameByCode(c)
|
return builtin7.ActorNameByCode(c)
|
||||||
|
|
||||||
case builtin8.IsBuiltinActor(c):
|
case builtin8.IsBuiltinActor(c):
|
||||||
return builtin8.ActorNameByCode(c)
|
return builtin8.ActorNameByCode(c)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return "<unknown>"
|
return "<unknown>"
|
||||||
@ -169,186 +179,211 @@ func ActorNameByCode(c cid.Cid) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func IsBuiltinActor(c cid.Cid) bool {
|
func IsBuiltinActor(c cid.Cid) bool {
|
||||||
|
_, _, ok := actors.GetActorMetaByCode(c)
|
||||||
if builtin0.IsBuiltinActor(c) {
|
if ok {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if builtin2.IsBuiltinActor(c) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
if builtin3.IsBuiltinActor(c) {
|
if builtin0.IsBuiltinActor(c) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if builtin4.IsBuiltinActor(c) {
|
if builtin2.IsBuiltinActor(c) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if builtin5.IsBuiltinActor(c) {
|
if builtin3.IsBuiltinActor(c) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if builtin6.IsBuiltinActor(c) {
|
if builtin4.IsBuiltinActor(c) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if builtin7.IsBuiltinActor(c) {
|
if builtin5.IsBuiltinActor(c) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if builtin8.IsBuiltinActor(c) {
|
if builtin6.IsBuiltinActor(c) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if builtin7.IsBuiltinActor(c) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if builtin8.IsBuiltinActor(c) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsAccountActor(c cid.Cid) bool {
|
func IsAccountActor(c cid.Cid) bool {
|
||||||
|
name, _, ok := actors.GetActorMetaByCode(c)
|
||||||
if c == builtin0.AccountActorCodeID {
|
if ok {
|
||||||
return true
|
return name == "account"
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin2.AccountActorCodeID {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
if c == builtin3.AccountActorCodeID {
|
if c == builtin0.AccountActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin4.AccountActorCodeID {
|
if c == builtin2.AccountActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin5.AccountActorCodeID {
|
if c == builtin3.AccountActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin6.AccountActorCodeID {
|
if c == builtin4.AccountActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin7.AccountActorCodeID {
|
if c == builtin5.AccountActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin8.AccountActorCodeID {
|
if c == builtin6.AccountActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if c == builtin7.AccountActorCodeID {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if c == builtin8.AccountActorCodeID {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsStorageMinerActor(c cid.Cid) bool {
|
func IsStorageMinerActor(c cid.Cid) bool {
|
||||||
|
name, _, ok := actors.GetActorMetaByCode(c)
|
||||||
if c == builtin0.StorageMinerActorCodeID {
|
if ok {
|
||||||
return true
|
return name == "storageminer"
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin2.StorageMinerActorCodeID {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
if c == builtin3.StorageMinerActorCodeID {
|
if c == builtin0.StorageMinerActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin4.StorageMinerActorCodeID {
|
if c == builtin2.StorageMinerActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin5.StorageMinerActorCodeID {
|
if c == builtin3.StorageMinerActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin6.StorageMinerActorCodeID {
|
if c == builtin4.StorageMinerActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin7.StorageMinerActorCodeID {
|
if c == builtin5.StorageMinerActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin8.StorageMinerActorCodeID {
|
if c == builtin6.StorageMinerActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if c == builtin7.StorageMinerActorCodeID {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if c == builtin8.StorageMinerActorCodeID {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsMultisigActor(c cid.Cid) bool {
|
func IsMultisigActor(c cid.Cid) bool {
|
||||||
|
name, _, ok := actors.GetActorMetaByCode(c)
|
||||||
if c == builtin0.MultisigActorCodeID {
|
if ok {
|
||||||
return true
|
return name == "multisig"
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin2.MultisigActorCodeID {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
if c == builtin3.MultisigActorCodeID {
|
if c == builtin0.MultisigActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin4.MultisigActorCodeID {
|
if c == builtin2.MultisigActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin5.MultisigActorCodeID {
|
if c == builtin3.MultisigActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin6.MultisigActorCodeID {
|
if c == builtin4.MultisigActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin7.MultisigActorCodeID {
|
if c == builtin5.MultisigActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin8.MultisigActorCodeID {
|
if c == builtin6.MultisigActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if c == builtin7.MultisigActorCodeID {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if c == builtin8.MultisigActorCodeID {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsPaymentChannelActor(c cid.Cid) bool {
|
func IsPaymentChannelActor(c cid.Cid) bool {
|
||||||
|
name, _, ok := actors.GetActorMetaByCode(c)
|
||||||
if c == builtin0.PaymentChannelActorCodeID {
|
if ok {
|
||||||
return true
|
return name == "paymentchannel"
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin2.PaymentChannelActorCodeID {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
if c == builtin3.PaymentChannelActorCodeID {
|
if c == builtin0.PaymentChannelActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin4.PaymentChannelActorCodeID {
|
if c == builtin2.PaymentChannelActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin5.PaymentChannelActorCodeID {
|
if c == builtin3.PaymentChannelActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin6.PaymentChannelActorCodeID {
|
if c == builtin4.PaymentChannelActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin7.PaymentChannelActorCodeID {
|
if c == builtin5.PaymentChannelActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin8.PaymentChannelActorCodeID {
|
if c == builtin6.PaymentChannelActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if c == builtin7.PaymentChannelActorCodeID {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if c == builtin8.PaymentChannelActorCodeID {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,8 @@ package cron
|
|||||||
import (
|
import (
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
|
|
||||||
@ -21,6 +21,7 @@ import (
|
|||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func MakeState(store adt.Store, av actors.Version) (State, error) {
|
func MakeState(store adt.Store, av actors.Version) (State, error) {
|
||||||
@ -50,11 +51,15 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
|
|||||||
case actors.Version8:
|
case actors.Version8:
|
||||||
return make8(store)
|
return make8(store)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, "cron"); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
|
|
||||||
case actors.Version0:
|
case actors.Version0:
|
||||||
@ -91,6 +96,7 @@ var (
|
|||||||
Methods = builtin8.MethodsCron
|
Methods = builtin8.MethodsCron
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
type State interface {
|
type State interface {
|
||||||
GetState() interface{}
|
GetState() interface{}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import (
|
|||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -37,33 +38,81 @@ func init() {
|
|||||||
return load0(store, root)
|
return load0(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version0, "init"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load0(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin2.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin2.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load2(store, root)
|
return load2(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version2, "init"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load2(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin3.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin3.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load3(store, root)
|
return load3(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version3, "init"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load3(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin4.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin4.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load4(store, root)
|
return load4(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version4, "init"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load4(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin5.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin5.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load5(store, root)
|
return load5(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version5, "init"); ok {
|
||||||
|
builtin.RegisterActorState(c, 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) {
|
builtin.RegisterActorState(builtin6.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load6(store, root)
|
return load6(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version6, "init"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load6(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin7.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin7.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load7(store, root)
|
return load7(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version7, "init"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load7(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin8.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin8.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load8(store, root)
|
return load8(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version8, "init"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load8(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -72,6 +121,42 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
|
if name != "init" {
|
||||||
|
return nil, xerrors.Errorf("actor code is not init: %s", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version0:
|
||||||
|
return load0(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version2:
|
||||||
|
return load2(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version3:
|
||||||
|
return load3(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version4:
|
||||||
|
return load4(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version5:
|
||||||
|
return load5(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version6:
|
||||||
|
return load6(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
return load7(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version8:
|
||||||
|
return load8(store, act.Head)
|
||||||
|
|
||||||
|
default:
|
||||||
|
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch act.Code {
|
switch act.Code {
|
||||||
|
|
||||||
case builtin0.InitActorCodeID:
|
case builtin0.InitActorCodeID:
|
||||||
@ -129,11 +214,15 @@ func MakeState(store adt.Store, av actors.Version, networkName string) (State, e
|
|||||||
case actors.Version8:
|
case actors.Version8:
|
||||||
return make8(store, networkName)
|
return make8(store, networkName)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, "init"); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
|
|
||||||
case actors.Version0:
|
case actors.Version0:
|
||||||
|
@ -10,6 +10,8 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
init0 "github.com/filecoin-project/specs-actors/actors/builtin/init"
|
init0 "github.com/filecoin-project/specs-actors/actors/builtin/init"
|
||||||
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||||
)
|
)
|
||||||
@ -28,12 +30,12 @@ func load0(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make0(store adt.Store, networkName string) (State, error) {
|
func make0(store adt.Store, networkName string) (State, error) {
|
||||||
out := state0{store: store}
|
out := state0{store: store}
|
||||||
|
|
||||||
mr, err := adt0.MakeEmptyMap(store).Root()
|
mr, err := adt0.MakeEmptyMap(store).Root()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *init0.ConstructState(mr, networkName)
|
out.State = *init0.ConstructState(mr, networkName)
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,8 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init"
|
init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init"
|
||||||
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
|
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
|
||||||
)
|
)
|
||||||
@ -28,12 +30,12 @@ func load2(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make2(store adt.Store, networkName string) (State, error) {
|
func make2(store adt.Store, networkName string) (State, error) {
|
||||||
out := state2{store: store}
|
out := state2{store: store}
|
||||||
|
|
||||||
mr, err := adt2.MakeEmptyMap(store).Root()
|
mr, err := adt2.MakeEmptyMap(store).Root()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *init2.ConstructState(mr, networkName)
|
out.State = *init2.ConstructState(mr, networkName)
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,10 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
|
|
||||||
|
|
||||||
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
||||||
|
|
||||||
|
|
||||||
init3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/init"
|
init3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/init"
|
||||||
adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt"
|
adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt"
|
||||||
)
|
)
|
||||||
@ -30,12 +32,12 @@ func load3(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make3(store adt.Store, networkName string) (State, error) {
|
func make3(store adt.Store, networkName string) (State, error) {
|
||||||
out := state3{store: store}
|
out := state3{store: store}
|
||||||
|
|
||||||
s, err := init3.ConstructState(store, networkName)
|
s, err := init3.ConstructState(store, networkName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *s
|
out.State = *s
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,10 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
|
|
||||||
|
|
||||||
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
||||||
|
|
||||||
|
|
||||||
init4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/init"
|
init4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/init"
|
||||||
adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt"
|
adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt"
|
||||||
)
|
)
|
||||||
@ -30,12 +32,12 @@ func load4(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make4(store adt.Store, networkName string) (State, error) {
|
func make4(store adt.Store, networkName string) (State, error) {
|
||||||
out := state4{store: store}
|
out := state4{store: store}
|
||||||
|
|
||||||
s, err := init4.ConstructState(store, networkName)
|
s, err := init4.ConstructState(store, networkName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *s
|
out.State = *s
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,10 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
|
|
||||||
|
|
||||||
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
||||||
|
|
||||||
|
|
||||||
init5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/init"
|
init5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/init"
|
||||||
adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt"
|
adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt"
|
||||||
)
|
)
|
||||||
@ -30,12 +32,12 @@ func load5(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make5(store adt.Store, networkName string) (State, error) {
|
func make5(store adt.Store, networkName string) (State, error) {
|
||||||
out := state5{store: store}
|
out := state5{store: store}
|
||||||
|
|
||||||
s, err := init5.ConstructState(store, networkName)
|
s, err := init5.ConstructState(store, networkName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *s
|
out.State = *s
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,10 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
|
|
||||||
|
|
||||||
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
||||||
|
|
||||||
|
|
||||||
init6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/init"
|
init6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/init"
|
||||||
adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt"
|
adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt"
|
||||||
)
|
)
|
||||||
@ -30,12 +32,12 @@ func load6(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make6(store adt.Store, networkName string) (State, error) {
|
func make6(store adt.Store, networkName string) (State, error) {
|
||||||
out := state6{store: store}
|
out := state6{store: store}
|
||||||
|
|
||||||
s, err := init6.ConstructState(store, networkName)
|
s, err := init6.ConstructState(store, networkName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *s
|
out.State = *s
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,10 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
|
|
||||||
|
|
||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
|
||||||
|
|
||||||
init7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/init"
|
init7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/init"
|
||||||
adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt"
|
adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt"
|
||||||
)
|
)
|
||||||
@ -30,12 +32,12 @@ func load7(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make7(store adt.Store, networkName string) (State, error) {
|
func make7(store adt.Store, networkName string) (State, error) {
|
||||||
out := state7{store: store}
|
out := state7{store: store}
|
||||||
|
|
||||||
s, err := init7.ConstructState(store, networkName)
|
s, err := init7.ConstructState(store, networkName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *s
|
out.State = *s
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,10 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
|
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
||||||
|
|
||||||
|
|
||||||
init8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/init"
|
init8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/init"
|
||||||
adt8 "github.com/filecoin-project/specs-actors/v8/actors/util/adt"
|
adt8 "github.com/filecoin-project/specs-actors/v8/actors/util/adt"
|
||||||
)
|
)
|
||||||
@ -30,12 +32,12 @@ func load8(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make8(store adt.Store, networkName string) (State, error) {
|
func make8(store adt.Store, networkName string) (State, error) {
|
||||||
out := state8{store: store}
|
out := state8{store: store}
|
||||||
|
|
||||||
s, err := init8.ConstructState(store, networkName)
|
s, err := init8.ConstructState(store, networkName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *s
|
out.State = *s
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,9 @@ import (
|
|||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
@ -41,33 +42,81 @@ func init() {
|
|||||||
return load0(store, root)
|
return load0(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version0, "storagemarket"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load0(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin2.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin2.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load2(store, root)
|
return load2(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version2, "storagemarket"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load2(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin3.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin3.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load3(store, root)
|
return load3(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version3, "storagemarket"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load3(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin4.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin4.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load4(store, root)
|
return load4(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version4, "storagemarket"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load4(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin5.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin5.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load5(store, root)
|
return load5(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version5, "storagemarket"); ok {
|
||||||
|
builtin.RegisterActorState(c, 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) {
|
builtin.RegisterActorState(builtin6.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load6(store, root)
|
return load6(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version6, "storagemarket"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load6(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin7.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin7.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load7(store, root)
|
return load7(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version7, "storagemarket"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load7(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin8.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin8.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load8(store, root)
|
return load8(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version8, "storagemarket"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load8(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -76,6 +125,42 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
|
if name != "storagemarket" {
|
||||||
|
return nil, xerrors.Errorf("actor code is not storagemarket: %s", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version0:
|
||||||
|
return load0(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version2:
|
||||||
|
return load2(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version3:
|
||||||
|
return load3(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version4:
|
||||||
|
return load4(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version5:
|
||||||
|
return load5(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version6:
|
||||||
|
return load6(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
return load7(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version8:
|
||||||
|
return load8(store, act.Head)
|
||||||
|
|
||||||
|
default:
|
||||||
|
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch act.Code {
|
switch act.Code {
|
||||||
|
|
||||||
case builtin0.StorageMarketActorCodeID:
|
case builtin0.StorageMarketActorCodeID:
|
||||||
@ -133,11 +218,15 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
|
|||||||
case actors.Version8:
|
case actors.Version8:
|
||||||
return make8(store)
|
return make8(store)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, "storagemarket"); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
|
|
||||||
case actors.Version0:
|
case actors.Version0:
|
||||||
@ -210,7 +299,7 @@ type DealProposals interface {
|
|||||||
type PublishStorageDealsParams = market0.PublishStorageDealsParams
|
type PublishStorageDealsParams = market0.PublishStorageDealsParams
|
||||||
|
|
||||||
type PublishStorageDealsReturn interface {
|
type PublishStorageDealsReturn interface {
|
||||||
DealIDs() ([]abi.DealID, error)
|
DealIDs() ([]abi.DealID, error)
|
||||||
// Note that this index is based on the batch of deals that were published, NOT the DealID
|
// Note that this index is based on the batch of deals that were published, NOT the DealID
|
||||||
IsDealValid(index uint64) (bool, error)
|
IsDealValid(index uint64) (bool, error)
|
||||||
}
|
}
|
||||||
@ -247,7 +336,7 @@ func DecodePublishStorageDealsReturn(b []byte, nv network.Version) (PublishStora
|
|||||||
case actors.Version8:
|
case actors.Version8:
|
||||||
return decodePublishStorageDealsReturn8(b)
|
return decodePublishStorageDealsReturn8(b)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,67 +352,67 @@ type DealState struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DealProposal struct {
|
type DealProposal struct {
|
||||||
PieceCID cid.Cid
|
PieceCID cid.Cid
|
||||||
PieceSize abi.PaddedPieceSize
|
PieceSize abi.PaddedPieceSize
|
||||||
VerifiedDeal bool
|
VerifiedDeal bool
|
||||||
Client address.Address
|
Client address.Address
|
||||||
Provider address.Address
|
Provider address.Address
|
||||||
Label string
|
Label string
|
||||||
StartEpoch abi.ChainEpoch
|
StartEpoch abi.ChainEpoch
|
||||||
EndEpoch abi.ChainEpoch
|
EndEpoch abi.ChainEpoch
|
||||||
StoragePricePerEpoch abi.TokenAmount
|
StoragePricePerEpoch abi.TokenAmount
|
||||||
ProviderCollateral abi.TokenAmount
|
ProviderCollateral abi.TokenAmount
|
||||||
ClientCollateral abi.TokenAmount
|
ClientCollateral abi.TokenAmount
|
||||||
}
|
}
|
||||||
|
|
||||||
type DealStateChanges struct {
|
type DealStateChanges struct {
|
||||||
Added []DealIDState
|
Added []DealIDState
|
||||||
Modified []DealStateChange
|
Modified []DealStateChange
|
||||||
Removed []DealIDState
|
Removed []DealIDState
|
||||||
}
|
}
|
||||||
|
|
||||||
type DealIDState struct {
|
type DealIDState struct {
|
||||||
ID abi.DealID
|
ID abi.DealID
|
||||||
Deal DealState
|
Deal DealState
|
||||||
}
|
}
|
||||||
|
|
||||||
// DealStateChange is a change in deal state from -> to
|
// DealStateChange is a change in deal state from -> to
|
||||||
type DealStateChange struct {
|
type DealStateChange struct {
|
||||||
ID abi.DealID
|
ID abi.DealID
|
||||||
From *DealState
|
From *DealState
|
||||||
To *DealState
|
To *DealState
|
||||||
}
|
}
|
||||||
|
|
||||||
type DealProposalChanges struct {
|
type DealProposalChanges struct {
|
||||||
Added []ProposalIDState
|
Added []ProposalIDState
|
||||||
Removed []ProposalIDState
|
Removed []ProposalIDState
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProposalIDState struct {
|
type ProposalIDState struct {
|
||||||
ID abi.DealID
|
ID abi.DealID
|
||||||
Proposal DealProposal
|
Proposal DealProposal
|
||||||
}
|
}
|
||||||
|
|
||||||
func EmptyDealState() *DealState {
|
func EmptyDealState() *DealState {
|
||||||
return &DealState{
|
return &DealState{
|
||||||
SectorStartEpoch: -1,
|
SectorStartEpoch: -1,
|
||||||
SlashEpoch: -1,
|
SlashEpoch: -1,
|
||||||
LastUpdatedEpoch: -1,
|
LastUpdatedEpoch: -1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns the earned fees and pending fees for a given deal
|
// returns the earned fees and pending fees for a given deal
|
||||||
func (deal DealProposal) GetDealFees(height abi.ChainEpoch) (abi.TokenAmount, abi.TokenAmount) {
|
func (deal DealProposal) GetDealFees(height abi.ChainEpoch) (abi.TokenAmount, abi.TokenAmount) {
|
||||||
tf := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(deal.EndEpoch-deal.StartEpoch)))
|
tf := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(deal.EndEpoch-deal.StartEpoch)))
|
||||||
|
|
||||||
ef := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(height-deal.StartEpoch)))
|
ef := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(height-deal.StartEpoch)))
|
||||||
if ef.LessThan(big.Zero()) {
|
if ef.LessThan(big.Zero()) {
|
||||||
ef = big.Zero()
|
ef = big.Zero()
|
||||||
}
|
}
|
||||||
|
|
||||||
if ef.GreaterThan(tf) {
|
if ef.GreaterThan(tf) {
|
||||||
ef = tf
|
ef = tf
|
||||||
}
|
}
|
||||||
|
|
||||||
return ef, big.Sub(tf, ef)
|
return ef, big.Sub(tf, ef)
|
||||||
}
|
}
|
||||||
|
@ -30,17 +30,17 @@ func load0(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make0(store adt.Store) (State, error) {
|
func make0(store adt.Store) (State, error) {
|
||||||
out := state0{store: store}
|
out := state0{store: store}
|
||||||
|
|
||||||
ea, err := adt0.MakeEmptyArray(store).Root()
|
ea, err := adt0.MakeEmptyArray(store).Root()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
em, err := adt0.MakeEmptyMap(store).Root()
|
em, err := adt0.MakeEmptyMap(store).Root()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *market0.ConstructState(ea, em, em)
|
out.State = *market0.ConstructState(ea, em, em)
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
@ -248,11 +248,11 @@ type publishStorageDealsReturn0 struct {
|
|||||||
|
|
||||||
func (r *publishStorageDealsReturn0) IsDealValid(index uint64) (bool, error) {
|
func (r *publishStorageDealsReturn0) IsDealValid(index uint64) (bool, error) {
|
||||||
|
|
||||||
// PublishStorageDeals only succeeded if all deals were valid in this version of actors
|
// PublishStorageDeals only succeeded if all deals were valid in this version of actors
|
||||||
return true, nil
|
return true, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *publishStorageDealsReturn0) DealIDs() ([]abi.DealID, error) {
|
func (r *publishStorageDealsReturn0) DealIDs() ([]abi.DealID, error) {
|
||||||
return r.IDs, nil
|
return r.IDs, nil
|
||||||
}
|
}
|
||||||
|
@ -30,17 +30,17 @@ func load2(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make2(store adt.Store) (State, error) {
|
func make2(store adt.Store) (State, error) {
|
||||||
out := state2{store: store}
|
out := state2{store: store}
|
||||||
|
|
||||||
ea, err := adt2.MakeEmptyArray(store).Root()
|
ea, err := adt2.MakeEmptyArray(store).Root()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
em, err := adt2.MakeEmptyMap(store).Root()
|
em, err := adt2.MakeEmptyMap(store).Root()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *market2.ConstructState(ea, em, em)
|
out.State = *market2.ConstructState(ea, em, em)
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
@ -248,11 +248,11 @@ type publishStorageDealsReturn2 struct {
|
|||||||
|
|
||||||
func (r *publishStorageDealsReturn2) IsDealValid(index uint64) (bool, error) {
|
func (r *publishStorageDealsReturn2) IsDealValid(index uint64) (bool, error) {
|
||||||
|
|
||||||
// PublishStorageDeals only succeeded if all deals were valid in this version of actors
|
// PublishStorageDeals only succeeded if all deals were valid in this version of actors
|
||||||
return true, nil
|
return true, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *publishStorageDealsReturn2) DealIDs() ([]abi.DealID, error) {
|
func (r *publishStorageDealsReturn2) DealIDs() ([]abi.DealID, error) {
|
||||||
return r.IDs, nil
|
return r.IDs, nil
|
||||||
}
|
}
|
||||||
|
@ -30,12 +30,12 @@ func load3(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make3(store adt.Store) (State, error) {
|
func make3(store adt.Store) (State, error) {
|
||||||
out := state3{store: store}
|
out := state3{store: store}
|
||||||
|
|
||||||
s, err := market3.ConstructState(store)
|
s, err := market3.ConstructState(store)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *s
|
out.State = *s
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
@ -243,11 +243,11 @@ type publishStorageDealsReturn3 struct {
|
|||||||
|
|
||||||
func (r *publishStorageDealsReturn3) IsDealValid(index uint64) (bool, error) {
|
func (r *publishStorageDealsReturn3) IsDealValid(index uint64) (bool, error) {
|
||||||
|
|
||||||
// PublishStorageDeals only succeeded if all deals were valid in this version of actors
|
// PublishStorageDeals only succeeded if all deals were valid in this version of actors
|
||||||
return true, nil
|
return true, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *publishStorageDealsReturn3) DealIDs() ([]abi.DealID, error) {
|
func (r *publishStorageDealsReturn3) DealIDs() ([]abi.DealID, error) {
|
||||||
return r.IDs, nil
|
return r.IDs, nil
|
||||||
}
|
}
|
||||||
|
@ -30,12 +30,12 @@ func load4(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make4(store adt.Store) (State, error) {
|
func make4(store adt.Store) (State, error) {
|
||||||
out := state4{store: store}
|
out := state4{store: store}
|
||||||
|
|
||||||
s, err := market4.ConstructState(store)
|
s, err := market4.ConstructState(store)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *s
|
out.State = *s
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
@ -243,11 +243,11 @@ type publishStorageDealsReturn4 struct {
|
|||||||
|
|
||||||
func (r *publishStorageDealsReturn4) IsDealValid(index uint64) (bool, error) {
|
func (r *publishStorageDealsReturn4) IsDealValid(index uint64) (bool, error) {
|
||||||
|
|
||||||
// PublishStorageDeals only succeeded if all deals were valid in this version of actors
|
// PublishStorageDeals only succeeded if all deals were valid in this version of actors
|
||||||
return true, nil
|
return true, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *publishStorageDealsReturn4) DealIDs() ([]abi.DealID, error) {
|
func (r *publishStorageDealsReturn4) DealIDs() ([]abi.DealID, error) {
|
||||||
return r.IDs, nil
|
return r.IDs, nil
|
||||||
}
|
}
|
||||||
|
@ -30,12 +30,12 @@ func load5(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make5(store adt.Store) (State, error) {
|
func make5(store adt.Store) (State, error) {
|
||||||
out := state5{store: store}
|
out := state5{store: store}
|
||||||
|
|
||||||
s, err := market5.ConstructState(store)
|
s, err := market5.ConstructState(store)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *s
|
out.State = *s
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
@ -243,11 +243,11 @@ type publishStorageDealsReturn5 struct {
|
|||||||
|
|
||||||
func (r *publishStorageDealsReturn5) IsDealValid(index uint64) (bool, error) {
|
func (r *publishStorageDealsReturn5) IsDealValid(index uint64) (bool, error) {
|
||||||
|
|
||||||
// PublishStorageDeals only succeeded if all deals were valid in this version of actors
|
// PublishStorageDeals only succeeded if all deals were valid in this version of actors
|
||||||
return true, nil
|
return true, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *publishStorageDealsReturn5) DealIDs() ([]abi.DealID, error) {
|
func (r *publishStorageDealsReturn5) DealIDs() ([]abi.DealID, error) {
|
||||||
return r.IDs, nil
|
return r.IDs, nil
|
||||||
}
|
}
|
||||||
|
@ -30,12 +30,12 @@ func load6(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make6(store adt.Store) (State, error) {
|
func make6(store adt.Store) (State, error) {
|
||||||
out := state6{store: store}
|
out := state6{store: store}
|
||||||
|
|
||||||
s, err := market6.ConstructState(store)
|
s, err := market6.ConstructState(store)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *s
|
out.State = *s
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
@ -243,10 +243,10 @@ type publishStorageDealsReturn6 struct {
|
|||||||
|
|
||||||
func (r *publishStorageDealsReturn6) IsDealValid(index uint64) (bool, error) {
|
func (r *publishStorageDealsReturn6) IsDealValid(index uint64) (bool, error) {
|
||||||
|
|
||||||
return r.ValidDeals.IsSet(index)
|
return r.ValidDeals.IsSet(index)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *publishStorageDealsReturn6) DealIDs() ([]abi.DealID, error) {
|
func (r *publishStorageDealsReturn6) DealIDs() ([]abi.DealID, error) {
|
||||||
return r.IDs, nil
|
return r.IDs, nil
|
||||||
}
|
}
|
||||||
|
@ -30,12 +30,12 @@ func load7(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make7(store adt.Store) (State, error) {
|
func make7(store adt.Store) (State, error) {
|
||||||
out := state7{store: store}
|
out := state7{store: store}
|
||||||
|
|
||||||
s, err := market7.ConstructState(store)
|
s, err := market7.ConstructState(store)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *s
|
out.State = *s
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
@ -243,10 +243,10 @@ type publishStorageDealsReturn7 struct {
|
|||||||
|
|
||||||
func (r *publishStorageDealsReturn7) IsDealValid(index uint64) (bool, error) {
|
func (r *publishStorageDealsReturn7) IsDealValid(index uint64) (bool, error) {
|
||||||
|
|
||||||
return r.ValidDeals.IsSet(index)
|
return r.ValidDeals.IsSet(index)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *publishStorageDealsReturn7) DealIDs() ([]abi.DealID, error) {
|
func (r *publishStorageDealsReturn7) DealIDs() ([]abi.DealID, error) {
|
||||||
return r.IDs, nil
|
return r.IDs, nil
|
||||||
}
|
}
|
||||||
|
@ -30,12 +30,12 @@ func load8(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make8(store adt.Store) (State, error) {
|
func make8(store adt.Store) (State, error) {
|
||||||
out := state8{store: store}
|
out := state8{store: store}
|
||||||
|
|
||||||
s, err := market8.ConstructState(store)
|
s, err := market8.ConstructState(store)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *s
|
out.State = *s
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
@ -243,10 +243,10 @@ type publishStorageDealsReturn8 struct {
|
|||||||
|
|
||||||
func (r *publishStorageDealsReturn8) IsDealValid(index uint64) (bool, error) {
|
func (r *publishStorageDealsReturn8) IsDealValid(index uint64) (bool, error) {
|
||||||
|
|
||||||
return r.ValidDeals.IsSet(index)
|
return r.ValidDeals.IsSet(index)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *publishStorageDealsReturn8) DealIDs() ([]abi.DealID, error) {
|
func (r *publishStorageDealsReturn8) DealIDs() ([]abi.DealID, error) {
|
||||||
return r.IDs, nil
|
return r.IDs, nil
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ import (
|
|||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -48,34 +49,82 @@ func init() {
|
|||||||
return load0(store, root)
|
return load0(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version0, "storageminer"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load0(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin2.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin2.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load2(store, root)
|
return load2(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version2, "storageminer"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load2(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin3.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin3.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load3(store, root)
|
return load3(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version3, "storageminer"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load3(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin4.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin4.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load4(store, root)
|
return load4(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version4, "storageminer"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load4(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin5.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin5.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load5(store, root)
|
return load5(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version5, "storageminer"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load5(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin6.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin6.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load6(store, root)
|
return load6(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version6, "storageminer"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load6(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin7.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin7.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load7(store, root)
|
return load7(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version7, "storageminer"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load7(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin8.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin8.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load8(store, root)
|
return load8(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version8, "storageminer"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load8(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var Methods = builtin8.MethodsMiner
|
var Methods = builtin8.MethodsMiner
|
||||||
@ -95,6 +144,42 @@ var DeclarationsMax = miner2.DeclarationsMax
|
|||||||
var AddressedSectorsMax = miner2.AddressedSectorsMax
|
var AddressedSectorsMax = miner2.AddressedSectorsMax
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
|
if name != "storageminer" {
|
||||||
|
return nil, xerrors.Errorf("actor code is not storageminer: %s", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version0:
|
||||||
|
return load0(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version2:
|
||||||
|
return load2(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version3:
|
||||||
|
return load3(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version4:
|
||||||
|
return load4(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version5:
|
||||||
|
return load5(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version6:
|
||||||
|
return load6(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
return load7(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version8:
|
||||||
|
return load8(store, act.Head)
|
||||||
|
|
||||||
|
default:
|
||||||
|
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch act.Code {
|
switch act.Code {
|
||||||
|
|
||||||
case builtin0.StorageMinerActorCodeID:
|
case builtin0.StorageMinerActorCodeID:
|
||||||
@ -121,7 +206,7 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case builtin8.StorageMinerActorCodeID:
|
case builtin8.StorageMinerActorCodeID:
|
||||||
return load8(store, act.Head)
|
return load8(store, act.Head)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,11 +237,15 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
|
|||||||
case actors.Version8:
|
case actors.Version8:
|
||||||
return make8(store)
|
return make8(store)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, "storageminer"); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
|
|
||||||
case actors.Version0:
|
case actors.Version0:
|
||||||
@ -207,8 +296,8 @@ type State interface {
|
|||||||
LoadSectors(sectorNos *bitfield.BitField) ([]*SectorOnChainInfo, error)
|
LoadSectors(sectorNos *bitfield.BitField) ([]*SectorOnChainInfo, error)
|
||||||
NumLiveSectors() (uint64, error)
|
NumLiveSectors() (uint64, error)
|
||||||
IsAllocated(abi.SectorNumber) (bool, error)
|
IsAllocated(abi.SectorNumber) (bool, error)
|
||||||
// UnallocatedSectorNumbers returns up to count unallocated sector numbers (or less than
|
// UnallocatedSectorNumbers returns up to count unallocated sector numbers (or less than
|
||||||
// count if there aren't enough).
|
// count if there aren't enough).
|
||||||
UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error)
|
UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error)
|
||||||
GetAllocatedSectors() (*bitfield.BitField, error)
|
GetAllocatedSectors() (*bitfield.BitField, error)
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
|
|
||||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||||
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||||
)
|
)
|
||||||
@ -135,10 +136,10 @@ func (s *state0) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// NOTE: this can be optimized significantly.
|
// NOTE: this can be optimized significantly.
|
||||||
// 1. If the sector is non-faulty, it will either expire on-time (can be
|
// 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
|
// learned from the sector info), or in the next quantized expiration
|
||||||
// epoch (i.e., the first element in the partition's expiration queue.
|
// 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
|
// 2. If it's faulty, it will expire early within the first 14 entries
|
||||||
// of the expiration queue.
|
// of the expiration queue.
|
||||||
|
|
||||||
stopErr := errors.New("stop")
|
stopErr := errors.New("stop")
|
||||||
@ -209,7 +210,7 @@ func (s *state0) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state0) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
func (s *state0) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
||||||
precommitted, err := adt0.AsMap(s.store, s.State.PreCommittedSectors)
|
precommitted, err := adt0.AsMap(s.store, s.State.PreCommittedSectors)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -288,7 +289,7 @@ func (s *state0) UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unallocatedRuns, err := rle.Subtract(
|
unallocatedRuns, err := rle.Subtract(
|
||||||
&rle.RunSliceIterator{Runs: []rle.Run{{Val: true, Len: abi.MaxSectorNumber}}},
|
&rle.RunSliceIterator{Runs: []rle.Run{ {Val: true, Len: abi.MaxSectorNumber} }},
|
||||||
allocatedRuns,
|
allocatedRuns,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -444,8 +445,8 @@ func (s *state0) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreC
|
|||||||
|
|
||||||
func (s *state0) EraseAllUnproven() error {
|
func (s *state0) EraseAllUnproven() error {
|
||||||
|
|
||||||
// field doesn't exist until v2
|
// field doesn't exist until v2
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -518,6 +519,7 @@ func fromV0SectorOnChainInfo(v0 miner0.SectorOnChainInfo) SectorOnChainInfo {
|
|||||||
InitialPledge: v0.InitialPledge,
|
InitialPledge: v0.InitialPledge,
|
||||||
ExpectedDayReward: v0.ExpectedDayReward,
|
ExpectedDayReward: v0.ExpectedDayReward,
|
||||||
ExpectedStoragePledge: v0.ExpectedStoragePledge,
|
ExpectedStoragePledge: v0.ExpectedStoragePledge,
|
||||||
|
|
||||||
}
|
}
|
||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
|
|
||||||
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
|
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
|
||||||
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
|
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
|
||||||
)
|
)
|
||||||
@ -133,10 +134,10 @@ func (s *state2) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// NOTE: this can be optimized significantly.
|
// NOTE: this can be optimized significantly.
|
||||||
// 1. If the sector is non-faulty, it will either expire on-time (can be
|
// 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
|
// learned from the sector info), or in the next quantized expiration
|
||||||
// epoch (i.e., the first element in the partition's expiration queue.
|
// 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
|
// 2. If it's faulty, it will expire early within the first 14 entries
|
||||||
// of the expiration queue.
|
// of the expiration queue.
|
||||||
|
|
||||||
stopErr := errors.New("stop")
|
stopErr := errors.New("stop")
|
||||||
@ -207,7 +208,7 @@ func (s *state2) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state2) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
func (s *state2) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
||||||
precommitted, err := adt2.AsMap(s.store, s.State.PreCommittedSectors)
|
precommitted, err := adt2.AsMap(s.store, s.State.PreCommittedSectors)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -286,7 +287,7 @@ func (s *state2) UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unallocatedRuns, err := rle.Subtract(
|
unallocatedRuns, err := rle.Subtract(
|
||||||
&rle.RunSliceIterator{Runs: []rle.Run{{Val: true, Len: abi.MaxSectorNumber}}},
|
&rle.RunSliceIterator{Runs: []rle.Run{ {Val: true, Len: abi.MaxSectorNumber} }},
|
||||||
allocatedRuns,
|
allocatedRuns,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -442,40 +443,40 @@ func (s *state2) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreC
|
|||||||
|
|
||||||
func (s *state2) EraseAllUnproven() error {
|
func (s *state2) EraseAllUnproven() error {
|
||||||
|
|
||||||
dls, err := s.State.LoadDeadlines(s.store)
|
dls, err := s.State.LoadDeadlines(s.store)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = dls.ForEach(s.store, func(dindx uint64, dl *miner2.Deadline) error {
|
|
||||||
ps, err := dl.PartitionsArray(s.store)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var part miner2.Partition
|
err = dls.ForEach(s.store, func(dindx uint64, dl *miner2.Deadline) error {
|
||||||
err = ps.ForEach(&part, func(pindx int64) error {
|
ps, err := dl.PartitionsArray(s.store)
|
||||||
_ = part.ActivateUnproven()
|
if err != nil {
|
||||||
err = ps.Set(uint64(pindx), &part)
|
return err
|
||||||
return nil
|
}
|
||||||
|
|
||||||
|
var part miner2.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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
dl.Partitions, err = ps.Root()
|
return s.State.SaveDeadlines(s.store, dls)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return dls.UpdateDeadline(s.store, dindx, dl)
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return s.State.SaveDeadlines(s.store, dls)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,6 +549,7 @@ func fromV2SectorOnChainInfo(v2 miner2.SectorOnChainInfo) SectorOnChainInfo {
|
|||||||
InitialPledge: v2.InitialPledge,
|
InitialPledge: v2.InitialPledge,
|
||||||
ExpectedDayReward: v2.ExpectedDayReward,
|
ExpectedDayReward: v2.ExpectedDayReward,
|
||||||
ExpectedStoragePledge: v2.ExpectedStoragePledge,
|
ExpectedStoragePledge: v2.ExpectedStoragePledge,
|
||||||
|
|
||||||
}
|
}
|
||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
|
|
||||||
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
||||||
|
|
||||||
miner3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/miner"
|
miner3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/miner"
|
||||||
@ -135,10 +136,10 @@ func (s *state3) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// NOTE: this can be optimized significantly.
|
// NOTE: this can be optimized significantly.
|
||||||
// 1. If the sector is non-faulty, it will either expire on-time (can be
|
// 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
|
// learned from the sector info), or in the next quantized expiration
|
||||||
// epoch (i.e., the first element in the partition's expiration queue.
|
// 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
|
// 2. If it's faulty, it will expire early within the first 14 entries
|
||||||
// of the expiration queue.
|
// of the expiration queue.
|
||||||
|
|
||||||
stopErr := errors.New("stop")
|
stopErr := errors.New("stop")
|
||||||
@ -209,7 +210,7 @@ func (s *state3) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state3) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
func (s *state3) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
||||||
precommitted, err := adt3.AsMap(s.store, s.State.PreCommittedSectors, builtin3.DefaultHamtBitwidth)
|
precommitted, err := adt3.AsMap(s.store, s.State.PreCommittedSectors, builtin3.DefaultHamtBitwidth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -288,7 +289,7 @@ func (s *state3) UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unallocatedRuns, err := rle.Subtract(
|
unallocatedRuns, err := rle.Subtract(
|
||||||
&rle.RunSliceIterator{Runs: []rle.Run{{Val: true, Len: abi.MaxSectorNumber}}},
|
&rle.RunSliceIterator{Runs: []rle.Run{ {Val: true, Len: abi.MaxSectorNumber} }},
|
||||||
allocatedRuns,
|
allocatedRuns,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -439,40 +440,40 @@ func (s *state3) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreC
|
|||||||
|
|
||||||
func (s *state3) EraseAllUnproven() error {
|
func (s *state3) EraseAllUnproven() error {
|
||||||
|
|
||||||
dls, err := s.State.LoadDeadlines(s.store)
|
dls, err := s.State.LoadDeadlines(s.store)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = dls.ForEach(s.store, func(dindx uint64, dl *miner3.Deadline) error {
|
|
||||||
ps, err := dl.PartitionsArray(s.store)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var part miner3.Partition
|
err = dls.ForEach(s.store, func(dindx uint64, dl *miner3.Deadline) error {
|
||||||
err = ps.ForEach(&part, func(pindx int64) error {
|
ps, err := dl.PartitionsArray(s.store)
|
||||||
_ = part.ActivateUnproven()
|
if err != nil {
|
||||||
err = ps.Set(uint64(pindx), &part)
|
return err
|
||||||
return nil
|
}
|
||||||
|
|
||||||
|
var part miner3.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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
dl.Partitions, err = ps.Root()
|
return s.State.SaveDeadlines(s.store, dls)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return dls.UpdateDeadline(s.store, dindx, dl)
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return s.State.SaveDeadlines(s.store, dls)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,6 +550,7 @@ func fromV3SectorOnChainInfo(v3 miner3.SectorOnChainInfo) SectorOnChainInfo {
|
|||||||
InitialPledge: v3.InitialPledge,
|
InitialPledge: v3.InitialPledge,
|
||||||
ExpectedDayReward: v3.ExpectedDayReward,
|
ExpectedDayReward: v3.ExpectedDayReward,
|
||||||
ExpectedStoragePledge: v3.ExpectedStoragePledge,
|
ExpectedStoragePledge: v3.ExpectedStoragePledge,
|
||||||
|
|
||||||
}
|
}
|
||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
|
|
||||||
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
||||||
|
|
||||||
miner4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/miner"
|
miner4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/miner"
|
||||||
@ -135,10 +136,10 @@ func (s *state4) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// NOTE: this can be optimized significantly.
|
// NOTE: this can be optimized significantly.
|
||||||
// 1. If the sector is non-faulty, it will either expire on-time (can be
|
// 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
|
// learned from the sector info), or in the next quantized expiration
|
||||||
// epoch (i.e., the first element in the partition's expiration queue.
|
// 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
|
// 2. If it's faulty, it will expire early within the first 14 entries
|
||||||
// of the expiration queue.
|
// of the expiration queue.
|
||||||
|
|
||||||
stopErr := errors.New("stop")
|
stopErr := errors.New("stop")
|
||||||
@ -209,7 +210,7 @@ func (s *state4) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state4) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
func (s *state4) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
||||||
precommitted, err := adt4.AsMap(s.store, s.State.PreCommittedSectors, builtin4.DefaultHamtBitwidth)
|
precommitted, err := adt4.AsMap(s.store, s.State.PreCommittedSectors, builtin4.DefaultHamtBitwidth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -288,7 +289,7 @@ func (s *state4) UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unallocatedRuns, err := rle.Subtract(
|
unallocatedRuns, err := rle.Subtract(
|
||||||
&rle.RunSliceIterator{Runs: []rle.Run{{Val: true, Len: abi.MaxSectorNumber}}},
|
&rle.RunSliceIterator{Runs: []rle.Run{ {Val: true, Len: abi.MaxSectorNumber} }},
|
||||||
allocatedRuns,
|
allocatedRuns,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -439,40 +440,40 @@ func (s *state4) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreC
|
|||||||
|
|
||||||
func (s *state4) EraseAllUnproven() error {
|
func (s *state4) EraseAllUnproven() error {
|
||||||
|
|
||||||
dls, err := s.State.LoadDeadlines(s.store)
|
dls, err := s.State.LoadDeadlines(s.store)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = dls.ForEach(s.store, func(dindx uint64, dl *miner4.Deadline) error {
|
|
||||||
ps, err := dl.PartitionsArray(s.store)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var part miner4.Partition
|
err = dls.ForEach(s.store, func(dindx uint64, dl *miner4.Deadline) error {
|
||||||
err = ps.ForEach(&part, func(pindx int64) error {
|
ps, err := dl.PartitionsArray(s.store)
|
||||||
_ = part.ActivateUnproven()
|
if err != nil {
|
||||||
err = ps.Set(uint64(pindx), &part)
|
return err
|
||||||
return nil
|
}
|
||||||
|
|
||||||
|
var part miner4.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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
dl.Partitions, err = ps.Root()
|
return s.State.SaveDeadlines(s.store, dls)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return dls.UpdateDeadline(s.store, dindx, dl)
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return s.State.SaveDeadlines(s.store, dls)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,6 +550,7 @@ func fromV4SectorOnChainInfo(v4 miner4.SectorOnChainInfo) SectorOnChainInfo {
|
|||||||
InitialPledge: v4.InitialPledge,
|
InitialPledge: v4.InitialPledge,
|
||||||
ExpectedDayReward: v4.ExpectedDayReward,
|
ExpectedDayReward: v4.ExpectedDayReward,
|
||||||
ExpectedStoragePledge: v4.ExpectedStoragePledge,
|
ExpectedStoragePledge: v4.ExpectedStoragePledge,
|
||||||
|
|
||||||
}
|
}
|
||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
|
|
||||||
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
||||||
|
|
||||||
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
|
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
|
||||||
@ -135,10 +136,10 @@ func (s *state5) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// NOTE: this can be optimized significantly.
|
// NOTE: this can be optimized significantly.
|
||||||
// 1. If the sector is non-faulty, it will either expire on-time (can be
|
// 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
|
// learned from the sector info), or in the next quantized expiration
|
||||||
// epoch (i.e., the first element in the partition's expiration queue.
|
// 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
|
// 2. If it's faulty, it will expire early within the first 14 entries
|
||||||
// of the expiration queue.
|
// of the expiration queue.
|
||||||
|
|
||||||
stopErr := errors.New("stop")
|
stopErr := errors.New("stop")
|
||||||
@ -209,7 +210,7 @@ func (s *state5) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state5) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
func (s *state5) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
||||||
precommitted, err := adt5.AsMap(s.store, s.State.PreCommittedSectors, builtin5.DefaultHamtBitwidth)
|
precommitted, err := adt5.AsMap(s.store, s.State.PreCommittedSectors, builtin5.DefaultHamtBitwidth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -288,7 +289,7 @@ func (s *state5) UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unallocatedRuns, err := rle.Subtract(
|
unallocatedRuns, err := rle.Subtract(
|
||||||
&rle.RunSliceIterator{Runs: []rle.Run{{Val: true, Len: abi.MaxSectorNumber}}},
|
&rle.RunSliceIterator{Runs: []rle.Run{ {Val: true, Len: abi.MaxSectorNumber} }},
|
||||||
allocatedRuns,
|
allocatedRuns,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -439,40 +440,40 @@ func (s *state5) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreC
|
|||||||
|
|
||||||
func (s *state5) EraseAllUnproven() error {
|
func (s *state5) EraseAllUnproven() error {
|
||||||
|
|
||||||
dls, err := s.State.LoadDeadlines(s.store)
|
dls, err := s.State.LoadDeadlines(s.store)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = dls.ForEach(s.store, func(dindx uint64, dl *miner5.Deadline) error {
|
|
||||||
ps, err := dl.PartitionsArray(s.store)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var part miner5.Partition
|
err = dls.ForEach(s.store, func(dindx uint64, dl *miner5.Deadline) error {
|
||||||
err = ps.ForEach(&part, func(pindx int64) error {
|
ps, err := dl.PartitionsArray(s.store)
|
||||||
_ = part.ActivateUnproven()
|
if err != nil {
|
||||||
err = ps.Set(uint64(pindx), &part)
|
return err
|
||||||
return nil
|
}
|
||||||
|
|
||||||
|
var part miner5.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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
dl.Partitions, err = ps.Root()
|
return s.State.SaveDeadlines(s.store, dls)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return dls.UpdateDeadline(s.store, dindx, dl)
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return s.State.SaveDeadlines(s.store, dls)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,6 +550,7 @@ func fromV5SectorOnChainInfo(v5 miner5.SectorOnChainInfo) SectorOnChainInfo {
|
|||||||
InitialPledge: v5.InitialPledge,
|
InitialPledge: v5.InitialPledge,
|
||||||
ExpectedDayReward: v5.ExpectedDayReward,
|
ExpectedDayReward: v5.ExpectedDayReward,
|
||||||
ExpectedStoragePledge: v5.ExpectedStoragePledge,
|
ExpectedStoragePledge: v5.ExpectedStoragePledge,
|
||||||
|
|
||||||
}
|
}
|
||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
|
|
||||||
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
||||||
|
|
||||||
miner6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/miner"
|
miner6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/miner"
|
||||||
@ -135,10 +136,10 @@ func (s *state6) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// NOTE: this can be optimized significantly.
|
// NOTE: this can be optimized significantly.
|
||||||
// 1. If the sector is non-faulty, it will either expire on-time (can be
|
// 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
|
// learned from the sector info), or in the next quantized expiration
|
||||||
// epoch (i.e., the first element in the partition's expiration queue.
|
// epoch (i.e., the first element in the partition's expiration queue.
|
||||||
// 2. If it's faulty, it will expire early within the first 42 entries
|
// 2. If it's faulty, it will expire early within the first 42 entries
|
||||||
// of the expiration queue.
|
// of the expiration queue.
|
||||||
|
|
||||||
stopErr := errors.New("stop")
|
stopErr := errors.New("stop")
|
||||||
@ -209,7 +210,7 @@ func (s *state6) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state6) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
func (s *state6) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
||||||
precommitted, err := adt6.AsMap(s.store, s.State.PreCommittedSectors, builtin6.DefaultHamtBitwidth)
|
precommitted, err := adt6.AsMap(s.store, s.State.PreCommittedSectors, builtin6.DefaultHamtBitwidth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -288,7 +289,7 @@ func (s *state6) UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unallocatedRuns, err := rle.Subtract(
|
unallocatedRuns, err := rle.Subtract(
|
||||||
&rle.RunSliceIterator{Runs: []rle.Run{{Val: true, Len: abi.MaxSectorNumber}}},
|
&rle.RunSliceIterator{Runs: []rle.Run{ {Val: true, Len: abi.MaxSectorNumber} }},
|
||||||
allocatedRuns,
|
allocatedRuns,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -439,40 +440,40 @@ func (s *state6) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreC
|
|||||||
|
|
||||||
func (s *state6) EraseAllUnproven() error {
|
func (s *state6) EraseAllUnproven() error {
|
||||||
|
|
||||||
dls, err := s.State.LoadDeadlines(s.store)
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var part miner6.Partition
|
err = dls.ForEach(s.store, func(dindx uint64, dl *miner6.Deadline) error {
|
||||||
err = ps.ForEach(&part, func(pindx int64) error {
|
ps, err := dl.PartitionsArray(s.store)
|
||||||
_ = part.ActivateUnproven()
|
if err != nil {
|
||||||
err = ps.Set(uint64(pindx), &part)
|
return err
|
||||||
return nil
|
}
|
||||||
|
|
||||||
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
dl.Partitions, err = ps.Root()
|
return s.State.SaveDeadlines(s.store, dls)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return dls.UpdateDeadline(s.store, dindx, dl)
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return s.State.SaveDeadlines(s.store, dls)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,6 +550,7 @@ func fromV6SectorOnChainInfo(v6 miner6.SectorOnChainInfo) SectorOnChainInfo {
|
|||||||
InitialPledge: v6.InitialPledge,
|
InitialPledge: v6.InitialPledge,
|
||||||
ExpectedDayReward: v6.ExpectedDayReward,
|
ExpectedDayReward: v6.ExpectedDayReward,
|
||||||
ExpectedStoragePledge: v6.ExpectedStoragePledge,
|
ExpectedStoragePledge: v6.ExpectedStoragePledge,
|
||||||
|
|
||||||
}
|
}
|
||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
|
|
||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
|
||||||
miner7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/miner"
|
miner7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/miner"
|
||||||
@ -135,9 +136,9 @@ func (s *state7) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// NOTE: this can be optimized significantly.
|
// NOTE: this can be optimized significantly.
|
||||||
// 1. If the sector is non-faulty, it will expire on-time (can be
|
// 1. If the sector is non-faulty, it will expire on-time (can be
|
||||||
// learned from the sector info).
|
// learned from the sector info).
|
||||||
// 2. If it's faulty, it will expire early within the first 42 entries
|
// 2. If it's faulty, it will expire early within the first 42 entries
|
||||||
// of the expiration queue.
|
// of the expiration queue.
|
||||||
|
|
||||||
stopErr := errors.New("stop")
|
stopErr := errors.New("stop")
|
||||||
@ -208,7 +209,7 @@ func (s *state7) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state7) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
func (s *state7) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
||||||
precommitted, err := adt7.AsMap(s.store, s.State.PreCommittedSectors, builtin7.DefaultHamtBitwidth)
|
precommitted, err := adt7.AsMap(s.store, s.State.PreCommittedSectors, builtin7.DefaultHamtBitwidth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -287,7 +288,7 @@ func (s *state7) UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unallocatedRuns, err := rle.Subtract(
|
unallocatedRuns, err := rle.Subtract(
|
||||||
&rle.RunSliceIterator{Runs: []rle.Run{{Val: true, Len: abi.MaxSectorNumber}}},
|
&rle.RunSliceIterator{Runs: []rle.Run{ {Val: true, Len: abi.MaxSectorNumber} }},
|
||||||
allocatedRuns,
|
allocatedRuns,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -438,40 +439,40 @@ func (s *state7) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreC
|
|||||||
|
|
||||||
func (s *state7) EraseAllUnproven() error {
|
func (s *state7) EraseAllUnproven() error {
|
||||||
|
|
||||||
dls, err := s.State.LoadDeadlines(s.store)
|
dls, err := s.State.LoadDeadlines(s.store)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = dls.ForEach(s.store, func(dindx uint64, dl *miner7.Deadline) error {
|
|
||||||
ps, err := dl.PartitionsArray(s.store)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var part miner7.Partition
|
err = dls.ForEach(s.store, func(dindx uint64, dl *miner7.Deadline) error {
|
||||||
err = ps.ForEach(&part, func(pindx int64) error {
|
ps, err := dl.PartitionsArray(s.store)
|
||||||
_ = part.ActivateUnproven()
|
if err != nil {
|
||||||
err = ps.Set(uint64(pindx), &part)
|
return err
|
||||||
return nil
|
}
|
||||||
|
|
||||||
|
var part miner7.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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
dl.Partitions, err = ps.Root()
|
return s.State.SaveDeadlines(s.store, dls)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return dls.UpdateDeadline(s.store, dindx, dl)
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return s.State.SaveDeadlines(s.store, dls)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,6 +551,7 @@ func fromV7SectorOnChainInfo(v7 miner7.SectorOnChainInfo) SectorOnChainInfo {
|
|||||||
ExpectedStoragePledge: v7.ExpectedStoragePledge,
|
ExpectedStoragePledge: v7.ExpectedStoragePledge,
|
||||||
|
|
||||||
SectorKeyCID: v7.SectorKeyCID,
|
SectorKeyCID: v7.SectorKeyCID,
|
||||||
|
|
||||||
}
|
}
|
||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
||||||
|
|
||||||
miner8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/miner"
|
miner8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/miner"
|
||||||
@ -135,9 +136,9 @@ func (s *state8) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// NOTE: this can be optimized significantly.
|
// NOTE: this can be optimized significantly.
|
||||||
// 1. If the sector is non-faulty, it will expire on-time (can be
|
// 1. If the sector is non-faulty, it will expire on-time (can be
|
||||||
// learned from the sector info).
|
// learned from the sector info).
|
||||||
// 2. If it's faulty, it will expire early within the first 42 entries
|
// 2. If it's faulty, it will expire early within the first 42 entries
|
||||||
// of the expiration queue.
|
// of the expiration queue.
|
||||||
|
|
||||||
stopErr := errors.New("stop")
|
stopErr := errors.New("stop")
|
||||||
@ -208,7 +209,7 @@ func (s *state8) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state8) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
func (s *state8) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
||||||
precommitted, err := adt8.AsMap(s.store, s.State.PreCommittedSectors, builtin8.DefaultHamtBitwidth)
|
precommitted, err := adt8.AsMap(s.store, s.State.PreCommittedSectors, builtin8.DefaultHamtBitwidth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -287,7 +288,7 @@ func (s *state8) UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unallocatedRuns, err := rle.Subtract(
|
unallocatedRuns, err := rle.Subtract(
|
||||||
&rle.RunSliceIterator{Runs: []rle.Run{{Val: true, Len: abi.MaxSectorNumber}}},
|
&rle.RunSliceIterator{Runs: []rle.Run{ {Val: true, Len: abi.MaxSectorNumber} }},
|
||||||
allocatedRuns,
|
allocatedRuns,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -438,40 +439,40 @@ func (s *state8) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreC
|
|||||||
|
|
||||||
func (s *state8) EraseAllUnproven() error {
|
func (s *state8) EraseAllUnproven() error {
|
||||||
|
|
||||||
dls, err := s.State.LoadDeadlines(s.store)
|
dls, err := s.State.LoadDeadlines(s.store)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = dls.ForEach(s.store, func(dindx uint64, dl *miner8.Deadline) error {
|
|
||||||
ps, err := dl.PartitionsArray(s.store)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var part miner8.Partition
|
err = dls.ForEach(s.store, func(dindx uint64, dl *miner8.Deadline) error {
|
||||||
err = ps.ForEach(&part, func(pindx int64) error {
|
ps, err := dl.PartitionsArray(s.store)
|
||||||
_ = part.ActivateUnproven()
|
if err != nil {
|
||||||
err = ps.Set(uint64(pindx), &part)
|
return err
|
||||||
return nil
|
}
|
||||||
|
|
||||||
|
var part miner8.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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
dl.Partitions, err = ps.Root()
|
return s.State.SaveDeadlines(s.store, dls)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return dls.UpdateDeadline(s.store, dindx, dl)
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return s.State.SaveDeadlines(s.store, dls)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,6 +551,7 @@ func fromV8SectorOnChainInfo(v8 miner8.SectorOnChainInfo) SectorOnChainInfo {
|
|||||||
ExpectedStoragePledge: v8.ExpectedStoragePledge,
|
ExpectedStoragePledge: v8.ExpectedStoragePledge,
|
||||||
|
|
||||||
SectorKeyCID: v8.SectorKeyCID,
|
SectorKeyCID: v8.SectorKeyCID,
|
||||||
|
|
||||||
}
|
}
|
||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,8 @@ func (m message0) Create(
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func (m message0) Propose(msig, to address.Address, amt abi.TokenAmount,
|
func (m message0) Propose(msig, to address.Address, amt abi.TokenAmount,
|
||||||
method abi.MethodNum, params []byte) (*types.Message, error) {
|
method abi.MethodNum, params []byte) (*types.Message, error) {
|
||||||
|
|
||||||
@ -140,3 +142,4 @@ func (m message0) Cancel(msig address.Address, txID uint64, hashData *ProposalHa
|
|||||||
Params: enc,
|
Params: enc,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,3 +69,5 @@ func (m message2) Create(
|
|||||||
Value: initialAmount,
|
Value: initialAmount,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,3 +69,5 @@ func (m message3) Create(
|
|||||||
Value: initialAmount,
|
Value: initialAmount,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,3 +69,5 @@ func (m message4) Create(
|
|||||||
Value: initialAmount,
|
Value: initialAmount,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,3 +69,5 @@ func (m message5) Create(
|
|||||||
Value: initialAmount,
|
Value: initialAmount,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,3 +69,5 @@ func (m message6) Create(
|
|||||||
Value: initialAmount,
|
Value: initialAmount,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,3 +69,5 @@ func (m message7) Create(
|
|||||||
Value: initialAmount,
|
Value: initialAmount,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,3 +69,5 @@ func (m message8) Create(
|
|||||||
Value: initialAmount,
|
Value: initialAmount,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ import (
|
|||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
||||||
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
@ -43,36 +44,120 @@ func init() {
|
|||||||
return load0(store, root)
|
return load0(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version0, "multisig"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load0(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin2.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin2.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load2(store, root)
|
return load2(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version2, "multisig"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load2(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin3.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin3.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load3(store, root)
|
return load3(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version3, "multisig"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load3(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin4.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin4.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load4(store, root)
|
return load4(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version4, "multisig"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load4(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin5.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin5.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load5(store, root)
|
return load5(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version5, "multisig"); ok {
|
||||||
|
builtin.RegisterActorState(c, 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) {
|
builtin.RegisterActorState(builtin6.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load6(store, root)
|
return load6(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version6, "multisig"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load6(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin7.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin7.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load7(store, root)
|
return load7(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version7, "multisig"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load7(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin8.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin8.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load8(store, root)
|
return load8(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version8, "multisig"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load8(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
|
if name != "multisig" {
|
||||||
|
return nil, xerrors.Errorf("actor code is not multisig: %s", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version0:
|
||||||
|
return load0(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version2:
|
||||||
|
return load2(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version3:
|
||||||
|
return load3(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version4:
|
||||||
|
return load4(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version5:
|
||||||
|
return load5(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version6:
|
||||||
|
return load6(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
return load7(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version8:
|
||||||
|
return load8(store, act.Head)
|
||||||
|
|
||||||
|
default:
|
||||||
|
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch act.Code {
|
switch act.Code {
|
||||||
|
|
||||||
case builtin0.MultisigActorCodeID:
|
case builtin0.MultisigActorCodeID:
|
||||||
@ -130,11 +215,15 @@ func MakeState(store adt.Store, av actors.Version, signers []address.Address, th
|
|||||||
case actors.Version8:
|
case actors.Version8:
|
||||||
return make8(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
|
return make8(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, "multisig"); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
|
|
||||||
case actors.Version0:
|
case actors.Version0:
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
|
|
||||||
msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
|
msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -37,12 +38,12 @@ func make0(store adt.Store, signers []address.Address, threshold uint64, startEp
|
|||||||
out.State.UnlockDuration = unlockDuration
|
out.State.UnlockDuration = unlockDuration
|
||||||
out.State.InitialBalance = initialBalance
|
out.State.InitialBalance = initialBalance
|
||||||
|
|
||||||
em, err := adt0.MakeEmptyMap(store).Root()
|
em, err := adt0.MakeEmptyMap(store).Root()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State.PendingTxns = em
|
out.State.PendingTxns = em
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
|
|
||||||
msig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig"
|
msig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -37,12 +38,12 @@ func make2(store adt.Store, signers []address.Address, threshold uint64, startEp
|
|||||||
out.State.UnlockDuration = unlockDuration
|
out.State.UnlockDuration = unlockDuration
|
||||||
out.State.InitialBalance = initialBalance
|
out.State.InitialBalance = initialBalance
|
||||||
|
|
||||||
em, err := adt2.MakeEmptyMap(store).Root()
|
em, err := adt2.MakeEmptyMap(store).Root()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State.PendingTxns = em
|
out.State.PendingTxns = em
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
|
|
||||||
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
||||||
|
|
||||||
msig3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/multisig"
|
msig3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/multisig"
|
||||||
@ -39,12 +40,12 @@ func make3(store adt.Store, signers []address.Address, threshold uint64, startEp
|
|||||||
out.State.UnlockDuration = unlockDuration
|
out.State.UnlockDuration = unlockDuration
|
||||||
out.State.InitialBalance = initialBalance
|
out.State.InitialBalance = initialBalance
|
||||||
|
|
||||||
em, err := adt3.StoreEmptyMap(store, builtin3.DefaultHamtBitwidth)
|
em, err := adt3.StoreEmptyMap(store, builtin3.DefaultHamtBitwidth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State.PendingTxns = em
|
out.State.PendingTxns = em
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
|
|
||||||
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
||||||
|
|
||||||
msig4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/multisig"
|
msig4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/multisig"
|
||||||
@ -39,12 +40,12 @@ func make4(store adt.Store, signers []address.Address, threshold uint64, startEp
|
|||||||
out.State.UnlockDuration = unlockDuration
|
out.State.UnlockDuration = unlockDuration
|
||||||
out.State.InitialBalance = initialBalance
|
out.State.InitialBalance = initialBalance
|
||||||
|
|
||||||
em, err := adt4.StoreEmptyMap(store, builtin4.DefaultHamtBitwidth)
|
em, err := adt4.StoreEmptyMap(store, builtin4.DefaultHamtBitwidth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State.PendingTxns = em
|
out.State.PendingTxns = em
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
|
|
||||||
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
||||||
|
|
||||||
msig5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/multisig"
|
msig5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/multisig"
|
||||||
@ -39,12 +40,12 @@ func make5(store adt.Store, signers []address.Address, threshold uint64, startEp
|
|||||||
out.State.UnlockDuration = unlockDuration
|
out.State.UnlockDuration = unlockDuration
|
||||||
out.State.InitialBalance = initialBalance
|
out.State.InitialBalance = initialBalance
|
||||||
|
|
||||||
em, err := adt5.StoreEmptyMap(store, builtin5.DefaultHamtBitwidth)
|
em, err := adt5.StoreEmptyMap(store, builtin5.DefaultHamtBitwidth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State.PendingTxns = em
|
out.State.PendingTxns = em
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
|
|
||||||
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
||||||
|
|
||||||
msig6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/multisig"
|
msig6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/multisig"
|
||||||
@ -39,12 +40,12 @@ func make6(store adt.Store, signers []address.Address, threshold uint64, startEp
|
|||||||
out.State.UnlockDuration = unlockDuration
|
out.State.UnlockDuration = unlockDuration
|
||||||
out.State.InitialBalance = initialBalance
|
out.State.InitialBalance = initialBalance
|
||||||
|
|
||||||
em, err := adt6.StoreEmptyMap(store, builtin6.DefaultHamtBitwidth)
|
em, err := adt6.StoreEmptyMap(store, builtin6.DefaultHamtBitwidth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State.PendingTxns = em
|
out.State.PendingTxns = em
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
|
|
||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
|
||||||
msig7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/multisig"
|
msig7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/multisig"
|
||||||
@ -39,12 +40,12 @@ func make7(store adt.Store, signers []address.Address, threshold uint64, startEp
|
|||||||
out.State.UnlockDuration = unlockDuration
|
out.State.UnlockDuration = unlockDuration
|
||||||
out.State.InitialBalance = initialBalance
|
out.State.InitialBalance = initialBalance
|
||||||
|
|
||||||
em, err := adt7.StoreEmptyMap(store, builtin7.DefaultHamtBitwidth)
|
em, err := adt7.StoreEmptyMap(store, builtin7.DefaultHamtBitwidth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State.PendingTxns = em
|
out.State.PendingTxns = em
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
||||||
|
|
||||||
msig8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/multisig"
|
msig8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/multisig"
|
||||||
@ -39,12 +40,12 @@ func make8(store adt.Store, signers []address.Address, threshold uint64, startEp
|
|||||||
out.State.UnlockDuration = unlockDuration
|
out.State.UnlockDuration = unlockDuration
|
||||||
out.State.InitialBalance = initialBalance
|
out.State.InitialBalance = initialBalance
|
||||||
|
|
||||||
em, err := adt8.StoreEmptyMap(store, builtin8.DefaultHamtBitwidth)
|
em, err := adt8.StoreEmptyMap(store, builtin8.DefaultHamtBitwidth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State.PendingTxns = em
|
out.State.PendingTxns = em
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ func (m message0) Create(to address.Address, initialAmount abi.TokenAmount) (*ty
|
|||||||
func (m message0) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
func (m message0) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
||||||
params, aerr := actors.SerializeParams(&paych0.UpdateChannelStateParams{
|
params, aerr := actors.SerializeParams(&paych0.UpdateChannelStateParams{
|
||||||
|
|
||||||
Sv: *sv,
|
Sv: *sv,
|
||||||
|
|
||||||
Secret: secret,
|
Secret: secret,
|
||||||
})
|
})
|
||||||
|
@ -40,7 +40,7 @@ func (m message2) Create(to address.Address, initialAmount abi.TokenAmount) (*ty
|
|||||||
func (m message2) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
func (m message2) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
||||||
params, aerr := actors.SerializeParams(&paych2.UpdateChannelStateParams{
|
params, aerr := actors.SerializeParams(&paych2.UpdateChannelStateParams{
|
||||||
|
|
||||||
Sv: *sv,
|
Sv: *sv,
|
||||||
|
|
||||||
Secret: secret,
|
Secret: secret,
|
||||||
})
|
})
|
||||||
|
@ -40,7 +40,7 @@ func (m message3) Create(to address.Address, initialAmount abi.TokenAmount) (*ty
|
|||||||
func (m message3) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
func (m message3) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
||||||
params, aerr := actors.SerializeParams(&paych3.UpdateChannelStateParams{
|
params, aerr := actors.SerializeParams(&paych3.UpdateChannelStateParams{
|
||||||
|
|
||||||
Sv: *sv,
|
Sv: *sv,
|
||||||
|
|
||||||
Secret: secret,
|
Secret: secret,
|
||||||
})
|
})
|
||||||
|
@ -40,7 +40,7 @@ func (m message4) Create(to address.Address, initialAmount abi.TokenAmount) (*ty
|
|||||||
func (m message4) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
func (m message4) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
||||||
params, aerr := actors.SerializeParams(&paych4.UpdateChannelStateParams{
|
params, aerr := actors.SerializeParams(&paych4.UpdateChannelStateParams{
|
||||||
|
|
||||||
Sv: *sv,
|
Sv: *sv,
|
||||||
|
|
||||||
Secret: secret,
|
Secret: secret,
|
||||||
})
|
})
|
||||||
|
@ -40,7 +40,7 @@ func (m message5) Create(to address.Address, initialAmount abi.TokenAmount) (*ty
|
|||||||
func (m message5) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
func (m message5) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
||||||
params, aerr := actors.SerializeParams(&paych5.UpdateChannelStateParams{
|
params, aerr := actors.SerializeParams(&paych5.UpdateChannelStateParams{
|
||||||
|
|
||||||
Sv: *sv,
|
Sv: *sv,
|
||||||
|
|
||||||
Secret: secret,
|
Secret: secret,
|
||||||
})
|
})
|
||||||
|
@ -40,7 +40,7 @@ func (m message6) Create(to address.Address, initialAmount abi.TokenAmount) (*ty
|
|||||||
func (m message6) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
func (m message6) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
||||||
params, aerr := actors.SerializeParams(&paych6.UpdateChannelStateParams{
|
params, aerr := actors.SerializeParams(&paych6.UpdateChannelStateParams{
|
||||||
|
|
||||||
Sv: *sv,
|
Sv: *sv,
|
||||||
|
|
||||||
Secret: secret,
|
Secret: secret,
|
||||||
})
|
})
|
||||||
|
@ -40,7 +40,7 @@ func (m message7) Create(to address.Address, initialAmount abi.TokenAmount) (*ty
|
|||||||
func (m message7) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
func (m message7) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
||||||
params, aerr := actors.SerializeParams(&paych7.UpdateChannelStateParams{
|
params, aerr := actors.SerializeParams(&paych7.UpdateChannelStateParams{
|
||||||
|
|
||||||
Sv: toV7SignedVoucher(*sv),
|
Sv: toV7SignedVoucher(*sv),
|
||||||
|
|
||||||
Secret: secret,
|
Secret: secret,
|
||||||
})
|
})
|
||||||
|
@ -40,7 +40,7 @@ func (m message8) Create(to address.Address, initialAmount abi.TokenAmount) (*ty
|
|||||||
func (m message8) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
func (m message8) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
||||||
params, aerr := actors.SerializeParams(&paych8.UpdateChannelStateParams{
|
params, aerr := actors.SerializeParams(&paych8.UpdateChannelStateParams{
|
||||||
|
|
||||||
Sv: toV8SignedVoucher(*sv),
|
Sv: toV8SignedVoucher(*sv),
|
||||||
|
|
||||||
Secret: secret,
|
Secret: secret,
|
||||||
})
|
})
|
||||||
|
@ -31,6 +31,7 @@ import (
|
|||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
||||||
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
@ -43,37 +44,121 @@ func init() {
|
|||||||
return load0(store, root)
|
return load0(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version0, "paymentchannel"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load0(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin2.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin2.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load2(store, root)
|
return load2(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version2, "paymentchannel"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load2(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin3.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin3.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load3(store, root)
|
return load3(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version3, "paymentchannel"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load3(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin4.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin4.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load4(store, root)
|
return load4(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version4, "paymentchannel"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load4(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin5.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin5.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load5(store, root)
|
return load5(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version5, "paymentchannel"); ok {
|
||||||
|
builtin.RegisterActorState(c, 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) {
|
builtin.RegisterActorState(builtin6.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load6(store, root)
|
return load6(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version6, "paymentchannel"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load6(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin7.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin7.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load7(store, root)
|
return load7(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version7, "paymentchannel"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load7(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin8.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin8.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load8(store, root)
|
return load8(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version8, "paymentchannel"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load8(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load returns an abstract copy of payment channel state, irregardless of actor version
|
// Load returns an abstract copy of payment channel state, irregardless of actor version
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
|
if name != "paymentchannel" {
|
||||||
|
return nil, xerrors.Errorf("actor code is not paymentchannel: %s", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version0:
|
||||||
|
return load0(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version2:
|
||||||
|
return load2(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version3:
|
||||||
|
return load3(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version4:
|
||||||
|
return load4(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version5:
|
||||||
|
return load5(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version6:
|
||||||
|
return load6(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
return load7(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version8:
|
||||||
|
return load8(store, act.Head)
|
||||||
|
|
||||||
|
default:
|
||||||
|
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch act.Code {
|
switch act.Code {
|
||||||
|
|
||||||
case builtin0.PaymentChannelActorCodeID:
|
case builtin0.PaymentChannelActorCodeID:
|
||||||
@ -131,11 +216,15 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
|
|||||||
case actors.Version8:
|
case actors.Version8:
|
||||||
return make8(store)
|
return make8(store)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, "paymentchannel"); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
|
|
||||||
case actors.Version0:
|
case actors.Version0:
|
||||||
|
@ -112,3 +112,4 @@ func (ls *laneState0) Redeemed() (big.Int, error) {
|
|||||||
func (ls *laneState0) Nonce() (uint64, error) {
|
func (ls *laneState0) Nonce() (uint64, error) {
|
||||||
return ls.LaneState.Nonce, nil
|
return ls.LaneState.Nonce, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,3 +112,4 @@ func (ls *laneState2) Redeemed() (big.Int, error) {
|
|||||||
func (ls *laneState2) Nonce() (uint64, error) {
|
func (ls *laneState2) Nonce() (uint64, error) {
|
||||||
return ls.LaneState.Nonce, nil
|
return ls.LaneState.Nonce, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,3 +112,4 @@ func (ls *laneState3) Redeemed() (big.Int, error) {
|
|||||||
func (ls *laneState3) Nonce() (uint64, error) {
|
func (ls *laneState3) Nonce() (uint64, error) {
|
||||||
return ls.LaneState.Nonce, nil
|
return ls.LaneState.Nonce, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,3 +112,4 @@ func (ls *laneState4) Redeemed() (big.Int, error) {
|
|||||||
func (ls *laneState4) Nonce() (uint64, error) {
|
func (ls *laneState4) Nonce() (uint64, error) {
|
||||||
return ls.LaneState.Nonce, nil
|
return ls.LaneState.Nonce, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,3 +112,4 @@ func (ls *laneState5) Redeemed() (big.Int, error) {
|
|||||||
func (ls *laneState5) Nonce() (uint64, error) {
|
func (ls *laneState5) Nonce() (uint64, error) {
|
||||||
return ls.LaneState.Nonce, nil
|
return ls.LaneState.Nonce, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,3 +112,4 @@ func (ls *laneState6) Redeemed() (big.Int, error) {
|
|||||||
func (ls *laneState6) Nonce() (uint64, error) {
|
func (ls *laneState6) Nonce() (uint64, error) {
|
||||||
return ls.LaneState.Nonce, nil
|
return ls.LaneState.Nonce, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,6 +113,7 @@ func (ls *laneState7) Nonce() (uint64, error) {
|
|||||||
return ls.LaneState.Nonce, nil
|
return ls.LaneState.Nonce, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func toV7SignedVoucher(sv SignedVoucher) paych7.SignedVoucher {
|
func toV7SignedVoucher(sv SignedVoucher) paych7.SignedVoucher {
|
||||||
return paych7.SignedVoucher{
|
return paych7.SignedVoucher{
|
||||||
ChannelAddr: sv.ChannelAddr,
|
ChannelAddr: sv.ChannelAddr,
|
||||||
|
@ -113,6 +113,7 @@ func (ls *laneState8) Nonce() (uint64, error) {
|
|||||||
return ls.LaneState.Nonce, nil
|
return ls.LaneState.Nonce, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func toV8SignedVoucher(sv SignedVoucher) paych8.SignedVoucher {
|
func toV8SignedVoucher(sv SignedVoucher) paych8.SignedVoucher {
|
||||||
return paych8.SignedVoucher{
|
return paych8.SignedVoucher{
|
||||||
ChannelAddr: sv.ChannelAddr,
|
ChannelAddr: sv.ChannelAddr,
|
||||||
|
@ -30,6 +30,7 @@ import (
|
|||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -38,33 +39,81 @@ func init() {
|
|||||||
return load0(store, root)
|
return load0(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version0, "storagepower"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load0(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin2.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin2.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load2(store, root)
|
return load2(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version2, "storagepower"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load2(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin3.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin3.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load3(store, root)
|
return load3(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version3, "storagepower"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load3(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin4.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin4.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load4(store, root)
|
return load4(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version4, "storagepower"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load4(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin5.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin5.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load5(store, root)
|
return load5(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version5, "storagepower"); ok {
|
||||||
|
builtin.RegisterActorState(c, 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) {
|
builtin.RegisterActorState(builtin6.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load6(store, root)
|
return load6(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version6, "storagepower"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load6(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin7.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin7.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load7(store, root)
|
return load7(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version7, "storagepower"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load7(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin8.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin8.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load8(store, root)
|
return load8(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version8, "storagepower"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load8(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -73,6 +122,42 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
|
if name != "storagepower" {
|
||||||
|
return nil, xerrors.Errorf("actor code is not storagepower: %s", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version0:
|
||||||
|
return load0(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version2:
|
||||||
|
return load2(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version3:
|
||||||
|
return load3(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version4:
|
||||||
|
return load4(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version5:
|
||||||
|
return load5(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version6:
|
||||||
|
return load6(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
return load7(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version8:
|
||||||
|
return load8(store, act.Head)
|
||||||
|
|
||||||
|
default:
|
||||||
|
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch act.Code {
|
switch act.Code {
|
||||||
|
|
||||||
case builtin0.StoragePowerActorCodeID:
|
case builtin0.StoragePowerActorCodeID:
|
||||||
@ -130,11 +215,15 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
|
|||||||
case actors.Version8:
|
case actors.Version8:
|
||||||
return make8(store)
|
return make8(store)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, "storagepower"); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
|
|
||||||
case actors.Version0:
|
case actors.Version0:
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
|
|
||||||
|
|
||||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||||
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||||
)
|
)
|
||||||
@ -29,17 +30,18 @@ func load0(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make0(store adt.Store) (State, error) {
|
func make0(store adt.Store) (State, error) {
|
||||||
out := state0{store: store}
|
out := state0{store: store}
|
||||||
|
|
||||||
em, err := adt0.MakeEmptyMap(store).Root()
|
em, err := adt0.MakeEmptyMap(store).Root()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
emm, err := adt0.MakeEmptyMultimap(store).Root()
|
emm, err := adt0.MakeEmptyMultimap(store).Root()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out.State = *power0.ConstructState(em, emm)
|
||||||
|
|
||||||
out.State = *power0.ConstructState(em, emm)
|
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
|
|
||||||
|
|
||||||
power2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/power"
|
power2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/power"
|
||||||
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
|
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
|
||||||
)
|
)
|
||||||
@ -29,17 +30,18 @@ func load2(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make2(store adt.Store) (State, error) {
|
func make2(store adt.Store) (State, error) {
|
||||||
out := state2{store: store}
|
out := state2{store: store}
|
||||||
|
|
||||||
em, err := adt2.MakeEmptyMap(store).Root()
|
em, err := adt2.MakeEmptyMap(store).Root()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
emm, err := adt2.MakeEmptyMultimap(store).Root()
|
emm, err := adt2.MakeEmptyMultimap(store).Root()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out.State = *power2.ConstructState(em, emm)
|
||||||
|
|
||||||
out.State = *power2.ConstructState(em, emm)
|
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
|
|
||||||
|
|
||||||
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
||||||
|
|
||||||
power3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/power"
|
power3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/power"
|
||||||
@ -31,12 +32,13 @@ func load3(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make3(store adt.Store) (State, error) {
|
func make3(store adt.Store) (State, error) {
|
||||||
out := state3{store: store}
|
out := state3{store: store}
|
||||||
|
|
||||||
s, err := power3.ConstructState(store)
|
s, err := power3.ConstructState(store)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out.State = *s
|
||||||
|
|
||||||
out.State = *s
|
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
|
|
||||||
|
|
||||||
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
||||||
|
|
||||||
power4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/power"
|
power4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/power"
|
||||||
@ -31,12 +32,13 @@ func load4(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make4(store adt.Store) (State, error) {
|
func make4(store adt.Store) (State, error) {
|
||||||
out := state4{store: store}
|
out := state4{store: store}
|
||||||
|
|
||||||
s, err := power4.ConstructState(store)
|
s, err := power4.ConstructState(store)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out.State = *s
|
||||||
|
|
||||||
out.State = *s
|
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
|
|
||||||
|
|
||||||
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
||||||
|
|
||||||
power5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/power"
|
power5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/power"
|
||||||
@ -31,12 +32,13 @@ func load5(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make5(store adt.Store) (State, error) {
|
func make5(store adt.Store) (State, error) {
|
||||||
out := state5{store: store}
|
out := state5{store: store}
|
||||||
|
|
||||||
s, err := power5.ConstructState(store)
|
s, err := power5.ConstructState(store)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out.State = *s
|
||||||
|
|
||||||
out.State = *s
|
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
|
|
||||||
|
|
||||||
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
||||||
|
|
||||||
power6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/power"
|
power6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/power"
|
||||||
@ -31,12 +32,13 @@ func load6(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make6(store adt.Store) (State, error) {
|
func make6(store adt.Store) (State, error) {
|
||||||
out := state6{store: store}
|
out := state6{store: store}
|
||||||
|
|
||||||
s, err := power6.ConstructState(store)
|
s, err := power6.ConstructState(store)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out.State = *s
|
||||||
|
|
||||||
out.State = *s
|
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
|
|
||||||
|
|
||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
|
||||||
power7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/power"
|
power7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/power"
|
||||||
@ -31,12 +32,13 @@ func load7(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make7(store adt.Store) (State, error) {
|
func make7(store adt.Store) (State, error) {
|
||||||
out := state7{store: store}
|
out := state7{store: store}
|
||||||
|
|
||||||
s, err := power7.ConstructState(store)
|
s, err := power7.ConstructState(store)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out.State = *s
|
||||||
|
|
||||||
out.State = *s
|
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
|
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
||||||
|
|
||||||
power8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/power"
|
power8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/power"
|
||||||
@ -31,12 +32,13 @@ func load8(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make8(store adt.Store) (State, error) {
|
func make8(store adt.Store) (State, error) {
|
||||||
out := state8{store: store}
|
out := state8{store: store}
|
||||||
|
|
||||||
s, err := power8.ConstructState(store)
|
s, err := power8.ConstructState(store)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out.State = *s
|
||||||
|
|
||||||
out.State = *s
|
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,9 @@ package reward
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
|
||||||
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
|
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
@ -25,6 +25,7 @@ import (
|
|||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
||||||
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
@ -36,33 +37,81 @@ func init() {
|
|||||||
return load0(store, root)
|
return load0(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version0, "reward"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load0(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin2.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin2.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load2(store, root)
|
return load2(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version2, "reward"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load2(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin3.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin3.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load3(store, root)
|
return load3(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version3, "reward"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load3(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin4.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin4.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load4(store, root)
|
return load4(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version4, "reward"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load4(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin5.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin5.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load5(store, root)
|
return load5(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version5, "reward"); ok {
|
||||||
|
builtin.RegisterActorState(c, 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) {
|
builtin.RegisterActorState(builtin6.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load6(store, root)
|
return load6(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version6, "reward"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load6(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin7.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin7.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load7(store, root)
|
return load7(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version7, "reward"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load7(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin8.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin8.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load8(store, root)
|
return load8(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version8, "reward"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load8(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -71,6 +120,42 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
|
if name != "reward" {
|
||||||
|
return nil, xerrors.Errorf("actor code is not reward: %s", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version0:
|
||||||
|
return load0(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version2:
|
||||||
|
return load2(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version3:
|
||||||
|
return load3(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version4:
|
||||||
|
return load4(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version5:
|
||||||
|
return load5(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version6:
|
||||||
|
return load6(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
return load7(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version8:
|
||||||
|
return load8(store, act.Head)
|
||||||
|
|
||||||
|
default:
|
||||||
|
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch act.Code {
|
switch act.Code {
|
||||||
|
|
||||||
case builtin0.RewardActorCodeID:
|
case builtin0.RewardActorCodeID:
|
||||||
@ -128,11 +213,15 @@ func MakeState(store adt.Store, av actors.Version, currRealizedPower abi.Storage
|
|||||||
case actors.Version8:
|
case actors.Version8:
|
||||||
return make8(store, currRealizedPower)
|
return make8(store, currRealizedPower)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, "reward"); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
|
|
||||||
case actors.Version0:
|
case actors.Version0:
|
||||||
|
@ -40,7 +40,7 @@ func (s *state2) ThisEpochReward() (abi.TokenAmount, error) {
|
|||||||
|
|
||||||
func (s *state2) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
|
func (s *state2) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
|
||||||
|
|
||||||
return builtin.FilterEstimate{
|
return builtin.FilterEstimate{
|
||||||
PositionEstimate: s.State.ThisEpochRewardSmoothed.PositionEstimate,
|
PositionEstimate: s.State.ThisEpochRewardSmoothed.PositionEstimate,
|
||||||
VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate,
|
VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate,
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -40,7 +40,7 @@ func (s *state3) ThisEpochReward() (abi.TokenAmount, error) {
|
|||||||
|
|
||||||
func (s *state3) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
|
func (s *state3) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
|
||||||
|
|
||||||
return builtin.FilterEstimate{
|
return builtin.FilterEstimate{
|
||||||
PositionEstimate: s.State.ThisEpochRewardSmoothed.PositionEstimate,
|
PositionEstimate: s.State.ThisEpochRewardSmoothed.PositionEstimate,
|
||||||
VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate,
|
VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate,
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -40,7 +40,7 @@ func (s *state4) ThisEpochReward() (abi.TokenAmount, error) {
|
|||||||
|
|
||||||
func (s *state4) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
|
func (s *state4) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
|
||||||
|
|
||||||
return builtin.FilterEstimate{
|
return builtin.FilterEstimate{
|
||||||
PositionEstimate: s.State.ThisEpochRewardSmoothed.PositionEstimate,
|
PositionEstimate: s.State.ThisEpochRewardSmoothed.PositionEstimate,
|
||||||
VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate,
|
VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate,
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -40,7 +40,7 @@ func (s *state5) ThisEpochReward() (abi.TokenAmount, error) {
|
|||||||
|
|
||||||
func (s *state5) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
|
func (s *state5) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
|
||||||
|
|
||||||
return builtin.FilterEstimate{
|
return builtin.FilterEstimate{
|
||||||
PositionEstimate: s.State.ThisEpochRewardSmoothed.PositionEstimate,
|
PositionEstimate: s.State.ThisEpochRewardSmoothed.PositionEstimate,
|
||||||
VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate,
|
VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate,
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -40,7 +40,7 @@ func (s *state6) ThisEpochReward() (abi.TokenAmount, error) {
|
|||||||
|
|
||||||
func (s *state6) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
|
func (s *state6) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
|
||||||
|
|
||||||
return builtin.FilterEstimate{
|
return builtin.FilterEstimate{
|
||||||
PositionEstimate: s.State.ThisEpochRewardSmoothed.PositionEstimate,
|
PositionEstimate: s.State.ThisEpochRewardSmoothed.PositionEstimate,
|
||||||
VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate,
|
VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate,
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -40,7 +40,7 @@ func (s *state7) ThisEpochReward() (abi.TokenAmount, error) {
|
|||||||
|
|
||||||
func (s *state7) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
|
func (s *state7) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
|
||||||
|
|
||||||
return builtin.FilterEstimate{
|
return builtin.FilterEstimate{
|
||||||
PositionEstimate: s.State.ThisEpochRewardSmoothed.PositionEstimate,
|
PositionEstimate: s.State.ThisEpochRewardSmoothed.PositionEstimate,
|
||||||
VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate,
|
VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate,
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -40,7 +40,7 @@ func (s *state8) ThisEpochReward() (abi.TokenAmount, error) {
|
|||||||
|
|
||||||
func (s *state8) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
|
func (s *state8) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
|
||||||
|
|
||||||
return builtin.FilterEstimate{
|
return builtin.FilterEstimate{
|
||||||
PositionEstimate: s.State.ThisEpochRewardSmoothed.PositionEstimate,
|
PositionEstimate: s.State.ThisEpochRewardSmoothed.PositionEstimate,
|
||||||
VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate,
|
VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate,
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package system
|
package system
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
|
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
|
|
||||||
@ -21,6 +22,7 @@ import (
|
|||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -54,11 +56,15 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
|
|||||||
case actors.Version8:
|
case actors.Version8:
|
||||||
return make8(store)
|
return make8(store)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, "system"); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
|
|
||||||
case actors.Version0:
|
case actors.Version0:
|
||||||
|
@ -26,12 +26,12 @@ func load0(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make0(store adt.Store, rootKeyAddress address.Address) (State, error) {
|
func make0(store adt.Store, rootKeyAddress address.Address) (State, error) {
|
||||||
out := state0{store: store}
|
out := state0{store: store}
|
||||||
|
|
||||||
em, err := adt0.MakeEmptyMap(store).Root()
|
em, err := adt0.MakeEmptyMap(store).Root()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *verifreg0.ConstructState(em, rootKeyAddress)
|
out.State = *verifreg0.ConstructState(em, rootKeyAddress)
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ func (s *state0) verifiers() (adt.Map, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state0) removeDataCapProposalIDs() (adt.Map, error) {
|
func (s *state0) removeDataCapProposalIDs() (adt.Map, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,12 +26,12 @@ func load2(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make2(store adt.Store, rootKeyAddress address.Address) (State, error) {
|
func make2(store adt.Store, rootKeyAddress address.Address) (State, error) {
|
||||||
out := state2{store: store}
|
out := state2{store: store}
|
||||||
|
|
||||||
em, err := adt2.MakeEmptyMap(store).Root()
|
em, err := adt2.MakeEmptyMap(store).Root()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *verifreg2.ConstructState(em, rootKeyAddress)
|
out.State = *verifreg2.ConstructState(em, rootKeyAddress)
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ func (s *state2) verifiers() (adt.Map, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state2) removeDataCapProposalIDs() (adt.Map, error) {
|
func (s *state2) removeDataCapProposalIDs() (adt.Map, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,12 +27,12 @@ func load3(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make3(store adt.Store, rootKeyAddress address.Address) (State, error) {
|
func make3(store adt.Store, rootKeyAddress address.Address) (State, error) {
|
||||||
out := state3{store: store}
|
out := state3{store: store}
|
||||||
|
|
||||||
s, err := verifreg3.ConstructState(store, rootKeyAddress)
|
s, err := verifreg3.ConstructState(store, rootKeyAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *s
|
out.State = *s
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ func (s *state3) verifiers() (adt.Map, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state3) removeDataCapProposalIDs() (adt.Map, error) {
|
func (s *state3) removeDataCapProposalIDs() (adt.Map, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,12 +27,12 @@ func load4(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make4(store adt.Store, rootKeyAddress address.Address) (State, error) {
|
func make4(store adt.Store, rootKeyAddress address.Address) (State, error) {
|
||||||
out := state4{store: store}
|
out := state4{store: store}
|
||||||
|
|
||||||
s, err := verifreg4.ConstructState(store, rootKeyAddress)
|
s, err := verifreg4.ConstructState(store, rootKeyAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *s
|
out.State = *s
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ func (s *state4) verifiers() (adt.Map, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state4) removeDataCapProposalIDs() (adt.Map, error) {
|
func (s *state4) removeDataCapProposalIDs() (adt.Map, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,12 +27,12 @@ func load5(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make5(store adt.Store, rootKeyAddress address.Address) (State, error) {
|
func make5(store adt.Store, rootKeyAddress address.Address) (State, error) {
|
||||||
out := state5{store: store}
|
out := state5{store: store}
|
||||||
|
|
||||||
s, err := verifreg5.ConstructState(store, rootKeyAddress)
|
s, err := verifreg5.ConstructState(store, rootKeyAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *s
|
out.State = *s
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ func (s *state5) verifiers() (adt.Map, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state5) removeDataCapProposalIDs() (adt.Map, error) {
|
func (s *state5) removeDataCapProposalIDs() (adt.Map, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,12 +27,12 @@ func load6(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make6(store adt.Store, rootKeyAddress address.Address) (State, error) {
|
func make6(store adt.Store, rootKeyAddress address.Address) (State, error) {
|
||||||
out := state6{store: store}
|
out := state6{store: store}
|
||||||
|
|
||||||
s, err := verifreg6.ConstructState(store, rootKeyAddress)
|
s, err := verifreg6.ConstructState(store, rootKeyAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *s
|
out.State = *s
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ func (s *state6) verifiers() (adt.Map, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state6) removeDataCapProposalIDs() (adt.Map, error) {
|
func (s *state6) removeDataCapProposalIDs() (adt.Map, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,12 +27,12 @@ func load7(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make7(store adt.Store, rootKeyAddress address.Address) (State, error) {
|
func make7(store adt.Store, rootKeyAddress address.Address) (State, error) {
|
||||||
out := state7{store: store}
|
out := state7{store: store}
|
||||||
|
|
||||||
s, err := verifreg7.ConstructState(store, rootKeyAddress)
|
s, err := verifreg7.ConstructState(store, rootKeyAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *s
|
out.State = *s
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ func (s *state7) verifiers() (adt.Map, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state7) removeDataCapProposalIDs() (adt.Map, error) {
|
func (s *state7) removeDataCapProposalIDs() (adt.Map, error) {
|
||||||
return adt7.AsMap(s.store, s.RemoveDataCapProposalIDs, builtin7.DefaultHamtBitwidth)
|
return adt7.AsMap(s.store, s.RemoveDataCapProposalIDs, builtin7.DefaultHamtBitwidth)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state7) GetState() interface{} {
|
func (s *state7) GetState() interface{} {
|
||||||
|
@ -27,12 +27,12 @@ func load8(store adt.Store, root cid.Cid) (State, error) {
|
|||||||
func make8(store adt.Store, rootKeyAddress address.Address) (State, error) {
|
func make8(store adt.Store, rootKeyAddress address.Address) (State, error) {
|
||||||
out := state8{store: store}
|
out := state8{store: store}
|
||||||
|
|
||||||
s, err := verifreg8.ConstructState(store, rootKeyAddress)
|
s, err := verifreg8.ConstructState(store, rootKeyAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out.State = *s
|
out.State = *s
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ func (s *state8) verifiers() (adt.Map, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state8) removeDataCapProposalIDs() (adt.Map, error) {
|
func (s *state8) removeDataCapProposalIDs() (adt.Map, error) {
|
||||||
return adt8.AsMap(s.store, s.RemoveDataCapProposalIDs, builtin8.DefaultHamtBitwidth)
|
return adt8.AsMap(s.store, s.RemoveDataCapProposalIDs, builtin8.DefaultHamtBitwidth)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state8) GetState() interface{} {
|
func (s *state8) GetState() interface{} {
|
||||||
|
@ -25,9 +25,10 @@ import (
|
|||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
verifreg8 "github.com/filecoin-project/specs-actors/v7/actors/builtin/verifreg"
|
verifreg8 "github.com/filecoin-project/specs-actors/v7/actors/builtin/verifreg"
|
||||||
)
|
)
|
||||||
@ -38,34 +39,82 @@ func init() {
|
|||||||
return load0(store, root)
|
return load0(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version0, "verifiedregistry"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load0(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin2.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin2.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load2(store, root)
|
return load2(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version2, "verifiedregistry"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load2(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin3.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin3.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load3(store, root)
|
return load3(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version3, "verifiedregistry"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load3(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin4.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin4.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load4(store, root)
|
return load4(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version4, "verifiedregistry"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load4(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin5.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin5.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load5(store, root)
|
return load5(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version5, "verifiedregistry"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load5(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin6.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin6.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load6(store, root)
|
return load6(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version6, "verifiedregistry"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load6(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin7.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin7.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load7(store, root)
|
return load7(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version7, "verifiedregistry"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load7(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin8.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
builtin.RegisterActorState(builtin8.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
return load8(store, root)
|
return load8(store, root)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if c, ok := actors.GetActorCodeID(actors.Version8, "verifiedregistry"); ok {
|
||||||
|
builtin.RegisterActorState(c, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
||||||
|
return load8(store, root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -74,6 +123,42 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
|
if name != "verifiedregistry" {
|
||||||
|
return nil, xerrors.Errorf("actor code is not verifiedregistry: %s", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version0:
|
||||||
|
return load0(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version2:
|
||||||
|
return load2(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version3:
|
||||||
|
return load3(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version4:
|
||||||
|
return load4(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version5:
|
||||||
|
return load5(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version6:
|
||||||
|
return load6(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
return load7(store, act.Head)
|
||||||
|
|
||||||
|
case actors.Version8:
|
||||||
|
return load8(store, act.Head)
|
||||||
|
|
||||||
|
default:
|
||||||
|
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch act.Code {
|
switch act.Code {
|
||||||
|
|
||||||
case builtin0.VerifiedRegistryActorCodeID:
|
case builtin0.VerifiedRegistryActorCodeID:
|
||||||
@ -131,11 +216,15 @@ func MakeState(store adt.Store, av actors.Version, rootKeyAddress address.Addres
|
|||||||
case actors.Version8:
|
case actors.Version8:
|
||||||
return make8(store, rootKeyAddress)
|
return make8(store, rootKeyAddress)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, "verifiedregistry"); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
|
|
||||||
case actors.Version0:
|
case actors.Version0:
|
||||||
@ -171,7 +260,6 @@ type RemoveDataCapProposal = verifreg8.RemoveDataCapProposal
|
|||||||
type RemoveDataCapRequest = verifreg8.RemoveDataCapRequest
|
type RemoveDataCapRequest = verifreg8.RemoveDataCapRequest
|
||||||
type RemoveDataCapParams = verifreg8.RemoveDataCapParams
|
type RemoveDataCapParams = verifreg8.RemoveDataCapParams
|
||||||
type RmDcProposalID = verifreg8.RmDcProposalID
|
type RmDcProposalID = verifreg8.RmDcProposalID
|
||||||
|
|
||||||
const SignatureDomainSeparation_RemoveDataCap = verifreg8.SignatureDomainSeparation_RemoveDataCap
|
const SignatureDomainSeparation_RemoveDataCap = verifreg8.SignatureDomainSeparation_RemoveDataCap
|
||||||
|
|
||||||
type State interface {
|
type State interface {
|
||||||
|
@ -10,46 +10,56 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/network"
|
"github.com/filecoin-project/go-state-types/network"
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
|
||||||
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||||
|
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||||
|
|
||||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||||
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
|
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
|
||||||
verifreg2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/verifreg"
|
verifreg2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/verifreg"
|
||||||
|
|
||||||
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
|
||||||
|
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
||||||
market3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/market"
|
market3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/market"
|
||||||
miner3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/miner"
|
miner3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/miner"
|
||||||
verifreg3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/verifreg"
|
verifreg3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/verifreg"
|
||||||
|
|
||||||
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
|
||||||
|
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
||||||
market4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/market"
|
market4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/market"
|
||||||
miner4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/miner"
|
miner4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/miner"
|
||||||
verifreg4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/verifreg"
|
verifreg4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/verifreg"
|
||||||
|
|
||||||
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
|
||||||
|
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
||||||
market5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/market"
|
market5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/market"
|
||||||
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
|
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
|
||||||
verifreg5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/verifreg"
|
verifreg5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/verifreg"
|
||||||
|
|
||||||
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
|
||||||
|
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
||||||
market6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/market"
|
market6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/market"
|
||||||
miner6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/miner"
|
miner6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/miner"
|
||||||
verifreg6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/verifreg"
|
verifreg6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/verifreg"
|
||||||
|
|
||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
|
||||||
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market"
|
market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market"
|
||||||
miner7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/miner"
|
miner7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/miner"
|
||||||
verifreg7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/verifreg"
|
verifreg7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/verifreg"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
|
||||||
|
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
||||||
market8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/market"
|
market8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/market"
|
||||||
miner8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/miner"
|
miner8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/miner"
|
||||||
verifreg8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/verifreg"
|
verifreg8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/verifreg"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
paych8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/paych"
|
paych8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/paych"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -64,27 +74,44 @@ const (
|
|||||||
// This should only be used for testing.
|
// This should only be used for testing.
|
||||||
func SetSupportedProofTypes(types ...abi.RegisteredSealProof) {
|
func SetSupportedProofTypes(types ...abi.RegisteredSealProof) {
|
||||||
|
|
||||||
miner0.SupportedProofTypes = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
|
||||||
|
|
||||||
miner2.PreCommitSealProofTypesV0 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
miner0.SupportedProofTypes = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
||||||
miner2.PreCommitSealProofTypesV7 = make(map[abi.RegisteredSealProof]struct{}, len(types)*2)
|
|
||||||
miner2.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
|
||||||
|
|
||||||
miner3.PreCommitSealProofTypesV0 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
|
||||||
miner3.PreCommitSealProofTypesV7 = make(map[abi.RegisteredSealProof]struct{}, len(types)*2)
|
|
||||||
miner3.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
|
||||||
|
|
||||||
miner4.PreCommitSealProofTypesV0 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
|
||||||
miner4.PreCommitSealProofTypesV7 = make(map[abi.RegisteredSealProof]struct{}, len(types)*2)
|
|
||||||
miner4.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
|
||||||
|
|
||||||
miner5.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
miner2.PreCommitSealProofTypesV0 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
||||||
|
miner2.PreCommitSealProofTypesV7 = make(map[abi.RegisteredSealProof]struct{}, len(types)*2)
|
||||||
|
miner2.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
||||||
|
|
||||||
miner6.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
|
||||||
|
|
||||||
miner7.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
|
||||||
|
|
||||||
miner8.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
miner3.PreCommitSealProofTypesV0 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
||||||
|
miner3.PreCommitSealProofTypesV7 = make(map[abi.RegisteredSealProof]struct{}, len(types)*2)
|
||||||
|
miner3.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
miner4.PreCommitSealProofTypesV0 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
||||||
|
miner4.PreCommitSealProofTypesV7 = make(map[abi.RegisteredSealProof]struct{}, len(types)*2)
|
||||||
|
miner4.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
miner5.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
miner6.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
miner7.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
miner8.PreCommitSealProofTypesV8 = make(map[abi.RegisteredSealProof]struct{}, len(types))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AddSupportedProofTypes(types...)
|
AddSupportedProofTypes(types...)
|
||||||
}
|
}
|
||||||
@ -98,58 +125,75 @@ func AddSupportedProofTypes(types ...abi.RegisteredSealProof) {
|
|||||||
}
|
}
|
||||||
// Set for all miner versions.
|
// Set for all miner versions.
|
||||||
|
|
||||||
miner0.SupportedProofTypes[t] = struct{}{}
|
|
||||||
|
|
||||||
miner2.PreCommitSealProofTypesV0[t] = struct{}{}
|
|
||||||
miner2.PreCommitSealProofTypesV7[t] = struct{}{}
|
|
||||||
miner2.PreCommitSealProofTypesV7[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
|
|
||||||
miner2.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
|
|
||||||
|
|
||||||
miner3.PreCommitSealProofTypesV0[t] = struct{}{}
|
miner0.SupportedProofTypes[t] = struct{}{}
|
||||||
miner3.PreCommitSealProofTypesV7[t] = struct{}{}
|
|
||||||
miner3.PreCommitSealProofTypesV7[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
|
|
||||||
miner3.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
|
|
||||||
|
|
||||||
miner4.PreCommitSealProofTypesV0[t] = struct{}{}
|
|
||||||
miner4.PreCommitSealProofTypesV7[t] = struct{}{}
|
|
||||||
miner4.PreCommitSealProofTypesV7[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
|
|
||||||
miner4.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
|
|
||||||
|
|
||||||
miner5.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)
|
|
||||||
}
|
|
||||||
|
|
||||||
miner5.WindowPoStProofTypes[wpp] = struct{}{}
|
miner2.PreCommitSealProofTypesV0[t] = struct{}{}
|
||||||
|
miner2.PreCommitSealProofTypesV7[t] = struct{}{}
|
||||||
|
miner2.PreCommitSealProofTypesV7[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
|
||||||
|
miner2.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = 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{}{}
|
|
||||||
|
|
||||||
miner7.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
|
miner3.PreCommitSealProofTypesV0[t] = struct{}{}
|
||||||
wpp, err = t.RegisteredWindowPoStProof()
|
miner3.PreCommitSealProofTypesV7[t] = struct{}{}
|
||||||
if err != nil {
|
miner3.PreCommitSealProofTypesV7[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
|
||||||
// Fine to panic, this is a test-only method
|
miner3.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
miner7.WindowPoStProofTypes[wpp] = struct{}{}
|
|
||||||
|
|
||||||
miner8.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)
|
|
||||||
}
|
|
||||||
|
|
||||||
miner8.WindowPoStProofTypes[wpp] = struct{}{}
|
miner4.PreCommitSealProofTypesV0[t] = struct{}{}
|
||||||
|
miner4.PreCommitSealProofTypesV7[t] = struct{}{}
|
||||||
|
miner4.PreCommitSealProofTypesV7[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
|
||||||
|
miner4.PreCommitSealProofTypesV8[t+abi.RegisteredSealProof_StackedDrg2KiBV1_1] = struct{}{}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
miner5.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)
|
||||||
|
}
|
||||||
|
|
||||||
|
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{}{}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
miner7.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)
|
||||||
|
}
|
||||||
|
|
||||||
|
miner7.WindowPoStProofTypes[wpp] = struct{}{}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
miner8.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)
|
||||||
|
}
|
||||||
|
|
||||||
|
miner8.WindowPoStProofTypes[wpp] = struct{}{}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -159,21 +203,21 @@ func AddSupportedProofTypes(types ...abi.RegisteredSealProof) {
|
|||||||
func SetPreCommitChallengeDelay(delay abi.ChainEpoch) {
|
func SetPreCommitChallengeDelay(delay abi.ChainEpoch) {
|
||||||
// Set for all miner versions.
|
// Set for all miner versions.
|
||||||
|
|
||||||
miner0.PreCommitChallengeDelay = delay
|
miner0.PreCommitChallengeDelay = delay
|
||||||
|
|
||||||
miner2.PreCommitChallengeDelay = delay
|
miner2.PreCommitChallengeDelay = delay
|
||||||
|
|
||||||
miner3.PreCommitChallengeDelay = delay
|
miner3.PreCommitChallengeDelay = delay
|
||||||
|
|
||||||
miner4.PreCommitChallengeDelay = delay
|
miner4.PreCommitChallengeDelay = delay
|
||||||
|
|
||||||
miner5.PreCommitChallengeDelay = delay
|
miner5.PreCommitChallengeDelay = delay
|
||||||
|
|
||||||
miner6.PreCommitChallengeDelay = delay
|
miner6.PreCommitChallengeDelay = delay
|
||||||
|
|
||||||
miner7.PreCommitChallengeDelay = delay
|
miner7.PreCommitChallengeDelay = delay
|
||||||
|
|
||||||
miner8.PreCommitChallengeDelay = delay
|
miner8.PreCommitChallengeDelay = delay
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,35 +231,51 @@ func GetPreCommitChallengeDelay() abi.ChainEpoch {
|
|||||||
// for testing.
|
// for testing.
|
||||||
func SetConsensusMinerMinPower(p abi.StoragePower) {
|
func SetConsensusMinerMinPower(p abi.StoragePower) {
|
||||||
|
|
||||||
power0.ConsensusMinerMinPower = p
|
|
||||||
|
|
||||||
for _, policy := range builtin2.SealProofPolicies {
|
power0.ConsensusMinerMinPower = p
|
||||||
policy.ConsensusMinerMinPower = p
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, policy := range builtin3.PoStProofPolicies {
|
|
||||||
policy.ConsensusMinerMinPower = p
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, policy := range builtin4.PoStProofPolicies {
|
|
||||||
policy.ConsensusMinerMinPower = p
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, policy := range builtin5.PoStProofPolicies {
|
for _, policy := range builtin2.SealProofPolicies {
|
||||||
policy.ConsensusMinerMinPower = p
|
policy.ConsensusMinerMinPower = p
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, policy := range builtin6.PoStProofPolicies {
|
|
||||||
policy.ConsensusMinerMinPower = p
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, policy := range builtin7.PoStProofPolicies {
|
|
||||||
policy.ConsensusMinerMinPower = p
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, policy := range builtin8.PoStProofPolicies {
|
for _, policy := range builtin3.PoStProofPolicies {
|
||||||
policy.ConsensusMinerMinPower = p
|
policy.ConsensusMinerMinPower = p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for _, policy := range builtin4.PoStProofPolicies {
|
||||||
|
policy.ConsensusMinerMinPower = p
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for _, policy := range builtin5.PoStProofPolicies {
|
||||||
|
policy.ConsensusMinerMinPower = p
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for _, policy := range builtin6.PoStProofPolicies {
|
||||||
|
policy.ConsensusMinerMinPower = p
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for _, policy := range builtin7.PoStProofPolicies {
|
||||||
|
policy.ConsensusMinerMinPower = p
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for _, policy := range builtin8.PoStProofPolicies {
|
||||||
|
policy.ConsensusMinerMinPower = p
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,58 +283,66 @@ func SetConsensusMinerMinPower(p abi.StoragePower) {
|
|||||||
// only be used for testing.
|
// only be used for testing.
|
||||||
func SetMinVerifiedDealSize(size abi.StoragePower) {
|
func SetMinVerifiedDealSize(size abi.StoragePower) {
|
||||||
|
|
||||||
verifreg0.MinVerifiedDealSize = size
|
verifreg0.MinVerifiedDealSize = size
|
||||||
|
|
||||||
verifreg2.MinVerifiedDealSize = size
|
verifreg2.MinVerifiedDealSize = size
|
||||||
|
|
||||||
verifreg3.MinVerifiedDealSize = size
|
verifreg3.MinVerifiedDealSize = size
|
||||||
|
|
||||||
verifreg4.MinVerifiedDealSize = size
|
verifreg4.MinVerifiedDealSize = size
|
||||||
|
|
||||||
verifreg5.MinVerifiedDealSize = size
|
verifreg5.MinVerifiedDealSize = size
|
||||||
|
|
||||||
verifreg6.MinVerifiedDealSize = size
|
verifreg6.MinVerifiedDealSize = size
|
||||||
|
|
||||||
verifreg7.MinVerifiedDealSize = size
|
verifreg7.MinVerifiedDealSize = size
|
||||||
|
|
||||||
verifreg8.MinVerifiedDealSize = size
|
verifreg8.MinVerifiedDealSize = size
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMaxProveCommitDuration(ver actors.Version, t abi.RegisteredSealProof) (abi.ChainEpoch, error) {
|
func GetMaxProveCommitDuration(ver actors.Version, t abi.RegisteredSealProof) (abi.ChainEpoch, error) {
|
||||||
switch ver {
|
switch ver {
|
||||||
|
|
||||||
case actors.Version0:
|
case actors.Version0:
|
||||||
|
|
||||||
return miner0.MaxSealDuration[t], nil
|
return miner0.MaxSealDuration[t], nil
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
|
|
||||||
return miner2.MaxProveCommitDuration[t], nil
|
case actors.Version2:
|
||||||
|
|
||||||
case actors.Version3:
|
return miner2.MaxProveCommitDuration[t], nil
|
||||||
|
|
||||||
return miner3.MaxProveCommitDuration[t], nil
|
|
||||||
|
|
||||||
case actors.Version4:
|
case actors.Version3:
|
||||||
|
|
||||||
return miner4.MaxProveCommitDuration[t], nil
|
return miner3.MaxProveCommitDuration[t], nil
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
|
|
||||||
return miner5.MaxProveCommitDuration[t], nil
|
case actors.Version4:
|
||||||
|
|
||||||
case actors.Version6:
|
return miner4.MaxProveCommitDuration[t], nil
|
||||||
|
|
||||||
return miner6.MaxProveCommitDuration[t], nil
|
|
||||||
|
|
||||||
case actors.Version7:
|
case actors.Version5:
|
||||||
|
|
||||||
return miner7.MaxProveCommitDuration[t], nil
|
return miner5.MaxProveCommitDuration[t], nil
|
||||||
|
|
||||||
case actors.Version8:
|
|
||||||
|
|
||||||
return miner8.MaxProveCommitDuration[t], nil
|
case actors.Version6:
|
||||||
|
|
||||||
|
return miner6.MaxProveCommitDuration[t], nil
|
||||||
|
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
|
||||||
|
return miner7.MaxProveCommitDuration[t], nil
|
||||||
|
|
||||||
|
|
||||||
|
case actors.Version8:
|
||||||
|
|
||||||
|
return miner8.MaxProveCommitDuration[t], nil
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return 0, xerrors.Errorf("unsupported actors version")
|
return 0, xerrors.Errorf("unsupported actors version")
|
||||||
@ -286,41 +354,57 @@ func GetMaxProveCommitDuration(ver actors.Version, t abi.RegisteredSealProof) (a
|
|||||||
// only be used for testing.
|
// only be used for testing.
|
||||||
func SetProviderCollateralSupplyTarget(num, denom big.Int) {
|
func SetProviderCollateralSupplyTarget(num, denom big.Int) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
market2.ProviderCollateralSupplyTarget = builtin2.BigFrac{
|
market2.ProviderCollateralSupplyTarget = builtin2.BigFrac{
|
||||||
Numerator: num,
|
Numerator: num,
|
||||||
Denominator: denom,
|
Denominator: denom,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
market3.ProviderCollateralSupplyTarget = builtin3.BigFrac{
|
market3.ProviderCollateralSupplyTarget = builtin3.BigFrac{
|
||||||
Numerator: num,
|
Numerator: num,
|
||||||
Denominator: denom,
|
Denominator: denom,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
market4.ProviderCollateralSupplyTarget = builtin4.BigFrac{
|
market4.ProviderCollateralSupplyTarget = builtin4.BigFrac{
|
||||||
Numerator: num,
|
Numerator: num,
|
||||||
Denominator: denom,
|
Denominator: denom,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
market5.ProviderCollateralSupplyTarget = builtin5.BigFrac{
|
market5.ProviderCollateralSupplyTarget = builtin5.BigFrac{
|
||||||
Numerator: num,
|
Numerator: num,
|
||||||
Denominator: denom,
|
Denominator: denom,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
market6.ProviderCollateralSupplyTarget = builtin6.BigFrac{
|
market6.ProviderCollateralSupplyTarget = builtin6.BigFrac{
|
||||||
Numerator: num,
|
Numerator: num,
|
||||||
Denominator: denom,
|
Denominator: denom,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
market7.ProviderCollateralSupplyTarget = builtin7.BigFrac{
|
market7.ProviderCollateralSupplyTarget = builtin7.BigFrac{
|
||||||
Numerator: num,
|
Numerator: num,
|
||||||
Denominator: denom,
|
Denominator: denom,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
market8.ProviderCollateralSupplyTarget = builtin8.BigFrac{
|
market8.ProviderCollateralSupplyTarget = builtin8.BigFrac{
|
||||||
Numerator: num,
|
Numerator: num,
|
||||||
Denominator: denom,
|
Denominator: denom,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func DealProviderCollateralBounds(
|
func DealProviderCollateralBounds(
|
||||||
@ -334,45 +418,53 @@ func DealProviderCollateralBounds(
|
|||||||
}
|
}
|
||||||
switch v {
|
switch v {
|
||||||
|
|
||||||
case actors.Version0:
|
case actors.Version0:
|
||||||
|
|
||||||
min, max := market0.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil, nwVer)
|
min, max := market0.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil, nwVer)
|
||||||
return min, max, nil
|
return min, max, nil
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
|
|
||||||
min, max := market2.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
case actors.Version2:
|
||||||
return min, max, nil
|
|
||||||
|
|
||||||
case actors.Version3:
|
min, max := market2.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
||||||
|
return min, max, nil
|
||||||
|
|
||||||
min, max := market3.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
|
||||||
return min, max, nil
|
|
||||||
|
|
||||||
case actors.Version4:
|
case actors.Version3:
|
||||||
|
|
||||||
min, max := market4.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
min, max := market3.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
||||||
return min, max, nil
|
return min, max, nil
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
|
|
||||||
min, max := market5.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
case actors.Version4:
|
||||||
return min, max, nil
|
|
||||||
|
|
||||||
case actors.Version6:
|
min, max := market4.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
||||||
|
return min, max, nil
|
||||||
|
|
||||||
min, max := market6.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
|
||||||
return min, max, nil
|
|
||||||
|
|
||||||
case actors.Version7:
|
case actors.Version5:
|
||||||
|
|
||||||
min, max := market7.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
min, max := market5.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
||||||
return min, max, nil
|
return min, max, nil
|
||||||
|
|
||||||
case actors.Version8:
|
|
||||||
|
|
||||||
min, max := market8.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
case actors.Version6:
|
||||||
return min, max, nil
|
|
||||||
|
min, max := market6.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
||||||
|
return min, max, nil
|
||||||
|
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
|
||||||
|
min, max := market7.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
||||||
|
return min, max, nil
|
||||||
|
|
||||||
|
|
||||||
|
case actors.Version8:
|
||||||
|
|
||||||
|
min, max := market8.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
|
||||||
|
return min, max, nil
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return big.Zero(), big.Zero(), xerrors.Errorf("unsupported actors version")
|
return big.Zero(), big.Zero(), xerrors.Errorf("unsupported actors version")
|
||||||
@ -387,53 +479,61 @@ func DealDurationBounds(pieceSize abi.PaddedPieceSize) (min, max abi.ChainEpoch)
|
|||||||
// there are always 48 challenge windows in a proving period).
|
// there are always 48 challenge windows in a proving period).
|
||||||
func SetWPoStChallengeWindow(period abi.ChainEpoch) {
|
func SetWPoStChallengeWindow(period abi.ChainEpoch) {
|
||||||
|
|
||||||
miner0.WPoStChallengeWindow = period
|
miner0.WPoStChallengeWindow = period
|
||||||
miner0.WPoStProvingPeriod = period * abi.ChainEpoch(miner0.WPoStPeriodDeadlines)
|
miner0.WPoStProvingPeriod = period * abi.ChainEpoch(miner0.WPoStPeriodDeadlines)
|
||||||
|
|
||||||
miner2.WPoStChallengeWindow = period
|
|
||||||
miner2.WPoStProvingPeriod = period * abi.ChainEpoch(miner2.WPoStPeriodDeadlines)
|
|
||||||
|
|
||||||
miner3.WPoStChallengeWindow = period
|
miner2.WPoStChallengeWindow = period
|
||||||
miner3.WPoStProvingPeriod = period * abi.ChainEpoch(miner3.WPoStPeriodDeadlines)
|
miner2.WPoStProvingPeriod = period * abi.ChainEpoch(miner2.WPoStPeriodDeadlines)
|
||||||
|
|
||||||
// by default, this is 2x finality which is 30 periods.
|
|
||||||
// scale it if we're scaling the challenge period.
|
|
||||||
miner3.WPoStDisputeWindow = period * 30
|
|
||||||
|
|
||||||
miner4.WPoStChallengeWindow = period
|
miner3.WPoStChallengeWindow = period
|
||||||
miner4.WPoStProvingPeriod = period * abi.ChainEpoch(miner4.WPoStPeriodDeadlines)
|
miner3.WPoStProvingPeriod = period * abi.ChainEpoch(miner3.WPoStPeriodDeadlines)
|
||||||
|
|
||||||
// by default, this is 2x finality which is 30 periods.
|
// by default, this is 2x finality which is 30 periods.
|
||||||
// scale it if we're scaling the challenge period.
|
// scale it if we're scaling the challenge period.
|
||||||
miner4.WPoStDisputeWindow = period * 30
|
miner3.WPoStDisputeWindow = period * 30
|
||||||
|
|
||||||
miner5.WPoStChallengeWindow = period
|
|
||||||
miner5.WPoStProvingPeriod = period * abi.ChainEpoch(miner5.WPoStPeriodDeadlines)
|
|
||||||
|
|
||||||
// by default, this is 2x finality which is 30 periods.
|
miner4.WPoStChallengeWindow = period
|
||||||
// scale it if we're scaling the challenge period.
|
miner4.WPoStProvingPeriod = period * abi.ChainEpoch(miner4.WPoStPeriodDeadlines)
|
||||||
miner5.WPoStDisputeWindow = period * 30
|
|
||||||
|
|
||||||
miner6.WPoStChallengeWindow = period
|
// by default, this is 2x finality which is 30 periods.
|
||||||
miner6.WPoStProvingPeriod = period * abi.ChainEpoch(miner6.WPoStPeriodDeadlines)
|
// scale it if we're scaling the challenge period.
|
||||||
|
miner4.WPoStDisputeWindow = period * 30
|
||||||
|
|
||||||
// by default, this is 2x finality which is 30 periods.
|
|
||||||
// scale it if we're scaling the challenge period.
|
|
||||||
miner6.WPoStDisputeWindow = period * 30
|
|
||||||
|
|
||||||
miner7.WPoStChallengeWindow = period
|
miner5.WPoStChallengeWindow = period
|
||||||
miner7.WPoStProvingPeriod = period * abi.ChainEpoch(miner7.WPoStPeriodDeadlines)
|
miner5.WPoStProvingPeriod = period * abi.ChainEpoch(miner5.WPoStPeriodDeadlines)
|
||||||
|
|
||||||
// by default, this is 2x finality which is 30 periods.
|
// by default, this is 2x finality which is 30 periods.
|
||||||
// scale it if we're scaling the challenge period.
|
// scale it if we're scaling the challenge period.
|
||||||
miner7.WPoStDisputeWindow = period * 30
|
miner5.WPoStDisputeWindow = period * 30
|
||||||
|
|
||||||
miner8.WPoStChallengeWindow = period
|
|
||||||
miner8.WPoStProvingPeriod = period * abi.ChainEpoch(miner8.WPoStPeriodDeadlines)
|
|
||||||
|
|
||||||
// by default, this is 2x finality which is 30 periods.
|
miner6.WPoStChallengeWindow = period
|
||||||
// scale it if we're scaling the challenge period.
|
miner6.WPoStProvingPeriod = period * abi.ChainEpoch(miner6.WPoStPeriodDeadlines)
|
||||||
miner8.WPoStDisputeWindow = period * 30
|
|
||||||
|
// by default, this is 2x finality which is 30 periods.
|
||||||
|
// scale it if we're scaling the challenge period.
|
||||||
|
miner6.WPoStDisputeWindow = period * 30
|
||||||
|
|
||||||
|
|
||||||
|
miner7.WPoStChallengeWindow = period
|
||||||
|
miner7.WPoStProvingPeriod = period * abi.ChainEpoch(miner7.WPoStPeriodDeadlines)
|
||||||
|
|
||||||
|
// by default, this is 2x finality which is 30 periods.
|
||||||
|
// scale it if we're scaling the challenge period.
|
||||||
|
miner7.WPoStDisputeWindow = period * 30
|
||||||
|
|
||||||
|
|
||||||
|
miner8.WPoStChallengeWindow = period
|
||||||
|
miner8.WPoStProvingPeriod = period * abi.ChainEpoch(miner8.WPoStPeriodDeadlines)
|
||||||
|
|
||||||
|
// by default, this is 2x finality which is 30 periods.
|
||||||
|
// scale it if we're scaling the challenge period.
|
||||||
|
miner8.WPoStDisputeWindow = period * 30
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,29 +604,29 @@ func GetAddressedSectorsMax(nwVer network.Version) (int, error) {
|
|||||||
}
|
}
|
||||||
switch v {
|
switch v {
|
||||||
|
|
||||||
case actors.Version0:
|
case actors.Version0:
|
||||||
return miner0.AddressedSectorsMax, nil
|
return miner0.AddressedSectorsMax, nil
|
||||||
|
|
||||||
case actors.Version2:
|
case actors.Version2:
|
||||||
return miner2.AddressedSectorsMax, nil
|
return miner2.AddressedSectorsMax, nil
|
||||||
|
|
||||||
case actors.Version3:
|
case actors.Version3:
|
||||||
return miner3.AddressedSectorsMax, nil
|
return miner3.AddressedSectorsMax, nil
|
||||||
|
|
||||||
case actors.Version4:
|
case actors.Version4:
|
||||||
return miner4.AddressedSectorsMax, nil
|
return miner4.AddressedSectorsMax, nil
|
||||||
|
|
||||||
case actors.Version5:
|
case actors.Version5:
|
||||||
return miner5.AddressedSectorsMax, nil
|
return miner5.AddressedSectorsMax, nil
|
||||||
|
|
||||||
case actors.Version6:
|
case actors.Version6:
|
||||||
return miner6.AddressedSectorsMax, nil
|
return miner6.AddressedSectorsMax, nil
|
||||||
|
|
||||||
case actors.Version7:
|
case actors.Version7:
|
||||||
return miner7.AddressedSectorsMax, nil
|
return miner7.AddressedSectorsMax, nil
|
||||||
|
|
||||||
case actors.Version8:
|
case actors.Version8:
|
||||||
return miner8.AddressedSectorsMax, nil
|
return miner8.AddressedSectorsMax, nil
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return 0, xerrors.Errorf("unsupported network version")
|
return 0, xerrors.Errorf("unsupported network version")
|
||||||
@ -540,38 +640,46 @@ func GetDeclarationsMax(nwVer network.Version) (int, error) {
|
|||||||
}
|
}
|
||||||
switch v {
|
switch v {
|
||||||
|
|
||||||
case actors.Version0:
|
case actors.Version0:
|
||||||
|
|
||||||
// TODO: Should we instead error here since the concept doesn't exist yet?
|
// TODO: Should we instead error here since the concept doesn't exist yet?
|
||||||
return miner0.AddressedPartitionsMax, nil
|
return miner0.AddressedPartitionsMax, nil
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
|
|
||||||
return miner2.DeclarationsMax, nil
|
case actors.Version2:
|
||||||
|
|
||||||
case actors.Version3:
|
return miner2.DeclarationsMax, nil
|
||||||
|
|
||||||
return miner3.DeclarationsMax, nil
|
|
||||||
|
|
||||||
case actors.Version4:
|
case actors.Version3:
|
||||||
|
|
||||||
return miner4.DeclarationsMax, nil
|
return miner3.DeclarationsMax, nil
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
|
|
||||||
return miner5.DeclarationsMax, nil
|
case actors.Version4:
|
||||||
|
|
||||||
case actors.Version6:
|
return miner4.DeclarationsMax, nil
|
||||||
|
|
||||||
return miner6.DeclarationsMax, nil
|
|
||||||
|
|
||||||
case actors.Version7:
|
case actors.Version5:
|
||||||
|
|
||||||
return miner7.DeclarationsMax, nil
|
return miner5.DeclarationsMax, nil
|
||||||
|
|
||||||
case actors.Version8:
|
|
||||||
|
|
||||||
return miner8.DeclarationsMax, nil
|
case actors.Version6:
|
||||||
|
|
||||||
|
return miner6.DeclarationsMax, nil
|
||||||
|
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
|
||||||
|
return miner7.DeclarationsMax, nil
|
||||||
|
|
||||||
|
|
||||||
|
case actors.Version8:
|
||||||
|
|
||||||
|
return miner8.DeclarationsMax, nil
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return 0, xerrors.Errorf("unsupported network version")
|
return 0, xerrors.Errorf("unsupported network version")
|
||||||
@ -579,43 +687,51 @@ func GetDeclarationsMax(nwVer network.Version) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func AggregateProveCommitNetworkFee(nwVer network.Version, aggregateSize int, baseFee abi.TokenAmount) (abi.TokenAmount, error) {
|
func AggregateProveCommitNetworkFee(nwVer network.Version, aggregateSize int, baseFee abi.TokenAmount) (abi.TokenAmount, error) {
|
||||||
v, err := actors.VersionForNetwork(nwVer)
|
v, err := actors.VersionForNetwork(nwVer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return big.Zero(), err
|
return big.Zero(), err
|
||||||
}
|
}
|
||||||
switch v {
|
switch v {
|
||||||
|
|
||||||
case actors.Version0:
|
case actors.Version0:
|
||||||
|
|
||||||
return big.Zero(), nil
|
return big.Zero(), nil
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
|
|
||||||
return big.Zero(), nil
|
case actors.Version2:
|
||||||
|
|
||||||
case actors.Version3:
|
return big.Zero(), nil
|
||||||
|
|
||||||
return big.Zero(), nil
|
|
||||||
|
|
||||||
case actors.Version4:
|
case actors.Version3:
|
||||||
|
|
||||||
return big.Zero(), nil
|
return big.Zero(), nil
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
|
|
||||||
return miner5.AggregateNetworkFee(aggregateSize, baseFee), nil
|
case actors.Version4:
|
||||||
|
|
||||||
case actors.Version6:
|
return big.Zero(), nil
|
||||||
|
|
||||||
return miner6.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
|
|
||||||
|
|
||||||
case actors.Version7:
|
case actors.Version5:
|
||||||
|
|
||||||
return miner7.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
|
return miner5.AggregateNetworkFee(aggregateSize, baseFee), nil
|
||||||
|
|
||||||
case actors.Version8:
|
|
||||||
|
|
||||||
return miner8.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
|
case actors.Version6:
|
||||||
|
|
||||||
|
return miner6.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
|
||||||
|
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
|
||||||
|
return miner7.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
|
||||||
|
|
||||||
|
|
||||||
|
case actors.Version8:
|
||||||
|
|
||||||
|
return miner8.AggregateProveCommitNetworkFee(aggregateSize, baseFee), nil
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return big.Zero(), xerrors.Errorf("unsupported network version")
|
return big.Zero(), xerrors.Errorf("unsupported network version")
|
||||||
@ -623,43 +739,51 @@ func AggregateProveCommitNetworkFee(nwVer network.Version, aggregateSize int, ba
|
|||||||
}
|
}
|
||||||
|
|
||||||
func AggregatePreCommitNetworkFee(nwVer network.Version, aggregateSize int, baseFee abi.TokenAmount) (abi.TokenAmount, error) {
|
func AggregatePreCommitNetworkFee(nwVer network.Version, aggregateSize int, baseFee abi.TokenAmount) (abi.TokenAmount, error) {
|
||||||
v, err := actors.VersionForNetwork(nwVer)
|
v, err := actors.VersionForNetwork(nwVer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return big.Zero(), err
|
return big.Zero(), err
|
||||||
}
|
}
|
||||||
switch v {
|
switch v {
|
||||||
|
|
||||||
case actors.Version0:
|
case actors.Version0:
|
||||||
|
|
||||||
return big.Zero(), nil
|
return big.Zero(), nil
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
|
|
||||||
return big.Zero(), nil
|
case actors.Version2:
|
||||||
|
|
||||||
case actors.Version3:
|
return big.Zero(), nil
|
||||||
|
|
||||||
return big.Zero(), nil
|
|
||||||
|
|
||||||
case actors.Version4:
|
case actors.Version3:
|
||||||
|
|
||||||
return big.Zero(), nil
|
return big.Zero(), nil
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
|
|
||||||
return big.Zero(), nil
|
case actors.Version4:
|
||||||
|
|
||||||
case actors.Version6:
|
return big.Zero(), nil
|
||||||
|
|
||||||
return miner6.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
|
|
||||||
|
|
||||||
case actors.Version7:
|
case actors.Version5:
|
||||||
|
|
||||||
return miner7.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
|
return big.Zero(), nil
|
||||||
|
|
||||||
case actors.Version8:
|
|
||||||
|
|
||||||
return miner8.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
|
case actors.Version6:
|
||||||
|
|
||||||
|
return miner6.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
|
||||||
|
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
|
||||||
|
return miner7.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
|
||||||
|
|
||||||
|
|
||||||
|
case actors.Version8:
|
||||||
|
|
||||||
|
return miner8.AggregatePreCommitNetworkFee(aggregateSize, baseFee), nil
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return big.Zero(), xerrors.Errorf("unsupported network version")
|
return big.Zero(), xerrors.Errorf("unsupported network version")
|
||||||
|
Loading…
Reference in New Issue
Block a user