Skip to content

Commit bf536c7

Browse files
committed
fix(runtime): resolve BoundedVec memory provider type mismatch in no_std execute function
- Change hardcoded 1024 to RUNTIME_MEMORY_SIZE (4096) in no_std execute function - Ensures consistency with Vec type alias definition: BoundedVec<T, 256, NoStdProvider<4096>> - Resolves compilation error: expected NoStdProvider<4096>, found NoStdProvider<1024> - Both std and no_std execute functions now use consistent memory provider sizing - Add missing RUNTIME_MEMORY_SIZE import for no_std code path
1 parent 29eacb6 commit bf536c7

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

wrt-runtime/src/stackless/engine.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,15 @@ impl StacklessEngine {
215215
#[cfg(any(feature = "std", feature = "alloc"))]
216216
{
217217
Ok(Self {
218-
instances: HashMap::new(),
219-
next_instance_id: AtomicU64::new(1),
218+
instances: HashMap::new(),
219+
next_instance_id: AtomicU64::new(1),
220220
current_instance_id: None,
221-
operand_stack: Vec::new(),
222-
call_frames_count: 0,
223-
stats: ExecutionStats::default(),
221+
operand_stack: Vec::new(),
222+
call_frames_count: 0,
223+
stats: ExecutionStats::default(),
224224
})
225225
}
226-
226+
227227
#[cfg(not(any(feature = "std", feature = "alloc")))]
228228
{
229229
Ok(Self {
@@ -318,11 +318,12 @@ impl StacklessEngine {
318318

319319
#[cfg(not(any(feature = "std", feature = "alloc")))]
320320
let mut results = {
321-
use crate::bounded_runtime_infra::RUNTIME_MEMORY_SIZE;
322321
use wrt_foundation::{
323322
budget_aware_provider::CrateId,
324323
safe_managed_alloc,
325324
};
325+
326+
use crate::bounded_runtime_infra::RUNTIME_MEMORY_SIZE;
326327
let provider = safe_managed_alloc!(RUNTIME_MEMORY_SIZE, CrateId::Runtime)?;
327328
BoundedVec::new(provider)?
328329
};
@@ -375,11 +376,12 @@ impl StacklessEngine {
375376

376377
// Return appropriate default values based on function signature
377378
let mut results = {
379+
use crate::bounded_runtime_infra::RUNTIME_MEMORY_SIZE;
378380
use wrt_foundation::{
379381
budget_aware_provider::CrateId,
380382
safe_managed_alloc,
381383
};
382-
let provider = safe_managed_alloc!(1024, CrateId::Runtime)?;
384+
let provider = safe_managed_alloc!(RUNTIME_MEMORY_SIZE, CrateId::Runtime)?;
383385
BoundedVec::new(provider)
384386
.map_err(|_| wrt_error::Error::runtime_error("Failed to create results vector"))?
385387
};

0 commit comments

Comments
 (0)