mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 16:57:58 +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:
@@ -60,6 +60,18 @@ pub trait TestApi {
|
||||
vec![0; 4 * 1024]
|
||||
}
|
||||
|
||||
fn return_option_vec() -> Option<Vec<u8>> {
|
||||
let mut vec = Vec::new();
|
||||
vec.resize(16 * 1024, 0xAA);
|
||||
Some(vec)
|
||||
}
|
||||
|
||||
fn return_option_bytes() -> Option<bytes::Bytes> {
|
||||
let mut vec = Vec::new();
|
||||
vec.resize(16 * 1024, 0xAA);
|
||||
Some(vec.into())
|
||||
}
|
||||
|
||||
/// Set the storage at key with value.
|
||||
fn set_storage(&mut self, key: &[u8], data: &[u8]) {
|
||||
self.place_storage(key.to_vec(), Some(data.to_vec()));
|
||||
@@ -300,4 +312,12 @@ wasm_export_functions! {
|
||||
assert_eq!(c, res.2);
|
||||
assert_eq!(d, res.3);
|
||||
}
|
||||
|
||||
fn test_return_option_vec() {
|
||||
test_api::return_option_vec();
|
||||
}
|
||||
|
||||
fn test_return_option_bytes() {
|
||||
test_api::return_option_bytes();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user