Skip to content

Commit 29f741f

Browse files
Use ExtrinsicV4 by default (#6164)
1 parent 187ce9c commit 29f741f

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

packages/api/src/base/Init.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,8 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
374374
throw new Error('Invalid initializion order, runtimeVersion is not available');
375375
}
376376

377-
this._extrinsicType = metadata.asLatest.extrinsic.versions.at(-1) || LATEST_EXTRINSIC_VERSION;
377+
// ExtrinsicV5 is not fully supported yet, for that reason we default to version 4
378+
this._extrinsicType = metadata.asLatest.extrinsic.versions.at(0) || LATEST_EXTRINSIC_VERSION;
378379
this._rx.extrinsicType = this._extrinsicType;
379380
this._rx.genesisHash = this._genesisHash;
380381
this._rx.runtimeVersion = runtimeVersion;

packages/types/src/extrinsic/Extrinsic.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,11 @@ export class GenericExtrinsic<A extends AnyTuple = AnyTuple> extends ExtrinsicBa
330330

331331
constructor (registry: Registry, value?: GenericExtrinsic | ExtrinsicValue | AnyU8a | Call, { preamble, version }: CreateOptions = {}) {
332332
const versionsLength = registry.metadata.extrinsic.versions.length;
333-
const highestSupportedVersion = versionsLength ? registry.metadata.extrinsic.versions[versionsLength - 1] : undefined;
334333

335-
super(registry, decodeExtrinsic(registry, value, version || highestSupportedVersion, preamble), undefined, preamble);
334+
// TODO: Once ExtrinsicV5 is fully supported update this to use the highest supported verion which is the last item of the array
335+
const supportedVersion = versionsLength ? registry.metadata.extrinsic.versions[0] : undefined;
336+
337+
super(registry, decodeExtrinsic(registry, value, version || supportedVersion, preamble), undefined, preamble);
336338
}
337339

338340
/**

packages/types/src/extrinsic/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export const UNMASK_VERSION = 0b01111111;
1414
export const DEFAULT_PREAMBLE = 'bare';
1515

1616
// Latest extrinsic version is v5, which has backwards compatibility for v4 signed extrinsics
17-
export const LATEST_EXTRINSIC_VERSION = 5;
17+
// However is not fully supported so LATEST_EXTRINSIC_VERSION is configured as 4 in the meantime.
18+
export const LATEST_EXTRINSIC_VERSION = 4;
1819

1920
export const VERSION_MASK = 0b00111111;
2021

0 commit comments

Comments
 (0)