Skip to content

Commit

Permalink
1.13 (#2248)
Browse files Browse the repository at this point in the history
* 1.13

* Add grandpa_roundState RPC

* RPC interfaces
  • Loading branch information
jacogr authored May 6, 2020
1 parent 92f62bf commit a1ad90c
Show file tree
Hide file tree
Showing 17 changed files with 150 additions and 74 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 1.13.0-beta.x
# 1.13.1 May 6, 2020

- Add support for ECDSA keypairs in extrinsic signers (Thanks to https://github.com/akru)
- Rework type generation to use templating for better maintenance (Thanks to https://github.com/xlc)
Expand All @@ -8,6 +8,7 @@
- Revert error swallow for wrong preimage data (temp. override for Kusama upgrade with no migration)
- Fix `.encodedLength` calculation on `[Type; N]` types
- Update types & metadata as per latest Substrate master
- Adjust Centrifuge starting version

# 1.12.2 Apr 30, 2020

Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"packages": [
"packages/*"
],
"version": "1.13.0-beta.19"
"version": "1.13.0"
}
8 changes: 4 additions & 4 deletions packages/api-contract/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-contract",
"version": "1.13.0-beta.19",
"version": "1.13.0",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
"keywords": [
Expand All @@ -27,9 +27,9 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": {
"@babel/runtime": "^7.9.6",
"@polkadot/api": "1.13.0-beta.19",
"@polkadot/rpc-core": "1.13.0-beta.19",
"@polkadot/types": "1.13.0-beta.19",
"@polkadot/api": "1.13.0",
"@polkadot/rpc-core": "1.13.0",
"@polkadot/types": "1.13.0",
"@polkadot/util": "^2.9.1",
"bn.js": "^5.1.1",
"rxjs": "^6.5.5"
Expand Down
10 changes: 5 additions & 5 deletions packages/api-derive/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-derive",
"version": "1.13.0-beta.19",
"version": "1.13.0",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
"keywords": [
Expand Down Expand Up @@ -28,10 +28,10 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.9.6",
"@polkadot/api": "1.13.0-beta.19",
"@polkadot/rpc-core": "1.13.0-beta.19",
"@polkadot/rpc-provider": "1.13.0-beta.19",
"@polkadot/types": "1.13.0-beta.19",
"@polkadot/api": "1.13.0",
"@polkadot/rpc-core": "1.13.0",
"@polkadot/rpc-provider": "1.13.0",
"@polkadot/types": "1.13.0",
"@polkadot/util": "^2.9.1",
"@polkadot/util-crypto": "^2.9.1",
"bn.js": "^5.1.1",
Expand Down
14 changes: 7 additions & 7 deletions packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api",
"version": "1.13.0-beta.19",
"version": "1.13.0",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js",
"keywords": [
Expand All @@ -27,13 +27,13 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": {
"@babel/runtime": "^7.9.6",
"@polkadot/api-derive": "1.13.0-beta.19",
"@polkadot/api-derive": "1.13.0",
"@polkadot/keyring": "^2.9.1",
"@polkadot/metadata": "1.13.0-beta.19",
"@polkadot/rpc-core": "1.13.0-beta.19",
"@polkadot/rpc-provider": "1.13.0-beta.19",
"@polkadot/types": "1.13.0-beta.19",
"@polkadot/types-known": "1.13.0-beta.19",
"@polkadot/metadata": "1.13.0",
"@polkadot/rpc-core": "1.13.0",
"@polkadot/rpc-provider": "1.13.0",
"@polkadot/types": "1.13.0",
"@polkadot/types-known": "1.13.0",
"@polkadot/util": "^2.9.1",
"@polkadot/util-crypto": "^2.9.1",
"bn.js": "^5.1.1",
Expand Down
7 changes: 7 additions & 0 deletions packages/api/src/augment/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { AuthorityId } from '@polkadot/types/interfaces/consensus';
import { ContractCallRequest, ContractExecResult } from '@polkadot/types/interfaces/contracts';
import { CreatedBlock } from '@polkadot/types/interfaces/engine';
import { Extrinsic } from '@polkadot/types/interfaces/extrinsics';
import { ReportedRoundStates } from '@polkadot/types/interfaces/grandpa';
import { StorageKind } from '@polkadot/types/interfaces/offchain';
import { RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
import { RpcMethods } from '@polkadot/types/interfaces/rpc';
Expand Down Expand Up @@ -140,6 +141,12 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
**/
finalizeBlock: AugmentedRpc<(hash: BlockHash | string | Uint8Array, justification?: Justification | string | Uint8Array) => Observable<bool>>;
};
grandpa: {
/**
* Returns the state of the current best round state as well as the ongoing background rounds
**/
roundState: AugmentedRpc<() => Observable<ReportedRoundStates>>;
};
offchain: {
/**
* Get offchain local storage under given key and prefix
Expand Down
6 changes: 3 additions & 3 deletions packages/metadata/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polkadot/metadata",
"version": "1.13.0-beta.19",
"version": "1.13.0",
"description": "Helpers to extract information from runtime metadata",
"main": "index.js",
"publishConfig": {
Expand All @@ -27,8 +27,8 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
"dependencies": {
"@babel/runtime": "^7.9.6",
"@polkadot/types": "1.13.0-beta.19",
"@polkadot/types-known": "1.13.0-beta.19",
"@polkadot/types": "1.13.0",
"@polkadot/types-known": "1.13.0",
"@polkadot/util": "^2.9.1",
"@polkadot/util-crypto": "^2.9.1",
"bn.js": "^5.1.1"
Expand Down
8 changes: 4 additions & 4 deletions packages/rpc-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-core",
"version": "1.13.0-beta.19",
"version": "1.13.0",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
Expand All @@ -27,9 +27,9 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": {
"@babel/runtime": "^7.9.6",
"@polkadot/metadata": "1.13.0-beta.19",
"@polkadot/rpc-provider": "1.13.0-beta.19",
"@polkadot/types": "1.13.0-beta.19",
"@polkadot/metadata": "1.13.0",
"@polkadot/rpc-provider": "1.13.0",
"@polkadot/types": "1.13.0",
"@polkadot/util": "^2.9.1",
"memoizee": "^0.4.14",
"rxjs": "^6.5.5"
Expand Down
2 changes: 2 additions & 0 deletions packages/rpc-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ export default class Rpc implements RpcInterface {

public readonly engine!: RpcInterface['engine'];

public readonly grandpa!: RpcInterface['grandpa'];

public readonly offchain!: RpcInterface['offchain'];

public readonly payment!: RpcInterface['payment'];
Expand Down
6 changes: 3 additions & 3 deletions packages/rpc-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-provider",
"version": "1.13.0-beta.19",
"version": "1.13.0",
"description": "Transport providers for the API",
"main": "index.js",
"keywords": [
Expand All @@ -27,8 +27,8 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": {
"@babel/runtime": "^7.9.6",
"@polkadot/metadata": "1.13.0-beta.19",
"@polkadot/types": "1.13.0-beta.19",
"@polkadot/metadata": "1.13.0",
"@polkadot/types": "1.13.0",
"@polkadot/util": "^2.9.1",
"@polkadot/util-crypto": "^2.9.1",
"bn.js": "^5.1.1",
Expand Down
10 changes: 5 additions & 5 deletions packages/typegen/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polkadot/typegen",
"version": "1.13.0-beta.19",
"version": "1.13.0",
"description": "Type generation scripts",
"main": "index.js",
"bin": {
Expand Down Expand Up @@ -36,10 +36,10 @@
"@babel/core": "^7.9.6",
"@babel/register": "^7.9.0",
"@babel/runtime": "^7.9.6",
"@polkadot/api": "1.13.0-beta.19",
"@polkadot/metadata": "1.13.0-beta.19",
"@polkadot/rpc-provider": "1.13.0-beta.19",
"@polkadot/types": "1.13.0-beta.19",
"@polkadot/api": "1.13.0",
"@polkadot/metadata": "1.13.0",
"@polkadot/rpc-provider": "1.13.0",
"@polkadot/types": "1.13.0",
"@polkadot/util": "^2.9.1",
"handlebars": "^4.7.6",
"websocket": "^1.0.31",
Expand Down
4 changes: 2 additions & 2 deletions packages/types-known/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types-known",
"version": "1.13.0-beta.19",
"version": "1.13.0",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
Expand All @@ -27,7 +27,7 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
"dependencies": {
"@babel/runtime": "^7.9.6",
"@polkadot/types": "1.13.0-beta.19",
"@polkadot/types": "1.13.0",
"@polkadot/util": "^2.9.1",
"bn.js": "^5.1.1"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types",
"version": "1.13.0-beta.19",
"version": "1.13.0",
"description": "Implementation of the Parity codec",
"main": "index.js",
"keywords": [
Expand All @@ -27,7 +27,7 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
"dependencies": {
"@babel/runtime": "^7.9.6",
"@polkadot/metadata": "1.13.0-beta.19",
"@polkadot/metadata": "1.13.0",
"@polkadot/util": "^2.9.1",
"@polkadot/util-crypto": "^2.9.1",
"@types/bn.js": "^4.11.6",
Expand Down
14 changes: 13 additions & 1 deletion packages/types/src/augment/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { CreatedBlock, ImportedAux } from '@polkadot/types/interfaces/engine';
import { Account, Log } from '@polkadot/types/interfaces/evm';
import { EcdsaSignature, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV1, ExtrinsicPayloadV2, ExtrinsicPayloadV3, ExtrinsicPayloadV4, ExtrinsicSignatureV1, ExtrinsicSignatureV2, ExtrinsicSignatureV3, ExtrinsicSignatureV4, ExtrinsicUnknown, ExtrinsicV1, ExtrinsicV2, ExtrinsicV3, ExtrinsicV4, ImmortalEra, MortalEra, MultiSignature, Signature, SignerPayload, Sr25519Signature } from '@polkadot/types/interfaces/extrinsics';
import { AssetOptions, Owner, PermissionLatest, PermissionVersions, PermissionsV1 } from '@polkadot/types/interfaces/genericAsset';
import { AuthorityIndex, AuthorityList, AuthorityWeight, Equivocation, EquivocationProof, GrandpaEquivocation, GrandpaPrevote, KeyOwnerProof, NextAuthority, PendingPause, PendingResume, SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa';
import { AuthorityIndex, AuthorityList, AuthorityWeight, Equivocation, EquivocationProof, GrandpaEquivocation, GrandpaPrevote, KeyOwnerProof, NextAuthority, PendingPause, PendingResume, Precommits, Prevotes, ReportedRoundStates, RoundState, SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa';
import { IdentityFields, IdentityInfo, IdentityInfoAdditional, IdentityJudgement, RegistrarIndex, RegistrarInfo, Registration, RegistrationJudgement } from '@polkadot/types/interfaces/identity';
import { AuthIndex, AuthoritySignature, Heartbeat, OpaqueMultiaddr, OpaqueNetworkState, OpaquePeerId } from '@polkadot/types/interfaces/imOnline';
import { CallMetadataV0, DoubleMapTypeLatest, DoubleMapTypeV10, DoubleMapTypeV11, DoubleMapTypeV3, DoubleMapTypeV4, DoubleMapTypeV5, DoubleMapTypeV6, DoubleMapTypeV7, DoubleMapTypeV8, DoubleMapTypeV9, ErrorMetadataV10, ErrorMetadataV11, ErrorMetadataV8, ErrorMetadataV9, EventMetadataLatest, EventMetadataV0, EventMetadataV1, EventMetadataV10, EventMetadataV11, EventMetadataV2, EventMetadataV3, EventMetadataV4, EventMetadataV5, EventMetadataV6, EventMetadataV7, EventMetadataV8, EventMetadataV9, ExtrinsicMetadataLatest, ExtrinsicMetadataV11, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV0, FunctionArgumentMetadataV1, FunctionArgumentMetadataV10, FunctionArgumentMetadataV11, FunctionArgumentMetadataV2, FunctionArgumentMetadataV3, FunctionArgumentMetadataV4, FunctionArgumentMetadataV5, FunctionArgumentMetadataV6, FunctionArgumentMetadataV7, FunctionArgumentMetadataV8, FunctionArgumentMetadataV9, FunctionMetadataLatest, FunctionMetadataV0, FunctionMetadataV1, FunctionMetadataV10, FunctionMetadataV11, FunctionMetadataV2, FunctionMetadataV3, FunctionMetadataV4, FunctionMetadataV5, FunctionMetadataV6, FunctionMetadataV7, FunctionMetadataV8, FunctionMetadataV9, MapTypeLatest, MapTypeV0, MapTypeV10, MapTypeV11, MapTypeV2, MapTypeV3, MapTypeV4, MapTypeV5, MapTypeV6, MapTypeV7, MapTypeV8, MapTypeV9, MetadataAll, MetadataLatest, MetadataV0, MetadataV1, MetadataV10, MetadataV11, MetadataV2, MetadataV3, MetadataV4, MetadataV5, MetadataV6, MetadataV7, MetadataV8, MetadataV9, ModuleConstantMetadataLatest, ModuleConstantMetadataV10, ModuleConstantMetadataV11, ModuleConstantMetadataV6, ModuleConstantMetadataV7, ModuleConstantMetadataV8, ModuleConstantMetadataV9, ModuleMetadataLatest, ModuleMetadataV0, ModuleMetadataV1, ModuleMetadataV10, ModuleMetadataV11, ModuleMetadataV2, ModuleMetadataV3, ModuleMetadataV4, ModuleMetadataV5, ModuleMetadataV6, ModuleMetadataV7, ModuleMetadataV8, ModuleMetadataV9, OuterDispatchCallV0, OuterDispatchMetadataV0, OuterEventEventMetadataEventsV0, OuterEventEventMetadataV0, OuterEventMetadataV0, PlainTypeLatest, PlainTypeV0, PlainTypeV10, PlainTypeV11, PlainTypeV2, PlainTypeV3, PlainTypeV4, PlainTypeV5, PlainTypeV6, PlainTypeV7, PlainTypeV8, PlainTypeV9, RuntimeModuleMetadataV0, StorageEntryMetadataLatest, StorageEntryMetadataV10, StorageEntryMetadataV11, StorageEntryMetadataV6, StorageEntryMetadataV7, StorageEntryMetadataV8, StorageEntryMetadataV9, StorageEntryModifierLatest, StorageEntryModifierV10, StorageEntryModifierV11, StorageEntryModifierV6, StorageEntryModifierV7, StorageEntryModifierV8, StorageEntryModifierV9, StorageEntryTypeLatest, StorageEntryTypeV10, StorageEntryTypeV11, StorageEntryTypeV6, StorageEntryTypeV7, StorageEntryTypeV8, StorageEntryTypeV9, StorageFunctionMetadataV0, StorageFunctionMetadataV1, StorageFunctionMetadataV2, StorageFunctionMetadataV3, StorageFunctionMetadataV4, StorageFunctionMetadataV5, StorageFunctionModifierV0, StorageFunctionModifierV1, StorageFunctionModifierV2, StorageFunctionModifierV3, StorageFunctionModifierV4, StorageFunctionModifierV5, StorageFunctionTypeV0, StorageFunctionTypeV1, StorageFunctionTypeV2, StorageFunctionTypeV3, StorageFunctionTypeV4, StorageFunctionTypeV5, StorageHasher, StorageHasherV10, StorageHasherV11, StorageHasherV4, StorageHasherV5, StorageHasherV6, StorageHasherV7, StorageHasherV8, StorageHasherV9, StorageMetadataLatest, StorageMetadataV0, StorageMetadataV10, StorageMetadataV11, StorageMetadataV7, StorageMetadataV8, StorageMetadataV9 } from '@polkadot/types/interfaces/metadata';
Expand Down Expand Up @@ -657,6 +657,18 @@ declare module '@polkadot/types/types/registry' {
PendingResume: PendingResume;
'Option<PendingResume>': Option<PendingResume>;
'Vec<PendingResume>': Vec<PendingResume>;
Precommits: Precommits;
'Option<Precommits>': Option<Precommits>;
'Vec<Precommits>': Vec<Precommits>;
Prevotes: Prevotes;
'Option<Prevotes>': Option<Prevotes>;
'Vec<Prevotes>': Vec<Prevotes>;
ReportedRoundStates: ReportedRoundStates;
'Option<ReportedRoundStates>': Option<ReportedRoundStates>;
'Vec<ReportedRoundStates>': Vec<ReportedRoundStates>;
RoundState: RoundState;
'Option<RoundState>': Option<RoundState>;
'Vec<RoundState>': Vec<RoundState>;
SetId: SetId;
'Compact<SetId>': Compact<SetId>;
'Option<SetId>': Option<SetId>;
Expand Down
28 changes: 27 additions & 1 deletion packages/types/src/interfaces/grandpa/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@
import { Definitions } from '../../types';

export default {
rpc: {},
rpc: {
roundState: {
description: 'Returns the state of the current best round state as well as the ongoing background rounds',
params: [],
type: 'ReportedRoundStates'
}
},
types: {
AuthorityIndex: 'u64',
AuthorityList: 'Vec<NextAuthority>',
Expand Down Expand Up @@ -47,6 +53,26 @@ export default {
/// Number of blocks after which the change will be enacted.
delay: 'BlockNumber'
},
Precommits: {
currentWeight: 'u32',
missing: 'BTreeSet<AuthorityId>'
},
Prevotes: {
currentWeight: 'u32',
missing: 'BTreeSet<AuthorityId>'
},
ReportedRoundStates: {
setId: 'u32',
best: 'RoundState',
background: 'Vec<RoundState>'
},
RoundState: {
round: 'u32',
totalWeight: 'u32',
thresholdWeight: 'u32',
prevotes: 'Prevotes',
precommits: 'Precommits'
},
SetId: 'u64',
StoredPendingChange: {
scheduledAt: 'BlockNumber',
Expand Down
32 changes: 30 additions & 2 deletions packages/types/src/interfaces/grandpa/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/* eslint-disable */

import { ITuple } from '@polkadot/types/types';
import { Enum, Struct, Vec } from '@polkadot/types/codec';
import { u64 } from '@polkadot/types/primitive';
import { BTreeSet, Enum, Struct, Vec } from '@polkadot/types/codec';
import { u32, u64 } from '@polkadot/types/primitive';
import { AuthorityId } from '@polkadot/types/interfaces/consensus';
import { AuthoritySignature } from '@polkadot/types/interfaces/imOnline';
import { BlockNumber, Hash } from '@polkadot/types/interfaces/runtime';
Expand Down Expand Up @@ -64,6 +64,34 @@ export interface PendingResume extends Struct {
readonly delay: BlockNumber;
}

/** @name Precommits */
export interface Precommits extends Struct {
readonly currentWeight: u32;
readonly missing: BTreeSet<AuthorityId>;
}

/** @name Prevotes */
export interface Prevotes extends Struct {
readonly currentWeight: u32;
readonly missing: BTreeSet<AuthorityId>;
}

/** @name ReportedRoundStates */
export interface ReportedRoundStates extends Struct {
readonly setId: u32;
readonly best: RoundState;
readonly background: Vec<RoundState>;
}

/** @name RoundState */
export interface RoundState extends Struct {
readonly round: u32;
readonly totalWeight: u32;
readonly thresholdWeight: u32;
readonly prevotes: Prevotes;
readonly precommits: Precommits;
}

/** @name SetId */
export interface SetId extends u64 {}

Expand Down
Loading

0 comments on commit a1ad90c

Please sign in to comment.