Skip to content

fix(operator): operator/status no longer 500s on missing/invalid address#403

Merged
jhfnetboy merged 1 commit into
masterfrom
fix/operator-status-500
Jul 2, 2026
Merged

fix(operator): operator/status no longer 500s on missing/invalid address#403
jhfnetboy merged 1 commit into
masterfrom
fix/operator-status-500

Conversation

@jhfnetboy

Copy link
Copy Markdown
Member

beta-pre #2. GET /operator/status called hasRole(user=undefined) when no address was supplied → contract revert → 500. Now the controller validates the address (viem isAddress) and returns 200 + unregistered status before any chain read; getV4PaymasterStatus gets a try/catch (like getSPOStatus) so a valid-but-reverting address degrades to {hasRole:false} instead of 500.

Deterministic e2e regression added (no RPC): missing + malformed address → 200 + registered:false (2 passed). tsc/lint/build green. Fixes LAUNCH_READINESS_PLAN.md step 3.

GET /operator/status called hasRole(user=undefined) when no address was supplied,
which reverts at the contract → 500. The controller now validates the address
(viem isAddress) and returns 200 + an unregistered status ({registered:false,
spoStatus:null, v4Status:null}) before any chain read. getV4PaymasterStatus also gets
a try/catch (mirroring getSPOStatus) so a valid-but-reverting address degrades to
{hasRole:false} instead of 500.

Adds a deterministic e2e regression (no RPC): missing + malformed address → 200 +
registered:false (2 passed). Fixes LAUNCH_READINESS step 3.
@jhfnetboy jhfnetboy requested a review from fanhousanbu as a code owner July 2, 2026 03:44
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@clestons clestons left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review: #403 — fix(operator): operator/status 500

修复路径清晰、精准:controller 先用 isAddress() 守门,service 补 try/catch 镜像 getSPOStatus 模式,e2e 加两个无 RPC 依赖的确定性回归测试。

[Confirmed] L — getV4PaymasterStatus catch 无日志

operator.service.ts catch 块(以及 pre-existing 的 getSPOStatus)完全静默:

} catch {
  return { paymasterAddress: null, balance: "0", hasRole: false };
}

有效地址触发合约 revert(RPC 抖动、合约升级)时,调用方得到 hasRole: false,日志里无任何记录。建议加一行 warn:

} catch (err) {
  this.logger.warn(`getV4PaymasterStatus(${address}) degraded: ${err}`);
  return { paymasterAddress: null, balance: "0", hasRole: false };
}

非阻塞,可后续 PR 跟进。


正确项

  • isAddress() 守门在链读之前短路 ✓
  • registered = !!(spoStatus?.hasRole || v4Status?.hasRole) — null 上正确求值 ✓
  • Promise.all 安全(两个 service 方法各自 catch,不会 bubble) ✓
  • 200 vs 400 for malformed: 前端 status-check 场景下 200+registered:false 是合理设计 ✓
  • 2 个 e2e regression 无 RPC 依赖,确定性 ✓
  • LAUNCH_READINESS step 3 ✓

APPROVE

轮次 执行者 裁决
R1 Sonnet 4.6 APPROVE(L catch 无日志,非阻塞)
PK Tier-3 本地 L1 CONFIRM / L2 CHALLENGE / MISSED 无

@jhfnetboy jhfnetboy merged commit ea27768 into master Jul 2, 2026
14 checks passed
@jhfnetboy jhfnetboy deleted the fix/operator-status-500 branch July 2, 2026 03:56
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants