Skip to content

Commit fe5b63f

Browse files
committed
Implement function to access state of system actor
1 parent 8212b2c commit fe5b63f

File tree

11 files changed

+60
-0
lines changed

11 files changed

+60
-0
lines changed

chain/actors/builtin/system/actor.go.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"github.com/filecoin-project/lotus/chain/actors/adt"
55
"github.com/filecoin-project/lotus/chain/actors"
66
"github.com/filecoin-project/lotus/chain/types"
7+
"github.com/ipfs/go-cid"
78

89
"golang.org/x/xerrors"
910

@@ -60,4 +61,5 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
6061

6162
type State interface {
6263
GetState() interface{}
64+
GetBuiltinActors() cid.Cid
6365
}

chain/actors/builtin/system/state.go.template

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,12 @@ type state{{.v}} struct {
3636

3737
func (s *state{{.v}}) GetState() interface{} {
3838
return &s.State
39+
}
40+
41+
func (s *state{{.v}}) GetBuiltinActors() cid.Cid {
42+
{{if (le .v 7)}}
43+
return cid.Undef
44+
{{else}}
45+
return s.State.BuiltinActors
46+
{{end}}
3947
}

chain/actors/builtin/system/system.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"github.com/filecoin-project/lotus/chain/actors"
55
"github.com/filecoin-project/lotus/chain/actors/adt"
66
"github.com/filecoin-project/lotus/chain/types"
7+
"github.com/ipfs/go-cid"
78

89
"golang.org/x/xerrors"
910

@@ -103,4 +104,5 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
103104

104105
type State interface {
105106
GetState() interface{}
107+
GetBuiltinActors() cid.Cid
106108
}

chain/actors/builtin/system/v0.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ type state0 struct {
3333
func (s *state0) GetState() interface{} {
3434
return &s.State
3535
}
36+
37+
func (s *state0) GetBuiltinActors() cid.Cid {
38+
39+
return cid.Undef
40+
41+
}

chain/actors/builtin/system/v2.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ type state2 struct {
3333
func (s *state2) GetState() interface{} {
3434
return &s.State
3535
}
36+
37+
func (s *state2) GetBuiltinActors() cid.Cid {
38+
39+
return cid.Undef
40+
41+
}

chain/actors/builtin/system/v3.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ type state3 struct {
3333
func (s *state3) GetState() interface{} {
3434
return &s.State
3535
}
36+
37+
func (s *state3) GetBuiltinActors() cid.Cid {
38+
39+
return cid.Undef
40+
41+
}

chain/actors/builtin/system/v4.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ type state4 struct {
3333
func (s *state4) GetState() interface{} {
3434
return &s.State
3535
}
36+
37+
func (s *state4) GetBuiltinActors() cid.Cid {
38+
39+
return cid.Undef
40+
41+
}

chain/actors/builtin/system/v5.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ type state5 struct {
3333
func (s *state5) GetState() interface{} {
3434
return &s.State
3535
}
36+
37+
func (s *state5) GetBuiltinActors() cid.Cid {
38+
39+
return cid.Undef
40+
41+
}

chain/actors/builtin/system/v6.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ type state6 struct {
3333
func (s *state6) GetState() interface{} {
3434
return &s.State
3535
}
36+
37+
func (s *state6) GetBuiltinActors() cid.Cid {
38+
39+
return cid.Undef
40+
41+
}

chain/actors/builtin/system/v7.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ type state7 struct {
3333
func (s *state7) GetState() interface{} {
3434
return &s.State
3535
}
36+
37+
func (s *state7) GetBuiltinActors() cid.Cid {
38+
39+
return cid.Undef
40+
41+
}

0 commit comments

Comments
 (0)