Skip to content

Commit

Permalink
GH-985 Remove unneeded chain::wasm_interface::test_disable_tierup.
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Nov 12, 2024
1 parent c05bc48 commit 76e2cc7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
2 changes: 0 additions & 2 deletions libraries/chain/include/eosio/chain/wasm_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ class apply_context;
oc_none
};

inline static bool test_disable_tierup = false; // set by unittests to test tierup failing

wasm_interface(vm_type vm, vm_oc_enable eosvmoc_tierup, const chainbase::database& d, platform_timer& main_thread_timer, const std::filesystem::path data_dir, const eosvmoc::config& eosvmoc_config, bool profile);
~wasm_interface();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ struct eosvmoc_tier {
});
context.trx_context.pause_billing_timer();
cd = eosvmoc->cc.get_descriptor_for_code(m, exec_action_id, code_hash, vm_version, failure);
if (wasm_interface::test_disable_tierup)
cd = nullptr;
} catch (...) {
// swallow errors here, if EOS VM OC has gone in to the weeds we shouldn't bail: continue to try and run baseline
// In the future, consider moving bits of EOS VM that can fire exceptions and such out of this call path
Expand Down
11 changes: 3 additions & 8 deletions tests/test_read_only_trx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,8 @@ BOOST_AUTO_TEST_CASE(not_check_configs_if_no_read_only_threads) {
test_configs_common(specific_args, app_init_status::succeeded);
}

void test_trxs_common(std::vector<const char*>& specific_args, bool test_disable_tierup = false) {
void test_trxs_common(std::vector<const char*>& specific_args) {
try {
fc::scoped_exit<std::function<void()>> on_exit = []() {
chain::wasm_interface::test_disable_tierup = false;
};
chain::wasm_interface::test_disable_tierup = test_disable_tierup;

using namespace std::chrono_literals;
fc::temp_directory temp;
appbase::scoped_app app;
Expand Down Expand Up @@ -206,7 +201,7 @@ BOOST_AUTO_TEST_CASE(with_3_read_only_threads_no_tierup) {
"--eos-vm-oc-enable=none",
#endif
};
test_trxs_common(specific_args, true);
test_trxs_common(specific_args);
}

// test read-only trxs on 8 separate threads (with --read-only-threads)
Expand All @@ -222,7 +217,7 @@ BOOST_AUTO_TEST_CASE(with_8_read_only_threads_no_tierup) {
"--eos-vm-oc-enable=none",
#endif
};
test_trxs_common(specific_args, true);
test_trxs_common(specific_args);
}

BOOST_AUTO_TEST_SUITE_END()
8 changes: 4 additions & 4 deletions unittests/eosvmoc_interrupt_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ BOOST_AUTO_TEST_CASE( wasm_interrupt_test ) { try {
auto pre_id = t.control->get_wasm_interface().get_executing_action_id();

// Use an infinite executing action. When oc compile completes it will kill the action and restart it under
// eosvmoc. That action will then fail when it hits the 30000ms deadline.
// 30000ms has to be long enough for oc compile to complete and kill the non-oc executing transaction
// eosvmoc. That action will then fail when it hits the 3000ms deadline.
// 3000ms has to be long enough for oc compile to complete and kill the non-oc executing transaction
BOOST_CHECK_THROW( push_trx( t, test_api_action<WASM_TEST_ACTION("test_checktime", "checktime_failure")>{},
0, 150, 30000, true, fc::raw::pack(10000000000000000000ULL) ),
0, 150, 3000, true, fc::raw::pack(10000000000000000000ULL) ),
deadline_exception );

auto post_id = t.control->get_wasm_interface().get_executing_action_id();

// each action uses 1 id, 2 if retried because of oc compile completion interruption
// if post_id == pre_id + 1, then likely that 30000ms above was not long enough for oc compile to complete
// if post_id == pre_id + 1, then likely that 3000ms above was not long enough for oc compile to complete
BOOST_TEST(post_id == pre_id + 2);

BOOST_REQUIRE_EQUAL( t.validate(), true );
Expand Down

0 comments on commit 76e2cc7

Please sign in to comment.