Skip to content
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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

akichidis
Copy link
Contributor

@akichidis akichidis commented Dec 18, 2024

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 on authority_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

SUI_SIM_CONFIG=regional_high_variance RUST_LOG=info,consensus_core=debug cargo simtest test_committee_start  --nocapture > output.txt 2>&1

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.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:

@akichidis akichidis requested a review from a team as a code owner December 18, 2024 20:28
Copy link

vercel bot commented Dec 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 6, 2025 7:19pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Feb 6, 2025 7:19pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Feb 6, 2025 7:19pm
sui-typescript-docs ⬜️ Ignored (Inspect) Feb 6, 2025 7:19pm

@akichidis akichidis temporarily deployed to sui-typescript-aws-kms-test-env December 18, 2024 20:28 — with GitHub Actions Inactive
@akichidis akichidis requested a review from mystenmark December 18, 2024 20:28
Copy link
Contributor

@mwtian mwtian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

sui-macros.workspace = true
sui-protocol-config.workspace = true
sui-simulator.workspace = true
Copy link
Contributor

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.

Copy link
Contributor

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?

@@ -0,0 +1,11 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
pub mod node;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why pub?

};

#[derive(Clone)]
#[allow(unused)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why unused?

Copy link
Contributor Author

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 {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@mwtian mwtian Jan 13, 2025

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?

Copy link
Contributor

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?

Copy link
Contributor Author

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.

@mwtian mwtian requested a review from arun-koshy December 19, 2024 18:22
@akichidis akichidis force-pushed the akichidis/consensus-simtests-support branch from d0015f4 to 69681b7 Compare January 13, 2025 14:37
@akichidis akichidis temporarily deployed to sui-typescript-aws-kms-test-env January 13, 2025 14:37 — with GitHub Actions Inactive
@akichidis akichidis temporarily deployed to sui-typescript-aws-kms-test-env January 13, 2025 14:42 — with GitHub Actions Inactive
@akichidis akichidis force-pushed the akichidis/consensus-simtests-support branch from f0f2da9 to 66033b5 Compare January 22, 2025 14:56
@akichidis akichidis temporarily deployed to sui-typescript-aws-kms-test-env January 22, 2025 14:56 — with GitHub Actions Inactive
Copy link
Contributor

@mwtian mwtian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants