Skip to content

Commit

Permalink
Merge pull request ethereum#72 from OffchainLabs/render-errors
Browse files Browse the repository at this point in the history
Add custom error handling hook for precompiles
  • Loading branch information
rachel-bousfield authored Mar 23, 2022
2 parents f5d63f1 + f37d69c commit dbd2a7f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ func IntrinsicGas(data []byte, accessList types.AccessList, isContractCreation b
var ReadyEVMForL2 func(evm *vm.EVM, msg Message)
var InterceptRPCMessage func(msg types.Message, statedb *state.StateDB) (types.Message, error)
var InterceptRPCGasCap func(gascap *uint64, msg types.Message, header *types.Header, statedb *state.StateDB)
var RenderRPCError func(data []byte) error

// NewStateTransition initialises and returns a new state transition object.
func NewStateTransition(evm *vm.EVM, msg Message, gp *GasPool) *StateTransition {
Expand Down
5 changes: 5 additions & 0 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,11 @@ func newRevertError(result *core.ExecutionResult) *revertError {
if errUnpack == nil {
err = fmt.Errorf("execution reverted: %v", reason)
}
if core.RenderRPCError != nil {
if arbErr := core.RenderRPCError(result.Revert()); arbErr != nil {
err = arbErr
}
}
return &revertError{
error: err,
reason: hexutil.Encode(result.Revert()),
Expand Down

0 comments on commit dbd2a7f

Please sign in to comment.