diff --git a/.buildkite/scripts/make_image.sh b/.buildkite/scripts/make_image.sh index 730137545..b8abeb002 100755 --- a/.buildkite/scripts/make_image.sh +++ b/.buildkite/scripts/make_image.sh @@ -53,6 +53,12 @@ case "$BUILD_TYPE" in BASE_DOCKER_NAME=$(basename $(pwd)) DOCKER_NAME="${BASE_DOCKER_NAME}-${IMAGE_ARCH}_${VERSION}" ;; + "miner-testnet") + echo "Doing a testnet miner image build for ${IMAGE_ARCH}" + DOCKER_BUILD_ARGS="--build-arg EXTRA_BUILD_APK_PACKAGES=apk-tools --build-arg EXTRA_RUNNER_APK_PACKAGES=apk-tools --build-arg BUILDER_IMAGE=${BUILD_IMAGE} --build-arg RUNNER_IMAGE=${RUN_IMAGE} --build-arg REBAR_BUILD_TARGET=docker_testminer ${DOCKER_BUILD_ARGS}" + BASE_DOCKER_NAME=$(basename $(pwd)) + DOCKER_NAME="${BASE_DOCKER_NAME}-${IMAGE_ARCH}_testnet_${VERSION}" + ;; *) echo "I don't know how to do a build for ${BUILD_TYPE}" exit 1 diff --git a/config/grpc_client_gen.config b/config/grpc_client_gen.config new file mode 100644 index 000000000..7a97923a2 --- /dev/null +++ b/config/grpc_client_gen.config @@ -0,0 +1,31 @@ +{plugins, [ + {grpcbox_plugin, + {git, "https://github.com/andymck/grpcbox_plugin.git", + {branch, "andymck/ts-master/combined-opts-and-template-changes"}}} +]}. + +{grpc, [ + {proto_files, [ + "_build/default/lib/helium_proto/src/service/gateway.proto" + ]}, + {beam_out_dir, "src/grpc/autogen/client"}, + {out_dir, "src/grpc/autogen/client"}, + {keep_beams, false}, + {create_services, false}, + {override_gpb_defaults, true}, + {gpb_opts, [ + {rename,{msg_fqname,base_name}}, + use_packages, + {report_errors, false}, + {descriptor, false}, + {recursive, false}, + {i, "_build/default/lib/helium_proto/src"}, + {o, "src/grpc/autogen/client"}, + {module_name_prefix, ""}, + {module_name_suffix, "_miner_client_pb"}, + {rename, {msg_name, {suffix, "_pb"}}}, + {strings_as_binaries, false}, + type_specs, + {defs_as_proplists, true} + ]} +]}. diff --git a/config/sys.config b/config/sys.config index 5e5236798..d721fb7c8 100644 --- a/config/sys.config +++ b/config/sys.config @@ -93,6 +93,10 @@ {log_file_time_to_roll, 86400} %% rotate logs once a day ]} ]}, + {sibyl, + [ + {validator_ignore_list, []} + ]}, {miner, [ {denylist_keys, ["1SbEYKju337P6aYsRd9DT2k4qgK5ZK62kXbSvnJgqeaxK3hqQrYURZjL"]}, @@ -101,6 +105,7 @@ {jsonrpc_ip, {127,0,0,1}}, %% bind JSONRPC to localhost only {jsonrpc_port, 4467}, {mode, gateway}, + {gateways_run_chain, true}, %% if false, gateways will no longer follow the chain {use_ebus, true}, {batch_size, 2500}, {curve, 'SS512'}, @@ -115,6 +120,13 @@ {default_routers, ["/p2p/11w77YQLhgUt8HUJrMtntGGr97RyXmot1ofs5Ct2ELTmbFoYsQa","/p2p/11afuQSrmk52mgxLu91AdtDXbJ9wmqWBUxC3hvjejoXkxEZfPvY"]}, {mark_mods, [miner_hbbft_handler]}, {stabilization_period, 50000}, + {seed_validators, [ + {"11tk4zzbyfMPYYHYda255ACoqfYFVdrUSoCWrCYfn8BoyuYrERK", "52.49.199.40", 8080}, %% ireland + {"115PmCR6fpFihdjw626JXYdUEdzwjh66yoWzWkMvB9CRGEx1U6G", "3.132.190.192", 8080}, %% ohio + {"11pUovhssQdXzrfcYMTUrNNTQossgny8WqhfdbprrAVFyHcmvAN", "35.84.173.125", 8080}, %% oregon + {"11yJXQPG9deHqvw2ac6VWtNP7gZj8X3t3Qb3Gqm9j729p4AsdaA", "3.38.70.101", 8080}, %% seoul + {"11Gx2yPEmBGUrbHUiUWQs9vV7JDHQLZSddQs6e3WB2uvqSMUDBW", "54.251.77.229", 8080} %% singapore + ]}, {reg_domains_file, "countries_reg_domains.csv"}, {frequency_data, #{'US915' => [903.9, 904.1, 904.3, 904.5, 904.7, 904.9, 905.1, 905.3], 'EU868' => [867.1, 867.3, 867.5, 867.7, 867.9, 868.1, 868.3, 868.5], diff --git a/config/test.config b/config/test.config index f7c4b0ac8..a178b1f23 100644 --- a/config/test.config +++ b/config/test.config @@ -8,6 +8,11 @@ {libp2p, [ {use_dns_for_seeds, false} ]}, +{sibyl, + [ + {poc_mgr_mod, miner_poc_mgr}, + {poc_report_handler, miner_poc_report_handler} + ]}, {blockchain, [ {seed_dns_cname, ""}, diff --git a/config/test_val.config.src b/config/test_val.config.src index 0c9e3aeec..b2945a8e3 100644 --- a/config/test_val.config.src +++ b/config/test_val.config.src @@ -52,6 +52,12 @@ %% as without one miner_lora is not started %% including the params anyway in case someone needs it in this env {region_override, 'US915'}, - {gateway_and_mux_enable, false} + {gateway_and_mux_enable, false}, + {seed_validators, [ + {"1ZPNnNd9k5qiQXXigKifQpCPiy5HTbszQDSyLM56ywk7ihNRvt6", "18.223.171.149", 8080}, %% test-val2 + {"1ZYe21WzqJGkWjXvyEt2c8ALSrufPfjzqfQP2SGy61UJd2h9EbL", "3.17.164.253", 8080}, %% test-val3 + {"1ZAxCrEsigGVbLUM37Jki6p88kyZ5NVqjVC6oHSbqu49t7bQDym", "18.191.60.231", 8080} %% test-val6 + ] + } ]} ]. diff --git a/rebar.config b/rebar.config index fc3f824ef..3e60dbc6a 100644 --- a/rebar.config +++ b/rebar.config @@ -10,9 +10,9 @@ {deps, [ {blockchain, {git, "https://github.com/helium/blockchain-core.git", - {branch, "master"}}}, + {branch, "andymck/poc-grpc-v2-plus-vals-as-chall"}}}, {sibyl, {git, "https://github.com/helium/sibyl.git", - {branch, "master"}}}, + {branch, "andymck/poc-grpc-plus-vals-as-chall"}}}, {hbbft, {git, "https://github.com/helium/erlang-hbbft.git", {branch, "master"}}}, {dkg, {git, "https://github.com/helium/erlang-dkg.git", {branch, "master"}}}, @@ -21,8 +21,10 @@ {jsx, "3.1.0"}, {kvc, {git, "https://github.com/etrepum/kvc", {tag, "v1.7.0"}}}, {longfi, {git, "https://github.com/helium/longfi-erlang", {tag, "0.2.2"}}}, + {grpc_lib, {git, "https://github.com/Bluehouse-Technology/grpc_lib", {branch, "master"}}}, {grpc_client, {git, "https://github.com/Bluehouse-Technology/grpc_client.git", {branch, "master"}}}, - {http2_client, {git, "https://github.com/Bluehouse-Technology/http2_client", {branch, "master"}}}, + {http2_client, {git, "https://github.com/Bluehouse-Technology/http2_client", + {branch, "master"}}}, recon, {elli, "3.3.0"}, {jsonrpc2, {git, "https://github.com/zuiderkwast/jsonrpc2-erlang", @@ -33,14 +35,14 @@ {xref_checks, [ undefined_function_calls, - undefined_functions, + undefined_functions %locals_not_used, - deprecated_function_calls, - deprecated_functions + %deprecated_function_calls, + %deprecated_functions ]}. {plugins, [ - {grpcbox_plugin, {git, "https://github.com/andymck/grpcbox_plugin.git", {branch, "andymck/ts-master"}}}, + {grpcbox_plugin, {git, "https://github.com/andymck/grpcbox_plugin.git", {branch, "andymck/ts-master/combined-opts-and-template-changes"}}}, {rebar3_gpb_plugin, "2.15.0"}, {rebar3_eqc, "1.3.0"} ]}. diff --git a/rebar.lock b/rebar.lock index c2c38b00e..7f903f096 100644 --- a/rebar.lock +++ b/rebar.lock @@ -5,7 +5,7 @@ {<<"base64url">>,{pkg,<<"base64url">>,<<"1.0.1">>},1}, {<<"blockchain">>, {git,"https://github.com/helium/blockchain-core.git", - {ref,"ef7e9604c5f304b49a88da73c93d7f2fe46ee516"}}, + {ref,"167c3eae368ba68cb4595e32204cc448603525b9"}}, 0}, {<<"chatterbox">>, {git,"https://github.com/andymck/chatterbox", @@ -81,7 +81,7 @@ 1}, {<<"getopt">>,{pkg,<<"getopt">>,<<"1.0.1">>},3}, {<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.9">>},2}, - {<<"gpb">>,{pkg,<<"gpb">>,<<"4.19.2">>},2}, + {<<"gpb">>,{pkg,<<"gpb">>,<<"4.19.2">>},1}, {<<"gproc">>,{pkg,<<"gproc">>,<<"0.8.0">>},2}, {<<"grpc_client">>, {git,"https://github.com/Bluehouse-Technology/grpc_client.git", @@ -90,7 +90,7 @@ {<<"grpc_lib">>, {git,"https://github.com/Bluehouse-Technology/grpc_lib", {ref,"a77686b55b60b052d6c7cd927d04dde429bbdabf"}}, - 1}, + 0}, {<<"grpcbox">>, {git,"https://github.com/andymck/grpcbox.git", {ref,"fbf689bb9c25fc2943155c891974e1f745ce5ac7"}}, @@ -105,7 +105,7 @@ 0}, {<<"helium_proto">>, {git,"https://github.com/helium/proto.git", - {ref,"30f17c5d1a7942297923f4e743c681c46f917fc3"}}, + {ref,"3704aed069ca48b3b56fecd7d0275a0f8a372bde"}}, 1}, {<<"hpack">>,{pkg,<<"hpack_erl">>,<<"0.2.3">>},3}, {<<"http2_client">>, @@ -170,7 +170,7 @@ 3}, {<<"sibyl">>, {git,"https://github.com/helium/sibyl.git", - {ref,"4d16f60fba28eafd70e256976cbe3644911ac16b"}}, + {ref,"3101e3a26c581f458d4babb8d01ee3154b5da430"}}, 0}, {<<"sidejob">>,{pkg,<<"sidejob">>,<<"2.1.0">>},2}, {<<"small_ints">>,{pkg,<<"small_ints">>,<<"0.1.0">>},4}, diff --git a/src/cli/miner_cli_info.erl b/src/cli/miner_cli_info.erl index 7bbd78936..d024702b6 100644 --- a/src/cli/miner_cli_info.erl +++ b/src/cli/miner_cli_info.erl @@ -223,7 +223,8 @@ info_region_usage() -> ]. info_region(["info", "region"], [], []) -> - case miner_lora:region() of + LoraMod = application:get_env(miner, lora_mod, miner_lora), + case LoraMod:region() of {ok, undefined} -> {exit_status, 1, [clique_status:text("undefined")]}; {ok, Region} -> @@ -271,7 +272,7 @@ info_onboarding(["info", "onboarding"], [], Flags) -> ProvidedKey end, PayerOutputOnly = proplists:is_defined(just_payer, Flags), - + case OnboardingKey of undefined -> error_message("This miner has no onboarding key, no onboarding info available."); @@ -293,7 +294,7 @@ info_onboarding(["info", "onboarding"], [], Flags) -> %% -spec onboarding_info_for_key(string()) -> {ok, {map(), map()}} | notfound | {error, non_neg_integer()}. onboarding_info_for_key(OnboardingKey) -> - Url = ?ONBOARDING_API_URL_BASE ++ "/hotspots/" ++ OnboardingKey, + Url = ?ONBOARDING_API_URL_BASE ++ "/hotspots/" ++ OnboardingKey, case get_api_json_as_map(Url) of {ok, OnboardingResult} -> OnboardingData = maps:get(<<"data">>, OnboardingResult), @@ -308,7 +309,7 @@ onboarding_info_for_key(OnboardingKey) -> -spec clique_status_for_onboarding_info({map(), map()}, boolean()) -> list(). clique_status_for_onboarding_info({MinerData, MakerData}, PayerOutputOnly) -> case PayerOutputOnly of - true -> + true -> PayerAddress = maps:get(<<"address">>, MakerData), PayerAddressString = binary_to_list(PayerAddress), [ clique_status:text(PayerAddressString) ]; diff --git a/src/grpc/autogen/client/gateway_miner_client_pb.erl b/src/grpc/autogen/client/gateway_miner_client_pb.erl new file mode 100644 index 000000000..43de673d1 --- /dev/null +++ b/src/grpc/autogen/client/gateway_miner_client_pb.erl @@ -0,0 +1,39636 @@ +%% -*- coding: utf-8 -*- +%% @private +%% Automatically generated, do not edit +%% Generated by gpb_compile version 4.11.2 +-module(gateway_miner_client_pb). + +-export([encode_msg/1, encode_msg/2, encode_msg/3]). +-export([decode_msg/2, decode_msg/3]). +-export([merge_msgs/2, merge_msgs/3, merge_msgs/4]). +-export([verify_msg/1, verify_msg/2, verify_msg/3]). +-export([get_msg_defs/0]). +-export([get_msg_names/0]). +-export([get_group_names/0]). +-export([get_msg_or_group_names/0]). +-export([get_enum_names/0]). +-export([find_msg_def/1, fetch_msg_def/1]). +-export([find_enum_def/1, fetch_enum_def/1]). +-export([enum_symbol_by_value/2, enum_value_by_symbol/2]). +-export(['enum_symbol_by_value_helium.close_state'/1, 'enum_value_by_symbol_helium.close_state'/1]). +-export(['enum_symbol_by_value_helium.blockchain_state_channel_state_v1'/1, 'enum_value_by_symbol_helium.blockchain_state_channel_state_v1'/1]). +-export(['enum_symbol_by_value_packet_pb.packet_type'/1, 'enum_value_by_symbol_packet_pb.packet_type'/1]). +-export(['enum_symbol_by_value_helium.region'/1, 'enum_value_by_symbol_helium.region'/1]). +-export(['enum_symbol_by_value_helium.origin'/1, 'enum_value_by_symbol_helium.origin'/1]). +-export(['enum_symbol_by_value_helium.RegionSpreading'/1, 'enum_value_by_symbol_helium.RegionSpreading'/1]). +-export([get_service_names/0]). +-export([get_service_def/1]). +-export([get_rpc_names/1]). +-export([find_rpc_def/2, fetch_rpc_def/2]). +-export([fqbin_to_service_name/1]). +-export([service_name_to_fqbin/1]). +-export([fqbins_to_service_and_rpc_name/2]). +-export([service_and_rpc_name_to_fqbins/2]). +-export([fqbin_to_msg_name/1]). +-export([msg_name_to_fqbin/1]). +-export([fqbin_to_enum_name/1]). +-export([enum_name_to_fqbin/1]). +-export([get_package_name/0]). +-export([uses_packages/0]). +-export([source_basename/0]). +-export([get_all_source_basenames/0]). +-export([get_all_proto_names/0]). +-export([get_msg_containment/1]). +-export([get_pkg_containment/1]). +-export([get_service_containment/1]). +-export([get_rpc_containment/1]). +-export([get_enum_containment/1]). +-export([get_proto_by_msg_name_as_fqbin/1]). +-export([get_proto_by_service_name_as_fqbin/1]). +-export([get_proto_by_enum_name_as_fqbin/1]). +-export([get_protos_by_pkg_name_as_fqbin/1]). +-export([gpb_version_as_string/0, gpb_version_as_list/0]). + +-include("gateway_miner_client_pb.hrl"). + +%% enumerated types +-type 'helium.close_state'() :: close_state_closable | close_state_closing | close_state_closed | close_state_dispute. +-type 'helium.blockchain_state_channel_state_v1'() :: open | closed. +-type 'packet_pb.packet_type'() :: longfi | lorawan. +-type 'helium.region'() :: 'US915' | 'EU868' | 'EU433' | 'CN470' | 'CN779' | 'AU915' | 'AS923_1' | 'KR920' | 'IN865' | 'AS923_2' | 'AS923_3' | 'AS923_4'. +-type 'helium.origin'() :: p2p | radio. +-type 'helium.RegionSpreading'() :: 'SF_INVALID' | 'SF7' | 'SF8' | 'SF9' | 'SF10' | 'SF11' | 'SF12'. +-export_type(['helium.close_state'/0, 'helium.blockchain_state_channel_state_v1'/0, 'packet_pb.packet_type'/0, 'helium.region'/0, 'helium.origin'/0, 'helium.RegionSpreading'/0]). + +%% message types +-type empty_pb() :: #empty_pb{}. + +-type gateway_success_resp_pb() :: #gateway_success_resp_pb{}. + +-type gateway_error_resp_pb() :: #gateway_error_resp_pb{}. + +-type gateway_config_req_v1_pb() :: #gateway_config_req_v1_pb{}. + +-type gateway_config_resp_v1_pb() :: #gateway_config_resp_v1_pb{}. + +-type gateway_config_update_req_v1_pb() :: #gateway_config_update_req_v1_pb{}. + +-type gateway_config_update_streamed_resp_v1_pb() :: #gateway_config_update_streamed_resp_v1_pb{}. + +-type gateway_validators_req_v1_pb() :: #gateway_validators_req_v1_pb{}. + +-type gateway_validators_resp_v1_pb() :: #gateway_validators_resp_v1_pb{}. + +-type gateway_region_params_streamed_resp_v1_pb() :: #gateway_region_params_streamed_resp_v1_pb{}. + +-type gateway_region_params_update_req_v1_pb() :: #gateway_region_params_update_req_v1_pb{}. + +-type gateway_resp_v1_pb() :: #gateway_resp_v1_pb{}. + +-type gateway_sc_is_active_req_v1_pb() :: #gateway_sc_is_active_req_v1_pb{}. + +-type gateway_sc_is_active_resp_v1_pb() :: #gateway_sc_is_active_resp_v1_pb{}. + +-type gateway_sc_is_overpaid_req_v1_pb() :: #gateway_sc_is_overpaid_req_v1_pb{}. + +-type gateway_sc_is_overpaid_resp_v1_pb() :: #gateway_sc_is_overpaid_resp_v1_pb{}. + +-type gateway_sc_close_req_v1_pb() :: #gateway_sc_close_req_v1_pb{}. + +-type gateway_sc_close_resp_v1_pb() :: #gateway_sc_close_resp_v1_pb{}. + +-type gateway_sc_follow_req_v1_pb() :: #gateway_sc_follow_req_v1_pb{}. + +-type gateway_sc_follow_streamed_resp_v1_pb() :: #gateway_sc_follow_streamed_resp_v1_pb{}. + +-type routing_pb() :: #routing_pb{}. + +-type routing_address_pb() :: #routing_address_pb{}. + +-type gateway_routing_req_v1_pb() :: #gateway_routing_req_v1_pb{}. + +-type gateway_routing_streamed_resp_v1_pb() :: #gateway_routing_streamed_resp_v1_pb{}. + +-type gateway_poc_req_v1_pb() :: #gateway_poc_req_v1_pb{}. + +-type gateway_poc_challenge_notification_resp_v1_pb() :: #gateway_poc_challenge_notification_resp_v1_pb{}. + +-type gateway_poc_check_challenge_target_req_v1_pb() :: #gateway_poc_check_challenge_target_req_v1_pb{}. + +-type gateway_poc_check_challenge_target_resp_v1_pb() :: #gateway_poc_check_challenge_target_resp_v1_pb{}. + +-type gateway_poc_report_req_v1_pb() :: #gateway_poc_report_req_v1_pb{}. + +-type gateway_address_routing_data_req_v1_pb() :: #gateway_address_routing_data_req_v1_pb{}. + +-type gateway_poc_key_routing_data_req_v1_pb() :: #gateway_poc_key_routing_data_req_v1_pb{}. + +-type gateway_public_routing_data_resp_v1_pb() :: #gateway_public_routing_data_resp_v1_pb{}. + +-type blockchain_state_channel_summary_v1_pb() :: #blockchain_state_channel_summary_v1_pb{}. + +-type blockchain_state_channel_v1_pb() :: #blockchain_state_channel_v1_pb{}. + +-type blockchain_state_channel_response_v1_pb() :: #blockchain_state_channel_response_v1_pb{}. + +-type blockchain_state_channel_packet_v1_pb() :: #blockchain_state_channel_packet_v1_pb{}. + +-type blockchain_state_channel_offer_v1_pb() :: #blockchain_state_channel_offer_v1_pb{}. + +-type blockchain_state_channel_purchase_v1_pb() :: #blockchain_state_channel_purchase_v1_pb{}. + +-type blockchain_state_channel_diff_v1_pb() :: #blockchain_state_channel_diff_v1_pb{}. + +-type blockchain_state_channel_diff_entry_v1_pb() :: #blockchain_state_channel_diff_entry_v1_pb{}. + +-type blockchain_state_channel_diff_append_summary_v1_pb() :: #blockchain_state_channel_diff_append_summary_v1_pb{}. + +-type blockchain_state_channel_diff_update_summary_v1_pb() :: #blockchain_state_channel_diff_update_summary_v1_pb{}. + +-type blockchain_state_channel_banner_v1_pb() :: #blockchain_state_channel_banner_v1_pb{}. + +-type blockchain_state_channel_rejection_v1_pb() :: #blockchain_state_channel_rejection_v1_pb{}. + +-type blockchain_state_channel_message_v1_pb() :: #blockchain_state_channel_message_v1_pb{}. + +-type eui_pb() :: #eui_pb{}. + +-type routing_information_pb() :: #routing_information_pb{}. + +-type window_pb() :: #window_pb{}. + +-type packet_pb() :: #packet_pb{}. + +-type blockchain_txn_state_channel_close_v1_pb() :: #blockchain_txn_state_channel_close_v1_pb{}. + +-type blockchain_var_v1_pb() :: #blockchain_var_v1_pb{}. + +-type blockchain_txn_vars_v1_pb() :: #blockchain_txn_vars_v1_pb{}. + +-type blockchain_txn_poc_receipts_v1_pb() :: #blockchain_txn_poc_receipts_v1_pb{}. + +-type blockchain_poc_receipt_v1_pb() :: #blockchain_poc_receipt_v1_pb{}. + +-type blockchain_poc_witness_v1_pb() :: #blockchain_poc_witness_v1_pb{}. + +-type blockchain_poc_response_v1_pb() :: #blockchain_poc_response_v1_pb{}. + +-type blockchain_poc_path_element_v1_pb() :: #blockchain_poc_path_element_v1_pb{}. + +-type blockchain_txn_poc_receipts_v2_pb() :: #blockchain_txn_poc_receipts_v2_pb{}. + +-type blockchain_region_params_v1_pb() :: #blockchain_region_params_v1_pb{}. + +-type tagged_spreading_pb() :: #tagged_spreading_pb{}. + +-type blockchain_region_spreading_v1_pb() :: #blockchain_region_spreading_v1_pb{}. + +-type blockchain_region_param_v1_pb() :: #blockchain_region_param_v1_pb{}. + +-export_type(['empty_pb'/0, 'gateway_success_resp_pb'/0, 'gateway_error_resp_pb'/0, 'gateway_config_req_v1_pb'/0, 'gateway_config_resp_v1_pb'/0, 'gateway_config_update_req_v1_pb'/0, 'gateway_config_update_streamed_resp_v1_pb'/0, 'gateway_validators_req_v1_pb'/0, 'gateway_validators_resp_v1_pb'/0, 'gateway_region_params_streamed_resp_v1_pb'/0, 'gateway_region_params_update_req_v1_pb'/0, 'gateway_resp_v1_pb'/0, 'gateway_sc_is_active_req_v1_pb'/0, 'gateway_sc_is_active_resp_v1_pb'/0, 'gateway_sc_is_overpaid_req_v1_pb'/0, 'gateway_sc_is_overpaid_resp_v1_pb'/0, 'gateway_sc_close_req_v1_pb'/0, 'gateway_sc_close_resp_v1_pb'/0, 'gateway_sc_follow_req_v1_pb'/0, 'gateway_sc_follow_streamed_resp_v1_pb'/0, 'routing_pb'/0, 'routing_address_pb'/0, 'gateway_routing_req_v1_pb'/0, 'gateway_routing_streamed_resp_v1_pb'/0, 'gateway_poc_req_v1_pb'/0, 'gateway_poc_challenge_notification_resp_v1_pb'/0, 'gateway_poc_check_challenge_target_req_v1_pb'/0, 'gateway_poc_check_challenge_target_resp_v1_pb'/0, 'gateway_poc_report_req_v1_pb'/0, 'gateway_address_routing_data_req_v1_pb'/0, 'gateway_poc_key_routing_data_req_v1_pb'/0, 'gateway_public_routing_data_resp_v1_pb'/0, 'blockchain_state_channel_summary_v1_pb'/0, 'blockchain_state_channel_v1_pb'/0, 'blockchain_state_channel_response_v1_pb'/0, 'blockchain_state_channel_packet_v1_pb'/0, 'blockchain_state_channel_offer_v1_pb'/0, 'blockchain_state_channel_purchase_v1_pb'/0, 'blockchain_state_channel_diff_v1_pb'/0, 'blockchain_state_channel_diff_entry_v1_pb'/0, 'blockchain_state_channel_diff_append_summary_v1_pb'/0, 'blockchain_state_channel_diff_update_summary_v1_pb'/0, 'blockchain_state_channel_banner_v1_pb'/0, 'blockchain_state_channel_rejection_v1_pb'/0, 'blockchain_state_channel_message_v1_pb'/0, 'eui_pb'/0, 'routing_information_pb'/0, 'window_pb'/0, 'packet_pb'/0, 'blockchain_txn_state_channel_close_v1_pb'/0, 'blockchain_var_v1_pb'/0, 'blockchain_txn_vars_v1_pb'/0, 'blockchain_txn_poc_receipts_v1_pb'/0, 'blockchain_poc_receipt_v1_pb'/0, 'blockchain_poc_witness_v1_pb'/0, 'blockchain_poc_response_v1_pb'/0, 'blockchain_poc_path_element_v1_pb'/0, 'blockchain_txn_poc_receipts_v2_pb'/0, 'blockchain_region_params_v1_pb'/0, 'tagged_spreading_pb'/0, 'blockchain_region_spreading_v1_pb'/0, 'blockchain_region_param_v1_pb'/0]). + +-spec encode_msg(#empty_pb{} | #gateway_success_resp_pb{} | #gateway_error_resp_pb{} | #gateway_config_req_v1_pb{} | #gateway_config_resp_v1_pb{} | #gateway_config_update_req_v1_pb{} | #gateway_config_update_streamed_resp_v1_pb{} | #gateway_validators_req_v1_pb{} | #gateway_validators_resp_v1_pb{} | #gateway_region_params_streamed_resp_v1_pb{} | #gateway_region_params_update_req_v1_pb{} | #gateway_resp_v1_pb{} | #gateway_sc_is_active_req_v1_pb{} | #gateway_sc_is_active_resp_v1_pb{} | #gateway_sc_is_overpaid_req_v1_pb{} | #gateway_sc_is_overpaid_resp_v1_pb{} | #gateway_sc_close_req_v1_pb{} | #gateway_sc_close_resp_v1_pb{} | #gateway_sc_follow_req_v1_pb{} | #gateway_sc_follow_streamed_resp_v1_pb{} | #routing_pb{} | #routing_address_pb{} | #gateway_routing_req_v1_pb{} | #gateway_routing_streamed_resp_v1_pb{} | #gateway_poc_req_v1_pb{} | #gateway_poc_challenge_notification_resp_v1_pb{} | #gateway_poc_check_challenge_target_req_v1_pb{} | #gateway_poc_check_challenge_target_resp_v1_pb{} | #gateway_poc_report_req_v1_pb{} | #gateway_address_routing_data_req_v1_pb{} | #gateway_poc_key_routing_data_req_v1_pb{} | #gateway_public_routing_data_resp_v1_pb{} | #blockchain_state_channel_summary_v1_pb{} | #blockchain_state_channel_v1_pb{} | #blockchain_state_channel_response_v1_pb{} | #blockchain_state_channel_packet_v1_pb{} | #blockchain_state_channel_offer_v1_pb{} | #blockchain_state_channel_purchase_v1_pb{} | #blockchain_state_channel_diff_v1_pb{} | #blockchain_state_channel_diff_entry_v1_pb{} | #blockchain_state_channel_diff_append_summary_v1_pb{} | #blockchain_state_channel_diff_update_summary_v1_pb{} | #blockchain_state_channel_banner_v1_pb{} | #blockchain_state_channel_rejection_v1_pb{} | #blockchain_state_channel_message_v1_pb{} | #eui_pb{} | #routing_information_pb{} | #window_pb{} | #packet_pb{} | #blockchain_txn_state_channel_close_v1_pb{} | #blockchain_var_v1_pb{} | #blockchain_txn_vars_v1_pb{} | #blockchain_txn_poc_receipts_v1_pb{} | #blockchain_poc_receipt_v1_pb{} | #blockchain_poc_witness_v1_pb{} | #blockchain_poc_response_v1_pb{} | #blockchain_poc_path_element_v1_pb{} | #blockchain_txn_poc_receipts_v2_pb{} | #blockchain_region_params_v1_pb{} | #tagged_spreading_pb{} | #blockchain_region_spreading_v1_pb{} | #blockchain_region_param_v1_pb{}) -> binary(). +encode_msg(Msg) when tuple_size(Msg) >= 1 -> + encode_msg(Msg, element(1, Msg), []). + +-spec encode_msg(#empty_pb{} | #gateway_success_resp_pb{} | #gateway_error_resp_pb{} | #gateway_config_req_v1_pb{} | #gateway_config_resp_v1_pb{} | #gateway_config_update_req_v1_pb{} | #gateway_config_update_streamed_resp_v1_pb{} | #gateway_validators_req_v1_pb{} | #gateway_validators_resp_v1_pb{} | #gateway_region_params_streamed_resp_v1_pb{} | #gateway_region_params_update_req_v1_pb{} | #gateway_resp_v1_pb{} | #gateway_sc_is_active_req_v1_pb{} | #gateway_sc_is_active_resp_v1_pb{} | #gateway_sc_is_overpaid_req_v1_pb{} | #gateway_sc_is_overpaid_resp_v1_pb{} | #gateway_sc_close_req_v1_pb{} | #gateway_sc_close_resp_v1_pb{} | #gateway_sc_follow_req_v1_pb{} | #gateway_sc_follow_streamed_resp_v1_pb{} | #routing_pb{} | #routing_address_pb{} | #gateway_routing_req_v1_pb{} | #gateway_routing_streamed_resp_v1_pb{} | #gateway_poc_req_v1_pb{} | #gateway_poc_challenge_notification_resp_v1_pb{} | #gateway_poc_check_challenge_target_req_v1_pb{} | #gateway_poc_check_challenge_target_resp_v1_pb{} | #gateway_poc_report_req_v1_pb{} | #gateway_address_routing_data_req_v1_pb{} | #gateway_poc_key_routing_data_req_v1_pb{} | #gateway_public_routing_data_resp_v1_pb{} | #blockchain_state_channel_summary_v1_pb{} | #blockchain_state_channel_v1_pb{} | #blockchain_state_channel_response_v1_pb{} | #blockchain_state_channel_packet_v1_pb{} | #blockchain_state_channel_offer_v1_pb{} | #blockchain_state_channel_purchase_v1_pb{} | #blockchain_state_channel_diff_v1_pb{} | #blockchain_state_channel_diff_entry_v1_pb{} | #blockchain_state_channel_diff_append_summary_v1_pb{} | #blockchain_state_channel_diff_update_summary_v1_pb{} | #blockchain_state_channel_banner_v1_pb{} | #blockchain_state_channel_rejection_v1_pb{} | #blockchain_state_channel_message_v1_pb{} | #eui_pb{} | #routing_information_pb{} | #window_pb{} | #packet_pb{} | #blockchain_txn_state_channel_close_v1_pb{} | #blockchain_var_v1_pb{} | #blockchain_txn_vars_v1_pb{} | #blockchain_txn_poc_receipts_v1_pb{} | #blockchain_poc_receipt_v1_pb{} | #blockchain_poc_witness_v1_pb{} | #blockchain_poc_response_v1_pb{} | #blockchain_poc_path_element_v1_pb{} | #blockchain_txn_poc_receipts_v2_pb{} | #blockchain_region_params_v1_pb{} | #tagged_spreading_pb{} | #blockchain_region_spreading_v1_pb{} | #blockchain_region_param_v1_pb{}, atom() | list()) -> binary(). +encode_msg(Msg, MsgName) when is_atom(MsgName) -> + encode_msg(Msg, MsgName, []); +encode_msg(Msg, Opts) + when tuple_size(Msg) >= 1, is_list(Opts) -> + encode_msg(Msg, element(1, Msg), Opts). + +-spec encode_msg(#empty_pb{} | #gateway_success_resp_pb{} | #gateway_error_resp_pb{} | #gateway_config_req_v1_pb{} | #gateway_config_resp_v1_pb{} | #gateway_config_update_req_v1_pb{} | #gateway_config_update_streamed_resp_v1_pb{} | #gateway_validators_req_v1_pb{} | #gateway_validators_resp_v1_pb{} | #gateway_region_params_streamed_resp_v1_pb{} | #gateway_region_params_update_req_v1_pb{} | #gateway_resp_v1_pb{} | #gateway_sc_is_active_req_v1_pb{} | #gateway_sc_is_active_resp_v1_pb{} | #gateway_sc_is_overpaid_req_v1_pb{} | #gateway_sc_is_overpaid_resp_v1_pb{} | #gateway_sc_close_req_v1_pb{} | #gateway_sc_close_resp_v1_pb{} | #gateway_sc_follow_req_v1_pb{} | #gateway_sc_follow_streamed_resp_v1_pb{} | #routing_pb{} | #routing_address_pb{} | #gateway_routing_req_v1_pb{} | #gateway_routing_streamed_resp_v1_pb{} | #gateway_poc_req_v1_pb{} | #gateway_poc_challenge_notification_resp_v1_pb{} | #gateway_poc_check_challenge_target_req_v1_pb{} | #gateway_poc_check_challenge_target_resp_v1_pb{} | #gateway_poc_report_req_v1_pb{} | #gateway_address_routing_data_req_v1_pb{} | #gateway_poc_key_routing_data_req_v1_pb{} | #gateway_public_routing_data_resp_v1_pb{} | #blockchain_state_channel_summary_v1_pb{} | #blockchain_state_channel_v1_pb{} | #blockchain_state_channel_response_v1_pb{} | #blockchain_state_channel_packet_v1_pb{} | #blockchain_state_channel_offer_v1_pb{} | #blockchain_state_channel_purchase_v1_pb{} | #blockchain_state_channel_diff_v1_pb{} | #blockchain_state_channel_diff_entry_v1_pb{} | #blockchain_state_channel_diff_append_summary_v1_pb{} | #blockchain_state_channel_diff_update_summary_v1_pb{} | #blockchain_state_channel_banner_v1_pb{} | #blockchain_state_channel_rejection_v1_pb{} | #blockchain_state_channel_message_v1_pb{} | #eui_pb{} | #routing_information_pb{} | #window_pb{} | #packet_pb{} | #blockchain_txn_state_channel_close_v1_pb{} | #blockchain_var_v1_pb{} | #blockchain_txn_vars_v1_pb{} | #blockchain_txn_poc_receipts_v1_pb{} | #blockchain_poc_receipt_v1_pb{} | #blockchain_poc_witness_v1_pb{} | #blockchain_poc_response_v1_pb{} | #blockchain_poc_path_element_v1_pb{} | #blockchain_txn_poc_receipts_v2_pb{} | #blockchain_region_params_v1_pb{} | #tagged_spreading_pb{} | #blockchain_region_spreading_v1_pb{} | #blockchain_region_param_v1_pb{}, atom(), list()) -> binary(). +encode_msg(Msg, MsgName, Opts) -> + case proplists:get_bool(verify, Opts) of + true -> verify_msg(Msg, MsgName, Opts); + false -> ok + end, + TrUserData = proplists:get_value(user_data, Opts), + case MsgName of + empty_pb -> + encode_msg_empty_pb(id(Msg, TrUserData), TrUserData); + gateway_success_resp_pb -> + encode_msg_gateway_success_resp_pb(id(Msg, TrUserData), + TrUserData); + gateway_error_resp_pb -> + encode_msg_gateway_error_resp_pb(id(Msg, TrUserData), + TrUserData); + gateway_config_req_v1_pb -> + encode_msg_gateway_config_req_v1_pb(id(Msg, TrUserData), + TrUserData); + gateway_config_resp_v1_pb -> + encode_msg_gateway_config_resp_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_config_update_req_v1_pb -> + encode_msg_gateway_config_update_req_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_config_update_streamed_resp_v1_pb -> + encode_msg_gateway_config_update_streamed_resp_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_validators_req_v1_pb -> + encode_msg_gateway_validators_req_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_validators_resp_v1_pb -> + encode_msg_gateway_validators_resp_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_region_params_streamed_resp_v1_pb -> + encode_msg_gateway_region_params_streamed_resp_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_region_params_update_req_v1_pb -> + encode_msg_gateway_region_params_update_req_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_resp_v1_pb -> + encode_msg_gateway_resp_v1_pb(id(Msg, TrUserData), + TrUserData); + gateway_sc_is_active_req_v1_pb -> + encode_msg_gateway_sc_is_active_req_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_sc_is_active_resp_v1_pb -> + encode_msg_gateway_sc_is_active_resp_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_sc_is_overpaid_req_v1_pb -> + encode_msg_gateway_sc_is_overpaid_req_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_sc_is_overpaid_resp_v1_pb -> + encode_msg_gateway_sc_is_overpaid_resp_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_sc_close_req_v1_pb -> + encode_msg_gateway_sc_close_req_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_sc_close_resp_v1_pb -> + encode_msg_gateway_sc_close_resp_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_sc_follow_req_v1_pb -> + encode_msg_gateway_sc_follow_req_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_sc_follow_streamed_resp_v1_pb -> + encode_msg_gateway_sc_follow_streamed_resp_v1_pb(id(Msg, + TrUserData), + TrUserData); + routing_pb -> + encode_msg_routing_pb(id(Msg, TrUserData), TrUserData); + routing_address_pb -> + encode_msg_routing_address_pb(id(Msg, TrUserData), + TrUserData); + gateway_routing_req_v1_pb -> + encode_msg_gateway_routing_req_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_routing_streamed_resp_v1_pb -> + encode_msg_gateway_routing_streamed_resp_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_poc_req_v1_pb -> + encode_msg_gateway_poc_req_v1_pb(id(Msg, TrUserData), + TrUserData); + gateway_poc_challenge_notification_resp_v1_pb -> + encode_msg_gateway_poc_challenge_notification_resp_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_poc_check_challenge_target_req_v1_pb -> + encode_msg_gateway_poc_check_challenge_target_req_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_poc_check_challenge_target_resp_v1_pb -> + encode_msg_gateway_poc_check_challenge_target_resp_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_poc_report_req_v1_pb -> + encode_msg_gateway_poc_report_req_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_address_routing_data_req_v1_pb -> + encode_msg_gateway_address_routing_data_req_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_poc_key_routing_data_req_v1_pb -> + encode_msg_gateway_poc_key_routing_data_req_v1_pb(id(Msg, + TrUserData), + TrUserData); + gateway_public_routing_data_resp_v1_pb -> + encode_msg_gateway_public_routing_data_resp_v1_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_state_channel_summary_v1_pb -> + encode_msg_blockchain_state_channel_summary_v1_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_state_channel_v1_pb -> + encode_msg_blockchain_state_channel_v1_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_state_channel_response_v1_pb -> + encode_msg_blockchain_state_channel_response_v1_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_state_channel_packet_v1_pb -> + encode_msg_blockchain_state_channel_packet_v1_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_state_channel_offer_v1_pb -> + encode_msg_blockchain_state_channel_offer_v1_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_state_channel_purchase_v1_pb -> + encode_msg_blockchain_state_channel_purchase_v1_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_state_channel_diff_v1_pb -> + encode_msg_blockchain_state_channel_diff_v1_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_state_channel_diff_entry_v1_pb -> + encode_msg_blockchain_state_channel_diff_entry_v1_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_state_channel_diff_append_summary_v1_pb -> + encode_msg_blockchain_state_channel_diff_append_summary_v1_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_state_channel_diff_update_summary_v1_pb -> + encode_msg_blockchain_state_channel_diff_update_summary_v1_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_state_channel_banner_v1_pb -> + encode_msg_blockchain_state_channel_banner_v1_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_state_channel_rejection_v1_pb -> + encode_msg_blockchain_state_channel_rejection_v1_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_state_channel_message_v1_pb -> + encode_msg_blockchain_state_channel_message_v1_pb(id(Msg, + TrUserData), + TrUserData); + eui_pb -> + encode_msg_eui_pb(id(Msg, TrUserData), TrUserData); + routing_information_pb -> + encode_msg_routing_information_pb(id(Msg, TrUserData), + TrUserData); + window_pb -> + encode_msg_window_pb(id(Msg, TrUserData), TrUserData); + packet_pb -> + encode_msg_packet_pb(id(Msg, TrUserData), TrUserData); + blockchain_txn_state_channel_close_v1_pb -> + encode_msg_blockchain_txn_state_channel_close_v1_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_var_v1_pb -> + encode_msg_blockchain_var_v1_pb(id(Msg, TrUserData), + TrUserData); + blockchain_txn_vars_v1_pb -> + encode_msg_blockchain_txn_vars_v1_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_txn_poc_receipts_v1_pb -> + encode_msg_blockchain_txn_poc_receipts_v1_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_poc_receipt_v1_pb -> + encode_msg_blockchain_poc_receipt_v1_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_poc_witness_v1_pb -> + encode_msg_blockchain_poc_witness_v1_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_poc_response_v1_pb -> + encode_msg_blockchain_poc_response_v1_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_poc_path_element_v1_pb -> + encode_msg_blockchain_poc_path_element_v1_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_txn_poc_receipts_v2_pb -> + encode_msg_blockchain_txn_poc_receipts_v2_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_region_params_v1_pb -> + encode_msg_blockchain_region_params_v1_pb(id(Msg, + TrUserData), + TrUserData); + tagged_spreading_pb -> + encode_msg_tagged_spreading_pb(id(Msg, TrUserData), + TrUserData); + blockchain_region_spreading_v1_pb -> + encode_msg_blockchain_region_spreading_v1_pb(id(Msg, + TrUserData), + TrUserData); + blockchain_region_param_v1_pb -> + encode_msg_blockchain_region_param_v1_pb(id(Msg, + TrUserData), + TrUserData) + end. + + +encode_msg_empty_pb(_Msg, _TrUserData) -> <<>>. + +encode_msg_gateway_success_resp_pb(Msg, TrUserData) -> + encode_msg_gateway_success_resp_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_success_resp_pb(#gateway_success_resp_pb{resp + = F1, + details = F2}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end. + +encode_msg_gateway_error_resp_pb(Msg, TrUserData) -> + encode_msg_gateway_error_resp_pb(Msg, <<>>, TrUserData). + + +encode_msg_gateway_error_resp_pb(#gateway_error_resp_pb{error + = F1, + details = F2}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end. + +encode_msg_gateway_config_req_v1_pb(Msg, TrUserData) -> + encode_msg_gateway_config_req_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_config_req_v1_pb(#gateway_config_req_v1_pb{keys + = F1}, + Bin, TrUserData) -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 == [] -> Bin; + true -> + e_field_gateway_config_req_v1_pb_keys(TrF1, + Bin, + TrUserData) + end + end. + +encode_msg_gateway_config_resp_v1_pb(Msg, TrUserData) -> + encode_msg_gateway_config_resp_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_config_resp_v1_pb(#gateway_config_resp_v1_pb{result + = F1}, + Bin, TrUserData) -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 == [] -> Bin; + true -> + e_field_gateway_config_resp_v1_pb_result(TrF1, + Bin, + TrUserData) + end + end. + +encode_msg_gateway_config_update_req_v1_pb(_Msg, + _TrUserData) -> + <<>>. + +encode_msg_gateway_config_update_streamed_resp_v1_pb(Msg, + TrUserData) -> + encode_msg_gateway_config_update_streamed_resp_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_config_update_streamed_resp_v1_pb(#gateway_config_update_streamed_resp_v1_pb{keys + = + F1}, + Bin, TrUserData) -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 == [] -> Bin; + true -> + e_field_gateway_config_update_streamed_resp_v1_pb_keys(TrF1, + Bin, + TrUserData) + end + end. + +encode_msg_gateway_validators_req_v1_pb(Msg, + TrUserData) -> + encode_msg_gateway_validators_req_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_validators_req_v1_pb(#gateway_validators_req_v1_pb{quantity + = F1}, + Bin, TrUserData) -> + if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= 0 -> Bin; + true -> e_varint(TrF1, <>, TrUserData) + end + end + end. + +encode_msg_gateway_validators_resp_v1_pb(Msg, + TrUserData) -> + encode_msg_gateway_validators_resp_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_validators_resp_v1_pb(#gateway_validators_resp_v1_pb{result + = + F1}, + Bin, TrUserData) -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 == [] -> Bin; + true -> + e_field_gateway_validators_resp_v1_pb_result(TrF1, + Bin, + TrUserData) + end + end. + +encode_msg_gateway_region_params_streamed_resp_v1_pb(Msg, + TrUserData) -> + encode_msg_gateway_region_params_streamed_resp_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_region_params_streamed_resp_v1_pb(#gateway_region_params_streamed_resp_v1_pb{address + = + F1, + region + = + F2, + params + = + F3}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= 'US915'; TrF2 =:= 0 -> B1; + true -> + 'e_enum_helium.region'(TrF2, + <>, + TrUserData) + end + end + end, + if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + if TrF3 =:= undefined -> B2; + true -> + e_mfield_gateway_region_params_streamed_resp_v1_pb_params(TrF3, + <>, + TrUserData) + end + end + end. + +encode_msg_gateway_region_params_update_req_v1_pb(Msg, + TrUserData) -> + encode_msg_gateway_region_params_update_req_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_region_params_update_req_v1_pb(#gateway_region_params_update_req_v1_pb{address + = + F1, + signature + = + F2}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end. + +encode_msg_gateway_resp_v1_pb(Msg, TrUserData) -> + encode_msg_gateway_resp_v1_pb(Msg, <<>>, TrUserData). + + +encode_msg_gateway_resp_v1_pb(#gateway_resp_v1_pb{height + = F1, + signature = F2, msg = F3, + block_time = F4, + block_age = F5}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= 0 -> Bin; + true -> e_varint(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end, + B3 = if F3 =:= undefined -> B2; + true -> + case id(F3, TrUserData) of + {is_active_resp, TF3} -> + begin + TrTF3 = id(TF3, TrUserData), + e_mfield_gateway_resp_v1_pb_is_active_resp(TrTF3, + <>, + TrUserData) + end; + {is_overpaid_resp, TF3} -> + begin + TrTF3 = id(TF3, TrUserData), + e_mfield_gateway_resp_v1_pb_is_overpaid_resp(TrTF3, + <>, + TrUserData) + end; + {close_resp, TF3} -> + begin + TrTF3 = id(TF3, TrUserData), + e_mfield_gateway_resp_v1_pb_close_resp(TrTF3, + <>, + TrUserData) + end; + {follow_streamed_resp, TF3} -> + begin + TrTF3 = id(TF3, TrUserData), + e_mfield_gateway_resp_v1_pb_follow_streamed_resp(TrTF3, + <>, + TrUserData) + end; + {routing_streamed_resp, TF3} -> + begin + TrTF3 = id(TF3, TrUserData), + e_mfield_gateway_resp_v1_pb_routing_streamed_resp(TrTF3, + <>, + TrUserData) + end; + {config_resp, TF3} -> + begin + TrTF3 = id(TF3, TrUserData), + e_mfield_gateway_resp_v1_pb_config_resp(TrTF3, + <>, + TrUserData) + end; + {config_update_streamed_resp, TF3} -> + begin + TrTF3 = id(TF3, TrUserData), + e_mfield_gateway_resp_v1_pb_config_update_streamed_resp(TrTF3, + <>, + TrUserData) + end; + {validators_resp, TF3} -> + begin + TrTF3 = id(TF3, TrUserData), + e_mfield_gateway_resp_v1_pb_validators_resp(TrTF3, + <>, + TrUserData) + end; + {region_params_streamed_resp, TF3} -> + begin + TrTF3 = id(TF3, TrUserData), + e_mfield_gateway_resp_v1_pb_region_params_streamed_resp(TrTF3, + <>, + TrUserData) + end; + {success_resp, TF3} -> + begin + TrTF3 = id(TF3, TrUserData), + e_mfield_gateway_resp_v1_pb_success_resp(TrTF3, + <>, + TrUserData) + end; + {error_resp, TF3} -> + begin + TrTF3 = id(TF3, TrUserData), + e_mfield_gateway_resp_v1_pb_error_resp(TrTF3, + <>, + TrUserData) + end; + {poc_challenge_resp, TF3} -> + begin + TrTF3 = id(TF3, TrUserData), + e_mfield_gateway_resp_v1_pb_poc_challenge_resp(TrTF3, + <>, + TrUserData) + end; + {poc_check_target_resp, TF3} -> + begin + TrTF3 = id(TF3, TrUserData), + e_mfield_gateway_resp_v1_pb_poc_check_target_resp(TrTF3, + <>, + TrUserData) + end; + {public_route, TF3} -> + begin + TrTF3 = id(TF3, TrUserData), + e_mfield_gateway_resp_v1_pb_public_route(TrTF3, + <>, + TrUserData) + end + end + end, + B4 = if F4 == undefined -> B3; + true -> + begin + TrF4 = id(F4, TrUserData), + if TrF4 =:= 0 -> B3; + true -> e_varint(TrF4, <>, TrUserData) + end + end + end, + if F5 == undefined -> B4; + true -> + begin + TrF5 = id(F5, TrUserData), + if TrF5 =:= 0 -> B4; + true -> e_varint(TrF5, <>, TrUserData) + end + end + end. + +encode_msg_gateway_sc_is_active_req_v1_pb(Msg, + TrUserData) -> + encode_msg_gateway_sc_is_active_req_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_sc_is_active_req_v1_pb(#gateway_sc_is_active_req_v1_pb{sc_id + = + F1, + sc_owner + = + F2}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end. + +encode_msg_gateway_sc_is_active_resp_v1_pb(Msg, + TrUserData) -> + encode_msg_gateway_sc_is_active_resp_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_sc_is_active_resp_v1_pb(#gateway_sc_is_active_resp_v1_pb{sc_id + = + F1, + sc_owner + = + F2, + active + = + F3, + sc_expiry_at_block + = + F4, + sc_original_dc_amount + = + F5}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end, + B3 = if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + if TrF3 =:= false -> B2; + true -> e_type_bool(TrF3, <>, TrUserData) + end + end + end, + B4 = if F4 == undefined -> B3; + true -> + begin + TrF4 = id(F4, TrUserData), + if TrF4 =:= 0 -> B3; + true -> e_varint(TrF4, <>, TrUserData) + end + end + end, + if F5 == undefined -> B4; + true -> + begin + TrF5 = id(F5, TrUserData), + if TrF5 =:= 0 -> B4; + true -> e_varint(TrF5, <>, TrUserData) + end + end + end. + +encode_msg_gateway_sc_is_overpaid_req_v1_pb(Msg, + TrUserData) -> + encode_msg_gateway_sc_is_overpaid_req_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_sc_is_overpaid_req_v1_pb(#gateway_sc_is_overpaid_req_v1_pb{sc_id + = + F1, + sc_owner + = + F2, + total_dcs + = + F3}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end, + if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + if TrF3 =:= 0 -> B2; + true -> e_varint(TrF3, <>, TrUserData) + end + end + end. + +encode_msg_gateway_sc_is_overpaid_resp_v1_pb(Msg, + TrUserData) -> + encode_msg_gateway_sc_is_overpaid_resp_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_sc_is_overpaid_resp_v1_pb(#gateway_sc_is_overpaid_resp_v1_pb{sc_id + = + F1, + sc_owner + = + F2, + overpaid + = + F3}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end, + if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + if TrF3 =:= false -> B2; + true -> e_type_bool(TrF3, <>, TrUserData) + end + end + end. + +encode_msg_gateway_sc_close_req_v1_pb(Msg, + TrUserData) -> + encode_msg_gateway_sc_close_req_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_sc_close_req_v1_pb(#gateway_sc_close_req_v1_pb{close_txn + = F1}, + Bin, TrUserData) -> + if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= undefined -> Bin; + true -> + e_mfield_gateway_sc_close_req_v1_pb_close_txn(TrF1, + <>, + TrUserData) + end + end + end. + +encode_msg_gateway_sc_close_resp_v1_pb(Msg, + TrUserData) -> + encode_msg_gateway_sc_close_resp_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_sc_close_resp_v1_pb(#gateway_sc_close_resp_v1_pb{sc_id + = F1, + response = + F2}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end. + +encode_msg_gateway_sc_follow_req_v1_pb(Msg, + TrUserData) -> + encode_msg_gateway_sc_follow_req_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_sc_follow_req_v1_pb(#gateway_sc_follow_req_v1_pb{sc_id + = F1, + sc_owner = + F2}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end. + +encode_msg_gateway_sc_follow_streamed_resp_v1_pb(Msg, + TrUserData) -> + encode_msg_gateway_sc_follow_streamed_resp_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_sc_follow_streamed_resp_v1_pb(#gateway_sc_follow_streamed_resp_v1_pb{sc_id + = + F1, + sc_owner + = + F2, + close_state + = + F3}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end, + if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + if TrF3 =:= close_state_closable; TrF3 =:= 0 -> B2; + true -> + 'e_enum_helium.close_state'(TrF3, + <>, + TrUserData) + end + end + end. + +encode_msg_routing_pb(Msg, TrUserData) -> + encode_msg_routing_pb(Msg, <<>>, TrUserData). + + +encode_msg_routing_pb(#routing_pb{oui = F1, owner = F2, + addresses = F3, filters = F4, subnets = F5}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= 0 -> Bin; + true -> e_varint(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end, + B3 = begin + TrF3 = id(F3, TrUserData), + if TrF3 == [] -> B2; + true -> + e_field_routing_pb_addresses(TrF3, B2, TrUserData) + end + end, + B4 = begin + TrF4 = id(F4, TrUserData), + if TrF4 == [] -> B3; + true -> e_field_routing_pb_filters(TrF4, B3, TrUserData) + end + end, + begin + TrF5 = id(F5, TrUserData), + if TrF5 == [] -> B4; + true -> e_field_routing_pb_subnets(TrF5, B4, TrUserData) + end + end. + +encode_msg_routing_address_pb(Msg, TrUserData) -> + encode_msg_routing_address_pb(Msg, <<>>, TrUserData). + + +encode_msg_routing_address_pb(#routing_address_pb{pub_key + = F1, + uri = F2}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end. + +encode_msg_gateway_routing_req_v1_pb(Msg, TrUserData) -> + encode_msg_gateway_routing_req_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_routing_req_v1_pb(#gateway_routing_req_v1_pb{height + = F1}, + Bin, TrUserData) -> + if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= 0 -> Bin; + true -> e_varint(TrF1, <>, TrUserData) + end + end + end. + +encode_msg_gateway_routing_streamed_resp_v1_pb(Msg, + TrUserData) -> + encode_msg_gateway_routing_streamed_resp_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_routing_streamed_resp_v1_pb(#gateway_routing_streamed_resp_v1_pb{routings + = + F1}, + Bin, TrUserData) -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 == [] -> Bin; + true -> + e_field_gateway_routing_streamed_resp_v1_pb_routings(TrF1, + Bin, + TrUserData) + end + end. + +encode_msg_gateway_poc_req_v1_pb(Msg, TrUserData) -> + encode_msg_gateway_poc_req_v1_pb(Msg, <<>>, TrUserData). + + +encode_msg_gateway_poc_req_v1_pb(#gateway_poc_req_v1_pb{address + = F1, + signature = F2}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end. + +encode_msg_gateway_poc_challenge_notification_resp_v1_pb(Msg, + TrUserData) -> + encode_msg_gateway_poc_challenge_notification_resp_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_poc_challenge_notification_resp_v1_pb(#gateway_poc_challenge_notification_resp_v1_pb{challenger + = + F1, + block_hash + = + F2, + onion_key_hash + = + F3}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= undefined -> Bin; + true -> + e_mfield_gateway_poc_challenge_notification_resp_v1_pb_challenger(TrF1, + <>, + TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end, + if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + case iolist_size(TrF3) of + 0 -> B2; + _ -> e_type_bytes(TrF3, <>, TrUserData) + end + end + end. + +encode_msg_gateway_poc_check_challenge_target_req_v1_pb(Msg, + TrUserData) -> + encode_msg_gateway_poc_check_challenge_target_req_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_poc_check_challenge_target_req_v1_pb(#gateway_poc_check_challenge_target_req_v1_pb{address + = + F1, + challenger + = + F2, + block_hash + = + F3, + onion_key_hash + = + F4, + height + = + F5, + notifier + = + F6, + notifier_sig + = + F7, + challengee_sig + = + F8}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end, + B3 = if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + case iolist_size(TrF3) of + 0 -> B2; + _ -> e_type_bytes(TrF3, <>, TrUserData) + end + end + end, + B4 = if F4 == undefined -> B3; + true -> + begin + TrF4 = id(F4, TrUserData), + case iolist_size(TrF4) of + 0 -> B3; + _ -> e_type_bytes(TrF4, <>, TrUserData) + end + end + end, + B5 = if F5 == undefined -> B4; + true -> + begin + TrF5 = id(F5, TrUserData), + if TrF5 =:= 0 -> B4; + true -> e_varint(TrF5, <>, TrUserData) + end + end + end, + B6 = if F6 == undefined -> B5; + true -> + begin + TrF6 = id(F6, TrUserData), + case iolist_size(TrF6) of + 0 -> B5; + _ -> e_type_bytes(TrF6, <>, TrUserData) + end + end + end, + B7 = if F7 == undefined -> B6; + true -> + begin + TrF7 = id(F7, TrUserData), + case iolist_size(TrF7) of + 0 -> B6; + _ -> e_type_bytes(TrF7, <>, TrUserData) + end + end + end, + if F8 == undefined -> B7; + true -> + begin + TrF8 = id(F8, TrUserData), + case iolist_size(TrF8) of + 0 -> B7; + _ -> e_type_bytes(TrF8, <>, TrUserData) + end + end + end. + +encode_msg_gateway_poc_check_challenge_target_resp_v1_pb(Msg, + TrUserData) -> + encode_msg_gateway_poc_check_challenge_target_resp_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_poc_check_challenge_target_resp_v1_pb(#gateway_poc_check_challenge_target_resp_v1_pb{target + = + F1, + onion + = + F2}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= false -> Bin; + true -> e_type_bool(TrF1, <>, TrUserData) + end + end + end, + if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end. + +encode_msg_gateway_poc_report_req_v1_pb(Msg, + TrUserData) -> + encode_msg_gateway_poc_report_req_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_poc_report_req_v1_pb(#gateway_poc_report_req_v1_pb{onion_key_hash + = F1, + msg = F2}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + if F2 =:= undefined -> B1; + true -> + case id(F2, TrUserData) of + {receipt, TF2} -> + begin + TrTF2 = id(TF2, TrUserData), + e_mfield_gateway_poc_report_req_v1_pb_receipt(TrTF2, + <>, + TrUserData) + end; + {witness, TF2} -> + begin + TrTF2 = id(TF2, TrUserData), + e_mfield_gateway_poc_report_req_v1_pb_witness(TrTF2, + <>, + TrUserData) + end + end + end. + +encode_msg_gateway_address_routing_data_req_v1_pb(Msg, + TrUserData) -> + encode_msg_gateway_address_routing_data_req_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_address_routing_data_req_v1_pb(#gateway_address_routing_data_req_v1_pb{address + = + F1}, + Bin, TrUserData) -> + if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end. + +encode_msg_gateway_poc_key_routing_data_req_v1_pb(Msg, + TrUserData) -> + encode_msg_gateway_poc_key_routing_data_req_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_poc_key_routing_data_req_v1_pb(#gateway_poc_key_routing_data_req_v1_pb{key + = + F1}, + Bin, TrUserData) -> + if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end. + +encode_msg_gateway_public_routing_data_resp_v1_pb(Msg, + TrUserData) -> + encode_msg_gateway_public_routing_data_resp_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_gateway_public_routing_data_resp_v1_pb(#gateway_public_routing_data_resp_v1_pb{address + = + F1, + public_uri + = + F2}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= undefined -> B1; + true -> + e_mfield_gateway_public_routing_data_resp_v1_pb_public_uri(TrF2, + <>, + TrUserData) + end + end + end. + +encode_msg_blockchain_state_channel_summary_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_state_channel_summary_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_state_channel_summary_v1_pb(#blockchain_state_channel_summary_v1_pb{client_pubkeybin + = + F1, + num_packets + = + F2, + num_dcs + = + F3}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= 0 -> B1; + true -> e_varint(TrF2, <>, TrUserData) + end + end + end, + if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + if TrF3 =:= 0 -> B2; + true -> e_varint(TrF3, <>, TrUserData) + end + end + end. + +encode_msg_blockchain_state_channel_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_state_channel_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_state_channel_v1_pb(#blockchain_state_channel_v1_pb{id + = + F1, + owner + = + F2, + credits + = + F3, + nonce + = + F4, + summaries + = + F5, + root_hash + = + F6, + skewed + = + F7, + state + = + F8, + expire_at_block + = + F9, + signature + = + F10}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end, + B3 = if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + if TrF3 =:= 0 -> B2; + true -> e_varint(TrF3, <>, TrUserData) + end + end + end, + B4 = if F4 == undefined -> B3; + true -> + begin + TrF4 = id(F4, TrUserData), + if TrF4 =:= 0 -> B3; + true -> e_varint(TrF4, <>, TrUserData) + end + end + end, + B5 = begin + TrF5 = id(F5, TrUserData), + if TrF5 == [] -> B4; + true -> + e_field_blockchain_state_channel_v1_pb_summaries(TrF5, + B4, + TrUserData) + end + end, + B6 = if F6 == undefined -> B5; + true -> + begin + TrF6 = id(F6, TrUserData), + case iolist_size(TrF6) of + 0 -> B5; + _ -> e_type_bytes(TrF6, <>, TrUserData) + end + end + end, + B7 = if F7 == undefined -> B6; + true -> + begin + TrF7 = id(F7, TrUserData), + case iolist_size(TrF7) of + 0 -> B6; + _ -> e_type_bytes(TrF7, <>, TrUserData) + end + end + end, + B8 = if F8 == undefined -> B7; + true -> + begin + TrF8 = id(F8, TrUserData), + if TrF8 =:= open; TrF8 =:= 0 -> B7; + true -> + 'e_enum_helium.blockchain_state_channel_state_v1'(TrF8, + <>, + TrUserData) + end + end + end, + B9 = if F9 == undefined -> B8; + true -> + begin + TrF9 = id(F9, TrUserData), + if TrF9 =:= 0 -> B8; + true -> e_varint(TrF9, <>, TrUserData) + end + end + end, + if F10 == undefined -> B9; + true -> + begin + TrF10 = id(F10, TrUserData), + case iolist_size(TrF10) of + 0 -> B9; + _ -> e_type_bytes(TrF10, <>, TrUserData) + end + end + end. + +encode_msg_blockchain_state_channel_response_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_state_channel_response_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_state_channel_response_v1_pb(#blockchain_state_channel_response_v1_pb{accepted + = + F1, + downlink + = + F2}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= false -> Bin; + true -> e_type_bool(TrF1, <>, TrUserData) + end + end + end, + if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= undefined -> B1; + true -> + e_mfield_blockchain_state_channel_response_v1_pb_downlink(TrF2, + <>, + TrUserData) + end + end + end. + +encode_msg_blockchain_state_channel_packet_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_state_channel_packet_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_state_channel_packet_v1_pb(#blockchain_state_channel_packet_v1_pb{packet + = + F1, + hotspot + = + F2, + signature + = + F3, + region + = + F4, + hold_time + = + F5}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= undefined -> Bin; + true -> + e_mfield_blockchain_state_channel_packet_v1_pb_packet(TrF1, + <>, + TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end, + B3 = if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + case iolist_size(TrF3) of + 0 -> B2; + _ -> e_type_bytes(TrF3, <>, TrUserData) + end + end + end, + B4 = if F4 == undefined -> B3; + true -> + begin + TrF4 = id(F4, TrUserData), + if TrF4 =:= 'US915'; TrF4 =:= 0 -> B3; + true -> + 'e_enum_helium.region'(TrF4, + <>, + TrUserData) + end + end + end, + if F5 == undefined -> B4; + true -> + begin + TrF5 = id(F5, TrUserData), + if TrF5 =:= 0 -> B4; + true -> e_varint(TrF5, <>, TrUserData) + end + end + end. + +encode_msg_blockchain_state_channel_offer_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_state_channel_offer_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_state_channel_offer_v1_pb(#blockchain_state_channel_offer_v1_pb{routing + = + F1, + packet_hash + = + F2, + payload_size + = + F3, + fcnt + = + F4, + hotspot + = + F5, + signature + = + F6, + region + = + F7, + req_diff + = + F8}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= undefined -> Bin; + true -> + e_mfield_blockchain_state_channel_offer_v1_pb_routing(TrF1, + <>, + TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end, + B3 = if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + if TrF3 =:= 0 -> B2; + true -> e_varint(TrF3, <>, TrUserData) + end + end + end, + B4 = if F4 == undefined -> B3; + true -> + begin + TrF4 = id(F4, TrUserData), + if TrF4 =:= 0 -> B3; + true -> e_varint(TrF4, <>, TrUserData) + end + end + end, + B5 = if F5 == undefined -> B4; + true -> + begin + TrF5 = id(F5, TrUserData), + case iolist_size(TrF5) of + 0 -> B4; + _ -> e_type_bytes(TrF5, <>, TrUserData) + end + end + end, + B6 = if F6 == undefined -> B5; + true -> + begin + TrF6 = id(F6, TrUserData), + case iolist_size(TrF6) of + 0 -> B5; + _ -> e_type_bytes(TrF6, <>, TrUserData) + end + end + end, + B7 = if F7 == undefined -> B6; + true -> + begin + TrF7 = id(F7, TrUserData), + if TrF7 =:= 'US915'; TrF7 =:= 0 -> B6; + true -> + 'e_enum_helium.region'(TrF7, + <>, + TrUserData) + end + end + end, + if F8 == undefined -> B7; + true -> + begin + TrF8 = id(F8, TrUserData), + if TrF8 =:= false -> B7; + true -> e_type_bool(TrF8, <>, TrUserData) + end + end + end. + +encode_msg_blockchain_state_channel_purchase_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_state_channel_purchase_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_state_channel_purchase_v1_pb(#blockchain_state_channel_purchase_v1_pb{sc + = + F1, + hotspot + = + F2, + packet_hash + = + F3, + region + = + F4, + sc_diff + = + F5}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= undefined -> Bin; + true -> + e_mfield_blockchain_state_channel_purchase_v1_pb_sc(TrF1, + <>, + TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end, + B3 = if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + case iolist_size(TrF3) of + 0 -> B2; + _ -> e_type_bytes(TrF3, <>, TrUserData) + end + end + end, + B4 = if F4 == undefined -> B3; + true -> + begin + TrF4 = id(F4, TrUserData), + if TrF4 =:= 'US915'; TrF4 =:= 0 -> B3; + true -> + 'e_enum_helium.region'(TrF4, + <>, + TrUserData) + end + end + end, + if F5 == undefined -> B4; + true -> + begin + TrF5 = id(F5, TrUserData), + if TrF5 =:= undefined -> B4; + true -> + e_mfield_blockchain_state_channel_purchase_v1_pb_sc_diff(TrF5, + <>, + TrUserData) + end + end + end. + +encode_msg_blockchain_state_channel_diff_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_state_channel_diff_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_state_channel_diff_v1_pb(#blockchain_state_channel_diff_v1_pb{id + = + F1, + add_nonce + = + F2, + signature + = + F3, + diffs + = + F4}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= 0 -> B1; + true -> e_varint(TrF2, <>, TrUserData) + end + end + end, + B3 = if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + case iolist_size(TrF3) of + 0 -> B2; + _ -> e_type_bytes(TrF3, <>, TrUserData) + end + end + end, + begin + TrF4 = id(F4, TrUserData), + if TrF4 == [] -> B3; + true -> + e_field_blockchain_state_channel_diff_v1_pb_diffs(TrF4, + B3, + TrUserData) + end + end. + +encode_msg_blockchain_state_channel_diff_entry_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_state_channel_diff_entry_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_state_channel_diff_entry_v1_pb(#blockchain_state_channel_diff_entry_v1_pb{entry + = + F1}, + Bin, TrUserData) -> + if F1 =:= undefined -> Bin; + true -> + case id(F1, TrUserData) of + {append, TF1} -> + begin + TrTF1 = id(TF1, TrUserData), + e_mfield_blockchain_state_channel_diff_entry_v1_pb_append(TrTF1, + <>, + TrUserData) + end; + {add, TF1} -> + begin + TrTF1 = id(TF1, TrUserData), + e_mfield_blockchain_state_channel_diff_entry_v1_pb_add(TrTF1, + <>, + TrUserData) + end + end + end. + +encode_msg_blockchain_state_channel_diff_append_summary_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_state_channel_diff_append_summary_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_state_channel_diff_append_summary_v1_pb(#blockchain_state_channel_diff_append_summary_v1_pb{client_pubkeybin + = + F1, + num_packets + = + F2, + num_dcs + = + F3}, + Bin, + TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= 0 -> B1; + true -> e_varint(TrF2, <>, TrUserData) + end + end + end, + if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + if TrF3 =:= 0 -> B2; + true -> e_varint(TrF3, <>, TrUserData) + end + end + end. + +encode_msg_blockchain_state_channel_diff_update_summary_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_state_channel_diff_update_summary_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_state_channel_diff_update_summary_v1_pb(#blockchain_state_channel_diff_update_summary_v1_pb{client_index + = + F1, + add_packets + = + F2, + add_dcs + = + F3}, + Bin, + TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= 0 -> Bin; + true -> e_varint(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= 0 -> B1; + true -> e_varint(TrF2, <>, TrUserData) + end + end + end, + if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + if TrF3 =:= 0 -> B2; + true -> e_varint(TrF3, <>, TrUserData) + end + end + end. + +encode_msg_blockchain_state_channel_banner_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_state_channel_banner_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_state_channel_banner_v1_pb(#blockchain_state_channel_banner_v1_pb{sc + = + F1}, + Bin, TrUserData) -> + if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= undefined -> Bin; + true -> + e_mfield_blockchain_state_channel_banner_v1_pb_sc(TrF1, + <>, + TrUserData) + end + end + end. + +encode_msg_blockchain_state_channel_rejection_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_state_channel_rejection_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_state_channel_rejection_v1_pb(#blockchain_state_channel_rejection_v1_pb{reject + = + F1, + packet_hash + = + F2}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= 0 -> Bin; + true -> e_varint(TrF1, <>, TrUserData) + end + end + end, + if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end. + +encode_msg_blockchain_state_channel_message_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_state_channel_message_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_state_channel_message_v1_pb(#blockchain_state_channel_message_v1_pb{msg + = + F1}, + Bin, TrUserData) -> + if F1 =:= undefined -> Bin; + true -> + case id(F1, TrUserData) of + {response, TF1} -> + begin + TrTF1 = id(TF1, TrUserData), + e_mfield_blockchain_state_channel_message_v1_pb_response(TrTF1, + <>, + TrUserData) + end; + {packet, TF1} -> + begin + TrTF1 = id(TF1, TrUserData), + e_mfield_blockchain_state_channel_message_v1_pb_packet(TrTF1, + <>, + TrUserData) + end; + {offer, TF1} -> + begin + TrTF1 = id(TF1, TrUserData), + e_mfield_blockchain_state_channel_message_v1_pb_offer(TrTF1, + <>, + TrUserData) + end; + {purchase, TF1} -> + begin + TrTF1 = id(TF1, TrUserData), + e_mfield_blockchain_state_channel_message_v1_pb_purchase(TrTF1, + <>, + TrUserData) + end; + {banner, TF1} -> + begin + TrTF1 = id(TF1, TrUserData), + e_mfield_blockchain_state_channel_message_v1_pb_banner(TrTF1, + <>, + TrUserData) + end; + {reject, TF1} -> + begin + TrTF1 = id(TF1, TrUserData), + e_mfield_blockchain_state_channel_message_v1_pb_reject(TrTF1, + <>, + TrUserData) + end + end + end. + +encode_msg_eui_pb(Msg, TrUserData) -> + encode_msg_eui_pb(Msg, <<>>, TrUserData). + + +encode_msg_eui_pb(#eui_pb{deveui = F1, appeui = F2}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= 0 -> Bin; + true -> e_varint(TrF1, <>, TrUserData) + end + end + end, + if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= 0 -> B1; + true -> e_varint(TrF2, <>, TrUserData) + end + end + end. + +encode_msg_routing_information_pb(Msg, TrUserData) -> + encode_msg_routing_information_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_routing_information_pb(#routing_information_pb{data + = F1}, + Bin, TrUserData) -> + if F1 =:= undefined -> Bin; + true -> + case id(F1, TrUserData) of + {devaddr, TF1} -> + begin + TrTF1 = id(TF1, TrUserData), + e_varint(TrTF1, <>, TrUserData) + end; + {eui, TF1} -> + begin + TrTF1 = id(TF1, TrUserData), + e_mfield_routing_information_pb_eui(TrTF1, + <>, + TrUserData) + end + end + end. + +encode_msg_window_pb(Msg, TrUserData) -> + encode_msg_window_pb(Msg, <<>>, TrUserData). + + +encode_msg_window_pb(#window_pb{timestamp = F1, + frequency = F2, datarate = F3}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= 0 -> Bin; + true -> e_varint(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= 0.0 -> B1; + true -> + e_type_float(TrF2, <>, TrUserData) + end + end + end, + if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + case is_empty_string(TrF3) of + true -> B2; + false -> + e_type_string(TrF3, <>, TrUserData) + end + end + end. + +encode_msg_packet_pb(Msg, TrUserData) -> + encode_msg_packet_pb(Msg, <<>>, TrUserData). + + +encode_msg_packet_pb(#packet_pb{oui = F1, type = F2, + payload = F3, timestamp = F4, + signal_strength = F5, frequency = F6, + datarate = F7, snr = F8, routing = F9, + rx2_window = F10}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= 0 -> Bin; + true -> e_varint(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= longfi; TrF2 =:= 0 -> B1; + true -> + 'e_enum_packet_pb.packet_type'(TrF2, + <>, + TrUserData) + end + end + end, + B3 = if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + case iolist_size(TrF3) of + 0 -> B2; + _ -> e_type_bytes(TrF3, <>, TrUserData) + end + end + end, + B4 = if F4 == undefined -> B3; + true -> + begin + TrF4 = id(F4, TrUserData), + if TrF4 =:= 0 -> B3; + true -> e_varint(TrF4, <>, TrUserData) + end + end + end, + B5 = if F5 == undefined -> B4; + true -> + begin + TrF5 = id(F5, TrUserData), + if TrF5 =:= 0.0 -> B4; + true -> + e_type_float(TrF5, <>, TrUserData) + end + end + end, + B6 = if F6 == undefined -> B5; + true -> + begin + TrF6 = id(F6, TrUserData), + if TrF6 =:= 0.0 -> B5; + true -> + e_type_float(TrF6, <>, TrUserData) + end + end + end, + B7 = if F7 == undefined -> B6; + true -> + begin + TrF7 = id(F7, TrUserData), + case is_empty_string(TrF7) of + true -> B6; + false -> + e_type_string(TrF7, <>, TrUserData) + end + end + end, + B8 = if F8 == undefined -> B7; + true -> + begin + TrF8 = id(F8, TrUserData), + if TrF8 =:= 0.0 -> B7; + true -> + e_type_float(TrF8, <>, TrUserData) + end + end + end, + B9 = if F9 == undefined -> B8; + true -> + begin + TrF9 = id(F9, TrUserData), + if TrF9 =:= undefined -> B8; + true -> + e_mfield_packet_pb_routing(TrF9, + <>, + TrUserData) + end + end + end, + if F10 == undefined -> B9; + true -> + begin + TrF10 = id(F10, TrUserData), + if TrF10 =:= undefined -> B9; + true -> + e_mfield_packet_pb_rx2_window(TrF10, + <>, + TrUserData) + end + end + end. + +encode_msg_blockchain_txn_state_channel_close_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_txn_state_channel_close_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_txn_state_channel_close_v1_pb(#blockchain_txn_state_channel_close_v1_pb{state_channel + = + F1, + closer + = + F2, + signature + = + F3, + fee + = + F4, + conflicts_with + = + F5}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= undefined -> Bin; + true -> + e_mfield_blockchain_txn_state_channel_close_v1_pb_state_channel(TrF1, + <>, + TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end, + B3 = if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + case iolist_size(TrF3) of + 0 -> B2; + _ -> e_type_bytes(TrF3, <>, TrUserData) + end + end + end, + B4 = if F4 == undefined -> B3; + true -> + begin + TrF4 = id(F4, TrUserData), + if TrF4 =:= 0 -> B3; + true -> e_varint(TrF4, <>, TrUserData) + end + end + end, + if F5 == undefined -> B4; + true -> + begin + TrF5 = id(F5, TrUserData), + if TrF5 =:= undefined -> B4; + true -> + e_mfield_blockchain_txn_state_channel_close_v1_pb_conflicts_with(TrF5, + <>, + TrUserData) + end + end + end. + +encode_msg_blockchain_var_v1_pb(Msg, TrUserData) -> + encode_msg_blockchain_var_v1_pb(Msg, <<>>, TrUserData). + + +encode_msg_blockchain_var_v1_pb(#blockchain_var_v1_pb{name + = F1, + type = F2, value = F3}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> + e_type_string(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case is_empty_string(TrF2) of + true -> B1; + false -> + e_type_string(TrF2, <>, TrUserData) + end + end + end, + if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + case iolist_size(TrF3) of + 0 -> B2; + _ -> e_type_bytes(TrF3, <>, TrUserData) + end + end + end. + +encode_msg_blockchain_txn_vars_v1_pb(Msg, TrUserData) -> + encode_msg_blockchain_txn_vars_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_txn_vars_v1_pb(#blockchain_txn_vars_v1_pb{vars + = F1, + version_predicate + = F2, + proof = F3, + master_key = F4, + key_proof = F5, + cancels = F6, + unsets = F7, + nonce = F8, + multi_keys = F9, + multi_proofs = + F10, + multi_key_proofs + = F11}, + Bin, TrUserData) -> + B1 = begin + TrF1 = id(F1, TrUserData), + if TrF1 == [] -> Bin; + true -> + e_field_blockchain_txn_vars_v1_pb_vars(TrF1, + Bin, + TrUserData) + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= 0 -> B1; + true -> e_varint(TrF2, <>, TrUserData) + end + end + end, + B3 = if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + case iolist_size(TrF3) of + 0 -> B2; + _ -> e_type_bytes(TrF3, <>, TrUserData) + end + end + end, + B4 = if F4 == undefined -> B3; + true -> + begin + TrF4 = id(F4, TrUserData), + case iolist_size(TrF4) of + 0 -> B3; + _ -> e_type_bytes(TrF4, <>, TrUserData) + end + end + end, + B5 = if F5 == undefined -> B4; + true -> + begin + TrF5 = id(F5, TrUserData), + case iolist_size(TrF5) of + 0 -> B4; + _ -> e_type_bytes(TrF5, <>, TrUserData) + end + end + end, + B6 = begin + TrF6 = id(F6, TrUserData), + if TrF6 == [] -> B5; + true -> + e_field_blockchain_txn_vars_v1_pb_cancels(TrF6, + B5, + TrUserData) + end + end, + B7 = begin + TrF7 = id(F7, TrUserData), + if TrF7 == [] -> B6; + true -> + e_field_blockchain_txn_vars_v1_pb_unsets(TrF7, + B6, + TrUserData) + end + end, + B8 = if F8 == undefined -> B7; + true -> + begin + TrF8 = id(F8, TrUserData), + if TrF8 =:= 0 -> B7; + true -> e_varint(TrF8, <>, TrUserData) + end + end + end, + B9 = begin + TrF9 = id(F9, TrUserData), + if TrF9 == [] -> B8; + true -> + e_field_blockchain_txn_vars_v1_pb_multi_keys(TrF9, + B8, + TrUserData) + end + end, + B10 = begin + TrF10 = id(F10, TrUserData), + if TrF10 == [] -> B9; + true -> + e_field_blockchain_txn_vars_v1_pb_multi_proofs(TrF10, + B9, + TrUserData) + end + end, + begin + TrF11 = id(F11, TrUserData), + if TrF11 == [] -> B10; + true -> + e_field_blockchain_txn_vars_v1_pb_multi_key_proofs(TrF11, + B10, + TrUserData) + end + end. + +encode_msg_blockchain_txn_poc_receipts_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_txn_poc_receipts_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_txn_poc_receipts_v1_pb(#blockchain_txn_poc_receipts_v1_pb{challenger + = + F1, + secret + = + F2, + onion_key_hash + = + F3, + path + = + F4, + fee + = + F5, + signature + = + F6, + request_block_hash + = + F7}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end, + B3 = if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + case iolist_size(TrF3) of + 0 -> B2; + _ -> e_type_bytes(TrF3, <>, TrUserData) + end + end + end, + B4 = begin + TrF4 = id(F4, TrUserData), + if TrF4 == [] -> B3; + true -> + e_field_blockchain_txn_poc_receipts_v1_pb_path(TrF4, + B3, + TrUserData) + end + end, + B5 = if F5 == undefined -> B4; + true -> + begin + TrF5 = id(F5, TrUserData), + if TrF5 =:= 0 -> B4; + true -> e_varint(TrF5, <>, TrUserData) + end + end + end, + B6 = if F6 == undefined -> B5; + true -> + begin + TrF6 = id(F6, TrUserData), + case iolist_size(TrF6) of + 0 -> B5; + _ -> e_type_bytes(TrF6, <>, TrUserData) + end + end + end, + if F7 == undefined -> B6; + true -> + begin + TrF7 = id(F7, TrUserData), + case iolist_size(TrF7) of + 0 -> B6; + _ -> e_type_bytes(TrF7, <>, TrUserData) + end + end + end. + +encode_msg_blockchain_poc_receipt_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_poc_receipt_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_poc_receipt_v1_pb(#blockchain_poc_receipt_v1_pb{gateway + = F1, + timestamp + = F2, + signal = + F3, + data = F4, + origin = + F5, + signature + = F6, + snr = F7, + frequency + = F8, + channel = + F9, + datarate = + F10, + addr_hash + = F11, + tx_power = + F12}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= 0 -> B1; + true -> e_varint(TrF2, <>, TrUserData) + end + end + end, + B3 = if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + if TrF3 =:= 0 -> B2; + true -> e_type_sint(TrF3, <>, TrUserData) + end + end + end, + B4 = if F4 == undefined -> B3; + true -> + begin + TrF4 = id(F4, TrUserData), + case iolist_size(TrF4) of + 0 -> B3; + _ -> e_type_bytes(TrF4, <>, TrUserData) + end + end + end, + B5 = if F5 == undefined -> B4; + true -> + begin + TrF5 = id(F5, TrUserData), + if TrF5 =:= p2p; TrF5 =:= 0 -> B4; + true -> + 'e_enum_helium.origin'(TrF5, + <>, + TrUserData) + end + end + end, + B6 = if F6 == undefined -> B5; + true -> + begin + TrF6 = id(F6, TrUserData), + case iolist_size(TrF6) of + 0 -> B5; + _ -> e_type_bytes(TrF6, <>, TrUserData) + end + end + end, + B7 = if F7 == undefined -> B6; + true -> + begin + TrF7 = id(F7, TrUserData), + if TrF7 =:= 0.0 -> B6; + true -> + e_type_float(TrF7, <>, TrUserData) + end + end + end, + B8 = if F8 == undefined -> B7; + true -> + begin + TrF8 = id(F8, TrUserData), + if TrF8 =:= 0.0 -> B7; + true -> + e_type_float(TrF8, <>, TrUserData) + end + end + end, + B9 = if F9 == undefined -> B8; + true -> + begin + TrF9 = id(F9, TrUserData), + if TrF9 =:= 0 -> B8; + true -> + e_type_int32(TrF9, <>, TrUserData) + end + end + end, + B10 = if F10 == undefined -> B9; + true -> + begin + TrF10 = id(F10, TrUserData), + case is_empty_string(TrF10) of + true -> B9; + false -> + e_type_string(TrF10, <>, TrUserData) + end + end + end, + B11 = if F11 == undefined -> B10; + true -> + begin + TrF11 = id(F11, TrUserData), + case iolist_size(TrF11) of + 0 -> B10; + _ -> + e_type_bytes(TrF11, <>, TrUserData) + end + end + end, + if F12 == undefined -> B11; + true -> + begin + TrF12 = id(F12, TrUserData), + if TrF12 =:= 0 -> B11; + true -> + e_type_int32(TrF12, <>, TrUserData) + end + end + end. + +encode_msg_blockchain_poc_witness_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_poc_witness_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_poc_witness_v1_pb(#blockchain_poc_witness_v1_pb{gateway + = F1, + timestamp + = F2, + signal = + F3, + packet_hash + = F4, + signature + = F5, + snr = F6, + frequency + = F7, + channel = + F8, + datarate = + F9}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= 0 -> B1; + true -> e_varint(TrF2, <>, TrUserData) + end + end + end, + B3 = if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + if TrF3 =:= 0 -> B2; + true -> e_type_sint(TrF3, <>, TrUserData) + end + end + end, + B4 = if F4 == undefined -> B3; + true -> + begin + TrF4 = id(F4, TrUserData), + case iolist_size(TrF4) of + 0 -> B3; + _ -> e_type_bytes(TrF4, <>, TrUserData) + end + end + end, + B5 = if F5 == undefined -> B4; + true -> + begin + TrF5 = id(F5, TrUserData), + case iolist_size(TrF5) of + 0 -> B4; + _ -> e_type_bytes(TrF5, <>, TrUserData) + end + end + end, + B6 = if F6 == undefined -> B5; + true -> + begin + TrF6 = id(F6, TrUserData), + if TrF6 =:= 0.0 -> B5; + true -> + e_type_float(TrF6, <>, TrUserData) + end + end + end, + B7 = if F7 == undefined -> B6; + true -> + begin + TrF7 = id(F7, TrUserData), + if TrF7 =:= 0.0 -> B6; + true -> + e_type_float(TrF7, <>, TrUserData) + end + end + end, + B8 = if F8 == undefined -> B7; + true -> + begin + TrF8 = id(F8, TrUserData), + if TrF8 =:= 0 -> B7; + true -> + e_type_int32(TrF8, <>, TrUserData) + end + end + end, + if F9 == undefined -> B8; + true -> + begin + TrF9 = id(F9, TrUserData), + case is_empty_string(TrF9) of + true -> B8; + false -> + e_type_string(TrF9, <>, TrUserData) + end + end + end. + +encode_msg_blockchain_poc_response_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_poc_response_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_poc_response_v1_pb(#blockchain_poc_response_v1_pb{payload + = + F1}, + Bin, TrUserData) -> + if F1 =:= undefined -> Bin; + true -> + case id(F1, TrUserData) of + {receipt, TF1} -> + begin + TrTF1 = id(TF1, TrUserData), + e_mfield_blockchain_poc_response_v1_pb_receipt(TrTF1, + <>, + TrUserData) + end; + {witness, TF1} -> + begin + TrTF1 = id(TF1, TrUserData), + e_mfield_blockchain_poc_response_v1_pb_witness(TrTF1, + <>, + TrUserData) + end + end + end. + +encode_msg_blockchain_poc_path_element_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_poc_path_element_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_poc_path_element_v1_pb(#blockchain_poc_path_element_v1_pb{challengee + = + F1, + receipt + = + F2, + witnesses + = + F3}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= undefined -> B1; + true -> + e_mfield_blockchain_poc_path_element_v1_pb_receipt(TrF2, + <>, + TrUserData) + end + end + end, + begin + TrF3 = id(F3, TrUserData), + if TrF3 == [] -> B2; + true -> + e_field_blockchain_poc_path_element_v1_pb_witnesses(TrF3, + B2, + TrUserData) + end + end. + +encode_msg_blockchain_txn_poc_receipts_v2_pb(Msg, + TrUserData) -> + encode_msg_blockchain_txn_poc_receipts_v2_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_txn_poc_receipts_v2_pb(#blockchain_txn_poc_receipts_v2_pb{challenger + = + F1, + secret + = + F2, + onion_key_hash + = + F3, + path + = + F4, + fee + = + F5, + signature + = + F6, + block_hash + = + F7}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + case iolist_size(TrF1) of + 0 -> Bin; + _ -> e_type_bytes(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + case iolist_size(TrF2) of + 0 -> B1; + _ -> e_type_bytes(TrF2, <>, TrUserData) + end + end + end, + B3 = if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + case iolist_size(TrF3) of + 0 -> B2; + _ -> e_type_bytes(TrF3, <>, TrUserData) + end + end + end, + B4 = begin + TrF4 = id(F4, TrUserData), + if TrF4 == [] -> B3; + true -> + e_field_blockchain_txn_poc_receipts_v2_pb_path(TrF4, + B3, + TrUserData) + end + end, + B5 = if F5 == undefined -> B4; + true -> + begin + TrF5 = id(F5, TrUserData), + if TrF5 =:= 0 -> B4; + true -> e_varint(TrF5, <>, TrUserData) + end + end + end, + B6 = if F6 == undefined -> B5; + true -> + begin + TrF6 = id(F6, TrUserData), + case iolist_size(TrF6) of + 0 -> B5; + _ -> e_type_bytes(TrF6, <>, TrUserData) + end + end + end, + if F7 == undefined -> B6; + true -> + begin + TrF7 = id(F7, TrUserData), + case iolist_size(TrF7) of + 0 -> B6; + _ -> e_type_bytes(TrF7, <>, TrUserData) + end + end + end. + +encode_msg_blockchain_region_params_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_region_params_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_region_params_v1_pb(#blockchain_region_params_v1_pb{region_params + = + F1}, + Bin, TrUserData) -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 == [] -> Bin; + true -> + e_field_blockchain_region_params_v1_pb_region_params(TrF1, + Bin, + TrUserData) + end + end. + +encode_msg_tagged_spreading_pb(Msg, TrUserData) -> + encode_msg_tagged_spreading_pb(Msg, <<>>, TrUserData). + + +encode_msg_tagged_spreading_pb(#tagged_spreading_pb{region_spreading + = F1, + max_packet_size = F2}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= 'SF_INVALID'; TrF1 =:= 0 -> Bin; + true -> + 'e_enum_helium.RegionSpreading'(TrF1, + <>, + TrUserData) + end + end + end, + if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= 0 -> B1; + true -> e_varint(TrF2, <>, TrUserData) + end + end + end. + +encode_msg_blockchain_region_spreading_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_region_spreading_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_region_spreading_v1_pb(#blockchain_region_spreading_v1_pb{tagged_spreading + = + F1}, + Bin, TrUserData) -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 == [] -> Bin; + true -> + e_field_blockchain_region_spreading_v1_pb_tagged_spreading(TrF1, + Bin, + TrUserData) + end + end. + +encode_msg_blockchain_region_param_v1_pb(Msg, + TrUserData) -> + encode_msg_blockchain_region_param_v1_pb(Msg, + <<>>, + TrUserData). + + +encode_msg_blockchain_region_param_v1_pb(#blockchain_region_param_v1_pb{channel_frequency + = + F1, + bandwidth + = + F2, + max_eirp + = + F3, + spreading + = + F4}, + Bin, TrUserData) -> + B1 = if F1 == undefined -> Bin; + true -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= 0 -> Bin; + true -> e_varint(TrF1, <>, TrUserData) + end + end + end, + B2 = if F2 == undefined -> B1; + true -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= 0 -> B1; + true -> e_varint(TrF2, <>, TrUserData) + end + end + end, + B3 = if F3 == undefined -> B2; + true -> + begin + TrF3 = id(F3, TrUserData), + if TrF3 =:= 0 -> B2; + true -> e_varint(TrF3, <>, TrUserData) + end + end + end, + if F4 == undefined -> B3; + true -> + begin + TrF4 = id(F4, TrUserData), + if TrF4 =:= undefined -> B3; + true -> + e_mfield_blockchain_region_param_v1_pb_spreading(TrF4, + <>, + TrUserData) + end + end + end. + +e_field_gateway_config_req_v1_pb_keys([Elem | Rest], + Bin, TrUserData) -> + Bin2 = <>, + Bin3 = e_type_string(id(Elem, TrUserData), + Bin2, + TrUserData), + e_field_gateway_config_req_v1_pb_keys(Rest, + Bin3, + TrUserData); +e_field_gateway_config_req_v1_pb_keys([], Bin, + _TrUserData) -> + Bin. + +e_mfield_gateway_config_resp_v1_pb_result(Msg, Bin, + TrUserData) -> + SubBin = encode_msg_blockchain_var_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_gateway_config_resp_v1_pb_result([Elem | Rest], + Bin, TrUserData) -> + Bin2 = <>, + Bin3 = + e_mfield_gateway_config_resp_v1_pb_result(id(Elem, + TrUserData), + Bin2, + TrUserData), + e_field_gateway_config_resp_v1_pb_result(Rest, + Bin3, + TrUserData); +e_field_gateway_config_resp_v1_pb_result([], Bin, + _TrUserData) -> + Bin. + +e_field_gateway_config_update_streamed_resp_v1_pb_keys([Elem + | Rest], + Bin, TrUserData) -> + Bin2 = <>, + Bin3 = e_type_string(id(Elem, TrUserData), + Bin2, + TrUserData), + e_field_gateway_config_update_streamed_resp_v1_pb_keys(Rest, + Bin3, + TrUserData); +e_field_gateway_config_update_streamed_resp_v1_pb_keys([], + Bin, _TrUserData) -> + Bin. + +e_mfield_gateway_validators_resp_v1_pb_result(Msg, Bin, + TrUserData) -> + SubBin = encode_msg_routing_address_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_gateway_validators_resp_v1_pb_result([Elem + | Rest], + Bin, TrUserData) -> + Bin2 = <>, + Bin3 = + e_mfield_gateway_validators_resp_v1_pb_result(id(Elem, + TrUserData), + Bin2, + TrUserData), + e_field_gateway_validators_resp_v1_pb_result(Rest, + Bin3, + TrUserData); +e_field_gateway_validators_resp_v1_pb_result([], Bin, + _TrUserData) -> + Bin. + +e_mfield_gateway_region_params_streamed_resp_v1_pb_params(Msg, + Bin, TrUserData) -> + SubBin = encode_msg_blockchain_region_params_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_gateway_resp_v1_pb_is_active_resp(Msg, Bin, + TrUserData) -> + SubBin = encode_msg_gateway_sc_is_active_resp_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_gateway_resp_v1_pb_is_overpaid_resp(Msg, Bin, + TrUserData) -> + SubBin = + encode_msg_gateway_sc_is_overpaid_resp_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_gateway_resp_v1_pb_close_resp(Msg, Bin, + TrUserData) -> + SubBin = encode_msg_gateway_sc_close_resp_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_gateway_resp_v1_pb_follow_streamed_resp(Msg, + Bin, TrUserData) -> + SubBin = + encode_msg_gateway_sc_follow_streamed_resp_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_gateway_resp_v1_pb_routing_streamed_resp(Msg, + Bin, TrUserData) -> + SubBin = + encode_msg_gateway_routing_streamed_resp_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_gateway_resp_v1_pb_config_resp(Msg, Bin, + TrUserData) -> + SubBin = encode_msg_gateway_config_resp_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_gateway_resp_v1_pb_config_update_streamed_resp(Msg, + Bin, TrUserData) -> + SubBin = + encode_msg_gateway_config_update_streamed_resp_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_gateway_resp_v1_pb_validators_resp(Msg, Bin, + TrUserData) -> + SubBin = encode_msg_gateway_validators_resp_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_gateway_resp_v1_pb_region_params_streamed_resp(Msg, + Bin, TrUserData) -> + SubBin = + encode_msg_gateway_region_params_streamed_resp_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_gateway_resp_v1_pb_success_resp(Msg, Bin, + TrUserData) -> + SubBin = encode_msg_gateway_success_resp_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_gateway_resp_v1_pb_error_resp(Msg, Bin, + TrUserData) -> + SubBin = encode_msg_gateway_error_resp_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_gateway_resp_v1_pb_poc_challenge_resp(Msg, Bin, + TrUserData) -> + SubBin = + encode_msg_gateway_poc_challenge_notification_resp_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_gateway_resp_v1_pb_poc_check_target_resp(Msg, + Bin, TrUserData) -> + SubBin = + encode_msg_gateway_poc_check_challenge_target_resp_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_gateway_resp_v1_pb_public_route(Msg, Bin, + TrUserData) -> + SubBin = + encode_msg_gateway_public_routing_data_resp_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_gateway_sc_close_req_v1_pb_close_txn(Msg, Bin, + TrUserData) -> + SubBin = + encode_msg_blockchain_txn_state_channel_close_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_routing_pb_addresses(Msg, Bin, TrUserData) -> + SubBin = encode_msg_routing_address_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_routing_pb_addresses([Elem | Rest], Bin, + TrUserData) -> + Bin2 = <>, + Bin3 = e_mfield_routing_pb_addresses(id(Elem, + TrUserData), + Bin2, + TrUserData), + e_field_routing_pb_addresses(Rest, Bin3, TrUserData); +e_field_routing_pb_addresses([], Bin, _TrUserData) -> + Bin. + +e_field_routing_pb_filters([Elem | Rest], Bin, + TrUserData) -> + Bin2 = <>, + Bin3 = e_type_bytes(id(Elem, TrUserData), + Bin2, + TrUserData), + e_field_routing_pb_filters(Rest, Bin3, TrUserData); +e_field_routing_pb_filters([], Bin, _TrUserData) -> Bin. + +e_field_routing_pb_subnets([Elem | Rest], Bin, + TrUserData) -> + Bin2 = <>, + Bin3 = e_type_bytes(id(Elem, TrUserData), + Bin2, + TrUserData), + e_field_routing_pb_subnets(Rest, Bin3, TrUserData); +e_field_routing_pb_subnets([], Bin, _TrUserData) -> Bin. + +e_mfield_gateway_routing_streamed_resp_v1_pb_routings(Msg, + Bin, TrUserData) -> + SubBin = encode_msg_routing_pb(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_gateway_routing_streamed_resp_v1_pb_routings([Elem + | Rest], + Bin, TrUserData) -> + Bin2 = <>, + Bin3 = + e_mfield_gateway_routing_streamed_resp_v1_pb_routings(id(Elem, + TrUserData), + Bin2, + TrUserData), + e_field_gateway_routing_streamed_resp_v1_pb_routings(Rest, + Bin3, + TrUserData); +e_field_gateway_routing_streamed_resp_v1_pb_routings([], + Bin, _TrUserData) -> + Bin. + +e_mfield_gateway_poc_challenge_notification_resp_v1_pb_challenger(Msg, + Bin, + TrUserData) -> + SubBin = encode_msg_routing_address_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_gateway_poc_report_req_v1_pb_receipt(Msg, Bin, + TrUserData) -> + SubBin = encode_msg_blockchain_poc_receipt_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_gateway_poc_report_req_v1_pb_witness(Msg, Bin, + TrUserData) -> + SubBin = encode_msg_blockchain_poc_witness_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_gateway_public_routing_data_resp_v1_pb_public_uri(Msg, + Bin, TrUserData) -> + SubBin = encode_msg_routing_address_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_blockchain_state_channel_v1_pb_summaries(Msg, + Bin, TrUserData) -> + SubBin = + encode_msg_blockchain_state_channel_summary_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_blockchain_state_channel_v1_pb_summaries([Elem + | Rest], + Bin, TrUserData) -> + Bin2 = <>, + Bin3 = + e_mfield_blockchain_state_channel_v1_pb_summaries(id(Elem, + TrUserData), + Bin2, + TrUserData), + e_field_blockchain_state_channel_v1_pb_summaries(Rest, + Bin3, + TrUserData); +e_field_blockchain_state_channel_v1_pb_summaries([], + Bin, _TrUserData) -> + Bin. + +e_mfield_blockchain_state_channel_response_v1_pb_downlink(Msg, + Bin, TrUserData) -> + SubBin = encode_msg_packet_pb(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_blockchain_state_channel_packet_v1_pb_packet(Msg, + Bin, TrUserData) -> + SubBin = encode_msg_packet_pb(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_blockchain_state_channel_offer_v1_pb_routing(Msg, + Bin, TrUserData) -> + SubBin = encode_msg_routing_information_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_blockchain_state_channel_purchase_v1_pb_sc(Msg, + Bin, TrUserData) -> + SubBin = encode_msg_blockchain_state_channel_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_blockchain_state_channel_purchase_v1_pb_sc_diff(Msg, + Bin, TrUserData) -> + SubBin = + encode_msg_blockchain_state_channel_diff_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_blockchain_state_channel_diff_v1_pb_diffs(Msg, + Bin, TrUserData) -> + SubBin = + encode_msg_blockchain_state_channel_diff_entry_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_blockchain_state_channel_diff_v1_pb_diffs([Elem + | Rest], + Bin, TrUserData) -> + Bin2 = <>, + Bin3 = + e_mfield_blockchain_state_channel_diff_v1_pb_diffs(id(Elem, + TrUserData), + Bin2, + TrUserData), + e_field_blockchain_state_channel_diff_v1_pb_diffs(Rest, + Bin3, + TrUserData); +e_field_blockchain_state_channel_diff_v1_pb_diffs([], + Bin, _TrUserData) -> + Bin. + +e_mfield_blockchain_state_channel_diff_entry_v1_pb_append(Msg, + Bin, TrUserData) -> + SubBin = + encode_msg_blockchain_state_channel_diff_append_summary_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_blockchain_state_channel_diff_entry_v1_pb_add(Msg, + Bin, TrUserData) -> + SubBin = + encode_msg_blockchain_state_channel_diff_update_summary_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_blockchain_state_channel_banner_v1_pb_sc(Msg, + Bin, TrUserData) -> + SubBin = encode_msg_blockchain_state_channel_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_blockchain_state_channel_message_v1_pb_response(Msg, + Bin, TrUserData) -> + SubBin = + encode_msg_blockchain_state_channel_response_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_blockchain_state_channel_message_v1_pb_packet(Msg, + Bin, TrUserData) -> + SubBin = + encode_msg_blockchain_state_channel_packet_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_blockchain_state_channel_message_v1_pb_offer(Msg, + Bin, TrUserData) -> + SubBin = + encode_msg_blockchain_state_channel_offer_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_blockchain_state_channel_message_v1_pb_purchase(Msg, + Bin, TrUserData) -> + SubBin = + encode_msg_blockchain_state_channel_purchase_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_blockchain_state_channel_message_v1_pb_banner(Msg, + Bin, TrUserData) -> + SubBin = + encode_msg_blockchain_state_channel_banner_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_blockchain_state_channel_message_v1_pb_reject(Msg, + Bin, TrUserData) -> + SubBin = + encode_msg_blockchain_state_channel_rejection_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_routing_information_pb_eui(Msg, Bin, + TrUserData) -> + SubBin = encode_msg_eui_pb(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_packet_pb_routing(Msg, Bin, TrUserData) -> + SubBin = encode_msg_routing_information_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_packet_pb_rx2_window(Msg, Bin, TrUserData) -> + SubBin = encode_msg_window_pb(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_blockchain_txn_state_channel_close_v1_pb_state_channel(Msg, + Bin, + TrUserData) -> + SubBin = encode_msg_blockchain_state_channel_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_blockchain_txn_state_channel_close_v1_pb_conflicts_with(Msg, + Bin, + TrUserData) -> + SubBin = encode_msg_blockchain_state_channel_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_blockchain_txn_vars_v1_pb_vars(Msg, Bin, + TrUserData) -> + SubBin = encode_msg_blockchain_var_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_blockchain_txn_vars_v1_pb_vars([Elem | Rest], + Bin, TrUserData) -> + Bin2 = <>, + Bin3 = e_mfield_blockchain_txn_vars_v1_pb_vars(id(Elem, + TrUserData), + Bin2, + TrUserData), + e_field_blockchain_txn_vars_v1_pb_vars(Rest, + Bin3, + TrUserData); +e_field_blockchain_txn_vars_v1_pb_vars([], Bin, + _TrUserData) -> + Bin. + +e_field_blockchain_txn_vars_v1_pb_cancels([Elem | Rest], + Bin, TrUserData) -> + Bin2 = <>, + Bin3 = e_type_bytes(id(Elem, TrUserData), + Bin2, + TrUserData), + e_field_blockchain_txn_vars_v1_pb_cancels(Rest, + Bin3, + TrUserData); +e_field_blockchain_txn_vars_v1_pb_cancels([], Bin, + _TrUserData) -> + Bin. + +e_field_blockchain_txn_vars_v1_pb_unsets([Elem | Rest], + Bin, TrUserData) -> + Bin2 = <>, + Bin3 = e_type_bytes(id(Elem, TrUserData), + Bin2, + TrUserData), + e_field_blockchain_txn_vars_v1_pb_unsets(Rest, + Bin3, + TrUserData); +e_field_blockchain_txn_vars_v1_pb_unsets([], Bin, + _TrUserData) -> + Bin. + +e_field_blockchain_txn_vars_v1_pb_multi_keys([Elem + | Rest], + Bin, TrUserData) -> + Bin2 = <>, + Bin3 = e_type_bytes(id(Elem, TrUserData), + Bin2, + TrUserData), + e_field_blockchain_txn_vars_v1_pb_multi_keys(Rest, + Bin3, + TrUserData); +e_field_blockchain_txn_vars_v1_pb_multi_keys([], Bin, + _TrUserData) -> + Bin. + +e_field_blockchain_txn_vars_v1_pb_multi_proofs([Elem + | Rest], + Bin, TrUserData) -> + Bin2 = <>, + Bin3 = e_type_bytes(id(Elem, TrUserData), + Bin2, + TrUserData), + e_field_blockchain_txn_vars_v1_pb_multi_proofs(Rest, + Bin3, + TrUserData); +e_field_blockchain_txn_vars_v1_pb_multi_proofs([], Bin, + _TrUserData) -> + Bin. + +e_field_blockchain_txn_vars_v1_pb_multi_key_proofs([Elem + | Rest], + Bin, TrUserData) -> + Bin2 = <>, + Bin3 = e_type_bytes(id(Elem, TrUserData), + Bin2, + TrUserData), + e_field_blockchain_txn_vars_v1_pb_multi_key_proofs(Rest, + Bin3, + TrUserData); +e_field_blockchain_txn_vars_v1_pb_multi_key_proofs([], + Bin, _TrUserData) -> + Bin. + +e_mfield_blockchain_txn_poc_receipts_v1_pb_path(Msg, + Bin, TrUserData) -> + SubBin = + encode_msg_blockchain_poc_path_element_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_blockchain_txn_poc_receipts_v1_pb_path([Elem + | Rest], + Bin, TrUserData) -> + Bin2 = <>, + Bin3 = + e_mfield_blockchain_txn_poc_receipts_v1_pb_path(id(Elem, + TrUserData), + Bin2, + TrUserData), + e_field_blockchain_txn_poc_receipts_v1_pb_path(Rest, + Bin3, + TrUserData); +e_field_blockchain_txn_poc_receipts_v1_pb_path([], Bin, + _TrUserData) -> + Bin. + +e_mfield_blockchain_poc_response_v1_pb_receipt(Msg, Bin, + TrUserData) -> + SubBin = encode_msg_blockchain_poc_receipt_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_blockchain_poc_response_v1_pb_witness(Msg, Bin, + TrUserData) -> + SubBin = encode_msg_blockchain_poc_witness_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_blockchain_poc_path_element_v1_pb_receipt(Msg, + Bin, TrUserData) -> + SubBin = encode_msg_blockchain_poc_receipt_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_blockchain_poc_path_element_v1_pb_witnesses(Msg, + Bin, TrUserData) -> + SubBin = encode_msg_blockchain_poc_witness_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_blockchain_poc_path_element_v1_pb_witnesses([Elem + | Rest], + Bin, TrUserData) -> + Bin2 = <>, + Bin3 = + e_mfield_blockchain_poc_path_element_v1_pb_witnesses(id(Elem, + TrUserData), + Bin2, + TrUserData), + e_field_blockchain_poc_path_element_v1_pb_witnesses(Rest, + Bin3, + TrUserData); +e_field_blockchain_poc_path_element_v1_pb_witnesses([], + Bin, _TrUserData) -> + Bin. + +e_mfield_blockchain_txn_poc_receipts_v2_pb_path(Msg, + Bin, TrUserData) -> + SubBin = + encode_msg_blockchain_poc_path_element_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_blockchain_txn_poc_receipts_v2_pb_path([Elem + | Rest], + Bin, TrUserData) -> + Bin2 = <>, + Bin3 = + e_mfield_blockchain_txn_poc_receipts_v2_pb_path(id(Elem, + TrUserData), + Bin2, + TrUserData), + e_field_blockchain_txn_poc_receipts_v2_pb_path(Rest, + Bin3, + TrUserData); +e_field_blockchain_txn_poc_receipts_v2_pb_path([], Bin, + _TrUserData) -> + Bin. + +e_mfield_blockchain_region_params_v1_pb_region_params(Msg, + Bin, TrUserData) -> + SubBin = encode_msg_blockchain_region_param_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_blockchain_region_params_v1_pb_region_params([Elem + | Rest], + Bin, TrUserData) -> + Bin2 = <>, + Bin3 = + e_mfield_blockchain_region_params_v1_pb_region_params(id(Elem, + TrUserData), + Bin2, + TrUserData), + e_field_blockchain_region_params_v1_pb_region_params(Rest, + Bin3, + TrUserData); +e_field_blockchain_region_params_v1_pb_region_params([], + Bin, _TrUserData) -> + Bin. + +e_mfield_blockchain_region_spreading_v1_pb_tagged_spreading(Msg, + Bin, TrUserData) -> + SubBin = encode_msg_tagged_spreading_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_blockchain_region_spreading_v1_pb_tagged_spreading([Elem + | Rest], + Bin, TrUserData) -> + Bin2 = <>, + Bin3 = + e_mfield_blockchain_region_spreading_v1_pb_tagged_spreading(id(Elem, + TrUserData), + Bin2, + TrUserData), + e_field_blockchain_region_spreading_v1_pb_tagged_spreading(Rest, + Bin3, + TrUserData); +e_field_blockchain_region_spreading_v1_pb_tagged_spreading([], + Bin, _TrUserData) -> + Bin. + +e_mfield_blockchain_region_param_v1_pb_spreading(Msg, + Bin, TrUserData) -> + SubBin = + encode_msg_blockchain_region_spreading_v1_pb(Msg, + <<>>, + TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +'e_enum_helium.close_state'(close_state_closable, Bin, + _TrUserData) -> + <>; +'e_enum_helium.close_state'(close_state_closing, Bin, + _TrUserData) -> + <>; +'e_enum_helium.close_state'(close_state_closed, Bin, + _TrUserData) -> + <>; +'e_enum_helium.close_state'(close_state_dispute, Bin, + _TrUserData) -> + <>; +'e_enum_helium.close_state'(V, Bin, _TrUserData) -> + e_varint(V, Bin). + +'e_enum_helium.blockchain_state_channel_state_v1'(open, + Bin, _TrUserData) -> + <>; +'e_enum_helium.blockchain_state_channel_state_v1'(closed, + Bin, _TrUserData) -> + <>; +'e_enum_helium.blockchain_state_channel_state_v1'(V, + Bin, _TrUserData) -> + e_varint(V, Bin). + +'e_enum_packet_pb.packet_type'(longfi, Bin, + _TrUserData) -> + <>; +'e_enum_packet_pb.packet_type'(lorawan, Bin, + _TrUserData) -> + <>; +'e_enum_packet_pb.packet_type'(V, Bin, _TrUserData) -> + e_varint(V, Bin). + +'e_enum_helium.region'('US915', Bin, _TrUserData) -> + <>; +'e_enum_helium.region'('EU868', Bin, _TrUserData) -> + <>; +'e_enum_helium.region'('EU433', Bin, _TrUserData) -> + <>; +'e_enum_helium.region'('CN470', Bin, _TrUserData) -> + <>; +'e_enum_helium.region'('CN779', Bin, _TrUserData) -> + <>; +'e_enum_helium.region'('AU915', Bin, _TrUserData) -> + <>; +'e_enum_helium.region'('AS923_1', Bin, _TrUserData) -> + <>; +'e_enum_helium.region'('KR920', Bin, _TrUserData) -> + <>; +'e_enum_helium.region'('IN865', Bin, _TrUserData) -> + <>; +'e_enum_helium.region'('AS923_2', Bin, _TrUserData) -> + <>; +'e_enum_helium.region'('AS923_3', Bin, _TrUserData) -> + <>; +'e_enum_helium.region'('AS923_4', Bin, _TrUserData) -> + <>; +'e_enum_helium.region'(V, Bin, _TrUserData) -> + e_varint(V, Bin). + +'e_enum_helium.origin'(p2p, Bin, _TrUserData) -> + <>; +'e_enum_helium.origin'(radio, Bin, _TrUserData) -> + <>; +'e_enum_helium.origin'(V, Bin, _TrUserData) -> + e_varint(V, Bin). + +'e_enum_helium.RegionSpreading'('SF_INVALID', Bin, + _TrUserData) -> + <>; +'e_enum_helium.RegionSpreading'('SF7', Bin, + _TrUserData) -> + <>; +'e_enum_helium.RegionSpreading'('SF8', Bin, + _TrUserData) -> + <>; +'e_enum_helium.RegionSpreading'('SF9', Bin, + _TrUserData) -> + <>; +'e_enum_helium.RegionSpreading'('SF10', Bin, + _TrUserData) -> + <>; +'e_enum_helium.RegionSpreading'('SF11', Bin, + _TrUserData) -> + <>; +'e_enum_helium.RegionSpreading'('SF12', Bin, + _TrUserData) -> + <>; +'e_enum_helium.RegionSpreading'(V, Bin, _TrUserData) -> + e_varint(V, Bin). + +-compile({nowarn_unused_function,e_type_sint/3}). +e_type_sint(Value, Bin, _TrUserData) when Value >= 0 -> + e_varint(Value * 2, Bin); +e_type_sint(Value, Bin, _TrUserData) -> + e_varint(Value * -2 - 1, Bin). + +-compile({nowarn_unused_function,e_type_int32/3}). +e_type_int32(Value, Bin, _TrUserData) + when 0 =< Value, Value =< 127 -> + <>; +e_type_int32(Value, Bin, _TrUserData) -> + <> = <>, + e_varint(N, Bin). + +-compile({nowarn_unused_function,e_type_int64/3}). +e_type_int64(Value, Bin, _TrUserData) + when 0 =< Value, Value =< 127 -> + <>; +e_type_int64(Value, Bin, _TrUserData) -> + <> = <>, + e_varint(N, Bin). + +-compile({nowarn_unused_function,e_type_bool/3}). +e_type_bool(true, Bin, _TrUserData) -> + <>; +e_type_bool(false, Bin, _TrUserData) -> + <>; +e_type_bool(1, Bin, _TrUserData) -> <>; +e_type_bool(0, Bin, _TrUserData) -> <>. + +-compile({nowarn_unused_function,e_type_string/3}). +e_type_string(S, Bin, _TrUserData) -> + Utf8 = unicode:characters_to_binary(S), + Bin2 = e_varint(byte_size(Utf8), Bin), + <>. + +-compile({nowarn_unused_function,e_type_bytes/3}). +e_type_bytes(Bytes, Bin, _TrUserData) + when is_binary(Bytes) -> + Bin2 = e_varint(byte_size(Bytes), Bin), + <>; +e_type_bytes(Bytes, Bin, _TrUserData) + when is_list(Bytes) -> + BytesBin = iolist_to_binary(Bytes), + Bin2 = e_varint(byte_size(BytesBin), Bin), + <>. + +-compile({nowarn_unused_function,e_type_fixed32/3}). +e_type_fixed32(Value, Bin, _TrUserData) -> + <>. + +-compile({nowarn_unused_function,e_type_sfixed32/3}). +e_type_sfixed32(Value, Bin, _TrUserData) -> + <>. + +-compile({nowarn_unused_function,e_type_fixed64/3}). +e_type_fixed64(Value, Bin, _TrUserData) -> + <>. + +-compile({nowarn_unused_function,e_type_sfixed64/3}). +e_type_sfixed64(Value, Bin, _TrUserData) -> + <>. + +-compile({nowarn_unused_function,e_type_float/3}). +e_type_float(V, Bin, _) when is_number(V) -> + <>; +e_type_float(infinity, Bin, _) -> + <>; +e_type_float('-infinity', Bin, _) -> + <>; +e_type_float(nan, Bin, _) -> + <>. + +-compile({nowarn_unused_function,e_type_double/3}). +e_type_double(V, Bin, _) when is_number(V) -> + <>; +e_type_double(infinity, Bin, _) -> + <>; +e_type_double('-infinity', Bin, _) -> + <>; +e_type_double(nan, Bin, _) -> + <>. + +-compile({nowarn_unused_function,e_varint/3}). +e_varint(N, Bin, _TrUserData) -> e_varint(N, Bin). + +-compile({nowarn_unused_function,e_varint/2}). +e_varint(N, Bin) when N =< 127 -> <>; +e_varint(N, Bin) -> + Bin2 = <>, + e_varint(N bsr 7, Bin2). + +is_empty_string("") -> true; +is_empty_string(<<>>) -> true; +is_empty_string(L) when is_list(L) -> + not string_has_chars(L); +is_empty_string(B) when is_binary(B) -> false. + +string_has_chars([C | _]) when is_integer(C) -> true; +string_has_chars([H | T]) -> + case string_has_chars(H) of + true -> true; + false -> string_has_chars(T) + end; +string_has_chars(B) + when is_binary(B), byte_size(B) =/= 0 -> + true; +string_has_chars(C) when is_integer(C) -> true; +string_has_chars(<<>>) -> false; +string_has_chars([]) -> false. + + +decode_msg(Bin, MsgName) when is_binary(Bin) -> + decode_msg(Bin, MsgName, []). + +decode_msg(Bin, MsgName, Opts) when is_binary(Bin) -> + TrUserData = proplists:get_value(user_data, Opts), + decode_msg_1_catch(Bin, MsgName, TrUserData). + +-ifdef('OTP_RELEASE'). +decode_msg_1_catch(Bin, MsgName, TrUserData) -> + try decode_msg_2_doit(MsgName, Bin, TrUserData) + catch Class:Reason:StackTrace -> error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) + end. +-else. +decode_msg_1_catch(Bin, MsgName, TrUserData) -> + try decode_msg_2_doit(MsgName, Bin, TrUserData) + catch Class:Reason -> + StackTrace = erlang:get_stacktrace(), + error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) + end. +-endif. + +decode_msg_2_doit(empty_pb, Bin, TrUserData) -> + id(decode_msg_empty_pb(Bin, TrUserData), TrUserData); +decode_msg_2_doit(gateway_success_resp_pb, Bin, + TrUserData) -> + id(decode_msg_gateway_success_resp_pb(Bin, TrUserData), + TrUserData); +decode_msg_2_doit(gateway_error_resp_pb, Bin, + TrUserData) -> + id(decode_msg_gateway_error_resp_pb(Bin, TrUserData), + TrUserData); +decode_msg_2_doit(gateway_config_req_v1_pb, Bin, + TrUserData) -> + id(decode_msg_gateway_config_req_v1_pb(Bin, TrUserData), + TrUserData); +decode_msg_2_doit(gateway_config_resp_v1_pb, Bin, + TrUserData) -> + id(decode_msg_gateway_config_resp_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_config_update_req_v1_pb, Bin, + TrUserData) -> + id(decode_msg_gateway_config_update_req_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_config_update_streamed_resp_v1_pb, + Bin, TrUserData) -> + id(decode_msg_gateway_config_update_streamed_resp_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_validators_req_v1_pb, Bin, + TrUserData) -> + id(decode_msg_gateway_validators_req_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_validators_resp_v1_pb, Bin, + TrUserData) -> + id(decode_msg_gateway_validators_resp_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_region_params_streamed_resp_v1_pb, + Bin, TrUserData) -> + id(decode_msg_gateway_region_params_streamed_resp_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_region_params_update_req_v1_pb, + Bin, TrUserData) -> + id(decode_msg_gateway_region_params_update_req_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_resp_v1_pb, Bin, + TrUserData) -> + id(decode_msg_gateway_resp_v1_pb(Bin, TrUserData), + TrUserData); +decode_msg_2_doit(gateway_sc_is_active_req_v1_pb, Bin, + TrUserData) -> + id(decode_msg_gateway_sc_is_active_req_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_sc_is_active_resp_v1_pb, Bin, + TrUserData) -> + id(decode_msg_gateway_sc_is_active_resp_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_sc_is_overpaid_req_v1_pb, Bin, + TrUserData) -> + id(decode_msg_gateway_sc_is_overpaid_req_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_sc_is_overpaid_resp_v1_pb, + Bin, TrUserData) -> + id(decode_msg_gateway_sc_is_overpaid_resp_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_sc_close_req_v1_pb, Bin, + TrUserData) -> + id(decode_msg_gateway_sc_close_req_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_sc_close_resp_v1_pb, Bin, + TrUserData) -> + id(decode_msg_gateway_sc_close_resp_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_sc_follow_req_v1_pb, Bin, + TrUserData) -> + id(decode_msg_gateway_sc_follow_req_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_sc_follow_streamed_resp_v1_pb, + Bin, TrUserData) -> + id(decode_msg_gateway_sc_follow_streamed_resp_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(routing_pb, Bin, TrUserData) -> + id(decode_msg_routing_pb(Bin, TrUserData), TrUserData); +decode_msg_2_doit(routing_address_pb, Bin, + TrUserData) -> + id(decode_msg_routing_address_pb(Bin, TrUserData), + TrUserData); +decode_msg_2_doit(gateway_routing_req_v1_pb, Bin, + TrUserData) -> + id(decode_msg_gateway_routing_req_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_routing_streamed_resp_v1_pb, + Bin, TrUserData) -> + id(decode_msg_gateway_routing_streamed_resp_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_poc_req_v1_pb, Bin, + TrUserData) -> + id(decode_msg_gateway_poc_req_v1_pb(Bin, TrUserData), + TrUserData); +decode_msg_2_doit(gateway_poc_challenge_notification_resp_v1_pb, + Bin, TrUserData) -> + id(decode_msg_gateway_poc_challenge_notification_resp_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_poc_check_challenge_target_req_v1_pb, + Bin, TrUserData) -> + id(decode_msg_gateway_poc_check_challenge_target_req_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_poc_check_challenge_target_resp_v1_pb, + Bin, TrUserData) -> + id(decode_msg_gateway_poc_check_challenge_target_resp_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_poc_report_req_v1_pb, Bin, + TrUserData) -> + id(decode_msg_gateway_poc_report_req_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_address_routing_data_req_v1_pb, + Bin, TrUserData) -> + id(decode_msg_gateway_address_routing_data_req_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_poc_key_routing_data_req_v1_pb, + Bin, TrUserData) -> + id(decode_msg_gateway_poc_key_routing_data_req_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(gateway_public_routing_data_resp_v1_pb, + Bin, TrUserData) -> + id(decode_msg_gateway_public_routing_data_resp_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_state_channel_summary_v1_pb, + Bin, TrUserData) -> + id(decode_msg_blockchain_state_channel_summary_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_state_channel_v1_pb, Bin, + TrUserData) -> + id(decode_msg_blockchain_state_channel_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_state_channel_response_v1_pb, + Bin, TrUserData) -> + id(decode_msg_blockchain_state_channel_response_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_state_channel_packet_v1_pb, + Bin, TrUserData) -> + id(decode_msg_blockchain_state_channel_packet_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_state_channel_offer_v1_pb, + Bin, TrUserData) -> + id(decode_msg_blockchain_state_channel_offer_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_state_channel_purchase_v1_pb, + Bin, TrUserData) -> + id(decode_msg_blockchain_state_channel_purchase_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_state_channel_diff_v1_pb, + Bin, TrUserData) -> + id(decode_msg_blockchain_state_channel_diff_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_state_channel_diff_entry_v1_pb, + Bin, TrUserData) -> + id(decode_msg_blockchain_state_channel_diff_entry_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_state_channel_diff_append_summary_v1_pb, + Bin, TrUserData) -> + id(decode_msg_blockchain_state_channel_diff_append_summary_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_state_channel_diff_update_summary_v1_pb, + Bin, TrUserData) -> + id(decode_msg_blockchain_state_channel_diff_update_summary_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_state_channel_banner_v1_pb, + Bin, TrUserData) -> + id(decode_msg_blockchain_state_channel_banner_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_state_channel_rejection_v1_pb, + Bin, TrUserData) -> + id(decode_msg_blockchain_state_channel_rejection_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_state_channel_message_v1_pb, + Bin, TrUserData) -> + id(decode_msg_blockchain_state_channel_message_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(eui_pb, Bin, TrUserData) -> + id(decode_msg_eui_pb(Bin, TrUserData), TrUserData); +decode_msg_2_doit(routing_information_pb, Bin, + TrUserData) -> + id(decode_msg_routing_information_pb(Bin, TrUserData), + TrUserData); +decode_msg_2_doit(window_pb, Bin, TrUserData) -> + id(decode_msg_window_pb(Bin, TrUserData), TrUserData); +decode_msg_2_doit(packet_pb, Bin, TrUserData) -> + id(decode_msg_packet_pb(Bin, TrUserData), TrUserData); +decode_msg_2_doit(blockchain_txn_state_channel_close_v1_pb, + Bin, TrUserData) -> + id(decode_msg_blockchain_txn_state_channel_close_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_var_v1_pb, Bin, + TrUserData) -> + id(decode_msg_blockchain_var_v1_pb(Bin, TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_txn_vars_v1_pb, Bin, + TrUserData) -> + id(decode_msg_blockchain_txn_vars_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_txn_poc_receipts_v1_pb, + Bin, TrUserData) -> + id(decode_msg_blockchain_txn_poc_receipts_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_poc_receipt_v1_pb, Bin, + TrUserData) -> + id(decode_msg_blockchain_poc_receipt_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_poc_witness_v1_pb, Bin, + TrUserData) -> + id(decode_msg_blockchain_poc_witness_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_poc_response_v1_pb, Bin, + TrUserData) -> + id(decode_msg_blockchain_poc_response_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_poc_path_element_v1_pb, + Bin, TrUserData) -> + id(decode_msg_blockchain_poc_path_element_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_txn_poc_receipts_v2_pb, + Bin, TrUserData) -> + id(decode_msg_blockchain_txn_poc_receipts_v2_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_region_params_v1_pb, Bin, + TrUserData) -> + id(decode_msg_blockchain_region_params_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(tagged_spreading_pb, Bin, + TrUserData) -> + id(decode_msg_tagged_spreading_pb(Bin, TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_region_spreading_v1_pb, + Bin, TrUserData) -> + id(decode_msg_blockchain_region_spreading_v1_pb(Bin, + TrUserData), + TrUserData); +decode_msg_2_doit(blockchain_region_param_v1_pb, Bin, + TrUserData) -> + id(decode_msg_blockchain_region_param_v1_pb(Bin, + TrUserData), + TrUserData). + + + +decode_msg_empty_pb(Bin, TrUserData) -> + dfp_read_field_def_empty_pb(Bin, 0, 0, TrUserData). + +dfp_read_field_def_empty_pb(<<>>, 0, 0, _) -> + #empty_pb{}; +dfp_read_field_def_empty_pb(Other, Z1, Z2, + TrUserData) -> + dg_read_field_def_empty_pb(Other, Z1, Z2, TrUserData). + +dg_read_field_def_empty_pb(<<1:1, X:7, Rest/binary>>, N, + Acc, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_empty_pb(Rest, + N + 7, + X bsl N + Acc, + TrUserData); +dg_read_field_def_empty_pb(<<0:1, X:7, Rest/binary>>, N, + Acc, TrUserData) -> + Key = X bsl N + Acc, + case Key band 7 of + 0 -> skip_varint_empty_pb(Rest, 0, 0, TrUserData); + 1 -> skip_64_empty_pb(Rest, 0, 0, TrUserData); + 2 -> + skip_length_delimited_empty_pb(Rest, 0, 0, TrUserData); + 3 -> + skip_group_empty_pb(Rest, Key bsr 3, 0, TrUserData); + 5 -> skip_32_empty_pb(Rest, 0, 0, TrUserData) + end; +dg_read_field_def_empty_pb(<<>>, 0, 0, _) -> + #empty_pb{}. + +skip_varint_empty_pb(<<1:1, _:7, Rest/binary>>, Z1, Z2, + TrUserData) -> + skip_varint_empty_pb(Rest, Z1, Z2, TrUserData); +skip_varint_empty_pb(<<0:1, _:7, Rest/binary>>, Z1, Z2, + TrUserData) -> + dfp_read_field_def_empty_pb(Rest, Z1, Z2, TrUserData). + +skip_length_delimited_empty_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, TrUserData) + when N < 57 -> + skip_length_delimited_empty_pb(Rest, + N + 7, + X bsl N + Acc, + TrUserData); +skip_length_delimited_empty_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_empty_pb(Rest2, 0, 0, TrUserData). + +skip_group_empty_pb(Bin, FNum, Z2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_empty_pb(Rest, 0, Z2, TrUserData). + +skip_32_empty_pb(<<_:32, Rest/binary>>, Z1, Z2, + TrUserData) -> + dfp_read_field_def_empty_pb(Rest, Z1, Z2, TrUserData). + +skip_64_empty_pb(<<_:64, Rest/binary>>, Z1, Z2, + TrUserData) -> + dfp_read_field_def_empty_pb(Rest, Z1, Z2, TrUserData). + +decode_msg_gateway_success_resp_pb(Bin, TrUserData) -> + dfp_read_field_def_gateway_success_resp_pb(Bin, + 0, + 0, + id(<<>>, TrUserData), + id(<<>>, TrUserData), + TrUserData). + +dfp_read_field_def_gateway_success_resp_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + d_field_gateway_success_resp_pb_resp(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_gateway_success_resp_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + d_field_gateway_success_resp_pb_details(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_gateway_success_resp_pb(<<>>, 0, 0, + F@_1, F@_2, _) -> + #gateway_success_resp_pb{resp = F@_1, details = F@_2}; +dfp_read_field_def_gateway_success_resp_pb(Other, Z1, + Z2, F@_1, F@_2, TrUserData) -> + dg_read_field_def_gateway_success_resp_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +dg_read_field_def_gateway_success_resp_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_success_resp_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +dg_read_field_def_gateway_success_resp_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_success_resp_pb_resp(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 18 -> + d_field_gateway_success_resp_pb_details(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_success_resp_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 1 -> + skip_64_gateway_success_resp_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 2 -> + skip_length_delimited_gateway_success_resp_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 3 -> + skip_group_gateway_success_resp_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + TrUserData); + 5 -> + skip_32_gateway_success_resp_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData) + end + end; +dg_read_field_def_gateway_success_resp_pb(<<>>, 0, 0, + F@_1, F@_2, _) -> + #gateway_success_resp_pb{resp = F@_1, details = F@_2}. + +d_field_gateway_success_resp_pb_resp(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + d_field_gateway_success_resp_pb_resp(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_gateway_success_resp_pb_resp(<<0:1, X:7, + Rest/binary>>, + N, Acc, _, F@_2, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_success_resp_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + TrUserData). + +d_field_gateway_success_resp_pb_details(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + d_field_gateway_success_resp_pb_details(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_gateway_success_resp_pb_details(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, _, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_success_resp_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + TrUserData). + +skip_varint_gateway_success_resp_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + skip_varint_gateway_success_resp_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +skip_varint_gateway_success_resp_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_gateway_success_resp_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_length_delimited_gateway_success_resp_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + skip_length_delimited_gateway_success_resp_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +skip_length_delimited_gateway_success_resp_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_success_resp_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + TrUserData). + +skip_group_gateway_success_resp_pb(Bin, FNum, Z2, F@_1, + F@_2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_success_resp_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_32_gateway_success_resp_pb(<<_:32, Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_gateway_success_resp_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_64_gateway_success_resp_pb(<<_:64, Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_gateway_success_resp_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +decode_msg_gateway_error_resp_pb(Bin, TrUserData) -> + dfp_read_field_def_gateway_error_resp_pb(Bin, + 0, + 0, + id(<<>>, TrUserData), + id(<<>>, TrUserData), + TrUserData). + +dfp_read_field_def_gateway_error_resp_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + d_field_gateway_error_resp_pb_error(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_gateway_error_resp_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + d_field_gateway_error_resp_pb_details(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_gateway_error_resp_pb(<<>>, 0, 0, + F@_1, F@_2, _) -> + #gateway_error_resp_pb{error = F@_1, details = F@_2}; +dfp_read_field_def_gateway_error_resp_pb(Other, Z1, Z2, + F@_1, F@_2, TrUserData) -> + dg_read_field_def_gateway_error_resp_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +dg_read_field_def_gateway_error_resp_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_error_resp_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +dg_read_field_def_gateway_error_resp_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_error_resp_pb_error(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 18 -> + d_field_gateway_error_resp_pb_details(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_error_resp_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 1 -> + skip_64_gateway_error_resp_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 2 -> + skip_length_delimited_gateway_error_resp_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 3 -> + skip_group_gateway_error_resp_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + TrUserData); + 5 -> + skip_32_gateway_error_resp_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData) + end + end; +dg_read_field_def_gateway_error_resp_pb(<<>>, 0, 0, + F@_1, F@_2, _) -> + #gateway_error_resp_pb{error = F@_1, details = F@_2}. + +d_field_gateway_error_resp_pb_error(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + d_field_gateway_error_resp_pb_error(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_gateway_error_resp_pb_error(<<0:1, X:7, + Rest/binary>>, + N, Acc, _, F@_2, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_error_resp_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + TrUserData). + +d_field_gateway_error_resp_pb_details(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + d_field_gateway_error_resp_pb_details(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_gateway_error_resp_pb_details(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, _, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_error_resp_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + TrUserData). + +skip_varint_gateway_error_resp_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + skip_varint_gateway_error_resp_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +skip_varint_gateway_error_resp_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_gateway_error_resp_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_length_delimited_gateway_error_resp_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + skip_length_delimited_gateway_error_resp_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +skip_length_delimited_gateway_error_resp_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_error_resp_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + TrUserData). + +skip_group_gateway_error_resp_pb(Bin, FNum, Z2, F@_1, + F@_2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_error_resp_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_32_gateway_error_resp_pb(<<_:32, Rest/binary>>, Z1, + Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_gateway_error_resp_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_64_gateway_error_resp_pb(<<_:64, Rest/binary>>, Z1, + Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_gateway_error_resp_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +decode_msg_gateway_config_req_v1_pb(Bin, TrUserData) -> + dfp_read_field_def_gateway_config_req_v1_pb(Bin, + 0, + 0, + id([], TrUserData), + TrUserData). + +dfp_read_field_def_gateway_config_req_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + d_field_gateway_config_req_v1_pb_keys(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_gateway_config_req_v1_pb(<<>>, 0, 0, + R1, TrUserData) -> + #gateway_config_req_v1_pb{keys = + lists_reverse(R1, TrUserData)}; +dfp_read_field_def_gateway_config_req_v1_pb(Other, Z1, + Z2, F@_1, TrUserData) -> + dg_read_field_def_gateway_config_req_v1_pb(Other, + Z1, + Z2, + F@_1, + TrUserData). + +dg_read_field_def_gateway_config_req_v1_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_config_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +dg_read_field_def_gateway_config_req_v1_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_config_req_v1_pb_keys(Rest, + 0, + 0, + F@_1, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_config_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 1 -> + skip_64_gateway_config_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 2 -> + skip_length_delimited_gateway_config_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 3 -> + skip_group_gateway_config_req_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + TrUserData); + 5 -> + skip_32_gateway_config_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData) + end + end; +dg_read_field_def_gateway_config_req_v1_pb(<<>>, 0, 0, + R1, TrUserData) -> + #gateway_config_req_v1_pb{keys = + lists_reverse(R1, TrUserData)}. + +d_field_gateway_config_req_v1_pb_keys(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + d_field_gateway_config_req_v1_pb_keys(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_gateway_config_req_v1_pb_keys(<<0:1, X:7, + Rest/binary>>, + N, Acc, Prev, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(unicode:characters_to_list(Utf8, unicode), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_config_req_v1_pb(RestF, + 0, + 0, + cons(NewFValue, + Prev, + TrUserData), + TrUserData). + +skip_varint_gateway_config_req_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + skip_varint_gateway_config_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData); +skip_varint_gateway_config_req_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_config_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_length_delimited_gateway_config_req_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + skip_length_delimited_gateway_config_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +skip_length_delimited_gateway_config_req_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_config_req_v1_pb(Rest2, + 0, + 0, + F@_1, + TrUserData). + +skip_group_gateway_config_req_v1_pb(Bin, FNum, Z2, F@_1, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_config_req_v1_pb(Rest, + 0, + Z2, + F@_1, + TrUserData). + +skip_32_gateway_config_req_v1_pb(<<_:32, Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_config_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_64_gateway_config_req_v1_pb(<<_:64, Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_config_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +decode_msg_gateway_config_resp_v1_pb(Bin, TrUserData) -> + dfp_read_field_def_gateway_config_resp_v1_pb(Bin, + 0, + 0, + id([], TrUserData), + TrUserData). + +dfp_read_field_def_gateway_config_resp_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + d_field_gateway_config_resp_v1_pb_result(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_gateway_config_resp_v1_pb(<<>>, 0, 0, + R1, TrUserData) -> + #gateway_config_resp_v1_pb{result = + lists_reverse(R1, TrUserData)}; +dfp_read_field_def_gateway_config_resp_v1_pb(Other, Z1, + Z2, F@_1, TrUserData) -> + dg_read_field_def_gateway_config_resp_v1_pb(Other, + Z1, + Z2, + F@_1, + TrUserData). + +dg_read_field_def_gateway_config_resp_v1_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_config_resp_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +dg_read_field_def_gateway_config_resp_v1_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_config_resp_v1_pb_result(Rest, + 0, + 0, + F@_1, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_config_resp_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 1 -> + skip_64_gateway_config_resp_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 2 -> + skip_length_delimited_gateway_config_resp_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 3 -> + skip_group_gateway_config_resp_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + TrUserData); + 5 -> + skip_32_gateway_config_resp_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData) + end + end; +dg_read_field_def_gateway_config_resp_v1_pb(<<>>, 0, 0, + R1, TrUserData) -> + #gateway_config_resp_v1_pb{result = + lists_reverse(R1, TrUserData)}. + +d_field_gateway_config_resp_v1_pb_result(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + d_field_gateway_config_resp_v1_pb_result(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_gateway_config_resp_v1_pb_result(<<0:1, X:7, + Rest/binary>>, + N, Acc, Prev, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_var_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_config_resp_v1_pb(RestF, + 0, + 0, + cons(NewFValue, + Prev, + TrUserData), + TrUserData). + +skip_varint_gateway_config_resp_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + skip_varint_gateway_config_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData); +skip_varint_gateway_config_resp_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_config_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_length_delimited_gateway_config_resp_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + skip_length_delimited_gateway_config_resp_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +skip_length_delimited_gateway_config_resp_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_config_resp_v1_pb(Rest2, + 0, + 0, + F@_1, + TrUserData). + +skip_group_gateway_config_resp_v1_pb(Bin, FNum, Z2, + F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_config_resp_v1_pb(Rest, + 0, + Z2, + F@_1, + TrUserData). + +skip_32_gateway_config_resp_v1_pb(<<_:32, Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_config_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_64_gateway_config_resp_v1_pb(<<_:64, Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_config_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +decode_msg_gateway_config_update_req_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_config_update_req_v1_pb(Bin, + 0, + 0, + TrUserData). + +dfp_read_field_def_gateway_config_update_req_v1_pb(<<>>, + 0, 0, _) -> + #gateway_config_update_req_v1_pb{}; +dfp_read_field_def_gateway_config_update_req_v1_pb(Other, + Z1, Z2, TrUserData) -> + dg_read_field_def_gateway_config_update_req_v1_pb(Other, + Z1, + Z2, + TrUserData). + +dg_read_field_def_gateway_config_update_req_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_config_update_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + TrUserData); +dg_read_field_def_gateway_config_update_req_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, TrUserData) -> + Key = X bsl N + Acc, + case Key band 7 of + 0 -> + skip_varint_gateway_config_update_req_v1_pb(Rest, + 0, + 0, + TrUserData); + 1 -> + skip_64_gateway_config_update_req_v1_pb(Rest, + 0, + 0, + TrUserData); + 2 -> + skip_length_delimited_gateway_config_update_req_v1_pb(Rest, + 0, + 0, + TrUserData); + 3 -> + skip_group_gateway_config_update_req_v1_pb(Rest, + Key bsr 3, + 0, + TrUserData); + 5 -> + skip_32_gateway_config_update_req_v1_pb(Rest, + 0, + 0, + TrUserData) + end; +dg_read_field_def_gateway_config_update_req_v1_pb(<<>>, + 0, 0, _) -> + #gateway_config_update_req_v1_pb{}. + +skip_varint_gateway_config_update_req_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, TrUserData) -> + skip_varint_gateway_config_update_req_v1_pb(Rest, + Z1, + Z2, + TrUserData); +skip_varint_gateway_config_update_req_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, TrUserData) -> + dfp_read_field_def_gateway_config_update_req_v1_pb(Rest, + Z1, + Z2, + TrUserData). + +skip_length_delimited_gateway_config_update_req_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, TrUserData) + when N < 57 -> + skip_length_delimited_gateway_config_update_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + TrUserData); +skip_length_delimited_gateway_config_update_req_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_config_update_req_v1_pb(Rest2, + 0, + 0, + TrUserData). + +skip_group_gateway_config_update_req_v1_pb(Bin, FNum, + Z2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_config_update_req_v1_pb(Rest, + 0, + Z2, + TrUserData). + +skip_32_gateway_config_update_req_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, TrUserData) -> + dfp_read_field_def_gateway_config_update_req_v1_pb(Rest, + Z1, + Z2, + TrUserData). + +skip_64_gateway_config_update_req_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, TrUserData) -> + dfp_read_field_def_gateway_config_update_req_v1_pb(Rest, + Z1, + Z2, + TrUserData). + +decode_msg_gateway_config_update_streamed_resp_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_config_update_streamed_resp_v1_pb(Bin, + 0, + 0, + id([], + TrUserData), + TrUserData). + +dfp_read_field_def_gateway_config_update_streamed_resp_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, + TrUserData) -> + d_field_gateway_config_update_streamed_resp_v1_pb_keys(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_gateway_config_update_streamed_resp_v1_pb(<<>>, + 0, 0, R1, + TrUserData) -> + #gateway_config_update_streamed_resp_v1_pb{keys = + lists_reverse(R1, + TrUserData)}; +dfp_read_field_def_gateway_config_update_streamed_resp_v1_pb(Other, + Z1, Z2, F@_1, + TrUserData) -> + dg_read_field_def_gateway_config_update_streamed_resp_v1_pb(Other, + Z1, + Z2, + F@_1, + TrUserData). + +dg_read_field_def_gateway_config_update_streamed_resp_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_config_update_streamed_resp_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +dg_read_field_def_gateway_config_update_streamed_resp_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_config_update_streamed_resp_v1_pb_keys(Rest, + 0, + 0, + F@_1, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_config_update_streamed_resp_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 1 -> + skip_64_gateway_config_update_streamed_resp_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 2 -> + skip_length_delimited_gateway_config_update_streamed_resp_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 3 -> + skip_group_gateway_config_update_streamed_resp_v1_pb(Rest, + Key bsr + 3, + 0, + F@_1, + TrUserData); + 5 -> + skip_32_gateway_config_update_streamed_resp_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData) + end + end; +dg_read_field_def_gateway_config_update_streamed_resp_v1_pb(<<>>, + 0, 0, R1, + TrUserData) -> + #gateway_config_update_streamed_resp_v1_pb{keys = + lists_reverse(R1, + TrUserData)}. + +d_field_gateway_config_update_streamed_resp_v1_pb_keys(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + d_field_gateway_config_update_streamed_resp_v1_pb_keys(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_gateway_config_update_streamed_resp_v1_pb_keys(<<0:1, + X:7, Rest/binary>>, + N, Acc, Prev, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(unicode:characters_to_list(Utf8, unicode), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_config_update_streamed_resp_v1_pb(RestF, + 0, + 0, + cons(NewFValue, + Prev, + TrUserData), + TrUserData). + +skip_varint_gateway_config_update_streamed_resp_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, + TrUserData) -> + skip_varint_gateway_config_update_streamed_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData); +skip_varint_gateway_config_update_streamed_resp_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, + TrUserData) -> + dfp_read_field_def_gateway_config_update_streamed_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_length_delimited_gateway_config_update_streamed_resp_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + TrUserData) + when N < 57 -> + skip_length_delimited_gateway_config_update_streamed_resp_v1_pb(Rest, + N + 7, + X bsl N + + Acc, + F@_1, + TrUserData); +skip_length_delimited_gateway_config_update_streamed_resp_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_config_update_streamed_resp_v1_pb(Rest2, + 0, + 0, + F@_1, + TrUserData). + +skip_group_gateway_config_update_streamed_resp_v1_pb(Bin, + FNum, Z2, F@_1, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_config_update_streamed_resp_v1_pb(Rest, + 0, + Z2, + F@_1, + TrUserData). + +skip_32_gateway_config_update_streamed_resp_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_config_update_streamed_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_64_gateway_config_update_streamed_resp_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_config_update_streamed_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +decode_msg_gateway_validators_req_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_validators_req_v1_pb(Bin, + 0, + 0, + id(0, TrUserData), + TrUserData). + +dfp_read_field_def_gateway_validators_req_v1_pb(<<8, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + d_field_gateway_validators_req_v1_pb_quantity(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_gateway_validators_req_v1_pb(<<>>, 0, + 0, F@_1, _) -> + #gateway_validators_req_v1_pb{quantity = F@_1}; +dfp_read_field_def_gateway_validators_req_v1_pb(Other, + Z1, Z2, F@_1, TrUserData) -> + dg_read_field_def_gateway_validators_req_v1_pb(Other, + Z1, + Z2, + F@_1, + TrUserData). + +dg_read_field_def_gateway_validators_req_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_validators_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +dg_read_field_def_gateway_validators_req_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 8 -> + d_field_gateway_validators_req_v1_pb_quantity(Rest, + 0, + 0, + F@_1, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_validators_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 1 -> + skip_64_gateway_validators_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 2 -> + skip_length_delimited_gateway_validators_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 3 -> + skip_group_gateway_validators_req_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + TrUserData); + 5 -> + skip_32_gateway_validators_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData) + end + end; +dg_read_field_def_gateway_validators_req_v1_pb(<<>>, 0, + 0, F@_1, _) -> + #gateway_validators_req_v1_pb{quantity = F@_1}. + +d_field_gateway_validators_req_v1_pb_quantity(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + d_field_gateway_validators_req_v1_pb_quantity(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_gateway_validators_req_v1_pb_quantity(<<0:1, + X:7, Rest/binary>>, + N, Acc, _, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_gateway_validators_req_v1_pb(RestF, + 0, + 0, + NewFValue, + TrUserData). + +skip_varint_gateway_validators_req_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + skip_varint_gateway_validators_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData); +skip_varint_gateway_validators_req_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_validators_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_length_delimited_gateway_validators_req_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + skip_length_delimited_gateway_validators_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +skip_length_delimited_gateway_validators_req_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_validators_req_v1_pb(Rest2, + 0, + 0, + F@_1, + TrUserData). + +skip_group_gateway_validators_req_v1_pb(Bin, FNum, Z2, + F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_validators_req_v1_pb(Rest, + 0, + Z2, + F@_1, + TrUserData). + +skip_32_gateway_validators_req_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_validators_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_64_gateway_validators_req_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_validators_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +decode_msg_gateway_validators_resp_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_validators_resp_v1_pb(Bin, + 0, + 0, + id([], TrUserData), + TrUserData). + +dfp_read_field_def_gateway_validators_resp_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + d_field_gateway_validators_resp_v1_pb_result(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_gateway_validators_resp_v1_pb(<<>>, + 0, 0, R1, TrUserData) -> + #gateway_validators_resp_v1_pb{result = + lists_reverse(R1, TrUserData)}; +dfp_read_field_def_gateway_validators_resp_v1_pb(Other, + Z1, Z2, F@_1, TrUserData) -> + dg_read_field_def_gateway_validators_resp_v1_pb(Other, + Z1, + Z2, + F@_1, + TrUserData). + +dg_read_field_def_gateway_validators_resp_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_validators_resp_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +dg_read_field_def_gateway_validators_resp_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_validators_resp_v1_pb_result(Rest, + 0, + 0, + F@_1, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_validators_resp_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 1 -> + skip_64_gateway_validators_resp_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 2 -> + skip_length_delimited_gateway_validators_resp_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 3 -> + skip_group_gateway_validators_resp_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + TrUserData); + 5 -> + skip_32_gateway_validators_resp_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData) + end + end; +dg_read_field_def_gateway_validators_resp_v1_pb(<<>>, 0, + 0, R1, TrUserData) -> + #gateway_validators_resp_v1_pb{result = + lists_reverse(R1, TrUserData)}. + +d_field_gateway_validators_resp_v1_pb_result(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + d_field_gateway_validators_resp_v1_pb_result(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_gateway_validators_resp_v1_pb_result(<<0:1, X:7, + Rest/binary>>, + N, Acc, Prev, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_routing_address_pb(Bs, TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_validators_resp_v1_pb(RestF, + 0, + 0, + cons(NewFValue, + Prev, + TrUserData), + TrUserData). + +skip_varint_gateway_validators_resp_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + skip_varint_gateway_validators_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData); +skip_varint_gateway_validators_resp_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_validators_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_length_delimited_gateway_validators_resp_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + skip_length_delimited_gateway_validators_resp_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +skip_length_delimited_gateway_validators_resp_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_validators_resp_v1_pb(Rest2, + 0, + 0, + F@_1, + TrUserData). + +skip_group_gateway_validators_resp_v1_pb(Bin, FNum, Z2, + F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_validators_resp_v1_pb(Rest, + 0, + Z2, + F@_1, + TrUserData). + +skip_32_gateway_validators_resp_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_validators_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_64_gateway_validators_resp_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_validators_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +decode_msg_gateway_region_params_streamed_resp_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_region_params_streamed_resp_v1_pb(Bin, + 0, + 0, + id(<<>>, + TrUserData), + id('US915', + TrUserData), + id(undefined, + TrUserData), + TrUserData). + +dfp_read_field_def_gateway_region_params_streamed_resp_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, + TrUserData) -> + d_field_gateway_region_params_streamed_resp_v1_pb_address(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_gateway_region_params_streamed_resp_v1_pb(<<16, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, + TrUserData) -> + d_field_gateway_region_params_streamed_resp_v1_pb_region(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_gateway_region_params_streamed_resp_v1_pb(<<26, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, + TrUserData) -> + d_field_gateway_region_params_streamed_resp_v1_pb_params(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_gateway_region_params_streamed_resp_v1_pb(<<>>, + 0, 0, F@_1, F@_2, + F@_3, _) -> + #gateway_region_params_streamed_resp_v1_pb{address = + F@_1, + region = F@_2, params = F@_3}; +dfp_read_field_def_gateway_region_params_streamed_resp_v1_pb(Other, + Z1, Z2, F@_1, F@_2, + F@_3, + TrUserData) -> + dg_read_field_def_gateway_region_params_streamed_resp_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +dg_read_field_def_gateway_region_params_streamed_resp_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_region_params_streamed_resp_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +dg_read_field_def_gateway_region_params_streamed_resp_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_region_params_streamed_resp_v1_pb_address(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 16 -> + d_field_gateway_region_params_streamed_resp_v1_pb_region(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 26 -> + d_field_gateway_region_params_streamed_resp_v1_pb_params(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_region_params_streamed_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 1 -> + skip_64_gateway_region_params_streamed_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 2 -> + skip_length_delimited_gateway_region_params_streamed_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 3 -> + skip_group_gateway_region_params_streamed_resp_v1_pb(Rest, + Key bsr + 3, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 5 -> + skip_32_gateway_region_params_streamed_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData) + end + end; +dg_read_field_def_gateway_region_params_streamed_resp_v1_pb(<<>>, + 0, 0, F@_1, F@_2, + F@_3, _) -> + #gateway_region_params_streamed_resp_v1_pb{address = + F@_1, + region = F@_2, params = F@_3}. + +d_field_gateway_region_params_streamed_resp_v1_pb_address(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, TrUserData) + when N < 57 -> + d_field_gateway_region_params_streamed_resp_v1_pb_address(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_gateway_region_params_streamed_resp_v1_pb_address(<<0:1, + X:7, Rest/binary>>, + N, Acc, _, F@_2, F@_3, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_region_params_streamed_resp_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + TrUserData). + +d_field_gateway_region_params_streamed_resp_v1_pb_region(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, TrUserData) + when N < 57 -> + d_field_gateway_region_params_streamed_resp_v1_pb_region(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_gateway_region_params_streamed_resp_v1_pb_region(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, _, F@_3, + TrUserData) -> + {NewFValue, RestF} = {id('d_enum_helium.region'(begin + <> = + <<(X bsl N + + Acc):32/unsigned-native>>, + id(Res, TrUserData) + end), + TrUserData), + Rest}, + dfp_read_field_def_gateway_region_params_streamed_resp_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + TrUserData). + +d_field_gateway_region_params_streamed_resp_v1_pb_params(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, TrUserData) + when N < 57 -> + d_field_gateway_region_params_streamed_resp_v1_pb_params(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_gateway_region_params_streamed_resp_v1_pb_params(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + Prev, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_region_params_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_region_params_streamed_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + if Prev == + undefined -> + NewFValue; + true -> + merge_msg_blockchain_region_params_v1_pb(Prev, + NewFValue, + TrUserData) + end, + TrUserData). + +skip_varint_gateway_region_params_streamed_resp_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + skip_varint_gateway_region_params_streamed_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_varint_gateway_region_params_streamed_resp_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_gateway_region_params_streamed_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_length_delimited_gateway_region_params_streamed_resp_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, + TrUserData) + when N < 57 -> + skip_length_delimited_gateway_region_params_streamed_resp_v1_pb(Rest, + N + 7, + X bsl N + + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_length_delimited_gateway_region_params_streamed_resp_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_region_params_streamed_resp_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_group_gateway_region_params_streamed_resp_v1_pb(Bin, + FNum, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_region_params_streamed_resp_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_32_gateway_region_params_streamed_resp_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_gateway_region_params_streamed_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_64_gateway_region_params_streamed_resp_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_gateway_region_params_streamed_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +decode_msg_gateway_region_params_update_req_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_region_params_update_req_v1_pb(Bin, + 0, + 0, + id(<<>>, + TrUserData), + id(<<>>, + TrUserData), + TrUserData). + +dfp_read_field_def_gateway_region_params_update_req_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + d_field_gateway_region_params_update_req_v1_pb_address(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_gateway_region_params_update_req_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + d_field_gateway_region_params_update_req_v1_pb_signature(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_gateway_region_params_update_req_v1_pb(<<>>, + 0, 0, F@_1, F@_2, + _) -> + #gateway_region_params_update_req_v1_pb{address = F@_1, + signature = F@_2}; +dfp_read_field_def_gateway_region_params_update_req_v1_pb(Other, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dg_read_field_def_gateway_region_params_update_req_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +dg_read_field_def_gateway_region_params_update_req_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_region_params_update_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +dg_read_field_def_gateway_region_params_update_req_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_region_params_update_req_v1_pb_address(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 18 -> + d_field_gateway_region_params_update_req_v1_pb_signature(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_region_params_update_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 1 -> + skip_64_gateway_region_params_update_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 2 -> + skip_length_delimited_gateway_region_params_update_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 3 -> + skip_group_gateway_region_params_update_req_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + TrUserData); + 5 -> + skip_32_gateway_region_params_update_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData) + end + end; +dg_read_field_def_gateway_region_params_update_req_v1_pb(<<>>, + 0, 0, F@_1, F@_2, _) -> + #gateway_region_params_update_req_v1_pb{address = F@_1, + signature = F@_2}. + +d_field_gateway_region_params_update_req_v1_pb_address(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) + when N < 57 -> + d_field_gateway_region_params_update_req_v1_pb_address(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_gateway_region_params_update_req_v1_pb_address(<<0:1, + X:7, Rest/binary>>, + N, Acc, _, F@_2, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_region_params_update_req_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + TrUserData). + +d_field_gateway_region_params_update_req_v1_pb_signature(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) + when N < 57 -> + d_field_gateway_region_params_update_req_v1_pb_signature(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_gateway_region_params_update_req_v1_pb_signature(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, _, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_region_params_update_req_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + TrUserData). + +skip_varint_gateway_region_params_update_req_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + skip_varint_gateway_region_params_update_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +skip_varint_gateway_region_params_update_req_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dfp_read_field_def_gateway_region_params_update_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_length_delimited_gateway_region_params_update_req_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) + when N < 57 -> + skip_length_delimited_gateway_region_params_update_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +skip_length_delimited_gateway_region_params_update_req_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_region_params_update_req_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + TrUserData). + +skip_group_gateway_region_params_update_req_v1_pb(Bin, + FNum, Z2, F@_1, F@_2, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_region_params_update_req_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_32_gateway_region_params_update_req_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dfp_read_field_def_gateway_region_params_update_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_64_gateway_region_params_update_req_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dfp_read_field_def_gateway_region_params_update_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +decode_msg_gateway_resp_v1_pb(Bin, TrUserData) -> + dfp_read_field_def_gateway_resp_v1_pb(Bin, + 0, + 0, + id(0, TrUserData), + id(<<>>, TrUserData), + id(undefined, TrUserData), + id(0, TrUserData), + id(0, TrUserData), + TrUserData). + +dfp_read_field_def_gateway_resp_v1_pb(<<8, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + d_field_gateway_resp_v1_pb_height(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_resp_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + d_field_gateway_resp_v1_pb_signature(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_resp_v1_pb(<<26, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + d_field_gateway_resp_v1_pb_is_active_resp(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_resp_v1_pb(<<34, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + d_field_gateway_resp_v1_pb_is_overpaid_resp(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_resp_v1_pb(<<42, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + d_field_gateway_resp_v1_pb_close_resp(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_resp_v1_pb(<<50, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + d_field_gateway_resp_v1_pb_follow_streamed_resp(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_resp_v1_pb(<<58, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + d_field_gateway_resp_v1_pb_routing_streamed_resp(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_resp_v1_pb(<<66, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + d_field_gateway_resp_v1_pb_config_resp(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_resp_v1_pb(<<74, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + d_field_gateway_resp_v1_pb_config_update_streamed_resp(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_resp_v1_pb(<<98, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + d_field_gateway_resp_v1_pb_validators_resp(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_resp_v1_pb(<<106, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + d_field_gateway_resp_v1_pb_region_params_streamed_resp(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_resp_v1_pb(<<114, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + d_field_gateway_resp_v1_pb_success_resp(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_resp_v1_pb(<<122, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + d_field_gateway_resp_v1_pb_error_resp(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_resp_v1_pb(<<130, 1, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + d_field_gateway_resp_v1_pb_poc_challenge_resp(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_resp_v1_pb(<<138, 1, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + d_field_gateway_resp_v1_pb_poc_check_target_resp(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_resp_v1_pb(<<146, 1, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + d_field_gateway_resp_v1_pb_public_route(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_resp_v1_pb(<<80, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + d_field_gateway_resp_v1_pb_block_time(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_resp_v1_pb(<<88, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + d_field_gateway_resp_v1_pb_block_age(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_resp_v1_pb(<<>>, 0, 0, F@_1, + F@_2, F@_3, F@_4, F@_5, _) -> + #gateway_resp_v1_pb{height = F@_1, signature = F@_2, + msg = F@_3, block_time = F@_4, block_age = F@_5}; +dfp_read_field_def_gateway_resp_v1_pb(Other, Z1, Z2, + F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + dg_read_field_def_gateway_resp_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +dg_read_field_def_gateway_resp_v1_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_resp_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dg_read_field_def_gateway_resp_v1_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 8 -> + d_field_gateway_resp_v1_pb_height(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 18 -> + d_field_gateway_resp_v1_pb_signature(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 26 -> + d_field_gateway_resp_v1_pb_is_active_resp(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 34 -> + d_field_gateway_resp_v1_pb_is_overpaid_resp(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 42 -> + d_field_gateway_resp_v1_pb_close_resp(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 50 -> + d_field_gateway_resp_v1_pb_follow_streamed_resp(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 58 -> + d_field_gateway_resp_v1_pb_routing_streamed_resp(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 66 -> + d_field_gateway_resp_v1_pb_config_resp(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 74 -> + d_field_gateway_resp_v1_pb_config_update_streamed_resp(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 98 -> + d_field_gateway_resp_v1_pb_validators_resp(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 106 -> + d_field_gateway_resp_v1_pb_region_params_streamed_resp(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 114 -> + d_field_gateway_resp_v1_pb_success_resp(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 122 -> + d_field_gateway_resp_v1_pb_error_resp(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 130 -> + d_field_gateway_resp_v1_pb_poc_challenge_resp(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 138 -> + d_field_gateway_resp_v1_pb_poc_check_target_resp(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 146 -> + d_field_gateway_resp_v1_pb_public_route(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 80 -> + d_field_gateway_resp_v1_pb_block_time(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 88 -> + d_field_gateway_resp_v1_pb_block_age(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 1 -> + skip_64_gateway_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 2 -> + skip_length_delimited_gateway_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 3 -> + skip_group_gateway_resp_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 5 -> + skip_32_gateway_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData) + end + end; +dg_read_field_def_gateway_resp_v1_pb(<<>>, 0, 0, F@_1, + F@_2, F@_3, F@_4, F@_5, _) -> + #gateway_resp_v1_pb{height = F@_1, signature = F@_2, + msg = F@_3, block_time = F@_4, block_age = F@_5}. + +d_field_gateway_resp_v1_pb_height(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + d_field_gateway_resp_v1_pb_height(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_resp_v1_pb_height(<<0:1, X:7, + Rest/binary>>, + N, Acc, _, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_gateway_resp_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +d_field_gateway_resp_v1_pb_signature(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + d_field_gateway_resp_v1_pb_signature(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_resp_v1_pb_signature(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, _, F@_3, F@_4, F@_5, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_resp_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + F@_4, + F@_5, + TrUserData). + +d_field_gateway_resp_v1_pb_is_active_resp(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + d_field_gateway_resp_v1_pb_is_active_resp(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_resp_v1_pb_is_active_resp(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, Prev, F@_4, F@_5, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_gateway_sc_is_active_resp_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + case Prev of + undefined -> + id({is_active_resp, + NewFValue}, + TrUserData); + {is_active_resp, MVPrev} -> + id({is_active_resp, + merge_msg_gateway_sc_is_active_resp_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({is_active_resp, + NewFValue}, + TrUserData) + end, + F@_4, + F@_5, + TrUserData). + +d_field_gateway_resp_v1_pb_is_overpaid_resp(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, TrUserData) + when N < 57 -> + d_field_gateway_resp_v1_pb_is_overpaid_resp(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_resp_v1_pb_is_overpaid_resp(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, Prev, F@_4, + F@_5, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_gateway_sc_is_overpaid_resp_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + case Prev of + undefined -> + id({is_overpaid_resp, + NewFValue}, + TrUserData); + {is_overpaid_resp, MVPrev} -> + id({is_overpaid_resp, + merge_msg_gateway_sc_is_overpaid_resp_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({is_overpaid_resp, + NewFValue}, + TrUserData) + end, + F@_4, + F@_5, + TrUserData). + +d_field_gateway_resp_v1_pb_close_resp(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + d_field_gateway_resp_v1_pb_close_resp(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_resp_v1_pb_close_resp(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, Prev, F@_4, F@_5, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_gateway_sc_close_resp_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + case Prev of + undefined -> + id({close_resp, NewFValue}, + TrUserData); + {close_resp, MVPrev} -> + id({close_resp, + merge_msg_gateway_sc_close_resp_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({close_resp, NewFValue}, + TrUserData) + end, + F@_4, + F@_5, + TrUserData). + +d_field_gateway_resp_v1_pb_follow_streamed_resp(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, TrUserData) + when N < 57 -> + d_field_gateway_resp_v1_pb_follow_streamed_resp(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_resp_v1_pb_follow_streamed_resp(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, Prev, F@_4, + F@_5, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_gateway_sc_follow_streamed_resp_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + case Prev of + undefined -> + id({follow_streamed_resp, + NewFValue}, + TrUserData); + {follow_streamed_resp, MVPrev} -> + id({follow_streamed_resp, + merge_msg_gateway_sc_follow_streamed_resp_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({follow_streamed_resp, + NewFValue}, + TrUserData) + end, + F@_4, + F@_5, + TrUserData). + +d_field_gateway_resp_v1_pb_routing_streamed_resp(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, TrUserData) + when N < 57 -> + d_field_gateway_resp_v1_pb_routing_streamed_resp(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_resp_v1_pb_routing_streamed_resp(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, Prev, F@_4, + F@_5, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_gateway_routing_streamed_resp_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + case Prev of + undefined -> + id({routing_streamed_resp, + NewFValue}, + TrUserData); + {routing_streamed_resp, MVPrev} -> + id({routing_streamed_resp, + merge_msg_gateway_routing_streamed_resp_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({routing_streamed_resp, + NewFValue}, + TrUserData) + end, + F@_4, + F@_5, + TrUserData). + +d_field_gateway_resp_v1_pb_config_resp(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + d_field_gateway_resp_v1_pb_config_resp(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_resp_v1_pb_config_resp(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, Prev, F@_4, F@_5, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_gateway_config_resp_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + case Prev of + undefined -> + id({config_resp, NewFValue}, + TrUserData); + {config_resp, MVPrev} -> + id({config_resp, + merge_msg_gateway_config_resp_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({config_resp, NewFValue}, + TrUserData) + end, + F@_4, + F@_5, + TrUserData). + +d_field_gateway_resp_v1_pb_config_update_streamed_resp(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) + when N < 57 -> + d_field_gateway_resp_v1_pb_config_update_streamed_resp(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_resp_v1_pb_config_update_streamed_resp(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, Prev, + F@_4, F@_5, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_gateway_config_update_streamed_resp_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + case Prev of + undefined -> + id({config_update_streamed_resp, + NewFValue}, + TrUserData); + {config_update_streamed_resp, + MVPrev} -> + id({config_update_streamed_resp, + merge_msg_gateway_config_update_streamed_resp_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({config_update_streamed_resp, + NewFValue}, + TrUserData) + end, + F@_4, + F@_5, + TrUserData). + +d_field_gateway_resp_v1_pb_validators_resp(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + d_field_gateway_resp_v1_pb_validators_resp(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_resp_v1_pb_validators_resp(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, Prev, F@_4, F@_5, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_gateway_validators_resp_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + case Prev of + undefined -> + id({validators_resp, + NewFValue}, + TrUserData); + {validators_resp, MVPrev} -> + id({validators_resp, + merge_msg_gateway_validators_resp_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({validators_resp, + NewFValue}, + TrUserData) + end, + F@_4, + F@_5, + TrUserData). + +d_field_gateway_resp_v1_pb_region_params_streamed_resp(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) + when N < 57 -> + d_field_gateway_resp_v1_pb_region_params_streamed_resp(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_resp_v1_pb_region_params_streamed_resp(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, Prev, + F@_4, F@_5, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_gateway_region_params_streamed_resp_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + case Prev of + undefined -> + id({region_params_streamed_resp, + NewFValue}, + TrUserData); + {region_params_streamed_resp, + MVPrev} -> + id({region_params_streamed_resp, + merge_msg_gateway_region_params_streamed_resp_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({region_params_streamed_resp, + NewFValue}, + TrUserData) + end, + F@_4, + F@_5, + TrUserData). + +d_field_gateway_resp_v1_pb_success_resp(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + d_field_gateway_resp_v1_pb_success_resp(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_resp_v1_pb_success_resp(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, Prev, F@_4, F@_5, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_gateway_success_resp_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + case Prev of + undefined -> + id({success_resp, NewFValue}, + TrUserData); + {success_resp, MVPrev} -> + id({success_resp, + merge_msg_gateway_success_resp_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({success_resp, NewFValue}, + TrUserData) + end, + F@_4, + F@_5, + TrUserData). + +d_field_gateway_resp_v1_pb_error_resp(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + d_field_gateway_resp_v1_pb_error_resp(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_resp_v1_pb_error_resp(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, Prev, F@_4, F@_5, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_gateway_error_resp_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + case Prev of + undefined -> + id({error_resp, NewFValue}, + TrUserData); + {error_resp, MVPrev} -> + id({error_resp, + merge_msg_gateway_error_resp_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({error_resp, NewFValue}, + TrUserData) + end, + F@_4, + F@_5, + TrUserData). + +d_field_gateway_resp_v1_pb_poc_challenge_resp(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, TrUserData) + when N < 57 -> + d_field_gateway_resp_v1_pb_poc_challenge_resp(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_resp_v1_pb_poc_challenge_resp(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, Prev, F@_4, + F@_5, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_gateway_poc_challenge_notification_resp_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + case Prev of + undefined -> + id({poc_challenge_resp, + NewFValue}, + TrUserData); + {poc_challenge_resp, MVPrev} -> + id({poc_challenge_resp, + merge_msg_gateway_poc_challenge_notification_resp_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({poc_challenge_resp, + NewFValue}, + TrUserData) + end, + F@_4, + F@_5, + TrUserData). + +d_field_gateway_resp_v1_pb_poc_check_target_resp(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, TrUserData) + when N < 57 -> + d_field_gateway_resp_v1_pb_poc_check_target_resp(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_resp_v1_pb_poc_check_target_resp(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, Prev, F@_4, + F@_5, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_gateway_poc_check_challenge_target_resp_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + case Prev of + undefined -> + id({poc_check_target_resp, + NewFValue}, + TrUserData); + {poc_check_target_resp, MVPrev} -> + id({poc_check_target_resp, + merge_msg_gateway_poc_check_challenge_target_resp_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({poc_check_target_resp, + NewFValue}, + TrUserData) + end, + F@_4, + F@_5, + TrUserData). + +d_field_gateway_resp_v1_pb_public_route(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + d_field_gateway_resp_v1_pb_public_route(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_resp_v1_pb_public_route(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, Prev, F@_4, F@_5, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_gateway_public_routing_data_resp_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + case Prev of + undefined -> + id({public_route, NewFValue}, + TrUserData); + {public_route, MVPrev} -> + id({public_route, + merge_msg_gateway_public_routing_data_resp_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({public_route, NewFValue}, + TrUserData) + end, + F@_4, + F@_5, + TrUserData). + +d_field_gateway_resp_v1_pb_block_time(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + d_field_gateway_resp_v1_pb_block_time(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_resp_v1_pb_block_time(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, _, F@_5, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_gateway_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + NewFValue, + F@_5, + TrUserData). + +d_field_gateway_resp_v1_pb_block_age(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + d_field_gateway_resp_v1_pb_block_age(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_resp_v1_pb_block_age(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, _, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_gateway_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + NewFValue, + TrUserData). + +skip_varint_gateway_resp_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + skip_varint_gateway_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +skip_varint_gateway_resp_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + dfp_read_field_def_gateway_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_length_delimited_gateway_resp_v1_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + skip_length_delimited_gateway_resp_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +skip_length_delimited_gateway_resp_v1_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_resp_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_group_gateway_resp_v1_pb(Bin, FNum, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_resp_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_32_gateway_resp_v1_pb(<<_:32, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + dfp_read_field_def_gateway_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_64_gateway_resp_v1_pb(<<_:64, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + dfp_read_field_def_gateway_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +decode_msg_gateway_sc_is_active_req_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_sc_is_active_req_v1_pb(Bin, + 0, + 0, + id(<<>>, TrUserData), + id(<<>>, TrUserData), + TrUserData). + +dfp_read_field_def_gateway_sc_is_active_req_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + d_field_gateway_sc_is_active_req_v1_pb_sc_id(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_gateway_sc_is_active_req_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + d_field_gateway_sc_is_active_req_v1_pb_sc_owner(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_gateway_sc_is_active_req_v1_pb(<<>>, + 0, 0, F@_1, F@_2, _) -> + #gateway_sc_is_active_req_v1_pb{sc_id = F@_1, + sc_owner = F@_2}; +dfp_read_field_def_gateway_sc_is_active_req_v1_pb(Other, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dg_read_field_def_gateway_sc_is_active_req_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +dg_read_field_def_gateway_sc_is_active_req_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_sc_is_active_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +dg_read_field_def_gateway_sc_is_active_req_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_sc_is_active_req_v1_pb_sc_id(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 18 -> + d_field_gateway_sc_is_active_req_v1_pb_sc_owner(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_sc_is_active_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 1 -> + skip_64_gateway_sc_is_active_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 2 -> + skip_length_delimited_gateway_sc_is_active_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 3 -> + skip_group_gateway_sc_is_active_req_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + TrUserData); + 5 -> + skip_32_gateway_sc_is_active_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData) + end + end; +dg_read_field_def_gateway_sc_is_active_req_v1_pb(<<>>, + 0, 0, F@_1, F@_2, _) -> + #gateway_sc_is_active_req_v1_pb{sc_id = F@_1, + sc_owner = F@_2}. + +d_field_gateway_sc_is_active_req_v1_pb_sc_id(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + d_field_gateway_sc_is_active_req_v1_pb_sc_id(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_gateway_sc_is_active_req_v1_pb_sc_id(<<0:1, X:7, + Rest/binary>>, + N, Acc, _, F@_2, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_sc_is_active_req_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + TrUserData). + +d_field_gateway_sc_is_active_req_v1_pb_sc_owner(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + d_field_gateway_sc_is_active_req_v1_pb_sc_owner(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_gateway_sc_is_active_req_v1_pb_sc_owner(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, _, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_sc_is_active_req_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + TrUserData). + +skip_varint_gateway_sc_is_active_req_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + skip_varint_gateway_sc_is_active_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +skip_varint_gateway_sc_is_active_req_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_gateway_sc_is_active_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_length_delimited_gateway_sc_is_active_req_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) + when N < 57 -> + skip_length_delimited_gateway_sc_is_active_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +skip_length_delimited_gateway_sc_is_active_req_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_sc_is_active_req_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + TrUserData). + +skip_group_gateway_sc_is_active_req_v1_pb(Bin, FNum, Z2, + F@_1, F@_2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_sc_is_active_req_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_32_gateway_sc_is_active_req_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_gateway_sc_is_active_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_64_gateway_sc_is_active_req_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_gateway_sc_is_active_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +decode_msg_gateway_sc_is_active_resp_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_sc_is_active_resp_v1_pb(Bin, + 0, + 0, + id(<<>>, TrUserData), + id(<<>>, TrUserData), + id(false, TrUserData), + id(0, TrUserData), + id(0, TrUserData), + TrUserData). + +dfp_read_field_def_gateway_sc_is_active_resp_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) -> + d_field_gateway_sc_is_active_resp_v1_pb_sc_id(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_sc_is_active_resp_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) -> + d_field_gateway_sc_is_active_resp_v1_pb_sc_owner(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_sc_is_active_resp_v1_pb(<<24, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) -> + d_field_gateway_sc_is_active_resp_v1_pb_active(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_sc_is_active_resp_v1_pb(<<32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) -> + d_field_gateway_sc_is_active_resp_v1_pb_sc_expiry_at_block(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_sc_is_active_resp_v1_pb(<<40, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) -> + d_field_gateway_sc_is_active_resp_v1_pb_sc_original_dc_amount(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_gateway_sc_is_active_resp_v1_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, F@_4, + F@_5, _) -> + #gateway_sc_is_active_resp_v1_pb{sc_id = F@_1, + sc_owner = F@_2, active = F@_3, + sc_expiry_at_block = F@_4, + sc_original_dc_amount = F@_5}; +dfp_read_field_def_gateway_sc_is_active_resp_v1_pb(Other, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) -> + dg_read_field_def_gateway_sc_is_active_resp_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +dg_read_field_def_gateway_sc_is_active_resp_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_sc_is_active_resp_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dg_read_field_def_gateway_sc_is_active_resp_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_sc_is_active_resp_v1_pb_sc_id(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 18 -> + d_field_gateway_sc_is_active_resp_v1_pb_sc_owner(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 24 -> + d_field_gateway_sc_is_active_resp_v1_pb_active(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 32 -> + d_field_gateway_sc_is_active_resp_v1_pb_sc_expiry_at_block(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 40 -> + d_field_gateway_sc_is_active_resp_v1_pb_sc_original_dc_amount(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_sc_is_active_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 1 -> + skip_64_gateway_sc_is_active_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 2 -> + skip_length_delimited_gateway_sc_is_active_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 3 -> + skip_group_gateway_sc_is_active_resp_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 5 -> + skip_32_gateway_sc_is_active_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData) + end + end; +dg_read_field_def_gateway_sc_is_active_resp_v1_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, F@_4, + F@_5, _) -> + #gateway_sc_is_active_resp_v1_pb{sc_id = F@_1, + sc_owner = F@_2, active = F@_3, + sc_expiry_at_block = F@_4, + sc_original_dc_amount = F@_5}. + +d_field_gateway_sc_is_active_resp_v1_pb_sc_id(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, TrUserData) + when N < 57 -> + d_field_gateway_sc_is_active_resp_v1_pb_sc_id(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_sc_is_active_resp_v1_pb_sc_id(<<0:1, + X:7, Rest/binary>>, + N, Acc, _, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_sc_is_active_resp_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +d_field_gateway_sc_is_active_resp_v1_pb_sc_owner(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, TrUserData) + when N < 57 -> + d_field_gateway_sc_is_active_resp_v1_pb_sc_owner(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_sc_is_active_resp_v1_pb_sc_owner(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, _, F@_3, F@_4, + F@_5, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_sc_is_active_resp_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + F@_4, + F@_5, + TrUserData). + +d_field_gateway_sc_is_active_resp_v1_pb_active(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, TrUserData) + when N < 57 -> + d_field_gateway_sc_is_active_resp_v1_pb_active(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_sc_is_active_resp_v1_pb_active(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, _, F@_4, + F@_5, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc =/= 0, + TrUserData), + Rest}, + dfp_read_field_def_gateway_sc_is_active_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + F@_4, + F@_5, + TrUserData). + +d_field_gateway_sc_is_active_resp_v1_pb_sc_expiry_at_block(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + d_field_gateway_sc_is_active_resp_v1_pb_sc_expiry_at_block(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_sc_is_active_resp_v1_pb_sc_expiry_at_block(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, _, F@_5, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_gateway_sc_is_active_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + NewFValue, + F@_5, + TrUserData). + +d_field_gateway_sc_is_active_resp_v1_pb_sc_original_dc_amount(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, F@_4, + F@_5, TrUserData) + when N < 57 -> + d_field_gateway_sc_is_active_resp_v1_pb_sc_original_dc_amount(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_gateway_sc_is_active_resp_v1_pb_sc_original_dc_amount(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, F@_4, + _, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_gateway_sc_is_active_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + NewFValue, + TrUserData). + +skip_varint_gateway_sc_is_active_resp_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, TrUserData) -> + skip_varint_gateway_sc_is_active_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +skip_varint_gateway_sc_is_active_resp_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, TrUserData) -> + dfp_read_field_def_gateway_sc_is_active_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_length_delimited_gateway_sc_is_active_resp_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) + when N < 57 -> + skip_length_delimited_gateway_sc_is_active_resp_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +skip_length_delimited_gateway_sc_is_active_resp_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_sc_is_active_resp_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_group_gateway_sc_is_active_resp_v1_pb(Bin, FNum, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_sc_is_active_resp_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_32_gateway_sc_is_active_resp_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + dfp_read_field_def_gateway_sc_is_active_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_64_gateway_sc_is_active_resp_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + dfp_read_field_def_gateway_sc_is_active_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +decode_msg_gateway_sc_is_overpaid_req_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_sc_is_overpaid_req_v1_pb(Bin, + 0, + 0, + id(<<>>, TrUserData), + id(<<>>, TrUserData), + id(0, TrUserData), + TrUserData). + +dfp_read_field_def_gateway_sc_is_overpaid_req_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + d_field_gateway_sc_is_overpaid_req_v1_pb_sc_id(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_gateway_sc_is_overpaid_req_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + d_field_gateway_sc_is_overpaid_req_v1_pb_sc_owner(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_gateway_sc_is_overpaid_req_v1_pb(<<24, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + d_field_gateway_sc_is_overpaid_req_v1_pb_total_dcs(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_gateway_sc_is_overpaid_req_v1_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, + _) -> + #gateway_sc_is_overpaid_req_v1_pb{sc_id = F@_1, + sc_owner = F@_2, total_dcs = F@_3}; +dfp_read_field_def_gateway_sc_is_overpaid_req_v1_pb(Other, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dg_read_field_def_gateway_sc_is_overpaid_req_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +dg_read_field_def_gateway_sc_is_overpaid_req_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_sc_is_overpaid_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +dg_read_field_def_gateway_sc_is_overpaid_req_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_sc_is_overpaid_req_v1_pb_sc_id(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 18 -> + d_field_gateway_sc_is_overpaid_req_v1_pb_sc_owner(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 24 -> + d_field_gateway_sc_is_overpaid_req_v1_pb_total_dcs(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_sc_is_overpaid_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 1 -> + skip_64_gateway_sc_is_overpaid_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 2 -> + skip_length_delimited_gateway_sc_is_overpaid_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 3 -> + skip_group_gateway_sc_is_overpaid_req_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 5 -> + skip_32_gateway_sc_is_overpaid_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData) + end + end; +dg_read_field_def_gateway_sc_is_overpaid_req_v1_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, _) -> + #gateway_sc_is_overpaid_req_v1_pb{sc_id = F@_1, + sc_owner = F@_2, total_dcs = F@_3}. + +d_field_gateway_sc_is_overpaid_req_v1_pb_sc_id(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + TrUserData) + when N < 57 -> + d_field_gateway_sc_is_overpaid_req_v1_pb_sc_id(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_gateway_sc_is_overpaid_req_v1_pb_sc_id(<<0:1, + X:7, Rest/binary>>, + N, Acc, _, F@_2, F@_3, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_sc_is_overpaid_req_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + TrUserData). + +d_field_gateway_sc_is_overpaid_req_v1_pb_sc_owner(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + TrUserData) + when N < 57 -> + d_field_gateway_sc_is_overpaid_req_v1_pb_sc_owner(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_gateway_sc_is_overpaid_req_v1_pb_sc_owner(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, _, F@_3, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_sc_is_overpaid_req_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + TrUserData). + +d_field_gateway_sc_is_overpaid_req_v1_pb_total_dcs(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + TrUserData) + when N < 57 -> + d_field_gateway_sc_is_overpaid_req_v1_pb_total_dcs(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_gateway_sc_is_overpaid_req_v1_pb_total_dcs(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, _, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_gateway_sc_is_overpaid_req_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + TrUserData). + +skip_varint_gateway_sc_is_overpaid_req_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + skip_varint_gateway_sc_is_overpaid_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_varint_gateway_sc_is_overpaid_req_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_gateway_sc_is_overpaid_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_length_delimited_gateway_sc_is_overpaid_req_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + TrUserData) + when N < 57 -> + skip_length_delimited_gateway_sc_is_overpaid_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_length_delimited_gateway_sc_is_overpaid_req_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_sc_is_overpaid_req_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_group_gateway_sc_is_overpaid_req_v1_pb(Bin, FNum, + Z2, F@_1, F@_2, F@_3, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_sc_is_overpaid_req_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_32_gateway_sc_is_overpaid_req_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_gateway_sc_is_overpaid_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_64_gateway_sc_is_overpaid_req_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_gateway_sc_is_overpaid_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +decode_msg_gateway_sc_is_overpaid_resp_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_sc_is_overpaid_resp_v1_pb(Bin, + 0, + 0, + id(<<>>, TrUserData), + id(<<>>, TrUserData), + id(false, TrUserData), + TrUserData). + +dfp_read_field_def_gateway_sc_is_overpaid_resp_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + d_field_gateway_sc_is_overpaid_resp_v1_pb_sc_id(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_gateway_sc_is_overpaid_resp_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + d_field_gateway_sc_is_overpaid_resp_v1_pb_sc_owner(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_gateway_sc_is_overpaid_resp_v1_pb(<<24, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + d_field_gateway_sc_is_overpaid_resp_v1_pb_overpaid(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_gateway_sc_is_overpaid_resp_v1_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, + _) -> + #gateway_sc_is_overpaid_resp_v1_pb{sc_id = F@_1, + sc_owner = F@_2, overpaid = F@_3}; +dfp_read_field_def_gateway_sc_is_overpaid_resp_v1_pb(Other, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dg_read_field_def_gateway_sc_is_overpaid_resp_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +dg_read_field_def_gateway_sc_is_overpaid_resp_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_sc_is_overpaid_resp_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +dg_read_field_def_gateway_sc_is_overpaid_resp_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_sc_is_overpaid_resp_v1_pb_sc_id(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 18 -> + d_field_gateway_sc_is_overpaid_resp_v1_pb_sc_owner(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 24 -> + d_field_gateway_sc_is_overpaid_resp_v1_pb_overpaid(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_sc_is_overpaid_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 1 -> + skip_64_gateway_sc_is_overpaid_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 2 -> + skip_length_delimited_gateway_sc_is_overpaid_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 3 -> + skip_group_gateway_sc_is_overpaid_resp_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 5 -> + skip_32_gateway_sc_is_overpaid_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData) + end + end; +dg_read_field_def_gateway_sc_is_overpaid_resp_v1_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, + _) -> + #gateway_sc_is_overpaid_resp_v1_pb{sc_id = F@_1, + sc_owner = F@_2, overpaid = F@_3}. + +d_field_gateway_sc_is_overpaid_resp_v1_pb_sc_id(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + TrUserData) + when N < 57 -> + d_field_gateway_sc_is_overpaid_resp_v1_pb_sc_id(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_gateway_sc_is_overpaid_resp_v1_pb_sc_id(<<0:1, + X:7, Rest/binary>>, + N, Acc, _, F@_2, F@_3, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_sc_is_overpaid_resp_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + TrUserData). + +d_field_gateway_sc_is_overpaid_resp_v1_pb_sc_owner(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + TrUserData) + when N < 57 -> + d_field_gateway_sc_is_overpaid_resp_v1_pb_sc_owner(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_gateway_sc_is_overpaid_resp_v1_pb_sc_owner(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, _, F@_3, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_sc_is_overpaid_resp_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + TrUserData). + +d_field_gateway_sc_is_overpaid_resp_v1_pb_overpaid(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + TrUserData) + when N < 57 -> + d_field_gateway_sc_is_overpaid_resp_v1_pb_overpaid(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_gateway_sc_is_overpaid_resp_v1_pb_overpaid(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, _, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc =/= 0, + TrUserData), + Rest}, + dfp_read_field_def_gateway_sc_is_overpaid_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + TrUserData). + +skip_varint_gateway_sc_is_overpaid_resp_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + skip_varint_gateway_sc_is_overpaid_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_varint_gateway_sc_is_overpaid_resp_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_gateway_sc_is_overpaid_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_length_delimited_gateway_sc_is_overpaid_resp_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, TrUserData) + when N < 57 -> + skip_length_delimited_gateway_sc_is_overpaid_resp_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_length_delimited_gateway_sc_is_overpaid_resp_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_sc_is_overpaid_resp_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_group_gateway_sc_is_overpaid_resp_v1_pb(Bin, FNum, + Z2, F@_1, F@_2, F@_3, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_sc_is_overpaid_resp_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_32_gateway_sc_is_overpaid_resp_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_gateway_sc_is_overpaid_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_64_gateway_sc_is_overpaid_resp_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_gateway_sc_is_overpaid_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +decode_msg_gateway_sc_close_req_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_sc_close_req_v1_pb(Bin, + 0, + 0, + id(undefined, TrUserData), + TrUserData). + +dfp_read_field_def_gateway_sc_close_req_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + d_field_gateway_sc_close_req_v1_pb_close_txn(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_gateway_sc_close_req_v1_pb(<<>>, 0, + 0, F@_1, _) -> + #gateway_sc_close_req_v1_pb{close_txn = F@_1}; +dfp_read_field_def_gateway_sc_close_req_v1_pb(Other, Z1, + Z2, F@_1, TrUserData) -> + dg_read_field_def_gateway_sc_close_req_v1_pb(Other, + Z1, + Z2, + F@_1, + TrUserData). + +dg_read_field_def_gateway_sc_close_req_v1_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_sc_close_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +dg_read_field_def_gateway_sc_close_req_v1_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_sc_close_req_v1_pb_close_txn(Rest, + 0, + 0, + F@_1, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_sc_close_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 1 -> + skip_64_gateway_sc_close_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 2 -> + skip_length_delimited_gateway_sc_close_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 3 -> + skip_group_gateway_sc_close_req_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + TrUserData); + 5 -> + skip_32_gateway_sc_close_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData) + end + end; +dg_read_field_def_gateway_sc_close_req_v1_pb(<<>>, 0, 0, + F@_1, _) -> + #gateway_sc_close_req_v1_pb{close_txn = F@_1}. + +d_field_gateway_sc_close_req_v1_pb_close_txn(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + d_field_gateway_sc_close_req_v1_pb_close_txn(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_gateway_sc_close_req_v1_pb_close_txn(<<0:1, X:7, + Rest/binary>>, + N, Acc, Prev, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_txn_state_channel_close_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_sc_close_req_v1_pb(RestF, + 0, + 0, + if Prev == undefined -> + NewFValue; + true -> + merge_msg_blockchain_txn_state_channel_close_v1_pb(Prev, + NewFValue, + TrUserData) + end, + TrUserData). + +skip_varint_gateway_sc_close_req_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + skip_varint_gateway_sc_close_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData); +skip_varint_gateway_sc_close_req_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_sc_close_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_length_delimited_gateway_sc_close_req_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + skip_length_delimited_gateway_sc_close_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +skip_length_delimited_gateway_sc_close_req_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_sc_close_req_v1_pb(Rest2, + 0, + 0, + F@_1, + TrUserData). + +skip_group_gateway_sc_close_req_v1_pb(Bin, FNum, Z2, + F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_sc_close_req_v1_pb(Rest, + 0, + Z2, + F@_1, + TrUserData). + +skip_32_gateway_sc_close_req_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_sc_close_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_64_gateway_sc_close_req_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_sc_close_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +decode_msg_gateway_sc_close_resp_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_sc_close_resp_v1_pb(Bin, + 0, + 0, + id(<<>>, TrUserData), + id(<<>>, TrUserData), + TrUserData). + +dfp_read_field_def_gateway_sc_close_resp_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + d_field_gateway_sc_close_resp_v1_pb_sc_id(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_gateway_sc_close_resp_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + d_field_gateway_sc_close_resp_v1_pb_response(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_gateway_sc_close_resp_v1_pb(<<>>, 0, + 0, F@_1, F@_2, _) -> + #gateway_sc_close_resp_v1_pb{sc_id = F@_1, + response = F@_2}; +dfp_read_field_def_gateway_sc_close_resp_v1_pb(Other, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dg_read_field_def_gateway_sc_close_resp_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +dg_read_field_def_gateway_sc_close_resp_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_sc_close_resp_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +dg_read_field_def_gateway_sc_close_resp_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_sc_close_resp_v1_pb_sc_id(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 18 -> + d_field_gateway_sc_close_resp_v1_pb_response(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_sc_close_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 1 -> + skip_64_gateway_sc_close_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 2 -> + skip_length_delimited_gateway_sc_close_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 3 -> + skip_group_gateway_sc_close_resp_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + TrUserData); + 5 -> + skip_32_gateway_sc_close_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData) + end + end; +dg_read_field_def_gateway_sc_close_resp_v1_pb(<<>>, 0, + 0, F@_1, F@_2, _) -> + #gateway_sc_close_resp_v1_pb{sc_id = F@_1, + response = F@_2}. + +d_field_gateway_sc_close_resp_v1_pb_sc_id(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + d_field_gateway_sc_close_resp_v1_pb_sc_id(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_gateway_sc_close_resp_v1_pb_sc_id(<<0:1, X:7, + Rest/binary>>, + N, Acc, _, F@_2, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_sc_close_resp_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + TrUserData). + +d_field_gateway_sc_close_resp_v1_pb_response(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + d_field_gateway_sc_close_resp_v1_pb_response(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_gateway_sc_close_resp_v1_pb_response(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, _, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_sc_close_resp_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + TrUserData). + +skip_varint_gateway_sc_close_resp_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + skip_varint_gateway_sc_close_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +skip_varint_gateway_sc_close_resp_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_gateway_sc_close_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_length_delimited_gateway_sc_close_resp_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) + when N < 57 -> + skip_length_delimited_gateway_sc_close_resp_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +skip_length_delimited_gateway_sc_close_resp_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_sc_close_resp_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + TrUserData). + +skip_group_gateway_sc_close_resp_v1_pb(Bin, FNum, Z2, + F@_1, F@_2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_sc_close_resp_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_32_gateway_sc_close_resp_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_gateway_sc_close_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_64_gateway_sc_close_resp_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_gateway_sc_close_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +decode_msg_gateway_sc_follow_req_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_sc_follow_req_v1_pb(Bin, + 0, + 0, + id(<<>>, TrUserData), + id(<<>>, TrUserData), + TrUserData). + +dfp_read_field_def_gateway_sc_follow_req_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + d_field_gateway_sc_follow_req_v1_pb_sc_id(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_gateway_sc_follow_req_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + d_field_gateway_sc_follow_req_v1_pb_sc_owner(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_gateway_sc_follow_req_v1_pb(<<>>, 0, + 0, F@_1, F@_2, _) -> + #gateway_sc_follow_req_v1_pb{sc_id = F@_1, + sc_owner = F@_2}; +dfp_read_field_def_gateway_sc_follow_req_v1_pb(Other, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dg_read_field_def_gateway_sc_follow_req_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +dg_read_field_def_gateway_sc_follow_req_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_sc_follow_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +dg_read_field_def_gateway_sc_follow_req_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_sc_follow_req_v1_pb_sc_id(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 18 -> + d_field_gateway_sc_follow_req_v1_pb_sc_owner(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_sc_follow_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 1 -> + skip_64_gateway_sc_follow_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 2 -> + skip_length_delimited_gateway_sc_follow_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 3 -> + skip_group_gateway_sc_follow_req_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + TrUserData); + 5 -> + skip_32_gateway_sc_follow_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData) + end + end; +dg_read_field_def_gateway_sc_follow_req_v1_pb(<<>>, 0, + 0, F@_1, F@_2, _) -> + #gateway_sc_follow_req_v1_pb{sc_id = F@_1, + sc_owner = F@_2}. + +d_field_gateway_sc_follow_req_v1_pb_sc_id(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + d_field_gateway_sc_follow_req_v1_pb_sc_id(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_gateway_sc_follow_req_v1_pb_sc_id(<<0:1, X:7, + Rest/binary>>, + N, Acc, _, F@_2, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_sc_follow_req_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + TrUserData). + +d_field_gateway_sc_follow_req_v1_pb_sc_owner(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + d_field_gateway_sc_follow_req_v1_pb_sc_owner(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_gateway_sc_follow_req_v1_pb_sc_owner(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, _, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_sc_follow_req_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + TrUserData). + +skip_varint_gateway_sc_follow_req_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + skip_varint_gateway_sc_follow_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +skip_varint_gateway_sc_follow_req_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_gateway_sc_follow_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_length_delimited_gateway_sc_follow_req_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) + when N < 57 -> + skip_length_delimited_gateway_sc_follow_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +skip_length_delimited_gateway_sc_follow_req_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_sc_follow_req_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + TrUserData). + +skip_group_gateway_sc_follow_req_v1_pb(Bin, FNum, Z2, + F@_1, F@_2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_sc_follow_req_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_32_gateway_sc_follow_req_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_gateway_sc_follow_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_64_gateway_sc_follow_req_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_gateway_sc_follow_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +decode_msg_gateway_sc_follow_streamed_resp_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_sc_follow_streamed_resp_v1_pb(Bin, + 0, + 0, + id(<<>>, + TrUserData), + id(<<>>, + TrUserData), + id(close_state_closable, + TrUserData), + TrUserData). + +dfp_read_field_def_gateway_sc_follow_streamed_resp_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, TrUserData) -> + d_field_gateway_sc_follow_streamed_resp_v1_pb_sc_id(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_gateway_sc_follow_streamed_resp_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, TrUserData) -> + d_field_gateway_sc_follow_streamed_resp_v1_pb_sc_owner(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_gateway_sc_follow_streamed_resp_v1_pb(<<24, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, TrUserData) -> + d_field_gateway_sc_follow_streamed_resp_v1_pb_close_state(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_gateway_sc_follow_streamed_resp_v1_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, + _) -> + #gateway_sc_follow_streamed_resp_v1_pb{sc_id = F@_1, + sc_owner = F@_2, close_state = F@_3}; +dfp_read_field_def_gateway_sc_follow_streamed_resp_v1_pb(Other, + Z1, Z2, F@_1, F@_2, + F@_3, TrUserData) -> + dg_read_field_def_gateway_sc_follow_streamed_resp_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +dg_read_field_def_gateway_sc_follow_streamed_resp_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_sc_follow_streamed_resp_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +dg_read_field_def_gateway_sc_follow_streamed_resp_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_sc_follow_streamed_resp_v1_pb_sc_id(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 18 -> + d_field_gateway_sc_follow_streamed_resp_v1_pb_sc_owner(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 24 -> + d_field_gateway_sc_follow_streamed_resp_v1_pb_close_state(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_sc_follow_streamed_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 1 -> + skip_64_gateway_sc_follow_streamed_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 2 -> + skip_length_delimited_gateway_sc_follow_streamed_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 3 -> + skip_group_gateway_sc_follow_streamed_resp_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 5 -> + skip_32_gateway_sc_follow_streamed_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData) + end + end; +dg_read_field_def_gateway_sc_follow_streamed_resp_v1_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, + _) -> + #gateway_sc_follow_streamed_resp_v1_pb{sc_id = F@_1, + sc_owner = F@_2, close_state = F@_3}. + +d_field_gateway_sc_follow_streamed_resp_v1_pb_sc_id(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + TrUserData) + when N < 57 -> + d_field_gateway_sc_follow_streamed_resp_v1_pb_sc_id(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_gateway_sc_follow_streamed_resp_v1_pb_sc_id(<<0:1, + X:7, Rest/binary>>, + N, Acc, _, F@_2, F@_3, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_sc_follow_streamed_resp_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + TrUserData). + +d_field_gateway_sc_follow_streamed_resp_v1_pb_sc_owner(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + TrUserData) + when N < 57 -> + d_field_gateway_sc_follow_streamed_resp_v1_pb_sc_owner(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_gateway_sc_follow_streamed_resp_v1_pb_sc_owner(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, _, F@_3, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_sc_follow_streamed_resp_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + TrUserData). + +d_field_gateway_sc_follow_streamed_resp_v1_pb_close_state(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, TrUserData) + when N < 57 -> + d_field_gateway_sc_follow_streamed_resp_v1_pb_close_state(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_gateway_sc_follow_streamed_resp_v1_pb_close_state(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, _, + TrUserData) -> + {NewFValue, RestF} = + {id('d_enum_helium.close_state'(begin + <> = <<(X bsl + N + + + Acc):32/unsigned-native>>, + id(Res, TrUserData) + end), + TrUserData), + Rest}, + dfp_read_field_def_gateway_sc_follow_streamed_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + TrUserData). + +skip_varint_gateway_sc_follow_streamed_resp_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + skip_varint_gateway_sc_follow_streamed_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_varint_gateway_sc_follow_streamed_resp_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_gateway_sc_follow_streamed_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_length_delimited_gateway_sc_follow_streamed_resp_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, TrUserData) + when N < 57 -> + skip_length_delimited_gateway_sc_follow_streamed_resp_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_length_delimited_gateway_sc_follow_streamed_resp_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_sc_follow_streamed_resp_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_group_gateway_sc_follow_streamed_resp_v1_pb(Bin, + FNum, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_sc_follow_streamed_resp_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_32_gateway_sc_follow_streamed_resp_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_gateway_sc_follow_streamed_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_64_gateway_sc_follow_streamed_resp_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_gateway_sc_follow_streamed_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +decode_msg_routing_pb(Bin, TrUserData) -> + dfp_read_field_def_routing_pb(Bin, + 0, + 0, + id(0, TrUserData), + id(<<>>, TrUserData), + id([], TrUserData), + id([], TrUserData), + id([], TrUserData), + TrUserData). + +dfp_read_field_def_routing_pb(<<8, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + d_field_routing_pb_oui(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_routing_pb(<<18, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + d_field_routing_pb_owner(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_routing_pb(<<26, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + d_field_routing_pb_addresses(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_routing_pb(<<34, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + d_field_routing_pb_filters(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_routing_pb(<<42, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + d_field_routing_pb_subnets(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_routing_pb(<<>>, 0, 0, F@_1, F@_2, + R1, R2, R3, TrUserData) -> + #routing_pb{oui = F@_1, owner = F@_2, + addresses = lists_reverse(R1, TrUserData), + filters = lists_reverse(R2, TrUserData), + subnets = lists_reverse(R3, TrUserData)}; +dfp_read_field_def_routing_pb(Other, Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, TrUserData) -> + dg_read_field_def_routing_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +dg_read_field_def_routing_pb(<<1:1, X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_routing_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dg_read_field_def_routing_pb(<<0:1, X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 8 -> + d_field_routing_pb_oui(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 18 -> + d_field_routing_pb_owner(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 26 -> + d_field_routing_pb_addresses(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 34 -> + d_field_routing_pb_filters(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 42 -> + d_field_routing_pb_subnets(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_routing_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 1 -> + skip_64_routing_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 2 -> + skip_length_delimited_routing_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 3 -> + skip_group_routing_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 5 -> + skip_32_routing_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData) + end + end; +dg_read_field_def_routing_pb(<<>>, 0, 0, F@_1, F@_2, R1, + R2, R3, TrUserData) -> + #routing_pb{oui = F@_1, owner = F@_2, + addresses = lists_reverse(R1, TrUserData), + filters = lists_reverse(R2, TrUserData), + subnets = lists_reverse(R3, TrUserData)}. + +d_field_routing_pb_oui(<<1:1, X:7, Rest/binary>>, N, + Acc, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) + when N < 57 -> + d_field_routing_pb_oui(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_routing_pb_oui(<<0:1, X:7, Rest/binary>>, N, + Acc, _, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_routing_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +d_field_routing_pb_owner(<<1:1, X:7, Rest/binary>>, N, + Acc, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) + when N < 57 -> + d_field_routing_pb_owner(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_routing_pb_owner(<<0:1, X:7, Rest/binary>>, N, + Acc, F@_1, _, F@_3, F@_4, F@_5, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_routing_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + F@_4, + F@_5, + TrUserData). + +d_field_routing_pb_addresses(<<1:1, X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) + when N < 57 -> + d_field_routing_pb_addresses(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_routing_pb_addresses(<<0:1, X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, Prev, F@_4, F@_5, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_routing_address_pb(Bs, TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_routing_pb(RestF, + 0, + 0, + F@_1, + F@_2, + cons(NewFValue, Prev, TrUserData), + F@_4, + F@_5, + TrUserData). + +d_field_routing_pb_filters(<<1:1, X:7, Rest/binary>>, N, + Acc, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) + when N < 57 -> + d_field_routing_pb_filters(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_routing_pb_filters(<<0:1, X:7, Rest/binary>>, N, + Acc, F@_1, F@_2, F@_3, Prev, F@_5, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_routing_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + cons(NewFValue, Prev, TrUserData), + F@_5, + TrUserData). + +d_field_routing_pb_subnets(<<1:1, X:7, Rest/binary>>, N, + Acc, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) + when N < 57 -> + d_field_routing_pb_subnets(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_routing_pb_subnets(<<0:1, X:7, Rest/binary>>, N, + Acc, F@_1, F@_2, F@_3, F@_4, Prev, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_routing_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + cons(NewFValue, Prev, TrUserData), + TrUserData). + +skip_varint_routing_pb(<<1:1, _:7, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + skip_varint_routing_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +skip_varint_routing_pb(<<0:1, _:7, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + dfp_read_field_def_routing_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_length_delimited_routing_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + skip_length_delimited_routing_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +skip_length_delimited_routing_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_routing_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_group_routing_pb(Bin, FNum, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_routing_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_32_routing_pb(<<_:32, Rest/binary>>, Z1, Z2, F@_1, + F@_2, F@_3, F@_4, F@_5, TrUserData) -> + dfp_read_field_def_routing_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_64_routing_pb(<<_:64, Rest/binary>>, Z1, Z2, F@_1, + F@_2, F@_3, F@_4, F@_5, TrUserData) -> + dfp_read_field_def_routing_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +decode_msg_routing_address_pb(Bin, TrUserData) -> + dfp_read_field_def_routing_address_pb(Bin, + 0, + 0, + id(<<>>, TrUserData), + id(<<>>, TrUserData), + TrUserData). + +dfp_read_field_def_routing_address_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + d_field_routing_address_pb_pub_key(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_routing_address_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + d_field_routing_address_pb_uri(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_routing_address_pb(<<>>, 0, 0, F@_1, + F@_2, _) -> + #routing_address_pb{pub_key = F@_1, uri = F@_2}; +dfp_read_field_def_routing_address_pb(Other, Z1, Z2, + F@_1, F@_2, TrUserData) -> + dg_read_field_def_routing_address_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +dg_read_field_def_routing_address_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_routing_address_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +dg_read_field_def_routing_address_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_routing_address_pb_pub_key(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 18 -> + d_field_routing_address_pb_uri(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_routing_address_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 1 -> + skip_64_routing_address_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 2 -> + skip_length_delimited_routing_address_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 3 -> + skip_group_routing_address_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + TrUserData); + 5 -> + skip_32_routing_address_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData) + end + end; +dg_read_field_def_routing_address_pb(<<>>, 0, 0, F@_1, + F@_2, _) -> + #routing_address_pb{pub_key = F@_1, uri = F@_2}. + +d_field_routing_address_pb_pub_key(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + d_field_routing_address_pb_pub_key(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_routing_address_pb_pub_key(<<0:1, X:7, + Rest/binary>>, + N, Acc, _, F@_2, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_routing_address_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + TrUserData). + +d_field_routing_address_pb_uri(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + d_field_routing_address_pb_uri(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_routing_address_pb_uri(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, _, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_routing_address_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + TrUserData). + +skip_varint_routing_address_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + skip_varint_routing_address_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +skip_varint_routing_address_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_routing_address_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_length_delimited_routing_address_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + skip_length_delimited_routing_address_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +skip_length_delimited_routing_address_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_routing_address_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + TrUserData). + +skip_group_routing_address_pb(Bin, FNum, Z2, F@_1, F@_2, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_routing_address_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_32_routing_address_pb(<<_:32, Rest/binary>>, Z1, + Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_routing_address_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_64_routing_address_pb(<<_:64, Rest/binary>>, Z1, + Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_routing_address_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +decode_msg_gateway_routing_req_v1_pb(Bin, TrUserData) -> + dfp_read_field_def_gateway_routing_req_v1_pb(Bin, + 0, + 0, + id(0, TrUserData), + TrUserData). + +dfp_read_field_def_gateway_routing_req_v1_pb(<<8, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + d_field_gateway_routing_req_v1_pb_height(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_gateway_routing_req_v1_pb(<<>>, 0, 0, + F@_1, _) -> + #gateway_routing_req_v1_pb{height = F@_1}; +dfp_read_field_def_gateway_routing_req_v1_pb(Other, Z1, + Z2, F@_1, TrUserData) -> + dg_read_field_def_gateway_routing_req_v1_pb(Other, + Z1, + Z2, + F@_1, + TrUserData). + +dg_read_field_def_gateway_routing_req_v1_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_routing_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +dg_read_field_def_gateway_routing_req_v1_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 8 -> + d_field_gateway_routing_req_v1_pb_height(Rest, + 0, + 0, + F@_1, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_routing_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 1 -> + skip_64_gateway_routing_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 2 -> + skip_length_delimited_gateway_routing_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 3 -> + skip_group_gateway_routing_req_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + TrUserData); + 5 -> + skip_32_gateway_routing_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData) + end + end; +dg_read_field_def_gateway_routing_req_v1_pb(<<>>, 0, 0, + F@_1, _) -> + #gateway_routing_req_v1_pb{height = F@_1}. + +d_field_gateway_routing_req_v1_pb_height(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + d_field_gateway_routing_req_v1_pb_height(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_gateway_routing_req_v1_pb_height(<<0:1, X:7, + Rest/binary>>, + N, Acc, _, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_gateway_routing_req_v1_pb(RestF, + 0, + 0, + NewFValue, + TrUserData). + +skip_varint_gateway_routing_req_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + skip_varint_gateway_routing_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData); +skip_varint_gateway_routing_req_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_routing_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_length_delimited_gateway_routing_req_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + skip_length_delimited_gateway_routing_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +skip_length_delimited_gateway_routing_req_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_routing_req_v1_pb(Rest2, + 0, + 0, + F@_1, + TrUserData). + +skip_group_gateway_routing_req_v1_pb(Bin, FNum, Z2, + F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_routing_req_v1_pb(Rest, + 0, + Z2, + F@_1, + TrUserData). + +skip_32_gateway_routing_req_v1_pb(<<_:32, Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_routing_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_64_gateway_routing_req_v1_pb(<<_:64, Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_routing_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +decode_msg_gateway_routing_streamed_resp_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_routing_streamed_resp_v1_pb(Bin, + 0, + 0, + id([], TrUserData), + TrUserData). + +dfp_read_field_def_gateway_routing_streamed_resp_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, + TrUserData) -> + d_field_gateway_routing_streamed_resp_v1_pb_routings(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_gateway_routing_streamed_resp_v1_pb(<<>>, + 0, 0, R1, TrUserData) -> + #gateway_routing_streamed_resp_v1_pb{routings = + lists_reverse(R1, TrUserData)}; +dfp_read_field_def_gateway_routing_streamed_resp_v1_pb(Other, + Z1, Z2, F@_1, + TrUserData) -> + dg_read_field_def_gateway_routing_streamed_resp_v1_pb(Other, + Z1, + Z2, + F@_1, + TrUserData). + +dg_read_field_def_gateway_routing_streamed_resp_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_routing_streamed_resp_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +dg_read_field_def_gateway_routing_streamed_resp_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_routing_streamed_resp_v1_pb_routings(Rest, + 0, + 0, + F@_1, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_routing_streamed_resp_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 1 -> + skip_64_gateway_routing_streamed_resp_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 2 -> + skip_length_delimited_gateway_routing_streamed_resp_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 3 -> + skip_group_gateway_routing_streamed_resp_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + TrUserData); + 5 -> + skip_32_gateway_routing_streamed_resp_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData) + end + end; +dg_read_field_def_gateway_routing_streamed_resp_v1_pb(<<>>, + 0, 0, R1, TrUserData) -> + #gateway_routing_streamed_resp_v1_pb{routings = + lists_reverse(R1, TrUserData)}. + +d_field_gateway_routing_streamed_resp_v1_pb_routings(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + d_field_gateway_routing_streamed_resp_v1_pb_routings(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_gateway_routing_streamed_resp_v1_pb_routings(<<0:1, + X:7, Rest/binary>>, + N, Acc, Prev, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_routing_pb(Bs, TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_routing_streamed_resp_v1_pb(RestF, + 0, + 0, + cons(NewFValue, + Prev, + TrUserData), + TrUserData). + +skip_varint_gateway_routing_streamed_resp_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + skip_varint_gateway_routing_streamed_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData); +skip_varint_gateway_routing_streamed_resp_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_routing_streamed_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_length_delimited_gateway_routing_streamed_resp_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, + TrUserData) + when N < 57 -> + skip_length_delimited_gateway_routing_streamed_resp_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +skip_length_delimited_gateway_routing_streamed_resp_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_routing_streamed_resp_v1_pb(Rest2, + 0, + 0, + F@_1, + TrUserData). + +skip_group_gateway_routing_streamed_resp_v1_pb(Bin, + FNum, Z2, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_routing_streamed_resp_v1_pb(Rest, + 0, + Z2, + F@_1, + TrUserData). + +skip_32_gateway_routing_streamed_resp_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_routing_streamed_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_64_gateway_routing_streamed_resp_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_routing_streamed_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +decode_msg_gateway_poc_req_v1_pb(Bin, TrUserData) -> + dfp_read_field_def_gateway_poc_req_v1_pb(Bin, + 0, + 0, + id(<<>>, TrUserData), + id(<<>>, TrUserData), + TrUserData). + +dfp_read_field_def_gateway_poc_req_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + d_field_gateway_poc_req_v1_pb_address(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_gateway_poc_req_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + d_field_gateway_poc_req_v1_pb_signature(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_gateway_poc_req_v1_pb(<<>>, 0, 0, + F@_1, F@_2, _) -> + #gateway_poc_req_v1_pb{address = F@_1, + signature = F@_2}; +dfp_read_field_def_gateway_poc_req_v1_pb(Other, Z1, Z2, + F@_1, F@_2, TrUserData) -> + dg_read_field_def_gateway_poc_req_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +dg_read_field_def_gateway_poc_req_v1_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_poc_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +dg_read_field_def_gateway_poc_req_v1_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_poc_req_v1_pb_address(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 18 -> + d_field_gateway_poc_req_v1_pb_signature(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_poc_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 1 -> + skip_64_gateway_poc_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 2 -> + skip_length_delimited_gateway_poc_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 3 -> + skip_group_gateway_poc_req_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + TrUserData); + 5 -> + skip_32_gateway_poc_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData) + end + end; +dg_read_field_def_gateway_poc_req_v1_pb(<<>>, 0, 0, + F@_1, F@_2, _) -> + #gateway_poc_req_v1_pb{address = F@_1, + signature = F@_2}. + +d_field_gateway_poc_req_v1_pb_address(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + d_field_gateway_poc_req_v1_pb_address(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_gateway_poc_req_v1_pb_address(<<0:1, X:7, + Rest/binary>>, + N, Acc, _, F@_2, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_poc_req_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + TrUserData). + +d_field_gateway_poc_req_v1_pb_signature(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + d_field_gateway_poc_req_v1_pb_signature(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_gateway_poc_req_v1_pb_signature(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, _, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_poc_req_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + TrUserData). + +skip_varint_gateway_poc_req_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + skip_varint_gateway_poc_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +skip_varint_gateway_poc_req_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_gateway_poc_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_length_delimited_gateway_poc_req_v1_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + skip_length_delimited_gateway_poc_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +skip_length_delimited_gateway_poc_req_v1_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_poc_req_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + TrUserData). + +skip_group_gateway_poc_req_v1_pb(Bin, FNum, Z2, F@_1, + F@_2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_poc_req_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_32_gateway_poc_req_v1_pb(<<_:32, Rest/binary>>, Z1, + Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_gateway_poc_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_64_gateway_poc_req_v1_pb(<<_:64, Rest/binary>>, Z1, + Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_gateway_poc_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +decode_msg_gateway_poc_challenge_notification_resp_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_poc_challenge_notification_resp_v1_pb(Bin, + 0, + 0, + id(undefined, + TrUserData), + id(<<>>, + TrUserData), + id(<<>>, + TrUserData), + TrUserData). + +dfp_read_field_def_gateway_poc_challenge_notification_resp_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, + F@_2, F@_3, + TrUserData) -> + d_field_gateway_poc_challenge_notification_resp_v1_pb_challenger(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_gateway_poc_challenge_notification_resp_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, + F@_2, F@_3, + TrUserData) -> + d_field_gateway_poc_challenge_notification_resp_v1_pb_block_hash(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_gateway_poc_challenge_notification_resp_v1_pb(<<26, + Rest/binary>>, + Z1, Z2, F@_1, + F@_2, F@_3, + TrUserData) -> + d_field_gateway_poc_challenge_notification_resp_v1_pb_onion_key_hash(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_gateway_poc_challenge_notification_resp_v1_pb(<<>>, + 0, 0, F@_1, + F@_2, F@_3, + _) -> + #gateway_poc_challenge_notification_resp_v1_pb{challenger + = F@_1, + block_hash = F@_2, + onion_key_hash = F@_3}; +dfp_read_field_def_gateway_poc_challenge_notification_resp_v1_pb(Other, + Z1, Z2, F@_1, + F@_2, F@_3, + TrUserData) -> + dg_read_field_def_gateway_poc_challenge_notification_resp_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +dg_read_field_def_gateway_poc_challenge_notification_resp_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_poc_challenge_notification_resp_v1_pb(Rest, + N + 7, + X bsl N + + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +dg_read_field_def_gateway_poc_challenge_notification_resp_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_poc_challenge_notification_resp_v1_pb_challenger(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 18 -> + d_field_gateway_poc_challenge_notification_resp_v1_pb_block_hash(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 26 -> + d_field_gateway_poc_challenge_notification_resp_v1_pb_onion_key_hash(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_poc_challenge_notification_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 1 -> + skip_64_gateway_poc_challenge_notification_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 2 -> + skip_length_delimited_gateway_poc_challenge_notification_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 3 -> + skip_group_gateway_poc_challenge_notification_resp_v1_pb(Rest, + Key + bsr + 3, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 5 -> + skip_32_gateway_poc_challenge_notification_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData) + end + end; +dg_read_field_def_gateway_poc_challenge_notification_resp_v1_pb(<<>>, + 0, 0, F@_1, + F@_2, F@_3, + _) -> + #gateway_poc_challenge_notification_resp_v1_pb{challenger + = F@_1, + block_hash = F@_2, + onion_key_hash = F@_3}. + +d_field_gateway_poc_challenge_notification_resp_v1_pb_challenger(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, + TrUserData) + when N < 57 -> + d_field_gateway_poc_challenge_notification_resp_v1_pb_challenger(Rest, + N + 7, + X bsl N + + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_gateway_poc_challenge_notification_resp_v1_pb_challenger(<<0:1, + X:7, + Rest/binary>>, + N, Acc, Prev, + F@_2, F@_3, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_routing_address_pb(Bs, TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_poc_challenge_notification_resp_v1_pb(RestF, + 0, + 0, + if Prev == + undefined -> + NewFValue; + true -> + merge_msg_routing_address_pb(Prev, + NewFValue, + TrUserData) + end, + F@_2, + F@_3, + TrUserData). + +d_field_gateway_poc_challenge_notification_resp_v1_pb_block_hash(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, + TrUserData) + when N < 57 -> + d_field_gateway_poc_challenge_notification_resp_v1_pb_block_hash(Rest, + N + 7, + X bsl N + + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_gateway_poc_challenge_notification_resp_v1_pb_block_hash(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + _, F@_3, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_poc_challenge_notification_resp_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + TrUserData). + +d_field_gateway_poc_challenge_notification_resp_v1_pb_onion_key_hash(<<1:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, F@_2, + F@_3, + TrUserData) + when N < 57 -> + d_field_gateway_poc_challenge_notification_resp_v1_pb_onion_key_hash(Rest, + N + 7, + X bsl N + + + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_gateway_poc_challenge_notification_resp_v1_pb_onion_key_hash(<<0:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, F@_2, + _, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_poc_challenge_notification_resp_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + TrUserData). + +skip_varint_gateway_poc_challenge_notification_resp_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, TrUserData) -> + skip_varint_gateway_poc_challenge_notification_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_varint_gateway_poc_challenge_notification_resp_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, TrUserData) -> + dfp_read_field_def_gateway_poc_challenge_notification_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_length_delimited_gateway_poc_challenge_notification_resp_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, F@_2, + F@_3, + TrUserData) + when N < 57 -> + skip_length_delimited_gateway_poc_challenge_notification_resp_v1_pb(Rest, + N + 7, + X bsl N + + + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_length_delimited_gateway_poc_challenge_notification_resp_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, F@_2, + F@_3, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_poc_challenge_notification_resp_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_group_gateway_poc_challenge_notification_resp_v1_pb(Bin, + FNum, Z2, F@_1, F@_2, + F@_3, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_poc_challenge_notification_resp_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_32_gateway_poc_challenge_notification_resp_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_gateway_poc_challenge_notification_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_64_gateway_poc_challenge_notification_resp_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_gateway_poc_challenge_notification_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +decode_msg_gateway_poc_check_challenge_target_req_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(Bin, + 0, + 0, + id(<<>>, + TrUserData), + id(<<>>, + TrUserData), + id(<<>>, + TrUserData), + id(<<>>, + TrUserData), + id(0, + TrUserData), + id(<<>>, + TrUserData), + id(<<>>, + TrUserData), + id(<<>>, + TrUserData), + TrUserData). + +dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, + F@_2, F@_3, + F@_4, F@_5, + F@_6, F@_7, + F@_8, + TrUserData) -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_address(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, + F@_2, F@_3, + F@_4, F@_5, + F@_6, F@_7, + F@_8, + TrUserData) -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_challenger(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(<<26, + Rest/binary>>, + Z1, Z2, F@_1, + F@_2, F@_3, + F@_4, F@_5, + F@_6, F@_7, + F@_8, + TrUserData) -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_block_hash(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(<<34, + Rest/binary>>, + Z1, Z2, F@_1, + F@_2, F@_3, + F@_4, F@_5, + F@_6, F@_7, + F@_8, + TrUserData) -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_onion_key_hash(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(<<40, + Rest/binary>>, + Z1, Z2, F@_1, + F@_2, F@_3, + F@_4, F@_5, + F@_6, F@_7, + F@_8, + TrUserData) -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_height(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(<<50, + Rest/binary>>, + Z1, Z2, F@_1, + F@_2, F@_3, + F@_4, F@_5, + F@_6, F@_7, + F@_8, + TrUserData) -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_notifier(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(<<58, + Rest/binary>>, + Z1, Z2, F@_1, + F@_2, F@_3, + F@_4, F@_5, + F@_6, F@_7, + F@_8, + TrUserData) -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_notifier_sig(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(<<66, + Rest/binary>>, + Z1, Z2, F@_1, + F@_2, F@_3, + F@_4, F@_5, + F@_6, F@_7, + F@_8, + TrUserData) -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_challengee_sig(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(<<>>, + 0, 0, F@_1, + F@_2, F@_3, + F@_4, F@_5, + F@_6, F@_7, + F@_8, _) -> + #gateway_poc_check_challenge_target_req_v1_pb{address = + F@_1, + challenger = F@_2, + block_hash = F@_3, + onion_key_hash = F@_4, + height = F@_5, + notifier = F@_6, + notifier_sig = F@_7, + challengee_sig = F@_8}; +dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(Other, + Z1, Z2, F@_1, + F@_2, F@_3, + F@_4, F@_5, + F@_6, F@_7, + F@_8, + TrUserData) -> + dg_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData). + +dg_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, + F@_8, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(Rest, + N + 7, + X bsl N + + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +dg_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, + F@_8, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_address(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 18 -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_challenger(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 26 -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_block_hash(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 34 -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_onion_key_hash(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 40 -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_height(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 50 -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_notifier(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 58 -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_notifier_sig(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 66 -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_challengee_sig(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_poc_check_challenge_target_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 1 -> + skip_64_gateway_poc_check_challenge_target_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 2 -> + skip_length_delimited_gateway_poc_check_challenge_target_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 3 -> + skip_group_gateway_poc_check_challenge_target_req_v1_pb(Rest, + Key + bsr + 3, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 5 -> + skip_32_gateway_poc_check_challenge_target_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData) + end + end; +dg_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(<<>>, + 0, 0, F@_1, F@_2, + F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, + _) -> + #gateway_poc_check_challenge_target_req_v1_pb{address = + F@_1, + challenger = F@_2, + block_hash = F@_3, + onion_key_hash = F@_4, + height = F@_5, + notifier = F@_6, + notifier_sig = F@_7, + challengee_sig = F@_8}. + +d_field_gateway_poc_check_challenge_target_req_v1_pb_address(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, + TrUserData) + when N < 57 -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_address(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +d_field_gateway_poc_check_challenge_target_req_v1_pb_address(<<0:1, + X:7, + Rest/binary>>, + N, Acc, _, F@_2, + F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData). + +d_field_gateway_poc_check_challenge_target_req_v1_pb_challenger(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, + F@_4, F@_5, + F@_6, F@_7, + F@_8, + TrUserData) + when N < 57 -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_challenger(Rest, + N + 7, + X bsl N + + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +d_field_gateway_poc_check_challenge_target_req_v1_pb_challenger(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, _, + F@_3, F@_4, + F@_5, F@_6, + F@_7, F@_8, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData). + +d_field_gateway_poc_check_challenge_target_req_v1_pb_block_hash(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, + F@_4, F@_5, + F@_6, F@_7, + F@_8, + TrUserData) + when N < 57 -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_block_hash(Rest, + N + 7, + X bsl N + + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +d_field_gateway_poc_check_challenge_target_req_v1_pb_block_hash(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, _, F@_4, + F@_5, F@_6, + F@_7, F@_8, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData). + +d_field_gateway_poc_check_challenge_target_req_v1_pb_onion_key_hash(<<1:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, F@_2, + F@_3, F@_4, + F@_5, F@_6, + F@_7, F@_8, + TrUserData) + when N < 57 -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_onion_key_hash(Rest, + N + 7, + X bsl N + + + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +d_field_gateway_poc_check_challenge_target_req_v1_pb_onion_key_hash(<<0:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, F@_2, + F@_3, _, + F@_5, F@_6, + F@_7, F@_8, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + NewFValue, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData). + +d_field_gateway_poc_check_challenge_target_req_v1_pb_height(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, + TrUserData) + when N < 57 -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_height(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +d_field_gateway_poc_check_challenge_target_req_v1_pb_height(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, _, F@_6, + F@_7, F@_8, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + NewFValue, + F@_6, + F@_7, + F@_8, + TrUserData). + +d_field_gateway_poc_check_challenge_target_req_v1_pb_notifier(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, + F@_8, TrUserData) + when N < 57 -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_notifier(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +d_field_gateway_poc_check_challenge_target_req_v1_pb_notifier(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, F@_4, + F@_5, _, F@_7, + F@_8, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + NewFValue, + F@_7, + F@_8, + TrUserData). + +d_field_gateway_poc_check_challenge_target_req_v1_pb_notifier_sig(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, + F@_4, F@_5, + F@_6, F@_7, + F@_8, + TrUserData) + when N < 57 -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_notifier_sig(Rest, + N + 7, + X bsl N + + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +d_field_gateway_poc_check_challenge_target_req_v1_pb_notifier_sig(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, + F@_4, F@_5, + F@_6, _, F@_8, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + NewFValue, + F@_8, + TrUserData). + +d_field_gateway_poc_check_challenge_target_req_v1_pb_challengee_sig(<<1:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, F@_2, + F@_3, F@_4, + F@_5, F@_6, + F@_7, F@_8, + TrUserData) + when N < 57 -> + d_field_gateway_poc_check_challenge_target_req_v1_pb_challengee_sig(Rest, + N + 7, + X bsl N + + + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +d_field_gateway_poc_check_challenge_target_req_v1_pb_challengee_sig(<<0:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, F@_2, + F@_3, F@_4, + F@_5, F@_6, + F@_7, _, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + NewFValue, + TrUserData). + +skip_varint_gateway_poc_check_challenge_target_req_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, + TrUserData) -> + skip_varint_gateway_poc_check_challenge_target_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +skip_varint_gateway_poc_check_challenge_target_req_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, + TrUserData) -> + dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData). + +skip_length_delimited_gateway_poc_check_challenge_target_req_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, + F@_4, F@_5, + F@_6, F@_7, + F@_8, + TrUserData) + when N < 57 -> + skip_length_delimited_gateway_poc_check_challenge_target_req_v1_pb(Rest, + N + 7, + X bsl N + + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +skip_length_delimited_gateway_poc_check_challenge_target_req_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, + F@_4, F@_5, + F@_6, F@_7, + F@_8, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData). + +skip_group_gateway_poc_check_challenge_target_req_v1_pb(Bin, + FNum, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData). + +skip_32_gateway_poc_check_challenge_target_req_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + F@_8, TrUserData) -> + dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData). + +skip_64_gateway_poc_check_challenge_target_req_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + F@_8, TrUserData) -> + dfp_read_field_def_gateway_poc_check_challenge_target_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData). + +decode_msg_gateway_poc_check_challenge_target_resp_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_poc_check_challenge_target_resp_v1_pb(Bin, + 0, + 0, + id(false, + TrUserData), + id(<<>>, + TrUserData), + TrUserData). + +dfp_read_field_def_gateway_poc_check_challenge_target_resp_v1_pb(<<8, + Rest/binary>>, + Z1, Z2, F@_1, + F@_2, + TrUserData) -> + d_field_gateway_poc_check_challenge_target_resp_v1_pb_target(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_gateway_poc_check_challenge_target_resp_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, + F@_2, + TrUserData) -> + d_field_gateway_poc_check_challenge_target_resp_v1_pb_onion(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_gateway_poc_check_challenge_target_resp_v1_pb(<<>>, + 0, 0, F@_1, + F@_2, _) -> + #gateway_poc_check_challenge_target_resp_v1_pb{target = + F@_1, + onion = F@_2}; +dfp_read_field_def_gateway_poc_check_challenge_target_resp_v1_pb(Other, + Z1, Z2, F@_1, + F@_2, + TrUserData) -> + dg_read_field_def_gateway_poc_check_challenge_target_resp_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +dg_read_field_def_gateway_poc_check_challenge_target_resp_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_poc_check_challenge_target_resp_v1_pb(Rest, + N + 7, + X bsl N + + Acc, + F@_1, + F@_2, + TrUserData); +dg_read_field_def_gateway_poc_check_challenge_target_resp_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 8 -> + d_field_gateway_poc_check_challenge_target_resp_v1_pb_target(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 18 -> + d_field_gateway_poc_check_challenge_target_resp_v1_pb_onion(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_poc_check_challenge_target_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 1 -> + skip_64_gateway_poc_check_challenge_target_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 2 -> + skip_length_delimited_gateway_poc_check_challenge_target_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 3 -> + skip_group_gateway_poc_check_challenge_target_resp_v1_pb(Rest, + Key + bsr + 3, + 0, + F@_1, + F@_2, + TrUserData); + 5 -> + skip_32_gateway_poc_check_challenge_target_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData) + end + end; +dg_read_field_def_gateway_poc_check_challenge_target_resp_v1_pb(<<>>, + 0, 0, F@_1, + F@_2, _) -> + #gateway_poc_check_challenge_target_resp_v1_pb{target = + F@_1, + onion = F@_2}. + +d_field_gateway_poc_check_challenge_target_resp_v1_pb_target(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) + when N < 57 -> + d_field_gateway_poc_check_challenge_target_resp_v1_pb_target(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_gateway_poc_check_challenge_target_resp_v1_pb_target(<<0:1, + X:7, + Rest/binary>>, + N, Acc, _, F@_2, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc =/= 0, + TrUserData), + Rest}, + dfp_read_field_def_gateway_poc_check_challenge_target_resp_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + TrUserData). + +d_field_gateway_poc_check_challenge_target_resp_v1_pb_onion(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) + when N < 57 -> + d_field_gateway_poc_check_challenge_target_resp_v1_pb_onion(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_gateway_poc_check_challenge_target_resp_v1_pb_onion(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, _, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_poc_check_challenge_target_resp_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + TrUserData). + +skip_varint_gateway_poc_check_challenge_target_resp_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + skip_varint_gateway_poc_check_challenge_target_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +skip_varint_gateway_poc_check_challenge_target_resp_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dfp_read_field_def_gateway_poc_check_challenge_target_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_length_delimited_gateway_poc_check_challenge_target_resp_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, F@_2, + TrUserData) + when N < 57 -> + skip_length_delimited_gateway_poc_check_challenge_target_resp_v1_pb(Rest, + N + 7, + X bsl N + + + Acc, + F@_1, + F@_2, + TrUserData); +skip_length_delimited_gateway_poc_check_challenge_target_resp_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, F@_2, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_poc_check_challenge_target_resp_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + TrUserData). + +skip_group_gateway_poc_check_challenge_target_resp_v1_pb(Bin, + FNum, Z2, F@_1, F@_2, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_poc_check_challenge_target_resp_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_32_gateway_poc_check_challenge_target_resp_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dfp_read_field_def_gateway_poc_check_challenge_target_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_64_gateway_poc_check_challenge_target_resp_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dfp_read_field_def_gateway_poc_check_challenge_target_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +decode_msg_gateway_poc_report_req_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_poc_report_req_v1_pb(Bin, + 0, + 0, + id(<<>>, TrUserData), + id(undefined, TrUserData), + TrUserData). + +dfp_read_field_def_gateway_poc_report_req_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + d_field_gateway_poc_report_req_v1_pb_onion_key_hash(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_gateway_poc_report_req_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + d_field_gateway_poc_report_req_v1_pb_receipt(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_gateway_poc_report_req_v1_pb(<<26, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + d_field_gateway_poc_report_req_v1_pb_witness(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_gateway_poc_report_req_v1_pb(<<>>, 0, + 0, F@_1, F@_2, _) -> + #gateway_poc_report_req_v1_pb{onion_key_hash = F@_1, + msg = F@_2}; +dfp_read_field_def_gateway_poc_report_req_v1_pb(Other, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dg_read_field_def_gateway_poc_report_req_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +dg_read_field_def_gateway_poc_report_req_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_poc_report_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +dg_read_field_def_gateway_poc_report_req_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_poc_report_req_v1_pb_onion_key_hash(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 18 -> + d_field_gateway_poc_report_req_v1_pb_receipt(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 26 -> + d_field_gateway_poc_report_req_v1_pb_witness(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_poc_report_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 1 -> + skip_64_gateway_poc_report_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 2 -> + skip_length_delimited_gateway_poc_report_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 3 -> + skip_group_gateway_poc_report_req_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + TrUserData); + 5 -> + skip_32_gateway_poc_report_req_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData) + end + end; +dg_read_field_def_gateway_poc_report_req_v1_pb(<<>>, 0, + 0, F@_1, F@_2, _) -> + #gateway_poc_report_req_v1_pb{onion_key_hash = F@_1, + msg = F@_2}. + +d_field_gateway_poc_report_req_v1_pb_onion_key_hash(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) + when N < 57 -> + d_field_gateway_poc_report_req_v1_pb_onion_key_hash(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_gateway_poc_report_req_v1_pb_onion_key_hash(<<0:1, + X:7, Rest/binary>>, + N, Acc, _, F@_2, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_poc_report_req_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + TrUserData). + +d_field_gateway_poc_report_req_v1_pb_receipt(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + d_field_gateway_poc_report_req_v1_pb_receipt(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_gateway_poc_report_req_v1_pb_receipt(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, Prev, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_poc_receipt_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_poc_report_req_v1_pb(RestF, + 0, + 0, + F@_1, + case Prev of + undefined -> + id({receipt, + NewFValue}, + TrUserData); + {receipt, MVPrev} -> + id({receipt, + merge_msg_blockchain_poc_receipt_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({receipt, + NewFValue}, + TrUserData) + end, + TrUserData). + +d_field_gateway_poc_report_req_v1_pb_witness(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + d_field_gateway_poc_report_req_v1_pb_witness(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_gateway_poc_report_req_v1_pb_witness(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, Prev, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_poc_witness_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_poc_report_req_v1_pb(RestF, + 0, + 0, + F@_1, + case Prev of + undefined -> + id({witness, + NewFValue}, + TrUserData); + {witness, MVPrev} -> + id({witness, + merge_msg_blockchain_poc_witness_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({witness, + NewFValue}, + TrUserData) + end, + TrUserData). + +skip_varint_gateway_poc_report_req_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + skip_varint_gateway_poc_report_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +skip_varint_gateway_poc_report_req_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_gateway_poc_report_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_length_delimited_gateway_poc_report_req_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) + when N < 57 -> + skip_length_delimited_gateway_poc_report_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +skip_length_delimited_gateway_poc_report_req_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_poc_report_req_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + TrUserData). + +skip_group_gateway_poc_report_req_v1_pb(Bin, FNum, Z2, + F@_1, F@_2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_poc_report_req_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_32_gateway_poc_report_req_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_gateway_poc_report_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_64_gateway_poc_report_req_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_gateway_poc_report_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +decode_msg_gateway_address_routing_data_req_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_address_routing_data_req_v1_pb(Bin, + 0, + 0, + id(<<>>, + TrUserData), + TrUserData). + +dfp_read_field_def_gateway_address_routing_data_req_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, + TrUserData) -> + d_field_gateway_address_routing_data_req_v1_pb_address(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_gateway_address_routing_data_req_v1_pb(<<>>, + 0, 0, F@_1, _) -> + #gateway_address_routing_data_req_v1_pb{address = F@_1}; +dfp_read_field_def_gateway_address_routing_data_req_v1_pb(Other, + Z1, Z2, F@_1, + TrUserData) -> + dg_read_field_def_gateway_address_routing_data_req_v1_pb(Other, + Z1, + Z2, + F@_1, + TrUserData). + +dg_read_field_def_gateway_address_routing_data_req_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_address_routing_data_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +dg_read_field_def_gateway_address_routing_data_req_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_address_routing_data_req_v1_pb_address(Rest, + 0, + 0, + F@_1, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_address_routing_data_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 1 -> + skip_64_gateway_address_routing_data_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 2 -> + skip_length_delimited_gateway_address_routing_data_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 3 -> + skip_group_gateway_address_routing_data_req_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + TrUserData); + 5 -> + skip_32_gateway_address_routing_data_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData) + end + end; +dg_read_field_def_gateway_address_routing_data_req_v1_pb(<<>>, + 0, 0, F@_1, _) -> + #gateway_address_routing_data_req_v1_pb{address = F@_1}. + +d_field_gateway_address_routing_data_req_v1_pb_address(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + d_field_gateway_address_routing_data_req_v1_pb_address(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_gateway_address_routing_data_req_v1_pb_address(<<0:1, + X:7, Rest/binary>>, + N, Acc, _, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_address_routing_data_req_v1_pb(RestF, + 0, + 0, + NewFValue, + TrUserData). + +skip_varint_gateway_address_routing_data_req_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + skip_varint_gateway_address_routing_data_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData); +skip_varint_gateway_address_routing_data_req_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_address_routing_data_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_length_delimited_gateway_address_routing_data_req_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + TrUserData) + when N < 57 -> + skip_length_delimited_gateway_address_routing_data_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +skip_length_delimited_gateway_address_routing_data_req_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_address_routing_data_req_v1_pb(Rest2, + 0, + 0, + F@_1, + TrUserData). + +skip_group_gateway_address_routing_data_req_v1_pb(Bin, + FNum, Z2, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_address_routing_data_req_v1_pb(Rest, + 0, + Z2, + F@_1, + TrUserData). + +skip_32_gateway_address_routing_data_req_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_address_routing_data_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_64_gateway_address_routing_data_req_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_address_routing_data_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +decode_msg_gateway_poc_key_routing_data_req_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_poc_key_routing_data_req_v1_pb(Bin, + 0, + 0, + id(<<>>, + TrUserData), + TrUserData). + +dfp_read_field_def_gateway_poc_key_routing_data_req_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, + TrUserData) -> + d_field_gateway_poc_key_routing_data_req_v1_pb_key(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_gateway_poc_key_routing_data_req_v1_pb(<<>>, + 0, 0, F@_1, _) -> + #gateway_poc_key_routing_data_req_v1_pb{key = F@_1}; +dfp_read_field_def_gateway_poc_key_routing_data_req_v1_pb(Other, + Z1, Z2, F@_1, + TrUserData) -> + dg_read_field_def_gateway_poc_key_routing_data_req_v1_pb(Other, + Z1, + Z2, + F@_1, + TrUserData). + +dg_read_field_def_gateway_poc_key_routing_data_req_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_poc_key_routing_data_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +dg_read_field_def_gateway_poc_key_routing_data_req_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_poc_key_routing_data_req_v1_pb_key(Rest, + 0, + 0, + F@_1, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_poc_key_routing_data_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 1 -> + skip_64_gateway_poc_key_routing_data_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 2 -> + skip_length_delimited_gateway_poc_key_routing_data_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 3 -> + skip_group_gateway_poc_key_routing_data_req_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + TrUserData); + 5 -> + skip_32_gateway_poc_key_routing_data_req_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData) + end + end; +dg_read_field_def_gateway_poc_key_routing_data_req_v1_pb(<<>>, + 0, 0, F@_1, _) -> + #gateway_poc_key_routing_data_req_v1_pb{key = F@_1}. + +d_field_gateway_poc_key_routing_data_req_v1_pb_key(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + d_field_gateway_poc_key_routing_data_req_v1_pb_key(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_gateway_poc_key_routing_data_req_v1_pb_key(<<0:1, + X:7, Rest/binary>>, + N, Acc, _, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_poc_key_routing_data_req_v1_pb(RestF, + 0, + 0, + NewFValue, + TrUserData). + +skip_varint_gateway_poc_key_routing_data_req_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + skip_varint_gateway_poc_key_routing_data_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData); +skip_varint_gateway_poc_key_routing_data_req_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_poc_key_routing_data_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_length_delimited_gateway_poc_key_routing_data_req_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + TrUserData) + when N < 57 -> + skip_length_delimited_gateway_poc_key_routing_data_req_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +skip_length_delimited_gateway_poc_key_routing_data_req_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_poc_key_routing_data_req_v1_pb(Rest2, + 0, + 0, + F@_1, + TrUserData). + +skip_group_gateway_poc_key_routing_data_req_v1_pb(Bin, + FNum, Z2, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_poc_key_routing_data_req_v1_pb(Rest, + 0, + Z2, + F@_1, + TrUserData). + +skip_32_gateway_poc_key_routing_data_req_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_poc_key_routing_data_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_64_gateway_poc_key_routing_data_req_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_gateway_poc_key_routing_data_req_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +decode_msg_gateway_public_routing_data_resp_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_gateway_public_routing_data_resp_v1_pb(Bin, + 0, + 0, + id(<<>>, + TrUserData), + id(undefined, + TrUserData), + TrUserData). + +dfp_read_field_def_gateway_public_routing_data_resp_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + d_field_gateway_public_routing_data_resp_v1_pb_address(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_gateway_public_routing_data_resp_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + d_field_gateway_public_routing_data_resp_v1_pb_public_uri(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_gateway_public_routing_data_resp_v1_pb(<<>>, + 0, 0, F@_1, F@_2, + _) -> + #gateway_public_routing_data_resp_v1_pb{address = F@_1, + public_uri = F@_2}; +dfp_read_field_def_gateway_public_routing_data_resp_v1_pb(Other, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dg_read_field_def_gateway_public_routing_data_resp_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +dg_read_field_def_gateway_public_routing_data_resp_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_gateway_public_routing_data_resp_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +dg_read_field_def_gateway_public_routing_data_resp_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_gateway_public_routing_data_resp_v1_pb_address(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 18 -> + d_field_gateway_public_routing_data_resp_v1_pb_public_uri(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_gateway_public_routing_data_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 1 -> + skip_64_gateway_public_routing_data_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 2 -> + skip_length_delimited_gateway_public_routing_data_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 3 -> + skip_group_gateway_public_routing_data_resp_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + TrUserData); + 5 -> + skip_32_gateway_public_routing_data_resp_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData) + end + end; +dg_read_field_def_gateway_public_routing_data_resp_v1_pb(<<>>, + 0, 0, F@_1, F@_2, _) -> + #gateway_public_routing_data_resp_v1_pb{address = F@_1, + public_uri = F@_2}. + +d_field_gateway_public_routing_data_resp_v1_pb_address(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) + when N < 57 -> + d_field_gateway_public_routing_data_resp_v1_pb_address(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_gateway_public_routing_data_resp_v1_pb_address(<<0:1, + X:7, Rest/binary>>, + N, Acc, _, F@_2, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_gateway_public_routing_data_resp_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + TrUserData). + +d_field_gateway_public_routing_data_resp_v1_pb_public_uri(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) + when N < 57 -> + d_field_gateway_public_routing_data_resp_v1_pb_public_uri(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_gateway_public_routing_data_resp_v1_pb_public_uri(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, Prev, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_routing_address_pb(Bs, TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_gateway_public_routing_data_resp_v1_pb(RestF, + 0, + 0, + F@_1, + if Prev == + undefined -> + NewFValue; + true -> + merge_msg_routing_address_pb(Prev, + NewFValue, + TrUserData) + end, + TrUserData). + +skip_varint_gateway_public_routing_data_resp_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + skip_varint_gateway_public_routing_data_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +skip_varint_gateway_public_routing_data_resp_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dfp_read_field_def_gateway_public_routing_data_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_length_delimited_gateway_public_routing_data_resp_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) + when N < 57 -> + skip_length_delimited_gateway_public_routing_data_resp_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +skip_length_delimited_gateway_public_routing_data_resp_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_gateway_public_routing_data_resp_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + TrUserData). + +skip_group_gateway_public_routing_data_resp_v1_pb(Bin, + FNum, Z2, F@_1, F@_2, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_gateway_public_routing_data_resp_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_32_gateway_public_routing_data_resp_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dfp_read_field_def_gateway_public_routing_data_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_64_gateway_public_routing_data_resp_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dfp_read_field_def_gateway_public_routing_data_resp_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +decode_msg_blockchain_state_channel_summary_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_summary_v1_pb(Bin, + 0, + 0, + id(<<>>, + TrUserData), + id(0, TrUserData), + id(0, TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_state_channel_summary_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, TrUserData) -> + d_field_blockchain_state_channel_summary_v1_pb_client_pubkeybin(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_blockchain_state_channel_summary_v1_pb(<<16, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, TrUserData) -> + d_field_blockchain_state_channel_summary_v1_pb_num_packets(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_blockchain_state_channel_summary_v1_pb(<<24, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, TrUserData) -> + d_field_blockchain_state_channel_summary_v1_pb_num_dcs(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_blockchain_state_channel_summary_v1_pb(<<>>, + 0, 0, F@_1, F@_2, + F@_3, _) -> + #blockchain_state_channel_summary_v1_pb{client_pubkeybin + = F@_1, + num_packets = F@_2, num_dcs = F@_3}; +dfp_read_field_def_blockchain_state_channel_summary_v1_pb(Other, + Z1, Z2, F@_1, F@_2, + F@_3, TrUserData) -> + dg_read_field_def_blockchain_state_channel_summary_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +dg_read_field_def_blockchain_state_channel_summary_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_state_channel_summary_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +dg_read_field_def_blockchain_state_channel_summary_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_blockchain_state_channel_summary_v1_pb_client_pubkeybin(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 16 -> + d_field_blockchain_state_channel_summary_v1_pb_num_packets(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 24 -> + d_field_blockchain_state_channel_summary_v1_pb_num_dcs(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_state_channel_summary_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 1 -> + skip_64_blockchain_state_channel_summary_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 2 -> + skip_length_delimited_blockchain_state_channel_summary_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 3 -> + skip_group_blockchain_state_channel_summary_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 5 -> + skip_32_blockchain_state_channel_summary_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData) + end + end; +dg_read_field_def_blockchain_state_channel_summary_v1_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, + _) -> + #blockchain_state_channel_summary_v1_pb{client_pubkeybin + = F@_1, + num_packets = F@_2, num_dcs = F@_3}. + +d_field_blockchain_state_channel_summary_v1_pb_client_pubkeybin(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_summary_v1_pb_client_pubkeybin(Rest, + N + 7, + X bsl N + + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_blockchain_state_channel_summary_v1_pb_client_pubkeybin(<<0:1, + X:7, + Rest/binary>>, + N, Acc, _, F@_2, + F@_3, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_state_channel_summary_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + TrUserData). + +d_field_blockchain_state_channel_summary_v1_pb_num_packets(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_summary_v1_pb_num_packets(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_blockchain_state_channel_summary_v1_pb_num_packets(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, _, + F@_3, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_state_channel_summary_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + TrUserData). + +d_field_blockchain_state_channel_summary_v1_pb_num_dcs(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_summary_v1_pb_num_dcs(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_blockchain_state_channel_summary_v1_pb_num_dcs(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, _, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_state_channel_summary_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + TrUserData). + +skip_varint_blockchain_state_channel_summary_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + skip_varint_blockchain_state_channel_summary_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_varint_blockchain_state_channel_summary_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_summary_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_length_delimited_blockchain_state_channel_summary_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_state_channel_summary_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_length_delimited_blockchain_state_channel_summary_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_state_channel_summary_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_group_blockchain_state_channel_summary_v1_pb(Bin, + FNum, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_state_channel_summary_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_32_blockchain_state_channel_summary_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_summary_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_64_blockchain_state_channel_summary_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_summary_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +decode_msg_blockchain_state_channel_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_v1_pb(Bin, + 0, + 0, + id(<<>>, TrUserData), + id(<<>>, TrUserData), + id(0, TrUserData), + id(0, TrUserData), + id([], TrUserData), + id(<<>>, TrUserData), + id(<<>>, TrUserData), + id(open, TrUserData), + id(0, TrUserData), + id(<<>>, TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_state_channel_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + d_field_blockchain_state_channel_v1_pb_id(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dfp_read_field_def_blockchain_state_channel_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + d_field_blockchain_state_channel_v1_pb_owner(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dfp_read_field_def_blockchain_state_channel_v1_pb(<<24, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + d_field_blockchain_state_channel_v1_pb_credits(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dfp_read_field_def_blockchain_state_channel_v1_pb(<<32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + d_field_blockchain_state_channel_v1_pb_nonce(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dfp_read_field_def_blockchain_state_channel_v1_pb(<<42, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + d_field_blockchain_state_channel_v1_pb_summaries(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dfp_read_field_def_blockchain_state_channel_v1_pb(<<50, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + d_field_blockchain_state_channel_v1_pb_root_hash(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dfp_read_field_def_blockchain_state_channel_v1_pb(<<58, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + d_field_blockchain_state_channel_v1_pb_skewed(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dfp_read_field_def_blockchain_state_channel_v1_pb(<<64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + d_field_blockchain_state_channel_v1_pb_state(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dfp_read_field_def_blockchain_state_channel_v1_pb(<<72, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + d_field_blockchain_state_channel_v1_pb_expire_at_block(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dfp_read_field_def_blockchain_state_channel_v1_pb(<<82, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + d_field_blockchain_state_channel_v1_pb_signature(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dfp_read_field_def_blockchain_state_channel_v1_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, F@_4, + R1, F@_6, F@_7, F@_8, F@_9, + F@_10, TrUserData) -> + #blockchain_state_channel_v1_pb{id = F@_1, owner = F@_2, + credits = F@_3, nonce = F@_4, + summaries = lists_reverse(R1, TrUserData), + root_hash = F@_6, skewed = F@_7, + state = F@_8, expire_at_block = F@_9, + signature = F@_10}; +dfp_read_field_def_blockchain_state_channel_v1_pb(Other, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + dg_read_field_def_blockchain_state_channel_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +dg_read_field_def_blockchain_state_channel_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_state_channel_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dg_read_field_def_blockchain_state_channel_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_blockchain_state_channel_v1_pb_id(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 18 -> + d_field_blockchain_state_channel_v1_pb_owner(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 24 -> + d_field_blockchain_state_channel_v1_pb_credits(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 32 -> + d_field_blockchain_state_channel_v1_pb_nonce(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 42 -> + d_field_blockchain_state_channel_v1_pb_summaries(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 50 -> + d_field_blockchain_state_channel_v1_pb_root_hash(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 58 -> + d_field_blockchain_state_channel_v1_pb_skewed(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 64 -> + d_field_blockchain_state_channel_v1_pb_state(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 72 -> + d_field_blockchain_state_channel_v1_pb_expire_at_block(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 82 -> + d_field_blockchain_state_channel_v1_pb_signature(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_state_channel_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 1 -> + skip_64_blockchain_state_channel_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 2 -> + skip_length_delimited_blockchain_state_channel_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 3 -> + skip_group_blockchain_state_channel_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 5 -> + skip_32_blockchain_state_channel_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData) + end + end; +dg_read_field_def_blockchain_state_channel_v1_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, F@_4, + R1, F@_6, F@_7, F@_8, F@_9, + F@_10, TrUserData) -> + #blockchain_state_channel_v1_pb{id = F@_1, owner = F@_2, + credits = F@_3, nonce = F@_4, + summaries = lists_reverse(R1, TrUserData), + root_hash = F@_6, skewed = F@_7, + state = F@_8, expire_at_block = F@_9, + signature = F@_10}. + +d_field_blockchain_state_channel_v1_pb_id(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_v1_pb_id(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_blockchain_state_channel_v1_pb_id(<<0:1, X:7, + Rest/binary>>, + N, Acc, _, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_state_channel_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +d_field_blockchain_state_channel_v1_pb_owner(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_v1_pb_owner(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_blockchain_state_channel_v1_pb_owner(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, _, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_state_channel_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +d_field_blockchain_state_channel_v1_pb_credits(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_v1_pb_credits(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_blockchain_state_channel_v1_pb_credits(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, _, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_state_channel_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +d_field_blockchain_state_channel_v1_pb_nonce(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_v1_pb_nonce(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_blockchain_state_channel_v1_pb_nonce(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, _, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_state_channel_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + NewFValue, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +d_field_blockchain_state_channel_v1_pb_summaries(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_v1_pb_summaries(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_blockchain_state_channel_v1_pb_summaries(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + Prev, F@_6, F@_7, F@_8, F@_9, + F@_10, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_state_channel_summary_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_state_channel_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + cons(NewFValue, + Prev, + TrUserData), + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +d_field_blockchain_state_channel_v1_pb_root_hash(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_v1_pb_root_hash(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_blockchain_state_channel_v1_pb_root_hash(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, _, F@_7, F@_8, F@_9, + F@_10, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_state_channel_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + NewFValue, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +d_field_blockchain_state_channel_v1_pb_skewed(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_v1_pb_skewed(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_blockchain_state_channel_v1_pb_skewed(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, _, F@_8, F@_9, F@_10, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_state_channel_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + NewFValue, + F@_8, + F@_9, + F@_10, + TrUserData). + +d_field_blockchain_state_channel_v1_pb_state(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_v1_pb_state(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_blockchain_state_channel_v1_pb_state(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, _, F@_9, F@_10, + TrUserData) -> + {NewFValue, RestF} = + {id('d_enum_helium.blockchain_state_channel_state_v1'(begin + <> = + <<(X bsl N + + + Acc):32/unsigned-native>>, + id(Res, + TrUserData) + end), + TrUserData), + Rest}, + dfp_read_field_def_blockchain_state_channel_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + NewFValue, + F@_9, + F@_10, + TrUserData). + +d_field_blockchain_state_channel_v1_pb_expire_at_block(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + F@_8, F@_9, F@_10, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_v1_pb_expire_at_block(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_blockchain_state_channel_v1_pb_expire_at_block(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + F@_8, _, F@_10, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_state_channel_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + NewFValue, + F@_10, + TrUserData). + +d_field_blockchain_state_channel_v1_pb_signature(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_v1_pb_signature(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_blockchain_state_channel_v1_pb_signature(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + _, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_state_channel_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + NewFValue, + TrUserData). + +skip_varint_blockchain_state_channel_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, + TrUserData) -> + skip_varint_blockchain_state_channel_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +skip_varint_blockchain_state_channel_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +skip_length_delimited_blockchain_state_channel_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + F@_8, F@_9, F@_10, + TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_state_channel_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +skip_length_delimited_blockchain_state_channel_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + F@_8, F@_9, F@_10, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_state_channel_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +skip_group_blockchain_state_channel_v1_pb(Bin, FNum, Z2, + F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, F@_9, F@_10, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_state_channel_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +skip_32_blockchain_state_channel_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +skip_64_blockchain_state_channel_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +decode_msg_blockchain_state_channel_response_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_response_v1_pb(Bin, + 0, + 0, + id(false, + TrUserData), + id(undefined, + TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_state_channel_response_v1_pb(<<8, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + d_field_blockchain_state_channel_response_v1_pb_accepted(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_blockchain_state_channel_response_v1_pb(<<34, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + d_field_blockchain_state_channel_response_v1_pb_downlink(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_blockchain_state_channel_response_v1_pb(<<>>, + 0, 0, F@_1, F@_2, + _) -> + #blockchain_state_channel_response_v1_pb{accepted = + F@_1, + downlink = F@_2}; +dfp_read_field_def_blockchain_state_channel_response_v1_pb(Other, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dg_read_field_def_blockchain_state_channel_response_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +dg_read_field_def_blockchain_state_channel_response_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_state_channel_response_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +dg_read_field_def_blockchain_state_channel_response_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 8 -> + d_field_blockchain_state_channel_response_v1_pb_accepted(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 34 -> + d_field_blockchain_state_channel_response_v1_pb_downlink(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_state_channel_response_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 1 -> + skip_64_blockchain_state_channel_response_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 2 -> + skip_length_delimited_blockchain_state_channel_response_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 3 -> + skip_group_blockchain_state_channel_response_v1_pb(Rest, + Key bsr + 3, + 0, + F@_1, + F@_2, + TrUserData); + 5 -> + skip_32_blockchain_state_channel_response_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData) + end + end; +dg_read_field_def_blockchain_state_channel_response_v1_pb(<<>>, + 0, 0, F@_1, F@_2, + _) -> + #blockchain_state_channel_response_v1_pb{accepted = + F@_1, + downlink = F@_2}. + +d_field_blockchain_state_channel_response_v1_pb_accepted(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_response_v1_pb_accepted(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_blockchain_state_channel_response_v1_pb_accepted(<<0:1, + X:7, Rest/binary>>, + N, Acc, _, F@_2, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc =/= 0, + TrUserData), + Rest}, + dfp_read_field_def_blockchain_state_channel_response_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + TrUserData). + +d_field_blockchain_state_channel_response_v1_pb_downlink(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_response_v1_pb_downlink(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_blockchain_state_channel_response_v1_pb_downlink(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, Prev, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_packet_pb(Bs, TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_state_channel_response_v1_pb(RestF, + 0, + 0, + F@_1, + if Prev == + undefined -> + NewFValue; + true -> + merge_msg_packet_pb(Prev, + NewFValue, + TrUserData) + end, + TrUserData). + +skip_varint_blockchain_state_channel_response_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + skip_varint_blockchain_state_channel_response_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +skip_varint_blockchain_state_channel_response_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_response_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_length_delimited_blockchain_state_channel_response_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_state_channel_response_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +skip_length_delimited_blockchain_state_channel_response_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_state_channel_response_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + TrUserData). + +skip_group_blockchain_state_channel_response_v1_pb(Bin, + FNum, Z2, F@_1, F@_2, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_state_channel_response_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_32_blockchain_state_channel_response_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_response_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_64_blockchain_state_channel_response_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_response_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +decode_msg_blockchain_state_channel_packet_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_packet_v1_pb(Bin, + 0, + 0, + id(undefined, + TrUserData), + id(<<>>, + TrUserData), + id(<<>>, + TrUserData), + id('US915', + TrUserData), + id(0, TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_state_channel_packet_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + d_field_blockchain_state_channel_packet_v1_pb_packet(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_blockchain_state_channel_packet_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + d_field_blockchain_state_channel_packet_v1_pb_hotspot(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_blockchain_state_channel_packet_v1_pb(<<26, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + d_field_blockchain_state_channel_packet_v1_pb_signature(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_blockchain_state_channel_packet_v1_pb(<<32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + d_field_blockchain_state_channel_packet_v1_pb_region(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_blockchain_state_channel_packet_v1_pb(<<40, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + d_field_blockchain_state_channel_packet_v1_pb_hold_time(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_blockchain_state_channel_packet_v1_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, + F@_4, F@_5, _) -> + #blockchain_state_channel_packet_v1_pb{packet = F@_1, + hotspot = F@_2, signature = F@_3, + region = F@_4, hold_time = F@_5}; +dfp_read_field_def_blockchain_state_channel_packet_v1_pb(Other, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + dg_read_field_def_blockchain_state_channel_packet_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +dg_read_field_def_blockchain_state_channel_packet_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_state_channel_packet_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dg_read_field_def_blockchain_state_channel_packet_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_blockchain_state_channel_packet_v1_pb_packet(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 18 -> + d_field_blockchain_state_channel_packet_v1_pb_hotspot(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 26 -> + d_field_blockchain_state_channel_packet_v1_pb_signature(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 32 -> + d_field_blockchain_state_channel_packet_v1_pb_region(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 40 -> + d_field_blockchain_state_channel_packet_v1_pb_hold_time(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_state_channel_packet_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 1 -> + skip_64_blockchain_state_channel_packet_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 2 -> + skip_length_delimited_blockchain_state_channel_packet_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 3 -> + skip_group_blockchain_state_channel_packet_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 5 -> + skip_32_blockchain_state_channel_packet_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData) + end + end; +dg_read_field_def_blockchain_state_channel_packet_v1_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, + F@_4, F@_5, _) -> + #blockchain_state_channel_packet_v1_pb{packet = F@_1, + hotspot = F@_2, signature = F@_3, + region = F@_4, hold_time = F@_5}. + +d_field_blockchain_state_channel_packet_v1_pb_packet(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_packet_v1_pb_packet(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_blockchain_state_channel_packet_v1_pb_packet(<<0:1, + X:7, Rest/binary>>, + N, Acc, Prev, F@_2, F@_3, + F@_4, F@_5, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_packet_pb(Bs, TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_state_channel_packet_v1_pb(RestF, + 0, + 0, + if Prev == + undefined -> + NewFValue; + true -> + merge_msg_packet_pb(Prev, + NewFValue, + TrUserData) + end, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +d_field_blockchain_state_channel_packet_v1_pb_hotspot(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_packet_v1_pb_hotspot(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_blockchain_state_channel_packet_v1_pb_hotspot(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, _, F@_3, + F@_4, F@_5, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_state_channel_packet_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + F@_4, + F@_5, + TrUserData). + +d_field_blockchain_state_channel_packet_v1_pb_signature(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_packet_v1_pb_signature(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_blockchain_state_channel_packet_v1_pb_signature(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, _, + F@_4, F@_5, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_state_channel_packet_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + F@_4, + F@_5, + TrUserData). + +d_field_blockchain_state_channel_packet_v1_pb_region(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_packet_v1_pb_region(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_blockchain_state_channel_packet_v1_pb_region(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + _, F@_5, TrUserData) -> + {NewFValue, RestF} = {id('d_enum_helium.region'(begin + <> = + <<(X bsl N + + Acc):32/unsigned-native>>, + id(Res, TrUserData) + end), + TrUserData), + Rest}, + dfp_read_field_def_blockchain_state_channel_packet_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + NewFValue, + F@_5, + TrUserData). + +d_field_blockchain_state_channel_packet_v1_pb_hold_time(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_packet_v1_pb_hold_time(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_blockchain_state_channel_packet_v1_pb_hold_time(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, _, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_state_channel_packet_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + NewFValue, + TrUserData). + +skip_varint_blockchain_state_channel_packet_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) -> + skip_varint_blockchain_state_channel_packet_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +skip_varint_blockchain_state_channel_packet_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) -> + dfp_read_field_def_blockchain_state_channel_packet_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_length_delimited_blockchain_state_channel_packet_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_state_channel_packet_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +skip_length_delimited_blockchain_state_channel_packet_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_state_channel_packet_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_group_blockchain_state_channel_packet_v1_pb(Bin, + FNum, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_state_channel_packet_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_32_blockchain_state_channel_packet_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, TrUserData) -> + dfp_read_field_def_blockchain_state_channel_packet_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_64_blockchain_state_channel_packet_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, TrUserData) -> + dfp_read_field_def_blockchain_state_channel_packet_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +decode_msg_blockchain_state_channel_offer_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_offer_v1_pb(Bin, + 0, + 0, + id(undefined, + TrUserData), + id(<<>>, + TrUserData), + id(0, TrUserData), + id(0, TrUserData), + id(<<>>, + TrUserData), + id(<<>>, + TrUserData), + id('US915', + TrUserData), + id(false, + TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_state_channel_offer_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, + TrUserData) -> + d_field_blockchain_state_channel_offer_v1_pb_routing(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +dfp_read_field_def_blockchain_state_channel_offer_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, + TrUserData) -> + d_field_blockchain_state_channel_offer_v1_pb_packet_hash(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +dfp_read_field_def_blockchain_state_channel_offer_v1_pb(<<24, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, + TrUserData) -> + d_field_blockchain_state_channel_offer_v1_pb_payload_size(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +dfp_read_field_def_blockchain_state_channel_offer_v1_pb(<<32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, + TrUserData) -> + d_field_blockchain_state_channel_offer_v1_pb_fcnt(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +dfp_read_field_def_blockchain_state_channel_offer_v1_pb(<<42, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, + TrUserData) -> + d_field_blockchain_state_channel_offer_v1_pb_hotspot(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +dfp_read_field_def_blockchain_state_channel_offer_v1_pb(<<50, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, + TrUserData) -> + d_field_blockchain_state_channel_offer_v1_pb_signature(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +dfp_read_field_def_blockchain_state_channel_offer_v1_pb(<<56, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, + TrUserData) -> + d_field_blockchain_state_channel_offer_v1_pb_region(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +dfp_read_field_def_blockchain_state_channel_offer_v1_pb(<<64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, + TrUserData) -> + d_field_blockchain_state_channel_offer_v1_pb_req_diff(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +dfp_read_field_def_blockchain_state_channel_offer_v1_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + F@_8, _) -> + #blockchain_state_channel_offer_v1_pb{routing = F@_1, + packet_hash = F@_2, + payload_size = F@_3, fcnt = F@_4, + hotspot = F@_5, signature = F@_6, + region = F@_7, req_diff = F@_8}; +dfp_read_field_def_blockchain_state_channel_offer_v1_pb(Other, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, + TrUserData) -> + dg_read_field_def_blockchain_state_channel_offer_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData). + +dg_read_field_def_blockchain_state_channel_offer_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + F@_8, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_state_channel_offer_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +dg_read_field_def_blockchain_state_channel_offer_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + F@_8, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_blockchain_state_channel_offer_v1_pb_routing(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 18 -> + d_field_blockchain_state_channel_offer_v1_pb_packet_hash(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 24 -> + d_field_blockchain_state_channel_offer_v1_pb_payload_size(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 32 -> + d_field_blockchain_state_channel_offer_v1_pb_fcnt(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 42 -> + d_field_blockchain_state_channel_offer_v1_pb_hotspot(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 50 -> + d_field_blockchain_state_channel_offer_v1_pb_signature(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 56 -> + d_field_blockchain_state_channel_offer_v1_pb_region(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 64 -> + d_field_blockchain_state_channel_offer_v1_pb_req_diff(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_state_channel_offer_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 1 -> + skip_64_blockchain_state_channel_offer_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 2 -> + skip_length_delimited_blockchain_state_channel_offer_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 3 -> + skip_group_blockchain_state_channel_offer_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); + 5 -> + skip_32_blockchain_state_channel_offer_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData) + end + end; +dg_read_field_def_blockchain_state_channel_offer_v1_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + F@_8, _) -> + #blockchain_state_channel_offer_v1_pb{routing = F@_1, + packet_hash = F@_2, + payload_size = F@_3, fcnt = F@_4, + hotspot = F@_5, signature = F@_6, + region = F@_7, req_diff = F@_8}. + +d_field_blockchain_state_channel_offer_v1_pb_routing(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + F@_8, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_offer_v1_pb_routing(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +d_field_blockchain_state_channel_offer_v1_pb_routing(<<0:1, + X:7, Rest/binary>>, + N, Acc, Prev, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + F@_8, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_routing_information_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_state_channel_offer_v1_pb(RestF, + 0, + 0, + if Prev == + undefined -> + NewFValue; + true -> + merge_msg_routing_information_pb(Prev, + NewFValue, + TrUserData) + end, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData). + +d_field_blockchain_state_channel_offer_v1_pb_packet_hash(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_offer_v1_pb_packet_hash(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +d_field_blockchain_state_channel_offer_v1_pb_packet_hash(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, _, F@_3, + F@_4, F@_5, F@_6, F@_7, + F@_8, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_state_channel_offer_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData). + +d_field_blockchain_state_channel_offer_v1_pb_payload_size(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_offer_v1_pb_payload_size(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +d_field_blockchain_state_channel_offer_v1_pb_payload_size(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, _, + F@_4, F@_5, F@_6, + F@_7, F@_8, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_state_channel_offer_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData). + +d_field_blockchain_state_channel_offer_v1_pb_fcnt(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, F@_8, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_offer_v1_pb_fcnt(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +d_field_blockchain_state_channel_offer_v1_pb_fcnt(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, _, + F@_5, F@_6, F@_7, F@_8, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_state_channel_offer_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + NewFValue, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData). + +d_field_blockchain_state_channel_offer_v1_pb_hotspot(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + F@_8, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_offer_v1_pb_hotspot(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +d_field_blockchain_state_channel_offer_v1_pb_hotspot(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, _, F@_6, F@_7, F@_8, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_state_channel_offer_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + NewFValue, + F@_6, + F@_7, + F@_8, + TrUserData). + +d_field_blockchain_state_channel_offer_v1_pb_signature(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + F@_8, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_offer_v1_pb_signature(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +d_field_blockchain_state_channel_offer_v1_pb_signature(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, _, F@_7, + F@_8, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_state_channel_offer_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + NewFValue, + F@_7, + F@_8, + TrUserData). + +d_field_blockchain_state_channel_offer_v1_pb_region(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + F@_8, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_offer_v1_pb_region(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +d_field_blockchain_state_channel_offer_v1_pb_region(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, _, F@_8, + TrUserData) -> + {NewFValue, RestF} = {id('d_enum_helium.region'(begin + <> = + <<(X bsl N + + Acc):32/unsigned-native>>, + id(Res, TrUserData) + end), + TrUserData), + Rest}, + dfp_read_field_def_blockchain_state_channel_offer_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + NewFValue, + F@_8, + TrUserData). + +d_field_blockchain_state_channel_offer_v1_pb_req_diff(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + F@_8, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_offer_v1_pb_req_diff(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +d_field_blockchain_state_channel_offer_v1_pb_req_diff(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, _, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc =/= 0, + TrUserData), + Rest}, + dfp_read_field_def_blockchain_state_channel_offer_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + NewFValue, + TrUserData). + +skip_varint_blockchain_state_channel_offer_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, + TrUserData) -> + skip_varint_blockchain_state_channel_offer_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +skip_varint_blockchain_state_channel_offer_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_offer_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData). + +skip_length_delimited_blockchain_state_channel_offer_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, + TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_state_channel_offer_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData); +skip_length_delimited_blockchain_state_channel_offer_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_state_channel_offer_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData). + +skip_group_blockchain_state_channel_offer_v1_pb(Bin, + FNum, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, F@_8, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_state_channel_offer_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData). + +skip_32_blockchain_state_channel_offer_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_offer_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData). + +skip_64_blockchain_state_channel_offer_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_offer_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + TrUserData). + +decode_msg_blockchain_state_channel_purchase_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_purchase_v1_pb(Bin, + 0, + 0, + id(undefined, + TrUserData), + id(<<>>, + TrUserData), + id(<<>>, + TrUserData), + id('US915', + TrUserData), + id(undefined, + TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_state_channel_purchase_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + d_field_blockchain_state_channel_purchase_v1_pb_sc(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_blockchain_state_channel_purchase_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + d_field_blockchain_state_channel_purchase_v1_pb_hotspot(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_blockchain_state_channel_purchase_v1_pb(<<26, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + d_field_blockchain_state_channel_purchase_v1_pb_packet_hash(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_blockchain_state_channel_purchase_v1_pb(<<32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + d_field_blockchain_state_channel_purchase_v1_pb_region(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_blockchain_state_channel_purchase_v1_pb(<<42, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + d_field_blockchain_state_channel_purchase_v1_pb_sc_diff(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_blockchain_state_channel_purchase_v1_pb(<<>>, + 0, 0, F@_1, F@_2, + F@_3, F@_4, F@_5, + _) -> + #blockchain_state_channel_purchase_v1_pb{sc = F@_1, + hotspot = F@_2, packet_hash = F@_3, + region = F@_4, sc_diff = F@_5}; +dfp_read_field_def_blockchain_state_channel_purchase_v1_pb(Other, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + dg_read_field_def_blockchain_state_channel_purchase_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +dg_read_field_def_blockchain_state_channel_purchase_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_state_channel_purchase_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dg_read_field_def_blockchain_state_channel_purchase_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_blockchain_state_channel_purchase_v1_pb_sc(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 18 -> + d_field_blockchain_state_channel_purchase_v1_pb_hotspot(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 26 -> + d_field_blockchain_state_channel_purchase_v1_pb_packet_hash(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 32 -> + d_field_blockchain_state_channel_purchase_v1_pb_region(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 42 -> + d_field_blockchain_state_channel_purchase_v1_pb_sc_diff(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_state_channel_purchase_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 1 -> + skip_64_blockchain_state_channel_purchase_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 2 -> + skip_length_delimited_blockchain_state_channel_purchase_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 3 -> + skip_group_blockchain_state_channel_purchase_v1_pb(Rest, + Key bsr + 3, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 5 -> + skip_32_blockchain_state_channel_purchase_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData) + end + end; +dg_read_field_def_blockchain_state_channel_purchase_v1_pb(<<>>, + 0, 0, F@_1, F@_2, + F@_3, F@_4, F@_5, + _) -> + #blockchain_state_channel_purchase_v1_pb{sc = F@_1, + hotspot = F@_2, packet_hash = F@_3, + region = F@_4, sc_diff = F@_5}. + +d_field_blockchain_state_channel_purchase_v1_pb_sc(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_purchase_v1_pb_sc(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_blockchain_state_channel_purchase_v1_pb_sc(<<0:1, + X:7, Rest/binary>>, + N, Acc, Prev, F@_2, F@_3, + F@_4, F@_5, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_state_channel_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_state_channel_purchase_v1_pb(RestF, + 0, + 0, + if Prev == + undefined -> + NewFValue; + true -> + merge_msg_blockchain_state_channel_v1_pb(Prev, + NewFValue, + TrUserData) + end, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +d_field_blockchain_state_channel_purchase_v1_pb_hotspot(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_purchase_v1_pb_hotspot(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_blockchain_state_channel_purchase_v1_pb_hotspot(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, _, F@_3, + F@_4, F@_5, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_state_channel_purchase_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + F@_4, + F@_5, + TrUserData). + +d_field_blockchain_state_channel_purchase_v1_pb_packet_hash(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_purchase_v1_pb_packet_hash(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_blockchain_state_channel_purchase_v1_pb_packet_hash(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + _, F@_4, F@_5, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_state_channel_purchase_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + F@_4, + F@_5, + TrUserData). + +d_field_blockchain_state_channel_purchase_v1_pb_region(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_purchase_v1_pb_region(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_blockchain_state_channel_purchase_v1_pb_region(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + _, F@_5, TrUserData) -> + {NewFValue, RestF} = {id('d_enum_helium.region'(begin + <> = + <<(X bsl N + + Acc):32/unsigned-native>>, + id(Res, TrUserData) + end), + TrUserData), + Rest}, + dfp_read_field_def_blockchain_state_channel_purchase_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + NewFValue, + F@_5, + TrUserData). + +d_field_blockchain_state_channel_purchase_v1_pb_sc_diff(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_purchase_v1_pb_sc_diff(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_blockchain_state_channel_purchase_v1_pb_sc_diff(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, Prev, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_state_channel_diff_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_state_channel_purchase_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + if Prev == + undefined -> + NewFValue; + true -> + merge_msg_blockchain_state_channel_diff_v1_pb(Prev, + NewFValue, + TrUserData) + end, + TrUserData). + +skip_varint_blockchain_state_channel_purchase_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) -> + skip_varint_blockchain_state_channel_purchase_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +skip_varint_blockchain_state_channel_purchase_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) -> + dfp_read_field_def_blockchain_state_channel_purchase_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_length_delimited_blockchain_state_channel_purchase_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, F@_4, + F@_5, TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_state_channel_purchase_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +skip_length_delimited_blockchain_state_channel_purchase_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, F@_4, + F@_5, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_state_channel_purchase_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_group_blockchain_state_channel_purchase_v1_pb(Bin, + FNum, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_state_channel_purchase_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_32_blockchain_state_channel_purchase_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, TrUserData) -> + dfp_read_field_def_blockchain_state_channel_purchase_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_64_blockchain_state_channel_purchase_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, TrUserData) -> + dfp_read_field_def_blockchain_state_channel_purchase_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +decode_msg_blockchain_state_channel_diff_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_diff_v1_pb(Bin, + 0, + 0, + id(<<>>, TrUserData), + id(0, TrUserData), + id(<<>>, TrUserData), + id([], TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_state_channel_diff_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, TrUserData) -> + d_field_blockchain_state_channel_diff_v1_pb_id(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +dfp_read_field_def_blockchain_state_channel_diff_v1_pb(<<16, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, TrUserData) -> + d_field_blockchain_state_channel_diff_v1_pb_add_nonce(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +dfp_read_field_def_blockchain_state_channel_diff_v1_pb(<<26, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, TrUserData) -> + d_field_blockchain_state_channel_diff_v1_pb_signature(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +dfp_read_field_def_blockchain_state_channel_diff_v1_pb(<<34, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, TrUserData) -> + d_field_blockchain_state_channel_diff_v1_pb_diffs(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +dfp_read_field_def_blockchain_state_channel_diff_v1_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, + R1, TrUserData) -> + #blockchain_state_channel_diff_v1_pb{id = F@_1, + add_nonce = F@_2, signature = F@_3, + diffs = lists_reverse(R1, TrUserData)}; +dfp_read_field_def_blockchain_state_channel_diff_v1_pb(Other, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, TrUserData) -> + dg_read_field_def_blockchain_state_channel_diff_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData). + +dg_read_field_def_blockchain_state_channel_diff_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_state_channel_diff_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +dg_read_field_def_blockchain_state_channel_diff_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_blockchain_state_channel_diff_v1_pb_id(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); + 16 -> + d_field_blockchain_state_channel_diff_v1_pb_add_nonce(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); + 26 -> + d_field_blockchain_state_channel_diff_v1_pb_signature(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); + 34 -> + d_field_blockchain_state_channel_diff_v1_pb_diffs(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_state_channel_diff_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); + 1 -> + skip_64_blockchain_state_channel_diff_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); + 2 -> + skip_length_delimited_blockchain_state_channel_diff_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); + 3 -> + skip_group_blockchain_state_channel_diff_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); + 5 -> + skip_32_blockchain_state_channel_diff_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData) + end + end; +dg_read_field_def_blockchain_state_channel_diff_v1_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, + R1, TrUserData) -> + #blockchain_state_channel_diff_v1_pb{id = F@_1, + add_nonce = F@_2, signature = F@_3, + diffs = lists_reverse(R1, TrUserData)}. + +d_field_blockchain_state_channel_diff_v1_pb_id(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_diff_v1_pb_id(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +d_field_blockchain_state_channel_diff_v1_pb_id(<<0:1, + X:7, Rest/binary>>, + N, Acc, _, F@_2, F@_3, F@_4, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_state_channel_diff_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + F@_4, + TrUserData). + +d_field_blockchain_state_channel_diff_v1_pb_add_nonce(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_diff_v1_pb_add_nonce(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +d_field_blockchain_state_channel_diff_v1_pb_add_nonce(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, _, F@_3, + F@_4, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_state_channel_diff_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + F@_4, + TrUserData). + +d_field_blockchain_state_channel_diff_v1_pb_signature(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_diff_v1_pb_signature(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +d_field_blockchain_state_channel_diff_v1_pb_signature(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, _, + F@_4, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_state_channel_diff_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + F@_4, + TrUserData). + +d_field_blockchain_state_channel_diff_v1_pb_diffs(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_diff_v1_pb_diffs(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +d_field_blockchain_state_channel_diff_v1_pb_diffs(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + Prev, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_state_channel_diff_entry_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_state_channel_diff_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + cons(NewFValue, + Prev, + TrUserData), + TrUserData). + +skip_varint_blockchain_state_channel_diff_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + TrUserData) -> + skip_varint_blockchain_state_channel_diff_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +skip_varint_blockchain_state_channel_diff_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_diff_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData). + +skip_length_delimited_blockchain_state_channel_diff_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, + TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_state_channel_diff_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +skip_length_delimited_blockchain_state_channel_diff_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_state_channel_diff_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData). + +skip_group_blockchain_state_channel_diff_v1_pb(Bin, + FNum, Z2, F@_1, F@_2, F@_3, F@_4, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_state_channel_diff_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData). + +skip_32_blockchain_state_channel_diff_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_diff_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData). + +skip_64_blockchain_state_channel_diff_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_diff_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData). + +decode_msg_blockchain_state_channel_diff_entry_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_diff_entry_v1_pb(Bin, + 0, + 0, + id(undefined, + TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_state_channel_diff_entry_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, + TrUserData) -> + d_field_blockchain_state_channel_diff_entry_v1_pb_append(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_blockchain_state_channel_diff_entry_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, + TrUserData) -> + d_field_blockchain_state_channel_diff_entry_v1_pb_add(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_blockchain_state_channel_diff_entry_v1_pb(<<>>, + 0, 0, F@_1, _) -> + #blockchain_state_channel_diff_entry_v1_pb{entry = + F@_1}; +dfp_read_field_def_blockchain_state_channel_diff_entry_v1_pb(Other, + Z1, Z2, F@_1, + TrUserData) -> + dg_read_field_def_blockchain_state_channel_diff_entry_v1_pb(Other, + Z1, + Z2, + F@_1, + TrUserData). + +dg_read_field_def_blockchain_state_channel_diff_entry_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_state_channel_diff_entry_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +dg_read_field_def_blockchain_state_channel_diff_entry_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_blockchain_state_channel_diff_entry_v1_pb_append(Rest, + 0, + 0, + F@_1, + TrUserData); + 18 -> + d_field_blockchain_state_channel_diff_entry_v1_pb_add(Rest, + 0, + 0, + F@_1, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_state_channel_diff_entry_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 1 -> + skip_64_blockchain_state_channel_diff_entry_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 2 -> + skip_length_delimited_blockchain_state_channel_diff_entry_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 3 -> + skip_group_blockchain_state_channel_diff_entry_v1_pb(Rest, + Key bsr + 3, + 0, + F@_1, + TrUserData); + 5 -> + skip_32_blockchain_state_channel_diff_entry_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData) + end + end; +dg_read_field_def_blockchain_state_channel_diff_entry_v1_pb(<<>>, + 0, 0, F@_1, _) -> + #blockchain_state_channel_diff_entry_v1_pb{entry = + F@_1}. + +d_field_blockchain_state_channel_diff_entry_v1_pb_append(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_diff_entry_v1_pb_append(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_blockchain_state_channel_diff_entry_v1_pb_append(<<0:1, + X:7, Rest/binary>>, + N, Acc, Prev, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_state_channel_diff_append_summary_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_state_channel_diff_entry_v1_pb(RestF, + 0, + 0, + case Prev of + undefined -> + id({append, + NewFValue}, + TrUserData); + {append, + MVPrev} -> + id({append, + merge_msg_blockchain_state_channel_diff_append_summary_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({append, + NewFValue}, + TrUserData) + end, + TrUserData). + +d_field_blockchain_state_channel_diff_entry_v1_pb_add(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_diff_entry_v1_pb_add(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_blockchain_state_channel_diff_entry_v1_pb_add(<<0:1, + X:7, Rest/binary>>, + N, Acc, Prev, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_state_channel_diff_update_summary_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_state_channel_diff_entry_v1_pb(RestF, + 0, + 0, + case Prev of + undefined -> + id({add, + NewFValue}, + TrUserData); + {add, + MVPrev} -> + id({add, + merge_msg_blockchain_state_channel_diff_update_summary_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({add, + NewFValue}, + TrUserData) + end, + TrUserData). + +skip_varint_blockchain_state_channel_diff_entry_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, + TrUserData) -> + skip_varint_blockchain_state_channel_diff_entry_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData); +skip_varint_blockchain_state_channel_diff_entry_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_diff_entry_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_length_delimited_blockchain_state_channel_diff_entry_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_state_channel_diff_entry_v1_pb(Rest, + N + 7, + X bsl N + + Acc, + F@_1, + TrUserData); +skip_length_delimited_blockchain_state_channel_diff_entry_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_state_channel_diff_entry_v1_pb(Rest2, + 0, + 0, + F@_1, + TrUserData). + +skip_group_blockchain_state_channel_diff_entry_v1_pb(Bin, + FNum, Z2, F@_1, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_state_channel_diff_entry_v1_pb(Rest, + 0, + Z2, + F@_1, + TrUserData). + +skip_32_blockchain_state_channel_diff_entry_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_blockchain_state_channel_diff_entry_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_64_blockchain_state_channel_diff_entry_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_blockchain_state_channel_diff_entry_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +decode_msg_blockchain_state_channel_diff_append_summary_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_diff_append_summary_v1_pb(Bin, + 0, + 0, + id(<<>>, + TrUserData), + id(0, + TrUserData), + id(0, + TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_state_channel_diff_append_summary_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, + F@_1, + F@_2, + F@_3, + TrUserData) -> + d_field_blockchain_state_channel_diff_append_summary_v1_pb_client_pubkeybin(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_blockchain_state_channel_diff_append_summary_v1_pb(<<16, + Rest/binary>>, + Z1, Z2, + F@_1, + F@_2, + F@_3, + TrUserData) -> + d_field_blockchain_state_channel_diff_append_summary_v1_pb_num_packets(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_blockchain_state_channel_diff_append_summary_v1_pb(<<24, + Rest/binary>>, + Z1, Z2, + F@_1, + F@_2, + F@_3, + TrUserData) -> + d_field_blockchain_state_channel_diff_append_summary_v1_pb_num_dcs(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_blockchain_state_channel_diff_append_summary_v1_pb(<<>>, + 0, 0, + F@_1, + F@_2, + F@_3, + _) -> + #blockchain_state_channel_diff_append_summary_v1_pb{client_pubkeybin + = F@_1, + num_packets = F@_2, + num_dcs = F@_3}; +dfp_read_field_def_blockchain_state_channel_diff_append_summary_v1_pb(Other, + Z1, Z2, + F@_1, + F@_2, + F@_3, + TrUserData) -> + dg_read_field_def_blockchain_state_channel_diff_append_summary_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +dg_read_field_def_blockchain_state_channel_diff_append_summary_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, F@_2, + F@_3, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_state_channel_diff_append_summary_v1_pb(Rest, + N + 7, + X bsl N + + + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +dg_read_field_def_blockchain_state_channel_diff_append_summary_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, F@_2, + F@_3, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_blockchain_state_channel_diff_append_summary_v1_pb_client_pubkeybin(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 16 -> + d_field_blockchain_state_channel_diff_append_summary_v1_pb_num_packets(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 24 -> + d_field_blockchain_state_channel_diff_append_summary_v1_pb_num_dcs(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_state_channel_diff_append_summary_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 1 -> + skip_64_blockchain_state_channel_diff_append_summary_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 2 -> + skip_length_delimited_blockchain_state_channel_diff_append_summary_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 3 -> + skip_group_blockchain_state_channel_diff_append_summary_v1_pb(Rest, + Key + bsr + 3, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 5 -> + skip_32_blockchain_state_channel_diff_append_summary_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData) + end + end; +dg_read_field_def_blockchain_state_channel_diff_append_summary_v1_pb(<<>>, + 0, 0, F@_1, + F@_2, F@_3, + _) -> + #blockchain_state_channel_diff_append_summary_v1_pb{client_pubkeybin + = F@_1, + num_packets = F@_2, + num_dcs = F@_3}. + +d_field_blockchain_state_channel_diff_append_summary_v1_pb_client_pubkeybin(<<1:1, + X:7, + Rest/binary>>, + N, + Acc, + F@_1, + F@_2, + F@_3, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_diff_append_summary_v1_pb_client_pubkeybin(Rest, + N + + + 7, + X + bsl + N + + + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_blockchain_state_channel_diff_append_summary_v1_pb_client_pubkeybin(<<0:1, + X:7, + Rest/binary>>, + N, + Acc, + _, + F@_2, + F@_3, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_state_channel_diff_append_summary_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + TrUserData). + +d_field_blockchain_state_channel_diff_append_summary_v1_pb_num_packets(<<1:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, + F@_2, + F@_3, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_diff_append_summary_v1_pb_num_packets(Rest, + N + + 7, + X bsl + N + + + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_blockchain_state_channel_diff_append_summary_v1_pb_num_packets(<<0:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, _, + F@_3, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_state_channel_diff_append_summary_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + TrUserData). + +d_field_blockchain_state_channel_diff_append_summary_v1_pb_num_dcs(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_diff_append_summary_v1_pb_num_dcs(Rest, + N + 7, + X bsl N + + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_blockchain_state_channel_diff_append_summary_v1_pb_num_dcs(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, _, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_state_channel_diff_append_summary_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + TrUserData). + +skip_varint_blockchain_state_channel_diff_append_summary_v1_pb(<<1:1, + _:7, + Rest/binary>>, + Z1, Z2, F@_1, + F@_2, F@_3, + TrUserData) -> + skip_varint_blockchain_state_channel_diff_append_summary_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_varint_blockchain_state_channel_diff_append_summary_v1_pb(<<0:1, + _:7, + Rest/binary>>, + Z1, Z2, F@_1, + F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_diff_append_summary_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_length_delimited_blockchain_state_channel_diff_append_summary_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, + F@_2, + F@_3, + TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_state_channel_diff_append_summary_v1_pb(Rest, + N + + 7, + X + bsl + N + + + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_length_delimited_blockchain_state_channel_diff_append_summary_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, + F@_2, + F@_3, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_state_channel_diff_append_summary_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_group_blockchain_state_channel_diff_append_summary_v1_pb(Bin, + FNum, Z2, F@_1, + F@_2, F@_3, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_state_channel_diff_append_summary_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_32_blockchain_state_channel_diff_append_summary_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, TrUserData) -> + dfp_read_field_def_blockchain_state_channel_diff_append_summary_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_64_blockchain_state_channel_diff_append_summary_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, TrUserData) -> + dfp_read_field_def_blockchain_state_channel_diff_append_summary_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +decode_msg_blockchain_state_channel_diff_update_summary_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_diff_update_summary_v1_pb(Bin, + 0, + 0, + id(0, + TrUserData), + id(0, + TrUserData), + id(0, + TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_state_channel_diff_update_summary_v1_pb(<<8, + Rest/binary>>, + Z1, Z2, + F@_1, + F@_2, + F@_3, + TrUserData) -> + d_field_blockchain_state_channel_diff_update_summary_v1_pb_client_index(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_blockchain_state_channel_diff_update_summary_v1_pb(<<16, + Rest/binary>>, + Z1, Z2, + F@_1, + F@_2, + F@_3, + TrUserData) -> + d_field_blockchain_state_channel_diff_update_summary_v1_pb_add_packets(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_blockchain_state_channel_diff_update_summary_v1_pb(<<24, + Rest/binary>>, + Z1, Z2, + F@_1, + F@_2, + F@_3, + TrUserData) -> + d_field_blockchain_state_channel_diff_update_summary_v1_pb_add_dcs(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_blockchain_state_channel_diff_update_summary_v1_pb(<<>>, + 0, 0, + F@_1, + F@_2, + F@_3, + _) -> + #blockchain_state_channel_diff_update_summary_v1_pb{client_index + = F@_1, + add_packets = F@_2, + add_dcs = F@_3}; +dfp_read_field_def_blockchain_state_channel_diff_update_summary_v1_pb(Other, + Z1, Z2, + F@_1, + F@_2, + F@_3, + TrUserData) -> + dg_read_field_def_blockchain_state_channel_diff_update_summary_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +dg_read_field_def_blockchain_state_channel_diff_update_summary_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, F@_2, + F@_3, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_state_channel_diff_update_summary_v1_pb(Rest, + N + 7, + X bsl N + + + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +dg_read_field_def_blockchain_state_channel_diff_update_summary_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, F@_2, + F@_3, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 8 -> + d_field_blockchain_state_channel_diff_update_summary_v1_pb_client_index(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 16 -> + d_field_blockchain_state_channel_diff_update_summary_v1_pb_add_packets(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 24 -> + d_field_blockchain_state_channel_diff_update_summary_v1_pb_add_dcs(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_state_channel_diff_update_summary_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 1 -> + skip_64_blockchain_state_channel_diff_update_summary_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 2 -> + skip_length_delimited_blockchain_state_channel_diff_update_summary_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 3 -> + skip_group_blockchain_state_channel_diff_update_summary_v1_pb(Rest, + Key + bsr + 3, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 5 -> + skip_32_blockchain_state_channel_diff_update_summary_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData) + end + end; +dg_read_field_def_blockchain_state_channel_diff_update_summary_v1_pb(<<>>, + 0, 0, F@_1, + F@_2, F@_3, + _) -> + #blockchain_state_channel_diff_update_summary_v1_pb{client_index + = F@_1, + add_packets = F@_2, + add_dcs = F@_3}. + +d_field_blockchain_state_channel_diff_update_summary_v1_pb_client_index(<<1:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, + F@_2, + F@_3, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_diff_update_summary_v1_pb_client_index(Rest, + N + + 7, + X + bsl + N + + + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_blockchain_state_channel_diff_update_summary_v1_pb_client_index(<<0:1, + X:7, + Rest/binary>>, + N, Acc, + _, F@_2, + F@_3, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_state_channel_diff_update_summary_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + TrUserData). + +d_field_blockchain_state_channel_diff_update_summary_v1_pb_add_packets(<<1:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, + F@_2, + F@_3, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_diff_update_summary_v1_pb_add_packets(Rest, + N + + 7, + X bsl + N + + + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_blockchain_state_channel_diff_update_summary_v1_pb_add_packets(<<0:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, _, + F@_3, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_state_channel_diff_update_summary_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + TrUserData). + +d_field_blockchain_state_channel_diff_update_summary_v1_pb_add_dcs(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_diff_update_summary_v1_pb_add_dcs(Rest, + N + 7, + X bsl N + + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_blockchain_state_channel_diff_update_summary_v1_pb_add_dcs(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, _, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_state_channel_diff_update_summary_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + TrUserData). + +skip_varint_blockchain_state_channel_diff_update_summary_v1_pb(<<1:1, + _:7, + Rest/binary>>, + Z1, Z2, F@_1, + F@_2, F@_3, + TrUserData) -> + skip_varint_blockchain_state_channel_diff_update_summary_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_varint_blockchain_state_channel_diff_update_summary_v1_pb(<<0:1, + _:7, + Rest/binary>>, + Z1, Z2, F@_1, + F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_diff_update_summary_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_length_delimited_blockchain_state_channel_diff_update_summary_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, + F@_2, + F@_3, + TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_state_channel_diff_update_summary_v1_pb(Rest, + N + + 7, + X + bsl + N + + + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_length_delimited_blockchain_state_channel_diff_update_summary_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, + F@_1, + F@_2, + F@_3, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_state_channel_diff_update_summary_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_group_blockchain_state_channel_diff_update_summary_v1_pb(Bin, + FNum, Z2, F@_1, + F@_2, F@_3, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_state_channel_diff_update_summary_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_32_blockchain_state_channel_diff_update_summary_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, TrUserData) -> + dfp_read_field_def_blockchain_state_channel_diff_update_summary_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_64_blockchain_state_channel_diff_update_summary_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, TrUserData) -> + dfp_read_field_def_blockchain_state_channel_diff_update_summary_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +decode_msg_blockchain_state_channel_banner_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_banner_v1_pb(Bin, + 0, + 0, + id(undefined, + TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_state_channel_banner_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, + TrUserData) -> + d_field_blockchain_state_channel_banner_v1_pb_sc(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_blockchain_state_channel_banner_v1_pb(<<>>, + 0, 0, F@_1, _) -> + #blockchain_state_channel_banner_v1_pb{sc = F@_1}; +dfp_read_field_def_blockchain_state_channel_banner_v1_pb(Other, + Z1, Z2, F@_1, + TrUserData) -> + dg_read_field_def_blockchain_state_channel_banner_v1_pb(Other, + Z1, + Z2, + F@_1, + TrUserData). + +dg_read_field_def_blockchain_state_channel_banner_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_state_channel_banner_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +dg_read_field_def_blockchain_state_channel_banner_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_blockchain_state_channel_banner_v1_pb_sc(Rest, + 0, + 0, + F@_1, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_state_channel_banner_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 1 -> + skip_64_blockchain_state_channel_banner_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 2 -> + skip_length_delimited_blockchain_state_channel_banner_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 3 -> + skip_group_blockchain_state_channel_banner_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + TrUserData); + 5 -> + skip_32_blockchain_state_channel_banner_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData) + end + end; +dg_read_field_def_blockchain_state_channel_banner_v1_pb(<<>>, + 0, 0, F@_1, _) -> + #blockchain_state_channel_banner_v1_pb{sc = F@_1}. + +d_field_blockchain_state_channel_banner_v1_pb_sc(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_banner_v1_pb_sc(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_blockchain_state_channel_banner_v1_pb_sc(<<0:1, + X:7, Rest/binary>>, + N, Acc, Prev, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_state_channel_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_state_channel_banner_v1_pb(RestF, + 0, + 0, + if Prev == + undefined -> + NewFValue; + true -> + merge_msg_blockchain_state_channel_v1_pb(Prev, + NewFValue, + TrUserData) + end, + TrUserData). + +skip_varint_blockchain_state_channel_banner_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + skip_varint_blockchain_state_channel_banner_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData); +skip_varint_blockchain_state_channel_banner_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_blockchain_state_channel_banner_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_length_delimited_blockchain_state_channel_banner_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_state_channel_banner_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +skip_length_delimited_blockchain_state_channel_banner_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_state_channel_banner_v1_pb(Rest2, + 0, + 0, + F@_1, + TrUserData). + +skip_group_blockchain_state_channel_banner_v1_pb(Bin, + FNum, Z2, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_state_channel_banner_v1_pb(Rest, + 0, + Z2, + F@_1, + TrUserData). + +skip_32_blockchain_state_channel_banner_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_blockchain_state_channel_banner_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_64_blockchain_state_channel_banner_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_blockchain_state_channel_banner_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +decode_msg_blockchain_state_channel_rejection_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_rejection_v1_pb(Bin, + 0, + 0, + id(0, + TrUserData), + id(<<>>, + TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_state_channel_rejection_v1_pb(<<8, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + d_field_blockchain_state_channel_rejection_v1_pb_reject(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_blockchain_state_channel_rejection_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + d_field_blockchain_state_channel_rejection_v1_pb_packet_hash(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_blockchain_state_channel_rejection_v1_pb(<<>>, + 0, 0, F@_1, F@_2, + _) -> + #blockchain_state_channel_rejection_v1_pb{reject = F@_1, + packet_hash = F@_2}; +dfp_read_field_def_blockchain_state_channel_rejection_v1_pb(Other, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dg_read_field_def_blockchain_state_channel_rejection_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +dg_read_field_def_blockchain_state_channel_rejection_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_state_channel_rejection_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +dg_read_field_def_blockchain_state_channel_rejection_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 8 -> + d_field_blockchain_state_channel_rejection_v1_pb_reject(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 18 -> + d_field_blockchain_state_channel_rejection_v1_pb_packet_hash(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_state_channel_rejection_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 1 -> + skip_64_blockchain_state_channel_rejection_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 2 -> + skip_length_delimited_blockchain_state_channel_rejection_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 3 -> + skip_group_blockchain_state_channel_rejection_v1_pb(Rest, + Key bsr + 3, + 0, + F@_1, + F@_2, + TrUserData); + 5 -> + skip_32_blockchain_state_channel_rejection_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData) + end + end; +dg_read_field_def_blockchain_state_channel_rejection_v1_pb(<<>>, + 0, 0, F@_1, F@_2, + _) -> + #blockchain_state_channel_rejection_v1_pb{reject = F@_1, + packet_hash = F@_2}. + +d_field_blockchain_state_channel_rejection_v1_pb_reject(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_rejection_v1_pb_reject(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_blockchain_state_channel_rejection_v1_pb_reject(<<0:1, + X:7, Rest/binary>>, + N, Acc, _, F@_2, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_state_channel_rejection_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + TrUserData). + +d_field_blockchain_state_channel_rejection_v1_pb_packet_hash(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_rejection_v1_pb_packet_hash(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_blockchain_state_channel_rejection_v1_pb_packet_hash(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, _, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_state_channel_rejection_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + TrUserData). + +skip_varint_blockchain_state_channel_rejection_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + skip_varint_blockchain_state_channel_rejection_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +skip_varint_blockchain_state_channel_rejection_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_rejection_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_length_delimited_blockchain_state_channel_rejection_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_state_channel_rejection_v1_pb(Rest, + N + 7, + X bsl N + + Acc, + F@_1, + F@_2, + TrUserData); +skip_length_delimited_blockchain_state_channel_rejection_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_state_channel_rejection_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + TrUserData). + +skip_group_blockchain_state_channel_rejection_v1_pb(Bin, + FNum, Z2, F@_1, F@_2, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_state_channel_rejection_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_32_blockchain_state_channel_rejection_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_rejection_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_64_blockchain_state_channel_rejection_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_rejection_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +decode_msg_blockchain_state_channel_message_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_state_channel_message_v1_pb(Bin, + 0, + 0, + id(undefined, + TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_state_channel_message_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, + TrUserData) -> + d_field_blockchain_state_channel_message_v1_pb_response(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_blockchain_state_channel_message_v1_pb(<<34, + Rest/binary>>, + Z1, Z2, F@_1, + TrUserData) -> + d_field_blockchain_state_channel_message_v1_pb_packet(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_blockchain_state_channel_message_v1_pb(<<42, + Rest/binary>>, + Z1, Z2, F@_1, + TrUserData) -> + d_field_blockchain_state_channel_message_v1_pb_offer(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_blockchain_state_channel_message_v1_pb(<<50, + Rest/binary>>, + Z1, Z2, F@_1, + TrUserData) -> + d_field_blockchain_state_channel_message_v1_pb_purchase(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_blockchain_state_channel_message_v1_pb(<<58, + Rest/binary>>, + Z1, Z2, F@_1, + TrUserData) -> + d_field_blockchain_state_channel_message_v1_pb_banner(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_blockchain_state_channel_message_v1_pb(<<66, + Rest/binary>>, + Z1, Z2, F@_1, + TrUserData) -> + d_field_blockchain_state_channel_message_v1_pb_reject(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_blockchain_state_channel_message_v1_pb(<<>>, + 0, 0, F@_1, _) -> + #blockchain_state_channel_message_v1_pb{msg = F@_1}; +dfp_read_field_def_blockchain_state_channel_message_v1_pb(Other, + Z1, Z2, F@_1, + TrUserData) -> + dg_read_field_def_blockchain_state_channel_message_v1_pb(Other, + Z1, + Z2, + F@_1, + TrUserData). + +dg_read_field_def_blockchain_state_channel_message_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_state_channel_message_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +dg_read_field_def_blockchain_state_channel_message_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 18 -> + d_field_blockchain_state_channel_message_v1_pb_response(Rest, + 0, + 0, + F@_1, + TrUserData); + 34 -> + d_field_blockchain_state_channel_message_v1_pb_packet(Rest, + 0, + 0, + F@_1, + TrUserData); + 42 -> + d_field_blockchain_state_channel_message_v1_pb_offer(Rest, + 0, + 0, + F@_1, + TrUserData); + 50 -> + d_field_blockchain_state_channel_message_v1_pb_purchase(Rest, + 0, + 0, + F@_1, + TrUserData); + 58 -> + d_field_blockchain_state_channel_message_v1_pb_banner(Rest, + 0, + 0, + F@_1, + TrUserData); + 66 -> + d_field_blockchain_state_channel_message_v1_pb_reject(Rest, + 0, + 0, + F@_1, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_state_channel_message_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 1 -> + skip_64_blockchain_state_channel_message_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 2 -> + skip_length_delimited_blockchain_state_channel_message_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 3 -> + skip_group_blockchain_state_channel_message_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + TrUserData); + 5 -> + skip_32_blockchain_state_channel_message_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData) + end + end; +dg_read_field_def_blockchain_state_channel_message_v1_pb(<<>>, + 0, 0, F@_1, _) -> + #blockchain_state_channel_message_v1_pb{msg = F@_1}. + +d_field_blockchain_state_channel_message_v1_pb_response(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_message_v1_pb_response(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_blockchain_state_channel_message_v1_pb_response(<<0:1, + X:7, Rest/binary>>, + N, Acc, Prev, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_state_channel_response_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_state_channel_message_v1_pb(RestF, + 0, + 0, + case Prev of + undefined -> + id({response, + NewFValue}, + TrUserData); + {response, + MVPrev} -> + id({response, + merge_msg_blockchain_state_channel_response_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({response, + NewFValue}, + TrUserData) + end, + TrUserData). + +d_field_blockchain_state_channel_message_v1_pb_packet(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_message_v1_pb_packet(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_blockchain_state_channel_message_v1_pb_packet(<<0:1, + X:7, Rest/binary>>, + N, Acc, Prev, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_state_channel_packet_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_state_channel_message_v1_pb(RestF, + 0, + 0, + case Prev of + undefined -> + id({packet, + NewFValue}, + TrUserData); + {packet, + MVPrev} -> + id({packet, + merge_msg_blockchain_state_channel_packet_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({packet, + NewFValue}, + TrUserData) + end, + TrUserData). + +d_field_blockchain_state_channel_message_v1_pb_offer(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_message_v1_pb_offer(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_blockchain_state_channel_message_v1_pb_offer(<<0:1, + X:7, Rest/binary>>, + N, Acc, Prev, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_state_channel_offer_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_state_channel_message_v1_pb(RestF, + 0, + 0, + case Prev of + undefined -> + id({offer, + NewFValue}, + TrUserData); + {offer, + MVPrev} -> + id({offer, + merge_msg_blockchain_state_channel_offer_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({offer, + NewFValue}, + TrUserData) + end, + TrUserData). + +d_field_blockchain_state_channel_message_v1_pb_purchase(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, + TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_message_v1_pb_purchase(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_blockchain_state_channel_message_v1_pb_purchase(<<0:1, + X:7, Rest/binary>>, + N, Acc, Prev, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_state_channel_purchase_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_state_channel_message_v1_pb(RestF, + 0, + 0, + case Prev of + undefined -> + id({purchase, + NewFValue}, + TrUserData); + {purchase, + MVPrev} -> + id({purchase, + merge_msg_blockchain_state_channel_purchase_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({purchase, + NewFValue}, + TrUserData) + end, + TrUserData). + +d_field_blockchain_state_channel_message_v1_pb_banner(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_message_v1_pb_banner(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_blockchain_state_channel_message_v1_pb_banner(<<0:1, + X:7, Rest/binary>>, + N, Acc, Prev, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_state_channel_banner_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_state_channel_message_v1_pb(RestF, + 0, + 0, + case Prev of + undefined -> + id({banner, + NewFValue}, + TrUserData); + {banner, + MVPrev} -> + id({banner, + merge_msg_blockchain_state_channel_banner_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({banner, + NewFValue}, + TrUserData) + end, + TrUserData). + +d_field_blockchain_state_channel_message_v1_pb_reject(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + d_field_blockchain_state_channel_message_v1_pb_reject(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_blockchain_state_channel_message_v1_pb_reject(<<0:1, + X:7, Rest/binary>>, + N, Acc, Prev, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_state_channel_rejection_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_state_channel_message_v1_pb(RestF, + 0, + 0, + case Prev of + undefined -> + id({reject, + NewFValue}, + TrUserData); + {reject, + MVPrev} -> + id({reject, + merge_msg_blockchain_state_channel_rejection_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({reject, + NewFValue}, + TrUserData) + end, + TrUserData). + +skip_varint_blockchain_state_channel_message_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + skip_varint_blockchain_state_channel_message_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData); +skip_varint_blockchain_state_channel_message_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_blockchain_state_channel_message_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_length_delimited_blockchain_state_channel_message_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_state_channel_message_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +skip_length_delimited_blockchain_state_channel_message_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_state_channel_message_v1_pb(Rest2, + 0, + 0, + F@_1, + TrUserData). + +skip_group_blockchain_state_channel_message_v1_pb(Bin, + FNum, Z2, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_state_channel_message_v1_pb(Rest, + 0, + Z2, + F@_1, + TrUserData). + +skip_32_blockchain_state_channel_message_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_blockchain_state_channel_message_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_64_blockchain_state_channel_message_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_blockchain_state_channel_message_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +decode_msg_eui_pb(Bin, TrUserData) -> + dfp_read_field_def_eui_pb(Bin, + 0, + 0, + id(0, TrUserData), + id(0, TrUserData), + TrUserData). + +dfp_read_field_def_eui_pb(<<8, Rest/binary>>, Z1, Z2, + F@_1, F@_2, TrUserData) -> + d_field_eui_pb_deveui(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_eui_pb(<<16, Rest/binary>>, Z1, Z2, + F@_1, F@_2, TrUserData) -> + d_field_eui_pb_appeui(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_eui_pb(<<>>, 0, 0, F@_1, F@_2, _) -> + #eui_pb{deveui = F@_1, appeui = F@_2}; +dfp_read_field_def_eui_pb(Other, Z1, Z2, F@_1, F@_2, + TrUserData) -> + dg_read_field_def_eui_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +dg_read_field_def_eui_pb(<<1:1, X:7, Rest/binary>>, N, + Acc, F@_1, F@_2, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_eui_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +dg_read_field_def_eui_pb(<<0:1, X:7, Rest/binary>>, N, + Acc, F@_1, F@_2, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 8 -> + d_field_eui_pb_deveui(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 16 -> + d_field_eui_pb_appeui(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_eui_pb(Rest, 0, 0, F@_1, F@_2, TrUserData); + 1 -> skip_64_eui_pb(Rest, 0, 0, F@_1, F@_2, TrUserData); + 2 -> + skip_length_delimited_eui_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 3 -> + skip_group_eui_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + TrUserData); + 5 -> skip_32_eui_pb(Rest, 0, 0, F@_1, F@_2, TrUserData) + end + end; +dg_read_field_def_eui_pb(<<>>, 0, 0, F@_1, F@_2, _) -> + #eui_pb{deveui = F@_1, appeui = F@_2}. + +d_field_eui_pb_deveui(<<1:1, X:7, Rest/binary>>, N, Acc, + F@_1, F@_2, TrUserData) + when N < 57 -> + d_field_eui_pb_deveui(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_eui_pb_deveui(<<0:1, X:7, Rest/binary>>, N, Acc, + _, F@_2, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_eui_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + TrUserData). + +d_field_eui_pb_appeui(<<1:1, X:7, Rest/binary>>, N, Acc, + F@_1, F@_2, TrUserData) + when N < 57 -> + d_field_eui_pb_appeui(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_eui_pb_appeui(<<0:1, X:7, Rest/binary>>, N, Acc, + F@_1, _, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_eui_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + TrUserData). + +skip_varint_eui_pb(<<1:1, _:7, Rest/binary>>, Z1, Z2, + F@_1, F@_2, TrUserData) -> + skip_varint_eui_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +skip_varint_eui_pb(<<0:1, _:7, Rest/binary>>, Z1, Z2, + F@_1, F@_2, TrUserData) -> + dfp_read_field_def_eui_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_length_delimited_eui_pb(<<1:1, X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + skip_length_delimited_eui_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +skip_length_delimited_eui_pb(<<0:1, X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_eui_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + TrUserData). + +skip_group_eui_pb(Bin, FNum, Z2, F@_1, F@_2, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_eui_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_32_eui_pb(<<_:32, Rest/binary>>, Z1, Z2, F@_1, + F@_2, TrUserData) -> + dfp_read_field_def_eui_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_64_eui_pb(<<_:64, Rest/binary>>, Z1, Z2, F@_1, + F@_2, TrUserData) -> + dfp_read_field_def_eui_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +decode_msg_routing_information_pb(Bin, TrUserData) -> + dfp_read_field_def_routing_information_pb(Bin, + 0, + 0, + id(undefined, TrUserData), + TrUserData). + +dfp_read_field_def_routing_information_pb(<<8, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + d_field_routing_information_pb_devaddr(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_routing_information_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + d_field_routing_information_pb_eui(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_routing_information_pb(<<>>, 0, 0, + F@_1, _) -> + #routing_information_pb{data = F@_1}; +dfp_read_field_def_routing_information_pb(Other, Z1, Z2, + F@_1, TrUserData) -> + dg_read_field_def_routing_information_pb(Other, + Z1, + Z2, + F@_1, + TrUserData). + +dg_read_field_def_routing_information_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_routing_information_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +dg_read_field_def_routing_information_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 8 -> + d_field_routing_information_pb_devaddr(Rest, + 0, + 0, + F@_1, + TrUserData); + 18 -> + d_field_routing_information_pb_eui(Rest, + 0, + 0, + F@_1, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_routing_information_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 1 -> + skip_64_routing_information_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 2 -> + skip_length_delimited_routing_information_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 3 -> + skip_group_routing_information_pb(Rest, + Key bsr 3, + 0, + F@_1, + TrUserData); + 5 -> + skip_32_routing_information_pb(Rest, + 0, + 0, + F@_1, + TrUserData) + end + end; +dg_read_field_def_routing_information_pb(<<>>, 0, 0, + F@_1, _) -> + #routing_information_pb{data = F@_1}. + +d_field_routing_information_pb_devaddr(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + d_field_routing_information_pb_devaddr(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_routing_information_pb_devaddr(<<0:1, X:7, + Rest/binary>>, + N, Acc, _, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_routing_information_pb(RestF, + 0, + 0, + id({devaddr, NewFValue}, + TrUserData), + TrUserData). + +d_field_routing_information_pb_eui(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + d_field_routing_information_pb_eui(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_routing_information_pb_eui(<<0:1, X:7, + Rest/binary>>, + N, Acc, Prev, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_eui_pb(Bs, TrUserData), TrUserData), + Rest2} + end, + dfp_read_field_def_routing_information_pb(RestF, + 0, + 0, + case Prev of + undefined -> + id({eui, NewFValue}, + TrUserData); + {eui, MVPrev} -> + id({eui, + merge_msg_eui_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({eui, NewFValue}, + TrUserData) + end, + TrUserData). + +skip_varint_routing_information_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + skip_varint_routing_information_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData); +skip_varint_routing_information_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_routing_information_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_length_delimited_routing_information_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + skip_length_delimited_routing_information_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +skip_length_delimited_routing_information_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_routing_information_pb(Rest2, + 0, + 0, + F@_1, + TrUserData). + +skip_group_routing_information_pb(Bin, FNum, Z2, F@_1, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_routing_information_pb(Rest, + 0, + Z2, + F@_1, + TrUserData). + +skip_32_routing_information_pb(<<_:32, Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_routing_information_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_64_routing_information_pb(<<_:64, Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_routing_information_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +decode_msg_window_pb(Bin, TrUserData) -> + dfp_read_field_def_window_pb(Bin, + 0, + 0, + id(0, TrUserData), + id(0.0, TrUserData), + id([], TrUserData), + TrUserData). + +dfp_read_field_def_window_pb(<<8, Rest/binary>>, Z1, Z2, + F@_1, F@_2, F@_3, TrUserData) -> + d_field_window_pb_timestamp(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_window_pb(<<21, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, TrUserData) -> + d_field_window_pb_frequency(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_window_pb(<<26, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, TrUserData) -> + d_field_window_pb_datarate(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_window_pb(<<>>, 0, 0, F@_1, F@_2, + F@_3, _) -> + #window_pb{timestamp = F@_1, frequency = F@_2, + datarate = F@_3}; +dfp_read_field_def_window_pb(Other, Z1, Z2, F@_1, F@_2, + F@_3, TrUserData) -> + dg_read_field_def_window_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +dg_read_field_def_window_pb(<<1:1, X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_window_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +dg_read_field_def_window_pb(<<0:1, X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 8 -> + d_field_window_pb_timestamp(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 21 -> + d_field_window_pb_frequency(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 26 -> + d_field_window_pb_datarate(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_window_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 1 -> + skip_64_window_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 2 -> + skip_length_delimited_window_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 3 -> + skip_group_window_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 5 -> + skip_32_window_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData) + end + end; +dg_read_field_def_window_pb(<<>>, 0, 0, F@_1, F@_2, + F@_3, _) -> + #window_pb{timestamp = F@_1, frequency = F@_2, + datarate = F@_3}. + +d_field_window_pb_timestamp(<<1:1, X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, TrUserData) + when N < 57 -> + d_field_window_pb_timestamp(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_window_pb_timestamp(<<0:1, X:7, Rest/binary>>, + N, Acc, _, F@_2, F@_3, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_window_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + TrUserData). + +d_field_window_pb_frequency(<<0:16, 128, 127, + Rest/binary>>, + Z1, Z2, F@_1, _, F@_3, TrUserData) -> + dfp_read_field_def_window_pb(Rest, + Z1, + Z2, + F@_1, + id(infinity, TrUserData), + F@_3, + TrUserData); +d_field_window_pb_frequency(<<0:16, 128, 255, + Rest/binary>>, + Z1, Z2, F@_1, _, F@_3, TrUserData) -> + dfp_read_field_def_window_pb(Rest, + Z1, + Z2, + F@_1, + id('-infinity', TrUserData), + F@_3, + TrUserData); +d_field_window_pb_frequency(<<_:16, 1:1, _:7, _:1, + 127:7, Rest/binary>>, + Z1, Z2, F@_1, _, F@_3, TrUserData) -> + dfp_read_field_def_window_pb(Rest, + Z1, + Z2, + F@_1, + id(nan, TrUserData), + F@_3, + TrUserData); +d_field_window_pb_frequency(<>, + Z1, Z2, F@_1, _, F@_3, TrUserData) -> + dfp_read_field_def_window_pb(Rest, + Z1, + Z2, + F@_1, + id(Value, TrUserData), + F@_3, + TrUserData). + +d_field_window_pb_datarate(<<1:1, X:7, Rest/binary>>, N, + Acc, F@_1, F@_2, F@_3, TrUserData) + when N < 57 -> + d_field_window_pb_datarate(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_window_pb_datarate(<<0:1, X:7, Rest/binary>>, N, + Acc, F@_1, F@_2, _, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(unicode:characters_to_list(Utf8, unicode), + TrUserData), + Rest2} + end, + dfp_read_field_def_window_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + TrUserData). + +skip_varint_window_pb(<<1:1, _:7, Rest/binary>>, Z1, Z2, + F@_1, F@_2, F@_3, TrUserData) -> + skip_varint_window_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_varint_window_pb(<<0:1, _:7, Rest/binary>>, Z1, Z2, + F@_1, F@_2, F@_3, TrUserData) -> + dfp_read_field_def_window_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_length_delimited_window_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, TrUserData) + when N < 57 -> + skip_length_delimited_window_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_length_delimited_window_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_window_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_group_window_pb(Bin, FNum, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_window_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_32_window_pb(<<_:32, Rest/binary>>, Z1, Z2, F@_1, + F@_2, F@_3, TrUserData) -> + dfp_read_field_def_window_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_64_window_pb(<<_:64, Rest/binary>>, Z1, Z2, F@_1, + F@_2, F@_3, TrUserData) -> + dfp_read_field_def_window_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +decode_msg_packet_pb(Bin, TrUserData) -> + dfp_read_field_def_packet_pb(Bin, + 0, + 0, + id(0, TrUserData), + id(longfi, TrUserData), + id(<<>>, TrUserData), + id(0, TrUserData), + id(0.0, TrUserData), + id(0.0, TrUserData), + id([], TrUserData), + id(0.0, TrUserData), + id(undefined, TrUserData), + id(undefined, TrUserData), + TrUserData). + +dfp_read_field_def_packet_pb(<<8, Rest/binary>>, Z1, Z2, + F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + d_field_packet_pb_oui(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dfp_read_field_def_packet_pb(<<16, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + d_field_packet_pb_type(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dfp_read_field_def_packet_pb(<<26, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + d_field_packet_pb_payload(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dfp_read_field_def_packet_pb(<<32, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + d_field_packet_pb_timestamp(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dfp_read_field_def_packet_pb(<<45, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + d_field_packet_pb_signal_strength(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dfp_read_field_def_packet_pb(<<53, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + d_field_packet_pb_frequency(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dfp_read_field_def_packet_pb(<<58, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + d_field_packet_pb_datarate(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dfp_read_field_def_packet_pb(<<69, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + d_field_packet_pb_snr(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dfp_read_field_def_packet_pb(<<74, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + d_field_packet_pb_routing(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dfp_read_field_def_packet_pb(<<82, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + d_field_packet_pb_rx2_window(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dfp_read_field_def_packet_pb(<<>>, 0, 0, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, + _) -> + #packet_pb{oui = F@_1, type = F@_2, payload = F@_3, + timestamp = F@_4, signal_strength = F@_5, + frequency = F@_6, datarate = F@_7, snr = F@_8, + routing = F@_9, rx2_window = F@_10}; +dfp_read_field_def_packet_pb(Other, Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, + TrUserData) -> + dg_read_field_def_packet_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +dg_read_field_def_packet_pb(<<1:1, X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, + F@_8, F@_9, F@_10, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_packet_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +dg_read_field_def_packet_pb(<<0:1, X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, + F@_8, F@_9, F@_10, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 8 -> + d_field_packet_pb_oui(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 16 -> + d_field_packet_pb_type(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 26 -> + d_field_packet_pb_payload(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 32 -> + d_field_packet_pb_timestamp(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 45 -> + d_field_packet_pb_signal_strength(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 53 -> + d_field_packet_pb_frequency(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 58 -> + d_field_packet_pb_datarate(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 69 -> + d_field_packet_pb_snr(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 74 -> + d_field_packet_pb_routing(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 82 -> + d_field_packet_pb_rx2_window(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_packet_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 1 -> + skip_64_packet_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 2 -> + skip_length_delimited_packet_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 3 -> + skip_group_packet_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); + 5 -> + skip_32_packet_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData) + end + end; +dg_read_field_def_packet_pb(<<>>, 0, 0, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, + _) -> + #packet_pb{oui = F@_1, type = F@_2, payload = F@_3, + timestamp = F@_4, signal_strength = F@_5, + frequency = F@_6, datarate = F@_7, snr = F@_8, + routing = F@_9, rx2_window = F@_10}. + +d_field_packet_pb_oui(<<1:1, X:7, Rest/binary>>, N, Acc, + F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, TrUserData) + when N < 57 -> + d_field_packet_pb_oui(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_packet_pb_oui(<<0:1, X:7, Rest/binary>>, N, Acc, + _, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_packet_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +d_field_packet_pb_type(<<1:1, X:7, Rest/binary>>, N, + Acc, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) + when N < 57 -> + d_field_packet_pb_type(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_packet_pb_type(<<0:1, X:7, Rest/binary>>, N, + Acc, F@_1, _, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, TrUserData) -> + {NewFValue, RestF} = + {id('d_enum_packet_pb.packet_type'(begin + <> = <<(X + bsl + N + + + Acc):32/unsigned-native>>, + id(Res, TrUserData) + end), + TrUserData), + Rest}, + dfp_read_field_def_packet_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +d_field_packet_pb_payload(<<1:1, X:7, Rest/binary>>, N, + Acc, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) + when N < 57 -> + d_field_packet_pb_payload(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_packet_pb_payload(<<0:1, X:7, Rest/binary>>, N, + Acc, F@_1, F@_2, _, F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_packet_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +d_field_packet_pb_timestamp(<<1:1, X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, + F@_8, F@_9, F@_10, TrUserData) + when N < 57 -> + d_field_packet_pb_timestamp(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_packet_pb_timestamp(<<0:1, X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, _, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_packet_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + NewFValue, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +d_field_packet_pb_signal_strength(<<0:16, 128, 127, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, _, F@_6, F@_7, + F@_8, F@_9, F@_10, TrUserData) -> + dfp_read_field_def_packet_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + id(infinity, TrUserData), + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_packet_pb_signal_strength(<<0:16, 128, 255, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, _, F@_6, F@_7, + F@_8, F@_9, F@_10, TrUserData) -> + dfp_read_field_def_packet_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + id('-infinity', TrUserData), + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_packet_pb_signal_strength(<<_:16, 1:1, _:7, _:1, + 127:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, _, F@_6, F@_7, + F@_8, F@_9, F@_10, TrUserData) -> + dfp_read_field_def_packet_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + id(nan, TrUserData), + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_packet_pb_signal_strength(<>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, _, F@_6, F@_7, + F@_8, F@_9, F@_10, TrUserData) -> + dfp_read_field_def_packet_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + id(Value, TrUserData), + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +d_field_packet_pb_frequency(<<0:16, 128, 127, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, _, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + dfp_read_field_def_packet_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + id(infinity, TrUserData), + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_packet_pb_frequency(<<0:16, 128, 255, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, _, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + dfp_read_field_def_packet_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + id('-infinity', TrUserData), + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_packet_pb_frequency(<<_:16, 1:1, _:7, _:1, + 127:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, _, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + dfp_read_field_def_packet_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + id(nan, TrUserData), + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_packet_pb_frequency(<>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, _, F@_7, F@_8, + F@_9, F@_10, TrUserData) -> + dfp_read_field_def_packet_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + id(Value, TrUserData), + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +d_field_packet_pb_datarate(<<1:1, X:7, Rest/binary>>, N, + Acc, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) + when N < 57 -> + d_field_packet_pb_datarate(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_packet_pb_datarate(<<0:1, X:7, Rest/binary>>, N, + Acc, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, _, F@_8, + F@_9, F@_10, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(unicode:characters_to_list(Utf8, unicode), + TrUserData), + Rest2} + end, + dfp_read_field_def_packet_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + NewFValue, + F@_8, + F@_9, + F@_10, + TrUserData). + +d_field_packet_pb_snr(<<0:16, 128, 127, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, _, + F@_9, F@_10, TrUserData) -> + dfp_read_field_def_packet_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + id(infinity, TrUserData), + F@_9, + F@_10, + TrUserData); +d_field_packet_pb_snr(<<0:16, 128, 255, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, _, + F@_9, F@_10, TrUserData) -> + dfp_read_field_def_packet_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + id('-infinity', TrUserData), + F@_9, + F@_10, + TrUserData); +d_field_packet_pb_snr(<<_:16, 1:1, _:7, _:1, 127:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, _, + F@_9, F@_10, TrUserData) -> + dfp_read_field_def_packet_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + id(nan, TrUserData), + F@_9, + F@_10, + TrUserData); +d_field_packet_pb_snr(<>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, _, + F@_9, F@_10, TrUserData) -> + dfp_read_field_def_packet_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + id(Value, TrUserData), + F@_9, + F@_10, + TrUserData). + +d_field_packet_pb_routing(<<1:1, X:7, Rest/binary>>, N, + Acc, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, TrUserData) + when N < 57 -> + d_field_packet_pb_routing(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_packet_pb_routing(<<0:1, X:7, Rest/binary>>, N, + Acc, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, + Prev, F@_10, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_routing_information_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_packet_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + if Prev == undefined -> NewFValue; + true -> + merge_msg_routing_information_pb(Prev, + NewFValue, + TrUserData) + end, + F@_10, + TrUserData). + +d_field_packet_pb_rx2_window(<<1:1, X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, + F@_8, F@_9, F@_10, TrUserData) + when N < 57 -> + d_field_packet_pb_rx2_window(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +d_field_packet_pb_rx2_window(<<0:1, X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, + F@_8, F@_9, Prev, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_window_pb(Bs, TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_packet_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + if Prev == undefined -> NewFValue; + true -> + merge_msg_window_pb(Prev, + NewFValue, + TrUserData) + end, + TrUserData). + +skip_varint_packet_pb(<<1:1, _:7, Rest/binary>>, Z1, Z2, + F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, TrUserData) -> + skip_varint_packet_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +skip_varint_packet_pb(<<0:1, _:7, Rest/binary>>, Z1, Z2, + F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, TrUserData) -> + dfp_read_field_def_packet_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +skip_length_delimited_packet_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, F@_9, F@_10, TrUserData) + when N < 57 -> + skip_length_delimited_packet_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData); +skip_length_delimited_packet_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, F@_9, F@_10, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_packet_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +skip_group_packet_pb(Bin, FNum, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_packet_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +skip_32_packet_pb(<<_:32, Rest/binary>>, Z1, Z2, F@_1, + F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, + TrUserData) -> + dfp_read_field_def_packet_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +skip_64_packet_pb(<<_:64, Rest/binary>>, Z1, Z2, F@_1, + F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, + TrUserData) -> + dfp_read_field_def_packet_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + TrUserData). + +decode_msg_blockchain_txn_state_channel_close_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_txn_state_channel_close_v1_pb(Bin, + 0, + 0, + id(undefined, + TrUserData), + id(<<>>, + TrUserData), + id(<<>>, + TrUserData), + id(0, + TrUserData), + id(undefined, + TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_txn_state_channel_close_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + d_field_blockchain_txn_state_channel_close_v1_pb_state_channel(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_blockchain_txn_state_channel_close_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + d_field_blockchain_txn_state_channel_close_v1_pb_closer(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_blockchain_txn_state_channel_close_v1_pb(<<26, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + d_field_blockchain_txn_state_channel_close_v1_pb_signature(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_blockchain_txn_state_channel_close_v1_pb(<<32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + d_field_blockchain_txn_state_channel_close_v1_pb_fee(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_blockchain_txn_state_channel_close_v1_pb(<<42, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + d_field_blockchain_txn_state_channel_close_v1_pb_conflicts_with(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dfp_read_field_def_blockchain_txn_state_channel_close_v1_pb(<<>>, + 0, 0, F@_1, F@_2, + F@_3, F@_4, F@_5, + _) -> + #blockchain_txn_state_channel_close_v1_pb{state_channel + = F@_1, + closer = F@_2, signature = F@_3, + fee = F@_4, + conflicts_with = F@_5}; +dfp_read_field_def_blockchain_txn_state_channel_close_v1_pb(Other, + Z1, Z2, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + dg_read_field_def_blockchain_txn_state_channel_close_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +dg_read_field_def_blockchain_txn_state_channel_close_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_txn_state_channel_close_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +dg_read_field_def_blockchain_txn_state_channel_close_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_blockchain_txn_state_channel_close_v1_pb_state_channel(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 18 -> + d_field_blockchain_txn_state_channel_close_v1_pb_closer(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 26 -> + d_field_blockchain_txn_state_channel_close_v1_pb_signature(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 32 -> + d_field_blockchain_txn_state_channel_close_v1_pb_fee(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 42 -> + d_field_blockchain_txn_state_channel_close_v1_pb_conflicts_with(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_txn_state_channel_close_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 1 -> + skip_64_blockchain_txn_state_channel_close_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 2 -> + skip_length_delimited_blockchain_txn_state_channel_close_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 3 -> + skip_group_blockchain_txn_state_channel_close_v1_pb(Rest, + Key bsr + 3, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); + 5 -> + skip_32_blockchain_txn_state_channel_close_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData) + end + end; +dg_read_field_def_blockchain_txn_state_channel_close_v1_pb(<<>>, + 0, 0, F@_1, F@_2, + F@_3, F@_4, F@_5, + _) -> + #blockchain_txn_state_channel_close_v1_pb{state_channel + = F@_1, + closer = F@_2, signature = F@_3, + fee = F@_4, + conflicts_with = F@_5}. + +d_field_blockchain_txn_state_channel_close_v1_pb_state_channel(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, F@_4, + F@_5, TrUserData) + when N < 57 -> + d_field_blockchain_txn_state_channel_close_v1_pb_state_channel(Rest, + N + 7, + X bsl N + + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_blockchain_txn_state_channel_close_v1_pb_state_channel(<<0:1, + X:7, + Rest/binary>>, + N, Acc, Prev, + F@_2, F@_3, F@_4, + F@_5, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_state_channel_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_txn_state_channel_close_v1_pb(RestF, + 0, + 0, + if Prev == + undefined -> + NewFValue; + true -> + merge_msg_blockchain_state_channel_v1_pb(Prev, + NewFValue, + TrUserData) + end, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +d_field_blockchain_txn_state_channel_close_v1_pb_closer(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + d_field_blockchain_txn_state_channel_close_v1_pb_closer(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_blockchain_txn_state_channel_close_v1_pb_closer(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, _, F@_3, + F@_4, F@_5, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_txn_state_channel_close_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + F@_4, + F@_5, + TrUserData). + +d_field_blockchain_txn_state_channel_close_v1_pb_signature(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + TrUserData) + when N < 57 -> + d_field_blockchain_txn_state_channel_close_v1_pb_signature(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_blockchain_txn_state_channel_close_v1_pb_signature(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + _, F@_4, F@_5, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_txn_state_channel_close_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + F@_4, + F@_5, + TrUserData). + +d_field_blockchain_txn_state_channel_close_v1_pb_fee(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) + when N < 57 -> + d_field_blockchain_txn_state_channel_close_v1_pb_fee(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_blockchain_txn_state_channel_close_v1_pb_fee(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + _, F@_5, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_txn_state_channel_close_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + NewFValue, + F@_5, + TrUserData). + +d_field_blockchain_txn_state_channel_close_v1_pb_conflicts_with(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, + F@_4, F@_5, + TrUserData) + when N < 57 -> + d_field_blockchain_txn_state_channel_close_v1_pb_conflicts_with(Rest, + N + 7, + X bsl N + + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +d_field_blockchain_txn_state_channel_close_v1_pb_conflicts_with(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, + F@_4, Prev, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_state_channel_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_txn_state_channel_close_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + if Prev == + undefined -> + NewFValue; + true -> + merge_msg_blockchain_state_channel_v1_pb(Prev, + NewFValue, + TrUserData) + end, + TrUserData). + +skip_varint_blockchain_txn_state_channel_close_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) -> + skip_varint_blockchain_txn_state_channel_close_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +skip_varint_blockchain_txn_state_channel_close_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) -> + dfp_read_field_def_blockchain_txn_state_channel_close_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_length_delimited_blockchain_txn_state_channel_close_v1_pb(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, F@_4, + F@_5, TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_txn_state_channel_close_v1_pb(Rest, + N + 7, + X bsl N + + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData); +skip_length_delimited_blockchain_txn_state_channel_close_v1_pb(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, + F@_2, F@_3, F@_4, + F@_5, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_txn_state_channel_close_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_group_blockchain_txn_state_channel_close_v1_pb(Bin, + FNum, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_txn_state_channel_close_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_32_blockchain_txn_state_channel_close_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, TrUserData) -> + dfp_read_field_def_blockchain_txn_state_channel_close_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +skip_64_blockchain_txn_state_channel_close_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, TrUserData) -> + dfp_read_field_def_blockchain_txn_state_channel_close_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + TrUserData). + +decode_msg_blockchain_var_v1_pb(Bin, TrUserData) -> + dfp_read_field_def_blockchain_var_v1_pb(Bin, + 0, + 0, + id([], TrUserData), + id([], TrUserData), + id(<<>>, TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_var_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, TrUserData) -> + d_field_blockchain_var_v1_pb_name(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_blockchain_var_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, TrUserData) -> + d_field_blockchain_var_v1_pb_type(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_blockchain_var_v1_pb(<<26, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, TrUserData) -> + d_field_blockchain_var_v1_pb_value(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_blockchain_var_v1_pb(<<>>, 0, 0, + F@_1, F@_2, F@_3, _) -> + #blockchain_var_v1_pb{name = F@_1, type = F@_2, + value = F@_3}; +dfp_read_field_def_blockchain_var_v1_pb(Other, Z1, Z2, + F@_1, F@_2, F@_3, TrUserData) -> + dg_read_field_def_blockchain_var_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +dg_read_field_def_blockchain_var_v1_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_var_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +dg_read_field_def_blockchain_var_v1_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_blockchain_var_v1_pb_name(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 18 -> + d_field_blockchain_var_v1_pb_type(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 26 -> + d_field_blockchain_var_v1_pb_value(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_var_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 1 -> + skip_64_blockchain_var_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 2 -> + skip_length_delimited_blockchain_var_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 3 -> + skip_group_blockchain_var_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 5 -> + skip_32_blockchain_var_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData) + end + end; +dg_read_field_def_blockchain_var_v1_pb(<<>>, 0, 0, F@_1, + F@_2, F@_3, _) -> + #blockchain_var_v1_pb{name = F@_1, type = F@_2, + value = F@_3}. + +d_field_blockchain_var_v1_pb_name(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, TrUserData) + when N < 57 -> + d_field_blockchain_var_v1_pb_name(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_blockchain_var_v1_pb_name(<<0:1, X:7, + Rest/binary>>, + N, Acc, _, F@_2, F@_3, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(unicode:characters_to_list(Utf8, unicode), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_var_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + TrUserData). + +d_field_blockchain_var_v1_pb_type(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, TrUserData) + when N < 57 -> + d_field_blockchain_var_v1_pb_type(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_blockchain_var_v1_pb_type(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, _, F@_3, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(unicode:characters_to_list(Utf8, unicode), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_var_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + TrUserData). + +d_field_blockchain_var_v1_pb_value(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, TrUserData) + when N < 57 -> + d_field_blockchain_var_v1_pb_value(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_blockchain_var_v1_pb_value(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, _, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_var_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + TrUserData). + +skip_varint_blockchain_var_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, TrUserData) -> + skip_varint_blockchain_var_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_varint_blockchain_var_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, TrUserData) -> + dfp_read_field_def_blockchain_var_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_length_delimited_blockchain_var_v1_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_var_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_length_delimited_blockchain_var_v1_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_var_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_group_blockchain_var_v1_pb(Bin, FNum, Z2, F@_1, + F@_2, F@_3, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_var_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_32_blockchain_var_v1_pb(<<_:32, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, TrUserData) -> + dfp_read_field_def_blockchain_var_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_64_blockchain_var_v1_pb(<<_:64, Rest/binary>>, Z1, + Z2, F@_1, F@_2, F@_3, TrUserData) -> + dfp_read_field_def_blockchain_var_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +decode_msg_blockchain_txn_vars_v1_pb(Bin, TrUserData) -> + dfp_read_field_def_blockchain_txn_vars_v1_pb(Bin, + 0, + 0, + id([], TrUserData), + id(0, TrUserData), + id(<<>>, TrUserData), + id(<<>>, TrUserData), + id(<<>>, TrUserData), + id([], TrUserData), + id([], TrUserData), + id(0, TrUserData), + id([], TrUserData), + id([], TrUserData), + id([], TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_txn_vars_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, TrUserData) -> + d_field_blockchain_txn_vars_v1_pb_vars(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +dfp_read_field_def_blockchain_txn_vars_v1_pb(<<16, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, TrUserData) -> + d_field_blockchain_txn_vars_v1_pb_version_predicate(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +dfp_read_field_def_blockchain_txn_vars_v1_pb(<<26, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, TrUserData) -> + d_field_blockchain_txn_vars_v1_pb_proof(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +dfp_read_field_def_blockchain_txn_vars_v1_pb(<<34, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, TrUserData) -> + d_field_blockchain_txn_vars_v1_pb_master_key(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +dfp_read_field_def_blockchain_txn_vars_v1_pb(<<42, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, TrUserData) -> + d_field_blockchain_txn_vars_v1_pb_key_proof(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +dfp_read_field_def_blockchain_txn_vars_v1_pb(<<50, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, TrUserData) -> + d_field_blockchain_txn_vars_v1_pb_cancels(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +dfp_read_field_def_blockchain_txn_vars_v1_pb(<<58, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, TrUserData) -> + d_field_blockchain_txn_vars_v1_pb_unsets(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +dfp_read_field_def_blockchain_txn_vars_v1_pb(<<64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, TrUserData) -> + d_field_blockchain_txn_vars_v1_pb_nonce(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +dfp_read_field_def_blockchain_txn_vars_v1_pb(<<74, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, TrUserData) -> + d_field_blockchain_txn_vars_v1_pb_multi_keys(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +dfp_read_field_def_blockchain_txn_vars_v1_pb(<<82, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, TrUserData) -> + d_field_blockchain_txn_vars_v1_pb_multi_proofs(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +dfp_read_field_def_blockchain_txn_vars_v1_pb(<<90, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, TrUserData) -> + d_field_blockchain_txn_vars_v1_pb_multi_key_proofs(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +dfp_read_field_def_blockchain_txn_vars_v1_pb(<<>>, 0, 0, + R1, F@_2, F@_3, F@_4, F@_5, R2, R3, + F@_8, R4, R5, R6, TrUserData) -> + #blockchain_txn_vars_v1_pb{vars = + lists_reverse(R1, TrUserData), + version_predicate = F@_2, proof = F@_3, + master_key = F@_4, key_proof = F@_5, + cancels = lists_reverse(R2, TrUserData), + unsets = lists_reverse(R3, TrUserData), + nonce = F@_8, + multi_keys = lists_reverse(R4, TrUserData), + multi_proofs = lists_reverse(R5, TrUserData), + multi_key_proofs = + lists_reverse(R6, TrUserData)}; +dfp_read_field_def_blockchain_txn_vars_v1_pb(Other, Z1, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, + F@_11, TrUserData) -> + dg_read_field_def_blockchain_txn_vars_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData). + +dg_read_field_def_blockchain_txn_vars_v1_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, + F@_11, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_txn_vars_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +dg_read_field_def_blockchain_txn_vars_v1_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, + F@_11, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_blockchain_txn_vars_v1_pb_vars(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); + 16 -> + d_field_blockchain_txn_vars_v1_pb_version_predicate(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); + 26 -> + d_field_blockchain_txn_vars_v1_pb_proof(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); + 34 -> + d_field_blockchain_txn_vars_v1_pb_master_key(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); + 42 -> + d_field_blockchain_txn_vars_v1_pb_key_proof(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); + 50 -> + d_field_blockchain_txn_vars_v1_pb_cancels(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); + 58 -> + d_field_blockchain_txn_vars_v1_pb_unsets(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); + 64 -> + d_field_blockchain_txn_vars_v1_pb_nonce(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); + 74 -> + d_field_blockchain_txn_vars_v1_pb_multi_keys(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); + 82 -> + d_field_blockchain_txn_vars_v1_pb_multi_proofs(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); + 90 -> + d_field_blockchain_txn_vars_v1_pb_multi_key_proofs(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_txn_vars_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); + 1 -> + skip_64_blockchain_txn_vars_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); + 2 -> + skip_length_delimited_blockchain_txn_vars_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); + 3 -> + skip_group_blockchain_txn_vars_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); + 5 -> + skip_32_blockchain_txn_vars_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData) + end + end; +dg_read_field_def_blockchain_txn_vars_v1_pb(<<>>, 0, 0, + R1, F@_2, F@_3, F@_4, F@_5, R2, R3, + F@_8, R4, R5, R6, TrUserData) -> + #blockchain_txn_vars_v1_pb{vars = + lists_reverse(R1, TrUserData), + version_predicate = F@_2, proof = F@_3, + master_key = F@_4, key_proof = F@_5, + cancels = lists_reverse(R2, TrUserData), + unsets = lists_reverse(R3, TrUserData), + nonce = F@_8, + multi_keys = lists_reverse(R4, TrUserData), + multi_proofs = lists_reverse(R5, TrUserData), + multi_key_proofs = + lists_reverse(R6, TrUserData)}. + +d_field_blockchain_txn_vars_v1_pb_vars(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, + TrUserData) + when N < 57 -> + d_field_blockchain_txn_vars_v1_pb_vars(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +d_field_blockchain_txn_vars_v1_pb_vars(<<0:1, X:7, + Rest/binary>>, + N, Acc, Prev, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_var_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_txn_vars_v1_pb(RestF, + 0, + 0, + cons(NewFValue, + Prev, + TrUserData), + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData). + +d_field_blockchain_txn_vars_v1_pb_version_predicate(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + F@_8, F@_9, F@_10, F@_11, + TrUserData) + when N < 57 -> + d_field_blockchain_txn_vars_v1_pb_version_predicate(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +d_field_blockchain_txn_vars_v1_pb_version_predicate(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, _, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, F@_11, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_txn_vars_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData). + +d_field_blockchain_txn_vars_v1_pb_proof(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, + TrUserData) + when N < 57 -> + d_field_blockchain_txn_vars_v1_pb_proof(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +d_field_blockchain_txn_vars_v1_pb_proof(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, _, F@_4, F@_5, F@_6, + F@_7, F@_8, F@_9, F@_10, F@_11, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_txn_vars_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData). + +d_field_blockchain_txn_vars_v1_pb_master_key(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, TrUserData) + when N < 57 -> + d_field_blockchain_txn_vars_v1_pb_master_key(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +d_field_blockchain_txn_vars_v1_pb_master_key(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, _, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, + F@_11, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_txn_vars_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + NewFValue, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData). + +d_field_blockchain_txn_vars_v1_pb_key_proof(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, + F@_11, TrUserData) + when N < 57 -> + d_field_blockchain_txn_vars_v1_pb_key_proof(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +d_field_blockchain_txn_vars_v1_pb_key_proof(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, _, + F@_6, F@_7, F@_8, F@_9, F@_10, + F@_11, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_txn_vars_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + NewFValue, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData). + +d_field_blockchain_txn_vars_v1_pb_cancels(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, + TrUserData) + when N < 57 -> + d_field_blockchain_txn_vars_v1_pb_cancels(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +d_field_blockchain_txn_vars_v1_pb_cancels(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + Prev, F@_7, F@_8, F@_9, F@_10, F@_11, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_txn_vars_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + cons(NewFValue, + Prev, + TrUserData), + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData). + +d_field_blockchain_txn_vars_v1_pb_unsets(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, + TrUserData) + when N < 57 -> + d_field_blockchain_txn_vars_v1_pb_unsets(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +d_field_blockchain_txn_vars_v1_pb_unsets(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, Prev, F@_8, F@_9, F@_10, F@_11, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_txn_vars_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + cons(NewFValue, + Prev, + TrUserData), + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData). + +d_field_blockchain_txn_vars_v1_pb_nonce(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, + TrUserData) + when N < 57 -> + d_field_blockchain_txn_vars_v1_pb_nonce(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +d_field_blockchain_txn_vars_v1_pb_nonce(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, _, F@_9, F@_10, F@_11, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_txn_vars_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + NewFValue, + F@_9, + F@_10, + F@_11, + TrUserData). + +d_field_blockchain_txn_vars_v1_pb_multi_keys(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, TrUserData) + when N < 57 -> + d_field_blockchain_txn_vars_v1_pb_multi_keys(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +d_field_blockchain_txn_vars_v1_pb_multi_keys(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, Prev, + F@_10, F@_11, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_txn_vars_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + cons(NewFValue, + Prev, + TrUserData), + F@_10, + F@_11, + TrUserData). + +d_field_blockchain_txn_vars_v1_pb_multi_proofs(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, TrUserData) + when N < 57 -> + d_field_blockchain_txn_vars_v1_pb_multi_proofs(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +d_field_blockchain_txn_vars_v1_pb_multi_proofs(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + Prev, F@_11, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_txn_vars_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + cons(NewFValue, + Prev, + TrUserData), + F@_11, + TrUserData). + +d_field_blockchain_txn_vars_v1_pb_multi_key_proofs(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, F@_11, + TrUserData) + when N < 57 -> + d_field_blockchain_txn_vars_v1_pb_multi_key_proofs(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +d_field_blockchain_txn_vars_v1_pb_multi_key_proofs(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, Prev, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_txn_vars_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + cons(NewFValue, + Prev, + TrUserData), + TrUserData). + +skip_varint_blockchain_txn_vars_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, + TrUserData) -> + skip_varint_blockchain_txn_vars_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +skip_varint_blockchain_txn_vars_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, + TrUserData) -> + dfp_read_field_def_blockchain_txn_vars_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData). + +skip_length_delimited_blockchain_txn_vars_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_txn_vars_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData); +skip_length_delimited_blockchain_txn_vars_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_txn_vars_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData). + +skip_group_blockchain_txn_vars_v1_pb(Bin, FNum, Z2, + F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, + F@_8, F@_9, F@_10, F@_11, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_txn_vars_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData). + +skip_32_blockchain_txn_vars_v1_pb(<<_:32, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, F@_9, F@_10, F@_11, TrUserData) -> + dfp_read_field_def_blockchain_txn_vars_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData). + +skip_64_blockchain_txn_vars_v1_pb(<<_:64, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, F@_9, F@_10, F@_11, TrUserData) -> + dfp_read_field_def_blockchain_txn_vars_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + TrUserData). + +decode_msg_blockchain_txn_poc_receipts_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(Bin, + 0, + 0, + id(<<>>, TrUserData), + id(<<>>, TrUserData), + id(<<>>, TrUserData), + id([], TrUserData), + id(0, TrUserData), + id(<<>>, TrUserData), + id(<<>>, TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + d_field_blockchain_txn_poc_receipts_v1_pb_challenger(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + d_field_blockchain_txn_poc_receipts_v1_pb_secret(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(<<26, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + d_field_blockchain_txn_poc_receipts_v1_pb_onion_key_hash(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(<<34, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + d_field_blockchain_txn_poc_receipts_v1_pb_path(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(<<40, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + d_field_blockchain_txn_poc_receipts_v1_pb_fee(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(<<50, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + d_field_blockchain_txn_poc_receipts_v1_pb_signature(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(<<58, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + d_field_blockchain_txn_poc_receipts_v1_pb_request_block_hash(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, R1, + F@_5, F@_6, F@_7, + TrUserData) -> + #blockchain_txn_poc_receipts_v1_pb{challenger = F@_1, + secret = F@_2, onion_key_hash = F@_3, + path = lists_reverse(R1, TrUserData), + fee = F@_5, signature = F@_6, + request_block_hash = F@_7}; +dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(Other, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + dg_read_field_def_blockchain_txn_poc_receipts_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData). + +dg_read_field_def_blockchain_txn_poc_receipts_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_txn_poc_receipts_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +dg_read_field_def_blockchain_txn_poc_receipts_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_blockchain_txn_poc_receipts_v1_pb_challenger(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + 18 -> + d_field_blockchain_txn_poc_receipts_v1_pb_secret(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + 26 -> + d_field_blockchain_txn_poc_receipts_v1_pb_onion_key_hash(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + 34 -> + d_field_blockchain_txn_poc_receipts_v1_pb_path(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + 40 -> + d_field_blockchain_txn_poc_receipts_v1_pb_fee(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + 50 -> + d_field_blockchain_txn_poc_receipts_v1_pb_signature(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + 58 -> + d_field_blockchain_txn_poc_receipts_v1_pb_request_block_hash(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_txn_poc_receipts_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + 1 -> + skip_64_blockchain_txn_poc_receipts_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + 2 -> + skip_length_delimited_blockchain_txn_poc_receipts_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + 3 -> + skip_group_blockchain_txn_poc_receipts_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + 5 -> + skip_32_blockchain_txn_poc_receipts_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData) + end + end; +dg_read_field_def_blockchain_txn_poc_receipts_v1_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, R1, + F@_5, F@_6, F@_7, + TrUserData) -> + #blockchain_txn_poc_receipts_v1_pb{challenger = F@_1, + secret = F@_2, onion_key_hash = F@_3, + path = lists_reverse(R1, TrUserData), + fee = F@_5, signature = F@_6, + request_block_hash = F@_7}. + +d_field_blockchain_txn_poc_receipts_v1_pb_challenger(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) + when N < 57 -> + d_field_blockchain_txn_poc_receipts_v1_pb_challenger(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +d_field_blockchain_txn_poc_receipts_v1_pb_challenger(<<0:1, + X:7, Rest/binary>>, + N, Acc, _, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData). + +d_field_blockchain_txn_poc_receipts_v1_pb_secret(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, TrUserData) + when N < 57 -> + d_field_blockchain_txn_poc_receipts_v1_pb_secret(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +d_field_blockchain_txn_poc_receipts_v1_pb_secret(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, _, F@_3, F@_4, + F@_5, F@_6, F@_7, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData). + +d_field_blockchain_txn_poc_receipts_v1_pb_onion_key_hash(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, + F@_7, TrUserData) + when N < 57 -> + d_field_blockchain_txn_poc_receipts_v1_pb_onion_key_hash(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +d_field_blockchain_txn_poc_receipts_v1_pb_onion_key_hash(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, _, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData). + +d_field_blockchain_txn_poc_receipts_v1_pb_path(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, TrUserData) + when N < 57 -> + d_field_blockchain_txn_poc_receipts_v1_pb_path(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +d_field_blockchain_txn_poc_receipts_v1_pb_path(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, Prev, + F@_5, F@_6, F@_7, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_poc_path_element_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + cons(NewFValue, + Prev, + TrUserData), + F@_5, + F@_6, + F@_7, + TrUserData). + +d_field_blockchain_txn_poc_receipts_v1_pb_fee(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, TrUserData) + when N < 57 -> + d_field_blockchain_txn_poc_receipts_v1_pb_fee(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +d_field_blockchain_txn_poc_receipts_v1_pb_fee(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, _, + F@_6, F@_7, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + NewFValue, + F@_6, + F@_7, + TrUserData). + +d_field_blockchain_txn_poc_receipts_v1_pb_signature(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) + when N < 57 -> + d_field_blockchain_txn_poc_receipts_v1_pb_signature(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +d_field_blockchain_txn_poc_receipts_v1_pb_signature(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, _, F@_7, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + NewFValue, + F@_7, + TrUserData). + +d_field_blockchain_txn_poc_receipts_v1_pb_request_block_hash(<<1:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + F@_6, F@_7, + TrUserData) + when N < 57 -> + d_field_blockchain_txn_poc_receipts_v1_pb_request_block_hash(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +d_field_blockchain_txn_poc_receipts_v1_pb_request_block_hash(<<0:1, + X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, + F@_6, _, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + NewFValue, + TrUserData). + +skip_varint_blockchain_txn_poc_receipts_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, TrUserData) -> + skip_varint_blockchain_txn_poc_receipts_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +skip_varint_blockchain_txn_poc_receipts_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, TrUserData) -> + dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData). + +skip_length_delimited_blockchain_txn_poc_receipts_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, + F@_7, TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_txn_poc_receipts_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +skip_length_delimited_blockchain_txn_poc_receipts_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, + F@_7, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData). + +skip_group_blockchain_txn_poc_receipts_v1_pb(Bin, FNum, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData). + +skip_32_blockchain_txn_poc_receipts_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, TrUserData) -> + dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData). + +skip_64_blockchain_txn_poc_receipts_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, TrUserData) -> + dfp_read_field_def_blockchain_txn_poc_receipts_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData). + +decode_msg_blockchain_poc_receipt_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_poc_receipt_v1_pb(Bin, + 0, + 0, + id(<<>>, TrUserData), + id(0, TrUserData), + id(0, TrUserData), + id(<<>>, TrUserData), + id(p2p, TrUserData), + id(<<>>, TrUserData), + id(0.0, TrUserData), + id(0.0, TrUserData), + id(0, TrUserData), + id([], TrUserData), + id(<<>>, TrUserData), + id(0, TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_poc_receipt_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, + TrUserData) -> + d_field_blockchain_poc_receipt_v1_pb_gateway(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +dfp_read_field_def_blockchain_poc_receipt_v1_pb(<<16, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, + TrUserData) -> + d_field_blockchain_poc_receipt_v1_pb_timestamp(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +dfp_read_field_def_blockchain_poc_receipt_v1_pb(<<24, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, + TrUserData) -> + d_field_blockchain_poc_receipt_v1_pb_signal(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +dfp_read_field_def_blockchain_poc_receipt_v1_pb(<<34, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, + TrUserData) -> + d_field_blockchain_poc_receipt_v1_pb_data(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +dfp_read_field_def_blockchain_poc_receipt_v1_pb(<<40, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, + TrUserData) -> + d_field_blockchain_poc_receipt_v1_pb_origin(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +dfp_read_field_def_blockchain_poc_receipt_v1_pb(<<50, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, + TrUserData) -> + d_field_blockchain_poc_receipt_v1_pb_signature(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +dfp_read_field_def_blockchain_poc_receipt_v1_pb(<<61, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, + TrUserData) -> + d_field_blockchain_poc_receipt_v1_pb_snr(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +dfp_read_field_def_blockchain_poc_receipt_v1_pb(<<69, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, + TrUserData) -> + d_field_blockchain_poc_receipt_v1_pb_frequency(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +dfp_read_field_def_blockchain_poc_receipt_v1_pb(<<72, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, + TrUserData) -> + d_field_blockchain_poc_receipt_v1_pb_channel(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +dfp_read_field_def_blockchain_poc_receipt_v1_pb(<<82, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, + TrUserData) -> + d_field_blockchain_poc_receipt_v1_pb_datarate(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +dfp_read_field_def_blockchain_poc_receipt_v1_pb(<<90, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, + TrUserData) -> + d_field_blockchain_poc_receipt_v1_pb_addr_hash(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +dfp_read_field_def_blockchain_poc_receipt_v1_pb(<<96, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, + TrUserData) -> + d_field_blockchain_poc_receipt_v1_pb_tx_power(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +dfp_read_field_def_blockchain_poc_receipt_v1_pb(<<>>, 0, + 0, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, + F@_11, F@_12, _) -> + #blockchain_poc_receipt_v1_pb{gateway = F@_1, + timestamp = F@_2, signal = F@_3, data = F@_4, + origin = F@_5, signature = F@_6, snr = F@_7, + frequency = F@_8, channel = F@_9, + datarate = F@_10, addr_hash = F@_11, + tx_power = F@_12}; +dfp_read_field_def_blockchain_poc_receipt_v1_pb(Other, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, + TrUserData) -> + dg_read_field_def_blockchain_poc_receipt_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData). + +dg_read_field_def_blockchain_poc_receipt_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_poc_receipt_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +dg_read_field_def_blockchain_poc_receipt_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_blockchain_poc_receipt_v1_pb_gateway(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); + 16 -> + d_field_blockchain_poc_receipt_v1_pb_timestamp(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); + 24 -> + d_field_blockchain_poc_receipt_v1_pb_signal(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); + 34 -> + d_field_blockchain_poc_receipt_v1_pb_data(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); + 40 -> + d_field_blockchain_poc_receipt_v1_pb_origin(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); + 50 -> + d_field_blockchain_poc_receipt_v1_pb_signature(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); + 61 -> + d_field_blockchain_poc_receipt_v1_pb_snr(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); + 69 -> + d_field_blockchain_poc_receipt_v1_pb_frequency(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); + 72 -> + d_field_blockchain_poc_receipt_v1_pb_channel(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); + 82 -> + d_field_blockchain_poc_receipt_v1_pb_datarate(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); + 90 -> + d_field_blockchain_poc_receipt_v1_pb_addr_hash(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); + 96 -> + d_field_blockchain_poc_receipt_v1_pb_tx_power(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_poc_receipt_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); + 1 -> + skip_64_blockchain_poc_receipt_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); + 2 -> + skip_length_delimited_blockchain_poc_receipt_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); + 3 -> + skip_group_blockchain_poc_receipt_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); + 5 -> + skip_32_blockchain_poc_receipt_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData) + end + end; +dg_read_field_def_blockchain_poc_receipt_v1_pb(<<>>, 0, + 0, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, + F@_11, F@_12, _) -> + #blockchain_poc_receipt_v1_pb{gateway = F@_1, + timestamp = F@_2, signal = F@_3, data = F@_4, + origin = F@_5, signature = F@_6, snr = F@_7, + frequency = F@_8, channel = F@_9, + datarate = F@_10, addr_hash = F@_11, + tx_power = F@_12}. + +d_field_blockchain_poc_receipt_v1_pb_gateway(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, TrUserData) + when N < 57 -> + d_field_blockchain_poc_receipt_v1_pb_gateway(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +d_field_blockchain_poc_receipt_v1_pb_gateway(<<0:1, X:7, + Rest/binary>>, + N, Acc, _, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, + F@_11, F@_12, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_poc_receipt_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData). + +d_field_blockchain_poc_receipt_v1_pb_timestamp(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, TrUserData) + when N < 57 -> + d_field_blockchain_poc_receipt_v1_pb_timestamp(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +d_field_blockchain_poc_receipt_v1_pb_timestamp(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, _, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_poc_receipt_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData). + +d_field_blockchain_poc_receipt_v1_pb_signal(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, + F@_11, F@_12, TrUserData) + when N < 57 -> + d_field_blockchain_poc_receipt_v1_pb_signal(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +d_field_blockchain_poc_receipt_v1_pb_signal(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, _, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, + F@_11, F@_12, TrUserData) -> + {NewFValue, RestF} = {begin + ZValue = X bsl N + Acc, + if ZValue band 1 =:= 0 -> + id(ZValue bsr 1, TrUserData); + true -> id(-(ZValue + 1 bsr 1), TrUserData) + end + end, + Rest}, + dfp_read_field_def_blockchain_poc_receipt_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData). + +d_field_blockchain_poc_receipt_v1_pb_data(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, + F@_12, TrUserData) + when N < 57 -> + d_field_blockchain_poc_receipt_v1_pb_data(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +d_field_blockchain_poc_receipt_v1_pb_data(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, _, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, + F@_12, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_poc_receipt_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + NewFValue, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData). + +d_field_blockchain_poc_receipt_v1_pb_origin(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, F@_10, + F@_11, F@_12, TrUserData) + when N < 57 -> + d_field_blockchain_poc_receipt_v1_pb_origin(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +d_field_blockchain_poc_receipt_v1_pb_origin(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, _, + F@_6, F@_7, F@_8, F@_9, F@_10, + F@_11, F@_12, TrUserData) -> + {NewFValue, RestF} = {id('d_enum_helium.origin'(begin + <> = + <<(X bsl N + + Acc):32/unsigned-native>>, + id(Res, TrUserData) + end), + TrUserData), + Rest}, + dfp_read_field_def_blockchain_poc_receipt_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + NewFValue, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData). + +d_field_blockchain_poc_receipt_v1_pb_signature(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, TrUserData) + when N < 57 -> + d_field_blockchain_poc_receipt_v1_pb_signature(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +d_field_blockchain_poc_receipt_v1_pb_signature(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, _, F@_7, F@_8, F@_9, F@_10, + F@_11, F@_12, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_poc_receipt_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + NewFValue, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData). + +d_field_blockchain_poc_receipt_v1_pb_snr(<<0:16, 128, + 127, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, _, F@_8, F@_9, F@_10, F@_11, + F@_12, TrUserData) -> + dfp_read_field_def_blockchain_poc_receipt_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + id(infinity, TrUserData), + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +d_field_blockchain_poc_receipt_v1_pb_snr(<<0:16, 128, + 255, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, _, F@_8, F@_9, F@_10, F@_11, + F@_12, TrUserData) -> + dfp_read_field_def_blockchain_poc_receipt_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + id('-infinity', TrUserData), + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +d_field_blockchain_poc_receipt_v1_pb_snr(<<_:16, 1:1, + _:7, _:1, 127:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, _, F@_8, F@_9, F@_10, F@_11, + F@_12, TrUserData) -> + dfp_read_field_def_blockchain_poc_receipt_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + id(nan, TrUserData), + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +d_field_blockchain_poc_receipt_v1_pb_snr(<>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, _, F@_8, F@_9, F@_10, F@_11, + F@_12, TrUserData) -> + dfp_read_field_def_blockchain_poc_receipt_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + id(Value, TrUserData), + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData). + +d_field_blockchain_poc_receipt_v1_pb_frequency(<<0:16, + 128, 127, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, _, F@_9, F@_10, + F@_11, F@_12, TrUserData) -> + dfp_read_field_def_blockchain_poc_receipt_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + id(infinity, TrUserData), + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +d_field_blockchain_poc_receipt_v1_pb_frequency(<<0:16, + 128, 255, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, _, F@_9, F@_10, + F@_11, F@_12, TrUserData) -> + dfp_read_field_def_blockchain_poc_receipt_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + id('-infinity', TrUserData), + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +d_field_blockchain_poc_receipt_v1_pb_frequency(<<_:16, + 1:1, _:7, _:1, 127:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, _, F@_9, F@_10, + F@_11, F@_12, TrUserData) -> + dfp_read_field_def_blockchain_poc_receipt_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + id(nan, TrUserData), + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +d_field_blockchain_poc_receipt_v1_pb_frequency(<>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, _, F@_9, F@_10, + F@_11, F@_12, TrUserData) -> + dfp_read_field_def_blockchain_poc_receipt_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + id(Value, TrUserData), + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData). + +d_field_blockchain_poc_receipt_v1_pb_channel(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, TrUserData) + when N < 57 -> + d_field_blockchain_poc_receipt_v1_pb_channel(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +d_field_blockchain_poc_receipt_v1_pb_channel(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, _, F@_10, + F@_11, F@_12, TrUserData) -> + {NewFValue, RestF} = {begin + <> = <<(X bsl N + + Acc):32/unsigned-native>>, + id(Res, TrUserData) + end, + Rest}, + dfp_read_field_def_blockchain_poc_receipt_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + NewFValue, + F@_10, + F@_11, + F@_12, + TrUserData). + +d_field_blockchain_poc_receipt_v1_pb_datarate(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, TrUserData) + when N < 57 -> + d_field_blockchain_poc_receipt_v1_pb_datarate(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +d_field_blockchain_poc_receipt_v1_pb_datarate(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, _, + F@_11, F@_12, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(unicode:characters_to_list(Utf8, unicode), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_poc_receipt_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + NewFValue, + F@_11, + F@_12, + TrUserData). + +d_field_blockchain_poc_receipt_v1_pb_addr_hash(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, TrUserData) + when N < 57 -> + d_field_blockchain_poc_receipt_v1_pb_addr_hash(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +d_field_blockchain_poc_receipt_v1_pb_addr_hash(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, _, F@_12, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_poc_receipt_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + NewFValue, + F@_12, + TrUserData). + +d_field_blockchain_poc_receipt_v1_pb_tx_power(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, F@_12, TrUserData) + when N < 57 -> + d_field_blockchain_poc_receipt_v1_pb_tx_power(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +d_field_blockchain_poc_receipt_v1_pb_tx_power(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + F@_10, F@_11, _, TrUserData) -> + {NewFValue, RestF} = {begin + <> = <<(X bsl N + + Acc):32/unsigned-native>>, + id(Res, TrUserData) + end, + Rest}, + dfp_read_field_def_blockchain_poc_receipt_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + NewFValue, + TrUserData). + +skip_varint_blockchain_poc_receipt_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, + F@_12, TrUserData) -> + skip_varint_blockchain_poc_receipt_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +skip_varint_blockchain_poc_receipt_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, F@_10, F@_11, + F@_12, TrUserData) -> + dfp_read_field_def_blockchain_poc_receipt_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData). + +skip_length_delimited_blockchain_poc_receipt_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, F@_11, F@_12, + TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_poc_receipt_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData); +skip_length_delimited_blockchain_poc_receipt_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, F@_10, F@_11, F@_12, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_poc_receipt_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData). + +skip_group_blockchain_poc_receipt_v1_pb(Bin, FNum, Z2, + F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_poc_receipt_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData). + +skip_32_blockchain_poc_receipt_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, + TrUserData) -> + dfp_read_field_def_blockchain_poc_receipt_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData). + +skip_64_blockchain_poc_receipt_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, F@_9, F@_10, F@_11, F@_12, + TrUserData) -> + dfp_read_field_def_blockchain_poc_receipt_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + F@_10, + F@_11, + F@_12, + TrUserData). + +decode_msg_blockchain_poc_witness_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_poc_witness_v1_pb(Bin, + 0, + 0, + id(<<>>, TrUserData), + id(0, TrUserData), + id(0, TrUserData), + id(<<>>, TrUserData), + id(<<>>, TrUserData), + id(0.0, TrUserData), + id(0.0, TrUserData), + id(0, TrUserData), + id([], TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_poc_witness_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + TrUserData) -> + d_field_blockchain_poc_witness_v1_pb_gateway(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); +dfp_read_field_def_blockchain_poc_witness_v1_pb(<<16, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + TrUserData) -> + d_field_blockchain_poc_witness_v1_pb_timestamp(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); +dfp_read_field_def_blockchain_poc_witness_v1_pb(<<24, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + TrUserData) -> + d_field_blockchain_poc_witness_v1_pb_signal(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); +dfp_read_field_def_blockchain_poc_witness_v1_pb(<<34, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + TrUserData) -> + d_field_blockchain_poc_witness_v1_pb_packet_hash(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); +dfp_read_field_def_blockchain_poc_witness_v1_pb(<<42, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + TrUserData) -> + d_field_blockchain_poc_witness_v1_pb_signature(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); +dfp_read_field_def_blockchain_poc_witness_v1_pb(<<53, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + TrUserData) -> + d_field_blockchain_poc_witness_v1_pb_snr(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); +dfp_read_field_def_blockchain_poc_witness_v1_pb(<<61, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + TrUserData) -> + d_field_blockchain_poc_witness_v1_pb_frequency(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); +dfp_read_field_def_blockchain_poc_witness_v1_pb(<<64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + TrUserData) -> + d_field_blockchain_poc_witness_v1_pb_channel(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); +dfp_read_field_def_blockchain_poc_witness_v1_pb(<<74, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + TrUserData) -> + d_field_blockchain_poc_witness_v1_pb_datarate(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); +dfp_read_field_def_blockchain_poc_witness_v1_pb(<<>>, 0, + 0, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, _) -> + #blockchain_poc_witness_v1_pb{gateway = F@_1, + timestamp = F@_2, signal = F@_3, + packet_hash = F@_4, signature = F@_5, + snr = F@_6, frequency = F@_7, channel = F@_8, + datarate = F@_9}; +dfp_read_field_def_blockchain_poc_witness_v1_pb(Other, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + TrUserData) -> + dg_read_field_def_blockchain_poc_witness_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData). + +dg_read_field_def_blockchain_poc_witness_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_poc_witness_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); +dg_read_field_def_blockchain_poc_witness_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_blockchain_poc_witness_v1_pb_gateway(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); + 16 -> + d_field_blockchain_poc_witness_v1_pb_timestamp(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); + 24 -> + d_field_blockchain_poc_witness_v1_pb_signal(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); + 34 -> + d_field_blockchain_poc_witness_v1_pb_packet_hash(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); + 42 -> + d_field_blockchain_poc_witness_v1_pb_signature(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); + 53 -> + d_field_blockchain_poc_witness_v1_pb_snr(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); + 61 -> + d_field_blockchain_poc_witness_v1_pb_frequency(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); + 64 -> + d_field_blockchain_poc_witness_v1_pb_channel(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); + 74 -> + d_field_blockchain_poc_witness_v1_pb_datarate(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_poc_witness_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); + 1 -> + skip_64_blockchain_poc_witness_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); + 2 -> + skip_length_delimited_blockchain_poc_witness_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); + 3 -> + skip_group_blockchain_poc_witness_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); + 5 -> + skip_32_blockchain_poc_witness_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData) + end + end; +dg_read_field_def_blockchain_poc_witness_v1_pb(<<>>, 0, + 0, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, _) -> + #blockchain_poc_witness_v1_pb{gateway = F@_1, + timestamp = F@_2, signal = F@_3, + packet_hash = F@_4, signature = F@_5, + snr = F@_6, frequency = F@_7, channel = F@_8, + datarate = F@_9}. + +d_field_blockchain_poc_witness_v1_pb_gateway(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + TrUserData) + when N < 57 -> + d_field_blockchain_poc_witness_v1_pb_gateway(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); +d_field_blockchain_poc_witness_v1_pb_gateway(<<0:1, X:7, + Rest/binary>>, + N, Acc, _, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_poc_witness_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData). + +d_field_blockchain_poc_witness_v1_pb_timestamp(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + TrUserData) + when N < 57 -> + d_field_blockchain_poc_witness_v1_pb_timestamp(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); +d_field_blockchain_poc_witness_v1_pb_timestamp(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, _, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_poc_witness_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData). + +d_field_blockchain_poc_witness_v1_pb_signal(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + TrUserData) + when N < 57 -> + d_field_blockchain_poc_witness_v1_pb_signal(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); +d_field_blockchain_poc_witness_v1_pb_signal(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, _, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, + TrUserData) -> + {NewFValue, RestF} = {begin + ZValue = X bsl N + Acc, + if ZValue band 1 =:= 0 -> + id(ZValue bsr 1, TrUserData); + true -> id(-(ZValue + 1 bsr 1), TrUserData) + end + end, + Rest}, + dfp_read_field_def_blockchain_poc_witness_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData). + +d_field_blockchain_poc_witness_v1_pb_packet_hash(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + TrUserData) + when N < 57 -> + d_field_blockchain_poc_witness_v1_pb_packet_hash(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); +d_field_blockchain_poc_witness_v1_pb_packet_hash(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, _, + F@_5, F@_6, F@_7, F@_8, F@_9, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_poc_witness_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + NewFValue, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData). + +d_field_blockchain_poc_witness_v1_pb_signature(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + TrUserData) + when N < 57 -> + d_field_blockchain_poc_witness_v1_pb_signature(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); +d_field_blockchain_poc_witness_v1_pb_signature(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + _, F@_6, F@_7, F@_8, F@_9, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_poc_witness_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + NewFValue, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData). + +d_field_blockchain_poc_witness_v1_pb_snr(<<0:16, 128, + 127, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + _, F@_7, F@_8, F@_9, TrUserData) -> + dfp_read_field_def_blockchain_poc_witness_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + id(infinity, TrUserData), + F@_7, + F@_8, + F@_9, + TrUserData); +d_field_blockchain_poc_witness_v1_pb_snr(<<0:16, 128, + 255, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + _, F@_7, F@_8, F@_9, TrUserData) -> + dfp_read_field_def_blockchain_poc_witness_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + id('-infinity', TrUserData), + F@_7, + F@_8, + F@_9, + TrUserData); +d_field_blockchain_poc_witness_v1_pb_snr(<<_:16, 1:1, + _:7, _:1, 127:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + _, F@_7, F@_8, F@_9, TrUserData) -> + dfp_read_field_def_blockchain_poc_witness_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + id(nan, TrUserData), + F@_7, + F@_8, + F@_9, + TrUserData); +d_field_blockchain_poc_witness_v1_pb_snr(<>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + _, F@_7, F@_8, F@_9, TrUserData) -> + dfp_read_field_def_blockchain_poc_witness_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + id(Value, TrUserData), + F@_7, + F@_8, + F@_9, + TrUserData). + +d_field_blockchain_poc_witness_v1_pb_frequency(<<0:16, + 128, 127, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, _, F@_8, F@_9, + TrUserData) -> + dfp_read_field_def_blockchain_poc_witness_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + id(infinity, TrUserData), + F@_8, + F@_9, + TrUserData); +d_field_blockchain_poc_witness_v1_pb_frequency(<<0:16, + 128, 255, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, _, F@_8, F@_9, + TrUserData) -> + dfp_read_field_def_blockchain_poc_witness_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + id('-infinity', TrUserData), + F@_8, + F@_9, + TrUserData); +d_field_blockchain_poc_witness_v1_pb_frequency(<<_:16, + 1:1, _:7, _:1, 127:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, _, F@_8, F@_9, + TrUserData) -> + dfp_read_field_def_blockchain_poc_witness_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + id(nan, TrUserData), + F@_8, + F@_9, + TrUserData); +d_field_blockchain_poc_witness_v1_pb_frequency(<>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, _, F@_8, F@_9, + TrUserData) -> + dfp_read_field_def_blockchain_poc_witness_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + id(Value, TrUserData), + F@_8, + F@_9, + TrUserData). + +d_field_blockchain_poc_witness_v1_pb_channel(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + TrUserData) + when N < 57 -> + d_field_blockchain_poc_witness_v1_pb_channel(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); +d_field_blockchain_poc_witness_v1_pb_channel(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, _, F@_9, + TrUserData) -> + {NewFValue, RestF} = {begin + <> = <<(X bsl N + + Acc):32/unsigned-native>>, + id(Res, TrUserData) + end, + Rest}, + dfp_read_field_def_blockchain_poc_witness_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + NewFValue, + F@_9, + TrUserData). + +d_field_blockchain_poc_witness_v1_pb_datarate(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, F@_9, + TrUserData) + when N < 57 -> + d_field_blockchain_poc_witness_v1_pb_datarate(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); +d_field_blockchain_poc_witness_v1_pb_datarate(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, F@_8, _, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(unicode:characters_to_list(Utf8, unicode), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_poc_witness_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + NewFValue, + TrUserData). + +skip_varint_blockchain_poc_witness_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, TrUserData) -> + skip_varint_blockchain_poc_witness_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); +skip_varint_blockchain_poc_witness_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, F@_8, F@_9, TrUserData) -> + dfp_read_field_def_blockchain_poc_witness_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData). + +skip_length_delimited_blockchain_poc_witness_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_poc_witness_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData); +skip_length_delimited_blockchain_poc_witness_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, F@_8, + F@_9, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_poc_witness_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData). + +skip_group_blockchain_poc_witness_v1_pb(Bin, FNum, Z2, + F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, F@_9, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_poc_witness_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData). + +skip_32_blockchain_poc_witness_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, F@_9, TrUserData) -> + dfp_read_field_def_blockchain_poc_witness_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData). + +skip_64_blockchain_poc_witness_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, + F@_7, F@_8, F@_9, TrUserData) -> + dfp_read_field_def_blockchain_poc_witness_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + F@_8, + F@_9, + TrUserData). + +decode_msg_blockchain_poc_response_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_poc_response_v1_pb(Bin, + 0, + 0, + id(undefined, TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_poc_response_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + d_field_blockchain_poc_response_v1_pb_receipt(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_blockchain_poc_response_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + d_field_blockchain_poc_response_v1_pb_witness(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_blockchain_poc_response_v1_pb(<<>>, + 0, 0, F@_1, _) -> + #blockchain_poc_response_v1_pb{payload = F@_1}; +dfp_read_field_def_blockchain_poc_response_v1_pb(Other, + Z1, Z2, F@_1, TrUserData) -> + dg_read_field_def_blockchain_poc_response_v1_pb(Other, + Z1, + Z2, + F@_1, + TrUserData). + +dg_read_field_def_blockchain_poc_response_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_poc_response_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +dg_read_field_def_blockchain_poc_response_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_blockchain_poc_response_v1_pb_receipt(Rest, + 0, + 0, + F@_1, + TrUserData); + 18 -> + d_field_blockchain_poc_response_v1_pb_witness(Rest, + 0, + 0, + F@_1, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_poc_response_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 1 -> + skip_64_blockchain_poc_response_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 2 -> + skip_length_delimited_blockchain_poc_response_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 3 -> + skip_group_blockchain_poc_response_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + TrUserData); + 5 -> + skip_32_blockchain_poc_response_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData) + end + end; +dg_read_field_def_blockchain_poc_response_v1_pb(<<>>, 0, + 0, F@_1, _) -> + #blockchain_poc_response_v1_pb{payload = F@_1}. + +d_field_blockchain_poc_response_v1_pb_receipt(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + d_field_blockchain_poc_response_v1_pb_receipt(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_blockchain_poc_response_v1_pb_receipt(<<0:1, + X:7, Rest/binary>>, + N, Acc, Prev, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_poc_receipt_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_poc_response_v1_pb(RestF, + 0, + 0, + case Prev of + undefined -> + id({receipt, + NewFValue}, + TrUserData); + {receipt, MVPrev} -> + id({receipt, + merge_msg_blockchain_poc_receipt_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({receipt, + NewFValue}, + TrUserData) + end, + TrUserData). + +d_field_blockchain_poc_response_v1_pb_witness(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + d_field_blockchain_poc_response_v1_pb_witness(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_blockchain_poc_response_v1_pb_witness(<<0:1, + X:7, Rest/binary>>, + N, Acc, Prev, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_poc_witness_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_poc_response_v1_pb(RestF, + 0, + 0, + case Prev of + undefined -> + id({witness, + NewFValue}, + TrUserData); + {witness, MVPrev} -> + id({witness, + merge_msg_blockchain_poc_witness_v1_pb(MVPrev, + NewFValue, + TrUserData)}, + TrUserData); + _ -> + id({witness, + NewFValue}, + TrUserData) + end, + TrUserData). + +skip_varint_blockchain_poc_response_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + skip_varint_blockchain_poc_response_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData); +skip_varint_blockchain_poc_response_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_blockchain_poc_response_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_length_delimited_blockchain_poc_response_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_poc_response_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +skip_length_delimited_blockchain_poc_response_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_poc_response_v1_pb(Rest2, + 0, + 0, + F@_1, + TrUserData). + +skip_group_blockchain_poc_response_v1_pb(Bin, FNum, Z2, + F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_poc_response_v1_pb(Rest, + 0, + Z2, + F@_1, + TrUserData). + +skip_32_blockchain_poc_response_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_blockchain_poc_response_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_64_blockchain_poc_response_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_blockchain_poc_response_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +decode_msg_blockchain_poc_path_element_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_poc_path_element_v1_pb(Bin, + 0, + 0, + id(<<>>, TrUserData), + id(undefined, + TrUserData), + id([], TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_poc_path_element_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + d_field_blockchain_poc_path_element_v1_pb_challengee(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_blockchain_poc_path_element_v1_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + d_field_blockchain_poc_path_element_v1_pb_receipt(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_blockchain_poc_path_element_v1_pb(<<26, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + d_field_blockchain_poc_path_element_v1_pb_witnesses(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +dfp_read_field_def_blockchain_poc_path_element_v1_pb(<<>>, + 0, 0, F@_1, F@_2, R1, + TrUserData) -> + #blockchain_poc_path_element_v1_pb{challengee = F@_1, + receipt = F@_2, + witnesses = + lists_reverse(R1, TrUserData)}; +dfp_read_field_def_blockchain_poc_path_element_v1_pb(Other, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dg_read_field_def_blockchain_poc_path_element_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +dg_read_field_def_blockchain_poc_path_element_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_poc_path_element_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +dg_read_field_def_blockchain_poc_path_element_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_blockchain_poc_path_element_v1_pb_challengee(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 18 -> + d_field_blockchain_poc_path_element_v1_pb_receipt(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 26 -> + d_field_blockchain_poc_path_element_v1_pb_witnesses(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_poc_path_element_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 1 -> + skip_64_blockchain_poc_path_element_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 2 -> + skip_length_delimited_blockchain_poc_path_element_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 3 -> + skip_group_blockchain_poc_path_element_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + F@_3, + TrUserData); + 5 -> + skip_32_blockchain_poc_path_element_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData) + end + end; +dg_read_field_def_blockchain_poc_path_element_v1_pb(<<>>, + 0, 0, F@_1, F@_2, R1, + TrUserData) -> + #blockchain_poc_path_element_v1_pb{challengee = F@_1, + receipt = F@_2, + witnesses = + lists_reverse(R1, TrUserData)}. + +d_field_blockchain_poc_path_element_v1_pb_challengee(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + TrUserData) + when N < 57 -> + d_field_blockchain_poc_path_element_v1_pb_challengee(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_blockchain_poc_path_element_v1_pb_challengee(<<0:1, + X:7, Rest/binary>>, + N, Acc, _, F@_2, F@_3, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_poc_path_element_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + TrUserData). + +d_field_blockchain_poc_path_element_v1_pb_receipt(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + TrUserData) + when N < 57 -> + d_field_blockchain_poc_path_element_v1_pb_receipt(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_blockchain_poc_path_element_v1_pb_receipt(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, Prev, F@_3, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_poc_receipt_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_poc_path_element_v1_pb(RestF, + 0, + 0, + F@_1, + if Prev == undefined -> + NewFValue; + true -> + merge_msg_blockchain_poc_receipt_v1_pb(Prev, + NewFValue, + TrUserData) + end, + F@_3, + TrUserData). + +d_field_blockchain_poc_path_element_v1_pb_witnesses(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + TrUserData) + when N < 57 -> + d_field_blockchain_poc_path_element_v1_pb_witnesses(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +d_field_blockchain_poc_path_element_v1_pb_witnesses(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, Prev, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_poc_witness_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_poc_path_element_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + cons(NewFValue, + Prev, + TrUserData), + TrUserData). + +skip_varint_blockchain_poc_path_element_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + skip_varint_blockchain_poc_path_element_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_varint_blockchain_poc_path_element_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_blockchain_poc_path_element_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_length_delimited_blockchain_poc_path_element_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_poc_path_element_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + TrUserData); +skip_length_delimited_blockchain_poc_path_element_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_poc_path_element_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_group_blockchain_poc_path_element_v1_pb(Bin, FNum, + Z2, F@_1, F@_2, F@_3, + TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_poc_path_element_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_32_blockchain_poc_path_element_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_blockchain_poc_path_element_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +skip_64_blockchain_poc_path_element_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + TrUserData) -> + dfp_read_field_def_blockchain_poc_path_element_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + TrUserData). + +decode_msg_blockchain_txn_poc_receipts_v2_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(Bin, + 0, + 0, + id(<<>>, TrUserData), + id(<<>>, TrUserData), + id(<<>>, TrUserData), + id([], TrUserData), + id(0, TrUserData), + id(<<>>, TrUserData), + id(<<>>, TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + d_field_blockchain_txn_poc_receipts_v2_pb_challenger(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(<<18, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + d_field_blockchain_txn_poc_receipts_v2_pb_secret(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(<<26, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + d_field_blockchain_txn_poc_receipts_v2_pb_onion_key_hash(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(<<34, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + d_field_blockchain_txn_poc_receipts_v2_pb_path(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(<<40, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + d_field_blockchain_txn_poc_receipts_v2_pb_fee(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(<<50, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + d_field_blockchain_txn_poc_receipts_v2_pb_signature(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(<<58, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + d_field_blockchain_txn_poc_receipts_v2_pb_block_hash(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, R1, + F@_5, F@_6, F@_7, + TrUserData) -> + #blockchain_txn_poc_receipts_v2_pb{challenger = F@_1, + secret = F@_2, onion_key_hash = F@_3, + path = lists_reverse(R1, TrUserData), + fee = F@_5, signature = F@_6, + block_hash = F@_7}; +dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(Other, + Z1, Z2, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + dg_read_field_def_blockchain_txn_poc_receipts_v2_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData). + +dg_read_field_def_blockchain_txn_poc_receipts_v2_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_txn_poc_receipts_v2_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +dg_read_field_def_blockchain_txn_poc_receipts_v2_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_blockchain_txn_poc_receipts_v2_pb_challenger(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + 18 -> + d_field_blockchain_txn_poc_receipts_v2_pb_secret(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + 26 -> + d_field_blockchain_txn_poc_receipts_v2_pb_onion_key_hash(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + 34 -> + d_field_blockchain_txn_poc_receipts_v2_pb_path(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + 40 -> + d_field_blockchain_txn_poc_receipts_v2_pb_fee(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + 50 -> + d_field_blockchain_txn_poc_receipts_v2_pb_signature(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + 58 -> + d_field_blockchain_txn_poc_receipts_v2_pb_block_hash(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_txn_poc_receipts_v2_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + 1 -> + skip_64_blockchain_txn_poc_receipts_v2_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + 2 -> + skip_length_delimited_blockchain_txn_poc_receipts_v2_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + 3 -> + skip_group_blockchain_txn_poc_receipts_v2_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); + 5 -> + skip_32_blockchain_txn_poc_receipts_v2_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData) + end + end; +dg_read_field_def_blockchain_txn_poc_receipts_v2_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, R1, + F@_5, F@_6, F@_7, + TrUserData) -> + #blockchain_txn_poc_receipts_v2_pb{challenger = F@_1, + secret = F@_2, onion_key_hash = F@_3, + path = lists_reverse(R1, TrUserData), + fee = F@_5, signature = F@_6, + block_hash = F@_7}. + +d_field_blockchain_txn_poc_receipts_v2_pb_challenger(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) + when N < 57 -> + d_field_blockchain_txn_poc_receipts_v2_pb_challenger(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +d_field_blockchain_txn_poc_receipts_v2_pb_challenger(<<0:1, + X:7, Rest/binary>>, + N, Acc, _, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData). + +d_field_blockchain_txn_poc_receipts_v2_pb_secret(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, TrUserData) + when N < 57 -> + d_field_blockchain_txn_poc_receipts_v2_pb_secret(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +d_field_blockchain_txn_poc_receipts_v2_pb_secret(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, _, F@_3, F@_4, + F@_5, F@_6, F@_7, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData). + +d_field_blockchain_txn_poc_receipts_v2_pb_onion_key_hash(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, + F@_7, TrUserData) + when N < 57 -> + d_field_blockchain_txn_poc_receipts_v2_pb_onion_key_hash(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +d_field_blockchain_txn_poc_receipts_v2_pb_onion_key_hash(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, _, + F@_4, F@_5, F@_6, F@_7, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData). + +d_field_blockchain_txn_poc_receipts_v2_pb_path(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, TrUserData) + when N < 57 -> + d_field_blockchain_txn_poc_receipts_v2_pb_path(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +d_field_blockchain_txn_poc_receipts_v2_pb_path(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, Prev, + F@_5, F@_6, F@_7, TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_poc_path_element_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + cons(NewFValue, + Prev, + TrUserData), + F@_5, + F@_6, + F@_7, + TrUserData). + +d_field_blockchain_txn_poc_receipts_v2_pb_fee(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, TrUserData) + when N < 57 -> + d_field_blockchain_txn_poc_receipts_v2_pb_fee(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +d_field_blockchain_txn_poc_receipts_v2_pb_fee(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, _, + F@_6, F@_7, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + NewFValue, + F@_6, + F@_7, + TrUserData). + +d_field_blockchain_txn_poc_receipts_v2_pb_signature(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) + when N < 57 -> + d_field_blockchain_txn_poc_receipts_v2_pb_signature(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +d_field_blockchain_txn_poc_receipts_v2_pb_signature(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, _, F@_7, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + NewFValue, + F@_7, + TrUserData). + +d_field_blockchain_txn_poc_receipts_v2_pb_block_hash(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, F@_7, + TrUserData) + when N < 57 -> + d_field_blockchain_txn_poc_receipts_v2_pb_block_hash(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +d_field_blockchain_txn_poc_receipts_v2_pb_block_hash(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, F@_5, F@_6, _, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(binary:copy(Bytes), TrUserData), Rest2} + end, + dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + NewFValue, + TrUserData). + +skip_varint_blockchain_txn_poc_receipts_v2_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, TrUserData) -> + skip_varint_blockchain_txn_poc_receipts_v2_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +skip_varint_blockchain_txn_poc_receipts_v2_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + F@_5, F@_6, F@_7, TrUserData) -> + dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData). + +skip_length_delimited_blockchain_txn_poc_receipts_v2_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, + F@_7, TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_txn_poc_receipts_v2_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData); +skip_length_delimited_blockchain_txn_poc_receipts_v2_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, F@_5, F@_6, + F@_7, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData). + +skip_group_blockchain_txn_poc_receipts_v2_pb(Bin, FNum, + Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData). + +skip_32_blockchain_txn_poc_receipts_v2_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, TrUserData) -> + dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData). + +skip_64_blockchain_txn_poc_receipts_v2_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, + F@_6, F@_7, TrUserData) -> + dfp_read_field_def_blockchain_txn_poc_receipts_v2_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + F@_5, + F@_6, + F@_7, + TrUserData). + +decode_msg_blockchain_region_params_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_region_params_v1_pb(Bin, + 0, + 0, + id([], TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_region_params_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + d_field_blockchain_region_params_v1_pb_region_params(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_blockchain_region_params_v1_pb(<<>>, + 0, 0, R1, TrUserData) -> + #blockchain_region_params_v1_pb{region_params = + lists_reverse(R1, TrUserData)}; +dfp_read_field_def_blockchain_region_params_v1_pb(Other, + Z1, Z2, F@_1, TrUserData) -> + dg_read_field_def_blockchain_region_params_v1_pb(Other, + Z1, + Z2, + F@_1, + TrUserData). + +dg_read_field_def_blockchain_region_params_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_region_params_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +dg_read_field_def_blockchain_region_params_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_blockchain_region_params_v1_pb_region_params(Rest, + 0, + 0, + F@_1, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_region_params_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 1 -> + skip_64_blockchain_region_params_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 2 -> + skip_length_delimited_blockchain_region_params_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 3 -> + skip_group_blockchain_region_params_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + TrUserData); + 5 -> + skip_32_blockchain_region_params_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData) + end + end; +dg_read_field_def_blockchain_region_params_v1_pb(<<>>, + 0, 0, R1, TrUserData) -> + #blockchain_region_params_v1_pb{region_params = + lists_reverse(R1, TrUserData)}. + +d_field_blockchain_region_params_v1_pb_region_params(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + d_field_blockchain_region_params_v1_pb_region_params(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_blockchain_region_params_v1_pb_region_params(<<0:1, + X:7, Rest/binary>>, + N, Acc, Prev, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_region_param_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_region_params_v1_pb(RestF, + 0, + 0, + cons(NewFValue, + Prev, + TrUserData), + TrUserData). + +skip_varint_blockchain_region_params_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + skip_varint_blockchain_region_params_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData); +skip_varint_blockchain_region_params_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_blockchain_region_params_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_length_delimited_blockchain_region_params_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_region_params_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +skip_length_delimited_blockchain_region_params_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_region_params_v1_pb(Rest2, + 0, + 0, + F@_1, + TrUserData). + +skip_group_blockchain_region_params_v1_pb(Bin, FNum, Z2, + F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_region_params_v1_pb(Rest, + 0, + Z2, + F@_1, + TrUserData). + +skip_32_blockchain_region_params_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_blockchain_region_params_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_64_blockchain_region_params_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_blockchain_region_params_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +decode_msg_tagged_spreading_pb(Bin, TrUserData) -> + dfp_read_field_def_tagged_spreading_pb(Bin, + 0, + 0, + id('SF_INVALID', TrUserData), + id(0, TrUserData), + TrUserData). + +dfp_read_field_def_tagged_spreading_pb(<<8, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + d_field_tagged_spreading_pb_region_spreading(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_tagged_spreading_pb(<<16, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + d_field_tagged_spreading_pb_max_packet_size(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +dfp_read_field_def_tagged_spreading_pb(<<>>, 0, 0, F@_1, + F@_2, _) -> + #tagged_spreading_pb{region_spreading = F@_1, + max_packet_size = F@_2}; +dfp_read_field_def_tagged_spreading_pb(Other, Z1, Z2, + F@_1, F@_2, TrUserData) -> + dg_read_field_def_tagged_spreading_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +dg_read_field_def_tagged_spreading_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_tagged_spreading_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +dg_read_field_def_tagged_spreading_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 8 -> + d_field_tagged_spreading_pb_region_spreading(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 16 -> + d_field_tagged_spreading_pb_max_packet_size(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_tagged_spreading_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 1 -> + skip_64_tagged_spreading_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 2 -> + skip_length_delimited_tagged_spreading_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData); + 3 -> + skip_group_tagged_spreading_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + TrUserData); + 5 -> + skip_32_tagged_spreading_pb(Rest, + 0, + 0, + F@_1, + F@_2, + TrUserData) + end + end; +dg_read_field_def_tagged_spreading_pb(<<>>, 0, 0, F@_1, + F@_2, _) -> + #tagged_spreading_pb{region_spreading = F@_1, + max_packet_size = F@_2}. + +d_field_tagged_spreading_pb_region_spreading(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + d_field_tagged_spreading_pb_region_spreading(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_tagged_spreading_pb_region_spreading(<<0:1, X:7, + Rest/binary>>, + N, Acc, _, F@_2, TrUserData) -> + {NewFValue, RestF} = + {id('d_enum_helium.RegionSpreading'(begin + <> = <<(X + bsl + N + + + Acc):32/unsigned-native>>, + id(Res, TrUserData) + end), + TrUserData), + Rest}, + dfp_read_field_def_tagged_spreading_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + TrUserData). + +d_field_tagged_spreading_pb_max_packet_size(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + d_field_tagged_spreading_pb_max_packet_size(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +d_field_tagged_spreading_pb_max_packet_size(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, _, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_tagged_spreading_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + TrUserData). + +skip_varint_tagged_spreading_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + skip_varint_tagged_spreading_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData); +skip_varint_tagged_spreading_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_tagged_spreading_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_length_delimited_tagged_spreading_pb(<<1:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) + when N < 57 -> + skip_length_delimited_tagged_spreading_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + TrUserData); +skip_length_delimited_tagged_spreading_pb(<<0:1, X:7, + Rest/binary>>, + N, Acc, F@_1, F@_2, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_tagged_spreading_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + TrUserData). + +skip_group_tagged_spreading_pb(Bin, FNum, Z2, F@_1, + F@_2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_tagged_spreading_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_32_tagged_spreading_pb(<<_:32, Rest/binary>>, Z1, + Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_tagged_spreading_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +skip_64_tagged_spreading_pb(<<_:64, Rest/binary>>, Z1, + Z2, F@_1, F@_2, TrUserData) -> + dfp_read_field_def_tagged_spreading_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + TrUserData). + +decode_msg_blockchain_region_spreading_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_region_spreading_v1_pb(Bin, + 0, + 0, + id([], TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_region_spreading_v1_pb(<<10, + Rest/binary>>, + Z1, Z2, F@_1, + TrUserData) -> + d_field_blockchain_region_spreading_v1_pb_tagged_spreading(Rest, + Z1, + Z2, + F@_1, + TrUserData); +dfp_read_field_def_blockchain_region_spreading_v1_pb(<<>>, + 0, 0, R1, TrUserData) -> + #blockchain_region_spreading_v1_pb{tagged_spreading = + lists_reverse(R1, TrUserData)}; +dfp_read_field_def_blockchain_region_spreading_v1_pb(Other, + Z1, Z2, F@_1, + TrUserData) -> + dg_read_field_def_blockchain_region_spreading_v1_pb(Other, + Z1, + Z2, + F@_1, + TrUserData). + +dg_read_field_def_blockchain_region_spreading_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_region_spreading_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +dg_read_field_def_blockchain_region_spreading_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> + d_field_blockchain_region_spreading_v1_pb_tagged_spreading(Rest, + 0, + 0, + F@_1, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_region_spreading_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 1 -> + skip_64_blockchain_region_spreading_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 2 -> + skip_length_delimited_blockchain_region_spreading_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData); + 3 -> + skip_group_blockchain_region_spreading_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + TrUserData); + 5 -> + skip_32_blockchain_region_spreading_v1_pb(Rest, + 0, + 0, + F@_1, + TrUserData) + end + end; +dg_read_field_def_blockchain_region_spreading_v1_pb(<<>>, + 0, 0, R1, TrUserData) -> + #blockchain_region_spreading_v1_pb{tagged_spreading = + lists_reverse(R1, TrUserData)}. + +d_field_blockchain_region_spreading_v1_pb_tagged_spreading(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, + TrUserData) + when N < 57 -> + d_field_blockchain_region_spreading_v1_pb_tagged_spreading(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +d_field_blockchain_region_spreading_v1_pb_tagged_spreading(<<0:1, + X:7, Rest/binary>>, + N, Acc, Prev, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_tagged_spreading_pb(Bs, TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_region_spreading_v1_pb(RestF, + 0, + 0, + cons(NewFValue, + Prev, + TrUserData), + TrUserData). + +skip_varint_blockchain_region_spreading_v1_pb(<<1:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + skip_varint_blockchain_region_spreading_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData); +skip_varint_blockchain_region_spreading_v1_pb(<<0:1, + _:7, Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_blockchain_region_spreading_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_length_delimited_blockchain_region_spreading_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, + TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_region_spreading_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + TrUserData); +skip_length_delimited_blockchain_region_spreading_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, + TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_region_spreading_v1_pb(Rest2, + 0, + 0, + F@_1, + TrUserData). + +skip_group_blockchain_region_spreading_v1_pb(Bin, FNum, + Z2, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_region_spreading_v1_pb(Rest, + 0, + Z2, + F@_1, + TrUserData). + +skip_32_blockchain_region_spreading_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_blockchain_region_spreading_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +skip_64_blockchain_region_spreading_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, TrUserData) -> + dfp_read_field_def_blockchain_region_spreading_v1_pb(Rest, + Z1, + Z2, + F@_1, + TrUserData). + +decode_msg_blockchain_region_param_v1_pb(Bin, + TrUserData) -> + dfp_read_field_def_blockchain_region_param_v1_pb(Bin, + 0, + 0, + id(0, TrUserData), + id(0, TrUserData), + id(0, TrUserData), + id(undefined, TrUserData), + TrUserData). + +dfp_read_field_def_blockchain_region_param_v1_pb(<<8, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + TrUserData) -> + d_field_blockchain_region_param_v1_pb_channel_frequency(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +dfp_read_field_def_blockchain_region_param_v1_pb(<<16, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + TrUserData) -> + d_field_blockchain_region_param_v1_pb_bandwidth(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +dfp_read_field_def_blockchain_region_param_v1_pb(<<24, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + TrUserData) -> + d_field_blockchain_region_param_v1_pb_max_eirp(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +dfp_read_field_def_blockchain_region_param_v1_pb(<<34, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + TrUserData) -> + d_field_blockchain_region_param_v1_pb_spreading(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +dfp_read_field_def_blockchain_region_param_v1_pb(<<>>, + 0, 0, F@_1, F@_2, F@_3, F@_4, + _) -> + #blockchain_region_param_v1_pb{channel_frequency = F@_1, + bandwidth = F@_2, max_eirp = F@_3, + spreading = F@_4}; +dfp_read_field_def_blockchain_region_param_v1_pb(Other, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + TrUserData) -> + dg_read_field_def_blockchain_region_param_v1_pb(Other, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData). + +dg_read_field_def_blockchain_region_param_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + TrUserData) + when N < 32 - 7 -> + dg_read_field_def_blockchain_region_param_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +dg_read_field_def_blockchain_region_param_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + TrUserData) -> + Key = X bsl N + Acc, + case Key of + 8 -> + d_field_blockchain_region_param_v1_pb_channel_frequency(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); + 16 -> + d_field_blockchain_region_param_v1_pb_bandwidth(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); + 24 -> + d_field_blockchain_region_param_v1_pb_max_eirp(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); + 34 -> + d_field_blockchain_region_param_v1_pb_spreading(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); + _ -> + case Key band 7 of + 0 -> + skip_varint_blockchain_region_param_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); + 1 -> + skip_64_blockchain_region_param_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); + 2 -> + skip_length_delimited_blockchain_region_param_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); + 3 -> + skip_group_blockchain_region_param_v1_pb(Rest, + Key bsr 3, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); + 5 -> + skip_32_blockchain_region_param_v1_pb(Rest, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData) + end + end; +dg_read_field_def_blockchain_region_param_v1_pb(<<>>, 0, + 0, F@_1, F@_2, F@_3, F@_4, _) -> + #blockchain_region_param_v1_pb{channel_frequency = F@_1, + bandwidth = F@_2, max_eirp = F@_3, + spreading = F@_4}. + +d_field_blockchain_region_param_v1_pb_channel_frequency(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, + F@_3, F@_4, TrUserData) + when N < 57 -> + d_field_blockchain_region_param_v1_pb_channel_frequency(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +d_field_blockchain_region_param_v1_pb_channel_frequency(<<0:1, + X:7, Rest/binary>>, + N, Acc, _, F@_2, F@_3, + F@_4, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_region_param_v1_pb(RestF, + 0, + 0, + NewFValue, + F@_2, + F@_3, + F@_4, + TrUserData). + +d_field_blockchain_region_param_v1_pb_bandwidth(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + TrUserData) + when N < 57 -> + d_field_blockchain_region_param_v1_pb_bandwidth(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +d_field_blockchain_region_param_v1_pb_bandwidth(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, _, F@_3, F@_4, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_region_param_v1_pb(RestF, + 0, + 0, + F@_1, + NewFValue, + F@_3, + F@_4, + TrUserData). + +d_field_blockchain_region_param_v1_pb_max_eirp(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + TrUserData) + when N < 57 -> + d_field_blockchain_region_param_v1_pb_max_eirp(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +d_field_blockchain_region_param_v1_pb_max_eirp(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, _, F@_4, + TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc, TrUserData), + Rest}, + dfp_read_field_def_blockchain_region_param_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + NewFValue, + F@_4, + TrUserData). + +d_field_blockchain_region_param_v1_pb_spreading(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, F@_4, + TrUserData) + when N < 57 -> + d_field_blockchain_region_param_v1_pb_spreading(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +d_field_blockchain_region_param_v1_pb_spreading(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, Prev, + TrUserData) -> + {NewFValue, RestF} = begin + Len = X bsl N + Acc, + <> = Rest, + {id(decode_msg_blockchain_region_spreading_v1_pb(Bs, + TrUserData), + TrUserData), + Rest2} + end, + dfp_read_field_def_blockchain_region_param_v1_pb(RestF, + 0, + 0, + F@_1, + F@_2, + F@_3, + if Prev == undefined -> + NewFValue; + true -> + merge_msg_blockchain_region_spreading_v1_pb(Prev, + NewFValue, + TrUserData) + end, + TrUserData). + +skip_varint_blockchain_region_param_v1_pb(<<1:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + TrUserData) -> + skip_varint_blockchain_region_param_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +skip_varint_blockchain_region_param_v1_pb(<<0:1, _:7, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + TrUserData) -> + dfp_read_field_def_blockchain_region_param_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData). + +skip_length_delimited_blockchain_region_param_v1_pb(<<1:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, TrUserData) + when N < 57 -> + skip_length_delimited_blockchain_region_param_v1_pb(Rest, + N + 7, + X bsl N + Acc, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData); +skip_length_delimited_blockchain_region_param_v1_pb(<<0:1, + X:7, Rest/binary>>, + N, Acc, F@_1, F@_2, F@_3, + F@_4, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_blockchain_region_param_v1_pb(Rest2, + 0, + 0, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData). + +skip_group_blockchain_region_param_v1_pb(Bin, FNum, Z2, + F@_1, F@_2, F@_3, F@_4, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_blockchain_region_param_v1_pb(Rest, + 0, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData). + +skip_32_blockchain_region_param_v1_pb(<<_:32, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + TrUserData) -> + dfp_read_field_def_blockchain_region_param_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData). + +skip_64_blockchain_region_param_v1_pb(<<_:64, + Rest/binary>>, + Z1, Z2, F@_1, F@_2, F@_3, F@_4, + TrUserData) -> + dfp_read_field_def_blockchain_region_param_v1_pb(Rest, + Z1, + Z2, + F@_1, + F@_2, + F@_3, + F@_4, + TrUserData). + +'d_enum_helium.close_state'(0) -> close_state_closable; +'d_enum_helium.close_state'(1) -> close_state_closing; +'d_enum_helium.close_state'(2) -> close_state_closed; +'d_enum_helium.close_state'(3) -> close_state_dispute; +'d_enum_helium.close_state'(V) -> V. + +'d_enum_helium.blockchain_state_channel_state_v1'(0) -> + open; +'d_enum_helium.blockchain_state_channel_state_v1'(1) -> + closed; +'d_enum_helium.blockchain_state_channel_state_v1'(V) -> + V. + +'d_enum_packet_pb.packet_type'(0) -> longfi; +'d_enum_packet_pb.packet_type'(1) -> lorawan; +'d_enum_packet_pb.packet_type'(V) -> V. + +'d_enum_helium.region'(0) -> 'US915'; +'d_enum_helium.region'(1) -> 'EU868'; +'d_enum_helium.region'(2) -> 'EU433'; +'d_enum_helium.region'(3) -> 'CN470'; +'d_enum_helium.region'(4) -> 'CN779'; +'d_enum_helium.region'(5) -> 'AU915'; +'d_enum_helium.region'(6) -> 'AS923_1'; +'d_enum_helium.region'(7) -> 'KR920'; +'d_enum_helium.region'(8) -> 'IN865'; +'d_enum_helium.region'(9) -> 'AS923_2'; +'d_enum_helium.region'(10) -> 'AS923_3'; +'d_enum_helium.region'(11) -> 'AS923_4'; +'d_enum_helium.region'(V) -> V. + +'d_enum_helium.origin'(0) -> p2p; +'d_enum_helium.origin'(1) -> radio; +'d_enum_helium.origin'(V) -> V. + +'d_enum_helium.RegionSpreading'(0) -> 'SF_INVALID'; +'d_enum_helium.RegionSpreading'(1) -> 'SF7'; +'d_enum_helium.RegionSpreading'(2) -> 'SF8'; +'d_enum_helium.RegionSpreading'(3) -> 'SF9'; +'d_enum_helium.RegionSpreading'(4) -> 'SF10'; +'d_enum_helium.RegionSpreading'(5) -> 'SF11'; +'d_enum_helium.RegionSpreading'(6) -> 'SF12'; +'d_enum_helium.RegionSpreading'(V) -> V. + +read_group(Bin, FieldNum) -> + {NumBytes, EndTagLen} = read_gr_b(Bin, 0, 0, 0, 0, FieldNum), + <> = Bin, + {Group, Rest}. + +%% Like skipping over fields, but record the total length, +%% Each field is <(FieldNum bsl 3) bor FieldType> ++ +%% Record the length because varints may be non-optimally encoded. +%% +%% Groups can be nested, but assume the same FieldNum cannot be nested +%% because group field numbers are shared with the rest of the fields +%% numbers. Thus we can search just for an group-end with the same +%% field number. +%% +%% (The only time the same group field number could occur would +%% be in a nested sub message, but then it would be inside a +%% length-delimited entry, which we skip-read by length.) +read_gr_b(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, FieldNum) + when N < (32-7) -> + read_gr_b(Tl, N+7, X bsl N + Acc, NumBytes, TagLen+1, FieldNum); +read_gr_b(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, + FieldNum) -> + Key = X bsl N + Acc, + TagLen1 = TagLen + 1, + case {Key bsr 3, Key band 7} of + {FieldNum, 4} -> % 4 = group_end + {NumBytes, TagLen1}; + {_, 0} -> % 0 = varint + read_gr_vi(Tl, 0, NumBytes + TagLen1, FieldNum); + {_, 1} -> % 1 = bits64 + <<_:64, Tl2/binary>> = Tl, + read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 8, 0, FieldNum); + {_, 2} -> % 2 = length_delimited + read_gr_ld(Tl, 0, 0, NumBytes + TagLen1, FieldNum); + {_, 3} -> % 3 = group_start + read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); + {_, 4} -> % 4 = group_end + read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); + {_, 5} -> % 5 = bits32 + <<_:32, Tl2/binary>> = Tl, + read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 4, 0, FieldNum) + end. + +read_gr_vi(<<1:1, _:7, Tl/binary>>, N, NumBytes, FieldNum) + when N < (64-7) -> + read_gr_vi(Tl, N+7, NumBytes+1, FieldNum); +read_gr_vi(<<0:1, _:7, Tl/binary>>, _, NumBytes, FieldNum) -> + read_gr_b(Tl, 0, 0, NumBytes+1, 0, FieldNum). + +read_gr_ld(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) + when N < (64-7) -> + read_gr_ld(Tl, N+7, X bsl N + Acc, NumBytes+1, FieldNum); +read_gr_ld(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) -> + Len = X bsl N + Acc, + NumBytes1 = NumBytes + 1, + <<_:Len/binary, Tl2/binary>> = Tl, + read_gr_b(Tl2, 0, 0, NumBytes1 + Len, 0, FieldNum). + +merge_msgs(Prev, New) + when element(1, Prev) =:= element(1, New) -> + merge_msgs(Prev, New, element(1, Prev), []). + +merge_msgs(Prev, New, MsgName) when is_atom(MsgName) -> + merge_msgs(Prev, New, MsgName, []); +merge_msgs(Prev, New, Opts) + when element(1, Prev) =:= element(1, New), + is_list(Opts) -> + merge_msgs(Prev, New, element(1, Prev), Opts). + +merge_msgs(Prev, New, MsgName, Opts) -> + TrUserData = proplists:get_value(user_data, Opts), + case MsgName of + empty_pb -> merge_msg_empty_pb(Prev, New, TrUserData); + gateway_success_resp_pb -> + merge_msg_gateway_success_resp_pb(Prev, + New, + TrUserData); + gateway_error_resp_pb -> + merge_msg_gateway_error_resp_pb(Prev, New, TrUserData); + gateway_config_req_v1_pb -> + merge_msg_gateway_config_req_v1_pb(Prev, + New, + TrUserData); + gateway_config_resp_v1_pb -> + merge_msg_gateway_config_resp_v1_pb(Prev, + New, + TrUserData); + gateway_config_update_req_v1_pb -> + merge_msg_gateway_config_update_req_v1_pb(Prev, + New, + TrUserData); + gateway_config_update_streamed_resp_v1_pb -> + merge_msg_gateway_config_update_streamed_resp_v1_pb(Prev, + New, + TrUserData); + gateway_validators_req_v1_pb -> + merge_msg_gateway_validators_req_v1_pb(Prev, + New, + TrUserData); + gateway_validators_resp_v1_pb -> + merge_msg_gateway_validators_resp_v1_pb(Prev, + New, + TrUserData); + gateway_region_params_streamed_resp_v1_pb -> + merge_msg_gateway_region_params_streamed_resp_v1_pb(Prev, + New, + TrUserData); + gateway_region_params_update_req_v1_pb -> + merge_msg_gateway_region_params_update_req_v1_pb(Prev, + New, + TrUserData); + gateway_resp_v1_pb -> + merge_msg_gateway_resp_v1_pb(Prev, New, TrUserData); + gateway_sc_is_active_req_v1_pb -> + merge_msg_gateway_sc_is_active_req_v1_pb(Prev, + New, + TrUserData); + gateway_sc_is_active_resp_v1_pb -> + merge_msg_gateway_sc_is_active_resp_v1_pb(Prev, + New, + TrUserData); + gateway_sc_is_overpaid_req_v1_pb -> + merge_msg_gateway_sc_is_overpaid_req_v1_pb(Prev, + New, + TrUserData); + gateway_sc_is_overpaid_resp_v1_pb -> + merge_msg_gateway_sc_is_overpaid_resp_v1_pb(Prev, + New, + TrUserData); + gateway_sc_close_req_v1_pb -> + merge_msg_gateway_sc_close_req_v1_pb(Prev, + New, + TrUserData); + gateway_sc_close_resp_v1_pb -> + merge_msg_gateway_sc_close_resp_v1_pb(Prev, + New, + TrUserData); + gateway_sc_follow_req_v1_pb -> + merge_msg_gateway_sc_follow_req_v1_pb(Prev, + New, + TrUserData); + gateway_sc_follow_streamed_resp_v1_pb -> + merge_msg_gateway_sc_follow_streamed_resp_v1_pb(Prev, + New, + TrUserData); + routing_pb -> + merge_msg_routing_pb(Prev, New, TrUserData); + routing_address_pb -> + merge_msg_routing_address_pb(Prev, New, TrUserData); + gateway_routing_req_v1_pb -> + merge_msg_gateway_routing_req_v1_pb(Prev, + New, + TrUserData); + gateway_routing_streamed_resp_v1_pb -> + merge_msg_gateway_routing_streamed_resp_v1_pb(Prev, + New, + TrUserData); + gateway_poc_req_v1_pb -> + merge_msg_gateway_poc_req_v1_pb(Prev, New, TrUserData); + gateway_poc_challenge_notification_resp_v1_pb -> + merge_msg_gateway_poc_challenge_notification_resp_v1_pb(Prev, + New, + TrUserData); + gateway_poc_check_challenge_target_req_v1_pb -> + merge_msg_gateway_poc_check_challenge_target_req_v1_pb(Prev, + New, + TrUserData); + gateway_poc_check_challenge_target_resp_v1_pb -> + merge_msg_gateway_poc_check_challenge_target_resp_v1_pb(Prev, + New, + TrUserData); + gateway_poc_report_req_v1_pb -> + merge_msg_gateway_poc_report_req_v1_pb(Prev, + New, + TrUserData); + gateway_address_routing_data_req_v1_pb -> + merge_msg_gateway_address_routing_data_req_v1_pb(Prev, + New, + TrUserData); + gateway_poc_key_routing_data_req_v1_pb -> + merge_msg_gateway_poc_key_routing_data_req_v1_pb(Prev, + New, + TrUserData); + gateway_public_routing_data_resp_v1_pb -> + merge_msg_gateway_public_routing_data_resp_v1_pb(Prev, + New, + TrUserData); + blockchain_state_channel_summary_v1_pb -> + merge_msg_blockchain_state_channel_summary_v1_pb(Prev, + New, + TrUserData); + blockchain_state_channel_v1_pb -> + merge_msg_blockchain_state_channel_v1_pb(Prev, + New, + TrUserData); + blockchain_state_channel_response_v1_pb -> + merge_msg_blockchain_state_channel_response_v1_pb(Prev, + New, + TrUserData); + blockchain_state_channel_packet_v1_pb -> + merge_msg_blockchain_state_channel_packet_v1_pb(Prev, + New, + TrUserData); + blockchain_state_channel_offer_v1_pb -> + merge_msg_blockchain_state_channel_offer_v1_pb(Prev, + New, + TrUserData); + blockchain_state_channel_purchase_v1_pb -> + merge_msg_blockchain_state_channel_purchase_v1_pb(Prev, + New, + TrUserData); + blockchain_state_channel_diff_v1_pb -> + merge_msg_blockchain_state_channel_diff_v1_pb(Prev, + New, + TrUserData); + blockchain_state_channel_diff_entry_v1_pb -> + merge_msg_blockchain_state_channel_diff_entry_v1_pb(Prev, + New, + TrUserData); + blockchain_state_channel_diff_append_summary_v1_pb -> + merge_msg_blockchain_state_channel_diff_append_summary_v1_pb(Prev, + New, + TrUserData); + blockchain_state_channel_diff_update_summary_v1_pb -> + merge_msg_blockchain_state_channel_diff_update_summary_v1_pb(Prev, + New, + TrUserData); + blockchain_state_channel_banner_v1_pb -> + merge_msg_blockchain_state_channel_banner_v1_pb(Prev, + New, + TrUserData); + blockchain_state_channel_rejection_v1_pb -> + merge_msg_blockchain_state_channel_rejection_v1_pb(Prev, + New, + TrUserData); + blockchain_state_channel_message_v1_pb -> + merge_msg_blockchain_state_channel_message_v1_pb(Prev, + New, + TrUserData); + eui_pb -> merge_msg_eui_pb(Prev, New, TrUserData); + routing_information_pb -> + merge_msg_routing_information_pb(Prev, New, TrUserData); + window_pb -> merge_msg_window_pb(Prev, New, TrUserData); + packet_pb -> merge_msg_packet_pb(Prev, New, TrUserData); + blockchain_txn_state_channel_close_v1_pb -> + merge_msg_blockchain_txn_state_channel_close_v1_pb(Prev, + New, + TrUserData); + blockchain_var_v1_pb -> + merge_msg_blockchain_var_v1_pb(Prev, New, TrUserData); + blockchain_txn_vars_v1_pb -> + merge_msg_blockchain_txn_vars_v1_pb(Prev, + New, + TrUserData); + blockchain_txn_poc_receipts_v1_pb -> + merge_msg_blockchain_txn_poc_receipts_v1_pb(Prev, + New, + TrUserData); + blockchain_poc_receipt_v1_pb -> + merge_msg_blockchain_poc_receipt_v1_pb(Prev, + New, + TrUserData); + blockchain_poc_witness_v1_pb -> + merge_msg_blockchain_poc_witness_v1_pb(Prev, + New, + TrUserData); + blockchain_poc_response_v1_pb -> + merge_msg_blockchain_poc_response_v1_pb(Prev, + New, + TrUserData); + blockchain_poc_path_element_v1_pb -> + merge_msg_blockchain_poc_path_element_v1_pb(Prev, + New, + TrUserData); + blockchain_txn_poc_receipts_v2_pb -> + merge_msg_blockchain_txn_poc_receipts_v2_pb(Prev, + New, + TrUserData); + blockchain_region_params_v1_pb -> + merge_msg_blockchain_region_params_v1_pb(Prev, + New, + TrUserData); + tagged_spreading_pb -> + merge_msg_tagged_spreading_pb(Prev, New, TrUserData); + blockchain_region_spreading_v1_pb -> + merge_msg_blockchain_region_spreading_v1_pb(Prev, + New, + TrUserData); + blockchain_region_param_v1_pb -> + merge_msg_blockchain_region_param_v1_pb(Prev, + New, + TrUserData) + end. + +-compile({nowarn_unused_function,merge_msg_empty_pb/3}). +merge_msg_empty_pb(_Prev, New, _TrUserData) -> New. + +-compile({nowarn_unused_function,merge_msg_gateway_success_resp_pb/3}). +merge_msg_gateway_success_resp_pb(#gateway_success_resp_pb{resp + = PFresp, + details = PFdetails}, + #gateway_success_resp_pb{resp = NFresp, + details = NFdetails}, + _) -> + #gateway_success_resp_pb{resp = + if NFresp =:= undefined -> PFresp; + true -> NFresp + end, + details = + if NFdetails =:= undefined -> PFdetails; + true -> NFdetails + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_error_resp_pb/3}). +merge_msg_gateway_error_resp_pb(#gateway_error_resp_pb{error + = PFerror, + details = PFdetails}, + #gateway_error_resp_pb{error = NFerror, + details = NFdetails}, + _) -> + #gateway_error_resp_pb{error = + if NFerror =:= undefined -> PFerror; + true -> NFerror + end, + details = + if NFdetails =:= undefined -> PFdetails; + true -> NFdetails + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_config_req_v1_pb/3}). +merge_msg_gateway_config_req_v1_pb(#gateway_config_req_v1_pb{keys + = PFkeys}, + #gateway_config_req_v1_pb{keys = NFkeys}, + TrUserData) -> + #gateway_config_req_v1_pb{keys = + if PFkeys /= undefined, NFkeys /= undefined -> + 'erlang_++'(PFkeys, + NFkeys, + TrUserData); + PFkeys == undefined -> NFkeys; + NFkeys == undefined -> PFkeys + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_config_resp_v1_pb/3}). +merge_msg_gateway_config_resp_v1_pb(#gateway_config_resp_v1_pb{result + = PFresult}, + #gateway_config_resp_v1_pb{result = + NFresult}, + TrUserData) -> + #gateway_config_resp_v1_pb{result = + if PFresult /= undefined, + NFresult /= undefined -> + 'erlang_++'(PFresult, + NFresult, + TrUserData); + PFresult == undefined -> NFresult; + NFresult == undefined -> PFresult + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_config_update_req_v1_pb/3}). +merge_msg_gateway_config_update_req_v1_pb(_Prev, New, + _TrUserData) -> + New. + +-compile({nowarn_unused_function,merge_msg_gateway_config_update_streamed_resp_v1_pb/3}). +merge_msg_gateway_config_update_streamed_resp_v1_pb(#gateway_config_update_streamed_resp_v1_pb{keys + = + PFkeys}, + #gateway_config_update_streamed_resp_v1_pb{keys + = + NFkeys}, + TrUserData) -> + #gateway_config_update_streamed_resp_v1_pb{keys = + if PFkeys /= undefined, + NFkeys /= undefined -> + 'erlang_++'(PFkeys, + NFkeys, + TrUserData); + PFkeys == undefined -> + NFkeys; + NFkeys == undefined -> + PFkeys + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_validators_req_v1_pb/3}). +merge_msg_gateway_validators_req_v1_pb(#gateway_validators_req_v1_pb{quantity + = + PFquantity}, + #gateway_validators_req_v1_pb{quantity = + NFquantity}, + _) -> + #gateway_validators_req_v1_pb{quantity = + if NFquantity =:= undefined -> PFquantity; + true -> NFquantity + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_validators_resp_v1_pb/3}). +merge_msg_gateway_validators_resp_v1_pb(#gateway_validators_resp_v1_pb{result + = + PFresult}, + #gateway_validators_resp_v1_pb{result = + NFresult}, + TrUserData) -> + #gateway_validators_resp_v1_pb{result = + if PFresult /= undefined, + NFresult /= undefined -> + 'erlang_++'(PFresult, + NFresult, + TrUserData); + PFresult == undefined -> NFresult; + NFresult == undefined -> PFresult + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_region_params_streamed_resp_v1_pb/3}). +merge_msg_gateway_region_params_streamed_resp_v1_pb(#gateway_region_params_streamed_resp_v1_pb{address + = + PFaddress, + region + = + PFregion, + params + = + PFparams}, + #gateway_region_params_streamed_resp_v1_pb{address + = + NFaddress, + region + = + NFregion, + params + = + NFparams}, + TrUserData) -> + #gateway_region_params_streamed_resp_v1_pb{address = + if NFaddress =:= undefined -> + PFaddress; + true -> NFaddress + end, + region = + if NFregion =:= undefined -> + PFregion; + true -> NFregion + end, + params = + if PFparams /= undefined, + NFparams /= undefined -> + merge_msg_blockchain_region_params_v1_pb(PFparams, + NFparams, + TrUserData); + PFparams == undefined -> + NFparams; + NFparams == undefined -> + PFparams + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_region_params_update_req_v1_pb/3}). +merge_msg_gateway_region_params_update_req_v1_pb(#gateway_region_params_update_req_v1_pb{address + = + PFaddress, + signature + = + PFsignature}, + #gateway_region_params_update_req_v1_pb{address + = + NFaddress, + signature + = + NFsignature}, + _) -> + #gateway_region_params_update_req_v1_pb{address = + if NFaddress =:= undefined -> + PFaddress; + true -> NFaddress + end, + signature = + if NFsignature =:= undefined -> + PFsignature; + true -> NFsignature + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_resp_v1_pb/3}). +merge_msg_gateway_resp_v1_pb(#gateway_resp_v1_pb{height + = PFheight, + signature = PFsignature, + msg = PFmsg, + block_time = PFblock_time, + block_age = PFblock_age}, + #gateway_resp_v1_pb{height = NFheight, + signature = NFsignature, + msg = NFmsg, + block_time = NFblock_time, + block_age = NFblock_age}, + TrUserData) -> + #gateway_resp_v1_pb{height = + if NFheight =:= undefined -> PFheight; + true -> NFheight + end, + signature = + if NFsignature =:= undefined -> PFsignature; + true -> NFsignature + end, + msg = + case {PFmsg, NFmsg} of + {{is_active_resp, OPFmsg}, + {is_active_resp, ONFmsg}} -> + {is_active_resp, + merge_msg_gateway_sc_is_active_resp_v1_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {{is_overpaid_resp, OPFmsg}, + {is_overpaid_resp, ONFmsg}} -> + {is_overpaid_resp, + merge_msg_gateway_sc_is_overpaid_resp_v1_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {{close_resp, OPFmsg}, {close_resp, ONFmsg}} -> + {close_resp, + merge_msg_gateway_sc_close_resp_v1_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {{follow_streamed_resp, OPFmsg}, + {follow_streamed_resp, ONFmsg}} -> + {follow_streamed_resp, + merge_msg_gateway_sc_follow_streamed_resp_v1_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {{routing_streamed_resp, OPFmsg}, + {routing_streamed_resp, ONFmsg}} -> + {routing_streamed_resp, + merge_msg_gateway_routing_streamed_resp_v1_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {{config_resp, OPFmsg}, + {config_resp, ONFmsg}} -> + {config_resp, + merge_msg_gateway_config_resp_v1_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {{config_update_streamed_resp, OPFmsg}, + {config_update_streamed_resp, ONFmsg}} -> + {config_update_streamed_resp, + merge_msg_gateway_config_update_streamed_resp_v1_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {{validators_resp, OPFmsg}, + {validators_resp, ONFmsg}} -> + {validators_resp, + merge_msg_gateway_validators_resp_v1_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {{region_params_streamed_resp, OPFmsg}, + {region_params_streamed_resp, ONFmsg}} -> + {region_params_streamed_resp, + merge_msg_gateway_region_params_streamed_resp_v1_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {{success_resp, OPFmsg}, + {success_resp, ONFmsg}} -> + {success_resp, + merge_msg_gateway_success_resp_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {{error_resp, OPFmsg}, {error_resp, ONFmsg}} -> + {error_resp, + merge_msg_gateway_error_resp_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {{poc_challenge_resp, OPFmsg}, + {poc_challenge_resp, ONFmsg}} -> + {poc_challenge_resp, + merge_msg_gateway_poc_challenge_notification_resp_v1_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {{poc_check_target_resp, OPFmsg}, + {poc_check_target_resp, ONFmsg}} -> + {poc_check_target_resp, + merge_msg_gateway_poc_check_challenge_target_resp_v1_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {{public_route, OPFmsg}, + {public_route, ONFmsg}} -> + {public_route, + merge_msg_gateway_public_routing_data_resp_v1_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {_, undefined} -> PFmsg; + _ -> NFmsg + end, + block_time = + if NFblock_time =:= undefined -> PFblock_time; + true -> NFblock_time + end, + block_age = + if NFblock_age =:= undefined -> PFblock_age; + true -> NFblock_age + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_sc_is_active_req_v1_pb/3}). +merge_msg_gateway_sc_is_active_req_v1_pb(#gateway_sc_is_active_req_v1_pb{sc_id + = + PFsc_id, + sc_owner + = + PFsc_owner}, + #gateway_sc_is_active_req_v1_pb{sc_id = + NFsc_id, + sc_owner + = + NFsc_owner}, + _) -> + #gateway_sc_is_active_req_v1_pb{sc_id = + if NFsc_id =:= undefined -> PFsc_id; + true -> NFsc_id + end, + sc_owner = + if NFsc_owner =:= undefined -> + PFsc_owner; + true -> NFsc_owner + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_sc_is_active_resp_v1_pb/3}). +merge_msg_gateway_sc_is_active_resp_v1_pb(#gateway_sc_is_active_resp_v1_pb{sc_id + = + PFsc_id, + sc_owner + = + PFsc_owner, + active + = + PFactive, + sc_expiry_at_block + = + PFsc_expiry_at_block, + sc_original_dc_amount + = + PFsc_original_dc_amount}, + #gateway_sc_is_active_resp_v1_pb{sc_id + = + NFsc_id, + sc_owner + = + NFsc_owner, + active + = + NFactive, + sc_expiry_at_block + = + NFsc_expiry_at_block, + sc_original_dc_amount + = + NFsc_original_dc_amount}, + _) -> + #gateway_sc_is_active_resp_v1_pb{sc_id = + if NFsc_id =:= undefined -> PFsc_id; + true -> NFsc_id + end, + sc_owner = + if NFsc_owner =:= undefined -> + PFsc_owner; + true -> NFsc_owner + end, + active = + if NFactive =:= undefined -> PFactive; + true -> NFactive + end, + sc_expiry_at_block = + if NFsc_expiry_at_block =:= + undefined -> + PFsc_expiry_at_block; + true -> NFsc_expiry_at_block + end, + sc_original_dc_amount = + if NFsc_original_dc_amount =:= + undefined -> + PFsc_original_dc_amount; + true -> NFsc_original_dc_amount + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_sc_is_overpaid_req_v1_pb/3}). +merge_msg_gateway_sc_is_overpaid_req_v1_pb(#gateway_sc_is_overpaid_req_v1_pb{sc_id + = + PFsc_id, + sc_owner + = + PFsc_owner, + total_dcs + = + PFtotal_dcs}, + #gateway_sc_is_overpaid_req_v1_pb{sc_id + = + NFsc_id, + sc_owner + = + NFsc_owner, + total_dcs + = + NFtotal_dcs}, + _) -> + #gateway_sc_is_overpaid_req_v1_pb{sc_id = + if NFsc_id =:= undefined -> PFsc_id; + true -> NFsc_id + end, + sc_owner = + if NFsc_owner =:= undefined -> + PFsc_owner; + true -> NFsc_owner + end, + total_dcs = + if NFtotal_dcs =:= undefined -> + PFtotal_dcs; + true -> NFtotal_dcs + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_sc_is_overpaid_resp_v1_pb/3}). +merge_msg_gateway_sc_is_overpaid_resp_v1_pb(#gateway_sc_is_overpaid_resp_v1_pb{sc_id + = + PFsc_id, + sc_owner + = + PFsc_owner, + overpaid + = + PFoverpaid}, + #gateway_sc_is_overpaid_resp_v1_pb{sc_id + = + NFsc_id, + sc_owner + = + NFsc_owner, + overpaid + = + NFoverpaid}, + _) -> + #gateway_sc_is_overpaid_resp_v1_pb{sc_id = + if NFsc_id =:= undefined -> PFsc_id; + true -> NFsc_id + end, + sc_owner = + if NFsc_owner =:= undefined -> + PFsc_owner; + true -> NFsc_owner + end, + overpaid = + if NFoverpaid =:= undefined -> + PFoverpaid; + true -> NFoverpaid + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_sc_close_req_v1_pb/3}). +merge_msg_gateway_sc_close_req_v1_pb(#gateway_sc_close_req_v1_pb{close_txn + = + PFclose_txn}, + #gateway_sc_close_req_v1_pb{close_txn = + NFclose_txn}, + TrUserData) -> + #gateway_sc_close_req_v1_pb{close_txn = + if PFclose_txn /= undefined, + NFclose_txn /= undefined -> + merge_msg_blockchain_txn_state_channel_close_v1_pb(PFclose_txn, + NFclose_txn, + TrUserData); + PFclose_txn == undefined -> NFclose_txn; + NFclose_txn == undefined -> PFclose_txn + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_sc_close_resp_v1_pb/3}). +merge_msg_gateway_sc_close_resp_v1_pb(#gateway_sc_close_resp_v1_pb{sc_id + = + PFsc_id, + response = + PFresponse}, + #gateway_sc_close_resp_v1_pb{sc_id = + NFsc_id, + response = + NFresponse}, + _) -> + #gateway_sc_close_resp_v1_pb{sc_id = + if NFsc_id =:= undefined -> PFsc_id; + true -> NFsc_id + end, + response = + if NFresponse =:= undefined -> PFresponse; + true -> NFresponse + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_sc_follow_req_v1_pb/3}). +merge_msg_gateway_sc_follow_req_v1_pb(#gateway_sc_follow_req_v1_pb{sc_id + = + PFsc_id, + sc_owner = + PFsc_owner}, + #gateway_sc_follow_req_v1_pb{sc_id = + NFsc_id, + sc_owner = + NFsc_owner}, + _) -> + #gateway_sc_follow_req_v1_pb{sc_id = + if NFsc_id =:= undefined -> PFsc_id; + true -> NFsc_id + end, + sc_owner = + if NFsc_owner =:= undefined -> PFsc_owner; + true -> NFsc_owner + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_sc_follow_streamed_resp_v1_pb/3}). +merge_msg_gateway_sc_follow_streamed_resp_v1_pb(#gateway_sc_follow_streamed_resp_v1_pb{sc_id + = + PFsc_id, + sc_owner + = + PFsc_owner, + close_state + = + PFclose_state}, + #gateway_sc_follow_streamed_resp_v1_pb{sc_id + = + NFsc_id, + sc_owner + = + NFsc_owner, + close_state + = + NFclose_state}, + _) -> + #gateway_sc_follow_streamed_resp_v1_pb{sc_id = + if NFsc_id =:= undefined -> + PFsc_id; + true -> NFsc_id + end, + sc_owner = + if NFsc_owner =:= undefined -> + PFsc_owner; + true -> NFsc_owner + end, + close_state = + if NFclose_state =:= undefined -> + PFclose_state; + true -> NFclose_state + end}. + +-compile({nowarn_unused_function,merge_msg_routing_pb/3}). +merge_msg_routing_pb(#routing_pb{oui = PFoui, + owner = PFowner, addresses = PFaddresses, + filters = PFfilters, subnets = PFsubnets}, + #routing_pb{oui = NFoui, owner = NFowner, + addresses = NFaddresses, filters = NFfilters, + subnets = NFsubnets}, + TrUserData) -> + #routing_pb{oui = + if NFoui =:= undefined -> PFoui; + true -> NFoui + end, + owner = + if NFowner =:= undefined -> PFowner; + true -> NFowner + end, + addresses = + if PFaddresses /= undefined, NFaddresses /= undefined -> + 'erlang_++'(PFaddresses, NFaddresses, TrUserData); + PFaddresses == undefined -> NFaddresses; + NFaddresses == undefined -> PFaddresses + end, + filters = + if PFfilters /= undefined, NFfilters /= undefined -> + 'erlang_++'(PFfilters, NFfilters, TrUserData); + PFfilters == undefined -> NFfilters; + NFfilters == undefined -> PFfilters + end, + subnets = + if PFsubnets /= undefined, NFsubnets /= undefined -> + 'erlang_++'(PFsubnets, NFsubnets, TrUserData); + PFsubnets == undefined -> NFsubnets; + NFsubnets == undefined -> PFsubnets + end}. + +-compile({nowarn_unused_function,merge_msg_routing_address_pb/3}). +merge_msg_routing_address_pb(#routing_address_pb{pub_key + = PFpub_key, + uri = PFuri}, + #routing_address_pb{pub_key = NFpub_key, + uri = NFuri}, + _) -> + #routing_address_pb{pub_key = + if NFpub_key =:= undefined -> PFpub_key; + true -> NFpub_key + end, + uri = + if NFuri =:= undefined -> PFuri; + true -> NFuri + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_routing_req_v1_pb/3}). +merge_msg_gateway_routing_req_v1_pb(#gateway_routing_req_v1_pb{height + = PFheight}, + #gateway_routing_req_v1_pb{height = + NFheight}, + _) -> + #gateway_routing_req_v1_pb{height = + if NFheight =:= undefined -> PFheight; + true -> NFheight + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_routing_streamed_resp_v1_pb/3}). +merge_msg_gateway_routing_streamed_resp_v1_pb(#gateway_routing_streamed_resp_v1_pb{routings + = + PFroutings}, + #gateway_routing_streamed_resp_v1_pb{routings + = + NFroutings}, + TrUserData) -> + #gateway_routing_streamed_resp_v1_pb{routings = + if PFroutings /= undefined, + NFroutings /= undefined -> + 'erlang_++'(PFroutings, + NFroutings, + TrUserData); + PFroutings == undefined -> + NFroutings; + NFroutings == undefined -> + PFroutings + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_poc_req_v1_pb/3}). +merge_msg_gateway_poc_req_v1_pb(#gateway_poc_req_v1_pb{address + = PFaddress, + signature = PFsignature}, + #gateway_poc_req_v1_pb{address = NFaddress, + signature = NFsignature}, + _) -> + #gateway_poc_req_v1_pb{address = + if NFaddress =:= undefined -> PFaddress; + true -> NFaddress + end, + signature = + if NFsignature =:= undefined -> PFsignature; + true -> NFsignature + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_poc_challenge_notification_resp_v1_pb/3}). +merge_msg_gateway_poc_challenge_notification_resp_v1_pb(#gateway_poc_challenge_notification_resp_v1_pb{challenger + = + PFchallenger, + block_hash + = + PFblock_hash, + onion_key_hash + = + PFonion_key_hash}, + #gateway_poc_challenge_notification_resp_v1_pb{challenger + = + NFchallenger, + block_hash + = + NFblock_hash, + onion_key_hash + = + NFonion_key_hash}, + TrUserData) -> + #gateway_poc_challenge_notification_resp_v1_pb{challenger + = + if PFchallenger /= + undefined, + NFchallenger /= + undefined -> + merge_msg_routing_address_pb(PFchallenger, + NFchallenger, + TrUserData); + PFchallenger == + undefined -> + NFchallenger; + NFchallenger == + undefined -> + PFchallenger + end, + block_hash = + if NFblock_hash =:= + undefined -> + PFblock_hash; + true -> NFblock_hash + end, + onion_key_hash = + if NFonion_key_hash =:= + undefined -> + PFonion_key_hash; + true -> + NFonion_key_hash + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_poc_check_challenge_target_req_v1_pb/3}). +merge_msg_gateway_poc_check_challenge_target_req_v1_pb(#gateway_poc_check_challenge_target_req_v1_pb{address + = + PFaddress, + challenger + = + PFchallenger, + block_hash + = + PFblock_hash, + onion_key_hash + = + PFonion_key_hash, + height + = + PFheight, + notifier + = + PFnotifier, + notifier_sig + = + PFnotifier_sig, + challengee_sig + = + PFchallengee_sig}, + #gateway_poc_check_challenge_target_req_v1_pb{address + = + NFaddress, + challenger + = + NFchallenger, + block_hash + = + NFblock_hash, + onion_key_hash + = + NFonion_key_hash, + height + = + NFheight, + notifier + = + NFnotifier, + notifier_sig + = + NFnotifier_sig, + challengee_sig + = + NFchallengee_sig}, + _) -> + #gateway_poc_check_challenge_target_req_v1_pb{address = + if NFaddress =:= + undefined -> + PFaddress; + true -> NFaddress + end, + challenger = + if NFchallenger =:= + undefined -> + PFchallenger; + true -> NFchallenger + end, + block_hash = + if NFblock_hash =:= + undefined -> + PFblock_hash; + true -> NFblock_hash + end, + onion_key_hash = + if NFonion_key_hash =:= + undefined -> + PFonion_key_hash; + true -> + NFonion_key_hash + end, + height = + if NFheight =:= + undefined -> + PFheight; + true -> NFheight + end, + notifier = + if NFnotifier =:= + undefined -> + PFnotifier; + true -> NFnotifier + end, + notifier_sig = + if NFnotifier_sig =:= + undefined -> + PFnotifier_sig; + true -> NFnotifier_sig + end, + challengee_sig = + if NFchallengee_sig =:= + undefined -> + PFchallengee_sig; + true -> + NFchallengee_sig + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_poc_check_challenge_target_resp_v1_pb/3}). +merge_msg_gateway_poc_check_challenge_target_resp_v1_pb(#gateway_poc_check_challenge_target_resp_v1_pb{target + = + PFtarget, + onion + = + PFonion}, + #gateway_poc_check_challenge_target_resp_v1_pb{target + = + NFtarget, + onion + = + NFonion}, + _) -> + #gateway_poc_check_challenge_target_resp_v1_pb{target = + if NFtarget =:= + undefined -> + PFtarget; + true -> NFtarget + end, + onion = + if NFonion =:= + undefined -> + PFonion; + true -> NFonion + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_poc_report_req_v1_pb/3}). +merge_msg_gateway_poc_report_req_v1_pb(#gateway_poc_report_req_v1_pb{onion_key_hash + = + PFonion_key_hash, + msg = + PFmsg}, + #gateway_poc_report_req_v1_pb{onion_key_hash + = + NFonion_key_hash, + msg = + NFmsg}, + TrUserData) -> + #gateway_poc_report_req_v1_pb{onion_key_hash = + if NFonion_key_hash =:= undefined -> + PFonion_key_hash; + true -> NFonion_key_hash + end, + msg = + case {PFmsg, NFmsg} of + {{receipt, OPFmsg}, + {receipt, ONFmsg}} -> + {receipt, + merge_msg_blockchain_poc_receipt_v1_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {{witness, OPFmsg}, + {witness, ONFmsg}} -> + {witness, + merge_msg_blockchain_poc_witness_v1_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {_, undefined} -> PFmsg; + _ -> NFmsg + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_address_routing_data_req_v1_pb/3}). +merge_msg_gateway_address_routing_data_req_v1_pb(#gateway_address_routing_data_req_v1_pb{address + = + PFaddress}, + #gateway_address_routing_data_req_v1_pb{address + = + NFaddress}, + _) -> + #gateway_address_routing_data_req_v1_pb{address = + if NFaddress =:= undefined -> + PFaddress; + true -> NFaddress + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_poc_key_routing_data_req_v1_pb/3}). +merge_msg_gateway_poc_key_routing_data_req_v1_pb(#gateway_poc_key_routing_data_req_v1_pb{key + = + PFkey}, + #gateway_poc_key_routing_data_req_v1_pb{key + = + NFkey}, + _) -> + #gateway_poc_key_routing_data_req_v1_pb{key = + if NFkey =:= undefined -> PFkey; + true -> NFkey + end}. + +-compile({nowarn_unused_function,merge_msg_gateway_public_routing_data_resp_v1_pb/3}). +merge_msg_gateway_public_routing_data_resp_v1_pb(#gateway_public_routing_data_resp_v1_pb{address + = + PFaddress, + public_uri + = + PFpublic_uri}, + #gateway_public_routing_data_resp_v1_pb{address + = + NFaddress, + public_uri + = + NFpublic_uri}, + TrUserData) -> + #gateway_public_routing_data_resp_v1_pb{address = + if NFaddress =:= undefined -> + PFaddress; + true -> NFaddress + end, + public_uri = + if PFpublic_uri /= undefined, + NFpublic_uri /= undefined -> + merge_msg_routing_address_pb(PFpublic_uri, + NFpublic_uri, + TrUserData); + PFpublic_uri == undefined -> + NFpublic_uri; + NFpublic_uri == undefined -> + PFpublic_uri + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_state_channel_summary_v1_pb/3}). +merge_msg_blockchain_state_channel_summary_v1_pb(#blockchain_state_channel_summary_v1_pb{client_pubkeybin + = + PFclient_pubkeybin, + num_packets + = + PFnum_packets, + num_dcs + = + PFnum_dcs}, + #blockchain_state_channel_summary_v1_pb{client_pubkeybin + = + NFclient_pubkeybin, + num_packets + = + NFnum_packets, + num_dcs + = + NFnum_dcs}, + _) -> + #blockchain_state_channel_summary_v1_pb{client_pubkeybin + = + if NFclient_pubkeybin =:= + undefined -> + PFclient_pubkeybin; + true -> NFclient_pubkeybin + end, + num_packets = + if NFnum_packets =:= + undefined -> + PFnum_packets; + true -> NFnum_packets + end, + num_dcs = + if NFnum_dcs =:= undefined -> + PFnum_dcs; + true -> NFnum_dcs + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_state_channel_v1_pb/3}). +merge_msg_blockchain_state_channel_v1_pb(#blockchain_state_channel_v1_pb{id + = + PFid, + owner = + PFowner, + credits + = + PFcredits, + nonce = + PFnonce, + summaries + = + PFsummaries, + root_hash + = + PFroot_hash, + skewed + = + PFskewed, + state = + PFstate, + expire_at_block + = + PFexpire_at_block, + signature + = + PFsignature}, + #blockchain_state_channel_v1_pb{id = + NFid, + owner = + NFowner, + credits + = + NFcredits, + nonce = + NFnonce, + summaries + = + NFsummaries, + root_hash + = + NFroot_hash, + skewed + = + NFskewed, + state = + NFstate, + expire_at_block + = + NFexpire_at_block, + signature + = + NFsignature}, + TrUserData) -> + #blockchain_state_channel_v1_pb{id = + if NFid =:= undefined -> PFid; + true -> NFid + end, + owner = + if NFowner =:= undefined -> PFowner; + true -> NFowner + end, + credits = + if NFcredits =:= undefined -> PFcredits; + true -> NFcredits + end, + nonce = + if NFnonce =:= undefined -> PFnonce; + true -> NFnonce + end, + summaries = + if PFsummaries /= undefined, + NFsummaries /= undefined -> + 'erlang_++'(PFsummaries, + NFsummaries, + TrUserData); + PFsummaries == undefined -> + NFsummaries; + NFsummaries == undefined -> + PFsummaries + end, + root_hash = + if NFroot_hash =:= undefined -> + PFroot_hash; + true -> NFroot_hash + end, + skewed = + if NFskewed =:= undefined -> PFskewed; + true -> NFskewed + end, + state = + if NFstate =:= undefined -> PFstate; + true -> NFstate + end, + expire_at_block = + if NFexpire_at_block =:= undefined -> + PFexpire_at_block; + true -> NFexpire_at_block + end, + signature = + if NFsignature =:= undefined -> + PFsignature; + true -> NFsignature + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_state_channel_response_v1_pb/3}). +merge_msg_blockchain_state_channel_response_v1_pb(#blockchain_state_channel_response_v1_pb{accepted + = + PFaccepted, + downlink + = + PFdownlink}, + #blockchain_state_channel_response_v1_pb{accepted + = + NFaccepted, + downlink + = + NFdownlink}, + TrUserData) -> + #blockchain_state_channel_response_v1_pb{accepted = + if NFaccepted =:= undefined -> + PFaccepted; + true -> NFaccepted + end, + downlink = + if PFdownlink /= undefined, + NFdownlink /= undefined -> + merge_msg_packet_pb(PFdownlink, + NFdownlink, + TrUserData); + PFdownlink == undefined -> + NFdownlink; + NFdownlink == undefined -> + PFdownlink + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_state_channel_packet_v1_pb/3}). +merge_msg_blockchain_state_channel_packet_v1_pb(#blockchain_state_channel_packet_v1_pb{packet + = + PFpacket, + hotspot + = + PFhotspot, + signature + = + PFsignature, + region + = + PFregion, + hold_time + = + PFhold_time}, + #blockchain_state_channel_packet_v1_pb{packet + = + NFpacket, + hotspot + = + NFhotspot, + signature + = + NFsignature, + region + = + NFregion, + hold_time + = + NFhold_time}, + TrUserData) -> + #blockchain_state_channel_packet_v1_pb{packet = + if PFpacket /= undefined, + NFpacket /= undefined -> + merge_msg_packet_pb(PFpacket, + NFpacket, + TrUserData); + PFpacket == undefined -> + NFpacket; + NFpacket == undefined -> + PFpacket + end, + hotspot = + if NFhotspot =:= undefined -> + PFhotspot; + true -> NFhotspot + end, + signature = + if NFsignature =:= undefined -> + PFsignature; + true -> NFsignature + end, + region = + if NFregion =:= undefined -> + PFregion; + true -> NFregion + end, + hold_time = + if NFhold_time =:= undefined -> + PFhold_time; + true -> NFhold_time + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_state_channel_offer_v1_pb/3}). +merge_msg_blockchain_state_channel_offer_v1_pb(#blockchain_state_channel_offer_v1_pb{routing + = + PFrouting, + packet_hash + = + PFpacket_hash, + payload_size + = + PFpayload_size, + fcnt + = + PFfcnt, + hotspot + = + PFhotspot, + signature + = + PFsignature, + region + = + PFregion, + req_diff + = + PFreq_diff}, + #blockchain_state_channel_offer_v1_pb{routing + = + NFrouting, + packet_hash + = + NFpacket_hash, + payload_size + = + NFpayload_size, + fcnt + = + NFfcnt, + hotspot + = + NFhotspot, + signature + = + NFsignature, + region + = + NFregion, + req_diff + = + NFreq_diff}, + TrUserData) -> + #blockchain_state_channel_offer_v1_pb{routing = + if PFrouting /= undefined, + NFrouting /= undefined -> + merge_msg_routing_information_pb(PFrouting, + NFrouting, + TrUserData); + PFrouting == undefined -> + NFrouting; + NFrouting == undefined -> + PFrouting + end, + packet_hash = + if NFpacket_hash =:= undefined -> + PFpacket_hash; + true -> NFpacket_hash + end, + payload_size = + if NFpayload_size =:= undefined -> + PFpayload_size; + true -> NFpayload_size + end, + fcnt = + if NFfcnt =:= undefined -> PFfcnt; + true -> NFfcnt + end, + hotspot = + if NFhotspot =:= undefined -> + PFhotspot; + true -> NFhotspot + end, + signature = + if NFsignature =:= undefined -> + PFsignature; + true -> NFsignature + end, + region = + if NFregion =:= undefined -> + PFregion; + true -> NFregion + end, + req_diff = + if NFreq_diff =:= undefined -> + PFreq_diff; + true -> NFreq_diff + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_state_channel_purchase_v1_pb/3}). +merge_msg_blockchain_state_channel_purchase_v1_pb(#blockchain_state_channel_purchase_v1_pb{sc + = + PFsc, + hotspot + = + PFhotspot, + packet_hash + = + PFpacket_hash, + region + = + PFregion, + sc_diff + = + PFsc_diff}, + #blockchain_state_channel_purchase_v1_pb{sc + = + NFsc, + hotspot + = + NFhotspot, + packet_hash + = + NFpacket_hash, + region + = + NFregion, + sc_diff + = + NFsc_diff}, + TrUserData) -> + #blockchain_state_channel_purchase_v1_pb{sc = + if PFsc /= undefined, + NFsc /= undefined -> + merge_msg_blockchain_state_channel_v1_pb(PFsc, + NFsc, + TrUserData); + PFsc == undefined -> NFsc; + NFsc == undefined -> PFsc + end, + hotspot = + if NFhotspot =:= undefined -> + PFhotspot; + true -> NFhotspot + end, + packet_hash = + if NFpacket_hash =:= + undefined -> + PFpacket_hash; + true -> NFpacket_hash + end, + region = + if NFregion =:= undefined -> + PFregion; + true -> NFregion + end, + sc_diff = + if PFsc_diff /= undefined, + NFsc_diff /= undefined -> + merge_msg_blockchain_state_channel_diff_v1_pb(PFsc_diff, + NFsc_diff, + TrUserData); + PFsc_diff == undefined -> + NFsc_diff; + NFsc_diff == undefined -> + PFsc_diff + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_state_channel_diff_v1_pb/3}). +merge_msg_blockchain_state_channel_diff_v1_pb(#blockchain_state_channel_diff_v1_pb{id + = + PFid, + add_nonce + = + PFadd_nonce, + signature + = + PFsignature, + diffs + = + PFdiffs}, + #blockchain_state_channel_diff_v1_pb{id + = + NFid, + add_nonce + = + NFadd_nonce, + signature + = + NFsignature, + diffs + = + NFdiffs}, + TrUserData) -> + #blockchain_state_channel_diff_v1_pb{id = + if NFid =:= undefined -> PFid; + true -> NFid + end, + add_nonce = + if NFadd_nonce =:= undefined -> + PFadd_nonce; + true -> NFadd_nonce + end, + signature = + if NFsignature =:= undefined -> + PFsignature; + true -> NFsignature + end, + diffs = + if PFdiffs /= undefined, + NFdiffs /= undefined -> + 'erlang_++'(PFdiffs, + NFdiffs, + TrUserData); + PFdiffs == undefined -> NFdiffs; + NFdiffs == undefined -> PFdiffs + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_state_channel_diff_entry_v1_pb/3}). +merge_msg_blockchain_state_channel_diff_entry_v1_pb(#blockchain_state_channel_diff_entry_v1_pb{entry + = + PFentry}, + #blockchain_state_channel_diff_entry_v1_pb{entry + = + NFentry}, + TrUserData) -> + #blockchain_state_channel_diff_entry_v1_pb{entry = + case {PFentry, NFentry} of + {{append, OPFentry}, + {append, ONFentry}} -> + {append, + merge_msg_blockchain_state_channel_diff_append_summary_v1_pb(OPFentry, + ONFentry, + TrUserData)}; + {{add, OPFentry}, + {add, ONFentry}} -> + {add, + merge_msg_blockchain_state_channel_diff_update_summary_v1_pb(OPFentry, + ONFentry, + TrUserData)}; + {_, undefined} -> + PFentry; + _ -> NFentry + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_state_channel_diff_append_summary_v1_pb/3}). +merge_msg_blockchain_state_channel_diff_append_summary_v1_pb(#blockchain_state_channel_diff_append_summary_v1_pb{client_pubkeybin + = + PFclient_pubkeybin, + num_packets + = + PFnum_packets, + num_dcs + = + PFnum_dcs}, + #blockchain_state_channel_diff_append_summary_v1_pb{client_pubkeybin + = + NFclient_pubkeybin, + num_packets + = + NFnum_packets, + num_dcs + = + NFnum_dcs}, + _) -> + #blockchain_state_channel_diff_append_summary_v1_pb{client_pubkeybin + = + if + NFclient_pubkeybin + =:= + undefined -> + PFclient_pubkeybin; + true -> + NFclient_pubkeybin + end, + num_packets = + if NFnum_packets =:= + undefined -> + PFnum_packets; + true -> + NFnum_packets + end, + num_dcs = + if NFnum_dcs =:= + undefined -> + PFnum_dcs; + true -> NFnum_dcs + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_state_channel_diff_update_summary_v1_pb/3}). +merge_msg_blockchain_state_channel_diff_update_summary_v1_pb(#blockchain_state_channel_diff_update_summary_v1_pb{client_index + = + PFclient_index, + add_packets + = + PFadd_packets, + add_dcs + = + PFadd_dcs}, + #blockchain_state_channel_diff_update_summary_v1_pb{client_index + = + NFclient_index, + add_packets + = + NFadd_packets, + add_dcs + = + NFadd_dcs}, + _) -> + #blockchain_state_channel_diff_update_summary_v1_pb{client_index + = + if NFclient_index + =:= + undefined -> + PFclient_index; + true -> + NFclient_index + end, + add_packets = + if NFadd_packets =:= + undefined -> + PFadd_packets; + true -> + NFadd_packets + end, + add_dcs = + if NFadd_dcs =:= + undefined -> + PFadd_dcs; + true -> NFadd_dcs + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_state_channel_banner_v1_pb/3}). +merge_msg_blockchain_state_channel_banner_v1_pb(#blockchain_state_channel_banner_v1_pb{sc + = + PFsc}, + #blockchain_state_channel_banner_v1_pb{sc + = + NFsc}, + TrUserData) -> + #blockchain_state_channel_banner_v1_pb{sc = + if PFsc /= undefined, + NFsc /= undefined -> + merge_msg_blockchain_state_channel_v1_pb(PFsc, + NFsc, + TrUserData); + PFsc == undefined -> NFsc; + NFsc == undefined -> PFsc + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_state_channel_rejection_v1_pb/3}). +merge_msg_blockchain_state_channel_rejection_v1_pb(#blockchain_state_channel_rejection_v1_pb{reject + = + PFreject, + packet_hash + = + PFpacket_hash}, + #blockchain_state_channel_rejection_v1_pb{reject + = + NFreject, + packet_hash + = + NFpacket_hash}, + _) -> + #blockchain_state_channel_rejection_v1_pb{reject = + if NFreject =:= undefined -> + PFreject; + true -> NFreject + end, + packet_hash = + if NFpacket_hash =:= + undefined -> + PFpacket_hash; + true -> NFpacket_hash + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_state_channel_message_v1_pb/3}). +merge_msg_blockchain_state_channel_message_v1_pb(#blockchain_state_channel_message_v1_pb{msg + = + PFmsg}, + #blockchain_state_channel_message_v1_pb{msg + = + NFmsg}, + TrUserData) -> + #blockchain_state_channel_message_v1_pb{msg = + case {PFmsg, NFmsg} of + {{response, OPFmsg}, + {response, ONFmsg}} -> + {response, + merge_msg_blockchain_state_channel_response_v1_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {{packet, OPFmsg}, + {packet, ONFmsg}} -> + {packet, + merge_msg_blockchain_state_channel_packet_v1_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {{offer, OPFmsg}, + {offer, ONFmsg}} -> + {offer, + merge_msg_blockchain_state_channel_offer_v1_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {{purchase, OPFmsg}, + {purchase, ONFmsg}} -> + {purchase, + merge_msg_blockchain_state_channel_purchase_v1_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {{banner, OPFmsg}, + {banner, ONFmsg}} -> + {banner, + merge_msg_blockchain_state_channel_banner_v1_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {{reject, OPFmsg}, + {reject, ONFmsg}} -> + {reject, + merge_msg_blockchain_state_channel_rejection_v1_pb(OPFmsg, + ONFmsg, + TrUserData)}; + {_, undefined} -> PFmsg; + _ -> NFmsg + end}. + +-compile({nowarn_unused_function,merge_msg_eui_pb/3}). +merge_msg_eui_pb(#eui_pb{deveui = PFdeveui, + appeui = PFappeui}, + #eui_pb{deveui = NFdeveui, appeui = NFappeui}, _) -> + #eui_pb{deveui = + if NFdeveui =:= undefined -> PFdeveui; + true -> NFdeveui + end, + appeui = + if NFappeui =:= undefined -> PFappeui; + true -> NFappeui + end}. + +-compile({nowarn_unused_function,merge_msg_routing_information_pb/3}). +merge_msg_routing_information_pb(#routing_information_pb{data + = PFdata}, + #routing_information_pb{data = NFdata}, + TrUserData) -> + #routing_information_pb{data = + case {PFdata, NFdata} of + {{eui, OPFdata}, {eui, ONFdata}} -> + {eui, + merge_msg_eui_pb(OPFdata, + ONFdata, + TrUserData)}; + {_, undefined} -> PFdata; + _ -> NFdata + end}. + +-compile({nowarn_unused_function,merge_msg_window_pb/3}). +merge_msg_window_pb(#window_pb{timestamp = PFtimestamp, + frequency = PFfrequency, datarate = PFdatarate}, + #window_pb{timestamp = NFtimestamp, + frequency = NFfrequency, datarate = NFdatarate}, + _) -> + #window_pb{timestamp = + if NFtimestamp =:= undefined -> PFtimestamp; + true -> NFtimestamp + end, + frequency = + if NFfrequency =:= undefined -> PFfrequency; + true -> NFfrequency + end, + datarate = + if NFdatarate =:= undefined -> PFdatarate; + true -> NFdatarate + end}. + +-compile({nowarn_unused_function,merge_msg_packet_pb/3}). +merge_msg_packet_pb(#packet_pb{oui = PFoui, + type = PFtype, payload = PFpayload, + timestamp = PFtimestamp, + signal_strength = PFsignal_strength, + frequency = PFfrequency, datarate = PFdatarate, + snr = PFsnr, routing = PFrouting, + rx2_window = PFrx2_window}, + #packet_pb{oui = NFoui, type = NFtype, + payload = NFpayload, timestamp = NFtimestamp, + signal_strength = NFsignal_strength, + frequency = NFfrequency, datarate = NFdatarate, + snr = NFsnr, routing = NFrouting, + rx2_window = NFrx2_window}, + TrUserData) -> + #packet_pb{oui = + if NFoui =:= undefined -> PFoui; + true -> NFoui + end, + type = + if NFtype =:= undefined -> PFtype; + true -> NFtype + end, + payload = + if NFpayload =:= undefined -> PFpayload; + true -> NFpayload + end, + timestamp = + if NFtimestamp =:= undefined -> PFtimestamp; + true -> NFtimestamp + end, + signal_strength = + if NFsignal_strength =:= undefined -> PFsignal_strength; + true -> NFsignal_strength + end, + frequency = + if NFfrequency =:= undefined -> PFfrequency; + true -> NFfrequency + end, + datarate = + if NFdatarate =:= undefined -> PFdatarate; + true -> NFdatarate + end, + snr = + if NFsnr =:= undefined -> PFsnr; + true -> NFsnr + end, + routing = + if PFrouting /= undefined, NFrouting /= undefined -> + merge_msg_routing_information_pb(PFrouting, + NFrouting, + TrUserData); + PFrouting == undefined -> NFrouting; + NFrouting == undefined -> PFrouting + end, + rx2_window = + if PFrx2_window /= undefined, + NFrx2_window /= undefined -> + merge_msg_window_pb(PFrx2_window, + NFrx2_window, + TrUserData); + PFrx2_window == undefined -> NFrx2_window; + NFrx2_window == undefined -> PFrx2_window + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_txn_state_channel_close_v1_pb/3}). +merge_msg_blockchain_txn_state_channel_close_v1_pb(#blockchain_txn_state_channel_close_v1_pb{state_channel + = + PFstate_channel, + closer + = + PFcloser, + signature + = + PFsignature, + fee + = + PFfee, + conflicts_with + = + PFconflicts_with}, + #blockchain_txn_state_channel_close_v1_pb{state_channel + = + NFstate_channel, + closer + = + NFcloser, + signature + = + NFsignature, + fee + = + NFfee, + conflicts_with + = + NFconflicts_with}, + TrUserData) -> + #blockchain_txn_state_channel_close_v1_pb{state_channel + = + if PFstate_channel /= + undefined, + NFstate_channel /= + undefined -> + merge_msg_blockchain_state_channel_v1_pb(PFstate_channel, + NFstate_channel, + TrUserData); + PFstate_channel == + undefined -> + NFstate_channel; + NFstate_channel == + undefined -> + PFstate_channel + end, + closer = + if NFcloser =:= undefined -> + PFcloser; + true -> NFcloser + end, + signature = + if NFsignature =:= + undefined -> + PFsignature; + true -> NFsignature + end, + fee = + if NFfee =:= undefined -> + PFfee; + true -> NFfee + end, + conflicts_with = + if PFconflicts_with /= + undefined, + NFconflicts_with /= + undefined -> + merge_msg_blockchain_state_channel_v1_pb(PFconflicts_with, + NFconflicts_with, + TrUserData); + PFconflicts_with == + undefined -> + NFconflicts_with; + NFconflicts_with == + undefined -> + PFconflicts_with + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_var_v1_pb/3}). +merge_msg_blockchain_var_v1_pb(#blockchain_var_v1_pb{name + = PFname, + type = PFtype, + value = PFvalue}, + #blockchain_var_v1_pb{name = NFname, + type = NFtype, + value = NFvalue}, + _) -> + #blockchain_var_v1_pb{name = + if NFname =:= undefined -> PFname; + true -> NFname + end, + type = + if NFtype =:= undefined -> PFtype; + true -> NFtype + end, + value = + if NFvalue =:= undefined -> PFvalue; + true -> NFvalue + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_txn_vars_v1_pb/3}). +merge_msg_blockchain_txn_vars_v1_pb(#blockchain_txn_vars_v1_pb{vars + = PFvars, + version_predicate + = + PFversion_predicate, + proof = PFproof, + master_key = + PFmaster_key, + key_proof = + PFkey_proof, + cancels = + PFcancels, + unsets = + PFunsets, + nonce = PFnonce, + multi_keys = + PFmulti_keys, + multi_proofs = + PFmulti_proofs, + multi_key_proofs + = + PFmulti_key_proofs}, + #blockchain_txn_vars_v1_pb{vars = NFvars, + version_predicate + = + NFversion_predicate, + proof = NFproof, + master_key = + NFmaster_key, + key_proof = + NFkey_proof, + cancels = + NFcancels, + unsets = + NFunsets, + nonce = NFnonce, + multi_keys = + NFmulti_keys, + multi_proofs = + NFmulti_proofs, + multi_key_proofs + = + NFmulti_key_proofs}, + TrUserData) -> + #blockchain_txn_vars_v1_pb{vars = + if PFvars /= undefined, + NFvars /= undefined -> + 'erlang_++'(PFvars, + NFvars, + TrUserData); + PFvars == undefined -> NFvars; + NFvars == undefined -> PFvars + end, + version_predicate = + if NFversion_predicate =:= undefined -> + PFversion_predicate; + true -> NFversion_predicate + end, + proof = + if NFproof =:= undefined -> PFproof; + true -> NFproof + end, + master_key = + if NFmaster_key =:= undefined -> + PFmaster_key; + true -> NFmaster_key + end, + key_proof = + if NFkey_proof =:= undefined -> PFkey_proof; + true -> NFkey_proof + end, + cancels = + if PFcancels /= undefined, + NFcancels /= undefined -> + 'erlang_++'(PFcancels, + NFcancels, + TrUserData); + PFcancels == undefined -> NFcancels; + NFcancels == undefined -> PFcancels + end, + unsets = + if PFunsets /= undefined, + NFunsets /= undefined -> + 'erlang_++'(PFunsets, + NFunsets, + TrUserData); + PFunsets == undefined -> NFunsets; + NFunsets == undefined -> PFunsets + end, + nonce = + if NFnonce =:= undefined -> PFnonce; + true -> NFnonce + end, + multi_keys = + if PFmulti_keys /= undefined, + NFmulti_keys /= undefined -> + 'erlang_++'(PFmulti_keys, + NFmulti_keys, + TrUserData); + PFmulti_keys == undefined -> NFmulti_keys; + NFmulti_keys == undefined -> PFmulti_keys + end, + multi_proofs = + if PFmulti_proofs /= undefined, + NFmulti_proofs /= undefined -> + 'erlang_++'(PFmulti_proofs, + NFmulti_proofs, + TrUserData); + PFmulti_proofs == undefined -> + NFmulti_proofs; + NFmulti_proofs == undefined -> + PFmulti_proofs + end, + multi_key_proofs = + if PFmulti_key_proofs /= undefined, + NFmulti_key_proofs /= undefined -> + 'erlang_++'(PFmulti_key_proofs, + NFmulti_key_proofs, + TrUserData); + PFmulti_key_proofs == undefined -> + NFmulti_key_proofs; + NFmulti_key_proofs == undefined -> + PFmulti_key_proofs + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_txn_poc_receipts_v1_pb/3}). +merge_msg_blockchain_txn_poc_receipts_v1_pb(#blockchain_txn_poc_receipts_v1_pb{challenger + = + PFchallenger, + secret + = + PFsecret, + onion_key_hash + = + PFonion_key_hash, + path + = + PFpath, + fee + = + PFfee, + signature + = + PFsignature, + request_block_hash + = + PFrequest_block_hash}, + #blockchain_txn_poc_receipts_v1_pb{challenger + = + NFchallenger, + secret + = + NFsecret, + onion_key_hash + = + NFonion_key_hash, + path + = + NFpath, + fee + = + NFfee, + signature + = + NFsignature, + request_block_hash + = + NFrequest_block_hash}, + TrUserData) -> + #blockchain_txn_poc_receipts_v1_pb{challenger = + if NFchallenger =:= undefined -> + PFchallenger; + true -> NFchallenger + end, + secret = + if NFsecret =:= undefined -> + PFsecret; + true -> NFsecret + end, + onion_key_hash = + if NFonion_key_hash =:= undefined -> + PFonion_key_hash; + true -> NFonion_key_hash + end, + path = + if PFpath /= undefined, + NFpath /= undefined -> + 'erlang_++'(PFpath, + NFpath, + TrUserData); + PFpath == undefined -> NFpath; + NFpath == undefined -> PFpath + end, + fee = + if NFfee =:= undefined -> PFfee; + true -> NFfee + end, + signature = + if NFsignature =:= undefined -> + PFsignature; + true -> NFsignature + end, + request_block_hash = + if NFrequest_block_hash =:= + undefined -> + PFrequest_block_hash; + true -> NFrequest_block_hash + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_poc_receipt_v1_pb/3}). +merge_msg_blockchain_poc_receipt_v1_pb(#blockchain_poc_receipt_v1_pb{gateway + = + PFgateway, + timestamp = + PFtimestamp, + signal = + PFsignal, + data = + PFdata, + origin = + PForigin, + signature = + PFsignature, + snr = + PFsnr, + frequency = + PFfrequency, + channel = + PFchannel, + datarate = + PFdatarate, + addr_hash = + PFaddr_hash, + tx_power = + PFtx_power}, + #blockchain_poc_receipt_v1_pb{gateway = + NFgateway, + timestamp = + NFtimestamp, + signal = + NFsignal, + data = + NFdata, + origin = + NForigin, + signature = + NFsignature, + snr = + NFsnr, + frequency = + NFfrequency, + channel = + NFchannel, + datarate = + NFdatarate, + addr_hash = + NFaddr_hash, + tx_power = + NFtx_power}, + _) -> + #blockchain_poc_receipt_v1_pb{gateway = + if NFgateway =:= undefined -> PFgateway; + true -> NFgateway + end, + timestamp = + if NFtimestamp =:= undefined -> + PFtimestamp; + true -> NFtimestamp + end, + signal = + if NFsignal =:= undefined -> PFsignal; + true -> NFsignal + end, + data = + if NFdata =:= undefined -> PFdata; + true -> NFdata + end, + origin = + if NForigin =:= undefined -> PForigin; + true -> NForigin + end, + signature = + if NFsignature =:= undefined -> + PFsignature; + true -> NFsignature + end, + snr = + if NFsnr =:= undefined -> PFsnr; + true -> NFsnr + end, + frequency = + if NFfrequency =:= undefined -> + PFfrequency; + true -> NFfrequency + end, + channel = + if NFchannel =:= undefined -> PFchannel; + true -> NFchannel + end, + datarate = + if NFdatarate =:= undefined -> PFdatarate; + true -> NFdatarate + end, + addr_hash = + if NFaddr_hash =:= undefined -> + PFaddr_hash; + true -> NFaddr_hash + end, + tx_power = + if NFtx_power =:= undefined -> PFtx_power; + true -> NFtx_power + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_poc_witness_v1_pb/3}). +merge_msg_blockchain_poc_witness_v1_pb(#blockchain_poc_witness_v1_pb{gateway + = + PFgateway, + timestamp = + PFtimestamp, + signal = + PFsignal, + packet_hash + = + PFpacket_hash, + signature = + PFsignature, + snr = + PFsnr, + frequency = + PFfrequency, + channel = + PFchannel, + datarate = + PFdatarate}, + #blockchain_poc_witness_v1_pb{gateway = + NFgateway, + timestamp = + NFtimestamp, + signal = + NFsignal, + packet_hash + = + NFpacket_hash, + signature = + NFsignature, + snr = + NFsnr, + frequency = + NFfrequency, + channel = + NFchannel, + datarate = + NFdatarate}, + _) -> + #blockchain_poc_witness_v1_pb{gateway = + if NFgateway =:= undefined -> PFgateway; + true -> NFgateway + end, + timestamp = + if NFtimestamp =:= undefined -> + PFtimestamp; + true -> NFtimestamp + end, + signal = + if NFsignal =:= undefined -> PFsignal; + true -> NFsignal + end, + packet_hash = + if NFpacket_hash =:= undefined -> + PFpacket_hash; + true -> NFpacket_hash + end, + signature = + if NFsignature =:= undefined -> + PFsignature; + true -> NFsignature + end, + snr = + if NFsnr =:= undefined -> PFsnr; + true -> NFsnr + end, + frequency = + if NFfrequency =:= undefined -> + PFfrequency; + true -> NFfrequency + end, + channel = + if NFchannel =:= undefined -> PFchannel; + true -> NFchannel + end, + datarate = + if NFdatarate =:= undefined -> PFdatarate; + true -> NFdatarate + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_poc_response_v1_pb/3}). +merge_msg_blockchain_poc_response_v1_pb(#blockchain_poc_response_v1_pb{payload + = + PFpayload}, + #blockchain_poc_response_v1_pb{payload = + NFpayload}, + TrUserData) -> + #blockchain_poc_response_v1_pb{payload = + case {PFpayload, NFpayload} of + {{receipt, OPFpayload}, + {receipt, ONFpayload}} -> + {receipt, + merge_msg_blockchain_poc_receipt_v1_pb(OPFpayload, + ONFpayload, + TrUserData)}; + {{witness, OPFpayload}, + {witness, ONFpayload}} -> + {witness, + merge_msg_blockchain_poc_witness_v1_pb(OPFpayload, + ONFpayload, + TrUserData)}; + {_, undefined} -> PFpayload; + _ -> NFpayload + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_poc_path_element_v1_pb/3}). +merge_msg_blockchain_poc_path_element_v1_pb(#blockchain_poc_path_element_v1_pb{challengee + = + PFchallengee, + receipt + = + PFreceipt, + witnesses + = + PFwitnesses}, + #blockchain_poc_path_element_v1_pb{challengee + = + NFchallengee, + receipt + = + NFreceipt, + witnesses + = + NFwitnesses}, + TrUserData) -> + #blockchain_poc_path_element_v1_pb{challengee = + if NFchallengee =:= undefined -> + PFchallengee; + true -> NFchallengee + end, + receipt = + if PFreceipt /= undefined, + NFreceipt /= undefined -> + merge_msg_blockchain_poc_receipt_v1_pb(PFreceipt, + NFreceipt, + TrUserData); + PFreceipt == undefined -> + NFreceipt; + NFreceipt == undefined -> + PFreceipt + end, + witnesses = + if PFwitnesses /= undefined, + NFwitnesses /= undefined -> + 'erlang_++'(PFwitnesses, + NFwitnesses, + TrUserData); + PFwitnesses == undefined -> + NFwitnesses; + NFwitnesses == undefined -> + PFwitnesses + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_txn_poc_receipts_v2_pb/3}). +merge_msg_blockchain_txn_poc_receipts_v2_pb(#blockchain_txn_poc_receipts_v2_pb{challenger + = + PFchallenger, + secret + = + PFsecret, + onion_key_hash + = + PFonion_key_hash, + path + = + PFpath, + fee + = + PFfee, + signature + = + PFsignature, + block_hash + = + PFblock_hash}, + #blockchain_txn_poc_receipts_v2_pb{challenger + = + NFchallenger, + secret + = + NFsecret, + onion_key_hash + = + NFonion_key_hash, + path + = + NFpath, + fee + = + NFfee, + signature + = + NFsignature, + block_hash + = + NFblock_hash}, + TrUserData) -> + #blockchain_txn_poc_receipts_v2_pb{challenger = + if NFchallenger =:= undefined -> + PFchallenger; + true -> NFchallenger + end, + secret = + if NFsecret =:= undefined -> + PFsecret; + true -> NFsecret + end, + onion_key_hash = + if NFonion_key_hash =:= undefined -> + PFonion_key_hash; + true -> NFonion_key_hash + end, + path = + if PFpath /= undefined, + NFpath /= undefined -> + 'erlang_++'(PFpath, + NFpath, + TrUserData); + PFpath == undefined -> NFpath; + NFpath == undefined -> PFpath + end, + fee = + if NFfee =:= undefined -> PFfee; + true -> NFfee + end, + signature = + if NFsignature =:= undefined -> + PFsignature; + true -> NFsignature + end, + block_hash = + if NFblock_hash =:= undefined -> + PFblock_hash; + true -> NFblock_hash + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_region_params_v1_pb/3}). +merge_msg_blockchain_region_params_v1_pb(#blockchain_region_params_v1_pb{region_params + = + PFregion_params}, + #blockchain_region_params_v1_pb{region_params + = + NFregion_params}, + TrUserData) -> + #blockchain_region_params_v1_pb{region_params = + if PFregion_params /= undefined, + NFregion_params /= undefined -> + 'erlang_++'(PFregion_params, + NFregion_params, + TrUserData); + PFregion_params == undefined -> + NFregion_params; + NFregion_params == undefined -> + PFregion_params + end}. + +-compile({nowarn_unused_function,merge_msg_tagged_spreading_pb/3}). +merge_msg_tagged_spreading_pb(#tagged_spreading_pb{region_spreading + = PFregion_spreading, + max_packet_size = + PFmax_packet_size}, + #tagged_spreading_pb{region_spreading = + NFregion_spreading, + max_packet_size = + NFmax_packet_size}, + _) -> + #tagged_spreading_pb{region_spreading = + if NFregion_spreading =:= undefined -> + PFregion_spreading; + true -> NFregion_spreading + end, + max_packet_size = + if NFmax_packet_size =:= undefined -> + PFmax_packet_size; + true -> NFmax_packet_size + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_region_spreading_v1_pb/3}). +merge_msg_blockchain_region_spreading_v1_pb(#blockchain_region_spreading_v1_pb{tagged_spreading + = + PFtagged_spreading}, + #blockchain_region_spreading_v1_pb{tagged_spreading + = + NFtagged_spreading}, + TrUserData) -> + #blockchain_region_spreading_v1_pb{tagged_spreading = + if PFtagged_spreading /= undefined, + NFtagged_spreading /= undefined -> + 'erlang_++'(PFtagged_spreading, + NFtagged_spreading, + TrUserData); + PFtagged_spreading == undefined -> + NFtagged_spreading; + NFtagged_spreading == undefined -> + PFtagged_spreading + end}. + +-compile({nowarn_unused_function,merge_msg_blockchain_region_param_v1_pb/3}). +merge_msg_blockchain_region_param_v1_pb(#blockchain_region_param_v1_pb{channel_frequency + = + PFchannel_frequency, + bandwidth + = + PFbandwidth, + max_eirp + = + PFmax_eirp, + spreading + = + PFspreading}, + #blockchain_region_param_v1_pb{channel_frequency + = + NFchannel_frequency, + bandwidth + = + NFbandwidth, + max_eirp + = + NFmax_eirp, + spreading + = + NFspreading}, + TrUserData) -> + #blockchain_region_param_v1_pb{channel_frequency = + if NFchannel_frequency =:= undefined -> + PFchannel_frequency; + true -> NFchannel_frequency + end, + bandwidth = + if NFbandwidth =:= undefined -> + PFbandwidth; + true -> NFbandwidth + end, + max_eirp = + if NFmax_eirp =:= undefined -> + PFmax_eirp; + true -> NFmax_eirp + end, + spreading = + if PFspreading /= undefined, + NFspreading /= undefined -> + merge_msg_blockchain_region_spreading_v1_pb(PFspreading, + NFspreading, + TrUserData); + PFspreading == undefined -> + NFspreading; + NFspreading == undefined -> + PFspreading + end}. + + +verify_msg(Msg) when tuple_size(Msg) >= 1 -> + verify_msg(Msg, element(1, Msg), []); +verify_msg(X) -> + mk_type_error(not_a_known_message, X, []). + +verify_msg(Msg, MsgName) when is_atom(MsgName) -> + verify_msg(Msg, MsgName, []); +verify_msg(Msg, Opts) when tuple_size(Msg) >= 1 -> + verify_msg(Msg, element(1, Msg), Opts); +verify_msg(X, _Opts) -> + mk_type_error(not_a_known_message, X, []). + +verify_msg(Msg, MsgName, Opts) -> + TrUserData = proplists:get_value(user_data, Opts), + case MsgName of + empty_pb -> v_msg_empty_pb(Msg, [MsgName], TrUserData); + gateway_success_resp_pb -> + v_msg_gateway_success_resp_pb(Msg, + [MsgName], + TrUserData); + gateway_error_resp_pb -> + v_msg_gateway_error_resp_pb(Msg, [MsgName], TrUserData); + gateway_config_req_v1_pb -> + v_msg_gateway_config_req_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_config_resp_v1_pb -> + v_msg_gateway_config_resp_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_config_update_req_v1_pb -> + v_msg_gateway_config_update_req_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_config_update_streamed_resp_v1_pb -> + v_msg_gateway_config_update_streamed_resp_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_validators_req_v1_pb -> + v_msg_gateway_validators_req_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_validators_resp_v1_pb -> + v_msg_gateway_validators_resp_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_region_params_streamed_resp_v1_pb -> + v_msg_gateway_region_params_streamed_resp_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_region_params_update_req_v1_pb -> + v_msg_gateway_region_params_update_req_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_resp_v1_pb -> + v_msg_gateway_resp_v1_pb(Msg, [MsgName], TrUserData); + gateway_sc_is_active_req_v1_pb -> + v_msg_gateway_sc_is_active_req_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_sc_is_active_resp_v1_pb -> + v_msg_gateway_sc_is_active_resp_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_sc_is_overpaid_req_v1_pb -> + v_msg_gateway_sc_is_overpaid_req_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_sc_is_overpaid_resp_v1_pb -> + v_msg_gateway_sc_is_overpaid_resp_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_sc_close_req_v1_pb -> + v_msg_gateway_sc_close_req_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_sc_close_resp_v1_pb -> + v_msg_gateway_sc_close_resp_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_sc_follow_req_v1_pb -> + v_msg_gateway_sc_follow_req_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_sc_follow_streamed_resp_v1_pb -> + v_msg_gateway_sc_follow_streamed_resp_v1_pb(Msg, + [MsgName], + TrUserData); + routing_pb -> + v_msg_routing_pb(Msg, [MsgName], TrUserData); + routing_address_pb -> + v_msg_routing_address_pb(Msg, [MsgName], TrUserData); + gateway_routing_req_v1_pb -> + v_msg_gateway_routing_req_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_routing_streamed_resp_v1_pb -> + v_msg_gateway_routing_streamed_resp_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_poc_req_v1_pb -> + v_msg_gateway_poc_req_v1_pb(Msg, [MsgName], TrUserData); + gateway_poc_challenge_notification_resp_v1_pb -> + v_msg_gateway_poc_challenge_notification_resp_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_poc_check_challenge_target_req_v1_pb -> + v_msg_gateway_poc_check_challenge_target_req_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_poc_check_challenge_target_resp_v1_pb -> + v_msg_gateway_poc_check_challenge_target_resp_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_poc_report_req_v1_pb -> + v_msg_gateway_poc_report_req_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_address_routing_data_req_v1_pb -> + v_msg_gateway_address_routing_data_req_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_poc_key_routing_data_req_v1_pb -> + v_msg_gateway_poc_key_routing_data_req_v1_pb(Msg, + [MsgName], + TrUserData); + gateway_public_routing_data_resp_v1_pb -> + v_msg_gateway_public_routing_data_resp_v1_pb(Msg, + [MsgName], + TrUserData); + blockchain_state_channel_summary_v1_pb -> + v_msg_blockchain_state_channel_summary_v1_pb(Msg, + [MsgName], + TrUserData); + blockchain_state_channel_v1_pb -> + v_msg_blockchain_state_channel_v1_pb(Msg, + [MsgName], + TrUserData); + blockchain_state_channel_response_v1_pb -> + v_msg_blockchain_state_channel_response_v1_pb(Msg, + [MsgName], + TrUserData); + blockchain_state_channel_packet_v1_pb -> + v_msg_blockchain_state_channel_packet_v1_pb(Msg, + [MsgName], + TrUserData); + blockchain_state_channel_offer_v1_pb -> + v_msg_blockchain_state_channel_offer_v1_pb(Msg, + [MsgName], + TrUserData); + blockchain_state_channel_purchase_v1_pb -> + v_msg_blockchain_state_channel_purchase_v1_pb(Msg, + [MsgName], + TrUserData); + blockchain_state_channel_diff_v1_pb -> + v_msg_blockchain_state_channel_diff_v1_pb(Msg, + [MsgName], + TrUserData); + blockchain_state_channel_diff_entry_v1_pb -> + v_msg_blockchain_state_channel_diff_entry_v1_pb(Msg, + [MsgName], + TrUserData); + blockchain_state_channel_diff_append_summary_v1_pb -> + v_msg_blockchain_state_channel_diff_append_summary_v1_pb(Msg, + [MsgName], + TrUserData); + blockchain_state_channel_diff_update_summary_v1_pb -> + v_msg_blockchain_state_channel_diff_update_summary_v1_pb(Msg, + [MsgName], + TrUserData); + blockchain_state_channel_banner_v1_pb -> + v_msg_blockchain_state_channel_banner_v1_pb(Msg, + [MsgName], + TrUserData); + blockchain_state_channel_rejection_v1_pb -> + v_msg_blockchain_state_channel_rejection_v1_pb(Msg, + [MsgName], + TrUserData); + blockchain_state_channel_message_v1_pb -> + v_msg_blockchain_state_channel_message_v1_pb(Msg, + [MsgName], + TrUserData); + eui_pb -> v_msg_eui_pb(Msg, [MsgName], TrUserData); + routing_information_pb -> + v_msg_routing_information_pb(Msg, + [MsgName], + TrUserData); + window_pb -> + v_msg_window_pb(Msg, [MsgName], TrUserData); + packet_pb -> + v_msg_packet_pb(Msg, [MsgName], TrUserData); + blockchain_txn_state_channel_close_v1_pb -> + v_msg_blockchain_txn_state_channel_close_v1_pb(Msg, + [MsgName], + TrUserData); + blockchain_var_v1_pb -> + v_msg_blockchain_var_v1_pb(Msg, [MsgName], TrUserData); + blockchain_txn_vars_v1_pb -> + v_msg_blockchain_txn_vars_v1_pb(Msg, + [MsgName], + TrUserData); + blockchain_txn_poc_receipts_v1_pb -> + v_msg_blockchain_txn_poc_receipts_v1_pb(Msg, + [MsgName], + TrUserData); + blockchain_poc_receipt_v1_pb -> + v_msg_blockchain_poc_receipt_v1_pb(Msg, + [MsgName], + TrUserData); + blockchain_poc_witness_v1_pb -> + v_msg_blockchain_poc_witness_v1_pb(Msg, + [MsgName], + TrUserData); + blockchain_poc_response_v1_pb -> + v_msg_blockchain_poc_response_v1_pb(Msg, + [MsgName], + TrUserData); + blockchain_poc_path_element_v1_pb -> + v_msg_blockchain_poc_path_element_v1_pb(Msg, + [MsgName], + TrUserData); + blockchain_txn_poc_receipts_v2_pb -> + v_msg_blockchain_txn_poc_receipts_v2_pb(Msg, + [MsgName], + TrUserData); + blockchain_region_params_v1_pb -> + v_msg_blockchain_region_params_v1_pb(Msg, + [MsgName], + TrUserData); + tagged_spreading_pb -> + v_msg_tagged_spreading_pb(Msg, [MsgName], TrUserData); + blockchain_region_spreading_v1_pb -> + v_msg_blockchain_region_spreading_v1_pb(Msg, + [MsgName], + TrUserData); + blockchain_region_param_v1_pb -> + v_msg_blockchain_region_param_v1_pb(Msg, + [MsgName], + TrUserData); + _ -> mk_type_error(not_a_known_message, Msg, []) + end. + + +-compile({nowarn_unused_function,v_msg_empty_pb/3}). +-dialyzer({nowarn_function,v_msg_empty_pb/3}). +v_msg_empty_pb(#empty_pb{}, _Path, _) -> ok; +v_msg_empty_pb(X, Path, _TrUserData) -> + mk_type_error({expected_msg, empty_pb}, X, Path). + +-compile({nowarn_unused_function,v_msg_gateway_success_resp_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_success_resp_pb/3}). +v_msg_gateway_success_resp_pb(#gateway_success_resp_pb{resp + = F1, + details = F2}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bytes(F1, [resp | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_bytes(F2, [details | Path], TrUserData) + end, + ok; +v_msg_gateway_success_resp_pb(X, Path, _TrUserData) -> + mk_type_error({expected_msg, gateway_success_resp_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_error_resp_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_error_resp_pb/3}). +v_msg_gateway_error_resp_pb(#gateway_error_resp_pb{error + = F1, + details = F2}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bytes(F1, [error | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_bytes(F2, [details | Path], TrUserData) + end, + ok; +v_msg_gateway_error_resp_pb(X, Path, _TrUserData) -> + mk_type_error({expected_msg, gateway_error_resp_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_config_req_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_config_req_v1_pb/3}). +v_msg_gateway_config_req_v1_pb(#gateway_config_req_v1_pb{keys + = F1}, + Path, TrUserData) -> + if is_list(F1) -> + _ = [v_type_string(Elem, [keys | Path], TrUserData) + || Elem <- F1], + ok; + true -> + mk_type_error({invalid_list_of, string}, + F1, + [keys | Path]) + end, + ok; +v_msg_gateway_config_req_v1_pb(X, Path, _TrUserData) -> + mk_type_error({expected_msg, gateway_config_req_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_config_resp_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_config_resp_v1_pb/3}). +v_msg_gateway_config_resp_v1_pb(#gateway_config_resp_v1_pb{result + = F1}, + Path, TrUserData) -> + if is_list(F1) -> + _ = [v_msg_blockchain_var_v1_pb(Elem, + [result | Path], + TrUserData) + || Elem <- F1], + ok; + true -> + mk_type_error({invalid_list_of, + {msg, blockchain_var_v1_pb}}, + F1, + [result | Path]) + end, + ok; +v_msg_gateway_config_resp_v1_pb(X, Path, _TrUserData) -> + mk_type_error({expected_msg, gateway_config_resp_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_config_update_req_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_config_update_req_v1_pb/3}). +v_msg_gateway_config_update_req_v1_pb(#gateway_config_update_req_v1_pb{}, + _Path, _) -> + ok; +v_msg_gateway_config_update_req_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + gateway_config_update_req_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_config_update_streamed_resp_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_config_update_streamed_resp_v1_pb/3}). +v_msg_gateway_config_update_streamed_resp_v1_pb(#gateway_config_update_streamed_resp_v1_pb{keys + = + F1}, + Path, TrUserData) -> + if is_list(F1) -> + _ = [v_type_string(Elem, [keys | Path], TrUserData) + || Elem <- F1], + ok; + true -> + mk_type_error({invalid_list_of, string}, + F1, + [keys | Path]) + end, + ok; +v_msg_gateway_config_update_streamed_resp_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + gateway_config_update_streamed_resp_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_validators_req_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_validators_req_v1_pb/3}). +v_msg_gateway_validators_req_v1_pb(#gateway_validators_req_v1_pb{quantity + = F1}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_uint32(F1, [quantity | Path], TrUserData) + end, + ok; +v_msg_gateway_validators_req_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + gateway_validators_req_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_validators_resp_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_validators_resp_v1_pb/3}). +v_msg_gateway_validators_resp_v1_pb(#gateway_validators_resp_v1_pb{result + = F1}, + Path, TrUserData) -> + if is_list(F1) -> + _ = [v_msg_routing_address_pb(Elem, + [result | Path], + TrUserData) + || Elem <- F1], + ok; + true -> + mk_type_error({invalid_list_of, + {msg, routing_address_pb}}, + F1, + [result | Path]) + end, + ok; +v_msg_gateway_validators_resp_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + gateway_validators_resp_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_region_params_streamed_resp_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_region_params_streamed_resp_v1_pb/3}). +v_msg_gateway_region_params_streamed_resp_v1_pb(#gateway_region_params_streamed_resp_v1_pb{address + = + F1, + region + = + F2, + params + = + F3}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bytes(F1, [address | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> + 'v_enum_helium.region'(F2, [region | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> + v_msg_blockchain_region_params_v1_pb(F3, + [params | Path], + TrUserData) + end, + ok; +v_msg_gateway_region_params_streamed_resp_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + gateway_region_params_streamed_resp_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_region_params_update_req_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_region_params_update_req_v1_pb/3}). +v_msg_gateway_region_params_update_req_v1_pb(#gateway_region_params_update_req_v1_pb{address + = + F1, + signature + = + F2}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bytes(F1, [address | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_bytes(F2, [signature | Path], TrUserData) + end, + ok; +v_msg_gateway_region_params_update_req_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + gateway_region_params_update_req_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_resp_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_resp_v1_pb/3}). +v_msg_gateway_resp_v1_pb(#gateway_resp_v1_pb{height = + F1, + signature = F2, msg = F3, + block_time = F4, block_age = F5}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_uint64(F1, [height | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_bytes(F2, [signature | Path], TrUserData) + end, + case F3 of + undefined -> ok; + {is_active_resp, OF3} -> + v_msg_gateway_sc_is_active_resp_v1_pb(OF3, + [is_active_resp, msg | Path], + TrUserData); + {is_overpaid_resp, OF3} -> + v_msg_gateway_sc_is_overpaid_resp_v1_pb(OF3, + [is_overpaid_resp, msg + | Path], + TrUserData); + {close_resp, OF3} -> + v_msg_gateway_sc_close_resp_v1_pb(OF3, + [close_resp, msg | Path], + TrUserData); + {follow_streamed_resp, OF3} -> + v_msg_gateway_sc_follow_streamed_resp_v1_pb(OF3, + [follow_streamed_resp, + msg + | Path], + TrUserData); + {routing_streamed_resp, OF3} -> + v_msg_gateway_routing_streamed_resp_v1_pb(OF3, + [routing_streamed_resp, + msg + | Path], + TrUserData); + {config_resp, OF3} -> + v_msg_gateway_config_resp_v1_pb(OF3, + [config_resp, msg | Path], + TrUserData); + {config_update_streamed_resp, OF3} -> + v_msg_gateway_config_update_streamed_resp_v1_pb(OF3, + [config_update_streamed_resp, + msg + | Path], + TrUserData); + {validators_resp, OF3} -> + v_msg_gateway_validators_resp_v1_pb(OF3, + [validators_resp, msg | Path], + TrUserData); + {region_params_streamed_resp, OF3} -> + v_msg_gateway_region_params_streamed_resp_v1_pb(OF3, + [region_params_streamed_resp, + msg + | Path], + TrUserData); + {success_resp, OF3} -> + v_msg_gateway_success_resp_pb(OF3, + [success_resp, msg | Path], + TrUserData); + {error_resp, OF3} -> + v_msg_gateway_error_resp_pb(OF3, + [error_resp, msg | Path], + TrUserData); + {poc_challenge_resp, OF3} -> + v_msg_gateway_poc_challenge_notification_resp_v1_pb(OF3, + [poc_challenge_resp, + msg + | Path], + TrUserData); + {poc_check_target_resp, OF3} -> + v_msg_gateway_poc_check_challenge_target_resp_v1_pb(OF3, + [poc_check_target_resp, + msg + | Path], + TrUserData); + {public_route, OF3} -> + v_msg_gateway_public_routing_data_resp_v1_pb(OF3, + [public_route, msg + | Path], + TrUserData); + _ -> mk_type_error(invalid_oneof, F3, [msg | Path]) + end, + if F4 == undefined -> ok; + true -> + v_type_uint64(F4, [block_time | Path], TrUserData) + end, + if F5 == undefined -> ok; + true -> + v_type_uint64(F5, [block_age | Path], TrUserData) + end, + ok; +v_msg_gateway_resp_v1_pb(X, Path, _TrUserData) -> + mk_type_error({expected_msg, gateway_resp_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_sc_is_active_req_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_sc_is_active_req_v1_pb/3}). +v_msg_gateway_sc_is_active_req_v1_pb(#gateway_sc_is_active_req_v1_pb{sc_id + = F1, + sc_owner = + F2}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bytes(F1, [sc_id | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_bytes(F2, [sc_owner | Path], TrUserData) + end, + ok; +v_msg_gateway_sc_is_active_req_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + gateway_sc_is_active_req_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_sc_is_active_resp_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_sc_is_active_resp_v1_pb/3}). +v_msg_gateway_sc_is_active_resp_v1_pb(#gateway_sc_is_active_resp_v1_pb{sc_id + = F1, + sc_owner + = F2, + active = + F3, + sc_expiry_at_block + = F4, + sc_original_dc_amount + = + F5}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bytes(F1, [sc_id | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_bytes(F2, [sc_owner | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> v_type_bool(F3, [active | Path], TrUserData) + end, + if F4 == undefined -> ok; + true -> + v_type_uint64(F4, + [sc_expiry_at_block | Path], + TrUserData) + end, + if F5 == undefined -> ok; + true -> + v_type_uint64(F5, + [sc_original_dc_amount | Path], + TrUserData) + end, + ok; +v_msg_gateway_sc_is_active_resp_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + gateway_sc_is_active_resp_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_sc_is_overpaid_req_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_sc_is_overpaid_req_v1_pb/3}). +v_msg_gateway_sc_is_overpaid_req_v1_pb(#gateway_sc_is_overpaid_req_v1_pb{sc_id + = + F1, + sc_owner + = + F2, + total_dcs + = + F3}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bytes(F1, [sc_id | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_bytes(F2, [sc_owner | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> + v_type_uint64(F3, [total_dcs | Path], TrUserData) + end, + ok; +v_msg_gateway_sc_is_overpaid_req_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + gateway_sc_is_overpaid_req_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_sc_is_overpaid_resp_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_sc_is_overpaid_resp_v1_pb/3}). +v_msg_gateway_sc_is_overpaid_resp_v1_pb(#gateway_sc_is_overpaid_resp_v1_pb{sc_id + = + F1, + sc_owner + = + F2, + overpaid + = + F3}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bytes(F1, [sc_id | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_bytes(F2, [sc_owner | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> v_type_bool(F3, [overpaid | Path], TrUserData) + end, + ok; +v_msg_gateway_sc_is_overpaid_resp_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + gateway_sc_is_overpaid_resp_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_sc_close_req_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_sc_close_req_v1_pb/3}). +v_msg_gateway_sc_close_req_v1_pb(#gateway_sc_close_req_v1_pb{close_txn + = F1}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> + v_msg_blockchain_txn_state_channel_close_v1_pb(F1, + [close_txn | Path], + TrUserData) + end, + ok; +v_msg_gateway_sc_close_req_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + gateway_sc_close_req_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_sc_close_resp_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_sc_close_resp_v1_pb/3}). +v_msg_gateway_sc_close_resp_v1_pb(#gateway_sc_close_resp_v1_pb{sc_id + = F1, + response = F2}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bytes(F1, [sc_id | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_bytes(F2, [response | Path], TrUserData) + end, + ok; +v_msg_gateway_sc_close_resp_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + gateway_sc_close_resp_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_sc_follow_req_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_sc_follow_req_v1_pb/3}). +v_msg_gateway_sc_follow_req_v1_pb(#gateway_sc_follow_req_v1_pb{sc_id + = F1, + sc_owner = F2}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bytes(F1, [sc_id | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_bytes(F2, [sc_owner | Path], TrUserData) + end, + ok; +v_msg_gateway_sc_follow_req_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + gateway_sc_follow_req_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_sc_follow_streamed_resp_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_sc_follow_streamed_resp_v1_pb/3}). +v_msg_gateway_sc_follow_streamed_resp_v1_pb(#gateway_sc_follow_streamed_resp_v1_pb{sc_id + = + F1, + sc_owner + = + F2, + close_state + = + F3}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bytes(F1, [sc_id | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_bytes(F2, [sc_owner | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> + 'v_enum_helium.close_state'(F3, + [close_state | Path], + TrUserData) + end, + ok; +v_msg_gateway_sc_follow_streamed_resp_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + gateway_sc_follow_streamed_resp_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_routing_pb/3}). +-dialyzer({nowarn_function,v_msg_routing_pb/3}). +v_msg_routing_pb(#routing_pb{oui = F1, owner = F2, + addresses = F3, filters = F4, subnets = F5}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_uint32(F1, [oui | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_bytes(F2, [owner | Path], TrUserData) + end, + if is_list(F3) -> + _ = [v_msg_routing_address_pb(Elem, + [addresses | Path], + TrUserData) + || Elem <- F3], + ok; + true -> + mk_type_error({invalid_list_of, + {msg, routing_address_pb}}, + F3, + [addresses | Path]) + end, + if is_list(F4) -> + _ = [v_type_bytes(Elem, [filters | Path], TrUserData) + || Elem <- F4], + ok; + true -> + mk_type_error({invalid_list_of, bytes}, + F4, + [filters | Path]) + end, + if is_list(F5) -> + _ = [v_type_bytes(Elem, [subnets | Path], TrUserData) + || Elem <- F5], + ok; + true -> + mk_type_error({invalid_list_of, bytes}, + F5, + [subnets | Path]) + end, + ok; +v_msg_routing_pb(X, Path, _TrUserData) -> + mk_type_error({expected_msg, routing_pb}, X, Path). + +-compile({nowarn_unused_function,v_msg_routing_address_pb/3}). +-dialyzer({nowarn_function,v_msg_routing_address_pb/3}). +v_msg_routing_address_pb(#routing_address_pb{pub_key = + F1, + uri = F2}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bytes(F1, [pub_key | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_bytes(F2, [uri | Path], TrUserData) + end, + ok; +v_msg_routing_address_pb(X, Path, _TrUserData) -> + mk_type_error({expected_msg, routing_address_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_routing_req_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_routing_req_v1_pb/3}). +v_msg_gateway_routing_req_v1_pb(#gateway_routing_req_v1_pb{height + = F1}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_uint64(F1, [height | Path], TrUserData) + end, + ok; +v_msg_gateway_routing_req_v1_pb(X, Path, _TrUserData) -> + mk_type_error({expected_msg, gateway_routing_req_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_routing_streamed_resp_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_routing_streamed_resp_v1_pb/3}). +v_msg_gateway_routing_streamed_resp_v1_pb(#gateway_routing_streamed_resp_v1_pb{routings + = + F1}, + Path, TrUserData) -> + if is_list(F1) -> + _ = [v_msg_routing_pb(Elem, + [routings | Path], + TrUserData) + || Elem <- F1], + ok; + true -> + mk_type_error({invalid_list_of, {msg, routing_pb}}, + F1, + [routings | Path]) + end, + ok; +v_msg_gateway_routing_streamed_resp_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + gateway_routing_streamed_resp_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_poc_req_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_poc_req_v1_pb/3}). +v_msg_gateway_poc_req_v1_pb(#gateway_poc_req_v1_pb{address + = F1, + signature = F2}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bytes(F1, [address | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_bytes(F2, [signature | Path], TrUserData) + end, + ok; +v_msg_gateway_poc_req_v1_pb(X, Path, _TrUserData) -> + mk_type_error({expected_msg, gateway_poc_req_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_poc_challenge_notification_resp_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_poc_challenge_notification_resp_v1_pb/3}). +v_msg_gateway_poc_challenge_notification_resp_v1_pb(#gateway_poc_challenge_notification_resp_v1_pb{challenger + = + F1, + block_hash + = + F2, + onion_key_hash + = + F3}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> + v_msg_routing_address_pb(F1, + [challenger | Path], + TrUserData) + end, + if F2 == undefined -> ok; + true -> + v_type_bytes(F2, [block_hash | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> + v_type_bytes(F3, [onion_key_hash | Path], TrUserData) + end, + ok; +v_msg_gateway_poc_challenge_notification_resp_v1_pb(X, + Path, _TrUserData) -> + mk_type_error({expected_msg, + gateway_poc_challenge_notification_resp_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_poc_check_challenge_target_req_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_poc_check_challenge_target_req_v1_pb/3}). +v_msg_gateway_poc_check_challenge_target_req_v1_pb(#gateway_poc_check_challenge_target_req_v1_pb{address + = + F1, + challenger + = + F2, + block_hash + = + F3, + onion_key_hash + = + F4, + height + = + F5, + notifier + = + F6, + notifier_sig + = + F7, + challengee_sig + = + F8}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bytes(F1, [address | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> + v_type_bytes(F2, [challenger | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> + v_type_bytes(F3, [block_hash | Path], TrUserData) + end, + if F4 == undefined -> ok; + true -> + v_type_bytes(F4, [onion_key_hash | Path], TrUserData) + end, + if F5 == undefined -> ok; + true -> v_type_uint64(F5, [height | Path], TrUserData) + end, + if F6 == undefined -> ok; + true -> v_type_bytes(F6, [notifier | Path], TrUserData) + end, + if F7 == undefined -> ok; + true -> + v_type_bytes(F7, [notifier_sig | Path], TrUserData) + end, + if F8 == undefined -> ok; + true -> + v_type_bytes(F8, [challengee_sig | Path], TrUserData) + end, + ok; +v_msg_gateway_poc_check_challenge_target_req_v1_pb(X, + Path, _TrUserData) -> + mk_type_error({expected_msg, + gateway_poc_check_challenge_target_req_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_poc_check_challenge_target_resp_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_poc_check_challenge_target_resp_v1_pb/3}). +v_msg_gateway_poc_check_challenge_target_resp_v1_pb(#gateway_poc_check_challenge_target_resp_v1_pb{target + = + F1, + onion + = + F2}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bool(F1, [target | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_bytes(F2, [onion | Path], TrUserData) + end, + ok; +v_msg_gateway_poc_check_challenge_target_resp_v1_pb(X, + Path, _TrUserData) -> + mk_type_error({expected_msg, + gateway_poc_check_challenge_target_resp_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_poc_report_req_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_poc_report_req_v1_pb/3}). +v_msg_gateway_poc_report_req_v1_pb(#gateway_poc_report_req_v1_pb{onion_key_hash + = F1, + msg = F2}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> + v_type_bytes(F1, [onion_key_hash | Path], TrUserData) + end, + case F2 of + undefined -> ok; + {receipt, OF2} -> + v_msg_blockchain_poc_receipt_v1_pb(OF2, + [receipt, msg | Path], + TrUserData); + {witness, OF2} -> + v_msg_blockchain_poc_witness_v1_pb(OF2, + [witness, msg | Path], + TrUserData); + _ -> mk_type_error(invalid_oneof, F2, [msg | Path]) + end, + ok; +v_msg_gateway_poc_report_req_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + gateway_poc_report_req_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_address_routing_data_req_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_address_routing_data_req_v1_pb/3}). +v_msg_gateway_address_routing_data_req_v1_pb(#gateway_address_routing_data_req_v1_pb{address + = + F1}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bytes(F1, [address | Path], TrUserData) + end, + ok; +v_msg_gateway_address_routing_data_req_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + gateway_address_routing_data_req_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_poc_key_routing_data_req_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_poc_key_routing_data_req_v1_pb/3}). +v_msg_gateway_poc_key_routing_data_req_v1_pb(#gateway_poc_key_routing_data_req_v1_pb{key + = + F1}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bytes(F1, [key | Path], TrUserData) + end, + ok; +v_msg_gateway_poc_key_routing_data_req_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + gateway_poc_key_routing_data_req_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_gateway_public_routing_data_resp_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_gateway_public_routing_data_resp_v1_pb/3}). +v_msg_gateway_public_routing_data_resp_v1_pb(#gateway_public_routing_data_resp_v1_pb{address + = + F1, + public_uri + = + F2}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bytes(F1, [address | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> + v_msg_routing_address_pb(F2, + [public_uri | Path], + TrUserData) + end, + ok; +v_msg_gateway_public_routing_data_resp_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + gateway_public_routing_data_resp_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_state_channel_summary_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_state_channel_summary_v1_pb/3}). +v_msg_blockchain_state_channel_summary_v1_pb(#blockchain_state_channel_summary_v1_pb{client_pubkeybin + = + F1, + num_packets + = + F2, + num_dcs + = + F3}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> + v_type_bytes(F1, [client_pubkeybin | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> + v_type_uint64(F2, [num_packets | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> v_type_uint64(F3, [num_dcs | Path], TrUserData) + end, + ok; +v_msg_blockchain_state_channel_summary_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + blockchain_state_channel_summary_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_state_channel_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_state_channel_v1_pb/3}). +v_msg_blockchain_state_channel_v1_pb(#blockchain_state_channel_v1_pb{id + = F1, + owner = F2, + credits = + F3, + nonce = F4, + summaries = + F5, + root_hash = + F6, + skewed = + F7, + state = F8, + expire_at_block + = F9, + signature = + F10}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bytes(F1, [id | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_bytes(F2, [owner | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> v_type_uint64(F3, [credits | Path], TrUserData) + end, + if F4 == undefined -> ok; + true -> v_type_uint64(F4, [nonce | Path], TrUserData) + end, + if is_list(F5) -> + _ = [v_msg_blockchain_state_channel_summary_v1_pb(Elem, + [summaries | Path], + TrUserData) + || Elem <- F5], + ok; + true -> + mk_type_error({invalid_list_of, + {msg, blockchain_state_channel_summary_v1_pb}}, + F5, + [summaries | Path]) + end, + if F6 == undefined -> ok; + true -> v_type_bytes(F6, [root_hash | Path], TrUserData) + end, + if F7 == undefined -> ok; + true -> v_type_bytes(F7, [skewed | Path], TrUserData) + end, + if F8 == undefined -> ok; + true -> + 'v_enum_helium.blockchain_state_channel_state_v1'(F8, + [state | Path], + TrUserData) + end, + if F9 == undefined -> ok; + true -> + v_type_uint64(F9, [expire_at_block | Path], TrUserData) + end, + if F10 == undefined -> ok; + true -> + v_type_bytes(F10, [signature | Path], TrUserData) + end, + ok; +v_msg_blockchain_state_channel_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + blockchain_state_channel_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_state_channel_response_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_state_channel_response_v1_pb/3}). +v_msg_blockchain_state_channel_response_v1_pb(#blockchain_state_channel_response_v1_pb{accepted + = + F1, + downlink + = + F2}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bool(F1, [accepted | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> + v_msg_packet_pb(F2, [downlink | Path], TrUserData) + end, + ok; +v_msg_blockchain_state_channel_response_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + blockchain_state_channel_response_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_state_channel_packet_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_state_channel_packet_v1_pb/3}). +v_msg_blockchain_state_channel_packet_v1_pb(#blockchain_state_channel_packet_v1_pb{packet + = + F1, + hotspot + = + F2, + signature + = + F3, + region + = + F4, + hold_time + = + F5}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_msg_packet_pb(F1, [packet | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_bytes(F2, [hotspot | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> v_type_bytes(F3, [signature | Path], TrUserData) + end, + if F4 == undefined -> ok; + true -> + 'v_enum_helium.region'(F4, [region | Path], TrUserData) + end, + if F5 == undefined -> ok; + true -> + v_type_uint64(F5, [hold_time | Path], TrUserData) + end, + ok; +v_msg_blockchain_state_channel_packet_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + blockchain_state_channel_packet_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_state_channel_offer_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_state_channel_offer_v1_pb/3}). +v_msg_blockchain_state_channel_offer_v1_pb(#blockchain_state_channel_offer_v1_pb{routing + = + F1, + packet_hash + = + F2, + payload_size + = + F3, + fcnt + = + F4, + hotspot + = + F5, + signature + = + F6, + region + = + F7, + req_diff + = + F8}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> + v_msg_routing_information_pb(F1, + [routing | Path], + TrUserData) + end, + if F2 == undefined -> ok; + true -> + v_type_bytes(F2, [packet_hash | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> + v_type_uint64(F3, [payload_size | Path], TrUserData) + end, + if F4 == undefined -> ok; + true -> v_type_uint32(F4, [fcnt | Path], TrUserData) + end, + if F5 == undefined -> ok; + true -> v_type_bytes(F5, [hotspot | Path], TrUserData) + end, + if F6 == undefined -> ok; + true -> v_type_bytes(F6, [signature | Path], TrUserData) + end, + if F7 == undefined -> ok; + true -> + 'v_enum_helium.region'(F7, [region | Path], TrUserData) + end, + if F8 == undefined -> ok; + true -> v_type_bool(F8, [req_diff | Path], TrUserData) + end, + ok; +v_msg_blockchain_state_channel_offer_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + blockchain_state_channel_offer_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_state_channel_purchase_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_state_channel_purchase_v1_pb/3}). +v_msg_blockchain_state_channel_purchase_v1_pb(#blockchain_state_channel_purchase_v1_pb{sc + = + F1, + hotspot + = + F2, + packet_hash + = + F3, + region + = + F4, + sc_diff + = + F5}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> + v_msg_blockchain_state_channel_v1_pb(F1, + [sc | Path], + TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_bytes(F2, [hotspot | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> + v_type_bytes(F3, [packet_hash | Path], TrUserData) + end, + if F4 == undefined -> ok; + true -> + 'v_enum_helium.region'(F4, [region | Path], TrUserData) + end, + if F5 == undefined -> ok; + true -> + v_msg_blockchain_state_channel_diff_v1_pb(F5, + [sc_diff | Path], + TrUserData) + end, + ok; +v_msg_blockchain_state_channel_purchase_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + blockchain_state_channel_purchase_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_state_channel_diff_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_state_channel_diff_v1_pb/3}). +v_msg_blockchain_state_channel_diff_v1_pb(#blockchain_state_channel_diff_v1_pb{id + = + F1, + add_nonce + = + F2, + signature + = + F3, + diffs + = + F4}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bytes(F1, [id | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> + v_type_uint64(F2, [add_nonce | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> v_type_bytes(F3, [signature | Path], TrUserData) + end, + if is_list(F4) -> + _ = + [v_msg_blockchain_state_channel_diff_entry_v1_pb(Elem, + [diffs | Path], + TrUserData) + || Elem <- F4], + ok; + true -> + mk_type_error({invalid_list_of, + {msg, blockchain_state_channel_diff_entry_v1_pb}}, + F4, + [diffs | Path]) + end, + ok; +v_msg_blockchain_state_channel_diff_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + blockchain_state_channel_diff_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_state_channel_diff_entry_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_state_channel_diff_entry_v1_pb/3}). +v_msg_blockchain_state_channel_diff_entry_v1_pb(#blockchain_state_channel_diff_entry_v1_pb{entry + = + F1}, + Path, TrUserData) -> + case F1 of + undefined -> ok; + {append, OF1} -> + v_msg_blockchain_state_channel_diff_append_summary_v1_pb(OF1, + [append, + entry + | Path], + TrUserData); + {add, OF1} -> + v_msg_blockchain_state_channel_diff_update_summary_v1_pb(OF1, + [add, entry + | Path], + TrUserData); + _ -> mk_type_error(invalid_oneof, F1, [entry | Path]) + end, + ok; +v_msg_blockchain_state_channel_diff_entry_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + blockchain_state_channel_diff_entry_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_state_channel_diff_append_summary_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_state_channel_diff_append_summary_v1_pb/3}). +v_msg_blockchain_state_channel_diff_append_summary_v1_pb(#blockchain_state_channel_diff_append_summary_v1_pb{client_pubkeybin + = + F1, + num_packets + = + F2, + num_dcs + = + F3}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> + v_type_bytes(F1, [client_pubkeybin | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> + v_type_uint64(F2, [num_packets | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> v_type_uint64(F3, [num_dcs | Path], TrUserData) + end, + ok; +v_msg_blockchain_state_channel_diff_append_summary_v1_pb(X, + Path, _TrUserData) -> + mk_type_error({expected_msg, + blockchain_state_channel_diff_append_summary_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_state_channel_diff_update_summary_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_state_channel_diff_update_summary_v1_pb/3}). +v_msg_blockchain_state_channel_diff_update_summary_v1_pb(#blockchain_state_channel_diff_update_summary_v1_pb{client_index + = + F1, + add_packets + = + F2, + add_dcs + = + F3}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> + v_type_uint64(F1, [client_index | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> + v_type_uint64(F2, [add_packets | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> v_type_uint64(F3, [add_dcs | Path], TrUserData) + end, + ok; +v_msg_blockchain_state_channel_diff_update_summary_v1_pb(X, + Path, _TrUserData) -> + mk_type_error({expected_msg, + blockchain_state_channel_diff_update_summary_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_state_channel_banner_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_state_channel_banner_v1_pb/3}). +v_msg_blockchain_state_channel_banner_v1_pb(#blockchain_state_channel_banner_v1_pb{sc + = + F1}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> + v_msg_blockchain_state_channel_v1_pb(F1, + [sc | Path], + TrUserData) + end, + ok; +v_msg_blockchain_state_channel_banner_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + blockchain_state_channel_banner_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_state_channel_rejection_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_state_channel_rejection_v1_pb/3}). +v_msg_blockchain_state_channel_rejection_v1_pb(#blockchain_state_channel_rejection_v1_pb{reject + = + F1, + packet_hash + = + F2}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_uint32(F1, [reject | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> + v_type_bytes(F2, [packet_hash | Path], TrUserData) + end, + ok; +v_msg_blockchain_state_channel_rejection_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + blockchain_state_channel_rejection_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_state_channel_message_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_state_channel_message_v1_pb/3}). +v_msg_blockchain_state_channel_message_v1_pb(#blockchain_state_channel_message_v1_pb{msg + = + F1}, + Path, TrUserData) -> + case F1 of + undefined -> ok; + {response, OF1} -> + v_msg_blockchain_state_channel_response_v1_pb(OF1, + [response, msg + | Path], + TrUserData); + {packet, OF1} -> + v_msg_blockchain_state_channel_packet_v1_pb(OF1, + [packet, msg | Path], + TrUserData); + {offer, OF1} -> + v_msg_blockchain_state_channel_offer_v1_pb(OF1, + [offer, msg | Path], + TrUserData); + {purchase, OF1} -> + v_msg_blockchain_state_channel_purchase_v1_pb(OF1, + [purchase, msg + | Path], + TrUserData); + {banner, OF1} -> + v_msg_blockchain_state_channel_banner_v1_pb(OF1, + [banner, msg | Path], + TrUserData); + {reject, OF1} -> + v_msg_blockchain_state_channel_rejection_v1_pb(OF1, + [reject, msg | Path], + TrUserData); + _ -> mk_type_error(invalid_oneof, F1, [msg | Path]) + end, + ok; +v_msg_blockchain_state_channel_message_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + blockchain_state_channel_message_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_eui_pb/3}). +-dialyzer({nowarn_function,v_msg_eui_pb/3}). +v_msg_eui_pb(#eui_pb{deveui = F1, appeui = F2}, Path, + TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_uint64(F1, [deveui | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_uint64(F2, [appeui | Path], TrUserData) + end, + ok; +v_msg_eui_pb(X, Path, _TrUserData) -> + mk_type_error({expected_msg, eui_pb}, X, Path). + +-compile({nowarn_unused_function,v_msg_routing_information_pb/3}). +-dialyzer({nowarn_function,v_msg_routing_information_pb/3}). +v_msg_routing_information_pb(#routing_information_pb{data + = F1}, + Path, TrUserData) -> + case F1 of + undefined -> ok; + {devaddr, OF1} -> + v_type_uint32(OF1, [devaddr, data | Path], TrUserData); + {eui, OF1} -> + v_msg_eui_pb(OF1, [eui, data | Path], TrUserData); + _ -> mk_type_error(invalid_oneof, F1, [data | Path]) + end, + ok; +v_msg_routing_information_pb(X, Path, _TrUserData) -> + mk_type_error({expected_msg, routing_information_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_window_pb/3}). +-dialyzer({nowarn_function,v_msg_window_pb/3}). +v_msg_window_pb(#window_pb{timestamp = F1, + frequency = F2, datarate = F3}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> + v_type_uint64(F1, [timestamp | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_float(F2, [frequency | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> v_type_string(F3, [datarate | Path], TrUserData) + end, + ok; +v_msg_window_pb(X, Path, _TrUserData) -> + mk_type_error({expected_msg, window_pb}, X, Path). + +-compile({nowarn_unused_function,v_msg_packet_pb/3}). +-dialyzer({nowarn_function,v_msg_packet_pb/3}). +v_msg_packet_pb(#packet_pb{oui = F1, type = F2, + payload = F3, timestamp = F4, signal_strength = F5, + frequency = F6, datarate = F7, snr = F8, + routing = F9, rx2_window = F10}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_uint32(F1, [oui | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> + 'v_enum_packet_pb.packet_type'(F2, + [type | Path], + TrUserData) + end, + if F3 == undefined -> ok; + true -> v_type_bytes(F3, [payload | Path], TrUserData) + end, + if F4 == undefined -> ok; + true -> + v_type_uint64(F4, [timestamp | Path], TrUserData) + end, + if F5 == undefined -> ok; + true -> + v_type_float(F5, [signal_strength | Path], TrUserData) + end, + if F6 == undefined -> ok; + true -> v_type_float(F6, [frequency | Path], TrUserData) + end, + if F7 == undefined -> ok; + true -> v_type_string(F7, [datarate | Path], TrUserData) + end, + if F8 == undefined -> ok; + true -> v_type_float(F8, [snr | Path], TrUserData) + end, + if F9 == undefined -> ok; + true -> + v_msg_routing_information_pb(F9, + [routing | Path], + TrUserData) + end, + if F10 == undefined -> ok; + true -> + v_msg_window_pb(F10, [rx2_window | Path], TrUserData) + end, + ok; +v_msg_packet_pb(X, Path, _TrUserData) -> + mk_type_error({expected_msg, packet_pb}, X, Path). + +-compile({nowarn_unused_function,v_msg_blockchain_txn_state_channel_close_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_txn_state_channel_close_v1_pb/3}). +v_msg_blockchain_txn_state_channel_close_v1_pb(#blockchain_txn_state_channel_close_v1_pb{state_channel + = + F1, + closer + = + F2, + signature + = + F3, + fee + = + F4, + conflicts_with + = + F5}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> + v_msg_blockchain_state_channel_v1_pb(F1, + [state_channel | Path], + TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_bytes(F2, [closer | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> v_type_bytes(F3, [signature | Path], TrUserData) + end, + if F4 == undefined -> ok; + true -> v_type_uint64(F4, [fee | Path], TrUserData) + end, + if F5 == undefined -> ok; + true -> + v_msg_blockchain_state_channel_v1_pb(F5, + [conflicts_with | Path], + TrUserData) + end, + ok; +v_msg_blockchain_txn_state_channel_close_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + blockchain_txn_state_channel_close_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_var_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_var_v1_pb/3}). +v_msg_blockchain_var_v1_pb(#blockchain_var_v1_pb{name = + F1, + type = F2, value = F3}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_string(F1, [name | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_string(F2, [type | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> v_type_bytes(F3, [value | Path], TrUserData) + end, + ok; +v_msg_blockchain_var_v1_pb(X, Path, _TrUserData) -> + mk_type_error({expected_msg, blockchain_var_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_txn_vars_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_txn_vars_v1_pb/3}). +v_msg_blockchain_txn_vars_v1_pb(#blockchain_txn_vars_v1_pb{vars + = F1, + version_predicate = + F2, + proof = F3, + master_key = F4, + key_proof = F5, + cancels = F6, + unsets = F7, + nonce = F8, + multi_keys = F9, + multi_proofs = F10, + multi_key_proofs = + F11}, + Path, TrUserData) -> + if is_list(F1) -> + _ = [v_msg_blockchain_var_v1_pb(Elem, + [vars | Path], + TrUserData) + || Elem <- F1], + ok; + true -> + mk_type_error({invalid_list_of, + {msg, blockchain_var_v1_pb}}, + F1, + [vars | Path]) + end, + if F2 == undefined -> ok; + true -> + v_type_uint32(F2, + [version_predicate | Path], + TrUserData) + end, + if F3 == undefined -> ok; + true -> v_type_bytes(F3, [proof | Path], TrUserData) + end, + if F4 == undefined -> ok; + true -> + v_type_bytes(F4, [master_key | Path], TrUserData) + end, + if F5 == undefined -> ok; + true -> v_type_bytes(F5, [key_proof | Path], TrUserData) + end, + if is_list(F6) -> + _ = [v_type_bytes(Elem, [cancels | Path], TrUserData) + || Elem <- F6], + ok; + true -> + mk_type_error({invalid_list_of, bytes}, + F6, + [cancels | Path]) + end, + if is_list(F7) -> + _ = [v_type_bytes(Elem, [unsets | Path], TrUserData) + || Elem <- F7], + ok; + true -> + mk_type_error({invalid_list_of, bytes}, + F7, + [unsets | Path]) + end, + if F8 == undefined -> ok; + true -> v_type_uint32(F8, [nonce | Path], TrUserData) + end, + if is_list(F9) -> + _ = [v_type_bytes(Elem, [multi_keys | Path], TrUserData) + || Elem <- F9], + ok; + true -> + mk_type_error({invalid_list_of, bytes}, + F9, + [multi_keys | Path]) + end, + if is_list(F10) -> + _ = [v_type_bytes(Elem, + [multi_proofs | Path], + TrUserData) + || Elem <- F10], + ok; + true -> + mk_type_error({invalid_list_of, bytes}, + F10, + [multi_proofs | Path]) + end, + if is_list(F11) -> + _ = [v_type_bytes(Elem, + [multi_key_proofs | Path], + TrUserData) + || Elem <- F11], + ok; + true -> + mk_type_error({invalid_list_of, bytes}, + F11, + [multi_key_proofs | Path]) + end, + ok; +v_msg_blockchain_txn_vars_v1_pb(X, Path, _TrUserData) -> + mk_type_error({expected_msg, blockchain_txn_vars_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_txn_poc_receipts_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_txn_poc_receipts_v1_pb/3}). +v_msg_blockchain_txn_poc_receipts_v1_pb(#blockchain_txn_poc_receipts_v1_pb{challenger + = + F1, + secret + = + F2, + onion_key_hash + = + F3, + path + = + F4, + fee = + F5, + signature + = + F6, + request_block_hash + = + F7}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> + v_type_bytes(F1, [challenger | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_bytes(F2, [secret | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> + v_type_bytes(F3, [onion_key_hash | Path], TrUserData) + end, + if is_list(F4) -> + _ = [v_msg_blockchain_poc_path_element_v1_pb(Elem, + [path | Path], + TrUserData) + || Elem <- F4], + ok; + true -> + mk_type_error({invalid_list_of, + {msg, blockchain_poc_path_element_v1_pb}}, + F4, + [path | Path]) + end, + if F5 == undefined -> ok; + true -> v_type_uint64(F5, [fee | Path], TrUserData) + end, + if F6 == undefined -> ok; + true -> v_type_bytes(F6, [signature | Path], TrUserData) + end, + if F7 == undefined -> ok; + true -> + v_type_bytes(F7, + [request_block_hash | Path], + TrUserData) + end, + ok; +v_msg_blockchain_txn_poc_receipts_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + blockchain_txn_poc_receipts_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_poc_receipt_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_poc_receipt_v1_pb/3}). +v_msg_blockchain_poc_receipt_v1_pb(#blockchain_poc_receipt_v1_pb{gateway + = F1, + timestamp = F2, + signal = F3, + data = F4, + origin = F5, + signature = F6, + snr = F7, + frequency = F8, + channel = F9, + datarate = F10, + addr_hash = + F11, + tx_power = + F12}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bytes(F1, [gateway | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> + v_type_uint64(F2, [timestamp | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> v_type_sint32(F3, [signal | Path], TrUserData) + end, + if F4 == undefined -> ok; + true -> v_type_bytes(F4, [data | Path], TrUserData) + end, + if F5 == undefined -> ok; + true -> + 'v_enum_helium.origin'(F5, [origin | Path], TrUserData) + end, + if F6 == undefined -> ok; + true -> v_type_bytes(F6, [signature | Path], TrUserData) + end, + if F7 == undefined -> ok; + true -> v_type_float(F7, [snr | Path], TrUserData) + end, + if F8 == undefined -> ok; + true -> v_type_float(F8, [frequency | Path], TrUserData) + end, + if F9 == undefined -> ok; + true -> v_type_int32(F9, [channel | Path], TrUserData) + end, + if F10 == undefined -> ok; + true -> + v_type_string(F10, [datarate | Path], TrUserData) + end, + if F11 == undefined -> ok; + true -> + v_type_bytes(F11, [addr_hash | Path], TrUserData) + end, + if F12 == undefined -> ok; + true -> v_type_int32(F12, [tx_power | Path], TrUserData) + end, + ok; +v_msg_blockchain_poc_receipt_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + blockchain_poc_receipt_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_poc_witness_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_poc_witness_v1_pb/3}). +v_msg_blockchain_poc_witness_v1_pb(#blockchain_poc_witness_v1_pb{gateway + = F1, + timestamp = F2, + signal = F3, + packet_hash = + F4, + signature = F5, + snr = F6, + frequency = F7, + channel = F8, + datarate = F9}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> v_type_bytes(F1, [gateway | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> + v_type_uint64(F2, [timestamp | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> v_type_sint32(F3, [signal | Path], TrUserData) + end, + if F4 == undefined -> ok; + true -> + v_type_bytes(F4, [packet_hash | Path], TrUserData) + end, + if F5 == undefined -> ok; + true -> v_type_bytes(F5, [signature | Path], TrUserData) + end, + if F6 == undefined -> ok; + true -> v_type_float(F6, [snr | Path], TrUserData) + end, + if F7 == undefined -> ok; + true -> v_type_float(F7, [frequency | Path], TrUserData) + end, + if F8 == undefined -> ok; + true -> v_type_int32(F8, [channel | Path], TrUserData) + end, + if F9 == undefined -> ok; + true -> v_type_string(F9, [datarate | Path], TrUserData) + end, + ok; +v_msg_blockchain_poc_witness_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + blockchain_poc_witness_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_poc_response_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_poc_response_v1_pb/3}). +v_msg_blockchain_poc_response_v1_pb(#blockchain_poc_response_v1_pb{payload + = F1}, + Path, TrUserData) -> + case F1 of + undefined -> ok; + {receipt, OF1} -> + v_msg_blockchain_poc_receipt_v1_pb(OF1, + [receipt, payload | Path], + TrUserData); + {witness, OF1} -> + v_msg_blockchain_poc_witness_v1_pb(OF1, + [witness, payload | Path], + TrUserData); + _ -> mk_type_error(invalid_oneof, F1, [payload | Path]) + end, + ok; +v_msg_blockchain_poc_response_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + blockchain_poc_response_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_poc_path_element_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_poc_path_element_v1_pb/3}). +v_msg_blockchain_poc_path_element_v1_pb(#blockchain_poc_path_element_v1_pb{challengee + = + F1, + receipt + = + F2, + witnesses + = + F3}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> + v_type_bytes(F1, [challengee | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> + v_msg_blockchain_poc_receipt_v1_pb(F2, + [receipt | Path], + TrUserData) + end, + if is_list(F3) -> + _ = [v_msg_blockchain_poc_witness_v1_pb(Elem, + [witnesses | Path], + TrUserData) + || Elem <- F3], + ok; + true -> + mk_type_error({invalid_list_of, + {msg, blockchain_poc_witness_v1_pb}}, + F3, + [witnesses | Path]) + end, + ok; +v_msg_blockchain_poc_path_element_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + blockchain_poc_path_element_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_txn_poc_receipts_v2_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_txn_poc_receipts_v2_pb/3}). +v_msg_blockchain_txn_poc_receipts_v2_pb(#blockchain_txn_poc_receipts_v2_pb{challenger + = + F1, + secret + = + F2, + onion_key_hash + = + F3, + path + = + F4, + fee = + F5, + signature + = + F6, + block_hash + = + F7}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> + v_type_bytes(F1, [challenger | Path], TrUserData) + end, + if F2 == undefined -> ok; + true -> v_type_bytes(F2, [secret | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> + v_type_bytes(F3, [onion_key_hash | Path], TrUserData) + end, + if is_list(F4) -> + _ = [v_msg_blockchain_poc_path_element_v1_pb(Elem, + [path | Path], + TrUserData) + || Elem <- F4], + ok; + true -> + mk_type_error({invalid_list_of, + {msg, blockchain_poc_path_element_v1_pb}}, + F4, + [path | Path]) + end, + if F5 == undefined -> ok; + true -> v_type_uint64(F5, [fee | Path], TrUserData) + end, + if F6 == undefined -> ok; + true -> v_type_bytes(F6, [signature | Path], TrUserData) + end, + if F7 == undefined -> ok; + true -> + v_type_bytes(F7, [block_hash | Path], TrUserData) + end, + ok; +v_msg_blockchain_txn_poc_receipts_v2_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + blockchain_txn_poc_receipts_v2_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_region_params_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_region_params_v1_pb/3}). +v_msg_blockchain_region_params_v1_pb(#blockchain_region_params_v1_pb{region_params + = F1}, + Path, TrUserData) -> + if is_list(F1) -> + _ = [v_msg_blockchain_region_param_v1_pb(Elem, + [region_params | Path], + TrUserData) + || Elem <- F1], + ok; + true -> + mk_type_error({invalid_list_of, + {msg, blockchain_region_param_v1_pb}}, + F1, + [region_params | Path]) + end, + ok; +v_msg_blockchain_region_params_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + blockchain_region_params_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_tagged_spreading_pb/3}). +-dialyzer({nowarn_function,v_msg_tagged_spreading_pb/3}). +v_msg_tagged_spreading_pb(#tagged_spreading_pb{region_spreading + = F1, + max_packet_size = F2}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> + 'v_enum_helium.RegionSpreading'(F1, + [region_spreading | Path], + TrUserData) + end, + if F2 == undefined -> ok; + true -> + v_type_uint32(F2, [max_packet_size | Path], TrUserData) + end, + ok; +v_msg_tagged_spreading_pb(X, Path, _TrUserData) -> + mk_type_error({expected_msg, tagged_spreading_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_region_spreading_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_region_spreading_v1_pb/3}). +v_msg_blockchain_region_spreading_v1_pb(#blockchain_region_spreading_v1_pb{tagged_spreading + = + F1}, + Path, TrUserData) -> + if is_list(F1) -> + _ = [v_msg_tagged_spreading_pb(Elem, + [tagged_spreading | Path], + TrUserData) + || Elem <- F1], + ok; + true -> + mk_type_error({invalid_list_of, + {msg, tagged_spreading_pb}}, + F1, + [tagged_spreading | Path]) + end, + ok; +v_msg_blockchain_region_spreading_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + blockchain_region_spreading_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,v_msg_blockchain_region_param_v1_pb/3}). +-dialyzer({nowarn_function,v_msg_blockchain_region_param_v1_pb/3}). +v_msg_blockchain_region_param_v1_pb(#blockchain_region_param_v1_pb{channel_frequency + = F1, + bandwidth = + F2, + max_eirp = + F3, + spreading = + F4}, + Path, TrUserData) -> + if F1 == undefined -> ok; + true -> + v_type_uint64(F1, + [channel_frequency | Path], + TrUserData) + end, + if F2 == undefined -> ok; + true -> + v_type_uint32(F2, [bandwidth | Path], TrUserData) + end, + if F3 == undefined -> ok; + true -> v_type_uint32(F3, [max_eirp | Path], TrUserData) + end, + if F4 == undefined -> ok; + true -> + v_msg_blockchain_region_spreading_v1_pb(F4, + [spreading | Path], + TrUserData) + end, + ok; +v_msg_blockchain_region_param_v1_pb(X, Path, + _TrUserData) -> + mk_type_error({expected_msg, + blockchain_region_param_v1_pb}, + X, + Path). + +-compile({nowarn_unused_function,'v_enum_helium.close_state'/3}). +-dialyzer({nowarn_function,'v_enum_helium.close_state'/3}). +'v_enum_helium.close_state'(close_state_closable, _Path, + _TrUserData) -> + ok; +'v_enum_helium.close_state'(close_state_closing, _Path, + _TrUserData) -> + ok; +'v_enum_helium.close_state'(close_state_closed, _Path, + _TrUserData) -> + ok; +'v_enum_helium.close_state'(close_state_dispute, _Path, + _TrUserData) -> + ok; +'v_enum_helium.close_state'(V, Path, TrUserData) + when is_integer(V) -> + v_type_sint32(V, Path, TrUserData); +'v_enum_helium.close_state'(X, Path, _TrUserData) -> + mk_type_error({invalid_enum, 'helium.close_state'}, + X, + Path). + +-compile({nowarn_unused_function,'v_enum_helium.blockchain_state_channel_state_v1'/3}). +-dialyzer({nowarn_function,'v_enum_helium.blockchain_state_channel_state_v1'/3}). +'v_enum_helium.blockchain_state_channel_state_v1'(open, + _Path, _TrUserData) -> + ok; +'v_enum_helium.blockchain_state_channel_state_v1'(closed, + _Path, _TrUserData) -> + ok; +'v_enum_helium.blockchain_state_channel_state_v1'(V, + Path, TrUserData) + when is_integer(V) -> + v_type_sint32(V, Path, TrUserData); +'v_enum_helium.blockchain_state_channel_state_v1'(X, + Path, _TrUserData) -> + mk_type_error({invalid_enum, + 'helium.blockchain_state_channel_state_v1'}, + X, + Path). + +-compile({nowarn_unused_function,'v_enum_packet_pb.packet_type'/3}). +-dialyzer({nowarn_function,'v_enum_packet_pb.packet_type'/3}). +'v_enum_packet_pb.packet_type'(longfi, _Path, + _TrUserData) -> + ok; +'v_enum_packet_pb.packet_type'(lorawan, _Path, + _TrUserData) -> + ok; +'v_enum_packet_pb.packet_type'(V, Path, TrUserData) + when is_integer(V) -> + v_type_sint32(V, Path, TrUserData); +'v_enum_packet_pb.packet_type'(X, Path, _TrUserData) -> + mk_type_error({invalid_enum, 'packet_pb.packet_type'}, + X, + Path). + +-compile({nowarn_unused_function,'v_enum_helium.region'/3}). +-dialyzer({nowarn_function,'v_enum_helium.region'/3}). +'v_enum_helium.region'('US915', _Path, _TrUserData) -> + ok; +'v_enum_helium.region'('EU868', _Path, _TrUserData) -> + ok; +'v_enum_helium.region'('EU433', _Path, _TrUserData) -> + ok; +'v_enum_helium.region'('CN470', _Path, _TrUserData) -> + ok; +'v_enum_helium.region'('CN779', _Path, _TrUserData) -> + ok; +'v_enum_helium.region'('AU915', _Path, _TrUserData) -> + ok; +'v_enum_helium.region'('AS923_1', _Path, _TrUserData) -> + ok; +'v_enum_helium.region'('KR920', _Path, _TrUserData) -> + ok; +'v_enum_helium.region'('IN865', _Path, _TrUserData) -> + ok; +'v_enum_helium.region'('AS923_2', _Path, _TrUserData) -> + ok; +'v_enum_helium.region'('AS923_3', _Path, _TrUserData) -> + ok; +'v_enum_helium.region'('AS923_4', _Path, _TrUserData) -> + ok; +'v_enum_helium.region'(V, Path, TrUserData) + when is_integer(V) -> + v_type_sint32(V, Path, TrUserData); +'v_enum_helium.region'(X, Path, _TrUserData) -> + mk_type_error({invalid_enum, 'helium.region'}, X, Path). + +-compile({nowarn_unused_function,'v_enum_helium.origin'/3}). +-dialyzer({nowarn_function,'v_enum_helium.origin'/3}). +'v_enum_helium.origin'(p2p, _Path, _TrUserData) -> ok; +'v_enum_helium.origin'(radio, _Path, _TrUserData) -> ok; +'v_enum_helium.origin'(V, Path, TrUserData) + when is_integer(V) -> + v_type_sint32(V, Path, TrUserData); +'v_enum_helium.origin'(X, Path, _TrUserData) -> + mk_type_error({invalid_enum, 'helium.origin'}, X, Path). + +-compile({nowarn_unused_function,'v_enum_helium.RegionSpreading'/3}). +-dialyzer({nowarn_function,'v_enum_helium.RegionSpreading'/3}). +'v_enum_helium.RegionSpreading'('SF_INVALID', _Path, + _TrUserData) -> + ok; +'v_enum_helium.RegionSpreading'('SF7', _Path, + _TrUserData) -> + ok; +'v_enum_helium.RegionSpreading'('SF8', _Path, + _TrUserData) -> + ok; +'v_enum_helium.RegionSpreading'('SF9', _Path, + _TrUserData) -> + ok; +'v_enum_helium.RegionSpreading'('SF10', _Path, + _TrUserData) -> + ok; +'v_enum_helium.RegionSpreading'('SF11', _Path, + _TrUserData) -> + ok; +'v_enum_helium.RegionSpreading'('SF12', _Path, + _TrUserData) -> + ok; +'v_enum_helium.RegionSpreading'(V, Path, TrUserData) + when is_integer(V) -> + v_type_sint32(V, Path, TrUserData); +'v_enum_helium.RegionSpreading'(X, Path, _TrUserData) -> + mk_type_error({invalid_enum, 'helium.RegionSpreading'}, + X, + Path). + +-compile({nowarn_unused_function,v_type_sint32/3}). +-dialyzer({nowarn_function,v_type_sint32/3}). +v_type_sint32(N, _Path, _TrUserData) + when -2147483648 =< N, N =< 2147483647 -> + ok; +v_type_sint32(N, Path, _TrUserData) + when is_integer(N) -> + mk_type_error({value_out_of_range, sint32, signed, 32}, + N, + Path); +v_type_sint32(X, Path, _TrUserData) -> + mk_type_error({bad_integer, sint32, signed, 32}, + X, + Path). + +-compile({nowarn_unused_function,v_type_int32/3}). +-dialyzer({nowarn_function,v_type_int32/3}). +v_type_int32(N, _Path, _TrUserData) + when -2147483648 =< N, N =< 2147483647 -> + ok; +v_type_int32(N, Path, _TrUserData) when is_integer(N) -> + mk_type_error({value_out_of_range, int32, signed, 32}, + N, + Path); +v_type_int32(X, Path, _TrUserData) -> + mk_type_error({bad_integer, int32, signed, 32}, + X, + Path). + +-compile({nowarn_unused_function,v_type_uint32/3}). +-dialyzer({nowarn_function,v_type_uint32/3}). +v_type_uint32(N, _Path, _TrUserData) + when 0 =< N, N =< 4294967295 -> + ok; +v_type_uint32(N, Path, _TrUserData) + when is_integer(N) -> + mk_type_error({value_out_of_range, + uint32, + unsigned, + 32}, + N, + Path); +v_type_uint32(X, Path, _TrUserData) -> + mk_type_error({bad_integer, uint32, unsigned, 32}, + X, + Path). + +-compile({nowarn_unused_function,v_type_uint64/3}). +-dialyzer({nowarn_function,v_type_uint64/3}). +v_type_uint64(N, _Path, _TrUserData) + when 0 =< N, N =< 18446744073709551615 -> + ok; +v_type_uint64(N, Path, _TrUserData) + when is_integer(N) -> + mk_type_error({value_out_of_range, + uint64, + unsigned, + 64}, + N, + Path); +v_type_uint64(X, Path, _TrUserData) -> + mk_type_error({bad_integer, uint64, unsigned, 64}, + X, + Path). + +-compile({nowarn_unused_function,v_type_bool/3}). +-dialyzer({nowarn_function,v_type_bool/3}). +v_type_bool(false, _Path, _TrUserData) -> ok; +v_type_bool(true, _Path, _TrUserData) -> ok; +v_type_bool(0, _Path, _TrUserData) -> ok; +v_type_bool(1, _Path, _TrUserData) -> ok; +v_type_bool(X, Path, _TrUserData) -> + mk_type_error(bad_boolean_value, X, Path). + +-compile({nowarn_unused_function,v_type_float/3}). +-dialyzer({nowarn_function,v_type_float/3}). +v_type_float(N, _Path, _TrUserData) when is_float(N) -> + ok; +v_type_float(N, _Path, _TrUserData) + when is_integer(N) -> + ok; +v_type_float(infinity, _Path, _TrUserData) -> ok; +v_type_float('-infinity', _Path, _TrUserData) -> ok; +v_type_float(nan, _Path, _TrUserData) -> ok; +v_type_float(X, Path, _TrUserData) -> + mk_type_error(bad_float_value, X, Path). + +-compile({nowarn_unused_function,v_type_string/3}). +-dialyzer({nowarn_function,v_type_string/3}). +v_type_string(S, Path, _TrUserData) + when is_list(S); is_binary(S) -> + try unicode:characters_to_binary(S) of + B when is_binary(B) -> ok; + {error, _, _} -> + mk_type_error(bad_unicode_string, S, Path) + catch + error:badarg -> + mk_type_error(bad_unicode_string, S, Path) + end; +v_type_string(X, Path, _TrUserData) -> + mk_type_error(bad_unicode_string, X, Path). + +-compile({nowarn_unused_function,v_type_bytes/3}). +-dialyzer({nowarn_function,v_type_bytes/3}). +v_type_bytes(B, _Path, _TrUserData) when is_binary(B) -> + ok; +v_type_bytes(B, _Path, _TrUserData) when is_list(B) -> + ok; +v_type_bytes(X, Path, _TrUserData) -> + mk_type_error(bad_binary_value, X, Path). + +-compile({nowarn_unused_function,mk_type_error/3}). +-spec mk_type_error(_, _, list()) -> no_return(). +mk_type_error(Error, ValueSeen, Path) -> + Path2 = prettify_path(Path), + erlang:error({gpb_type_error, + {Error, [{value, ValueSeen}, {path, Path2}]}}). + + +-compile({nowarn_unused_function,prettify_path/1}). +-dialyzer({nowarn_function,prettify_path/1}). +prettify_path([]) -> top_level; +prettify_path(PathR) -> + list_to_atom(lists:append(lists:join(".", + lists:map(fun atom_to_list/1, + lists:reverse(PathR))))). + + +-compile({nowarn_unused_function,id/2}). +-compile({inline,id/2}). +id(X, _TrUserData) -> X. + +-compile({nowarn_unused_function,v_ok/3}). +-compile({inline,v_ok/3}). +v_ok(_Value, _Path, _TrUserData) -> ok. + +-compile({nowarn_unused_function,m_overwrite/3}). +-compile({inline,m_overwrite/3}). +m_overwrite(_Prev, New, _TrUserData) -> New. + +-compile({nowarn_unused_function,cons/3}). +-compile({inline,cons/3}). +cons(Elem, Acc, _TrUserData) -> [Elem | Acc]. + +-compile({nowarn_unused_function,lists_reverse/2}). +-compile({inline,lists_reverse/2}). +'lists_reverse'(L, _TrUserData) -> lists:reverse(L). +-compile({nowarn_unused_function,'erlang_++'/3}). +-compile({inline,'erlang_++'/3}). +'erlang_++'(A, B, _TrUserData) -> A ++ B. + + +get_msg_defs() -> + [{{enum, 'helium.close_state'}, + [{close_state_closable, 0}, + {close_state_closing, 1}, + {close_state_closed, 2}, + {close_state_dispute, 3}]}, + {{enum, 'helium.blockchain_state_channel_state_v1'}, + [{open, 0}, {closed, 1}]}, + {{enum, 'packet_pb.packet_type'}, + [{longfi, 0}, {lorawan, 1}]}, + {{enum, 'helium.region'}, + [{'US915', 0}, + {'EU868', 1}, + {'EU433', 2}, + {'CN470', 3}, + {'CN779', 4}, + {'AU915', 5}, + {'AS923_1', 6}, + {'KR920', 7}, + {'IN865', 8}, + {'AS923_2', 9}, + {'AS923_3', 10}, + {'AS923_4', 11}]}, + {{enum, 'helium.origin'}, [{p2p, 0}, {radio, 1}]}, + {{enum, 'helium.RegionSpreading'}, + [{'SF_INVALID', 0}, + {'SF7', 1}, + {'SF8', 2}, + {'SF9', 3}, + {'SF10', 4}, + {'SF11', 5}, + {'SF12', 6}]}, + {{msg, empty_pb}, []}, + {{msg, gateway_success_resp_pb}, + [[{name, resp}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, details}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, gateway_error_resp_pb}, + [[{name, error}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, details}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, gateway_config_req_v1_pb}, + [[{name, keys}, + {fnum, 1}, + {rnum, 2}, + {type, string}, + {occurrence, repeated}, + {opts, []}]]}, + {{msg, gateway_config_resp_v1_pb}, + [[{name, result}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, blockchain_var_v1_pb}}, + {occurrence, repeated}, + {opts, []}]]}, + {{msg, gateway_config_update_req_v1_pb}, []}, + {{msg, gateway_config_update_streamed_resp_v1_pb}, + [[{name, keys}, + {fnum, 1}, + {rnum, 2}, + {type, string}, + {occurrence, repeated}, + {opts, []}]]}, + {{msg, gateway_validators_req_v1_pb}, + [[{name, quantity}, + {fnum, 1}, + {rnum, 2}, + {type, uint32}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, gateway_validators_resp_v1_pb}, + [[{name, result}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, routing_address_pb}}, + {occurrence, repeated}, + {opts, []}]]}, + {{msg, gateway_region_params_streamed_resp_v1_pb}, + [[{name, address}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, region}, + {fnum, 2}, + {rnum, 3}, + {type, {enum, 'helium.region'}}, + {occurrence, optional}, + {opts, []}], + [{name, params}, + {fnum, 3}, + {rnum, 4}, + {type, {msg, blockchain_region_params_v1_pb}}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, gateway_region_params_update_req_v1_pb}, + [[{name, address}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, gateway_resp_v1_pb}, + [[{name, height}, + {fnum, 1}, + {rnum, 2}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, msg}, + {rnum, 4}, + {fields, + [[{name, is_active_resp}, + {fnum, 3}, + {rnum, 4}, + {type, {msg, gateway_sc_is_active_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, is_overpaid_resp}, + {fnum, 4}, + {rnum, 4}, + {type, {msg, gateway_sc_is_overpaid_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, close_resp}, + {fnum, 5}, + {rnum, 4}, + {type, {msg, gateway_sc_close_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, follow_streamed_resp}, + {fnum, 6}, + {rnum, 4}, + {type, {msg, gateway_sc_follow_streamed_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, routing_streamed_resp}, + {fnum, 7}, + {rnum, 4}, + {type, {msg, gateway_routing_streamed_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, config_resp}, + {fnum, 8}, + {rnum, 4}, + {type, {msg, gateway_config_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, config_update_streamed_resp}, + {fnum, 9}, + {rnum, 4}, + {type, + {msg, gateway_config_update_streamed_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, validators_resp}, + {fnum, 12}, + {rnum, 4}, + {type, {msg, gateway_validators_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, region_params_streamed_resp}, + {fnum, 13}, + {rnum, 4}, + {type, + {msg, gateway_region_params_streamed_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, success_resp}, + {fnum, 14}, + {rnum, 4}, + {type, {msg, gateway_success_resp_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, error_resp}, + {fnum, 15}, + {rnum, 4}, + {type, {msg, gateway_error_resp_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, poc_challenge_resp}, + {fnum, 16}, + {rnum, 4}, + {type, + {msg, gateway_poc_challenge_notification_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, poc_check_target_resp}, + {fnum, 17}, + {rnum, 4}, + {type, + {msg, gateway_poc_check_challenge_target_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, public_route}, + {fnum, 18}, + {rnum, 4}, + {type, {msg, gateway_public_routing_data_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}]]}], + [{name, block_time}, + {fnum, 10}, + {rnum, 5}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, block_age}, + {fnum, 11}, + {rnum, 6}, + {type, uint64}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, gateway_sc_is_active_req_v1_pb}, + [[{name, sc_id}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, sc_owner}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, gateway_sc_is_active_resp_v1_pb}, + [[{name, sc_id}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, sc_owner}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, active}, + {fnum, 3}, + {rnum, 4}, + {type, bool}, + {occurrence, optional}, + {opts, []}], + [{name, sc_expiry_at_block}, + {fnum, 4}, + {rnum, 5}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, sc_original_dc_amount}, + {fnum, 5}, + {rnum, 6}, + {type, uint64}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, gateway_sc_is_overpaid_req_v1_pb}, + [[{name, sc_id}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, sc_owner}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, total_dcs}, + {fnum, 3}, + {rnum, 4}, + {type, uint64}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, gateway_sc_is_overpaid_resp_v1_pb}, + [[{name, sc_id}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, sc_owner}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, overpaid}, + {fnum, 3}, + {rnum, 4}, + {type, bool}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, gateway_sc_close_req_v1_pb}, + [[{name, close_txn}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, blockchain_txn_state_channel_close_v1_pb}}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, gateway_sc_close_resp_v1_pb}, + [[{name, sc_id}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, response}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, gateway_sc_follow_req_v1_pb}, + [[{name, sc_id}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, sc_owner}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, gateway_sc_follow_streamed_resp_v1_pb}, + [[{name, sc_id}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, sc_owner}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, close_state}, + {fnum, 3}, + {rnum, 4}, + {type, {enum, 'helium.close_state'}}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, routing_pb}, + [[{name, oui}, + {fnum, 1}, + {rnum, 2}, + {type, uint32}, + {occurrence, optional}, + {opts, []}], + [{name, owner}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, addresses}, + {fnum, 3}, + {rnum, 4}, + {type, {msg, routing_address_pb}}, + {occurrence, repeated}, + {opts, []}], + [{name, filters}, + {fnum, 4}, + {rnum, 5}, + {type, bytes}, + {occurrence, repeated}, + {opts, []}], + [{name, subnets}, + {fnum, 5}, + {rnum, 6}, + {type, bytes}, + {occurrence, repeated}, + {opts, []}]]}, + {{msg, routing_address_pb}, + [[{name, pub_key}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, uri}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, gateway_routing_req_v1_pb}, + [[{name, height}, + {fnum, 1}, + {rnum, 2}, + {type, uint64}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, gateway_routing_streamed_resp_v1_pb}, + [[{name, routings}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, routing_pb}}, + {occurrence, repeated}, + {opts, []}]]}, + {{msg, gateway_poc_req_v1_pb}, + [[{name, address}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, gateway_poc_challenge_notification_resp_v1_pb}, + [[{name, challenger}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, routing_address_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, block_hash}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, onion_key_hash}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, gateway_poc_check_challenge_target_req_v1_pb}, + [[{name, address}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, challenger}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, block_hash}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, onion_key_hash}, + {fnum, 4}, + {rnum, 5}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, height}, + {fnum, 5}, + {rnum, 6}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, notifier}, + {fnum, 6}, + {rnum, 7}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, notifier_sig}, + {fnum, 7}, + {rnum, 8}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, challengee_sig}, + {fnum, 8}, + {rnum, 9}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, gateway_poc_check_challenge_target_resp_v1_pb}, + [[{name, target}, + {fnum, 1}, + {rnum, 2}, + {type, bool}, + {occurrence, optional}, + {opts, []}], + [{name, onion}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, gateway_poc_report_req_v1_pb}, + [[{name, onion_key_hash}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, msg}, + {rnum, 3}, + {fields, + [[{name, receipt}, + {fnum, 2}, + {rnum, 3}, + {type, {msg, blockchain_poc_receipt_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, witness}, + {fnum, 3}, + {rnum, 3}, + {type, {msg, blockchain_poc_witness_v1_pb}}, + {occurrence, optional}, + {opts, []}]]}]]}, + {{msg, gateway_address_routing_data_req_v1_pb}, + [[{name, address}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, gateway_poc_key_routing_data_req_v1_pb}, + [[{name, key}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, gateway_public_routing_data_resp_v1_pb}, + [[{name, address}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, public_uri}, + {fnum, 2}, + {rnum, 3}, + {type, {msg, routing_address_pb}}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, blockchain_state_channel_summary_v1_pb}, + [[{name, client_pubkeybin}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, num_packets}, + {fnum, 2}, + {rnum, 3}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, num_dcs}, + {fnum, 3}, + {rnum, 4}, + {type, uint64}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, blockchain_state_channel_v1_pb}, + [[{name, id}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, owner}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, credits}, + {fnum, 3}, + {rnum, 4}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, nonce}, + {fnum, 4}, + {rnum, 5}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, summaries}, + {fnum, 5}, + {rnum, 6}, + {type, {msg, blockchain_state_channel_summary_v1_pb}}, + {occurrence, repeated}, + {opts, []}], + [{name, root_hash}, + {fnum, 6}, + {rnum, 7}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, skewed}, + {fnum, 7}, + {rnum, 8}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, state}, + {fnum, 8}, + {rnum, 9}, + {type, + {enum, 'helium.blockchain_state_channel_state_v1'}}, + {occurrence, optional}, + {opts, []}], + [{name, expire_at_block}, + {fnum, 9}, + {rnum, 10}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 10}, + {rnum, 11}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, blockchain_state_channel_response_v1_pb}, + [[{name, accepted}, + {fnum, 1}, + {rnum, 2}, + {type, bool}, + {occurrence, optional}, + {opts, []}], + [{name, downlink}, + {fnum, 4}, + {rnum, 3}, + {type, {msg, packet_pb}}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, blockchain_state_channel_packet_v1_pb}, + [[{name, packet}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, packet_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, hotspot}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, region}, + {fnum, 4}, + {rnum, 5}, + {type, {enum, 'helium.region'}}, + {occurrence, optional}, + {opts, []}], + [{name, hold_time}, + {fnum, 5}, + {rnum, 6}, + {type, uint64}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, blockchain_state_channel_offer_v1_pb}, + [[{name, routing}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, routing_information_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, packet_hash}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, payload_size}, + {fnum, 3}, + {rnum, 4}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, fcnt}, + {fnum, 4}, + {rnum, 5}, + {type, uint32}, + {occurrence, optional}, + {opts, []}], + [{name, hotspot}, + {fnum, 5}, + {rnum, 6}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 6}, + {rnum, 7}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, region}, + {fnum, 7}, + {rnum, 8}, + {type, {enum, 'helium.region'}}, + {occurrence, optional}, + {opts, []}], + [{name, req_diff}, + {fnum, 8}, + {rnum, 9}, + {type, bool}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, blockchain_state_channel_purchase_v1_pb}, + [[{name, sc}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, blockchain_state_channel_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, hotspot}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, packet_hash}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, region}, + {fnum, 4}, + {rnum, 5}, + {type, {enum, 'helium.region'}}, + {occurrence, optional}, + {opts, []}], + [{name, sc_diff}, + {fnum, 5}, + {rnum, 6}, + {type, {msg, blockchain_state_channel_diff_v1_pb}}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, blockchain_state_channel_diff_v1_pb}, + [[{name, id}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, add_nonce}, + {fnum, 2}, + {rnum, 3}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, diffs}, + {fnum, 4}, + {rnum, 5}, + {type, + {msg, blockchain_state_channel_diff_entry_v1_pb}}, + {occurrence, repeated}, + {opts, []}]]}, + {{msg, blockchain_state_channel_diff_entry_v1_pb}, + [[{name, entry}, + {rnum, 2}, + {fields, + [[{name, append}, + {fnum, 1}, + {rnum, 2}, + {type, + {msg, + blockchain_state_channel_diff_append_summary_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, add}, + {fnum, 2}, + {rnum, 2}, + {type, + {msg, + blockchain_state_channel_diff_update_summary_v1_pb}}, + {occurrence, optional}, + {opts, []}]]}]]}, + {{msg, + blockchain_state_channel_diff_append_summary_v1_pb}, + [[{name, client_pubkeybin}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, num_packets}, + {fnum, 2}, + {rnum, 3}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, num_dcs}, + {fnum, 3}, + {rnum, 4}, + {type, uint64}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, + blockchain_state_channel_diff_update_summary_v1_pb}, + [[{name, client_index}, + {fnum, 1}, + {rnum, 2}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, add_packets}, + {fnum, 2}, + {rnum, 3}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, add_dcs}, + {fnum, 3}, + {rnum, 4}, + {type, uint64}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, blockchain_state_channel_banner_v1_pb}, + [[{name, sc}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, blockchain_state_channel_v1_pb}}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, blockchain_state_channel_rejection_v1_pb}, + [[{name, reject}, + {fnum, 1}, + {rnum, 2}, + {type, uint32}, + {occurrence, optional}, + {opts, []}], + [{name, packet_hash}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, blockchain_state_channel_message_v1_pb}, + [[{name, msg}, + {rnum, 2}, + {fields, + [[{name, response}, + {fnum, 2}, + {rnum, 2}, + {type, {msg, blockchain_state_channel_response_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, packet}, + {fnum, 4}, + {rnum, 2}, + {type, {msg, blockchain_state_channel_packet_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, offer}, + {fnum, 5}, + {rnum, 2}, + {type, {msg, blockchain_state_channel_offer_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, purchase}, + {fnum, 6}, + {rnum, 2}, + {type, {msg, blockchain_state_channel_purchase_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, banner}, + {fnum, 7}, + {rnum, 2}, + {type, {msg, blockchain_state_channel_banner_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, reject}, + {fnum, 8}, + {rnum, 2}, + {type, {msg, blockchain_state_channel_rejection_v1_pb}}, + {occurrence, optional}, + {opts, []}]]}]]}, + {{msg, eui_pb}, + [[{name, deveui}, + {fnum, 1}, + {rnum, 2}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, appeui}, + {fnum, 2}, + {rnum, 3}, + {type, uint64}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, routing_information_pb}, + [[{name, data}, + {rnum, 2}, + {fields, + [[{name, devaddr}, + {fnum, 1}, + {rnum, 2}, + {type, uint32}, + {occurrence, optional}, + {opts, []}], + [{name, eui}, + {fnum, 2}, + {rnum, 2}, + {type, {msg, eui_pb}}, + {occurrence, optional}, + {opts, []}]]}]]}, + {{msg, window_pb}, + [[{name, timestamp}, + {fnum, 1}, + {rnum, 2}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, frequency}, + {fnum, 2}, + {rnum, 3}, + {type, float}, + {occurrence, optional}, + {opts, []}], + [{name, datarate}, + {fnum, 3}, + {rnum, 4}, + {type, string}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, packet_pb}, + [[{name, oui}, + {fnum, 1}, + {rnum, 2}, + {type, uint32}, + {occurrence, optional}, + {opts, []}], + [{name, type}, + {fnum, 2}, + {rnum, 3}, + {type, {enum, 'packet_pb.packet_type'}}, + {occurrence, optional}, + {opts, []}], + [{name, payload}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, timestamp}, + {fnum, 4}, + {rnum, 5}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, signal_strength}, + {fnum, 5}, + {rnum, 6}, + {type, float}, + {occurrence, optional}, + {opts, []}], + [{name, frequency}, + {fnum, 6}, + {rnum, 7}, + {type, float}, + {occurrence, optional}, + {opts, []}], + [{name, datarate}, + {fnum, 7}, + {rnum, 8}, + {type, string}, + {occurrence, optional}, + {opts, []}], + [{name, snr}, + {fnum, 8}, + {rnum, 9}, + {type, float}, + {occurrence, optional}, + {opts, []}], + [{name, routing}, + {fnum, 9}, + {rnum, 10}, + {type, {msg, routing_information_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, rx2_window}, + {fnum, 10}, + {rnum, 11}, + {type, {msg, window_pb}}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, blockchain_txn_state_channel_close_v1_pb}, + [[{name, state_channel}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, blockchain_state_channel_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, closer}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, fee}, + {fnum, 4}, + {rnum, 5}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, conflicts_with}, + {fnum, 5}, + {rnum, 6}, + {type, {msg, blockchain_state_channel_v1_pb}}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, blockchain_var_v1_pb}, + [[{name, name}, + {fnum, 1}, + {rnum, 2}, + {type, string}, + {occurrence, optional}, + {opts, []}], + [{name, type}, + {fnum, 2}, + {rnum, 3}, + {type, string}, + {occurrence, optional}, + {opts, []}], + [{name, value}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, blockchain_txn_vars_v1_pb}, + [[{name, vars}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, blockchain_var_v1_pb}}, + {occurrence, repeated}, + {opts, []}], + [{name, version_predicate}, + {fnum, 2}, + {rnum, 3}, + {type, uint32}, + {occurrence, optional}, + {opts, []}], + [{name, proof}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, master_key}, + {fnum, 4}, + {rnum, 5}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, key_proof}, + {fnum, 5}, + {rnum, 6}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, cancels}, + {fnum, 6}, + {rnum, 7}, + {type, bytes}, + {occurrence, repeated}, + {opts, []}], + [{name, unsets}, + {fnum, 7}, + {rnum, 8}, + {type, bytes}, + {occurrence, repeated}, + {opts, []}], + [{name, nonce}, + {fnum, 8}, + {rnum, 9}, + {type, uint32}, + {occurrence, optional}, + {opts, []}], + [{name, multi_keys}, + {fnum, 9}, + {rnum, 10}, + {type, bytes}, + {occurrence, repeated}, + {opts, []}], + [{name, multi_proofs}, + {fnum, 10}, + {rnum, 11}, + {type, bytes}, + {occurrence, repeated}, + {opts, []}], + [{name, multi_key_proofs}, + {fnum, 11}, + {rnum, 12}, + {type, bytes}, + {occurrence, repeated}, + {opts, []}]]}, + {{msg, blockchain_txn_poc_receipts_v1_pb}, + [[{name, challenger}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, secret}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, onion_key_hash}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, path}, + {fnum, 4}, + {rnum, 5}, + {type, {msg, blockchain_poc_path_element_v1_pb}}, + {occurrence, repeated}, + {opts, []}], + [{name, fee}, + {fnum, 5}, + {rnum, 6}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 6}, + {rnum, 7}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, request_block_hash}, + {fnum, 7}, + {rnum, 8}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, blockchain_poc_receipt_v1_pb}, + [[{name, gateway}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, timestamp}, + {fnum, 2}, + {rnum, 3}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, signal}, + {fnum, 3}, + {rnum, 4}, + {type, sint32}, + {occurrence, optional}, + {opts, []}], + [{name, data}, + {fnum, 4}, + {rnum, 5}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, origin}, + {fnum, 5}, + {rnum, 6}, + {type, {enum, 'helium.origin'}}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 6}, + {rnum, 7}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, snr}, + {fnum, 7}, + {rnum, 8}, + {type, float}, + {occurrence, optional}, + {opts, []}], + [{name, frequency}, + {fnum, 8}, + {rnum, 9}, + {type, float}, + {occurrence, optional}, + {opts, []}], + [{name, channel}, + {fnum, 9}, + {rnum, 10}, + {type, int32}, + {occurrence, optional}, + {opts, []}], + [{name, datarate}, + {fnum, 10}, + {rnum, 11}, + {type, string}, + {occurrence, optional}, + {opts, []}], + [{name, addr_hash}, + {fnum, 11}, + {rnum, 12}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, tx_power}, + {fnum, 12}, + {rnum, 13}, + {type, int32}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, blockchain_poc_witness_v1_pb}, + [[{name, gateway}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, timestamp}, + {fnum, 2}, + {rnum, 3}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, signal}, + {fnum, 3}, + {rnum, 4}, + {type, sint32}, + {occurrence, optional}, + {opts, []}], + [{name, packet_hash}, + {fnum, 4}, + {rnum, 5}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 5}, + {rnum, 6}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, snr}, + {fnum, 6}, + {rnum, 7}, + {type, float}, + {occurrence, optional}, + {opts, []}], + [{name, frequency}, + {fnum, 7}, + {rnum, 8}, + {type, float}, + {occurrence, optional}, + {opts, []}], + [{name, channel}, + {fnum, 8}, + {rnum, 9}, + {type, int32}, + {occurrence, optional}, + {opts, []}], + [{name, datarate}, + {fnum, 9}, + {rnum, 10}, + {type, string}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, blockchain_poc_response_v1_pb}, + [[{name, payload}, + {rnum, 2}, + {fields, + [[{name, receipt}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, blockchain_poc_receipt_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, witness}, + {fnum, 2}, + {rnum, 2}, + {type, {msg, blockchain_poc_witness_v1_pb}}, + {occurrence, optional}, + {opts, []}]]}]]}, + {{msg, blockchain_poc_path_element_v1_pb}, + [[{name, challengee}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, receipt}, + {fnum, 2}, + {rnum, 3}, + {type, {msg, blockchain_poc_receipt_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, witnesses}, + {fnum, 3}, + {rnum, 4}, + {type, {msg, blockchain_poc_witness_v1_pb}}, + {occurrence, repeated}, + {opts, []}]]}, + {{msg, blockchain_txn_poc_receipts_v2_pb}, + [[{name, challenger}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, secret}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, onion_key_hash}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, path}, + {fnum, 4}, + {rnum, 5}, + {type, {msg, blockchain_poc_path_element_v1_pb}}, + {occurrence, repeated}, + {opts, []}], + [{name, fee}, + {fnum, 5}, + {rnum, 6}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 6}, + {rnum, 7}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, block_hash}, + {fnum, 7}, + {rnum, 8}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, blockchain_region_params_v1_pb}, + [[{name, region_params}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, blockchain_region_param_v1_pb}}, + {occurrence, repeated}, + {opts, []}]]}, + {{msg, tagged_spreading_pb}, + [[{name, region_spreading}, + {fnum, 1}, + {rnum, 2}, + {type, {enum, 'helium.RegionSpreading'}}, + {occurrence, optional}, + {opts, []}], + [{name, max_packet_size}, + {fnum, 2}, + {rnum, 3}, + {type, uint32}, + {occurrence, optional}, + {opts, []}]]}, + {{msg, blockchain_region_spreading_v1_pb}, + [[{name, tagged_spreading}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, tagged_spreading_pb}}, + {occurrence, repeated}, + {opts, []}]]}, + {{msg, blockchain_region_param_v1_pb}, + [[{name, channel_frequency}, + {fnum, 1}, + {rnum, 2}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, bandwidth}, + {fnum, 2}, + {rnum, 3}, + {type, uint32}, + {occurrence, optional}, + {opts, []}], + [{name, max_eirp}, + {fnum, 3}, + {rnum, 4}, + {type, uint32}, + {occurrence, optional}, + {opts, []}], + [{name, spreading}, + {fnum, 4}, + {rnum, 5}, + {type, {msg, blockchain_region_spreading_v1_pb}}, + {occurrence, optional}, + {opts, []}]]}]. + + +get_msg_names() -> + [empty_pb, + gateway_success_resp_pb, + gateway_error_resp_pb, + gateway_config_req_v1_pb, + gateway_config_resp_v1_pb, + gateway_config_update_req_v1_pb, + gateway_config_update_streamed_resp_v1_pb, + gateway_validators_req_v1_pb, + gateway_validators_resp_v1_pb, + gateway_region_params_streamed_resp_v1_pb, + gateway_region_params_update_req_v1_pb, + gateway_resp_v1_pb, + gateway_sc_is_active_req_v1_pb, + gateway_sc_is_active_resp_v1_pb, + gateway_sc_is_overpaid_req_v1_pb, + gateway_sc_is_overpaid_resp_v1_pb, + gateway_sc_close_req_v1_pb, + gateway_sc_close_resp_v1_pb, + gateway_sc_follow_req_v1_pb, + gateway_sc_follow_streamed_resp_v1_pb, + routing_pb, + routing_address_pb, + gateway_routing_req_v1_pb, + gateway_routing_streamed_resp_v1_pb, + gateway_poc_req_v1_pb, + gateway_poc_challenge_notification_resp_v1_pb, + gateway_poc_check_challenge_target_req_v1_pb, + gateway_poc_check_challenge_target_resp_v1_pb, + gateway_poc_report_req_v1_pb, + gateway_address_routing_data_req_v1_pb, + gateway_poc_key_routing_data_req_v1_pb, + gateway_public_routing_data_resp_v1_pb, + blockchain_state_channel_summary_v1_pb, + blockchain_state_channel_v1_pb, + blockchain_state_channel_response_v1_pb, + blockchain_state_channel_packet_v1_pb, + blockchain_state_channel_offer_v1_pb, + blockchain_state_channel_purchase_v1_pb, + blockchain_state_channel_diff_v1_pb, + blockchain_state_channel_diff_entry_v1_pb, + blockchain_state_channel_diff_append_summary_v1_pb, + blockchain_state_channel_diff_update_summary_v1_pb, + blockchain_state_channel_banner_v1_pb, + blockchain_state_channel_rejection_v1_pb, + blockchain_state_channel_message_v1_pb, + eui_pb, + routing_information_pb, + window_pb, + packet_pb, + blockchain_txn_state_channel_close_v1_pb, + blockchain_var_v1_pb, + blockchain_txn_vars_v1_pb, + blockchain_txn_poc_receipts_v1_pb, + blockchain_poc_receipt_v1_pb, + blockchain_poc_witness_v1_pb, + blockchain_poc_response_v1_pb, + blockchain_poc_path_element_v1_pb, + blockchain_txn_poc_receipts_v2_pb, + blockchain_region_params_v1_pb, + tagged_spreading_pb, + blockchain_region_spreading_v1_pb, + blockchain_region_param_v1_pb]. + + +get_group_names() -> []. + + +get_msg_or_group_names() -> + [empty_pb, + gateway_success_resp_pb, + gateway_error_resp_pb, + gateway_config_req_v1_pb, + gateway_config_resp_v1_pb, + gateway_config_update_req_v1_pb, + gateway_config_update_streamed_resp_v1_pb, + gateway_validators_req_v1_pb, + gateway_validators_resp_v1_pb, + gateway_region_params_streamed_resp_v1_pb, + gateway_region_params_update_req_v1_pb, + gateway_resp_v1_pb, + gateway_sc_is_active_req_v1_pb, + gateway_sc_is_active_resp_v1_pb, + gateway_sc_is_overpaid_req_v1_pb, + gateway_sc_is_overpaid_resp_v1_pb, + gateway_sc_close_req_v1_pb, + gateway_sc_close_resp_v1_pb, + gateway_sc_follow_req_v1_pb, + gateway_sc_follow_streamed_resp_v1_pb, + routing_pb, + routing_address_pb, + gateway_routing_req_v1_pb, + gateway_routing_streamed_resp_v1_pb, + gateway_poc_req_v1_pb, + gateway_poc_challenge_notification_resp_v1_pb, + gateway_poc_check_challenge_target_req_v1_pb, + gateway_poc_check_challenge_target_resp_v1_pb, + gateway_poc_report_req_v1_pb, + gateway_address_routing_data_req_v1_pb, + gateway_poc_key_routing_data_req_v1_pb, + gateway_public_routing_data_resp_v1_pb, + blockchain_state_channel_summary_v1_pb, + blockchain_state_channel_v1_pb, + blockchain_state_channel_response_v1_pb, + blockchain_state_channel_packet_v1_pb, + blockchain_state_channel_offer_v1_pb, + blockchain_state_channel_purchase_v1_pb, + blockchain_state_channel_diff_v1_pb, + blockchain_state_channel_diff_entry_v1_pb, + blockchain_state_channel_diff_append_summary_v1_pb, + blockchain_state_channel_diff_update_summary_v1_pb, + blockchain_state_channel_banner_v1_pb, + blockchain_state_channel_rejection_v1_pb, + blockchain_state_channel_message_v1_pb, + eui_pb, + routing_information_pb, + window_pb, + packet_pb, + blockchain_txn_state_channel_close_v1_pb, + blockchain_var_v1_pb, + blockchain_txn_vars_v1_pb, + blockchain_txn_poc_receipts_v1_pb, + blockchain_poc_receipt_v1_pb, + blockchain_poc_witness_v1_pb, + blockchain_poc_response_v1_pb, + blockchain_poc_path_element_v1_pb, + blockchain_txn_poc_receipts_v2_pb, + blockchain_region_params_v1_pb, + tagged_spreading_pb, + blockchain_region_spreading_v1_pb, + blockchain_region_param_v1_pb]. + + +get_enum_names() -> + ['helium.close_state', + 'helium.blockchain_state_channel_state_v1', + 'packet_pb.packet_type', + 'helium.region', + 'helium.origin', + 'helium.RegionSpreading']. + + +fetch_msg_def(MsgName) -> + case find_msg_def(MsgName) of + Fs when is_list(Fs) -> Fs; + error -> erlang:error({no_such_msg, MsgName}) + end. + + +fetch_enum_def(EnumName) -> + case find_enum_def(EnumName) of + Es when is_list(Es) -> Es; + error -> erlang:error({no_such_enum, EnumName}) + end. + + +find_msg_def(empty_pb) -> []; +find_msg_def(gateway_success_resp_pb) -> + [[{name, resp}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, details}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(gateway_error_resp_pb) -> + [[{name, error}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, details}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(gateway_config_req_v1_pb) -> + [[{name, keys}, + {fnum, 1}, + {rnum, 2}, + {type, string}, + {occurrence, repeated}, + {opts, []}]]; +find_msg_def(gateway_config_resp_v1_pb) -> + [[{name, result}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, blockchain_var_v1_pb}}, + {occurrence, repeated}, + {opts, []}]]; +find_msg_def(gateway_config_update_req_v1_pb) -> []; +find_msg_def(gateway_config_update_streamed_resp_v1_pb) -> + [[{name, keys}, + {fnum, 1}, + {rnum, 2}, + {type, string}, + {occurrence, repeated}, + {opts, []}]]; +find_msg_def(gateway_validators_req_v1_pb) -> + [[{name, quantity}, + {fnum, 1}, + {rnum, 2}, + {type, uint32}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(gateway_validators_resp_v1_pb) -> + [[{name, result}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, routing_address_pb}}, + {occurrence, repeated}, + {opts, []}]]; +find_msg_def(gateway_region_params_streamed_resp_v1_pb) -> + [[{name, address}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, region}, + {fnum, 2}, + {rnum, 3}, + {type, {enum, 'helium.region'}}, + {occurrence, optional}, + {opts, []}], + [{name, params}, + {fnum, 3}, + {rnum, 4}, + {type, {msg, blockchain_region_params_v1_pb}}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(gateway_region_params_update_req_v1_pb) -> + [[{name, address}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(gateway_resp_v1_pb) -> + [[{name, height}, + {fnum, 1}, + {rnum, 2}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, msg}, + {rnum, 4}, + {fields, + [[{name, is_active_resp}, + {fnum, 3}, + {rnum, 4}, + {type, {msg, gateway_sc_is_active_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, is_overpaid_resp}, + {fnum, 4}, + {rnum, 4}, + {type, {msg, gateway_sc_is_overpaid_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, close_resp}, + {fnum, 5}, + {rnum, 4}, + {type, {msg, gateway_sc_close_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, follow_streamed_resp}, + {fnum, 6}, + {rnum, 4}, + {type, {msg, gateway_sc_follow_streamed_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, routing_streamed_resp}, + {fnum, 7}, + {rnum, 4}, + {type, {msg, gateway_routing_streamed_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, config_resp}, + {fnum, 8}, + {rnum, 4}, + {type, {msg, gateway_config_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, config_update_streamed_resp}, + {fnum, 9}, + {rnum, 4}, + {type, + {msg, gateway_config_update_streamed_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, validators_resp}, + {fnum, 12}, + {rnum, 4}, + {type, {msg, gateway_validators_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, region_params_streamed_resp}, + {fnum, 13}, + {rnum, 4}, + {type, + {msg, gateway_region_params_streamed_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, success_resp}, + {fnum, 14}, + {rnum, 4}, + {type, {msg, gateway_success_resp_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, error_resp}, + {fnum, 15}, + {rnum, 4}, + {type, {msg, gateway_error_resp_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, poc_challenge_resp}, + {fnum, 16}, + {rnum, 4}, + {type, + {msg, gateway_poc_challenge_notification_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, poc_check_target_resp}, + {fnum, 17}, + {rnum, 4}, + {type, + {msg, gateway_poc_check_challenge_target_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, public_route}, + {fnum, 18}, + {rnum, 4}, + {type, {msg, gateway_public_routing_data_resp_v1_pb}}, + {occurrence, optional}, + {opts, []}]]}], + [{name, block_time}, + {fnum, 10}, + {rnum, 5}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, block_age}, + {fnum, 11}, + {rnum, 6}, + {type, uint64}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(gateway_sc_is_active_req_v1_pb) -> + [[{name, sc_id}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, sc_owner}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(gateway_sc_is_active_resp_v1_pb) -> + [[{name, sc_id}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, sc_owner}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, active}, + {fnum, 3}, + {rnum, 4}, + {type, bool}, + {occurrence, optional}, + {opts, []}], + [{name, sc_expiry_at_block}, + {fnum, 4}, + {rnum, 5}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, sc_original_dc_amount}, + {fnum, 5}, + {rnum, 6}, + {type, uint64}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(gateway_sc_is_overpaid_req_v1_pb) -> + [[{name, sc_id}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, sc_owner}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, total_dcs}, + {fnum, 3}, + {rnum, 4}, + {type, uint64}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(gateway_sc_is_overpaid_resp_v1_pb) -> + [[{name, sc_id}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, sc_owner}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, overpaid}, + {fnum, 3}, + {rnum, 4}, + {type, bool}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(gateway_sc_close_req_v1_pb) -> + [[{name, close_txn}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, blockchain_txn_state_channel_close_v1_pb}}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(gateway_sc_close_resp_v1_pb) -> + [[{name, sc_id}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, response}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(gateway_sc_follow_req_v1_pb) -> + [[{name, sc_id}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, sc_owner}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(gateway_sc_follow_streamed_resp_v1_pb) -> + [[{name, sc_id}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, sc_owner}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, close_state}, + {fnum, 3}, + {rnum, 4}, + {type, {enum, 'helium.close_state'}}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(routing_pb) -> + [[{name, oui}, + {fnum, 1}, + {rnum, 2}, + {type, uint32}, + {occurrence, optional}, + {opts, []}], + [{name, owner}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, addresses}, + {fnum, 3}, + {rnum, 4}, + {type, {msg, routing_address_pb}}, + {occurrence, repeated}, + {opts, []}], + [{name, filters}, + {fnum, 4}, + {rnum, 5}, + {type, bytes}, + {occurrence, repeated}, + {opts, []}], + [{name, subnets}, + {fnum, 5}, + {rnum, 6}, + {type, bytes}, + {occurrence, repeated}, + {opts, []}]]; +find_msg_def(routing_address_pb) -> + [[{name, pub_key}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, uri}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(gateway_routing_req_v1_pb) -> + [[{name, height}, + {fnum, 1}, + {rnum, 2}, + {type, uint64}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(gateway_routing_streamed_resp_v1_pb) -> + [[{name, routings}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, routing_pb}}, + {occurrence, repeated}, + {opts, []}]]; +find_msg_def(gateway_poc_req_v1_pb) -> + [[{name, address}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(gateway_poc_challenge_notification_resp_v1_pb) -> + [[{name, challenger}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, routing_address_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, block_hash}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, onion_key_hash}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(gateway_poc_check_challenge_target_req_v1_pb) -> + [[{name, address}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, challenger}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, block_hash}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, onion_key_hash}, + {fnum, 4}, + {rnum, 5}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, height}, + {fnum, 5}, + {rnum, 6}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, notifier}, + {fnum, 6}, + {rnum, 7}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, notifier_sig}, + {fnum, 7}, + {rnum, 8}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, challengee_sig}, + {fnum, 8}, + {rnum, 9}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(gateway_poc_check_challenge_target_resp_v1_pb) -> + [[{name, target}, + {fnum, 1}, + {rnum, 2}, + {type, bool}, + {occurrence, optional}, + {opts, []}], + [{name, onion}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(gateway_poc_report_req_v1_pb) -> + [[{name, onion_key_hash}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, msg}, + {rnum, 3}, + {fields, + [[{name, receipt}, + {fnum, 2}, + {rnum, 3}, + {type, {msg, blockchain_poc_receipt_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, witness}, + {fnum, 3}, + {rnum, 3}, + {type, {msg, blockchain_poc_witness_v1_pb}}, + {occurrence, optional}, + {opts, []}]]}]]; +find_msg_def(gateway_address_routing_data_req_v1_pb) -> + [[{name, address}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(gateway_poc_key_routing_data_req_v1_pb) -> + [[{name, key}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(gateway_public_routing_data_resp_v1_pb) -> + [[{name, address}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, public_uri}, + {fnum, 2}, + {rnum, 3}, + {type, {msg, routing_address_pb}}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(blockchain_state_channel_summary_v1_pb) -> + [[{name, client_pubkeybin}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, num_packets}, + {fnum, 2}, + {rnum, 3}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, num_dcs}, + {fnum, 3}, + {rnum, 4}, + {type, uint64}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(blockchain_state_channel_v1_pb) -> + [[{name, id}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, owner}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, credits}, + {fnum, 3}, + {rnum, 4}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, nonce}, + {fnum, 4}, + {rnum, 5}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, summaries}, + {fnum, 5}, + {rnum, 6}, + {type, {msg, blockchain_state_channel_summary_v1_pb}}, + {occurrence, repeated}, + {opts, []}], + [{name, root_hash}, + {fnum, 6}, + {rnum, 7}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, skewed}, + {fnum, 7}, + {rnum, 8}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, state}, + {fnum, 8}, + {rnum, 9}, + {type, + {enum, 'helium.blockchain_state_channel_state_v1'}}, + {occurrence, optional}, + {opts, []}], + [{name, expire_at_block}, + {fnum, 9}, + {rnum, 10}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 10}, + {rnum, 11}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(blockchain_state_channel_response_v1_pb) -> + [[{name, accepted}, + {fnum, 1}, + {rnum, 2}, + {type, bool}, + {occurrence, optional}, + {opts, []}], + [{name, downlink}, + {fnum, 4}, + {rnum, 3}, + {type, {msg, packet_pb}}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(blockchain_state_channel_packet_v1_pb) -> + [[{name, packet}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, packet_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, hotspot}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, region}, + {fnum, 4}, + {rnum, 5}, + {type, {enum, 'helium.region'}}, + {occurrence, optional}, + {opts, []}], + [{name, hold_time}, + {fnum, 5}, + {rnum, 6}, + {type, uint64}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(blockchain_state_channel_offer_v1_pb) -> + [[{name, routing}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, routing_information_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, packet_hash}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, payload_size}, + {fnum, 3}, + {rnum, 4}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, fcnt}, + {fnum, 4}, + {rnum, 5}, + {type, uint32}, + {occurrence, optional}, + {opts, []}], + [{name, hotspot}, + {fnum, 5}, + {rnum, 6}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 6}, + {rnum, 7}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, region}, + {fnum, 7}, + {rnum, 8}, + {type, {enum, 'helium.region'}}, + {occurrence, optional}, + {opts, []}], + [{name, req_diff}, + {fnum, 8}, + {rnum, 9}, + {type, bool}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(blockchain_state_channel_purchase_v1_pb) -> + [[{name, sc}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, blockchain_state_channel_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, hotspot}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, packet_hash}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, region}, + {fnum, 4}, + {rnum, 5}, + {type, {enum, 'helium.region'}}, + {occurrence, optional}, + {opts, []}], + [{name, sc_diff}, + {fnum, 5}, + {rnum, 6}, + {type, {msg, blockchain_state_channel_diff_v1_pb}}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(blockchain_state_channel_diff_v1_pb) -> + [[{name, id}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, add_nonce}, + {fnum, 2}, + {rnum, 3}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, diffs}, + {fnum, 4}, + {rnum, 5}, + {type, + {msg, blockchain_state_channel_diff_entry_v1_pb}}, + {occurrence, repeated}, + {opts, []}]]; +find_msg_def(blockchain_state_channel_diff_entry_v1_pb) -> + [[{name, entry}, + {rnum, 2}, + {fields, + [[{name, append}, + {fnum, 1}, + {rnum, 2}, + {type, + {msg, + blockchain_state_channel_diff_append_summary_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, add}, + {fnum, 2}, + {rnum, 2}, + {type, + {msg, + blockchain_state_channel_diff_update_summary_v1_pb}}, + {occurrence, optional}, + {opts, []}]]}]]; +find_msg_def(blockchain_state_channel_diff_append_summary_v1_pb) -> + [[{name, client_pubkeybin}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, num_packets}, + {fnum, 2}, + {rnum, 3}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, num_dcs}, + {fnum, 3}, + {rnum, 4}, + {type, uint64}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(blockchain_state_channel_diff_update_summary_v1_pb) -> + [[{name, client_index}, + {fnum, 1}, + {rnum, 2}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, add_packets}, + {fnum, 2}, + {rnum, 3}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, add_dcs}, + {fnum, 3}, + {rnum, 4}, + {type, uint64}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(blockchain_state_channel_banner_v1_pb) -> + [[{name, sc}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, blockchain_state_channel_v1_pb}}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(blockchain_state_channel_rejection_v1_pb) -> + [[{name, reject}, + {fnum, 1}, + {rnum, 2}, + {type, uint32}, + {occurrence, optional}, + {opts, []}], + [{name, packet_hash}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(blockchain_state_channel_message_v1_pb) -> + [[{name, msg}, + {rnum, 2}, + {fields, + [[{name, response}, + {fnum, 2}, + {rnum, 2}, + {type, {msg, blockchain_state_channel_response_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, packet}, + {fnum, 4}, + {rnum, 2}, + {type, {msg, blockchain_state_channel_packet_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, offer}, + {fnum, 5}, + {rnum, 2}, + {type, {msg, blockchain_state_channel_offer_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, purchase}, + {fnum, 6}, + {rnum, 2}, + {type, {msg, blockchain_state_channel_purchase_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, banner}, + {fnum, 7}, + {rnum, 2}, + {type, {msg, blockchain_state_channel_banner_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, reject}, + {fnum, 8}, + {rnum, 2}, + {type, {msg, blockchain_state_channel_rejection_v1_pb}}, + {occurrence, optional}, + {opts, []}]]}]]; +find_msg_def(eui_pb) -> + [[{name, deveui}, + {fnum, 1}, + {rnum, 2}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, appeui}, + {fnum, 2}, + {rnum, 3}, + {type, uint64}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(routing_information_pb) -> + [[{name, data}, + {rnum, 2}, + {fields, + [[{name, devaddr}, + {fnum, 1}, + {rnum, 2}, + {type, uint32}, + {occurrence, optional}, + {opts, []}], + [{name, eui}, + {fnum, 2}, + {rnum, 2}, + {type, {msg, eui_pb}}, + {occurrence, optional}, + {opts, []}]]}]]; +find_msg_def(window_pb) -> + [[{name, timestamp}, + {fnum, 1}, + {rnum, 2}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, frequency}, + {fnum, 2}, + {rnum, 3}, + {type, float}, + {occurrence, optional}, + {opts, []}], + [{name, datarate}, + {fnum, 3}, + {rnum, 4}, + {type, string}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(packet_pb) -> + [[{name, oui}, + {fnum, 1}, + {rnum, 2}, + {type, uint32}, + {occurrence, optional}, + {opts, []}], + [{name, type}, + {fnum, 2}, + {rnum, 3}, + {type, {enum, 'packet_pb.packet_type'}}, + {occurrence, optional}, + {opts, []}], + [{name, payload}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, timestamp}, + {fnum, 4}, + {rnum, 5}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, signal_strength}, + {fnum, 5}, + {rnum, 6}, + {type, float}, + {occurrence, optional}, + {opts, []}], + [{name, frequency}, + {fnum, 6}, + {rnum, 7}, + {type, float}, + {occurrence, optional}, + {opts, []}], + [{name, datarate}, + {fnum, 7}, + {rnum, 8}, + {type, string}, + {occurrence, optional}, + {opts, []}], + [{name, snr}, + {fnum, 8}, + {rnum, 9}, + {type, float}, + {occurrence, optional}, + {opts, []}], + [{name, routing}, + {fnum, 9}, + {rnum, 10}, + {type, {msg, routing_information_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, rx2_window}, + {fnum, 10}, + {rnum, 11}, + {type, {msg, window_pb}}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(blockchain_txn_state_channel_close_v1_pb) -> + [[{name, state_channel}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, blockchain_state_channel_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, closer}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, fee}, + {fnum, 4}, + {rnum, 5}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, conflicts_with}, + {fnum, 5}, + {rnum, 6}, + {type, {msg, blockchain_state_channel_v1_pb}}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(blockchain_var_v1_pb) -> + [[{name, name}, + {fnum, 1}, + {rnum, 2}, + {type, string}, + {occurrence, optional}, + {opts, []}], + [{name, type}, + {fnum, 2}, + {rnum, 3}, + {type, string}, + {occurrence, optional}, + {opts, []}], + [{name, value}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(blockchain_txn_vars_v1_pb) -> + [[{name, vars}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, blockchain_var_v1_pb}}, + {occurrence, repeated}, + {opts, []}], + [{name, version_predicate}, + {fnum, 2}, + {rnum, 3}, + {type, uint32}, + {occurrence, optional}, + {opts, []}], + [{name, proof}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, master_key}, + {fnum, 4}, + {rnum, 5}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, key_proof}, + {fnum, 5}, + {rnum, 6}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, cancels}, + {fnum, 6}, + {rnum, 7}, + {type, bytes}, + {occurrence, repeated}, + {opts, []}], + [{name, unsets}, + {fnum, 7}, + {rnum, 8}, + {type, bytes}, + {occurrence, repeated}, + {opts, []}], + [{name, nonce}, + {fnum, 8}, + {rnum, 9}, + {type, uint32}, + {occurrence, optional}, + {opts, []}], + [{name, multi_keys}, + {fnum, 9}, + {rnum, 10}, + {type, bytes}, + {occurrence, repeated}, + {opts, []}], + [{name, multi_proofs}, + {fnum, 10}, + {rnum, 11}, + {type, bytes}, + {occurrence, repeated}, + {opts, []}], + [{name, multi_key_proofs}, + {fnum, 11}, + {rnum, 12}, + {type, bytes}, + {occurrence, repeated}, + {opts, []}]]; +find_msg_def(blockchain_txn_poc_receipts_v1_pb) -> + [[{name, challenger}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, secret}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, onion_key_hash}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, path}, + {fnum, 4}, + {rnum, 5}, + {type, {msg, blockchain_poc_path_element_v1_pb}}, + {occurrence, repeated}, + {opts, []}], + [{name, fee}, + {fnum, 5}, + {rnum, 6}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 6}, + {rnum, 7}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, request_block_hash}, + {fnum, 7}, + {rnum, 8}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(blockchain_poc_receipt_v1_pb) -> + [[{name, gateway}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, timestamp}, + {fnum, 2}, + {rnum, 3}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, signal}, + {fnum, 3}, + {rnum, 4}, + {type, sint32}, + {occurrence, optional}, + {opts, []}], + [{name, data}, + {fnum, 4}, + {rnum, 5}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, origin}, + {fnum, 5}, + {rnum, 6}, + {type, {enum, 'helium.origin'}}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 6}, + {rnum, 7}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, snr}, + {fnum, 7}, + {rnum, 8}, + {type, float}, + {occurrence, optional}, + {opts, []}], + [{name, frequency}, + {fnum, 8}, + {rnum, 9}, + {type, float}, + {occurrence, optional}, + {opts, []}], + [{name, channel}, + {fnum, 9}, + {rnum, 10}, + {type, int32}, + {occurrence, optional}, + {opts, []}], + [{name, datarate}, + {fnum, 10}, + {rnum, 11}, + {type, string}, + {occurrence, optional}, + {opts, []}], + [{name, addr_hash}, + {fnum, 11}, + {rnum, 12}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, tx_power}, + {fnum, 12}, + {rnum, 13}, + {type, int32}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(blockchain_poc_witness_v1_pb) -> + [[{name, gateway}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, timestamp}, + {fnum, 2}, + {rnum, 3}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, signal}, + {fnum, 3}, + {rnum, 4}, + {type, sint32}, + {occurrence, optional}, + {opts, []}], + [{name, packet_hash}, + {fnum, 4}, + {rnum, 5}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 5}, + {rnum, 6}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, snr}, + {fnum, 6}, + {rnum, 7}, + {type, float}, + {occurrence, optional}, + {opts, []}], + [{name, frequency}, + {fnum, 7}, + {rnum, 8}, + {type, float}, + {occurrence, optional}, + {opts, []}], + [{name, channel}, + {fnum, 8}, + {rnum, 9}, + {type, int32}, + {occurrence, optional}, + {opts, []}], + [{name, datarate}, + {fnum, 9}, + {rnum, 10}, + {type, string}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(blockchain_poc_response_v1_pb) -> + [[{name, payload}, + {rnum, 2}, + {fields, + [[{name, receipt}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, blockchain_poc_receipt_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, witness}, + {fnum, 2}, + {rnum, 2}, + {type, {msg, blockchain_poc_witness_v1_pb}}, + {occurrence, optional}, + {opts, []}]]}]]; +find_msg_def(blockchain_poc_path_element_v1_pb) -> + [[{name, challengee}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, receipt}, + {fnum, 2}, + {rnum, 3}, + {type, {msg, blockchain_poc_receipt_v1_pb}}, + {occurrence, optional}, + {opts, []}], + [{name, witnesses}, + {fnum, 3}, + {rnum, 4}, + {type, {msg, blockchain_poc_witness_v1_pb}}, + {occurrence, repeated}, + {opts, []}]]; +find_msg_def(blockchain_txn_poc_receipts_v2_pb) -> + [[{name, challenger}, + {fnum, 1}, + {rnum, 2}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, secret}, + {fnum, 2}, + {rnum, 3}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, onion_key_hash}, + {fnum, 3}, + {rnum, 4}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, path}, + {fnum, 4}, + {rnum, 5}, + {type, {msg, blockchain_poc_path_element_v1_pb}}, + {occurrence, repeated}, + {opts, []}], + [{name, fee}, + {fnum, 5}, + {rnum, 6}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, signature}, + {fnum, 6}, + {rnum, 7}, + {type, bytes}, + {occurrence, optional}, + {opts, []}], + [{name, block_hash}, + {fnum, 7}, + {rnum, 8}, + {type, bytes}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(blockchain_region_params_v1_pb) -> + [[{name, region_params}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, blockchain_region_param_v1_pb}}, + {occurrence, repeated}, + {opts, []}]]; +find_msg_def(tagged_spreading_pb) -> + [[{name, region_spreading}, + {fnum, 1}, + {rnum, 2}, + {type, {enum, 'helium.RegionSpreading'}}, + {occurrence, optional}, + {opts, []}], + [{name, max_packet_size}, + {fnum, 2}, + {rnum, 3}, + {type, uint32}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(blockchain_region_spreading_v1_pb) -> + [[{name, tagged_spreading}, + {fnum, 1}, + {rnum, 2}, + {type, {msg, tagged_spreading_pb}}, + {occurrence, repeated}, + {opts, []}]]; +find_msg_def(blockchain_region_param_v1_pb) -> + [[{name, channel_frequency}, + {fnum, 1}, + {rnum, 2}, + {type, uint64}, + {occurrence, optional}, + {opts, []}], + [{name, bandwidth}, + {fnum, 2}, + {rnum, 3}, + {type, uint32}, + {occurrence, optional}, + {opts, []}], + [{name, max_eirp}, + {fnum, 3}, + {rnum, 4}, + {type, uint32}, + {occurrence, optional}, + {opts, []}], + [{name, spreading}, + {fnum, 4}, + {rnum, 5}, + {type, {msg, blockchain_region_spreading_v1_pb}}, + {occurrence, optional}, + {opts, []}]]; +find_msg_def(_) -> error. + + +find_enum_def('helium.close_state') -> + [{close_state_closable, 0}, + {close_state_closing, 1}, + {close_state_closed, 2}, + {close_state_dispute, 3}]; +find_enum_def('helium.blockchain_state_channel_state_v1') -> + [{open, 0}, {closed, 1}]; +find_enum_def('packet_pb.packet_type') -> + [{longfi, 0}, {lorawan, 1}]; +find_enum_def('helium.region') -> + [{'US915', 0}, + {'EU868', 1}, + {'EU433', 2}, + {'CN470', 3}, + {'CN779', 4}, + {'AU915', 5}, + {'AS923_1', 6}, + {'KR920', 7}, + {'IN865', 8}, + {'AS923_2', 9}, + {'AS923_3', 10}, + {'AS923_4', 11}]; +find_enum_def('helium.origin') -> + [{p2p, 0}, {radio, 1}]; +find_enum_def('helium.RegionSpreading') -> + [{'SF_INVALID', 0}, + {'SF7', 1}, + {'SF8', 2}, + {'SF9', 3}, + {'SF10', 4}, + {'SF11', 5}, + {'SF12', 6}]; +find_enum_def(_) -> error. + + +enum_symbol_by_value('helium.close_state', Value) -> + 'enum_symbol_by_value_helium.close_state'(Value); +enum_symbol_by_value('helium.blockchain_state_channel_state_v1', + Value) -> + 'enum_symbol_by_value_helium.blockchain_state_channel_state_v1'(Value); +enum_symbol_by_value('packet_pb.packet_type', Value) -> + 'enum_symbol_by_value_packet_pb.packet_type'(Value); +enum_symbol_by_value('helium.region', Value) -> + 'enum_symbol_by_value_helium.region'(Value); +enum_symbol_by_value('helium.origin', Value) -> + 'enum_symbol_by_value_helium.origin'(Value); +enum_symbol_by_value('helium.RegionSpreading', Value) -> + 'enum_symbol_by_value_helium.RegionSpreading'(Value). + + +enum_value_by_symbol('helium.close_state', Sym) -> + 'enum_value_by_symbol_helium.close_state'(Sym); +enum_value_by_symbol('helium.blockchain_state_channel_state_v1', + Sym) -> + 'enum_value_by_symbol_helium.blockchain_state_channel_state_v1'(Sym); +enum_value_by_symbol('packet_pb.packet_type', Sym) -> + 'enum_value_by_symbol_packet_pb.packet_type'(Sym); +enum_value_by_symbol('helium.region', Sym) -> + 'enum_value_by_symbol_helium.region'(Sym); +enum_value_by_symbol('helium.origin', Sym) -> + 'enum_value_by_symbol_helium.origin'(Sym); +enum_value_by_symbol('helium.RegionSpreading', Sym) -> + 'enum_value_by_symbol_helium.RegionSpreading'(Sym). + + +'enum_symbol_by_value_helium.close_state'(0) -> + close_state_closable; +'enum_symbol_by_value_helium.close_state'(1) -> + close_state_closing; +'enum_symbol_by_value_helium.close_state'(2) -> + close_state_closed; +'enum_symbol_by_value_helium.close_state'(3) -> + close_state_dispute. + + +'enum_value_by_symbol_helium.close_state'(close_state_closable) -> + 0; +'enum_value_by_symbol_helium.close_state'(close_state_closing) -> + 1; +'enum_value_by_symbol_helium.close_state'(close_state_closed) -> + 2; +'enum_value_by_symbol_helium.close_state'(close_state_dispute) -> + 3. + +'enum_symbol_by_value_helium.blockchain_state_channel_state_v1'(0) -> + open; +'enum_symbol_by_value_helium.blockchain_state_channel_state_v1'(1) -> + closed. + + +'enum_value_by_symbol_helium.blockchain_state_channel_state_v1'(open) -> + 0; +'enum_value_by_symbol_helium.blockchain_state_channel_state_v1'(closed) -> + 1. + +'enum_symbol_by_value_packet_pb.packet_type'(0) -> + longfi; +'enum_symbol_by_value_packet_pb.packet_type'(1) -> + lorawan. + + +'enum_value_by_symbol_packet_pb.packet_type'(longfi) -> + 0; +'enum_value_by_symbol_packet_pb.packet_type'(lorawan) -> + 1. + +'enum_symbol_by_value_helium.region'(0) -> 'US915'; +'enum_symbol_by_value_helium.region'(1) -> 'EU868'; +'enum_symbol_by_value_helium.region'(2) -> 'EU433'; +'enum_symbol_by_value_helium.region'(3) -> 'CN470'; +'enum_symbol_by_value_helium.region'(4) -> 'CN779'; +'enum_symbol_by_value_helium.region'(5) -> 'AU915'; +'enum_symbol_by_value_helium.region'(6) -> 'AS923_1'; +'enum_symbol_by_value_helium.region'(7) -> 'KR920'; +'enum_symbol_by_value_helium.region'(8) -> 'IN865'; +'enum_symbol_by_value_helium.region'(9) -> 'AS923_2'; +'enum_symbol_by_value_helium.region'(10) -> 'AS923_3'; +'enum_symbol_by_value_helium.region'(11) -> 'AS923_4'. + + +'enum_value_by_symbol_helium.region'('US915') -> 0; +'enum_value_by_symbol_helium.region'('EU868') -> 1; +'enum_value_by_symbol_helium.region'('EU433') -> 2; +'enum_value_by_symbol_helium.region'('CN470') -> 3; +'enum_value_by_symbol_helium.region'('CN779') -> 4; +'enum_value_by_symbol_helium.region'('AU915') -> 5; +'enum_value_by_symbol_helium.region'('AS923_1') -> 6; +'enum_value_by_symbol_helium.region'('KR920') -> 7; +'enum_value_by_symbol_helium.region'('IN865') -> 8; +'enum_value_by_symbol_helium.region'('AS923_2') -> 9; +'enum_value_by_symbol_helium.region'('AS923_3') -> 10; +'enum_value_by_symbol_helium.region'('AS923_4') -> 11. + +'enum_symbol_by_value_helium.origin'(0) -> p2p; +'enum_symbol_by_value_helium.origin'(1) -> radio. + + +'enum_value_by_symbol_helium.origin'(p2p) -> 0; +'enum_value_by_symbol_helium.origin'(radio) -> 1. + +'enum_symbol_by_value_helium.RegionSpreading'(0) -> + 'SF_INVALID'; +'enum_symbol_by_value_helium.RegionSpreading'(1) -> + 'SF7'; +'enum_symbol_by_value_helium.RegionSpreading'(2) -> + 'SF8'; +'enum_symbol_by_value_helium.RegionSpreading'(3) -> + 'SF9'; +'enum_symbol_by_value_helium.RegionSpreading'(4) -> + 'SF10'; +'enum_symbol_by_value_helium.RegionSpreading'(5) -> + 'SF11'; +'enum_symbol_by_value_helium.RegionSpreading'(6) -> + 'SF12'. + + +'enum_value_by_symbol_helium.RegionSpreading'('SF_INVALID') -> + 0; +'enum_value_by_symbol_helium.RegionSpreading'('SF7') -> + 1; +'enum_value_by_symbol_helium.RegionSpreading'('SF8') -> + 2; +'enum_value_by_symbol_helium.RegionSpreading'('SF9') -> + 3; +'enum_value_by_symbol_helium.RegionSpreading'('SF10') -> + 4; +'enum_value_by_symbol_helium.RegionSpreading'('SF11') -> + 5; +'enum_value_by_symbol_helium.RegionSpreading'('SF12') -> + 6. + + +get_service_names() -> ['helium.gateway']. + + +get_service_def('helium.gateway') -> + {{service, 'helium.gateway'}, + [[{name, follow_sc}, + {input, gateway_sc_follow_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, true}, + {output_stream, true}, + {opts, []}], + [{name, routing}, + {input, gateway_routing_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, true}, + {opts, []}], + [{name, stream_poc}, + {input, gateway_poc_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, true}, + {output_stream, true}, + {opts, []}], + [{name, config_update}, + {input, gateway_config_update_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, true}, + {opts, []}], + [{name, is_active_sc}, + {input, gateway_sc_is_active_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, false}, + {opts, []}], + [{name, is_overpaid_sc}, + {input, gateway_sc_is_overpaid_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, false}, + {opts, []}], + [{name, close_sc}, + {input, gateway_sc_close_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, false}, + {opts, []}], + [{name, check_challenge_target}, + {input, gateway_poc_check_challenge_target_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, false}, + {opts, []}], + [{name, send_report}, + {input, gateway_poc_report_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, false}, + {opts, []}], + [{name, address_to_public_uri}, + {input, gateway_address_routing_data_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, false}, + {opts, []}], + [{name, poc_key_to_public_uri}, + {input, gateway_poc_key_routing_data_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, false}, + {opts, []}], + [{name, config}, + {input, gateway_config_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, false}, + {opts, []}], + [{name, validators}, + {input, gateway_validators_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, false}, + {opts, []}], + [{name, region_params_update}, + {input, gateway_region_params_update_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, true}, + {opts, []}]]}; +get_service_def(_) -> error. + + +get_rpc_names('helium.gateway') -> + [follow_sc, + routing, + stream_poc, + config_update, + is_active_sc, + is_overpaid_sc, + close_sc, + check_challenge_target, + send_report, + address_to_public_uri, + poc_key_to_public_uri, + config, + validators, + region_params_update]; +get_rpc_names(_) -> error. + + +find_rpc_def('helium.gateway', RpcName) -> + 'find_rpc_def_helium.gateway'(RpcName); +find_rpc_def(_, _) -> error. + + +'find_rpc_def_helium.gateway'(follow_sc) -> + [{name, follow_sc}, + {input, gateway_sc_follow_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, true}, + {output_stream, true}, + {opts, []}]; +'find_rpc_def_helium.gateway'(routing) -> + [{name, routing}, + {input, gateway_routing_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, true}, + {opts, []}]; +'find_rpc_def_helium.gateway'(stream_poc) -> + [{name, stream_poc}, + {input, gateway_poc_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, true}, + {output_stream, true}, + {opts, []}]; +'find_rpc_def_helium.gateway'(config_update) -> + [{name, config_update}, + {input, gateway_config_update_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, true}, + {opts, []}]; +'find_rpc_def_helium.gateway'(is_active_sc) -> + [{name, is_active_sc}, + {input, gateway_sc_is_active_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, false}, + {opts, []}]; +'find_rpc_def_helium.gateway'(is_overpaid_sc) -> + [{name, is_overpaid_sc}, + {input, gateway_sc_is_overpaid_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, false}, + {opts, []}]; +'find_rpc_def_helium.gateway'(close_sc) -> + [{name, close_sc}, + {input, gateway_sc_close_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, false}, + {opts, []}]; +'find_rpc_def_helium.gateway'(check_challenge_target) -> + [{name, check_challenge_target}, + {input, gateway_poc_check_challenge_target_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, false}, + {opts, []}]; +'find_rpc_def_helium.gateway'(send_report) -> + [{name, send_report}, + {input, gateway_poc_report_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, false}, + {opts, []}]; +'find_rpc_def_helium.gateway'(address_to_public_uri) -> + [{name, address_to_public_uri}, + {input, gateway_address_routing_data_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, false}, + {opts, []}]; +'find_rpc_def_helium.gateway'(poc_key_to_public_uri) -> + [{name, poc_key_to_public_uri}, + {input, gateway_poc_key_routing_data_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, false}, + {opts, []}]; +'find_rpc_def_helium.gateway'(config) -> + [{name, config}, + {input, gateway_config_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, false}, + {opts, []}]; +'find_rpc_def_helium.gateway'(validators) -> + [{name, validators}, + {input, gateway_validators_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, false}, + {opts, []}]; +'find_rpc_def_helium.gateway'(region_params_update) -> + [{name, region_params_update}, + {input, gateway_region_params_update_req_v1_pb}, + {output, gateway_resp_v1_pb}, + {input_stream, false}, + {output_stream, true}, + {opts, []}]; +'find_rpc_def_helium.gateway'(_) -> error. + + +fetch_rpc_def(ServiceName, RpcName) -> + case find_rpc_def(ServiceName, RpcName) of + Def when is_list(Def) -> Def; + error -> + erlang:error({no_such_rpc, ServiceName, RpcName}) + end. + + +%% Convert a a fully qualified (ie with package name) service name +%% as a binary to a service name as an atom. +fqbin_to_service_name(<<"helium.gateway">>) -> 'helium.gateway'; +fqbin_to_service_name(X) -> + error({gpb_error, {badservice, X}}). + + +%% Convert a service name as an atom to a fully qualified +%% (ie with package name) name as a binary. +service_name_to_fqbin('helium.gateway') -> <<"helium.gateway">>; +service_name_to_fqbin(X) -> + error({gpb_error, {badservice, X}}). + + +%% Convert a a fully qualified (ie with package name) service name +%% and an rpc name, both as binaries to a service name and an rpc +%% name, as atoms. +fqbins_to_service_and_rpc_name(<<"helium.gateway">>, <<"follow_sc">>) -> + {'helium.gateway', follow_sc}; +fqbins_to_service_and_rpc_name(<<"helium.gateway">>, <<"routing">>) -> + {'helium.gateway', routing}; +fqbins_to_service_and_rpc_name(<<"helium.gateway">>, <<"stream_poc">>) -> + {'helium.gateway', stream_poc}; +fqbins_to_service_and_rpc_name(<<"helium.gateway">>, <<"config_update">>) -> + {'helium.gateway', config_update}; +fqbins_to_service_and_rpc_name(<<"helium.gateway">>, <<"is_active_sc">>) -> + {'helium.gateway', is_active_sc}; +fqbins_to_service_and_rpc_name(<<"helium.gateway">>, <<"is_overpaid_sc">>) -> + {'helium.gateway', is_overpaid_sc}; +fqbins_to_service_and_rpc_name(<<"helium.gateway">>, <<"close_sc">>) -> + {'helium.gateway', close_sc}; +fqbins_to_service_and_rpc_name(<<"helium.gateway">>, <<"check_challenge_target">>) -> + {'helium.gateway', check_challenge_target}; +fqbins_to_service_and_rpc_name(<<"helium.gateway">>, <<"send_report">>) -> + {'helium.gateway', send_report}; +fqbins_to_service_and_rpc_name(<<"helium.gateway">>, <<"address_to_public_uri">>) -> + {'helium.gateway', address_to_public_uri}; +fqbins_to_service_and_rpc_name(<<"helium.gateway">>, <<"poc_key_to_public_uri">>) -> + {'helium.gateway', poc_key_to_public_uri}; +fqbins_to_service_and_rpc_name(<<"helium.gateway">>, <<"config">>) -> + {'helium.gateway', config}; +fqbins_to_service_and_rpc_name(<<"helium.gateway">>, <<"validators">>) -> + {'helium.gateway', validators}; +fqbins_to_service_and_rpc_name(<<"helium.gateway">>, <<"region_params_update">>) -> + {'helium.gateway', region_params_update}; +fqbins_to_service_and_rpc_name(S, R) -> + error({gpb_error, {badservice_or_rpc, {S, R}}}). + + +%% Convert a service name and an rpc name, both as atoms, +%% to a fully qualified (ie with package name) service name and +%% an rpc name as binaries. +service_and_rpc_name_to_fqbins('helium.gateway', + follow_sc) -> + {<<"helium.gateway">>, <<"follow_sc">>}; +service_and_rpc_name_to_fqbins('helium.gateway', + routing) -> + {<<"helium.gateway">>, <<"routing">>}; +service_and_rpc_name_to_fqbins('helium.gateway', + stream_poc) -> + {<<"helium.gateway">>, <<"stream_poc">>}; +service_and_rpc_name_to_fqbins('helium.gateway', + config_update) -> + {<<"helium.gateway">>, <<"config_update">>}; +service_and_rpc_name_to_fqbins('helium.gateway', + is_active_sc) -> + {<<"helium.gateway">>, <<"is_active_sc">>}; +service_and_rpc_name_to_fqbins('helium.gateway', + is_overpaid_sc) -> + {<<"helium.gateway">>, <<"is_overpaid_sc">>}; +service_and_rpc_name_to_fqbins('helium.gateway', + close_sc) -> + {<<"helium.gateway">>, <<"close_sc">>}; +service_and_rpc_name_to_fqbins('helium.gateway', + check_challenge_target) -> + {<<"helium.gateway">>, <<"check_challenge_target">>}; +service_and_rpc_name_to_fqbins('helium.gateway', + send_report) -> + {<<"helium.gateway">>, <<"send_report">>}; +service_and_rpc_name_to_fqbins('helium.gateway', + address_to_public_uri) -> + {<<"helium.gateway">>, <<"address_to_public_uri">>}; +service_and_rpc_name_to_fqbins('helium.gateway', + poc_key_to_public_uri) -> + {<<"helium.gateway">>, <<"poc_key_to_public_uri">>}; +service_and_rpc_name_to_fqbins('helium.gateway', + config) -> + {<<"helium.gateway">>, <<"config">>}; +service_and_rpc_name_to_fqbins('helium.gateway', + validators) -> + {<<"helium.gateway">>, <<"validators">>}; +service_and_rpc_name_to_fqbins('helium.gateway', + region_params_update) -> + {<<"helium.gateway">>, <<"region_params_update">>}; +service_and_rpc_name_to_fqbins(S, R) -> + error({gpb_error, {badservice_or_rpc, {S, R}}}). + + +fqbin_to_msg_name(<<"helium.empty">>) -> empty_pb; +fqbin_to_msg_name(<<"helium.gateway_success_resp">>) -> gateway_success_resp_pb; +fqbin_to_msg_name(<<"helium.gateway_error_resp">>) -> gateway_error_resp_pb; +fqbin_to_msg_name(<<"helium.gateway_config_req_v1">>) -> gateway_config_req_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_config_resp_v1">>) -> gateway_config_resp_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_config_update_req_v1">>) -> + gateway_config_update_req_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_config_update_streamed_resp_v1">>) -> + gateway_config_update_streamed_resp_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_validators_req_v1">>) -> + gateway_validators_req_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_validators_resp_v1">>) -> + gateway_validators_resp_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_region_params_streamed_resp_v1">>) -> + gateway_region_params_streamed_resp_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_region_params_update_req_v1">>) -> + gateway_region_params_update_req_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_resp_v1">>) -> gateway_resp_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_sc_is_active_req_v1">>) -> + gateway_sc_is_active_req_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_sc_is_active_resp_v1">>) -> + gateway_sc_is_active_resp_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_sc_is_overpaid_req_v1">>) -> + gateway_sc_is_overpaid_req_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_sc_is_overpaid_resp_v1">>) -> + gateway_sc_is_overpaid_resp_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_sc_close_req_v1">>) -> + gateway_sc_close_req_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_sc_close_resp_v1">>) -> + gateway_sc_close_resp_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_sc_follow_req_v1">>) -> + gateway_sc_follow_req_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_sc_follow_streamed_resp_v1">>) -> + gateway_sc_follow_streamed_resp_v1_pb; +fqbin_to_msg_name(<<"helium.routing">>) -> routing_pb; +fqbin_to_msg_name(<<"helium.routing_address">>) -> routing_address_pb; +fqbin_to_msg_name(<<"helium.gateway_routing_req_v1">>) -> gateway_routing_req_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_routing_streamed_resp_v1">>) -> + gateway_routing_streamed_resp_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_poc_req_v1">>) -> gateway_poc_req_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_poc_challenge_notification_resp_v1">>) -> + gateway_poc_challenge_notification_resp_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_poc_check_challenge_target_req_v1">>) -> + gateway_poc_check_challenge_target_req_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_poc_check_challenge_target_resp_v1">>) -> + gateway_poc_check_challenge_target_resp_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_poc_report_req_v1">>) -> + gateway_poc_report_req_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_address_routing_data_req_v1">>) -> + gateway_address_routing_data_req_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_poc_key_routing_data_req_v1">>) -> + gateway_poc_key_routing_data_req_v1_pb; +fqbin_to_msg_name(<<"helium.gateway_public_routing_data_resp_v1">>) -> + gateway_public_routing_data_resp_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_state_channel_summary_v1">>) -> + blockchain_state_channel_summary_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_state_channel_v1">>) -> + blockchain_state_channel_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_state_channel_response_v1">>) -> + blockchain_state_channel_response_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_state_channel_packet_v1">>) -> + blockchain_state_channel_packet_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_state_channel_offer_v1">>) -> + blockchain_state_channel_offer_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_state_channel_purchase_v1">>) -> + blockchain_state_channel_purchase_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_state_channel_diff_v1">>) -> + blockchain_state_channel_diff_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_state_channel_diff_entry_v1">>) -> + blockchain_state_channel_diff_entry_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_state_channel_diff_append_summary_v1">>) -> + blockchain_state_channel_diff_append_summary_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_state_channel_diff_update_summary_v1">>) -> + blockchain_state_channel_diff_update_summary_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_state_channel_banner_v1">>) -> + blockchain_state_channel_banner_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_state_channel_rejection_v1">>) -> + blockchain_state_channel_rejection_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_state_channel_message_v1">>) -> + blockchain_state_channel_message_v1_pb; +fqbin_to_msg_name(<<"helium.eui">>) -> eui_pb; +fqbin_to_msg_name(<<"helium.routing_information">>) -> routing_information_pb; +fqbin_to_msg_name(<<"helium.window">>) -> window_pb; +fqbin_to_msg_name(<<"helium.packet">>) -> packet_pb; +fqbin_to_msg_name(<<"helium.blockchain_txn_state_channel_close_v1">>) -> + blockchain_txn_state_channel_close_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_var_v1">>) -> blockchain_var_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_txn_vars_v1">>) -> blockchain_txn_vars_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_txn_poc_receipts_v1">>) -> + blockchain_txn_poc_receipts_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_poc_receipt_v1">>) -> + blockchain_poc_receipt_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_poc_witness_v1">>) -> + blockchain_poc_witness_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_poc_response_v1">>) -> + blockchain_poc_response_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_poc_path_element_v1">>) -> + blockchain_poc_path_element_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_txn_poc_receipts_v2">>) -> + blockchain_txn_poc_receipts_v2_pb; +fqbin_to_msg_name(<<"helium.blockchain_region_params_v1">>) -> + blockchain_region_params_v1_pb; +fqbin_to_msg_name(<<"helium.tagged_spreading">>) -> tagged_spreading_pb; +fqbin_to_msg_name(<<"helium.blockchain_region_spreading_v1">>) -> + blockchain_region_spreading_v1_pb; +fqbin_to_msg_name(<<"helium.blockchain_region_param_v1">>) -> + blockchain_region_param_v1_pb; +fqbin_to_msg_name(E) -> error({gpb_error, {badmsg, E}}). + + +msg_name_to_fqbin(empty_pb) -> <<"helium.empty">>; +msg_name_to_fqbin(gateway_success_resp_pb) -> <<"helium.gateway_success_resp">>; +msg_name_to_fqbin(gateway_error_resp_pb) -> <<"helium.gateway_error_resp">>; +msg_name_to_fqbin(gateway_config_req_v1_pb) -> <<"helium.gateway_config_req_v1">>; +msg_name_to_fqbin(gateway_config_resp_v1_pb) -> <<"helium.gateway_config_resp_v1">>; +msg_name_to_fqbin(gateway_config_update_req_v1_pb) -> + <<"helium.gateway_config_update_req_v1">>; +msg_name_to_fqbin(gateway_config_update_streamed_resp_v1_pb) -> + <<"helium.gateway_config_update_streamed_resp_v1">>; +msg_name_to_fqbin(gateway_validators_req_v1_pb) -> + <<"helium.gateway_validators_req_v1">>; +msg_name_to_fqbin(gateway_validators_resp_v1_pb) -> + <<"helium.gateway_validators_resp_v1">>; +msg_name_to_fqbin(gateway_region_params_streamed_resp_v1_pb) -> + <<"helium.gateway_region_params_streamed_resp_v1">>; +msg_name_to_fqbin(gateway_region_params_update_req_v1_pb) -> + <<"helium.gateway_region_params_update_req_v1">>; +msg_name_to_fqbin(gateway_resp_v1_pb) -> <<"helium.gateway_resp_v1">>; +msg_name_to_fqbin(gateway_sc_is_active_req_v1_pb) -> + <<"helium.gateway_sc_is_active_req_v1">>; +msg_name_to_fqbin(gateway_sc_is_active_resp_v1_pb) -> + <<"helium.gateway_sc_is_active_resp_v1">>; +msg_name_to_fqbin(gateway_sc_is_overpaid_req_v1_pb) -> + <<"helium.gateway_sc_is_overpaid_req_v1">>; +msg_name_to_fqbin(gateway_sc_is_overpaid_resp_v1_pb) -> + <<"helium.gateway_sc_is_overpaid_resp_v1">>; +msg_name_to_fqbin(gateway_sc_close_req_v1_pb) -> + <<"helium.gateway_sc_close_req_v1">>; +msg_name_to_fqbin(gateway_sc_close_resp_v1_pb) -> + <<"helium.gateway_sc_close_resp_v1">>; +msg_name_to_fqbin(gateway_sc_follow_req_v1_pb) -> + <<"helium.gateway_sc_follow_req_v1">>; +msg_name_to_fqbin(gateway_sc_follow_streamed_resp_v1_pb) -> + <<"helium.gateway_sc_follow_streamed_resp_v1">>; +msg_name_to_fqbin(routing_pb) -> <<"helium.routing">>; +msg_name_to_fqbin(routing_address_pb) -> <<"helium.routing_address">>; +msg_name_to_fqbin(gateway_routing_req_v1_pb) -> <<"helium.gateway_routing_req_v1">>; +msg_name_to_fqbin(gateway_routing_streamed_resp_v1_pb) -> + <<"helium.gateway_routing_streamed_resp_v1">>; +msg_name_to_fqbin(gateway_poc_req_v1_pb) -> <<"helium.gateway_poc_req_v1">>; +msg_name_to_fqbin(gateway_poc_challenge_notification_resp_v1_pb) -> + <<"helium.gateway_poc_challenge_notification_resp_v1">>; +msg_name_to_fqbin(gateway_poc_check_challenge_target_req_v1_pb) -> + <<"helium.gateway_poc_check_challenge_target_req_v1">>; +msg_name_to_fqbin(gateway_poc_check_challenge_target_resp_v1_pb) -> + <<"helium.gateway_poc_check_challenge_target_resp_v1">>; +msg_name_to_fqbin(gateway_poc_report_req_v1_pb) -> + <<"helium.gateway_poc_report_req_v1">>; +msg_name_to_fqbin(gateway_address_routing_data_req_v1_pb) -> + <<"helium.gateway_address_routing_data_req_v1">>; +msg_name_to_fqbin(gateway_poc_key_routing_data_req_v1_pb) -> + <<"helium.gateway_poc_key_routing_data_req_v1">>; +msg_name_to_fqbin(gateway_public_routing_data_resp_v1_pb) -> + <<"helium.gateway_public_routing_data_resp_v1">>; +msg_name_to_fqbin(blockchain_state_channel_summary_v1_pb) -> + <<"helium.blockchain_state_channel_summary_v1">>; +msg_name_to_fqbin(blockchain_state_channel_v1_pb) -> + <<"helium.blockchain_state_channel_v1">>; +msg_name_to_fqbin(blockchain_state_channel_response_v1_pb) -> + <<"helium.blockchain_state_channel_response_v1">>; +msg_name_to_fqbin(blockchain_state_channel_packet_v1_pb) -> + <<"helium.blockchain_state_channel_packet_v1">>; +msg_name_to_fqbin(blockchain_state_channel_offer_v1_pb) -> + <<"helium.blockchain_state_channel_offer_v1">>; +msg_name_to_fqbin(blockchain_state_channel_purchase_v1_pb) -> + <<"helium.blockchain_state_channel_purchase_v1">>; +msg_name_to_fqbin(blockchain_state_channel_diff_v1_pb) -> + <<"helium.blockchain_state_channel_diff_v1">>; +msg_name_to_fqbin(blockchain_state_channel_diff_entry_v1_pb) -> + <<"helium.blockchain_state_channel_diff_entry_v1">>; +msg_name_to_fqbin(blockchain_state_channel_diff_append_summary_v1_pb) -> + <<"helium.blockchain_state_channel_diff_append_summary_v1">>; +msg_name_to_fqbin(blockchain_state_channel_diff_update_summary_v1_pb) -> + <<"helium.blockchain_state_channel_diff_update_summary_v1">>; +msg_name_to_fqbin(blockchain_state_channel_banner_v1_pb) -> + <<"helium.blockchain_state_channel_banner_v1">>; +msg_name_to_fqbin(blockchain_state_channel_rejection_v1_pb) -> + <<"helium.blockchain_state_channel_rejection_v1">>; +msg_name_to_fqbin(blockchain_state_channel_message_v1_pb) -> + <<"helium.blockchain_state_channel_message_v1">>; +msg_name_to_fqbin(eui_pb) -> <<"helium.eui">>; +msg_name_to_fqbin(routing_information_pb) -> <<"helium.routing_information">>; +msg_name_to_fqbin(window_pb) -> <<"helium.window">>; +msg_name_to_fqbin(packet_pb) -> <<"helium.packet">>; +msg_name_to_fqbin(blockchain_txn_state_channel_close_v1_pb) -> + <<"helium.blockchain_txn_state_channel_close_v1">>; +msg_name_to_fqbin(blockchain_var_v1_pb) -> <<"helium.blockchain_var_v1">>; +msg_name_to_fqbin(blockchain_txn_vars_v1_pb) -> <<"helium.blockchain_txn_vars_v1">>; +msg_name_to_fqbin(blockchain_txn_poc_receipts_v1_pb) -> + <<"helium.blockchain_txn_poc_receipts_v1">>; +msg_name_to_fqbin(blockchain_poc_receipt_v1_pb) -> + <<"helium.blockchain_poc_receipt_v1">>; +msg_name_to_fqbin(blockchain_poc_witness_v1_pb) -> + <<"helium.blockchain_poc_witness_v1">>; +msg_name_to_fqbin(blockchain_poc_response_v1_pb) -> + <<"helium.blockchain_poc_response_v1">>; +msg_name_to_fqbin(blockchain_poc_path_element_v1_pb) -> + <<"helium.blockchain_poc_path_element_v1">>; +msg_name_to_fqbin(blockchain_txn_poc_receipts_v2_pb) -> + <<"helium.blockchain_txn_poc_receipts_v2">>; +msg_name_to_fqbin(blockchain_region_params_v1_pb) -> + <<"helium.blockchain_region_params_v1">>; +msg_name_to_fqbin(tagged_spreading_pb) -> <<"helium.tagged_spreading">>; +msg_name_to_fqbin(blockchain_region_spreading_v1_pb) -> + <<"helium.blockchain_region_spreading_v1">>; +msg_name_to_fqbin(blockchain_region_param_v1_pb) -> + <<"helium.blockchain_region_param_v1">>; +msg_name_to_fqbin(E) -> error({gpb_error, {badmsg, E}}). + + +fqbin_to_enum_name(<<"helium.close_state">>) -> 'helium.close_state'; +fqbin_to_enum_name(<<"helium.blockchain_state_channel_state_v1">>) -> + 'helium.blockchain_state_channel_state_v1'; +fqbin_to_enum_name(<<"helium.packet.packet_type">>) -> 'packet_pb.packet_type'; +fqbin_to_enum_name(<<"helium.region">>) -> 'helium.region'; +fqbin_to_enum_name(<<"helium.origin">>) -> 'helium.origin'; +fqbin_to_enum_name(<<"helium.RegionSpreading">>) -> 'helium.RegionSpreading'; +fqbin_to_enum_name(E) -> + error({gpb_error, {badenum, E}}). + + +enum_name_to_fqbin('helium.close_state') -> <<"helium.close_state">>; +enum_name_to_fqbin('helium.blockchain_state_channel_state_v1') -> + <<"helium.blockchain_state_channel_state_v1">>; +enum_name_to_fqbin('packet_pb.packet_type') -> <<"helium.packet.packet_type">>; +enum_name_to_fqbin('helium.region') -> <<"helium.region">>; +enum_name_to_fqbin('helium.origin') -> <<"helium.origin">>; +enum_name_to_fqbin('helium.RegionSpreading') -> <<"helium.RegionSpreading">>; +enum_name_to_fqbin(E) -> + error({gpb_error, {badenum, E}}). + + +get_package_name() -> helium. + + +%% Whether or not the message names +%% are prepended with package name or not. +uses_packages() -> true. + + +source_basename() -> "gateway.proto". + + +%% Retrieve all proto file names, also imported ones. +%% The order is top-down. The first element is always the main +%% source file. The files are returned with extension, +%% see get_all_proto_names/0 for a version that returns +%% the basenames sans extension +get_all_source_basenames() -> + ["gateway.proto", + "blockchain_state_channel_v1.proto", + "packet.proto", + "region.proto", + "blockchain_txn_state_channel_close_v1.proto", + "blockchain_txn_vars_v1.proto", + "blockchain_txn_poc_receipts_v1.proto", + "blockchain_poc_core_v1.proto", + "blockchain_txn_poc_receipts_v2.proto", + "blockchain_region_param_v1.proto"]. + + +%% Retrieve all proto file names, also imported ones. +%% The order is top-down. The first element is always the main +%% source file. The files are returned sans .proto extension, +%% to make it easier to use them with the various get_xyz_containment +%% functions. +get_all_proto_names() -> + ["gateway", + "blockchain_state_channel_v1", + "packet", + "region", + "blockchain_txn_state_channel_close_v1", + "blockchain_txn_vars_v1", + "blockchain_txn_poc_receipts_v1", + "blockchain_poc_core_v1", + "blockchain_txn_poc_receipts_v2", + "blockchain_region_param_v1"]. + + +get_msg_containment("gateway") -> + [empty_pb, + gateway_address_routing_data_req_v1_pb, + gateway_config_req_v1_pb, + gateway_config_resp_v1_pb, + gateway_config_update_req_v1_pb, + gateway_config_update_streamed_resp_v1_pb, + gateway_error_resp_pb, + gateway_poc_challenge_notification_resp_v1_pb, + gateway_poc_check_challenge_target_req_v1_pb, + gateway_poc_check_challenge_target_resp_v1_pb, + gateway_poc_key_routing_data_req_v1_pb, + gateway_poc_report_req_v1_pb, + gateway_poc_req_v1_pb, + gateway_public_routing_data_resp_v1_pb, + gateway_region_params_streamed_resp_v1_pb, + gateway_region_params_update_req_v1_pb, + gateway_resp_v1_pb, + gateway_routing_req_v1_pb, + gateway_routing_streamed_resp_v1_pb, + gateway_sc_close_req_v1_pb, + gateway_sc_close_resp_v1_pb, + gateway_sc_follow_req_v1_pb, + gateway_sc_follow_streamed_resp_v1_pb, + gateway_sc_is_active_req_v1_pb, + gateway_sc_is_active_resp_v1_pb, + gateway_sc_is_overpaid_req_v1_pb, + gateway_sc_is_overpaid_resp_v1_pb, + gateway_success_resp_pb, + gateway_validators_req_v1_pb, + gateway_validators_resp_v1_pb, + routing_pb, + routing_address_pb]; +get_msg_containment("blockchain_state_channel_v1") -> + [blockchain_state_channel_banner_v1_pb, + blockchain_state_channel_diff_append_summary_v1_pb, + blockchain_state_channel_diff_entry_v1_pb, + blockchain_state_channel_diff_update_summary_v1_pb, + blockchain_state_channel_diff_v1_pb, + blockchain_state_channel_message_v1_pb, + blockchain_state_channel_offer_v1_pb, + blockchain_state_channel_packet_v1_pb, + blockchain_state_channel_purchase_v1_pb, + blockchain_state_channel_rejection_v1_pb, + blockchain_state_channel_response_v1_pb, + blockchain_state_channel_summary_v1_pb, + blockchain_state_channel_v1_pb]; +get_msg_containment("packet") -> + [eui_pb, packet_pb, routing_information_pb, window_pb]; +get_msg_containment("region") -> []; +get_msg_containment("blockchain_txn_state_channel_close_v1") -> + [blockchain_txn_state_channel_close_v1_pb]; +get_msg_containment("blockchain_txn_vars_v1") -> + [blockchain_txn_vars_v1_pb, blockchain_var_v1_pb]; +get_msg_containment("blockchain_txn_poc_receipts_v1") -> + [blockchain_txn_poc_receipts_v1_pb]; +get_msg_containment("blockchain_poc_core_v1") -> + [blockchain_poc_path_element_v1_pb, + blockchain_poc_receipt_v1_pb, + blockchain_poc_response_v1_pb, + blockchain_poc_witness_v1_pb]; +get_msg_containment("blockchain_txn_poc_receipts_v2") -> + [blockchain_txn_poc_receipts_v2_pb]; +get_msg_containment("blockchain_region_param_v1") -> + [blockchain_region_param_v1_pb, + blockchain_region_params_v1_pb, + blockchain_region_spreading_v1_pb, + tagged_spreading_pb]; +get_msg_containment(P) -> + error({gpb_error, {badproto, P}}). + + +get_pkg_containment("gateway") -> helium; +get_pkg_containment("blockchain_state_channel_v1") -> + helium; +get_pkg_containment("packet") -> helium; +get_pkg_containment("region") -> helium; +get_pkg_containment("blockchain_txn_state_channel_close_v1") -> + helium; +get_pkg_containment("blockchain_txn_vars_v1") -> helium; +get_pkg_containment("blockchain_txn_poc_receipts_v1") -> + helium; +get_pkg_containment("blockchain_poc_core_v1") -> helium; +get_pkg_containment("blockchain_txn_poc_receipts_v2") -> + helium; +get_pkg_containment("blockchain_region_param_v1") -> + helium; +get_pkg_containment(P) -> + error({gpb_error, {badproto, P}}). + + +get_service_containment("gateway") -> + ['helium.gateway']; +get_service_containment("blockchain_state_channel_v1") -> + []; +get_service_containment("packet") -> []; +get_service_containment("region") -> []; +get_service_containment("blockchain_txn_state_channel_close_v1") -> + []; +get_service_containment("blockchain_txn_vars_v1") -> []; +get_service_containment("blockchain_txn_poc_receipts_v1") -> + []; +get_service_containment("blockchain_poc_core_v1") -> []; +get_service_containment("blockchain_txn_poc_receipts_v2") -> + []; +get_service_containment("blockchain_region_param_v1") -> + []; +get_service_containment(P) -> + error({gpb_error, {badproto, P}}). + + +get_rpc_containment("gateway") -> + [{'helium.gateway', follow_sc}, + {'helium.gateway', routing}, + {'helium.gateway', stream_poc}, + {'helium.gateway', config_update}, + {'helium.gateway', is_active_sc}, + {'helium.gateway', is_overpaid_sc}, + {'helium.gateway', close_sc}, + {'helium.gateway', check_challenge_target}, + {'helium.gateway', send_report}, + {'helium.gateway', address_to_public_uri}, + {'helium.gateway', poc_key_to_public_uri}, + {'helium.gateway', config}, + {'helium.gateway', validators}, + {'helium.gateway', region_params_update}]; +get_rpc_containment("blockchain_state_channel_v1") -> + []; +get_rpc_containment("packet") -> []; +get_rpc_containment("region") -> []; +get_rpc_containment("blockchain_txn_state_channel_close_v1") -> + []; +get_rpc_containment("blockchain_txn_vars_v1") -> []; +get_rpc_containment("blockchain_txn_poc_receipts_v1") -> + []; +get_rpc_containment("blockchain_poc_core_v1") -> []; +get_rpc_containment("blockchain_txn_poc_receipts_v2") -> + []; +get_rpc_containment("blockchain_region_param_v1") -> []; +get_rpc_containment(P) -> + error({gpb_error, {badproto, P}}). + + +get_enum_containment("gateway") -> + ['helium.close_state']; +get_enum_containment("blockchain_state_channel_v1") -> + ['helium.blockchain_state_channel_state_v1']; +get_enum_containment("packet") -> + ['packet_pb.packet_type']; +get_enum_containment("region") -> ['helium.region']; +get_enum_containment("blockchain_txn_state_channel_close_v1") -> + []; +get_enum_containment("blockchain_txn_vars_v1") -> []; +get_enum_containment("blockchain_txn_poc_receipts_v1") -> + []; +get_enum_containment("blockchain_poc_core_v1") -> + ['helium.origin']; +get_enum_containment("blockchain_txn_poc_receipts_v2") -> + []; +get_enum_containment("blockchain_region_param_v1") -> + ['helium.RegionSpreading']; +get_enum_containment(P) -> + error({gpb_error, {badproto, P}}). + + +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_success_resp">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_error_resp">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_region_spreading_v1">>) -> + "blockchain_region_param_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_region_params_v1">>) -> + "blockchain_region_param_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_region_param_v1">>) -> + "blockchain_region_param_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_poc_witness_v1">>) -> + "blockchain_poc_core_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_poc_response_v1">>) -> + "blockchain_poc_core_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_poc_receipt_v1">>) -> + "blockchain_poc_core_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_poc_path_element_v1">>) -> + "blockchain_poc_core_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_txn_poc_receipts_v1">>) -> + "blockchain_txn_poc_receipts_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_var_v1">>) -> + "blockchain_txn_vars_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_txn_vars_v1">>) -> + "blockchain_txn_vars_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_txn_state_channel_close_v1">>) -> + "blockchain_txn_state_channel_close_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_state_channel_v1">>) -> + "blockchain_state_channel_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_state_channel_summary_v1">>) -> + "blockchain_state_channel_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_state_channel_response_v1">>) -> + "blockchain_state_channel_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_state_channel_rejection_v1">>) -> + "blockchain_state_channel_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_state_channel_purchase_v1">>) -> + "blockchain_state_channel_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_state_channel_packet_v1">>) -> + "blockchain_state_channel_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_state_channel_offer_v1">>) -> + "blockchain_state_channel_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_state_channel_message_v1">>) -> + "blockchain_state_channel_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_state_channel_diff_v1">>) -> + "blockchain_state_channel_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_state_channel_diff_update_summary_v1">>) -> + "blockchain_state_channel_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_state_channel_diff_entry_v1">>) -> + "blockchain_state_channel_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_state_channel_diff_append_summary_v1">>) -> + "blockchain_state_channel_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_state_channel_banner_v1">>) -> + "blockchain_state_channel_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_validators_resp_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_validators_req_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_sc_is_overpaid_resp_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_sc_is_overpaid_req_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_sc_is_active_resp_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_sc_is_active_req_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_sc_follow_streamed_resp_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_sc_follow_req_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_sc_close_resp_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_sc_close_req_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_routing_streamed_resp_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_routing_req_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_resp_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_region_params_update_req_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_region_params_streamed_resp_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_public_routing_data_resp_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_poc_req_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_poc_report_req_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_poc_key_routing_data_req_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_poc_check_challenge_target_resp_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_poc_check_challenge_target_req_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_poc_challenge_notification_resp_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_config_update_streamed_resp_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_config_update_req_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_config_resp_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_config_req_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.gateway_address_routing_data_req_v1">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.blockchain_txn_poc_receipts_v2">>) -> + "blockchain_txn_poc_receipts_v2"; +get_proto_by_msg_name_as_fqbin(<<"helium.routing_address">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.packet">>) -> "packet"; +get_proto_by_msg_name_as_fqbin(<<"helium.tagged_spreading">>) -> + "blockchain_region_param_v1"; +get_proto_by_msg_name_as_fqbin(<<"helium.window">>) -> "packet"; +get_proto_by_msg_name_as_fqbin(<<"helium.routing">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.eui">>) -> "packet"; +get_proto_by_msg_name_as_fqbin(<<"helium.empty">>) -> "gateway"; +get_proto_by_msg_name_as_fqbin(<<"helium.routing_information">>) -> "packet"; +get_proto_by_msg_name_as_fqbin(E) -> + error({gpb_error, {badmsg, E}}). + + +get_proto_by_service_name_as_fqbin(<<"helium.gateway">>) -> + "gateway"; +get_proto_by_service_name_as_fqbin(E) -> + error({gpb_error, {badservice, E}}). + + +get_proto_by_enum_name_as_fqbin(<<"helium.blockchain_state_channel_state_v1">>) -> + "blockchain_state_channel_v1"; +get_proto_by_enum_name_as_fqbin(<<"helium.packet.packet_type">>) -> "packet"; +get_proto_by_enum_name_as_fqbin(<<"helium.close_state">>) -> "gateway"; +get_proto_by_enum_name_as_fqbin(<<"helium.RegionSpreading">>) -> + "blockchain_region_param_v1"; +get_proto_by_enum_name_as_fqbin(<<"helium.origin">>) -> + "blockchain_poc_core_v1"; +get_proto_by_enum_name_as_fqbin(<<"helium.region">>) -> "region"; +get_proto_by_enum_name_as_fqbin(E) -> + error({gpb_error, {badenum, E}}). + + +get_protos_by_pkg_name_as_fqbin(<<"helium">>) -> + ["blockchain_poc_core_v1", + "blockchain_region_param_v1", + "blockchain_state_channel_v1", + "blockchain_txn_poc_receipts_v1", + "blockchain_txn_poc_receipts_v2", + "blockchain_txn_state_channel_close_v1", + "blockchain_txn_vars_v1", + "gateway", + "packet", + "region"]; +get_protos_by_pkg_name_as_fqbin(E) -> + error({gpb_error, {badpkg, E}}). + + + +gpb_version_as_string() -> + "4.11.2". + +gpb_version_as_list() -> + [4,11,2]. diff --git a/src/grpc/autogen/client/gateway_miner_client_pb.hrl b/src/grpc/autogen/client/gateway_miner_client_pb.hrl new file mode 100644 index 000000000..38d7c0354 --- /dev/null +++ b/src/grpc/autogen/client/gateway_miner_client_pb.hrl @@ -0,0 +1,584 @@ +%% -*- coding: utf-8 -*- +%% Automatically generated, do not edit +%% Generated by gpb_compile version 4.11.2 + +-ifndef(gateway_miner_client_pb). +-define(gateway_miner_client_pb, true). + +-define(gateway_miner_client_pb_gpb_version, "4.11.2"). + +-ifndef('EMPTY_PB_PB_H'). +-define('EMPTY_PB_PB_H', true). +-record(empty_pb, + { + }). +-endif. + +-ifndef('GATEWAY_SUCCESS_RESP_PB_PB_H'). +-define('GATEWAY_SUCCESS_RESP_PB_PB_H', true). +-record(gateway_success_resp_pb, + {resp = <<>> :: iodata() | undefined, % = 1 + details = <<>> :: iodata() | undefined % = 2 + }). +-endif. + +-ifndef('GATEWAY_ERROR_RESP_PB_PB_H'). +-define('GATEWAY_ERROR_RESP_PB_PB_H', true). +-record(gateway_error_resp_pb, + {error = <<>> :: iodata() | undefined, % = 1 + details = <<>> :: iodata() | undefined % = 2 + }). +-endif. + +-ifndef('GATEWAY_CONFIG_REQ_V1_PB_PB_H'). +-define('GATEWAY_CONFIG_REQ_V1_PB_PB_H', true). +-record(gateway_config_req_v1_pb, + {keys = [] :: [iodata()] | undefined % = 1 + }). +-endif. + +-ifndef('GATEWAY_CONFIG_RESP_V1_PB_PB_H'). +-define('GATEWAY_CONFIG_RESP_V1_PB_PB_H', true). +-record(gateway_config_resp_v1_pb, + {result = [] :: [gateway_miner_client_pb:blockchain_var_v1_pb()] | undefined % = 1 + }). +-endif. + +-ifndef('GATEWAY_CONFIG_UPDATE_REQ_V1_PB_PB_H'). +-define('GATEWAY_CONFIG_UPDATE_REQ_V1_PB_PB_H', true). +-record(gateway_config_update_req_v1_pb, + { + }). +-endif. + +-ifndef('GATEWAY_CONFIG_UPDATE_STREAMED_RESP_V1_PB_PB_H'). +-define('GATEWAY_CONFIG_UPDATE_STREAMED_RESP_V1_PB_PB_H', true). +-record(gateway_config_update_streamed_resp_v1_pb, + {keys = [] :: [iodata()] | undefined % = 1 + }). +-endif. + +-ifndef('GATEWAY_VALIDATORS_REQ_V1_PB_PB_H'). +-define('GATEWAY_VALIDATORS_REQ_V1_PB_PB_H', true). +-record(gateway_validators_req_v1_pb, + {quantity = 0 :: non_neg_integer() | undefined % = 1, 32 bits + }). +-endif. + +-ifndef('GATEWAY_VALIDATORS_RESP_V1_PB_PB_H'). +-define('GATEWAY_VALIDATORS_RESP_V1_PB_PB_H', true). +-record(gateway_validators_resp_v1_pb, + {result = [] :: [gateway_miner_client_pb:routing_address_pb()] | undefined % = 1 + }). +-endif. + +-ifndef('GATEWAY_REGION_PARAMS_STREAMED_RESP_V1_PB_PB_H'). +-define('GATEWAY_REGION_PARAMS_STREAMED_RESP_V1_PB_PB_H', true). +-record(gateway_region_params_streamed_resp_v1_pb, + {address = <<>> :: iodata() | undefined, % = 1 + region = 'US915' :: 'US915' | 'EU868' | 'EU433' | 'CN470' | 'CN779' | 'AU915' | 'AS923_1' | 'KR920' | 'IN865' | 'AS923_2' | 'AS923_3' | 'AS923_4' | integer() | undefined, % = 2, enum helium.region + params = undefined :: gateway_miner_client_pb:blockchain_region_params_v1_pb() | undefined % = 3 + }). +-endif. + +-ifndef('GATEWAY_REGION_PARAMS_UPDATE_REQ_V1_PB_PB_H'). +-define('GATEWAY_REGION_PARAMS_UPDATE_REQ_V1_PB_PB_H', true). +-record(gateway_region_params_update_req_v1_pb, + {address = <<>> :: iodata() | undefined, % = 1 + signature = <<>> :: iodata() | undefined % = 2 + }). +-endif. + +-ifndef('GATEWAY_RESP_V1_PB_PB_H'). +-define('GATEWAY_RESP_V1_PB_PB_H', true). +-record(gateway_resp_v1_pb, + {height = 0 :: non_neg_integer() | undefined, % = 1, 64 bits + signature = <<>> :: iodata() | undefined, % = 2 + msg :: {is_active_resp, gateway_miner_client_pb:gateway_sc_is_active_resp_v1_pb()} | {is_overpaid_resp, gateway_miner_client_pb:gateway_sc_is_overpaid_resp_v1_pb()} | {close_resp, gateway_miner_client_pb:gateway_sc_close_resp_v1_pb()} | {follow_streamed_resp, gateway_miner_client_pb:gateway_sc_follow_streamed_resp_v1_pb()} | {routing_streamed_resp, gateway_miner_client_pb:gateway_routing_streamed_resp_v1_pb()} | {config_resp, gateway_miner_client_pb:gateway_config_resp_v1_pb()} | {config_update_streamed_resp, gateway_miner_client_pb:gateway_config_update_streamed_resp_v1_pb()} | {validators_resp, gateway_miner_client_pb:gateway_validators_resp_v1_pb()} | {region_params_streamed_resp, gateway_miner_client_pb:gateway_region_params_streamed_resp_v1_pb()} | {success_resp, gateway_miner_client_pb:gateway_success_resp_pb()} | {error_resp, gateway_miner_client_pb:gateway_error_resp_pb()} | {poc_challenge_resp, gateway_miner_client_pb:gateway_poc_challenge_notification_resp_v1_pb()} | {poc_check_target_resp, gateway_miner_client_pb:gateway_poc_check_challenge_target_resp_v1_pb()} | {public_route, gateway_miner_client_pb:gateway_public_routing_data_resp_v1_pb()} | undefined, % oneof + block_time = 0 :: non_neg_integer() | undefined, % = 10, 64 bits + block_age = 0 :: non_neg_integer() | undefined % = 11, 64 bits + }). +-endif. + +-ifndef('GATEWAY_SC_IS_ACTIVE_REQ_V1_PB_PB_H'). +-define('GATEWAY_SC_IS_ACTIVE_REQ_V1_PB_PB_H', true). +-record(gateway_sc_is_active_req_v1_pb, + {sc_id = <<>> :: iodata() | undefined, % = 1 + sc_owner = <<>> :: iodata() | undefined % = 2 + }). +-endif. + +-ifndef('GATEWAY_SC_IS_ACTIVE_RESP_V1_PB_PB_H'). +-define('GATEWAY_SC_IS_ACTIVE_RESP_V1_PB_PB_H', true). +-record(gateway_sc_is_active_resp_v1_pb, + {sc_id = <<>> :: iodata() | undefined, % = 1 + sc_owner = <<>> :: iodata() | undefined, % = 2 + active = false :: boolean() | 0 | 1 | undefined, % = 3 + sc_expiry_at_block = 0 :: non_neg_integer() | undefined, % = 4, 64 bits + sc_original_dc_amount = 0 :: non_neg_integer() | undefined % = 5, 64 bits + }). +-endif. + +-ifndef('GATEWAY_SC_IS_OVERPAID_REQ_V1_PB_PB_H'). +-define('GATEWAY_SC_IS_OVERPAID_REQ_V1_PB_PB_H', true). +-record(gateway_sc_is_overpaid_req_v1_pb, + {sc_id = <<>> :: iodata() | undefined, % = 1 + sc_owner = <<>> :: iodata() | undefined, % = 2 + total_dcs = 0 :: non_neg_integer() | undefined % = 3, 64 bits + }). +-endif. + +-ifndef('GATEWAY_SC_IS_OVERPAID_RESP_V1_PB_PB_H'). +-define('GATEWAY_SC_IS_OVERPAID_RESP_V1_PB_PB_H', true). +-record(gateway_sc_is_overpaid_resp_v1_pb, + {sc_id = <<>> :: iodata() | undefined, % = 1 + sc_owner = <<>> :: iodata() | undefined, % = 2 + overpaid = false :: boolean() | 0 | 1 | undefined % = 3 + }). +-endif. + +-ifndef('GATEWAY_SC_CLOSE_REQ_V1_PB_PB_H'). +-define('GATEWAY_SC_CLOSE_REQ_V1_PB_PB_H', true). +-record(gateway_sc_close_req_v1_pb, + {close_txn = undefined :: gateway_miner_client_pb:blockchain_txn_state_channel_close_v1_pb() | undefined % = 1 + }). +-endif. + +-ifndef('GATEWAY_SC_CLOSE_RESP_V1_PB_PB_H'). +-define('GATEWAY_SC_CLOSE_RESP_V1_PB_PB_H', true). +-record(gateway_sc_close_resp_v1_pb, + {sc_id = <<>> :: iodata() | undefined, % = 1 + response = <<>> :: iodata() | undefined % = 2 + }). +-endif. + +-ifndef('GATEWAY_SC_FOLLOW_REQ_V1_PB_PB_H'). +-define('GATEWAY_SC_FOLLOW_REQ_V1_PB_PB_H', true). +-record(gateway_sc_follow_req_v1_pb, + {sc_id = <<>> :: iodata() | undefined, % = 1 + sc_owner = <<>> :: iodata() | undefined % = 2 + }). +-endif. + +-ifndef('GATEWAY_SC_FOLLOW_STREAMED_RESP_V1_PB_PB_H'). +-define('GATEWAY_SC_FOLLOW_STREAMED_RESP_V1_PB_PB_H', true). +-record(gateway_sc_follow_streamed_resp_v1_pb, + {sc_id = <<>> :: iodata() | undefined, % = 1 + sc_owner = <<>> :: iodata() | undefined, % = 2 + close_state = close_state_closable :: close_state_closable | close_state_closing | close_state_closed | close_state_dispute | integer() | undefined % = 3, enum helium.close_state + }). +-endif. + +-ifndef('ROUTING_PB_PB_H'). +-define('ROUTING_PB_PB_H', true). +-record(routing_pb, + {oui = 0 :: non_neg_integer() | undefined, % = 1, 32 bits + owner = <<>> :: iodata() | undefined, % = 2 + addresses = [] :: [gateway_miner_client_pb:routing_address_pb()] | undefined, % = 3 + filters = [] :: [iodata()] | undefined, % = 4 + subnets = [] :: [iodata()] | undefined % = 5 + }). +-endif. + +-ifndef('ROUTING_ADDRESS_PB_PB_H'). +-define('ROUTING_ADDRESS_PB_PB_H', true). +-record(routing_address_pb, + {pub_key = <<>> :: iodata() | undefined, % = 1 + uri = <<>> :: iodata() | undefined % = 2 + }). +-endif. + +-ifndef('GATEWAY_ROUTING_REQ_V1_PB_PB_H'). +-define('GATEWAY_ROUTING_REQ_V1_PB_PB_H', true). +-record(gateway_routing_req_v1_pb, + {height = 0 :: non_neg_integer() | undefined % = 1, 64 bits + }). +-endif. + +-ifndef('GATEWAY_ROUTING_STREAMED_RESP_V1_PB_PB_H'). +-define('GATEWAY_ROUTING_STREAMED_RESP_V1_PB_PB_H', true). +-record(gateway_routing_streamed_resp_v1_pb, + {routings = [] :: [gateway_miner_client_pb:routing_pb()] | undefined % = 1 + }). +-endif. + +-ifndef('GATEWAY_POC_REQ_V1_PB_PB_H'). +-define('GATEWAY_POC_REQ_V1_PB_PB_H', true). +-record(gateway_poc_req_v1_pb, + {address = <<>> :: iodata() | undefined, % = 1 + signature = <<>> :: iodata() | undefined % = 2 + }). +-endif. + +-ifndef('GATEWAY_POC_CHALLENGE_NOTIFICATION_RESP_V1_PB_PB_H'). +-define('GATEWAY_POC_CHALLENGE_NOTIFICATION_RESP_V1_PB_PB_H', true). +-record(gateway_poc_challenge_notification_resp_v1_pb, + {challenger = undefined :: gateway_miner_client_pb:routing_address_pb() | undefined, % = 1 + block_hash = <<>> :: iodata() | undefined, % = 2 + onion_key_hash = <<>> :: iodata() | undefined % = 3 + }). +-endif. + +-ifndef('GATEWAY_POC_CHECK_CHALLENGE_TARGET_REQ_V1_PB_PB_H'). +-define('GATEWAY_POC_CHECK_CHALLENGE_TARGET_REQ_V1_PB_PB_H', true). +-record(gateway_poc_check_challenge_target_req_v1_pb, + {address = <<>> :: iodata() | undefined, % = 1 + challenger = <<>> :: iodata() | undefined, % = 2 + block_hash = <<>> :: iodata() | undefined, % = 3 + onion_key_hash = <<>> :: iodata() | undefined, % = 4 + height = 0 :: non_neg_integer() | undefined, % = 5, 64 bits + notifier = <<>> :: iodata() | undefined, % = 6 + notifier_sig = <<>> :: iodata() | undefined, % = 7 + challengee_sig = <<>> :: iodata() | undefined % = 8 + }). +-endif. + +-ifndef('GATEWAY_POC_CHECK_CHALLENGE_TARGET_RESP_V1_PB_PB_H'). +-define('GATEWAY_POC_CHECK_CHALLENGE_TARGET_RESP_V1_PB_PB_H', true). +-record(gateway_poc_check_challenge_target_resp_v1_pb, + {target = false :: boolean() | 0 | 1 | undefined, % = 1 + onion = <<>> :: iodata() | undefined % = 2 + }). +-endif. + +-ifndef('GATEWAY_POC_REPORT_REQ_V1_PB_PB_H'). +-define('GATEWAY_POC_REPORT_REQ_V1_PB_PB_H', true). +-record(gateway_poc_report_req_v1_pb, + {onion_key_hash = <<>> :: iodata() | undefined, % = 1 + msg :: {receipt, gateway_miner_client_pb:blockchain_poc_receipt_v1_pb()} | {witness, gateway_miner_client_pb:blockchain_poc_witness_v1_pb()} | undefined % oneof + }). +-endif. + +-ifndef('GATEWAY_ADDRESS_ROUTING_DATA_REQ_V1_PB_PB_H'). +-define('GATEWAY_ADDRESS_ROUTING_DATA_REQ_V1_PB_PB_H', true). +-record(gateway_address_routing_data_req_v1_pb, + {address = <<>> :: iodata() | undefined % = 1 + }). +-endif. + +-ifndef('GATEWAY_POC_KEY_ROUTING_DATA_REQ_V1_PB_PB_H'). +-define('GATEWAY_POC_KEY_ROUTING_DATA_REQ_V1_PB_PB_H', true). +-record(gateway_poc_key_routing_data_req_v1_pb, + {key = <<>> :: iodata() | undefined % = 1 + }). +-endif. + +-ifndef('GATEWAY_PUBLIC_ROUTING_DATA_RESP_V1_PB_PB_H'). +-define('GATEWAY_PUBLIC_ROUTING_DATA_RESP_V1_PB_PB_H', true). +-record(gateway_public_routing_data_resp_v1_pb, + {address = <<>> :: iodata() | undefined, % = 1 + public_uri = undefined :: gateway_miner_client_pb:routing_address_pb() | undefined % = 2 + }). +-endif. + +-ifndef('BLOCKCHAIN_STATE_CHANNEL_SUMMARY_V1_PB_PB_H'). +-define('BLOCKCHAIN_STATE_CHANNEL_SUMMARY_V1_PB_PB_H', true). +-record(blockchain_state_channel_summary_v1_pb, + {client_pubkeybin = <<>> :: iodata() | undefined, % = 1 + num_packets = 0 :: non_neg_integer() | undefined, % = 2, 64 bits + num_dcs = 0 :: non_neg_integer() | undefined % = 3, 64 bits + }). +-endif. + +-ifndef('BLOCKCHAIN_STATE_CHANNEL_V1_PB_PB_H'). +-define('BLOCKCHAIN_STATE_CHANNEL_V1_PB_PB_H', true). +-record(blockchain_state_channel_v1_pb, + {id = <<>> :: iodata() | undefined, % = 1 + owner = <<>> :: iodata() | undefined, % = 2 + credits = 0 :: non_neg_integer() | undefined, % = 3, 64 bits + nonce = 0 :: non_neg_integer() | undefined, % = 4, 64 bits + summaries = [] :: [gateway_miner_client_pb:blockchain_state_channel_summary_v1_pb()] | undefined, % = 5 + root_hash = <<>> :: iodata() | undefined, % = 6 + skewed = <<>> :: iodata() | undefined, % = 7 + state = open :: open | closed | integer() | undefined, % = 8, enum helium.blockchain_state_channel_state_v1 + expire_at_block = 0 :: non_neg_integer() | undefined, % = 9, 64 bits + signature = <<>> :: iodata() | undefined % = 10 + }). +-endif. + +-ifndef('BLOCKCHAIN_STATE_CHANNEL_RESPONSE_V1_PB_PB_H'). +-define('BLOCKCHAIN_STATE_CHANNEL_RESPONSE_V1_PB_PB_H', true). +-record(blockchain_state_channel_response_v1_pb, + {accepted = false :: boolean() | 0 | 1 | undefined, % = 1 + downlink = undefined :: gateway_miner_client_pb:packet_pb() | undefined % = 4 + }). +-endif. + +-ifndef('BLOCKCHAIN_STATE_CHANNEL_PACKET_V1_PB_PB_H'). +-define('BLOCKCHAIN_STATE_CHANNEL_PACKET_V1_PB_PB_H', true). +-record(blockchain_state_channel_packet_v1_pb, + {packet = undefined :: gateway_miner_client_pb:packet_pb() | undefined, % = 1 + hotspot = <<>> :: iodata() | undefined, % = 2 + signature = <<>> :: iodata() | undefined, % = 3 + region = 'US915' :: 'US915' | 'EU868' | 'EU433' | 'CN470' | 'CN779' | 'AU915' | 'AS923_1' | 'KR920' | 'IN865' | 'AS923_2' | 'AS923_3' | 'AS923_4' | integer() | undefined, % = 4, enum helium.region + hold_time = 0 :: non_neg_integer() | undefined % = 5, 64 bits + }). +-endif. + +-ifndef('BLOCKCHAIN_STATE_CHANNEL_OFFER_V1_PB_PB_H'). +-define('BLOCKCHAIN_STATE_CHANNEL_OFFER_V1_PB_PB_H', true). +-record(blockchain_state_channel_offer_v1_pb, + {routing = undefined :: gateway_miner_client_pb:routing_information_pb() | undefined, % = 1 + packet_hash = <<>> :: iodata() | undefined, % = 2 + payload_size = 0 :: non_neg_integer() | undefined, % = 3, 64 bits + fcnt = 0 :: non_neg_integer() | undefined, % = 4, 32 bits + hotspot = <<>> :: iodata() | undefined, % = 5 + signature = <<>> :: iodata() | undefined, % = 6 + region = 'US915' :: 'US915' | 'EU868' | 'EU433' | 'CN470' | 'CN779' | 'AU915' | 'AS923_1' | 'KR920' | 'IN865' | 'AS923_2' | 'AS923_3' | 'AS923_4' | integer() | undefined, % = 7, enum helium.region + req_diff = false :: boolean() | 0 | 1 | undefined % = 8 + }). +-endif. + +-ifndef('BLOCKCHAIN_STATE_CHANNEL_PURCHASE_V1_PB_PB_H'). +-define('BLOCKCHAIN_STATE_CHANNEL_PURCHASE_V1_PB_PB_H', true). +-record(blockchain_state_channel_purchase_v1_pb, + {sc = undefined :: gateway_miner_client_pb:blockchain_state_channel_v1_pb() | undefined, % = 1 + hotspot = <<>> :: iodata() | undefined, % = 2 + packet_hash = <<>> :: iodata() | undefined, % = 3 + region = 'US915' :: 'US915' | 'EU868' | 'EU433' | 'CN470' | 'CN779' | 'AU915' | 'AS923_1' | 'KR920' | 'IN865' | 'AS923_2' | 'AS923_3' | 'AS923_4' | integer() | undefined, % = 4, enum helium.region + sc_diff = undefined :: gateway_miner_client_pb:blockchain_state_channel_diff_v1_pb() | undefined % = 5 + }). +-endif. + +-ifndef('BLOCKCHAIN_STATE_CHANNEL_DIFF_V1_PB_PB_H'). +-define('BLOCKCHAIN_STATE_CHANNEL_DIFF_V1_PB_PB_H', true). +-record(blockchain_state_channel_diff_v1_pb, + {id = <<>> :: iodata() | undefined, % = 1 + add_nonce = 0 :: non_neg_integer() | undefined, % = 2, 64 bits + signature = <<>> :: iodata() | undefined, % = 3 + diffs = [] :: [gateway_miner_client_pb:blockchain_state_channel_diff_entry_v1_pb()] | undefined % = 4 + }). +-endif. + +-ifndef('BLOCKCHAIN_STATE_CHANNEL_DIFF_ENTRY_V1_PB_PB_H'). +-define('BLOCKCHAIN_STATE_CHANNEL_DIFF_ENTRY_V1_PB_PB_H', true). +-record(blockchain_state_channel_diff_entry_v1_pb, + {entry :: {append, gateway_miner_client_pb:blockchain_state_channel_diff_append_summary_v1_pb()} | {add, gateway_miner_client_pb:blockchain_state_channel_diff_update_summary_v1_pb()} | undefined % oneof + }). +-endif. + +-ifndef('BLOCKCHAIN_STATE_CHANNEL_DIFF_APPEND_SUMMARY_V1_PB_PB_H'). +-define('BLOCKCHAIN_STATE_CHANNEL_DIFF_APPEND_SUMMARY_V1_PB_PB_H', true). +-record(blockchain_state_channel_diff_append_summary_v1_pb, + {client_pubkeybin = <<>> :: iodata() | undefined, % = 1 + num_packets = 0 :: non_neg_integer() | undefined, % = 2, 64 bits + num_dcs = 0 :: non_neg_integer() | undefined % = 3, 64 bits + }). +-endif. + +-ifndef('BLOCKCHAIN_STATE_CHANNEL_DIFF_UPDATE_SUMMARY_V1_PB_PB_H'). +-define('BLOCKCHAIN_STATE_CHANNEL_DIFF_UPDATE_SUMMARY_V1_PB_PB_H', true). +-record(blockchain_state_channel_diff_update_summary_v1_pb, + {client_index = 0 :: non_neg_integer() | undefined, % = 1, 64 bits + add_packets = 0 :: non_neg_integer() | undefined, % = 2, 64 bits + add_dcs = 0 :: non_neg_integer() | undefined % = 3, 64 bits + }). +-endif. + +-ifndef('BLOCKCHAIN_STATE_CHANNEL_BANNER_V1_PB_PB_H'). +-define('BLOCKCHAIN_STATE_CHANNEL_BANNER_V1_PB_PB_H', true). +-record(blockchain_state_channel_banner_v1_pb, + {sc = undefined :: gateway_miner_client_pb:blockchain_state_channel_v1_pb() | undefined % = 1 + }). +-endif. + +-ifndef('BLOCKCHAIN_STATE_CHANNEL_REJECTION_V1_PB_PB_H'). +-define('BLOCKCHAIN_STATE_CHANNEL_REJECTION_V1_PB_PB_H', true). +-record(blockchain_state_channel_rejection_v1_pb, + {reject = 0 :: non_neg_integer() | undefined, % = 1, 32 bits + packet_hash = <<>> :: iodata() | undefined % = 2 + }). +-endif. + +-ifndef('BLOCKCHAIN_STATE_CHANNEL_MESSAGE_V1_PB_PB_H'). +-define('BLOCKCHAIN_STATE_CHANNEL_MESSAGE_V1_PB_PB_H', true). +-record(blockchain_state_channel_message_v1_pb, + {msg :: {response, gateway_miner_client_pb:blockchain_state_channel_response_v1_pb()} | {packet, gateway_miner_client_pb:blockchain_state_channel_packet_v1_pb()} | {offer, gateway_miner_client_pb:blockchain_state_channel_offer_v1_pb()} | {purchase, gateway_miner_client_pb:blockchain_state_channel_purchase_v1_pb()} | {banner, gateway_miner_client_pb:blockchain_state_channel_banner_v1_pb()} | {reject, gateway_miner_client_pb:blockchain_state_channel_rejection_v1_pb()} | undefined % oneof + }). +-endif. + +-ifndef('EUI_PB_PB_H'). +-define('EUI_PB_PB_H', true). +-record(eui_pb, + {deveui = 0 :: non_neg_integer() | undefined, % = 1, 64 bits + appeui = 0 :: non_neg_integer() | undefined % = 2, 64 bits + }). +-endif. + +-ifndef('ROUTING_INFORMATION_PB_PB_H'). +-define('ROUTING_INFORMATION_PB_PB_H', true). +-record(routing_information_pb, + {data :: {devaddr, non_neg_integer()} | {eui, gateway_miner_client_pb:eui_pb()} | undefined % oneof + }). +-endif. + +-ifndef('WINDOW_PB_PB_H'). +-define('WINDOW_PB_PB_H', true). +-record(window_pb, + {timestamp = 0 :: non_neg_integer() | undefined, % = 1, 64 bits + frequency = 0.0 :: float() | integer() | infinity | '-infinity' | nan | undefined, % = 2 + datarate = [] :: iodata() | undefined % = 3 + }). +-endif. + +-ifndef('PACKET_PB_PB_H'). +-define('PACKET_PB_PB_H', true). +-record(packet_pb, + {oui = 0 :: non_neg_integer() | undefined, % = 1, 32 bits + type = longfi :: longfi | lorawan | integer() | undefined, % = 2, enum packet_pb.packet_type + payload = <<>> :: iodata() | undefined, % = 3 + timestamp = 0 :: non_neg_integer() | undefined, % = 4, 64 bits + signal_strength = 0.0 :: float() | integer() | infinity | '-infinity' | nan | undefined, % = 5 + frequency = 0.0 :: float() | integer() | infinity | '-infinity' | nan | undefined, % = 6 + datarate = [] :: iodata() | undefined, % = 7 + snr = 0.0 :: float() | integer() | infinity | '-infinity' | nan | undefined, % = 8 + routing = undefined :: gateway_miner_client_pb:routing_information_pb() | undefined, % = 9 + rx2_window = undefined :: gateway_miner_client_pb:window_pb() | undefined % = 10 + }). +-endif. + +-ifndef('BLOCKCHAIN_TXN_STATE_CHANNEL_CLOSE_V1_PB_PB_H'). +-define('BLOCKCHAIN_TXN_STATE_CHANNEL_CLOSE_V1_PB_PB_H', true). +-record(blockchain_txn_state_channel_close_v1_pb, + {state_channel = undefined :: gateway_miner_client_pb:blockchain_state_channel_v1_pb() | undefined, % = 1 + closer = <<>> :: iodata() | undefined, % = 2 + signature = <<>> :: iodata() | undefined, % = 3 + fee = 0 :: non_neg_integer() | undefined, % = 4, 64 bits + conflicts_with = undefined :: gateway_miner_client_pb:blockchain_state_channel_v1_pb() | undefined % = 5 + }). +-endif. + +-ifndef('BLOCKCHAIN_VAR_V1_PB_PB_H'). +-define('BLOCKCHAIN_VAR_V1_PB_PB_H', true). +-record(blockchain_var_v1_pb, + {name = [] :: iodata() | undefined, % = 1 + type = [] :: iodata() | undefined, % = 2 + value = <<>> :: iodata() | undefined % = 3 + }). +-endif. + +-ifndef('BLOCKCHAIN_TXN_VARS_V1_PB_PB_H'). +-define('BLOCKCHAIN_TXN_VARS_V1_PB_PB_H', true). +-record(blockchain_txn_vars_v1_pb, + {vars = [] :: [gateway_miner_client_pb:blockchain_var_v1_pb()] | undefined, % = 1 + version_predicate = 0 :: non_neg_integer() | undefined, % = 2, 32 bits + proof = <<>> :: iodata() | undefined, % = 3 + master_key = <<>> :: iodata() | undefined, % = 4 + key_proof = <<>> :: iodata() | undefined, % = 5 + cancels = [] :: [iodata()] | undefined, % = 6 + unsets = [] :: [iodata()] | undefined, % = 7 + nonce = 0 :: non_neg_integer() | undefined, % = 8, 32 bits + multi_keys = [] :: [iodata()] | undefined, % = 9 + multi_proofs = [] :: [iodata()] | undefined, % = 10 + multi_key_proofs = [] :: [iodata()] | undefined % = 11 + }). +-endif. + +-ifndef('BLOCKCHAIN_TXN_POC_RECEIPTS_V1_PB_PB_H'). +-define('BLOCKCHAIN_TXN_POC_RECEIPTS_V1_PB_PB_H', true). +-record(blockchain_txn_poc_receipts_v1_pb, + {challenger = <<>> :: iodata() | undefined, % = 1 + secret = <<>> :: iodata() | undefined, % = 2 + onion_key_hash = <<>> :: iodata() | undefined, % = 3 + path = [] :: [gateway_miner_client_pb:blockchain_poc_path_element_v1_pb()] | undefined, % = 4 + fee = 0 :: non_neg_integer() | undefined, % = 5, 64 bits + signature = <<>> :: iodata() | undefined, % = 6 + request_block_hash = <<>> :: iodata() | undefined % = 7 + }). +-endif. + +-ifndef('BLOCKCHAIN_POC_RECEIPT_V1_PB_PB_H'). +-define('BLOCKCHAIN_POC_RECEIPT_V1_PB_PB_H', true). +-record(blockchain_poc_receipt_v1_pb, + {gateway = <<>> :: iodata() | undefined, % = 1 + timestamp = 0 :: non_neg_integer() | undefined, % = 2, 64 bits + signal = 0 :: integer() | undefined, % = 3, 32 bits + data = <<>> :: iodata() | undefined, % = 4 + origin = p2p :: p2p | radio | integer() | undefined, % = 5, enum helium.origin + signature = <<>> :: iodata() | undefined, % = 6 + snr = 0.0 :: float() | integer() | infinity | '-infinity' | nan | undefined, % = 7 + frequency = 0.0 :: float() | integer() | infinity | '-infinity' | nan | undefined, % = 8 + channel = 0 :: integer() | undefined, % = 9, 32 bits + datarate = [] :: iodata() | undefined, % = 10 + addr_hash = <<>> :: iodata() | undefined, % = 11 + tx_power = 0 :: integer() | undefined % = 12, 32 bits + }). +-endif. + +-ifndef('BLOCKCHAIN_POC_WITNESS_V1_PB_PB_H'). +-define('BLOCKCHAIN_POC_WITNESS_V1_PB_PB_H', true). +-record(blockchain_poc_witness_v1_pb, + {gateway = <<>> :: iodata() | undefined, % = 1 + timestamp = 0 :: non_neg_integer() | undefined, % = 2, 64 bits + signal = 0 :: integer() | undefined, % = 3, 32 bits + packet_hash = <<>> :: iodata() | undefined, % = 4 + signature = <<>> :: iodata() | undefined, % = 5 + snr = 0.0 :: float() | integer() | infinity | '-infinity' | nan | undefined, % = 6 + frequency = 0.0 :: float() | integer() | infinity | '-infinity' | nan | undefined, % = 7 + channel = 0 :: integer() | undefined, % = 8, 32 bits + datarate = [] :: iodata() | undefined % = 9 + }). +-endif. + +-ifndef('BLOCKCHAIN_POC_RESPONSE_V1_PB_PB_H'). +-define('BLOCKCHAIN_POC_RESPONSE_V1_PB_PB_H', true). +-record(blockchain_poc_response_v1_pb, + {payload :: {receipt, gateway_miner_client_pb:blockchain_poc_receipt_v1_pb()} | {witness, gateway_miner_client_pb:blockchain_poc_witness_v1_pb()} | undefined % oneof + }). +-endif. + +-ifndef('BLOCKCHAIN_POC_PATH_ELEMENT_V1_PB_PB_H'). +-define('BLOCKCHAIN_POC_PATH_ELEMENT_V1_PB_PB_H', true). +-record(blockchain_poc_path_element_v1_pb, + {challengee = <<>> :: iodata() | undefined, % = 1 + receipt = undefined :: gateway_miner_client_pb:blockchain_poc_receipt_v1_pb() | undefined, % = 2 + witnesses = [] :: [gateway_miner_client_pb:blockchain_poc_witness_v1_pb()] | undefined % = 3 + }). +-endif. + +-ifndef('BLOCKCHAIN_TXN_POC_RECEIPTS_V2_PB_PB_H'). +-define('BLOCKCHAIN_TXN_POC_RECEIPTS_V2_PB_PB_H', true). +-record(blockchain_txn_poc_receipts_v2_pb, + {challenger = <<>> :: iodata() | undefined, % = 1 + secret = <<>> :: iodata() | undefined, % = 2 + onion_key_hash = <<>> :: iodata() | undefined, % = 3 + path = [] :: [gateway_miner_client_pb:blockchain_poc_path_element_v1_pb()] | undefined, % = 4 + fee = 0 :: non_neg_integer() | undefined, % = 5, 64 bits + signature = <<>> :: iodata() | undefined, % = 6 + block_hash = <<>> :: iodata() | undefined % = 7 + }). +-endif. + +-ifndef('BLOCKCHAIN_REGION_PARAMS_V1_PB_PB_H'). +-define('BLOCKCHAIN_REGION_PARAMS_V1_PB_PB_H', true). +-record(blockchain_region_params_v1_pb, + {region_params = [] :: [gateway_miner_client_pb:blockchain_region_param_v1_pb()] | undefined % = 1 + }). +-endif. + +-ifndef('TAGGED_SPREADING_PB_PB_H'). +-define('TAGGED_SPREADING_PB_PB_H', true). +-record(tagged_spreading_pb, + {region_spreading = 'SF_INVALID' :: 'SF_INVALID' | 'SF7' | 'SF8' | 'SF9' | 'SF10' | 'SF11' | 'SF12' | integer() | undefined, % = 1, enum helium.RegionSpreading + max_packet_size = 0 :: non_neg_integer() | undefined % = 2, 32 bits + }). +-endif. + +-ifndef('BLOCKCHAIN_REGION_SPREADING_V1_PB_PB_H'). +-define('BLOCKCHAIN_REGION_SPREADING_V1_PB_PB_H', true). +-record(blockchain_region_spreading_v1_pb, + {tagged_spreading = [] :: [gateway_miner_client_pb:tagged_spreading_pb()] | undefined % = 1 + }). +-endif. + +-ifndef('BLOCKCHAIN_REGION_PARAM_V1_PB_PB_H'). +-define('BLOCKCHAIN_REGION_PARAM_V1_PB_PB_H', true). +-record(blockchain_region_param_v1_pb, + {channel_frequency = 0 :: non_neg_integer() | undefined, % = 1, 64 bits + bandwidth = 0 :: non_neg_integer() | undefined, % = 2, 32 bits + max_eirp = 0 :: non_neg_integer() | undefined, % = 3, 32 bits + spreading = undefined :: gateway_miner_client_pb:blockchain_region_spreading_v1_pb() | undefined % = 4 + }). +-endif. + +-endif. diff --git a/src/handlers/miner_discovery_handler.erl b/src/handlers/miner_discovery_handler.erl index ca59efa4d..c1e7e0575 100644 --- a/src/handlers/miner_discovery_handler.erl +++ b/src/handlers/miner_discovery_handler.erl @@ -70,7 +70,8 @@ handle_data(server, Data, State) -> Sig ]); true -> - case miner_lora:location_ok() of + LoraMod = application:get_env(miner, lora_mod, miner_lora), + case LoraMod:location_ok() of true -> miner_discovery_worker:start(Packets); false -> diff --git a/src/handlers/miner_hbbft_handler.erl b/src/handlers/miner_hbbft_handler.erl index 4cb573b58..71fe50c30 100644 --- a/src/handlers/miner_hbbft_handler.erl +++ b/src/handlers/miner_hbbft_handler.erl @@ -61,6 +61,8 @@ %% TODO No need to pass Meta when tuple. Use sum type: {map, Meta} | tuple metadata(Version, Meta, Chain) -> {ok, HeadHash} = blockchain:head_hash(Chain), + Ledger = blockchain:ledger(Chain), + {ok, N} = blockchain:config(?num_consensus_members, Ledger), %% construct a 2-tuple of the system time and the current head block hash as our stamp data case Version of tuple -> @@ -93,7 +95,28 @@ metadata(Version, Meta, Chain) -> lager:info("no snapshot interval configured"), ChainMeta0 end, - t2b(maps:merge(Meta, ChainMeta)) + ChainMeta1 = + case blockchain:config(?poc_challenger_type, Ledger) of + {ok, validator} -> + %% generate a set of ephemeral keys for POC usage + %% the hashes of the public keys are added to metadata + ChallengeRate = + case blockchain:config(?poc_challenge_rate, Ledger) of + {ok, CR} -> CR; + _ -> 1 + end, + lager:debug("poc challenge rate ~p", [ChallengeRate] ), + SelfPubKeyBin = blockchain_swarm:pubkey_bin(), + NumKeys = max(1, trunc(ChallengeRate / (((N-1)/3) * 2 ))), + POCEphemeralKeys = miner_poc_mgr:get_random_poc_key_proposals(NumKeys, Ledger), + lager:debug("node ~p submitting poc ephemeral key hashes ~p", [SelfPubKeyBin, POCEphemeralKeys]), + maps:put(poc_keys, POCEphemeralKeys, ChainMeta); + _ -> + ChainMeta + + end, + lager:info("ChainMeta1 ~p", [ChainMeta1]), + t2b(maps:merge(Meta, ChainMeta1)) end. init([Members, Id, N, F, BatchSize, SK, Chain]) -> @@ -119,7 +142,8 @@ init([Members, Id, N, F, BatchSize, SK, Chain, Round, Buf]) -> signatures_required = N - F, hbbft = HBBFT, swarm_keys = {MyPubKey, SignFun}, % For re-signing on var-autoskip - chain = Chain1}}. + chain = Chain1 + }}. handle_command(start_acs, State) -> case hbbft:start_on_demand(State#state.hbbft) of diff --git a/src/jsonrpc/miner_jsonrpc_info.erl b/src/jsonrpc/miner_jsonrpc_info.erl index fbedad78f..0b6b3cc43 100644 --- a/src/jsonrpc/miner_jsonrpc_info.erl +++ b/src/jsonrpc/miner_jsonrpc_info.erl @@ -45,8 +45,9 @@ handle_rpc(<<"info_p2p_status">>, []) -> height => ?TO_VALUE(list_to_integer(Height)) }; handle_rpc(<<"info_region">>, []) -> + LoraMod = application:get_env(miner, lora_mod, miner_lora), R = - case miner_lora:region() of + case LoraMod:region() of {ok, undefined} -> null; {ok, Region} -> atom_to_binary(Region, utf8) end, diff --git a/src/miner.erl b/src/miner.erl index 31826391b..3b7f75e87 100644 --- a/src/miner.erl +++ b/src/miner.erl @@ -52,7 +52,8 @@ seen => binary(), bba_completion => binary(), head_hash => blockchain_block:hash(), - snapshot_hash => binary() + snapshot_hash => binary(), + poc_onion_keys => list() }. -type metadata() :: @@ -329,7 +330,8 @@ version() -> %% ------------------------------------------------------------------ init(_Args) -> - lager:info("STARTING UP MINER"), + Mode = application:get_env(miner, mode), + lager:info("STARTING UP MINER with mode ~p", [Mode]), ok = blockchain_event:add_handler(self()), %% TODO: Maybe put this somewhere else? ok = miner_discovery_handler:add_stream_handler(blockchain_swarm:tid()), @@ -574,6 +576,13 @@ create_block(Metadata, Txns, HBBFTRound, Chain, VotesNeeded, {MyPubKey, SignFun} HeightNext = HeightCurr + 1, Ledger = blockchain:ledger(Chain), SnapshotHash = snapshot_hash(Ledger, HeightNext, Metadata, VotesNeeded), + POCKeys = + case blockchain:config(?poc_challenger_type, Ledger) of + {ok, validator} -> + poc_keys(Ledger, Metadata, CurrentBlockHash); + _ -> + [] + end, SeenBBAs = [{{J, S}, B} || {J, #{seen := S, bba_completion := B}} <- metadata_only_v2(Metadata)], {SeenVectors, BBAs} = lists:unzip(SeenBBAs), @@ -602,7 +611,8 @@ create_block(Metadata, Txns, HBBFTRound, Chain, VotesNeeded, {MyPubKey, SignFun} epoch_start => EpochStart, seen_votes => SeenVectors, bba_completion => BBA, - snapshot_hash => SnapshotHash + snapshot_hash => SnapshotHash, + poc_keys => POCKeys }), BinNewBlock = blockchain_block:serialize(NewBlock), Signature = SignFun(BinNewBlock), @@ -739,6 +749,27 @@ snapshot_hash(Ledger, BlockHeightNext, Metadata, VotesNeeded) -> <<>> end. +-spec poc_keys(L, M, B) -> [] + when L :: blockchain_ledger_v1:ledger(), + M :: metadata(), + B :: blockchain_block:hash(). +poc_keys(Ledger, Metadata, BlockHash) -> + %% Construct a set of poc keys. Each node will pull a random list from a pool of keys + %% We want to take a deterministic random subset of these up to a max of poc challenge rate + %% Use the blockhash as the seed + RandState = blockchain_utils:rand_state(BlockHash), + ChallengeRate = + case blockchain:config(?poc_challenge_rate, Ledger) of + {ok, V} -> V; + _ -> 1 + end, + PocKeys0 = [POCKeys || {_, #{poc_keys := POCKeys}} <- metadata_only_v2(Metadata)], + sort_and_truncate_poc_keys(lists:flatten(PocKeys0), ChallengeRate, RandState). + +sort_and_truncate_poc_keys(L, MaxKeys, RandState) -> + {_, TruncList} = blockchain_utils:deterministic_subset(MaxKeys, RandState, L), + TruncList. + -spec common_enough_or_default(non_neg_integer(), [X], X) -> X. common_enough_or_default(_, [], Default) -> Default; diff --git a/src/miner_consensus_mgr.erl b/src/miner_consensus_mgr.erl index 58e1a08d8..c3a6906d4 100644 --- a/src/miner_consensus_mgr.erl +++ b/src/miner_consensus_mgr.erl @@ -177,6 +177,7 @@ einfo() -> %%%=================================================================== init(_Args) -> + lager:info("Starting consensus_mgr", []), ok = blockchain_event:add_handler(self()), erlang:send_after(timer:seconds(1), self(), monitor_miner), case blockchain_worker:blockchain() of diff --git a/src/miner_critical_sup.erl b/src/miner_critical_sup.erl index 66a48cc2d..30e7879d7 100644 --- a/src/miner_critical_sup.erl +++ b/src/miner_critical_sup.erl @@ -74,6 +74,17 @@ init(_Opts) -> %% downlink packets from state channels go here application:set_env(blockchain, sc_client_handler, miner_lora), + %% if POCs are over grpc and we are a gateway then dont start the chain + GatewaysRunChain = application:get_env(miner, gateways_run_chain, true), + MinerMode = application:get_env(miner, mode, gateway), + case {MinerMode, GatewaysRunChain} of + {gateway, false} -> + lager:info("grpc gateway, not loading chain"), + application:set_env(blockchain, autoload, false); + _ -> + ok + end, + BlockchainOpts = [ {key, {PublicKey, SigFun, ECDHFun}}, {seed_nodes, SeedNodes ++ SeedAddresses}, diff --git a/src/miner_discovery_worker.erl b/src/miner_discovery_worker.erl index 7b32b7c65..1f09cbcf3 100644 --- a/src/miner_discovery_worker.erl +++ b/src/miner_discovery_worker.erl @@ -46,7 +46,8 @@ init([Packets]) -> length(Packets), ?DEFAULT_TRANSMIT_DELAY_MS ]), - {ok, Region} = miner_lora:region(), + LoraMod = application:get_env(miner, lora_mod, miner_lora), + {ok, Region} = LoraMod:region(), TxPower = tx_power(Region), timer:send_after(?DEFAULT_TRANSMIT_DELAY_MS, self(), tick), {ok, #state{ @@ -75,7 +76,8 @@ handle_info( lists:nth(rand:uniform(length(FreqList)), FreqList) end, Spreading = spreading(Region, byte_size(Packet)), - case miner_lora:send_poc( + LoraMod = application:get_env(miner, lora_mod, miner_lora), + case LoraMod:send_poc( Packet, immediate, ChannelSelectorFun, diff --git a/src/miner_hbbft_sidecar.erl b/src/miner_hbbft_sidecar.erl index e93050cff..b7b1ecb21 100644 --- a/src/miner_hbbft_sidecar.erl +++ b/src/miner_hbbft_sidecar.erl @@ -19,8 +19,15 @@ -define(SERVER, ?MODULE). +-ifdef(TEST). +-define(SlowTxns, #{blockchain_txn_poc_receipts_v1 => 10000, + blockchain_txn_poc_receipts_v2 => 10000, + blockchain_txn_consensus_group_v1 => 30000}). +-else. -define(SlowTxns, #{blockchain_txn_poc_receipts_v1 => 75, + blockchain_txn_poc_receipts_v2 => 75, blockchain_txn_consensus_group_v1 => 30000}). +-endif. %% txns that do not appear naturally -define(InvalidTxns, [blockchain_txn_reward_v1, blockchain_txn_reward_v2]). diff --git a/src/miner_jsonrpc_handler.erl b/src/miner_jsonrpc_handler.erl index 7d47486ca..f5f4972e0 100644 --- a/src/miner_jsonrpc_handler.erl +++ b/src/miner_jsonrpc_handler.erl @@ -214,9 +214,9 @@ to_value(X) -> iolist_to_binary(io_lib:format("~p", [X])). ensure_binary_map(M) -> maps:fold(fun(K, V, Acc) -> - BinK = to_key(K), - BinV = to_value(V), - Acc#{BinK => BinV} + BinK = to_key(K), + BinV = to_value(V), + Acc#{BinK => BinV} end, #{}, M). jsonrpc_maybe(undefined) -> <<"undefined">>; diff --git a/src/miner_keys.erl b/src/miner_keys.erl index ab54c01ba..12f559e19 100644 --- a/src/miner_keys.erl +++ b/src/miner_keys.erl @@ -190,14 +190,20 @@ keys({ecc, Options}) when is_list(Options) -> end, onboarding_key => libp2p_crypto:pubkey_to_b58(OnboardingKey) } - end. + end; +keys(#{pubkey := _PubKey, ecdh_fun := _ECDH, sig_fun := _Sig} = KeyInfo) -> + maps:merge(#{key_slot => undefined, bus => undefined, address => undefined}, KeyInfo). -spec key_config() -> key_configuration(). key_config() -> BaseDir = application:get_env(blockchain, base_dir, "data"), case application:get_env(blockchain, key, undefined) of - undefined -> {file, BaseDir}; - KC -> KC + undefined -> + lager:info("*** key config point 1 ~p", [BaseDir]), + {file, BaseDir}; + KC -> + lager:info("*** key config point 2 ~p ~p", [BaseDir, KC]), + KC end. -spec libp2p_to_gateway_key(libp2p_crypto:key_map()) -> libp2p_crypto:key_map(). diff --git a/src/miner_lora.erl b/src/miner_lora.erl index 46ff2f5af..659630c74 100644 --- a/src/miner_lora.erl +++ b/src/miner_lora.erl @@ -41,7 +41,7 @@ }). -record(state, { - socket, + socket = undefined :: undefined | port(), gateways = #{}, %% keyed by MAC packet_timers = #{}, %% keyed by token sig_fun, @@ -54,7 +54,11 @@ reg_throttle = undefined :: undefined | miner_lora_throttle:handle(), last_tmst_us = undefined :: undefined | integer(), % last concentrator tmst reported by the packet forwarder last_mono_us = undefined :: undefined | integer(), % last local monotonic timestamp taken when packet forwarder reported last tmst - chain = undefined :: undefined | blockchain:blockchain() + chain = undefined :: undefined | blockchain:blockchain(), + radio_udp_bind_ip, + radio_udp_bind_port, + cur_poc_challenger_type = undefined :: undefined | validator, + following_chain = true :: boolean() | undefined }). -record(country, { @@ -236,24 +240,15 @@ init(Args) -> lager:info("init with args ~p", [Args]), UDPIP = maps:get(radio_udp_bind_ip, Args), UDPPort = maps:get(radio_udp_bind_port, Args), - {ok, Socket} = gen_udp:open(UDPPort, [binary, {reuseaddr, true}, {active, 100}, {ip, UDPIP}]), - MirrorSocket = case application:get_env(miner, radio_mirror_port, undefined) of - undefined -> - undefined; - P -> - {ok, S} = gen_udp:open(P, [binary, {active, true}]), - S - end, %% cloud/miner pro will never assert location and so we dont use regulatory domain checks for these miners %% instead they will supply a region value, use this if it exists {RegDomainConfirmed, DefaultRegRegion, DefaultRegFreqList} = case maps:get(region_override, Args, undefined) of undefined -> - %% not overriding domain checks, so initialize with source data and defaults + %% not overriding domain checks, so initialize with source dahandle_info(reg_domain_timeoutta and defaults ets:new(?COUNTRY_FREQ_DATA, [named_table, public]), ok = init_ets(), - erlang:send_after(5000, self(), reg_domain_timeout), {false, undefined, undefined}; Region -> lager:info("using region specifed in config: ~p", [Region]), @@ -269,24 +264,17 @@ init(Args) -> end end, - S0 = #state{socket=Socket, - sig_fun = maps:get(sig_fun, Args), - mirror_socket = {MirrorSocket, undefined}, + S0 = #state{sig_fun = maps:get(sig_fun, Args), pubkey_bin = blockchain_swarm:pubkey_bin(), reg_domain_confirmed = RegDomainConfirmed, reg_region = DefaultRegRegion, reg_freq_list = DefaultRegFreqList, - reg_throttle=miner_lora_throttle:new(DefaultRegRegion) + reg_throttle=miner_lora_throttle:new(DefaultRegRegion), + radio_udp_bind_ip = UDPIP, + radio_udp_bind_port = UDPPort }, - - case blockchain_worker:blockchain() of - undefined -> - erlang:send_after(500, self(), chain_check), - {ok, S0}; - Chain -> - ok = blockchain_event:add_handler(self()), - {ok, update_state_using_chain(Chain, S0)} - end. + erlang:send_after(500, self(), init), + {ok, S0}. -spec update_state_using_chain(Chain :: blockchain_worker:blockchain(), InputState :: state()) -> state(). @@ -304,6 +292,8 @@ handle_call({send, Payload, When, ChannelSelectorFun, DataRate, Power, IPol, Hlm {error, _}=Error -> {reply, Error, State}; {ok, State1} -> {noreply, State1} end; +handle_call(port, _From, State = #state{socket = undefined}) -> + {reply, {error, no_socket}, State}; handle_call(port, _From, State) -> {reply, inet:port(State#state.socket), State}; handle_call(position, _From, #state{latlong = undefined} = State) -> @@ -347,33 +337,67 @@ handle_cast(_Msg, State) -> lager:warning("rcvd unknown cast msg: ~p", [_Msg]), {noreply, State}. -handle_info(chain_check, State) -> +handle_info(init, State = #state{following_chain = false}) -> + %% if we are not following chain then assume validators running POC challenges and thus + %% the alternative module 'miner_lora_light" will handle lora packets + %% just need to set required env vars here + application:set_env(miner, lora_mod, miner_lora_light), + application:set_env(miner, onion_server_mod, miner_onion_server_light), + {noreply, State}; +handle_info(init, State = #state{radio_udp_bind_ip = UDPIP, radio_udp_bind_port = UDPPort}) -> case blockchain_worker:blockchain() of undefined -> - erlang:send_after(500, self(), chain_check), + erlang:send_after(500, self(), init), {noreply, State}; Chain -> ok = blockchain_event:add_handler(self()), - {noreply, update_state_using_chain(Chain, State)} + erlang:send_after(500, self(), reg_domain_timeout), + Ledger = blockchain:ledger(Chain), + case blockchain:config(?poc_challenger_type, Ledger) of + {ok, validator} -> + %% we are in validator POC mode, dont open a socket + %% instead let the alternative module 'miner_lora_light' take it + %% and have it handle lora packets + application:set_env(miner, lora_mod, miner_lora_light), + application:set_env(miner, onion_server_mod, miner_onion_server_light), + {noreply, State#state{cur_poc_challenger_type = validator}}; + NonValidatorChallenger -> + %% we are not in validator POC mode, so open a socket as normal + %% this module will handle lora packets + application:set_env(miner, lora_mod, miner_lora), + application:set_env(miner, onion_server_mod, miner_onion_server), + {ok, Socket, MirrorSocket} = open_socket(UDPIP, UDPPort), + {noreply, update_state_using_chain(Chain, State#state{cur_poc_challenger_type = NonValidatorChallenger, socket=Socket, mirror_socket = {MirrorSocket, undefined}})} + end end; handle_info({blockchain_event, {new_chain, NC}}, State) -> {noreply, update_state_using_chain(NC, State)}; -handle_info({blockchain_event, {add_block, Hash, _Sync, _Ledger}}, - #state{chain=Chain}=State) when Chain /= undefined -> +handle_info({blockchain_event, {add_block, Hash, _Sync, Ledger}}, + #state{chain=Chain, cur_poc_challenger_type = CurPoCChallengerType}=State) when Chain /= undefined -> {ok, Block} = blockchain:get_block(Hash, Chain), Predicate = fun(T) -> blockchain_txn:type(T) == blockchain_txn_vars_v1 end, case blockchain_utils:find_txn(Block, Predicate) of Txs when length(Txs) > 0 -> - %% Resend the timeout for regulatory domain - self() ! reg_domain_timeout; + case blockchain:config(?poc_challenger_type, Ledger) of + {ok, V} when V /= CurPoCChallengerType -> + %% the poc challenger chain var has been modified, force this server + %% to restart and recheck if it can still bind to the lora port + %% in addition restart the grpc client so that we start afresh + _ = miner_poc_grpc_client_statem:stop(), + {stop, force_restart, State}; + _ -> + {noreply, State} + end; _ -> - ok - end, - {noreply, State}; + {noreply, State} + end; handle_info(reg_domain_timeout, #state{chain=undefined} = State) -> %% There is no chain, we cannot lookup regulatory domain data yet %% Keep waiting for chain - erlang:send_after(500, self(), chain_check), + erlang:send_after(500, self(), init), + {noreply, State}; +handle_info(reg_domain_timeout, #state{cur_poc_challenger_type=validator} = State) -> + %% validators are issuing POCs, so miner_lora_light will be in use...do nothing {noreply, State}; handle_info(reg_domain_timeout, #state{reg_domain_confirmed=false, pubkey_bin=Addr, chain=Chain} = State) -> lager:info("checking regulatory domain for address ~p", [Addr]), @@ -409,14 +433,14 @@ handle_info({udp, Socket, IP, Port, _Packet}, #state{mirror_socket={Socket, _}}= lager:info("received mirror port connection from ~p ~p", [IP, Port]), {noreply, State#state{mirror_socket={Socket, {IP, Port}}}}; handle_info(_Msg, State) -> - lager:warning("rcvd unknown info msg: ~p", [_Msg]), + lager:debug("rcvd unknown info msg: ~p", [_Msg]), {noreply, State}. code_change(_OldVsn, State, _Extra) -> {ok, State}. terminate(_Reason, #state{socket=Socket}) -> - gen_udp:close(Socket), + catch gen_udp:close(Socket), ok. %% ------------------------------------------------------------------ @@ -830,7 +854,7 @@ packet_rssi(Packet, UseRSSIS) -> BestRSSISelector = fun (Obj, Best) -> erlang:max(Best, FetchRSSI(Obj)) - end, + end, [H|T] = maps:get(<<"rsig">>, Packet), lists:foldl(BestRSSISelector, FetchRSSI(H), T); %% GWMP V1 @@ -1008,17 +1032,29 @@ maybe_update_reg_data(#state{pubkey_bin=Addr} = State) -> } end. - -spec reg_region(State :: state()) -> atom(). reg_region(State) -> State#state.reg_region. +-spec open_socket(string(), pos_integer()) -> {ok, port(), port()}. +open_socket(IP, Port) -> + {ok, Socket} = gen_udp:open(Port, [binary, {reuseaddr, true}, {active, 100}, {ip, IP}]), + MirrorSocket = + case application:get_env(miner, radio_mirror_port, undefined) of + undefined -> + undefined; + P -> + {ok, MS} = gen_udp:open(P, [binary, {active, true}]), + MS + end, + {ok, Socket, MirrorSocket}. + -ifdef(TEST). -include_lib("eunit/include/eunit.hrl"). rssi_fetch_test() -> PacketWithRSSIS = #{ - <<"rssis">> => 1, + <<"rssis">> => 1, <<"rssi">> => 2 }, PacketWithoutRSSIS = #{ @@ -1046,5 +1082,5 @@ rssi_fetch_test() -> ?assertEqual(packet_rssi(RSIGPacketWithRSSIS, false), 4), ?assertEqual(packet_rssi(RSIGPacketWithoutRSSIS, true), 4), ?assertEqual(packet_rssi(RSIGPacketWithoutRSSIS, false), 4). - --endif. + +-endif. \ No newline at end of file diff --git a/src/miner_lora_light.erl b/src/miner_lora_light.erl new file mode 100644 index 000000000..eb5a2e005 --- /dev/null +++ b/src/miner_lora_light.erl @@ -0,0 +1,796 @@ +%%%------------------------------------------------------------------- +%% @doc +%% == Miner lora for light gateways == +%% no use of chain or ledger +%% @end +%%%------------------------------------------------------------------- +-module(miner_lora_light). + +-include("src/grpc/autogen/client/gateway_miner_client_pb.hrl"). +-behaviour(gen_server). + +-export([ + start_link/1, + handle_response/1, + send/1, + send_poc/5, + port/0, + location_ok/0, + region/0, + region_params_update/2 +]). + +-export([ + init/1, + handle_call/3, + handle_cast/2, + handle_info/2, + terminate/2, + code_change/3 +]). + +-include_lib("helium_proto/include/blockchain_state_channel_v1_pb.hrl"). +-include("lora.hrl"). +-include_lib("blockchain/include/blockchain_utils.hrl"). +-include_lib("blockchain/include/blockchain_vars.hrl"). + +-record(gateway, { + mac, + ip, + port, + sent =0, + received = 0, + dropped = 0, + status, + rtt_samples = [], + rtt=5000000 %% in microseconds +}). + +-record(state, { + socket = undefined :: undefined | port(), + gateways = #{}, %% keyed by MAC + packet_timers = #{}, %% keyed by token + sig_fun, + pubkey_bin, + mirror_socket, + latlong, + reg_domain_confirmed = false :: boolean(), + reg_region :: atom(), + reg_region_params :: blockchain_region_param_v1:region_param_v1(), + reg_freq_list :: [float()] | undefined, + reg_throttle = undefined :: undefined | miner_lora_throttle:handle(), + last_tmst_us = undefined :: undefined | integer(), % last concentrator tmst reported by the packet forwarder + last_mono_us = undefined :: undefined | integer(), % last local monotonic timestamp taken when packet forwarder reported last tmst + chain = undefined :: undefined | blockchain:blockchain(), + radio_udp_bind_ip, + radio_udp_bind_port, + cur_poc_challenger_type = undefined :: undefined | validator, + following_chain = true :: undefined | boolean() +}). + +-type state() :: #state{}. +-type gateway() :: #gateway{}. +-type helium_packet() :: #packet_pb{}. + +-define(COUNTRY_FREQ_DATA, country_freq_data). + +%% in meters +-define(MAX_WANDER_DIST, 200). + +%% Maximum `tmst` counter value reported by an SX130x concentrator +%% IC. This is a raw [1] counter value with the following +%% characteristics: +%% +%% - unsigned +%% - counts upwards +%% - 32 bits +%% - increments at 1 MHz +%% +%% [1]: On SX1301 it is a raw value. On SX1302 it is a 32 bit value +%% counting at 32 MHz, but the SX1302 HAL throws away 5 bits to match +%% SX1301's behavior. +%% +%% Equivalent `(2^32)-1` +-define(MAX_TMST_VAL, 4294967295). + +-ifdef(TEST). +-define(REG_DOMAIN_TIMEOUT, 1000). +-else. +-define(REG_DOMAIN_TIMEOUT, 30000). +-endif. + + +%% ------------------------------------------------------------------ +%% API Function Definitions +%% ------------------------------------------------------------------ + +start_link(Args) -> + gen_server:start_link({local, ?MODULE}, ?MODULE, Args, []). + +%% @doc used to handle state channel responses +-spec handle_response(blockchain_state_channel_response_v1:response()) -> ok | {error, any()}. +handle_response(Resp) -> + case blockchain_state_channel_response_v1:downlink(Resp) of + undefined -> + ok; + Packet -> + send(Packet) + end. + +-spec send(helium_packet()) -> ok | {error, any()}. +send(#packet_pb{payload=Payload, frequency=Freq, timestamp=When, signal_strength=Power, datarate=DataRate}=Packet) -> + lager:debug("got download packet ~p via freq ~p", [Packet, Freq]), + %% this is used for downlink packets that have been assigned a downlink frequency by the router, so just use the supplied frequency + ChannelSelectorFun = fun(_FreqList) -> Freq end, + gen_server:call(?MODULE, {send, Payload, When, ChannelSelectorFun, DataRate, Power, true, Packet}, 11000). + +-spec send_poc(binary(), any(), function(), iolist(), any()) -> ok | {error, any()} | {warning, any()}. +send_poc(Payload, When, ChannelSelectorFun, DataRate, Power) -> + gen_server:call(?MODULE, {send, Payload, When, ChannelSelectorFun, DataRate, Power, false, undefined}, 11000). + +-spec port() -> {ok, inet:port_number()} | {error, any()}. +port() -> + gen_server:call(?MODULE, port, 11000). + +-spec location_ok() -> true | false. +location_ok() -> + %% this terrible thing is to fake out dialyzer + application:get_env(miner, loc_ok_default, true). + +-spec region_params_update(atom(), [blockchain_region_param_v1:region_param_v1()]) -> ok. +region_params_update(Region, RegionParams) -> + gen_server:cast(?MODULE, {region_params_update, Region, RegionParams}). + +-spec region() -> {ok, atom()}. +region()-> + %% TODO: recalc region if hotspot re-asserts + gen_server:call(?MODULE, region, 5000). + +%% ------------------------------------------------------------------ +%% gen_server Function Definitions +%% ------------------------------------------------------------------ +init(Args) -> + lager:info("init with args ~p", [Args]), + UDPIP = maps:get(radio_udp_bind_ip, Args), + UDPPort = maps:get(radio_udp_bind_port, Args), + GatewaysRunChain = application:get_env(miner, gateways_run_chain, true), + lager:info("gateways_run_chain: ~p", [GatewaysRunChain]), + S0 = #state{pubkey_bin = blockchain_swarm:pubkey_bin(), + reg_domain_confirmed = false, + radio_udp_bind_ip = UDPIP, + radio_udp_bind_port = UDPPort, + following_chain = GatewaysRunChain + }, + erlang:send_after(500, self(), init), + {ok, S0}. + +handle_call({send, _Payload, _When, _ChannelSelectorFun, _DataRate, _Power, _IPol, _HlmPacket}, _From, + #state{reg_domain_confirmed = false}=State) -> + lager:debug("ignoring send request as regulatory domain not yet confirmed", []), + {reply, {error, reg_domain_unconfirmed}, State}; +handle_call({send, Payload, When, ChannelSelectorFun, DataRate, Power, IPol, HlmPacket}, From, State) -> + case send_packet(Payload, When, ChannelSelectorFun, DataRate, Power, IPol, HlmPacket, From, State) of + {error, _}=Error -> {reply, Error, State}; + {ok, State1} -> {noreply, State1} + end; +handle_call(port, _From, State = #state{socket = undefined}) -> + {reply, {error, no_socket}, State}; +handle_call(port, _From, State) -> + {reply, inet:port(State#state.socket), State}; +handle_call(region, _From, #state{reg_region = Region} = State) -> + {reply, {ok, Region}, State}; +handle_call(_Msg, _From, State) -> + lager:warning("rcvd unknown call msg: ~p", [_Msg]), + {reply, ok, State}. + +handle_cast({region_params_update, Region, RegionParams}, State) -> + lager:info("updating region params. Region: ~p, Params: ~p", [Region, RegionParams]), + Throttle = miner_lora_throttle:new(Region), + FreqList = [(blockchain_region_param_v1:channel_frequency(RP) / ?MHzToHzMultiplier) || RP <- RegionParams], + {noreply, State#state{ + reg_region = Region, + reg_region_params = RegionParams, + reg_domain_confirmed = true, + reg_throttle=Throttle, + reg_freq_list = FreqList}}; +handle_cast(_Msg, State) -> + lager:warning("rcvd unknown cast msg: ~p", [_Msg]), + {noreply, State}. + +handle_info(init, State = #state{radio_udp_bind_ip = UDPIP, radio_udp_bind_port = UDPPort, following_chain = false}) -> + %% if we are not following chain then assume validators are running POC challenges and thus + %% this module will handle lora packets and will need to open the port + application:set_env(miner, lora_mod, miner_lora_light), + application:set_env(miner, onion_server_mod, miner_onion_server_light), + {ok, Socket, MirrorSocket} = open_socket(UDPIP, UDPPort), + erlang:send_after(500, self(), reg_domain_timeout), + {noreply, State#state{socket=Socket, mirror_socket = {MirrorSocket, undefined}}}; +handle_info(init, State = #state{radio_udp_bind_ip = UDPIP, radio_udp_bind_port = UDPPort}) -> + case blockchain_worker:blockchain() of + undefined -> + lager:info("failed to find chain, will retry in a bit",[]), + erlang:send_after(500, self(), init), + {noreply, State}; + Chain -> + ok = blockchain_event:add_handler(self()), + Ledger = blockchain:ledger(Chain), + case blockchain:config(?poc_challenger_type, Ledger) of + {ok, validator} -> + lager:debug("poc_challenger_type: ~p", [validator]), + %% we are in validator POC mode, open a socket + %% this module will handle lora packets + application:set_env(miner, lora_mod, miner_lora_light), + application:set_env(miner, onion_server_mod, miner_onion_server_light), + {ok, Socket, MirrorSocket} = open_socket(UDPIP, UDPPort), + {noreply, State#state{chain = Chain, cur_poc_challenger_type = validator, socket=Socket, mirror_socket = {MirrorSocket, undefined}}}; + NonValidatorChallenger -> + lager:debug("poc_challenger_type: ~p", [NonValidatorChallenger]), + %% we are NOT in validator POC mode, dont open a socket + %% instead let the alternative module 'miner_lora' take it + %% and handle lora packets + application:set_env(miner, lora_mod, miner_lora), + application:set_env(miner, onion_server_mod, miner_onion_server), + {noreply, State#state{cur_poc_challenger_type = NonValidatorChallenger}} + end + end; +handle_info({blockchain_event, {new_chain, NC}}, State) -> + {noreply, State#state{chain = NC}}; +handle_info( + {blockchain_event, {add_block, _BlockHash, _Sync, Ledger} = _Event}, + #state{cur_poc_challenger_type = CurPoCChallengerType} = State +)-> + case blockchain:config(?poc_challenger_type, Ledger) of + {ok, V} when V /= CurPoCChallengerType -> + %% the poc challenger chain var has been modified, force this server + %% to restart. It will recheck if it can still bind to the lora port + %% in addition restart the grpc client so that we start afresh + _ = miner_poc_grpc_client_statem:stop(), + {stop, force_restart, State}; + _ -> + {noreply, State} + end; +handle_info({blockchain_event, _}, State) -> + {noreply, State}; + +handle_info({tx_timeout, Token}, #state{packet_timers=Timers}=State) -> + case maps:find(Token, Timers) of + {ok, {send, _Ref, From, _SentAt, _LocalFreq, _TimeOnAir, _HlmPacket}} -> + gen_server:reply(From, {error, timeout}); + error -> + ok + end, + {noreply, State#state{packet_timers=maps:remove(Token, Timers)}}; +handle_info({udp, Socket, IP, Port, Packet}, #state{socket=Socket}=State) -> + RxInstantLocal_us = erlang:monotonic_time(microsecond), + maybe_mirror(State#state.mirror_socket, Packet), + State2 = handle_udp_packet(Packet, IP, Port, RxInstantLocal_us, State), + {noreply, State2}; +handle_info({udp_passive, Socket}, #state{socket=Socket}=State) -> + inet:setopts(Socket, [{active, 100}]), + {noreply, State}; +handle_info({udp, Socket, IP, Port, _Packet}, #state{mirror_socket={Socket, _}}=State) -> + lager:info("received mirror port connection from ~p ~p", [IP, Port]), + {noreply, State#state{mirror_socket={Socket, {IP, Port}}}}; +handle_info(_Msg, State) -> + lager:warning("rcvd unknown info msg: ~p", [_Msg]), + {noreply, State}. + +code_change(_OldVsn, State, _Extra) -> + {ok, State}. + +terminate(_Reason, #state{socket=Socket}) -> + catch gen_udp:close(Socket), + ok. + +%% ------------------------------------------------------------------ +%% Internal Function Definitions +%% ------------------------------------------------------------------ + +-spec mk_token(map()) -> binary(). +mk_token(Timers) -> + Token = <<(rand:uniform(65535)):16/integer-unsigned-little>>, + case maps:is_key(Token, Timers) of + true -> mk_token(Timers); + false -> Token + end. + +-spec select_gateway(map()) -> {ok, gateway()} | {error, no_gateways}. +select_gateway(Gateways) -> + %% TODO for a multi-tenant miner we'd have a mapping of swarm keys to + %% 64-bit packet forwarder IDs and, depending on what swarm key this send + %% was directed to, we'd select the appropriate gateway from the map. + case maps:size(Gateways) of + 0 -> + {error, no_gateways}; + _ -> + {ok, erlang:element(2, erlang:hd(maps:to_list(Gateways)))} + end. + +-spec handle_udp_packet(binary(), inet:ip_address(), inet:port_number(), integer(), state()) -> state(). +handle_udp_packet(<>, IP, Port, RxInstantLocal_us, + #state{socket=Socket, gateways=Gateways, + reg_domain_confirmed = RegDomainConfirmed}=State) -> + lager:info("PUSH_DATA ~p from ~p on ~p", [jsx:decode(JSON), MAC, Port]), + Gateway = + case maps:find(MAC, Gateways) of + {ok, #gateway{received=Received}=G} -> + %% We purposely do not update gateway's addr/port + %% here. They should only be updated when handling + %% PULL_DATA, otherwise we may send downlink packets + %% to the wrong place. + G#gateway{received=Received+1}; + error -> + #gateway{mac=MAC, ip=IP, port=Port, received=1} + end, + Packet = <>, + maybe_mirror(State#state.mirror_socket, Packet), + maybe_send_udp_ack(Socket, IP, Port, Packet, RegDomainConfirmed), + handle_json_data(jsx:decode(JSON, [return_maps]), Gateway, RxInstantLocal_us, State); +handle_udp_packet(<>, IP, Port, _RxInstantLocal_us, #state{socket=Socket, gateways=Gateways, + reg_domain_confirmed = RegDomainConfirmed}=State) -> + Packet = <>, + maybe_mirror(State#state.mirror_socket, Packet), + maybe_send_udp_ack(Socket, IP, Port, Packet, RegDomainConfirmed), + lager:info("PULL_DATA from ~p on ~p", [MAC, Port]), + Gateway = + case maps:find(MAC, Gateways) of + {ok, #gateway{received=Received}=G} -> + G#gateway{ip=IP, port=Port, received=Received+1}; + error -> + #gateway{mac=MAC, ip=IP, port=Port, received=1} + end, + State#state{gateways=maps:put(MAC, Gateway, Gateways)}; +handle_udp_packet(<>, _IP, _Port, _RxInstantLocal_us, #state{packet_timers=Timers, reg_throttle=Throttle}=State0) -> + lager:info("TX ack for token ~p ~p", [Token, MaybeJSON]), + case maps:find(Token, Timers) of + {ok, {send, Ref, From, SentAt, LocalFreq, TimeOnAir, _HlmPacket}} when MaybeJSON == <<>> -> %% empty string means success, at least with the semtech reference implementation + _ = erlang:cancel_timer(Ref), + _ = gen_server:reply(From, ok), + State0#state{packet_timers=maps:remove(Token, Timers), + reg_throttle=miner_lora_throttle:track_sent(Throttle, SentAt, LocalFreq, TimeOnAir)}; + {ok, {send, Ref, From, SentAt, LocalFreq, TimeOnAir, HlmPacket}} -> + %% likely some kind of error here + _ = erlang:cancel_timer(Ref), + State1 = State0#state{packet_timers=maps:remove(Token, Timers)}, + {Reply, NewState} = case kvc:path([<<"txpk_ack">>, <<"error">>], jsx:decode(MaybeJSON)) of + <<"NONE">> -> + lager:info("packet sent ok"), + Throttle1 = miner_lora_throttle:track_sent(Throttle, SentAt, LocalFreq, TimeOnAir), + {ok, State1#state{reg_throttle=Throttle1}}; + <<"COLLISION_", _/binary>> -> + %% colliding with a beacon or another packet, check if join2/rx2 is OK + lager:info("collision"), + {{error, collision}, State1}; + <<"TOO_LATE">> -> + lager:info("too late"), + case blockchain_helium_packet_v1:rx2_window(HlmPacket) of + undefined -> lager:warning("No RX2 available"), + {{error, too_late}, State1}; + _ -> retry_with_rx2(HlmPacket, From, State1) + end; + <<"TOO_EARLY">> -> + lager:info("too early"), + case blockchain_helium_packet_v1:rx2_window(HlmPacket) of + undefined -> lager:warning("No RX2 available"), + {{error, too_early}, State1}; + _ -> retry_with_rx2(HlmPacket, From, State1) + end; + <<"TX_FREQ">> -> + %% unmodified 1301 will send this + lager:info("tx frequency not supported"), + {{error, bad_tx_frequency}, State1}; + <<"TX_POWER">> -> + lager:info("tx power not supported"), + {{error, bad_tx_power}, State1}; + <<"GPS_UNLOCKED">> -> + lager:info("transmitting on GPS time not supported because no GPS lock"), + {{error, no_gps_lock}, State1}; + [] -> + %% there was no error, see if there was a warning, which implies we sent the packet + %% but some correction had to be done. + Throttle1 = miner_lora_throttle:track_sent(Throttle, SentAt, LocalFreq, TimeOnAir), + case kvc:path([<<"txpk_ack">>, <<"warn">>], jsx:decode(MaybeJSON)) of + <<"TX_POWER">> -> + %% modified 1301 and unmodified 1302 will send this + {{warning, {tx_power_corrected, kvc:path([<<"txpk_ack">>, <<"value">>], jsx:decode(MaybeJSON))}}, State1#state{reg_throttle=Throttle1}}; + Other -> + {{warning, {unknown, Other}}, State1#state{reg_throttle=Throttle1}} + end; + Error -> + %% any other errors are pretty severe + lager:error("Failure enqueing packet for gateway ~p", [Error]), + {{error, {unknown, Error}}, State1} + end, + gen_server:reply(From, Reply), + NewState; + error -> + State0 + end; +handle_udp_packet(Packet, _IP, _Port, _RxInstantLocal_us, State) -> + lager:info("unhandled udp packet ~p", [Packet]), + State. + +-spec handle_json_data(map(), gateway(), integer(), state()) -> state(). +handle_json_data(#{<<"rxpk">> := Packets} = Map, Gateway, RxInstantLocal_us, State0) -> + State1 = handle_packets(sort_packets(Packets), Gateway, RxInstantLocal_us, State0), + handle_json_data(maps:remove(<<"rxpk">>, Map), Gateway, RxInstantLocal_us, State1); +handle_json_data(#{<<"stat">> := Status} = Map, Gateway0, RxInstantLocal_us, #state{gateways=Gateways}=State) -> + Gateway1 = Gateway0#gateway{status=Status}, + lager:info("got status ~p", [Status]), + lager:info("Gateway ~p", [lager:pr(Gateway1, ?MODULE)]), + Mac = Gateway1#gateway.mac, + State1 = maybe_update_gps(Status, State), + handle_json_data(maps:remove(<<"stat">>, Map), Gateway1, RxInstantLocal_us, + State1#state{gateways=maps:put(Mac, Gateway1, Gateways)}); +handle_json_data(_, _Gateway, _RxInstantLocal_us, State) -> + State. + +%% cache GPS the state with each update. I'm not sure if this will +%% lead to a lot of wander, but I do want to be able to refine if we +%% have a poor quality initial lock. we might want to keep track of +%% server boot time and lock it down after some period of time. +-spec maybe_update_gps(#{}, state()) -> state(). +maybe_update_gps(#{<<"lati">> := Lat, <<"long">> := Long}, State) -> + State#state{latlong = {Lat, Long}}; +maybe_update_gps(_Status, State) -> + State. +maybe_send_udp_ack(_Socket, _IP, _Port, _Packet, false = _RegDomainConfirmed)-> + ok; +maybe_send_udp_ack(Socket, IP, Port, Packet, _RegDomainConfirmed)-> + ok = gen_udp:send(Socket, IP, Port, Packet). + +-spec sort_packets(list()) -> list(). +sort_packets(Packets) -> + lists:sort( + fun(A, B) -> + packet_snr(A) >= packet_snr(B) + end, + Packets + ). + +-spec handle_packets(list(), gateway(), integer(), state()) -> state(). +handle_packets([], _Gateway, _RxInstantLocal_us, State) -> + State; +handle_packets(_Packets, _Gateway, _RxInstantLocal_us, #state{reg_domain_confirmed = false} = State) -> + State; +handle_packets([Packet|Tail], Gateway, RxInstantLocal_us, #state{reg_region = _Region} = State) -> + POCVersion = application:get_env(miner, poc_version, 11), + Data = base64:decode(maps:get(<<"data">>, Packet)), + case route(Data) of + error -> + ok; + {onion, Payload} -> + Freq = maps:get(<<"freq">>, Packet), + %% onion server + UseRSSIS = case POCVersion of + X when X > 10 -> true; + _ -> false + end, + miner_onion_server_light:decrypt_radio( + Payload, + erlang:trunc(packet_rssi(Packet, UseRSSIS)), + packet_snr(Packet), + %% TODO we might want to send GPS time here, if available + maps:get(<<"tmst">>, Packet), + Freq, + channel(Freq, State#state.reg_freq_list), + maps:get(<<"datr">>, Packet) + ); + {_Type, _RoutingInfo} -> + %% normally packets here would be send to the router + %% but in light mode we can just discard non poc packets + noop + end, + handle_packets(Tail, Gateway, RxInstantLocal_us, State#state{last_mono_us = RxInstantLocal_us, last_tmst_us = maps:get(<<"tmst">>, Packet)}). + +-spec route(binary()) -> any(). + route(Pkt) -> + case longfi:deserialize(Pkt) of + error -> + route_non_longfi(Pkt); + {ok, LongFiPkt} -> + %% hello longfi, my old friend + try longfi:type(LongFiPkt) == monolithic andalso longfi:oui(LongFiPkt) == 0 andalso longfi:device_id(LongFiPkt) == 1 of + true -> + {onion, longfi:payload(LongFiPkt)}; + false -> + %% we currently don't expect non-onion packets, + %% this is probably a false positive on a LoRaWAN packet + route_non_longfi(Pkt) + catch _:_ -> + route_non_longfi(Pkt) + end + end. + +% Some binary madness going on here +-spec route_non_longfi(binary()) -> any(). +route_non_longfi(<>) -> + {lorawan, {eui, DevEUI, AppEUI}}; +route_non_longfi(<>) when MType == ?UNCONFIRMED_UP; MType == ?CONFIRMED_UP -> + Body = binary:part(PayloadAndMIC, {0, byte_size(PayloadAndMIC) -4}), + {FPort, _FRMPayload} = + case Body of + <<>> -> {undefined, <<>>}; + <> -> {Port, Payload} + end, + case FPort of + 0 when FOptsLen /= 0 -> + error; + _ -> + {lorawan, {devaddr, DevAddr}} + end; +route_non_longfi(_) -> + error. + +maybe_mirror({undefined, undefined}, _) -> + ok; +maybe_mirror({_, undefined}, _) -> + ok; +maybe_mirror({Sock, Destination}, Packet) -> + gen_udp:send(Sock, Destination, Packet). + +channel(Freq, Frequencies) -> + channel(Freq, Frequencies, 0). + +channel(Freq, [H|T], Acc) -> + case abs(H - Freq) =< 0.001 of + true -> + Acc; + false -> + channel(Freq, T, Acc+1) + end. + +%% @doc returns a tuple of {SpreadingFactor, Bandwidth} from strings like "SFdBWddd" +%% +%% Example: `{7, 125} = scratch:parse_datarate("SF7BW125")' +-spec parse_datarate(string()) -> {integer(), integer()}. +parse_datarate(Datarate) -> + case Datarate of + [$S, $F, SF1, SF2, $B, $W, BW1, BW2, BW3] -> + {erlang:list_to_integer([SF1, SF2]), erlang:list_to_integer([BW1, BW2, BW3])}; + [$S, $F, SF1, $B, $W, BW1, BW2, BW3] -> + {erlang:list_to_integer([SF1]), erlang:list_to_integer([BW1, BW2, BW3])} + end. + +%% @doc adjusts concentrator timestamp (`tmst`) to a monotonic value. +%% +%% The returned value is a best-effort estimate of what +%% `erlang:monotonic_time(microsecond)` would return if it was called +%% at `Tmst_us`. +-spec tmst_to_local_monotonic_time(immediate | integer(), undefined | integer(), undefined | integer()) -> integer(). +tmst_to_local_monotonic_time(immediate, _PrevTmst_us, _PrevMonoTime_us) -> + erlang:monotonic_time(microsecond); +tmst_to_local_monotonic_time(_When, undefined, undefined) -> + %% We haven't yet received a `tmst` from the packet forwarder, so + %% we don't have anything to track. Let's just use the current + %% time and hope for the best. + erlang:monotonic_time(microsecond); +tmst_to_local_monotonic_time(Tmst_us, PrevTmst_us, PrevMonoTime_us) when Tmst_us >= PrevTmst_us -> + Tmst_us - PrevTmst_us + PrevMonoTime_us; +tmst_to_local_monotonic_time(Tmst_us, PrevTmst_us, PrevMonoTime_us) -> + %% Because `Tmst_us` is less than the last `tmst` we received from + %% the packet forwarder, we allow for the possibility one single + %% roll over of the clock has occurred, and that `Tmst_us` might + %% represent a time in the future. + Tmst_us + ?MAX_TMST_VAL - PrevTmst_us + PrevMonoTime_us. + +%% Extracts a packet's RSSI, abstracting away the differences between +%% GWMP JSON V1/V2. +-spec packet_rssi(map(), boolean()) -> number(). +packet_rssi(Packet, UseRSSIS) -> + RSSIS = maps:get(<<"rssis">>, Packet, undefined), + SingleRSSI = case UseRSSIS andalso RSSIS =/= undefined of + true -> RSSIS; + false -> maps:get(<<"rssi">>, Packet, undefined) + end, + case SingleRSSI of + %% No RSSI, perhaps this is a GWMP V2 + undefined -> + %% `rsig` is a list. It can contain more than one signal + %% quality object if the packet was received on multiple + %% antennas/receivers. So let's pick the one with the + %% highest RSSI. + FetchRSSI = case UseRSSIS of + true -> + %% Use RSSIS if available, fall back to RSSIC. + fun (Obj) -> + maps:get(<<"rssis">>, Obj, + maps:get(<<"rssic">>, Obj, undefined)) + end; + false -> + %% Just use RSSIC. + fun (Obj) -> + maps:get(<<"rssic">>, Obj, undefined) + end + end, + BestRSSISelector = + fun (Obj, Best) -> + erlang:max(Best, FetchRSSI(Obj)) + end, + [H|T] = maps:get(<<"rsig">>, Packet), + lists:foldl(BestRSSISelector, FetchRSSI(H), T); + %% GWMP V1 + RSSI -> + RSSI + end. + +%% Extracts a packet's SNR, abstracting away the differences between +%% GWMP JSON V1/V2. +-spec packet_snr(map()) -> number(). +packet_snr(Packet) -> + case maps:get(<<"lsnr">>, Packet, undefined) of + %% GWMP V2 + undefined -> + %% `rsig` is a list. It can contain more than one signal + %% quality object if the packet was received on multiple + %% antennas/receivers. So let's pick the one with the + %% highest SNR + [H|T] = maps:get(<<"rsig">>, Packet), + Selector = fun(Obj, Best) -> + erlang:max(Best, maps:get(<<"lsnr">>, Obj)) + end, + lists:foldl(Selector, maps:get(<<"lsnr">>, H), T); + %% GWMP V1 + LSNR -> + LSNR + end. + +-spec send_packet( + Payload :: binary(), + When :: integer(), + ChannelSelectorFun :: fun(), + DataRate :: string(), + Power :: float(), + IPol :: boolean(), + HlmPacket :: helium_packet(), + From :: {pid(), reference()}, + State :: state() +) -> {error, any()} | {ok, state()}. +send_packet(Payload, When, ChannelSelectorFun, DataRate, Power, IPol, HlmPacket, From, + #state{socket=Socket, + gateways=Gateways, + packet_timers=Timers, + reg_freq_list=Freqs, + reg_throttle=Throttle, + last_tmst_us=PrevTmst_us, + last_mono_us=PrevMono_us}=State) -> + case select_gateway(Gateways) of + {error, _}=Error -> + Error; + {ok, #gateway{ip=IP, port=Port}} -> + lager:info("PULL_RESP to ~p:~p", [IP, Port]), + %% the fun is set by the sender and is used to deterministically route data via channels + LocalFreq = ChannelSelectorFun(Freqs), + + %% Check this transmission for regulatory compliance. + {SpreadingFactor, Bandwidth} = parse_datarate(DataRate), + TimeOnAir = miner_lora_throttle:time_on_air(Bandwidth, SpreadingFactor, 5, 8, true, byte_size(Payload)), + AdjustedTmst_us = tmst_to_local_monotonic_time(When, PrevTmst_us, PrevMono_us), + SentAt = AdjustedTmst_us / 1000, + case miner_lora_throttle:can_send(Throttle, SentAt, LocalFreq, TimeOnAir) of + false -> lager:warning("This transmission should have been rejected"); + true -> ok + end, + + Token = mk_token(Timers), + Packet = create_packet(Payload, When, LocalFreq, DataRate, Power, IPol, Token), + maybe_mirror(State#state.mirror_socket, Packet), + lager:debug("sending packet via channel: ~p",[LocalFreq]), + ok = gen_udp:send(Socket, IP, Port, Packet), + %% TODO a better timeout would be good here + Ref = erlang:send_after(10000, self(), {tx_timeout, Token}), + {ok, State#state{packet_timers=maps:put(Token, {send, Ref, From, SentAt, LocalFreq, TimeOnAir, HlmPacket}, Timers)}} + end. + +-spec create_packet( + Payload :: binary(), + When :: atom() | integer(), + LocalFreq :: integer(), + DataRate :: string(), + Power :: float(), + IPol :: boolean(), + Token :: binary() +) -> binary(). +create_packet(Payload, When, LocalFreq, DataRate, Power, IPol, Token) -> + + IsImme = When == immediate, + Tmst = case IsImme of + false -> When; + true -> 0 + end, + + DecodedJSX = #{<<"txpk">> => #{ + <<"ipol">> => IPol, %% IPol for downlink to devices only, not poc packets + <<"imme">> => IsImme, + <<"powe">> => trunc(Power), + <<"tmst">> => Tmst, + <<"freq">> => LocalFreq, + <<"modu">> => <<"LORA">>, + <<"datr">> => list_to_binary(DataRate), + <<"codr">> => <<"4/5">>, + <<"size">> => byte_size(Payload), + <<"rfch">> => 0, + <<"data">> => base64:encode(Payload) + } + }, + BinJSX = jsx:encode(DecodedJSX), + lager:debug("PULL_RESP: ~p",[DecodedJSX]), + lager:debug("sending packet via channel: ~p",[LocalFreq]), + <>. + +-spec retry_with_rx2( + HlmPacket0 :: helium_packet(), + From :: {pid(), reference()}, + State :: state() +) -> {error, any()} | {ok, state()}. +retry_with_rx2(HlmPacket0, From, State) -> + #window_pb{timestamp=TS, + frequency=Freq, + datarate=DataRate} = blockchain_helium_packet_v1:rx2_window(HlmPacket0), + lager:info("Retrying with RX2 window ~p", [TS]), + Power = blockchain_helium_packet_v1:signal_strength(HlmPacket0), + Payload = blockchain_helium_packet_v1:payload(HlmPacket0), + ChannelSelectorFun = fun(_FreqList) -> Freq end, + HlmPacket1 = HlmPacket0#packet_pb{rx2_window=undefined}, + send_packet(Payload, TS, ChannelSelectorFun, DataRate, Power, true, HlmPacket1, From, State). + +-spec open_socket(string(), pos_integer()) -> {ok, port(), port()}. +open_socket(IP, Port) -> + {ok, Socket} = gen_udp:open(Port, [binary, {reuseaddr, true}, {active, 100}, {ip, IP}]), + MirrorSocket = + case application:get_env(miner, radio_mirror_port, undefined) of + undefined -> + undefined; + P -> + {ok, MS} = gen_udp:open(P, [binary, {active, true}]), + MS + end, + {ok, Socket, MirrorSocket}. + +-ifdef(TEST). +-include_lib("eunit/include/eunit.hrl"). + +rssi_fetch_test() -> + PacketWithRSSIS = #{ + <<"rssis">> => 1, + <<"rssi">> => 2 + }, + PacketWithoutRSSIS = #{ + <<"rssi">> => 2 + }, + RSIGPacketWithRSSIS = #{ + <<"rsig">> => [ + #{ <<"rssis">> => 1, <<"rssic">> => 2 }, + #{ <<"rssis">> => 3, <<"rssic">> => 4 }, + #{ <<"rssis">> => -1, <<"rssic">> => 0 } + ] + }, + RSIGPacketWithoutRSSIS = #{ + <<"rsig">> => [ + #{ <<"rssic">> => 2 }, + #{ <<"rssic">> => 4 }, + #{ <<"rssic">> => 0 } + ] + }, + ?assertEqual(packet_rssi(PacketWithRSSIS, true), 1), + ?assertEqual(packet_rssi(PacketWithRSSIS, false), 2), + ?assertEqual(packet_rssi(PacketWithoutRSSIS, true), 2), + ?assertEqual(packet_rssi(PacketWithoutRSSIS, false), 2), + ?assertEqual(packet_rssi(RSIGPacketWithRSSIS, true), 3), + ?assertEqual(packet_rssi(RSIGPacketWithRSSIS, false), 4), + ?assertEqual(packet_rssi(RSIGPacketWithoutRSSIS, true), 4), + ?assertEqual(packet_rssi(RSIGPacketWithoutRSSIS, false), 4). + +-endif. diff --git a/src/miner_restart_sup.erl b/src/miner_restart_sup.erl index 4e692aef7..5ad304f65 100644 --- a/src/miner_restart_sup.erl +++ b/src/miner_restart_sup.erl @@ -54,18 +54,15 @@ init(_Opts) -> application:set_env(blockchain, sc_client_handler, miner_lora), BaseDir = application:get_env(blockchain, base_dir, "data"), - %% Miner Options - POCOpts = #{ - base_dir => BaseDir - }, + %% Miner Options - OnionServer = + OnionOpts = case application:get_env(miner, radio_device, undefined) of {RadioBindIP, RadioBindPort, RadioSendIP, RadioSendPort} -> %% check if we are overriding/forcing the region ( for lora ) RegionOverRide = check_for_region_override(), - OnionOpts = #{ + #{ radio_udp_bind_ip => RadioBindIP, radio_udp_bind_port => RadioBindPort, radio_udp_send_ip => RadioSendIP, @@ -73,12 +70,14 @@ init(_Opts) -> ecdh_fun => ECDHFun, sig_fun => SigFun, region_override => RegionOverRide - }, - [?WORKER(miner_onion_server, [OnionOpts]), - ?WORKER(miner_lora, [OnionOpts]), - ?WORKER(miner_poc_statem, [POCOpts])]; + }; _ -> - [] + #{ + radio_udp_bind_ip => {127, 0, 0, 1}, + radio_udp_bind_port => 0, + ecdh_fun => ECDHFun, + sig_fun => SigFun + } end, EbusServer = @@ -87,17 +86,63 @@ init(_Opts) -> _ -> [] end, - ValServers = - case application:get_env(miner, mode, gateway) of + MinerMode = application:get_env(miner, mode, gateway), + POCServers = + case MinerMode of validator -> - [?WORKER(miner_val_heartbeat, []), - ?SUP(sibyl_sup, [])]; - _ -> [] + %% NOTE: validators do not require the onion or lora server + %% however removing these here breaks tests + %% there is no harm done by leaving them running + application:set_env(sibyl, poc_mgr_mod, miner_poc_mgr), + application:set_env(sibyl, poc_report_handler, miner_poc_report_handler), + [PocMgrTab1, PocMgrTab2] = miner_poc_mgr:make_ets_table(), + POCMgrOpts = #{tab1 => PocMgrTab1, tab2 => PocMgrTab2}, + POCOpts = #{base_dir => BaseDir, + cfs => ["default", + "poc_mgr_cf" + ] + }, + [ + ?WORKER(miner_onion_server, [OnionOpts]), + ?WORKER(miner_lora, [OnionOpts]), + ?WORKER(miner_poc_mgr_db_owner, [POCOpts]), + ?WORKER(miner_poc_statem, [POCOpts]), + ?WORKER(miner_poc_mgr, [POCMgrOpts]) + ]; + gateway -> + %% running as a gateway + %% run both the grpc and libp2p version of the lora & onion modules + %% they will work out which is required based on chain vars + %% start miner_poc_statem, if the pocs are being run by validators, it will do nothing + %% start the grpc start client, if the pocs are NOT being run by validators, it will do nothing + POCOpts = #{ + base_dir => BaseDir + }, + [ + ?WORKER(miner_onion_server_light, [OnionOpts]), + ?WORKER(miner_onion_server, [OnionOpts]), + ?WORKER(miner_lora_light, [OnionOpts]), + ?WORKER(miner_lora, [OnionOpts]), + ?WORKER(miner_poc_grpc_client_statem, []), + ?WORKER(miner_poc_statem, [POCOpts]) + + ] end, {JsonRpcPort, JsonRpcIp} = jsonrpc_server_config(), + ValServers = + case MinerMode of + validator -> + [ + ?WORKER(miner_val_heartbeat, []), + ?SUP(sibyl_sup, []) + ]; + _ -> + [] + end, ChildSpecs = + [ ?WORKER(miner_hbbft_sidecar, []), ?WORKER(miner, []), @@ -106,9 +151,9 @@ init(_Opts) -> {port, JsonRpcPort}]]), ?WORKER(miner_poc_denylist, []) ] ++ + POCServers ++ ValServers ++ - EbusServer ++ - OnionServer, + EbusServer, {ok, {SupFlags, ChildSpecs}}. diff --git a/src/miner_val_heartbeat.erl b/src/miner_val_heartbeat.erl index 5b28a575c..7ef24d0c8 100644 --- a/src/miner_val_heartbeat.erl +++ b/src/miner_val_heartbeat.erl @@ -87,8 +87,11 @@ handle_info({blockchain_event, {add_block, Hash, Sync, _Ledger}}, %% we need to construct and submit a heartbeat txn {ok, CBMod} = blockchain_ledger_v1:config(?predicate_callback_mod, Ledger), {ok, Callback} = blockchain_ledger_v1:config(?predicate_callback_fun, Ledger), + {EmpKeys, EmpKeyHashes} = generate_poc_keys(Ledger), + lager:debug("HB poc ephemeral keys ~p", [EmpKeys]), + ok = miner_poc_mgr:save_local_poc_keys(Height, EmpKeys), UnsignedTxn = - blockchain_txn_validator_heartbeat_v1:new(Address, Height, CBMod:Callback()), + blockchain_txn_validator_heartbeat_v1:new(Address, Height, CBMod:Callback(), EmpKeyHashes), Txn = blockchain_txn_validator_heartbeat_v1:sign(UnsignedTxn, SigFun), lager:info("submitting txn ~p for val ~p ~p ~p", [Txn, Val, N, HBInterval]), Self = self(), @@ -132,3 +135,40 @@ code_change(_OldVsn, State, _Extra) -> %%%=================================================================== %%% Internal functions %%%=================================================================== +-spec generate_poc_keys(blockchain:ledger()) -> + {[#{secret => libp2p_crypto:privkey(), public => libp2p_crypto:pubkey()}], [binary()]}. +generate_poc_keys(Ledger) -> + case blockchain:config(?poc_challenger_type, Ledger) of + {ok, validator} -> + %% if a val is in the ignore list then dont generate poc keys for it + %% TODO: this is a temp hack. remove when testing finished + IgnoreVals = application:get_env(sibyl, validator_ignore_list, []), + SelfPubKeyBin = blockchain_swarm:pubkey_bin(), + case not lists:member(SelfPubKeyBin, IgnoreVals) of + true -> + %% generate a set of ephemeral keys for POC usage + EphemeralKeyCount = + case blockchain:config(?poc_validator_ephemeral_key_count, Ledger) of + {ok, N} -> N; + _ -> 1 + end, + lager:debug("heartbeat ephemeral key count ~p", [EphemeralKeyCount]), + generate_ephemeral_keys(EphemeralKeyCount); + false -> + {[], []} + end; + _ -> + {[], []} + + end. + +-spec generate_ephemeral_keys(pos_integer()) -> {[#{secret => libp2p_crypto:privkey(), public => libp2p_crypto:pubkey()}], [binary()]}. +generate_ephemeral_keys(NumKeys) -> + lists:foldl( + fun(_N, {AccKeys, AccHashes})-> + Keys = libp2p_crypto:generate_keys(ecc_compact), + #{public := OnionCompactKey} = Keys, + OnionHash = crypto:hash(sha256, libp2p_crypto:pubkey_to_bin(OnionCompactKey)), + {[Keys | AccKeys], [OnionHash | AccHashes]} + end, + {[], []}, lists:seq(1, NumKeys)). diff --git a/src/poc/grpc_client_custom.erl b/src/poc/grpc_client_custom.erl new file mode 100644 index 000000000..b335927db --- /dev/null +++ b/src/poc/grpc_client_custom.erl @@ -0,0 +1,283 @@ +%% NOTE: +%% copied and modified from https://github.com/Bluehouse-Technology/grpc_client/blob/master/src/grpc_client.erl +%% requires the gpb modules to have been created with the following config: +%%{gpb_opts, [ +%% {rename,{msg_fqname,base_name}}, +%% use_packages, +%% {report_errors, false}, +%% {descriptor, false}, +%% {recursive, false}, +%% {i, "_build/default/lib/helium_proto/src"}, +%% {o, "src/grpc/autogen/client"}, +%% {module_name_prefix, ""}, +%% {module_name_suffix, "_client_pb"}, +%% {rename, {msg_name, {suffix, "_pb"}}}, +%% {strings_as_binaries, false}, +%% type_specs, +%% {defs_as_proplists, true} +%%]} + +%%%------------------------------------------------------------------- +%%% Licensed to the Apache Software Foundation (ASF) under one +%%% or more contributor license agreements. See the NOTICE file +%%% distributed with this work for additional information +%%% regarding copyright ownership. The ASF licenses this file +%%% to you under the Apache License, Version 2.0 (the +%%% "License"); you may not use this file except in compliance +%%% with the License. You may obtain a copy of the License at +%%% +%%% http://www.apache.org/licenses/LICENSE-2.0 +%%% +%%% Unless required by applicable law or agreed to in writing, +%%% software distributed under the License is distributed on an +%%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +%%% KIND, either express or implied. See the License for the +%%% specific language governing permissions and limitations +%%% under the License. +%%% + +%% @doc The interface for grpc_client. +%% +%% This module contains the functions use a gRPC service from Erlang. +%% +%% See the Readme in the root folder of the repository for a reference to a +%% more general (tutorial-style) introduction. +%% +-module(grpc_client_custom). + +-export([compile/1, compile/2, + connect/3, connect/4, + new_stream/4, new_stream/5, + send/2, send_last/2, + unary/6, + rcv/1, rcv/2, + get/1, + ping/2, + stop_stream/1, stop_stream/2, + stop_connection/1]). + +-type connection_option() :: + verify_server_opt() | + server_host_override_opt() | + http2_client_opt() | + {http2_options, [http2_option()]}. + +-type verify_server_opt() :: {verify_server_identity, boolean()}. +%% If true (and if the transport is ssl), the client will verify +%% that the subject of the server certificate matches with the domain +%% of the server (use the 'server_host_override' to check against +%% another name). + +-type server_host_override_opt() :: {server_host_override, string()}. +%% If the 'verify_server_identity' option is set, check the subject of +%% the server certificate against this name (rather than against the host name). + +-type http2_client_opt() :: {http2_client, module()}. +%% A module that implements an HTPP/2 client (with a specific API). +%% By default 'http2_client' will be used. As an alternative +%% 'grpc_client_chatterbox_adapter' can be used, which provides an interface to the +%% chatterbox http/2 client, or any other HTTP/2 client implementation with the right +%% API. + +-type http2_option() :: term(). +%% Passed on to the HTTP/2 client. See the documentation of 'http2_client' for the options +%% that can be specified for the default HTTP2/2 client. + +-type connection() :: grpc_client_connection:connection(). + +-type metadata_key() :: binary(). +-type metadata_value() :: binary(). +-type metadata() :: #{metadata_key() => metadata_value()}. +-type compression_method() :: none | gzip. + +-type stream_option() :: + {metadata, metadata()} | + {compression, compression_method()} | + {http2_options, [term()]}. + +-type client_stream() :: pid(). + +-type rcv_response() :: {data, map()} | + {headers, metadata()} | + eof | {error, term()}. + +-type get_response() :: rcv_response() | empty. + +-type unary_response() :: ok_response() | error_response(). + +-type ok_response() :: + {ok, #{result => any(), + status_message => binary(), + http_status => 200, + grpc_status => 0, + headers => metadata(), + trailers => metadata()}}. + +-type error_response() :: + {error, #{error_type => error_type(), + http_status => integer(), + grpc_status => integer(), + status_message => binary(), + headers => metadata(), + result => any(), + trailers => grpc:metadata()}}. + +-type error_type() :: client | timeout | http | grpc. + +-export_type([connection/0, + stream_option/0, + connection_option/0, + client_stream/0, + unary_response/0, + metadata/0, + compression_method/0 + ]). + +-spec compile(FileName::string()) -> ok. +%% @equiv compile(FileName, []) +compile(FileName) -> + grpc_client_custom:compile(FileName, []). + +-spec compile(FileName::string(), Options::gpb_compile:opts()) -> ok. +%% @doc Compile a .proto file to generate client stubs and a module +%% to encode and decode the protobuf messages. +%% +%% Refer to gpb for the options. grpc_client will always use the option +%% 'maps' (so that the protobuf messages are translated to and +%% from maps) and the option '{i, "."}' (so that .proto files in the +%% current working directory will be found). +compile(FileName, Options) -> + grpc_lib_compile:file(FileName, [{generate, client} | Options]). + +-spec connect(Transport::tcp|ssl, + Host::string(), + Port::integer()) -> {ok, connection()} | {error, term()}. +%% @equiv connect(Transport, Host, Port, []) +connect(Transport, Host, Port) -> + connect(Transport, Host, Port, []). + +-spec connect(Transport::tcp|ssl, + Host::string(), + Port::integer(), + Options::[connection_option()]) -> {ok, connection()} | {error, term()}. +%% @doc Start a connection to a gRPC server. +%% +%% If 'verify_server_identity' is true (and Transport == ssl), the client will +%% check that the subject of the certificate received from the server is +%% identical to Host. +%% +%% If it is known that the server returns a certificate with another subject +%% than the host name, the 'server_host_override' option can be used to +%% specify that other subject. +%% +%% The transport options will be passed to the selected Transport when +%% establishing the connection. +%% +%% The option {'http2_client', module()} enables the selection of +%% an http2 client. The default is http2_client, as an alternative it +%% is possible to select 'grpc_client_chatterbox_adapter', which +%% implements an adapter for the chatterbox http/2 client. +connect(Transport, Host, Port, Options) -> + grpc_client_connection:new(Transport, Host, Port, Options). + +-spec new_stream(Connection::connection(), + Service::atom(), + Rpc::atom(), + DecoderModule::module()) -> {ok, client_stream()}. +%% @equiv new_stream(Connection, Service, Rpc, DecoderModule, []) +new_stream(Connection, Service, Rpc, DecoderModule) -> + new_stream(Connection, Service, Rpc, DecoderModule, []). + +-spec new_stream(Connection::connection(), + Service::atom(), + Rpc::atom(), + DecoderModule::module(), + Options::[stream_option()]) -> {ok, client_stream()}. +%% @doc Create a new stream to start a new RPC. +new_stream(Connection, Service, Rpc, DecoderModule, Options) -> + CBMod = proplists:get_value(callback_mod, Options), + grpc_client_stream_custom:new(Connection, Service, Rpc, DecoderModule, Options, CBMod). + +-spec send(Stream::client_stream(), Msg::any()) -> ok. +%% @doc Send a message from the client to the server. +send(Stream, Msg) when is_pid(Stream) -> + grpc_client_stream_custom:send(Stream, Msg). + +-spec send_last(Stream::client_stream(), Msg::map()) -> ok. +%% @doc Send a message to server and mark it as the last message +%% on the stream. For simple RPC and client-streaming RPCs that +%% will trigger the response from the server. +send_last(Stream, Msg) when is_pid(Stream)-> + grpc_client_stream_custom:send_last(Stream, Msg). + +-spec rcv(Stream::client_stream()) -> rcv_response(). +%% @equiv rcv(Stream, infinity) +rcv(Stream) -> + grpc_client_stream_custom:rcv(Stream). + +-spec rcv(Stream::client_stream(), Timeout::timeout()) -> rcv_response(). +%% @doc Receive a message from the server. This is a blocking +%% call, it returns when a message has been received or after Timeout. +%% Timeout is in milliseconds. +%% +%% Returns 'eof' after the last message from the server has been read. +rcv(Stream, Timeout) -> + grpc_client_stream_custom:rcv(Stream, Timeout). + +-spec get(Stream::client_stream()) -> get_response(). +%% @doc Get a message from the stream, if there is one in the queue. If not return +%% 'empty'. This is a non-blocking call. +%% +%% Returns 'eof' after the last message from the server has been read. +get(Stream) -> + grpc_client_stream_custom:get(Stream). + +-spec ping(Connection::connection(), + Timeout::timeout()) -> {ok, RoundTripTime::integer()} | + {error, term()}. +%% @doc Send a PING request. +ping(Connection, Timeout) -> + grpc_client_connection:ping(Connection, Timeout). + +-spec stop_stream(Stream::client_stream()) -> ok. +%% @equiv stop_stream(Stream, 0) +stop_stream(Stream) -> + stop_stream(Stream, 0). + +-spec stop_stream(Stream::client_stream(), ErrorCode::integer()) -> ok. +%% @doc +%% Stops a stream. Depending on the state of the connection a 'RST_STREAM' +%% frame may be sent to the server with the provided Errorcode (it should be +%% a HTTP/2 error code, see RFC7540). +stop_stream(Stream, ErrorCode) -> + grpc_client_stream_custom:stop(Stream, ErrorCode). + +-spec stop_connection(Connection::connection()) -> ok. +%% @doc Stop a connection and clean up. +stop_connection(Connection) -> + grpc_client_connection:stop(Connection). + +-spec unary(Connection::connection(), + Message::tuple(), Service::atom(), Rpc::atom(), + Decoder::module(), + Options::[stream_option() | + {timeout, timeout()} | + {callback_mod, atom()}]) -> unary_response(). +%% @doc Call a unary rpc in one go. +%% +%% Set up a stream, receive headers, message and trailers, stop +%% the stream and assemble a response. This is a blocking function. +unary(Connection, Message, Service, Rpc, Decoder, Options) -> + {Timeout, StreamOptions} = grpc_lib:keytake(timeout, Options, infinity), + try + {ok, Stream} = new_stream(Connection, Service, + Rpc, Decoder, [{type, unary} | StreamOptions]), + Response = grpc_client_stream_custom:call_rpc(Stream, Message, Timeout), + stop_stream(Stream), + Response + catch + _Type:_Error:_Stack -> + lager:warning("Failed to create stream. Type: ~p, Error: ~p, Stack:~p", [_Type, _Error, _Stack]), + {error, #{error_type => client, + status_message => <<"stream create failed">>}} + end. \ No newline at end of file diff --git a/src/poc/grpc_client_stream_custom.erl b/src/poc/grpc_client_stream_custom.erl new file mode 100644 index 000000000..a283b2755 --- /dev/null +++ b/src/poc/grpc_client_stream_custom.erl @@ -0,0 +1,469 @@ +%% NOTE: +%% copied and modified from https://github.com/Bluehouse-Technology/grpc_client/blob/master/src/grpc_client_stream.erl +%% requires the gpb modules to have been created with the following config: +%%{gpb_opts, [ +%% {rename,{msg_fqname,base_name}}, +%% use_packages, +%% {report_errors, false}, +%% {descriptor, false}, +%% {recursive, false}, +%% {i, "_build/default/lib/helium_proto/src"}, +%% {o, "src/grpc/autogen/client"}, +%% {module_name_prefix, ""}, +%% {module_name_suffix, "_client_pb"}, +%% {rename, {msg_name, {suffix, "_pb"}}}, +%% {strings_as_binaries, false}, +%% type_specs, +%% {defs_as_proplists, true} +%%]} + +%%%------------------------------------------------------------------- +%%% Licensed to the Apache Software Foundation (ASF) under one +%%% or more contributor license agreements. See the NOTICE file +%%% distributed with this work for additional information +%%% regarding copyright ownership. The ASF licenses this file +%%% to you under the Apache License, Version 2.0 (the +%%% "License"); you may not use this file except in compliance +%%% with the License. You may obtain a copy of the License at +%%% +%%% http://www.apache.org/licenses/LICENSE-2.0 +%%% +%%% Unless required by applicable law or agreed to in writing, +%%% software distributed under the License is distributed on an +%%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +%%% KIND, either express or implied. See the License for the +%%% specific language governing permissions and limitations +%%% under the License. +%%% + +%% @private An a-synchronous client with a queue-like interface. +%% A gen_server is started for each stream, this keeps track +%% of the status of the http2 stream and it buffers responses in a queue. +-module(grpc_client_stream_custom). + +-behaviour(gen_server). + +-export([new/6, + send/2, send_last/2, + get/1, rcv/1, rcv/2, + state/1, + call_rpc/3, + stop/2]). + +%% gen_server behaviors +-export([code_change/3, handle_call/3, handle_cast/2, handle_info/2, init/1, terminate/2]). + +%%-type stream() :: +%% #{stream_id := integer(), +%% package := string(), +%% service := string(), +%% rpc := string(), +%% queue := queue:queue(), +%% response_pending := boolean(), +%% state := idle | open | half_closed_local | half_closed_remote | closed, +%% encoder := module(), +%% connection := grpc_client_custom:connection(), +%% headers_sent := boolean(), +%% metadata := grpc_client_custom:metadata(), +%% compression := grpc_client_custom:compression_method(), +%% buffer := binary(), +%% handler_callback := undefined, +%% handler_state := undefined, +%% type := unary | streaming | undefined}. + +-spec new(Connection::pid(), + Service::atom(), + Rpc::atom(), + Encoder::module(), + Options::list(), + HandlerMod::atom() ) -> {ok, Pid::pid()} | {error, Reason::term()}. +new(Connection, Service, Rpc, Encoder, Options, HandlerMod) -> + gen_server:start_link(?MODULE, + {Connection, Service, Rpc, Encoder, Options, HandlerMod}, []). + +send(Pid, Message) -> + gen_server:call(Pid, {send, Message}). + +send_last(Pid, Message) -> + gen_server:call(Pid, {send_last, Message}). + +get(Pid) -> + gen_server:call(Pid, get). + +rcv(Pid) -> + rcv(Pid, infinity). + +rcv(Pid, Timeout) -> + gen_server:call(Pid, {rcv, Timeout}, infinity). + +%% @doc Get the state of the stream. +state(Pid) -> + gen_server:call(Pid, state). + +-spec stop(Stream::pid(), ErrorCode::integer()) -> ok. +%% @doc Close (stop/clean up) the stream. +%% +%% If the stream is in open or half closed state, a RST_STREAM frame +%% will be sent to the server. +stop(Pid, ErrorCode) -> + gen_server:call(Pid, {stop, ErrorCode}). + +%% @doc Call a unary rpc and process the response. +call_rpc(Pid, Message, Timeout) -> + try send_last(Pid, Message) of + ok -> + process_response(Pid, Timeout) + catch + _:_ -> + {error, #{error_type => client, + status_message => <<"failed to encode and send message">>}} + end. + +%% gen_server implementation +%% @private +init({Connection, Service, Rpc, Encoder, Options, HandlerMod}) -> + try + StreamType = proplists:get_value(type, Options, undefined), + lager:info("init stream for RPC ~p and type ~p", [Rpc, StreamType]), + Stream = new_stream(Connection, Service, Rpc, Encoder, Options), + lager:info("init stream success with state ~p, handle_mod: ~p", [Stream, HandlerMod]), + HandlerState = HandlerMod:init(), + {ok, Stream#{handler_state => HandlerState, handler_callback => HandlerMod, type => StreamType}} + catch + _Class:_Error:_Stack -> + lager:warning("failed to create stream, ~p ~p ~p", [_Class, _Error, _Stack]), + {stop, <<"failed to create stream">>} + end. + +%% @private +code_change(_OldVsn, State, _Extra) -> + {ok, State}. + +%% @private +handle_call(state, _From, #{state := State} = Stream) -> + {reply, State, Stream}; +handle_call({stop, ErrorCode}, _From, Stream) -> + {stop, normal, ok, rst_stream(Stream, ErrorCode)}; +handle_call({send_last, Message}, _From, Stream) -> + {reply, ok, send_msg(Stream, Message, true)}; +handle_call({send, Message}, _From, Stream) -> + {reply, ok, send_msg(Stream, Message, false)}; +handle_call(get, _From, #{queue := Queue, + state := StreamState} = Stream) -> + {Value, NewQueue} = queue:out(Queue), + Response = case {Value, StreamState} of + {{value, V}, _} -> + V; + {empty, S} when S == closed; + S == half_closed_remote -> + eof; + {empty, _} -> + empty + end, + {reply, Response, Stream#{queue => NewQueue}}; +handle_call({rcv, Timeout}, From, #{queue := Queue, + state := StreamState} = Stream) -> + {Value, NewQueue} = queue:out(Queue), + NewStream = Stream#{queue => NewQueue}, + case {Value, StreamState} of + {{value, V}, _} -> + {reply, V, NewStream}; + {empty, S} when S == closed; + S == half_closed_remote -> + {reply, eof, NewStream}; + {empty, _} -> + {noreply, NewStream#{client => From, + response_pending => true}, Timeout} + end. + +%% @private +handle_cast(_, State) -> + {noreply, State}. + +%% @private +handle_info({'RECV_DATA', StreamId, Bin}, Stream) -> + %% This is a workaround to deal with the different format from Chatterbox. + %% TODO: find a better way to do this. + handle_info({'RECV_DATA', StreamId, Bin, false, false}, Stream); +handle_info({'RECV_DATA', StreamId, Bin, + _StreamWindowError, _ConnectionWindowError}, + #{stream_id := StreamId, + buffer := Buffer} = Stream) -> + case <> of + <> -> + Response = + try + {data, decode(Encoded, Message, Stream#{buffer => Rest})} + catch + throw:{error, Message} -> + {error, Message}; + _Error:_Message -> + {error, <<"failed to decode message">>} + end, + info_response(Response, Stream#{buffer => Rest}); + NotComplete -> + {noreply, Stream#{buffer => NotComplete}} + end; + +handle_info({'RECV_HEADERS', StreamId, Headers}, + #{stream_id := StreamId, + state := StreamState} = Stream) -> + HeadersMap = maps:from_list([grpc_lib:maybe_decode_header(H) + || H <- Headers]), + Encoding = maps:get(<<"grpc-encoding">>, HeadersMap, none), + NewState = case StreamState of + idle -> + open; + _ -> + StreamState + end, + info_response({headers, HeadersMap}, + Stream#{response_encoding => Encoding, + state => NewState}); +handle_info({'END_STREAM', StreamId}, + #{stream_id := StreamId, + state := StreamState} = Stream) -> + NewState = case StreamState of + half_closed_local -> + closed; + _ -> + half_closed_remote + end, + info_response(eof, Stream#{state => NewState}); +handle_info({ClosedMessage, StreamId, _ErrorCode}, + #{stream_id := StreamId} = Stream) + when ClosedMessage == 'RESET_BY_PEER'; + ClosedMessage == 'CLOSED_BY_PEER' -> + info_response(eof, Stream#{state => closed}); +handle_info(timeout, #{response_pending := true, + client := Client} = Stream) -> + gen_server:reply(Client, {error, timeout}), + {noreply, Stream#{response_pending => false}}; +handle_info(Msg, #{handler_callback := HandlerCB} = Stream) -> + NewState = + case erlang:function_exported(HandlerCB, handle_info, 2) of + true -> HandlerCB:handle_info(Msg, Stream); + false -> Stream + end, + {noreply, NewState}. +%%handle_info(_InfoMessage, Stream) -> +%% {noreply, Stream}. + +%% @private +terminate(_Reason, _State) -> + ok. + + +%% internal methods + +new_stream(Connection, Service, Rpc, Encoder, Options) -> + Compression = proplists:get_value(compression, Options, none), + Metadata = proplists:get_value(metadata, Options, #{}), + TransportOptions = proplists:get_value(http2_options, Options, []), + {ok, StreamId} = grpc_client_connection:new_stream(Connection, TransportOptions), + RpcDef = Encoder:find_rpc_def(Service, Rpc), + RpcDefMap = maps:from_list(RpcDef), + %% the gpb rpc def has 'input', 'output' etc. + %% All the information is combined in 1 map, + %% which is is the state of the gen_server. + RpcDefMap#{stream_id => StreamId, + package => [], + service => Service, + rpc => Rpc, + queue => queue:new(), + response_pending => false, + state => idle, + encoder => Encoder, + connection => Connection, + headers_sent => false, + metadata => Metadata, + compression => Compression, + buffer => <<>>}. + +send_msg(#{stream_id := StreamId, + connection := Connection, + headers_sent := HeadersSent, + metadata := Metadata, + state := State + } = Stream, Message, EndStream) -> + Encoded = encode(Stream, Message), + case HeadersSent of + false -> + DefaultHeaders = default_headers(Stream), + AllHeaders = add_metadata(DefaultHeaders, Metadata), + ok = grpc_client_connection:send_headers(Connection, StreamId, AllHeaders); + true -> + ok + end, + Opts = [{end_stream, EndStream}], + NewState = + case {EndStream, State} of + {false, _} when State == idle -> + open; + {false, _} -> + State; + {true, _} when State == open; + State == idle -> + half_closed_local; + {true, _} -> + closed + end, + ok = grpc_client_connection:send_body(Connection, StreamId, Encoded, Opts), + Stream#{headers_sent => true, + state => NewState}. + +rst_stream(#{connection := Connection, + stream_id := StreamId} = Stream, ErrorCode) -> + grpc_client_connection:rst_stream(Connection, StreamId, ErrorCode), + Stream#{state => closed}. + +default_headers(#{service := Service, + rpc := Rpc, + package := Package, + compression := Compression, + connection := #{host := Host, + scheme := Scheme} + }) -> + Path = iolist_to_binary(["/", Package, atom_to_list(Service), + "/", atom_to_list(Rpc)]), + Headers1 = case Compression of + none -> + []; + _ -> + [{<<"grpc-encoding">>, + atom_to_binary(Compression, unicode)}] + end, + [{<<":method">>, <<"POST">>}, + {<<":scheme">>, Scheme}, + {<<":path">>, Path}, + {<<":authority">>, Host}, + {<<"content-type">>, <<"application/grpc+proto">>}, + {<<"user-agent">>, <<"grpc-erlang/0.0.1">>}, + {<<"te">>, <<"trailers">>} | Headers1]. + +add_metadata(Headers, Metadata) -> + lists:foldl(fun(H, Acc) -> + {K, V} = grpc_lib:maybe_encode_header(H), + %% if the key exists, replace it. + lists:keystore(K, 1, Acc, {K,V}) + end, Headers, maps:to_list(Metadata)). + +info_response(Response, #{response_pending := true, + client := Client} = Stream) -> + gen_server:reply(Client, Response), + {noreply, Stream#{response_pending => false}}; +info_response(Response, #{queue := Queue, type := unary} = Stream) -> + NewQueue = queue:in(Response, Queue), + {noreply, Stream#{queue => NewQueue}}; +%%info_response(Response, #{queue := Queue} = Stream) -> +%% NewQueue = queue:in(Response, Queue), +%% {noreply, Stream#{queue => NewQueue}}. + +info_response(eof = Response, #{type := Type} = Stream) -> + lager:info("info_response ~p, stream type: ~p", [Response, Type]), + {stop, normal, rst_stream(Stream, 0)}; +info_response(Response, #{handler_callback := CB, handler_state := CBState} = Stream) -> + lager:info("info_response ~p, CB: ~p", [Response, CB]), + NewCBState = CB:handle_msg(Response, CBState), + {noreply, Stream#{handler_callback_state => NewCBState}}. +%% TODO: fix the error handling, currently it is very hard to understand the +%% error that results from a bad message (Map). +encode(#{encoder := Encoder, + input := MsgType, + compression := CompressionMethod}, Map) -> + %% RequestData = Encoder:encode_msg(Map, MsgType), + try Encoder:encode_msg(Map, MsgType) of + RequestData -> + maybe_compress(RequestData, CompressionMethod) + catch + error:function_clause -> + throw({error, {failed_to_encode, MsgType, Map}}); + Error:Reason -> + throw({error, {Error, Reason}}) + end. + +maybe_compress(Encoded, none) -> + Length = byte_size(Encoded), + <<0, Length:32, Encoded/binary>>; +maybe_compress(Encoded, gzip) -> + Compressed = zlib:gzip(Encoded), + Length = byte_size(Compressed), + <<1, Length:32, Compressed/binary>>; +maybe_compress(_Encoded, Other) -> + throw({error, {compression_method_not_supported, Other}}). + +decode(Encoded, Binary, + #{response_encoding := Method, + encoder := Encoder, + output := MsgType}) -> + Message = case Encoded of + 1 -> decompress(Binary, Method); + 0 -> Binary + end, + Encoder:decode_msg(Message, MsgType). + +decompress(Compressed, <<"gzip">>) -> + zlib:gunzip(Compressed); +decompress(_Compressed, Other) -> + throw({error, {decompression_method_not_supported, Other}}). + +process_response(Pid, Timeout) -> + case rcv(Pid, Timeout) of + {headers, #{<<":status">> := <<"200">>, + <<"grpc-status">> := GrpcStatus} = Trailers} + when GrpcStatus /= <<"0">> -> + %% "trailers only" response. + grpc_response(#{}, #{}, Trailers); + {headers, #{<<":status">> := <<"200">>} = Headers} -> + get_message(Headers, Pid, Timeout); + {headers, #{<<":status">> := HttpStatus} = Headers} -> + {error, #{error_type => http, + status => {http, HttpStatus}, + headers => Headers}}; + {headers, #{<<"grpc-status">> := GrpcStatus} = Headers} + when GrpcStatus == <<"14">> -> + {error, #{error_type => http, + status => {http, <<"503">>}, + headers => Headers}}; + {error, timeout} -> + {error, #{error_type => timeout}} + end. + +get_message(Headers, Pid, Timeout) -> + case rcv(Pid, Timeout) of + {data, Response} -> + get_trailer(Response, Headers, Pid, Timeout); + {headers, Trailers} -> + grpc_response(Headers, #{}, Trailers); + {error, timeout} -> + {error, #{error_type => timeout, + headers => Headers}} + end. + +get_trailer(Response, Headers, Pid, Timeout) -> + case rcv(Pid, Timeout) of + {headers, Trailers} -> + grpc_response(Headers, Response, Trailers); + {error, timeout} -> + {error, #{error_type => timeout, + headers => Headers, + result => Response}} + end. + +grpc_response(Headers, Response, #{<<"grpc-status">> := <<"0">>} = Trailers) -> + StatusMessage = maps:get(<<"grpc-message">>, Trailers, <<"">>), + {ok, #{status_message => StatusMessage, + http_status => 200, + grpc_status => 0, + headers => Headers, + result => Response, + trailers => Trailers}}; +grpc_response(Headers, Response, #{<<"grpc-status">> := ErrorStatus} = Trailers) -> + StatusMessage = maps:get(<<"grpc-message">>, Trailers, <<"">>), + {error, #{error_type => grpc, + http_status => 200, + grpc_status => binary_to_integer(ErrorStatus), + status_message => StatusMessage, + headers => Headers, + result => Response, + trailers => Trailers}}. \ No newline at end of file diff --git a/src/poc/miner_onion_server.erl b/src/poc/miner_onion_server.erl index a4e91ddef..5e77a292e 100644 --- a/src/poc/miner_onion_server.erl +++ b/src/poc/miner_onion_server.erl @@ -150,7 +150,7 @@ send_receipt(Data, OnionCompactKey, Type, Time, RSSI, SNR, Frequency, Channel, D Acc; false -> P2P = libp2p_crypto:pubkey_bin_to_p2p(Challenger), - case miner_poc:dial_framed_stream(blockchain_swarm:tid(), P2P, []) of + case miner_poc:dial_framed_stream(blockchain_swarm:tid(), P2P, miner_poc_handler, []) of {error, _Reason} -> lager:error("failed to dial challenger ~p (~p)", [P2P, _Reason]), [error|Acc]; @@ -238,7 +238,7 @@ send_witness(Data, OnionCompactKey, Time, RSSI, SNR, Frequency, Channel, DataRat false -> EncodedWitness = blockchain_poc_response_v1:encode(Witness1), P2P = libp2p_crypto:pubkey_bin_to_p2p(Challenger), - case miner_poc:dial_framed_stream(blockchain_swarm:tid(), P2P, []) of + case miner_poc:dial_framed_stream(blockchain_swarm:tid(), P2P, miner_poc_handler, []) of {error, _Reason} -> lager:warning("failed to dial challenger ~p: ~p", [P2P, _Reason]), timer:sleep(timer:seconds(30)), diff --git a/src/poc/miner_onion_server_light.erl b/src/poc/miner_onion_server_light.erl new file mode 100644 index 000000000..6861d4f90 --- /dev/null +++ b/src/poc/miner_onion_server_light.erl @@ -0,0 +1,381 @@ +%%%------------------------------------------------------------------- +%% @doc +%% == Miner Onion Server for light gateways == +%% no use of chain or ledger +%% @end +%%%------------------------------------------------------------------- +-module(miner_onion_server_light). + +-behavior(gen_server). + +-include("src/grpc/autogen/client/gateway_miner_client_pb.hrl"). +-include_lib("blockchain/include/blockchain_vars.hrl"). +-include_lib("blockchain/include/blockchain_caps.hrl"). + +%% ------------------------------------------------------------------ +%% API Function Exports +%% ------------------------------------------------------------------ +-export([ + start_link/1, + decrypt_p2p/1, + decrypt_radio/7, + retry_decrypt/11, + send_receipt/11, + send_witness/9, + region_params_update/2, + region_params/0 +]). + +-ifdef(TEST). +-include_lib("eunit/include/eunit.hrl"). +-define(TX_RAND_SLEEP, 1). +-define(TX_MIN_SLEEP, 0). +-define(TX_COUNT, 1). +-else. +-define(TX_RAND_SLEEP, 10000). +-define(TX_MIN_SLEEP, 0). +-define(TX_COUNT, 3). +-endif. + +-ifdef(EQC). +-export([try_decrypt/5]). +-endif. + +%% ------------------------------------------------------------------ +%% gen_server Function Exports +%% ------------------------------------------------------------------ +-export([ + init/1, + handle_call/3, + handle_cast/2, + handle_info/2 +]). + +-record(state, { + compact_key :: ecc_compact:compact_key(), + ecdh_fun, + miner_name :: binary(), + sender :: undefined | {pid(), term()}, + packet_id = 0 :: non_neg_integer(), + region_params = undefined :: undefined | blockchain_region_param_v1:region_param_v1(), + region = undefined :: undefined | atom() +}). + +-define(BLOCK_RETRY_COUNT, 10). +-define(CHANNELS, [903.9, 904.1, 904.3, 904.5, 904.7, 904.9, 905.1, 905.3]). + +-type state() :: #state{}. + +%% ------------------------------------------------------------------ +%% API Function Definitions +%% ------------------------------------------------------------------ +start_link(Args) -> + gen_server:start_link({local, ?MODULE}, ?MODULE, Args, []). + +-spec decrypt_p2p(binary()) -> ok. +decrypt_p2p(Onion) -> + gen_server:cast(?MODULE, {decrypt_p2p, Onion}). + +decrypt_radio(Packet, RSSI, SNR, Timestamp, Freq, Channel, Spreading) -> + gen_server:cast(?MODULE, {decrypt_radio, Packet, RSSI, SNR, Timestamp, Freq, Channel, Spreading}). + +retry_decrypt(Type, IV, OnionCompactKey, Tag, CipherText, RSSI, SNR, Frequency, Channel, DataRate, Stream) -> + gen_server:cast(?MODULE, {retry_decrypt, Type, IV, OnionCompactKey, Tag, CipherText, RSSI, SNR, Frequency, Channel, DataRate, Stream}). + +-spec region_params_update(atom(), [blockchain_region_param_v1:region_param_v1()]) -> ok. +region_params_update(Region, RegionParams) -> + gen_server:cast(?MODULE, {region_params_update, Region, RegionParams}). + +-spec region_params() -> ok. +region_params() -> + gen_server:call(?MODULE, region_params). + +-spec send_receipt(Data :: binary(), + OnionCompactKey :: libp2p_crypto:pubkey_bin(), + Type :: radio | p2p, + Time :: pos_integer(), + RSSI :: integer(), + SNR :: float(), + Frequency :: float(), + Channel :: non_neg_integer(), + DataRate :: binary(), + Power :: non_neg_integer(), + State :: state()) -> ok | {error, any()}. +send_receipt(Data, OnionCompactKey, Type, Time, RSSI, SNR, Frequency, Channel, DataRate, Power, _State) -> + case miner_lora_light:location_ok() of + true -> + lager:md([{poc_id, blockchain_utils:poc_id(OnionCompactKey)}]), + OnionKeyHash = crypto:hash(sha256, OnionCompactKey), + Address = blockchain_swarm:pubkey_bin(), + Receipt = case application:get_env(miner, data_aggregation_version, 3) of + 1 -> + blockchain_poc_receipt_v1:new(Address, Time, RSSI, Data, Type, SNR, Frequency); + 2 -> + blockchain_poc_receipt_v1:new(Address, Time, RSSI, Data, Type, SNR, Frequency, Channel, DataRate); + V when V >= 3 -> + R0 = blockchain_poc_receipt_v1:new(Address, Time, RSSI, Data, Type, SNR, Frequency, Channel, DataRate), + blockchain_poc_receipt_v1:tx_power(R0, Power); + _ -> + blockchain_poc_receipt_v1:new(Address, Time, RSSI, Data, Type) + end, + + %% TODO: put retry mechanism back in place + miner_poc_grpc_client_statem:send_report(receipt, Receipt, OnionKeyHash); + false -> + ok + end. + +-spec send_witness(Data :: binary(), + OnionCompactKey :: libp2p_crypto:pubkey_bin(), + Time :: pos_integer(), + RSSI :: integer(), + SNR :: float(), + Frequency :: float(), + Channel :: non_neg_integer(), + DataRate :: binary(), + State :: state()) -> ok. +send_witness(Data, OnionCompactKey, Time, RSSI, SNR, Frequency, Channel, DataRate, _State) -> + case miner_lora_light:location_ok() of + true -> + POCID = blockchain_utils:poc_id(OnionCompactKey), + lager:info([{poc_id, POCID}], + "sending witness at RSSI: ~p, Frequency: ~p, SNR: ~p", + [RSSI, Frequency, SNR]), + OnionKeyHash = crypto:hash(sha256, OnionCompactKey), + SelfPubKeyBin = blockchain_swarm:pubkey_bin(), + Witness = case application:get_env(miner, data_aggregation_version, 2) of + V when V >= 2 -> + %% Send channel + datarate with data_aggregation_version >= 2 + blockchain_poc_witness_v1:new(SelfPubKeyBin, Time, RSSI, Data, SNR, Frequency, Channel, DataRate); + 1 -> + blockchain_poc_witness_v1:new(SelfPubKeyBin, Time, RSSI, Data, SNR, Frequency); + _ -> + blockchain_poc_witness_v1:new(SelfPubKeyBin, Time, RSSI, Data) + end, + miner_poc_grpc_client_statem:send_report(witness, Witness, OnionKeyHash); + false -> + ok + end. + +%% ------------------------------------------------------------------ +%% gen_server Function Definitions +%% ------------------------------------------------------------------ +init(Args) -> + lager:info("init with ~p", [Args]), + {ok, Name} = erl_angry_purple_tiger:animal_name(libp2p_crypto:bin_to_b58(blockchain_swarm:pubkey_bin())), + MinerName = binary:replace(erlang:list_to_binary(Name), <<"-">>, <<" ">>, [global]), + State = #state{ + compact_key = blockchain_swarm:pubkey_bin(), + ecdh_fun = maps:get(ecdh_fun, Args), + miner_name = unicode:characters_to_binary(MinerName, utf8) + }, + {ok, State}. + +handle_call(region_params, _From, #state{region_params = Params}=State) -> + {reply, {ok, Params}, State}; +handle_call(compact_key, _From, #state{compact_key=CK}=State) when CK /= undefined -> + {reply, {ok, CK}, State}; +handle_call(_Msg, _From, State) -> + {reply, ok, State}. + +handle_cast({region_params_update, Region, RegionParams}, State) -> + lager:info("updating region params. Region: ~p, Params: ~p", [Region, RegionParams]), + {noreply, State#state{region = Region, region_params = RegionParams}}; +handle_cast({decrypt_p2p, _Payload}, #state{region_params = undefined} = State) -> + lager:warning("dropping p2p challenge packet as no region params data", []), + {noreply, State}; +handle_cast({decrypt_p2p, <>}, State) -> + %%TODO - rssi, freq, snr, channel and datarate were originally undefined + %% but this breaks the in use PB encoder, so defaulted to values below + NewState = decrypt(p2p, IV, OnionCompactKey, Tag, CipherText, 0, 0.0, 0.0, 0, [12], State), + {noreply, NewState}; +handle_cast({decrypt_radio, _Payload}, #state{region_params = undefined} = State) -> + lager:warning("dropping radio challenge packet as no region params data", []), + {noreply, State}; +handle_cast({decrypt_radio, <>, + RSSI, SNR, _Timestamp, Frequency, Channel, DataRate}, State) -> + NewState = decrypt(radio, IV, OnionCompactKey, Tag, CipherText, RSSI, SNR, Frequency, Channel, DataRate, State), + {noreply, NewState}; +handle_cast({retry_decrypt, Type, _IV, _OnionCompactKey, _Tag, _CipherText, _RSSI, _SNR, _Frequency, _Channel, _DataRate}, #state{region_params = undefined} = State) -> + lager:warning("dropping retry ~p challenge packet as no region params data", [Type]), + {noreply, State}; +handle_cast({retry_decrypt, Type, IV, OnionCompactKey, Tag, CipherText, RSSI, SNR, Frequency, Channel, DataRate}, State) -> + NewState = decrypt(Type, IV, OnionCompactKey, Tag, CipherText, RSSI, SNR, Frequency, Channel, DataRate, State), + {noreply, NewState}; +handle_cast(_Msg, State) -> + {noreply, State}. + +handle_info(_Msg, State) -> + lager:warning("unhandled Msg: ~p", [_Msg]), + {noreply, State}. + +%% ------------------------------------------------------------------ +%% Internal Function Definitions +%% ------------------------------------------------------------------ +decrypt(Type, IV, OnionCompactKey, Tag, CipherText, RSSI, SNR, Frequency, Channel, DataRate, #state{ecdh_fun=ECDHFun, region_params = RegionParams, region = Region}=State) -> + POCID = blockchain_utils:poc_id(OnionCompactKey), + OnionKeyHash = crypto:hash(sha256, OnionCompactKey), + lager:info("attempting decrypt of type ~p for onion key hash ~p", [Type, OnionKeyHash]), + NewState = case try_decrypt(IV, OnionCompactKey, OnionKeyHash, Tag, CipherText, ECDHFun) of + {error, fail_decrypt} -> + lager:info([{poc_id, POCID}], + "sending witness at RSSI: ~p, Frequency: ~p, SNR: ~p", + [RSSI, Frequency, SNR]), + _ = erlang:spawn( + ?MODULE, + send_witness, + [crypto:hash(sha256, <>), + OnionCompactKey, + os:system_time(nanosecond), RSSI, SNR, Frequency, Channel, DataRate, State] + ), + lager:info([{poc_id, POCID}], "could not decrypt packet received via ~p: treating as a witness", [Type]), + State; + {ok, Data, NextPacket} -> + lager:info([{poc_id, POCID}], "decrypted a layer: ~w received via ~p~n", [Data, Type]), + %% fingerprint with a blank key + Packet = longfi:serialize(<<0:128/integer-unsigned-little>>, longfi:new(monolithic, 0, 1, 0, NextPacket, #{})), + %% deterministally pick a channel based on the layerdata + <> = Data, + %% TODO calculate some kind of delay here + case miner_lora_light:location_ok() of + true -> + %% the fun below will be executed by miner_lora:send and supplied with the localised lists of channels + ChannelSelectorFun = fun(FreqList) -> lists:nth((IntData rem length(FreqList)) + 1, FreqList) end, + + %% NOTE: poc version used to be derived from ledger + %% as we wont be following the chain, cant use that + case application:get_env(miner, poc_version, 11) of + POCVersion when POCVersion >= 11 -> + %% send receipt with poc_v11 updates + case RegionParams of + undefined -> + %% continue doing the old way + %% the fun below will be executed by miner_lora:send and supplied with the localised lists of channels + Spreading = spreading(Region, erlang:byte_size(Packet)), + TxPower = tx_power(Region), + erlang:spawn(fun() -> miner_lora_light:send_poc(Packet, immediate, ChannelSelectorFun, Spreading, TxPower) end), + erlang:spawn(fun() -> ?MODULE:send_receipt(Data, OnionCompactKey, Type, os:system_time(nanosecond), + RSSI, SNR, Frequency, Channel, DataRate, TxPower, State) end); + _ -> + case blockchain_region_params_v1:get_spreading(RegionParams, erlang:byte_size(Packet)) of + {error, Why} -> + lager:error("unable to get spreading, reason: ~p", [Why]), + ok; + {ok, Spreading} -> + case tx_power(Region, State) of + {error, Reason} -> + %% could not calculate txpower, don't do anything + lager:error("unable to get tx_power, reason: ~p", [Reason]), + ok; + {ok, TxPower, EffectiveTxPower, AssertedGain} -> + %% TxPower is the power we tell the radio to transmit at + %% and EffectiveTxPower is the power we expect to radiate at the + %% antenna. + BW = blockchain_region_params_v1:get_bandwidth(RegionParams), + DR = datarate(Spreading, BW), + case miner_lora_light:send_poc(Packet, immediate, ChannelSelectorFun, DR, TxPower) of + ok -> + lager:info("sending receipt with observed power: ~p with radio power ~p", [EffectiveTxPower, TxPower]), + ?MODULE:send_receipt(Data, OnionCompactKey, Type, os:system_time(nanosecond), + RSSI, SNR, Frequency, Channel, DataRate, EffectiveTxPower, State); + {warning, {tx_power_corrected, CorrectedPower}} -> + %% Corrected power never takes into account antenna gain config in pkt forwarder so we + %% always add it back here + lager:warning("tx_power_corrected! original_power: ~p, corrected_power: ~p, with gain ~p; sending receipt with power ~p", + [TxPower, CorrectedPower, AssertedGain, CorrectedPower + AssertedGain]), + ?MODULE:send_receipt(Data, OnionCompactKey, Type, os:system_time(nanosecond), + RSSI, SNR, Frequency, Channel, DataRate, CorrectedPower + AssertedGain, State); + {warning, {unknown, Other}} -> + %% This should not happen + lager:warning("What is this? ~p", [Other]), + ok; + {error, Reason} -> + lager:error("unable to send_poc, reason: ~p", [Reason]), + ok + end + end + end + end + end; + false -> + ok + end, + State; + {error, Reason} -> + lager:info([{poc_id, POCID}], "could not decrypt packet received via ~p: Reason, discarding", [Type, Reason]), + State + end, + NewState. + +-spec try_decrypt(binary(), binary(), binary(), binary(), binary(), function()) -> poc_not_found | {ok, binary(), binary()} | {error, any()}. +try_decrypt(IV, OnionCompactKey, _OnionKeyHash, Tag, CipherText, ECDHFun) -> + try blockchain_poc_packet_v2:decrypt(<>, ECDHFun) of + error -> + {error, fail_decrypt}; + {Payload, NextLayer} -> + {ok, Payload, NextLayer} + catch _A:_B:_C -> + lager:error("A: ~p, B: ~p, C: ~p", [_A, _B, _C]), + {error, {_A, _B}} + end. +%% end. + +-spec tx_power(Region :: atom(), State :: state()) -> {ok, pos_integer(), pos_integer(), non_neg_integer()} | {error, any()}. +tx_power(Region, #state{compact_key=_CK, region_params = RegionParams}) -> + try + MaxEIRP = lists:max([blockchain_region_param_v1:max_eirp(R) || R <- RegionParams]), + %% if the antenna gain is accounted for in the packet forwarder config file + %% set this to false + %% ConsiderTxGain = application:get_env(miner, consider_tx_gain, true), + %% TODO - revisit as we are dropping the GW gain from the ledger + %% do we need an API to pull this from a validator ? + EIRP = trunc(MaxEIRP/10), + lager:info("Region: ~p, Gain: ~p, MaxEIRP: ~p, EIRP: ~p", + [Region, undefined, MaxEIRP/10, EIRP]), + {ok, EIRP, EIRP, 0} + catch _Class:_Error -> + {error, failed_to_get_tx_power} + end. + +-spec datarate(Spreading :: atom(), BW :: pos_integer()) -> string(). +datarate(Spreading, BW) -> + BWInKhz = trunc(BW / 1000), + atom_to_list(Spreading) ++ "BW" ++ integer_to_list(BWInKhz). + +-spec tx_power(atom()) -> pos_integer(). +tx_power('EU868') -> + 14; +tx_power('US915') -> + 27; +tx_power(_) -> + 27. + +-spec spreading(Region :: atom(), + Len :: pos_integer()) -> string(). +spreading('EU868', L) when L < 65 -> + "SF12BW125"; +spreading('EU868', L) when L < 129 -> + "SF9BW125"; +spreading('EU868', L) when L < 238 -> + "SF8BW125"; +spreading(_, L) when L < 25 -> + "SF10BW125"; +spreading(_, L) when L < 67 -> + "SF9BW125"; +spreading(_, L) when L < 139 -> + "SF8BW125"; +spreading(_, _) -> + "SF7BW125". + +-ifdef(EQC). +-spec try_decrypt(binary(), binary(), binary(), binary(), function()) -> {ok, binary(), binary()} | {error, any()}. +try_decrypt(IV, OnionCompactKey, Tag, CipherText, ECDHFun) -> + OnionKeyHash = crypto:hash(sha256, OnionCompactKey), + try_decrypt(IV, OnionCompactKey, OnionKeyHash, Tag, CipherText, ECDHFun). +-endif. diff --git a/src/poc/miner_poc.erl b/src/poc/miner_poc.erl index cbe846f45..9a4ee41b6 100644 --- a/src/poc/miner_poc.erl +++ b/src/poc/miner_poc.erl @@ -6,8 +6,8 @@ -module(miner_poc). -export([ - dial_framed_stream/3, - add_stream_handler/1 + dial_framed_stream/4, + add_stream_handler/2 ]). -define(POC_VERSION, "miner_poc/1.0.0"). @@ -17,13 +17,13 @@ %% Dial PoC stream %% @end %%-------------------------------------------------------------------- --spec dial_framed_stream(ets:tab(), string(), list()) -> {ok, pid()} | {error, any()} | ignore. -dial_framed_stream(SwarmTID, Address, Args) -> +-spec dial_framed_stream(ets:tab(), string(), atom(), list()) -> {ok, pid()} | {error, any()} | ignore. +dial_framed_stream(SwarmTID, Address, HandlerMod, Args) -> libp2p_swarm:dial_framed_stream( SwarmTID, Address, ?POC_VERSION, - miner_poc_handler, + HandlerMod, Args ). @@ -31,10 +31,11 @@ dial_framed_stream(SwarmTID, Address, Args) -> %% @doc %% @end %%-------------------------------------------------------------------- --spec add_stream_handler(pid() | ets:tab()) -> ok. -add_stream_handler(SwarmTID) -> +-spec add_stream_handler(pid() | ets:tab(), atom()) -> ok. +add_stream_handler(SwarmTID, HandlerMod) -> libp2p_swarm:add_stream_handler( SwarmTID, ?POC_VERSION, - {libp2p_framed_stream, server, [miner_poc_handler, self(), SwarmTID]} + {libp2p_framed_stream, server, [HandlerMod, self(), SwarmTID]} ). + diff --git a/src/poc/miner_poc_grpc_client_handler.erl b/src/poc/miner_poc_grpc_client_handler.erl new file mode 100644 index 000000000..7bc17360e --- /dev/null +++ b/src/poc/miner_poc_grpc_client_handler.erl @@ -0,0 +1,205 @@ +%% +%% grpc client handler for poc streamed msgs - WIP +%% +-module(miner_poc_grpc_client_handler). + +-include("src/grpc/autogen/client/gateway_miner_client_pb.hrl"). + +%% ------------------------------------------------------------------ +%% Stream Exports +%% ------------------------------------------------------------------ +-export([ + init/0, + handle_msg/2, + handle_info/2 +]). + +%% ------------------------------------------------------------------ +%% API Function Exports +%% ------------------------------------------------------------------ +-ifdef(TEST). +-export([ + connect/1 +]). +-endif. + +-export([ + connect/3, + poc_stream/3, + config_update_stream/1, + region_params_update_stream/3 +]). + +init()-> + []. + +-ifdef(TEST). +connect(PeerP2P) -> + {ok, _PubKey, _SigFun, _} = blockchain_swarm:keys(), + %% get the test specific grpc port for the peer + %% ( which is going to be the libp2p port + 1000 ) + %% see miner_ct_utils for more info + {ok, PeerGrpcPort} = p2p_port_to_grpc_port(PeerP2P), + connect(PeerP2P, "127.0.0.1", PeerGrpcPort). +-endif. + +-spec connect(libp2p_crypto:peer_id(), string(), non_neg_integer()) -> {ok, grpc_client_custom:connection()} | {error, any()}. +connect(PeerP2P, PeerIP, GRPCPort) -> + try + lager:debug("connecting over grpc to peer ~p via IP ~p and port ~p", [PeerP2P, PeerIP, GRPCPort]), + {ok, Connection} = grpc_client_custom:connect(tcp, PeerIP, GRPCPort), + {ok, Connection} + catch _Error:_Reason:_Stack -> + lager:warning("*** failed to connect over grpc to peer ~p. Reason ~p Stack ~p", [PeerP2P, _Reason, _Stack]), + {error, failed_to_connect_to_grpc_peer} + end. + +-spec poc_stream(grpc_client_custom:connection(), libp2p_crypto:pubkey_bin(), function()) -> {ok, pid()} | {error, any()}. +poc_stream(Connection, PubKeyBin, SigFun)-> + try + {ok, Stream} = grpc_client_stream_custom:new( + Connection, + 'helium.gateway', + stream_poc, + gateway_miner_client_pb, + [{type, stream}], + ?MODULE), + lager:debug("*** new poc stream established with pid ~p", [Stream]), + %% subscribe to poc updates + Req = #gateway_poc_req_v1_pb{address = PubKeyBin, signature = <<>>}, + ReqEncoded = gateway_miner_client_pb:encode_msg(Req, gateway_poc_req_v1_pb), + ReqSigned = Req#gateway_poc_req_v1_pb{signature = SigFun(ReqEncoded)}, + ok = grpc_client_custom:send(Stream, ReqSigned), + {ok, Stream} + catch _Error:_Reason:_Stack -> + lager:warning("*** failed to connect to poc stream on connection ~p. Reason ~p Stack ~p", [Connection, _Reason, _Stack]), + {error, stream_failed} + end. + +-spec config_update_stream(grpc_client_custom:connection()) -> {ok, pid()} | {error, any()}. +config_update_stream(Connection)-> + try + {ok, Stream} = grpc_client_stream_custom:new( + Connection, + 'helium.gateway', + config_update, + gateway_miner_client_pb, + [{type, stream}], + ?MODULE), + %% subscribe to config updates + Req = #gateway_config_update_req_v1_pb{}, + ok = grpc_client_custom:send(Stream, Req), + {ok, Stream} + catch _Error:_Reason:_Stack -> + lager:warning("*** failed to connect to config_update stream on connection ~p. Reason ~p Stack ~p", [Connection, _Reason, _Stack]), + {error, stream_failed} + end. + +-spec region_params_update_stream(grpc_client_custom:connection(), libp2p_crypto:pubkey_bin(), function()) -> {ok, pid()} | {error, any()}. +region_params_update_stream(Connection, PubKeyBin, SigFun)-> + try + {ok, Stream} = grpc_client_stream_custom:new( + Connection, + 'helium.gateway', + region_params_update, + gateway_miner_client_pb, + [{type, stream}], + ?MODULE), + %% subscribe to region params updates + Req = #gateway_region_params_update_req_v1_pb{address = PubKeyBin, signature = <<>>}, + ReqEncoded = gateway_miner_client_pb:encode_msg(Req, gateway_region_params_update_req_v1_pb), + ReqSigned = Req#gateway_region_params_update_req_v1_pb{signature = SigFun(ReqEncoded)}, + ok = grpc_client_custom:send(Stream, ReqSigned), + {ok, Stream} + catch _Error:_Reason:_Stack -> + lager:warning("*** failed to connect to region_params_update stream on connection ~p. Reason ~p Stack ~p", [Connection, _Reason, _Stack]), + {error, stream_failed} + end. + +%% TODO: handle headers +handle_msg({headers, _Headers}, StreamState) -> + lager:debug("*** grpc client ignoring headers ~p", [_Headers]), + StreamState; +handle_msg({data, #gateway_resp_v1_pb{msg = {poc_challenge_resp, ChallengeNotification}, height = NotificationHeight, signature = ChallengerSig}} = Msg, StreamState) -> + lager:debug("grpc client received gateway_poc_challenge_notification_resp_v1 msg ~p", [Msg]), + #gateway_poc_challenge_notification_resp_v1_pb{challenger = #routing_address_pb{uri = URI, pub_key = PubKeyBin}, block_hash = BlockHash, onion_key_hash = OnionKeyHash} = ChallengeNotification, + Self = self(), + F = fun() -> + TargetRes = miner_poc_grpc_client_statem:check_target(binary_to_list(URI), PubKeyBin, OnionKeyHash, BlockHash, NotificationHeight, ChallengerSig), + lager:info("check target result for key ~p: ~p",[OnionKeyHash, TargetRes]), + case TargetRes of + {ok, Result, _Details} -> + handle_check_target_resp(Result); + {error, <<"queued_poc">>} -> + erlang:send_after(5000, Self, {retry_check_target, 1, Msg}); + {error, _Reason, _Details} -> + ok; + {error, _Reason} -> + ok + end + end, + spawn(F), + StreamState; +handle_msg({data, #gateway_resp_v1_pb{msg = {config_update_streamed_resp, Payload}, height = _NotificationHeight, signature = _ChallengerSig}} = _Msg, StreamState) -> + lager:debug("grpc client received config_update_streamed_resp msg ~p", [_Msg]), + #gateway_config_update_streamed_resp_v1_pb{keys = UpdatedKeys} = Payload, + miner_poc_grpc_client_statem:update_config(UpdatedKeys), + StreamState; +handle_msg({data, #gateway_resp_v1_pb{msg = {region_params_streamed_resp, Payload}, height = _NotificationHeight, signature = _ChallengerSig}} = _Msg, StreamState) -> + lager:debug("grpc client received region_params_streamed_resp msg ~p", [_Msg]), + #gateway_region_params_streamed_resp_v1_pb{region = Region, params =Params} = Payload, + #blockchain_region_params_v1_pb{region_params = RegionParams} = Params, + miner_lora_light:region_params_update(Region, RegionParams), + miner_onion_server_light:region_params_update(Region, RegionParams), + StreamState; +handle_msg({data, _Msg}, StreamState) -> + lager:warning("grpc client received unexpected msg ~p",[_Msg]), + StreamState. + +handle_info({retry_check_target, Attempt, Msg}, StreamState) when Attempt =< 3 -> + lager:debug("retry_check_target with attempt ~p for msg: ~p", [Attempt, Msg]), + {data, #gateway_resp_v1_pb{msg = {poc_challenge_resp, ChallengeNotification}, height = NotificationHeight, signature = ChallengerSig}} = Msg, + #gateway_poc_challenge_notification_resp_v1_pb{challenger = #routing_address_pb{uri = URI, pub_key = PubKeyBin}, block_hash = BlockHash, onion_key_hash = OnionKeyHash} = ChallengeNotification, + Self = self(), + F = fun()-> + TargetRes = miner_poc_grpc_client_statem:check_target(binary_to_list(URI), PubKeyBin, OnionKeyHash, BlockHash, NotificationHeight, ChallengerSig), + lager:info("check target result retry ~p for key ~p: ~p",[Attempt, OnionKeyHash, TargetRes]), + case TargetRes of + {ok, Result, _Details} -> + handle_check_target_resp(Result); + {error, <<"queued_poc">>} -> + erlang:send_after(5000, Self, {retry_check_target, Attempt +1, Msg}); + {error, _Reason, _Details} -> + ok; + {error, _Reason} -> + ok + end + end, + spawn(F), + StreamState; +handle_info(_Msg, StreamState) -> + lager:warning("grpc client unhandled msg: ~p", [_Msg]), + StreamState. + +%% ------------------------------------------------------------------ +%% Internal functions +%% ------------------------------------------------------------------ +-spec handle_check_target_resp(#gateway_poc_check_challenge_target_resp_v1_pb{})-> ok. +handle_check_target_resp(#gateway_poc_check_challenge_target_resp_v1_pb{target = true, onion = Onion} = _ChallengeResp) -> + ok = miner_onion_server_light:decrypt_p2p(Onion); +handle_check_target_resp(#gateway_poc_check_challenge_target_resp_v1_pb{target = false} = _ChallengeResp) -> + ok. + +-ifdef(TEST). +p2p_port_to_grpc_port(PeerAddr)-> + SwarmTID = blockchain_swarm:tid(), + Peerbook = libp2p_swarm:peerbook(SwarmTID), + {ok, _ConnAddr, {Transport, _TransportPid}} = libp2p_transport:for_addr(SwarmTID, PeerAddr), + {ok, PeerPubKeyBin} = Transport:p2p_addr(PeerAddr), + {ok, PeerInfo} = libp2p_peerbook:get(Peerbook, PeerPubKeyBin), + ListenAddrs = libp2p_peer:listen_addrs(PeerInfo), + [H | _ ] = libp2p_transport:sort_addrs(SwarmTID, ListenAddrs), + [_, _, _IP,_, Port] = _Full = re:split(H, "/"), + lager:info("*** peer p2p port ~p", [Port]), + {ok, list_to_integer(binary_to_list(Port)) + 1000}. +-endif. diff --git a/src/poc/miner_poc_grpc_client_statem.erl b/src/poc/miner_poc_grpc_client_statem.erl new file mode 100644 index 000000000..f82355b09 --- /dev/null +++ b/src/poc/miner_poc_grpc_client_statem.erl @@ -0,0 +1,540 @@ +-module(miner_poc_grpc_client_statem). +-behavior(gen_statem). + +%%-dialyzer({nowarn_function, process_unary_response/1}). +%%-dialyzer({nowarn_function, handle_info/2}). +%%-dialyzer({nowarn_function, build_config_req/1}). + + +-include("src/grpc/autogen/client/gateway_miner_client_pb.hrl"). +-include_lib("public_key/include/public_key.hrl"). +-include_lib("helium_proto/include/blockchain_txn_vars_v1_pb.hrl"). + +%% ------------------------------------------------------------------ +%% API Function Exports +%% ------------------------------------------------------------------ +-export([ + start_link/0, + stop/0, + connection/0, + check_target/6, + send_report/3, + send_report/4, + update_config/1 +]). + +%% ------------------------------------------------------------------ +%% gen_statem Function Exports +%% ------------------------------------------------------------------ +-export([ + init/1, + callback_mode/0, + terminate/2 +]). + +%% ------------------------------------------------------------------ +%% record defs and macros +%% ------------------------------------------------------------------ +-record(data, { + self_pub_key_bin, + self_sig_fun, + connection, + connection_pid, + conn_monitor_ref, + stream_poc_pid, + stream_poc_monitor_ref, + stream_config_update_pid, + stream_config_update_monitor_ref, + stream_region_params_update_pid, + stream_region_params_update_monitor_ref, + val_p2p_addr, + val_public_ip, + val_grpc_port +}). + +%% these are config vars the miner is interested in, if they change we +%% will want to get their latest values +-define(CONFIG_VARS, ["poc_version", "data_aggregation_version"]). + +%% delay between validator reconnects attempts +-define(VALIDATOR_RECONNECT_DELAY, 5000). +%% delay between stream reconnects attempts +-define(STREAM_RECONNECT_DELAY, 5000). + +-type data() :: #data{}. + +%% ------------------------------------------------------------------ +%% gen_statem callbacks Exports +%% ------------------------------------------------------------------ +-export([ + setup/3, + connected/3 +]). + +%% ------------------------------------------------------------------ +%% API Definitions +%% ------------------------------------------------------------------ +-spec start_link() -> {ok, pid()}. +start_link() -> + gen_statem:start_link({local, ?MODULE}, ?MODULE, [], []). + +-spec stop() -> ok. +stop() -> + gen_statem:stop(?MODULE). + +-spec connection() -> {ok, grpc_client_custom:connection()}. +connection() -> + gen_statem:call(?MODULE, connection, infinity). + +-spec check_target(string(), libp2p_crypto:pubkey_bin(), binary(), binary(), non_neg_integer(), libp2p_crypto:signature()) -> {error, any()} | {error, any(), map()} | {ok, any(), map()}. +check_target(ChallengerURI, ChallengerPubKeyBin, OnionKeyHash, BlockHash, NotificationHeight, ChallengerSig) -> + SelfPubKeyBin = blockchain_swarm:pubkey_bin(), + {ok, _, SelfSigFun, _} = blockchain_swarm:keys(), + %% split the URI into its IP and port parts + #{host := IP, port := Port, scheme := _Scheme} = uri_string:parse(ChallengerURI), + TargetIP = maybe_override_ip(IP), + %% build the request + Req = build_check_target_req(ChallengerPubKeyBin, OnionKeyHash, + BlockHash, NotificationHeight, ChallengerSig, SelfPubKeyBin, SelfSigFun), + send_grpc_unary_req(TargetIP, Port, Req, 'check_challenge_target'). + +-spec send_report(witness | receipt, any(), binary()) -> ok. +send_report(ReportType, Report, OnionKeyHash)-> + gen_statem:cast(?MODULE, {send_report, ReportType, Report, OnionKeyHash, 5}). + +-spec send_report(witness | receipt, any(), binary(), non_neg_integer()) -> ok. +send_report(ReportType, Report, OnionKeyHash, Retries)-> + gen_statem:cast(?MODULE, {send_report, ReportType, Report, OnionKeyHash, Retries}). + +-spec update_config([string()]) -> ok. +update_config(UpdatedKeys)-> + gen_statem:cast(?MODULE, {update_config, UpdatedKeys}). + +%% ------------------------------------------------------------------ +%% gen_statem Definitions +%% ------------------------------------------------------------------ +init(_Args) -> + lager:info("starting ~p", [?MODULE]), + erlang:process_flag(trap_exit, true), + SelfPubKeyBin = blockchain_swarm:pubkey_bin(), + {ok, _, SigFun, _} = blockchain_swarm:keys(), + {ok, setup, #data{self_pub_key_bin = SelfPubKeyBin, self_sig_fun = SigFun}}. + +callback_mode() -> [state_functions,state_enter]. + +terminate(_Reason, Data) -> + lager:info("terminating with reason ~p", [_Reason]), + _ = disconnect(Data), + ok. + +%% ------------------------------------------------------------------ +%% gen_statem callbacks +%% ------------------------------------------------------------------ +setup(enter, _OldState, Data)-> + %% each time we enter connecting_validator state we assume we are initiating a new + %% connection to a durable validators + %% thus ensure all streams are disconnected + ok = disconnect(Data), + erlang:send_after(?VALIDATOR_RECONNECT_DELAY, self(), find_validator), + {keep_state, + Data#data{val_public_ip = undefined, val_grpc_port = undefined, val_p2p_addr = undefined}}; +setup(info, find_validator, Data) -> + %% ask a random seed validator for the address of a 'proper' validator + %% we will then use this as our default durable validator + case find_validator() of + {error, _Reason} -> + {repeat_state, Data}; + {ok, ValIP, ValPort, ValP2P} -> + lager:info("*** Found validator with ip: ~p, port: ~p, addr: ~p", [ValIP, ValPort, ValP2P]), + {keep_state, + Data#data{val_public_ip = ValIP, val_grpc_port = ValPort, val_p2p_addr = ValP2P}, + [{next_event, info, connect_validator}]} + end; +setup(info, connect_validator, #data{val_public_ip = ValIP, val_grpc_port = ValGRPCPort, val_p2p_addr = ValP2P} = Data) -> + %% connect to our durable validator + case connect_validator(ValP2P, ValIP, ValGRPCPort) of + {ok, Connection} -> + #{http_connection := ConnectionPid} = Connection, + M = erlang:monitor(process, ConnectionPid), + {keep_state, + Data#data{connection = Connection, connection_pid = ConnectionPid, conn_monitor_ref = M}, + [{next_event, info, fetch_config}]}; + {error, _} -> + {repeat_state, Data} + end; +setup(info, fetch_config, #data{val_public_ip = ValIP, val_grpc_port = ValGRPCPort} = Data) -> + %% get necessary config data from our durable validator + case fetch_config(?CONFIG_VARS, ValIP, ValGRPCPort) of + ok -> + {keep_state, Data, [{next_event, info, connect_poc_stream}]}; + {error, _} -> + {repeat_state, Data} + end; +setup(info, connect_poc_stream, #data{connection = Connection, self_pub_key_bin = SelfPubKeyBin, self_sig_fun = SelfSigFun} = Data) -> + %% connect any required streams + %% we are interested in three streams, poc events, config change events, region params updates + case connect_stream_poc(Connection, SelfPubKeyBin, SelfSigFun) of + {ok, StreamPid} -> + M = erlang:monitor(process, StreamPid), + lager:info("monitoring stream poc pid ~p with ref ~p", [StreamPid, M]), + {keep_state, + Data#data{stream_poc_monitor_ref = M, stream_poc_pid = StreamPid}, + [{next_event, info, connect_config_stream}]}; + {error, _} -> + {repeat_state, Data} + end; +setup(info, connect_config_stream, #data{connection = Connection} = Data) -> + %% connect any required streams + %% we are interested in three streams, poc events, config change events, region params updates + case connect_stream_config_update(Connection) of + {ok, StreamPid} -> + M = erlang:monitor(process, StreamPid), + {keep_state, + Data#data{stream_config_update_monitor_ref = M, stream_config_update_pid = StreamPid}, + [{next_event, info, connect_region_params_stream}]}; + {error, _} -> + {repeat_state, Data} + end; +setup(info, connect_region_params_stream, #data{connection = Connection, self_pub_key_bin = SelfPubKeyBin, self_sig_fun = SelfSigFun} = Data) -> + %% connect any required streams + %% we are interested in three streams, poc events, config change events, region params updates + case connect_stream_region_params_update(Connection, SelfPubKeyBin, SelfSigFun) of + {ok, StreamPid} -> + M = erlang:monitor(process, StreamPid), + {next_state, connected, + Data#data{stream_region_params_update_monitor_ref = M, stream_region_params_update_pid = StreamPid}}; + {error, _} -> + {repeat_state, Data} + end; +setup(info, {'DOWN', _Ref, process, _, _Reason} = Event, Data) -> + lager:info("got down event ~p", [Event]), + %% handle down msgs, such as from our streams or validator connection + handle_down_event(setup, Event, Data); +setup({call, From}, _Msg, Data) -> + %% return an error for any call msgs whilst in setup state + {keep_state, Data, [{reply, From, {error, grpc_client_not_ready}}]}; +setup(_EventType, _Msg, Data) -> + %% ignore ev things else whist in setup state + lager:info("unhandled event whilst in ~p state: Type: ~p, Msg: ~p", [setup, _EventType, _Msg]), + {keep_state, Data}. + +connected(enter, _OldState, Data)-> + {keep_state, Data}; +connected(cast, {send_report, ReportType, Report, OnionKeyHash, RetryAttempts}, #data{connection = Connection, self_sig_fun = SelfSigFun, self_pub_key_bin = SelfPubKeyBin} = Data) -> + lager:info("send_report ~p with onionkeyhash ~p: ~p", [ReportType, OnionKeyHash, Report]), + ok = send_report(ReportType, Report, OnionKeyHash, SelfPubKeyBin, SelfSigFun, Connection, RetryAttempts), + {keep_state, Data}; +connected(cast, {update_config, Keys}, #data{val_public_ip = ValIP, val_grpc_port = ValPort} = Data) -> + lager:info("update_config for keys ~p", [Keys]), + _ = fetch_config(Keys, ValIP, ValPort), + {keep_state, Data}; +connected({call, From}, connection, #data{connection = Connection} = Data) -> + {keep_state, Data, [{reply, From, {ok, Connection}}]}; +connected(info, {'DOWN', _Ref, process, _, _Reason} = Event, Data) -> + lager:info("got down event ~p", [Event]), + %% handle down msgs, such as from our streams or validator connection + handle_down_event(connected, Event, Data); +connected(_EventType, _Msg, Data)-> + lager:info("unhandled event whilst in ~p state: Type: ~p, Msg: ~p", [connected, _EventType, _Msg]), + {keep_state, Data}. + +%% ------------------------------------------------------------------ +%% Internal functions +%% ------------------------------------------------------------------ +-spec disconnect(data())-> ok. +disconnect(_Data = #data{connection = undefined}) -> + ok; +disconnect(_Data = #data{connection = Connection}) -> + catch _ = grpc_client_custom:stop_connection(Connection), + ok. + +-spec find_validator() -> {error, any()} | {ok, string(), pos_integer(), string()}. +find_validator()-> + case application:get_env(miner, seed_validators) of + {ok, SeedValidators} -> + {_SeedP2PAddr, SeedValIP, SeedValGRPCPort} = lists:nth(rand:uniform(length(SeedValidators)), SeedValidators), + Req = build_validators_req(1), + case send_grpc_unary_req(SeedValIP, SeedValGRPCPort, Req, 'validators') of + {ok, #gateway_validators_resp_v1_pb{result = []}, _ReqDetails} -> + %% no routes, retry in a bit + lager:warning("failed to find any validator routing from seed validator ~p", [SeedValIP]), + {error, no_validators}; + {ok, #gateway_validators_resp_v1_pb{result = Routing}, _ReqDetails} -> + %% resp will contain the payload 'gateway_validators_resp_v1_pb' + [#routing_address_pb{pub_key = DurableValPubKeyBin, uri = DurableValURI}] = Routing, + DurableValP2PAddr = libp2p_crypto:pubkey_bin_to_p2p(DurableValPubKeyBin), + #{host := DurableValIP, port := DurableValGRPCPort} = uri_string:parse(binary_to_list(DurableValURI)), + {ok, DurableValIP, DurableValGRPCPort, DurableValP2PAddr}; + {error, Reason} = _Error -> + lager:warning("request to validator failed: ~p", [_Error]), + {error, Reason} + end; + _ -> + lager:warning("failed to find seed validators", []), + {error, find_validator_request_failed} + end. + +-spec connect_validator(string(), string(), pos_integer()) -> {error, any()} | {ok, grpc_client_custom:connection()}. +connect_validator(ValAddr, ValIP, ValPort) -> + try + lager:info("connecting to validator, p2paddr: ~p, ip: ~p, port: ~p", [ValAddr, ValIP, ValPort]), + case miner_poc_grpc_client_handler:connect(ValAddr, maybe_override_ip(ValIP), ValPort) of + {error, _} = Error -> + Error; + {ok, Connection} = Res-> + lager:info("successfully connected to validator via connection ~p", [Connection]), + Res + end + catch _Class:_Error:_Stack -> + lager:info("failed to connect to validator, will try again in a bit. Reason: ~p, Details: ~p, Stack: ~p", [_Class, _Error, _Stack]), + {error, connect_validator_failed} + end. + +-spec connect_stream_poc(grpc_client_custom:connection(), libp2p_crypto:pubkey_bin(), function()) -> {error, any()} | {ok, pid()}. +connect_stream_poc(Connection, SelfPubKeyBin, SelfSigFun) -> + lager:debug("establishing POC stream on connection ~p", [Connection]), + case miner_poc_grpc_client_handler:poc_stream(Connection, SelfPubKeyBin, SelfSigFun) of + {error, _Reason} = Error-> + Error; + {ok, Stream} = Res-> + lager:info("successfully connected poc stream ~p on connection ~p", [Stream, Connection]), + Res + end. + +-spec connect_stream_config_update(grpc_client_custom:connection()) -> {error, any()} | {ok, pid()}. +connect_stream_config_update(Connection) -> + lager:debug("establishing config_update stream on connection ~p", [Connection]), + case miner_poc_grpc_client_handler:config_update_stream(Connection) of + {error, _Reason} = Error-> + Error; + {ok, Stream} = Res-> + lager:info("successfully connected config update stream ~p on connection ~p", [Stream, Connection]), + Res + end. + +-spec connect_stream_region_params_update(grpc_client_custom:connection(), libp2p_crypto:pubkey_bin(), function()) -> {error, any()} | {ok, pid()}. +connect_stream_region_params_update(Connection, SelfPubKeyBin, SelfSigFun) -> + lager:debug("establishing region_params_update stream on connection ~p", [Connection]), + case miner_poc_grpc_client_handler:region_params_update_stream(Connection, SelfPubKeyBin, SelfSigFun) of + {error, _Reason} = Error-> + Error; + {ok, Stream} = Res-> + lager:info("successfully connected region params update stream ~p on connection ~p", [Stream, Connection]), + Res + end. + +-spec send_report(witness | receipt, any(), binary(), libp2p_crypto:pubkey_bin(), function(), grpc_client_custom:connection(), non_neg_integer()) -> ok. +send_report(_ReportType, _Report, _OnionKeyHash, _SelfPubKeyBin, _SigFun, _Connection, 0) -> + ok; +send_report(receipt = ReportType, Report, OnionKeyHash, _SelfPubKeyBin, SigFun, Connection, RetryAttempts) -> + EncodedReceipt = gateway_miner_client_pb:encode_msg(Report#blockchain_poc_receipt_v1_pb{signature = <<>>}, blockchain_poc_receipt_v1_pb), + SignedReceipt = Report#blockchain_poc_receipt_v1_pb{signature = SigFun(EncodedReceipt)}, + Req = #gateway_poc_report_req_v1_pb{ + onion_key_hash = OnionKeyHash, + msg = {ReportType, SignedReceipt}}, + do_send_report(Req, ReportType, Report, OnionKeyHash, Connection, RetryAttempts); +send_report(witness = ReportType, Report, OnionKeyHash, _SelfPubKeyBin, SigFun, Connection, RetryAttempts) -> + EncodedWitness = gateway_miner_client_pb:encode_msg(Report#blockchain_poc_witness_v1_pb{signature = <<>>}, blockchain_poc_witness_v1_pb), + SignedWitness = Report#blockchain_poc_witness_v1_pb{signature = SigFun(EncodedWitness)}, + Req = #gateway_poc_report_req_v1_pb{ + onion_key_hash = OnionKeyHash, + msg = {ReportType, SignedWitness}}, + do_send_report(Req, ReportType, Report, OnionKeyHash, Connection, RetryAttempts). + +-spec do_send_report(binary(), witness | receipt, any(), binary(), grpc_client_custom:connection(), non_neg_integer()) -> ok. +do_send_report(Req, ReportType, Report, OnionKeyHash, Connection, RetryAttempts) -> + %% ask validator for public uri of the challenger of this POC + case get_uri_for_challenger(OnionKeyHash, Connection) of + {ok, {IP, Port}} -> + %% send the report to our challenger + case send_grpc_unary_req(IP, Port, Req, 'send_report') of + {ok, _} -> + ok; + _ -> + ?MODULE:send_report(ReportType, Report, OnionKeyHash, RetryAttempts - 1) + end; + {error, _Reason} -> + ?MODULE:send_report(ReportType, Report, OnionKeyHash, RetryAttempts - 1) + end, + ok. + +-spec fetch_config([string()], string(), pos_integer()) -> {error, any()} | ok. +fetch_config(UpdatedKeys, ValIP, ValGRPCPort) -> + %% filter out keys we are not interested in + %% and then ask our validator for current values + %% for remaining keys + FilteredKeys = lists:filter(fun(K)-> lists:member(K, ?CONFIG_VARS) end, UpdatedKeys), + case FilteredKeys of + [] -> ok; + _ -> + %% retrieve some config from the returned validator + Req2 = build_config_req(FilteredKeys), + case send_grpc_unary_req(ValIP, ValGRPCPort, Req2, 'config') of + {ok, #gateway_config_resp_v1_pb{result = Vars}, _Req2Details} -> + [ + begin + {Name, Value} = blockchain_txn_vars_v1:from_var(Var), + application:set_env(miner, list_to_atom(Name), Value) + end || #blockchain_var_v1_pb{} = Var <- Vars], + ok; + {error, Reason, _Details} -> + {error, Reason}; + {error, Reason} -> + {error, Reason} + end + end. + +-spec send_grpc_unary_req(grpc_client_custom:connection(), any(), atom())-> {error, any(), map()} | {error, any()} | {ok, any(), map()} | {ok, map()}. +send_grpc_unary_req(undefined, _Req, _RPC) -> + {error, no_grpc_connection}; +send_grpc_unary_req(Connection, Req, RPC) -> + try + lager:info("send unary request: ~p", [Req]), + Res = grpc_client_custom:unary( + Connection, + Req, + 'helium.gateway', + RPC, + gateway_miner_client_pb, + [{callback_mod, miner_poc_grpc_client_handler}] + ), + lager:info("send unary result: ~p", [Res]), + process_unary_response(Res) + catch + _Class:_Error:_Stack -> + lager:warning("send unary failed: ~p, ~p, ~p", [_Class, _Error, _Stack]), + {error, req_failed} + end. + +-spec send_grpc_unary_req(string(), non_neg_integer(), any(), atom()) -> {error, any(), map()} | {error, any()} | {ok, any(), map()} | {ok, map()}. +send_grpc_unary_req(PeerIP, GRPCPort, Req, RPC)-> + try + lager:info("Send unary request via new connection to ip ~p: ~p", [PeerIP, Req]), + {ok, Connection} = grpc_client_custom:connect(tcp, maybe_override_ip(PeerIP), GRPCPort), + + Res = grpc_client_custom:unary( + Connection, + Req, + 'helium.gateway', + RPC, + gateway_miner_client_pb, + [{callback_mod, miner_poc_grpc_client_handler}] + ), + lager:info("New Connection, send unary result: ~p", [Res]), + %% we dont need the connection to hang around, so close it out + catch _ = grpc_client_custom:stop_connection(Connection), + process_unary_response(Res) + catch + _Class:_Error:_Stack -> + lager:warning("send unary failed: ~p, ~p, ~p", [_Class, _Error, _Stack]), + {error, req_failed} + end. + +-spec build_check_target_req(libp2p_crypto:pubkey_bin(), binary(), binary(), non_neg_integer(), binary(), libp2p_crypto:pubkey_bin(), function()) -> #gateway_poc_check_challenge_target_req_v1_pb{}. +build_check_target_req(ChallengerPubKeyBin, OnionKeyHash, BlockHash, ChallengeHeight, ChallengerSig, SelfPubKeyBin, SelfSigFun) -> + Req = #gateway_poc_check_challenge_target_req_v1_pb{ + address = SelfPubKeyBin, + challenger = ChallengerPubKeyBin, + block_hash = BlockHash, + onion_key_hash = OnionKeyHash, + height = ChallengeHeight, + notifier = ChallengerPubKeyBin, + notifier_sig = ChallengerSig, + challengee_sig = <<>> + }, + ReqEncoded = gateway_miner_client_pb:encode_msg(Req, gateway_poc_check_challenge_target_req_v1_pb), + Req#gateway_poc_check_challenge_target_req_v1_pb{challengee_sig = SelfSigFun(ReqEncoded)}. + +-spec build_validators_req(Quantity:: pos_integer()) -> #gateway_validators_req_v1_pb{}. +build_validators_req(Quantity) -> + #gateway_validators_req_v1_pb{ + quantity = Quantity + }. + +-spec build_config_req([string()]) -> #gateway_config_req_v1_pb{}. +build_config_req(Keys) -> + #gateway_config_req_v1_pb{ keys = Keys}. + +-spec build_poc_challenger_req(binary()) -> #gateway_poc_key_routing_data_req_v1_pb{}. +build_poc_challenger_req(OnionKeyHash) -> + #gateway_poc_key_routing_data_req_v1_pb{ key = OnionKeyHash}. + +%% TODO: return a better and consistent response +%%-spec process_unary_response(grpc_client_custom:unary_response()) -> {error, any(), map()} | {error, any()} | {ok, any(), map()} | {ok, map()}. +process_unary_response({ok, #{http_status := 200, result := #gateway_resp_v1_pb{msg = {success_resp, _Payload}, height = Height, signature = Sig}}}) -> + {ok, #{height => Height, signature => Sig}}; +process_unary_response({ok, #{http_status := 200, result := #gateway_resp_v1_pb{msg = {error_resp, Details}, height = Height, signature = Sig}}}) -> + #gateway_error_resp_pb{error = ErrorReason} = Details, + {error, ErrorReason, #{height => Height, signature => Sig}}; +process_unary_response({ok, #{http_status := 200, result := #gateway_resp_v1_pb{msg = {_RespType, Payload}, height = Height, signature = Sig}}}) -> + {ok, Payload, #{height => Height, signature => Sig}}; +process_unary_response({error, ClientError = #{error_type := 'client'}}) -> + lager:warning("grpc error response ~p", [ClientError]), + {error, grpc_client_error}; +process_unary_response({error, ClientError = #{error_type := 'grpc', http_status := 200, status_message := ErrorMsg}}) -> + lager:warning("grpc error response ~p", [ClientError]), + {error, ErrorMsg}; +process_unary_response(_Response) -> + lager:warning("unhandled grpc response ~p", [_Response]), + {error, unexpected_response}. + +handle_down_event(_CurState, {'DOWN', Ref, process, _, Reason}, Data = #data{conn_monitor_ref = Ref, connection = Connection}) -> + lager:warning("GRPC connection to validator is down, reconnecting. Reason: ~p", [Reason]), + _ = grpc_client_custom:stop_connection(Connection), + %% if the connection goes down, enter setup state to reconnect + {next_state, setup, Data}; +handle_down_event(_CurState, {'DOWN', Ref, process, _, Reason} = Event, Data = #data{stream_poc_monitor_ref = Ref, + connection = Connection, + self_pub_key_bin = SelfPubKeyBin, + self_sig_fun = SelfSigFun}) -> + %% the poc stream is meant to be long lived, we always want it up as long as we have a grpc connection + %% so if it goes down start it back up again + lager:warning("poc stream to validator is down, reconnecting. Reason: ~p", [Reason]), + case connect_stream_poc(Connection, SelfPubKeyBin, SelfSigFun) of + {ok, StreamPid} -> + M = erlang:monitor(process, StreamPid), + {keep_state, Data#data{stream_poc_monitor_ref = M, stream_poc_pid = StreamPid}}; + {error, _} -> + %% if stream reconnnect fails, replay the orig down msg to trigger another attempt + %% NOTE: not using transition actions below as want a delay before the msgs get processed again + erlang:send_after(?STREAM_RECONNECT_DELAY, self(), Event), + {keep_state, Data} + end; +handle_down_event(_CurState, {'DOWN', Ref, process, _, Reason} = Event, Data = #data{stream_config_update_monitor_ref = Ref, + connection = Connection}) -> + %% the config_update stream is meant to be long lived, we always want it up as long as we have a grpc connection + %% so if it goes down start it back up again + lager:warning("config_update stream to validator is down, reconnecting. Reason: ~p", [Reason]), + case connect_stream_config_update(Connection) of + {ok, StreamPid} -> + M = erlang:monitor(process, StreamPid), + {keep_state, Data#data{stream_config_update_monitor_ref = M, stream_config_update_pid = StreamPid}}; + {error, _} -> + %% if stream reconnnect fails, replay the orig down msg to trigger another attempt + %% NOTE: not using transition actions below as want a delay before the msgs get processed again + erlang:send_after(?STREAM_RECONNECT_DELAY, self(), Event), + {keep_state, Data} + end. + +-spec get_uri_for_challenger(binary(), grpc_client_custom:connection()) -> {ok, {string(), pos_integer()}} | {error, any()}. +get_uri_for_challenger(OnionKeyHash, Connection)-> + Req = build_poc_challenger_req(OnionKeyHash), + case send_grpc_unary_req(Connection, Req, 'poc_key_to_public_uri') of + {ok, #gateway_public_routing_data_resp_v1_pb{public_uri = URIData}, _Req2Details} -> + #routing_address_pb{uri = URI, pub_key = _PubKey} = URIData, + #{host := IP, port := Port} = uri_string:parse(binary_to_list(URI)), + {ok, {IP, Port}}; + {error, Reason, _Details} -> + {error, Reason}; + {error, Reason} -> + {error, Reason} + end. + +-ifdef(TEST). +maybe_override_ip(_IP)-> + "127.0.0.1". +-else. +maybe_override_ip(IP)-> + IP. +-endif. + diff --git a/src/poc/miner_poc_mgr.erl b/src/poc/miner_poc_mgr.erl new file mode 100644 index 000000000..b52d6b6ef --- /dev/null +++ b/src/poc/miner_poc_mgr.erl @@ -0,0 +1,1111 @@ +%%%------------------------------------------------------------------- +%%% @doc +%%% listens for block events, inspects the POCs in the block metadata +%%% and for each of our own keys which made it into the block +%%% kick off a POC +%%% @end +%%%------------------------------------------------------------------- +-module(miner_poc_mgr). + +-behaviour(gen_server). + +-include_lib("blockchain/include/blockchain_vars.hrl"). +-include_lib("public_key/include/public_key.hrl"). + +-define(ACTIVE_POCS, active_pocs). +-define(KEYS, keys). +-define(KEY_PROPOSALS, key_proposals). +-define(ADDR_HASH_FP_RATE, 1.0e-9). +-define(POC_DB_CF, {?MODULE, poc_db_cf_handle}). +-ifdef(TEST). +%% lifespan of a POC, after which we will +%% submit the receipts txn and delete the local poc data +-define(POC_TIMEOUT, 4). +-else. +-define(POC_TIMEOUT, 10). +-endif. + + +%% ------------------------------------------------------------------ +%% API exports +%% ------------------------------------------------------------------ +-export([ + start_link/1, + make_ets_table/0, + cached_local_poc_key/1, + save_local_poc_keys/2, + check_target/3, + report/4, + active_pocs/0, + local_poc_key/1, + local_poc/1, + save_poc_key_proposals/3, + delete_cached_local_poc_key_proposal/1, + get_random_poc_key_proposals/2, + cached_local_poc_key_proposals/0 +]). +%% ------------------------------------------------------------------ +%% gen_server exports +%% ------------------------------------------------------------------ +-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2]). + +%% ------------------------------------------------------------------ +%% record defs and macros +%% ------------------------------------------------------------------ +-record(addr_hash_filter, { + start :: pos_integer(), + height :: pos_integer(), + byte_size :: pos_integer(), + salt :: binary(), + bloom :: bloom_nif:bloom() +}). + +-record(poc_local_key_data, { + receive_height :: non_neg_integer(), + keys :: keys() +}). + +-record(poc_key_proposal, { + receive_height :: non_neg_integer(), + key :: key_proposal(), + address :: libp2p_crypto:pubkey_bin() +}). + +-record(local_poc, { + onion_key_hash :: binary(), + block_hash :: binary() | undefined, + keys :: keys() | undefined, + target :: libp2p_crypto:pubkey_bin(), + onion :: binary() | undefined, + secret :: binary() | undefined, + responses = #{}, + challengees = [] :: [libp2p_crypto:pubkey_bin()], + packet_hashes = [] :: [{libp2p_crypto:pubkey_bin(), binary()}], + start_height :: non_neg_integer() +}). + +-record(state, { + db :: rocksdb:db_handle(), + cf :: rocksdb:cf_handle(), + chain :: undefined | blockchain:blockchain(), + ledger :: undefined | blockchain:ledger(), + sig_fun :: undefined | libp2p_crypto:sig_fun(), + pub_key = undefined :: undefined | libp2p_crypto:pubkey_bin(), + addr_hash_filter :: undefined | #addr_hash_filter{} +}). +-type state() :: #state{}. +-type keys() :: #{secret => libp2p_crypto:privkey(), public => libp2p_crypto:pubkey()}. +-type poc_key() :: binary(). +-type cached_local_poc_local_key_data() :: #poc_local_key_data{}. +-type cached_local_poc_key_type() :: {POCKey :: poc_key(), POCKeyData :: #poc_local_key_data{}}. +-type key_proposals() :: [key_proposal()]. +-type key_proposal() :: binary(). +-type cached_key_proposal() :: #poc_key_proposal{}. + +-type local_poc() :: #local_poc{}. +-type local_pocs() :: [local_poc()]. +-type local_poc_key() :: binary(). + +-export_type([keys/0, local_poc_key/0, cached_local_poc_local_key_data/0, cached_local_poc_key_type/0, local_poc/0, local_pocs/0]). + +%% ------------------------------------------------------------------ +%% API functions +%% ------------------------------------------------------------------ + +-spec local_poc_key(local_poc()) -> local_poc_key(). +local_poc_key(LocalPoC) -> + LocalPoC#local_poc.onion_key_hash. + +-spec start_link(#{}) -> {ok, pid()}. +start_link(Args) when is_map(Args) -> + case gen_server:start_link({local, ?MODULE}, ?MODULE, Args, []) of + {ok, Pid} -> + %% if we have an ETS table reference, give ownership to the new process + %% we likely are the `heir', so we'll get it back if this process dies + case maps:find(tab1, Args) of + error -> + ok; + {ok, Tab1} -> + true = ets:give_away(Tab1, Pid, undefined) + end, + case maps:find(tab2, Args) of + error -> + ok; + {ok, Tab2} -> + true = ets:give_away(Tab2, Pid, undefined) + end, + {ok, Pid}; + Other -> + Other + end. + +-spec make_ets_table() -> [atom()]. +make_ets_table() -> + Tab1 = ets:new( + ?KEYS, + [ + named_table, + public, + {heir, self(), undefined} + ] + ), + Tab2 = ets:new( + ?KEY_PROPOSALS, + [ + named_table, + public, + {heir, self(), undefined} + ] + ), + [Tab1, Tab2]. + +-spec save_local_poc_keys(CurHeight :: non_neg_integer(), [keys()]) -> ok. +save_local_poc_keys(CurHeight, KeyList) -> + %% these are the keys ( public & private ) generated by this validator + %% as part of submitting a new heartbeat + %% push each key set to ets with a hash of the public key as key + %% each new block we will then check if any of our cached keys made it into the block + %% and if so retrieve the private key for each + [ + begin + #{public := PubKey} = Keys, + OnionKeyHash = crypto:hash(sha256, libp2p_crypto:pubkey_to_bin(PubKey)), + POCKeyRec = #poc_local_key_data{receive_height = CurHeight, keys = Keys}, + lager:info("caching local poc keys with hash ~p", [OnionKeyHash]), + _ = cache_poc_key(OnionKeyHash, POCKeyRec) + end + || Keys <- KeyList + ], + ok. + +-spec cached_local_poc_key(poc_key()) -> {ok, cached_local_poc_key_type()} | false. +cached_local_poc_key(ID) -> + case ets:lookup(?KEYS, ID) of + [Res] -> {ok, Res}; + _ -> false + end. + +-spec active_pocs()->[local_poc()]. +active_pocs() -> + gen_server:call(?MODULE, {active_pocs}). + +-spec check_target( + Challengee :: libp2p_crypto:pubkey_bin(), + BlockHash :: binary(), + OnionKeyHash :: binary() +) -> false | {true, binary()} | {error, any()}. +check_target(Challengee, BlockHash, OnionKeyHash) -> + lager:info("*** check target with key ~p", [OnionKeyHash]), + LocalPOC = e2qc:cache( + local_pocs, + OnionKeyHash, + 30, + fun() -> ?MODULE:local_poc(OnionKeyHash) end + ), + lager:info("*** e2qc local POC check target result ~p", [LocalPOC]), + Res = + case LocalPOC of + {error, not_found} -> + %% if the cache returns not found it could be the poc has not yet been initialized + %% so check if we have a cached local POC key. + %% These are added when a val HB is submitted by the local node + %% if such a key exists its an indication the POC may not yet have been initialized + %% OR the e2qc cache was called before the POC was initialised and it + %% has cached the {error, not_found} term + %% so if we have the key then check rocks again, + %% if still not available then its likely the POC hasnt been initialized + %% if found then invalidate the e2qc cache + %% TODO: do the assumptions above still hold true with the val pool generating challenges + %% rather than the CG generating challenges ? + case cached_local_poc_key(OnionKeyHash) of + {ok, {_KeyHash, _POCData}} -> + %% the submitted key is one of this nodes local keys + lager:info("*** ~p is a known key ~p", [OnionKeyHash]), + case ?MODULE:local_poc(OnionKeyHash) of + {error, _} -> + %% clients should retry after a period of time + {error, <<"queued_poc">>}; + {ok, #local_poc{block_hash = BlockHash, target = Challengee, onion = Onion}} -> + e2qc:evict(local_pocs, OnionKeyHash), + {true, Onion}; + {ok, #local_poc{block_hash = BlockHash, target = _OtherTarget}} -> + e2qc:evict(local_pocs, OnionKeyHash), + false; + {ok, #local_poc{block_hash = _OtherBlockHash, target = _Target}} -> + e2qc:evict(local_pocs, OnionKeyHash), + {error, mismatched_block_hash} + end; + _ -> + lager:info("*** ~p is NOT a known key", [OnionKeyHash]), + {error, <<"invalid_or_expired_poc">>} + end; + {ok, #local_poc{block_hash = BlockHash, target = Challengee, onion = Onion}} -> + {true, Onion}; + {ok, #local_poc{block_hash = BlockHash, target = _OtherTarget}} -> + false; + {ok, #local_poc{block_hash = _OtherBlockHash, target = _Target}} -> + {error, mismatched_block_hash}; + _ -> + false + end, + lager:info("*** check target result for key ~p: ~p", [OnionKeyHash, Res]), + Res. + +-spec report( + Report :: {witness, blockchain_poc_witness_v1:poc_witness()} | {receipt, blockchain_poc_receipt_v1:receipt()}, + OnionKeyHash :: binary(), + Peer :: libp2p_crypto:pubkey_bin(), + P2PAddr :: libp2p_crypto:peer_id()) -> ok. +report(Report, OnionKeyHash, Peer, P2PAddr) -> + gen_server:cast(?MODULE, {Report, OnionKeyHash, Peer, P2PAddr}). + +-spec local_poc(OnionKeyHash :: binary()) -> + {ok, local_poc()} | {error, any()}. +local_poc(OnionKeyHash) -> + case persistent_term:get(?POC_DB_CF, not_found) of + not_found -> {error, not_found}; + {DB, CF} -> + case rocksdb:get(DB, CF, OnionKeyHash, []) of + {ok, Bin} -> + [POC] = erlang:binary_to_term(Bin), + {ok, POC}; + not_found -> + {error, not_found}; + Error -> + lager:error("error: ~p", [Error]), + Error + end + end. + +-spec save_poc_key_proposals(libp2p_crypto:pubkey_bin(), key_proposals(), pos_integer()) -> ok. +save_poc_key_proposals(Address, KeyProposals, Height) -> + %% these are key proposals submitted by *any* validator via their heartbeat + %% save_poc_key_proposals/3 is called when absorbing a heartbeat + %% we add the proposed keys to this local cache + %% and from this cache a random set of keys will be selected as part of + %% block proposals by the consensus group + [ + begin + POCKeyProposalRec = #poc_key_proposal{ + receive_height = Height, + address = Address, + key = KeyProposal + }, + lager:debug("caching poc key proposal ~p", [KeyProposal]), + _ = cache_poc_key_proposal(KeyProposal, POCKeyProposalRec) + end + || KeyProposal <- KeyProposals + ], + ok. + +-spec delete_cached_local_poc_key_proposal(key_proposal()) -> ok. +delete_cached_local_poc_key_proposal(KeyProposal) -> + true = ets:delete(?KEY_PROPOSALS, KeyProposal), + ok. + +-spec get_random_poc_key_proposals(pos_integer(), blockchain:ledger()) -> + [{libp2p_crypto:pubkey_bin(), key_proposal()}]. +get_random_poc_key_proposals(NumKeys, Ledger) -> + Keys = cached_local_poc_key_proposals(), + ShuffledKeys = blockchain_utils:shuffle(Keys), + {ok, CGMembers} = blockchain_ledger_v1:consensus_members(Ledger), + do_get_random_poc_key_proposals(NumKeys, CGMembers, ShuffledKeys). + +%% ------------------------------------------------------------------ +%% gen_server functions +%% ------------------------------------------------------------------ +init(_Args) -> + lager:info("starting ~p", [?MODULE]), + erlang:send_after(500, self(), init), + {ok, PubKey, SigFun, _ECDHFun} = blockchain_swarm:keys(), + SelfPubKeyBin = libp2p_crypto:pubkey_to_bin(PubKey), + DB = miner_poc_mgr_db_owner:db(), + CF = miner_poc_mgr_db_owner:poc_mgr_cf(), + ok = persistent_term:put(?POC_DB_CF, {DB, CF}), + {ok, #state{ + db = DB, + cf = CF, + sig_fun = SigFun, + pub_key = SelfPubKeyBin + }}. + +handle_call({active_pocs}, _From, State = #state{}) -> + {reply, local_pocs(State), State}; +handle_call(_Request, _From, State = #state{}) -> + {reply, ok, State}. + +handle_cast({{witness, Witness}, OnionKeyHash, Peer, _PeerAddr}, State) -> + handle_witness(Witness, OnionKeyHash, Peer, State); +handle_cast({{receipt, Receipt}, OnionKeyHash, Peer, PeerAddr}, State) -> + handle_receipt(Receipt, OnionKeyHash, Peer, PeerAddr, State); +handle_cast(_Request, State) -> + {noreply, State}. + +handle_info(init, #state{chain = undefined} = State) -> + %% No chain + case blockchain_worker:blockchain() of + undefined -> + erlang:send_after(500, self(), init), + {noreply, State}; + Chain -> + ok = blockchain_event:add_handler(self()), + Ledger = blockchain:ledger(Chain), + ok = miner_poc:add_stream_handler(blockchain_swarm:tid(), miner_poc_report_handler), + SelfPubKeyBin = blockchain_swarm:pubkey_bin(), + {noreply, State#state{ + chain = Chain, + ledger = Ledger, + pub_key = SelfPubKeyBin + }} + end; +handle_info(init, State) -> + {noreply, State}; +handle_info({blockchain_event, {new_chain, NC}}, State) -> + {noreply, State#state{chain = NC}}; +handle_info({blockchain_event, _Event}, #state{chain = undefined} = State)-> + {noreply, State}; +handle_info( + {blockchain_event, {add_block, BlockHash, Sync, Ledger} = _Event}, + #state{chain = Chain} = State +)-> + CurPOCChallengerType = + case blockchain:config(?poc_challenger_type, Ledger) of + {ok, V} -> V; + _ -> undefined + end, + lager:info("received add block event, sync is ~p, poc_challenge_type is ~p", [Sync, CurPOCChallengerType]), + State1 = maybe_init_addr_hash(State), + ok = handle_add_block_event(CurPOCChallengerType, BlockHash, Chain, State1), + {noreply, State1}; +handle_info(_Info, State = #state{}) -> + {noreply, State}. + +terminate(_Reason, _State = #state{}) -> + persistent_term:erase(?POC_DB_CF), + ok. + +%%%=================================================================== +%%% breakout functions +%%%=================================================================== +-spec handle_add_block_event( + POCChallengeType :: validator | undefined, + BlockHash :: binary(), + Chain :: blockchain:blockchain(), + State :: state() +) -> ok. +handle_add_block_event(POCChallengeType, BlockHash, Chain, State) when POCChallengeType == validator -> + case blockchain:get_block(BlockHash, Chain) of + {ok, Block} -> + %% save public data on each POC key found in the block to the ledger + %% that way all validators have access to this public data + %% however the validator which is running the POC will be the only node + %% which has the secret + ok = process_block_pocs(BlockHash, Block, State), + %% take care of GC + ok = purge_local_pocs(Block, State), + BlockHeight = blockchain_block:height(Block), + Ledger = blockchain:ledger(Chain), + %% GC local pocs keys every 50 blocks + case BlockHeight rem 50 == 0 of + true -> + ok = purge_local_poc_keys(BlockHeight, Ledger); + false -> + ok + end, + %% GC pocs key proposals every 60 blocks + case BlockHeight rem 60 == 0 of + true -> + ok = purge_pocs_key_proposals(BlockHeight, Ledger); + false -> + ok + end; + + _ -> + %% err what? + ok + end; +handle_add_block_event(_POCChallengeType, _BlockHash, _Chain, _State) -> + ok. + +-spec handle_witness( + Witness :: blockchain_poc_witness_v1:poc_witness(), + OnionKeyHash :: binary(), + Address :: libp2p_crypto:pubkey_bin(), + State :: #state{} +) -> {noreply, state()}. +handle_witness(Witness, OnionKeyHash, Peer, #state{chain = Chain} = State) -> + lager:info("got witness ~p with onionkeyhash ~p", [Witness, OnionKeyHash]), + %% Validate the witness is correct + Ledger = blockchain:ledger(Chain), + case validate_witness(Witness, Ledger) of + false -> + lager:warning("ignoring witness ~p for onionkeyhash ~p. Reason: invalid", [Witness, OnionKeyHash]), + {noreply, State}; + true -> + %% get the local POC + case ?MODULE:local_poc(OnionKeyHash) of + {error, _} -> + lager:warning("ignoring witness ~p for onionkeyhash ~p. Reason: no local_poc", [Witness, OnionKeyHash]), + {noreply, State}; + {ok, #local_poc{packet_hashes = PacketHashes, responses = Response0} = POC} -> + PacketHash = blockchain_poc_witness_v1:packet_hash(Witness), + GatewayWitness = blockchain_poc_witness_v1:gateway(Witness), + %% check this is a known layer of the packet + case lists:keyfind(PacketHash, 2, PacketHashes) of + false -> + lager:warning("Saw invalid witness with packet hash ~p and onionkeyhash ~p", [PacketHash, OnionKeyHash]), + {noreply, State}; + {GatewayWitness, PacketHash} -> + lager:warning("Saw self-witness from ~p for onionkeyhash ~p", [GatewayWitness, OnionKeyHash]), + {noreply, State}; + _ -> + Witnesses = maps:get(PacketHash, Response0, []), + PerHopMaxWitnesses = blockchain_utils:poc_per_hop_max_witnesses(Ledger), + case erlang:length(Witnesses) >= PerHopMaxWitnesses of + true -> + lager:warning("ignoring witness ~p for onionkeyhash ~p. Reason: exceeded per hop max witnesses", [Witness, OnionKeyHash]), + {noreply, State}; + false -> + %% Don't allow putting duplicate response in the witness list resp + Predicate = fun({_, W}) -> + blockchain_poc_witness_v1:gateway(W) == GatewayWitness + end, + Responses1 = + case lists:any(Predicate, Witnesses) of + false -> + maps:put( + PacketHash, + lists:keystore( + Peer, + 1, + Witnesses, + {Peer, Witness} + ), + Response0 + ); + true -> + Response0 + end, + UpdatedPOC = POC#local_poc{responses = Responses1}, + ok = write_local_poc(UpdatedPOC, State), + {noreply, State} + end + end + end + end. + +-spec handle_receipt( + Receipt :: blockchain_poc_receipt_v1:receipt(), + OnionKeyHash :: binary(), + Peer :: libp2p_crypto:pubkey_bin(), + PeerAddr :: libp2p_crypto:peer_id(), + State :: #state{} +) -> {noreply, state()}. +handle_receipt(Receipt, OnionKeyHash, Peer, PeerAddr, #state{chain = Chain} = State) -> + lager:info("got receipt ~p with onionkeyhash ~p", [Receipt, OnionKeyHash]), + Gateway = blockchain_poc_receipt_v1:gateway(Receipt), + LayerData = blockchain_poc_receipt_v1:data(Receipt), + Ledger = blockchain:ledger(Chain), + case blockchain_poc_receipt_v1:is_valid(Receipt, Ledger) of + false -> + lager:warning("ignoring invalid receipt ~p for onionkeyhash", [Receipt, OnionKeyHash]), + {noreply, State}; + true -> + %% get the POC data from the cache + case ?MODULE:local_poc(OnionKeyHash) of + {error, _} -> + lager:warning("ignoring receipt ~p for onionkeyhash ~p. Reason: no local_poc", [Receipt, OnionKeyHash]), + {noreply, State}; + {ok, #local_poc{challengees = Challengees, responses = Response0} = POC} -> + case lists:keyfind(Gateway, 1, Challengees) of + {Gateway, LayerData} -> + case maps:get(Gateway, Response0, undefined) of + undefined -> + IsFirstChallengee = + case hd(Challengees) of + {Gateway, _} -> + true; + _ -> + false + end, + %% compute address hash and compare to known ones + %% TODO - This needs refactoring, wont work as is + case check_addr_hash(PeerAddr, State) of + true when IsFirstChallengee -> + %% drop whole challenge because we should always be able to get the first hop's receipt + %% TODO: delete the cached POC here? + {noreply, State}; + true -> + {noreply, State}; + undefined -> + Responses1 = maps:put( + Gateway, + {Peer, Receipt}, + Response0 + ), + UpdatedPOC = POC#local_poc{responses = Responses1}, + ok = write_local_poc(UpdatedPOC, State), + {noreply, State}; + PeerHash -> + Responses1 = maps:put( + Gateway, + {Peer, + blockchain_poc_receipt_v1:addr_hash( + Receipt, + PeerHash + )}, + Response0 + ), + UpdatedPOC = POC#local_poc{responses = Responses1}, + ok = write_local_poc(UpdatedPOC, State), + {noreply, State} + end; + _ -> + lager:warning("Already got this receipt ~p for ~p ignoring", [ + Receipt, + Gateway + ]), + {noreply, State} + end; + {Gateway, OtherData} -> + lager:warning("Got incorrect layer data ~p from ~p (expected ~p) for onionkeyhash ~p", [ + Gateway, + OtherData, + Receipt, + OnionKeyHash + ]), + {noreply, State}; + false -> + lager:warning("Got unexpected receipt from ~p for onionkeyhash", [Gateway, OnionKeyHash]), + {noreply, State} + end + end + end. + +%% ------------------------------------------------------------------ +%% Internal functions +%% ------------------------------------------------------------------ +initialize_poc(BlockHash, POCStartHeight, Keys, Vars, #state{chain = Chain, pub_key = Challenger} = State) -> + Ledger = blockchain:ledger(Chain), + #{public := OnionCompactKey, secret := {ecc_compact, POCPrivKey}} = Keys, + POCPubKeyBin = libp2p_crypto:pubkey_to_bin(OnionCompactKey), + #'ECPrivateKey'{privateKey = PrivKeyBin} = POCPrivKey, + POCPrivKeyHash = crypto:hash(sha256, PrivKeyBin), + OnionKeyHash = crypto:hash(sha256, POCPubKeyBin), + lager:info("*** initializing POC at height ~p for local onion key hash ~p", [POCStartHeight, OnionKeyHash]), + Entropy = <>, + lager:info("*** entropy constructed using onionkeyhash ~p and blockhash ~p", [OnionKeyHash, BlockHash]), + ZoneRandState = blockchain_utils:rand_state(Entropy), + InitTargetRandState = blockchain_utils:rand_state(POCPrivKeyHash), + lager:info("*** ZoneRandState ~p", [ZoneRandState]), + lager:info("*** InitTargetRandState ~p", [InitTargetRandState]), + case blockchain_poc_target_v4:target(Challenger, InitTargetRandState, ZoneRandState, Ledger, Vars) of + {error, Reason}-> + lager:info("*** failed to find a target, reason ~p", [Reason]), + noop; + {ok, {TargetPubkeybin, TargetRandState}}-> + lager:info("*** found target ~p", [TargetPubkeybin]), + {ok, LastChallenge} = blockchain_ledger_v1:current_height(Ledger), + {ok, B} = blockchain:get_block(LastChallenge, Chain), + Time = blockchain_block:time(B), + Path = blockchain_poc_path_v4:build(TargetPubkeybin, TargetRandState, Ledger, Time, Vars), + lager:info("path created ~p", [Path]), + N = erlang:length(Path), + [<> | LayerData] = blockchain_txn_poc_receipts_v2:create_secret_hash( + Entropy, + N + 1 + ), + OnionList = lists:zip([libp2p_crypto:bin_to_pubkey(P) || P <- Path], LayerData), + {Onion, Layers} = blockchain_poc_packet_v2:build(Keys, IV, OnionList), + [_|LayerHashes] = [crypto:hash(sha256, L) || L <- Layers], + Challengees = lists:zip(Path, LayerData), + PacketHashes = lists:zip(Path, LayerHashes), + Secret = libp2p_crypto:keys_to_bin(Keys), + %% save the POC data to our local cache + LocalPOC = #local_poc{ + onion_key_hash = OnionKeyHash, + block_hash = BlockHash, + target = TargetPubkeybin, + onion = Onion, + secret = Secret, + challengees = Challengees, + packet_hashes = PacketHashes, + keys = Keys, + start_height = POCStartHeight + }, + ok = write_local_poc(LocalPOC, State), + lager:info("starting poc for challengeraddr ~p, onionhash ~p", [Challenger, OnionKeyHash]), + ok + end. + +-spec process_block_pocs( + BlockHash :: blockchain_block:hash(), + Block :: blockchain_block:block(), + State :: state() +) -> ok. +process_block_pocs( + BlockHash, + Block, + #state{chain = Chain} = State +) -> + Ledger = blockchain:ledger(Chain), + BlockHeight = blockchain_block:height(Block), + %% get the ephemeral keys from the block + %% these will be a prop with tuples as {MemberPosInCG, PocKeyHash} + BlockPocEphemeralKeys = blockchain_block_v1:poc_keys(Block), + [ + begin + %% the published key is a hash of the public key, aka the onion key hash + %% use this to check our local cache containing the keys of POCs owned by this validator + %% if it is one of this local validators POCs, then kick it off + case cached_local_poc_key(OnionKeyHash) of + {ok, {_KeyHash, #poc_local_key_data{keys = Keys}}} -> + lager:info("found local poc key, starting a poc for ~p", [OnionKeyHash]), + %% its a locally owned POC key, so kick off a new POC + Vars = blockchain_utils:vars_binary_keys_to_atoms(maps:from_list(blockchain_ledger_v1:snapshot_vars(Ledger))), + spawn_link(fun() -> initialize_poc(BlockHash, BlockHeight, Keys, Vars, State) end); + _ -> + lager:info("failed to find local poc key for ~p", [OnionKeyHash]), + noop + end, + %% GC the block key from the key proposals cache + %% dont want to have it reused + _ = delete_cached_local_poc_key_proposal(OnionKeyHash) + end + || {_CGPos, OnionKeyHash} <- BlockPocEphemeralKeys + ], + ok. + +-spec purge_local_pocs( + Block :: blockchain_block:block(), + State :: state() +) -> ok. +purge_local_pocs( + Block, + #state{chain = Chain, pub_key = SelfPubKeyBin, sig_fun = SigFun} = State +) -> + %% iterate over the local POCs in our rocksdb + %% end and clean up any which have exceeded their life span + %% these are active POCs which were initiated by this node + %% and the data is known only to this node + Ledger = blockchain:ledger(Chain), + Timeout = + case blockchain:config(?poc_timeout, Ledger) of + {ok, N} -> N; + _ -> ?POC_TIMEOUT + end, + BlockHeight = blockchain_block:height(Block), + LocalPOCs = local_pocs(State), + lists:foreach( + fun([#local_poc{start_height = POCStartHeight, onion_key_hash = OnionKeyHash} = POC]) -> + case (BlockHeight - POCStartHeight) > Timeout of + true -> + lager:info("*** purging local poc with key ~p", [OnionKeyHash]), + %% this POC's time is up, submit receipts we have received + ok = submit_receipts(POC, SelfPubKeyBin, SigFun, Chain), + %% as receipts have been submitted, we can delete the local poc from the db + %% the public poc data will remain until at least the receipt txn is absorbed + _ = delete_local_poc(OnionKeyHash, State); + _ -> + lager:info("*** not purging local poc with key ~p. BlockHeight: ~p, POCStartHeight: ~p", [OnionKeyHash, BlockHeight, POCStartHeight]), + ok + end + end, + LocalPOCs + ), + ok. + +-spec purge_local_poc_keys( + BlockHeight :: pos_integer(), + Ledger :: blockchain_ledger_v1:ledger() +) -> ok. +purge_local_poc_keys( + BlockHeight, + Ledger +) -> + %% iterate over the poc keys in our ets cache + %% and purge any which are deemed to be passed due + %% these keys are generated by *this* node + %% as part of its heartbeat submission + %% and added to the poc_mgr cache + %% each new block check if each mined key + %% for that block is one of our own + %% if it is then we initiate a new local POC + %% the keys are purged periodically + Timeout = + case blockchain:config(?poc_timeout, Ledger) of + {ok, N} -> N; + _ -> ?POC_TIMEOUT + end, + %% iterate over the cached POC keys, delete any which are beyond the lifespan of when the active POC would have ended + CachedPOCKeys = cached_local_poc_keys(), + lists:foreach( + fun({Key, #poc_local_key_data{receive_height = ReceiveHeight}}) -> + case (BlockHeight - ReceiveHeight) > Timeout of + true -> + %% the lifespan of any POC for this key has passed, we can GC + ok = delete_cached_local_poc_key(Key); + _ -> + ok + end + end, + CachedPOCKeys + ), + ok. + +-spec purge_pocs_key_proposals( + BlockHeight :: pos_integer(), + Ledger :: blockchain_ledger_v1:ledger() +) -> ok. +purge_pocs_key_proposals( + BlockHeight, + Ledger +) -> + %% iterate over the poc key proposals in our ets cache + %% and purge any which are deemed to be passed due + %% these proposed keys are those generated by any validator + %% and cached on this node when absorbing validator heartbeats + %% when blocks are proposed, a random subset of keys + %% from this cache will be selected and included + %% in the local block proposal ( assuming the node is in the CG ) + %% one or more of these proposed keys *may* make it into the block + %% in order to prevent an unbounded cache we will GC + %% keys in this cache periodically + %% NOTE: a key will also be removed from the cache should it make it into a block + Timeout = + case blockchain:config(?poc_validator_ephemeral_key_timeout, Ledger) of + {ok, N} -> N; + _ -> 200 + end, + CachedPOCKeyProposals = cached_local_poc_key_proposals(), + lists:foreach( + fun({Key, #poc_key_proposal{receive_height = ReceiveHeight}}) -> + case (BlockHeight - ReceiveHeight) > Timeout of + true -> + %% the lifespan of any POC for this key has passed, we can GC + ok = delete_cached_local_poc_key_proposal(Key); + _ -> + ok + end + end, + CachedPOCKeyProposals + ), + ok. + +-spec submit_receipts(local_poc(), libp2p_crypto:pubkey_bin(), libp2p_crypto:sig_fun(), blockchain:blockchain()) -> ok. +submit_receipts( + #local_poc{ + onion_key_hash = OnionKeyHash, + responses = Responses0, + secret = Secret, + packet_hashes = LayerHashes, + block_hash = BlockHash + } = _Data, + Challenger, + SigFun, + Chain +) -> + Path1 = lists:foldl( + fun({Challengee, LayerHash}, Acc) -> + {Address, Receipt} = maps:get(Challengee, Responses0, {make_ref(), undefined}), + %% get any witnesses not from the same p2p address and also ignore challengee as a witness (self-witness) + Witnesses = [ + W + || {A, W} <- maps:get(LayerHash, Responses0, []), A /= Address, A /= Challengee + ], + E = blockchain_poc_path_element_v1:new(Challengee, Receipt, Witnesses), + [E | Acc] + end, + [], + LayerHashes + ), + Txn0 = + case blockchain:config(?poc_version, blockchain:ledger(Chain)) of + {ok, PoCVersion} when PoCVersion >= 10 -> + blockchain_txn_poc_receipts_v2:new( + Challenger, + Secret, + OnionKeyHash, + lists:reverse(Path1), + BlockHash + ); + _ -> + %% hmm we shouldnt really hit here as this all started with poc version 10 + noop + end, + Txn1 = blockchain_txn:sign(Txn0, SigFun), + lager:info("submitting blockchain_txn_poc_receipts_v2 for onion key hash ~p: ~p", [OnionKeyHash, Txn0]), + case miner_consensus_mgr:in_consensus() of + false -> + lager:info("node is not in consensus", []), + ok = blockchain_txn_mgr:submit(Txn1, fun(_Result) -> noop end); + true -> + lager:info("node is in consensus", []), + _ = miner_hbbft_sidecar:submit(Txn1) + end, + + ok. + +-spec cache_poc_key(poc_key(), cached_local_poc_local_key_data()) -> true. +cache_poc_key(ID, Keys) -> + true = ets:insert(?KEYS, {ID, Keys}). + +-spec cached_local_poc_keys() -> [cached_local_poc_key_type()]. +cached_local_poc_keys() -> + ets:tab2list(?KEYS). + +-spec delete_cached_local_poc_key(poc_key()) -> ok. +delete_cached_local_poc_key(Key) -> + true = ets:delete(?KEYS, Key), + ok. + +-spec cache_poc_key_proposal(key_proposal(), cached_key_proposal()) -> true. +cache_poc_key_proposal(KeyProposal, Rec) -> + true = ets:insert(?KEY_PROPOSALS, {KeyProposal, Rec}). + +-spec cached_local_poc_key_proposals() -> [cached_key_proposal()]. +cached_local_poc_key_proposals() -> + ets:tab2list(?KEY_PROPOSALS). + +-spec validate_witness(blockchain_poc_witness_v1:witness(), blockchain_ledger_v1:ledger()) -> + boolean(). +validate_witness(Witness, Ledger) -> + Gateway = blockchain_poc_witness_v1:gateway(Witness), + %% TODO this should be against the ledger at the time the receipt was mined + case blockchain_ledger_v1:find_gateway_info(Gateway, Ledger) of + {error, _Reason} -> + lager:warning("failed to get witness ~p info ~p", [Gateway, _Reason]), + false; + {ok, GwInfo} -> + case blockchain_ledger_gateway_v2:location(GwInfo) of + undefined -> + lager:warning("ignoring witness ~p location undefined", [Gateway]), + false; + _ -> + blockchain_poc_witness_v1:is_valid(Witness, Ledger) + end + end. + +check_addr_hash(_PeerAddr, #state{addr_hash_filter = undefined}) -> + undefined; +check_addr_hash(PeerAddr, #state{ + addr_hash_filter = #addr_hash_filter{byte_size = Size, salt = Hash, bloom = Bloom} +}) -> + case multiaddr:protocols(PeerAddr) of + [{"ip4", Address}, {_, _}] -> + {ok, Addr} = inet:parse_ipv4_address(Address), + Val = binary:part( + enacl:pwhash( + list_to_binary(tuple_to_list(Addr)), + binary:part(Hash, {0, enacl:pwhash_SALTBYTES()}) + ), + {0, Size} + ), + case bloom:check_and_set(Bloom, Val) of + true -> + true; + false -> + Val + end; + _ -> + undefined + end. + +-spec maybe_init_addr_hash(#state{}) -> #state{}. +maybe_init_addr_hash(#state{chain = undefined} = State) -> + %% no chain + State; +maybe_init_addr_hash(#state{chain = Chain, addr_hash_filter = undefined} = State) -> + %% check if we have the block we need + Ledger = blockchain:ledger(Chain), + case blockchain:config(?poc_addr_hash_byte_count, Ledger) of + {ok, Bytes} when is_integer(Bytes), Bytes > 0 -> + case blockchain:config(?poc_challenge_interval, Ledger) of + {ok, Interval} -> + {ok, Height} = blockchain:height(Chain), + StartHeight = max(Height - (Height rem Interval), 1), + %% check if we have this block + case blockchain:get_block(StartHeight, Chain) of + {ok, Block} -> + Hash = blockchain_block:hash_block(Block), + %% ok, now we can build the filter + Gateways = blockchain_ledger_v1:gateway_count(Ledger), + {ok, Bloom} = bloom:new_optimal(Gateways, ?ADDR_HASH_FP_RATE), + sync_filter(Block, Bloom, Chain), + State#state{ + addr_hash_filter = #addr_hash_filter{ + start = StartHeight, + height = Height, + byte_size = Bytes, + salt = Hash, + bloom = Bloom + } + }; + _ -> + State + end; + _ -> + State + end; + _ -> + State + end; +maybe_init_addr_hash( + #state{ + chain = Chain, + addr_hash_filter = #addr_hash_filter{ + start = StartHeight, + height = Height, + byte_size = Bytes, + salt = Hash, + bloom = Bloom + } + } = State +) -> + Ledger = blockchain:ledger(Chain), + case blockchain:config(?poc_addr_hash_byte_count, Ledger) of + {ok, Bytes} when is_integer(Bytes), Bytes > 0 -> + case blockchain:config(?poc_challenge_interval, Ledger) of + {ok, Interval} -> + {ok, CurHeight} = blockchain:height(Chain), + case max(Height - (Height rem Interval), 1) of + StartHeight -> + case CurHeight of + Height -> + %% ok, everything lines up + State; + _ -> + case blockchain:get_block(Height + 1, Chain) of + {ok, Block} -> + sync_filter(Block, Bloom, Chain), + State#state{ + addr_hash_filter = #addr_hash_filter{ + start = StartHeight, + height = CurHeight, + byte_size = Bytes, + salt = Hash, + bloom = Bloom + } + }; + _ -> + State + end + end; + _NewStart -> + %% filter is stale + maybe_init_addr_hash(State#state{addr_hash_filter = undefined}) + end; + _ -> + State + end; + _ -> + State#state{addr_hash_filter = undefined} + end. + +sync_filter(StopBlock, Bloom, Blockchain) -> + blockchain:fold_chain( + fun(Blk, _) -> + blockchain_utils:find_txn(Blk, fun(T) -> + case blockchain_txn:type(T) == blockchain_txn_poc_receipts_v2 of + true -> + %% abuse side effects here for PERFORMANCE + [update_addr_hash(Bloom, E) || E <- blockchain_txn_poc_receipts_v2:path(T)]; + false -> + ok + end, + false + end), + case Blk == StopBlock of + true -> + return; + false -> + continue + end + end, + any, + element(2, blockchain:head_block(Blockchain)), + Blockchain + ). + +-spec update_addr_hash( + Bloom :: bloom_nif:bloom(), + Element :: blockchain_poc_path_element_v1:poc_element() +) -> ok. +update_addr_hash(Bloom, Element) -> + case blockchain_poc_path_element_v1:receipt(Element) of + undefined -> + ok; + Receipt -> + case blockchain_poc_receipt_v1:addr_hash(Receipt) of + undefined -> + ok; + Hash -> + bloom:set(Bloom, Hash) + end + end. + +-spec do_get_random_poc_key_proposals(pos_integer(), [libp2p_crypto:pubkey_bin()], + [cached_key_proposal()]) -> + [{libp2p_crypto:pubkey_bin(), key_proposal()}]. +do_get_random_poc_key_proposals(NumKeys, CGMembers, Keys) -> + do_get_random_poc_key_proposals(NumKeys, CGMembers, Keys, []). +-spec do_get_random_poc_key_proposals(pos_integer(), [libp2p_crypto:pubkey_bin()], + [cached_key_proposal()], [{libp2p_crypto:pubkey_bin(), key_proposal()}]) -> + [{libp2p_crypto:pubkey_bin(), key_proposal()}]. +do_get_random_poc_key_proposals(0, _CGMembers, _Keys, Acc) -> + Acc; +do_get_random_poc_key_proposals(_, _CGMembers, [] = _Keys, Acc) -> + Acc; +do_get_random_poc_key_proposals(NumKeys, CGMembers, + [{_, #poc_key_proposal{key = Key, address = Address}} | T] = _Keys, Acc) -> + case lists:member(Address, CGMembers) of + true -> + do_get_random_poc_key_proposals(NumKeys, CGMembers, T, Acc); + false -> + do_get_random_poc_key_proposals(NumKeys-1, CGMembers, T, [{Address, Key} | Acc]) + end. + +%% ------------------------------------------------------------------ +%% DB functions +%% ------------------------------------------------------------------ + +%%-spec append_local_poc(NewLocalPOC :: local_poc(), +%% State :: state()) -> ok | {error, any()}. +%%append_local_poc(#local_poc{onion_key_hash=OnionKeyHash} = NewLocalPOC, #state{db=DB, cf=CF}=State) -> +%% case ?MODULE:local_poc(OnionKeyHash) of +%% {ok, SavedLocalPOCs} -> +%% %% check we're not writing something we already have +%% case lists:member(NewLocalPOC, SavedLocalPOCs) of +%% true -> +%% ok; +%% false -> +%% ToInsert = erlang:term_to_binary([NewLocalPOC | SavedLocalPOCs]), +%% rocksdb:put(DB, CF, OnionKeyHash, ToInsert, []) +%% end; +%% {error, not_found} -> +%% ToInsert = erlang:term_to_binary([NewLocalPOC]), +%% rocksdb:put(DB, CF, OnionKeyHash, ToInsert, []); +%% {error, _}=E -> +%% E +%% end. + +local_pocs(#state{db=DB, cf=CF}) -> + {ok, Itr} = rocksdb:iterator(DB, CF, []), + local_pocs(Itr, rocksdb:iterator_move(Itr, first), []). + +local_pocs(Itr, {error, invalid_iterator}, Acc) -> + catch rocksdb:iterator_close(Itr), + Acc; +local_pocs(Itr, {ok, _, LocalPOCBin}, Acc) -> + local_pocs(Itr, rocksdb:iterator_move(Itr, next), [binary_to_term(LocalPOCBin)|Acc]). + +-spec write_local_poc( LocalPOC ::local_poc(), + State :: state()) -> ok. +write_local_poc(#local_poc{onion_key_hash=OnionKeyHash} = LocalPOC, #state{db=DB, cf=CF}) -> + ToInsert = erlang:term_to_binary([LocalPOC]), + rocksdb:put(DB, CF, OnionKeyHash, ToInsert, []). + +-spec delete_local_poc( OnionKeyHash ::binary(), + State :: state()) -> ok. +delete_local_poc(OnionKeyHash, #state{db=DB, cf=CF}) -> + rocksdb:delete(DB, CF, OnionKeyHash, []). diff --git a/src/poc/miner_poc_mgr_db_owner.erl b/src/poc/miner_poc_mgr_db_owner.erl new file mode 100644 index 000000000..0e94da466 --- /dev/null +++ b/src/poc/miner_poc_mgr_db_owner.erl @@ -0,0 +1,189 @@ +%%%------------------------------------------------------------------- +%% @doc +%% == poc mgr db owner and related functions == +%% +%% * This process is started first in the miner supervision tree +%% * POC mgr will get the db reference from here when they init +%% * This process also traps exits and closes rocksdb (if need be) +%% * This process is responsible for serializing local POC updates to disk in a +%% batch write each write interval (currently 1000 millis) +%% * local POCs are POC which are running and active on this validator +%% +%% @end +%%%------------------------------------------------------------------- +-module(miner_poc_mgr_db_owner). + +-behavior(gen_server). + +%% api exports +-export([start_link/1, + db/0, + poc_mgr_cf/0, + write/2, + gc/1 + ]). + +%% gen_server exports +-export([ + init/1, + handle_call/3, + handle_cast/2, + handle_info/2, + terminate/2, + code_change/3 +]). + +-define(DB_FILE, "poc_mgr.db"). +-define(TICK, '__poc_write_tick'). + +-record(state, { + db :: rocksdb:db_handle(), + default :: rocksdb:cf_handle(), + poc_mgr_cf :: rocksdb:cf_handle(), + write_interval = 1000 :: pos_integer(), + tref :: reference(), + pending = #{} :: maps:map() + }). + +%% api functions +start_link(Args) -> + gen_server:start_link({local, ?MODULE}, ?MODULE, Args, []). + +-spec db() -> rocksdb:db_handle(). +db() -> + gen_server:call(?MODULE, db). + +-spec poc_mgr_cf() -> rocksdb:cf_handle(). +poc_mgr_cf() -> + gen_server:call(?MODULE, poc_mgr_cf). + +-spec write( POC :: miner_poc_mgr:local_poc(), + Skewed :: skewed:skewed()) -> ok. +write(POC, Skewed) -> + gen_server:cast(?MODULE, {write, POC, Skewed}). + +-spec gc( [ miner_poc_mgr:local_poc_onion_key_hash() ] ) -> ok. +gc(IDs) -> + gen_server:call(?MODULE, {gc, IDs}, infinity). + +%% gen_server callbacks +init(Args) -> + lager:info("~p init with ~p", [?MODULE, Args]), + erlang:process_flag(trap_exit, true), + BaseDir = maps:get(base_dir, Args), + CFs = maps:get(cfs, Args, ["default", "poc_mgr_cf"]), + {ok, DB, [DefaultCF, POCMgrCF]} = open_db(BaseDir, CFs), + WriteInterval = get_env(poc_mgr_write_interval, 100), + Tref = schedule_next_tick(WriteInterval), + {ok, #state{db=DB, default=DefaultCF, poc_mgr_cf=POCMgrCF, + tref=Tref, write_interval=WriteInterval}}. + +handle_call(db, _From, #state{db=DB}=State) -> + {reply, DB, State}; +handle_call(poc_mgr_cf, _From, #state{poc_mgr_cf=CF}=State) -> + {reply, CF, State}; +handle_call({gc, IDs}, _From, #state{pending=P, db=DB}=State)-> + {ok, Batch} = rocksdb:batch(), + ok = lists:foreach(fun(POCID) -> + ok = rocksdb:batch_delete(Batch, POCID) + end, IDs), + ok = rocksdb:write_batch(DB, Batch, []), + ok = rocksdb:release_batch(Batch), + {reply, ok, State#state{pending=maps:without(IDs, P)}}; +handle_call(_Msg, _From, State) -> + lager:warning("rcvd unknown call msg: ~p from: ~p", [_Msg, _From]), + {reply, ok, State}. + +handle_cast({write, POC, Skewed}, #state{pending=P}=State) -> + POCID = miner_poc_mgr:local_poc_key(POC), + %% defer encoding until write time + NewP = maps:put(POCID, {POC, Skewed}, P), + {noreply, State#state{pending=NewP}}; +handle_cast(_Msg, State) -> + lager:warning("rcvd unknown cast msg: ~p", [_Msg]), + {noreply, State}. + +handle_info({'EXIT', _From, _Reason} , #state{db=DB}=State) -> + lager:info("EXIT because: ~p, closing rocks: ~p", [_Reason, DB]), + ok = rocksdb:close(DB), + {stop, db_owner_exit, State}; +handle_info(?TICK, #state{pending=P, write_interval=W}=State) when map_size(P) == 0 -> + Tref = schedule_next_tick(W), + {noreply, State#state{tref=Tref}}; +handle_info(?TICK, #state{pending=P, db=DB, + write_interval=W}=State) -> + lager:info("~p pending writes this tick", [map_size(P)]), + ok = handle_batch_write(DB, P), + Tref = schedule_next_tick(W), + {noreply, State#state{tref=Tref, pending=#{}}}; +handle_info(_Msg, State) -> + lager:warning("rcvd unknown info msg: ~p", [_Msg]), + {noreply, State}. + +code_change(_OldVsn, State, _Extra) -> + {ok, State}. + +terminate(_Reason, #state{db=DB, + pending=P}) when map_size(P) == 0 -> + ok = rocksdb:close(DB), + ok; +terminate(_Reason, #state{db=DB, + pending=P}) -> + ok = handle_batch_write(DB, P), + ok = rocksdb:close(DB), + ok. + +%% Helper functions +-spec open_db(Dir::file:filename_all(), + CFNames::[string()]) -> {ok, rocksdb:db_handle(), [rocksdb:cf_handle()]} | + {error, any()}. +open_db(Dir, CFNames) -> + ok = filelib:ensure_dir(Dir), + DBDir = filename:join(Dir, ?DB_FILE), + GlobalOpts = application:get_env(rocksdb, global_opts, []), + DBOptions = [{create_if_missing, true}, {atomic_flush, true}] ++ GlobalOpts, + ExistingCFs = + case rocksdb:list_column_families(DBDir, DBOptions) of + {ok, CFs0} -> + CFs0; + {error, _} -> + ["default"] + end, + + CFOpts = GlobalOpts, + case rocksdb:open_with_cf(DBDir, DBOptions, [{CF, CFOpts} || CF <- ExistingCFs]) of + {error, _Reason}=Error -> + Error; + {ok, DB, OpenedCFs} -> + L1 = lists:zip(ExistingCFs, OpenedCFs), + L2 = lists:map( + fun(CF) -> + {ok, CF1} = rocksdb:create_column_family(DB, CF, CFOpts), + {CF, CF1} + end, + CFNames -- ExistingCFs + ), + L3 = L1 ++ L2, + {ok, DB, [proplists:get_value(X, L3) || X <- CFNames]} + end. + +schedule_next_tick(Interval) -> + erlang:send_after(Interval, self(), ?TICK). + +handle_batch_write(DB, P) -> + {ok, Batch} = rocksdb:batch(), + ok = maps:fold(fun(POCID, {POC, Skewed}, Acc) -> + Bin = term_to_binary({POC, + Skewed}), + ok = rocksdb:batch_put(Batch, POCID, Bin), + Acc + end, ok, P), + Res = rocksdb:write_batch(DB, Batch, []), + ok = rocksdb:release_batch(Batch), + Res. + +get_env(Key, Default) -> + case application:get_env(miner, Key, Default) of + {ok, X} -> X; + Default -> Default + end. diff --git a/src/poc/miner_poc_report_handler.erl b/src/poc/miner_poc_report_handler.erl new file mode 100644 index 000000000..932d1a1d9 --- /dev/null +++ b/src/poc/miner_poc_report_handler.erl @@ -0,0 +1,106 @@ +%%%------------------------------------------------------------------- +%% @doc +%% == Miner POC Stream Handler == +%% used to relay a receipt or witness report received by a validator +%% onto the actual challenger +%% @end +%%%------------------------------------------------------------------- +-module(miner_poc_report_handler). + +-behavior(libp2p_framed_stream). + +%% ------------------------------------------------------------------ +%% API Function Exports +%% ------------------------------------------------------------------ + +-export([ + server/4, + client/2, + decode/1 +]). + +%% ------------------------------------------------------------------ +%% libp2p_framed_stream Function Exports +%% ------------------------------------------------------------------ +-export([ + init/3, + handle_data/3, + handle_info/3, + send/2 +]). + +-record(state, { + peer :: undefined | libp2p_crypto:pubkey_bin(), + peer_addr :: undefined | string() +}). + +%% ------------------------------------------------------------------ +%% API Function Definitions +%% ------------------------------------------------------------------ +client(Connection, Args) -> + libp2p_framed_stream:client(?MODULE, Connection, Args). + +server(Connection, Path, _TID, Args) -> + libp2p_framed_stream:server(?MODULE, Connection, [Path | Args]). + +send(Pid, Data) -> + Pid ! {send, Data}. + +decode(Data) -> + try blockchain_poc_response_v1:decode(Data) of + Res -> Res + catch + _:_ -> + lager:error("got unknown data ~p", [Data]), + {error, failed_to_decode_report} + end. +%% ------------------------------------------------------------------ +%% libp2p_framed_stream Function Definitions +%% ------------------------------------------------------------------ +init(client, _Conn, _Args) -> + {ok, #state{}}; +init(server, Conn, _Args) -> + {_, PeerAddr} = libp2p_connection:addr_info(Conn), + {ok, #state{peer = identify(Conn), peer_addr = PeerAddr}}. + +handle_data(client, Data, State) -> + lager:info("client got data: ~p", [Data]), + %% client should not receive data + {stop, normal, State}; +handle_data(server, Payload, #state{peer = SelfPeer} = State) -> + {OnionKeyHash, Data} = binary_to_term(Payload), + lager:info("server got data, OnionKeyHash: ~p, Report: ~p", [OnionKeyHash, Data]), + P2PAddr = libp2p_crypto:pubkey_bin_to_p2p(SelfPeer), + try ?MODULE:decode(Data) of + {witness, _} = Report -> + ok = miner_poc_mgr:report(Report, OnionKeyHash, SelfPeer, P2PAddr); + {receipt, _} = Report -> + ok = miner_poc_mgr:report(Report, OnionKeyHash, SelfPeer, P2PAddr) + catch + _:_ -> + lager:error("got unknown data ~p", [Data]) + end, + %% we only expect one receipt/witness from the peer at a time + {stop, normal, State}. + +handle_info(client, {send, Data}, State) -> + lager:info("client sending data: ~p", [Data]), + %% send one and done + {stop, normal, State, Data}; +handle_info(_Type, _Msg, State) -> + lager:info("rcvd unknown type: ~p unknown msg: ~p", [_Type, _Msg]), + %% unexpected input, just close + {stop, normal, State}. + +identify(Conn) -> + case libp2p_connection:session(Conn) of + {ok, Session} -> + libp2p_session:identify(Session, self(), ?MODULE), + receive + {handle_identify, ?MODULE, {ok, Identify}} -> + libp2p_identify:pubkey_bin(Identify) + after 10000 -> erlang:error(failed_identify_timeout) + end; + {error, closed} -> + erlang:error(dead_session) + end. diff --git a/src/poc/miner_poc_statem.erl b/src/poc/miner_poc_statem.erl index 1469ba30c..956ef6496 100644 --- a/src/poc/miner_poc_statem.erl +++ b/src/poc/miner_poc_statem.erl @@ -121,7 +121,7 @@ witness(Address, Data) -> %% ------------------------------------------------------------------ init(Args) -> ok = blockchain_event:add_handler(self()), - ok = miner_poc:add_stream_handler(blockchain_swarm:tid()), + ok = miner_poc:add_stream_handler(blockchain_swarm:tid(), miner_poc_handler), ok = miner_onion:add_stream_handler(blockchain_swarm:tid()), Address = blockchain_swarm:pubkey_bin(), Blockchain = blockchain_worker:blockchain(), @@ -191,6 +191,13 @@ requesting(info, Msg, #data{blockchain = Chain} = Data) when Chain =:= undefined lager:warning("dropped ~p cause chain is still undefined", [Msg]), {keep_state, Data}; NewChain -> + Ledger = blockchain:ledger(NewChain), + case blockchain:config(?poc_challenger_type, Ledger) of + {ok, validator} -> + ok; + _ -> + ok = miner_poc:add_stream_handler(blockchain_swarm:tid(), miner_poc_handler) + end, {keep_state, Data#data{blockchain=NewChain}, [{next_event, info, Msg}]} end; requesting(info, {blockchain_event, {add_block, BlockHash, Sync, Ledger}} = Msg, @@ -854,34 +861,39 @@ allow_request(BlockHash, #data{blockchain=Blockchain, POCInterval0 end, try - case blockchain_ledger_v1:find_gateway_info(Address, Ledger) of - {ok, GwInfo} -> - GwMode = blockchain_ledger_gateway_v2:mode(GwInfo), - case blockchain_ledger_gateway_v2:is_valid_capability(GwMode, ?GW_CAPABILITY_POC_CHALLENGER, Ledger) of - true -> - {ok, Block} = blockchain:get_block(BlockHash, Blockchain), - Height = blockchain_block:height(Block), - ChallengeOK = - case blockchain_ledger_gateway_v2:last_poc_challenge(GwInfo) of - undefined -> - lager:info("got block ~p @ height ~p (never challenged before)", [BlockHash, Height]), - true; - LastChallenge -> - case (Height - LastChallenge) > POCInterval of - true -> 1 == rand:uniform(max(10, POCInterval div 10)); - false -> false - end - end, - LocationOK = true, - LocationOK = miner_lora:location_ok(), - ChallengeOK andalso LocationOK; + case blockchain:config(?poc_challenger_type, Ledger) of + {ok, validator} -> + false; + _ -> + case blockchain_ledger_v1:find_gateway_info(Address, Ledger) of + {ok, GwInfo} -> + GwMode = blockchain_ledger_gateway_v2:mode(GwInfo), + case blockchain_ledger_gateway_v2:is_valid_capability(GwMode, ?GW_CAPABILITY_POC_CHALLENGER, Ledger) of + true -> + {ok, Block} = blockchain:get_block(BlockHash, Blockchain), + Height = blockchain_block:height(Block), + ChallengeOK = + case blockchain_ledger_gateway_v2:last_poc_challenge(GwInfo) of + undefined -> + lager:info("got block ~p @ height ~p (never challenged before)", [BlockHash, Height]), + true; + LastChallenge -> + case (Height - LastChallenge) > POCInterval of + true -> 1 == rand:uniform(max(10, POCInterval div 10)); + false -> false + end + end, + LocationOK = true, + LocationOK = miner_lora:location_ok(), + ChallengeOK andalso LocationOK; + _ -> + %% the GW is not allowed to send POC challenges + false + end; + %% mostly this is going to be unasserted full nodes _ -> - %% the GW is not allowed to send POC challenges false - end; - %% mostly this is going to be unasserted full nodes - _ -> - false + end end catch Class:Err:Stack -> lager:warning("error determining if request allowed: ~p:~p ~p", diff --git a/test/miner_ct_utils.erl b/test/miner_ct_utils.erl index 2491c448f..b53bbc0c6 100644 --- a/test/miner_ct_utils.erl +++ b/test/miner_ct_utils.erl @@ -4,6 +4,7 @@ -include_lib("eunit/include/eunit.hrl"). -include_lib("blockchain/include/blockchain_vars.hrl"). -include_lib("blockchain/include/blockchain.hrl"). +-include_lib("blockchain/include/blockchain_txn_fees.hrl"). -include("miner_ct_macros.hrl"). -define(BASE_TMP_DIR, "./_build/test/tmp"). @@ -15,6 +16,7 @@ pmap/2, pmap/3, wait_until/1, wait_until/3, wait_until_disconnected/2, + wait_until_local_height/1, get_addrs/1, start_miner/2, start_node/1, @@ -36,6 +38,7 @@ init_base_dir_config/3, generate_keys/1, new_random_key/1, + new_random_key_with_sig_fun/1, stop_miners/1, stop_miners/2, start_miners/1, start_miners/2, height/1, @@ -50,6 +53,8 @@ shuffle/1, partition_miners/2, node2addr/2, + node2sigfun/2, + node2pubkeybin/2, addr2node/2, addr_list/1, blockchain_worker_check/1, @@ -58,6 +63,7 @@ wait_for_app_stop/2, wait_for_app_stop/3, wait_for_in_consensus/2, wait_for_in_consensus/3, wait_for_chain_var_update/3, wait_for_chain_var_update/4, + wait_for_lora_port/3, delete_dirs/2, initial_dkg/5, initial_dkg/6, confirm_balance/3, @@ -84,7 +90,8 @@ build_asserts/2, add_block/3, gen_gateways/2, gen_payments/1, gen_locations/1, - existing_vars/0, start_blockchain/2 + existing_vars/0, start_blockchain/2, + create_block/2 ]). chain_var_lookup_all(Key, Nodes) -> @@ -199,6 +206,18 @@ wait_for_equalized_heights(Miners) -> [Height] = UniqueHeights, Height. +wait_until_local_height(TargetHeight) -> + miner_ct_utils:wait_until( + fun() -> + C = blockchain_worker:blockchain(), + {ok, CurHeight} = blockchain:height(C), + ct:pal("local height ~p", [CurHeight]), + CurHeight >= TargetHeight + end, + 30, + timer:seconds(1) + ). + stop_miners(Miners) -> stop_miners(Miners, 60). @@ -493,6 +512,25 @@ wait_for_chain_var_update(Miners, Key, Value, Retries)-> Else -> Else end. +wait_for_lora_port(Miners, Mod, Retries)-> + ?noAssertAsync(begin + lists:all( + fun(Miner) -> + try + case ct_rpc:call(Miner, Mod, port, []) of + {error, _} -> + ct:pal("Failed to find lora port ~p via module ~p", [Miner, Mod]), + false; + _ -> true + end + catch _:_ -> + ct:pal("Failed to find lora port ~p", [Miner]), + false + end + end, Miners) + end, + Retries, timer:seconds(1)). + delete_dirs(DirWildcard, SubDir)-> Dirs = filelib:wildcard(DirWildcard), [begin @@ -607,9 +645,9 @@ start_node(Name) -> %% have the slave nodes monitor the runner node, so they can't outlive it NodeConfig = [ {monitor_master, true}, - {boot_timeout, 10}, - {init_timeout, 10}, - {startup_timeout, 10}, + {boot_timeout, 30}, + {init_timeout, 30}, + {startup_timeout, 30}, {startup_functions, [ {code, set_path, [CodePath]} ]}], @@ -696,6 +734,13 @@ shuffle(List) -> S. +node2sigfun(Node, KeyList) -> + {_Miner, {_TCPPort, _UDPPort, _JsonRpcPort}, _ECDH, _PubKey, _Addr, SigFun} = lists:keyfind(Node, 1, KeyList), + SigFun. + +node2pubkeybin(Node, KeyList) -> + {_Miner, {_TCPPort, _UDPPort, _JsonRpcPort}, _ECDH, _PubKey, Addr, _SigFun} = lists:keyfind(Node, 1, KeyList), + Addr. node2addr(Node, AddrList) -> {_, Addr} = lists:keyfind(Node, 1, AddrList), @@ -723,6 +768,11 @@ init_per_testcase(Mod, TestCase, Config0) -> Config = init_base_dir_config(Mod, TestCase, Config0), BaseDir = ?config(base_dir, Config), LogDir = ?config(log_dir, Config), + SplitMiners = proplists:get_value(split_miners_vals_and_gateways, Config, false), + NumValidators = proplists:get_value(num_validators, Config, 0), + NumGateways = proplists:get_value(num_gateways, Config, get_config("T", 8)), + NumConsensusMembers = proplists:get_value(num_consensus_members, Config, get_config("N", 7)), + LoadChainOnGateways = proplists:get_value(gateways_run_chain, Config, true), os:cmd(os:find_executable("epmd")++" -daemon"), {ok, Hostname} = inet:gethostname(), @@ -734,29 +784,32 @@ init_per_testcase(Mod, TestCase, Config0) -> {error, {{already_started, _},_}} -> ok end, - %% Miner configuration, can be input from os env - TotalMiners = - case TestCase of - restart_test -> - 4; - _ -> - get_config("T", 8) - end, - NumConsensusMembers = - case TestCase of - group_change_test -> - 4; - restart_test -> - 4; - validator_transition_test -> - 4; - autoskip_chain_vars_test -> - 4; - autoskip_on_timeout_test -> - 4; - _ -> - get_config("N", 7) - end, + TotalMiners = NumValidators + NumGateways, +%% case TestCase of +%% poc_grpc_dist_v11_test -> +%% 16; %% 10 vals, 6 gateways +%% poc_grpc_dist_v11_cn_test -> +%% 13; %% 5 vals, 8 gateways +%% poc_grpc_dist_v11_partitioned_test -> +%% 13; %% 5 vals, 8 gateways +%% poc_grpc_dist_v11_partitioned_lying_test -> +%% 13; %% 5 vals, 8 gateways +%% _ -> +%% get_config("T", 8) +%% end, +%% NumConsensusMembers = +%% case TestCase of +%% poc_grpc_dist_v11_test -> +%% 4; +%% poc_grpc_dist_v11_cn_test -> +%% 4; +%% poc_grpc_dist_v11_partitioned_test -> +%% 4; +%% poc_grpc_dist_v11_partitioned_lying_test -> +%% 4; +%% _ -> +%% get_config("N", 7) +%% end, SeedNodes = [], JsonRpcBase = 4486, Port = get_config("PORT", 0), @@ -765,13 +818,15 @@ init_per_testcase(Mod, TestCase, Config0) -> BatchSize = get_config("BS", 500), Interval = get_config("INT", 5), - MinersAndPorts = miner_ct_utils:pmap( - fun(I) -> + MinersAndPorts = lists:reverse(lists:foldl( + fun(I, Acc) -> MinerName = list_to_atom(integer_to_list(I) ++ miner_ct_utils:randname(5)), - {start_node(MinerName), {45000, 0, JsonRpcBase + I}} + [{start_node(MinerName), {45000, 0, JsonRpcBase + I}} | Acc] end, + [], lists:seq(1, TotalMiners) - ), + )), + ct:pal("MinersAndPorts: ~p",[MinersAndPorts]), case lists:any(fun({{error, _}, _}) -> true; (_) -> false end, MinersAndPorts) of true -> @@ -782,10 +837,12 @@ init_per_testcase(Mod, TestCase, Config0) -> ok end, - Keys = miner_ct_utils:pmap( - fun({Miner, Ports}) -> - make_keys(Miner, Ports) - end, MinersAndPorts), + Keys = lists:reverse(lists:foldl( + fun({Miner, Ports}, Acc) -> + [make_keys(Miner, Ports) | Acc] + end, [], MinersAndPorts)), + + ct:pal("Keys: ~p", [Keys]), {_Miner, {_TCPPort, _UDPPort, _JsonRpcPort}, _ECDH, _PubKey, Addr, _SigFun} = hd(Keys), DefaultRouters = libp2p_crypto:pubkey_bin_to_p2p(Addr), @@ -799,9 +856,41 @@ init_per_testcase(Mod, TestCase, Config0) -> {default_routers, DefaultRouters}, {port, Port}], - ConfigResult = miner_ct_utils:pmap(fun(N) -> config_node(N, Options) end, Keys), + %% config nodes + ConfigResult = + case SplitMiners of + true -> + %% if config says to use validators for CG then + %% split key sets into validators and miners + %% first batch of keys up to NumConsensusMembers will be validators, rest gateways/miners + {ValKeys, GatewayKeys} = lists:split(NumValidators, Keys), + ct:pal("validator keys: ~p", [ValKeys]), + ct:pal("gateway keys: ~p", [GatewayKeys]), + %% carry the poc transport setting through to config node so that it can + %% set the app env var appropiately on each node + _GatewayConfigResult = miner_ct_utils:pmap(fun(N) -> config_node(N, [{gateways_run_chain, LoadChainOnGateways}, {mode, gateway} | Options]) end, GatewayKeys), + ValConfigResult = miner_ct_utils:pmap(fun(N) -> config_node(N, [{gateways_run_chain, LoadChainOnGateways}, {mode, validator} | Options]) end, ValKeys), + ValConfigResult; + _ -> + miner_ct_utils:pmap(fun(N) -> config_node(N, [{gateways_run_chain, LoadChainOnGateways}, {mode, validator} | Options]) end, Keys) + end, Miners = [M || {M, _} <- MinersAndPorts], + ct:pal("Miners: ~p", [Miners]), + + %% get a sep list of validator and gateway node names + %% if SplitMiners is false then all miners will be gateways + {Validators, Gateways} = + case SplitMiners of + true -> + lists:split(NumValidators, Miners); + _ -> + {[], Miners} + end, + + ct:pal("Validators: ~p", [Validators]), + ct:pal("Gateways: ~p", [Gateways]), + %% check that the config loaded correctly on each miner true = lists:all( fun(ok) -> true; @@ -812,10 +901,24 @@ init_per_testcase(Mod, TestCase, Config0) -> ConfigResult ), + %% hardcode some alias for our localhost miners + %% sibyl will not return routing data unless a miner/validator has a public address + %% so force an alias for each of our miners to a public IP + MinerAliases = lists:foldl( + fun({_, _, _, _, AliasAddr, _}, Acc) -> + P2PAddr = libp2p_crypto:pubkey_bin_to_p2p(AliasAddr), + [{P2PAddr, "/ip4/52.8.80.146/tcp/2154" } | Acc] + end, [], Keys), + ct:pal("miner aliases ~p", [MinerAliases]), + lists:foreach(fun(Miner)-> ct_rpc:call(Miner, application, set_env, [libp2p, node_aliases, MinerAliases]) end, Miners), + Addrs = get_addrs(Miners), + ct:pal("Addrs: ~p", [Addrs]), miner_ct_utils:pmap( fun(Miner) -> + TID = ct_rpc:call(Miner, blockchain_swarm, tid, [], 2000), + ct_rpc:call(Miner, miner_poc, add_stream_handler, [TID], 2000), Swarm = ct_rpc:call(Miner, blockchain_swarm, swarm, [], 2000), lists:foreach( fun(A) -> @@ -849,38 +952,158 @@ init_per_testcase(Mod, TestCase, Config0) -> end, Miners) end, 200, 150), + %% to enable the tests to run over grpc we need to deterministically set the grpc listen addr + %% with libp2p all the port data is in the peer entries + %% in the real world we would run grpc over a known port + %% but for the sake of the tests which run multiple nodes on a single instance + %% we need to choose a random port for each node + %% and the client needs to know which port was choosen + %% so for the sake of the tests what we do here is get the libp2p port + %% and run grpc on that value + 1000 + %% the client then just has to pull the libp2p peer data + %% retrieve the libp2p port and derive the grpc port from that + + GRPCServerConfigFun = fun(PeerPort)-> + [#{grpc_opts => #{service_protos => [gateway_pb], + services => #{'helium.gateway' => helium_gateway_service} + }, + + transport_opts => #{ssl => false}, + + listen_opts => #{port => PeerPort, + ip => {0,0,0,0}}, + + pool_opts => #{size => 2}, + + server_opts => #{header_table_size => 4096, + enable_push => 1, + max_concurrent_streams => unlimited, + initial_window_size => 65535, + max_frame_size => 16384, + max_header_list_size => unlimited}}] + end, + ok = lists:foreach(fun(Node) -> + Swarm = ct_rpc:call(Node, blockchain_swarm, swarm, []), + TID = ct_rpc:call(Node, blockchain_swarm, tid, []), + ListenAddrs = ct_rpc:call(Node, libp2p_swarm, listen_addrs, [Swarm]), + [H | _ ] = _SortedAddrs = ct_rpc:call(Node, libp2p_transport, sort_addrs, [TID, ListenAddrs]), + [_, _, _IP,_, Libp2pPort] = _Full = re:split(H, "/"), + ThisPort = list_to_integer(binary_to_list(Libp2pPort)), + _ = ct_rpc:call(Node, application, set_env, [grpcbox, servers, GRPCServerConfigFun(ThisPort + 1000)]), + _ = ct_rpc:call(Node, application, ensure_all_started, [grpcbox]), + ok + + end, Miners), + + %% setup a bunch of aliases for the running miner grpc hosts + %% as per above, each such port will be the equivilent libp2p port + 1000 + %% these grpc aliases are added purely for testing purposes + %% no current need to support in the wild + MinerGRPCPortAliases = lists:foldl( + fun({Miner, _, _, _, GrpcAliasAddr, _}, Acc) -> + P2PAddr = libp2p_crypto:pubkey_bin_to_p2p(GrpcAliasAddr), + Swarm = ct_rpc:call(Miner, blockchain_swarm, swarm, []), + TID = ct_rpc:call(Miner, blockchain_swarm, tid, []), + ListenAddrs = ct_rpc:call(Miner, libp2p_swarm, listen_addrs, [Swarm]), + [H | _ ] = _SortedAddrs = ct_rpc:call(Miner, libp2p_transport, sort_addrs, [TID, ListenAddrs]), + [_, _, _IP,_, Libp2pPort] = _Full = re:split(H, "/"), + GrpcPort = list_to_integer(binary_to_list(Libp2pPort)) + 1000, + [{P2PAddr, {GrpcPort, false}} | Acc] + end, [], Keys), + ct:pal("miner grpc port aliases ~p", [MinerGRPCPortAliases]), + + %% create a list of validators and for each their p2p addr, ip addr and grpc port + %% use this list to set an app env var to provide a list of default validators to which + %% gateways can connect + %% only used when testing grpc gateways + SeedValidators = lists:foldl( + fun({Miner, _, _, _, ValAddr, _}, Acc) -> + P2PAddr = libp2p_crypto:pubkey_bin_to_p2p(ValAddr), + Swarm = ct_rpc:call(Miner, blockchain_swarm, swarm, []), + TID = ct_rpc:call(Miner, blockchain_swarm, tid, []), + ListenAddrs = ct_rpc:call(Miner, libp2p_swarm, listen_addrs, [Swarm]), + [H | _ ] = _SortedAddrs = ct_rpc:call(Miner, libp2p_transport, sort_addrs, [TID, ListenAddrs]), + [_, _, _IP,_, Libp2pPort] = _Full = re:split(H, "/"), + GrpcPort = list_to_integer(binary_to_list(Libp2pPort)) + 1000, + [{P2PAddr, "127.0.0.1", GrpcPort} | Acc] + end, [], Keys), + ct:pal("seed validators: ~p", [SeedValidators]), + + %% set any required env vars for grpc gateways + lists:foreach(fun(Gateway)-> + ct_rpc:call(Gateway, application, set_env, [miner, seed_validators, SeedValidators]), + ct_rpc:call(Gateway, application, set_env, [miner, gateways_run_chain, LoadChainOnGateways]) + end, Gateways), + + %% set any required env vars for validators + lists:foreach(fun(Val)-> + ct_rpc:call(Val, application, set_env, [sibyl, node_grpc_port_aliases, MinerGRPCPortAliases]), + ct_rpc:call(Val, application, set_env, [sibyl, poc_mgr_mod, miner_poc_mgr]), + ct_rpc:call(Val, application, set_env, [sibyl, poc_report_handler, miner_poc_report_handler]) + end, Validators), + %% accumulate the address of each miner - MinerTaggedAddresses = lists:foldl( + MinerTaggedAddresses = lists:reverse(lists:foldl( fun(Miner, Acc) -> - Address = ct_rpc:call(Miner, blockchain_swarm, pubkey_bin, []), - [{Miner, Address} | Acc] + PubKeyBin = ct_rpc:call(Miner, blockchain_swarm, pubkey_bin, []), + [{Miner, PubKeyBin} | Acc] end, [], Miners - ), + )), + ct:pal("MinerTaggedAddresses: ~p", [MinerTaggedAddresses]), + %% save a version of the address list with the miner and address tuple %% and then a version with just a list of addresses {_Keys, Addresses} = lists:unzip(MinerTaggedAddresses), + {ValidatorAddrs, GatewayAddrs} = + case SplitMiners of + true -> + lists:split(NumValidators, Addresses); + _ -> + {[], Addresses} + end, + + ct:pal("Validator Addrs: ~p", [ValidatorAddrs]), + ct:pal("Gateway Addrs: ~p", [GatewayAddrs]), + {ok, _} = ct_cover:add_nodes(Miners), %% wait until we get confirmation the miners are fully up %% which we are determining by the miner_consensus_mgr being registered - %% QUESTION: is there a better process to use to determine things are healthy - %% and which works for both in consensus and non consensus miners? - ok = miner_ct_utils:wait_for_registration(Miners, miner_consensus_mgr), - %ok = miner_ct_utils:wait_for_registration(Miners, blockchain_worker), + %% if we have a split of validators and gateways, we only need to wait on the validators + %% otherwise wait for all gateways + case SplitMiners of + true -> + ok = miner_ct_utils:wait_for_registration(Validators, miner_consensus_mgr); + false -> + ok = miner_ct_utils:wait_for_registration(Miners, miner_consensus_mgr) + end, - UpdatedMinersAndPorts = lists:map(fun({Miner, {TCPPort, _, JsonRpcPort}}) -> - {ok, RandomPort} = ct_rpc:call(Miner, miner_lora, port, []), - ct:pal("~p is listening for packet forwarder on ~p", [Miner, RandomPort]), - {Miner, {TCPPort, RandomPort, JsonRpcPort}} - end, MinersAndPorts), + %% get a sep list of ports for validators and gateways + {ValidatorPorts, GatewayPorts} = + case SplitMiners of + true -> + lists:split(NumValidators, MinersAndPorts); + _ -> + {[], MinersAndPorts} + end, + UpdatedValidatorPorts = lists:map(fun({Miner, {TCPPort, _, JsonRpcPort}}) -> + {Miner, {TCPPort, ignore, JsonRpcPort}} + end, ValidatorPorts), [ {miners, Miners}, + {validators, Validators}, + {gateways, Gateways}, + {validator_addrs, ValidatorAddrs}, + {gateway_addrs, GatewayAddrs}, + {addrs, Addrs}, {keys, Keys}, - {ports, UpdatedMinersAndPorts}, + {ports, UpdatedValidatorPorts ++ GatewayPorts}, + {validator_ports, UpdatedValidatorPorts}, + {gateway_ports, GatewayPorts}, {node_options, Options}, {addresses, Addresses}, {tagged_miner_addresses, MinerTaggedAddresses}, @@ -894,17 +1117,19 @@ init_per_testcase(Mod, TestCase, Config0) -> ]. get_addrs(Miners) -> - miner_ct_utils:pmap( - fun(Miner) -> + lists:foldl( + fun(Miner, Acc) -> Swarm = ct_rpc:call(Miner, blockchain_swarm, swarm, [], 2000), + ct:pal("swarm ~p ~p", [Miner, Swarm]), true = miner_ct_utils:wait_until( fun() -> - length(ct_rpc:call(Miner, libp2p_swarm, listen_addrs, [Swarm], 2000)) > 0 - end), - ct:pal("swarm ~p ~p", [Miner, Swarm]), - [H|_] = ct_rpc:call(Miner, libp2p_swarm, listen_addrs, [Swarm], 2000), - H - end, Miners). + length(ct_rpc:call(Miner, libp2p_swarm, listen_addrs, [Swarm], 5000)) > 0 + end, 20, 1000), + + [H|_] = ct_rpc:call(Miner, libp2p_swarm, listen_addrs, [Swarm], 5000), + ct:pal("miner ~p has addr ~p", [Miner, H]), + [H | Acc] + end, [], Miners). make_keys(Miner, Ports) -> #{secret := GPriv, public := GPub} = @@ -923,6 +1148,9 @@ config_node({Miner, {TCPPort, UDPPort, JSONRPCPort}, ECDH, PubKey, _Addr, SigFun Curve = proplists:get_value(curve, Options), DefaultRouters = proplists:get_value(default_routers, Options), Port = proplists:get_value(port, Options), + Mode = proplists:get_value(mode, Options, gateway), + LoadChainOnGateways = proplists:get_value(gateways_run_chain, Options, true), + ct:pal("Miner ~p", [Miner]), ct_rpc:call(Miner, cover, start, []), @@ -937,7 +1165,8 @@ config_node({Miner, {TCPPort, UDPPort, JSONRPCPort}, ECDH, PubKey, _Addr, SigFun ct_rpc:call(Miner, application, set_env, [lager, metadata_whitelist, [poc_id]]), %% set blockchain configuration - Key = {PubKey, ECDH, SigFun}, +%% Key = {PubKey, ECDH, SigFun}, + Key = #{pubkey => PubKey, ecdh_fun => ECDH, sig_fun => SigFun}, MinerBaseDir = BaseDir ++ "_" ++ atom_to_list(Miner), ct:pal("MinerBaseDir: ~p", [MinerBaseDir]), @@ -959,7 +1188,9 @@ config_node({Miner, {TCPPort, UDPPort, JSONRPCPort}, ECDH, PubKey, _Addr, SigFun %% set miner configuration ct_rpc:call(Miner, application, set_env, [miner, curve, Curve]), ct_rpc:call(Miner, application, set_env, [miner, jsonrpc_port, JSONRPCPort]), - ct_rpc:call(Miner, application, set_env, [miner, mode, validator]), + ct_rpc:call(Miner, application, set_env, [miner, mode, Mode]), + ct_rpc:call(Miner, application, set_env, [miner, gateways_run_chain, LoadChainOnGateways]), + ct_rpc:call(Miner, application, set_env, [miner, radio_device, {{127,0,0,1}, UDPPort, {127,0,0,1}, TCPPort}]), ct_rpc:call(Miner, application, set_env, [miner, stabilization_period_start, 2]), ct_rpc:call(Miner, application, set_env, [miner, default_routers, [DefaultRouters]]), @@ -990,7 +1221,8 @@ end_per_testcase(TestCase, Config) -> case ?config(tc_status, Config) of ok -> %% test passed, we can cleanup - cleanup_per_testcase(TestCase, Config); +%% cleanup_per_testcase(TestCase, Config), + ok; _ -> %% leave results alone for analysis ok @@ -1230,6 +1462,10 @@ new_random_key(Curve) -> #{secret := PrivKey, public := PubKey} = libp2p_crypto:generate_keys(Curve), {PrivKey, PubKey}. +new_random_key_with_sig_fun(Curve) -> + #{secret := PrivKey, public := PubKey} = libp2p_crypto:generate_keys(Curve), + SigFun = libp2p_crypto:mk_sig_fun(PrivKey), + {PrivKey, PubKey, SigFun}. %%-------------------------------------------------------------------- %% @doc @@ -1513,7 +1749,8 @@ create_block(ConsensusMembers, Txs) -> election_epoch => 1, epoch_start => 1, seen_votes => [], - bba_completion => <<>>}), + bba_completion => <<>>, + poc_keys => []}), BinBlock = blockchain_block:serialize(blockchain_block:set_signatures(Block0, [])), Signatures = signatures(ConsensusMembers, BinBlock), Block1 = blockchain_block:set_signatures(Block0, Signatures), diff --git a/test/miner_poc_SUITE.erl b/test/miner_poc_SUITE.erl index 879490f91..c7dde334e 100644 --- a/test/miner_poc_SUITE.erl +++ b/test/miner_poc_SUITE.erl @@ -849,13 +849,28 @@ exec_dist_test(TestCase, Config, VarMap, Status) -> setup_dist_test(TestCase, Config, VarMap, Status) -> Miners = ?config(miners, Config), - MinersAndPorts = ?config(ports, Config), {_, Locations} = lists:unzip(initialize_chain(Miners, TestCase, Config, VarMap)), GenesisBlock = miner_ct_utils:get_genesis_block(Miners, Config), - RadioPorts = [ P || {_Miner, {_TP, P, _JRPCP}} <- MinersAndPorts ], + + ok = miner_ct_utils:load_genesis_block(GenesisBlock, Miners, Config), + %% the radio ports used to be fetched from miner lora as part of init_per_testcase + %% but the port is only opened now after a chain is up and been consulted to + %% determine if validators are running POCs + %% So now we have wait until the chain is up and miner lora has opened the port + true = miner_ct_utils:wait_for_lora_port(Miners, miner_lora, 30), + + RadioPorts = lists:map( + fun(Miner) -> + {ok, RandomPort} = ct_rpc:call(Miner, miner_lora, port, []), + ct:pal("~p is listening for packet forwarder on ~p", [Miner, RandomPort]), + RandomPort + end, + Miners), + +%% RadioPorts = [ P || {_Miner, {_TP, P, _JRPCP}} <- MinersAndPorts ], {ok, _FakeRadioPid} = miner_fake_radio_backplane:start_link(maps:get(?poc_version, VarMap), 45000, lists:zip(RadioPorts, Locations), Status), - ok = miner_ct_utils:load_genesis_block(GenesisBlock, Miners, Config), + miner_fake_radio_backplane ! go, %% wait till height 10 ok = miner_ct_utils:wait_for_gte(height, Miners, 10, all, 30), @@ -1171,7 +1186,8 @@ common_poc_vars(Config) -> ?poc_v4_target_prob_score_wt => 0.8, ?poc_v4_target_score_curve => 5, ?poc_target_hex_parent_res => 5, - ?poc_v5_target_prob_randomness_wt => 0.0}. + ?poc_v5_target_prob_randomness_wt => 0.0, + ?poc_witness_consideration_limit => 20}. do_common_partition_checks(TestCase, Config, VarMap) -> Miners = ?config(miners, Config), @@ -1364,7 +1380,7 @@ do_common_partition_lying_checks(TestCase, Config, VarMap) -> extra_vars(poc_v11) -> POCVars = maps:merge(extra_vars(poc_v10), miner_poc_test_utils:poc_v11_vars()), - RewardVars = #{reward_version => 5, rewards_txn_version => 2}, + RewardVars = #{reward_version => 5, rewards_txn_version => 2, poc_witness_consideration_limit => 20}, maps:merge(POCVars, RewardVars); extra_vars(poc_v10) -> maps:merge(extra_poc_vars(), diff --git a/test/miner_poc_grpc_SUITE.erl b/test/miner_poc_grpc_SUITE.erl new file mode 100644 index 000000000..5502687dc --- /dev/null +++ b/test/miner_poc_grpc_SUITE.erl @@ -0,0 +1,591 @@ +-module(miner_poc_grpc_SUITE). + +-include_lib("common_test/include/ct.hrl"). +-include_lib("eunit/include/eunit.hrl"). +-include_lib("blockchain/include/blockchain_vars.hrl"). +-include_lib("blockchain/include/blockchain.hrl"). + +-export([ + groups/0, all/0, test_cases/0, init_per_group/2, end_per_group/2, init_per_testcase/2, end_per_testcase/2 +]). + +-export([ + poc_grpc_dist_v11_test/1, + poc_grpc_dist_v11_cn_test/1, + poc_grpc_dist_v11_partitioned_test/1, + poc_grpc_dist_v11_partitioned_lying_test/1 +]). + +-define(SFLOCS, [631210968910285823, 631210968909003263, 631210968912894463, 631210968907949567]). +-define(NYLOCS, [631243922668565503, 631243922671147007, 631243922895615999, 631243922665907711]). +-define(AUSTINLOCS1, [631781084745290239, 631781089167934463, 631781054839691775, 631781050465723903]). +-define(AUSTINLOCS2, [631781452049762303, 631781453390764543, 631781452924144639, 631781452838965759]). +-define(LALOCS, [631236297173835263, 631236292179769855, 631236329165333503, 631236328049271807]). +-define(CNLOCS1, [ + 631649369216118271, %% spare-tortilla-raccoon + 631649369235022335, %% kind-tangerine-octopus + 631649369177018879, %% damp-hemp-pangolin + 631649369175419391 %% fierce-lipstick-poodle + ]). + +-define(CNLOCS2, [ + 631649369213830655, %% raspy-parchment-pike + 631649369205533183, %% fresh-gingham-porpoise + 631649369207629311, %% innocent-irish-pheasant + 631649368709059071 %% glorious-eggshell-finch + ]). + +%%-------------------------------------------------------------------- +%% COMMON TEST CALLBACK FUNCTIONS +%%-------------------------------------------------------------------- + +groups() -> + [{poc_grpc_with_chain, + [], + test_cases() + }, + {poc_grpc_no_chain, + [], + test_cases() + }]. + +%%-------------------------------------------------------------------- +%% @public +%% @doc +%% Running tests for this suite +%% @end +%%-------------------------------------------------------------------- +all() -> + [{group, poc_grpc_with_chain}, {group, poc_grpc_no_chain}]. + +test_cases() -> + [ + poc_grpc_dist_v11_test, + poc_grpc_dist_v11_cn_test, + poc_grpc_dist_v11_partitioned_test, + poc_grpc_dist_v11_partitioned_lying_test + ]. + +init_per_group(poc_grpc_with_chain, Config) -> + [ + {split_miners_vals_and_gateways, true}, + {num_validators, 10}, + {num_gateways, 6}, + {num_consensus_members, 4}, + {gateways_run_chain, true} | Config]; +init_per_group(poc_grpc_no_chain, Config) -> + [ + {split_miners_vals_and_gateways, true}, + {num_validators, 10}, + {num_gateways, 6}, + {num_consensus_members, 4}, + {gateways_run_chain, false} | Config]. + +init_per_testcase(TestCase, Config) -> + miner_ct_utils:init_per_testcase(?MODULE, TestCase, Config). + +end_per_testcase(TestCase, Config) -> + gen_server:stop(miner_fake_radio_backplane), + miner_ct_utils:end_per_testcase(TestCase, Config). + +end_per_group(_, _Config) -> + ok. +%%-------------------------------------------------------------------- +%% TEST CASES +%%-------------------------------------------------------------------- +poc_grpc_dist_v11_test(Config) -> + CommonPOCVars = common_poc_vars(Config), + ExtraVars = extra_vars(grpc), + run_dist_with_params(poc_grpc_dist_v11_test, Config, maps:merge(CommonPOCVars, ExtraVars)). + +poc_grpc_dist_v11_cn_test(Config) -> + CommonPOCVars = common_poc_vars(Config), + ExtraVars = extra_vars(grpc), + run_dist_with_params(poc_grpc_dist_v11_cn_test, Config, maps:merge(CommonPOCVars, ExtraVars)). + +poc_grpc_dist_v11_partitioned_test(Config) -> + CommonPOCVars = common_poc_vars(Config), + ExtraVars = extra_vars(grpc), + run_dist_with_params(poc_grpc_dist_v11_partitioned_test, Config, maps:merge(CommonPOCVars, ExtraVars)). + +poc_grpc_dist_v11_partitioned_lying_test(Config) -> + CommonPOCVars = common_poc_vars(Config), + ExtraVars = extra_vars(grpc), + run_dist_with_params(poc_grpc_dist_v11_partitioned_lying_test, Config, maps:merge(CommonPOCVars, ExtraVars)). + +%% ------------------------------------------------------------------ +%% Internal Function Definitions +%% ------------------------------------------------------------------ + +run_dist_with_params(TestCase, Config, VarMap) -> + run_dist_with_params(TestCase, Config, VarMap, true). + +run_dist_with_params(TestCase, Config, VarMap, Status) -> + ok = setup_dist_test(TestCase, Config, VarMap, Status), + %% Execute the test + ok = exec_dist_test(TestCase, Config, VarMap, Status), + %% show the final receipt counter + Validators = ?config(validators, Config), + FinalReceiptMap = challenger_receipts_map(find_receipts(Validators)), + ct:pal("FinalReceiptMap: ~p", [FinalReceiptMap]), + ct:pal("FinalReceiptCounter: ~p", [receipt_counter(FinalReceiptMap)]), + %% The test endeth here + ok. + +exec_dist_test(poc_grpc_dist_v11_partitioned_lying_test, Config, VarMap, _Status) -> + do_common_partition_lying_checks(poc_grpc_dist_v11_partitioned_lying_test, Config, VarMap); +exec_dist_test(poc_grpc_dist_v11_partitioned_test, Config, VarMap, _Status) -> + do_common_partition_checks(poc_grpc_dist_v11_partitioned_test, Config, VarMap); +exec_dist_test(_TestCase, Config, VarMap, Status) -> + Validators = ?config(validators, Config), + %% Print scores before we begin the test + InitialScores = gateway_scores(Config), + ct:pal("InitialScores: ~p", [InitialScores]), + %% check that every miner has issued a challenge + case Status of + %% expect failure and exit + false -> + ok; + true -> + %% Check that the receipts are growing + case maps:get(?poc_version, VarMap, 11) of + V when V >= 10 -> + %% There are no paths in v11 or v10 for that matter, so we'll consolidate + %% the checks for both poc-v10 and poc-v11 here + true = miner_ct_utils:wait_until( + fun() -> + C1 = check_validators_are_creating_poc_keys(Validators), + %% Check if we have some receipts + C2 = maps:size(challenger_receipts_map(find_receipts(Validators))) > 0, + %% Check there are some poc rewards + RewardsMD = get_rewards_md(Config), + ct:pal("RewardsMD: ~p", [RewardsMD]), + C3 = check_non_empty_poc_rewards(take_poc_challengee_and_witness_rewards(RewardsMD)), + ct:pal("C1: ~p C2: ~p, C3: ~p", [C1, C2, C3]), + C1 andalso C2 andalso C3 + end, + 25, 5000), + FinalRewards = get_rewards(Config), + ct:pal("FinalRewards: ~p", [FinalRewards]), + ok; + _ -> + ok + end + end, + ok. + +setup_dist_test(TestCase, Config, VarMap, Status) -> + AllMiners = ?config(miners, Config), + Validators = ?config(validators, Config), + Gateways = ?config(gateways, Config), + RunChainOnGateways = proplists:get_value(gateways_run_chain, Config, true), + {_, Locations} = lists:unzip(initialize_chain(Validators, TestCase, Config, VarMap)), + + case RunChainOnGateways of + true -> + _ = miner_ct_utils:integrate_genesis_block(hd(Validators), Gateways); + false -> + ok + end, + + %% the radio ports used to be fetched from miner lora as part of init_per_testcase + %% but the port is only opened now after a chain is up and been consulted to + %% determine if validators are running POCs + %% So now we have wait until the chain is up and miner lora has opened the port + true = miner_ct_utils:wait_for_lora_port(Gateways, miner_lora_light, 30), + + RadioPorts = lists:map( + fun(Gateway) -> + {ok, RandomPort} = ct_rpc:call(Gateway, miner_lora_light, port, []), + ct:pal("~p is listening for packet forwarder on ~p", [Gateway, RandomPort]), + RandomPort + end, + Gateways), + {ok, _FakeRadioPid} = miner_fake_radio_backplane:start_link(maps:get(?poc_version, VarMap), 45000, + lists:zip(RadioPorts, Locations), Status), + miner_fake_radio_backplane ! go, + %% wait till height 2 + case RunChainOnGateways of + true -> + ok = miner_ct_utils:wait_for_gte(height, AllMiners, 2, all, 30); + false -> + ok = miner_ct_utils:wait_for_gte(height, Validators, 2, all, 30) + end, + ok. + +gen_locations(poc_grpc_dist_v11_partitioned_lying_test, _, _) -> + {?AUSTINLOCS1 ++ ?LALOCS, lists:duplicate(4, hd(?AUSTINLOCS1)) ++ lists:duplicate(4, hd(?LALOCS))}; +gen_locations(poc_grpc_dist_v11_partitioned_test, _, _) -> + %% These are taken from the ledger + {?AUSTINLOCS1 ++ ?LALOCS, ?AUSTINLOCS1 ++ ?LALOCS}; +gen_locations(poc_grpc_dist_v11_cn_test, _, _) -> + %% Actual locations are the same as the claimed locations for the dist test + {?CNLOCS1 ++ ?CNLOCS2, ?CNLOCS1 ++ ?CNLOCS2}; +gen_locations(_TestCase, Addresses, VarMap) -> + LocationJitter = case maps:get(?poc_version, VarMap, 1) of + V when V > 3 -> + 100; + _ -> + 1000000 + end, + + Locs = lists:foldl( + fun(I, Acc) -> + [h3:from_geo({37.780586, -122.469470 + I/LocationJitter}, 13)|Acc] + end, + [], + lists:seq(1, length(Addresses)) + ), + {Locs, Locs}. + +initialize_chain(_AllMiners, TestCase, Config, VarMap) -> + AllAddresses = ?config(addresses, Config), + Validators = ?config(validators, Config), + ValidatorAddrs = ?config(validator_addrs, Config), + GatewayAddrs = ?config(gateway_addrs, Config), + + N = ?config(num_consensus_members, Config), + Curve = ?config(dkg_curve, Config), + Keys = libp2p_crypto:generate_keys(ecc_compact), + InitialVars = miner_ct_utils:make_vars(Keys, VarMap), + InitialPaymentTransactions = [blockchain_txn_coinbase_v1:new(Addr, 5000) || Addr <- AllAddresses], + AddValTxns = [blockchain_txn_gen_validator_v1:new(Addr, Addr, ?bones(10000)) || Addr <- ValidatorAddrs], + + {ActualLocations, ClaimedLocations} = gen_locations(TestCase, GatewayAddrs, VarMap), + ct:pal("GatewayAddrs: ~p, ActualLocations: ~p, ClaimedLocations: ~p",[GatewayAddrs, ActualLocations, ClaimedLocations]), + AddressesWithLocations = lists:zip(GatewayAddrs, ActualLocations), + AddressesWithClaimedLocations = lists:zip(GatewayAddrs, ClaimedLocations), + InitialGenGatewayTxns = [blockchain_txn_gen_gateway_v1:new(Addr, Addr, Loc, 0) || {Addr, Loc} <- AddressesWithLocations], + InitialTransactions = InitialVars ++ InitialPaymentTransactions ++ AddValTxns ++ InitialGenGatewayTxns, + {ok, DKGCompletedNodes} = miner_ct_utils:initial_dkg(Validators, InitialTransactions, ValidatorAddrs, N, Curve), + + %% integrate genesis block + _GenesisLoadResults = miner_ct_utils:integrate_genesis_block(hd(DKGCompletedNodes), Validators -- DKGCompletedNodes), + AddressesWithClaimedLocations. + + +find_receipts(Validators) -> + [V | _] = Validators, + Chain = ct_rpc:call(V, blockchain_worker, blockchain, []), + Blocks = ct_rpc:call(V, blockchain, blocks, [Chain]), + lists:flatten(lists:foldl(fun({_Hash, Block}, Acc) -> + Txns = blockchain_block:transactions(Block), + Height = blockchain_block:height(Block), + Receipts = lists:filter(fun(T) -> + blockchain_txn:type(T) == blockchain_txn_poc_receipts_v2 + end, + Txns), + TaggedReceipts = lists:map(fun(R) -> + {Height, R} + end, + Receipts), + TaggedReceipts ++ Acc + end, + [], + maps:to_list(Blocks))). + +challenger_receipts_map(Receipts) -> + ReceiptMap = lists:foldl( + fun({_Height, Receipt}=R, Acc) -> + {ok, Challenger} = erl_angry_purple_tiger:animal_name(libp2p_crypto:bin_to_b58(blockchain_txn_poc_receipts_v2:challenger(Receipt))), + case maps:get(Challenger, Acc, undefined) of + undefined -> + maps:put(Challenger, [R], Acc); + List -> + maps:put(Challenger, lists:keysort(1, [R | List]), Acc) + end + end, + #{}, + Receipts), + + ct:pal("ReceiptMap: ~p", [ReceiptMap]), + + ReceiptMap. + +check_validators_are_creating_poc_keys([Val |_] = _Validators) -> + Chain = ct_rpc:call(Val, blockchain_worker, blockchain, []), + Ledger = ct_rpc:call(Val, blockchain, ledger, [Chain]), + {ok, CurHeight} = ct_rpc:call(Val, blockchain_ledger_v1, current_height, [Ledger]), + {ok, Block} = ct_rpc:call(Val, blockchain_ledger_v1, get_block, [CurHeight, Ledger]), + case blockchain_block_v1:poc_keys(Block) of + [] -> false; + [_] -> true + end. + +check_partitioned_lying_path_growth(_TestCase, Miners) -> + ReceiptMap = challenger_receipts_map(find_receipts(Miners)), + ct:pal("ReceiptMap: ~p", [ReceiptMap]), + not check_subsequent_path_growth(ReceiptMap). + +receipt_counter(ReceiptMap) -> + lists:foldl(fun({Name, ReceiptList}, Acc) -> + Counts = lists:map(fun({Height, ReceiptTxn}) -> + {Height, length(blockchain_txn_poc_receipts_v2:path(ReceiptTxn))} + end, + ReceiptList), + maps:put(Name, Counts, Acc) + end, + #{}, + maps:to_list(ReceiptMap)). + +gateway_scores(Config) -> + [V | _] = ?config(validators, Config), + Addresses = ?config(gateway_addrs, Config), + Chain = ct_rpc:call(V, blockchain_worker, blockchain, []), + Ledger = ct_rpc:call(V, blockchain, ledger, [Chain]), + lists:foldl(fun(Address, Acc) -> + {ok, S} = ct_rpc:call(V, blockchain_ledger_v1, gateway_score, [Address, Ledger]), + {ok, Name} = erl_angry_purple_tiger:animal_name(libp2p_crypto:bin_to_b58(Address)), + maps:put(Name, S, Acc) + end, + #{}, + Addresses). + +common_poc_vars(Config) -> + N = ?config(num_consensus_members, Config), + BlockTime = ?config(block_time, Config), + Interval = ?config(election_interval, Config), + BatchSize = ?config(batch_size, Config), + Curve = ?config(dkg_curve, Config), + %% Don't put the poc version here + %% Add it to the map in the tests above + #{?block_time => BlockTime, + ?election_interval => Interval, + ?num_consensus_members => N, + ?batch_size => BatchSize, + ?dkg_curve => Curve, + ?election_version => 6, %% TODO validators + ?poc_challenge_interval => 15, + ?poc_v4_exclusion_cells => 10, + ?poc_v4_parent_res => 11, + ?poc_v4_prob_bad_rssi => 0.01, + ?poc_v4_prob_count_wt => 0.3, + ?poc_v4_prob_good_rssi => 1.0, + ?poc_v4_prob_no_rssi => 0.5, + ?poc_v4_prob_rssi_wt => 0.3, + ?poc_v4_prob_time_wt => 0.3, + ?poc_v4_randomness_wt => 0.1, + ?poc_v4_target_challenge_age => 300, + ?poc_v4_target_exclusion_cells => 6000, + ?poc_v4_target_prob_edge_wt => 0.2, + ?poc_v4_target_prob_score_wt => 0.8, + ?poc_v4_target_score_curve => 5, + ?poc_target_hex_parent_res => 5, + ?poc_v5_target_prob_randomness_wt => 0.0}. + +do_common_partition_checks(_TestCase, Config, VarMap) -> + Validators = ?config(validators, Config), + %% Print scores before we begin the test + InitialScores = gateway_scores(Config), + ct:pal("InitialScores: ~p", [InitialScores]), + true = miner_ct_utils:wait_until( + fun() -> + case maps:get(poc_version, VarMap, 1) of + V when V >= 10 -> + %% There is no path to check, so do both poc-v10 and poc-v11 checks here + %% Check that every miner has issued a challenge + C1 = check_validators_are_creating_poc_keys(Validators), + %% Check there are some poc rewards + RewardsMD = get_rewards_md(Config), + ct:pal("RewardsMD: ~p", [RewardsMD]), + C2 = check_non_empty_poc_rewards(take_poc_challengee_and_witness_rewards(RewardsMD)), + ct:pal("C1: ~p, C2: ~p", [C1, C2]), + C1 andalso C2; + _ -> + ok + end + end, 60, 5000), + %% Print scores after execution + FinalScores = gateway_scores(Config), + ct:pal("FinalScores: ~p", [FinalScores]), + FinalRewards = get_rewards(Config), + ct:pal("FinalRewards: ~p", [FinalRewards]), + ok. + +balances(Config) -> + [V | _] = ?config(validators, Config), + Addresses = ?config(validator_addrs, Config), + [miner_ct_utils:get_balance(V, Addr) || Addr <- Addresses]. + +take_poc_challengee_and_witness_rewards(RewardsMD) -> + %% only take poc_challengee and poc_witness rewards + POCRewards = lists:foldl( + fun({Ht, MDMap}, Acc) -> + [{Ht, maps:with([poc_challengee, poc_witness], MDMap)} | Acc] + end, + [], + RewardsMD), + ct:pal("POCRewards: ~p", [POCRewards]), + POCRewards. + +check_non_empty_poc_rewards(POCRewards) -> + lists:any( + fun({_Ht, #{poc_challengee := R1, poc_witness := R2}}) -> + maps:size(R1) > 0 andalso maps:size(R2) > 0 + end, + POCRewards). + + +get_rewards_md(Config) -> + %% NOTE: It's possible that the calculations below may blow up + %% since we are folding the entire chain here and some subsequent + %% ledger_at call in rewards_metadata blows up. Investigate + + [V | _] = ?config(validators, Config), + Chain = ct_rpc:call(V, blockchain_worker, blockchain, []), + {ok, Head} = ct_rpc:call(V, blockchain, head_block, [Chain]), + + Filter = fun(T) -> blockchain_txn:type(T) == blockchain_txn_rewards_v2 end, + Fun = fun(Block, Acc) -> + case blockchain_utils:find_txn(Block, Filter) of + [T] -> + Start = blockchain_txn_rewards_v2:start_epoch(T), + End = blockchain_txn_rewards_v2:end_epoch(T), + MDRes = ct_rpc:call(V, blockchain_txn_rewards_v2, calculate_rewards_metadata, [ + Start, + End, + Chain + ]), + case MDRes of + {ok, MD} -> + [{blockchain_block:height(Block), MD} | Acc]; + _ -> + Acc + end; + _ -> + Acc + end + end, + Res = ct_rpc:call(V, blockchain, fold_chain, [Fun, [], Head, Chain]), + Res. + + +get_rewards(Config) -> + %% default to rewards_v1 + get_rewards(Config, blockchain_txn_rewards_v2). + +get_rewards(Config, RewardType) -> + [Val | _] = ?config(validators, Config), + Chain = ct_rpc:call(Val, blockchain_worker, blockchain, []), + Blocks = ct_rpc:call(Val, blockchain, blocks, [Chain]), + maps:fold(fun(_, Block, Acc) -> + case blockchain_block:transactions(Block) of + [] -> + Acc; + Ts -> + Rewards = lists:filter(fun(T) -> + blockchain_txn:type(T) == RewardType + end, + Ts), + lists:flatten([Rewards | Acc]) + end + end, + [], + Blocks). + +check_poc_rewards(RewardsTxns) -> + %% Get all rewards types + RewardTypes = lists:foldl(fun(RewardTxn, Acc) -> + Types = [blockchain_txn_reward_v1:type(R) || R <- blockchain_txn_rewards_v2:rewards(RewardTxn)], + lists:flatten([Types | Acc]) + end, + [], + RewardsTxns), + lists:any(fun(T) -> + T == poc_challengees orelse T == poc_witnesses + end, + RewardTypes). + +do_common_partition_lying_checks(TestCase, Config, VarMap) -> + Validators = ?config(validators, Config), + %% Print scores before we begin the test + InitialScores = gateway_scores(Config), + ct:pal("InitialScores: ~p", [InitialScores]), + %% Print scores before we begin the test + InitialBalances = balances(Config), + ct:pal("InitialBalances: ~p", [InitialBalances]), + + true = miner_ct_utils:wait_until( + fun() -> + case maps:get(poc_version, VarMap, 11) of + V when V > 10 -> + %% Check that every miner has issued a challenge + C1 = check_validators_are_creating_poc_keys(Validators), + %% TODO: What to check when the partitioned nodes are lying about their locations + C1; + _ -> + %% Check that every miner has issued a challenge + C1 = check_validators_are_creating_poc_keys(Validators), + %% Since we have two static location partitioned networks, where + %% both are lying about their distances, the paths should + %% never get longer than 1 + C2 = check_partitioned_lying_path_growth(TestCase, Validators), + C1 andalso C2 + end + end, + 40, 5000), + %% Print scores after execution + FinalScores = gateway_scores(Config), + ct:pal("FinalScores: ~p", [FinalScores]), + %% Print rewards + Rewards = get_rewards(Config), + ct:pal("Rewards: ~p", [Rewards]), + %% Print balances after execution + FinalBalances = balances(Config), + ct:pal("FinalBalances: ~p", [FinalBalances]), + %% There should be no poc_witness or poc_challengees rewards + ?assert(not check_poc_rewards(Rewards)), + ok. + +extra_vars(grpc) -> + GrpcVars = #{ + ?poc_challenge_rate => 1, + ?poc_challenger_type => validator, + ?poc_timeout => 4, + ?poc_receipts_absorb_timeout => 2, + ?poc_validator_ephemeral_key_count => 10, + ?poc_validator_ephemeral_key_timeout => 50 + }, + maps:merge(extra_vars(poc_v11), GrpcVars); +extra_vars(poc_v11) -> + POCVars = maps:merge(extra_vars(poc_v10), miner_poc_test_utils:poc_v11_vars()), + RewardVars = #{reward_version => 5, rewards_txn_version => 2}, + maps:merge(POCVars, RewardVars); +extra_vars(poc_v10) -> + maps:merge(extra_poc_vars(), + #{?poc_version => 10, + ?data_aggregation_version => 2, + ?consensus_percent => 0.06, + ?dc_percent => 0.325, + ?poc_challengees_percent => 0.18, + ?poc_challengers_percent => 0.0095, + ?poc_witnesses_percent => 0.0855, + ?securities_percent => 0.34, + ?reward_version => 5, + ?rewards_txn_version => 2, + ?election_interval => 10, + ?block_time => 5000 + }); +extra_vars(poc_v8) -> + maps:merge(extra_poc_vars(), #{?poc_version => 8}); +extra_vars(_) -> + {error, poc_v8_and_above_only}. + +extra_poc_vars() -> + #{?poc_good_bucket_low => -132, + ?poc_good_bucket_high => -80, + ?poc_v5_target_prob_randomness_wt => 1.0, + ?poc_v4_target_prob_edge_wt => 0.0, + ?poc_v4_target_prob_score_wt => 0.0, + ?poc_v4_prob_rssi_wt => 0.0, + ?poc_v4_prob_time_wt => 0.0, + ?poc_v4_randomness_wt => 0.5, + ?poc_v4_prob_count_wt => 0.0, + ?poc_centrality_wt => 0.5, + ?poc_max_hop_cells => 2000}. + +check_subsequent_path_growth(ReceiptMap) -> + PathLengths = [ length(blockchain_txn_poc_receipts_v2:path(Txn)) || {_, Txn} <- lists:flatten(maps:values(ReceiptMap)) ], + ct:pal("PathLengths: ~p", [PathLengths]), + lists:any(fun(L) -> L > 1 end, PathLengths). + diff --git a/test/miner_poc_test_utils.erl b/test/miner_poc_test_utils.erl index 8cfe23325..32bea7902 100644 --- a/test/miner_poc_test_utils.erl +++ b/test/miner_poc_test_utils.erl @@ -128,12 +128,16 @@ download_serialized_region(URL) -> PrivDir = filename:join([Dir, "priv"]), ok = filelib:ensure_dir(PrivDir ++ "/"), ok = ssl:start(), - {ok, {{_, 200, "OK"}, _, Body}} = httpc:request(URL), - FName = hd(string:tokens(hd(lists:reverse(string:tokens(URL, "/"))), "?")), - FPath = filename:join([PrivDir, FName]), - ok = file:write_file(FPath, Body), - {ok, Data} = file:read_file(FPath), - Data. + case httpc:request(URL) of + {ok, {{_, 200, "OK"}, _, Body}} -> + FName = hd(string:tokens(hd(lists:reverse(string:tokens(URL, "/"))), "?")), + FPath = filename:join([PrivDir, FName]), + ok = file:write_file(FPath, Body), + {ok, Data} = file:read_file(FPath), + Data; + _ -> + <<>> + end. make_params(RegionParams) -> lists:foldl( @@ -150,4 +154,4 @@ construct_param(P) -> BW = proplists:get_value(<<"bandwidth">>, P), MaxEIRP = proplists:get_value(<<"max_eirp">>, P), Spreading = blockchain_region_spreading_v1:new(proplists:get_value(<<"spreading">>, P)), - blockchain_region_param_v1:new(CF, BW, MaxEIRP, Spreading). + blockchain_region_param_v1:new(CF, BW, MaxEIRP, Spreading). \ No newline at end of file diff --git a/test/miner_txn_mgr_SUITE.erl b/test/miner_txn_mgr_SUITE.erl index 72026cda4..e1dcdb7f0 100644 --- a/test/miner_txn_mgr_SUITE.erl +++ b/test/miner_txn_mgr_SUITE.erl @@ -633,4 +633,4 @@ nonce_updated_for_miner(Addr, ExpectedNonce, ConMiners)-> Nonce == ExpectedNonce end, ConMiners), [true] == lists:usort(HaveNoncesIncremented) - end, 200, 1000). + end, 200, 1000). \ No newline at end of file