## Week 12 Update #### Besu – Discovery v5 Dual Mode Last week, I focused on enabling dual access for Discovery v5 in Besu. This required introducing a new DiscoveryMode enum with three values: `V4, V5, and DUAL.` For backward compatibility, the default is kept as V4, ensuring that existing networks are not affected. #### Challenges Encountered One challenge was making sure that this new DiscoveryMode parameter could be smoothly integrated across the networking stack without disrupting existing configurations. Besu’s networking configuration was tightly coupled with Discovery v4, so introducing Discovery v5 in a way that still preserved default behavior required careful handling. To solve this, I extended `NetworkingConfiguration` to accept `DiscoveryMode` through its builder pattern. This allowed me to: * Ensure null-safety by defaulting to V4 when no mode is explicitly provided. * Keep the implementation modular so that adding Discovery v5 and DUAL support does not interfere with existing code paths. I also introduced a new CLI flag `--discovery-mode` inside `BesuCommand`. This gives node operators the ability to explicitly choose their preferred discovery protocol (V4, V5, or DUAL). The value is passed through the builder and into the networking configuration, which then flows down into the P2P network startup logic. This way, users can continue running Besu with the existing defaults, but they also have the option to start experimenting with Discovery v5 or run in a hybrid dual mode once support is fully implemented. ## Next Steps - [ ] Define a minimal DiscV5 agent wrapper to begin handling v5 messages. - [ ] Implement a composite agent that allows DUAL mode to run both v4 and v5 side by side. - [ ] Most likely, I will also create my first PR this week with these changes, marking the first step towards integrating Discovery v5 into Besu.