mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 00:01:09 +00:00
update the WASM runtime imports
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
//! Environment API: Allows certain information to be accessed throughout the runtime.
|
||||
|
||||
use runtime_support::boxed::Box;
|
||||
use runtime_support::mem;
|
||||
use runtime_support::cell::RefCell;
|
||||
use runtime_support::rc::Rc;
|
||||
|
||||
@@ -8,11 +8,19 @@ extern crate alloc;
|
||||
|
||||
pub use alloc::vec;
|
||||
pub use alloc::boxed;
|
||||
pub use alloc::rc::Rc;
|
||||
pub use alloc::rc;
|
||||
pub use core::mem;
|
||||
pub use core::slice;
|
||||
pub use core::cell;
|
||||
|
||||
/// Common re-exports that are useful to have in scope.
|
||||
pub mod prelude {
|
||||
pub use alloc::vec::Vec;
|
||||
pub use alloc::boxed::Box;
|
||||
}
|
||||
|
||||
use alloc::vec::Vec;
|
||||
|
||||
extern crate pwasm_libc;
|
||||
extern crate pwasm_alloc;
|
||||
|
||||
@@ -68,7 +76,7 @@ pub fn chain_id() -> u64 {
|
||||
/// Conduct a 256-bit Blake2 hash.
|
||||
pub fn blake2_256(data: &[u8]) -> [u8; 32] {
|
||||
unsafe {
|
||||
let mut result: [u8; 32] = uninitialized();
|
||||
let mut result: [u8; 32] = Default::default();
|
||||
// guaranteed to write into result.
|
||||
ext_blake2_256(&data[0], data.len() as u32, &mut result[0]);
|
||||
result
|
||||
@@ -78,7 +86,7 @@ pub fn blake2_256(data: &[u8]) -> [u8; 32] {
|
||||
/// Conduct four XX hashes to give a 256-bit result.
|
||||
pub fn twox_256(data: &[u8]) -> [u8; 32] {
|
||||
unsafe {
|
||||
let mut result: [u8; 32] = uninitialized();
|
||||
let mut result: [u8; 32] = Default::default();
|
||||
// guaranteed to write into result.
|
||||
ext_twox_256(&data[0], data.len() as u32, &mut result[0]);
|
||||
result
|
||||
@@ -88,7 +96,7 @@ pub fn twox_256(data: &[u8]) -> [u8; 32] {
|
||||
/// Conduct two XX hashes to give a 256-bit result.
|
||||
pub fn twox_128(data: &[u8]) -> [u8; 16] {
|
||||
unsafe {
|
||||
let mut result: [u8; 16] = uninitialized();
|
||||
let mut result: [u8; 16] = Default::default();
|
||||
// guaranteed to write into result.
|
||||
ext_twox_128(&data[0], data.len() as u32, &mut result[0]);
|
||||
result
|
||||
@@ -132,7 +140,7 @@ macro_rules! impl_stubs {
|
||||
#[no_mangle]
|
||||
pub fn $name(input_data: *mut u8, input_len: usize) -> u64 {
|
||||
let input = unsafe {
|
||||
$crate::Vec::from_raw_parts(input_data, input_len, input_len)
|
||||
$crate::vec::Vec::from_raw_parts(input_data, input_len, input_len)
|
||||
};
|
||||
|
||||
let output = super::$name(input);
|
||||
|
||||
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user