diff --git a/api/api_full.go b/api/api_full.go index bfd5e4f6b..c00daa000 100644 --- a/api/api_full.go +++ b/api/api_full.go @@ -597,6 +597,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 diff --git a/api/mocks/mock_full.go b/api/mocks/mock_full.go index 5aa152c85..7b7459d5f 100644 --- a/api/mocks/mock_full.go +++ b/api/mocks/mock_full.go @@ -2302,6 +2302,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() diff --git a/api/proxy_gen.go b/api/proxy_gen.go index 64855ab0f..a45b96b28 100644 --- a/api/proxy_gen.go +++ b/api/proxy_gen.go @@ -343,6 +343,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"` @@ -2447,6 +2449,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 diff --git a/api/v0api/full.go b/api/v0api/full.go index 15da14411..b9e92224c 100644 --- a/api/v0api/full.go +++ b/api/v0api/full.go @@ -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 diff --git a/api/v0api/proxy_gen.go b/api/v0api/proxy_gen.go index 3e11f6b0d..9f5645f61 100644 --- a/api/v0api/proxy_gen.go +++ b/api/v0api/proxy_gen.go @@ -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 diff --git a/api/v0api/v0mocks/mock_full.go b/api/v0api/v0mocks/mock_full.go index c6bc4111e..ce5e1f59c 100644 --- a/api/v0api/v0mocks/mock_full.go +++ b/api/v0api/v0mocks/mock_full.go @@ -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() diff --git a/build/openrpc/full.json.gz b/build/openrpc/full.json.gz index aeb7555df..b1c063ed7 100644 Binary files a/build/openrpc/full.json.gz and b/build/openrpc/full.json.gz differ diff --git a/build/openrpc/gateway.json.gz b/build/openrpc/gateway.json.gz index 22c4f769f..ab7a63f0a 100644 Binary files a/build/openrpc/gateway.json.gz and b/build/openrpc/gateway.json.gz differ diff --git a/build/openrpc/miner.json.gz b/build/openrpc/miner.json.gz index 7177e4f07..d0a852b1c 100644 Binary files a/build/openrpc/miner.json.gz and b/build/openrpc/miner.json.gz differ diff --git a/build/openrpc/worker.json.gz b/build/openrpc/worker.json.gz index c2201b2df..a42d5c73a 100644 Binary files a/build/openrpc/worker.json.gz and b/build/openrpc/worker.json.gz differ diff --git a/documentation/en/api-v0-methods.md b/documentation/en/api-v0-methods.md index b090a7a53..75459001a 100644 --- a/documentation/en/api-v0-methods.md +++ b/documentation/en/api-v0-methods.md @@ -159,6 +159,7 @@ * [State](#State) * [StateAccountKey](#StateAccountKey) * [StateActorCodeCIDs](#StateActorCodeCIDs) + * [StateActorManifestCID](#StateActorManifestCID) * [StateAllMinerFaults](#StateAllMinerFaults) * [StateCall](#StateCall) * [StateChangedActors](#StateChangedActors) @@ -4658,6 +4659,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 diff --git a/documentation/en/api-v1-unstable-methods.md b/documentation/en/api-v1-unstable-methods.md index 0afad3fb0..b11b47bc8 100644 --- a/documentation/en/api-v1-unstable-methods.md +++ b/documentation/en/api-v1-unstable-methods.md @@ -167,6 +167,7 @@ * [State](#State) * [StateAccountKey](#StateAccountKey) * [StateActorCodeCIDs](#StateActorCodeCIDs) + * [StateActorManifestCID](#StateActorManifestCID) * [StateAllMinerFaults](#StateAllMinerFaults) * [StateCall](#StateCall) * [StateChangedActors](#StateChangedActors) @@ -5089,6 +5090,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 diff --git a/node/impl/full/state.go b/node/impl/full/state.go index 62483ebba..d9d4f8644 100644 --- a/node/impl/full/state.go +++ b/node/impl/full/state.go @@ -1537,6 +1537,20 @@ func (a *StateAPI) StateActorCodeCIDs(ctx context.Context, nv network.Version) ( 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) }