Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

Andymck/poc grpc plus vals as chall #1468

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .buildkite/scripts/make_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 31 additions & 0 deletions config/grpc_client_gen.config
Original file line number Diff line number Diff line change
@@ -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}
]}
]}.
12 changes: 12 additions & 0 deletions config/sys.config
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@
{log_file_time_to_roll, 86400} %% rotate logs once a day
]}
]},
{sibyl,
[
{validator_ignore_list, []}
]},
{miner,
[
{denylist_keys, ["1SbEYKju337P6aYsRd9DT2k4qgK5ZK62kXbSvnJgqeaxK3hqQrYURZjL"]},
Expand All @@ -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'},
Expand All @@ -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],
Expand Down
5 changes: 5 additions & 0 deletions config/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -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, ""},
Expand Down
8 changes: 7 additions & 1 deletion config/test_val.config.src
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
}
]}
].
16 changes: 9 additions & 7 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}},
Expand All @@ -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",
Expand All @@ -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"}
]}.
Expand Down
10 changes: 5 additions & 5 deletions rebar.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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"}},
Expand All @@ -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">>,
Expand Down Expand Up @@ -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},
Expand Down
9 changes: 5 additions & 4 deletions src/cli/miner_cli_info.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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} ->
Expand Down Expand Up @@ -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.");
Expand All @@ -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),
Expand All @@ -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) ];
Expand Down
Loading