From ffe7201fbcd7023602f6b624e7eff715dae627e3 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 4 Sep 2019 07:57:00 +0200 Subject: [PATCH] Add explicit payload comment (clarification) (#1363) --- packages/types/src/primitive/Extrinsic/v3/ExtrinsicPayload.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/types/src/primitive/Extrinsic/v3/ExtrinsicPayload.ts b/packages/types/src/primitive/Extrinsic/v3/ExtrinsicPayload.ts index fab3102c8d..e869eafee0 100644 --- a/packages/types/src/primitive/Extrinsic/v3/ExtrinsicPayload.ts +++ b/packages/types/src/primitive/Extrinsic/v3/ExtrinsicPayload.ts @@ -94,6 +94,10 @@ export default class ExtrinsicPayloadV3 extends Struct { * @description Sign the payload with the keypair */ public sign (signerPair: IKeyringPair): Uint8Array { + // NOTE The `toU8a(true)` argument is absolutely critical - we don't want the method (Bytes) + // to have the length prefix included. This means that the data-as-signed is un-decodable, + // but is also doesn't need the extra information, only the pure data (and is not decoded) + // ... The same applies to V1 & V1, if we have a V4, carry move this comment to latest return sign(signerPair, this.toU8a(true)); } }