Organize gossip random packet generation #4880
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Gossip's random packet generation was never designed to be reproducible, and did not cover all variants of all packets. As a result, it is really hard to make reproducible pseudorandom gossip packets for purposes such as wire format validation and to track down possible incompatibilities between implemenations.
Also all of that code was not guarded by dev-context-only-utils feature-gate, making it accidentally usable in prod code.
Summary of Changes
All of the changes here concern only the code that runs in tests and benches.
This intended to be the first step to address #4879