From 12036822d45268e72c02407540fc99e2625a3062 Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Sun, 1 Apr 2018 13:36:01 -0400 Subject: [PATCH] Fixed merge conflicts --- contracts/stltest/stltest.cpp | 1 - contracts/test_api/test_api.cpp | 2 +- libraries/chain/chain_controller.cpp | 6 ----- .../include/eosio/chain/transaction_trace.hpp | 1 + tests/api_tests/api_tests.cpp | 25 +++---------------- tests/wasm_tests/wasm_tests.cpp | 2 +- 6 files changed, 7 insertions(+), 30 deletions(-) diff --git a/contracts/stltest/stltest.cpp b/contracts/stltest/stltest.cpp index 16d8a0b00..75e2734a4 100644 --- a/contracts/stltest/stltest.cpp +++ b/contracts/stltest/stltest.cpp @@ -257,7 +257,6 @@ namespace stltest { } static void apply( account_name c, action_name act) { - require_auth(c); eosio::dispatch(c,act); } }; diff --git a/contracts/test_api/test_api.cpp b/contracts/test_api/test_api.cpp index 7ce821fea..ec91fb4e3 100644 --- a/contracts/test_api/test_api.cpp +++ b/contracts/test_api/test_api.cpp @@ -26,7 +26,7 @@ extern "C" { } WASM_TEST_HANDLER(test_action, assert_true_cf); - require_auth(code); + require_auth(code); //test_types WASM_TEST_HANDLER(test_types, types_size); diff --git a/libraries/chain/chain_controller.cpp b/libraries/chain/chain_controller.cpp index 56b4e5321..e258a78c2 100644 --- a/libraries/chain/chain_controller.cpp +++ b/libraries/chain/chain_controller.cpp @@ -1824,12 +1824,6 @@ transaction_trace chain_controller::__apply_transaction( transaction_metadata& m context.results.applied_actions.back().auths_used = act.authorization.size() - context.unused_authorizations().size(); fc::move_append(result.action_traces, std::move(context.results.applied_actions)); fc::move_append(result.deferred_transaction_requests, std::move(context.results.deferred_transaction_requests)); - /* - // check if all authorizations were used, special case a couple of native contracts - if (!(act.name == N(updateauth) || act.name == N(canceldelay))) - EOS_ASSERT( context.all_authorizations_used(), tx_irrelevant_auth, "actions should only require the authorizations needed for execution, unused : ${auth}", - ("auth", context.unused_authorizations()) ); - */ } update_resource_usage(result, meta); diff --git a/libraries/chain/include/eosio/chain/transaction_trace.hpp b/libraries/chain/include/eosio/chain/transaction_trace.hpp index f7fae241d..96f437f49 100644 --- a/libraries/chain/include/eosio/chain/transaction_trace.hpp +++ b/libraries/chain/include/eosio/chain/transaction_trace.hpp @@ -33,6 +33,7 @@ namespace eosio { namespace chain { uint32_t region_id; uint32_t cycle_index; vector data_access; + uint32_t auths_used; fc::microseconds _profiling_us = fc::microseconds(0); }; diff --git a/tests/api_tests/api_tests.cpp b/tests/api_tests/api_tests.cpp index 841574839..ffea3e1a3 100644 --- a/tests/api_tests/api_tests.cpp +++ b/tests/api_tests/api_tests.cpp @@ -349,6 +349,7 @@ BOOST_FIXTURE_TEST_CASE(action_tests, tester) { try { trx.actions.push_back(act); set_transaction_headers(trx); + trx.sign(get_private_key(N(testapi), "active"), chain_id_type()); trx.sign(get_private_key(N(acc3), "active"), chain_id_type()); trx.sign(get_private_key(N(acc4), "active"), chain_id_type()); auto res = push_transaction(trx); @@ -401,6 +402,7 @@ BOOST_FIXTURE_TEST_CASE(cf_action_tests, tester) { try { produce_blocks(1); cf_action cfa; signed_transaction trx; + set_transaction_headers(trx); // need at least one normal action BOOST_CHECK_EXCEPTION(push_transaction(trx), tx_no_action, [](const fc::assert_exception& e) { @@ -462,7 +464,6 @@ BOOST_FIXTURE_TEST_CASE(cf_action_tests, tester) { try { trx.context_free_data.emplace_back(fc::raw::pack(200)); trx.actions.push_back(act1); - set_tapos(trx); // attempt to access non context free api for (uint32_t i = 200; i <= 204; ++i) { trx.context_free_actions.clear(); @@ -481,28 +482,9 @@ BOOST_FIXTURE_TEST_CASE(cf_action_tests, tester) { try { ); } - // attempt to access non context free api - for (uint32_t i = 200; i <= 204; ++i) { - trx.context_free_actions.clear(); - trx.context_free_data.clear(); - cfa.payload = i; - cfa.cfd_idx = 1; - action cfa_act({}, cfa); - dummy_action da = { DUMMY_ACTION_DEFAULT_A, DUMMY_ACTION_DEFAULT_B, DUMMY_ACTION_DEFAULT_C }; - trx.context_free_actions.emplace_back(cfa_act); - trx.actions.emplace_back(pl, da); - trx.signatures.clear(); - sigs = trx.sign(get_private_key(N(testapi), "active"), chain_id_type()); - BOOST_CHECK_EXCEPTION(push_transaction(trx), transaction_exception, - [](const fc::assert_exception& e) { - return expect_assert_message(e, "context_free: only context free api's can be used in this context"); - } - ); - } } produce_block(); - return; // test send context free action auto ttrace = CallFunction( *this, test_api_action{}, {}, {N(testapi)}, 20000 ); BOOST_CHECK_EQUAL(ttrace.action_traces.size(), 2); @@ -518,6 +500,7 @@ BOOST_FIXTURE_TEST_CASE(cf_action_tests, tester) { try { ); CALL_TEST_FUNCTION( *this, "test_transaction", "read_inline_action", {} ); + CallFunction( *this, test_api_action{}, {}, {N(testapi)}, 20000 ); } FC_LOG_AND_RETHROW() } @@ -661,7 +644,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_tests, tester) { try { action act({}, tm); trx.actions.push_back(act); - set_tapos(trx); + set_transaction_headers(trx); BOOST_CHECK_EXCEPTION(push_transaction(trx), transaction_exception, [](const fc::exception& e) { return expect_assert_message(e, "transactions require at least one authorization"); diff --git a/tests/wasm_tests/wasm_tests.cpp b/tests/wasm_tests/wasm_tests.cpp index 88bd2cd05..462f474a9 100644 --- a/tests/wasm_tests/wasm_tests.cpp +++ b/tests/wasm_tests/wasm_tests.cpp @@ -473,7 +473,7 @@ BOOST_FIXTURE_TEST_CASE( stl_test, tester ) try { trx.actions.push_back(std::move(msg_act)); set_transaction_headers(trx); - trx.sign(get_private_key(N(bob), "active"), chain_id_type()); + trx.sign(get_private_key(N(stltest), "active"), chain_id_type()); push_transaction(trx); produce_block(); -- GitLab