Extract all unsafe Substrate RPC checks (#5538)
This commit is contained in:
@@ -6,6 +6,7 @@ import type { DefinitionsRpc } from '../../types/index.js';
|
||||
export const rpc: DefinitionsRpc = {
|
||||
hasKey: {
|
||||
description: 'Returns true if the keystore has private keys for the given public key and key type.',
|
||||
isUnsafe: true,
|
||||
params: [
|
||||
{
|
||||
name: 'publicKey',
|
||||
@@ -20,6 +21,7 @@ export const rpc: DefinitionsRpc = {
|
||||
},
|
||||
hasSessionKeys: {
|
||||
description: 'Returns true if the keystore has private keys for the given session public keys.',
|
||||
isUnsafe: true,
|
||||
params: [
|
||||
{
|
||||
name: 'sessionKeys',
|
||||
@@ -30,6 +32,7 @@ export const rpc: DefinitionsRpc = {
|
||||
},
|
||||
insertKey: {
|
||||
description: 'Insert a key into the keystore.',
|
||||
isUnsafe: true,
|
||||
params: [
|
||||
{
|
||||
name: 'keyType',
|
||||
@@ -53,6 +56,7 @@ export const rpc: DefinitionsRpc = {
|
||||
},
|
||||
removeExtrinsic: {
|
||||
description: 'Remove given extrinsic from the pool and temporarily ban it to prevent reimporting',
|
||||
isUnsafe: true,
|
||||
params: [
|
||||
{
|
||||
name: 'bytesOrHash',
|
||||
@@ -63,6 +67,7 @@ export const rpc: DefinitionsRpc = {
|
||||
},
|
||||
rotateKeys: {
|
||||
description: 'Generate new session keys and returns the corresponding public keys',
|
||||
isUnsafe: true,
|
||||
params: [],
|
||||
type: 'Bytes'
|
||||
},
|
||||
|
||||
@@ -6,6 +6,7 @@ import type { DefinitionsRpc } from '../../types/index.js';
|
||||
export const rpc: DefinitionsRpc = {
|
||||
epochAuthorship: {
|
||||
description: 'Returns data about which slots (primary or secondary) can be claimed in the current epoch with the keys in the keystore',
|
||||
isUnsafe: true,
|
||||
params: [],
|
||||
type: 'HashMap<AuthorityId, EpochAuthorship>'
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import type { DefinitionsRpc } from '../../types/index.js';
|
||||
export const rpc: DefinitionsRpc = {
|
||||
getBlockStats: {
|
||||
description: 'Reexecute the specified `block_hash` and gather statistics while doing so',
|
||||
isUnsafe: true,
|
||||
params: [
|
||||
{
|
||||
isHistoric: true,
|
||||
|
||||
@@ -6,6 +6,7 @@ import type { DefinitionsRpc } from '../../types/index.js';
|
||||
export const rpc: DefinitionsRpc = {
|
||||
localStorageGet: {
|
||||
description: 'Get offchain local storage under given key and prefix',
|
||||
isUnsafe: true,
|
||||
params: [
|
||||
{
|
||||
name: 'kind',
|
||||
@@ -20,6 +21,7 @@ export const rpc: DefinitionsRpc = {
|
||||
},
|
||||
localStorageSet: {
|
||||
description: 'Set offchain local storage under given key and prefix',
|
||||
isUnsafe: true,
|
||||
params: [
|
||||
{
|
||||
name: 'kind',
|
||||
|
||||
@@ -215,6 +215,7 @@ export const rpc: DefinitionsRpc = {
|
||||
getPairs: {
|
||||
deprecated: 'Use `api.rpc.state.getKeysPaged` to retrieve keys',
|
||||
description: 'Returns the keys with prefix, leave empty to get all the keys (deprecated: Use getKeysPaged)',
|
||||
isUnsafe: true,
|
||||
params: [
|
||||
{
|
||||
name: 'prefix',
|
||||
@@ -311,6 +312,7 @@ export const rpc: DefinitionsRpc = {
|
||||
},
|
||||
queryStorage: {
|
||||
description: 'Query historical storage entries (by key) starting from a start block',
|
||||
isUnsafe: true,
|
||||
params: [
|
||||
{
|
||||
name: 'keys',
|
||||
@@ -357,6 +359,10 @@ export const rpc: DefinitionsRpc = {
|
||||
},
|
||||
subscribeStorage: {
|
||||
description: 'Subscribes to storage changes for the provided keys',
|
||||
// NOTE Just marking it here to follow the logic - this is unsafe when no
|
||||
// keys are provided (i.e. subscribing to all), generally this is used
|
||||
// extensively with normal subscriptions
|
||||
// isUnsafe: true,
|
||||
params: [
|
||||
{
|
||||
isOptional: true,
|
||||
@@ -373,6 +379,7 @@ export const rpc: DefinitionsRpc = {
|
||||
},
|
||||
traceBlock: {
|
||||
description: 'Provides a way to trace the re-execution of a single block',
|
||||
isUnsafe: true,
|
||||
params: [
|
||||
{
|
||||
name: 'block',
|
||||
@@ -395,6 +402,7 @@ export const rpc: DefinitionsRpc = {
|
||||
},
|
||||
trieMigrationStatus: {
|
||||
description: 'Check current migration state',
|
||||
isUnsafe: true,
|
||||
params: [
|
||||
{
|
||||
isHistoric: true,
|
||||
|
||||
@@ -17,6 +17,7 @@ export const rpc: DefinitionsRpc = {
|
||||
},
|
||||
addLogFilter: {
|
||||
description: 'Adds the supplied directives to the current log filter',
|
||||
isUnsafe: true,
|
||||
params: [
|
||||
{
|
||||
name: 'directives',
|
||||
@@ -27,6 +28,7 @@ export const rpc: DefinitionsRpc = {
|
||||
},
|
||||
addReservedPeer: {
|
||||
description: 'Adds a reserved peer',
|
||||
isUnsafe: true,
|
||||
params: [
|
||||
{
|
||||
name: 'peer',
|
||||
@@ -48,6 +50,7 @@ export const rpc: DefinitionsRpc = {
|
||||
dryRun: {
|
||||
alias: ['system_dryRunAt'],
|
||||
description: 'Dry run an extrinsic at a given block',
|
||||
isUnsafe: true,
|
||||
params: [
|
||||
{
|
||||
name: 'extrinsic',
|
||||
@@ -86,6 +89,7 @@ export const rpc: DefinitionsRpc = {
|
||||
networkState: {
|
||||
alias: ['system_unstable_networkState'],
|
||||
description: 'Returns current state of the network',
|
||||
isUnsafe: true,
|
||||
params: [],
|
||||
type: 'NetworkState'
|
||||
},
|
||||
@@ -96,6 +100,7 @@ export const rpc: DefinitionsRpc = {
|
||||
},
|
||||
peers: {
|
||||
description: 'Returns the currently connected peers',
|
||||
isUnsafe: true,
|
||||
params: [],
|
||||
type: 'Vec<PeerInfo>'
|
||||
},
|
||||
@@ -106,6 +111,7 @@ export const rpc: DefinitionsRpc = {
|
||||
},
|
||||
removeReservedPeer: {
|
||||
description: 'Remove a reserved peer',
|
||||
isUnsafe: true,
|
||||
params: [
|
||||
{
|
||||
name: 'peerId',
|
||||
@@ -121,6 +127,7 @@ export const rpc: DefinitionsRpc = {
|
||||
},
|
||||
resetLogFilter: {
|
||||
description: 'Resets the log filter to Substrate defaults',
|
||||
isUnsafe: true,
|
||||
params: [],
|
||||
type: 'Null'
|
||||
},
|
||||
|
||||
@@ -42,6 +42,8 @@ export interface DefinitionRpc {
|
||||
endpoint?: string;
|
||||
/** true if this needs a signed submission, e.g. when submitting extrinsics */
|
||||
isSigned?: boolean;
|
||||
/** true if this is an RPC call that has been marked unsafe */
|
||||
isUnsafe?: boolean;
|
||||
/** Don't log any errors if they occur (should be used sparingly for exceptions only) */
|
||||
noErrorLog?: boolean;
|
||||
/** The applicable parameters for the call */
|
||||
|
||||
Reference in New Issue
Block a user