Skip to content

Commit

Permalink
Convert assert in create into a warning
Browse files Browse the repository at this point in the history
Turn the assert statement in create into a warning, this restores the
ability to import tokens through Metamask.

Details: When importing tokens, Metamask sends a create call without
sender information, triggering an assert failure.

Signed-off-by: Michael Maurer <[email protected]>
  • Loading branch information
maurermi authored and HalosGhost committed Aug 22, 2024
1 parent f6e5401 commit cf9060e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/parsec/agent/runners/evm/host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,15 @@ namespace cbdc::parsec::agent::runner {

auto evm_host::create(const evmc_message& msg) noexcept -> evmc::Result {
auto maybe_sender_acc = get_account(msg.sender, false);
assert(maybe_sender_acc.has_value());
if(!maybe_sender_acc.has_value()) {
m_log->warn("EVM CREATE: sender account not found");
return evmc::Result(
evmc::make_result(evmc_status_code::EVMC_REVERT,
0,
0,
nullptr,
0));
}
auto& sender_acc = maybe_sender_acc.value();

auto new_addr = evmc::address();
Expand Down

0 comments on commit cf9060e

Please sign in to comment.