Skip to content

feat: dynamic gas margin for Tempo recovery based on user gas params#8741

Open
bhavesh-prasad wants to merge 1 commit into
masterfrom
CECHO-917
Open

feat: dynamic gas margin for Tempo recovery based on user gas params#8741
bhavesh-prasad wants to merge 1 commit into
masterfrom
CECHO-917

Conversation

@bhavesh-prasad
Copy link
Copy Markdown
Contributor

@bhavesh-prasad bhavesh-prasad commented May 12, 2026

Summary

Implements the full TSS recovery flow for the Tempo chain (TIP-20 / EIP-7702).

What was there before

  • buildUnsignedSweepTxnTSS and recoveryBlockchainExplorerQuery were stubs returning empty/dummy objects
  • No signed recovery path existed

What this PR adds

Recovery infrastructure (tempo.ts)

  • recoveryBlockchainExplorerQuery — routes Etherscan-style queries to Tempo's Alchemy JSON-RPC endpoint (configured via environments.ts)
  • queryTempoRpc — translates account/balance, account/tokenbalance, and account/txlist queries into eth_call / eth_getTransactionCount JSON-RPC calls
  • buildTempoSweepTx — shared helper that queries token balance, computes sweep amount, and builds an unsigned TIP-20 transfer transaction; used by both recovery paths
  • recoverTSS — overrides base-class recovery with two paths:
    • Unsigned sweep (plain public key shares): delegates to buildUnsignedSweepTxnTSS
    • Signed sweep (encrypted keys + passphrase): builds a TIP-20 tx, hashes it, signs via MPC v2 ECDSA, attaches the signature, and returns the broadcast-ready hex
  • buildUnsignedSweepTxnTSS — builds an unsigned TIP-20 sweep and returns the UnsignedSweepTxMPCv2 structure for offline vault signing

Dynamic gas margin

  • Removes hardcoded GAS_MARGIN_UNITS = 20_000n constant
  • Gas margin is now computed from user-supplied params: gasMarginUnits = gasLimit × maxFeePerGas / 10^12
  • Matches the gasLimit × gasPrice pattern used across all ETH-like coin recovery flows in abstract-eth; the /10^12 factor converts from wei scale (18 decimals) to pathUSD's TIP-20 units (6 decimals)

Environment config (environments.ts)

  • Adds Tempo evm config entry so recoveryBlockchainExplorerQuery can resolve the RPC URL and API token

@bhavesh-prasad bhavesh-prasad requested review from a team as code owners May 12, 2026 09:16
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 12, 2026

CECHO-917

@bhavesh-prasad bhavesh-prasad force-pushed the CECHO-917 branch 3 times, most recently from d1f7e4b to cfd5179 Compare May 12, 2026 11:28
Signed-off-by: B.Prasad <[email protected]>

TICKET: CECHO-917
Signed-off-by: B.Prasad <[email protected]>
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