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

Abierto Apto para principiantes
#177 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@Muneerali199 ya está trabajando en esto.

Desde el 11/11/2026.

  • #183 de @Muneerali199 — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python

Línea de trabajo

Empieza en minichain/rpc.py y sigue cómo se distribuyen las solicitudes y se construyen las respuestas. Revisa las pruebas existentes de solicitudes RPC y de lotes, y añade cobertura para una notificación, una notificación en un lote y un lote vacío. La tarea estará completa cuando las notificaciones no produzcan ninguna respuesta y un lote vacío devuelva un error -32600 Invalid Request, y las pruebas RPC existentes pasen.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
Python
Estrellas
12
Forks
27
Merge medio
2 min
PR fusionados (30 d)
1

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de StabilityNexus/MiniChain

Todos los issues de StabilityNexus/MiniChain

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.