From 81b07f1e3a19459863ec203bc02a10f58e45d189 Mon Sep 17 00:00:00 2001 From: Chris Gundlach Date: Wed, 20 Jul 2022 13:16:18 -0500 Subject: [PATCH 1/2] GH-659 backport always populate hex_data for actions --- libraries/chain/include/eosio/chain/abi_serializer.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/chain/include/eosio/chain/abi_serializer.hpp b/libraries/chain/include/eosio/chain/abi_serializer.hpp index 8e0d4a273c..10e876a7ff 100644 --- a/libraries/chain/include/eosio/chain/abi_serializer.hpp +++ b/libraries/chain/include/eosio/chain/abi_serializer.hpp @@ -493,7 +493,6 @@ namespace impl { binary_to_variant_context _ctx(*abi, ctx, type); _ctx.short_path = true; // Just to be safe while avoiding the complexity of threading an override boolean all over the place mvo( "data", abi->_binary_to_variant( type, act.data, _ctx )); - set_hex_data(mvo, "hex_data", act.data); } catch(...) { // any failure to serialize data, then leave as not serailzed set_hex_data(mvo, "data", act.data); @@ -507,6 +506,7 @@ namespace impl { } catch(...) { set_hex_data(mvo, "data", act.data); } + set_hex_data(mvo, "hex_data", act.data); out(name, std::move(mvo)); } From 5ed2e8d8f5a8c475dbe40af3e3698d97c45b24de Mon Sep 17 00:00:00 2001 From: Chris Gundlach Date: Wed, 20 Jul 2022 13:17:09 -0500 Subject: [PATCH 2/2] GH-659 backport tests for always populate hex_data for actions --- unittests/abi_tests.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unittests/abi_tests.cpp b/unittests/abi_tests.cpp index 8c24d92bed..3d0c719c26 100644 --- a/unittests/abi_tests.cpp +++ b/unittests/abi_tests.cpp @@ -2307,10 +2307,9 @@ BOOST_AUTO_TEST_CASE(abi_large_signature) auto stop = fc::time_point::now(); // Give it a leaway of 50ms BOOST_CHECK_LE( (stop - start).count(), 51*1000 ); - // only contains hex_data if it didn't hit the deadline if( check_data ) { BOOST_CHECK( var.get_object().contains( "data" ) ); - BOOST_CHECK( !var.get_object().contains( "hex_data" ) ); + BOOST_CHECK( var.get_object().contains( "hex_data" ) ); } } FC_LOG_AND_RETHROW() } @@ -2917,7 +2916,8 @@ inline std::pair generate_action_trace(const std::opt << "\"actor\":\"acctest\"," << "\"permission\":\"active\"" << "}]," - << "\"data\":\"09746573745f64617461\"" + << "\"data\":\"09746573745f64617461\"," + << "\"hex_data\":\"09746573745f64617461\"" << "}," << "\"context_free\":false," << "\"elapsed\":3,"