mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 21:37:56 +00:00
Prevent double allocation of the payload when calling sp_io::storage::get (#11523)
* Expose allocation stats in `FreeingBumpHeapAllocator` * Return allocation stats when calling into the runtime * Bump `parity-scale-codec` to 3.1.3 (fork) * Prevent double allocation of the payload when calling `sp_io::storage::get` * Fix tests * Remove unnecessary `mut` * Enable the `bytes` feature for `parity-scale-codec` in `sp-runtime-interface` * Update client/allocator/src/freeing_bump.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Bump `parity-scale-codec` to 3.1.3 * Fix some of the UI tests Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
use crate::error::Error;
|
||||
use sp_wasm_interface::Value;
|
||||
|
||||
pub use sc_allocator::AllocationStats;
|
||||
|
||||
/// A method to be used to find the entrypoint when calling into the runtime
|
||||
///
|
||||
/// Contains variants on how to resolve wasm function that will be invoked.
|
||||
@@ -78,7 +80,20 @@ pub trait WasmInstance: Send {
|
||||
/// Before execution, instance is reset.
|
||||
///
|
||||
/// Returns the encoded result on success.
|
||||
fn call(&mut self, method: InvokeMethod, data: &[u8]) -> Result<Vec<u8>, Error>;
|
||||
fn call(&mut self, method: InvokeMethod, data: &[u8]) -> Result<Vec<u8>, Error> {
|
||||
self.call_with_allocation_stats(method, data).0
|
||||
}
|
||||
|
||||
/// Call a method on this WASM instance.
|
||||
///
|
||||
/// Before execution, instance is reset.
|
||||
///
|
||||
/// Returns the encoded result on success.
|
||||
fn call_with_allocation_stats(
|
||||
&mut self,
|
||||
method: InvokeMethod,
|
||||
data: &[u8],
|
||||
) -> (Result<Vec<u8>, Error>, Option<AllocationStats>);
|
||||
|
||||
/// Call an exported method on this WASM instance.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user