From 82e60d68ad2258416a9e8554580771efacb1a794 Mon Sep 17 00:00:00 2001 From: Virgil <25692529+virgil-serbanuta@users.noreply.github.com> Date: Thu, 7 Nov 2024 11:51:12 +0200 Subject: [PATCH] Revert when endpoint not found (#182) --- tests/ulm-with-contract/endpoints.notfound.run | 17 +++++++++++++++++ ulm-semantics/main/preprocessing/endpoints.md | 5 ++--- 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 tests/ulm-with-contract/endpoints.notfound.run diff --git a/tests/ulm-with-contract/endpoints.notfound.run b/tests/ulm-with-contract/endpoints.notfound.run new file mode 100644 index 0000000..d7911d3 --- /dev/null +++ b/tests/ulm-with-contract/endpoints.notfound.run @@ -0,0 +1,17 @@ +push "noEndpoint"; +hold_string_from_test_stack; +push "uint64"; +hold_list_values_from_test_stack; +push 123_u64; +hold_list_values_from_test_stack; +encode_call_data; + +return_value; +mock CallData; + +call_contract 12345; +return_value; +check_eq (); + +push_status; +check_eq 3 diff --git a/ulm-semantics/main/preprocessing/endpoints.md b/ulm-semantics/main/preprocessing/endpoints.md index 23f53b5..d4b46a0 100644 --- a/ulm-semantics/main/preprocessing/endpoints.md +++ b/ulm-semantics/main/preprocessing/endpoints.md @@ -178,7 +178,7 @@ module ULM-PREPROCESSING-ENDPOINTS | "ulm" [token] | "ulmWrap##init" [token] | "CallData" [token] - | "EVMC_BAD_JUMP_DESTINATION" [token] + | "EVMC_REVERT" [token] | "EVMC_SUCCESS" [token] syntax BytesOrError ::= methodSignature(String, NormalizedFunctionParameterList) [function, total] @@ -222,8 +222,7 @@ module ULM-PREPROCESSING-ENDPOINTS , bufferId: _:Identifier , gas: _:Identifier ) - // TODO: Is this the right kind of error? - => :: state_hooks :: setStatus(:: ulm :: EVMC_BAD_JUMP_DESTINATION , .CallParamsList); + => :: state_hooks :: setStatus(:: ulm :: EVMC_REVERT , .CallParamsList); rule signatureToCall (... signature: Signature:Identifier