Kernel/EVM: refactor ExecutionOutput to avoid maintaining invariants between fields
The following discussion from !10288 (merged) should be addressed:
-
@picdc started a discussion: This is only for a follow up:
I think these three fields (and probably
resulttoo) could be merged into a single type, especially considering they embody the same result: whether or not the operation failed.Right now we have to maintain an invariant that if
is_success == truethen either there is a result or a new address for a contract, and for a deployment or a contract call there is an exit reason.Something in this sense could make it probably simpler:
enum ExecutionResult { TransferSucceeded, ContractDeployed(H160), CallSucceeded(Vec<u8>), CallReverted(Vec<u8>), ExecutionError(EthereumError), FatalError(ExitFatal), }I need to think about this though, I may be missing some bits and I don't consider it blocking for the MR.
To achieve this several steps are needed:
-
Simplify ExecutionOutcome by removing is_success (!13721 (merged)) -
Replace ExecutionOutcome.{is_success, reason, result} with ExecutionResult (!14501 (merged))
Edited by Steve Sanches