[BUG]: Handle JSON-RPC notifications and empty batches correctly

未关闭 适合新手
#177 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@Muneerali199 已经在做这个了。

开始于 2026年11月11日。

  • #183 来自 @Muneerali199 —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python

调研方向

从minichain/rpc.py开始,追踪请求如何被分派以及响应如何组装。检查现有的RPC请求和批处理测试,然后添加对通知、批处理中包含通知以及空批处理的测试。完成标准是通知不产生响应,空批处理返回一个-32600 Invalid Request错误,并且现有RPC测试通过。

由索引模型根据 Issue 内容生成。

描述

bug
Bug Description
Description

I noticed two JSON-RPC 2.0 compliance issues in MiniChain's RPC request handling.

Currently, requests without an id receive a response with "id": null, even though JSON-RPC notifications should not receive any response. Also, sending an empty batch ([]) returns an empty array instead of an Invalid Request error.

Steps to Reproduce

1. Notification handling

Send the following request:

{
  "jsonrpc": "2.0",
  "method": "mc_blockNumber"
}

Observe that the server returns a JSON-RPC response even though the request is a notification.

2. Empty batch handling

Send an empty batch:

[]

Observe that the server returns an empty array instead of an error response.

Expected Behavior
  • Valid notification requests should be processed without returning a JSON-RPC response.
  • An empty batch should return a single error response with code -32600 and message Invalid Request.
Actual Behavior
  • Notifications currently receive a response with "id": null.
  • Empty batches currently return [].
Proposed Fix

Update the request-handling logic in minichain/rpc.py to follow JSON-RPC 2.0 notification and batch-processing requirements.

Testing
  • Test valid notification requests.
  • Test notifications inside a batch.
  • Test empty batch requests.
  • Ensure existing RPC request and batch tests continue to pass.
Steps to Reproduce

No response

Logs and Screenshots

No response

Environment Details

No response

Impact

Medium

Code of Conduct
  • I have joined the Discord server and will post updates there
  • I have searched existing issues to avoid duplicates
主要语言
Python
星标
12
派生
27
平均合并
2 分钟
30 天内合并 PR
1

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

StabilityNexus/MiniChain 的其他 Issue

查看 StabilityNexus/MiniChain 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。