From a25bb62b58564c7205fd55f48c3aaebc5a1defe0 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Mon, 10 Jun 2024 16:24:46 +0300 Subject: [PATCH 01/15] managed dealloc - api --- .../base/src/api/managed_types/managed_type_api_impl.rs | 6 ++++++ framework/base/src/types/managed/basic/managed_buffer.rs | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/framework/base/src/api/managed_types/managed_type_api_impl.rs b/framework/base/src/api/managed_types/managed_type_api_impl.rs index 1d2ead32ec..985678da17 100644 --- a/framework/base/src/api/managed_types/managed_type_api_impl.rs +++ b/framework/base/src/api/managed_types/managed_type_api_impl.rs @@ -65,4 +65,10 @@ pub trait ManagedTypeApiImpl: fn get_token_ticker_len(&self, token_id_len: usize) -> usize { super::token_identifier_util::get_token_ticker_len(token_id_len) } + + fn drop_managed_buffer(&self, _handle: Self::ManagedBufferHandle) {} + fn drop_big_float(&self, _handle: Self::BigFloatHandle) {} + fn drop_big_int(&self, _handle: Self::BigIntHandle) {} + fn drop_elliptic_curve(&self, _handle: Self::EllipticCurveHandle) {} + fn drop_managed_map(&self, _handle: Self::ManagedMapHandle) {} } diff --git a/framework/base/src/types/managed/basic/managed_buffer.rs b/framework/base/src/types/managed/basic/managed_buffer.rs index d232776b2e..8152080317 100644 --- a/framework/base/src/types/managed/basic/managed_buffer.rs +++ b/framework/base/src/types/managed/basic/managed_buffer.rs @@ -1,8 +1,7 @@ use crate::{ abi::{TypeAbi, TypeAbiFrom, TypeName}, api::{ - use_raw_handle, ErrorApiImpl, HandleConstraints, InvalidSliceError, ManagedBufferApiImpl, - ManagedTypeApi, StaticVarApiImpl, + use_raw_handle, ErrorApiImpl, HandleConstraints, InvalidSliceError, ManagedBufferApiImpl, ManagedTypeApi, ManagedTypeApiImpl, StaticVarApiImpl }, codec::{ DecodeErrorHandler, Empty, EncodeErrorHandler, NestedDecode, NestedDecodeInput, @@ -350,6 +349,12 @@ impl Clone for ManagedBuffer { } } +impl Drop for ManagedBuffer { + fn drop(&mut self) { + M::managed_type_impl().drop_managed_buffer(self.get_handle()); + } +} + impl PartialEq for ManagedBuffer { #[inline] fn eq(&self, other: &Self) -> bool { From 9dd2bffd3fe96b8dd5ee95388ce41d97f1a277e4 Mon Sep 17 00:00:00 2001 From: Alin Cruceat Date: Tue, 18 Jun 2024 09:41:10 +0300 Subject: [PATCH 02/15] drop for managed buffer --- .../basic_features_managed_buffer_test.rs | 7 +++++++ .../managed_types/managed_type_api_impl.rs | 21 ++++++++++++++----- .../src/types/managed/basic/managed_buffer.rs | 5 +++-- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/contracts/feature-tests/basic-features/tests/basic_features_managed_buffer_test.rs b/contracts/feature-tests/basic-features/tests/basic_features_managed_buffer_test.rs index 88320b17f6..e775c5e167 100644 --- a/contracts/feature-tests/basic-features/tests/basic_features_managed_buffer_test.rs +++ b/contracts/feature-tests/basic-features/tests/basic_features_managed_buffer_test.rs @@ -15,3 +15,10 @@ fn test_managed_address_zero() { let result = bf.managed_address_zero(); assert_eq!(ManagedAddress::zero(), result); } + +#[test] +fn test_managed_buffer_destructor() { + let my_buffer = ManagedBuffer::::from(b"my buffer"); + assert_eq!(my_buffer, managed_buffer!(b"my buffer")); + drop(my_buffer); +} diff --git a/framework/base/src/api/managed_types/managed_type_api_impl.rs b/framework/base/src/api/managed_types/managed_type_api_impl.rs index 985678da17..c0f34284c0 100644 --- a/framework/base/src/api/managed_types/managed_type_api_impl.rs +++ b/framework/base/src/api/managed_types/managed_type_api_impl.rs @@ -66,9 +66,20 @@ pub trait ManagedTypeApiImpl: super::token_identifier_util::get_token_ticker_len(token_id_len) } - fn drop_managed_buffer(&self, _handle: Self::ManagedBufferHandle) {} - fn drop_big_float(&self, _handle: Self::BigFloatHandle) {} - fn drop_big_int(&self, _handle: Self::BigIntHandle) {} - fn drop_elliptic_curve(&self, _handle: Self::EllipticCurveHandle) {} - fn drop_managed_map(&self, _handle: Self::ManagedMapHandle) {} + fn drop_managed_buffer(&self, handle: Self::ManagedBufferHandle) { + drop(handle) + } + + fn drop_big_float(&self, handle: Self::BigFloatHandle) { + drop(handle) + } + fn drop_big_int(&self, handle: Self::BigIntHandle) { + drop(handle) + } + fn drop_elliptic_curve(&self, handle: Self::EllipticCurveHandle) { + drop(handle) + } + fn drop_managed_map(&self, handle: Self::ManagedMapHandle) { + drop(handle) + } } diff --git a/framework/base/src/types/managed/basic/managed_buffer.rs b/framework/base/src/types/managed/basic/managed_buffer.rs index 8152080317..34ec9e44c9 100644 --- a/framework/base/src/types/managed/basic/managed_buffer.rs +++ b/framework/base/src/types/managed/basic/managed_buffer.rs @@ -1,7 +1,8 @@ use crate::{ abi::{TypeAbi, TypeAbiFrom, TypeName}, api::{ - use_raw_handle, ErrorApiImpl, HandleConstraints, InvalidSliceError, ManagedBufferApiImpl, ManagedTypeApi, ManagedTypeApiImpl, StaticVarApiImpl + use_raw_handle, ErrorApiImpl, HandleConstraints, InvalidSliceError, ManagedBufferApiImpl, + ManagedTypeApi, StaticVarApiImpl, }, codec::{ DecodeErrorHandler, Empty, EncodeErrorHandler, NestedDecode, NestedDecodeInput, @@ -351,7 +352,7 @@ impl Clone for ManagedBuffer { impl Drop for ManagedBuffer { fn drop(&mut self) { - M::managed_type_impl().drop_managed_buffer(self.get_handle()); + let _ = core::mem::replace(&mut self.get_handle(), unsafe { core::mem::zeroed() }); } } From 951a7d817ecd651ac2a2fc2d7e9d94495ed983f7 Mon Sep 17 00:00:00 2001 From: Alin Cruceat Date: Tue, 18 Jun 2024 09:56:33 +0300 Subject: [PATCH 03/15] leave just managed buffer destructor --- .../api/managed_types/managed_type_api_impl.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/framework/base/src/api/managed_types/managed_type_api_impl.rs b/framework/base/src/api/managed_types/managed_type_api_impl.rs index c0f34284c0..6446aa896d 100644 --- a/framework/base/src/api/managed_types/managed_type_api_impl.rs +++ b/framework/base/src/api/managed_types/managed_type_api_impl.rs @@ -70,16 +70,8 @@ pub trait ManagedTypeApiImpl: drop(handle) } - fn drop_big_float(&self, handle: Self::BigFloatHandle) { - drop(handle) - } - fn drop_big_int(&self, handle: Self::BigIntHandle) { - drop(handle) - } - fn drop_elliptic_curve(&self, handle: Self::EllipticCurveHandle) { - drop(handle) - } - fn drop_managed_map(&self, handle: Self::ManagedMapHandle) { - drop(handle) - } + fn drop_big_float(&self, _handle: Self::BigFloatHandle) {} + fn drop_big_int(&self, _handle: Self::BigIntHandle) {} + fn drop_elliptic_curve(&self, _handle: Self::EllipticCurveHandle) {} + fn drop_managed_map(&self, _handle: Self::ManagedMapHandle) {} } From 94e69817de48657a45bf13b432909477dd56d2a0 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Sun, 27 Oct 2024 17:26:26 +0200 Subject: [PATCH 04/15] managed dealloc - implementation --- .../managed_types/managed_type_api_impl.rs | 5 +-- .../src/types/managed/basic/managed_buffer.rs | 3 +- .../scenario/src/api/impl_vh/debug_api.rs | 12 +++---- .../scenario/src/api/impl_vh/single_tx_api.rs | 5 ++- .../scenario/src/api/impl_vh/static_api.rs | 9 ++---- .../scenario/src/api/impl_vh/vm_hooks_api.rs | 12 +++---- .../src/api/impl_vh/vm_hooks_backend.rs | 11 +++---- .../scenario/src/api/managed_type_api_vh.rs | 24 ++++++++++++++ framework/scenario/src/debug_executor.rs | 2 ++ .../src/debug_executor/vm_hooks_debugger.rs | 32 +++++++++++++++++++ vm/src/tx_mock/tx_managed_types/handle_map.rs | 4 +++ .../tx_mock/tx_managed_types/tx_big_float.rs | 4 +++ vm/src/tx_mock/tx_managed_types/tx_big_int.rs | 4 +++ .../tx_managed_types/tx_managed_buffer.rs | 4 +++ .../tx_managed_types/tx_managed_map.rs | 4 +++ vm/src/vm_hooks/vh_dispatcher.rs | 2 +- .../vh_managed_types/vh_big_float.rs | 4 +++ .../vh_handler/vh_managed_types/vh_big_int.rs | 4 +++ .../vh_managed_types/vh_managed_buffer.rs | 4 +++ .../vh_managed_types/vh_managed_map.rs | 4 +++ 20 files changed, 120 insertions(+), 33 deletions(-) create mode 100644 framework/scenario/src/debug_executor/vm_hooks_debugger.rs diff --git a/framework/base/src/api/managed_types/managed_type_api_impl.rs b/framework/base/src/api/managed_types/managed_type_api_impl.rs index 6446aa896d..985678da17 100644 --- a/framework/base/src/api/managed_types/managed_type_api_impl.rs +++ b/framework/base/src/api/managed_types/managed_type_api_impl.rs @@ -66,10 +66,7 @@ pub trait ManagedTypeApiImpl: super::token_identifier_util::get_token_ticker_len(token_id_len) } - fn drop_managed_buffer(&self, handle: Self::ManagedBufferHandle) { - drop(handle) - } - + fn drop_managed_buffer(&self, _handle: Self::ManagedBufferHandle) {} fn drop_big_float(&self, _handle: Self::BigFloatHandle) {} fn drop_big_int(&self, _handle: Self::BigIntHandle) {} fn drop_elliptic_curve(&self, _handle: Self::EllipticCurveHandle) {} diff --git a/framework/base/src/types/managed/basic/managed_buffer.rs b/framework/base/src/types/managed/basic/managed_buffer.rs index 455925ae6a..a85e6002e1 100644 --- a/framework/base/src/types/managed/basic/managed_buffer.rs +++ b/framework/base/src/types/managed/basic/managed_buffer.rs @@ -352,7 +352,8 @@ impl Clone for ManagedBuffer { impl Drop for ManagedBuffer { fn drop(&mut self) { - let _ = core::mem::replace(&mut self.get_handle(), unsafe { core::mem::zeroed() }); + // TODO: enable, after fixing all ownership issues + // M::managed_type_impl().drop_managed_buffer(self.handle.clone()); } } diff --git a/framework/scenario/src/api/impl_vh/debug_api.rs b/framework/scenario/src/api/impl_vh/debug_api.rs index 43bed2fe5d..74eb2ef933 100644 --- a/framework/scenario/src/api/impl_vh/debug_api.rs +++ b/framework/scenario/src/api/impl_vh/debug_api.rs @@ -1,13 +1,13 @@ use std::sync::Arc; use multiversx_chain_vm::{ - executor::{BreakpointValue, VMHooks}, + executor::BreakpointValue, tx_mock::{TxContext, TxContextRef, TxContextStack, TxPanic}, vm_hooks::{DebugApiVMHooksHandler, VMHooksDispatcher}, }; use multiversx_sc::{chain_core::types::ReturnCode, err_msg}; -use crate::debug_executor::{StaticVarData, StaticVarStack}; +use crate::debug_executor::{StaticVarData, StaticVarStack, VMHooksDebugger}; use super::{DebugHandle, VMHooksApi, VMHooksApiBackend}; @@ -19,7 +19,7 @@ impl VMHooksApiBackend for DebugApiBackend { fn with_vm_hooks(f: F) -> R where - F: FnOnce(&dyn VMHooks) -> R, + F: FnOnce(&dyn VMHooksDebugger) -> R, { let top_context = TxContextStack::static_peek(); let wrapper = DebugApiVMHooksHandler::new(top_context); @@ -29,7 +29,7 @@ impl VMHooksApiBackend for DebugApiBackend { fn with_vm_hooks_ctx_1(handle: Self::HandleType, f: F) -> R where - F: FnOnce(&dyn VMHooks) -> R, + F: FnOnce(&dyn VMHooksDebugger) -> R, { let wrapper = DebugApiVMHooksHandler::new(handle.context); let dispatcher = VMHooksDispatcher::new(Box::new(wrapper)); @@ -38,7 +38,7 @@ impl VMHooksApiBackend for DebugApiBackend { fn with_vm_hooks_ctx_2(handle1: Self::HandleType, handle2: Self::HandleType, f: F) -> R where - F: FnOnce(&dyn VMHooks) -> R, + F: FnOnce(&dyn VMHooksDebugger) -> R, { assert_handles_on_same_context(&handle1, &handle2); Self::with_vm_hooks_ctx_1(handle1, f) @@ -51,7 +51,7 @@ impl VMHooksApiBackend for DebugApiBackend { f: F, ) -> R where - F: FnOnce(&dyn VMHooks) -> R, + F: FnOnce(&dyn VMHooksDebugger) -> R, { assert_handles_on_same_context(&handle1, &handle2); assert_handles_on_same_context(&handle1, &handle3); diff --git a/framework/scenario/src/api/impl_vh/single_tx_api.rs b/framework/scenario/src/api/impl_vh/single_tx_api.rs index 2cf63f74b0..a441a81aef 100644 --- a/framework/scenario/src/api/impl_vh/single_tx_api.rs +++ b/framework/scenario/src/api/impl_vh/single_tx_api.rs @@ -1,14 +1,13 @@ use std::sync::Mutex; use multiversx_chain_vm::{ - executor::VMHooks, types::VMAddress, vm_hooks::{SingleTxApiData, SingleTxApiVMHooksHandler, VMHooksDispatcher}, world_mock::AccountData, }; use multiversx_sc::api::RawHandle; -use crate::debug_executor::StaticVarData; +use crate::debug_executor::{StaticVarData, VMHooksDebugger}; use super::{VMHooksApi, VMHooksApiBackend}; @@ -26,7 +25,7 @@ impl VMHooksApiBackend for SingleTxApiBackend { fn with_vm_hooks(f: F) -> R where - F: FnOnce(&dyn VMHooks) -> R, + F: FnOnce(&dyn VMHooksDebugger) -> R, { SINGLE_TX_API_VH_CELL.with(|cell| { let handler = cell.lock().unwrap().clone(); diff --git a/framework/scenario/src/api/impl_vh/static_api.rs b/framework/scenario/src/api/impl_vh/static_api.rs index d4941a60db..27ce03c8dc 100644 --- a/framework/scenario/src/api/impl_vh/static_api.rs +++ b/framework/scenario/src/api/impl_vh/static_api.rs @@ -1,11 +1,8 @@ -use multiversx_chain_vm::{ - executor::VMHooks, - vm_hooks::{StaticApiVMHooksHandler, VMHooksDispatcher, VMHooksHandler}, -}; +use multiversx_chain_vm::vm_hooks::{StaticApiVMHooksHandler, VMHooksDispatcher, VMHooksHandler}; use multiversx_sc::{api::RawHandle, types::Address}; use std::sync::Mutex; -use crate::debug_executor::StaticVarData; +use crate::debug_executor::{StaticVarData, VMHooksDebugger}; use super::{VMHooksApi, VMHooksApiBackend}; @@ -28,7 +25,7 @@ impl VMHooksApiBackend for StaticApiBackend { fn with_vm_hooks(f: F) -> R where - F: FnOnce(&dyn VMHooks) -> R, + F: FnOnce(&dyn VMHooksDebugger) -> R, { STATIC_API_VH_CELL.with(|vh_mutex| { let vh = vh_mutex.lock().unwrap(); diff --git a/framework/scenario/src/api/impl_vh/vm_hooks_api.rs b/framework/scenario/src/api/impl_vh/vm_hooks_api.rs index 71f14b1974..a2ff2a183f 100644 --- a/framework/scenario/src/api/impl_vh/vm_hooks_api.rs +++ b/framework/scenario/src/api/impl_vh/vm_hooks_api.rs @@ -1,10 +1,10 @@ -use crate::debug_executor::StaticVarData; +use crate::debug_executor::{StaticVarData, VMHooksDebugger}; use super::VMHooksApiBackend; use std::marker::PhantomData; -use multiversx_chain_vm::executor::{MemPtr, VMHooks}; +use multiversx_chain_vm::executor::MemPtr; use multiversx_sc::api::{HandleTypeInfo, ManagedBufferApiImpl}; #[derive(Clone, Debug)] @@ -22,7 +22,7 @@ impl VMHooksApi { /// All communication with the VM happens via this method. pub fn with_vm_hooks(&self, f: F) -> R where - F: FnOnce(&dyn VMHooks) -> R, + F: FnOnce(&dyn VMHooksDebugger) -> R, { VHB::with_vm_hooks(f) } @@ -30,7 +30,7 @@ impl VMHooksApi { /// Works with the VM hooks given by the context of 1 handle. pub fn with_vm_hooks_ctx_1(&self, handle: &VHB::HandleType, f: F) -> R where - F: FnOnce(&dyn VMHooks) -> R, + F: FnOnce(&dyn VMHooksDebugger) -> R, { VHB::with_vm_hooks_ctx_1(handle.clone(), f) } @@ -43,7 +43,7 @@ impl VMHooksApi { f: F, ) -> R where - F: FnOnce(&dyn VMHooks) -> R, + F: FnOnce(&dyn VMHooksDebugger) -> R, { VHB::with_vm_hooks_ctx_2(handle1.clone(), handle2.clone(), f) } @@ -57,7 +57,7 @@ impl VMHooksApi { f: F, ) -> R where - F: FnOnce(&dyn VMHooks) -> R, + F: FnOnce(&dyn VMHooksDebugger) -> R, { VHB::with_vm_hooks_ctx_3(handle1.clone(), handle2.clone(), handle3.clone(), f) } diff --git a/framework/scenario/src/api/impl_vh/vm_hooks_backend.rs b/framework/scenario/src/api/impl_vh/vm_hooks_backend.rs index 336f228b2d..d55590c625 100644 --- a/framework/scenario/src/api/impl_vh/vm_hooks_backend.rs +++ b/framework/scenario/src/api/impl_vh/vm_hooks_backend.rs @@ -1,7 +1,6 @@ -use multiversx_chain_vm::executor::VMHooks; use multiversx_sc::api::HandleConstraints; -use crate::debug_executor::StaticVarData; +use crate::debug_executor::{StaticVarData, VMHooksDebugger}; pub trait VMHooksApiBackend: Clone + Send + Sync + 'static { /// We use a single handle type for all handles. @@ -10,18 +9,18 @@ pub trait VMHooksApiBackend: Clone + Send + Sync + 'static { /// All communication with the VM happens via this method. fn with_vm_hooks(f: F) -> R where - F: FnOnce(&dyn VMHooks) -> R; + F: FnOnce(&dyn VMHooksDebugger) -> R; fn with_vm_hooks_ctx_1(_handle: Self::HandleType, f: F) -> R where - F: FnOnce(&dyn VMHooks) -> R, + F: FnOnce(&dyn VMHooksDebugger) -> R, { Self::with_vm_hooks(f) } fn with_vm_hooks_ctx_2(_handle1: Self::HandleType, _handle2: Self::HandleType, f: F) -> R where - F: FnOnce(&dyn VMHooks) -> R, + F: FnOnce(&dyn VMHooksDebugger) -> R, { Self::with_vm_hooks(f) } @@ -33,7 +32,7 @@ pub trait VMHooksApiBackend: Clone + Send + Sync + 'static { f: F, ) -> R where - F: FnOnce(&dyn VMHooks) -> R, + F: FnOnce(&dyn VMHooksDebugger) -> R, { Self::with_vm_hooks(f) } diff --git a/framework/scenario/src/api/managed_type_api_vh.rs b/framework/scenario/src/api/managed_type_api_vh.rs index e7f28ea8b7..6ca415c0c3 100644 --- a/framework/scenario/src/api/managed_type_api_vh.rs +++ b/framework/scenario/src/api/managed_type_api_vh.rs @@ -94,4 +94,28 @@ impl ManagedTypeApiImpl for VMHooksApi { ) }); } + + fn drop_managed_buffer(&self, handle: Self::ManagedBufferHandle) { + self.with_vm_hooks_ctx_1(&handle, |vh| { + vh.drop_managed_buffer(handle.get_raw_handle_unchecked()) + }); + } + fn drop_big_float(&self, handle: Self::BigFloatHandle) { + self.with_vm_hooks_ctx_1(&handle, |vh| { + vh.drop_big_float(handle.get_raw_handle_unchecked()) + }); + } + fn drop_big_int(&self, handle: Self::BigIntHandle) { + self.with_vm_hooks_ctx_1(&handle, |vh| { + vh.drop_big_int(handle.get_raw_handle_unchecked()) + }); + } + fn drop_elliptic_curve(&self, _handle: Self::EllipticCurveHandle) { + // TODO + } + fn drop_managed_map(&self, handle: Self::ManagedMapHandle) { + self.with_vm_hooks_ctx_1(&handle, |vh| { + vh.drop_managed_map(handle.get_raw_handle_unchecked()) + }); + } } diff --git a/framework/scenario/src/debug_executor.rs b/framework/scenario/src/debug_executor.rs index 9fbba55308..a8e73241a3 100644 --- a/framework/scenario/src/debug_executor.rs +++ b/framework/scenario/src/debug_executor.rs @@ -3,6 +3,7 @@ mod contract_container; mod contract_map; mod static_var_stack; mod tx_static_vars; +mod vm_hooks_debugger; pub use catch_tx_panic::catch_tx_panic; pub use contract_container::{ @@ -11,3 +12,4 @@ pub use contract_container::{ pub use contract_map::{ContractMap, ContractMapRef}; pub use static_var_stack::{StaticVarData, StaticVarStack}; pub use tx_static_vars::TxStaticVars; +pub use vm_hooks_debugger::VMHooksDebugger; diff --git a/framework/scenario/src/debug_executor/vm_hooks_debugger.rs b/framework/scenario/src/debug_executor/vm_hooks_debugger.rs new file mode 100644 index 0000000000..5e5df80b62 --- /dev/null +++ b/framework/scenario/src/debug_executor/vm_hooks_debugger.rs @@ -0,0 +1,32 @@ +use multiversx_chain_vm::vm_hooks::VMHooksDispatcher; +use multiversx_chain_vm_executor::VMHooks; + +pub trait VMHooksDebugger: VMHooks { + fn drop_managed_buffer(&self, handle: i32); + fn drop_big_float(&self, handle: i32); + fn drop_big_int(&self, handle: i32); + fn drop_elliptic_curve(&self, handle: i32); + fn drop_managed_map(&self, handle: i32); +} + +impl VMHooksDebugger for VMHooksDispatcher { + fn drop_managed_buffer(&self, handle: i32) { + self.handler.mb_drop(handle); + } + + fn drop_big_float(&self, handle: i32) { + self.handler.bf_drop(handle); + } + + fn drop_big_int(&self, handle: i32) { + self.handler.bi_drop(handle); + } + + fn drop_elliptic_curve(&self, _handle: i32) { + // TODO: not implemented + } + + fn drop_managed_map(&self, handle: i32) { + self.handler.mm_drop(handle); + } +} diff --git a/vm/src/tx_mock/tx_managed_types/handle_map.rs b/vm/src/tx_mock/tx_managed_types/handle_map.rs index 4473e9104b..f121389696 100644 --- a/vm/src/tx_mock/tx_managed_types/handle_map.rs +++ b/vm/src/tx_mock/tx_managed_types/handle_map.rs @@ -47,4 +47,8 @@ impl HandleMap { pub fn insert(&mut self, handle: RawHandle, value: V) { let _ = self.map.insert(handle, value); } + + pub fn remove_handle(&mut self, handle: RawHandle) { + let _ = self.map.remove(&handle); + } } diff --git a/vm/src/tx_mock/tx_managed_types/tx_big_float.rs b/vm/src/tx_mock/tx_managed_types/tx_big_float.rs index 5152ae9ada..dd69653091 100644 --- a/vm/src/tx_mock/tx_managed_types/tx_big_float.rs +++ b/vm/src/tx_mock/tx_managed_types/tx_big_float.rs @@ -10,4 +10,8 @@ impl TxManagedTypes { pub fn bf_overwrite(&mut self, handle: RawHandle, value: f64) { self.big_float_map.insert(handle, value); } + + pub fn bf_remove(&mut self, handle: RawHandle) { + self.big_float_map.remove_handle(handle); + } } diff --git a/vm/src/tx_mock/tx_managed_types/tx_big_int.rs b/vm/src/tx_mock/tx_managed_types/tx_big_int.rs index 510dee9a51..dabee068e9 100644 --- a/vm/src/tx_mock/tx_managed_types/tx_big_int.rs +++ b/vm/src/tx_mock/tx_managed_types/tx_big_int.rs @@ -11,6 +11,10 @@ impl TxManagedTypes { self.big_int_map.insert_new_handle_raw(value) } + pub fn bi_remove(&mut self, handle: RawHandle) { + self.big_int_map.remove_handle(handle); + } + pub fn bi_overwrite(&mut self, destination: RawHandle, value: num_bigint::BigInt) { self.big_int_map.insert(destination, value); } diff --git a/vm/src/tx_mock/tx_managed_types/tx_managed_buffer.rs b/vm/src/tx_mock/tx_managed_types/tx_managed_buffer.rs index ba43dde71f..3357f34691 100644 --- a/vm/src/tx_mock/tx_managed_types/tx_managed_buffer.rs +++ b/vm/src/tx_mock/tx_managed_types/tx_managed_buffer.rs @@ -165,6 +165,10 @@ impl TxManagedTypes { self.mb_append_bytes(dest_handle, &handle_to_be_bytes(amount_handle)[..]); } } + + pub fn mb_remove(&mut self, handle: RawHandle) { + self.managed_buffer_map.remove_handle(handle); + } } pub fn handle_to_be_bytes(handle: RawHandle) -> [u8; 4] { diff --git a/vm/src/tx_mock/tx_managed_types/tx_managed_map.rs b/vm/src/tx_mock/tx_managed_types/tx_managed_map.rs index 1a61d6de66..fec9116f2d 100644 --- a/vm/src/tx_mock/tx_managed_types/tx_managed_map.rs +++ b/vm/src/tx_mock/tx_managed_types/tx_managed_map.rs @@ -31,4 +31,8 @@ impl TxManagedTypes { let mmap = self.managed_map_map.get_mut(map_handle); mmap.remove(key).unwrap_or_default() } + + pub fn mm_remove(&mut self, handle: RawHandle) { + self.managed_map_map.remove_handle(handle); + } } diff --git a/vm/src/vm_hooks/vh_dispatcher.rs b/vm/src/vm_hooks/vh_dispatcher.rs index 0dbfc54051..e037d7393c 100644 --- a/vm/src/vm_hooks/vh_dispatcher.rs +++ b/vm/src/vm_hooks/vh_dispatcher.rs @@ -9,7 +9,7 @@ use super::VMHooksHandler; /// Dispatches messages coming via VMHooks to the underlying implementation (the VMHooksHandler). #[derive(Debug)] pub struct VMHooksDispatcher { - handler: Box, + pub handler: Box, } impl VMHooksDispatcher { diff --git a/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_big_float.rs b/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_big_float.rs index 4c2c06b49a..952190a222 100644 --- a/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_big_float.rs +++ b/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_big_float.rs @@ -177,4 +177,8 @@ pub trait VMHooksBigFloat: VMHooksHandlerSource + VMHooksError { fn bf_get_const_e(&self, dest: RawHandle) { self.m_types_lock().bf_overwrite(dest, std::f64::consts::E); } + + fn bf_drop(&self, map_handle: RawHandle) { + self.m_types_lock().bf_remove(map_handle); + } } diff --git a/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_big_int.rs b/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_big_int.rs index a541a426c5..31d93e2be3 100644 --- a/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_big_int.rs +++ b/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_big_int.rs @@ -160,4 +160,8 @@ pub trait VMHooksBigInt: VMHooksHandlerSource + VMHooksError { let result = bi_x.shl(bits); self.m_types_lock().bi_overwrite(dest, result); } + + fn bi_drop(&self, map_handle: RawHandle) { + self.m_types_lock().bi_remove(map_handle); + } } diff --git a/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_managed_buffer.rs b/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_managed_buffer.rs index 0761d9b76b..5767c4dad3 100644 --- a/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_managed_buffer.rs +++ b/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_managed_buffer.rs @@ -110,4 +110,8 @@ pub trait VMHooksManagedBuffer: VMHooksHandlerSource { self.m_types_lock() .mb_set(dest_handle, encoded.into_bytes()); } + + fn mb_drop(&self, handle: RawHandle) { + self.m_types_lock().mb_remove(handle); + } } diff --git a/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_managed_map.rs b/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_managed_map.rs index b180dc30fa..b3438eab72 100644 --- a/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_managed_map.rs +++ b/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_managed_map.rs @@ -31,4 +31,8 @@ pub trait VMHooksManagedMap: VMHooksHandlerSource { let key = self.m_types_lock().mb_get(key_handle).to_vec(); self.m_types_lock().mm_contains(map_handle, key.as_slice()) } + + fn mm_drop(&self, map_handle: RawHandle) { + self.m_types_lock().mm_remove(map_handle); + } } From ca9cc0603bfd3277cd8cf68d67f49636657586ea Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Thu, 18 Sep 2025 22:07:55 +0300 Subject: [PATCH 05/15] DebugHandle Weak pointer to TxContext --- chain/vm/src/host/context/tx_context_ref.rs | 10 ++++++- .../scenario/src/api/impl_vh/debug_api.rs | 3 +- .../src/api/impl_vh/debug_handle_vh.rs | 30 ++++++++++++------- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/chain/vm/src/host/context/tx_context_ref.rs b/chain/vm/src/host/context/tx_context_ref.rs index 1680198070..333b105452 100644 --- a/chain/vm/src/host/context/tx_context_ref.rs +++ b/chain/vm/src/host/context/tx_context_ref.rs @@ -1,4 +1,7 @@ -use std::{ops::Deref, sync::Arc}; +use std::{ + ops::Deref, + sync::{Arc, Weak}, +}; use crate::host::context::{TxContext, TxResult}; @@ -65,4 +68,9 @@ impl TxContextRef { pub fn into_ref(self) -> Arc { self.0 } + + /// Creates a new [`Weak`] pointer to the [`TxContext`]. + pub fn downgrade(&self) -> Weak { + Arc::downgrade(&self.0) + } } diff --git a/framework/scenario/src/api/impl_vh/debug_api.rs b/framework/scenario/src/api/impl_vh/debug_api.rs index 3076d6a24a..2babf9dbd1 100644 --- a/framework/scenario/src/api/impl_vh/debug_api.rs +++ b/framework/scenario/src/api/impl_vh/debug_api.rs @@ -1,6 +1,5 @@ use multiversx_chain_vm::{ executor::{VMHooks, VMHooksEarlyExit}, - host::context::TxContextRef, host::vm_hooks::{TxVMHooksContext, VMHooksDispatcher}, }; use multiversx_sc::{chain_core::types::ReturnCode, err_msg}; @@ -32,7 +31,7 @@ impl VMHooksApiBackend for DebugApiBackend { where F: FnOnce(&mut dyn VMHooks) -> Result, { - let tx_context_ref = TxContextRef(handle.context.clone()); + let tx_context_ref = handle.to_tx_context_ref(); let vh_context = TxVMHooksContext::new(tx_context_ref, ContractDebugInstanceState); let mut dispatcher = VMHooksDispatcher::new(vh_context); f(&mut dispatcher).unwrap_or_else(|err| ContractDebugInstanceState::early_exit_panic(err)) diff --git a/framework/scenario/src/api/impl_vh/debug_handle_vh.rs b/framework/scenario/src/api/impl_vh/debug_handle_vh.rs index 7f3da0d20f..193209708d 100644 --- a/framework/scenario/src/api/impl_vh/debug_handle_vh.rs +++ b/framework/scenario/src/api/impl_vh/debug_handle_vh.rs @@ -1,6 +1,6 @@ -use std::sync::Arc; +use std::sync::Weak; -use multiversx_chain_vm::host::context::TxContext; +use multiversx_chain_vm::host::context::{TxContext, TxContextRef}; use multiversx_sc::{ api::{HandleConstraints, RawHandle}, codec::TryStaticCast, @@ -10,22 +10,22 @@ use crate::executor::debug::ContractDebugStack; #[derive(Clone)] pub struct DebugHandle { - /// TODO: would be nice to be an actual TxContextRef, - /// but that requires changing the debugger scripts - pub(crate) context: Arc, + /// Only keep a weak reference to the context, to avoid stray handles keeping the context from being released. + /// Using the pointer after the context is released will panic. + pub(crate) context: Weak, raw_handle: RawHandle, } impl DebugHandle { pub fn is_on_current_context(&self) -> bool { - Arc::ptr_eq( + Weak::ptr_eq( &self.context, - &ContractDebugStack::static_peek().tx_context_ref.into_ref(), + &ContractDebugStack::static_peek().tx_context_ref.downgrade(), ) } pub fn is_on_same_context(&self, other: &DebugHandle) -> bool { - Arc::ptr_eq(&self.context, &other.context) + Weak::ptr_eq(&self.context, &other.context) } pub fn assert_current_context(&self) { @@ -34,6 +34,16 @@ impl DebugHandle { "Managed value not used in original context" ); } + + pub fn to_tx_context_ref(&self) -> TxContextRef { + let tx_context_arc = self.context.upgrade().unwrap_or_else(|| { + panic!( + "TxContext is no longer valid for handle {}", + self.raw_handle + ) + }); + TxContextRef::new(tx_context_arc) + } } impl core::fmt::Debug for DebugHandle { @@ -45,7 +55,7 @@ impl core::fmt::Debug for DebugHandle { impl HandleConstraints for DebugHandle { fn new(handle: multiversx_sc::api::RawHandle) -> Self { Self { - context: ContractDebugStack::static_peek().tx_context_ref.into_ref(), + context: ContractDebugStack::static_peek().tx_context_ref.downgrade(), raw_handle: handle, } } @@ -73,7 +83,7 @@ impl PartialEq for DebugHandle { impl PartialEq for DebugHandle { fn eq(&self, other: &DebugHandle) -> bool { - Arc::ptr_eq(&self.context, &other.context) && self.raw_handle == other.raw_handle + Weak::ptr_eq(&self.context, &other.context) && self.raw_handle == other.raw_handle } } From 2cb3343d7a20662ac0a2ab6968e65f343515d5d1 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Mon, 29 Dec 2025 14:29:02 +0200 Subject: [PATCH 06/15] vm - signal error utf-8 lossy --- .../vm/src/host/vm_hooks/vh_handler/vh_error.rs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/chain/vm/src/host/vm_hooks/vh_handler/vh_error.rs b/chain/vm/src/host/vm_hooks/vh_handler/vh_error.rs index ef0dcb00d8..41166264d5 100644 --- a/chain/vm/src/host/vm_hooks/vh_handler/vh_error.rs +++ b/chain/vm/src/host/vm_hooks/vh_handler/vh_error.rs @@ -1,23 +1,16 @@ use multiversx_chain_core::types::ReturnCode; use multiversx_chain_vm_executor::VMHooksEarlyExit; -use crate::{ - host::vm_hooks::{VMHooksContext, vh_early_exit::early_exit_vm_error}, - types::RawHandle, -}; +use crate::{host::vm_hooks::VMHooksContext, types::RawHandle}; use super::VMHooksHandler; impl VMHooksHandler { pub fn signal_error(&mut self, message: &[u8]) -> Result<(), VMHooksEarlyExit> { - match String::from_utf8(message.to_owned()) { - Ok(message_string) => { - self.error_trace(&message_string); - Err(VMHooksEarlyExit::new(ReturnCode::UserError.as_u64()) - .with_message(message_string)) - } - Err(_) => Err(early_exit_vm_error("error message utf-8 error")), - } + let message_string = String::from_utf8_lossy(message); + self.error_trace(&message_string); + Err(VMHooksEarlyExit::new(ReturnCode::UserError.as_u64()) + .with_message(message_string.to_string())) } pub fn signal_error_from_buffer( From 57e7c43dab5f0fd947b71e2b2e1cc2220aeb2de1 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Mon, 29 Dec 2025 14:37:23 +0200 Subject: [PATCH 07/15] ManagedBuffer Display utf8 lossy --- framework/base/src/types/managed/basic/managed_buffer.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/framework/base/src/types/managed/basic/managed_buffer.rs b/framework/base/src/types/managed/basic/managed_buffer.rs index 55caf8a42a..c41c8eae90 100644 --- a/framework/base/src/types/managed/basic/managed_buffer.rs +++ b/framework/base/src/types/managed/basic/managed_buffer.rs @@ -583,11 +583,8 @@ impl core::fmt::Debug for ManagedBuffer { impl core::fmt::Display for ManagedBuffer { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - use crate::contract_base::ErrorHelper; - - let s = alloc::string::String::from_utf8(self.to_boxed_bytes().into_vec()) - .unwrap_or_else(|err| ErrorHelper::::signal_error_with_message(err.as_bytes())); - + let bytes = self.to_boxed_bytes(); + let s = alloc::string::String::from_utf8_lossy(bytes.as_slice()); s.fmt(f) } } From 7db86dd64f53a41098dc6305a398e258c613288f Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Mon, 29 Dec 2025 16:00:30 +0200 Subject: [PATCH 08/15] DebugHandle Weak pointer to TxContext LLDB fix --- .../multiversx_sc_lldb_pretty_printers.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/rust-debugger/pretty-printers/multiversx_sc_lldb_pretty_printers.py b/tools/rust-debugger/pretty-printers/multiversx_sc_lldb_pretty_printers.py index cc48f7df9b..5844307245 100644 --- a/tools/rust-debugger/pretty-printers/multiversx_sc_lldb_pretty_printers.py +++ b/tools/rust-debugger/pretty-printers/multiversx_sc_lldb_pretty_printers.py @@ -278,7 +278,13 @@ def lookup(self, full_value: lldb.value) -> lldb.value: return full_value def extract_value_from_raw_handle(self, context: lldb.value, raw_handle: int, map_picker: Callable) -> lldb.value: - managed_types = context[0].managed_types.data.value + # Handle Weak by accessing the ptr field directly + # context is Weak, which contains ptr that points to the WeakInner + # The WeakInner contains a pointer to the actual TxContext data + # In LLDB, we access: context.ptr.pointer (NonNull>) -> pointer.data -> TxContext + weak_inner = context.ptr.pointer + tx_context = weak_inner.data + managed_types = tx_context.managed_types.data.value chosen_map = map_picker(managed_types) value = map_lookup(chosen_map, raw_handle) return value @@ -294,6 +300,7 @@ def summary(self, original_value: lldb.value) -> str: managed_value = self.lookup(original_value) handle = managed_value.handle raw_handle = int(handle.raw_handle) + # Handle Weak by getting the context from the handle context = handle.context return self.summary_from_raw_handle(raw_handle, context, type_info) From 292413c52d81bdb84124ef0591eeac56864bc632 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Mon, 29 Dec 2025 16:42:20 +0200 Subject: [PATCH 09/15] DebugHandle ptr eq optimization --- chain/vm/src/host/context/tx_context_ref.rs | 8 ++++++++ framework/scenario/src/api/impl_vh/debug_handle_vh.rs | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/chain/vm/src/host/context/tx_context_ref.rs b/chain/vm/src/host/context/tx_context_ref.rs index 4552fa10a6..95324e2c33 100644 --- a/chain/vm/src/host/context/tx_context_ref.rs +++ b/chain/vm/src/host/context/tx_context_ref.rs @@ -65,6 +65,14 @@ impl TxContextRef { Arc::ptr_eq(&this.0, &other.0) } + /// Returns a raw pointer to the underlying `TxContext`. + /// + /// This is useful for pointer comparisons, particularly when comparing + /// with weak references to determine if they point to the same context. + pub fn as_ptr(&self) -> *const TxContext { + Arc::as_ptr(&self.0) + } + pub fn into_ref(self) -> Arc { self.0 } diff --git a/framework/scenario/src/api/impl_vh/debug_handle_vh.rs b/framework/scenario/src/api/impl_vh/debug_handle_vh.rs index 193209708d..851854d535 100644 --- a/framework/scenario/src/api/impl_vh/debug_handle_vh.rs +++ b/framework/scenario/src/api/impl_vh/debug_handle_vh.rs @@ -18,9 +18,9 @@ pub struct DebugHandle { impl DebugHandle { pub fn is_on_current_context(&self) -> bool { - Weak::ptr_eq( - &self.context, - &ContractDebugStack::static_peek().tx_context_ref.downgrade(), + std::ptr::eq( + self.context.as_ptr(), + ContractDebugStack::static_peek().tx_context_ref.as_ptr(), ) } From acdd326d5b794c171302773d0976ad53419c030a Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Mon, 29 Dec 2025 18:32:41 +0200 Subject: [PATCH 10/15] docs --- chain/vm/src/host/context/tx_context_ref.rs | 10 ++++++++++ .../scenario/src/api/impl_vh/debug_handle_vh.rs | 16 +++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/chain/vm/src/host/context/tx_context_ref.rs b/chain/vm/src/host/context/tx_context_ref.rs index 95324e2c33..05f1a69cf2 100644 --- a/chain/vm/src/host/context/tx_context_ref.rs +++ b/chain/vm/src/host/context/tx_context_ref.rs @@ -78,6 +78,16 @@ impl TxContextRef { } /// Creates a new [`Weak`] pointer to the [`TxContext`]. + /// + /// This is the preferred way to obtain a non‑owning reference to the underlying + /// `TxContext` when you need to store a handle that should not keep the transaction + /// alive on its own. In particular, this method underpins the weak‑pointer pattern + /// used by [`DebugHandle`], which holds a `Weak` so that debug tooling + /// can observe a transaction while it exists, without extending its lifetime. + /// + /// Callers that use the returned [`Weak`] must call [`Weak::upgrade`] before + /// accessing the `TxContext` and be prepared to handle the case where upgrading + /// fails because the transaction context has already been dropped. pub fn downgrade(&self) -> Weak { Arc::downgrade(&self.0) } diff --git a/framework/scenario/src/api/impl_vh/debug_handle_vh.rs b/framework/scenario/src/api/impl_vh/debug_handle_vh.rs index 851854d535..fce7144070 100644 --- a/framework/scenario/src/api/impl_vh/debug_handle_vh.rs +++ b/framework/scenario/src/api/impl_vh/debug_handle_vh.rs @@ -35,10 +35,24 @@ impl DebugHandle { ); } + /// Upgrades the weak reference to a strong `TxContextRef`. + /// + /// This method attempts to upgrade the weak reference stored in this handle + /// to a strong reference. This is necessary when you need to access the + /// underlying `TxContext` for operations. + /// + /// # Panics + /// + /// Panics if the `TxContext` is no longer valid (has been dropped). This can + /// happen if the object was created on a VM execution stack frame that has + /// already been popped, or if objects are mixed between different execution + /// contexts during whitebox testing. pub fn to_tx_context_ref(&self) -> TxContextRef { let tx_context_arc = self.context.upgrade().unwrap_or_else(|| { panic!( - "TxContext is no longer valid for handle {}", + "TxContext is no longer valid for handle {}. +The object was created on a VM execution stack frame that has already been popped. +This can sometimes happen during whitebox testing if the objects are mixed between execution contexts.", self.raw_handle ) }); From 691c929efe07a5f4707d46dbaa2619b1e7bdabbc Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 30 Dec 2025 01:38:30 +0200 Subject: [PATCH 11/15] DebugHandle LLVM dropped TxContext error & tests --- .../src/api/impl_vh/debug_handle_vh.rs | 14 ++++-- .../format-tests/src/format_tests.rs | 45 ++++++++++++++++--- .../multiversx_sc_lldb_pretty_printers.py | 21 ++++++++- 3 files changed, 70 insertions(+), 10 deletions(-) diff --git a/framework/scenario/src/api/impl_vh/debug_handle_vh.rs b/framework/scenario/src/api/impl_vh/debug_handle_vh.rs index fce7144070..086d166d17 100644 --- a/framework/scenario/src/api/impl_vh/debug_handle_vh.rs +++ b/framework/scenario/src/api/impl_vh/debug_handle_vh.rs @@ -17,6 +17,14 @@ pub struct DebugHandle { } impl DebugHandle { + /// Should almost never call directly, only used directly in a test. + pub fn new_with_explicit_context_ref(context: Weak, raw_handle: RawHandle) -> Self { + Self { + context, + raw_handle, + } + } + pub fn is_on_current_context(&self) -> bool { std::ptr::eq( self.context.as_ptr(), @@ -68,10 +76,8 @@ impl core::fmt::Debug for DebugHandle { impl HandleConstraints for DebugHandle { fn new(handle: multiversx_sc::api::RawHandle) -> Self { - Self { - context: ContractDebugStack::static_peek().tx_context_ref.downgrade(), - raw_handle: handle, - } + let context = ContractDebugStack::static_peek().tx_context_ref.downgrade(); + DebugHandle::new_with_explicit_context_ref(context, handle) } fn to_be_bytes(&self) -> [u8; 4] { diff --git a/tools/rust-debugger/format-tests/src/format_tests.rs b/tools/rust-debugger/format-tests/src/format_tests.rs index 4e878b2df6..83743dcd38 100644 --- a/tools/rust-debugger/format-tests/src/format_tests.rs +++ b/tools/rust-debugger/format-tests/src/format_tests.rs @@ -1,4 +1,7 @@ -use multiversx_sc_scenario::imports::*; +use multiversx_sc_scenario::{ + executor::debug::{ContractDebugInstance, ContractDebugStack}, + imports::*, +}; macro_rules! push { ($list: ident, $name:ident, $expected: expr ) => {{ @@ -13,7 +16,8 @@ macro_rules! push { // they have to be cloned if used before that point #[allow(clippy::redundant_clone)] fn main() { - DebugApi::dummy(); + // Set up a dummy context on the debug stack, required for all managed types + ContractDebugStack::static_push(ContractDebugInstance::dummy()); // Used by the python script which checks the variable summaries let mut to_check: Vec<(String, String)> = Vec::new(); @@ -76,7 +80,11 @@ fn main() { let hex_esdt_safe_address = Address::new(hex_esdt_safe); let esdt_safe_managed_address: ManagedAddress = ManagedAddress::from(hex_esdt_safe_address); - push!(to_check, esdt_safe_managed_address, "\"esdt-safe_____________\" - (32) 0x00000000000000000500657364742d736166655f5f5f5f5f5f5f5f5f5f5f5f5f"); + push!( + to_check, + esdt_safe_managed_address, + "\"esdt-safe_____________\" - (32) 0x00000000000000000500657364742d736166655f5f5f5f5f5f5f5f5f5f5f5f5f" + ); let test_token_identifier: TestTokenIdentifier = TestTokenIdentifier::new("TEST-123456"); push!(to_check, test_token_identifier, "\"str:TEST-123456\""); @@ -137,7 +145,11 @@ fn main() { 100, 5000u64.into(), )); - push!(to_check, managed_vec_of_payments, "(2) { [0] = { token_identifier: \"MYTOK-123456\", nonce: 42, amount: 1000 }, [1] = { token_identifier: \"MYTOK-abcdef\", nonce: 100, amount: 5000 } }"); + push!( + to_check, + managed_vec_of_payments, + "(2) { [0] = { token_identifier: \"MYTOK-123456\", nonce: 42, amount: 1000 }, [1] = { token_identifier: \"MYTOK-abcdef\", nonce: 100, amount: 5000 } }" + ); let egld_or_esdt_token_identifier_egld: EgldOrEsdtTokenIdentifier = EgldOrEsdtTokenIdentifier::egld(); @@ -169,7 +181,11 @@ fn main() { DebugApi, ManagedVec>, > = ManagedOption::some(managed_vec_of_addresses.clone()); - push!(to_check, managed_option_of_vec_of_addresses, "ManagedOption::some((1) { [0] = (32) 0x000000000000000000010000000000000000000000000000000000000002ffff })"); + push!( + to_check, + managed_option_of_vec_of_addresses, + "ManagedOption::some((1) { [0] = (32) 0x000000000000000000010000000000000000000000000000000000000002ffff })" + ); // 5. SC wasm - heap let heap_address: Address = managed_address.to_address(); @@ -244,7 +260,26 @@ fn main() { "OptionalValue::Some()" ); + // Invalid TxContext test - simulate access after context change + // This test relies on the debugger pretty printer's error handling + // to detect when a weak pointer becomes invalid + let dropped_context = + let biguint_with_invalid_context = + unsafe { BigUint::::from_handle(create_handle_from_dropped_context()) }; + push!( + to_check, + biguint_with_invalid_context, + "" + ); + breakpoint_marker_end_of_main(); + + // Clean up the dummy entry on stack + ContractDebugStack::static_pop(); +} + +fn create_handle_from_dropped_context() -> DebugHandle { + DebugHandle::new_with_explicit_context_ref(std::sync::Weak::new(), -100i32) } fn breakpoint_marker_end_of_main() {} diff --git a/tools/rust-debugger/pretty-printers/multiversx_sc_lldb_pretty_printers.py b/tools/rust-debugger/pretty-printers/multiversx_sc_lldb_pretty_printers.py index 5844307245..b257e89fdc 100644 --- a/tools/rust-debugger/pretty-printers/multiversx_sc_lldb_pretty_printers.py +++ b/tools/rust-debugger/pretty-printers/multiversx_sc_lldb_pretty_printers.py @@ -78,12 +78,23 @@ def __init__(self, raw_handle: int, map_: lldb.value) -> None: super().__init__(error) +class InvalidWeakPointer(Exception): + def __init__(self, raw_handle: int) -> None: + error = f"" + super().__init__(error) + + def check_invalid_handle(callable: Callable) -> Callable: def wrapped(*args) -> str: try: return callable(*args) except InvalidHandle as e: return str(e) + except InvalidWeakPointer as e: + return str(e) + except Exception as e: + # Catch any other exceptions that might occur during pointer dereferencing + return f"" return wrapped @@ -278,11 +289,19 @@ def lookup(self, full_value: lldb.value) -> lldb.value: return full_value def extract_value_from_raw_handle(self, context: lldb.value, raw_handle: int, map_picker: Callable) -> lldb.value: + weak_inner = context.ptr.pointer # object is of Rust type: ArcInner + + # Check the strong count to see if the object is still alive + # If strong count is 0, the object has been dropped + strong_atomic_usize = weak_inner.strong # object is of Rust type: Atomic + strong_count = int(strong_atomic_usize.v.value) + if strong_count == 0: + raise InvalidWeakPointer(raw_handle) + # Handle Weak by accessing the ptr field directly # context is Weak, which contains ptr that points to the WeakInner # The WeakInner contains a pointer to the actual TxContext data # In LLDB, we access: context.ptr.pointer (NonNull>) -> pointer.data -> TxContext - weak_inner = context.ptr.pointer tx_context = weak_inner.data managed_types = tx_context.managed_types.data.value chosen_map = map_picker(managed_types) From 56954bf665c4bccee12706b1a95d819df6d64c15 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 30 Dec 2025 01:59:06 +0200 Subject: [PATCH 12/15] lldb py ignore warning --- .../pretty-printers/multiversx_sc_lldb_pretty_printers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/rust-debugger/pretty-printers/multiversx_sc_lldb_pretty_printers.py b/tools/rust-debugger/pretty-printers/multiversx_sc_lldb_pretty_printers.py index b257e89fdc..72c532b78a 100644 --- a/tools/rust-debugger/pretty-printers/multiversx_sc_lldb_pretty_printers.py +++ b/tools/rust-debugger/pretty-printers/multiversx_sc_lldb_pretty_printers.py @@ -7,8 +7,8 @@ from functools import partial import string from typing import Callable, Collection, Iterable, List, Tuple, Type -from lldb import SBValue, SBDebugger -import lldb +from lldb import SBValue, SBDebugger # type: ignore[import] +import lldb # type: ignore[import] from pathlib import Path import re import struct From f7cda84738e3f29265a7ddc0caaf626ae817b674 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 30 Dec 2025 02:15:20 +0200 Subject: [PATCH 13/15] test fix --- tools/rust-debugger/format-tests/src/format_tests.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/rust-debugger/format-tests/src/format_tests.rs b/tools/rust-debugger/format-tests/src/format_tests.rs index 83743dcd38..28129aa9a8 100644 --- a/tools/rust-debugger/format-tests/src/format_tests.rs +++ b/tools/rust-debugger/format-tests/src/format_tests.rs @@ -263,7 +263,6 @@ fn main() { // Invalid TxContext test - simulate access after context change // This test relies on the debugger pretty printer's error handling // to detect when a weak pointer becomes invalid - let dropped_context = let biguint_with_invalid_context = unsafe { BigUint::::from_handle(create_handle_from_dropped_context()) }; push!( From 356e4559ae9acad4e80452dc736f52b5f98493cd Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 30 Dec 2025 14:06:11 +0200 Subject: [PATCH 14/15] python formatting --- .../pretty-printers/format-python.sh | 41 ++++ .../multiversx_sc_lldb_pretty_printers.py | 195 ++++++++++++------ .../pretty-printers/pyproject.toml | 13 ++ 3 files changed, 189 insertions(+), 60 deletions(-) create mode 100755 tools/rust-debugger/pretty-printers/format-python.sh create mode 100644 tools/rust-debugger/pretty-printers/pyproject.toml diff --git a/tools/rust-debugger/pretty-printers/format-python.sh b/tools/rust-debugger/pretty-printers/format-python.sh new file mode 100755 index 0000000000..1fb4d0e0e3 --- /dev/null +++ b/tools/rust-debugger/pretty-printers/format-python.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# Python code formatting script for MultiversX SDK pretty-printers +echo "🐍 Formatting Python code..." + +# Get the SDK root directory (3 levels up from this script) +SDK_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" +PYTHON_CMD="$SDK_ROOT/.venv/bin/python" + +# Find Python files in this directory +PYTHON_FILES=$(find . -name "*.py" -maxdepth 1) + +if [ -z "$PYTHON_FILES" ]; then + echo "No Python files found to format" + exit 0 +fi + +echo "Found $(echo "$PYTHON_FILES" | wc -l) Python files to format" + +# Check if virtual environment exists +if [ ! -f "$PYTHON_CMD" ]; then + echo "❌ Python virtual environment not found at $PYTHON_CMD" + echo "Please run 'configure_python_environment' from the SDK root first" + exit 1 +fi + +# 1. Sort imports with isort +echo "📦 Sorting imports with isort..." +$PYTHON_CMD -m isort $PYTHON_FILES + +# 2. Format code with black +echo "🖤 Formatting code with black..." +$PYTHON_CMD -m black $PYTHON_FILES + +# 3. Check style with flake8 (optional) +if [ "$1" = "--check" ]; then + echo "🔍 Checking style with flake8..." + $PYTHON_CMD -m flake8 $PYTHON_FILES --max-line-length=88 --extend-ignore=E203,W503 +fi + +echo "✅ Python formatting complete!" \ No newline at end of file diff --git a/tools/rust-debugger/pretty-printers/multiversx_sc_lldb_pretty_printers.py b/tools/rust-debugger/pretty-printers/multiversx_sc_lldb_pretty_printers.py index 72c532b78a..b9fccd051b 100644 --- a/tools/rust-debugger/pretty-printers/multiversx_sc_lldb_pretty_printers.py +++ b/tools/rust-debugger/pretty-printers/multiversx_sc_lldb_pretty_printers.py @@ -4,14 +4,15 @@ ### Version: 0.64.0 ############################################################################## -from functools import partial -import string -from typing import Callable, Collection, Iterable, List, Tuple, Type -from lldb import SBValue, SBDebugger # type: ignore[import] -import lldb # type: ignore[import] -from pathlib import Path import re +import string import struct +from functools import partial +from pathlib import Path +from typing import Callable, Collection, Iterable, List, Tuple, Type + +import lldb # type: ignore[import] +from lldb import SBDebugger, SBValue # type: ignore[import] VM_TYPE_ADDRESS = "0000000050" DEBUG_API_TYPE = "multiversx_sc_scenario::api::impl_vh::vm_hooks_api::VMHooksApi" @@ -27,15 +28,21 @@ BIG_INT_TYPE = f"{MANAGED_BASIC_PATH}::big_int::BigInt<{DEBUG_API_TYPE} ?>" BIG_FLOAT_TYPE = f"{MANAGED_BASIC_PATH}::big_float::BigFloat<{DEBUG_API_TYPE} ?>" -MANAGED_BUFFER_TYPE = f"{MANAGED_BASIC_PATH}::managed_buffer::ManagedBuffer<{DEBUG_API_TYPE} ?>" +MANAGED_BUFFER_TYPE = ( + f"{MANAGED_BASIC_PATH}::managed_buffer::ManagedBuffer<{DEBUG_API_TYPE} ?>" +) # 3. SC wasm - Managed wrapped types ## 3a. general MANAGED_WRAPPED_PATH = "multiversx_sc::types::managed::wrapped" BIG_UINT_TYPE = f"{MANAGED_WRAPPED_PATH}::num::big_uint::BigUint<{DEBUG_API_TYPE} ?>" NON_ZERO_BIG_UINT_TYPE = f"{MANAGED_WRAPPED_PATH}::num::non_zero_big_uint::NonZeroBigUint<{DEBUG_API_TYPE} ?>" -MANAGED_ADDRESS_TYPE = f"{MANAGED_WRAPPED_PATH}::managed_address::ManagedAddress<{DEBUG_API_TYPE} ?>" -MANAGED_BYTE_ARRAY_TYPE = f"{MANAGED_WRAPPED_PATH}::managed_byte_array::ManagedByteArray<{DEBUG_API_TYPE} ?>" +MANAGED_ADDRESS_TYPE = ( + f"{MANAGED_WRAPPED_PATH}::managed_address::ManagedAddress<{DEBUG_API_TYPE} ?>" +) +MANAGED_BYTE_ARRAY_TYPE = ( + f"{MANAGED_WRAPPED_PATH}::managed_byte_array::ManagedByteArray<{DEBUG_API_TYPE} ?>" +) ## 3b. tokens & payments MANAGED_WRAPPED_TOKEN_PATH = "multiversx_sc::types::managed::wrapped::token" ESDT_TOKEN_IDENTIFIER_TYPE = f"{MANAGED_WRAPPED_TOKEN_PATH}::esdt_token_identifier::EsdtTokenIdentifier<{DEBUG_API_TYPE} ?>" @@ -49,7 +56,9 @@ MANAGED_OPTION_TYPE = f"{MANAGED_WRAPPED_PATH}::managed_option::ManagedOption<{DEBUG_API_TYPE}, {ANY_TYPE}>" # ManagedVec MANAGED_VEC_INNER_TYPE_INDEX = 1 -MANAGED_VEC_TYPE = f"{MANAGED_WRAPPED_PATH}::managed_vec::ManagedVec<{DEBUG_API_TYPE}, {ANY_TYPE}>" +MANAGED_VEC_TYPE = ( + f"{MANAGED_WRAPPED_PATH}::managed_vec::ManagedVec<{DEBUG_API_TYPE}, {ANY_TYPE}>" +) # 4. SC wasm - Managed multi value types @@ -64,12 +73,17 @@ TEST_SC_ADDRESS_TYPE = f"{INTERACTION_EXPR_PATH}::test_sc_address::TestSCAddress" TEST_ADDRESS_TYPE = f"{INTERACTION_EXPR_PATH}::test_address::TestAddress" -TEST_TOKEN_IDENTIFIER_TYPE = f"{INTERACTION_EXPR_PATH}::test_token_identifier::TestTokenIdentifier" +TEST_TOKEN_IDENTIFIER_TYPE = ( + f"{INTERACTION_EXPR_PATH}::test_token_identifier::TestTokenIdentifier" +) # 7. MultiversX codec - Multi-types MULTI_TYPES_PATH = "multiversx_sc_codec::multi_types" -OPTIONAL_VALUE_TYPE = f"{MULTI_TYPES_PATH}::multi_value_optional::OptionalValue<{ANY_TYPE}>" +OPTIONAL_VALUE_TYPE = ( + f"{MULTI_TYPES_PATH}::multi_value_optional::OptionalValue<{ANY_TYPE}>" +) + class InvalidHandle(Exception): def __init__(self, raw_handle: int, map_: lldb.value) -> None: @@ -95,6 +109,7 @@ def wrapped(*args) -> str: except Exception as e: # Catch any other exceptions that might occur during pointer dereferencing return f"" + return wrapped @@ -162,12 +177,12 @@ def bytes_to_int(bytes: Collection[int]) -> int: def num_bigint_data_to_int(value_vec_u64: lldb.value) -> int: - value_hex = ''.join(reversed(list(map(sb_value_to_hex, value_vec_u64.sbvalue)))) + value_hex = "".join(reversed(list(map(sb_value_to_hex, value_vec_u64.sbvalue)))) return hex_to_int(value_hex) def ints_to_hex(ints: Iterable[int]) -> str: - return ''.join(map(u8_to_hex, ints)) + return "".join(map(u8_to_hex, ints)) def buffer_to_bytes(buffer: lldb.value) -> List[int]: @@ -190,7 +205,7 @@ def bytes_to_handle(bytes: List[int]) -> int: -112 """ bytes_hex = ints_to_hex(bytes) - return struct.unpack('>i', bytearray.fromhex(bytes_hex))[0] + return struct.unpack(">i", bytearray.fromhex(bytes_hex))[0] def format_buffer_hex_string(buffer_hex: str) -> str: @@ -210,27 +225,31 @@ def ascii_to_string(buffer_iterator: Iterable[int]) -> str: >>> ascii_to_string([116, 101, 115, 116]) 'test' """ - return ''.join(map(chr, buffer_iterator)) + return "".join(map(chr, buffer_iterator)) + def buffer_to_bytes_without_vm_type(buffer: lldb.value) -> List[int]: buffer_ints = buffer_to_bytes(buffer) buffer_vm_type = buffer_to_bytes(VM_TYPE_ADDRESS) - if buffer_ints[:len(buffer_vm_type)] == buffer_vm_type: - return buffer_ints[len(buffer_vm_type):] + if buffer_ints[: len(buffer_vm_type)] == buffer_vm_type: + return buffer_ints[len(buffer_vm_type) :] return buffer_ints + def buffer_as_string(buffer: lldb.value) -> str: buffer_ints = buffer_to_bytes_without_vm_type(buffer) buffer_string = ascii_to_string(buffer_ints) return f'"{buffer_string}"' + def interaction_type_as_string(buffer: lldb.value, prefix: str) -> str: buffer_ints = buffer_to_bytes(buffer) buffer_string = ascii_to_string(buffer_ints) return f'"{prefix}:{buffer_string}"' + def mixed_representation(buffer: lldb.value) -> str: buffer_hex = format_buffer_hex(buffer) buffer_string = buffer_as_string(buffer) @@ -248,8 +267,8 @@ def parse_handles_from_buffer_hex(buffer_hex: str) -> List[int]: """ raw_handles = [] for handle_bytes_iter in zip(*[iter(buffer_hex)] * 8): - handle_bytes_hex = ''.join(handle_bytes_iter) - raw_handle = struct.unpack('>i', bytearray.fromhex(handle_bytes_hex))[0] + handle_bytes_hex = "".join(handle_bytes_iter) + raw_handle = struct.unpack(">i", bytearray.fromhex(handle_bytes_hex))[0] raw_handles.append(raw_handle) return raw_handles @@ -288,16 +307,18 @@ def map_picker(self) -> Callable: def lookup(self, full_value: lldb.value) -> lldb.value: return full_value - def extract_value_from_raw_handle(self, context: lldb.value, raw_handle: int, map_picker: Callable) -> lldb.value: - weak_inner = context.ptr.pointer # object is of Rust type: ArcInner - + def extract_value_from_raw_handle( + self, context: lldb.value, raw_handle: int, map_picker: Callable + ) -> lldb.value: + weak_inner = context.ptr.pointer # object is of Rust type: ArcInner + # Check the strong count to see if the object is still alive # If strong count is 0, the object has been dropped - strong_atomic_usize = weak_inner.strong # object is of Rust type: Atomic + strong_atomic_usize = weak_inner.strong # object is of Rust type: Atomic strong_count = int(strong_atomic_usize.v.value) if strong_count == 0: raise InvalidWeakPointer(raw_handle) - + # Handle Weak by accessing the ptr field directly # context is Weak, which contains ptr that points to the WeakInner # The WeakInner contains a pointer to the actual TxContext data @@ -309,7 +330,9 @@ def extract_value_from_raw_handle(self, context: lldb.value, raw_handle: int, ma return value @check_invalid_handle - def summary_from_raw_handle(self, raw_handle: int, context: lldb.value, type_info: lldb.SBType) -> str: + def summary_from_raw_handle( + self, raw_handle: int, context: lldb.value, type_info: lldb.SBType + ) -> str: map_picker = self.map_picker() value = self.extract_value_from_raw_handle(context, raw_handle, map_picker) return self.value_summary(value, context, type_info) @@ -323,7 +346,9 @@ def summary(self, original_value: lldb.value) -> str: context = handle.context return self.summary_from_raw_handle(raw_handle, context, type_info) - def value_summary(self, value: lldb.value, context: lldb.value, type_info: lldb.SBType) -> str: + def value_summary( + self, value: lldb.value, context: lldb.value, type_info: lldb.SBType + ) -> str: pass @@ -331,7 +356,9 @@ class ManagedVecItem(Handler): def item_size(self) -> int: pass - def summarize_item(self, bytes: List[int], context: lldb.value, type_info: lldb.SBType) -> str: + def summarize_item( + self, bytes: List[int], context: lldb.value, type_info: lldb.SBType + ) -> str: pass @@ -343,7 +370,9 @@ class PlainManagedVecItem(ManagedVecItem, ManagedType): def item_size(self) -> int: return 4 - def summarize_item(self, handle_bytes: List[int], context: lldb.value, type_info: lldb.SBType) -> str: + def summarize_item( + self, handle_bytes: List[int], context: lldb.value, type_info: lldb.SBType + ) -> str: raw_handle = bytes_to_handle(handle_bytes) return self.summary_from_raw_handle(raw_handle, context, type_info) @@ -351,7 +380,7 @@ def summarize_item(self, handle_bytes: List[int], context: lldb.value, type_info class NumBigInt(Handler): def summary(self, num_big_int: lldb.value) -> str: value_int = num_bigint_data_to_int(num_big_int.data.data) - if num_big_int.sign.sbvalue.GetValue() == 'Minus': + if num_big_int.sign.sbvalue.GetValue() == "Minus": return str(-value_int) return str(value_int) @@ -366,7 +395,9 @@ class BigInt(PlainManagedVecItem, ManagedType): def map_picker(self) -> Callable: return pick_big_int - def value_summary(self, value: lldb.value, context: lldb.value, type_info: lldb.SBType) -> str: + def value_summary( + self, value: lldb.value, context: lldb.value, type_info: lldb.SBType + ) -> str: return str(value.sbvalue.GetSummary()) @@ -374,23 +405,29 @@ class BigFloat(PlainManagedVecItem, ManagedType): def map_picker(self) -> Callable: return pick_big_float - def value_summary(self, value: lldb.value, context: lldb.value, type_info: lldb.SBType) -> str: + def value_summary( + self, value: lldb.value, context: lldb.value, type_info: lldb.SBType + ) -> str: return str(value.sbvalue.GetValue()) class ManagedBuffer(PlainManagedVecItem, ManagedType): - def value_summary(self, buffer: lldb.value, context: lldb.value, type_info: lldb.SBType) -> str: + def value_summary( + self, buffer: lldb.value, context: lldb.value, type_info: lldb.SBType + ) -> str: return mixed_representation(buffer) class BigUint(PlainManagedVecItem, ManagedType): def map_picker(self) -> Callable: return pick_big_int - + def lookup(self, big_uint: lldb.value) -> lldb.value: return big_uint.value - def value_summary(self, big_uint: lldb.value, context: lldb.value, type_info: lldb.SBType) -> str: + def value_summary( + self, big_uint: lldb.value, context: lldb.value, type_info: lldb.SBType + ) -> str: return big_uint.sbvalue.GetSummary() @@ -398,7 +435,9 @@ class EsdtTokenIdentifier(PlainManagedVecItem, ManagedType): def lookup(self, token_identifier: lldb.value) -> lldb.value: return token_identifier.token_id.buffer - def value_summary(self, buffer: lldb.value, context: lldb.value, type_info: lldb.SBType) -> str: + def value_summary( + self, buffer: lldb.value, context: lldb.value, type_info: lldb.SBType + ) -> str: return buffer_as_string(buffer) @@ -406,24 +445,35 @@ class ManagedAddress(PlainManagedVecItem, ManagedType): def lookup(self, managed_address: lldb.value) -> lldb.value: return managed_address.bytes.buffer - def value_summary(self, buffer: lldb.value, context: lldb.value, type_info: lldb.SBType) -> str: + def value_summary( + self, buffer: lldb.value, context: lldb.value, type_info: lldb.SBType + ) -> str: return mixed_representation(buffer) + class ManagedByteArray(PlainManagedVecItem, ManagedType): def lookup(self, managed_byte_array: lldb.value) -> lldb.value: return managed_byte_array.buffer - def value_summary(self, buffer: lldb.value, context: lldb.value, type_info: lldb.SBType) -> str: + def value_summary( + self, buffer: lldb.value, context: lldb.value, type_info: lldb.SBType + ) -> str: return mixed_representation(buffer) class ManagedOption(PlainManagedVecItem, ManagedType): - def summary_from_raw_handle(self, raw_handle: int, context: lldb.value, type_info: lldb.SBType) -> str: + def summary_from_raw_handle( + self, raw_handle: int, context: lldb.value, type_info: lldb.SBType + ) -> str: if raw_handle == MANAGED_OPTION_NONE_HANDLE: return "ManagedOption::none()" - inner_type_handler, inner_type = get_inner_type_handler(type_info, MANAGED_OPTION_INNER_TYPE_INDEX) - assert(isinstance(inner_type_handler, ManagedType)) - inner_summary = inner_type_handler.summary_from_raw_handle(raw_handle, context, inner_type) + inner_type_handler, inner_type = get_inner_type_handler( + type_info, MANAGED_OPTION_INNER_TYPE_INDEX + ) + assert isinstance(inner_type_handler, ManagedType) + inner_summary = inner_type_handler.summary_from_raw_handle( + raw_handle, context, inner_type + ) return f"ManagedOption::some({inner_summary})" @@ -436,7 +486,7 @@ def split_bytes(bytes: List[int], sizes: Iterable[int]) -> List[List[int]]: chunks = [] i = 0 for size in sizes: - chunks.append(bytes[i: i + size]) + chunks.append(bytes[i : i + size]) i += size return chunks @@ -451,7 +501,7 @@ def split_bytes_fixed_size(bytes: List[int], size: int) -> List[List[int]]: i = 0 byte_count = len(bytes) while i < byte_count: - chunks.append(bytes[i: i + size]) + chunks.append(bytes[i : i + size]) i += size return chunks @@ -468,9 +518,15 @@ def summary(self, payment: lldb.value) -> str: def item_size(self) -> int: return sum(self.COMPONENT_SIZES) - def summarize_item(self, bytes: List[int], context: lldb.value, type_info: lldb.SBType) -> str: - token_id_handle_bytes, nonce_bytes, amount_handle_bytes = split_bytes(bytes, self.COMPONENT_SIZES) - token_id = EsdtTokenIdentifier().summarize_item(token_id_handle_bytes, context, None) + def summarize_item( + self, bytes: List[int], context: lldb.value, type_info: lldb.SBType + ) -> str: + token_id_handle_bytes, nonce_bytes, amount_handle_bytes = split_bytes( + bytes, self.COMPONENT_SIZES + ) + token_id = EsdtTokenIdentifier().summarize_item( + token_id_handle_bytes, context, None + ) nonce = bytes_to_int(nonce_bytes) amount = BigInt().summarize_item(amount_handle_bytes, context, None) return self.to_string(token_id, nonce, amount) @@ -483,24 +539,33 @@ class EgldOrEsdtTokenIdentifier(PlainManagedVecItem, ManagedType): def lookup(self, egld_or_esdt_token_identifier: lldb.value) -> lldb.value: return egld_or_esdt_token_identifier.token_id.buffer - def value_summary(self, buffer: lldb.value, context: lldb.value, type_info: lldb.SBType) -> str: + def value_summary( + self, buffer: lldb.value, context: lldb.value, type_info: lldb.SBType + ) -> str: token_id = buffer_as_string(buffer) if token_id == '"EGLD-000000"': return "EgldOrEsdtTokenIdentifier::egld()" - return f"EgldOrEsdtTokenIdentifier::esdt({token_id})" + return f"EgldOrEsdtTokenIdentifier::esdt({token_id})" class ManagedVec(PlainManagedVecItem, ManagedType): def lookup(self, managed_vec: lldb.value) -> lldb.value: return managed_vec.buffer - def value_summary(self, value: lldb.value, context: lldb.value, type_info: lldb.SBType) -> str: - item_handler, inner_type = get_inner_type_handler(type_info, MANAGED_VEC_INNER_TYPE_INDEX) - assert(isinstance(item_handler, ManagedVecItem)) + def value_summary( + self, value: lldb.value, context: lldb.value, type_info: lldb.SBType + ) -> str: + item_handler, inner_type = get_inner_type_handler( + type_info, MANAGED_VEC_INNER_TYPE_INDEX + ) + assert isinstance(item_handler, ManagedVecItem) buffer_bytes = buffer_to_bytes(value) item_size = item_handler.item_size() bytes_of_all_items = split_bytes_fixed_size(buffer_bytes, item_size) - items = [item_handler.summarize_item(bytes, context, inner_type) for bytes in bytes_of_all_items] + items = [ + item_handler.summarize_item(bytes, context, inner_type) + for bytes in bytes_of_all_items + ] return format_vec(items) @@ -519,25 +584,33 @@ def summary(self, boxed_bytes: lldb.value) -> str: buffer_hex = ints_to_hex(raw) return format_buffer_hex_string(buffer_hex) + class TestSCAddress(Handler): def summary(self, test_sc_address: lldb.value) -> str: buffer = lldb.value(test_sc_address.sbvalue.GetChildAtIndex(0)) return interaction_type_as_string(buffer, "sc") - + + class TestAddress(Handler): def summary(self, test_address: lldb.value) -> str: buffer = lldb.value(test_address.sbvalue.GetChildAtIndex(0)) return interaction_type_as_string(buffer, "address") - + + class TestTokenIdentifier(Handler): def summary(self, test_address: lldb.value) -> str: buffer = lldb.value(test_address.sbvalue.GetChildAtIndex(0)) return interaction_type_as_string(buffer, "str") + class OptionalValue(Handler): def summary(self, optional_value: lldb.value) -> str: base_type = optional_value.sbvalue.GetType().GetName() - if optional_value.value.sbvalue.GetType().GetName().startswith(f'{base_type}::Some'): + if ( + optional_value.value.sbvalue.GetType() + .GetName() + .startswith(f"{base_type}::Some") + ): summary = optional_value.value.sbvalue.GetChildAtIndex(0).GetSummary() return f"OptionalValue::Some({summary})" return "OptionalValue::None" @@ -576,10 +649,12 @@ def summary(self, optional_value: lldb.value) -> str: class UnknownType(Exception): def __init__(self, type_name: str) -> None: - super().__init__(f'unknown type: {type_name}') + super().__init__(f"unknown type: {type_name}") -def get_inner_type_handler(type_info: lldb.SBType, inner_type_index: int) -> Tuple[Handler, lldb.SBType]: +def get_inner_type_handler( + type_info: lldb.SBType, inner_type_index: int +) -> Tuple[Handler, lldb.SBType]: inner_type = type_info.GetTemplateArgumentType(inner_type_index).GetCanonicalType() handler = get_handler(inner_type.GetName()) return handler, inner_type @@ -599,7 +674,7 @@ def summarize_handler(handler_type: Type[Handler], valobj: SBValue, dictionary) def __lldb_init_module(debugger: SBDebugger, dict): - python_module_name = Path(__file__).with_suffix('').name + python_module_name = Path(__file__).with_suffix("").name for rust_type, handler_class in MULTIVERSX_WASM_TYPE_HANDLERS: # Add summary binding @@ -611,4 +686,4 @@ def __lldb_init_module(debugger: SBDebugger, dict): # print(f"Registered: {summary_command}") # Enable categories - debugger.HandleCommand('type category enable multiversx-sc') + debugger.HandleCommand("type category enable multiversx-sc") diff --git a/tools/rust-debugger/pretty-printers/pyproject.toml b/tools/rust-debugger/pretty-printers/pyproject.toml new file mode 100644 index 0000000000..400b7c3f24 --- /dev/null +++ b/tools/rust-debugger/pretty-printers/pyproject.toml @@ -0,0 +1,13 @@ +[tool.black] +line-length = 88 +target-version = ['py38', 'py39', 'py310', 'py311'] +include = '\.pyi?$' +extend-exclude = ''' +/( + # directories + \.eggs + | \.git + | \.venv + | target +)/ +''' \ No newline at end of file From 5b0c3be80f7debef3755584294071b20c43c9cb4 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Mon, 12 Jan 2026 18:39:02 +0200 Subject: [PATCH 15/15] reqwest upgrade, using rusttls --- Cargo.lock | 699 +++++++++++++++++++--------------- framework/meta/Cargo.toml | 2 +- framework/snippets/Cargo.toml | 4 +- sdk/http/Cargo.toml | 5 +- tools/git-scraper/Cargo.toml | 2 +- 5 files changed, 393 insertions(+), 319 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 59e2ed1a0e..dd517fc5f7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -207,6 +207,28 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "aws-lc-rs" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a88aab2464f1f25453baa7a07c84c5b7684e274054ba06817f382357f77a288" +dependencies = [ + "aws-lc-sys", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45afffdee1e7c9126814751f88dddc747f41d91da16c9551a0f1e8a11e788a1" +dependencies = [ + "cc", + "cmake", + "dunce", + "fs_extra", +] + [[package]] name = "backtrace" version = "0.3.76" @@ -230,9 +252,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" -version = "1.8.1" +version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e050f626429857a27ddccb31e0aca21356bfa709c04041aefddac081a8f068a" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" [[package]] name = "basic-features" @@ -255,7 +277,7 @@ dependencies = [ "serial_test", "system-sc-interact", "tokio", - "toml 0.9.10+spec-1.1.0", + "toml 0.9.11+spec-1.1.0", ] [[package]] @@ -276,7 +298,7 @@ dependencies = [ "serde", "serial_test", "tokio", - "toml 0.9.10+spec-1.1.0", + "toml 0.9.11+spec-1.1.0", ] [[package]] @@ -335,7 +357,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -472,7 +494,7 @@ checksum = "89385e82b5d1821d2219e0b095efa2cc1f246cbf99080f3be46a1a85c0d392d9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -495,14 +517,22 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.49" +version = "1.2.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90583009037521a116abf44494efecd645ba48b6622457080f080b85544e2215" +checksum = "cd4932aefd12402b36c60956a4fe0035421f544799057659ff86f923657aada3" dependencies = [ "find-msvc-tools", + "jobserver", + "libc", "shlex", ] +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + [[package]] name = "cexpr" version = "0.6.0" @@ -622,9 +652,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.53" +version = "4.5.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8" +checksum = "c6e6ff9dcd79cff5cd969a17a545d79e84ab086e444102a591e288a8aa3ce394" dependencies = [ "clap_builder", "clap_derive", @@ -632,9 +662,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.53" +version = "4.5.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00" +checksum = "fa42cf4d2b7a41bc8f663a7cab4031ebafa1bf3875705bfaf8466dc60ab52c00" dependencies = [ "anstream", "anstyle", @@ -651,7 +681,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -694,6 +724,16 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + [[package]] name = "common-path" version = "1.0.0" @@ -771,6 +811,16 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -992,7 +1042,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -1015,7 +1065,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -1026,7 +1076,7 @@ checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ "darling_core", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -1051,7 +1101,7 @@ dependencies = [ "multiversx-sc-snippets", "serde", "tokio", - "toml 0.9.10+spec-1.1.0", + "toml 0.9.11+spec-1.1.0", ] [[package]] @@ -1072,7 +1122,7 @@ checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -1083,29 +1133,29 @@ checksum = "6edb4b64a43d977b8e99788fe3a04d483834fba1215a7e02caa415b626497f7f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] name = "derive_more" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10b768e943bed7bf2cab53df09f4bc34bfd217cdb57d971e769874c9a6710618" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" dependencies = [ "derive_more-impl", ] [[package]] name = "derive_more-impl" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d286bfdaf75e988b4a78e013ecd79c581e06399ab53fbacd2d916c2f904f30b" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" dependencies = [ "convert_case", "proc-macro2", "quote", "rustc_version", - "syn 2.0.111", + "syn 2.0.114", "unicode-xid", ] @@ -1144,9 +1194,15 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "dynasm" version = "4.0.2" @@ -1159,7 +1215,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -1274,7 +1330,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -1486,12 +1542,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" -[[package]] -name = "fastrand" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" - [[package]] name = "fiat-crypto" version = "0.2.9" @@ -1512,9 +1562,9 @@ dependencies = [ [[package]] name = "find-msvc-tools" -version = "0.1.5" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" +checksum = "f449e6c6c08c865631d4890cfacf252b3d396c9bcc83adb6623cdb02a8336c41" [[package]] name = "first-contract" @@ -1535,13 +1585,13 @@ dependencies = [ [[package]] name = "flate2" -version = "1.1.5" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" +checksum = "b375d6465b98090a5f25b1c7703f3859783755aa9a80433b36e0379a3ec2f369" dependencies = [ "crc32fast", - "libz-rs-sys", "miniz_oxide", + "zlib-rs", ] [[package]] @@ -1556,21 +1606,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.2.2" @@ -1613,7 +1648,7 @@ dependencies = [ "multiversx-sc", "multiversx-sc-snippets", "serde", - "toml 0.9.10+spec-1.1.0", + "toml 0.9.11+spec-1.1.0", ] [[package]] @@ -1691,6 +1726,12 @@ dependencies = [ "multiversx-sc-meta-lib", ] +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "futures" version = "0.3.31" @@ -1747,7 +1788,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -1813,9 +1854,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ "cfg-if", "js-sys", @@ -1945,7 +1986,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "903f432be5ba34427eac5e16048ef65604a82061fe93789f2212afc73d8617d6" dependencies = [ - "getrandom 0.2.16", + "getrandom 0.2.17", "gloo-events", "gloo-utils", "serde", @@ -2076,7 +2117,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -2089,14 +2130,14 @@ dependencies = [ "payable-interactor", "serde", "tokio", - "toml 0.9.10+spec-1.1.0", + "toml 0.9.11+spec-1.1.0", ] [[package]] name = "h2" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386" +checksum = "2f44da3a8150a6703ed5d34e164b875fd14c2cdab9af1252a9a1020bde2bdc54" dependencies = [ "atomic-waker", "bytes", @@ -2275,23 +2316,6 @@ dependencies = [ "tokio", "tokio-rustls", "tower-service", - "webpki-roots", -] - -[[package]] -name = "hyper-tls" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" -dependencies = [ - "bytes", - "http-body-util", - "hyper", - "hyper-util", - "native-tls", - "tokio", - "tokio-native-tls", - "tower-service", ] [[package]] @@ -2485,14 +2509,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "699c1b6d335e63d0ba5c1e1c7f647371ce989c3bcbe1f7ed2b85fa56e3bd1a21" dependencies = [ "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] name = "indexmap" -version = "2.12.1" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" dependencies = [ "equivalent", "hashbrown 0.16.1", @@ -2518,7 +2542,7 @@ dependencies = [ "multiversx-sc-snippets", "serde", "tokio", - "toml 0.9.10+spec-1.1.0", + "toml 0.9.11+spec-1.1.0", ] [[package]] @@ -2529,9 +2553,9 @@ checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" [[package]] name = "iri-string" -version = "0.7.9" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f867b9d1d896b67beb18518eda36fdb77a32ea590de864f1325b294a6d14397" +checksum = "c91338f0783edbd6195decb37bae672fd3b165faffb89bf7b9e6942f8b1a731a" dependencies = [ "memchr", "serde", @@ -2563,15 +2587,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" [[package]] name = "jiff" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49cce2b81f2098e7e3efc35bc2e0a6b7abec9d34128283d7a26fa8f32a6dbb35" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" dependencies = [ "jiff-static", "log", @@ -2582,13 +2606,45 @@ dependencies = [ [[package]] name = "jiff-static" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "980af8b43c3ad5d8d349ace167ec8170839f753a42d233ba19e08afe1850fa69" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", +] + +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", ] [[package]] @@ -2709,9 +2765,9 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" [[package]] name = "libc" -version = "0.2.178" +version = "0.2.180" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" [[package]] name = "libloading" @@ -2725,13 +2781,13 @@ dependencies = [ [[package]] name = "libredox" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df15f6eac291ed1cf25865b1ee60399f57e7c227e7f51bdbd4c5270396a9ed50" +checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" dependencies = [ "bitflags 2.10.0", "libc", - "redox_syscall 0.6.0", + "redox_syscall 0.7.0", ] [[package]] @@ -2740,15 +2796,6 @@ version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c6639b70a7ce854b79c70d7e83f16b5dc0137cc914f3d7d03803b513ecc67ac" -[[package]] -name = "libz-rs-sys" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15413ef615ad868d4d65dce091cb233b229419c7c0c4bcaa746c0901c49ff39c" -dependencies = [ - "zlib-rs", -] - [[package]] name = "linked-list-repeat" version = "0.0.0" @@ -3017,7 +3064,7 @@ dependencies = [ "multiversx-sc-snippets", "serde", "tokio", - "toml 0.9.10+spec-1.1.0", + "toml 0.9.11+spec-1.1.0", ] [[package]] @@ -3085,7 +3132,7 @@ dependencies = [ "serde", "sha2", "sha3", - "toml 0.9.10+spec-1.1.0", + "toml 0.9.11+spec-1.1.0", ] [[package]] @@ -3166,7 +3213,7 @@ dependencies = [ "hex", "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -3185,7 +3232,7 @@ dependencies = [ "proc-macro2", "quote", "radix_trie", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -3212,7 +3259,7 @@ dependencies = [ "serde", "serde_json", "tokio", - "toml 0.9.10+spec-1.1.0", + "toml 0.9.11+spec-1.1.0", "zip", ] @@ -3230,7 +3277,7 @@ dependencies = [ "semver", "serde", "serde_json", - "toml 0.9.10+spec-1.1.0", + "toml 0.9.11+spec-1.1.0", "wasmparser 0.243.0", "wasmprinter", "wat", @@ -3387,7 +3434,7 @@ checksum = "4568f25ccbd45ab5d5603dc34318c1ec56b117531781260002151b8530a9f931" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -3401,23 +3448,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "native-tls" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "nft-minter" version = "0.0.0" @@ -3574,49 +3604,11 @@ dependencies = [ "num-traits", ] -[[package]] -name = "openssl" -version = "0.10.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" -dependencies = [ - "bitflags 2.10.0", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.111", -] - [[package]] name = "openssl-probe" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" - -[[package]] -name = "openssl-sys" -version = "0.9.111" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] +checksum = "9f50d9b3dabb09ecd771ad0aa242ca6894994c130308ca3d7684634df8037391" [[package]] name = "order-book-factory" @@ -3736,7 +3728,7 @@ dependencies = [ "serde", "serial_test", "tokio", - "toml 0.9.10+spec-1.1.0", + "toml 0.9.11+spec-1.1.0", ] [[package]] @@ -3782,7 +3774,7 @@ checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -3828,7 +3820,7 @@ dependencies = [ "ping-pong-egld", "serde", "tokio", - "toml 0.9.10+spec-1.1.0", + "toml 0.9.11+spec-1.1.0", ] [[package]] @@ -3860,12 +3852,6 @@ dependencies = [ "spki", ] -[[package]] -name = "pkg-config" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" - [[package]] name = "plotters" version = "0.3.7" @@ -3896,9 +3882,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.11.1" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" [[package]] name = "portable-atomic-util" @@ -3934,7 +3920,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -3990,14 +3976,14 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] name = "proc-macro2" -version = "1.0.103" +version = "1.0.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7" dependencies = [ "unicode-ident", ] @@ -4089,7 +4075,7 @@ checksum = "7347867d0a7e1208d93b46767be83e2b8f978c3dad35f775ac8d8847551d6fe1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -4135,6 +4121,7 @@ version = "0.11.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" dependencies = [ + "aws-lc-rs", "bytes", "getrandom 0.3.4", "lru-slab", @@ -4166,9 +4153,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.42" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a" dependencies = [ "proc-macro2", ] @@ -4216,7 +4203,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ "rand_chacha 0.9.0", - "rand_core 0.9.3", + "rand_core 0.9.4", ] [[package]] @@ -4236,7 +4223,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", - "rand_core 0.9.3", + "rand_core 0.9.4", ] [[package]] @@ -4245,14 +4232,14 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.16", + "getrandom 0.2.17", ] [[package]] name = "rand_core" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +checksum = "4f1b3bc831f92381018fd9c6350b917c7b21f1eed35a65a51900e0e55a3d7afa" dependencies = [ "getrandom 0.3.4", ] @@ -4263,7 +4250,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "502927fdfc3c9645d53e0c95bb2d53783b5a15bfeaeeb96f7703c21fbb76841e" dependencies = [ - "rand_core 0.9.3", + "rand_core 0.9.4", ] [[package]] @@ -4327,9 +4314,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec96166dafa0886eb81fe1c0a388bece180fbef2135f97c1e2cf8302e74b43b5" +checksum = "49f3fe0889e69e2ae9e41f4d6c4c0181701d00e4697b356fb1f74173a5e0ee27" dependencies = [ "bitflags 2.10.0", ] @@ -4386,9 +4373,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.26" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b4c14b2d9afca6a60277086b0cc6a6ae0b568f6f7916c943a8cdc79f8be240f" +checksum = "04e9018c9d814e5f30cc16a0f03271aeab3571e609612d9fe78c1aa8d11c2f62" dependencies = [ "base64", "bytes", @@ -4402,23 +4389,20 @@ dependencies = [ "http-body-util", "hyper", "hyper-rustls", - "hyper-tls", "hyper-util", "js-sys", "log", "mime", - "native-tls", "percent-encoding", "pin-project-lite", "quinn", "rustls", "rustls-pki-types", + "rustls-platform-verifier", "serde", "serde_json", - "serde_urlencoded", "sync_wrapper", "tokio", - "tokio-native-tls", "tokio-rustls", "tower", "tower-http", @@ -4427,7 +4411,6 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots", ] [[package]] @@ -4455,7 +4438,7 @@ checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", - "getrandom 0.2.16", + "getrandom 0.2.17", "libc", "untrusted", "windows-sys 0.52.0", @@ -4463,13 +4446,13 @@ dependencies = [ [[package]] name = "rkyv" -version = "0.8.12" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35a640b26f007713818e9a9b65d34da1cf58538207b052916a83d80e43f3ffa4" +checksum = "8b2e88acca7157d83d789836a3987dafc12bc3d88a050e54b8fe9ea4aaa29d20" dependencies = [ "bytecheck 0.8.2", "bytes", - "hashbrown 0.15.5", + "hashbrown 0.16.1", "indexmap", "munge", "ptr_meta 0.3.1", @@ -4482,13 +4465,13 @@ dependencies = [ [[package]] name = "rkyv_derive" -version = "0.8.12" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd83f5f173ff41e00337d97f6572e416d022ef8a19f371817259ae960324c482" +checksum = "7f6dffea3c91fa91a3c0fc8a061b0e27fef25c6304728038a6d6bcb1c58ba9bd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -4579,9 +4562,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" dependencies = [ "bitflags 2.10.0", "errno", @@ -4592,18 +4575,30 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.35" +version = "0.23.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f" +checksum = "c665f33d38cea657d9614f766881e4d510e0eda4239891eea56b4cadcf01801b" dependencies = [ + "aws-lc-rs", "once_cell", - "ring", "rustls-pki-types", "rustls-webpki", "subtle", "zeroize", ] +[[package]] +name = "rustls-native-certs" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + [[package]] name = "rustls-pki-types" version = "1.13.2" @@ -4614,12 +4609,40 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rustls-platform-verifier" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d99feebc72bae7ab76ba994bb5e121b8d83d910ca40b36e0921f53becc41784" +dependencies = [ + "core-foundation 0.10.1", + "core-foundation-sys", + "jni", + "log", + "once_cell", + "rustls", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki", + "security-framework", + "security-framework-sys", + "webpki-root-certs", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls-platform-verifier-android" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" + [[package]] name = "rustls-webpki" version = "0.103.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52" dependencies = [ + "aws-lc-rs", "ring", "rustls-pki-types", "untrusted", @@ -4644,9 +4667,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984" [[package]] name = "salsa20" @@ -4742,12 +4765,12 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.11.1" +version = "3.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +checksum = "b3297343eaf830f66ede390ea39da1d462b6b0c1b000f420d0a83f898bbbe6ef" dependencies = [ "bitflags 2.10.0", - "core-foundation", + "core-foundation 0.10.1", "core-foundation-sys", "libc", "security-framework-sys", @@ -4782,9 +4805,9 @@ dependencies = [ [[package]] name = "self_cell" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16c2f82143577edb4921b71ede051dac62ca3c16084e918bf7b40c96ae10eb33" +checksum = "b12e76d157a900eb52e81bc6e9f3069344290341720e9178cde2407113ac8d89" [[package]] name = "semver" @@ -4846,21 +4869,21 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] name = "serde_json" -version = "1.0.145" +version = "1.0.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" dependencies = [ "indexmap", "itoa", "memchr", - "ryu", "serde", "serde_core", + "zmij", ] [[package]] @@ -4871,7 +4894,7 @@ checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -4906,11 +4929,12 @@ dependencies = [ [[package]] name = "serial_test" -version = "3.2.0" +version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b258109f244e1d6891bf1053a55d63a5cd4f8f4c30cf9a1280989f80e7a1fa9" +checksum = "0d0b343e184fc3b7bb44dff0705fffcf4b3756ba6aff420dddd8b24ca145e555" dependencies = [ - "futures", + "futures-executor", + "futures-util", "log", "once_cell", "parking_lot", @@ -4920,13 +4944,13 @@ dependencies = [ [[package]] name = "serial_test_derive" -version = "3.2.0" +version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d69265a08751de7844521fd15003ae0a888e035773ba05695c5c759a6f89eef" +checksum = "6f50427f258fb77356e4cd4aa0e87e2bd2c66dbcee41dc405282cae2bfc26c83" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -4985,10 +5009,11 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" -version = "1.4.7" +version = "1.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7664a098b8e616bdfcc2dc0e9ac44eb231eedf41db4e9fe95d8d32ec728dedad" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" dependencies = [ + "errno", "libc", ] @@ -5138,9 +5163,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.111" +version = "2.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" +checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" dependencies = [ "proc-macro2", "quote", @@ -5164,7 +5189,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -5174,7 +5199,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ "bitflags 2.10.0", - "core-foundation", + "core-foundation 0.9.4", "system-configuration-sys", ] @@ -5196,7 +5221,7 @@ dependencies = [ "multiversx-sc-snippets", "serde", "tokio", - "toml 0.9.10+spec-1.1.0", + "toml 0.9.11+spec-1.1.0", ] [[package]] @@ -5216,19 +5241,6 @@ version = "0.12.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" -[[package]] -name = "tempfile" -version = "3.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" -dependencies = [ - "fastrand", - "getrandom 0.3.4", - "once_cell", - "rustix", - "windows-sys 0.61.2", -] - [[package]] name = "termcolor" version = "1.4.1" @@ -5264,7 +5276,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -5275,7 +5287,7 @@ checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -5331,9 +5343,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.48.0" +version = "1.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" dependencies = [ "bytes", "libc", @@ -5354,17 +5366,7 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", -] - -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", + "syn 2.0.114", ] [[package]] @@ -5379,9 +5381,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" +checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" dependencies = [ "futures-core", "pin-project-lite", @@ -5390,9 +5392,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.17" +version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2efa149fe76073d6e8fd97ef4f4eca7b67f599660115591483572e406e165594" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" dependencies = [ "bytes", "futures-core", @@ -5432,9 +5434,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.9.10+spec-1.1.0" +version = "0.9.11+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0825052159284a1a8b4d6c0c86cbc801f2da5afd2b225fa548c72f2e74002f48" +checksum = "f3afc9a848309fe1aaffaed6e1546a7a14de1f935dc9d89d32afd9a44bab7c46" dependencies = [ "indexmap", "serde_core", @@ -5555,7 +5557,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -5654,9 +5656,9 @@ checksum = "e497bb1f828cc9fb236722c2eaa100dcf201563f38f4da6252357a59037adf31" [[package]] name = "url" -version = "2.5.7" +version = "2.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" dependencies = [ "form_urlencoded", "idna", @@ -5727,12 +5729,6 @@ dependencies = [ "vault", ] -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "vec-repeat" version = "0.0.0" @@ -5835,7 +5831,7 @@ dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", "wasm-bindgen-shared", ] @@ -5850,12 +5846,12 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.243.0" +version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c55db9c896d70bd9fa535ce83cd4e1f2ec3726b0edd2142079f594fc3be1cb35" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" dependencies = [ "leb128fmt", - "wasmparser 0.243.0", + "wasmparser 0.244.0", ] [[package]] @@ -5868,7 +5864,7 @@ dependencies = [ "bytes", "cfg-if", "cmake", - "derive_more 2.1.0", + "derive_more 2.1.1", "indexmap", "js-sys", "more-asserts", @@ -5962,7 +5958,7 @@ dependencies = [ "bytecheck 0.6.12", "enum-iterator", "enumset", - "getrandom 0.2.16", + "getrandom 0.2.17", "hex", "indexmap", "more-asserts", @@ -6023,6 +6019,17 @@ dependencies = [ "serde", ] +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags 2.10.0", + "indexmap", + "semver", +] + [[package]] name = "wasmprinter" version = "0.243.0" @@ -6036,9 +6043,9 @@ dependencies = [ [[package]] name = "wast" -version = "243.0.0" +version = "244.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df21d01c2d91e46cb7a221d79e58a2d210ea02020d57c092e79255cc2999ca7f" +checksum = "b2e7b9f9e23311275920e3d6b56d64137c160cf8af4f84a7283b36cfecbf4acb" dependencies = [ "bumpalo", "leb128fmt", @@ -6049,9 +6056,9 @@ dependencies = [ [[package]] name = "wat" -version = "1.243.0" +version = "1.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "226a9a91cd80a50449312fef0c75c23478fcecfcc4092bdebe1dc8e760ef521b" +checksum = "bbf35b87ed352f9ab6cd0732abde5a67dd6153dfd02c493e61459218b19456fa" dependencies = [ "wast", ] @@ -6085,10 +6092,10 @@ dependencies = [ ] [[package]] -name = "webpki-roots" -version = "1.0.4" +name = "webpki-root-certs" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2878ef029c47c6e8cf779119f20fcf52bde7ad42a731b2a304bc221df17571e" +checksum = "36a29fc0408b113f68cf32637857ab740edfafdf460c326cd2afaa2d84cc05dc" dependencies = [ "rustls-pki-types", ] @@ -6123,7 +6130,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -6134,7 +6141,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -6172,6 +6179,15 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + [[package]] name = "windows-sys" version = "0.52.0" @@ -6208,6 +6224,21 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + [[package]] name = "windows-targets" version = "0.52.6" @@ -6241,6 +6272,12 @@ dependencies = [ "windows_x86_64_msvc 0.53.1", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" @@ -6253,6 +6290,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" @@ -6265,6 +6308,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -6289,6 +6338,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + [[package]] name = "windows_i686_msvc" version = "0.52.6" @@ -6301,6 +6356,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" @@ -6313,6 +6374,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" @@ -6325,6 +6392,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -6417,7 +6490,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -6447,7 +6520,7 @@ checksum = "9e87a3ce33434ab66a700edbaf2cc8a417d9b89f00a6fd8216fd6ac83b0e7b1c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -6469,28 +6542,28 @@ checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", "synstructure", ] [[package]] name = "zerocopy" -version = "0.8.31" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" +checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.31" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" +checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -6510,7 +6583,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", "synstructure", ] @@ -6550,7 +6623,7 @@ checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.114", ] [[package]] @@ -6569,9 +6642,15 @@ dependencies = [ [[package]] name = "zlib-rs" -version = "0.5.4" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40990edd51aae2c2b6907af74ffb635029d5788228222c4bb811e9351c0caad3" + +[[package]] +name = "zmij" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51f936044d677be1a1168fae1d03b583a285a5dd9d8cbf7b24c23aa1fc775235" +checksum = "ac93432f5b761b22864c774aac244fa5c0fd877678a4c37ebf6cf42208f9c9ec" [[package]] name = "zopfli" diff --git a/framework/meta/Cargo.toml b/framework/meta/Cargo.toml index 9a3ae8db29..0aa2321eb3 100644 --- a/framework/meta/Cargo.toml +++ b/framework/meta/Cargo.toml @@ -35,7 +35,7 @@ convert_case = "0.10" semver = "1.0.20" ruplacer = { version = "0.10", default-features = false } regex = "1.11" -reqwest = { version = "0.12", features = ["blocking", "json"] } +reqwest = { version = "0.13", features = ["rustls", "blocking", "json"] } zip = { version = "6.0", features = ["deflate"], default-features = false } copy_dir = "0.1.2" pathdiff = "0.2.1" diff --git a/framework/snippets/Cargo.toml b/framework/snippets/Cargo.toml index 0e0bc27d6f..7e9e03708b 100644 --- a/framework/snippets/Cargo.toml +++ b/framework/snippets/Cargo.toml @@ -14,11 +14,9 @@ keywords = ["multiversx", "blockchain", "contract", "snippets"] categories = ["cryptography::cryptocurrencies"] [features] -default = ["http", "default-tls"] +default = ["http"] http = ["multiversx-sdk-http", "tokio"] dapp = ["multiversx-sdk-dapp"] -default-tls = ["multiversx-sdk-http/default-tls"] -static-tls = ["multiversx-sdk-http/static-tls"] [dependencies] hex = "0.4" diff --git a/sdk/http/Cargo.toml b/sdk/http/Cargo.toml index 3bf99a23b5..ba1e37b146 100644 --- a/sdk/http/Cargo.toml +++ b/sdk/http/Cargo.toml @@ -16,14 +16,11 @@ categories = ["cryptography::cryptocurrencies", "api-bindings"] keywords = ["multiversx", "blockchain", "sdk", "api"] [features] -default = ["default-tls"] -default-tls = ["reqwest/default-tls"] -static-tls = ["reqwest/rustls-tls"] chain_simulator = [] [dependencies] tokio = { version = "1.24", features = ["full"] } -reqwest = { version = "0.12", features = ["blocking", "json"], default-features = false } +reqwest = { version = "0.13", features = ["rustls", "blocking", "json"], default-features = false } anyhow = "1.0.44" hex = "0.4.3" itertools = "0.14.0" diff --git a/tools/git-scraper/Cargo.toml b/tools/git-scraper/Cargo.toml index 59a6032bcc..e9294ce3bb 100644 --- a/tools/git-scraper/Cargo.toml +++ b/tools/git-scraper/Cargo.toml @@ -10,7 +10,7 @@ edition = "2024" authors = ["you"] [dependencies] -reqwest = { version = "0.11", features = ["blocking", "json"] } +reqwest = { version = "0.13", features = ["rustls", "blocking", "json"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" dotenv = "0.15"