From 5696bcb1da19ab0b076f6cb25c635fb62444b15a Mon Sep 17 00:00:00 2001 From: Itzik Grossman Date: Mon, 31 Jul 2023 00:06:08 +0300 Subject: [PATCH] Merge master with the cache changes --- cosmwasm/enclaves/execute/src/ecalls.rs | 2 -- cosmwasm/enclaves/execute/src/lib.rs | 2 ++ cosmwasm/enclaves/execute/src/sdk_entrypoints.rs | 8 ++++++++ .../shared/contract-engine/src/contract_validation.rs | 6 ------ 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cosmwasm/enclaves/execute/src/ecalls.rs b/cosmwasm/enclaves/execute/src/ecalls.rs index cf2d3cb54..40db781d6 100644 --- a/cosmwasm/enclaves/execute/src/ecalls.rs +++ b/cosmwasm/enclaves/execute/src/ecalls.rs @@ -1,7 +1,5 @@ use sgx_types::sgx_status_t; -pub use read_verifier::ecalls::ecall_submit_store_roots; - /// # Safety /// This function reads buffers which must be correctly initialized by the caller, /// see safety section of slice::[from_raw_parts](https://doc.rust-lang.org/std/slice/fn.from_raw_parts.html#safety) diff --git a/cosmwasm/enclaves/execute/src/lib.rs b/cosmwasm/enclaves/execute/src/lib.rs index f4578a931..3110a4675 100644 --- a/cosmwasm/enclaves/execute/src/lib.rs +++ b/cosmwasm/enclaves/execute/src/lib.rs @@ -18,6 +18,8 @@ pub mod registration; mod sdk_entrypoints; mod tests; +pub use sdk_entrypoints::ecall_app_begin_blocker; + #[cfg(feature = "production")] #[ctor] fn init_logger() { diff --git a/cosmwasm/enclaves/execute/src/sdk_entrypoints.rs b/cosmwasm/enclaves/execute/src/sdk_entrypoints.rs index 3e87111ea..b62b56f82 100644 --- a/cosmwasm/enclaves/execute/src/sdk_entrypoints.rs +++ b/cosmwasm/enclaves/execute/src/sdk_entrypoints.rs @@ -23,6 +23,11 @@ macro_rules! validate_input_length { }; } +/// # Safety +/// This function must only be called with valid pointers and lengths. +/// - `in_roots` and `in_roots_len`: must point to a valid sequence of bytes representing roots. +/// - `in_compute_root` and `in_compute_root_len`: must point to a valid sequence of bytes representing compute roots. +/// It's the caller's responsibility to ensure that the pointers are valid and the lengths are correct. #[no_mangle] pub unsafe extern "C" fn ecall_app_begin_blocker( in_roots: *const u8, @@ -55,5 +60,8 @@ pub unsafe extern "C" fn ecall_app_begin_blocker( } } +/// # Safety +/// This function's safety requirements depend on the expected implementation. +/// Since the function body is empty, there are currently no specific safety concerns. #[no_mangle] pub unsafe extern "C" fn end_blocker() {} diff --git a/cosmwasm/enclaves/shared/contract-engine/src/contract_validation.rs b/cosmwasm/enclaves/shared/contract-engine/src/contract_validation.rs index b4b6e6d29..7dd7757a5 100644 --- a/cosmwasm/enclaves/shared/contract-engine/src/contract_validation.rs +++ b/cosmwasm/enclaves/shared/contract-engine/src/contract_validation.rs @@ -50,12 +50,6 @@ fn is_subslice(larger: &[u8], smaller: &[u8]) -> bool { false } -#[cfg(feature = "light-client-validation")] -pub fn is_last_msg_in_block() -> bool { - let verified_msgs = VERIFIED_MESSAGES.lock().unwrap(); - return verified_msgs.remaining() == 0; -} - #[cfg(feature = "light-client-validation")] pub fn verify_block_info(base_env: &BaseEnv) -> Result<(), EnclaveError> { let verified_msgs = VERIFIED_MESSAGES.lock().unwrap();