-
Notifications
You must be signed in to change notification settings - Fork 11.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Consensus] introduce consensus only simtests #20683
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Skipped Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
consensus/core/Cargo.toml
Outdated
sui-macros.workspace = true | ||
sui-protocol-config.workspace = true | ||
sui-simulator.workspace = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in [target.'cfg(msim)'.dependencies]
, and potentially other additional dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe it is better to have a consensus-simulator
crate?
consensus/core/src/swarm/mod.rs
Outdated
@@ -0,0 +1,11 @@ | |||
// Copyright (c) Mysten Labs, Inc. | |||
// SPDX-License-Identifier: Apache-2.0 | |||
pub mod node; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why pub
?
consensus/core/src/swarm/node.rs
Outdated
}; | ||
|
||
#[derive(Clone)] | ||
#[allow(unused)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why unused
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The non-simulation version of Node can be used for non-simulation tests where this is needed. Right now I haven't written a test for it, but most probably we might need this.
use std::sync::Arc; | ||
use tracing::info; | ||
|
||
pub(crate) struct AuthorityNodeContainer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it necessary to create this struct when not using simtest
target?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the same reason as above, if we want to use swarm for a non-sim test then we should have the corresponding structs available. Then we just import the implementation depending on whether we are running a simtest or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give an example on swarm for a non-sim consensus test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ones in AuthorityNoe today could be sort of an example? Practically everything we might even want to run in a multithreaded fashion I would say.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does AuthorityNodeContainer provide on top of the existing AuthorityNode struct? Or is it to make transitioning tests between cfg(test) and cfg(msim) easier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, what is the thoughts on making this struct cfg(test) when not used in simtests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does AuthorityNodeContainer provide on top of the existing AuthorityNode struct? Or is it to make transitioning tests between cfg(test) and cfg(msim) easier?
AuthorityNodeContainer
is practically allow us managing the AuthorityNode
and boot under the simulation framework handler thttps://github.com//pull/20683/files#diff-eb8c4b54e61d2d23dd2993bbd667be09e6200499afe7b38ce555d3b25b90062fR46 . So it's kind of a lightweight wrapper.
d0015f4
to
69681b7
Compare
f0f2da9
to
66033b5
Compare
…e ip allocation issues. Create example simtest.
…. Extract the authority building method and reuse across containers.
b5bfd91
to
35b8d60
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
Description
PR is introducing the framework to enable us run Consensus-only simtests. Looking on the existing sui-swarm it would be a bit challenging to reuse as APIs are different and especially when we need to access consensus specific components.
The PR is using similar patterns that have been used in sui-swarm but I am expecting to refine this as we go. This might be a good start for now. A simple simtest method has been added for the time being
test_committee_start_simple
. Eventually we want to replace the tests onauthority_node
and add a few more cases. Motivation to do this has been the Garbage Collection work when investigating some edge cases where reproducibility was important to confirm the issues.Example to run this simtest with additional logging, a high regional variance in latency, and outputting the result in
output.txt
Test plan
CI
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.