# Week4 Update
## TL;DR
1. Finalize the proposal for zig-libp2p QUIC+Gossipsub support and open the [PR](https://github.com/eth-protocol-fellows/cohort-six/pull/169)
2. Start to develop `QuicListener` for `QuicTransport` and make a draft [PR](https://github.com/zen-eth/zig-libp2p/pull/30)
## Dive into Gossipsub
This week I read the contents of the Gossipsub spec carefully to understand how it works and all the modules. Combined with the current zig-libp2p design, the high-level design of the Gossipsub part of the proposal was completed.
### Ambient Peer Discovery
This is out of the scope for this propossal, from the [spec](https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.0.md#ambient-peer-discovery), for testing purpose, we can use a known list peers as bootstrap peers.
### Wire Protocol Message
Use a [zig protobuf library](https://github.com/Arwalk/zig-protobuf) to implement codec for messages defined below.
- Common Wire Format
The common wire format which used protobuf is defined [here](https://github.com/libp2p/specs/tree/master/pubsub#the-rpc).
- Gossipsub Control Message
The specific control message is defined [here](https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.0.md#control-messages).
### Gossipsub Parameters
It need maintance all these configurable [parameters](https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.0.md#parameters) in a `GossipsubParams` struct.
### Core Gossip Router
It need implement the core `GossipsubRouter` follow the [spec](https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.0.md#router-state), it is the most important component which keeps track all the states.
- Peer State
It need maintain the [core state](https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.0.md#peering-state) specific for the Gossipsub and common state for the common pubsub framework.
- Message Cache
Implement a [cache](https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.0.md#message-cache) for messages during the history windows.
### Heartbeat
Implement the [heartbeat mechanism](https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.0.md#heartbeat) follow the spec.
### Topic Membership
It need implement the two topic membership operations JOIN(topic) and LEAVE(topic) follow the [spec](https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.0.md#topic-membership).
## Develop `QuicListener`
This week I started implementing `QuicListener`, there are a lot of projects that are currently implementing the QUIC transport layer based on the [lsquic library](https://lsquic.readthedocs.io/en/latest/), I read the QUIC implementation of [cpp-libp2p](https://github.com/libp2p/cpp-libp2p/tree/master/include/libp2p/transport/quic) and the QUIC implementation of the Solana client [Sig](https://github.com/Syndica/sig/blob/c807735ab5dc968afd70e2171d3579a84fb2df60/src/net/quic_client.zig), and learned how to use the lsquic API. So far I've implemented most of the code for 'QuicListener' in the [PR](https://github.com/zen-eth/zig-libp2p/pull/30).
## Next
Try to implement libp2p TLS peer auth.