refactor: add inspection methods to actor gen interface
- adds the following methods to all generated actor interfaces: - Code() cid.Cid - ActorKey() string - ActorVersion() actorstypes.Version - AllCodes() []cid.Cid
This commit is contained in:
parent
85960256ca
commit
e61b9b2a65
@ -1,6 +1,7 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
@ -104,6 +105,24 @@ func MakeState(store adt.Store, av actorstypes.Version, addr address.Address) (S
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
Code() cid.Cid
|
||||
ActorKey() string
|
||||
ActorVersion() actorstypes.Version
|
||||
|
||||
PubkeyAddress() (address.Address, error)
|
||||
GetState() interface{}
|
||||
}
|
||||
|
||||
func AllCodes() []cid.Cid {
|
||||
return []cid.Cid{
|
||||
(&state0{}).Code(),
|
||||
(&state2{}).Code(),
|
||||
(&state3{}).Code(),
|
||||
(&state4{}).Code(),
|
||||
(&state5{}).Code(),
|
||||
(&state6{}).Code(),
|
||||
(&state7{}).Code(),
|
||||
(&state8{}).Code(),
|
||||
(&state9{}).Code(),
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"golang.org/x/xerrors"
|
||||
@ -62,6 +63,17 @@ func MakeState(store adt.Store, av actorstypes.Version, addr address.Address) (S
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
Code() cid.Cid
|
||||
ActorKey() string
|
||||
ActorVersion() actorstypes.Version
|
||||
|
||||
PubkeyAddress() (address.Address, error)
|
||||
GetState() interface{}
|
||||
}
|
||||
|
||||
func AllCodes() []cid.Cid {
|
||||
return []cid.Cid{ {{range .versions}}
|
||||
(&state{{.}}{}).Code(),
|
||||
{{- end}}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,14 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
|
||||
{{if (le .v 7)}}
|
||||
account{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/account"
|
||||
@ -41,4 +45,21 @@ func (s *state{{.v}}) PubkeyAddress() (address.Address, error) {
|
||||
|
||||
func (s *state{{.v}}) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) ActorKey() string {
|
||||
return actors.AccountKey
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version{{.v}}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
@ -1,11 +1,15 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
account0 "github.com/filecoin-project/specs-actors/actors/builtin/account"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -38,3 +42,20 @@ func (s *state0) PubkeyAddress() (address.Address, error) {
|
||||
func (s *state0) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state0) ActorKey() string {
|
||||
return actors.AccountKey
|
||||
}
|
||||
|
||||
func (s *state0) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version0
|
||||
}
|
||||
|
||||
func (s *state0) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,11 +1,15 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
account2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/account"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -38,3 +42,20 @@ func (s *state2) PubkeyAddress() (address.Address, error) {
|
||||
func (s *state2) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state2) ActorKey() string {
|
||||
return actors.AccountKey
|
||||
}
|
||||
|
||||
func (s *state2) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version2
|
||||
}
|
||||
|
||||
func (s *state2) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,11 +1,15 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
account3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/account"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -38,3 +42,20 @@ func (s *state3) PubkeyAddress() (address.Address, error) {
|
||||
func (s *state3) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state3) ActorKey() string {
|
||||
return actors.AccountKey
|
||||
}
|
||||
|
||||
func (s *state3) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version3
|
||||
}
|
||||
|
||||
func (s *state3) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,11 +1,15 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
account4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/account"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -38,3 +42,20 @@ func (s *state4) PubkeyAddress() (address.Address, error) {
|
||||
func (s *state4) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state4) ActorKey() string {
|
||||
return actors.AccountKey
|
||||
}
|
||||
|
||||
func (s *state4) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version4
|
||||
}
|
||||
|
||||
func (s *state4) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,11 +1,15 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
account5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/account"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -38,3 +42,20 @@ func (s *state5) PubkeyAddress() (address.Address, error) {
|
||||
func (s *state5) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state5) ActorKey() string {
|
||||
return actors.AccountKey
|
||||
}
|
||||
|
||||
func (s *state5) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version5
|
||||
}
|
||||
|
||||
func (s *state5) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,11 +1,15 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
account6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/account"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -38,3 +42,20 @@ func (s *state6) PubkeyAddress() (address.Address, error) {
|
||||
func (s *state6) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state6) ActorKey() string {
|
||||
return actors.AccountKey
|
||||
}
|
||||
|
||||
func (s *state6) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version6
|
||||
}
|
||||
|
||||
func (s *state6) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,11 +1,15 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
account7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/account"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -38,3 +42,20 @@ func (s *state7) PubkeyAddress() (address.Address, error) {
|
||||
func (s *state7) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state7) ActorKey() string {
|
||||
return actors.AccountKey
|
||||
}
|
||||
|
||||
func (s *state7) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version7
|
||||
}
|
||||
|
||||
func (s *state7) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,11 +1,15 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
account8 "github.com/filecoin-project/go-state-types/builtin/v8/account"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -38,3 +42,20 @@ func (s *state8) PubkeyAddress() (address.Address, error) {
|
||||
func (s *state8) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state8) ActorKey() string {
|
||||
return actors.AccountKey
|
||||
}
|
||||
|
||||
func (s *state8) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version8
|
||||
}
|
||||
|
||||
func (s *state8) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,11 +1,15 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
account9 "github.com/filecoin-project/go-state-types/builtin/v9/account"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -38,3 +42,20 @@ func (s *state9) PubkeyAddress() (address.Address, error) {
|
||||
func (s *state9) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state9) ActorKey() string {
|
||||
return actors.AccountKey
|
||||
}
|
||||
|
||||
func (s *state9) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version9
|
||||
}
|
||||
|
||||
func (s *state9) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
@ -60,5 +61,16 @@ var (
|
||||
|
||||
|
||||
type State interface {
|
||||
Code() cid.Cid
|
||||
ActorKey() string
|
||||
ActorVersion() actorstypes.Version
|
||||
|
||||
GetState() interface{}
|
||||
}
|
||||
|
||||
func AllCodes() []cid.Cid {
|
||||
return []cid.Cid{ {{range .versions}}
|
||||
(&state{{.}}{}).Code(),
|
||||
{{- end}}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
@ -103,5 +104,23 @@ var (
|
||||
)
|
||||
|
||||
type State interface {
|
||||
Code() cid.Cid
|
||||
ActorKey() string
|
||||
ActorVersion() actorstypes.Version
|
||||
|
||||
GetState() interface{}
|
||||
}
|
||||
|
||||
func AllCodes() []cid.Cid {
|
||||
return []cid.Cid{
|
||||
(&state0{}).Code(),
|
||||
(&state2{}).Code(),
|
||||
(&state3{}).Code(),
|
||||
(&state4{}).Code(),
|
||||
(&state5{}).Code(),
|
||||
(&state6{}).Code(),
|
||||
(&state7{}).Code(),
|
||||
(&state8{}).Code(),
|
||||
(&state9{}).Code(),
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
|
||||
{{if (le .v 7)}}
|
||||
cron{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/cron"
|
||||
@ -36,4 +39,21 @@ type state{{.v}} struct {
|
||||
|
||||
func (s *state{{.v}}) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) ActorKey() string {
|
||||
return actors.CronKey
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version{{.v}}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,10 +1,14 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
cron0 "github.com/filecoin-project/specs-actors/actors/builtin/cron"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -33,3 +37,20 @@ type state0 struct {
|
||||
func (s *state0) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state0) ActorKey() string {
|
||||
return actors.CronKey
|
||||
}
|
||||
|
||||
func (s *state0) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version0
|
||||
}
|
||||
|
||||
func (s *state0) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,10 +1,14 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
cron2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/cron"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -33,3 +37,20 @@ type state2 struct {
|
||||
func (s *state2) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state2) ActorKey() string {
|
||||
return actors.CronKey
|
||||
}
|
||||
|
||||
func (s *state2) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version2
|
||||
}
|
||||
|
||||
func (s *state2) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,10 +1,14 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
cron3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/cron"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -33,3 +37,20 @@ type state3 struct {
|
||||
func (s *state3) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state3) ActorKey() string {
|
||||
return actors.CronKey
|
||||
}
|
||||
|
||||
func (s *state3) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version3
|
||||
}
|
||||
|
||||
func (s *state3) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,10 +1,14 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
cron4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/cron"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -33,3 +37,20 @@ type state4 struct {
|
||||
func (s *state4) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state4) ActorKey() string {
|
||||
return actors.CronKey
|
||||
}
|
||||
|
||||
func (s *state4) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version4
|
||||
}
|
||||
|
||||
func (s *state4) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,10 +1,14 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
cron5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/cron"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -33,3 +37,20 @@ type state5 struct {
|
||||
func (s *state5) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state5) ActorKey() string {
|
||||
return actors.CronKey
|
||||
}
|
||||
|
||||
func (s *state5) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version5
|
||||
}
|
||||
|
||||
func (s *state5) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,10 +1,14 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
cron6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/cron"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -33,3 +37,20 @@ type state6 struct {
|
||||
func (s *state6) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state6) ActorKey() string {
|
||||
return actors.CronKey
|
||||
}
|
||||
|
||||
func (s *state6) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version6
|
||||
}
|
||||
|
||||
func (s *state6) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,10 +1,14 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
cron7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/cron"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -33,3 +37,20 @@ type state7 struct {
|
||||
func (s *state7) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state7) ActorKey() string {
|
||||
return actors.CronKey
|
||||
}
|
||||
|
||||
func (s *state7) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version7
|
||||
}
|
||||
|
||||
func (s *state7) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,10 +1,14 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
cron8 "github.com/filecoin-project/go-state-types/builtin/v8/cron"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -33,3 +37,20 @@ type state8 struct {
|
||||
func (s *state8) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state8) ActorKey() string {
|
||||
return actors.CronKey
|
||||
}
|
||||
|
||||
func (s *state8) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version8
|
||||
}
|
||||
|
||||
func (s *state8) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,10 +1,14 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
cron9 "github.com/filecoin-project/go-state-types/builtin/v9/cron"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -33,3 +37,20 @@ type state9 struct {
|
||||
func (s *state9) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state9) ActorKey() string {
|
||||
return actors.CronKey
|
||||
}
|
||||
|
||||
func (s *state9) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version9
|
||||
}
|
||||
|
||||
func (s *state9) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ package datacap
|
||||
import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
@ -50,8 +52,19 @@ func MakeState(store adt.Store, av actorstypes.Version, governor address.Address
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
Code() cid.Cid
|
||||
ActorKey() string
|
||||
ActorVersion() actorstypes.Version
|
||||
|
||||
ForEachClient(func(addr address.Address, dcap abi.StoragePower) error) error
|
||||
VerifiedClientDataCap(address.Address) (bool, abi.StoragePower, error)
|
||||
Governor() (address.Address, error)
|
||||
GetState() interface{}
|
||||
}
|
||||
|
||||
func AllCodes() []cid.Cid {
|
||||
return []cid.Cid{ {{range .versions}}
|
||||
(&state{{.}}{}).Code(),
|
||||
{{- end}}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package datacap
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
@ -51,8 +52,18 @@ func MakeState(store adt.Store, av actorstypes.Version, governor address.Address
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
Code() cid.Cid
|
||||
ActorKey() string
|
||||
ActorVersion() actorstypes.Version
|
||||
|
||||
ForEachClient(func(addr address.Address, dcap abi.StoragePower) error) error
|
||||
VerifiedClientDataCap(address.Address) (bool, abi.StoragePower, error)
|
||||
Governor() (address.Address, error)
|
||||
GetState() interface{}
|
||||
}
|
||||
|
||||
func AllCodes() []cid.Cid {
|
||||
return []cid.Cid{
|
||||
(&state9{}).Code(),
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,14 @@
|
||||
package datacap
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
|
||||
datacap{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}datacap"
|
||||
adt{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}util/adt"
|
||||
@ -59,3 +61,20 @@ func (s *state{{.v}}) verifiedClients() (adt.Map, error) {
|
||||
func (s *state{{.v}}) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
return getDataCap(s.store, actors.Version{{.v}}, s.verifiedClients, addr)
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) ActorKey() string {
|
||||
return actors.DatacapKey
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version{{.v}}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,10 +1,13 @@
|
||||
package datacap
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
datacap9 "github.com/filecoin-project/go-state-types/builtin/v9/datacap"
|
||||
adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt"
|
||||
|
||||
@ -59,3 +62,20 @@ func (s *state9) verifiedClients() (adt.Map, error) {
|
||||
func (s *state9) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
return getDataCap(s.store, actors.Version9, s.verifiedClients, addr)
|
||||
}
|
||||
|
||||
func (s *state9) ActorKey() string {
|
||||
return actors.DatacapKey
|
||||
}
|
||||
|
||||
func (s *state9) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version9
|
||||
}
|
||||
|
||||
func (s *state9) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -67,6 +67,10 @@ func MakeState(store adt.Store, av actorstypes.Version, networkName string) (Sta
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
Code() cid.Cid
|
||||
ActorKey() string
|
||||
ActorVersion() actorstypes.Version
|
||||
|
||||
ResolveAddress(address address.Address) (address.Address, bool, error)
|
||||
MapAddressToNewID(address address.Address) (address.Address, error)
|
||||
NetworkName() (dtypes.NetworkName, error)
|
||||
@ -93,3 +97,10 @@ type State interface {
|
||||
AddressMapBitWidth() int
|
||||
AddressMapHashFunction() func(input []byte) []byte
|
||||
}
|
||||
|
||||
func AllCodes() []cid.Cid {
|
||||
return []cid.Cid{ {{range .versions}}
|
||||
(&state{{.}}{}).Code(),
|
||||
{{- end}}
|
||||
}
|
||||
}
|
||||
|
@ -110,6 +110,10 @@ func MakeState(store adt.Store, av actorstypes.Version, networkName string) (Sta
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
Code() cid.Cid
|
||||
ActorKey() string
|
||||
ActorVersion() actorstypes.Version
|
||||
|
||||
ResolveAddress(address address.Address) (address.Address, bool, error)
|
||||
MapAddressToNewID(address address.Address) (address.Address, error)
|
||||
NetworkName() (dtypes.NetworkName, error)
|
||||
@ -136,3 +140,17 @@ type State interface {
|
||||
AddressMapBitWidth() int
|
||||
AddressMapHashFunction() func(input []byte) []byte
|
||||
}
|
||||
|
||||
func AllCodes() []cid.Cid {
|
||||
return []cid.Cid{
|
||||
(&state0{}).Code(),
|
||||
(&state2{}).Code(),
|
||||
(&state3{}).Code(),
|
||||
(&state4{}).Code(),
|
||||
(&state5{}).Code(),
|
||||
(&state6{}).Code(),
|
||||
(&state7{}).Code(),
|
||||
(&state8{}).Code(),
|
||||
(&state9{}).Code(),
|
||||
}
|
||||
}
|
||||
|
@ -2,13 +2,17 @@ package init
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
|
||||
{{if (le .v 7)}}
|
||||
@ -141,4 +145,21 @@ func (s *state{{.v}}) AddressMapHashFunction() func(input []byte) []byte {
|
||||
res := sha256.Sum256(input)
|
||||
return res[:]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) ActorKey() string {
|
||||
return actors.InitKey
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version{{.v}}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package init
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -9,9 +10,11 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
init0 "github.com/filecoin-project/specs-actors/actors/builtin/init"
|
||||
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
)
|
||||
@ -123,3 +126,20 @@ func (s *state0) AddressMapHashFunction() func(input []byte) []byte {
|
||||
return res[:]
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state0) ActorKey() string {
|
||||
return actors.InitKey
|
||||
}
|
||||
|
||||
func (s *state0) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version0
|
||||
}
|
||||
|
||||
func (s *state0) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package init
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -9,9 +10,11 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init"
|
||||
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
)
|
||||
@ -123,3 +126,20 @@ func (s *state2) AddressMapHashFunction() func(input []byte) []byte {
|
||||
return res[:]
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state2) ActorKey() string {
|
||||
return actors.InitKey
|
||||
}
|
||||
|
||||
func (s *state2) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version2
|
||||
}
|
||||
|
||||
func (s *state2) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package init
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -9,10 +10,12 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
||||
init3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/init"
|
||||
adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
)
|
||||
@ -124,3 +127,20 @@ func (s *state3) AddressMapHashFunction() func(input []byte) []byte {
|
||||
return res[:]
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state3) ActorKey() string {
|
||||
return actors.InitKey
|
||||
}
|
||||
|
||||
func (s *state3) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version3
|
||||
}
|
||||
|
||||
func (s *state3) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package init
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -9,10 +10,12 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
||||
init4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/init"
|
||||
adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
)
|
||||
@ -124,3 +127,20 @@ func (s *state4) AddressMapHashFunction() func(input []byte) []byte {
|
||||
return res[:]
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state4) ActorKey() string {
|
||||
return actors.InitKey
|
||||
}
|
||||
|
||||
func (s *state4) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version4
|
||||
}
|
||||
|
||||
func (s *state4) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package init
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -9,10 +10,12 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
||||
init5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/init"
|
||||
adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
)
|
||||
@ -124,3 +127,20 @@ func (s *state5) AddressMapHashFunction() func(input []byte) []byte {
|
||||
return res[:]
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state5) ActorKey() string {
|
||||
return actors.InitKey
|
||||
}
|
||||
|
||||
func (s *state5) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version5
|
||||
}
|
||||
|
||||
func (s *state5) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package init
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -9,10 +10,12 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
||||
init6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/init"
|
||||
adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
)
|
||||
@ -124,3 +127,20 @@ func (s *state6) AddressMapHashFunction() func(input []byte) []byte {
|
||||
return res[:]
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state6) ActorKey() string {
|
||||
return actors.InitKey
|
||||
}
|
||||
|
||||
func (s *state6) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version6
|
||||
}
|
||||
|
||||
func (s *state6) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package init
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -9,10 +10,12 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||
init7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/init"
|
||||
adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
)
|
||||
@ -124,3 +127,20 @@ func (s *state7) AddressMapHashFunction() func(input []byte) []byte {
|
||||
return res[:]
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state7) ActorKey() string {
|
||||
return actors.InitKey
|
||||
}
|
||||
|
||||
func (s *state7) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version7
|
||||
}
|
||||
|
||||
func (s *state7) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package init
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -9,10 +10,12 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||
init8 "github.com/filecoin-project/go-state-types/builtin/v8/init"
|
||||
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
)
|
||||
@ -124,3 +127,20 @@ func (s *state8) AddressMapHashFunction() func(input []byte) []byte {
|
||||
return res[:]
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state8) ActorKey() string {
|
||||
return actors.InitKey
|
||||
}
|
||||
|
||||
func (s *state8) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version8
|
||||
}
|
||||
|
||||
func (s *state8) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package init
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -9,10 +10,12 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin9 "github.com/filecoin-project/go-state-types/builtin"
|
||||
init9 "github.com/filecoin-project/go-state-types/builtin/v9/init"
|
||||
adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
)
|
||||
@ -124,3 +127,20 @@ func (s *state9) AddressMapHashFunction() func(input []byte) []byte {
|
||||
return res[:]
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state9) ActorKey() string {
|
||||
return actors.InitKey
|
||||
}
|
||||
|
||||
func (s *state9) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version9
|
||||
}
|
||||
|
||||
func (s *state9) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package market
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"unicode/utf8"
|
||||
|
||||
@ -73,6 +74,11 @@ func MakeState(store adt.Store, av actorstypes.Version) (State, error) {
|
||||
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
Code() cid.Cid
|
||||
ActorKey() string
|
||||
ActorVersion() actorstypes.Version
|
||||
|
||||
BalancesChanged(State) (bool, error)
|
||||
EscrowTable() (BalanceTable, error)
|
||||
LockedTable() (BalanceTable, error)
|
||||
@ -200,3 +206,10 @@ func labelFromGoString(s string) (markettypes.DealLabel, error) {
|
||||
return markettypes.NewLabelFromBytes([]byte(s))
|
||||
}
|
||||
}
|
||||
|
||||
func AllCodes() []cid.Cid {
|
||||
return []cid.Cid{ {{range .versions}}
|
||||
(&state{{.}}{}).Code(),
|
||||
{{- end}}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package market
|
||||
import (
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
@ -114,6 +115,11 @@ func MakeState(store adt.Store, av actorstypes.Version) (State, error) {
|
||||
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
Code() cid.Cid
|
||||
ActorKey() string
|
||||
ActorVersion() actorstypes.Version
|
||||
|
||||
BalancesChanged(State) (bool, error)
|
||||
EscrowTable() (BalanceTable, error)
|
||||
LockedTable() (BalanceTable, error)
|
||||
@ -264,3 +270,17 @@ func labelFromGoString(s string) (markettypes.DealLabel, error) {
|
||||
return markettypes.NewLabelFromBytes([]byte(s))
|
||||
}
|
||||
}
|
||||
|
||||
func AllCodes() []cid.Cid {
|
||||
return []cid.Cid{
|
||||
(&state0{}).Code(),
|
||||
(&state2{}).Code(),
|
||||
(&state3{}).Code(),
|
||||
(&state4{}).Code(),
|
||||
(&state5{}).Code(),
|
||||
(&state6{}).Code(),
|
||||
(&state7{}).Code(),
|
||||
(&state8{}).Code(),
|
||||
(&state9{}).Code(),
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package market
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"bytes"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
@ -14,7 +15,9 @@ import (
|
||||
{{end}}
|
||||
|
||||
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
|
||||
@ -387,3 +390,21 @@ func (s *state{{.v}}) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifreg
|
||||
return verifregtypes.AllocationId(allocationId), nil
|
||||
{{end}}
|
||||
}
|
||||
|
||||
|
||||
func (s *state{{.v}}) ActorKey() string {
|
||||
return actors.MarketKey
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version{{.v}}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package market
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -9,10 +10,12 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
@ -307,3 +310,20 @@ func (s *state0) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("unsupported before actors v9")
|
||||
|
||||
}
|
||||
|
||||
func (s *state0) ActorKey() string {
|
||||
return actors.MarketKey
|
||||
}
|
||||
|
||||
func (s *state0) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version0
|
||||
}
|
||||
|
||||
func (s *state0) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package market
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -9,10 +10,12 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
@ -307,3 +310,20 @@ func (s *state2) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("unsupported before actors v9")
|
||||
|
||||
}
|
||||
|
||||
func (s *state2) ActorKey() string {
|
||||
return actors.MarketKey
|
||||
}
|
||||
|
||||
func (s *state2) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version2
|
||||
}
|
||||
|
||||
func (s *state2) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package market
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -9,10 +10,12 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
market3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/market"
|
||||
adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
@ -302,3 +305,20 @@ func (s *state3) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("unsupported before actors v9")
|
||||
|
||||
}
|
||||
|
||||
func (s *state3) ActorKey() string {
|
||||
return actors.MarketKey
|
||||
}
|
||||
|
||||
func (s *state3) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version3
|
||||
}
|
||||
|
||||
func (s *state3) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package market
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -9,10 +10,12 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
market4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/market"
|
||||
adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
@ -302,3 +305,20 @@ func (s *state4) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("unsupported before actors v9")
|
||||
|
||||
}
|
||||
|
||||
func (s *state4) ActorKey() string {
|
||||
return actors.MarketKey
|
||||
}
|
||||
|
||||
func (s *state4) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version4
|
||||
}
|
||||
|
||||
func (s *state4) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package market
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -9,10 +10,12 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
market5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/market"
|
||||
adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
@ -302,3 +305,20 @@ func (s *state5) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("unsupported before actors v9")
|
||||
|
||||
}
|
||||
|
||||
func (s *state5) ActorKey() string {
|
||||
return actors.MarketKey
|
||||
}
|
||||
|
||||
func (s *state5) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version5
|
||||
}
|
||||
|
||||
func (s *state5) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package market
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -11,10 +12,12 @@ import (
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
market6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/market"
|
||||
adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
@ -320,3 +323,20 @@ func (s *state6) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("unsupported before actors v9")
|
||||
|
||||
}
|
||||
|
||||
func (s *state6) ActorKey() string {
|
||||
return actors.MarketKey
|
||||
}
|
||||
|
||||
func (s *state6) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version6
|
||||
}
|
||||
|
||||
func (s *state6) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package market
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -11,10 +12,12 @@ import (
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market"
|
||||
adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
@ -320,3 +323,20 @@ func (s *state7) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("unsupported before actors v9")
|
||||
|
||||
}
|
||||
|
||||
func (s *state7) ActorKey() string {
|
||||
return actors.MarketKey
|
||||
}
|
||||
|
||||
func (s *state7) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version7
|
||||
}
|
||||
|
||||
func (s *state7) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package market
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -11,11 +12,13 @@ import (
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
market8 "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
|
||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
@ -337,3 +340,20 @@ func (s *state8) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes
|
||||
return verifregtypes.NoAllocationID, xerrors.Errorf("unsupported before actors v9")
|
||||
|
||||
}
|
||||
|
||||
func (s *state8) ActorKey() string {
|
||||
return actors.MarketKey
|
||||
}
|
||||
|
||||
func (s *state8) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version8
|
||||
}
|
||||
|
||||
func (s *state8) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package market
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -11,12 +12,14 @@ import (
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/builtin"
|
||||
market9 "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||
markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market"
|
||||
adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
@ -347,3 +350,20 @@ func (s *state9) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes
|
||||
return verifregtypes.AllocationId(allocationId), nil
|
||||
|
||||
}
|
||||
|
||||
func (s *state9) ActorKey() string {
|
||||
return actors.MarketKey
|
||||
}
|
||||
|
||||
func (s *state9) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version9
|
||||
}
|
||||
|
||||
func (s *state9) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package miner
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
@ -66,6 +67,10 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
Code() cid.Cid
|
||||
ActorKey() string
|
||||
ActorVersion() actorstypes.Version
|
||||
|
||||
// Total available balance to spend.
|
||||
AvailableBalance(abi.TokenAmount) (abi.TokenAmount, error)
|
||||
// Funds that will vest by the given epoch.
|
||||
@ -243,3 +248,10 @@ type LockedFunds struct {
|
||||
func (lf LockedFunds) TotalLockedFunds() abi.TokenAmount {
|
||||
return big.Add(lf.VestingFunds, big.Add(lf.InitialPledgeRequirement, lf.PreCommitDeposits))
|
||||
}
|
||||
|
||||
func AllCodes() []cid.Cid {
|
||||
return []cid.Cid{ {{range .versions}}
|
||||
(&state{{.}}{}).Code(),
|
||||
{{- end}}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package miner
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
@ -108,6 +109,10 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
Code() cid.Cid
|
||||
ActorKey() string
|
||||
ActorVersion() actorstypes.Version
|
||||
|
||||
// Total available balance to spend.
|
||||
AvailableBalance(abi.TokenAmount) (abi.TokenAmount, error)
|
||||
// Funds that will vest by the given epoch.
|
||||
@ -285,3 +290,17 @@ type LockedFunds struct {
|
||||
func (lf LockedFunds) TotalLockedFunds() abi.TokenAmount {
|
||||
return big.Add(lf.VestingFunds, big.Add(lf.InitialPledgeRequirement, lf.PreCommitDeposits))
|
||||
}
|
||||
|
||||
func AllCodes() []cid.Cid {
|
||||
return []cid.Cid{
|
||||
(&state0{}).Code(),
|
||||
(&state2{}).Code(),
|
||||
(&state3{}).Code(),
|
||||
(&state4{}).Code(),
|
||||
(&state5{}).Code(),
|
||||
(&state6{}).Code(),
|
||||
(&state7{}).Code(),
|
||||
(&state8{}).Code(),
|
||||
(&state9{}).Code(),
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package miner
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"bytes"
|
||||
"errors"
|
||||
{{if (le .v 1)}}
|
||||
@ -15,6 +16,8 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
minertypes "github.com/filecoin-project/go-state-types/builtin/v{{.latestVersion}}/miner"
|
||||
|
||||
{{if (le .v 7)}}
|
||||
@ -602,3 +605,20 @@ func fromV{{.v}}SectorPreCommitOnChainInfo(v{{.v}} miner{{.v}}.SectorPreCommitOn
|
||||
func (s *state{{.v}}) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) ActorKey() string {
|
||||
return actors.MinerKey
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version{{.v}}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package miner
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -11,12 +12,14 @@ import (
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
rle "github.com/filecoin-project/go-bitfield/rle"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -528,3 +531,20 @@ func fromV0SectorPreCommitOnChainInfo(v0 miner0.SectorPreCommitOnChainInfo) mine
|
||||
func (s *state0) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state0) ActorKey() string {
|
||||
return actors.MinerKey
|
||||
}
|
||||
|
||||
func (s *state0) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version0
|
||||
}
|
||||
|
||||
func (s *state0) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package miner
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -11,11 +12,13 @@ import (
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
rle "github.com/filecoin-project/go-bitfield/rle"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
|
||||
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -559,3 +562,20 @@ func fromV2SectorPreCommitOnChainInfo(v2 miner2.SectorPreCommitOnChainInfo) mine
|
||||
func (s *state2) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state2) ActorKey() string {
|
||||
return actors.MinerKey
|
||||
}
|
||||
|
||||
func (s *state2) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version2
|
||||
}
|
||||
|
||||
func (s *state2) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package miner
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -11,12 +12,14 @@ import (
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
rle "github.com/filecoin-project/go-bitfield/rle"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
||||
miner3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/miner"
|
||||
adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -559,3 +562,20 @@ func fromV3SectorPreCommitOnChainInfo(v3 miner3.SectorPreCommitOnChainInfo) mine
|
||||
func (s *state3) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state3) ActorKey() string {
|
||||
return actors.MinerKey
|
||||
}
|
||||
|
||||
func (s *state3) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version3
|
||||
}
|
||||
|
||||
func (s *state3) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package miner
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -11,12 +12,14 @@ import (
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
rle "github.com/filecoin-project/go-bitfield/rle"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
||||
miner4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/miner"
|
||||
adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -559,3 +562,20 @@ func fromV4SectorPreCommitOnChainInfo(v4 miner4.SectorPreCommitOnChainInfo) mine
|
||||
func (s *state4) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state4) ActorKey() string {
|
||||
return actors.MinerKey
|
||||
}
|
||||
|
||||
func (s *state4) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version4
|
||||
}
|
||||
|
||||
func (s *state4) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package miner
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -11,12 +12,14 @@ import (
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
rle "github.com/filecoin-project/go-bitfield/rle"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
||||
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
|
||||
adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -559,3 +562,20 @@ func fromV5SectorPreCommitOnChainInfo(v5 miner5.SectorPreCommitOnChainInfo) mine
|
||||
func (s *state5) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state5) ActorKey() string {
|
||||
return actors.MinerKey
|
||||
}
|
||||
|
||||
func (s *state5) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version5
|
||||
}
|
||||
|
||||
func (s *state5) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package miner
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -11,12 +12,14 @@ import (
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
rle "github.com/filecoin-project/go-bitfield/rle"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
||||
miner6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/miner"
|
||||
adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -559,3 +562,20 @@ func fromV6SectorPreCommitOnChainInfo(v6 miner6.SectorPreCommitOnChainInfo) mine
|
||||
func (s *state6) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state6) ActorKey() string {
|
||||
return actors.MinerKey
|
||||
}
|
||||
|
||||
func (s *state6) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version6
|
||||
}
|
||||
|
||||
func (s *state6) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package miner
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -11,12 +12,14 @@ import (
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
rle "github.com/filecoin-project/go-bitfield/rle"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||
miner7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/miner"
|
||||
adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -560,3 +563,20 @@ func fromV7SectorPreCommitOnChainInfo(v7 miner7.SectorPreCommitOnChainInfo) mine
|
||||
func (s *state7) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state7) ActorKey() string {
|
||||
return actors.MinerKey
|
||||
}
|
||||
|
||||
func (s *state7) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version7
|
||||
}
|
||||
|
||||
func (s *state7) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package miner
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -11,12 +12,14 @@ import (
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
rle "github.com/filecoin-project/go-bitfield/rle"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||
miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
|
||||
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -560,3 +563,20 @@ func fromV8SectorPreCommitOnChainInfo(v8 miner8.SectorPreCommitOnChainInfo) mine
|
||||
func (s *state8) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state8) ActorKey() string {
|
||||
return actors.MinerKey
|
||||
}
|
||||
|
||||
func (s *state8) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version8
|
||||
}
|
||||
|
||||
func (s *state8) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package miner
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -11,12 +12,14 @@ import (
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
rle "github.com/filecoin-project/go-bitfield/rle"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin9 "github.com/filecoin-project/go-state-types/builtin"
|
||||
miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -552,3 +555,20 @@ func fromV9SectorPreCommitOnChainInfo(v9 miner9.SectorPreCommitOnChainInfo) mine
|
||||
func (s *state9) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state9) ActorKey() string {
|
||||
return actors.MinerKey
|
||||
}
|
||||
|
||||
func (s *state9) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version9
|
||||
}
|
||||
|
||||
func (s *state9) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package multisig
|
||||
|
||||
import (
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/ipfs/go-cid"
|
||||
"fmt"
|
||||
|
||||
"github.com/minio/blake2b-simd"
|
||||
@ -67,6 +68,10 @@ func MakeState(store adt.Store, av actorstypes.Version, signers []address.Addres
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
Code() cid.Cid
|
||||
ActorKey() string
|
||||
ActorVersion() actorstypes.Version
|
||||
|
||||
LockedBalance(epoch abi.ChainEpoch) (abi.TokenAmount, error)
|
||||
StartEpoch() (abi.ChainEpoch, error)
|
||||
UnlockDuration() (abi.ChainEpoch, error)
|
||||
@ -141,3 +146,10 @@ func txnParams(id uint64, data *ProposalHashData) ([]byte, error) {
|
||||
|
||||
return actors.SerializeParams(¶ms)
|
||||
}
|
||||
|
||||
func AllCodes() []cid.Cid {
|
||||
return []cid.Cid{ {{range .versions}}
|
||||
(&state{{.}}{}).Code(),
|
||||
{{- end}}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package multisig
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/minio/blake2b-simd"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
"golang.org/x/xerrors"
|
||||
@ -108,6 +109,10 @@ func MakeState(store adt.Store, av actorstypes.Version, signers []address.Addres
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
Code() cid.Cid
|
||||
ActorKey() string
|
||||
ActorVersion() actorstypes.Version
|
||||
|
||||
LockedBalance(epoch abi.ChainEpoch) (abi.TokenAmount, error)
|
||||
StartEpoch() (abi.ChainEpoch, error)
|
||||
UnlockDuration() (abi.ChainEpoch, error)
|
||||
@ -206,3 +211,17 @@ func txnParams(id uint64, data *ProposalHashData) ([]byte, error) {
|
||||
|
||||
return actors.SerializeParams(¶ms)
|
||||
}
|
||||
|
||||
func AllCodes() []cid.Cid {
|
||||
return []cid.Cid{
|
||||
(&state0{}).Code(),
|
||||
(&state2{}).Code(),
|
||||
(&state3{}).Code(),
|
||||
(&state4{}).Code(),
|
||||
(&state5{}).Code(),
|
||||
(&state6{}).Code(),
|
||||
(&state7{}).Code(),
|
||||
(&state8{}).Code(),
|
||||
(&state9{}).Code(),
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
package multisig
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
@ -12,6 +14,7 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
|
||||
{{if (le .v 7)}}
|
||||
{{if (ge .v 3)}}
|
||||
@ -131,3 +134,20 @@ func (s *state{{.v}}) decodeTransaction(val *cbg.Deferred) (Transaction, error)
|
||||
func (s *state{{.v}}) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) ActorKey() string {
|
||||
return actors.MultisigKey
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version{{.v}}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package multisig
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -10,9 +11,11 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
|
||||
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -114,3 +117,20 @@ func (s *state0) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
||||
func (s *state0) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state0) ActorKey() string {
|
||||
return actors.MultisigKey
|
||||
}
|
||||
|
||||
func (s *state0) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version0
|
||||
}
|
||||
|
||||
func (s *state0) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package multisig
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -10,9 +11,11 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
msig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig"
|
||||
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -114,3 +117,20 @@ func (s *state2) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
||||
func (s *state2) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state2) ActorKey() string {
|
||||
return actors.MultisigKey
|
||||
}
|
||||
|
||||
func (s *state2) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version2
|
||||
}
|
||||
|
||||
func (s *state2) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package multisig
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -10,10 +11,12 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
||||
msig3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/multisig"
|
||||
adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -115,3 +118,20 @@ func (s *state3) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
||||
func (s *state3) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state3) ActorKey() string {
|
||||
return actors.MultisigKey
|
||||
}
|
||||
|
||||
func (s *state3) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version3
|
||||
}
|
||||
|
||||
func (s *state3) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package multisig
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -10,10 +11,12 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
||||
msig4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/multisig"
|
||||
adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -115,3 +118,20 @@ func (s *state4) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
||||
func (s *state4) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state4) ActorKey() string {
|
||||
return actors.MultisigKey
|
||||
}
|
||||
|
||||
func (s *state4) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version4
|
||||
}
|
||||
|
||||
func (s *state4) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package multisig
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -10,10 +11,12 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
||||
msig5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/multisig"
|
||||
adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -115,3 +118,20 @@ func (s *state5) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
||||
func (s *state5) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state5) ActorKey() string {
|
||||
return actors.MultisigKey
|
||||
}
|
||||
|
||||
func (s *state5) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version5
|
||||
}
|
||||
|
||||
func (s *state5) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package multisig
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -10,10 +11,12 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
||||
msig6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/multisig"
|
||||
adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -115,3 +118,20 @@ func (s *state6) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
||||
func (s *state6) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state6) ActorKey() string {
|
||||
return actors.MultisigKey
|
||||
}
|
||||
|
||||
func (s *state6) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version6
|
||||
}
|
||||
|
||||
func (s *state6) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package multisig
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -10,10 +11,12 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||
msig7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/multisig"
|
||||
adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -115,3 +118,20 @@ func (s *state7) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
||||
func (s *state7) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state7) ActorKey() string {
|
||||
return actors.MultisigKey
|
||||
}
|
||||
|
||||
func (s *state7) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version7
|
||||
}
|
||||
|
||||
func (s *state7) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package multisig
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -10,10 +11,12 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||
msig8 "github.com/filecoin-project/go-state-types/builtin/v8/multisig"
|
||||
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -115,3 +118,20 @@ func (s *state8) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
||||
func (s *state8) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state8) ActorKey() string {
|
||||
return actors.MultisigKey
|
||||
}
|
||||
|
||||
func (s *state8) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version8
|
||||
}
|
||||
|
||||
func (s *state8) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package multisig
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
@ -10,10 +11,12 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin9 "github.com/filecoin-project/go-state-types/builtin"
|
||||
msig9 "github.com/filecoin-project/go-state-types/builtin/v9/multisig"
|
||||
adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -115,3 +118,20 @@ func (s *state9) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
||||
func (s *state9) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state9) ActorKey() string {
|
||||
return actors.MultisigKey
|
||||
}
|
||||
|
||||
func (s *state9) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version9
|
||||
}
|
||||
|
||||
func (s *state9) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
package paych
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/ipfs/go-cid"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
|
||||
@ -59,6 +61,11 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
// versions
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
Code() cid.Cid
|
||||
ActorKey() string
|
||||
ActorVersion() actorstypes.Version
|
||||
|
||||
// Channel owner, who has funded the actor
|
||||
From() (address.Address, error)
|
||||
// Recipient of payouts from channel
|
||||
@ -132,4 +139,11 @@ func toV0SignedVoucher(sv paychtypes.SignedVoucher) paych0.SignedVoucher {
|
||||
Merges: nil,
|
||||
Signature: sv.Signature,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func AllCodes() []cid.Cid {
|
||||
return []cid.Cid{ {{range .versions}}
|
||||
(&state{{.}}{}).Code(),
|
||||
{{- end}}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
ipldcbor "github.com/ipfs/go-ipld-cbor"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
@ -77,6 +78,11 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
// versions
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
Code() cid.Cid
|
||||
ActorKey() string
|
||||
ActorVersion() actorstypes.Version
|
||||
|
||||
// Channel owner, who has funded the actor
|
||||
From() (address.Address, error)
|
||||
// Recipient of payouts from channel
|
||||
@ -175,3 +181,17 @@ func toV0SignedVoucher(sv paychtypes.SignedVoucher) paych0.SignedVoucher {
|
||||
Signature: sv.Signature,
|
||||
}
|
||||
}
|
||||
|
||||
func AllCodes() []cid.Cid {
|
||||
return []cid.Cid{
|
||||
(&state0{}).Code(),
|
||||
(&state2{}).Code(),
|
||||
(&state3{}).Code(),
|
||||
(&state4{}).Code(),
|
||||
(&state5{}).Code(),
|
||||
(&state6{}).Code(),
|
||||
(&state7{}).Code(),
|
||||
(&state8{}).Code(),
|
||||
(&state9{}).Code(),
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package paych
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
@ -8,6 +10,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
|
||||
{{if (le .v 7)}}
|
||||
paych{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/paych"
|
||||
@ -117,3 +120,20 @@ func (ls *laneState{{.v}}) Redeemed() (big.Int, error) {
|
||||
func (ls *laneState{{.v}}) Nonce() (uint64, error) {
|
||||
return ls.LaneState.Nonce, nil
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) ActorKey() string {
|
||||
return actors.PaychKey
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version{{.v}}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,14 +1,18 @@
|
||||
package paych
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -111,3 +115,20 @@ func (ls *laneState0) Redeemed() (big.Int, error) {
|
||||
func (ls *laneState0) Nonce() (uint64, error) {
|
||||
return ls.LaneState.Nonce, nil
|
||||
}
|
||||
|
||||
func (s *state0) ActorKey() string {
|
||||
return actors.PaychKey
|
||||
}
|
||||
|
||||
func (s *state0) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version0
|
||||
}
|
||||
|
||||
func (s *state0) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,14 +1,18 @@
|
||||
package paych
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
paych2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/paych"
|
||||
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -111,3 +115,20 @@ func (ls *laneState2) Redeemed() (big.Int, error) {
|
||||
func (ls *laneState2) Nonce() (uint64, error) {
|
||||
return ls.LaneState.Nonce, nil
|
||||
}
|
||||
|
||||
func (s *state2) ActorKey() string {
|
||||
return actors.PaychKey
|
||||
}
|
||||
|
||||
func (s *state2) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version2
|
||||
}
|
||||
|
||||
func (s *state2) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,14 +1,18 @@
|
||||
package paych
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
paych3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/paych"
|
||||
adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -111,3 +115,20 @@ func (ls *laneState3) Redeemed() (big.Int, error) {
|
||||
func (ls *laneState3) Nonce() (uint64, error) {
|
||||
return ls.LaneState.Nonce, nil
|
||||
}
|
||||
|
||||
func (s *state3) ActorKey() string {
|
||||
return actors.PaychKey
|
||||
}
|
||||
|
||||
func (s *state3) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version3
|
||||
}
|
||||
|
||||
func (s *state3) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,14 +1,18 @@
|
||||
package paych
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
paych4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/paych"
|
||||
adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -111,3 +115,20 @@ func (ls *laneState4) Redeemed() (big.Int, error) {
|
||||
func (ls *laneState4) Nonce() (uint64, error) {
|
||||
return ls.LaneState.Nonce, nil
|
||||
}
|
||||
|
||||
func (s *state4) ActorKey() string {
|
||||
return actors.PaychKey
|
||||
}
|
||||
|
||||
func (s *state4) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version4
|
||||
}
|
||||
|
||||
func (s *state4) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,14 +1,18 @@
|
||||
package paych
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
paych5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/paych"
|
||||
adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -111,3 +115,20 @@ func (ls *laneState5) Redeemed() (big.Int, error) {
|
||||
func (ls *laneState5) Nonce() (uint64, error) {
|
||||
return ls.LaneState.Nonce, nil
|
||||
}
|
||||
|
||||
func (s *state5) ActorKey() string {
|
||||
return actors.PaychKey
|
||||
}
|
||||
|
||||
func (s *state5) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version5
|
||||
}
|
||||
|
||||
func (s *state5) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,14 +1,18 @@
|
||||
package paych
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
paych6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/paych"
|
||||
adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -111,3 +115,20 @@ func (ls *laneState6) Redeemed() (big.Int, error) {
|
||||
func (ls *laneState6) Nonce() (uint64, error) {
|
||||
return ls.LaneState.Nonce, nil
|
||||
}
|
||||
|
||||
func (s *state6) ActorKey() string {
|
||||
return actors.PaychKey
|
||||
}
|
||||
|
||||
func (s *state6) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version6
|
||||
}
|
||||
|
||||
func (s *state6) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,14 +1,18 @@
|
||||
package paych
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
paych7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/paych"
|
||||
adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -111,3 +115,20 @@ func (ls *laneState7) Redeemed() (big.Int, error) {
|
||||
func (ls *laneState7) Nonce() (uint64, error) {
|
||||
return ls.LaneState.Nonce, nil
|
||||
}
|
||||
|
||||
func (s *state7) ActorKey() string {
|
||||
return actors.PaychKey
|
||||
}
|
||||
|
||||
func (s *state7) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version7
|
||||
}
|
||||
|
||||
func (s *state7) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,14 +1,18 @@
|
||||
package paych
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
paych8 "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -111,3 +115,20 @@ func (ls *laneState8) Redeemed() (big.Int, error) {
|
||||
func (ls *laneState8) Nonce() (uint64, error) {
|
||||
return ls.LaneState.Nonce, nil
|
||||
}
|
||||
|
||||
func (s *state8) ActorKey() string {
|
||||
return actors.PaychKey
|
||||
}
|
||||
|
||||
func (s *state8) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version8
|
||||
}
|
||||
|
||||
func (s *state8) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,14 +1,18 @@
|
||||
package paych
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
paych9 "github.com/filecoin-project/go-state-types/builtin/v9/paych"
|
||||
adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
@ -111,3 +115,20 @@ func (ls *laneState9) Redeemed() (big.Int, error) {
|
||||
func (ls *laneState9) Nonce() (uint64, error) {
|
||||
return ls.LaneState.Nonce, nil
|
||||
}
|
||||
|
||||
func (s *state9) ActorKey() string {
|
||||
return actors.PaychKey
|
||||
}
|
||||
|
||||
func (s *state9) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version9
|
||||
}
|
||||
|
||||
func (s *state9) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package power
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
@ -69,6 +70,10 @@ func MakeState(store adt.Store, av actorstypes.Version) (State, error) {
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
Code() cid.Cid
|
||||
ActorKey() string
|
||||
ActorVersion() actorstypes.Version
|
||||
|
||||
TotalLocked() (abi.TokenAmount, error)
|
||||
TotalPower() (Claim, error)
|
||||
TotalCommitted() (Claim, error)
|
||||
@ -109,3 +114,10 @@ func AddClaims(a Claim, b Claim) Claim {
|
||||
QualityAdjPower: big.Add(a.QualityAdjPower, b.QualityAdjPower),
|
||||
}
|
||||
}
|
||||
|
||||
func AllCodes() []cid.Cid {
|
||||
return []cid.Cid{ {{range .versions}}
|
||||
(&state{{.}}{}).Code(),
|
||||
{{- end}}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package power
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
@ -111,6 +112,10 @@ func MakeState(store adt.Store, av actorstypes.Version) (State, error) {
|
||||
type State interface {
|
||||
cbor.Marshaler
|
||||
|
||||
Code() cid.Cid
|
||||
ActorKey() string
|
||||
ActorVersion() actorstypes.Version
|
||||
|
||||
TotalLocked() (abi.TokenAmount, error)
|
||||
TotalPower() (Claim, error)
|
||||
TotalCommitted() (Claim, error)
|
||||
@ -151,3 +156,17 @@ func AddClaims(a Claim, b Claim) Claim {
|
||||
QualityAdjPower: big.Add(a.QualityAdjPower, b.QualityAdjPower),
|
||||
}
|
||||
}
|
||||
|
||||
func AllCodes() []cid.Cid {
|
||||
return []cid.Cid{
|
||||
(&state0{}).Code(),
|
||||
(&state2{}).Code(),
|
||||
(&state3{}).Code(),
|
||||
(&state4{}).Code(),
|
||||
(&state5{}).Code(),
|
||||
(&state6{}).Code(),
|
||||
(&state7{}).Code(),
|
||||
(&state8{}).Code(),
|
||||
(&state9{}).Code(),
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package power
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"bytes"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
@ -8,6 +10,7 @@ import (
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
|
||||
@ -205,3 +208,20 @@ func fromV{{.v}}Claim(v{{.v}} power{{.v}}.Claim) Claim {
|
||||
QualityAdjPower: v{{.v}}.QualityAdjPower,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) ActorKey() string {
|
||||
return actors.PowerKey
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version{{.v}}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,15 +2,18 @@ package power
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
)
|
||||
@ -188,3 +191,20 @@ func fromV0Claim(v0 power0.Claim) Claim {
|
||||
QualityAdjPower: v0.QualityAdjPower,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state0) ActorKey() string {
|
||||
return actors.PowerKey
|
||||
}
|
||||
|
||||
func (s *state0) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version0
|
||||
}
|
||||
|
||||
func (s *state0) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,15 +2,18 @@ package power
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
power2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/power"
|
||||
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
)
|
||||
@ -188,3 +191,20 @@ func fromV2Claim(v2 power2.Claim) Claim {
|
||||
QualityAdjPower: v2.QualityAdjPower,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state2) ActorKey() string {
|
||||
return actors.PowerKey
|
||||
}
|
||||
|
||||
func (s *state2) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version2
|
||||
}
|
||||
|
||||
func (s *state2) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,16 +2,19 @@ package power
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
||||
power3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/power"
|
||||
adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
)
|
||||
@ -184,3 +187,20 @@ func fromV3Claim(v3 power3.Claim) Claim {
|
||||
QualityAdjPower: v3.QualityAdjPower,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state3) ActorKey() string {
|
||||
return actors.PowerKey
|
||||
}
|
||||
|
||||
func (s *state3) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version3
|
||||
}
|
||||
|
||||
func (s *state3) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,16 +2,19 @@ package power
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
||||
power4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/power"
|
||||
adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
)
|
||||
@ -184,3 +187,20 @@ func fromV4Claim(v4 power4.Claim) Claim {
|
||||
QualityAdjPower: v4.QualityAdjPower,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state4) ActorKey() string {
|
||||
return actors.PowerKey
|
||||
}
|
||||
|
||||
func (s *state4) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version4
|
||||
}
|
||||
|
||||
func (s *state4) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,16 +2,19 @@ package power
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
||||
power5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/power"
|
||||
adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
)
|
||||
@ -184,3 +187,20 @@ func fromV5Claim(v5 power5.Claim) Claim {
|
||||
QualityAdjPower: v5.QualityAdjPower,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state5) ActorKey() string {
|
||||
return actors.PowerKey
|
||||
}
|
||||
|
||||
func (s *state5) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version5
|
||||
}
|
||||
|
||||
func (s *state5) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,16 +2,19 @@ package power
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
||||
power6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/power"
|
||||
adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
)
|
||||
@ -184,3 +187,20 @@ func fromV6Claim(v6 power6.Claim) Claim {
|
||||
QualityAdjPower: v6.QualityAdjPower,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state6) ActorKey() string {
|
||||
return actors.PowerKey
|
||||
}
|
||||
|
||||
func (s *state6) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version6
|
||||
}
|
||||
|
||||
func (s *state6) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,16 +2,19 @@ package power
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||
power7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/power"
|
||||
adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
)
|
||||
@ -184,3 +187,20 @@ func fromV7Claim(v7 power7.Claim) Claim {
|
||||
QualityAdjPower: v7.QualityAdjPower,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state7) ActorKey() string {
|
||||
return actors.PowerKey
|
||||
}
|
||||
|
||||
func (s *state7) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version7
|
||||
}
|
||||
|
||||
func (s *state7) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,16 +2,19 @@ package power
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||
power8 "github.com/filecoin-project/go-state-types/builtin/v8/power"
|
||||
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
)
|
||||
@ -184,3 +187,20 @@ func fromV8Claim(v8 power8.Claim) Claim {
|
||||
QualityAdjPower: v8.QualityAdjPower,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state8) ActorKey() string {
|
||||
return actors.PowerKey
|
||||
}
|
||||
|
||||
func (s *state8) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version8
|
||||
}
|
||||
|
||||
func (s *state8) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
@ -2,16 +2,19 @@ package power
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
builtin9 "github.com/filecoin-project/go-state-types/builtin"
|
||||
power9 "github.com/filecoin-project/go-state-types/builtin/v9/power"
|
||||
adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
)
|
||||
@ -184,3 +187,20 @@ func fromV9Claim(v9 power9.Claim) Claim {
|
||||
QualityAdjPower: v9.QualityAdjPower,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state9) ActorKey() string {
|
||||
return actors.PowerKey
|
||||
}
|
||||
|
||||
func (s *state9) ActorVersion() actorstypes.Version {
|
||||
return actorstypes.Version9
|
||||
}
|
||||
|
||||
func (s *state9) Code() cid.Cid {
|
||||
code, ok := actors.GetActorCodeID(s.ActorVersion(), s.ActorKey())
|
||||
if !ok {
|
||||
panic(fmt.Errorf("didn't find actor %v code id for actor version %d", s.ActorKey(), s.ActorVersion()))
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user