Skip to content

Commit 3b9e87c

Browse files
authoredNov 23, 2023
Don't use InvokerControl for precompile (#234)
1 parent 1fa8518 commit 3b9e87c

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed
 

‎precompiles/src/lib.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ pub use crate::simple::{ECRecover, Identity, Ripemd160, Sha256};
2727

2828
use alloc::vec::Vec;
2929
use evm::standard::{CodeResolver, Config, Precompile, ResolvedCode};
30-
use evm::{
31-
ExitError, ExitException, ExitResult, GasedMachine, InvokerControl, RuntimeBackend,
32-
RuntimeState, StaticGasometer,
33-
};
30+
use evm::{ExitError, ExitException, ExitResult, RuntimeBackend, RuntimeState, StaticGasometer};
3431

3532
use primitive_types::H160;
3633

@@ -62,7 +59,7 @@ impl<S: AsRef<RuntimeState>, G: StaticGasometer, H> Precompile<S, G, H> for Stan
6259
state: S,
6360
mut gasometer: G,
6461
_handler: &mut H,
65-
) -> InvokerControl<GasedMachine<S, G>, (ExitResult, (S, G, Vec<u8>))> {
62+
) -> (ExitResult, (S, G, Vec<u8>)) {
6663
let (exit, retval) = match self {
6764
Self::ECRecover => ECRecover.execute(input, state.as_ref(), &mut gasometer),
6865
Self::Sha256 => Sha256.execute(input, state.as_ref(), &mut gasometer),
@@ -75,7 +72,7 @@ impl<S: AsRef<RuntimeState>, G: StaticGasometer, H> Precompile<S, G, H> for Stan
7572
Self::Blake2F => Blake2F.execute(input, state.as_ref(), &mut gasometer),
7673
};
7774

78-
InvokerControl::DirectExit((exit, (state, gasometer, retval)))
75+
(exit, (state, gasometer, retval))
7976
}
8077
}
8178

‎src/standard/invoker/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub trait Precompile<S, G, H> {
112112
state: S,
113113
gasometer: G,
114114
handler: &mut H,
115-
) -> InvokerControl<GasedMachine<S, G>, (ExitResult, (S, G, Vec<u8>))>;
115+
) -> (ExitResult, (S, G, Vec<u8>));
116116
}
117117

118118
impl<S, G, H> Precompile<S, G, H> for Infallible {
@@ -122,7 +122,7 @@ impl<S, G, H> Precompile<S, G, H> for Infallible {
122122
_state: S,
123123
_gasometer: G,
124124
_handler: &mut H,
125-
) -> InvokerControl<GasedMachine<S, G>, (ExitResult, (S, G, Vec<u8>))> {
125+
) -> (ExitResult, (S, G, Vec<u8>)) {
126126
match *self {}
127127
}
128128
}

‎src/standard/invoker/routines.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ where
5656
is_static,
5757
}))
5858
}
59-
ResolvedCode::Precompile(precompile) => {
60-
Ok(precompile.execute(&input, state, gasometer, handler))
61-
}
59+
ResolvedCode::Precompile(precompile) => Ok(InvokerControl::DirectExit(
60+
precompile.execute(&input, state, gasometer, handler),
61+
)),
6262
}
6363
}
6464

0 commit comments

Comments
 (0)
Please sign in to comment.