ethereum / trin

An Ethereum portal client: a json-rpc server with nearly instant sync, and low CPU & storage usage
363 stars 111 forks source link

Fix "Unable to initialize bitlist for requested keys" error when trying to accept many items #1484

Open carver opened 2 hours ago

carver commented 2 hours ago

Got this in my logs, and it seems like it shouldn't ever happen:

2024-09-25T00:47:52.235808Z ERROR trin_history::events: Error processing portal history request, responding with empty TALKRESP error=Error while building accept message: Unable to initialize bitlist for requested keys. request.discv5.id=aaa81102dc43bd18

Error is triggered here: https://github.com/ethereum/trin/blob/b28beff3e83bc8bdcf7b9cf7bcb2f934bed652f0/portalnet/src/overlay/service.rs#L1057-L1059

The size of the Bitlist is defined by the Accept message here: https://github.com/ethereum/trin/blob/b28beff3e83bc8bdcf7b9cf7bcb2f934bed652f0/ethportal-api/src/types/portal_wire.rs#L567

So it seems that our accept message only stores up to 8 items. The specs suggest that it should accept up to 64.

I'll open a PR to increase this to 64.

carver commented 2 hours ago

Tangentially, I noticed a minor Bitlist bug: https://github.com/sigp/ethereum_ssz/pull/33