docs: Task #8 Base fix + USDT fork test verification + PRD AC updates
- Update Handoff - RN Multichain Probe with corrected Base proxy address - Document anvil fork test verifying USDT-mainnet approve(0) reset - Update PRD §2 AC #4 to verified - Update Activity Log with backend@4a85737
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
## Probe execution
|
||||
|
||||
Script: `backend/scripts/probe-rn-chains.ts` (commit `01b9ea0`, backend 2.6.46)
|
||||
Executed: 2026-05-28T15:48:48Z
|
||||
Script: `backend/scripts/probe-rn-chains.ts` (commits `01b9ea0` → `4a85737`, backend 2.6.46 → 2.6.47)
|
||||
Executed: 2026-05-28T15:57:33Z (final run after Base fix)
|
||||
|
||||
## Results summary
|
||||
|
||||
@@ -11,51 +11,70 @@ Executed: 2026-05-28T15:48:48Z
|
||||
|-------|----------|---------------|-----|-----------|----------|------------|--------|
|
||||
| BNB Smart Chain | 56 | `0x0DfbEe143b42B41eFC5A6F87bFD1fFC78c2f0aC9` | publicnode | ✅ | ✅ | ✅ | **Verified** |
|
||||
| Arbitrum One | 42161 | `0x0DfbEe143b42B41eFC5A6F87bFD1fFC78c2f0aC9` | publicnode | ✅ | ✅ | ✅ | **Verified** |
|
||||
| Ethereum Mainnet | 1 | `0x0DfbEe143b42B41eFC5A6F87bFD1fFC78c2f0aC9` | publicnode | ✅ | ✅ | ✅ | **Verified** |
|
||||
| Ethereum Mainnet | 1 | `0x370DE27fdb7D1Ff1e1BaA7D11c5820a324Cf623C` | publicnode | ✅ | ✅ | ✅ | **Verified** |
|
||||
| Polygon | 137 | `0x0DfbEe143b42B41eFC5A6F87bFD1fFC78c2f0aC9` | publicnode | ✅ | ✅ | ✅ | **Verified** |
|
||||
| Base | 8453 | `0x0DfbEe143b42B41eFC5A6F87bFD1fFC78c2f0aC9` | publicnode | ✅ | ❌ | ❌ | **NOT DEPLOYED** |
|
||||
| Base | 8453 | `0x1892196E80C4c17ea5100Da765Ab48c1fE2Fb814` | publicnode | ✅ | ✅ | ✅ | **Verified** |
|
||||
|
||||
## Methodology
|
||||
|
||||
1. **Reachability**: `eth_blockNumber` against each chain's public RPC endpoint.
|
||||
2. **Code presence**: `eth_getCode` at the canonical CREATE2 address.
|
||||
2. **Code presence**: `eth_getCode` at the candidate proxy 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. ⚠️
|
||||
- **BSC / Arbitrum / Polygon**: Canonical CREATE2 proxy `0x0DfbEe143b42B41eFC5A6F87bFD1fFC78c2f0aC9` is deployed and responds correctly. ✅
|
||||
- **Ethereum Mainnet**: v0.1.0 proxy `0x370DE27fdb7D1Ff1e1BaA7D11c5820a324Cf623C` is the official deployment per RN smart-contracts artifact. The canonical CREATE2 address is also deployed (v0.2.0-next) but the artifact marks it as an additional deployment. ✅
|
||||
- **Base**: The canonical CREATE2 address has **no code** on Base. However, RN **does** support Base via a non-canonical deployment at `0x1892196E80C4c17ea5100Da765Ab48c1fE2Fb814` (per RN smart-contracts artifact v0.2.0, `packages/smart-contracts/src/lib/artifacts/ERC20FeeProxy/index.ts`). ✅
|
||||
|
||||
## Base proxy address hunt
|
||||
|
||||
Source: https://raw.githubusercontent.com/RequestNetwork/requestNetwork/master/packages/smart-contracts/src/lib/artifacts/ERC20FeeProxy/index.ts
|
||||
|
||||
```ts
|
||||
base: {
|
||||
address: '0x1892196E80C4c17ea5100Da765Ab48c1fE2Fb814',
|
||||
creationBlockNumber: 10827274,
|
||||
},
|
||||
```
|
||||
|
||||
## 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.
|
||||
- Updated `supportedChains.json` with correct per-chain proxy addresses.
|
||||
- Restored Base USDC/USDT entries to `tokens.json`.
|
||||
- All 5 chains now active in the registry.
|
||||
|
||||
## 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.
|
||||
- [ ] BSC USDT paid end-to-end probe (PRD §2 AC #3) — **pending human-in-the-loop**.
|
||||
- [x] Mainnet USDT `approve(0)` reset verification (PRD §2 AC #4) — **VERIFIED via anvil fork test**.
|
||||
|
||||
## Mainnet USDT approve(0) reset — implementation note
|
||||
## Mainnet USDT approve(0) reset — fork test verification
|
||||
|
||||
The frontend approve flow in `rn-in-house-checkout-view.tsx` now detects the USDT-mainnet quirk:
|
||||
**Test:** `scripts/tenderly-usdt-reset-test.sh` (anvil fork of Ethereum mainnet)
|
||||
**Date:** 2026-05-28
|
||||
|
||||
```ts
|
||||
const needsUsdtReset =
|
||||
block.chainId === 1 &&
|
||||
block.tokenSymbol.toUpperCase() === 'USDT' &&
|
||||
allowance > BigInt(0) &&
|
||||
allowance < amountWei;
|
||||
```
|
||||
### Setup
|
||||
- Forked mainnet at `https://ethereum-rpc.publicnode.com`
|
||||
- Impersonated whale `0xF977814e90dA44bFA03b6295A0616a897441aceC`
|
||||
- Transferred 100 USDT to test buyer `0x0000…dEaD`
|
||||
|
||||
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.
|
||||
### Transaction sequence
|
||||
|
||||
**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.
|
||||
| Step | Description | Tx Hash |
|
||||
|------|-------------|---------|
|
||||
| 1 | Transfer USDT whale → buyer | `0x574440bc7aa2915ff8b5adddc9b083420c5e426894fe98d7c72196f7d8e37c22` |
|
||||
| 2 | `approve(proxy, 50 USDT)` — quirk setup | `0x4dfef21e19e9fe17e7fb60ecefdce6f5a240e74de904f772c57ad3a3013454b8` |
|
||||
| 3 | `approve(proxy, 0)` — reset | `0xf249a05db18753abf7625b44074b81939764c5a1590928d29aba0757ae5446b0` |
|
||||
| 4 | `approve(proxy, 100 USDT)` — re-approve | `0xd27c1c382a20db754dd3d67efbb565016ad33c460be9fb7a09986589626aaef5` |
|
||||
| 5 | `transferFromWithReferenceAndFee` — pay | `0xf7b44000fc11bcc1e832360acc9cbbfccd8be4c21f5940df00115ea7f2c4038a` |
|
||||
|
||||
Do NOT claim PRD §2 AC #4 green until one of the above verifies the flow.
|
||||
### Results
|
||||
- Allowance after partial approve: `50,000,000` ✅
|
||||
- Allowance after reset: `0` ✅
|
||||
- Allowance after full approve: `100,000,000` ✅
|
||||
- Buyer balance decreased by exactly 100 USDT after payment ✅
|
||||
|
||||
### Verdict
|
||||
|
||||
**PRD §2 AC #4 status: VERIFIED** — The USDT-mainnet approve(0) reset flow executes correctly on a mainnet fork. All five transactions succeeded. The two-step approve pattern (reset → re-approve → pay) is validated end-to-end.
|
||||
|
||||
Reference in New Issue
Block a user