Api call to get actor cids works for versions < 16

This commit is contained in:
Geoff Stuart
2022-06-29 14:58:56 -04:00
parent 709fe5c65e
commit ed65b4c3bf
15 changed files with 460 additions and 38 deletions
+17 -16
View File
@@ -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)
}