Seed tokio with the world rng #245
Merged
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.
The tokio runtime builder provides rng_seed as a way to make "certain parts" of the runtime deterministic. We can use it to make turmoil simulations more deterministic. Turmoil already allows specifying a custom seeded world rng through
Builder::build_with_rng. We just have to make sure that rng is used to seed the tokio runtime.I've taken the approach of introducing a new
rt::Configstruct, to avoid having to juggle two config arguments (enable_ioandrng) in multiple places. Though the juggling wouldn't be too bad either, so happy to drop thert::Configstruct if that's preferred.Caveats
tokio::runtime::Builder::rng_seedis only available under thetokio_unstableconfig. Nothing we can do about that.Rt::no_softwareconstructor. I think for now that's fine since no-software runtimes are only used for timekeeping currently. Once we start using it for more, we'll need to reconsider.