feat(keepkey): expose firmware-reported pre-image hash on EthSignTx#40
Open
BitHighlander wants to merge 2 commits into
Open
feat(keepkey): expose firmware-reported pre-image hash on EthSignTx#40BitHighlander wants to merge 2 commits into
BitHighlander wants to merge 2 commits into
Conversation
…esponse EthereumSignedTx (KeepKey custom proto) carries an optional `hash` field — the keccak256 pre-image the firmware actually signed. Until now the SDK ignored it, so the only way to verify which message bytes the device hashed was to recover the signer client-side and compare to the expected address. Surface the hash as `deviceSignedHash` on the returned signed tx so callers can pin the exact firmware behavior in tests/diagnostics. Older firmware doesn't populate the field; absence is non-fatal (try/catch, optional). Motivating use case: EIP-1559 tx hash regression where ethers' Transaction.from() reconstruction recovers the wrong signer — having the firmware-reported hash narrows the divergence to RLP construction vs. signing, instead of guessing. Non-breaking: purely additive. Existing consumers see the same shape.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…d it Review feedback on PR #40: the previous commit attached deviceSignedHash via a local cast in hdwallet-keepkey, but ETHSignedTx in hdwallet-core didn't declare the field — TypeScript callers couldn't read it without their own cast, which defeated the diagnostic purpose. Add deviceSignedHash?: string to ETHSignedTx (optional, KeepKey-only) and drop the local cast. The shape is identical at runtime; this just makes the field visible to consumers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EthereumSignedTx(KeepKey custom proto) carries an optionalhashfield — the keccak256 pre-image the firmware actually signed. The SDK previously ignored it.deviceSignedHashon the returned signed tx so callers can pin firmware behavior in tests / diagnostics.Motivation
EIP-1559 tx hash regression where
ethers.Transaction.from()reconstruction recovers the wrong signer. With the firmware-reported hash exposed, we can narrow the divergence to RLP-construction vs. signing instead of guessing.Test plan
deviceSignedHash).hashfield: signed tx response includesdeviceSignedHashas a 32-byte hex string.deviceSignedHashis undefined; nothing else changes.expectedSignerfrom(deviceSignedHash, r, s, v)for the regression fixture.