summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-03-21 12:56:16 +0100
committerChristian Grothoff <christian@grothoff.org>2020-03-21 12:56:16 +0100
commita8b8258e12f8e04936bffd82a2e31be7117ec860 (patch)
treeebd159531f6a8ab552579835c85286e8a8016777
parent2ace9969b7e1ede610ff99546c5a84f59adf0931 (diff)
downloadexchange-a8b8258e12f8e04936bffd82a2e31be7117ec860.tar.gz
exchange-a8b8258e12f8e04936bffd82a2e31be7117ec860.tar.bz2
exchange-a8b8258e12f8e04936bffd82a2e31be7117ec860.zip
steps towards new split-auditor logic
-rw-r--r--contrib/auditor-report.tex.j2326
-rwxr-xr-xcontrib/render.py14
-rw-r--r--src/auditor/.gitignore5
-rw-r--r--src/auditor/report-lib.c2
-rw-r--r--src/auditor/report-lib.h2
-rw-r--r--src/auditor/taler-helper-auditor-aggregation.c14
-rw-r--r--src/auditor/taler-helper-auditor-coins.c27
-rw-r--r--src/auditor/taler-helper-auditor-deposits.c10
-rw-r--r--src/auditor/taler-helper-auditor-reserves.c12
-rwxr-xr-xsrc/auditor/test-auditor.sh340
10 files changed, 483 insertions, 269 deletions
diff --git a/contrib/auditor-report.tex.j2 b/contrib/auditor-report.tex.j2
index 28c40f88..ccb249dd 100644
--- a/contrib/auditor-report.tex.j2
+++ b/contrib/auditor-report.tex.j2
@@ -64,51 +64,58 @@ This report is based on a template licensed under the Affero General Public
License, either version 3, or (at your option) any later version.
The source code for the template is available at \url{https://git.taler.net/}.
-The report was generated by the auditor started at
-{\bf {{ data.auditor_start_time }} } and concluded at
-{\bf {{ data.auditor_end_time }} }.
+The report was generated by the auditors at the following times:
-In that time, the auditor processed the following table ranges:
+\begin{table}[h!]
+\begin{center}
+\begin{tabular}{l|r|r}
+ Auditor & Start & End \\ \hline \hline
+ Aggregation & {{ aggregation.auditor_start_time }} & {{ aggregation.auditor_end_time }} \\ \hline
+ Coins & {{ coins.auditor_start_time }} & {{ coins.auditor_end_time }} \\ \hline
+ Deposits & {{ deposits.auditor_start_time }} & {{ deposits.auditor_end_time }} \\ \hline
+ Reserves & {{ reserves.auditor_start_time }} & {{ reserves.auditor_end_time }} \\ \hline
+ Wire & {{ wire.wire_auditor_start_time }} & {{ wire.wire_auditor_end_time }} \\
+\end{tabular}
+\end{center}
+\end{table}
+
+In that time, the auditors processed the following table ranges:
\begin{table}[h!]
\begin{center}
\begin{tabular}{l|r|r}
Table & Start & End \\ \hline \hline
- Reserves Incoming & {{ data.start_ppr_reserve_in_serial_id }}
- & {{ data.end_ppr_reserve_in_serial_id }} \\ \hline
- Reserves Out (withdraw) & {{ data.start_ppr_reserve_out_serial_id }}
- & {{ data.end_ppr_reserve_out_serial_id }} \\ \hline
- Reserves Recoup & {{ data.start_ppr_reserve_recoup_serial_id }}
- & {{ data.end_ppr_reserve_recoup_serial_id }} \\ \hline
- Reserves Close & {{ data.start_ppr_reserve_close_serial_id }}
- & {{ data.end_ppr_reserve_close_serial_id }} \\ \hline
- Aggregation & {{ data.start_ppa_wire_out_serial_id }}
- & {{ data.end_ppa_wire_out_serial_id }} \\ \hline
- Coin withdraw & {{ data.start_ppc_withdraw_serial_id }}
- & {{ data.end_ppc_withdraw_serial_id }} \\ \hline
- Coin deposit & {{ data.start_ppc_deposit_serial_id }}
- & {{ data.end_ppc_deposit_serial_id }} \\ \hline
- Coin melt & {{ data.start_ppc_melt_serial_id }}
- & {{ data.end_ppc_melt_serial_id }} \\ \hline
- Coin refund & {{ data.start_ppc_refund_serial_id }}
- & {{ data.end_ppc_refund_serial_id }} \\ \hline
- Coin recoup & {{ data.start_ppc_recoup_serial_id }}
- & {{ data.end_ppc_recoup_serial_id }} \\ \hline
- Coin recoup refresh & {{ data.start_ppc_recoup_refresh_serial_id }}
- & {{ data.end_ppc_recoup_refresh_serial_id }} \\
+ Reserves Incoming & {{ reserves.start_ppr_reserve_in_serial_id }}
+ & {{ reserves.end_ppr_reserve_in_serial_id }} \\ \hline
+ Reserves Out (withdraw) & {{ reserves.start_ppr_reserve_out_serial_id }}
+ & {{ reserves.end_ppr_reserve_out_serial_id }} \\ \hline
+ Reserves Recoup & {{ reserves.start_ppr_reserve_recoup_serial_id }}
+ & {{ reserves.end_ppr_reserve_recoup_serial_id }} \\ \hline
+ Reserves Close & {{ reserves.start_ppr_reserve_close_serial_id }}
+ & {{ reserves.end_ppr_reserve_close_serial_id }} \\ \hline
+ Aggregation & {{ aggregation.start_ppa_wire_out_serial_id }}
+ & {{ aggregation.end_ppa_wire_out_serial_id }} \\ \hline
+ Coin withdraw & {{ coins.start_ppc_withdraw_serial_id }}
+ & {{ coins.end_ppc_withdraw_serial_id }} \\ \hline
+ Coin deposit & {{ coins.start_ppc_deposit_serial_id }}
+ & {{ coins.end_ppc_deposit_serial_id }} \\ \hline
+ Coin melt & {{ coins.start_ppc_melt_serial_id }}
+ & {{ coins.end_ppc_melt_serial_id }} \\ \hline
+ Coin refund & {{ coins.start_ppc_refund_serial_id }}
+ & {{ coins.end_ppc_refund_serial_id }} \\ \hline
+ Coin recoup & {{ coins.start_ppc_recoup_serial_id }}
+ & {{ coins.end_ppc_recoup_serial_id }} \\ \hline
+ Coin recoup refresh & {{ coins.start_ppc_recoup_refresh_serial_id }}
+ & {{ coins.end_ppc_recoup_refresh_serial_id }} \\
\end{tabular}
\end{center}
\caption{Serial number ranges of the tables processed by the audit.}
\label{table:auditor_range}
\end{table}
-The report was generated by the wire auditor started at
-{\bf {{ wire.wire_auditor_start_time }} } and concluded at
-{\bf {{ wire.wire_auditor_end_time }} }.
-
{% if wire.account_progress|length() == 0 %}
-In that time, the auditor processed NO accounts at all.
+In that time, the wire auditor processed NO accounts at all.
{% else %}
-In that time, the auditor processed the following table ranges:
+In that time, the wire auditor processed the following table ranges:
\begin{center}
\begin{longtable}{l|c|r|r}
Account & Table & Start & End \\ \hline
@@ -136,19 +143,21 @@ In that time, the auditor processed the following table ranges:
\section{Operations}
The balance of the escrow account should
-be {\bf {{ data.total_escrow_balance }}}.
+be {\bf {{ coins.total_escrow_balance }}} (coins)
+plus {\bf {{ reserves.total_escrow_balance }}} (reserves).
\noindent
The active operational risk stands at
-{\bf {{ data.total_active_risk }}}.
+{\bf {{ coins.total_active_risk }}}.
\noindent
Loss (actualized risk from recoups) is
-{\bf {{ data.total_recoup_loss }}}.
+{\bf {{ coins.total_recoup_loss }}}.
\noindent
Recoups of non-revoked coins are at
-{\bf {{ data.total_irregular_recoups }}}.
+{\bf {{ coins.total_irregular_recoups }}} (coins)
+plus {\bf {{ reserves.total_irregular_recoups }}} (reserves).
\section{Income}
@@ -160,12 +169,11 @@ This section analyzes the income of the exchange operator from fees.
\label{table:revenue}
\begin{tabular}{l|r}
Category & Amount \\ \hline \hline
- Withdraw fees & {{ data.total_withdraw_fee_income }} \\
- Deposit fees & {{ data.total_deposit_fee_income }} \\
- Melt fees & {{ data.total_melt_fee_income }} \\
- Refund fees & {{ data.total_refund_fee_income }} \\
- Aggregation fees & {{ data.total_aggregation_fee_income }} \\ \hline \hline
- {\bf Total} & {{ data.income_fee_total }} \\
+ Withdraw fees & {{ reserves.total_withdraw_fee_income }} \\
+ Deposit fees & {{ coins.total_deposit_fee_income }} \\
+ Melt fees & {{ coins.total_melt_fee_income }} \\
+ Refund fees & {{ coins.total_refund_fee_income }} \\
+ Aggregation fees & {{ aggregation.total_aggregation_fee_income }} \\
\end{tabular}
\end{center}
\end{table}
@@ -297,15 +305,15 @@ and should be answered by revoking the exchange's online siging keys.
% TODO: maybe reference PhD thesis on this?
The total amount the exchange currently lags behind is
-{\bf {{ data.missing_deposit_confirmation_total }} } from a total number of
-{\bf {{ data.missing_deposit_confirmation_count }} } deposit confirmations.
+{\bf {{ deposits.missing_deposit_confirmation_total }} } from a total number of
+{\bf {{ deposits.missing_deposit_confirmation_count }} } deposit confirmations.
Note that some lag is perfectly normal.
Below, we report {\em all} deposit confirmations that are lagging behind.
% Table generation tested by testcase #24 in test-auditor.sh
-{% if data.deposit_confirmation_inconsistencies|length() == 0 %}
+{% if deposits.deposit_confirmation_inconsistencies|length() == 0 %}
{\bf No deposit confirmations that are lagging behind detected.}
{% else %}
\begin{longtable}{r|r|r}
@@ -325,7 +333,7 @@ Below, we report {\em all} deposit confirmations that are lagging behind.
\caption{Missing deposit confirmations.}
\label{table:missing_dc}
\endlastfoot
-{% for item in data.deposit_confirmation_inconsistencies %}
+{% for item in deposits.deposit_confirmation_inconsistencies %}
{{ item.timestamp }} &
{{ item.amount }} &
{{ item.rowid }} \\
@@ -355,18 +363,18 @@ exposure} is the amount of coins in circulation for a particular
denomination and the maximum loss for the exchange from this type of
compromise.
-{% if (data.emergencies|length() != 0) %}
+{% if (coins.emergencies|length() != 0) %}
The total risk from emergencies detected by amount is
-{\bf {{ data.emergencies_risk_by_amount }} }.
+{\bf {{ coins.emergencies_risk_by_amount }} }.
The total loss from emergencies detected by amount is
-{\bf {{ data.emergencies_loss }} }.
+{\bf {{ coins.emergencies_loss }} }.
{% endif %}
-{% if (data.emergencies_by_count|length() != 0) %}
+{% if (coins.emergencies_by_count|length() != 0) %}
The total risk from emergencies detected by counting coins is
-{\bf {{ data.emergencies_risk_by_count }} }
+{\bf {{ coins.emergencies_risk_by_count }} }
The total loss from emergencies detected by counting coins could be up to
-{\bf {{ data.emergencies_loss_by_count }} }.
+{\bf {{ coins.emergencies_loss_by_count }} }.
{% endif %}
@@ -374,7 +382,7 @@ The total loss from emergencies detected by counting coins could be up to
% Table generation tested by testcase #18 in test-auditor.sh
-{% if data.emergencies_by_count|length() == 0 %}
+{% if coins.emergencies_by_count|length() == 0 %}
{\bf No emergencies detected by counting coins.}
{% else %}
\begin{longtable}{r|c|r|r}
@@ -391,7 +399,7 @@ The total loss from emergencies detected by counting coins could be up to
\caption{Emergencies by counting coins.}
\label{table:emergencies_coin_counting}
\endlastfoot
-{% for item in data.emergencies_by_count %}
+{% for item in coins.emergencies_by_count %}
\multicolumn{4}{l}{ {\tt \truncate{0.95\textwidth}{ {{ item.denompub_hash }} } } } \\
\nopagebreak
{{ item.value }} &
@@ -416,7 +424,7 @@ indicator that the exchange's private signing key was compromised.
% Table generation tested by testcases #18, #25 in test-auditor.sh
-{% if data.emergencies|length() == 0 %}
+{% if coins.emergencies|length() == 0 %}
{\bf No emergencies by value detected.}
{% else %}
\begin{longtable}{r|c|r|r}
@@ -433,7 +441,7 @@ indicator that the exchange's private signing key was compromised.
\caption{Emergencies by value deposited.}
\label{table:emergencies}
\endlastfoot
-{% for item in data.emergencies %}
+{% for item in coins.emergencies %}
\multicolumn{4}{l}{ {\tt \truncate{0.95\textwidth}{ {{ item.denompub_hash }} } } } \\
\nopagebreak
{{ item.value }} &
@@ -504,7 +512,7 @@ compromise resulting in proportional financial losses to the exchange.
% Table generation tested by testcase #2 in test-auditor.sh
-{% if data.reserve_balance_insufficient_inconsistencies|length() == 0 %}
+{% if reserves.reserve_balance_insufficient_inconsistencies|length() == 0 %}
{\bf All withdrawals were covered by sufficient reserve funding.}
{% else %}
\begin{longtable}{p{8.5cm}|r}
@@ -517,11 +525,11 @@ compromise resulting in proportional financial losses to the exchange.
\endfoot
\hline
{\bf Total loss} &
- {{ data.total_loss_balance_insufficient }} \\
+ {{ reserves.total_loss_balance_insufficient }} \\
\caption{Reserves with withdrawals higher than reserve funding.}
\label{table:reserve:balance_insufficient}
\endlastfoot
-{% for item in data.reserve_balance_insufficient_inconsistencies %}
+{% for item in reserves.reserve_balance_insufficient_inconsistencies %}
{\tt \small {{ item.reserve_pub }} }
&
{{ item.loss }} \\ \hline
@@ -543,7 +551,7 @@ would be reported separately in Section~\ref{sec:wire_check_out}.
% Table generation tested by testcase #23 in test-auditor.sh
-{% if data.wire_out_inconsistencies|length() == 0 %}
+{% if aggregation.wire_out_inconsistencies|length() == 0 %}
{\bf All aggregations matched up.}
{% else %}
\begin{longtable}{r|r|r}
@@ -559,12 +567,12 @@ would be reported separately in Section~\ref{sec:wire_check_out}.
\endfoot
\hline
{\bf Total deltas} &
- {{ data.total_wire_out_delta_plus}} &
- - {{ data.total_wire_out_delta_minus}} \\
+ {{ aggregation.total_wire_out_delta_plus}} &
+ - {{ aggregation.total_wire_out_delta_minus}} \\
\caption{Claimed wire out aggregate totals not matching up.}
\label{table:reserve:wire_out_balance_inconsistencies}
\endlastfoot
-{% for item in data.wire_out_inconsistencies %}
+{% for item in aggregation.wire_out_inconsistencies %}
\multicolumn{3}{l}{ {\tt \truncate{0.95\textwidth}{
{% if 'payto_uri' in item.destination_account %}
{{ item.destination_account.payto_uri }}
@@ -589,7 +597,7 @@ any effects on its own balance, those entries are excluded from the total.
% Table generation tested by testcase #25 in test-auditor.sh
-{% if data.coin_inconsistencies|length() == 0 %}
+{% if aggregation.coin_inconsistencies|length() == 0 %}
{\bf All coin histories were unproblematic.}
{% else %}
\begin{longtable}{p{1.8cm}|r|r}
@@ -607,12 +615,12 @@ any effects on its own balance, those entries are excluded from the total.
\endfoot
\hline
$\sum$ {\bf Delta (Auditor-Exchange)} &
- {{ data.total_coin_delta_plus }} &
- - {{ data.total_coin_delta_minus }} \\
+ {{ aggregation.total_coin_delta_plus }} &
+ - {{ aggregation.total_coin_delta_minus }} \\
\caption{Arithmetic inconsistencies of amount calculations involving a coin.}
\label{table:amount:arithmetic:coin:inconsistencies}
\endlastfoot
-{% for item in data.coin_inconsistencies %}
+{% for item in aggregation.coin_inconsistencies %}
{{ item.operation }} &
\multicolumn{2}{l}{ {\tt \small {{ item.coin_pub }} } } \\
\nopagebreak &
@@ -637,9 +645,81 @@ the (hash of the) denomination public key for
``recoup-verify'' and ``deposit-verify'' operations, and the master
public key for ``recoup-master'' operations.
-% Table generation tested by testcase #4/#5/#6/#7/#13 in test-auditor.sh
+\subsubsection{For aggregations}
+
+% Table generation tested by testcase #XX in test-auditor.sh
+
+{% if aggregation.bad_sig_losses|length() == 0 %}
+ {\bf All signatures were valid.}
+{% else %}
+ \begin{longtable}{l|r|r}
+ \multicolumn{3}{l}{ {\bf Public key} }\\
+ {\bf Operation type} & Database row & {\bf Loss amount} \\
+ \hline \hline
+\endfirsthead
+ \multicolumn{3}{l}{ {\bf Public key} }\\
+ {\bf Operation type} & Database row & {\bf Loss amount} \\ \hline \hline
+\endhead
+ \hline \hline
+ \multicolumn{3}{l}{ {\bf Public key} }\\
+ {\bf Operation type} & Database row & {\bf Loss amount} \\
+\endfoot
+ \hline
+ \multicolumn{2}{l}{ {\bf Total losses} } &
+ {\bf {{ aggregation.total_bad_sig_loss}} } \\
+ \caption{Losses from operations performed on coins without proper signatures.}
+ \label{table:bad_signature_losses}
+\endlastfoot
+{% for item in aggregation.bad_sig_losses %}
+ \multicolumn{3}{l}{ {\tt \small \truncate{0.9\textwidth}{ {{ item.key_pub }} } } } \\
+\nopagebreak
+ {{ item.operation }} &
+ {{ item.row }} &
+ {{ item.loss }} \\ \hline
+{% endfor %}
+ \end{longtable}
+{% endif %}
+
+\subsubsection{For coins}
+
+% Table generation tested by testcase #4/#5/#6/#13 in test-auditor.sh
+
+{% if coins.bad_sig_losses|length() == 0 %}
+ {\bf All signatures were valid.}
+{% else %}
+ \begin{longtable}{l|r|r}
+ \multicolumn{3}{l}{ {\bf Public key} }\\
+ {\bf Operation type} & Database row & {\bf Loss amount} \\
+ \hline \hline
+\endfirsthead
+ \multicolumn{3}{l}{ {\bf Public key} }\\
+ {\bf Operation type} & Database row & {\bf Loss amount} \\ \hline \hline
+\endhead
+ \hline \hline
+ \multicolumn{3}{l}{ {\bf Public key} }\\
+ {\bf Operation type} & Database row & {\bf Loss amount} \\
+\endfoot
+ \hline
+ \multicolumn{2}{l}{ {\bf Total losses} } &
+ {\bf {{ coins.total_bad_sig_loss}} } \\
+ \caption{Losses from operations performed on coins without proper signatures.}
+ \label{table:bad_signature_losses}
+\endlastfoot
+{% for item in coins.bad_sig_losses %}
+ \multicolumn{3}{l}{ {\tt \small \truncate{0.9\textwidth}{ {{ item.key_pub }} } } } \\
+\nopagebreak
+ {{ item.operation }} &
+ {{ item.row }} &
+ {{ item.loss }} \\ \hline
+{% endfor %}
+ \end{longtable}
+{% endif %}
+
+\subsubsection{For reserves}
-{% if data.bad_sig_losses|length() == 0 %}
+% Table generation tested by testcase #7 in test-auditor.sh
+
+{% if reserves.bad_sig_losses|length() == 0 %}
{\bf All signatures were valid.}
{% else %}
\begin{longtable}{l|r|r}
@@ -656,11 +736,11 @@ public key for ``recoup-master'' operations.
\endfoot
\hline
\multicolumn{2}{l}{ {\bf Total losses} } &
- {\bf {{ data.total_bad_sig_loss}} } \\
+ {\bf {{ reserves.total_bad_sig_loss}} } \\
\caption{Losses from operations performed on coins without proper signatures.}
\label{table:bad_signature_losses}
\endlastfoot
-{% for item in data.bad_sig_losses %}
+{% for item in reserves.bad_sig_losses %}
\multicolumn{3}{l}{ {\tt \small \truncate{0.9\textwidth}{ {{ item.key_pub }} } } } \\
\nopagebreak
{{ item.operation }} &
@@ -826,7 +906,7 @@ translate into a financial loss (yet).
% Table generation tested by testcase #3 in test-auditor.sh
-{% if data.reserve_balance_summary_wrong_inconsistencies|length() == 0 %}
+{% if reserves.reserve_balance_summary_wrong_inconsistencies|length() == 0 %}
{\bf All balances matched up.}
{% else %}
\begin{longtable}{p{6cm}|r|r}
@@ -840,12 +920,12 @@ translate into a financial loss (yet).
\hline
\hline
{\bf Total deltas} &
- {{ data.total_balance_summary_delta_plus}} &
- - {{ data.total_balance_summary_delta_minus}} \\
+ {{ reserves.total_balance_summary_delta_plus}} &
+ - {{ reserves.total_balance_summary_delta_minus}} \\
\caption{Reserves balances not matching up.}
\label{table:reserve:balance_inconsistencies}
\endlastfoot
-{% for item in data.reserve_balance_summary_wrong_inconsistencies %}
+{% for item in reserves.reserve_balance_summary_wrong_inconsistencies %}
{\tt \tiny {{ item.reserve_pub }} } &
{{ item.auditor }} &
{{ item.exchange }} \\ \hline
@@ -853,16 +933,16 @@ translate into a financial loss (yet).
\end{longtable}
{% endif %}
-{% if data.reserve_balance_summary_wrong_inconsistencies|length() != 0 %}
+{% if reserves.reserve_balance_summary_wrong_inconsistencies|length() != 0 %}
This means that there are inconsistencies in the exchange's
summary data about reserve balances.
\begin{itemize}
\item The exchange believes some reserves contain (in total)
-{\bf {{ data.total_balance_summary_delta_plus}} } {\em less} than they
+{\bf {{ reserves.total_balance_summary_delta_plus}} } {\em less} than they
actually contain. A non-zero value here means the exchange may deny legitimate withdrawal
requests, denying customers access to their funds.
\item The exchange believes some reserves contain (in total)
-{\bf {{ data.total_balance_summary_delta_minus}} } {\em more} than they
+{\bf {{ reserves.total_balance_summary_delta_minus}} } {\em more} than they
actually contain. A non-zero value here means the exchange may allow coins to be withdrawn
for which it never received any income, at a loss (for the exchange).
\end{itemize}
@@ -958,7 +1038,7 @@ with respect to what wire fee it charges at what time.
% Table generation tested by testcase #14 in test-auditor.sh
-{% if data.wire_fee_time_inconsistencies|length() == 0 %}
+{% if aggregation.wire_fee_time_inconsistencies|length() == 0 %}
{\bf No wire fee timing issues detected.}
{% else %}
\begin{longtable}{p{1.5cm}|r|p{6}}
@@ -976,7 +1056,7 @@ with respect to what wire fee it charges at what time.
\caption{Wire fees with ambiguous timestamps.}
\label{table:wire_fee:ambiguity}
\endlastfoot
-{% for item in data.wire_fee_time_inconsistencies %}
+{% for item in aggregation.wire_fee_time_inconsistencies %}
{\tt {{ item.type }} } & {{ item.time }} & {{ item.diagnostic }} \\ \hline
{% endfor %}
\end{longtable}
@@ -989,9 +1069,71 @@ with respect to what wire fee it charges at what time.
This section describes issues found that do not have a clear financial
impact.
-% Table generation tested by testcase #13/#15/#25 in test-auditor.sh
+\subsubsection{For aggregations}
+
+% Table generation tested by testcase #15/#25 in test-auditor.sh
+
+{% if aggregation.row_inconsistencies|length() == 0 %}
+ {\bf No row inconsistencies found.}
+{% else %}
+ \begin{longtable}{p{2.5cm}|l|p{5cm}}
+ {\bf Table} & {\bf Row} & {\bf Diagnostic} \\
+ \hline \hline
+\endfirsthead
+ {\bf Table} & {\bf Row} & {\bf Diagnostic} \\
+ \hline \hline
+\endhead
+ \hline \hline
+ {\bf Table} & {\bf Row} & {\bf Diagnostic} \\
+\endfoot
+ \hline \hline
+ {\bf Table} & {\bf Row} & {\bf Diagnostic} \\
+ \caption{Other issues found (by table and row).}
+ \label{table:misc:aggregation}
+\endlastfoot
+{% for item in aggregation.row_inconsistencies %}
+ \verb! {{ item.table }} ! &
+ {{ item.row }} &
+ {{ item.diagnostic }} \\ \hline
+{% endfor %}
+ \end{longtable}
+{% endif %}
+
+\subsubsection{For coins}
+
+% Table generation tested by testcase #13 in test-auditor.sh
+
+{% if coins.row_inconsistencies|length() == 0 %}
+ {\bf No row inconsistencies found.}
+{% else %}
+ \begin{longtable}{p{2.5cm}|l|p{5cm}}
+ {\bf Table} & {\bf Row} & {\bf Diagnostic} \\
+ \hline \hline
+\endfirsthead
+ {\bf Table} & {\bf Row} & {\bf Diagnostic} \\
+ \hline \hline
+\endhead
+ \hline \hline
+ {\bf Table} & {\bf Row} & {\bf Diagnostic} \\
+\endfoot
+ \hline \hline
+ {\bf Table} & {\bf Row} & {\bf Diagnostic} \\
+ \caption{Other issues found (by table and row).}
+ \label{table:misc:coins}
+\endlastfoot
+{% for item in coins.row_inconsistencies %}
+ \verb! {{ item.table }} ! &
+ {{ item.row }} &
+ {{ item.diagnostic }} \\ \hline
+{% endfor %}
+ \end{longtable}
+{% endif %}
+
+\subsubsection{For reserves}
+
+% Table generation tested by testcase #XX in test-auditor.sh
-{% if data.row_inconsistencies|length() == 0 %}
+{% if reserves.row_inconsistencies|length() == 0 %}
{\bf No row inconsistencies found.}
{% else %}
\begin{longtable}{p{2.5cm}|l|p{5cm}}
@@ -1007,9 +1149,9 @@ impact.
\hline \hline
{\bf Table} & {\bf Row} & {\bf Diagnostic} \\
\caption{Other issues found (by table and row).}
- \label{table:misc}
+ \label{table:misc:reserves}
\endlastfoot
-{% for item in data.row_inconsistencies %}
+{% for item in reserves.row_inconsistencies %}
\verb! {{ item.table }} ! &
{{ item.row }} &
{{ item.diagnostic }} \\ \hline
@@ -1032,7 +1174,7 @@ reserve expired.
% Table generation tested by testcase #20 in test-auditor.sh
-{% if data.reserve_not_closed_inconsistencies|length() == 0 %}
+{% if reserves.reserve_not_closed_inconsistencies|length() == 0 %}
{\bf All expired reserves were closed.}
{% else %}
\begin{longtable}{p{4.5cm}|c|r}
@@ -1045,11 +1187,11 @@ reserve expired.
\endfoot
\hline
{\bf Sum} & &
- {{ data.total_balance_reserve_not_closed}} \\
+ {{ reserves.total_balance_reserve_not_closed}} \\
\caption{Reserves not closed on time.}
\label{table:reserve:not_closed}
\endlastfoot
-{% for item in data.reserve_not_closed_inconsistencies %}
+{% for item in reserves.reserve_not_closed_inconsistencies %}
{\tt \tiny \truncate{4.3cm}{ {{ item.reserve_pub }} } } &
{\tiny {{ item.expiration_time }} } &
{{ item.balance }} \\ \hline
@@ -1067,7 +1209,7 @@ may happen even if the exchange is correct.
% Table generation tested by testcase #12 in test-auditor.sh
-{% if data.refresh_hanging|length() == 0 %}
+{% if coins.refresh_hanging|length() == 0 %}
{\bf All melted coins were refreshed.}
{% else %}
\begin{longtable}{p{6.5cm}|c|r}
@@ -1082,11 +1224,11 @@ may happen even if the exchange is correct.
\endfoot
\hline
{\bf Sum} & &
- {{ data.total_refresh_hanging}} \\
+ {{ coins.total_refresh_hanging}} \\
\caption{Refresh operations hanging.}
\label{table:refresh:hanging}
\endlastfoot
-{% for item in data.refresh_hanging %}
+{% for item in coins.refresh_hanging %}
\truncate{6.2cm}{ {\tt \small {{ item.coin_pub }} } } &
{{ item.row }} &
{{ item.amount }} \\ \hline
@@ -1104,7 +1246,7 @@ implications.
% Table generation tested by testcase #22 in test-auditor.sh
-{% if data.denomination_key_validity_withdraw_inconsistencies|length() == 0 %}
+{% if reserves.denomination_key_validity_withdraw_inconsistencies|length() == 0 %}
{\bf All denomination keys were valid at the time of withdrawals.}
{% else %}
\begin{longtable}{p{7.5cm}|r}
@@ -1124,7 +1266,7 @@ implications.
\caption{Execution times not matching denomination key validity period.}
\label{table:withdraw:bad_time}
\endlastfoot
-{% for item in data.denomination_key_validity_withdraw_inconsistencies %}
+{% for item in reserves.denomination_key_validity_withdraw_inconsistencies %}
{\tt \small \truncate{0.6\textwidth}{ {{ item.reserve_pub }} } } & {{ item.row }} \\
\nopagebreak
{\tt \small \truncate{0.6\textwidth}{ {{ item.denompub_h }} } } & {{ item.execution_date }} \\ \hline
diff --git a/contrib/render.py b/contrib/render.py
index 2290e92f..cd50f716 100755
--- a/contrib/render.py
+++ b/contrib/render.py
@@ -36,6 +36,18 @@ jsonData1 = json.load(jsonFile1)
jsonFile2 = open (sys.argv[2], 'r')
jsonData2 = json.load(jsonFile2)
+jsonFile3 = open (sys.argv[3], 'r')
+jsonData3 = json.load(jsonFile3)
+
+jsonFile4 = open (sys.argv[4], 'r')
+jsonData4 = json.load(jsonFile4)
+
+jsonFile5 = open (sys.argv[5], 'r')
+jsonData5 = json.load(jsonFile5)
+
+jsonFile6 = open (sys.argv[6], 'r')
+jsonData6 = json.load(jsonFile6)
+
jinjaEnv = jinja2.Environment(loader=StdinLoader(),
lstrip_blocks=True,
trim_blocks=True,
@@ -43,4 +55,4 @@ jinjaEnv = jinja2.Environment(loader=StdinLoader(),
autoescape=False)
tmpl = jinjaEnv.get_template('stdin');
-print(tmpl.render(data = jsonData1, wire = jsonData2))
+print(tmpl.render(data = jsonData1, wire = jsonData2, aggregation = jsonData3, coins = jsonData4, deposits = jsonData5, reserves = jsonData6))
diff --git a/src/auditor/.gitignore b/src/auditor/.gitignore
index d065d10a..95757b5f 100644
--- a/src/auditor/.gitignore
+++ b/src/auditor/.gitignore
@@ -2,14 +2,11 @@ taler-auditor-httpd
taler-auditor
taler-wire-auditor
taler-auditor-exchange
-test-audit.json
test-report.aux
test-report.pdf
test-report.tex
-test-wire-audit.json
+*.json
texput.aux
-test-audit-inc.json
-test-wire-audit-inc.json
wirefees/
bank.err
libauditor.a
diff --git a/src/auditor/report-lib.c b/src/auditor/report-lib.c
index b00a522a..128ec625 100644
--- a/src/auditor/report-lib.c
+++ b/src/auditor/report-lib.c
@@ -85,7 +85,7 @@ static struct GNUNET_CONTAINER_MultiHashMap *denominations;
* @return human-readable string representing the time
*/
json_t *
-TALER_ARL_TALER_ARL_json_from_time_abs_nbo (struct GNUNET_TIME_AbsoluteNBO at)
+TALER_ARL_json_from_time_abs_nbo (struct GNUNET_TIME_AbsoluteNBO at)
{
return json_string
(GNUNET_STRINGS_absolute_time_to_string
diff --git a/src/auditor/report-lib.h b/src/auditor/report-lib.h
index 59229ad1..84619a5d 100644
--- a/src/auditor/report-lib.h
+++ b/src/auditor/report-lib.h
@@ -87,7 +87,7 @@ extern struct GNUNET_TIME_Absolute start_time;
* @return human-readable string representing the time
*/
json_t *
-TALER_ARL_TALER_ARL_json_from_time_abs_nbo (struct GNUNET_TIME_AbsoluteNBO at);
+TALER_ARL_json_from_time_abs_nbo (struct GNUNET_TIME_AbsoluteNBO at);
/**
diff --git a/src/auditor/taler-helper-auditor-aggregation.c b/src/auditor/taler-helper-auditor-aggregation.c
index bbad7125..27afcfd8 100644
--- a/src/auditor/taler-helper-auditor-aggregation.c
+++ b/src/auditor/taler-helper-auditor-aggregation.c
@@ -1441,24 +1441,26 @@ run (void *cls,
report = json_pack ("{s:o, s:o, s:o, s:o, s:o,"
" s:o, s:o, s:o, s:o, s:o,"
" s:o, s:o, s:o, s:I, s:I,"
- " s:o, s:o }",
+ " s:o, s:o, s:o }",
/* blocks #1 */
"wire_out_inconsistencies",
report_wire_out_inconsistencies,
+ /* Tested in test-auditor.sh #23 */
"total_wire_out_delta_plus",
TALER_JSON_from_amount (
&total_wire_out_delta_plus),
+ /* Tested in test-auditor.sh #23 */
"total_wire_out_delta_minus",
TALER_JSON_from_amount (
&total_wire_out_delta_minus),
- /* Tested in test-auditor.sh #4/#5/#6/#7/#13 */
+ /* FIXME: Tested in test-auditor.sh #?? */
"bad_sig_losses",
report_bad_sig_losses,
- /* Tested in test-auditor.sh #4/#5/#6/#7/#13 */
+ /* FIXME: Tested in test-auditor.sh #?? */
"total_bad_sig_loss",
TALER_JSON_from_amount (&total_bad_sig_loss),
/* block #2 */
- /* Tested in test-auditor.sh #14/#15 */
+ /* Tested in test-auditor.sh #15 */
"row_inconsistencies",
report_row_inconsistencies,
"coin_inconsistencies",
@@ -1490,7 +1492,9 @@ run (void *cls,
start_time),
"auditor_end_time",
TALER_ARL_json_from_time_abs (
- GNUNET_TIME_absolute_get ())
+ GNUNET_TIME_absolute_get ()),
+ "wire_fee_time_inconsistencies",
+ report_fee_time_inconsistencies
);
GNUNET_break (NULL != report);
TALER_ARL_done (report);
diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c
index c9250961..d1e91ac2 100644
--- a/src/auditor/taler-helper-auditor-coins.c
+++ b/src/auditor/taler-helper-auditor-coins.c
@@ -199,10 +199,10 @@ report_emergency_by_amount (const struct
"denom_loss",
TALER_JSON_from_amount (loss),
"start",
- TALER_ARL_TALER_ARL_json_from_time_abs_nbo (
+ TALER_ARL_json_from_time_abs_nbo (
issue->start),
"deposit_end",
- TALER_ARL_TALER_ARL_json_from_time_abs_nbo (
+ TALER_ARL_json_from_time_abs_nbo (
issue->expire_deposit),
"value",
TALER_JSON_from_amount_nbo (&issue->value)));
@@ -251,10 +251,10 @@ report_emergency_by_count (const struct
"denom_risk",
TALER_JSON_from_amount (risk),
"start",
- TALER_ARL_TALER_ARL_json_from_time_abs_nbo (
+ TALER_ARL_json_from_time_abs_nbo (
issue->start),
"deposit_end",
- TALER_ARL_TALER_ARL_json_from_time_abs_nbo (
+ TALER_ARL_json_from_time_abs_nbo (
issue->expire_deposit),
"value",
TALER_JSON_from_amount_nbo (&issue->value)));
@@ -2238,16 +2238,17 @@ run (void *cls,
"emergencies_risk_by_amount",
TALER_JSON_from_amount (
&reported_emergency_risk_by_amount),
- /* Tested in test-auditor.sh #4/#5/#6/#7/#13 */
+ /* Tested in test-auditor.sh #4/#5/#6/#13/#26 */
"bad_sig_losses",
report_bad_sig_losses,
- /* Tested in test-auditor.sh #4/#5/#6/#7/#13 */
+ /* Tested in test-auditor.sh #4/#5/#6/#13/#26 */
"total_bad_sig_loss",
TALER_JSON_from_amount (&total_bad_sig_loss),
- /* Tested in test-auditor.sh #14/#15 */
+ /* FIXME: Tested in test-auditor.sh #?? */
"row_inconsistencies",
report_row_inconsistencies,
/* Block #3 */
+ /* Tested in test-auditor.sh #18 */
"amount_arithmetic_inconsistencies",
report_amount_arithmetic_inconsistencies,
"total_arithmetic_delta_plus",
@@ -2308,12 +2309,12 @@ run (void *cls,
(json_int_t) ppc.last_recoup_serial_id,
"end_ppc_recoup_refresh_serial_id",
(json_int_t) ppc.last_recoup_refresh_serial_id,
- "auditor_start_time", json_string (
- GNUNET_STRINGS_absolute_time_to_string (
- start_time)),
- "auditor_end_time", json_string (
- GNUNET_STRINGS_absolute_time_to_string (
- GNUNET_TIME_absolute_get ())),
+ "auditor_start_time",
+ TALER_ARL_json_from_time_abs (
+ start_time),
+ "auditor_end_time",
+ TALER_ARL_json_from_time_abs (
+ GNUNET_TIME_absolute_get ()),
"total_irregular_recoups",
TALER_JSON_from_amount (
&total_irregular_recoups)
diff --git a/src/auditor/taler-helper-auditor-deposits.c b/src/auditor/taler-helper-auditor-deposits.c
index eb3e0e7a..00042159 100644
--- a/src/auditor/taler-helper-auditor-deposits.c
+++ b/src/auditor/taler-helper-auditor-deposits.c
@@ -303,14 +303,20 @@ run (void *cls,
{
json_t *report;
- report = json_pack ("{s:o, s:o, s:I}",
+ report = json_pack ("{s:o, s:I, s:o, s:o, s:o}",
"deposit_confirmation_inconsistencies",
report_deposit_confirmation_inconsistencies,
"missing_deposit_confirmation_count",
(json_int_t) number_missed_deposit_confirmations,
"missing_deposit_confirmation_total",
TALER_JSON_from_amount (
- &total_missed_deposit_confirmations)
+ &total_missed_deposit_confirmations),
+ "auditor_start_time",
+ TALER_ARL_json_from_time_abs (
+ start_time),
+ "auditor_end_time",
+ TALER_ARL_json_from_time_abs (
+ GNUNET_TIME_absolute_get ())
);
GNUNET_break (NULL != report);
TALER_ARL_done (report);
diff --git a/src/auditor/taler-helper-auditor-reserves.c b/src/auditor/taler-helper-auditor-reserves.c
index cd0f1b98..335eb899 100644
--- a/src/auditor/taler-helper-auditor-reserves.c
+++ b/src/auditor/taler-helper-auditor-reserves.c
@@ -1449,19 +1449,19 @@ run (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Launching auditor\n");
if (GNUNET_OK !=
- TALER_ARL_init (TALER_ARL_cfg))
+ TALER_ARL_init (c))
{
global_ret = 1;
return;
}
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (TALER_ARL_cfg,
- "exchangTALER_ARL_edb",
+ "exchangedb",
"IDLE_RESERVE_EXPIRATION_TIME",
&idle_reserve_expiration_time))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "exchangTALER_ARL_edb",
+ "exchangedb",
"IDLE_RESERVE_EXPIRATION_TIME");
global_ret = 1;
return;
@@ -1564,14 +1564,14 @@ run (void *cls,
"total_balance_reserve_not_closed",
TALER_JSON_from_amount (
&total_balance_reserve_not_closed),
- /* Tested in test-auditor.sh #4/#5/#6/#7/#13 */
+ /* Tested in test-auditor.sh #7 */
"bad_sig_losses",
report_bad_sig_losses,
/* blocks #3 */
- /* Tested in test-auditor.sh #4/#5/#6/#7/#13 */
+ /* Tested in test-auditor.sh #7 */
"total_bad_sig_loss",
TALER_JSON_from_amount (&total_bad_sig_loss),
- /* Tested in test-auditor.sh #14/#15 */
+ /* FIXME: Tested in test-auditor.sh #?? */
"row_inconsistencies",
report_row_inconsistencies,
/* Tested in test-auditor.sh #23 */
diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh
index 236a1151..0f76608b 100755
--- a/src/auditor/test-auditor.sh
+++ b/src/auditor/test-auditor.sh
@@ -79,15 +79,35 @@ function pre_audit () {
function audit_only () {
# Run the auditor!
echo -n "Running audit(s) ..."
+
+ # NOTE: this should be removed soon...
$VALGRIND taler-auditor -L DEBUG -r -c $CONF -m $MASTER_PUB > test-audit.json 2> test-audit.log || exit_fail "auditor failed"
echo -n "."
# Also do incremental run
$VALGRIND taler-auditor -L DEBUG -c $CONF -m $MASTER_PUB > test-audit-inc.json 2> test-audit-inc.log || exit_fail "auditor failed"
echo -n "."
- $VALGRIND taler-helper-auditor-wire -L DEBUG -r -c $CONF -m $MASTER_PUB > test-wire-audit.json 2> test-wire-audit.log || exit_fail "wire auditor failed"
- # Also do incremental run
+
+ $VALGRIND taler-helper-auditor-aggregation -L DEBUG -r -c $CONF -m $MASTER_PUB > test-audit-aggregation.json 2> test-audit-aggregation.log || exit_fail "aggregation audit failed"
+ echo -n "."
+ $VALGRIND taler-helper-auditor-aggregation -L DEBUG -c $CONF -m $MASTER_PUB > test-audit-aggregation-inc.json 2> test-audit-aggregation-inc.log || exit_fail "incremental aggregation audit failed"
+ echo -n "."
+ $VALGRIND taler-helper-auditor-coins -L DEBUG -r -c $CONF -m $MASTER_PUB > test-audit-coins.json 2> test-audit-coins.log || exit_fail "coin audit failed"
+ echo -n "."
+ $VALGRIND taler-helper-auditor-coins -L DEBUG -c $CONF -m $MASTER_PUB > test-audit-coins-inc.json 2> test-audit-coins-inc.log || exit_fail "incremental coin audit failed"
+ echo -n "."
+ $VALGRIND taler-helper-auditor-deposits -L DEBUG -r -c $CONF -m $MASTER_PUB > test-audit-deposits.json 2> test-audit-deposits.log || exit_fail "deposits audit failed"
+ echo -n "."
+ $VALGRIND taler-helper-auditor-deposits -L DEBUG -c $CONF -m $MASTER_PUB > test-audit-deposits-inc.json 2> test-audit-deposits-inc.log || exit_fail "incremental deposits audit failed"
echo -n "."
- $VALGRIND taler-helper-auditor-wire -L DEBUG -c $CONF -m $MASTER_PUB > test-wire-audit-inc.json 2> test-wire-audit-inc.log || exit_fail "wire auditor failed"
+ $VALGRIND taler-helper-auditor-reserves -L DEBUG -r -c $CONF -m $MASTER_PUB > test-audit-reserves.json 2> test-audit-reserves.log || exit_fail "reserves audit failed"
+ echo -n "."
+ $VALGRIND taler-helper-auditor-reserves -L DEBUG -c $CONF -m $MASTER_PUB > test-audit-reserves-inc.json 2> test-audit-reserves-inc.log || exit_fail "incremental reserves audit failed"
+ echo -n "."
+ $VALGRIND taler-helper-auditor-wire -L DEBUG -r -c $CONF -m $MASTER_PUB > test-audit-wire.json 2> test-wire-audit.log || exit_fail "wire audit failed"
+ echo -n "."
+ $VALGRIND taler-helper-auditor-wire -L DEBUG -c $CONF -m $MASTER_PUB > test-audit-wire-inc.json 2> test-wire-audit-inc.log || exit_fail "wire audit failed"
+ echo -n "."
+
echo " DONE"
}
@@ -99,7 +119,7 @@ function post_audit () {
wait
echo "DONE"
echo -n "TeXing ."
- ../../contrib/render.py test-audit.json test-wire-audit.json < ../../contrib/auditor-report.tex.j2 > test-report.tex || exit_fail "Renderer failed"
+ ../../contrib/render.py test-audit.json test-audit-wire.json test-audit-aggregation.json test-audit-coins.json test-audit-deposits.json test-audit-reserves.json < ../../contrib/auditor-report.tex.j2 > test-report.tex || exit_fail "Renderer failed"
echo -n "."
timeout 10 pdflatex test-report.tex >/dev/null || exit_fail "pdflatex failed"
@@ -141,21 +161,21 @@ run_audit aggregator
echo "Checking output"
# if an emergency was detected, that is a bug and we should fail
echo -n "Test for emergencies... "
-jq -e .emergencies[0] < test-audit.json > /dev/null && exit_fail "Unexpected emergency detected in ordinary run" || echo PASS
+jq -e .emergencies[0] < test-audit-coins.json > /dev/null && exit_fail "Unexpected emergency detected in ordinary run" || echo PASS
echo -n "Test for deposit confirmation emergencies... "
-jq -e .deposit_confirmation_inconsistencies[0] < test-audit.json > /dev/null && exit_fail "Unexpected deposit confirmation inconsistency detected" || echo PASS
+jq -e .deposit_confirmation_inconsistencies[0] < test-audit-deposits.json > /dev/null && exit_fail "Unexpected deposit confirmation inconsistency detected" || echo PASS
echo -n "Test for emergencies by count... "
-jq -e .emergencies_by_count[0] < test-audit.json > /dev/null && exit_fail "Unexpected emergency by count detected in ordinary run" || echo PASS
+jq -e .emergencies_by_count[0] < test-audit-coins.json > /dev/null && exit_fail "Unexpected emergency by count detected in ordinary run" || echo PASS
echo -n "Test for wire inconsistencies... "
-jq -e .wire_out_amount_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected wire out inconsistency detected in ordinary run"
-jq -e .reserve_in_amount_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected reserve in inconsistency detected in ordinary run"
-jq -e .missattribution_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected missattribution inconsistency detected in ordinary run"
-jq -e .row_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected row inconsistency detected in ordinary run"
-jq -e .denomination_key_validity_withdraw_inconsistencies[0] < test-audit.json > /dev/null && exit_fail "Unexpected denomination key withdraw inconsistency detected in ordinary run"
-jq -e .row_minor_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected minor row inconsistency detected in ordinary run"
-jq -e .lag_details[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected lag detected in ordinary run"
-jq -e .wire_format_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected wire format inconsistencies detected in ordinary run"
+jq -e .wire_out_amount_inconsistencies[0] < test-audit-wire.json > /dev/null && exit_fail "Unexpected wire out inconsistency detected in ordinary run"
+jq -e .reserve_in_amount_inconsistencies[0] < test-audit-wire.json > /dev/null && exit_fail "Unexpected reserve in inconsistency detected in ordinary run"
+jq -e .missattribution_inconsistencies[0] < test-audit-wire.json > /dev/null && exit_fail "Unexpected missattribution inconsistency detected in ordinary run"
+jq -e .row_inconsistencies[0] < test-audit-wire.json > /dev/null && exit_fail "Unexpected row inconsistency detected in ordinary run"
+jq -e .denomination_key_validity_withdraw_inconsistencies[0] < test-audit-reserves.json > /dev/null && exit_fail "Unexpected denomination key withdraw inconsistency detected in ordinary run"
+jq -e .row_minor_inconsistencies[0] < test-audit-wire.json > /dev/null && exit_fail "Unexpected minor row inconsistency detected in ordinary run"
+jq -e .lag_details[0] < test-audit-wire.json > /dev/null && exit_fail "Unexpected lag detected in ordinary run"
+jq -e .wire_format_inconsistencies[0] < test-audit-wire.json > /dev/null && exit_fail "Unexpected wire format inconsistencies detected in ordinary run"
# TODO: check operation balances are correct (once we have all transaction types and wallet is deterministic)
@@ -163,34 +183,44 @@ jq -e .wire_format_inconsistencies[0] < test-wire-audit.json > /dev/null && exit
echo PASS
-LOSS=`jq -r .total_bad_sig_loss < test-audit.json`
+LOSS=`jq -r .total_bad_sig_loss < test-audit-aggregation.json`
+if test $LOSS != "TESTKUDOS:0"
+then
+ exit_fail "Wrong total bad sig loss from aggregation, got unexpected loss of $LOSS"
+fi
+LOSS=`jq -r .total_bad_sig_loss < test-audit-coins.json`
if test $LOSS != "TESTKUDOS:0"
then
- exit_fail "Wrong total bad sig loss, got unexpected loss of $LOSS"
+ exit_fail "Wrong total bad sig loss from coins, got unexpected loss of $LOSS"
+fi
+LOSS=`jq -r .total_bad_sig_loss < test-audit-reserves.json`
+if test $LOSS != "TESTKUDOS:0"
+then
+ exit_fail "Wrong total bad sig loss from reserves, got unexpected loss of $LOSS"
fi
echo -n "Test for wire amounts... "
-WIRED=`jq -r .total_wire_in_delta_plus < test-wire-audit.json`
+WIRED=`jq -r .total_wire_in_delta_plus < test-audit-wire.json`
if test $WIRED != "TESTKUDOS:0"
then
exit_fail "Expected total wire delta plus wrong, got $WIRED"
fi
-WIRED=`jq -r .total_wire_in_delta_minus < test-wire-audit.json`
+WIRED=`jq -r .total_wire_in_delta_minus < test-audit-wire.json`
if test $WIRED != "TESTKUDOS:0"
then
exit_fail "Expected total wire delta minus wrong, got $WIRED"
fi
-WIRED=`jq -r .total_wire_out_delta_plus < test-wire-audit.json`
+WIRED=`jq -r .total_wire_out_delta_plus < test-audit-wire.json`
if test $WIRED != "TESTKUDOS:0"
then
exit_fail "Expected total wire delta plus wrong, got $WIRED"
fi
-WIRED=`jq -r .total_wire_out_delta_minus < test-wire-audit.json`
+WIRED=`jq -r .total_wire_out_delta_minus < test-audit-wire.json`
if test $WIRED != "TESTKUDOS:0"
then
exit_fail "Expected total wire delta minus wrong, got $WIRED"
fi
-WIRED=`jq -r .total_missattribution_in < test-wire-audit.json`
+WIRED=`jq -r .total_missattribution_in < test-audit-wire.json`
if test $WIRED != "TESTKUDOS:0"
then
exit_fail "Expected total missattribution in wrong, got $WIRED"
@@ -198,22 +228,44 @@ fi
echo PASS
echo -n "Checking for unexpected arithmetic differences "
-LOSS=`jq -r .total_arithmetic_delta_plus < test-audit.json`
+LOSS=`jq -r .total_arithmetic_delta_plus < test-audit-aggregation.json`
+if test $LOSS != "TESTKUDOS:0"
+then
+ exit_fail "Wrong arithmetic delta from aggregations, got unexpected plus of $LOSS"
+fi
+LOSS=`jq -r .total_arithmetic_delta_minus < test-audit-aggregation.json`
+if test $LOSS != "TESTKUDOS:0"
+then
+ exit_fail "Wrong arithmetic delta from aggregation, got unexpected minus of $LOSS"
+fi
+LOSS=`jq -r .total_arithmetic_delta_plus < test-audit-coins.json`
+if test $LOSS != "TESTKUDOS:0"
+then
+ exit_fail "Wrong arithmetic delta from coins, got unexpected plus of $LOSS"
+fi
+LOSS=`jq -r .total_arithmetic_delta_minus < test-audit-coins.json`
+if test $LOSS != "TESTKUDOS:0"
+then
+ exit_fail "Wrong arithmetic delta from coins, got unexpected minus of $LOSS"
+fi
+LOSS=`jq -r .total_arithmetic_delta_plus < test-audit-reserves.json`
if test $LOSS != "TESTKUDOS:0"
then
- exit_fail "Wrong arithmetic delta, got unexpected plus of $LOSS"
+ exit_fail "Wrong arithmetic delta from reserves, got unexpected plus of $LOSS"
fi
-LOSS=`jq -r .total_arithmetic_delta_minus < test-audit.json`
+LOSS=`jq -r .total_arithmetic_delta_minus < test-audit-reserves.json`
if test $LOSS != "TESTKUDOS:0"
then
- exit_fail "Wrong arithmetic delta, got unexpected minus of $LOSS"
+ exit_fail "Wrong arithmetic delta from reserves, got unexpected minus of $LOSS"
fi
-jq -e .amount_arithmetic_inconsistencies[0] < test-audit.json > /dev/null && exit_fail "Unexpected arithmetic inconsistencies detected in ordinary run"
+jq -e .amount_arithmetic_inconsistencies[0] < test-audit-aggregation.json > /dev/null && exit_fail "Unexpected arithmetic inconsistencies from aggregations detected in ordinary run"
+jq -e .amount_arithmetic_inconsistencies[0] < test-audit-coins.json > /dev/null && exit_fail "Unexpected arithmetic inconsistencies from coins detected in ordinary run"
+jq -e .amount_arithmetic_inconsistencies[0] < test-audit-reserves.json > /dev/null && exit_fail "Unexpected arithmetic inconsistencies from reserves detected in ordinary run"
echo PASS
echo -n "Checking for unexpected wire out differences "
-jq -e .wire_out_inconsistencies[0] < test-audit.json > /dev/null && exit_fail "Unexpected wire out inconsistencies detected in ordinary run"
+jq -e .wire_out_inconsistencies[0] < test-audit-aggregation.json > /dev/null && exit_fail "Unexpected wire out inconsistencies detected in ordinary run"
echo PASS
# cannot easily undo aggregator, hence full reload
@@ -232,17 +284,17 @@ run_audit
echo "Checking output"
# if an emergency was detected, that is a bug and we should fail
echo -n "Test for emergencies... "
-jq -e .emergencies[0] < test-audit.json > /dev/null && exit_fail "Unexpected emergency detected in ordinary run" || echo PASS
+jq -e .emergencies[0] < test-audit-coins.json > /dev/null && exit_fail "Unexpected emergency detected in ordinary run" || echo PASS
echo -n "Test for emergencies by count... "
-jq -e .emergencies_by_count[0] < test-audit.json > /dev/null && exit_fail "Unexpected emergency by count detected in ordinary run" || echo PASS
+jq -e .emergencies_by_count[0] < test-audit-coins.json > /dev/null && exit_fail "Unexpected emergency by count detected in ordinary run" || echo PASS
echo -n "Test for wire inconsistencies... "
-jq -e .wire_out_amount_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected wire out inconsistency detected in ordinary run"
-jq -e .reserve_in_amount_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected reserve in inconsistency detected in ordinary run"
-jq -e .missattribution_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected missattribution inconsistency detected in ordinary run"
-jq -e .row_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected row inconsistency detected in ordinary run"
-jq -e .row_minor_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected minor row inconsistency detected in ordinary run"
-jq -e .wire_format_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected wire format inconsistencies detected in ordinary run"
+jq -e .wire_out_amount_inconsistencies[0] < test-audit-wire.json > /dev/null && exit_fail "Unexpected wire out inconsistency detected in ordinary run"
+jq -e .reserve_in_amount_inconsistencies[0] < test-audit-wire.json > /dev/null && exit_fail "Unexpected reserve in inconsistency detected in ordinary run"
+jq -e .missattribution_inconsistencies[0] < test-audit-wire.json > /dev/null && exit_fail "Unexpected missattribution inconsistency detected in ordinary run"
+jq -e .row_inconsistencies[0] < test-audit-wire.json > /dev/null && exit_fail "Unexpected row inconsistency detected in ordinary run"
+jq -e .row_minor_inconsistencies[0] < test-audit-wire.json > /dev/null && exit_fail "Unexpected minor row inconsistency detected in ordinary run"
+jq -e .wire_format_inconsistencies[0] < test-audit-wire.json > /dev/null && exit_fail "Unexpected wire format inconsistencies detected in ordinary run"
# TODO: check operation balances are correct (once we have all transaction types and wallet is deterministic)
# TODO: check revenue summaries are correct (once we have all transaction types and wallet is deterministic)
@@ -258,9 +310,9 @@ echo -n "Check for lag detection... "
# taler-helper-auditor-wire.c)
if [ $DATABASE_AGE -gt 3600 ]
then
- jq -e .lag_details[0] < test-wire-audit.json > /dev/null || exit_fail "Lag not detected in run without aggregator at age $DELTA"
+ jq -e .lag_details[0] < test-audit-wire.json > /dev/null || exit_fail "Lag not detected in run without aggregator at age $DELTA"
- LAG=`jq -r .total_amount_lag < test-wire-audit.json`
+ LAG=`jq -r .total_amount_lag < test-audit-wire.json`
if test $LAG = "TESTKUDOS:0"
then
exit_fail "Expected total lag to be non-zero"
@@ -272,27 +324,27 @@ fi
echo -n "Test for wire amounts... "
-WIRED=`jq -r .total_wire_in_delta_plus < test-wire-audit.json`
+WIRED=`jq -r .total_wire_in_delta_plus < test-audit-wire.json`
if test $WIRED != "TESTKUDOS:0"
then
exit_fail "Expected total wire delta plus wrong, got $WIRED"
fi
-WIRED=`jq -r .total_wire_in_delta_minus < test-wire-audit.json`
+WIRED=`jq -r .total_wire_in_delta_minus < test-audit-wire.json`
if test $WIRED != "TESTKUDOS:0"
then
exit_fail "Expected total wire delta minus wrong, got $WIRED"
fi
-WIRED=`jq -r .total_wire_out_delta_plus < test-wire-audit.json`
+WIRED=`jq -r .total_wire_out_delta_plus < test-audit-wire.json`
if test $WIRED != "TESTKUDOS:0"
then
exit_fail "Expected total wire delta plus wrong, got $WIRED"
fi
-WIRED=`jq -r .total_wire_out_delta_minus < test-wire-audit.json`
+WIRED=`jq -r .total_wire_out_delta_minus < test-audit-wire.json`
if test $WIRED != "TESTKUDOS:0"
then
exit_fail "Expected total wire delta minus wrong, got $WIRED"
fi
-WIRED=`jq -r .total_missattribution_in < test-wire-audit.json`
+WIRED=`jq -r .total_missattribution_in < test-audit-wire.json`
if test $WIRED != "TESTKUDOS:0"
then
exit_fail "Expected total missattribution in wrong, got $WIRED"
@@ -311,28 +363,28 @@ echo "UPDATE reserves_in SET credit_val=5 WHERE reserve_in_serial_id=1" | psql -
run_audit
echo -n "Testing inconsistency detection... "
-ROW=`jq .reserve_in_amount_inconsistencies[0].row < test-wire-audit.json`
+ROW=`jq .reserve_in_amount_inconsistencies[0].row < test-audit-wire.json`
if test $ROW != 1
then
exit_fail "Row wrong"
fi
-WIRED=`jq -r .reserve_in_amount_inconsistencies[0].amount_wired < test-wire-audit.json`
+WIRED=`jq -r .reserve_in_amount_inconsistencies[0].amount_wired < test-audit-wire.json`
if test $WIRED != "TESTKUDOS:10"
then
exit_fail "Amount wrong"
fi
-EXPECTED=`jq -r .reserve_in_amount_inconsistencies[0].amount_exchange_expected < test-wire-audit.json`
+EXPECTED=`jq -r .reserve_in_amount_inconsistencies[0].amount_exchange_expected < test-audit-wire.json`
if test $EXPECTED != "TESTKUDOS:5"
then
exit_fail "Expected amount wrong"
fi
-WIRED=`jq -r .total_wire_in_delta_minus < test-wire-audit.json`
+WIRED=`jq -r .total_wire_in_delta_minus < test-audit-wire.json`
if test $WIRED != "TESTKUDOS:0"
then
exit_fail "Wrong total wire_in_delta_minus, got $WIRED"
fi
-DELTA=`jq -r .total_wire_in_delta_plus < test-wire-audit.json`
+DELTA=`jq -r .total_wire_in_delta_plus < test-audit-wire.json`
if test $DELTA != "TESTKUDOS:5"
then
exit_fail "Expected total wire delta plus wrong, got $DELTA"
@@ -354,49 +406,49 @@ echo "UPDATE reserves_in SET credit_val=15 WHERE reserve_in_serial_id=1" | psql
run_audit
-EXPECTED=`jq -r .reserve_balance_summary_wrong_inconsistencies[0].auditor < test-audit.json`
+EXPECTED=`jq -r .reserve_balance_summary_wrong_inconsistencies[0].auditor < test-audit-reserves.json`
if test $EXPECTED != "TESTKUDOS:5.01"
then
exit_fail "Expected reserve balance summary amount wrong, got $EXPECTED (auditor)"
fi
-EXPECTED=`jq -r .reserve_balance_summary_wrong_inconsistencies[0].exchange < test-audit.json`
+EXPECTED=`jq -r .reserve_balance_summary_wrong_inconsistencies[0].exchange < test-audit-reserves.json`
if test $EXPECTED != "TESTKUDOS:0.01"
then
exit_fail "Expected reserve balance summary amount wrong, got $EXPECTED (exchange)"
fi
-WIRED=`jq -r .total_loss_balance_insufficient < test-audit.json`
+WIRED=`jq -r .total_loss_balance_insufficient < test-audit-reserves.json`
if test $WIRED != "TESTKUDOS:0"
then
exit_fail "Wrong total loss from insufficient balance, got $WIRED"
fi
-ROW=`jq -e .reserve_in_amount_inconsistencies[0].row < test-wire-audit.json`
+ROW=`jq -e .reserve_in_amount_inconsistencies[0].row < test-audit-wire.json`
if test $ROW != 1
then
exit_fail "Row wrong, got $ROW"
fi
-WIRED=`jq -r .reserve_in_amount_inconsistencies[0].amount_exchange_expected < test-wire-audit.json`
+WIRED=`jq -r .reserve_in_amount_inconsistencies[0].amount_exchange_expected < test-audit-wire.json`
if test $WIRED != "TESTKUDOS:15"
then
exit_fail "Wrong amount_exchange_expected, got $WIRED"
fi
-WIRED=`jq -r .reserve_in_amount_inconsistencies[0].amount_wired < test-wire-audit.json`
+WIRED=`jq -r .reserve_in_amount_inconsistencies[0].amount_wired < test-audit-wire.json`
if test $WIRED != "TESTKUDOS:10"
then
exit_fail "Wrong amount_wired, got $WIRED"
fi
-WIRED=`jq -r .total_wire_in_delta_minus < test-wire-audit.json`
+WIRED=`jq -r .total_wire_in_delta_minus < test-audit-wire.json`
if test $WIRED != "TESTKUDOS:5"
then
exit_fail "Wrong total wire_in_delta_minus, got $WIRED"
fi
-WIRED=`jq -r .total_wire_in_delta_plus < test-wire-audit.json`
+WIRED=`jq -r .total_wire_in_delta_plus < test-audit-wire.json`
if test $WIRED != "TESTKUDOS:0"
then
exit_fail "Wrong total wire_in_delta_plus, got $WIRED"
@@ -422,27 +474,27 @@ run_audit
echo -n "Testing inconsistency detection... "
-jq -e .bad_sig_losses[0] < test-audit.json > /dev/null || exit_fail "Bad signature not detected"
+jq -e .bad_sig_losses[0] < test-audit-coins.json > /dev/null || exit_fail "Bad signature not detected"
-ROW=`jq -e .bad_sig_losses[0].row < test-audit.json`
+ROW=`jq -e .bad_sig_losses[0].row < test-audit-coins.json`
if test $ROW != ${SERIAL}
then
exit_fail "Row wrong, got $ROW"
fi
-LOSS=`jq -r .bad_sig_losses[0].loss < test-audit.json`
+LOSS=`jq -r .bad_sig_losses[0].loss < test-audit-coins.json`
if test $LOSS != "TESTKUDOS:3"
then
exit_fail "Wrong deposit bad signature loss, got $LOSS"
fi
-OP=`jq -r .bad_sig_losses[0].operation < test-audit.json`
+OP=`jq -r .bad_sig_losses[0].operation < test-audit-coins.json`
if test $OP != "deposit"
then
exit_fail "Wrong operation, got $OP"
fi
-LOSS=`jq -r .total_bad_sig_loss < test-audit.json`
+LOSS=`jq -r .total_bad_sig_loss < test-audit-coins.json`
if test $LOSS != "TESTKUDOS:3"
then
exit_fail "Wrong total bad sig loss, got $LOSS"
@@ -468,25 +520,25 @@ echo "UPDATE deposits SET h_contract_terms='\x12bb676444955c98789f219148aa31899d
run_audit
echo -n "Checking bad signature detection... "
-ROW=`jq -e .bad_sig_losses[0].row < test-audit.json`
+ROW=`jq -e .bad_sig_losses[0].row < test-audit-coins.json`
if test $ROW != $SERIAL
then
exit_fail "Row wrong, got $ROW"
fi
-LOSS=`jq -r .bad_sig_losses[0].loss < test-audit.json`
+LOSS=`jq -r .bad_sig_losses[0].loss < test-audit-coins.json`
if test $LOSS != "TESTKUDOS:3"
then
exit_fail "Wrong deposit bad signature loss, got $LOSS"
fi
-OP=`jq -r .bad_sig_losses[0].operation < test-audit.json`
+OP=`jq -r .bad_sig_losses[0].operation < test-audit-coins.json`
if test $OP != "deposit"
then
exit_fail "Wrong operation, got $OP"
fi
-LOSS=`jq -r .total_bad_sig_loss < test-audit.json`
+LOSS=`jq -r .total_bad_sig_loss < test-audit-coins.json`
if test $LOSS != "TESTKUDOS:3"
then
exit_fail "Wrong total bad sig loss, got $LOSS"
@@ -510,25 +562,25 @@ echo "UPDATE known_coins SET denom_sig='\x287369672d76616c200a2028727361200a2020
run_audit
-ROW=`jq -e .bad_sig_losses[0].row < test-audit.json`
+ROW=`jq -e .bad_sig_losses[0].row < test-audit-coins.json`
if test $ROW != "-1"
then
exit_fail "Row wrong, got $ROW"
fi
-LOSS=`jq -r .bad_sig_losses[0].loss < test-audit.json`
+LOSS=`jq -r .bad_sig_losses[0].loss < test-audit-coins.json`
if test $LOSS == "TESTKUDOS:0"
then
exit_fail "Wrong deposit bad signature loss, got $LOSS"
fi
-OP=`jq -r .bad_sig_losses[0].operation < test-audit.json`
+OP=`jq -r .bad_sig_losses[0].operation < test-audit-coins.json`
if test $OP != "known-coin"
then
exit_fail "Wrong operation, got $OP"
fi
-LOSS=`jq -r .total_bad_sig_loss < test-audit.json`
+LOSS=`jq -r .total_bad_sig_loss < test-audit-coins.json`
if test $LOSS == "TESTKUDOS:0"
then
exit_fail "Wrong total bad sig loss, got $LOSS"
@@ -555,14 +607,14 @@ echo "UPDATE reserves_out SET reserve_sig='\x9ef381a84aff252646a157d88eded50f708
run_audit
-OP=`jq -r .bad_sig_losses[0].operation < test-audit.json`
+OP=`jq -r .bad_sig_losses[0].operation < test-audit-reserves.json`
if test $OP != "withdraw"
then
exit_fail "Wrong operation, got $OP"
fi
-LOSS=`jq -r .bad_sig_losses[0].loss < test-audit.json`
-LOSS_TOTAL=`jq -r .total_bad_sig_loss < test-audit.json`
+LOSS=`jq -r .bad_sig_losses[0].loss < test-audit-reserves.json`
+LOSS_TOTAL=`jq -r .total_bad_sig_loss < test-audit-reserves.json`
if test $LOSS != $LOSS_TOTAL
then
exit_fail "Expected loss $LOSS and total loss $LOSS_TOTAL do not match"
@@ -604,17 +656,17 @@ echo "UPDATE app_banktransaction SET subject='$NEW_WTID' WHERE id='$OLD_ID';" |
run_audit
echo -n "Testing inconsistency detection... "
-DIAG=`jq -r .reserve_in_amount_inconsistencies[0].diagnostic < test-wire-audit.json`
+DIAG=`jq -r .reserve_in_amount_inconsistencies[0].diagnostic < test-audit-wire.json`
if test "x$DIAG" != "xwire subject does not match"
then
exit_fail "Diagnostic wrong: $DIAG (0)"
fi
-WTID=`jq -r .reserve_in_amount_inconsistencies[0].reserve_pub < test-wire-audit.json`
+WTID=`jq -r .reserve_in_amount_inconsistencies[0].reserve_pub < test-audit-wire.json`
if test x$WTID != x"$OLD_WTID" -a x$WTID != x"$NEW_WTID"
then
exit_fail "WTID reported wrong: $WTID"
fi
-EX_A=`jq -r .reserve_in_amount_inconsistencies[0].amount_exchange_expected < test-wire-audit.json`
+EX_A=`jq -r .reserve_in_amount_inconsistencies[0].amount_exchange_expected < test-audit-wire.json`
if test x$WTID = x$OLD_WTID -a x$EX_A != x"TESTKUDOS:10"
then
exit_fail "Amount reported wrong: $EX_A"
@@ -623,17 +675,17 @@ if test x$WTID = x$NEW_WTID -a x$EX_A != x"TESTKUDOS:0"
then
exit_fail "Amount reported wrong: $EX_A"
fi
-DIAG=`jq -r .reserve_in_amount_inconsistencies[1].diagnostic < test-wire-audit.json`
+DIAG=`jq -r .reserve_in_amount_inconsistencies[1].diagnostic < test-audit-wire.json`
if test "x$DIAG" != "xwire subject does not match"
then
exit_fail "Diagnostic wrong: $DIAG (1)"
fi
-WTID=`jq -r .reserve_in_amount_inconsistencies[1].reserve_pub < test-wire-audit.json`
+WTID=`jq -r .reserve_in_amount_inconsistencies[1].reserve_pub < test-audit-wire.json`
if test $WTID != "$OLD_WTID" -a $WTID != "$NEW_WTID"
then
exit_fail "WTID reported wrong: $WTID (wanted: $NEW_WTID or $OLD_WTID)"
fi
-EX_A=`jq -r .reserve_in_amount_inconsistencies[1].amount_exchange_expected < test-wire-audit.json`
+EX_A=`jq -r .reserve_in_amount_inconsistencies[1].amount_exchange_expected < test-audit-wire.json`
if test $WTID = "$OLD_WTID" -a $EX_A != "TESTKUDOS:10"
then
exit_fail "Amount reported wrong: $EX_A"
@@ -643,12 +695,12 @@ then
exit_fail "Amount reported wrong: $EX_A"
fi
-WIRED=`jq -r .total_wire_in_delta_minus < test-wire-audit.json`
+WIRED=`jq -r .total_wire_in_delta_minus < test-audit-wire.json`
if test $WIRED != "TESTKUDOS:10"
then
exit_fail "Wrong total wire_in_delta_minus, got $WIRED"
fi
-DELTA=`jq -r .total_wire_in_delta_plus < test-wire-audit.json`
+DELTA=`jq -r .total_wire_in_delta_plus < test-audit-wire.json`
if test $DELTA != "TESTKUDOS:10"
then
exit_fail "Expected total wire delta plus wrong, got $DELTA"
@@ -673,12 +725,12 @@ echo "UPDATE app_banktransaction SET debit_account_id=1 WHERE id='$OLD_ID';" | p
run_audit
echo -n "Testing inconsistency detection... "
-AMOUNT=`jq -r .missattribution_in_inconsistencies[0].amount < test-wire-audit.json`
+AMOUNT=`jq -r .missattribution_in_inconsistencies[0].amount < test-audit-wire.json`
if test "x$AMOUNT" != "xTESTKUDOS:10"
then
exit_fail "Reported amount wrong: $AMOUNT"
fi
-AMOUNT=`jq -r .total_missattribution_in < test-wire-audit.json`
+AMOUNT=`jq -r .total_missattribution_in < test-audit-wire.json`
if test "x$AMOUNT" != "xTESTKUDOS:10"
then
exit_fail "Reported total amount wrong: $AMOUNT"
@@ -702,12 +754,12 @@ echo "UPDATE app_banktransaction SET date=NOW() WHERE id=$OLD_ID;" | psql -Aqt $
run_audit
echo -n "Testing inconsistency detection... "
-DIAG=`jq -r .row_minor_inconsistencies[0].diagnostic < test-wire-audit.json`
+DIAG=`jq -r .row_minor_inconsistencies[0].diagnostic < test-audit-wire.json`
if test "x$DIAG" != "xexecution date mismatch"
then
exit_fail "Reported diagnostic wrong: $DIAG"
fi
-TABLE=`jq -r .row_minor_inconsistencies[0].table < test-wire-audit.json`
+TABLE=`jq -r .row_minor_inconsistencies[0].table < test-audit-wire.json`
if test "x$TABLE" != "xreserves_in"
then
exit_fail "Reported table wrong: $TABLE"
@@ -737,27 +789,27 @@ echo -e "UPDATE app_banktransaction SET debit_account_id=2,credit_account_id=1,s
run_audit
echo -n "Testing inconsistency detection... "
-AMOUNT=`jq -r .wire_out_amount_inconsistencies[0].amount_wired < test-wire-audit.json`
+AMOUNT=`jq -r .wire_out_amount_inconsistencies[0].amount_wired < test-audit-wire.json`
if test "x$AMOUNT" != "xTESTKUDOS:10"
then
exit_fail "Reported wired amount wrong: $AMOUNT"
fi
-AMOUNT=`jq -r .total_wire_out_delta_plus < test-wire-audit.json`
+AMOUNT=`jq -r .total_wire_out_delta_plus < test-audit-wire.json`
if test "x$AMOUNT" != "xTESTKUDOS:10"
then
exit_fail "Reported total plus amount wrong: $AMOUNT"
fi
-AMOUNT=`jq -r .total_wire_out_delta_minus < test-wire-audit.json`
+AMOUNT=`jq -r .total_wire_out_delta_minus < test-audit-wire.json`
if test "x$AMOUNT" != "xTESTKUDOS:0"
then
exit_fail "Reported total minus amount wrong: $AMOUNT"
fi
-AMOUNT=`jq -r .wire_out_amount_inconsistencies[0].amount_justified < test-wire-audit.json`
+AMOUNT=`jq -r .wire_out_amount_inconsistencies[0].amount_justified < test-audit-wire.json`
if test "x$AMOUNT" != "xTESTKUDOS:0"
then
exit_fail "Reported justified amount wrong: $AMOUNT"
fi
-DIAG=`jq -r .wire_out_amount_inconsistencies[0].diagnostic < test-wire-audit.json`
+DIAG=`jq -r .wire_out_amount_inconsistencies[0].diagnostic < test-audit-wire.json`
if test "x$DIAG" != "xjustification for wire transfer not found"
then
exit_fail "Reported diagnostic wrong: $DIAG"
@@ -781,8 +833,8 @@ run_audit
echo -n "Testing hung refresh detection... "
-HANG=`jq -er .refresh_hanging[0].amount < test-audit.json`
-TOTAL_HANG=`jq -er .total_refresh_hanging < test-audit.json`
+HANG=`jq -er .refresh_hanging[0].amount < test-audit-coins.json`
+TOTAL_HANG=`jq -er .total_refresh_hanging < test-audit-coins.json`
if test x$HANG = TESTKUDOS:0
then
exit_fail "Hanging amount zero"
@@ -815,14 +867,14 @@ run_audit
echo -n "Testing inconsistency detection... "
-OP=`jq -er .bad_sig_losses[0].operation < test-audit.json`
+OP=`jq -er .bad_sig_losses[0].operation < test-audit-coins.json`
if test x$OP != xmelt
then
exit_fail "Operation wrong, got $OP"
fi
-LOSS=`jq -er .bad_sig_losses[0].loss < test-audit.json`
-TOTAL_LOSS=`jq -er .total_bad_sig_loss < test-audit.json`
+LOSS=`jq -er .bad_sig_losses[0].loss < test-audit-coins.json`
+TOTAL_LOSS=`jq -er .total_bad_sig_loss < test-audit-coins.json`
if test x$LOSS != x$TOTAL_LOSS
then
exit_fail "Loss inconsistent, got $LOSS and $TOTAL_LOSS"
@@ -861,12 +913,12 @@ then
post_audit
echo -n "Testing inconsistency detection... "
- TABLE=`jq -r .row_inconsistencies[0].table < test-audit.json`
+ TABLE=`jq -r .row_inconsistencies[0].table < test-audit-aggregation.json`
if test "x$TABLE" != "xwire-fee"
then
exit_fail "Reported table wrong: $TABLE"
fi
- DIAG=`jq -r .row_inconsistencies[0].diagnostic < test-audit.json`
+ DIAG=`jq -r .row_inconsistencies[0].diagnostic < test-audit-aggregation.json`
if test "x$DIAG" != "xwire fee signature invalid at given time"
then
exit_fail "Reported diagnostic wrong: $DIAG"
@@ -906,7 +958,7 @@ then
run_audit aggregator
echo -n "Testing inconsistency detection... "
- TABLE=`jq -r .row_inconsistencies[0].table < test-audit.json`
+ TABLE=`jq -r .row_inconsistencies[0].table < test-audit-aggregation.json`
if test "x$TABLE" != "xaggregation" -a "x$TABLE" != "xdeposits"
then
exit_fail "Reported table wrong: $TABLE"
@@ -950,22 +1002,22 @@ then
echo -n "Testing inconsistency detection... "
- AMOUNT=`jq -r .wire_out_amount_inconsistencies[0].amount_justified < test-wire-audit.json`
+ AMOUNT=`jq -r .wire_out_amount_inconsistencies[0].amount_justified < test-audit-wire.json`
if test "x$AMOUNT" != "x$OLD_AMOUNT"
then
exit_fail "Reported justified amount wrong: $AMOUNT"
fi
- AMOUNT=`jq -r .wire_out_amount_inconsistencies[0].amount_wired < test-wire-audit.json`
+ AMOUNT=`jq -r .wire_out_amount_inconsistencies[0].amount_wired < test-audit-wire.json`
if test "x$AMOUNT" != "x$NEW_AMOUNT"
then
exit_fail "Reported wired amount wrong: $AMOUNT"
fi
- TOTAL_AMOUNT=`jq -r .total_wire_out_delta_minus < test-wire-audit.json`
+ TOTAL_AMOUNT=`jq -r .total_wire_out_delta_minus < test-audit-wire.json`
if test "x$TOTAL_AMOUNT" != "xTESTKUDOS:0"
then
exit_fail "Reported total wired amount minus wrong: $TOTAL_AMOUNT"
fi
- TOTAL_AMOUNT=`jq -r .total_wire_out_delta_plus < test-wire-audit.json`
+ TOTAL_AMOUNT=`jq -r .total_wire_out_delta_plus < test-audit-wire.json`
if test "x$TOTAL_AMOUNT" = "xTESTKUDOS:0"
then
exit_fail "Reported total wired amount plus wrong: $TOTAL_AMOUNT"
@@ -980,22 +1032,22 @@ then
echo -n "Testing inconsistency detection... "
- AMOUNT=`jq -r .wire_out_amount_inconsistencies[0].amount_justified < test-wire-audit.json`
+ AMOUNT=`jq -r .wire_out_amount_inconsistencies[0].amount_justified < test-audit-wire.json`
if test "x$AMOUNT" != "x$OLD_AMOUNT"
then
exit_fail "Reported justified amount wrong: $AMOUNT"
fi
- AMOUNT=`jq -r .wire_out_amount_inconsistencies[0].amount_wired < test-wire-audit.json`
+ AMOUNT=`jq -r .wire_out_amount_inconsistencies[0].amount_wired < test-audit-wire.json`
if test "x$AMOUNT" != "x$NEW_AMOUNT"
then
exit_fail "Reported wired amount wrong: $AMOUNT"
fi
- TOTAL_AMOUNT=`jq -r .total_wire_out_delta_minus < test-wire-audit.json`
+ TOTAL_AMOUNT=`jq -r .total_wire_out_delta_minus < test-audit-wire.json`
if test "x$TOTAL_AMOUNT" != "x$OLD_AMOUNT"
then
exit_fail "Reported total wired amount minus wrong: $TOTAL_AMOUNT (wanted $OLD_AMOUNT)"
fi
- TOTAL_AMOUNT=`jq -r .total_wire_out_delta_plus < test-wire-audit.json`
+ TOTAL_AMOUNT=`jq -r .total_wire_out_delta_plus < test-audit-wire.json`
if test "x$TOTAL_AMOUNT" != "xTESTKUDOS:0"
then
exit_fail "Reported total wired amount plus wrong: $TOTAL_AMOUNT"
@@ -1044,12 +1096,12 @@ then
post_audit
echo -n "Testing inconsistency detection... "
- TABLE=`jq -r .row_minor_inconsistencies[0].table < test-wire-audit.json`
+ TABLE=`jq -r .row_minor_inconsistencies[0].table < test-audit-wire.json`
if test "x$TABLE" != "xwire_out"
then
exit_fail "Reported table wrong: $TABLE"
fi
- DIAG=`jq -r .row_minor_inconsistencies[0].diagnostic < test-wire-audit.json`
+ DIAG=`jq -r .row_minor_inconsistencies[0].diagnostic < test-audit-wire.json`
DIAG=`echo "$DIAG" | awk '{print $1 " " $2 " " $3}'`
if test "x$DIAG" != "xexecution date mismatch"
then
@@ -1079,22 +1131,22 @@ run_audit
echo -n "Testing emergency detection... "
-jq -e .reserve_balance_summary_wrong_inconsistencies[0] < test-audit.json > /dev/null || exit_fail "Reserve balance inconsistency not detected"
+jq -e .reserve_balance_summary_wrong_inconsistencies[0] < test-audit-reserves.json > /dev/null || exit_fail "Reserve balance inconsistency not detected"
-jq -e .emergencies[0] < test-audit.json > /dev/null || exit_fail "Emergency not detected"
-jq -e .emergencies_by_count[0] < test-audit.json > /dev/null || exit_fail "Emergency by count not detected"
-jq -e .amount_arithmetic_inconsistencies[0] < test-audit.json > /dev/null || exit_fail "Escrow balance calculation impossibility not detected"
+jq -e .emergencies[0] < test-audit-coins.json > /dev/null || exit_fail "Emergency not detected"
+jq -e .emergencies_by_count[0] < test-audit-coins.json > /dev/null || exit_fail "Emergency by count not detected"
+jq -e .amount_arithmetic_inconsistencies[0] < test-audit-coins.json > /dev/null || exit_fail "Escrow balance calculation impossibility not detected"
echo PASS
echo -n "Testing loss calculation... "
-AMOUNT=`jq -r .emergencies_loss < test-audit.json`
+AMOUNT=`jq -r .emergencies_loss < test-audit-coins.json`
if test "x$AMOUNT" == "xTESTKUDOS:0"
then
exit_fail "Reported amount wrong: $AMOUNT"
fi
-AMOUNT=`jq -r .emergencies_loss_by_count < test-audit.json`
+AMOUNT=`jq -r .emergencies_loss_by_count < test-audit-coins.json`
if test "x$AMOUNT" == "xTESTKUDOS:0"
then
exit_fail "Reported amount wrong: $AMOUNT"
@@ -1135,12 +1187,12 @@ then
echo -n "Testing reserve closure was done correctly... "
- jq -e .reserve_not_closed_inconsistencies[0] < test-audit.json > /dev/null && exit_fail "Unexpected reserve not closed inconsistency detected"
+ jq -e .reserve_not_closed_inconsistencies[0] < test-audit-reserves.json > /dev/null && exit_fail "Unexpected reserve not closed inconsistency detected"
echo "PASS"
echo -n "Testing no bogus transfers detected... "
- jq -e .wire_out_amount_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected wire out inconsistency detected in run with reserve closure"
+ jq -e .wire_out_amount_inconsistencies[0] < test-audit-wire.json > /dev/null && exit_fail "Unexpected wire out inconsistency detected in run with reserve closure"
echo "PASS"
@@ -1169,10 +1221,10 @@ echo "UPDATE reserves SET current_balance_val=100+current_balance_val WHERE rese
run_audit
echo -n "Testing reserve closure missing detected... "
-jq -e .reserve_not_closed_inconsistencies[0] < test-audit.json > /dev/null || exit_fail "Reserve not closed inconsistency not detected"
+jq -e .reserve_not_closed_inconsistencies[0] < test-audit-reserves.json > /dev/null || exit_fail "Reserve not closed inconsistency not detected"
echo "PASS"
-AMOUNT=`jq -r .total_balance_reserve_not_closed < test-audit.json`
+AMOUNT=`jq -r .total_balance_reserve_not_closed < test-audit-reserves.json`
if test "x$AMOUNT" == "xTESTKUDOS:0"
then
exit_fail "Reported total amount wrong: $AMOUNT"
@@ -1220,14 +1272,14 @@ then
echo -n "Testing lack of reserve closure transaction detected... "
- jq -e .reserve_lag_details[0] < test-wire-audit.json > /dev/null || exit_fail "Reserve closure lag not detected"
+ jq -e .reserve_lag_details[0] < test-audit-wire.json > /dev/null || exit_fail "Reserve closure lag not detected"
- AMOUNT=`jq -r .reserve_lag_details[0].amount < test-wire-audit.json`
+ AMOUNT=`jq -r .reserve_lag_details[0].amount < test-audit-wire.json`
if test "x$AMOUNT" != "xTESTKUDOS:${VAL_DELTA}"
then
exit_fail "Reported total amount wrong: $AMOUNT"
fi
- AMOUNT=`jq -r .total_closure_amount_lag < test-wire-audit.json`
+ AMOUNT=`jq -r .total_closure_amount_lag < test-audit-wire.json`
if test "x$AMOUNT" != "xTESTKUDOS:${VAL_DELTA}"
then
exit_fail "Reported total amount wrong: $AMOUNT"
@@ -1260,7 +1312,7 @@ echo "UPDATE auditor_denominations SET expire_withdraw=${NEW_WEXP} WHERE denom_p
run_audit
echo -n "Testing inconsistency detection... "
-jq -e .denomination_key_validity_withdraw_inconsistencies[0] < test-audit.json > /dev/null || exit_fail "Denomination key withdraw inconsistency not detected"
+jq -e .denomination_key_validity_withdraw_inconsistencies[0] < test-audit-reserves.json > /dev/null || exit_fail "Denomination key withdraw inconsistency not detected"
echo PASS
@@ -1295,19 +1347,19 @@ then
echo -n "Testing inconsistency detection... "
- jq -e .wire_out_inconsistencies[0] < test-audit.json > /dev/null || exit_fail "Wire out inconsistency not detected"
+ jq -e .wire_out_inconsistencies[0] < test-audit-aggregation.json > /dev/null || exit_fail "Wire out inconsistency not detected"
- ROW=`jq .wire_out_inconsistencies[0].rowid < test-audit.json`
+ ROW=`jq .wire_out_inconsistencies[0].rowid < test-audit-aggregation.json`
if test $ROW != 1
then
exit_fail "Row wrong"
fi
- AMOUNT=`jq -r .total_wire_out_delta_plus < test-audit.json`
+ AMOUNT=`jq -r .total_wire_out_delta_plus < test-audit-aggregation.json`
if test "x$AMOUNT" != "xTESTKUDOS:0"
then
exit_fail "Reported amount wrong: $AMOUNT"
fi
- AMOUNT=`jq -r .total_wire_out_delta_minus < test-audit.json`
+ AMOUNT=`jq -r .total_wire_out_delta_minus < test-audit-aggregation.json`
if test "x$AMOUNT" != "xTESTKUDOS:0.01"
then
exit_fail "Reported total amount wrong: $AMOUNT"
@@ -1324,19 +1376,19 @@ then
echo -n "Testing inconsistency detection... "
- jq -e .wire_out_inconsistencies[0] < test-audit.json > /dev/null || exit_fail "Wire out inconsistency not detected"
+ jq -e .wire_out_inconsistencies[0] < test-audit-aggregation.json > /dev/null || exit_fail "Wire out inconsistency not detected"
- ROW=`jq .wire_out_inconsistencies[0].rowid < test-audit.json`
+ ROW=`jq .wire_out_inconsistencies[0].rowid < test-audit-aggregation.json`
if test $ROW != 1
then
exit_fail "Row wrong"
fi
- AMOUNT=`jq -r .total_wire_out_delta_minus < test-audit.json`
+ AMOUNT=`jq -r .total_wire_out_delta_minus < test-audit-aggregation.json`
if test "x$AMOUNT" != "xTESTKUDOS:0"
then
exit_fail "Reported amount wrong: $AMOUNT"
fi
- AMOUNT=`jq -r .total_wire_out_delta_plus < test-audit.json`
+ AMOUNT=`jq -r .total_wire_out_delta_plus < test-audit-aggregation.json`
if test "x$AMOUNT" != "xTESTKUDOS:0.01"
then
exit_fail "Reported total amount wrong: $AMOUNT"
@@ -1370,14 +1422,14 @@ else
echo -n "Testing inconsistency detection... "
- jq -e .deposit_confirmation_inconsistencies[0] < test-audit.json > /dev/null || exit_fail "Deposit confirmation inconsistency NOT detected"
+ jq -e .deposit_confirmation_inconsistencies[0] < test-audit-deposits.json > /dev/null || exit_fail "Deposit confirmation inconsistency NOT detected"
- AMOUNT=`jq -er .missing_deposit_confirmation_total < test-audit.json`
+ AMOUNT=`jq -er .missing_deposit_confirmation_total < test-audit-deposits.json`
if test x$AMOUNT = xTESTKUDOS:0
then
exit_fail "Expected non-zero total missing deposit confirmation amount"
fi
- COUNT=`jq -er .missing_deposit_confirmation_count < test-audit.json`
+ COUNT=`jq -er .missing_deposit_confirmation_count < test-audit-deposits.json`
if test x$AMOUNT = x0
then
exit_fail "Expected non-zero total missing deposit confirmation count"
@@ -1411,22 +1463,22 @@ then
echo -n "Testing inconsistency detection... "
- jq -e .coin_inconsistencies[0] < test-audit.json > /dev/null || exit_fail "Coin inconsistency NOT detected"
+ jq -e .coin_inconsistencies[0] < test-audit-aggregation.json > /dev/null || exit_fail "Coin inconsistency NOT detected"
- jq -e .row_inconsistencies[0] < test-audit.json > /dev/null || exit_fail "Coin history verification failure NOT reported"
+ jq -e .row_inconsistencies[0] < test-audit-aggregation.json > /dev/null || exit_fail "Coin history verification failure NOT reported"
# Note: if the wallet withdrew much more than it spent, this might indeed
# go legitimately unnoticed.
- jq -e .emergencies[0] < test-audit.json > /dev/null || exit_fail "Denomination value emergency NOT reported"
+ jq -e .emergencies[0] < test-audit-coins.json > /dev/null || exit_fail "Denomination value emergency NOT reported"
- AMOUNT=`jq -er .total_coin_delta_minus < test-audit.json`
+ AMOUNT=`jq -er .total_coin_delta_minus < test-audit-aggregation.json`
if test x$AMOUNT = xTESTKUDOS:0
then
exit_fail "Expected non-zero total inconsistency amount from coins"
fi
# Note: if the wallet withdrew much more than it spent, this might indeed
# go legitimately unnoticed.
- COUNT=`jq -er .emergencies_risk_by_amount < test-audit.json`
+ COUNT=`jq -er .emergencies_risk_by_amount < test-audit-coins.json`
if test x$AMOUNT = xTESTKUDOS:0
then
exit_fail "Expected non-zero emergency-by-amount"
@@ -1453,27 +1505,27 @@ run_audit
echo -n "Testing inconsistency detection... "
-jq -e .bad_sig_losses[0] < test-audit.json > /dev/null || exit_fail "Bad signature not detected"
+jq -e .bad_sig_losses[0] < test-audit-coins.json > /dev/null || exit_fail "Bad signature not detected"
-ROW=`jq -e .bad_sig_losses[0].row < test-audit.json`
+ROW=`jq -e .bad_sig_losses[0].row < test-audit-coins.json`
if test $ROW != ${SERIAL}
then
exit_fail "Row wrong, got $ROW"
fi
-LOSS=`jq -r .bad_sig_losses[0].loss < test-audit.json`
+LOSS=`jq -r .bad_sig_losses[0].loss < test-audit-coins.json`
if test $LOSS != "TESTKUDOS:3"
then
exit_fail "Wrong deposit bad signature loss, got $LOSS"
fi
-OP=`jq -r .bad_sig_losses[0].operation < test-audit.json`
+OP=`jq -r .bad_sig_losses[0].operation < test-audit-coins.json`
if test $OP != "deposit"
then
exit_fail "Wrong operation, got $OP"
fi
-LOSS=`jq -r .total_bad_sig_loss < test-audit.json`
+LOSS=`jq -r .total_bad_sig_loss < test-audit-coins.json`
if test $LOSS != "TESTKUDOS:3"
then
exit_fail "Wrong total bad sig loss, got $LOSS"
@@ -1509,13 +1561,13 @@ then
echo -n "Testing inconsistency detection... "
- AMOUNT=`jq -r .wire_format_inconsistencies[0].amount < test-wire-audit.json`
+ AMOUNT=`jq -r .wire_format_inconsistencies[0].amount < test-audit-wire.json`
if test "${AMOUNT}" != "TESTKUDOS:1"
then
exit_fail "Amount wrong, got ${AMOUNT}"
fi
- AMOUNT=`jq -r .total_wire_format_amount < test-wire-audit.json`
+ AMOUNT=`jq -r .total_wire_format_amount < test-audit-wire.json`
if test "${AMOUNT}" != "TESTKUDOS:1"
then
exit_fail "Wrong total wire format amount, got $AMOUNT"