Skip to content

Commit

Permalink
Remove action redefinition, fix tests, adjust stack size
Browse files Browse the repository at this point in the history
  • Loading branch information
elmato committed Aug 21, 2023
1 parent c80295f commit 02dfdc7
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 42 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,5 @@ target_compile_options(evm_runtime PUBLIC --no-missing-ricardian-clause)
if (WITH_LARGE_STACK)
target_link_options(evm_runtime PUBLIC --stack-size=50000000)
else()
target_link_options(evm_runtime PUBLIC --stack-size=32768)
target_link_options(evm_runtime PUBLIC --stack-size=38432)
endif()
37 changes: 1 addition & 36 deletions src/actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,42 +629,6 @@ bool evm_contract::gc(uint32_t max) {
return state.gc(max);
}

void evm_contract::bridgereg(eosio::name receiver, const eosio::asset& min_fee) {
assert_unfrozen();
require_auth(receiver);
require_auth(get_self()); // to temporarily prevent registration of unauthorized accounts

eosio::check(min_fee.symbol == token_symbol, "unexpected symbol");
eosio::check(min_fee.amount >= 0, "min_fee cannot be negative");

auto update_row = [&](auto& row) {
row.account = receiver;
row.min_fee = min_fee;
row.flags = message_receiver::flag::FORCE_ATOMIC;
};

message_receiver_table message_receivers(get_self(), get_self().value);
auto it = message_receivers.find(receiver.value);

if(it == message_receivers.end()) {
message_receivers.emplace(receiver, update_row);
} else {
message_receivers.modify(*it, eosio::same_payer, update_row);
}

open(receiver);
}

void evm_contract::bridgeunreg(eosio::name receiver) {
assert_unfrozen();
require_auth(receiver);

message_receiver_table message_receivers(get_self(), get_self().value);
auto it = message_receivers.find(receiver.value);
eosio::check(it != message_receivers.end(), "receiver not found");
message_receivers.erase(*it);
}

void evm_contract::call_(intx::uint256 s, const bytes& to, intx::uint256 value, const bytes& data, uint64_t gas_limit, uint64_t nonce) {
const auto& current_config = _config.get();

Expand Down Expand Up @@ -746,6 +710,7 @@ void evm_contract::bridgereg(eosio::name receiver, const eosio::asset& min_fee)
auto update_row = [&](auto& row) {
row.account = receiver;
row.min_fee = min_fee;
row.flags = message_receiver::FORCE_ATOMIC;
};

message_receiver_table message_receivers(get_self(), get_self().value);
Expand Down
5 changes: 0 additions & 5 deletions tests/basic_evm_tester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,6 @@ transaction_trace_ptr basic_evm_tester::bridgeunreg(name receiver) {
mvo()("receiver", receiver));
}

transaction_trace_ptr basic_evm_tester::exec(const exec_input& input, const std::optional<exec_callback>& callback) {
auto binary_data = fc::raw::pack<exec_input, std::optional<exec_callback>>(input, callback);
return basic_evm_tester::push_action(evm_account_name, "exec"_n, evm_account_name, bytes{binary_data.begin(), binary_data.end()});
}

transaction_trace_ptr basic_evm_tester::pushtx(const silkworm::Transaction& trx, name miner)
{
silkworm::Bytes rlp;
Expand Down

0 comments on commit 02dfdc7

Please sign in to comment.