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 0000000000..050ccce0bb Binary files /dev/null and b/unittests/contracts/jumborow/jumborow.wasm differ diff --git a/unittests/contracts/jumborow/jumborow.wast b/unittests/contracts/jumborow/jumborow.wast new file mode 100644 index 0000000000..d9f0838e58 --- /dev/null +++ b/unittests/contracts/jumborow/jumborow.wast @@ -0,0 +1,8 @@ +(module + (import "env" "db_store_i64" (func $db_store_i64 (param i64 i64 i64 i64 i32 i32) (result i32))) + (memory $0 528) + (export "apply" (func $apply)) + (func $apply (param $receiver i64) (param $account i64) (param $action_name i64) + (drop (call $db_store_i64 (local.get $receiver) (local.get $receiver) (local.get $receiver) (i64.const 0) (i32.const 1) (i32.const 34603007))) + ) +) diff --git a/unittests/contracts/test_wasts.hpp b/unittests/contracts/test_wasts.hpp index 1eab70405e..94f5a9f249 100644 --- a/unittests/contracts/test_wasts.hpp +++ b/unittests/contracts/test_wasts.hpp @@ -990,4 +990,15 @@ static const char negative_memory_grow_trap_wast[] = R"=====( ) ) ) +)====="; + +static const char set_jumbo_row_wast[] = R"=====( +(module + (import "env" "db_store_i64" (func $db_store_i64 (param i64 i64 i64 i64 i32 i32) (result i32))) + (memory $0 528) + (export "apply" (func $apply)) + (func $apply (param $receiver i64) (param $account i64) (param $action_name i64) + (drop (call $db_store_i64 (get_local $receiver) (get_local $receiver) (get_local $receiver) (i64.const 0) (i32.const 1) (i32.const 34603007))) + ) +) )====="; \ No newline at end of file diff --git a/unittests/snapshot_tests.cpp b/unittests/snapshot_tests.cpp index 5e25220161..710db93312 100644 --- a/unittests/snapshot_tests.cpp +++ b/unittests/snapshot_tests.cpp @@ -11,6 +11,7 @@ #include #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()