Skip to content

Commit

Permalink
Remove unused method and define default test committee size in test-u…
Browse files Browse the repository at this point in the history
…tils (MystenLabs#9833)

## Description 

Clean up crypto.rs by removing an unused method and define default test
committee size in test-utils instead.

## Test Plan 

Unit tests.
  • Loading branch information
jonas-lj authored Mar 27, 2023
1 parent 46b3844 commit a014288
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 1 addition & 7 deletions crates/sui-types/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,13 +546,7 @@ where
get_key_pair_from_rng(&mut OsRng)
}

pub const TEST_COMMITTEE_SIZE: usize = 4;

pub fn random_committee_key_pairs() -> Vec<AuthorityKeyPair> {
random_committee_key_pairs_of_size(TEST_COMMITTEE_SIZE)
}

/// Generate a random committee key pairs with size of TEST_COMMITTEE_SIZE.
/// Generate a random committee key pairs with a given committee size
pub fn random_committee_key_pairs_of_size(size: usize) -> Vec<AuthorityKeyPair> {
let mut rng = StdRng::from_seed([0; 32]);
(0..size)
Expand Down
4 changes: 3 additions & 1 deletion crates/test-utils/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ use sui_core::authority_client::AuthorityAPI;
use sui_core::authority_client::NetworkAuthorityClient;
pub use sui_node::{SuiNode, SuiNodeHandle};
use sui_types::base_types::ObjectID;
use sui_types::crypto::TEST_COMMITTEE_SIZE;
use sui_types::messages::ObjectInfoRequest;
use sui_types::multiaddr::Multiaddr;
use sui_types::object::Object;

/// The default network buffer size of a test authority.
pub const NETWORK_BUFFER_SIZE: usize = 65_000;

/// Default committee size for tests
pub const TEST_COMMITTEE_SIZE: usize = 4;

/// Make an authority config for each of the `TEST_COMMITTEE_SIZE` authorities in the test committee.
pub fn test_authority_configs() -> NetworkConfig {
test_and_configure_authority_configs(TEST_COMMITTEE_SIZE)
Expand Down

0 comments on commit a014288

Please sign in to comment.