From 76de4024f00e7403b16a3719e261a6d775dd3ea7 Mon Sep 17 00:00:00 2001 From: Alisander Qoshqosh Date: Mon, 25 Mar 2024 17:20:23 +0400 Subject: [PATCH] add make test_utils pub(crate) --- contracts/Cargo.toml | 1 + contracts/src/test_utils.rs | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/contracts/Cargo.toml b/contracts/Cargo.toml index 2dea9934..3dc7753b 100644 --- a/contracts/Cargo.toml +++ b/contracts/Cargo.toml @@ -1,4 +1,5 @@ [package] +# TODO: Figure out public name before v0.1.0 release. name = "contracts" categories = ["no-std", "wasm"] description = "Contracts for Stylus" diff --git a/contracts/src/test_utils.rs b/contracts/src/test_utils.rs index 7eaeae51..b37d405e 100644 --- a/contracts/src/test_utils.rs +++ b/contracts/src/test_utils.rs @@ -1,7 +1,7 @@ //! Unit-testing utilities for Stylus contracts. use std::sync::{Mutex, MutexGuard}; -pub use wavm_shims::*; +pub(crate) use wavm_shims::*; /// A global static mutex. /// @@ -10,15 +10,15 @@ pub use wavm_shims::*; /// accesses storage in an non-overlapping manner. /// /// See [`with_storage`]. -pub static STORAGE_MUTEX: Mutex<()> = Mutex::new(()); +pub(crate) static STORAGE_MUTEX: Mutex<()> = Mutex::new(()); /// Acquires access to storage. -pub fn acquire_storage() -> MutexGuard<'static, ()> { +pub(crate) fn acquire_storage() -> MutexGuard<'static, ()> { STORAGE_MUTEX.lock().unwrap() } /// Decorates a closure by running it with exclusive access to storage. -pub fn with_storage(closure: impl FnOnce(&mut C)) { +pub(crate) fn with_storage(closure: impl FnOnce(&mut C)) { let _lock = acquire_storage(); let mut contract = C::default(); closure(&mut contract);