rollmint icon indicating copy to clipboard operation
rollmint copied to clipboard

Use parametrized topic ID in P2P layer of go-header library

Open Manav-Aggarwal opened this issue 2 years ago • 5 comments

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.

Manav-Aggarwal avatar Jun 19 '23 01:06 Manav-Aggarwal

go-header has parametrized networkID for users of Subscriber. Isn't this enough?

Wondertan avatar Jun 19 '23 12:06 Wondertan

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.

Manav-Aggarwal avatar Jun 19 '23 14:06 Manav-Aggarwal

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

Wondertan avatar Jun 22 '23 08:06 Wondertan

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.

Manav-Aggarwal avatar Jun 22 '23 19:06 Manav-Aggarwal

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

tzdybal avatar Feb 20 '25 21:02 tzdybal