Skip to content

feat(tip-1034): derive channel ids from open tx hash#3779

Open
legion2002 wants to merge 14 commits intotanishk/tip-1034-implfrom
tanishk/tip-1034-txhash-channel-id-stack
Open

feat(tip-1034): derive channel ids from open tx hash#3779
legion2002 wants to merge 14 commits intotanishk/tip-1034-implfrom
tanishk/tip-1034-txhash-channel-id-stack

Conversation

@legion2002
Copy link
Copy Markdown
Contributor

@legion2002 legion2002 commented Apr 30, 2026

Makes TIP-20 channel escrow stateless on close by including the opening transaction hash in channel ID derivation and deleting terminal state instead of keeping a tombstone.

This threads the top-level tx hash through revm and the precompile storage context, updates the TIP-1034 spec and Solidity reference artifacts, and adds regression coverage for channel reopen and tx-hash scoping behavior.

Verification:

  • cargo test -p tempo-precompiles
  • cargo test -p tempo-revm

Adds the native TIP-20 channel escrow precompile, wires T4 activation and payment-lane classification, and introduces the packed U96 storage primitive needed for the single-slot channel state.

Amp-Thread-ID: https://ampcode.com/threads/T-019db9e6-a988-765a-ad31-301b7b72fc95
Adds the T5 hardfork, moves channel escrow deployment and precompile registration behind that fork, and makes payment-lane classification explicitly hardfork-aware across consensus, pool, and payload-building paths.

Amp-Thread-ID: https://ampcode.com/threads/T-019db9e6-a988-765a-ad31-301b7b72fc95
Makes TIP-20 channel escrow stateless on close by including the opening transaction hash in channelId derivation and deleting terminal state instead of keeping a tombstone.

Threads the top-level tx hash through the revm/precompile execution path, updates the TIP-1034 spec and reference Solidity artifacts, and adds regression coverage for reopen and tx-hash scoping behavior.

Amp-Thread-ID: https://ampcode.com/threads/T-019ddf4c-e3f2-722f-b6a9-5b822be31d91
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

⚠️ Changelog not found.

A changelog entry is required before merging. We've generated a suggested changelog based on your changes:

Preview
---
tempo-contracts: major
tempo-precompiles: major
tempo-revm: minor
---

Bound TIP-20 channel IDs to the enclosing open-transaction hash via a new `openTxHash` field on `ChannelDescriptor`, plumbed through the EVM handler and `TempoTxEnv`. Replaced the finalized-channel tombstone with full slot deletion on `close`/`withdraw`, allowing channels to be reopened with a new tx hash.

Add changelog to commit this to your branch.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a462b9d1b2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +91 to +93
let open_tx_hash = self.storage.tx_hash().ok_or_else(|| {
crate::error::TempoPrecompileError::Fatal("current tx hash unavailable".into())
})?;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Handle missing tx hash in channel open

open now hard-fails when StorageCtx::tx_hash() is unset, returning a fatal error. This breaks any execution path that runs TIP-20 escrow from a raw/simulated TxEnv without a recovered top-level hash (for example, transaction simulation flows that construct TempoTxEnv via default/raw conversion), so open cannot be dry-run or gas-estimated in those contexts. Because the error is fatal rather than a typed revert, clients cannot recover gracefully and wallets/services may fail to build channel-open transactions.

Useful? React with 👍 / 👎.

Stores the current top-level tx hash in TIP-20 channel escrow transient storage and seeds it from the handler, mirroring the existing tx.origin pattern used by account keychain.

Removes the generic StorageCtx tx-hash thread-local path and updates escrow tests to seed the precompile-local context explicitly.

Amp-Thread-ID: https://ampcode.com/threads/T-019ddf4c-e3f2-722f-b6a9-5b822be31d91
@legion2002 legion2002 force-pushed the tanishk/tip-1034-impl branch from 00f91cc to 30b5ee6 Compare May 1, 2026 13:00
@legion2002 legion2002 force-pushed the tanishk/tip-1034-impl branch from 30b5ee6 to 1f4c838 Compare May 6, 2026 12:55
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