Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Inspector): frame_end called multiple times #2037

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/handler/interface/src/item_or_result.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::Frame;

#[derive(Clone, Debug)]
pub enum ItemOrResult<ITEM, RES> {
Item(ITEM),
Result(RES),
Expand Down
23 changes: 7 additions & 16 deletions crates/inspector/src/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,9 @@ where
.handler
.frame_init_first(context, frame_context, frame_input);

match &mut ret {
Ok(ItemOrResult::Result(res)) => {
context.frame_end(res);
}
Ok(ItemOrResult::Item(frame)) => {
context.initialize_interp(frame.interpreter());
}
_ => (),
// only if new frame is created call initialize_interp hook.
if let Ok(ItemOrResult::Item(frame)) = &mut ret {
context.initialize_interp(frame.interpreter());
}
ret
}
Expand All @@ -297,14 +292,10 @@ where
let mut ret = self
.handler
.frame_init(frame, context, frame_context, frame_input);
match &mut ret {
Ok(ItemOrResult::Result(res)) => {
context.frame_end(res);
}
Ok(ItemOrResult::Item(frame)) => {
context.initialize_interp(frame.interpreter());
}
_ => (),

// only if new frame is created call initialize_interp hook.
if let Ok(ItemOrResult::Item(frame)) = &mut ret {
context.initialize_interp(frame.interpreter());
}
ret
}
Expand Down
2 changes: 1 addition & 1 deletion crates/precompile/src/bn128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ mod tests {
.unwrap();

let res = run_add(&input, BYZANTIUM_ADD_GAS_COST, 499);
println!("{:?}", res);

assert!(matches!(
res,
Err(PrecompileErrors::Error(PrecompileError::OutOfGas))
Expand Down
Loading