[BUG]: Handle JSON-RPC notifications and empty batches correctly
Maintainers usually reply within 1 day
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
- Domain
- backend-api-design
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 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
-32600and messageInvalid 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
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from StabilityNexus/MiniChain
-
automatic-copyright-year: keep README copyright currentPossibly taken @anshulchikhale30-p claimed this 7 days ago. Opendocumentation enhancement
Difficulty 3/5 Half a day Newbie friendliness 35/100
StabilityNexus/MiniChain#189 ·
Maintainers usually reply within 1 day
-
Difficulty: bound per-block EMA moves, add a difficulty floor, and preserve state across restartsPossibly taken @anshulchikhale30-p claimed this 7 days ago. Openbug documentation enhancement
Difficulty 4/5 3-5 days Newbie friendliness 25/100
StabilityNexus/MiniChain#187 ·
Maintainers usually reply within 1 day
-
[BUG]: Blocks on a different parent are classified INVALID and get the sender bannedPossibly taken @kansalakshat claimed this 7 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
StabilityNexus/MiniChain#185 ·
Maintainers usually reply within 1 day
-
[BUG]: P2P sync downloads full 500-block chunks without headers-first validationPossibly taken @anshulchikhale30-p claimed this 14 days ago. Openbug documentation enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
StabilityNexus/MiniChain#178 ·
Maintainers usually reply within 1 day
-
[FEATURE]: Add transaction and receipt lookup RPC methodsPossibly taken @Thushara3005 claimed this 10 days ago. Openenhancement
Difficulty 4/5 3-5 days Newbie friendliness 58/100
StabilityNexus/MiniChain#176 ·
Maintainers usually reply within 1 day
All issues in StabilityNexus/MiniChain
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
huggingface/datasets#9128 ·
Maintainers usually reply within 1 day
-
priority:low ready-for-dev
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
OpenHands/extensions#975 ·
Maintainers usually reply within 1 day
-
Function/dict state handlers can't supply provider-state injected values (`generate.provider_state`)Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pact-foundation/pact-python#1789 ·
Maintainers usually reply within 9 days
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
juandresrodca/AdminForge#66 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day