evm
evm copied to clipboard
Fallible `Handler`
A follow-up from https://github.com/paritytech/frontier/issues/724#issuecomment-1152808742.
This issue is to discuss the details of making the Handler
(https://github.com/rust-blockchain/evm/blob/master/runtime/src/handler.rs) calls fallible.
Non-trivial cases
Most of them are pretty trivial, however, there are some return Capture
, which seems to wrapping the error internally already. Do we make it Result<Capture<...>, ExitFatal>
too?
Error type
The original proposal was to use the ExitFatal
, but what if we do this instead:
pub trait Handler {
...
/// The runtime error.
type RuntimeError: From<ExitFatal> + Into<ExitFatal>;
...
/// Get balance of address.
fn balance(&self, address: H160) -> Result<U256, Self::RuntimeError>;
...
The idea is to have a user-provided type that has to be able to hold the ExitFatal
(we don't require that specifically, just that we can go from and to ExitFatal
). This might give some freedom to the implementors to introduce the errors that are internal within their implementation. Not sure if this is a good idea or not, or if it is a good implementation of the idea or not, but any feedback is welcome.
CC @dmitrylavrenov, @intendednull, @Henry-bee