Skip to content

Commit

Permalink
Merge pull request #701 from eosnetworkfoundation/backport_action_ser…
Browse files Browse the repository at this point in the history
…ialization_data

[3.2] Backport action serialization to always include hex_data.
  • Loading branch information
ndcgundlach authored Jul 20, 2022
2 parents 423b20a + 5ed2e8d commit 814aeca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libraries/chain/include/eosio/chain/abi_serializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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));
}

Expand Down
6 changes: 3 additions & 3 deletions unittests/abi_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down Expand Up @@ -2917,7 +2916,8 @@ inline std::pair<action_trace, std::string> generate_action_trace(const std::opt
<< "\"actor\":\"acctest\","
<< "\"permission\":\"active\""
<< "}],"
<< "\"data\":\"09746573745f64617461\""
<< "\"data\":\"09746573745f64617461\","
<< "\"hex_data\":\"09746573745f64617461\""
<< "},"
<< "\"context_free\":false,"
<< "\"elapsed\":3,"
Expand Down

0 comments on commit 814aeca

Please sign in to comment.