Skip to content

fix(aip18): make pure buyers gasless via buyer-link gate marker (DEC-8)#21

Merged
DamirAGI merged 1 commit into
mainfrom
fix/aip18-buyer-gasless
Jun 5, 2026
Merged

fix(aip18): make pure buyers gasless via buyer-link gate marker (DEC-8)#21
DamirAGI merged 1 commit into
mainfrom
fix/aip18-buyer-gasless

Conversation

@DamirAGI
Copy link
Copy Markdown
Collaborator

@DamirAGI DamirAGI commented Jun 5, 2026

Problem (code-verified)

The SDK auto-wallet gate (ACTPClient.ts) granted the gas-sponsored wallet only when configHash != 0 || hasPendingPublish. A pure buyer (intent: pay) links instead of registering (DEC-3/DEC-4) → it has neither → the gate dropped it to the EOA wallet, forcing the buyer to fund ETH. That directly contradicts DEC-8 ("buyers are gasless; they need only USDC").

This was surfaced by the budget-privacy fix (#20): making buyer publish link-only means a buyer has no configHash and no pending-publish, so the gate never granted it the sponsored wallet.

Fix — a buyer-link marker (mirrors the existing pending-publish escape hatch)

  • New config/buyerLink.ts: a tiny, network-agnostic .actp/buyer-link.json marker — atomic write, 0o600, symlink-safe, corrupt-tolerant.
  • actp publish (pay-only branch) writes the marker on link. No lazy on-chain activation is triggered (a buyer never registers).
  • ACTPClient gate adds a third leg ... || isLinkedBuyer in both the normal and fail-open (RPC-down) paths.

Why this opens no free-gas vector

A buyer's only costly on-chain action — pay()locks USDC in escrow, which is the anti-DOS backstop (threat-model). The marker carries the same trust posture as the already-trusted pending-publish local file.

⚠ Ops follow-up (not in this PR)

The SDK now grants the sponsored wallet; the paymaster policy must also allow-list the contracts a buyer touches — kernel + vault + USDC approve / Permit2 — for true end-to-end gasless. Tracked separately.

Tests

New buyerLink suite (6) + 2 gate tests (linked buyer → auto; unregistered non-buyer → eoa). Full SDK suite: 2914/2914.

Builds on #20. Implements agirails/aips#3 DEC-8.

🤖 Generated with Claude Code

…C-8)

The SDK auto-wallet gate (ACTPClient) only granted the gas-sponsored wallet
when `configHash != 0 || hasPendingPublish`. A pure buyer (intent: pay) links
instead of registering (DEC-3/DEC-4), so it has NEITHER — the gate dropped it
to the EOA wallet, forcing the buyer to fund ETH. That contradicts DEC-8
("buyers are gasless; they need only USDC").

Fix — a buyer-link marker, mirroring the existing pending-publish escape hatch:
- New `config/buyerLink.ts`: a tiny, network-agnostic `.actp/buyer-link.json`
  marker (atomic write, 0o600, symlink-safe, corrupt-tolerant).
- `actp publish` (pay-only branch) writes the marker on link. It triggers NO
  lazy on-chain activation (a buyer never registers).
- ACTPClient gate adds a third leg: `... || isLinkedBuyer` in both the normal
  and fail-open (RPC-down) paths.

Why this opens no free-gas vector: a buyer's only costly on-chain action —
pay() — locks USDC in escrow, which is the anti-DOS backstop (threat-model).
The marker is the same trust posture as the already-trusted pending-publish
local file.

Note: the SDK now grants the sponsored wallet; the paymaster policy must also
allow-list the contracts a buyer touches (kernel + vault + USDC approve /
Permit2) for end-to-end gasless — an ops follow-up, tracked separately.

Tests: new buyerLink suite (6) + 2 gate tests (linked buyer → auto;
unregistered non-buyer → eoa). Full SDK suite: 2914/2914.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@DamirAGI DamirAGI requested a review from roosch269 as a code owner June 5, 2026 22:56
@DamirAGI DamirAGI merged commit b46d605 into main Jun 5, 2026
7 of 9 checks passed
@DamirAGI DamirAGI deleted the fix/aip18-buyer-gasless branch June 5, 2026 22:57
DamirAGI added a commit that referenced this pull request Jun 5, 2026
Ships the buyer-link gate marker: a pure buyer (intent: pay) now uses the
gas-sponsored auto wallet instead of falling back to the ETH-funded EOA.
Source merged in #21. Bump kept separate from the in-flight 4.5.0 delivery work.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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