From 9f6592836be6b08709237733215cebd67340775e Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 15 Oct 2024 17:55:00 +0300 Subject: [PATCH] refactor!: rename `miden-sdk` crate to `miden` #338 --- Cargo.lock | 18 ++--- sdk/sdk/Cargo.toml | 2 +- tests/integration/src/compiler_test.rs | 6 +- .../rust-sdk/account-test/Cargo.lock | 10 +-- .../rust-sdk/account-test/Cargo.toml | 2 +- .../rust-sdk/account-test/src/lib.rs | 2 +- .../rust-sdk/basic-wallet/Cargo.lock | 10 +-- .../rust-sdk/basic-wallet/Cargo.toml | 2 +- .../rust-sdk/basic-wallet/src/bindings.rs | 66 +++++++++---------- .../rust-sdk/basic-wallet/src/lib.rs | 4 +- tools/cargo-miden/src/lib.rs | 14 ++-- 11 files changed, 68 insertions(+), 68 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8cb7818c1..c8d0fdcd2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2962,6 +2962,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "miden" +version = "0.0.7" +dependencies = [ + "miden-base-sys", + "miden-sdk-alloc", + "miden-stdlib-sys", +] + [[package]] name = "miden-air" version = "0.10.5" @@ -3140,15 +3149,6 @@ dependencies = [ "winter-prover", ] -[[package]] -name = "miden-sdk" -version = "0.0.7" -dependencies = [ - "miden-base-sys", - "miden-sdk-alloc", - "miden-stdlib-sys", -] - [[package]] name = "miden-sdk-alloc" version = "0.0.7" diff --git a/sdk/sdk/Cargo.toml b/sdk/sdk/Cargo.toml index 4e8550ea6..de6848f3b 100644 --- a/sdk/sdk/Cargo.toml +++ b/sdk/sdk/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "miden-sdk" +name = "miden" description = "Miden SDK" version.workspace = true rust-version.workspace = true diff --git a/tests/integration/src/compiler_test.rs b/tests/integration/src/compiler_test.rs index f89ea49bd..6df94dbc0 100644 --- a/tests/integration/src/compiler_test.rs +++ b/tests/integration/src/compiler_test.rs @@ -842,7 +842,7 @@ authors = [] [dependencies] miden-sdk-alloc = {{ path = "{sdk_alloc_path}" }} -miden-sdk = {{ path = "{sdk_path}" }} +miden = {{ path = "{sdk_path}" }} [lib] crate-type = ["cdylib"] @@ -873,8 +873,8 @@ fn my_panic(_info: &core::panic::PanicInfo) -> ! {{ #[global_allocator] static ALLOC: miden_sdk_alloc::BumpAlloc = miden_sdk_alloc::BumpAlloc::new(); -extern crate miden_sdk; -use miden_sdk::*; +extern crate miden; +use miden::*; extern crate alloc; use alloc::vec::Vec; diff --git a/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock index f926dcfa4..46e62894d 100644 --- a/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock @@ -21,18 +21,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" [[package]] -name = "miden-base-sys" +name = "miden" version = "0.0.7" dependencies = [ + "miden-base-sys", + "miden-sdk-alloc", "miden-stdlib-sys", ] [[package]] -name = "miden-sdk" +name = "miden-base-sys" version = "0.0.7" dependencies = [ - "miden-base-sys", - "miden-sdk-alloc", "miden-stdlib-sys", ] @@ -40,7 +40,7 @@ dependencies = [ name = "miden-sdk-account-test" version = "0.0.0" dependencies = [ - "miden-sdk", + "miden", "wee_alloc", ] diff --git a/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.toml b/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.toml index 2b8a9e198..fd45da9ad 100644 --- a/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.toml +++ b/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" crate-type = ["cdylib", "rlib"] [dependencies] -miden-sdk = { path = "../../../../sdk/sdk" } +miden = { path = "../../../../sdk/sdk" } wee_alloc = { version = "0.4.5", default-features = false } [profile.release] diff --git a/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs index e0c0602da..ebaea63fa 100644 --- a/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs @@ -1,6 +1,6 @@ extern crate alloc; -use miden_sdk::*; +use miden::*; #[global_allocator] static ALLOC: BumpAlloc = BumpAlloc::new(); diff --git a/tests/rust-apps-wasm/rust-sdk/basic-wallet/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/basic-wallet/Cargo.lock index 12a87cc27..f457071dc 100644 --- a/tests/rust-apps-wasm/rust-sdk/basic-wallet/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/basic-wallet/Cargo.lock @@ -6,23 +6,23 @@ version = 3 name = "basic_wallet" version = "0.1.0" dependencies = [ - "miden-sdk", + "miden", "wit-bindgen-rt", ] [[package]] -name = "miden-base-sys" +name = "miden" version = "0.0.7" dependencies = [ + "miden-base-sys", + "miden-sdk-alloc", "miden-stdlib-sys", ] [[package]] -name = "miden-sdk" +name = "miden-base-sys" version = "0.0.7" dependencies = [ - "miden-base-sys", - "miden-sdk-alloc", "miden-stdlib-sys", ] diff --git a/tests/rust-apps-wasm/rust-sdk/basic-wallet/Cargo.toml b/tests/rust-apps-wasm/rust-sdk/basic-wallet/Cargo.toml index d7e94a69b..56f8d6abe 100644 --- a/tests/rust-apps-wasm/rust-sdk/basic-wallet/Cargo.toml +++ b/tests/rust-apps-wasm/rust-sdk/basic-wallet/Cargo.toml @@ -11,7 +11,7 @@ crate-type = ["cdylib"] [dependencies] # Miden SDK consists of a stdlib (intrinsic functions for VM ops, stdlib functions and types) # and transaction kernel API for the Miden rollup -miden-sdk = { path = "../../../../sdk/sdk" } +miden = { path = "../../../../sdk/sdk" } wit-bindgen-rt = "0.28" diff --git a/tests/rust-apps-wasm/rust-sdk/basic-wallet/src/bindings.rs b/tests/rust-apps-wasm/rust-sdk/basic-wallet/src/bindings.rs index 55c9c577d..012d5d8a4 100644 --- a/tests/rust-apps-wasm/rust-sdk/basic-wallet/src/bindings.rs +++ b/tests/rust-apps-wasm/rust-sdk/basic-wallet/src/bindings.rs @@ -64,13 +64,13 @@ pub mod exports { arg3: f32, ) { #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - T::receive_asset(miden_sdk::CoreAsset { - inner: miden_sdk::Word { + T::receive_asset(miden::CoreAsset { + inner: miden::Word { inner: ( - miden_sdk::Felt { inner: arg0 }, - miden_sdk::Felt { inner: arg1 }, - miden_sdk::Felt { inner: arg2 }, - miden_sdk::Felt { inner: arg3 }, + miden::Felt { inner: arg0 }, + miden::Felt { inner: arg1 }, + miden::Felt { inner: arg2 }, + miden::Felt { inner: arg3 }, ), }, }); @@ -91,29 +91,29 @@ pub mod exports { ) { #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); T::send_asset( - miden_sdk::CoreAsset { - inner: miden_sdk::Word { + miden::CoreAsset { + inner: miden::Word { inner: ( - miden_sdk::Felt { inner: arg0 }, - miden_sdk::Felt { inner: arg1 }, - miden_sdk::Felt { inner: arg2 }, - miden_sdk::Felt { inner: arg3 }, + miden::Felt { inner: arg0 }, + miden::Felt { inner: arg1 }, + miden::Felt { inner: arg2 }, + miden::Felt { inner: arg3 }, ), }, }, - miden_sdk::Tag { - inner: miden_sdk::Felt { inner: arg4 }, + miden::Tag { + inner: miden::Felt { inner: arg4 }, }, - miden_sdk::NoteType { - inner: miden_sdk::Felt { inner: arg5 }, + miden::NoteType { + inner: miden::Felt { inner: arg5 }, }, - miden_sdk::Recipient { - inner: miden_sdk::Word { + miden::Recipient { + inner: miden::Word { inner: ( - miden_sdk::Felt { inner: arg6 }, - miden_sdk::Felt { inner: arg7 }, - miden_sdk::Felt { inner: arg8 }, - miden_sdk::Felt { inner: arg9 }, + miden::Felt { inner: arg6 }, + miden::Felt { inner: arg7 }, + miden::Felt { inner: arg8 }, + miden::Felt { inner: arg9 }, ), }, }, @@ -127,10 +127,10 @@ pub mod exports { ) -> f32 { #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::test_felt_intrinsics( - miden_sdk::Felt { inner: arg0 }, - miden_sdk::Felt { inner: arg1 }, + miden::Felt { inner: arg0 }, + miden::Felt { inner: arg1 }, ); - let miden_sdk::Felt { inner: inner1 } = result0; + let miden::Felt { inner: inner1 } = result0; _rt::as_f32(inner1) } #[doc(hidden)] @@ -163,17 +163,17 @@ pub mod exports { _rt::cabi_dealloc(base2, len2 * 1, 1); } pub trait Guest { - fn receive_asset(core_asset: miden_sdk::CoreAsset); + fn receive_asset(core_asset: miden::CoreAsset); fn send_asset( - core_asset: miden_sdk::CoreAsset, - tag: miden_sdk::Tag, - note_type: miden_sdk::NoteType, - recipient: miden_sdk::Recipient, + core_asset: miden::CoreAsset, + tag: miden::Tag, + note_type: miden::NoteType, + recipient: miden::Recipient, ); fn test_felt_intrinsics( - a: miden_sdk::Felt, - b: miden_sdk::Felt, - ) -> miden_sdk::Felt; + a: miden::Felt, + b: miden::Felt, + ) -> miden::Felt; fn test_stdlib(input: _rt::Vec) -> _rt::Vec; } #[doc(hidden)] diff --git a/tests/rust-apps-wasm/rust-sdk/basic-wallet/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/basic-wallet/src/lib.rs index daf5c2ef5..d7d124932 100644 --- a/tests/rust-apps-wasm/rust-sdk/basic-wallet/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/basic-wallet/src/lib.rs @@ -9,7 +9,7 @@ use alloc::vec::Vec; // Global allocator to use heap memory in no-std environment #[global_allocator] -static ALLOC: miden_sdk::BumpAlloc = miden_sdk::BumpAlloc::new(); +static ALLOC: miden::BumpAlloc = miden::BumpAlloc::new(); // Required for no-std crates #[panic_handler] @@ -22,7 +22,7 @@ bindings::export!(MyAccount with_types_in bindings); mod bindings; use bindings::exports::miden::basic_wallet::basic_wallet::Guest; -use miden_sdk::{ +use miden::{ add_asset, blake3_hash_1to1, create_note, remove_asset, CoreAsset, Felt, NoteType, Recipient, Tag, }; diff --git a/tools/cargo-miden/src/lib.rs b/tools/cargo-miden/src/lib.rs index 3f5b095f1..44c7290db 100644 --- a/tools/cargo-miden/src/lib.rs +++ b/tools/cargo-miden/src/lib.rs @@ -173,13 +173,13 @@ where for package in packages.iter_mut() { package.metadata.section.bindings.with = [ - ("miden:base/core-types@1.0.0/felt", "miden_sdk::Felt"), - ("miden:base/core-types@1.0.0/word", "miden_sdk::Word"), - ("miden:base/core-types@1.0.0/core-asset", "miden_sdk::CoreAsset"), - ("miden:base/core-types@1.0.0/account-id", "miden_sdk::AccountId"), - ("miden:base/core-types@1.0.0/tag", "miden_sdk::Tag"), - ("miden:base/core-types@1.0.0/note-type", "miden_sdk::NoteType"), - ("miden:base/core-types@1.0.0/recipient", "miden_sdk::Recipient"), + ("miden:base/core-types@1.0.0/felt", "miden::Felt"), + ("miden:base/core-types@1.0.0/word", "miden::Word"), + ("miden:base/core-types@1.0.0/core-asset", "miden::CoreAsset"), + ("miden:base/core-types@1.0.0/account-id", "miden::AccountId"), + ("miden:base/core-types@1.0.0/tag", "miden::Tag"), + ("miden:base/core-types@1.0.0/note-type", "miden::NoteType"), + ("miden:base/core-types@1.0.0/recipient", "miden::Recipient"), ] .into_iter() .map(|(k, v)| (k.to_string(), v.to_string()))