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
1 change: 1 addition & 0 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

{profiles, [
{no_events, [{erl_opts, [{d, 'NO_EVENTS', true}]}]},
{top, [{deps, [observer_cli]}, {erl_opts, [{d, 'AO_TOP', true}]}]},
{store_events, [{erl_opts, [{d, 'STORE_EVENTS', true}]}]},
{ao_profiling, [{erl_opts, [{d, 'AO_PROFILING', true}]}]},
{eflame,
Expand Down
5 changes: 3 additions & 2 deletions src/dev_codec_httpsig.erl
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ commit(BaseMsg, Req = #{ <<"type">> := <<"hmac-sha256">> }, RawOpts) ->
normalize_for_encoding(Msg, UnauthedCommitment, Opts),
SigBase = signature_base(EncMsg, EncComm, Opts),
HMac = hb_util:human_id(crypto:mac(hmac, sha256, Key, SigBase)),
?event(httpsig_commit,
?event(
debug_commitments,
{hmac_commit,
{type, <<"hmac-sha256">>},
{keyid, KeyID},
Expand All @@ -255,7 +256,7 @@ commit(BaseMsg, Req = #{ <<"type">> := <<"hmac-sha256">> }, RawOpts) ->
}
}
},
?event({hmac_generation_complete, Res}),
?event(debug_commitments, {hmac_generation_complete, Res}),
Res.

%% @doc Annotate the commitment with the `bundle' key if the request contains
Expand Down
24 changes: 15 additions & 9 deletions src/dev_message.erl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ id(RawBase, Req, NodeOpts) ->
% filtering for the committers specified in the request.
#{ <<"commitments">> := Commitments }
= with_relevant_commitments(Base, Req, IDOpts),
?event(debug_commitments,
?event(debug_id,
{generating_ids,
{selected_commitments, Commitments},
{req, Req},
Expand All @@ -109,7 +109,7 @@ id(RawBase, Req, NodeOpts) ->
case hb_maps:keys(Commitments) of
[] ->
% If there are no commitments, we must (re)calculate the ID.
?event(debug_id, no_commitments_found_in_id_call),
?event(ids, regenerating_id),
calculate_id(hb_maps:without([<<"commitments">>], Base), Req, IDOpts);
IDs ->
% Accumulate the relevant IDs into a single value. This is performed
Expand All @@ -124,7 +124,7 @@ id(RawBase, Req, NodeOpts) ->
% accumulation function starts with a buffer of zero encoded as a
% 256-bit binary. Subsequently, a single ID on its own 'accumulates'
% to itself.
?event(debug_id, {accumulating_existing_ids, IDs}),
?event(ids, returning_existing_ids),
{ok,
hb_util:human_id(
hb_crypto:accumulate(
Expand All @@ -137,13 +137,13 @@ id(RawBase, Req, NodeOpts) ->
calculate_id(RawBase, Req, NodeOpts) ->
% Find the ID device for the message.
Base = hb_message:convert(RawBase, tabm, NodeOpts),
?event(linkify, {calculate_ids, {base, Base}}),
?event(debug_id, {calculate_ids, {base, Base}}),
IDMod =
case id_device(Base, NodeOpts) of
{ok, IDDev} -> IDDev;
{error, Error} -> throw({id, Error})
end,
?event(linkify, {generating_id, {idmod, IDMod}, {base, Base}}),
?event(debug_id, {generating_id, {idmod, IDMod}, {base, Base}}),
% Get the device module from the message, or use the default if it is not
% set. We can tell if the device is not set (or is the default) by checking
% whether the device module is the same as this module.
Expand Down Expand Up @@ -450,7 +450,7 @@ committed(Self, Req, Opts) ->
OnlyCommittedKeys
)
end,
?event({only_committed_keys, CommittedNormalizedKeys}),
?event(debug_commitments, {only_committed_keys, CommittedNormalizedKeys}),
{ok, CommittedNormalizedKeys}.

%% @doc Return a message with only the relevant commitments for a given request.
Expand Down Expand Up @@ -497,14 +497,17 @@ commitment_ids_from_request(Base, Req, Opts) ->
FromCommitterAddrs =
case ReqCommitters of
<<"none">> ->
?event(no_commitment_ids_for_committers),
?event(debug_commitments, no_commitment_ids_for_committers),
[];
<<"all">> ->
{ok, Committers} = committers(Base, Req, Opts),
?event(debug_commitments, {commitment_ids_from_committers, Committers}),
commitment_ids_from_committers(Committers, Commitments, Opts);
RawCommitterAddrs ->
?event({getting_commitment_ids_for_committers, RawCommitterAddrs}),
?event(
debug_commitments,
{getting_commitment_ids_for_committers, RawCommitterAddrs}
),
CommitterAddrs =
if is_list(RawCommitterAddrs) -> RawCommitterAddrs;
true -> [RawCommitterAddrs]
Expand All @@ -531,7 +534,10 @@ commitment_ids_from_request(Base, Req, Opts) ->
);
FinalCommitmentIDs -> FinalCommitmentIDs
end,
?event({commitment_ids_from_request, {base, Base}, {req, Req}, {res, Res}}),
?event(
debug_commitments,
{commitment_ids_from_request, {base, Base}, {req, Req}, {res, Res}}
),
Res.

%% @doc Ensure that the `commitments` submessage of a base message is fully
Expand Down
Loading