rust-ethereum / evm

Pure Rust implementation of Ethereum Virtual Machine
Apache License 2.0
1.17k stars 360 forks source link

Better trap handling #252

Closed sorpaas closed 10 months ago

sorpaas commented 10 months ago

Introduce two different traits TrapConsume and TrapConstruct.

TrapConstruct is self-explanatory -- given a base-type trap, it warps it to the top-level enum.

TrapConsume should be implemented on the top-level enum for all possibilities of trap handling orders, and reduce the type into Rest. For example, if a VM has three different types of traps -- CallCreateTrap, dyn Future<Output = Control<Tr>> for storage access, and Interrupt. Then TrapConsume<CallCreateTrap> should return an enum containing two other variants dyn Future<Output = Control<Tr>> and Interrupt, and so forth.