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

Open Beginner friendly
#177 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Muneerali199 is already working on this.

Since Nov 11, 2026.

  • #183 by @Muneerali199 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start in minichain/rpc.py and trace how requests are dispatched and responses are assembled. Check the existing RPC request and batch tests, then add coverage for a notification, a notification in a batch, and an empty batch. Done means notifications produce no response and an empty batch returns one -32600 Invalid Request error, with existing RPC tests passing.

Written by the indexing model from the issue text.

Description

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
Dominant language
Python
Stars
12
Forks
27
Avg merge
2m
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from StabilityNexus/MiniChain

All issues in StabilityNexus/MiniChain

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.