Skip to content

X402 payment channel#3758

Merged
jolestar merged 3 commits into
mainfrom
x402_payment_channel_v2
Nov 19, 2025
Merged

X402 payment channel#3758
jolestar merged 3 commits into
mainfrom
x402_payment_channel_v2

Conversation

@jolestar

Copy link
Copy Markdown
Contributor

Summary

Summary about this PR

  • Closes #issue

@vercel

vercel Bot commented Nov 18, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
rooch-portal-v2.1 Ready Ready Preview Comment Nov 19, 2025 11:19am
test-portal Ready Ready Preview Comment Nov 19, 2025 11:19am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
rooch Ignored Ignored Preview Nov 19, 2025 11:19am

@github-actions

github-actions Bot commented Nov 18, 2025

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements the x402 payment channel scheme by introducing a unified apply_receipt function that enables zero-client blockchain interaction through facilitator-proxied receipt processing. The key innovation is lazy initialization: the function automatically handles channel opening and sub-channel authorization if they don't exist, then performs settlement if the receipt has a positive delta.

Key Changes:

  • Introduced apply_receipt and apply_receipt_entry functions for unified receipt processing with lazy channel/sub-channel initialization
  • Refactored existing functions (open_channel, authorize_sub_channel, claim_from_channel) to use new internal helpers (internal_open_channel, internal_authorize_sub_channel, internal_claim_from_channel)
  • Added comprehensive test suite covering lazy initialization, settlement, idempotency, and backward compatibility

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.

File Description
frameworks/rooch-framework/sources/payment_channel.move Core implementation: Added internal helper functions for channel operations, implemented apply_receipt and apply_receipt_for_test functions, and refactored existing public functions to delegate to internal helpers
frameworks/rooch-framework/sources/tests/payment_channel_test.move Added 6 new tests for apply_receipt functionality covering lazy initialization, settlement, idempotency, error cases (no DID), backward compatibility, and progressive settlement
frameworks/rooch-framework/doc/payment_channel.md Updated generated documentation to include new apply_receipt and apply_receipt_entry functions with detailed parameter, behavior, and panic condition documentation

Comment thread frameworks/rooch-framework/sources/payment_channel.move Outdated
Comment thread frameworks/rooch-framework/sources/tests/payment_channel_test.move
Comment thread frameworks/rooch-framework/sources/payment_channel.move Outdated
Comment thread frameworks/rooch-framework/sources/payment_channel.move Outdated
Comment thread frameworks/rooch-framework/sources/payment_channel.move
Comment thread frameworks/rooch-framework/sources/tests/payment_channel_test.move Outdated
Comment thread frameworks/rooch-framework/sources/payment_channel.move Outdated
Comment thread frameworks/rooch-framework/sources/payment_channel.move
@jolestar jolestar merged commit 70ea41d into main Nov 19, 2025
14 of 21 checks passed
@jolestar jolestar deleted the x402_payment_channel_v2 branch November 19, 2025 14:00
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.

2 participants