Skip to content

Commit

Permalink
fix executor error handling (0xPolygonHermez#2109)
Browse files Browse the repository at this point in the history
  • Loading branch information
ToniRamirezM authored May 18, 2023
1 parent 1d29c35 commit 7f7e467
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion state/runtime/executor/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions state/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7f7e467

Please sign in to comment.