Use ExtrinsicV4 by default (#6164)

This commit is contained in:
Valentin Fernandez
2025-06-04 12:24:19 -03:00
committed by GitHub
parent 187ce9cfcf
commit 29f741f9d9
3 changed files with 8 additions and 4 deletions
+2 -1
View File
@@ -374,7 +374,8 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
throw new Error('Invalid initializion order, runtimeVersion is not available');
}
this._extrinsicType = metadata.asLatest.extrinsic.versions.at(-1) || LATEST_EXTRINSIC_VERSION;
// ExtrinsicV5 is not fully supported yet, for that reason we default to version 4
this._extrinsicType = metadata.asLatest.extrinsic.versions.at(0) || LATEST_EXTRINSIC_VERSION;
this._rx.extrinsicType = this._extrinsicType;
this._rx.genesisHash = this._genesisHash;
this._rx.runtimeVersion = runtimeVersion;
+4 -2
View File
@@ -330,9 +330,11 @@ export class GenericExtrinsic<A extends AnyTuple = AnyTuple> extends ExtrinsicBa
constructor (registry: Registry, value?: GenericExtrinsic | ExtrinsicValue | AnyU8a | Call, { preamble, version }: CreateOptions = {}) {
const versionsLength = registry.metadata.extrinsic.versions.length;
const highestSupportedVersion = versionsLength ? registry.metadata.extrinsic.versions[versionsLength - 1] : undefined;
super(registry, decodeExtrinsic(registry, value, version || highestSupportedVersion, preamble), undefined, preamble);
// TODO: Once ExtrinsicV5 is fully supported update this to use the highest supported verion which is the last item of the array
const supportedVersion = versionsLength ? registry.metadata.extrinsic.versions[0] : undefined;
super(registry, decodeExtrinsic(registry, value, version || supportedVersion, preamble), undefined, preamble);
}
/**
+2 -1
View File
@@ -14,7 +14,8 @@ export const UNMASK_VERSION = 0b01111111;
export const DEFAULT_PREAMBLE = 'bare';
// Latest extrinsic version is v5, which has backwards compatibility for v4 signed extrinsics
export const LATEST_EXTRINSIC_VERSION = 5;
// However is not fully supported so LATEST_EXTRINSIC_VERSION is configured as 4 in the meantime.
export const LATEST_EXTRINSIC_VERSION = 4;
export const VERSION_MASK = 0b00111111;