Skip to content

Commit

Permalink
Added send_action_4k action.
Browse files Browse the repository at this point in the history
  • Loading branch information
brianjohnson5972 committed Jul 8, 2020
1 parent d7570f7 commit 1c8ffc3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion unittests/test-contracts/test_api/test_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ extern "C" {
WASM_TEST_HANDLER ( test_transaction, send_action_inline_fail );
WASM_TEST_HANDLER ( test_transaction, send_action_empty );
WASM_TEST_HANDLER ( test_transaction, send_action_large );
WASM_TEST_HANDLER ( test_transaction, send_action_4k );
WASM_TEST_HANDLER ( test_transaction, send_action_recurse );
WASM_TEST_HANDLER ( test_transaction, test_read_transaction );
WASM_TEST_HANDLER ( test_transaction, test_transaction_size );
Expand Down Expand Up @@ -160,7 +161,7 @@ extern "C" {
WASM_TEST_HANDLER_EX( test_permission, test_account_creation_time );

//unhandled test call
eosio_assert( false, "Unknown Test" );
eosio_assert( false, "Unknown Test ahhh!" );

}
}
1 change: 1 addition & 0 deletions unittests/test-contracts/test_api/test_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ struct test_transaction {
static void send_action_empty();
static void send_action_max();
static void send_action_large();
static void send_action_4k();
static void send_action_recurse();
static void send_action_inline_fail();
static void test_read_transaction();
Expand Down
Binary file modified unittests/test-contracts/test_api/test_api.wasm
Binary file not shown.
15 changes: 15 additions & 0 deletions unittests/test-contracts/test_api/test_transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,21 @@ void test_transaction::send_action_large() {
eosio_assert( false, "send_message_large() should've thrown an error" );
}

/**
* send an inline action that is 4K
*/
void test_transaction::send_action_4k() {
using namespace eosio;
static char large_message[4 * 1024];
test_action_action<"testapi"_n.value, WASM_TEST_ACTION( "test_action", "assert_true" )> test_action;
copy_data( large_message, 4*1024, test_action.data );

std::vector<permission_level> permissions = { {"testapi"_n, "active"_n} };
action act( permissions, name{"testapi"}, name{WASM_TEST_ACTION("test_action", "assert_true")}, test_action );

act.send();
}

/**
* cause failure due recursive loop
*/
Expand Down

0 comments on commit 1c8ffc3

Please sign in to comment.