Skip to content

feat(abstract-eth): expose getSignablePayload for ETH coin classes (CGD-1083)#8826

Draft
0xPrabh wants to merge 1 commit into
masterfrom
prabhsharan/cgd-1083-eth-signable-payload-v2
Draft

feat(abstract-eth): expose getSignablePayload for ETH coin classes (CGD-1083)#8826
0xPrabh wants to merge 1 commit into
masterfrom
prabhsharan/cgd-1083-eth-signable-payload-v2

Conversation

@0xPrabh
Copy link
Copy Markdown
Contributor

@0xPrabh 0xPrabh commented May 21, 2026

Description

Overrides getSignablePayload(serializedTx) on AbstractEthLikeCoin so that ETH and all ETH-like coins return the correct 32-byte keccak256 signing digest, rather than falling through to the base-class no-op that returns raw serialized bytes.

This is required to unblock AKM's external signing endpoint (POST /sign), which needs the correct hash to sign — not the raw transaction bytes.

Changes

  • AbstractEthLikeCoin.getSignablePayload — new override: deserializes via the transaction builder, casts to EthTransaction, and returns tx.signablePayload
  • EthLikeTransactionData interface — adds getSignablePayload(): Buffer
  • EthTransactionData — implements getSignablePayload() via tx.getMessageToSign(true) (keccak256 hash, same primitive used internally for TSS signing)
  • Transaction.signablePayload getter — overrides BaseTransaction's NotImplementedError default; throws InvalidTransactionError if no transaction data is set
  • Inherited by all AbstractEthLikeNewCoins descendants (Eth, Polygon, Arbeth, Opeth, BSC, AvaxC, EVM, tokens, etc.) and legacy AbstractEthLikeCoin descendants (Rbtc, Celo, Etc)

Issue

CGD-1083 (unblocks WCN-397)

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Unit tests added in:

  • modules/abstract-eth/test/unit/transaction.ts — throws on empty tx; returns 32-byte hash for unsigned tx
  • modules/sdk-coin-eth/test/unit/transaction.ts — hash pinned against txData.id fixture for both Legacy and EIP1559; distinct-payload check between tx types
  • modules/sdk-coin-eth/test/unit/eth.ts — end-to-end coin.getSignablePayload(serializedTx) for Legacy and EIP1559 via Teth

Existing TSS signing flows are unaffected — they use signableHex from the unsigned tx object directly (abstractEthLikeNewCoins.ts:2444), not getSignablePayload.

@0xPrabh 0xPrabh requested a review from a team as a code owner May 21, 2026 14:13
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 21, 2026

CGD-1083

Override `getSignablePayload` on `AbstractEthLikeCoin` to return the
keccak256 hash of the unsigned transaction (via `getMessageToSign(true)`)
rather than raw serialized bytes. This exposes the correct bytes AKM
needs for its external POST /sign endpoint.

Changes:
- Add `getSignablePayload(): Buffer` to `EthLikeTransactionData` interface
  and implement it in `EthTransactionData` using `tx.getMessageToSign(true)`
- Add `get signablePayload(): Buffer` to the `Transaction` class, delegating
  to `EthTransactionData.getSignablePayload()`
- Override `getSignablePayload(serializedTx)` in `AbstractEthLikeCoin`,
  rebuilding via the transaction builder and returning `tx.signablePayload`
- Add unit tests covering Legacy and EIP1559 transaction types, and
  empty-transaction error handling

Ticket: CGD-1083
@0xPrabh 0xPrabh force-pushed the prabhsharan/cgd-1083-eth-signable-payload-v2 branch from dbc8c82 to 14a7783 Compare May 21, 2026 14:47
@0xPrabh 0xPrabh marked this pull request as draft May 21, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant