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

Fallible Handler #128

Open
MOZGIII opened this issue Jun 27, 2022 · 0 comments
Open

Fallible Handler #128

MOZGIII opened this issue Jun 27, 2022 · 0 comments

Comments

@MOZGIII
Copy link
Contributor

MOZGIII commented Jun 27, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant