@ethereumjs/tx ^4.2.0 -> ^5.4.0
The bump compiles with no source change, which is exactly the trap here.
@ethereumjs/tx@5 reuses the name TxData for something entirely different:
v4 TxData = a legacy transaction data object
v5 TxData = { [TransactionType.Legacy]: LegacyTxData, [AccessListEIP2930]: ..., ... }
v4's meaning is now called LegacyTxData. Since keyring.ts declares
signTransaction as returning Promise<TxData>, the bump alone would silently
change that public type from "a signed legacy transaction" to "an object
carrying every transaction type at once", and still build clean.
Confirmed by typechecking a v4 era consumer against the unpatched build:
Type '{ nonce, gasPrice, gasLimit, to, value, data, v, r, s }' is missing
the following properties from type 'TxData': [TransactionType.Legacy],
[TransactionType.AccessListEIP2930], ...
Mapping TxData to LegacyTxData restores the original contract exactly, so
the same consumer typechecks again and the bump is not breaking. TypedTxData
would also accept it, but it is a union, so callers would have to narrow the
result. LegacyTxData keeps the API identical to v4.
Top of stack #315, on #320. Last of the PR#2 bumps.
@ethereumjs/tx^4.2.0^5.4.0This is not breaking, but only because of a one word change
The bump compiles with no source change at all, which is the trap.
@ethereumjs/tx@5reuses the nameTxDatafor something entirely different:v4's meaning is now called
LegacyTxData.keyring.tsdeclaressignTransactionas returningPromise<TxData>, so bumping alone would silently change that public type from "a signed legacy transaction" into "an object carrying every transaction type at once", and still build clean.Typechecking a v4 era consumer against the unpatched build confirms it:
Mapping
TxDatatoLegacyTxDatarestores the original contract exactly, and that same consumer typechecks again.TypedTxDatawould also accept it, but it is a union, so callers would have to narrow the result.LegacyTxDatakeeps the API identical to v4.Note
Keyringis already deprecated in favour of@metamask/keyring-utils, so the blast radius is small either way.Note
Medium Risk
Touches transaction-signing types from a major dependency bump; the explicit
LegacyTxDatafix avoids a silent type break for consumers of deprecatedKeyring.Overview
Upgrades
@ethereumjs/txfrom^4.2.0to^5.4.0(with lockfile updates for transitive@ethereumjs/*and crypto deps) and documents the change in the changelog.Because v5 redefined
TxDataas a per-transaction-type map, the deprecatedKeyring.signTransactionreturn type is updated fromPromise<TxData>toPromise<LegacyTxData>so the public API still means a signed legacy transaction object—the same shape as before. Keyring implementers do not need code changes.Reviewed by Cursor Bugbot for commit d1ea1a7. Bugbot is set up for automated code reviews on this repo. Configure here.