diff --git a/eosevm/assert.hpp b/eosevm/assert.hpp new file mode 100644 index 00000000..e6b3cd0a --- /dev/null +++ b/eosevm/assert.hpp @@ -0,0 +1,18 @@ +#pragma once +#ifdef ANTELOPE +#include +#else +#include +#endif + +namespace eosevm { + +static void abort(const char* msg) { + #ifdef ANTELOPE + eosio::check(false, msg); + #else + silkworm::abort_due_to_assertion_failure(msg, __FILE__, __LINE__); + #endif +} + +} diff --git a/eosevm/version.hpp b/eosevm/version.hpp index 99dc6e71..1207668d 100644 --- a/eosevm/version.hpp +++ b/eosevm/version.hpp @@ -2,9 +2,7 @@ #include #include -#ifdef ANTELOPE -#include -#endif +#include namespace eosevm { static constexpr uint64_t max_eos_evm_version = 1; @@ -28,11 +26,7 @@ inline evmc_revision version_to_evmc_revision(uint64_t version) { case 1: return EVMC_ISTANBUL; } auto msg = "Unknown EOSEVM version: " + std::to_string(version); - #ifdef ANTELOPE - eosio::check(false, msg.c_str()); - #else - silkworm::abort_due_to_assertion_failure(msg.c_str(), __FILE__, __LINE__); - #endif + eosevm::abort(msg.c_str()); return static_cast(0); }