1#define BOOST_TEST_MODULE trace_data_responses
2#include <boost/test/included/unit_test.hpp>
48 template<
typename ActionTrace>
50 if constexpr(std::is_same_v<ActionTrace, action_trace_v0>){
53 else if constexpr(std::is_same_v<ActionTrace, action_trace_v1>){
85BOOST_AUTO_TEST_SUITE(trace_responses)
90 "b000000000000000000000000000000000000000000000000000000000000001"_h,
92 "0000000000000000000000000000000000000000000000000000000000000000"_h,
96 "0000000000000000000000000000000000000000000000000000000000000000"_h,
97 "0000000000000000000000000000000000000000000000000000000000000000"_h,
103 (
"id",
"b000000000000000000000000000000000000000000000000000000000000001")
105 (
"previous_id",
"0000000000000000000000000000000000000000000000000000000000000000")
106 (
"status",
"pending")
107 (
"timestamp",
"2000-01-01T00:00:00.000Z")
108 (
"producer",
"bp.one")
109 (
"transaction_mroot",
"0000000000000000000000000000000000000000000000000000000000000000")
110 (
"action_mroot",
"0000000000000000000000000000000000000000000000000000000000000000")
111 (
"schedule_version", 0)
116 BOOST_TEST(height == 1);
120 fc::variant actual_response = get_block_trace( 1 );
122 BOOST_TEST(
to_kv(expected_response) ==
to_kv(actual_response), boost::test_tools::per_element());
129 "receiver"_n,
"contract"_n,
"action"_n,
130 {{
"alice"_n,
"active"_n }},
131 { 0x00, 0x01, 0x02, 0x03 }
135 "0000000000000000000000000000000000000000000000000000000000000001"_h,
148 "b000000000000000000000000000000000000000000000000000000000000001"_h,
150 "0000000000000000000000000000000000000000000000000000000000000000"_h,
154 "0000000000000000000000000000000000000000000000000000000000000000"_h,
155 "0000000000000000000000000000000000000000000000000000000000000000"_h,
163 (
"id",
"b000000000000000000000000000000000000000000000000000000000000001")
165 (
"previous_id",
"0000000000000000000000000000000000000000000000000000000000000000")
166 (
"status",
"pending")
167 (
"timestamp",
"2000-01-01T00:00:00.000Z")
168 (
"producer",
"bp.one")
169 (
"transaction_mroot",
"0000000000000000000000000000000000000000000000000000000000000000")
170 (
"action_mroot",
"0000000000000000000000000000000000000000000000000000000000000000")
171 (
"schedule_version", 0)
174 (
"id",
"0000000000000000000000000000000000000000000000000000000000000001")
177 (
"global_sequence", 0)
178 (
"receiver",
"receiver")
179 (
"account",
"contract")
184 (
"permission",
"active")
190 (
"status",
"executed")
192 (
"net_usage_words", 5)
193 (
"signatures",
fc::variants({
"SIG_K1_111111111111111111111111111111111111111111111111111111111111111116uk5ne"}))
195 (
"expiration",
"1970-01-01T00:00:00")
197 (
"ref_block_prefix", 0)
198 (
"max_net_usage_words", 100)
199 (
"max_cpu_usage_ms", 50)
206 BOOST_TEST(height == 1);
210 fc::variant actual_response = get_block_trace( 1 );
212 BOOST_TEST(
to_kv(expected_response) ==
to_kv(actual_response), boost::test_tools::per_element());
219 "b000000000000000000000000000000000000000000000000000000000000001"_h,
221 "0000000000000000000000000000000000000000000000000000000000000000"_h,
225 "0000000000000000000000000000000000000000000000000000000000000000"_h,
226 "0000000000000000000000000000000000000000000000000000000000000000"_h,
231 "0000000000000000000000000000000000000000000000000000000000000001"_h,
235 "receiver"_n,
"contract"_n,
"action"_n,
236 {{
"alice"_n,
"active"_n }},
237 { 0x00, 0x01, 0x02, 0x03 }
251 (
"id",
"b000000000000000000000000000000000000000000000000000000000000001")
253 (
"previous_id",
"0000000000000000000000000000000000000000000000000000000000000000")
254 (
"status",
"pending")
255 (
"timestamp",
"2000-01-01T00:00:00.000Z")
256 (
"producer",
"bp.one")
257 (
"transaction_mroot",
"0000000000000000000000000000000000000000000000000000000000000000")
258 (
"action_mroot",
"0000000000000000000000000000000000000000000000000000000000000000")
259 (
"schedule_version", 0)
262 (
"id",
"0000000000000000000000000000000000000000000000000000000000000001")
265 (
"global_sequence", 0)
266 (
"receiver",
"receiver")
267 (
"account",
"contract")
272 (
"permission",
"active")
276 (
"status",
"executed")
278 (
"net_usage_words", 5)
279 (
"signatures",
fc::variants({
"SIG_K1_111111111111111111111111111111111111111111111111111111111111111116uk5ne"}))
281 (
"expiration",
"1970-01-01T00:00:00")
283 (
"ref_block_prefix", 0)
284 (
"max_net_usage_words", 100)
285 (
"max_cpu_usage_ms", 50)
292 BOOST_TEST(height == 1);
301 fc::variant actual_response = get_block_trace( 1 );
303 BOOST_TEST(
to_kv(expected_response) ==
to_kv(actual_response), boost::test_tools::per_element());
310 "b000000000000000000000000000000000000000000000000000000000000001"_h,
312 "0000000000000000000000000000000000000000000000000000000000000000"_h,
316 "0000000000000000000000000000000000000000000000000000000000000000"_h,
317 "0000000000000000000000000000000000000000000000000000000000000000"_h,
322 "0000000000000000000000000000000000000000000000000000000000000001"_h,
326 "receiver"_n,
"contract"_n,
"action"_n,
327 {{
"alice"_n,
"active"_n }},
328 { 0x01, 0x01, 0x01, 0x01 }
332 "receiver"_n,
"contract"_n,
"action"_n,
333 {{
"alice"_n,
"active"_n }},
334 { 0x00, 0x00, 0x00, 0x00 }
338 "receiver"_n,
"contract"_n,
"action"_n,
339 {{
"alice"_n,
"active"_n }},
340 { 0x02, 0x02, 0x02, 0x02 }
354 (
"id",
"b000000000000000000000000000000000000000000000000000000000000001")
356 (
"previous_id",
"0000000000000000000000000000000000000000000000000000000000000000")
357 (
"status",
"pending")
358 (
"timestamp",
"2000-01-01T00:00:00.000Z")
359 (
"producer",
"bp.one")
360 (
"transaction_mroot",
"0000000000000000000000000000000000000000000000000000000000000000")
361 (
"action_mroot",
"0000000000000000000000000000000000000000000000000000000000000000")
362 (
"schedule_version", 0)
365 (
"id",
"0000000000000000000000000000000000000000000000000000000000000001")
368 (
"global_sequence", 0)
369 (
"receiver",
"receiver")
370 (
"account",
"contract")
375 (
"permission",
"active")
380 (
"global_sequence", 1)
381 (
"receiver",
"receiver")
382 (
"account",
"contract")
387 (
"permission",
"active")
392 (
"global_sequence", 2)
393 (
"receiver",
"receiver")
394 (
"account",
"contract")
399 (
"permission",
"active")
403 (
"status",
"executed")
405 (
"net_usage_words", 5)
406 (
"signatures",
fc::variants({
"SIG_K1_111111111111111111111111111111111111111111111111111111111111111116uk5ne"}))
408 (
"expiration",
"1970-01-01T00:00:00")
410 (
"ref_block_prefix", 0)
411 (
"max_net_usage_words", 100)
412 (
"max_cpu_usage_ms", 50)
419 BOOST_TEST(height == 1);
428 fc::variant actual_response = get_block_trace( 1 );
430 BOOST_TEST(
to_kv(expected_response) ==
to_kv(actual_response), boost::test_tools::per_element());
437 "b000000000000000000000000000000000000000000000000000000000000001"_h,
439 "0000000000000000000000000000000000000000000000000000000000000000"_h,
443 "0000000000000000000000000000000000000000000000000000000000000000"_h,
444 "0000000000000000000000000000000000000000000000000000000000000000"_h,
450 (
"id",
"b000000000000000000000000000000000000000000000000000000000000001")
452 (
"previous_id",
"0000000000000000000000000000000000000000000000000000000000000000")
453 (
"status",
"irreversible")
454 (
"timestamp",
"2000-01-01T00:00:00.000Z")
455 (
"producer",
"bp.one")
456 (
"transaction_mroot",
"0000000000000000000000000000000000000000000000000000000000000000")
457 (
"action_mroot",
"0000000000000000000000000000000000000000000000000000000000000000")
458 (
"schedule_version", 0)
463 BOOST_TEST(height == 1);
468 BOOST_TEST(
to_kv(expected_response) ==
to_kv(response), boost::test_tools::per_element());
475 BOOST_TEST(height == 1);
485 BOOST_TEST(height == 1);
491 BOOST_TEST(null_response.
is_null());
498 "b000000000000000000000000000000000000000000000000000000000000001"_h,
500 "0000000000000000000000000000000000000000000000000000000000000000"_h,
504 "0000000000000000000000000000000000000000000000000000000000000000"_h,
505 "0000000000000000000000000000000000000000000000000000000000000000"_h,
510 "0000000000000000000000000000000000000000000000000000000000000001"_h,
514 "receiver"_n,
"contract"_n,
"action"_n,
515 {{
"alice"_n,
"active"_n }},
516 { 0x00, 0x01, 0x02, 0x03 }
530 BOOST_TEST(height == 1);
536 if (countdown-- == 0) {
562 "b000000000000000000000000000000000000000000000000000000000000001"_h,
564 "0000000000000000000000000000000000000000000000000000000000000000"_h,
569 "0000000000000000000000000000000000000000000000000000000000000001"_h,
573 "receiver"_n,
"contract"_n,
"action"_n,
574 {{
"alice"_n,
"active"_n }},
575 { 0x00, 0x01, 0x02, 0x03 }
583 (
"id",
"b000000000000000000000000000000000000000000000000000000000000001")
585 (
"previous_id",
"0000000000000000000000000000000000000000000000000000000000000000")
586 (
"status",
"pending")
587 (
"timestamp",
"2000-01-01T00:00:00.000Z")
588 (
"producer",
"bp.one")
591 (
"id",
"0000000000000000000000000000000000000000000000000000000000000001")
594 (
"global_sequence", 0)
595 (
"receiver",
"receiver")
596 (
"account",
"contract")
601 (
"permission",
"active")
612 BOOST_TEST(height == 1);
616 fc::variant actual_response = get_block_trace( 1 );
618 BOOST_TEST(
to_kv(expected_response) ==
to_kv(actual_response), boost::test_tools::per_element());
624 "b000000000000000000000000000000000000000000000000000000000000001"_h,
626 "0000000000000000000000000000000000000000000000000000000000000000"_h,
629 "0000000000000000000000000000000000000000000000000000000000000000"_h,
630 "0000000000000000000000000000000000000000000000000000000000000000"_h,
636 (
"id",
"b000000000000000000000000000000000000000000000000000000000000001")
638 (
"previous_id",
"0000000000000000000000000000000000000000000000000000000000000000")
639 (
"status",
"pending")
640 (
"timestamp",
"2000-01-01T00:00:00.000Z")
641 (
"producer",
"bp.one")
642 (
"transaction_mroot",
"0000000000000000000000000000000000000000000000000000000000000000")
643 (
"action_mroot",
"0000000000000000000000000000000000000000000000000000000000000000")
644 (
"schedule_version", 0)
649 BOOST_TEST(height == 1);
653 fc::variant actual_response = get_block_trace( 1 );
655 BOOST_TEST(
to_kv(expected_response) ==
to_kv(actual_response), boost::test_tools::per_element());
663 "receiver"_n,
"contract"_n,
"action"_n,
664 {{
"alice"_n,
"active"_n }},
665 { 0x00, 0x01, 0x02, 0x03 }
667 { 0x04, 0x05, 0x06, 0x07 }
671 "0000000000000000000000000000000000000000000000000000000000000001"_h,
672 std::vector<action_trace_v1> {
683 "b000000000000000000000000000000000000000000000000000000000000001"_h,
685 "0000000000000000000000000000000000000000000000000000000000000000"_h,
688 "0000000000000000000000000000000000000000000000000000000000000000"_h,
689 "0000000000000000000000000000000000000000000000000000000000000000"_h,
691 std::vector<transaction_trace_v2> {
697 (
"id",
"b000000000000000000000000000000000000000000000000000000000000001")
699 (
"previous_id",
"0000000000000000000000000000000000000000000000000000000000000000")
700 (
"status",
"pending")
701 (
"timestamp",
"2000-01-01T00:00:00.000Z")
702 (
"producer",
"bp.one")
703 (
"transaction_mroot",
"0000000000000000000000000000000000000000000000000000000000000000")
704 (
"action_mroot",
"0000000000000000000000000000000000000000000000000000000000000000")
705 (
"schedule_version", 0)
708 (
"id",
"0000000000000000000000000000000000000000000000000000000000000001")
711 (
"global_sequence", 0)
712 (
"receiver",
"receiver")
713 (
"account",
"contract")
718 (
"permission",
"active")
721 (
"return_value",
"04050607")
727 (
"status",
"executed")
729 (
"net_usage_words", 5)
730 (
"signatures",
fc::variants({
"SIG_K1_111111111111111111111111111111111111111111111111111111111111111116uk5ne"}))
732 (
"expiration",
"1970-01-01T00:00:00")
734 (
"ref_block_prefix", 0)
735 (
"max_net_usage_words", 100)
736 (
"max_cpu_usage_ms", 50)
743 BOOST_TEST(height == 1);
747 fc::variant actual_response = get_block_trace( 1 );
748 BOOST_TEST(
to_kv(expected_response) ==
to_kv(actual_response), boost::test_tools::per_element());
756 "receiver"_n,
"contract"_n,
"action"_n,
757 {{
"alice"_n,
"active"_n }},
758 { 0x00, 0x01, 0x02, 0x03 }
760 { 0x04, 0x05, 0x06, 0x07 }
764 "0000000000000000000000000000000000000000000000000000000000000001"_h,
765 std::vector<action_trace_v1> {
776 "b000000000000000000000000000000000000000000000000000000000000001"_h,
778 "0000000000000000000000000000000000000000000000000000000000000000"_h,
781 "0000000000000000000000000000000000000000000000000000000000000000"_h,
782 "0000000000000000000000000000000000000000000000000000000000000000"_h,
784 std::vector<transaction_trace_v2> {
790 (
"id",
"b000000000000000000000000000000000000000000000000000000000000001")
792 (
"previous_id",
"0000000000000000000000000000000000000000000000000000000000000000")
793 (
"status",
"pending")
794 (
"timestamp",
"2000-01-01T00:00:00.000Z")
795 (
"producer",
"bp.one")
796 (
"transaction_mroot",
"0000000000000000000000000000000000000000000000000000000000000000")
797 (
"action_mroot",
"0000000000000000000000000000000000000000000000000000000000000000")
798 (
"schedule_version", 0)
801 (
"id",
"0000000000000000000000000000000000000000000000000000000000000001")
804 (
"global_sequence", 0)
805 (
"receiver",
"receiver")
806 (
"account",
"contract")
811 (
"permission",
"active")
814 (
"return_value",
"04050607")
816 (
"status",
"executed")
818 (
"net_usage_words", 5)
819 (
"signatures",
fc::variants({
"SIG_K1_111111111111111111111111111111111111111111111111111111111111111116uk5ne"}))
821 (
"expiration",
"1970-01-01T00:00:00")
823 (
"ref_block_prefix", 0)
824 (
"max_net_usage_words", 100)
825 (
"max_cpu_usage_ms", 50)
831 BOOST_TEST(height == 1);
840 fc::variant actual_response = get_block_trace( 1 );
842 BOOST_TEST(
to_kv(expected_response) ==
to_kv(actual_response), boost::test_tools::per_element());
847 std::vector<action_trace_v1> actions = {
851 "receiver"_n,
"contract"_n,
"action"_n,
852 {{
"alice"_n,
"active"_n }},
853 { 0x01, 0x01, 0x01, 0x01 },
855 { 0x05, 0x05, 0x05, 0x05 }
860 "receiver"_n,
"contract"_n,
"action"_n,
861 {{
"alice"_n,
"active"_n }},
862 { 0x00, 0x00, 0x00, 0x00 }
864 { 0x04, 0x04, 0x04, 0x04}
869 "receiver"_n,
"contract"_n,
"action"_n,
870 {{
"alice"_n,
"active"_n }},
871 { 0x02, 0x02, 0x02, 0x02 }
873 { 0x06, 0x06, 0x06, 0x06 }
878 "0000000000000000000000000000000000000000000000000000000000000001"_h,
888 "b000000000000000000000000000000000000000000000000000000000000001"_h,
890 "0000000000000000000000000000000000000000000000000000000000000000"_h,
893 "0000000000000000000000000000000000000000000000000000000000000000"_h,
894 "0000000000000000000000000000000000000000000000000000000000000000"_h,
896 std::vector<transaction_trace_v2> {
902 (
"id",
"b000000000000000000000000000000000000000000000000000000000000001")
904 (
"previous_id",
"0000000000000000000000000000000000000000000000000000000000000000")
905 (
"status",
"pending")
906 (
"timestamp",
"2000-01-01T00:00:00.000Z")
907 (
"producer",
"bp.one")
908 (
"transaction_mroot",
"0000000000000000000000000000000000000000000000000000000000000000")
909 (
"action_mroot",
"0000000000000000000000000000000000000000000000000000000000000000")
910 (
"schedule_version", 0)
913 (
"id",
"0000000000000000000000000000000000000000000000000000000000000001")
916 (
"global_sequence", 0)
917 (
"receiver",
"receiver")
918 (
"account",
"contract")
923 (
"permission",
"active")
926 (
"return_value",
"04040404")
929 (
"global_sequence", 1)
930 (
"receiver",
"receiver")
931 (
"account",
"contract")
936 (
"permission",
"active")
939 (
"return_value",
"05050505")
942 (
"global_sequence", 2)
943 (
"receiver",
"receiver")
944 (
"account",
"contract")
949 (
"permission",
"active")
952 (
"return_value",
"06060606")
954 (
"status",
"executed")
956 (
"net_usage_words", 5)
957 (
"signatures",
fc::variants({
"SIG_K1_111111111111111111111111111111111111111111111111111111111111111116uk5ne"}))
959 (
"expiration",
"1970-01-01T00:00:00")
961 (
"ref_block_prefix", 0)
962 (
"max_net_usage_words", 100)
963 (
"max_cpu_usage_ms", 50)
970 BOOST_TEST(height == 1);
979 fc::variant actual_response = get_block_trace( 1 );
981 BOOST_TEST(
to_kv(expected_response) ==
to_kv(actual_response), boost::test_tools::per_element());
987 "b000000000000000000000000000000000000000000000000000000000000001"_h,
989 "0000000000000000000000000000000000000000000000000000000000000000"_h,
992 "0000000000000000000000000000000000000000000000000000000000000000"_h,
993 "0000000000000000000000000000000000000000000000000000000000000000"_h,
999 (
"id",
"b000000000000000000000000000000000000000000000000000000000000001")
1001 (
"previous_id",
"0000000000000000000000000000000000000000000000000000000000000000")
1002 (
"status",
"irreversible")
1003 (
"timestamp",
"2000-01-01T00:00:00.000Z")
1004 (
"producer",
"bp.one")
1005 (
"transaction_mroot",
"0000000000000000000000000000000000000000000000000000000000000000")
1006 (
"action_mroot",
"0000000000000000000000000000000000000000000000000000000000000000")
1007 (
"schedule_version", 0)
1012 BOOST_TEST(height == 1);
1017 BOOST_TEST(
to_kv(expected_response) ==
to_kv(response), boost::test_tools::per_element());
1026 "receiver"_n,
"contract"_n,
"action"_n,
1027 {{
"alice"_n,
"active"_n }},
1028 { 0x00, 0x01, 0x02, 0x03 }
1030 { 0x04, 0x05, 0x06, 0x07 }
1034 "0000000000000000000000000000000000000000000000000000000000000001"_h,
1035 std::vector<action_trace_v1> {
1046 "b000000000000000000000000000000000000000000000000000000000000001"_h,
1048 "0000000000000000000000000000000000000000000000000000000000000000"_h,
1051 "0000000000000000000000000000000000000000000000000000000000000000"_h,
1052 "0000000000000000000000000000000000000000000000000000000000000000"_h,
1054 std::vector<transaction_trace_v2>{
1060 BOOST_TEST(height == 1);
1066 if (countdown-- == 0) {
1074BOOST_AUTO_TEST_SUITE_END()
static logger get(const fc::string &name=DEFAULT_LOGGER)
An order-preserving dictionary of variants.
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
fc::variant get_block_trace(uint32_t block_height, const yield_function &yield={})
#define fc_dlog(LOGGER, FORMAT,...)
std::vector< fc::variant > variants
fc::string to_hex(const char *d, uint32_t s)
auto to_kv(const fc::variant &v)
std::optional< std::tuple< data_log_entry, bool > > get_block_t
std::variant< block_trace_v0, block_trace_v1, block_trace_v2 > data_log_entry
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
mock_data_handler_provider(response_test_fixture &fixture)
response_test_fixture & fixture
std::tuple< fc::variant, std::optional< fc::variant > > serialize_to_variant(const ActionTrace &action, const yield_function &yield)
mock_logfile_provider(response_test_fixture &fixture)
get_block_t get_block(uint32_t height, const yield_function &yield={})
response_test_fixture & fixture
response_impl_type response_impl
std::function< std::tuple< fc::variant, std::optional< fc::variant > >(const action_trace_v1 &, const yield_function &)> mock_data_handler_v1
static constexpr auto default_mock_data_handler_v1
static constexpr auto default_mock_data_handler_v0
std::function< std::tuple< fc::variant, std::optional< fc::variant > >(const action_trace_v0 &, const yield_function &)> mock_data_handler_v0
std::function< get_block_t(uint32_t, const yield_function &)> mock_get_block
fc::variant get_block_trace(uint32_t block_height, const yield_function &yield={})
BOOST_FIXTURE_TEST_CASE(basic_empty_block_response, response_test_fixture)