fix(operator): operator/status no longer 500s on missing/invalid address#403
Merged
Conversation
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.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
clestons
approved these changes
Jul 2, 2026
clestons
left a comment
There was a problem hiding this comment.
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 无 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
beta-pre #2.
GET /operator/statuscalledhasRole(user=undefined)when no address was supplied → contract revert → 500. Now the controller validates the address (viemisAddress) and returns 200 + unregistered status before any chain read;getV4PaymasterStatusgets a try/catch (likegetSPOStatus) 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. FixesLAUNCH_READINESS_PLAN.mdstep 3.