Force-inclusion server rejects JSON-RPC batch requests with -32700

Aperta
#3,529 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
api, backend

Direzione di ricerca

Read apps/evm/server/force_inclusion.go and handleJSONRPC first, then review the existing tests in apps/evm/server/force_inclusion_test.go. Check how single requests are routed and how the response helpers handle errors. Done when batch requests without eth_sendRawTransaction are proxied and batches containing it or empty batches receive the specified invalid request error; the issue reports two tests and go test ./server/ as verification.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

needs-triage
Version Information

ev-node: main @ e8626b1 (apps/evm, force-inclusion server in apps/evm/server/force_inclusion.go)
Execution Implementation: any EVM execution RPC behind the proxy

System Information

Found by reading the code and reproduced with a unit test (httptest), not on a running network.
OS Type & Version: Linux (cloud dev box)
Architecture: amd64

Network Configuration

No response

Development Environment

Go Version: 1.26.6 (as in apps/evm/go.mod)

Configuration Details

Default force-inclusion server config, with an execution RPC URL set (so that unknown methods are proxied).

Steps to Reproduce
  1. Start the force-inclusion server with an execution RPC URL.
  2. Send a JSON-RPC batch, e.g.
    [{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]},{"jsonrpc":"2.0","id":2,"method":"eth_blockNumber","params":[]}]
  3. Clients do this on their own: e.g. ethers v6 JsonRpcProvider groups requests sent within a few milliseconds into one batch by default.
Expected Result

A batch without eth_sendRawTransaction is forwarded to the execution RPC like a single request is today.

A batch that contains eth_sendRawTransaction should not be forwarded as-is, because the transaction would then reach the execution RPC instead of going through forced inclusion. It should get an explicit error (or be handled per element).

Actual Result

handleJSONRPC always unmarshals the body into a single JSONRPCRequest. A JSON array fails that, so the server answers {"error":{"code":-32700,"message":"invalid JSON"}} and nothing reaches the execution RPC, although the request is valid JSON-RPC 2.0.

Relevant Logs

Additional Information

Proposed fix (small, I have it with tests):

  • if the body starts with [, handle it as a batch;
  • a batch without eth_sendRawTransaction is proxied unchanged to the execution RPC;
  • a batch containing eth_sendRawTransaction, or an empty batch, is rejected with -32600 (Invalid Request). Handling each element separately is possible too, but needs a larger refactor of the write* helpers, so I kept it minimal; happy to do it the other way if you prefer.

Two tests in apps/evm/server/force_inclusion_test.go fail on main (the batch is not forwarded / -32700 instead of -32600) and pass with the change; go test ./server/, gofmt and go vet are clean. I haven't run golangci-lint or the e2e tests.

If this approach is fine, I can open the PR.

This report was written with help from an AI assistant (Claude Code) and reviewed before submitting.

Lingua principale
Go
Stelle
362
Fork
295
Merge medio
9h 29m
PR unite (30g)
3

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di evstack/ev-node

Tutte le issue di evstack/ev-node

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.