Skip to content
Open
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
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
]}.

{deps, [
{ecc508, ".*", {git, "https://github.com/helium/ecc508.git", {branch, "master"}}},
{ecc508, ".*", {git, "https://github.com/flyerink/ecc508", {branch, "master"}}},
{ecc_compact, ".*", {git, "https://github.com/helium/ecc_compact.git", {branch, "master"}}},
{clique, ".*", {git, "https://github.com/helium/clique.git", {branch, "develop"}}},
{erl_base58, "0.0.1"},
Expand Down
34 changes: 3 additions & 31 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,32 +1,4 @@
{"1.1.0",
[{<<"clique">>,
{git,"https://github.com/helium/clique.git",
{ref,"e327ba3058004c32dd2166416a60497ba87933af"}},
0},
{<<"cuttlefish">>,
{git,"https://github.com/helium/cuttlefish.git",
{ref,"8672838e8f4ef61602aee6e4ff97ec9be54031dc"}},
1},
{<<"ecc508">>,
{git,"https://github.com/helium/ecc508.git",
{ref,"91d20ce3caf4f0567e95f71926d03ad3dcc2061d"}},
0},
{<<"ecc_compact">>,
{git,"https://github.com/helium/ecc_compact.git",
{ref,"a4508cbfa31f7c6f1a5b4e0391c1cc7d185ae0b1"}},
0},
{<<"erl_base58">>,{pkg,<<"erl_base58">>,<<"0.0.1">>},0},
{<<"erlang_ale">>,
[{<<"erlang_ale">>,
{git,"https://github.com/helium/erlang_ale",
{ref,"9db629ebf946e9b32a4dd5efefea3d16c3f808b9"}},
1},
{<<"getopt">>,{pkg,<<"getopt">>,<<"1.0.1">>},2},
{<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.9">>},1},
{<<"lager">>,{pkg,<<"lager">>,<<"3.6.7">>},0}]}.
[
{pkg_hash,[
{<<"erl_base58">>, <<"37710854461D71DF338E73C65776302DB41C4BAB4674D2EC134ED7BCFC7B5552">>},
{<<"getopt">>, <<"C73A9FA687B217F2FF79F68A3B637711BB1936E712B521D8CE466B29CBF7808A">>},
{<<"goldrush">>, <<"F06E5D5F1277DA5C413E84D5A2924174182FB108DABB39D5EC548B27424CD106">>},
{<<"lager">>, <<"2FBF823944CAA0FC10DF5EC13F3F047524A249BB32F0D801B7900C9610264286">>}]}
].
{ref,"07e10e656693f07a0d577f3651e76e52680c3768"}},
0}].
8 changes: 6 additions & 2 deletions src/gateway_mfr_worker.erl
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,11 @@ check_miner_key(Pid) ->
{ok, PubKey} ->
case ecc_compact:is_compact(PubKey) of
{true, _} -> ok;
false -> {error, not_compact}
false ->
case gen_compact_key(Pid, ?KEY_SLOT) of
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem correct.. check_miner_key is not there to actually generate the private key. It's just there to validate that there is a public compact key in a slot. There is a separate command to generate the private key

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If check the key not compact, it will always fail when run test. We can't run provision again to re-gen the private key any more. So this code can fix it by re-gen private key.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the right assumption. Check_key_configuration should only check that the chip was already correctly configured. If it returns an error on is_compact it means it was not provisioned/configured correctly in a previous step

{ok, _} -> ok;
{error, Error} -> {error, Error}
end
end;
{error, Error} ->
{error, Error}
Expand All @@ -288,7 +292,7 @@ check_miner_key(Pid) ->
%%

gen_compact_key(Pid, Slot) ->
gen_compact_key(Pid, Slot, 100).
gen_compact_key(Pid, Slot, 200).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you have to double the number of retries to 200? That seems like there's an issue with the part you are using if it needs this many retries to generate a private key

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As test by my customer, they find many failure chip, which can't pass the private key testing as not compact key. So we can increase to retry 200 times to gen a compact private key.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This usually implies a hardware integration issue. We used to have the same problems on the original Helium hotspot and it turned out to be either a badly configured driver or i2c bus issues


gen_compact_key(_Pid, _Slot, 0) ->
{error, compact_key_create_failed};
Expand Down