Skip to content

Commit 9290793

Browse files
committed
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
1 parent aaff21f commit 9290793

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

packages/wasm-dot/js/transaction.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ export class DotTransaction {
2727
* @param material - Chain material from the fullnode. See {@link fromHex}
2828
* for why material is needed at deserialization time.
2929
*/
30-
static fromBytes(bytes: Uint8Array, material?: Material): DotTransaction {
31-
const ctx = material ? createContext(material) : undefined;
30+
static fromBytes(bytes: Uint8Array, material: Material): DotTransaction {
31+
const ctx = createContext(material);
3232
const inner = new WasmTransaction(bytes, ctx);
3333
return new DotTransaction(inner);
3434
}
@@ -71,8 +71,8 @@ export class DotTransaction {
7171
* @param material - Chain material from the fullnode (genesisHash,
7272
* chainName, specName, specVersion, txVersion, metadata)
7373
*/
74-
static fromHex(hex: string, material?: Material): DotTransaction {
75-
const ctx = material ? createContext(material) : undefined;
74+
static fromHex(hex: string, material: Material): DotTransaction {
75+
const ctx = createContext(material);
7676
const inner = WasmTransaction.fromHex(hex, ctx);
7777
return new DotTransaction(inner);
7878
}

0 commit comments

Comments
 (0)