Skip to content

Commit

Permalink
[Examples] Remove references to sui_programmability in codebase (#1…
Browse files Browse the repository at this point in the history
…8595)

## 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
```

## Stack

- #18525 
- #18526 
- #18557 
- #18558 

---

## 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): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:

---------

Co-authored-by: Ronny Roland <[email protected]>
  • Loading branch information
amnn and ronny-mysten authored Jul 12, 2024
1 parent b6feede commit aae6f5c
Show file tree
Hide file tree
Showing 17 changed files with 340 additions and 676 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
13 changes: 6 additions & 7 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 @@ -1011,8 +1011,7 @@ async fn test_get_objects_read() -> Result<(), anyhow::Error> {
.expect("Failed to transfer coins to recipient");

// Delete the object
let response =
delete_devnet_nft(&test_cluster.wallet, recipient, package_id, object_ref_v2).await;
let response = delete_nft(&test_cluster.wallet, recipient, package_id, object_ref_v2).await;
assert_eq!(
*response.effects.unwrap().status(),
SuiExecutionStatus::Success
Expand Down
9 changes: 3 additions & 6 deletions crates/sui-framework-tests/src/metered_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,12 @@ fn test_metered_move_bytecode_verifier() {
// Check shared meter logic works across all publish in PT
let mut packages = vec![];
let with_unpublished_deps = false;
let path =
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../sui_programmability/examples/basics");
let path = 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");
let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../examples/move/coin");
let package = build(&path).unwrap();
packages.push(package.get_dependency_sorted_modules(with_unpublished_deps));

Expand Down Expand Up @@ -288,8 +286,7 @@ fn test_build_and_verify_programmability_examples() {
let meter_config = protocol_config.meter_config();
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");
let 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
5 changes: 2 additions & 3 deletions crates/sui-json-rpc-tests/tests/rpc_server_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,8 @@ async fn test_publish() -> Result<(), anyhow::Error> {
.await?;
let gas = objects.data.first().unwrap().object().unwrap();

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

0 comments on commit aae6f5c

Please sign in to comment.