rollmint
rollmint copied to clipboard
Use parametrized topic ID in P2P layer of go-header library
Currently, HeaderExchangeService and BlockExchangeService do not use a parametrized topic ID in the P2P layer of go-header library. Once, go-header library supports a parametrized topic ID, we should make these exchange services use customized P2P topic IDs.
go-header has parametrized networkID for users of Subscriber. Isn't this enough?
This came up while adding a BlockExchangeService where the networkID had to be changed to the current chain ID with -block appended to it for it to work. Ideally, when we want two different P2P layers for the same chain, we can have separate topics with the same chainID.
Ideally, when we want two different P2P layers for the same chain, we can have separate topics with the same chainID.
Can you elaborate on this? Why would the same chain want different p2p layers? This seems counterintuitive to me. cc @nashqueue
Yeah, for a single rollup chain, there can be a P2P network for full nodes to exchange blocks and another P2P network for all nodes (full and light) to exchange headers.
Currently we're appending suffix to chain ID, and pass this as WithSubscriberNetworkID option to go-header, https://github.com/rollkit/rollkit/blob/cd056f171fe673d261282da510678cab3aa54a83/block/sync_service.go#L351-L353
https://github.com/rollkit/rollkit/blob/cd056f171fe673d261282da510678cab3aa54a83/block/sync_service.go#L179