Skip to content

Commit

Permalink
Merge pull request #18 from ElrondNetwork/memory-limit-breakpoint
Browse files Browse the repository at this point in the history
Add BREAKPOINT_VALUE_MEMORY_LIMIT
  • Loading branch information
camilbancioiu authored Mar 1, 2022
2 parents c3bc0d1 + 46daf7d commit 090754a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
9 changes: 6 additions & 3 deletions lib/middleware-common/src/opcode_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ use wasmer_runtime_core::{
module::ModuleInfo,
};

use crate::runtime_breakpoints::{push_runtime_breakpoint, BREAKPOINT_VALUE_EXECUTION_FAILED};
use crate::runtime_breakpoints::{
push_runtime_breakpoint,
BREAKPOINT_VALUE_MEMORY_LIMIT,
};

static FIELD_MEMORY_GROW_COUNT: InternalField = InternalField::allocate();

Expand Down Expand Up @@ -35,7 +38,7 @@ impl OpcodeControl {
sink.push(Event::WasmOwned(Operator::If {
ty: WpTypeOrFuncType::Type(WpType::EmptyBlockType),
}));
push_runtime_breakpoint(sink, BREAKPOINT_VALUE_EXECUTION_FAILED);
push_runtime_breakpoint(sink, BREAKPOINT_VALUE_MEMORY_LIMIT);
sink.push(Event::WasmOwned(Operator::End));
}

Expand Down Expand Up @@ -63,7 +66,7 @@ impl OpcodeControl {
sink.push(Event::WasmOwned(Operator::If {
ty: WpTypeOrFuncType::Type(WpType::EmptyBlockType),
}));
push_runtime_breakpoint(sink, BREAKPOINT_VALUE_EXECUTION_FAILED);
push_runtime_breakpoint(sink, BREAKPOINT_VALUE_MEMORY_LIMIT);
sink.push(Event::WasmOwned(Operator::End));
}
}
Expand Down
5 changes: 1 addition & 4 deletions lib/middleware-common/src/runtime_breakpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ pub static FIELD_RUNTIME_BREAKPOINT_VALUE: InternalField = InternalField::alloca
pub const BREAKPOINT_VALUE_NO_BREAKPOINT: u64 = 0;
pub const BREAKPOINT_VALUE_EXECUTION_FAILED: u64 = 1;
pub const BREAKPOINT_VALUE_OUT_OF_GAS: u64 = 4;


#[derive(Copy, Clone, Debug)]
pub struct RuntimeBreakpointReachedError;
pub const BREAKPOINT_VALUE_MEMORY_LIMIT: u64 = 5;


pub struct RuntimeBreakpointHandler {}
Expand Down

0 comments on commit 090754a

Please sign in to comment.