From 161cb28dc039879d0336605b4992392aae5a61da Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Tue, 5 Dec 2023 10:18:53 -0500 Subject: [PATCH] tests for ship & snapshots with jumbo rows --- tests/ship_streamer_test.py | 16 +++++++++ unittests/contracts/CMakeLists.txt | 1 + unittests/contracts/jumborow/CMakeLists.txt | 2 ++ unittests/contracts/jumborow/jumborow.abi | 23 +++++++++++++ unittests/contracts/jumborow/jumborow.wasm | Bin 0 -> 94 bytes unittests/contracts/jumborow/jumborow.wast | 8 +++++ unittests/contracts/test_wasts.hpp | 11 +++++++ unittests/snapshot_tests.cpp | 34 ++++++++++++++++++++ 8 files changed, 95 insertions(+) create mode 100644 unittests/contracts/jumborow/CMakeLists.txt create mode 100644 unittests/contracts/jumborow/jumborow.abi create mode 100644 unittests/contracts/jumborow/jumborow.wasm create mode 100644 unittests/contracts/jumborow/jumborow.wast diff --git a/tests/ship_streamer_test.py b/tests/ship_streamer_test.py index 710ab90db4..7b38f501ec 100755 --- a/tests/ship_streamer_test.py +++ b/tests/ship_streamer_test.py @@ -155,6 +155,22 @@ def getLatestSnapshot(nodeId): Print("Shutdown unneeded bios node") cluster.biosNode.kill(signal.SIGTERM) + Print("Create a jumbo row") + contract = "jumborow" + contractDir = "unittests/contracts/%s" % (contract) + wasmFile = "%s.wasm" % (contract) + abiFile = "%s.abi" % (contract) + + nonProdNode.publishContract(accounts[0], contractDir, wasmFile, abiFile) + jumbotxn = { + + "actions": [{"account": "testeraaaaaa","name": "jumbotime", + "authorization": [{"actor": "testeraaaaaa","permission": "active"}], + "data": "", + "compression": "none"}] + } + nonProdNode.pushTransaction(jumbotxn) + Print("Configure and launch txn generators") targetTpsPerGenerator = 10 testTrxGenDurationSec=60*60 diff --git a/unittests/contracts/CMakeLists.txt b/unittests/contracts/CMakeLists.txt index 289450ccf1..ae0c483d71 100644 --- a/unittests/contracts/CMakeLists.txt +++ b/unittests/contracts/CMakeLists.txt @@ -26,3 +26,4 @@ add_subdirectory(eosio.system) add_subdirectory(eosio.token) add_subdirectory(eosio.wrap) add_subdirectory(eosio.mechanics) +add_subdirectory(jumborow) \ No newline at end of file diff --git a/unittests/contracts/jumborow/CMakeLists.txt b/unittests/contracts/jumborow/CMakeLists.txt new file mode 100644 index 0000000000..f0a14a49ea --- /dev/null +++ b/unittests/contracts/jumborow/CMakeLists.txt @@ -0,0 +1,2 @@ +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/jumborow.wasm ${CMAKE_CURRENT_BINARY_DIR}/jumborow.wasm COPYONLY ) +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/jumborow.abi ${CMAKE_CURRENT_BINARY_DIR}/jumborow.abi COPYONLY ) diff --git a/unittests/contracts/jumborow/jumborow.abi b/unittests/contracts/jumborow/jumborow.abi new file mode 100644 index 0000000000..c8f7eaac7c --- /dev/null +++ b/unittests/contracts/jumborow/jumborow.abi @@ -0,0 +1,23 @@ +{ + "version": "eosio::abi/1.0", + "types": [], + "structs": [{ + "name": "jumbo", + "base": "", + "fields": [] + } + ], + "actions": [{ + "name": "jumbotime", + "type": "jumbo", + "ricardian_contract": "" + } + ], + "tables": [], + "ricardian_clauses": [], + "error_messages": [], + "abi_extensions": [], + "variants": [], + "action_results": [] +} + diff --git a/unittests/contracts/jumborow/jumborow.wasm b/unittests/contracts/jumborow/jumborow.wasm new file mode 100644 index 0000000000000000000000000000000000000000..050ccce0bbc2a01dcc04fac0a518404ee564df1e GIT binary patch literal 94 zcmZQbEY4+QU|?VrWJ+MG1A_W`#`*+iAcKKPgpoNluZ$-pDZaQQzbG|6)69f{ftiVs rk(Gs!VFC*~CnIZOK|xL>10$ChqX>fn7& #include +#include "test_wasts.hpp" using namespace eosio; using namespace testing; @@ -653,4 +654,37 @@ BOOST_AUTO_TEST_CASE(json_snapshot_validity_test) remove(json_snap_path); } +BOOST_AUTO_TEST_CASE_TEMPLATE(jumbo_row, SNAPSHOT_SUITE, snapshot_suites) +{ + fc::temp_directory tempdir; + auto config = tester::default_config(tempdir); + config.first.state_size = 64*1024*1024; + tester chain(config.first, config.second); + chain.execute_setup_policy(setup_policy::full); + + chain.create_accounts({"jumbo"_n}); + chain.set_code("jumbo"_n, set_jumbo_row_wast); + chain.produce_blocks(1); + + signed_transaction trx; + action act; + act.account = "jumbo"_n; + act.name = "jumbo"_n; + act.authorization = vector{{"jumbo"_n,config::active_name}}; + trx.actions.push_back(act); + + chain.set_transaction_headers(trx); + trx.sign(tester::get_private_key("jumbo"_n, "active"), chain.control->get_chain_id()); + chain.push_transaction(trx); + chain.produce_blocks(1); + + chain.control->abort_block(); + + auto writer = SNAPSHOT_SUITE::get_writer(); + chain.control->write_snapshot(writer); + auto snapshot = SNAPSHOT_SUITE::finalize(writer); + + snapshotted_tester sst(chain.get_config(), SNAPSHOT_SUITE::get_reader(snapshot), 0); +} + BOOST_AUTO_TEST_SUITE_END()