Api call to get actor cids works for versions < 16
This commit is contained in:
parent
709fe5c65e
commit
ed65b4c3bf
@ -593,6 +593,8 @@ type FullNode interface {
|
||||
StateNetworkVersion(context.Context, types.TipSetKey) (apitypes.NetworkVersion, error) //perm:read
|
||||
// StateActorCodeCIDs returns the CIDs of all the builtin actors for the given network version
|
||||
StateActorCodeCIDs(context.Context, abinetwork.Version) (map[string]cid.Cid, error) //perm:read
|
||||
// StateActorManifestCID returns the CID of the builtin actors manifest for the given network version
|
||||
StateActorManifestCID(context.Context, abinetwork.Version) (cid.Cid, error) //perm:read
|
||||
|
||||
// StateGetRandomnessFromTickets is used to sample the chain for randomness.
|
||||
StateGetRandomnessFromTickets(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tsk types.TipSetKey) (abi.Randomness, error) //perm:read
|
||||
|
@ -2288,6 +2288,21 @@ func (mr *MockFullNodeMockRecorder) StateActorCodeCIDs(arg0, arg1 interface{}) *
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateActorCodeCIDs", reflect.TypeOf((*MockFullNode)(nil).StateActorCodeCIDs), arg0, arg1)
|
||||
}
|
||||
|
||||
// StateActorManifestCID mocks base method.
|
||||
func (m *MockFullNode) StateActorManifestCID(arg0 context.Context, arg1 network.Version) (cid.Cid, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateActorManifestCID", arg0, arg1)
|
||||
ret0, _ := ret[0].(cid.Cid)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateActorManifestCID indicates an expected call of StateActorManifestCID.
|
||||
func (mr *MockFullNodeMockRecorder) StateActorManifestCID(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateActorManifestCID", reflect.TypeOf((*MockFullNode)(nil).StateActorManifestCID), arg0, arg1)
|
||||
}
|
||||
|
||||
// StateAllMinerFaults mocks base method.
|
||||
func (m *MockFullNode) StateAllMinerFaults(arg0 context.Context, arg1 abi.ChainEpoch, arg2 types.TipSetKey) ([]*api.Fault, error) {
|
||||
m.ctrl.T.Helper()
|
||||
|
@ -341,6 +341,8 @@ type FullNodeStruct struct {
|
||||
|
||||
StateActorCodeCIDs func(p0 context.Context, p1 abinetwork.Version) (map[string]cid.Cid, error) `perm:"read"`
|
||||
|
||||
StateActorManifestCID func(p0 context.Context, p1 abinetwork.Version) (cid.Cid, error) `perm:"read"`
|
||||
|
||||
StateAllMinerFaults func(p0 context.Context, p1 abi.ChainEpoch, p2 types.TipSetKey) ([]*Fault, error) `perm:"read"`
|
||||
|
||||
StateCall func(p0 context.Context, p1 *types.Message, p2 types.TipSetKey) (*InvocResult, error) `perm:"read"`
|
||||
@ -2412,6 +2414,17 @@ func (s *FullNodeStub) StateActorCodeCIDs(p0 context.Context, p1 abinetwork.Vers
|
||||
return *new(map[string]cid.Cid), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *FullNodeStruct) StateActorManifestCID(p0 context.Context, p1 abinetwork.Version) (cid.Cid, error) {
|
||||
if s.Internal.StateActorManifestCID == nil {
|
||||
return *new(cid.Cid), ErrNotSupported
|
||||
}
|
||||
return s.Internal.StateActorManifestCID(p0, p1)
|
||||
}
|
||||
|
||||
func (s *FullNodeStub) StateActorManifestCID(p0 context.Context, p1 abinetwork.Version) (cid.Cid, error) {
|
||||
return *new(cid.Cid), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *FullNodeStruct) StateAllMinerFaults(p0 context.Context, p1 abi.ChainEpoch, p2 types.TipSetKey) ([]*Fault, error) {
|
||||
if s.Internal.StateAllMinerFaults == nil {
|
||||
return *new([]*Fault), ErrNotSupported
|
||||
|
@ -607,6 +607,8 @@ type FullNode interface {
|
||||
StateNetworkVersion(context.Context, types.TipSetKey) (apitypes.NetworkVersion, error) //perm:read
|
||||
// StateActorCodeCIDs returns the CIDs of all the builtin actors for the given network version
|
||||
StateActorCodeCIDs(context.Context, abinetwork.Version) (map[string]cid.Cid, error) //perm:read
|
||||
// StateActorManifestCID returns the CID of the builtin actors manifest for the given network version
|
||||
StateActorManifestCID(context.Context, abinetwork.Version) (cid.Cid, error) //perm:read
|
||||
|
||||
// StateGetRandomnessFromTickets is used to sample the chain for randomness.
|
||||
StateGetRandomnessFromTickets(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tsk types.TipSetKey) (abi.Randomness, error) //perm:read
|
||||
|
@ -259,6 +259,8 @@ type FullNodeStruct struct {
|
||||
|
||||
StateActorCodeCIDs func(p0 context.Context, p1 abinetwork.Version) (map[string]cid.Cid, error) `perm:"read"`
|
||||
|
||||
StateActorManifestCID func(p0 context.Context, p1 abinetwork.Version) (cid.Cid, error) `perm:"read"`
|
||||
|
||||
StateAllMinerFaults func(p0 context.Context, p1 abi.ChainEpoch, p2 types.TipSetKey) ([]*api.Fault, error) `perm:"read"`
|
||||
|
||||
StateCall func(p0 context.Context, p1 *types.Message, p2 types.TipSetKey) (*api.InvocResult, error) `perm:"read"`
|
||||
@ -1692,6 +1694,17 @@ func (s *FullNodeStub) StateActorCodeCIDs(p0 context.Context, p1 abinetwork.Vers
|
||||
return *new(map[string]cid.Cid), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *FullNodeStruct) StateActorManifestCID(p0 context.Context, p1 abinetwork.Version) (cid.Cid, error) {
|
||||
if s.Internal.StateActorManifestCID == nil {
|
||||
return *new(cid.Cid), ErrNotSupported
|
||||
}
|
||||
return s.Internal.StateActorManifestCID(p0, p1)
|
||||
}
|
||||
|
||||
func (s *FullNodeStub) StateActorManifestCID(p0 context.Context, p1 abinetwork.Version) (cid.Cid, error) {
|
||||
return *new(cid.Cid), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *FullNodeStruct) StateAllMinerFaults(p0 context.Context, p1 abi.ChainEpoch, p2 types.TipSetKey) ([]*api.Fault, error) {
|
||||
if s.Internal.StateAllMinerFaults == nil {
|
||||
return *new([]*api.Fault), ErrNotSupported
|
||||
|
@ -2187,6 +2187,21 @@ func (mr *MockFullNodeMockRecorder) StateActorCodeCIDs(arg0, arg1 interface{}) *
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateActorCodeCIDs", reflect.TypeOf((*MockFullNode)(nil).StateActorCodeCIDs), arg0, arg1)
|
||||
}
|
||||
|
||||
// StateActorManifestCID mocks base method.
|
||||
func (m *MockFullNode) StateActorManifestCID(arg0 context.Context, arg1 network.Version) (cid.Cid, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateActorManifestCID", arg0, arg1)
|
||||
ret0, _ := ret[0].(cid.Cid)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateActorManifestCID indicates an expected call of StateActorManifestCID.
|
||||
func (mr *MockFullNodeMockRecorder) StateActorManifestCID(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateActorManifestCID", reflect.TypeOf((*MockFullNode)(nil).StateActorManifestCID), arg0, arg1)
|
||||
}
|
||||
|
||||
// StateAllMinerFaults mocks base method.
|
||||
func (m *MockFullNode) StateAllMinerFaults(arg0 context.Context, arg1 abi.ChainEpoch, arg2 types.TipSetKey) ([]*api.Fault, error) {
|
||||
m.ctrl.T.Helper()
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
326
chain/actors/actor_cids.go
Normal file
326
chain/actors/actor_cids.go
Normal file
@ -0,0 +1,326 @@
|
||||
package actors
|
||||
|
||||
import (
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
||||
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
||||
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
||||
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||
"github.com/ipfs/go-cid"
|
||||
"golang.org/x/xerrors"
|
||||
)
|
||||
|
||||
// GetActorCodeID looks up a builtin actor's code CID by actor version and canonical actor name.
|
||||
func GetActorCodeID(av Version, name string) (cid.Cid, bool) {
|
||||
|
||||
// Actors V8 and above
|
||||
if cids, ok := GetActorCodeIDsFromManifest(av); ok {
|
||||
if c, ok := cids[name]; ok {
|
||||
return c, true
|
||||
}
|
||||
}
|
||||
|
||||
// Actors V7 and lower
|
||||
switch name {
|
||||
|
||||
case AccountKey:
|
||||
switch av {
|
||||
|
||||
case Version0:
|
||||
return builtin0.AccountActorCodeID, true
|
||||
|
||||
case Version2:
|
||||
return builtin2.AccountActorCodeID, true
|
||||
|
||||
case Version3:
|
||||
return builtin3.AccountActorCodeID, true
|
||||
|
||||
case Version4:
|
||||
return builtin4.AccountActorCodeID, true
|
||||
|
||||
case Version5:
|
||||
return builtin5.AccountActorCodeID, true
|
||||
|
||||
case Version6:
|
||||
return builtin6.AccountActorCodeID, true
|
||||
|
||||
case Version7:
|
||||
return builtin7.AccountActorCodeID, true
|
||||
}
|
||||
|
||||
case CronKey:
|
||||
switch av {
|
||||
|
||||
case Version0:
|
||||
return builtin0.CronActorCodeID, true
|
||||
|
||||
case Version2:
|
||||
return builtin2.CronActorCodeID, true
|
||||
|
||||
case Version3:
|
||||
return builtin3.CronActorCodeID, true
|
||||
|
||||
case Version4:
|
||||
return builtin4.CronActorCodeID, true
|
||||
|
||||
case Version5:
|
||||
return builtin5.CronActorCodeID, true
|
||||
|
||||
case Version6:
|
||||
return builtin6.CronActorCodeID, true
|
||||
|
||||
case Version7:
|
||||
return builtin7.CronActorCodeID, true
|
||||
}
|
||||
|
||||
case InitKey:
|
||||
switch av {
|
||||
|
||||
case Version0:
|
||||
return builtin0.InitActorCodeID, true
|
||||
|
||||
case Version2:
|
||||
return builtin2.InitActorCodeID, true
|
||||
|
||||
case Version3:
|
||||
return builtin3.InitActorCodeID, true
|
||||
|
||||
case Version4:
|
||||
return builtin4.InitActorCodeID, true
|
||||
|
||||
case Version5:
|
||||
return builtin5.InitActorCodeID, true
|
||||
|
||||
case Version6:
|
||||
return builtin6.InitActorCodeID, true
|
||||
|
||||
case Version7:
|
||||
return builtin7.InitActorCodeID, true
|
||||
}
|
||||
|
||||
case MarketKey:
|
||||
switch av {
|
||||
|
||||
case Version0:
|
||||
return builtin0.StorageMarketActorCodeID, true
|
||||
|
||||
case Version2:
|
||||
return builtin2.StorageMarketActorCodeID, true
|
||||
|
||||
case Version3:
|
||||
return builtin3.StorageMarketActorCodeID, true
|
||||
|
||||
case Version4:
|
||||
return builtin4.StorageMarketActorCodeID, true
|
||||
|
||||
case Version5:
|
||||
return builtin5.StorageMarketActorCodeID, true
|
||||
|
||||
case Version6:
|
||||
return builtin6.StorageMarketActorCodeID, true
|
||||
|
||||
case Version7:
|
||||
return builtin7.StorageMarketActorCodeID, true
|
||||
}
|
||||
|
||||
case MinerKey:
|
||||
switch av {
|
||||
|
||||
case Version0:
|
||||
return builtin0.StorageMinerActorCodeID, true
|
||||
|
||||
case Version2:
|
||||
return builtin2.StorageMinerActorCodeID, true
|
||||
|
||||
case Version3:
|
||||
return builtin3.StorageMinerActorCodeID, true
|
||||
|
||||
case Version4:
|
||||
return builtin4.StorageMinerActorCodeID, true
|
||||
|
||||
case Version5:
|
||||
return builtin5.StorageMinerActorCodeID, true
|
||||
|
||||
case Version6:
|
||||
return builtin6.StorageMinerActorCodeID, true
|
||||
|
||||
case Version7:
|
||||
return builtin7.StorageMinerActorCodeID, true
|
||||
}
|
||||
|
||||
case MultisigKey:
|
||||
switch av {
|
||||
|
||||
case Version0:
|
||||
return builtin0.MultisigActorCodeID, true
|
||||
|
||||
case Version2:
|
||||
return builtin2.MultisigActorCodeID, true
|
||||
|
||||
case Version3:
|
||||
return builtin3.MultisigActorCodeID, true
|
||||
|
||||
case Version4:
|
||||
return builtin4.MultisigActorCodeID, true
|
||||
|
||||
case Version5:
|
||||
return builtin5.MultisigActorCodeID, true
|
||||
|
||||
case Version6:
|
||||
return builtin6.MultisigActorCodeID, true
|
||||
|
||||
case Version7:
|
||||
return builtin7.MultisigActorCodeID, true
|
||||
}
|
||||
|
||||
case PaychKey:
|
||||
switch av {
|
||||
|
||||
case Version0:
|
||||
return builtin0.PaymentChannelActorCodeID, true
|
||||
|
||||
case Version2:
|
||||
return builtin2.PaymentChannelActorCodeID, true
|
||||
|
||||
case Version3:
|
||||
return builtin3.PaymentChannelActorCodeID, true
|
||||
|
||||
case Version4:
|
||||
return builtin4.PaymentChannelActorCodeID, true
|
||||
|
||||
case Version5:
|
||||
return builtin5.PaymentChannelActorCodeID, true
|
||||
|
||||
case Version6:
|
||||
return builtin6.PaymentChannelActorCodeID, true
|
||||
|
||||
case Version7:
|
||||
return builtin7.PaymentChannelActorCodeID, true
|
||||
}
|
||||
|
||||
case PowerKey:
|
||||
switch av {
|
||||
|
||||
case Version0:
|
||||
return builtin0.StoragePowerActorCodeID, true
|
||||
|
||||
case Version2:
|
||||
return builtin2.StoragePowerActorCodeID, true
|
||||
|
||||
case Version3:
|
||||
return builtin3.StoragePowerActorCodeID, true
|
||||
|
||||
case Version4:
|
||||
return builtin4.StoragePowerActorCodeID, true
|
||||
|
||||
case Version5:
|
||||
return builtin5.StoragePowerActorCodeID, true
|
||||
|
||||
case Version6:
|
||||
return builtin6.StoragePowerActorCodeID, true
|
||||
|
||||
case Version7:
|
||||
return builtin7.StoragePowerActorCodeID, true
|
||||
}
|
||||
|
||||
case RewardKey:
|
||||
switch av {
|
||||
|
||||
case Version0:
|
||||
return builtin0.RewardActorCodeID, true
|
||||
|
||||
case Version2:
|
||||
return builtin2.RewardActorCodeID, true
|
||||
|
||||
case Version3:
|
||||
return builtin3.RewardActorCodeID, true
|
||||
|
||||
case Version4:
|
||||
return builtin4.RewardActorCodeID, true
|
||||
|
||||
case Version5:
|
||||
return builtin5.RewardActorCodeID, true
|
||||
|
||||
case Version6:
|
||||
return builtin6.RewardActorCodeID, true
|
||||
|
||||
case Version7:
|
||||
return builtin7.RewardActorCodeID, true
|
||||
}
|
||||
|
||||
case SystemKey:
|
||||
switch av {
|
||||
|
||||
case Version0:
|
||||
return builtin0.SystemActorCodeID, true
|
||||
|
||||
case Version2:
|
||||
return builtin2.SystemActorCodeID, true
|
||||
|
||||
case Version3:
|
||||
return builtin3.SystemActorCodeID, true
|
||||
|
||||
case Version4:
|
||||
return builtin4.SystemActorCodeID, true
|
||||
|
||||
case Version5:
|
||||
return builtin5.SystemActorCodeID, true
|
||||
|
||||
case Version6:
|
||||
return builtin6.SystemActorCodeID, true
|
||||
|
||||
case Version7:
|
||||
return builtin7.SystemActorCodeID, true
|
||||
}
|
||||
|
||||
case VerifregKey:
|
||||
switch av {
|
||||
|
||||
case Version0:
|
||||
return builtin0.VerifiedRegistryActorCodeID, true
|
||||
|
||||
case Version2:
|
||||
return builtin2.VerifiedRegistryActorCodeID, true
|
||||
|
||||
case Version3:
|
||||
return builtin3.VerifiedRegistryActorCodeID, true
|
||||
|
||||
case Version4:
|
||||
return builtin4.VerifiedRegistryActorCodeID, true
|
||||
|
||||
case Version5:
|
||||
return builtin5.VerifiedRegistryActorCodeID, true
|
||||
|
||||
case Version6:
|
||||
return builtin6.VerifiedRegistryActorCodeID, true
|
||||
|
||||
case Version7:
|
||||
return builtin7.VerifiedRegistryActorCodeID, true
|
||||
}
|
||||
}
|
||||
|
||||
return cid.Undef, false
|
||||
}
|
||||
|
||||
// GetActorCodeIDs looks up a builtin actor's code CID by actor version.
|
||||
func GetActorCodeIDs(av Version) (map[string]cid.Cid, error) {
|
||||
cids, ok := GetActorCodeIDsFromManifest(av)
|
||||
if ok {
|
||||
return cids, nil
|
||||
}
|
||||
|
||||
actorsKeys := GetBuiltinActorsKeys()
|
||||
synthCids := make(map[string]cid.Cid)
|
||||
|
||||
for _, key := range actorsKeys {
|
||||
c, ok := GetActorCodeID(av, key)
|
||||
if !ok {
|
||||
return nil, xerrors.Errorf("could not find builtin actor cids for Actors version %d", av)
|
||||
}
|
||||
cids[key] = c
|
||||
}
|
||||
|
||||
return synthCids, nil
|
||||
}
|
@ -113,6 +113,15 @@ func ReadManifest(ctx context.Context, store cbor.IpldStore, mfCid cid.Cid) (map
|
||||
return metadata, nil
|
||||
}
|
||||
|
||||
// GetActorCodeIDs looks up a builtin actor's code CID by actor version.
|
||||
func GetActorCodeIDsFromManifest(av Version) (map[string]cid.Cid, bool) {
|
||||
manifestMx.RLock()
|
||||
defer manifestMx.RUnlock()
|
||||
|
||||
cids, ok := manifests[av]
|
||||
return cids, ok
|
||||
}
|
||||
|
||||
// Given a Manifest CID, get the manifest from the store and Load data into its entries
|
||||
func LoadManifest(ctx context.Context, mfCid cid.Cid, adtStore adt.Store) (*manifest.Manifest, error) {
|
||||
var mf manifest.Manifest
|
||||
@ -128,15 +137,6 @@ func LoadManifest(ctx context.Context, mfCid cid.Cid, adtStore adt.Store) (*mani
|
||||
return &mf, nil
|
||||
}
|
||||
|
||||
// GetActorCodeID looks up a builtin actor's code CID by actor version and canonical actor name.
|
||||
func GetActorCodeID(av Version, name string) (cid.Cid, bool) {
|
||||
manifestMx.RLock()
|
||||
defer manifestMx.RUnlock()
|
||||
|
||||
c, ok := manifests[av][name]
|
||||
return c, ok
|
||||
}
|
||||
|
||||
func GetActorMetaByCode(c cid.Cid) (string, Version, bool) {
|
||||
manifestMx.RLock()
|
||||
defer manifestMx.RUnlock()
|
||||
|
19
cli/state.go
19
cli/state.go
@ -1900,19 +1900,7 @@ var StateSysActorCIDsCmd = &cli.Command{
|
||||
|
||||
ctx := ReqContext(cctx)
|
||||
|
||||
ts, err := LoadTipSet(ctx, cctx, api)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
nv, err := api.StateNetworkVersion(ctx, ts.Key())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if cctx.IsSet("network-version") {
|
||||
nv = network.Version(cctx.Uint64("network-version"))
|
||||
}
|
||||
nv := network.Version(cctx.Uint64("network-version"))
|
||||
|
||||
fmt.Printf("Network Version: %d\n", nv)
|
||||
|
||||
@ -1922,6 +1910,11 @@ var StateSysActorCIDsCmd = &cli.Command{
|
||||
}
|
||||
fmt.Printf("Actor Version: %d\n", actorVersion)
|
||||
|
||||
manifestCid, ok := actors.GetManifest(actorVersion)
|
||||
if ok {
|
||||
fmt.Printf("Manifest CID: %v\n", manifestCid)
|
||||
}
|
||||
|
||||
tw := tabwriter.NewWriter(os.Stdout, 2, 4, 2, ' ', 0)
|
||||
_, _ = fmt.Fprintln(tw, "\nActor\tCID\t")
|
||||
|
||||
|
@ -159,6 +159,7 @@
|
||||
* [State](#State)
|
||||
* [StateAccountKey](#StateAccountKey)
|
||||
* [StateActorCodeCIDs](#StateActorCodeCIDs)
|
||||
* [StateActorManifestCID](#StateActorManifestCID)
|
||||
* [StateAllMinerFaults](#StateAllMinerFaults)
|
||||
* [StateCall](#StateCall)
|
||||
* [StateChangedActors](#StateChangedActors)
|
||||
@ -4655,6 +4656,26 @@ Inputs:
|
||||
|
||||
Response: `{}`
|
||||
|
||||
### StateActorManifestCID
|
||||
StateActorManifestCID returns the CID of the builtin actors manifest for the given network version
|
||||
|
||||
|
||||
Perms: read
|
||||
|
||||
Inputs:
|
||||
```json
|
||||
[
|
||||
16
|
||||
]
|
||||
```
|
||||
|
||||
Response:
|
||||
```json
|
||||
{
|
||||
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
|
||||
}
|
||||
```
|
||||
|
||||
### StateAllMinerFaults
|
||||
StateAllMinerFaults returns all non-expired Faults that occur within lookback epochs of the given tipset
|
||||
|
||||
|
@ -166,6 +166,7 @@
|
||||
* [State](#State)
|
||||
* [StateAccountKey](#StateAccountKey)
|
||||
* [StateActorCodeCIDs](#StateActorCodeCIDs)
|
||||
* [StateActorManifestCID](#StateActorManifestCID)
|
||||
* [StateAllMinerFaults](#StateAllMinerFaults)
|
||||
* [StateCall](#StateCall)
|
||||
* [StateChangedActors](#StateChangedActors)
|
||||
@ -5066,6 +5067,26 @@ Inputs:
|
||||
|
||||
Response: `{}`
|
||||
|
||||
### StateActorManifestCID
|
||||
StateActorManifestCID returns the CID of the builtin actors manifest for the given network version
|
||||
|
||||
|
||||
Perms: read
|
||||
|
||||
Inputs:
|
||||
```json
|
||||
[
|
||||
16
|
||||
]
|
||||
```
|
||||
|
||||
Response:
|
||||
```json
|
||||
{
|
||||
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
|
||||
}
|
||||
```
|
||||
|
||||
### StateAllMinerFaults
|
||||
StateAllMinerFaults returns all non-expired Faults that occur within lookback epochs of the given tipset
|
||||
|
||||
|
@ -1529,27 +1529,28 @@ func (a *StateAPI) StateActorCodeCIDs(ctx context.Context, nv network.Version) (
|
||||
return nil, xerrors.Errorf("invalid network version")
|
||||
}
|
||||
|
||||
cids := make(map[string]cid.Cid)
|
||||
|
||||
manifestCid, ok := actors.GetManifest(actorVersion)
|
||||
if !ok {
|
||||
return nil, xerrors.Errorf("cannot get manifest CID")
|
||||
cids, err := actors.GetActorCodeIDs(actorVersion)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("could not find cids for network version %d, actors version %d: %w", nv, actorVersion, err)
|
||||
}
|
||||
|
||||
cids["_manifest"] = manifestCid
|
||||
|
||||
var actorKeys = actors.GetBuiltinActorsKeys()
|
||||
for _, name := range actorKeys {
|
||||
actorCID, ok := actors.GetActorCodeID(actorVersion, name)
|
||||
if !ok {
|
||||
return nil, xerrors.Errorf("didn't find actor %v code id for actor version %d", name,
|
||||
actorVersion)
|
||||
}
|
||||
cids[name] = actorCID
|
||||
}
|
||||
return cids, nil
|
||||
}
|
||||
|
||||
func (a *StateAPI) StateActorManifestCID(ctx context.Context, nv network.Version) (cid.Cid, error) {
|
||||
actorVersion, err := actors.VersionForNetwork(nv)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("invalid network version")
|
||||
}
|
||||
|
||||
c, ok := actors.GetManifest(actorVersion)
|
||||
if !ok {
|
||||
return cid.Undef, xerrors.Errorf("could not find manifest cid for network version %d, actors version %d", nv, actorVersion)
|
||||
}
|
||||
|
||||
return c, nil
|
||||
}
|
||||
|
||||
func (a *StateAPI) StateGetRandomnessFromTickets(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tsk types.TipSetKey) (abi.Randomness, error) {
|
||||
return a.StateManager.GetRandomnessFromTickets(ctx, personalization, randEpoch, entropy, tsk)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user