diff --git a/contract/include/evm_runtime/state.hpp b/contract/include/evm_runtime/state.hpp index 0cb4a53b..ddc3383d 100644 --- a/contract/include/evm_runtime/state.hpp +++ b/contract/include/evm_runtime/state.hpp @@ -27,12 +27,13 @@ struct state : State { name _self; name _ram_payer; bool _read_only; + bool _allow_frozen; mutable std::map addr2id; mutable std::map addr2code; mutable db_stats stats; std::optional _config2; - explicit state(name self, name ram_payer, bool read_only=false) : _self(self), _ram_payer(ram_payer), _read_only{read_only}{} + explicit state(name self, name ram_payer, bool read_only=false, bool allow_frozen=true) : _self(self), _ram_payer(ram_payer), _read_only{read_only}, _allow_frozen{allow_frozen}{} virtual ~state() override; uint64_t get_next_account_id(); diff --git a/contract/src/actions.cpp b/contract/src/actions.cpp index d8428563..0d5a4541 100644 --- a/contract/src/actions.cpp +++ b/contract/src/actions.cpp @@ -341,7 +341,7 @@ void evm_contract::exec(const exec_input& input, const std::optionalsecond}; - evm_runtime::state state{get_self(), get_self()}; + evm_runtime::state state{get_self(), get_self(), false, false}; silkworm::ExecutionProcessor ep{block, engine, state, *found_chain_config->second}; Transaction tx; diff --git a/contract/src/state.cpp b/contract/src/state.cpp index 27ec48a8..fab0e0ca 100644 --- a/contract/src/state.cpp +++ b/contract/src/state.cpp @@ -16,7 +16,7 @@ std::optional state::read_account(const evmc::address& address) const n if (itr == inx.end()) { return {}; } - eosio::check(!itr->has_flag(account::flag::frozen), "account is frozen"); + eosio::check(_allow_frozen || !itr->has_flag(account::flag::frozen), "account is frozen"); addr2id[address] = itr->id; diff --git a/contract/tests/admin_actions_tests.cpp b/contract/tests/admin_actions_tests.cpp index 67df5c76..95331719 100644 --- a/contract/tests/admin_actions_tests.cpp +++ b/contract/tests/admin_actions_tests.cpp @@ -267,8 +267,8 @@ BOOST_FIXTURE_TEST_CASE(freezeaccnt_tests, admin_action_tester) try { auto [contract_addr, contract_account_id] = deploy_simple_contract(evm1); freezeaccnt(contract_account_id, true); - BOOST_REQUIRE_EXCEPTION(getval(contract_addr), - eosio_assert_message_exception, eosio_assert_message_is("account is frozen")); + // We allow evm::exec action to work with frozen accounts + BOOST_REQUIRE(getval(contract_addr) == 0); BOOST_REQUIRE_EXCEPTION(transfer_token("alice"_n, evm_account_name, make_asset(to_bridge), fc::variant(contract_addr).as_string()), eosio_assert_message_exception, eosio_assert_message_is("account is frozen"));