Skip to content

Commit

Permalink
Add eosevm::abort function
Browse files Browse the repository at this point in the history
  • Loading branch information
elmato committed Jan 18, 2024
1 parent c9d247b commit 8b8e25e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
18 changes: 18 additions & 0 deletions eosevm/assert.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once
#ifdef ANTELOPE
#include <eosio/eosio.hpp>
#else
#include <silkworm/silkworm/core/common/assert.hpp>
#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
}

}
10 changes: 2 additions & 8 deletions eosevm/version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

#include <silkworm/core/types/block.hpp>
#include <silkworm/core/common/endian.hpp>
#ifdef ANTELOPE
#include <eosio/eosio.hpp>
#endif
#include <eosevm/assert.hpp>
namespace eosevm {

static constexpr uint64_t max_eos_evm_version = 1;
Expand All @@ -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<evmc_revision>(0);
}

Expand Down

0 comments on commit 8b8e25e

Please sign in to comment.