Skip to content

Commit

Permalink
[Examples] Remove references to sui_programmability in codebase
Browse files Browse the repository at this point in the history
## Description

Replace all references to Move packages in `sui_programmability` with
equivalents in `./examples/move`, in preparation for deleting the
programmability directory.

In the process, I also:

- removed the tic-tac-toe example from the Sui SDK, as it has been
  replaced by a more full-featured E2E example.
- ported some modernised versions of the `basics` packages into the
  new `examples/move/basics` for use in tests.

## Test plan

CI and,

```
sui$ cargo simtest
```
  • Loading branch information
amnn committed Jul 11, 2024
1 parent 991909f commit 4175669
Show file tree
Hide file tree
Showing 16 changed files with 322 additions and 665 deletions.
2 changes: 1 addition & 1 deletion crates/sui-core/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ pub fn create_fake_cert_and_effect_digest<'a>(
}

pub fn compile_basics_package() -> CompiledPackage {
compile_example_package("../../sui_programmability/examples/basics")
compile_example_package("../../examples/move/basics")
}

pub fn compile_managed_coin_package() -> CompiledPackage {
Expand Down
12 changes: 6 additions & 6 deletions crates/sui-e2e-tests/tests/full_node_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use sui_sdk::wallet_context::WalletContext;
use sui_storage::key_value_store::TransactionKeyValueStore;
use sui_storage::key_value_store_metrics::KeyValueStoreMetrics;
use sui_test_transaction_builder::{
batch_make_transfer_transactions, create_devnet_nft, delete_devnet_nft, increment_counter,
batch_make_transfer_transactions, create_nft, delete_nft, increment_counter,
publish_basics_package, publish_basics_package_and_make_counter, publish_nfts_package,
TestTransactionBuilder,
};
Expand Down Expand Up @@ -672,7 +672,7 @@ async fn test_full_node_event_read_api_ok() {
// This is a poor substitute for the post processing taking some time
sleep(Duration::from_millis(1000)).await;

let (_sender, _object_id, digest2) = create_devnet_nft(context, package_id).await;
let (_sender, _object_id, digest2) = create_nft(context, package_id).await;

// Add a delay to ensure event processing is done after transaction commits.
sleep(Duration::from_secs(5)).await;
Expand Down Expand Up @@ -702,15 +702,15 @@ async fn test_full_node_event_query_by_module_ok() {
// This is a poor substitute for the post processing taking some time
sleep(Duration::from_millis(1000)).await;

let (_sender, _object_id, digest2) = create_devnet_nft(context, package_id).await;
let (_sender, _object_id, digest2) = create_nft(context, package_id).await;

// Add a delay to ensure event processing is done after transaction commits.
sleep(Duration::from_secs(5)).await;

// query by move event module
let params = rpc_params![EventFilter::MoveEventModule {
package: package_id,
module: ident_str!("devnet_nft").into()
module: ident_str!("testnet_nft").into()
}];
let page: EventPage = jsonrpc_client
.request("suix_queryEvents", params)
Expand Down Expand Up @@ -980,7 +980,7 @@ async fn test_get_objects_read() -> Result<(), anyhow::Error> {
let package_id = publish_nfts_package(&test_cluster.wallet).await.0;

// Create the object
let (sender, object_id, _) = create_devnet_nft(&test_cluster.wallet, package_id).await;
let (sender, object_id, _) = create_nft(&test_cluster.wallet, package_id).await;

let recipient = test_cluster.get_address_1();
assert_ne!(sender, recipient);
Expand Down Expand Up @@ -1012,7 +1012,7 @@ async fn test_get_objects_read() -> Result<(), anyhow::Error> {

// Delete the object
let response =
delete_devnet_nft(&test_cluster.wallet, recipient, package_id, object_ref_v2).await;
delete_nft(&test_cluster.wallet, recipient, package_id, object_ref_v2).await;
assert_eq!(
*response.effects.unwrap().status(),
SuiExecutionStatus::Success
Expand Down
6 changes: 3 additions & 3 deletions crates/sui-framework-tests/src/metered_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ fn test_metered_move_bytecode_verifier() {
let mut packages = vec![];
let with_unpublished_deps = false;
let path =
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../sui_programmability/examples/basics");
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../examples/move/basics");
let package = build(&path).unwrap();
packages.push(package.get_dependency_sorted_modules(with_unpublished_deps));
packages.push(package.get_dependency_sorted_modules(with_unpublished_deps));

let path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("../../sui_programmability/examples/fungible_tokens");
.join("../../examples/move/coin");
let package = build(&path).unwrap();
packages.push(package.get_dependency_sorted_modules(with_unpublished_deps));

Expand Down Expand Up @@ -289,7 +289,7 @@ fn test_build_and_verify_programmability_examples() {
let registry = &Registry::new();
let bytecode_verifier_metrics = Arc::new(BytecodeVerifierMetrics::new(registry));
let examples =
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../sui_programmability/examples");
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../examples");

for example in std::fs::read_dir(examples).unwrap() {
let Ok(example) = example else { continue };
Expand Down
26 changes: 0 additions & 26 deletions crates/sui-framework-tests/src/unit_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,32 +52,6 @@ fn run_bridge_tests() {
check_move_unit_tests(&buf);
}

#[test]
#[cfg_attr(msim, ignore)]
fn run_sui_programmability_examples_move_unit_tests() {
let examples_dir = Path::new(env!("CARGO_MANIFEST_DIR"))
.join("..")
.join("..")
.join("sui_programmability")
.join("examples");

for example in [
"basics",
"capy",
"crypto",
"defi",
"fungible_tokens",
"games",
"move_tutorial",
"nfts",
"objects_tutorial",
] {
let path = examples_dir.join(example);
check_package_builds(&path);
check_move_unit_tests(&path);
}
}

fn check_packages_recursively(path: &Path) -> io::Result<()> {
for entry in fs::read_dir(path).unwrap() {
let entry = entry?;
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-json-rpc-tests/tests/rpc_server_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ async fn test_publish() -> Result<(), anyhow::Error> {
let gas = objects.data.first().unwrap().object().unwrap();

let compiled_package = BuildConfig::new_for_testing().build(Path::new(
"../../sui_programmability/examples/fungible_tokens",
"../../examples/move/basics",
))?;
let compiled_modules_bytes =
compiled_package.get_package_base64(/* with_unpublished_deps */ false);
Expand Down
Loading

0 comments on commit 4175669

Please sign in to comment.