docs: Task #8 probe results + handoff + PRD AC updates

- Add Handoff - RN Multichain Probe - 2026-05-28.md
- Update Handoff - Request Network In-House Checkout with Task #8 status
- Update Activity Log with backend@ae17b18, frontend@0ebb2f1
- Update PRD §2 acceptance criteria for Task #8
- Update Payment API.md with /api/admin/rn/networks endpoints
This commit is contained in:
Siavash Sameni
2026-05-28 19:53:06 +04:00
parent 2308db8074
commit 85cb439ce2
6 changed files with 157 additions and 12 deletions

View File

@@ -0,0 +1,61 @@
# Handoff: RN Multichain Proxy Probe — 2026-05-28
## Probe execution
Script: `backend/scripts/probe-rn-chains.ts` (commit `01b9ea0`, backend 2.6.46)
Executed: 2026-05-28T15:48:48Z
## Results summary
| Chain | Chain ID | Proxy Address | RPC | Reachable | Has Code | Call Valid | Status |
|-------|----------|---------------|-----|-----------|----------|------------|--------|
| BNB Smart Chain | 56 | `0x0DfbEe143b42B41eFC5A6F87bFD1fFC78c2f0aC9` | publicnode | ✅ | ✅ | ✅ | **Verified** |
| Arbitrum One | 42161 | `0x0DfbEe143b42B41eFC5A6F87bFD1fFC78c2f0aC9` | publicnode | ✅ | ✅ | ✅ | **Verified** |
| Ethereum Mainnet | 1 | `0x0DfbEe143b42B41eFC5A6F87bFD1fFC78c2f0aC9` | publicnode | ✅ | ✅ | ✅ | **Verified** |
| Polygon | 137 | `0x0DfbEe143b42B41eFC5A6F87bFD1fFC78c2f0aC9` | publicnode | ✅ | ✅ | ✅ | **Verified** |
| Base | 8453 | `0x0DfbEe143b42B41eFC5A6F87bFD1fFC78c2f0aC9` | publicnode | ✅ | ❌ | ❌ | **NOT DEPLOYED** |
## Methodology
1. **Reachability**: `eth_blockNumber` against each chain's public RPC endpoint.
2. **Code presence**: `eth_getCode` at the canonical CREATE2 address.
3. **Function validity**: `eth_call` with a dummy `transferFromWithReferenceAndFee` payload. A valid proxy reverts with an ERC-20/execution error (proving the selector is recognized). An invalid address would revert with "unknown function selector" or return empty.
## Key findings
- **BSC / Arbitrum / Ethereum / Polygon**: Canonical proxy `0x0DfbEe143b42B41eFC5A6F87bFD1fFC78c2f0aC9` is deployed and responds to the RN fee-proxy function selector on all four chains. ✅
- **Base**: The canonical CREATE2 address has **no code** on Base as of block `0x2c7037e`. RN has either not deployed the ERC20FeeProxy on Base yet, or deployed it at a different address. ⚠️
## Action taken
- Removed Base (8453) from the active `supportedChains.json` registry.
- Moved Base to `_unverified` section with a verification note.
- Removed Base USDC/USDT entries from `tokens.json`.
- Frontend wagmi config retains `base` chain support for future use, but the backend will return `unsupported_chain:8453` for any RN payment configured to Base until the correct proxy address is found and verified.
## Remaining work
- [ ] Find the actual RN ERC20FeeProxy address on Base (if deployed) from RN official docs / subgraph / Discord.
- [ ] Re-verify Base once the correct address is known.
- [ ] BSC USDT paid end-to-end probe (PRD §2 AC #3).
- [ ] Mainnet USDT `approve(0)` reset verification (PRD §2 AC #4) — see note below.
## Mainnet USDT approve(0) reset — implementation note
The frontend approve flow in `rn-in-house-checkout-view.tsx` now detects the USDT-mainnet quirk:
```ts
const needsUsdtReset =
block.chainId === 1 &&
block.tokenSymbol.toUpperCase() === 'USDT' &&
allowance > BigInt(0) &&
allowance < amountWei;
```
When `needsUsdtReset` is true, the UI first sends `approve(spender, 0)`, waits for confirmation, then sends `approve(spender, amountWei)`. The button label changes to "بازنشانی USDT" during the reset phase.
**Status: implemented but NOT verified.** Mainnet USDT testing costs real ETH gas. Options:
1. **Tenderly fork test** — fork Ethereum mainnet, simulate a buyer with existing USDT allowance > 0, verify the two-step approve flow executes correctly.
2. **Wait for first real mainnet usage** — the code path is well-contained; if a real buyer hits this case, the UI will guide them through the reset.
Do NOT claim PRD §2 AC #4 green until one of the above verifies the flow.

View File

@@ -63,8 +63,8 @@ Five follow-ups scoped for kimi to pick up independently. Full spec in `PRD - Wa
| # | Task | Priority | Status |
|---|---------------------------------------------------------------|----------|--------|
| 7 | Per-(buyer, sellerOffer) ephemeral RN destination wallets | high | 🟡 In progress — backend + admin UI shipped in 2.6.42, cart-aware buyer UX + tests + live RN-accepts-divergent-destination probe remain |
| 8 | Multichain RN proxy registry + USDC/USDT support | high | ⏳ Not started |
| 7 | Per-(buyer, sellerOffer) ephemeral RN destination wallets | high | 🟡 In progress — backend + admin UI + cart-aware UX + tests shipped in 2.6.45/2.6.46; **live RN-accepts-divergent-destination probe remains manual** |
| 8 | Multichain RN proxy registry + USDC/USDT support | high | 🟡 In progress — backend registry + probe script + frontend admin page + USDT-mainnet reset shipped in 2.6.46; **BSC USDT paid probe + Base proxy address hunt remain** |
| 9 | Per-chain confirmation thresholds + admin UI | medium | ⏳ Not started |
| 10 | Optional AML screening on incoming payments (seller-paid) | medium | ⏳ Not started |
| 11 | Trezor signing for admin actions (release/refund/sweep) | high | ⏳ Not started |
@@ -107,7 +107,23 @@ Five follow-ups scoped for kimi to pick up independently. Full spec in `PRD - Wa
| E — `recordSweep` accumulation fix | ✅ | `$inc: { totalSwept }` instead of `$setOnInsert` |
| F — API docs | ✅ | Derived-destination endpoints added to `Payment API.md` |
| B — Unit tests | ✅ | 46 tests across 3 files (see below) |
| C — Live divergent-destination probe | 🔄 | Protocol prepared; requires manual execution on dev (see §Live multi-seller probe below) |
| C — Live divergent-destination probe | 🔄 | Protocol prepared; **requires manual browser + wallet execution** (see §Live multi-seller probe below). Dev is running 2.6.46 with all backend/frontend code deployed. |
## Task #8 — completion status
| Item | Status | Notes |
|------|--------|-------|
| Probe script | ✅ | `scripts/probe-rn-chains.ts` — 4/5 chains verified (BSC, Arbitrum, Ethereum, Polygon). Base proxy not deployed at canonical address. |
| Token registry JSON | ✅ | `tokens.json` — USDC + USDT on 4 verified chains with correct decimals |
| Chain registry JSON | ✅ | `supportedChains.json` — 4 verified chains + Base in `_unverified` |
| Admin route | ✅ | `GET /api/admin/rn/networks`, `POST /api/admin/rn/networks/reload` |
| Frontend admin page | ✅ | `/dashboard/admin/networks` renders registry with reload button |
| `unsupported_chain` reason | ✅ | `buildInHouseCheckoutBlock` returns `unsupported_chain:<id>` |
| Frontend wagmi multichain | ✅ | Added arbitrum + base to wagmi config with RPC transports |
| Per-chain explorers | ✅ | Checkout view uses correct explorer per chainId |
| USDT-mainnet approve reset | ✅ | **Implemented but unverified** — see note in [[Handoff - RN Multichain Probe - 2026-05-28]] |
| BSC USDT paid probe | 🔄 | **Pending manual execution** — needs real wallet + test BSC USDT |
| Base proxy hunt | 🔄 | Canonical address has no code on Base. Need RN official docs for actual address. |
### B — Unit tests (backend@34f542e, 2.6.45)