Implement function to access state of system actor

This commit is contained in:
Geoff Stuart 2022-06-06 23:14:16 -04:00
parent 7ff86efba2
commit 81cacd76a7
11 changed files with 60 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/types"
"github.com/ipfs/go-cid"
"golang.org/x/xerrors"
@ -60,4 +61,5 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
type State interface {
GetState() interface{}
GetBuiltinActors() cid.Cid
}

View File

@ -37,3 +37,11 @@ type state{{.v}} struct {
func (s *state{{.v}}) GetState() interface{} {
return &s.State
}
func (s *state{{.v}}) GetBuiltinActors() cid.Cid {
{{if (le .v 7)}}
return cid.Undef
{{else}}
return s.State.BuiltinActors
{{end}}
}

View File

@ -4,6 +4,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
"github.com/ipfs/go-cid"
"golang.org/x/xerrors"
@ -103,4 +104,5 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
type State interface {
GetState() interface{}
GetBuiltinActors() cid.Cid
}

View File

@ -33,3 +33,9 @@ type state0 struct {
func (s *state0) GetState() interface{} {
return &s.State
}
func (s *state0) GetBuiltinActors() cid.Cid {
return cid.Undef
}

View File

@ -33,3 +33,9 @@ type state2 struct {
func (s *state2) GetState() interface{} {
return &s.State
}
func (s *state2) GetBuiltinActors() cid.Cid {
return cid.Undef
}

View File

@ -33,3 +33,9 @@ type state3 struct {
func (s *state3) GetState() interface{} {
return &s.State
}
func (s *state3) GetBuiltinActors() cid.Cid {
return cid.Undef
}

View File

@ -33,3 +33,9 @@ type state4 struct {
func (s *state4) GetState() interface{} {
return &s.State
}
func (s *state4) GetBuiltinActors() cid.Cid {
return cid.Undef
}

View File

@ -33,3 +33,9 @@ type state5 struct {
func (s *state5) GetState() interface{} {
return &s.State
}
func (s *state5) GetBuiltinActors() cid.Cid {
return cid.Undef
}

View File

@ -33,3 +33,9 @@ type state6 struct {
func (s *state6) GetState() interface{} {
return &s.State
}
func (s *state6) GetBuiltinActors() cid.Cid {
return cid.Undef
}

View File

@ -33,3 +33,9 @@ type state7 struct {
func (s *state7) GetState() interface{} {
return &s.State
}
func (s *state7) GetBuiltinActors() cid.Cid {
return cid.Undef
}

View File

@ -33,3 +33,9 @@ type state8 struct {
func (s *state8) GetState() interface{} {
return &s.State
}
func (s *state8) GetBuiltinActors() cid.Cid {
return s.State.BuiltinActors
}