From 9290793d08cfb9710cddf54728bfd36541fc0886 Mon Sep 17 00:00:00 2001 From: Luis Covarrubias Date: Wed, 18 Mar 2026 23:54:02 -0700 Subject: [PATCH] fix: make material required in DotTransaction.fromHex/fromBytes Without material, the parser silently falls back to guessing the signed extension layout (assumes era + nonce + tip only). On chains with additional extensions (AuthorizeCall, StorageWeightReclaim, CheckMetadataHash, ChargeAssetTxPayment), this causes extra extension bytes to leak into call_data, producing silently corrupted transactions. All existing callers already pass material. Making it required turns a silent data corruption bug into a compile-time error. BTC-3062 --- packages/wasm-dot/js/transaction.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/wasm-dot/js/transaction.ts b/packages/wasm-dot/js/transaction.ts index 616558b..db6dfdb 100644 --- a/packages/wasm-dot/js/transaction.ts +++ b/packages/wasm-dot/js/transaction.ts @@ -27,8 +27,8 @@ export class DotTransaction { * @param material - Chain material from the fullnode. See {@link fromHex} * for why material is needed at deserialization time. */ - static fromBytes(bytes: Uint8Array, material?: Material): DotTransaction { - const ctx = material ? createContext(material) : undefined; + static fromBytes(bytes: Uint8Array, material: Material): DotTransaction { + const ctx = createContext(material); const inner = new WasmTransaction(bytes, ctx); return new DotTransaction(inner); } @@ -71,8 +71,8 @@ export class DotTransaction { * @param material - Chain material from the fullnode (genesisHash, * chainName, specName, specVersion, txVersion, metadata) */ - static fromHex(hex: string, material?: Material): DotTransaction { - const ctx = material ? createContext(material) : undefined; + static fromHex(hex: string, material: Material): DotTransaction { + const ctx = createContext(material); const inner = WasmTransaction.fromHex(hex, ctx); return new DotTransaction(inner); }