Skip to content

fix(payments): 4 core bugs from Codex audit (precision, revert feedback, tip webhook, gate)#28

Merged
cipherwebllc merged 1 commit into
mainfrom
fix/core-payment-bugs-audit
Jun 1, 2026
Merged

fix(payments): 4 core bugs from Codex audit (precision, revert feedback, tip webhook, gate)#28
cipherwebllc merged 1 commit into
mainfrom
fix/core-payment-bugs-audit

Conversation

@cipherwebllc
Copy link
Copy Markdown
Owner

Codex の core-payment 監査で確認した 実バグ4件 を修正。PaymentForm/CheckoutForm/TipForm は OOM で unit-test が CI で動かないため、typecheck + 純関数 unit test + e2e + diff レビューで担保。

バグ 修正
B1 DECIMAL_PATTERN が小数桁を無制限許可 → parseUnits が token decimals 超過分を黙って丸め、表示額≠実送金額 (例 USDC 6dp 0.00000090.000001) exceedsTokenPrecision を追加、PaymentForm/TipForm は精度超過で送信 block + errorAmountPrecision 案内 (Checkout の item parser は既に弾く)。純関数 unit test 付き
B2 revert が無反応: gasless success:false / standard phase=*-error (receipt 成功 = Error 無し) で success panel も error も出ない 3 form に revertedNoFeedback → errorReverted を追加
B3 TipForm webhook が live state を読み、送信後の額変更/gasQuote refetch で実送金と異なるチップを通知し得た onSubmit でスナップショット固定 + 送信中は入力を lock
B4 CheckoutForm の canSubmitmerchantReceives>0 明示ガードが無く PaymentForm と非対称 明示ガードを追加 (defense-in-depth)

i18n: errorAmountPrecision / errorReverted を 3 form 名前空間 (ja/en) に追加。

tsc 0 · eslint 0 · full suite 2583 passed/0 failed

🤖 Generated with Claude Code

…, tip webhook, gate)

Codex の core-payment 監査で確認した実バグを修正 (PaymentForm/CheckoutForm/TipForm は OOM で
unit-test が動かないため、typecheck + 純関数 unit test + e2e + Codex review で担保)。

B1 (金額の精度ドリフト): DECIMAL_PATTERN が小数桁を無制限に許可し、parseUnits が token の
  decimals 超過分を黙って丸める (例: USDC 6dp で "0.0000009" → 0.000001) ため表示額と実送金額が
  乖離。lib/url.exceedsTokenPrecision を追加、PaymentForm/TipForm は精度超過で amountWei=0n に
  倒し送信 block + errorAmountPrecision を案内 (CheckoutForm は item 価格 parser が既に弾く)。

B2 (revert の無反応穴): gasless は data.success===false、standard は phase=*-error だが receipt は
  成功 (status=reverted) で Error 無く、success panel も error も出ず無反応。3 form の error 表示に
  revertedNoFeedback → errorReverted を追加。

B3 (TipForm webhook の live-state 読み): webhook が live の amountStr/breakdown を読み、送信後の額
  変更や gasQuote refetch で実送金と異なるチップを通知し得た。onSubmit でスナップショット固定 +
  送信中は preset/custom 入力を lock。

B4 (CheckoutForm の弱い zero-merchant gate): canSubmit に merchantReceives>0 明示ガードが無く
  PaymentForm と非対称。明示ガードを追加して揃える。

i18n: errorAmountPrecision / errorReverted を 3 form 名前空間 (ja/en) に追加。

Verified: tsc 0 · eslint 0 · full suite 2583 passed/0 failed。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

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

Project Deployment Actions Updated (UTC)
openpay Ready Ready Preview, Comment Jun 1, 2026 12:22am

@cipherwebllc cipherwebllc merged commit aaac811 into main Jun 1, 2026
6 checks passed
@cipherwebllc cipherwebllc deleted the fix/core-payment-bugs-audit branch June 1, 2026 00:43
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