Skip to content

Fallible Handler #128

@MOZGIII

Description

@MOZGIII

A follow-up from polkadot-evm/frontier#724 (comment).

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions