diff --git a/rebar.config b/rebar.config index 1805972cbb..0a9b09d058 100644 --- a/rebar.config +++ b/rebar.config @@ -40,7 +40,7 @@ {erlang_stats, ".*", {git, "https://github.com/helium/erlang-stats.git", {branch, "master"}}}, {e2qc, ".*", {git, "https://github.com/helium/e2qc", {branch, "master"}}}, {vincenty, ".*", {git, "https://github.com/helium/vincenty", {branch, "master"}}}, - {helium_proto, {git, "https://github.com/helium/proto.git", {branch, "master"}}}, + {helium_proto, {git, "https://github.com/helium/proto.git", {branch, "andymck/poc-grpc-report-attestation"}}}, {lorawan, {git, "https://github.com/helium/erlang-lorawan.git", {branch, "master"}}}, {merkerl, ".*", {git, "https://github.com/helium/merkerl.git", {branch, "master"}}}, {xxhash, {git, "https://github.com/pierreis/erlang-xxhash", {branch, "master"}}}, diff --git a/rebar.lock b/rebar.lock index fcaf27bc11..d51772ce11 100644 --- a/rebar.lock +++ b/rebar.lock @@ -77,7 +77,7 @@ {<<"hackney">>,{pkg,<<"hackney">>,<<"1.18.0">>},0}, {<<"helium_proto">>, {git,"https://github.com/helium/proto.git", - {ref,"d1694d5ddb3801f70461921a33407b04d9df66f3"}}, + {ref,"45792698b66690062e4f130912edb772eb4edd45"}}, 0}, {<<"hpack">>,{pkg,<<"hpack_erl">>,<<"0.2.3">>},2}, {<<"idna">>,{pkg,<<"idna">>,<<"6.1.1">>},1}, diff --git a/src/transactions/v1/blockchain_poc_receipt_v1.erl b/src/transactions/v1/blockchain_poc_receipt_v1.erl index b936779187..896b02e138 100644 --- a/src/transactions/v1/blockchain_poc_receipt_v1.erl +++ b/src/transactions/v1/blockchain_poc_receipt_v1.erl @@ -9,10 +9,11 @@ -include("blockchain_caps.hrl"). -include("blockchain_vars.hrl"). -include("blockchain_utils.hrl"). +-include_lib("helium_proto/include/blockchain_poc_core_v1_pb.hrl"). -include_lib("helium_proto/include/blockchain_txn_poc_receipts_v1_pb.hrl"). -export([ - new/5, new/7, new/9, + new/5, new/7, new/9, new/10, gateway/1, timestamp/1, signal/1, @@ -98,7 +99,30 @@ new(Address, Timestamp, Signal, Data, Origin, SNR, Frequency, Channel, DataRate) datarate=DataRate, signature = <<>> }. - +-spec new(Address :: libp2p_crypto:pubkey_bin(), + Timestamp :: non_neg_integer(), + Signal :: integer(), + Data :: binary(), + Origin :: origin(), + SNR :: float(), + Frequency :: float(), + Channel :: non_neg_integer(), + DataRate :: binary(), + Attestation :: #attestation_pb{}) -> poc_receipt(). +new(Address, Timestamp, Signal, Data, Origin, SNR, Frequency, Channel, DataRate, Attestation) -> + #blockchain_poc_receipt_v1_pb{ + gateway=Address, + timestamp=Timestamp, + signal=Signal, + data=Data, + origin=Origin, + snr=SNR, + frequency=Frequency, + channel=Channel, + datarate=DataRate, + signature = <<>>, + attestation = Attestation + }. -spec gateway(Receipt :: poc_receipt()) -> libp2p_crypto:pubkey_bin(). gateway(Receipt) -> Receipt#blockchain_poc_receipt_v1_pb.gateway. diff --git a/src/transactions/v1/blockchain_poc_witness_v1.erl b/src/transactions/v1/blockchain_poc_witness_v1.erl index d9c9aeda71..68f931bb19 100644 --- a/src/transactions/v1/blockchain_poc_witness_v1.erl +++ b/src/transactions/v1/blockchain_poc_witness_v1.erl @@ -8,10 +8,11 @@ -include("blockchain_caps.hrl"). -include("blockchain_json.hrl"). -include("blockchain_utils.hrl"). +-include_lib("helium_proto/include/blockchain_poc_core_v1_pb.hrl"). -include_lib("helium_proto/include/blockchain_txn_poc_receipts_v1_pb.hrl"). -export([ - new/4, new/6, new/8, + new/4, new/6, new/8, new/9, gateway/1, timestamp/1, signal/1, @@ -88,6 +89,29 @@ new(Gateway, Timestamp, Signal, PacketHash, SNR, Frequency, Channel, DataRate) - signature = <<>> }. +-spec new(Gateway :: libp2p_crypto:pubkey_bin(), + Timestamp :: non_neg_integer(), + Signal :: integer(), + PacketHash :: binary(), + SNR :: float(), + Frequency :: float(), + Channel :: non_neg_integer(), + DataRate :: binary(), + Attestation :: #attestation_pb{}) -> poc_witness(). +new(Gateway, Timestamp, Signal, PacketHash, SNR, Frequency, Channel, DataRate, Attestation) -> + #blockchain_poc_witness_v1_pb{ + gateway=Gateway, + timestamp=Timestamp, + signal=Signal, + packet_hash=PacketHash, + snr=SNR, + frequency=Frequency, + channel=Channel, + datarate=DataRate, + signature = <<>>, + attestation = Attestation + }. + -spec gateway(Witness :: poc_witness()) -> libp2p_crypto:pubkey_bin(). gateway(Witness) -> Witness#blockchain_poc_witness_v1_pb.gateway.