Add system_dryRun RPCs (#2363)

* Add system_dryRun RPCs

* CHANGELOG
This commit is contained in:
Jaco Greeff
2020-06-18 10:15:41 +02:00
committed by GitHub
parent 5a4ff5420f
commit 5c5db2709b
14 changed files with 192 additions and 106 deletions
+29 -14
View File
@@ -31,14 +31,14 @@ import { AbridgedCandidateReceipt, AttestedCandidate, AuctionIndex, Bidder, Cand
import { RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
import { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
import { RpcMethods } from '@polkadot/types/interfaces/rpc';
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, DispatchClass, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, ExtrinsicsWeight, Fixed128, Fixed64, H160, H256, H512, Hash, Header, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, Origin, Pays, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, ProxyType, RuntimeDbWeight, Seal, SealV0, SignedBlock, StorageData, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, ExtrinsicsWeight, Fixed128, Fixed64, H160, H256, H512, Hash, Header, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, Origin, Pays, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, ProxyType, RuntimeDbWeight, Seal, SealV0, SignedBlock, StorageData, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, TaskAddress } from '@polkadot/types/interfaces/scheduler';
import { FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, ValidatorCount } from '@polkadot/types/interfaces/session';
import { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
import { ActiveEraInfo, CompactAssignments, CompactScore, ElectionCompute, ElectionResult, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, OffchainAccuracy, PerU16, PhragmenScore, Points, ReleasesStaking, RewardDestination, RewardPoint, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196 } from '@polkadot/types/interfaces/staking';
import { ApiId, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/state';
import { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
import { AccountInfo, ChainProperties, ChainType, DigestOf, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, EventRecordTo76, Health, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, Phase, RefCount } from '@polkadot/types/interfaces/system';
import { AccountInfo, ApplyExtrinsicResult, ChainProperties, ChainType, DigestOf, DispatchClass, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, DispatchOutcome, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, EventRecordTo76, Health, InvalidTransaction, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, Phase, RefCount, TransactionValidityError, UnknownTransaction } from '@polkadot/types/interfaces/system';
import { OpenTip, OpenTipFinder, OpenTipTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import { Multiplier } from '@polkadot/types/interfaces/txpayment';
import { CallHash, Multisig, Timepoint } from '@polkadot/types/interfaces/utility';
@@ -171,18 +171,6 @@ declare module '@polkadot/types/types/registry' {
DigestItem: DigestItem;
'Option<DigestItem>': Option<DigestItem>;
'Vec<DigestItem>': Vec<DigestItem>;
DispatchClass: DispatchClass;
'Option<DispatchClass>': Option<DispatchClass>;
'Vec<DispatchClass>': Vec<DispatchClass>;
DispatchInfo: DispatchInfo;
'Option<DispatchInfo>': Option<DispatchInfo>;
'Vec<DispatchInfo>': Vec<DispatchInfo>;
DispatchInfoTo190: DispatchInfoTo190;
'Option<DispatchInfoTo190>': Option<DispatchInfoTo190>;
'Vec<DispatchInfoTo190>': Vec<DispatchInfoTo190>;
DispatchInfoTo244: DispatchInfoTo244;
'Option<DispatchInfoTo244>': Option<DispatchInfoTo244>;
'Vec<DispatchInfoTo244>': Vec<DispatchInfoTo244>;
ExtrinsicsWeight: ExtrinsicsWeight;
'Option<ExtrinsicsWeight>': Option<ExtrinsicsWeight>;
'Vec<ExtrinsicsWeight>': Vec<ExtrinsicsWeight>;
@@ -1008,6 +996,9 @@ declare module '@polkadot/types/types/registry' {
AccountInfo: AccountInfo;
'Option<AccountInfo>': Option<AccountInfo>;
'Vec<AccountInfo>': Vec<AccountInfo>;
ApplyExtrinsicResult: ApplyExtrinsicResult;
'Option<ApplyExtrinsicResult>': Option<ApplyExtrinsicResult>;
'Vec<ApplyExtrinsicResult>': Vec<ApplyExtrinsicResult>;
ChainProperties: ChainProperties;
'Option<ChainProperties>': Option<ChainProperties>;
'Vec<ChainProperties>': Vec<ChainProperties>;
@@ -1017,6 +1008,9 @@ declare module '@polkadot/types/types/registry' {
DigestOf: DigestOf;
'Option<DigestOf>': Option<DigestOf>;
'Vec<DigestOf>': Vec<DigestOf>;
DispatchClass: DispatchClass;
'Option<DispatchClass>': Option<DispatchClass>;
'Vec<DispatchClass>': Vec<DispatchClass>;
DispatchError: DispatchError;
'Option<DispatchError>': Option<DispatchError>;
'Vec<DispatchError>': Vec<DispatchError>;
@@ -1026,6 +1020,18 @@ declare module '@polkadot/types/types/registry' {
DispatchErrorTo198: DispatchErrorTo198;
'Option<DispatchErrorTo198>': Option<DispatchErrorTo198>;
'Vec<DispatchErrorTo198>': Vec<DispatchErrorTo198>;
DispatchInfo: DispatchInfo;
'Option<DispatchInfo>': Option<DispatchInfo>;
'Vec<DispatchInfo>': Vec<DispatchInfo>;
DispatchInfoTo190: DispatchInfoTo190;
'Option<DispatchInfoTo190>': Option<DispatchInfoTo190>;
'Vec<DispatchInfoTo190>': Vec<DispatchInfoTo190>;
DispatchInfoTo244: DispatchInfoTo244;
'Option<DispatchInfoTo244>': Option<DispatchInfoTo244>;
'Vec<DispatchInfoTo244>': Vec<DispatchInfoTo244>;
DispatchOutcome: DispatchOutcome;
'Option<DispatchOutcome>': Option<DispatchOutcome>;
'Vec<DispatchOutcome>': Vec<DispatchOutcome>;
DispatchResult: DispatchResult;
'Option<DispatchResult>': Option<DispatchResult>;
'Vec<DispatchResult>': Vec<DispatchResult>;
@@ -1054,6 +1060,9 @@ declare module '@polkadot/types/types/registry' {
Health: Health;
'Option<Health>': Option<Health>;
'Vec<Health>': Vec<Health>;
InvalidTransaction: InvalidTransaction;
'Option<InvalidTransaction>': Option<InvalidTransaction>;
'Vec<InvalidTransaction>': Vec<InvalidTransaction>;
Key: Key;
'Option<Key>': Option<Key>;
'Vec<Key>': Vec<Key>;
@@ -1097,6 +1106,12 @@ declare module '@polkadot/types/types/registry' {
'Compact<RefCount>': Compact<RefCount>;
'Option<RefCount>': Option<RefCount>;
'Vec<RefCount>': Vec<RefCount>;
TransactionValidityError: TransactionValidityError;
'Option<TransactionValidityError>': Option<TransactionValidityError>;
'Vec<TransactionValidityError>': Vec<TransactionValidityError>;
UnknownTransaction: UnknownTransaction;
'Option<UnknownTransaction>': Option<UnknownTransaction>;
'Vec<UnknownTransaction>': Vec<UnknownTransaction>;
OpenTip: OpenTip;
'Option<OpenTip>': Option<OpenTip>;
'Vec<OpenTip>': Vec<OpenTip>;
@@ -1,25 +0,0 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
rpc: {
nextIndex: {
alias: ['system_accountNextIndex'],
description: 'Retrieves the next accountIndex as available on the node',
params: [
{
name: 'accountId',
type: 'AccountId'
}
],
type: 'Index'
}
},
types: {}
} as Definitions;
@@ -1,4 +0,0 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
export * from './types';
@@ -1,4 +0,0 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
export type PHANTOM_ACCOUNT = 'account';
@@ -45,7 +45,6 @@ export { default as metadata } from './metadata/definitions';
export { default as rpc } from './rpc/definitions';
// rpc-only definitions
export { default as account } from './account/definitions';
export { default as author } from './author/definitions';
export { default as chain } from './chain/definitions';
export { default as childstate } from './childstate/definitions';
@@ -2,7 +2,8 @@
/* eslint-disable */
import { Struct } from '@polkadot/types/codec';
import { Balance, DispatchClass, Weight } from '@polkadot/types/interfaces/runtime';
import { Balance, Weight } from '@polkadot/types/interfaces/runtime';
import { DispatchClass } from '@polkadot/types/interfaces/system';
/** @name RuntimeDispatchInfo */
export interface RuntimeDispatchInfo extends Struct {
@@ -39,23 +39,6 @@ export default {
PreRuntime: 'PreRuntime' // 6
}
},
DispatchClass: {
_enum: ['Normal', 'Operational', 'Mandatory']
},
DispatchInfo: {
weight: 'Weight',
class: 'DispatchClass',
paysFee: 'Pays'
},
DispatchInfoTo190: {
weight: 'Weight',
class: 'DispatchClass'
},
DispatchInfoTo244: {
weight: 'Weight',
class: 'DispatchClass',
paysFee: 'bool'
},
ExtrinsicsWeight: {
normal: 'Weight',
operational: 'Weight'
+1 -28
View File
@@ -4,7 +4,7 @@
import { ITuple } from '@polkadot/types/types';
import { Compact, Enum, Int, Struct, U8aFixed, Vec } from '@polkadot/types/codec';
import { GenericAccountId, GenericAccountIndex, GenericAddress, GenericBlock, GenericCall, GenericConsensusEngineId } from '@polkadot/types/generic';
import { Bytes, DoNotConstruct, Null, StorageKey, bool, u128, u32, u64, u8 } from '@polkadot/types/primitive';
import { Bytes, DoNotConstruct, Null, StorageKey, u128, u32, u64, u8 } from '@polkadot/types/primitive';
import { AuthorityId } from '@polkadot/types/interfaces/consensus';
import { Signature } from '@polkadot/types/interfaces/extrinsics';
@@ -73,33 +73,6 @@ export interface DigestItem extends Enum {
readonly asPreRuntime: PreRuntime;
}
/** @name DispatchClass */
export interface DispatchClass extends Enum {
readonly isNormal: boolean;
readonly isOperational: boolean;
readonly isMandatory: boolean;
}
/** @name DispatchInfo */
export interface DispatchInfo extends Struct {
readonly weight: Weight;
readonly class: DispatchClass;
readonly paysFee: Pays;
}
/** @name DispatchInfoTo190 */
export interface DispatchInfoTo190 extends Struct {
readonly weight: Weight;
readonly class: DispatchClass;
}
/** @name DispatchInfoTo244 */
export interface DispatchInfoTo244 extends Struct {
readonly weight: Weight;
readonly class: DispatchClass;
readonly paysFee: bool;
}
/** @name ExtrinsicsWeight */
export interface ExtrinsicsWeight extends Struct {
readonly normal: Weight;
@@ -9,6 +9,33 @@ import { Definitions } from '../../types';
export default {
rpc: {
accountNextIndex: {
alias: ['account_nextIndex'],
description: 'Retrieves the next accountIndex as available on the node',
params: [
{
name: 'accountId',
type: 'AccountId'
}
],
type: 'Index'
},
dryRun: {
alias: ['system_dryRunAt'],
description: 'Dry run an extrinsic at a given block',
params: [
{
name: 'extrinsic',
type: 'Bytes'
},
{
name: 'at',
type: 'BlockHash',
isOptional: true
}
],
type: 'ApplyExtrinsicResult'
},
name: {
description: 'Retrieves the node name',
params: [],
@@ -91,6 +118,7 @@ export default {
refcount: 'RefCount',
data: 'AccountData'
},
ApplyExtrinsicResult: 'Result<DispatchOutcome, TransactionValidityError>',
ChainProperties: {
ss58Format: 'Option<u8>',
tokenDecimals: 'Option<u32>',
@@ -105,6 +133,9 @@ export default {
}
},
DigestOf: 'Digest',
DispatchClass: {
_enum: ['Normal', 'Operational', 'Mandatory']
},
DispatchError: {
_enum: {
Other: 'Null',
@@ -121,6 +152,21 @@ export default {
module: 'Option<u8>',
error: 'u8'
},
DispatchInfo: {
weight: 'Weight',
class: 'DispatchClass',
paysFee: 'Pays'
},
DispatchInfoTo190: {
weight: 'Weight',
class: 'DispatchClass'
},
DispatchInfoTo244: {
weight: 'Weight',
class: 'DispatchClass',
paysFee: 'bool'
},
DispatchOutcome: 'Result<(), DispatchError>',
DispatchResult: 'Result<(), DispatchError>',
DispatchResultOf: 'DispatchResult',
DispatchResultTo198: 'Result<(), Text>',
@@ -141,6 +187,20 @@ export default {
isSyncing: 'bool',
shouldHavePeers: 'bool'
},
InvalidTransaction: {
_enum: {
Call: 'Null',
Payment: 'Null',
Future: 'Null',
Stale: 'Null',
BadProof: 'Null',
AncientBirthBlock: 'Null',
ExhaustsResources: 'Null',
Custom: 'u8',
BadMandatory: 'Null',
MandatoryDispatch: 'Null'
}
},
Key: 'Bytes',
LastRuntimeUpgradeInfo: {
specVersion: 'Compact<u32>',
@@ -214,6 +274,19 @@ export default {
Initialization: 'Null'
}
},
RefCount: 'u8'
RefCount: 'u8',
TransactionValidityError: {
_enum: {
Invalid: 'InvalidTransaction',
Unknown: 'UnknownTransaction'
}
},
UnknownTransaction: {
_enum: {
CannotLookup: 'Null',
NoUnsignedValidator: 'Null',
Custom: 'u8'
}
}
}
} as Definitions;
+75 -1
View File
@@ -6,7 +6,7 @@ import { Compact, Enum, HashMap, Option, Result, Struct, U8aFixed, Vec } from '@
import { GenericEvent } from '@polkadot/types/generic';
import { Bytes, Text, bool, u32, u64, u8 } from '@polkadot/types/primitive';
import { AccountData } from '@polkadot/types/interfaces/balances';
import { BlockNumber, Digest, Hash, Index } from '@polkadot/types/interfaces/runtime';
import { BlockNumber, Digest, Hash, Index, Pays, Weight } from '@polkadot/types/interfaces/runtime';
/** @name AccountInfo */
export interface AccountInfo extends Struct {
@@ -15,6 +15,14 @@ export interface AccountInfo extends Struct {
readonly data: AccountData;
}
/** @name ApplyExtrinsicResult */
export interface ApplyExtrinsicResult extends Result<DispatchOutcome, TransactionValidityError> {
readonly isError: boolean;
readonly asError: TransactionValidityError;
readonly isOk: boolean;
readonly asOk: DispatchOutcome;
}
/** @name ChainProperties */
export interface ChainProperties extends Struct {
readonly ss58Format: Option<u8>;
@@ -34,6 +42,13 @@ export interface ChainType extends Enum {
/** @name DigestOf */
export interface DigestOf extends Digest {}
/** @name DispatchClass */
export interface DispatchClass extends Enum {
readonly isNormal: boolean;
readonly isOperational: boolean;
readonly isMandatory: boolean;
}
/** @name DispatchError */
export interface DispatchError extends Enum {
readonly isOther: boolean;
@@ -55,6 +70,34 @@ export interface DispatchErrorTo198 extends Struct {
readonly error: u8;
}
/** @name DispatchInfo */
export interface DispatchInfo extends Struct {
readonly weight: Weight;
readonly class: DispatchClass;
readonly paysFee: Pays;
}
/** @name DispatchInfoTo190 */
export interface DispatchInfoTo190 extends Struct {
readonly weight: Weight;
readonly class: DispatchClass;
}
/** @name DispatchInfoTo244 */
export interface DispatchInfoTo244 extends Struct {
readonly weight: Weight;
readonly class: DispatchClass;
readonly paysFee: bool;
}
/** @name DispatchOutcome */
export interface DispatchOutcome extends Result<ITuple<[]>, DispatchError> {
readonly isError: boolean;
readonly asError: DispatchError;
readonly isOk: boolean;
readonly asOk: ITuple<[]>;
}
/** @name DispatchResult */
export interface DispatchResult extends Result<ITuple<[]>, DispatchError> {
readonly isError: boolean;
@@ -103,6 +146,21 @@ export interface Health extends Struct {
readonly shouldHavePeers: bool;
}
/** @name InvalidTransaction */
export interface InvalidTransaction extends Enum {
readonly isCall: boolean;
readonly isPayment: boolean;
readonly isFuture: boolean;
readonly isStale: boolean;
readonly isBadProof: boolean;
readonly isAncientBirthBlock: boolean;
readonly isExhaustsResources: boolean;
readonly isCustom: boolean;
readonly asCustom: u8;
readonly isBadMandatory: boolean;
readonly isMandatoryDispatch: boolean;
}
/** @name Key */
export interface Key extends Bytes {}
@@ -199,4 +257,20 @@ export interface Phase extends Enum {
/** @name RefCount */
export interface RefCount extends u8 {}
/** @name TransactionValidityError */
export interface TransactionValidityError extends Enum {
readonly isInvalid: boolean;
readonly asInvalid: InvalidTransaction;
readonly isUnknown: boolean;
readonly asUnknown: UnknownTransaction;
}
/** @name UnknownTransaction */
export interface UnknownTransaction extends Enum {
readonly isCannotLookup: boolean;
readonly isNoUnsignedValidator: boolean;
readonly isCustom: boolean;
readonly asCustom: u8;
}
export type PHANTOM_SYSTEM = 'system';
-1
View File
@@ -35,7 +35,6 @@ export * from './claims/types';
export * from './parachains/types';
export * from './metadata/types';
export * from './rpc/types';
export * from './account/types';
export * from './author/types';
export * from './chain/types';
export * from './childstate/types';