From 0c5b69bea1c304922b6aa24d44e3f17162763e41 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Tue, 12 May 2020 20:20:24 +0200 Subject: [PATCH] Extra signedExtensions retrieved via specVersion (#2268) * Extra signedExtensions retrieved via specVersion * Fix tests --- CHANGELOG.md | 2 +- packages/types/src/extrinsic/SignerPayload.spec.ts | 6 ------ packages/types/src/extrinsic/SignerPayload.ts | 8 +------- packages/types/src/types/extrinsic.ts | 10 ---------- 4 files changed, 2 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3867555c0..fab3f74b62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ - Add `derive.democracy.locks` to return extended lock info based on votes - Ensure metadata is only requested once upon startup (bypass on upgrade subscriptions) - Expand testing around `ExtrinsicEra` construction -- Expand `SignerPayload` to supply both the `txVersion` and active `signedExtensions` +- Expand `Registry` to direct access to available signed extensions (in addition to types) # 1.13.1 May 6, 2020 diff --git a/packages/types/src/extrinsic/SignerPayload.spec.ts b/packages/types/src/extrinsic/SignerPayload.spec.ts index b12c9d3c88..52e34227e8 100644 --- a/packages/types/src/extrinsic/SignerPayload.spec.ts +++ b/packages/types/src/extrinsic/SignerPayload.spec.ts @@ -22,10 +22,8 @@ describe('SignerPayload', (): void => { genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b', method: '0x0600ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c', nonce: '0x00001234', - signedExtensions: ['CheckEra', 'CheckNonce'], specVersion: '0x00000006', tip: '0x00000000000000000000000000005678', - txVersion: '0x00000007', version: 3 }; @@ -39,9 +37,7 @@ describe('SignerPayload', (): void => { genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b', method: registry.createType('Call', '0x0600ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c'), nonce: 0x1234, - signedExtensions: ['CheckEra', 'CheckNonce'], tip: 0x5678, - txVersion: 0x07, version: 3 }).toPayload() ).toEqual({ @@ -52,10 +48,8 @@ describe('SignerPayload', (): void => { genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b', method: '0x0600ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c', nonce: '0x00001234', - signedExtensions: ['CheckEra', 'CheckNonce'], specVersion: '0x00000000', tip: '0x00000000000000000000000000005678', - txVersion: '0x00000000', version: 3 }); }); diff --git a/packages/types/src/extrinsic/SignerPayload.ts b/packages/types/src/extrinsic/SignerPayload.ts index 71bd4b8406..cd4c06eaac 100644 --- a/packages/types/src/extrinsic/SignerPayload.ts +++ b/packages/types/src/extrinsic/SignerPayload.ts @@ -9,8 +9,6 @@ import { u8aToHex } from '@polkadot/util'; import Compact from '../codec/Compact'; import Struct from '../codec/Struct'; -import Vec from '../codec/Vec'; -import Text from '../primitive/Text'; import u8 from '../primitive/U8'; export interface SignerPayloadType extends Codec { @@ -22,7 +20,6 @@ export interface SignerPayloadType extends Codec { method: Call; nonce: Compact; runtimeVersion: RuntimeVersion; - signedExtensions: Vec; tip: Compact; version: u8; } @@ -38,7 +35,6 @@ const _Payload: Constructor = Struct.with({ method: 'Call', nonce: 'Compact', runtimeVersion: 'RuntimeVersion', - signedExtensions: 'Vec', tip: 'Compact', version: 'u8' }) as any; @@ -53,7 +49,7 @@ export default class SignerPayload extends _Payload implements ISignerPayload { * @description Creates an representation of the structure as an ISignerPayload JSON */ public toPayload (): SignerPayloadJSON { - const { address, blockHash, blockNumber, era, genesisHash, method, nonce, runtimeVersion: { specVersion, transactionVersion }, signedExtensions, tip, version } = this; + const { address, blockHash, blockNumber, era, genesisHash, method, nonce, runtimeVersion: { specVersion }, tip, version } = this; return { address: address.toString(), @@ -63,10 +59,8 @@ export default class SignerPayload extends _Payload implements ISignerPayload { genesisHash: genesisHash.toHex(), method: method.toHex(), nonce: nonce.toHex(), - signedExtensions: signedExtensions.map((ext) => ext.toString()), specVersion: specVersion.toHex(), tip: tip.toHex(), - txVersion: transactionVersion.toHex(), version: version.toNumber() }; } diff --git a/packages/types/src/types/extrinsic.ts b/packages/types/src/types/extrinsic.ts index d096a6deb5..f1c4d87442 100644 --- a/packages/types/src/types/extrinsic.ts +++ b/packages/types/src/types/extrinsic.ts @@ -155,11 +155,6 @@ export interface SignerPayloadJSON { */ nonce: string; - /** - * @description The current signed extensions for the network - */ - signedExtensions: string[]; - /** * @description The current spec version for the runtime */ @@ -170,11 +165,6 @@ export interface SignerPayloadJSON { */ tip: string; - /** - * @description The current transaction version for the runtime - */ - txVersion: string; - /** * @description The version of the extrinsic we are dealing with */