Skip to content

Commit

Permalink
Revert "Add a simple test of Random to cluster-test" (MystenLabs#18585)
Browse files Browse the repository at this point in the history
  • Loading branch information
benr-ml authored and tx-tomcat committed Jul 29, 2024
1 parent 8b6c046 commit 0efad31
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 140 deletions.
4 changes: 1 addition & 3 deletions crates/sui-cluster-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ use test_case::{
coin_index_test::CoinIndexTest, coin_merge_split_test::CoinMergeSplitTest,
fullnode_build_publish_transaction_test::FullNodeBuildPublishTransactionTest,
fullnode_execute_transaction_test::FullNodeExecuteTransactionTest,
native_transfer_test::NativeTransferTest, random_beacon_test::RandomBeaconTest,
shared_object_test::SharedCounterTest,
native_transfer_test::NativeTransferTest, shared_object_test::SharedCounterTest,
};
use tokio::time::{self, Duration};
use tracing::{error, info};
Expand Down Expand Up @@ -309,7 +308,6 @@ impl ClusterTest {
TestCase::new(FullNodeExecuteTransactionTest {}),
TestCase::new(FullNodeBuildPublishTransactionTest {}),
TestCase::new(CoinIndexTest {}),
TestCase::new(RandomBeaconTest {}),
];

// TODO: improve the runner parallelism for efficiency
Expand Down
1 change: 0 additions & 1 deletion crates/sui-cluster-test/src/test_case.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ pub mod coin_merge_split_test;
pub mod fullnode_build_publish_transaction_test;
pub mod fullnode_execute_transaction_test;
pub mod native_transfer_test;
pub mod random_beacon_test;
pub mod shared_object_test;
72 changes: 0 additions & 72 deletions crates/sui-cluster-test/src/test_case/random_beacon_test.rs

This file was deleted.

47 changes: 1 addition & 46 deletions crates/sui-test-transaction-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ use std::path::PathBuf;
use sui_genesis_builder::validator_info::GenesisValidatorMetadata;
use sui_move_build::{BuildConfig, CompiledPackage};
use sui_sdk::rpc_types::{
get_new_package_obj_from_response, SuiObjectDataOptions, SuiTransactionBlockEffectsAPI,
SuiTransactionBlockResponse,
get_new_package_obj_from_response, SuiTransactionBlockEffectsAPI, SuiTransactionBlockResponse,
};
use sui_sdk::wallet_context::WalletContext;
use sui_types::base_types::{ObjectID, ObjectRef, SequenceNumber, SuiAddress};
Expand All @@ -24,7 +23,6 @@ use sui_types::transaction::{
DEFAULT_VALIDATOR_GAS_PRICE, TEST_ONLY_GAS_UNIT_FOR_HEAVY_COMPUTATION_STORAGE,
TEST_ONLY_GAS_UNIT_FOR_TRANSFER,
};
use sui_types::SUI_RANDOMNESS_STATE_OBJECT_ID;
use sui_types::{TypeTag, SUI_SYSTEM_PACKAGE_ID};

pub struct TestTransactionBuilder {
Expand Down Expand Up @@ -608,49 +606,6 @@ pub async fn increment_counter(
context.execute_transaction_must_succeed(txn).await
}

/// Executes a transaction that generates a new random u128 using Random and emits it as an event.
pub async fn emit_new_random_u128(
context: &WalletContext,
package_id: ObjectID,
) -> SuiTransactionBlockResponse {
let (sender, gas_object) = context.get_one_gas_object().await.unwrap().unwrap();
let rgp = context.get_reference_gas_price().await.unwrap();

let client = context.get_client().await.unwrap();
let random_obj = client
.read_api()
.get_object_with_options(
SUI_RANDOMNESS_STATE_OBJECT_ID,
SuiObjectDataOptions::new().with_owner(),
)
.await
.unwrap()
.into_object()
.unwrap();
let random_obj_owner = random_obj
.owner
.expect("Expect Randomness object to have an owner");

let Owner::Shared {
initial_shared_version,
} = random_obj_owner
else {
panic!("Expect Randomness to be shared object")
};
let random_call_arg = CallArg::Object(ObjectArg::SharedObject {
id: SUI_RANDOMNESS_STATE_OBJECT_ID,
initial_shared_version,
mutable: false,
});

let txn = context.sign_transaction(
&TestTransactionBuilder::new(sender, gas_object, rgp)
.move_call(package_id, "random", "new", vec![random_call_arg])
.build(),
);
context.execute_transaction_must_succeed(txn).await
}

/// Executes a transaction to publish the `nfts` package and returns the package id, id of the gas
/// object used, and the digest of the transaction.
pub async fn publish_nfts_package(
Expand Down
18 changes: 0 additions & 18 deletions sui_programmability/examples/basics/sources/random.move

This file was deleted.

0 comments on commit 0efad31

Please sign in to comment.