From 399f310ed1d45adbc6f90d19be798b5685f47a44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20Ram=C3=ADrez?= Date: Thu, 18 May 2023 16:51:21 +0200 Subject: [PATCH] fix executor error handling --- state/runtime/executor/errors.go | 4 +++- state/runtime/runtime.go | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/state/runtime/executor/errors.go b/state/runtime/executor/errors.go index 49c4fdbf64..0ed116c5c7 100644 --- a/state/runtime/executor/errors.go +++ b/state/runtime/executor/errors.go @@ -121,7 +121,7 @@ func RomErr(errorCode pb.RomError) error { case ROM_ERROR_EXECUTION_REVERTED: return runtime.ErrExecutionReverted case ROM_ERROR_OUT_OF_COUNTERS_STEP: - return runtime.ErrOutOfCountersKeccak + return runtime.ErrOutOfCountersStep case ROM_ERROR_OUT_OF_COUNTERS_KECCAK: return runtime.ErrOutOfCountersKeccak case ROM_ERROR_OUT_OF_COUNTERS_BINARY: @@ -183,6 +183,8 @@ func RomErrorCode(err error) pb.RomError { return pb.RomError(ROM_ERROR_CONTRACT_ADDRESS_COLLISION) case runtime.ErrExecutionReverted: return pb.RomError(ROM_ERROR_EXECUTION_REVERTED) + case runtime.ErrOutOfCountersStep: + return pb.RomError(ROM_ERROR_OUT_OF_COUNTERS_STEP) case runtime.ErrOutOfCountersKeccak: return pb.RomError(ROM_ERROR_OUT_OF_COUNTERS_KECCAK) case runtime.ErrOutOfCountersBinary: diff --git a/state/runtime/runtime.go b/state/runtime/runtime.go index 901a76099a..d7363b0917 100644 --- a/state/runtime/runtime.go +++ b/state/runtime/runtime.go @@ -21,6 +21,8 @@ var ( ErrContractAddressCollision = errors.New("contract address collision") // ErrExecutionReverted indicates the execution has been reverted ErrExecutionReverted = errors.New("execution reverted") + // ErrOutOfCountersStep indicates there are not enough step counters to continue the execution + ErrOutOfCountersStep = errors.New("not enough step counters to continue the execution") // ErrOutOfCountersKeccak indicates there are not enough keccak counters to continue the execution ErrOutOfCountersKeccak = errors.New("not enough keccak counters to continue the execution") // ErrOutOfCountersBinary indicates there are not enough binary counters to continue the execution