Add v3 actors support for account

This commit is contained in:
Aayush Rajasekaran 2021-01-15 23:14:20 -05:00 committed by Steven Allen
parent ba3b32cfe7
commit 3961e3daf8
2 changed files with 33 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import (
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
) )
func init() { func init() {
@ -32,6 +33,8 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
return load0(store, act.Head) return load0(store, act.Head)
case builtin2.AccountActorCodeID: case builtin2.AccountActorCodeID:
return load2(store, act.Head) return load2(store, act.Head)
case builtin3.AccountActorCodeID:
return load3(store, act.Head)
} }
return nil, xerrors.Errorf("unknown actor code %s", act.Code) return nil, xerrors.Errorf("unknown actor code %s", act.Code)
} }

View File

@ -0,0 +1,30 @@
package account
import (
"github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/lotus/chain/actors/adt"
account3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/account"
)
var _ State = (*state3)(nil)
func load3(store adt.Store, root cid.Cid) (State, error) {
out := state3{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
type state3 struct {
account3.State
store adt.Store
}
func (s *state3) PubkeyAddress() (address.Address, error) {
return s.Address, nil
}