diff --git a/packages/fuels-programs/src/assembly/script_and_predicate_loader.rs b/packages/fuels-programs/src/assembly/script_and_predicate_loader.rs index 4408b7857..f27a44313 100644 --- a/packages/fuels-programs/src/assembly/script_and_predicate_loader.rs +++ b/packages/fuels-programs/src/assembly/script_and_predicate_loader.rs @@ -1,26 +1,24 @@ use fuel_asm::{op, Instruction, RegId}; -use fuels_core::{ - constants::WORD_SIZE, - types::{ - errors::Result, - transaction_builders::{Blob, BlobId}, - }, -}; +use fuels_core::{constants::WORD_SIZE, types::errors::Result}; use itertools::Itertools; use crate::assembly::cursor::WasmFriendlyCursor; pub struct LoaderCode { - blob_id: BlobId, + blob_id: [u8; 32], code: Vec, data_offset: usize, } impl LoaderCode { + // std gated because of Blob usage which is in transaction_builders which are currently not + // nostd friendly + #[cfg(feature = "std")] pub fn from_normal_binary(binary: Vec) -> Result { let (original_code, data_section) = split_at_data_offset(&binary)?; - let blob_id = Blob::from(original_code.to_vec()).id(); + let blob_id = + fuels_core::types::transaction_builders::Blob::from(original_code.to_vec()).id(); let (loader_code, data_offset) = Self::generate_loader_code(blob_id, data_section); Ok(Self { @@ -75,9 +73,10 @@ impl LoaderCode { })) } - pub fn extract_blob(binary: &[u8]) -> Result { + #[cfg(feature = "std")] + pub fn extract_blob(binary: &[u8]) -> Result { let (code, _) = split_at_data_offset(binary)?; - Ok(Blob::from(code.to_vec())) + Ok(code.to_vec().into()) } pub fn as_bytes(&self) -> &[u8] { @@ -88,7 +87,7 @@ impl LoaderCode { self.data_offset } - fn generate_loader_code(blob_id: BlobId, data_section: &[u8]) -> (Vec, usize) { + fn generate_loader_code(blob_id: [u8; 32], data_section: &[u8]) -> (Vec, usize) { if !data_section.is_empty() { generate_loader_w_data_section(blob_id, data_section) } else { diff --git a/wasm-tests/src/lib.rs b/wasm-tests/src/lib.rs index 8659d7e86..cc9649445 100644 --- a/wasm-tests/src/lib.rs +++ b/wasm-tests/src/lib.rs @@ -1,7 +1,6 @@ extern crate alloc; -// #[cfg(all(test, target_arch = "wasm32"))] -#[cfg(test)] +#[cfg(all(test, target_arch = "wasm32"))] mod tests { use std::{default::Default, str::FromStr};