aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-03-21 16:09:22 +0100
committerChristian Grothoff <christian@grothoff.org>2020-03-21 16:09:22 +0100
commit88fd81e5da88fe11746ed7c06ba283891e05b673 (patch)
tree0816f19307abcf815e67763d8d461ca84819e016 /contrib
parenta8b8258e12f8e04936bffd82a2e31be7117ec860 (diff)
completing auditor split
Diffstat (limited to 'contrib')
-rw-r--r--contrib/Makefile.am10
-rw-r--r--contrib/auditor-report.tex.j286
-rwxr-xr-xcontrib/render.py58
3 files changed, 84 insertions, 70 deletions
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index eb4ad312d..76443cbca 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -6,6 +6,8 @@ tosendir=$(pkgdatadir)/tos/en
# English (en)
ppendir=$(pkgdatadir)/pp/en
+rdatadir=$(pkgdatadir)
+
tosen_DATA = \
tos/en/0.txt \
tos/en/0.pdf \
@@ -20,6 +22,9 @@ ppen_DATA = \
pp/en/0.xml \
pp/en/0.html
+rdata_DATA = \
+ auditor-report.tex.j2
+
bin_SCRIPTS = \
taler-bank-manage-testing \
taler-exchange-revoke
@@ -39,11 +44,10 @@ EXTRA_DIST = \
pp/tos.rst \
pp/conf.py \
pp/locale/pp/LC_MESSAGES/pp.po \
- auditor-report.tex.j2 \
+ $(data_DATA) \
coverage.sh \
gnunet.tag \
- microhttpd.tag \
- render.py
+ microhttpd.tag
# Change the set of supported languages here. You should
# also update tos'XX'data and EXTRA_DIST accordingly.
diff --git a/contrib/auditor-report.tex.j2 b/contrib/auditor-report.tex.j2
index ccb249dd3..d826de446 100644
--- a/contrib/auditor-report.tex.j2
+++ b/contrib/auditor-report.tex.j2
@@ -467,9 +467,49 @@ the financial damage done to the customer).
Note that the deltas only sum up the issues where $P \not= 0$ as only
then we can tell if the problem lead to a profit or loss.
+The {\bf P} colum is set to "1" if the arithmetic problem was be determined to be
+profitable for the exchange, "-1" if the problem resulted in a net loss for
+the exchange, and "0" if this is unclear or at least the gain/loss is not
+easily determined from the amounts and thus not included in the totals.
+
+\subsubsection{For aggregation}
+
+% Table generation tested by testcase #XX in test-auditor.sh
+
+{% if aggregation.amount_arithmetic_inconsistencies|length() == 0 %}
+ {\bf No arithmetic problems detected.}
+{% else %}
+ \begin{longtable}{p{3.5cm}|r|r|r|c}
+ {\bf Operation} & {\bf Row} & {\bf Exchange} & {\bf Auditor} & {\bf P} \\
+ \hline \hline
+\endfirsthead
+ {\bf Operation} & {\bf Row} & {\bf Exchange} & {\bf Auditor} & {\bf P} \\ \hline \hline
+\endhead
+ \hline \hline
+ {\bf Operation} & {\bf Row} & {\bf Exchange} & {\bf Auditor} & {\bf P} \\
+\endfoot
+ \hline \hline
+ \multicolumn{2}{l|}{ {\bf $\sum$ Deltas (Auditor-Exchange)} } &
+ + {{ aggregation.total_arithmetic_delta_plus }} &
+ - {{ aggregation.total_arithmetic_delta_minus }} & \\
+ \caption{Arithmetic inconsistencies.}
+ \label{table:amount:arithmetic:inconsistencies:aggregation}
+\endlastfoot
+{% for item in aggregation.amount_arithmetic_inconsistencies %}
+ \truncate{3.3cm}{ {\tiny {{ item.operation }} } } &
+ {{ item.rowid }} &
+ {{ item.exchange }} &
+ {{ item.auditor }} &
+ {{ item.profitable }} \\ \hline
+{% endfor %}
+ \end{longtable}
+{% endif %}
+
+\subsubsection{For coins}
+
% Table generation tested by testcase #18 in test-auditor.sh
-{% if data.amount_arithmetic_inconsistencies|length() == 0 %}
+{% if coins.amount_arithmetic_inconsistencies|length() == 0 %}
{\bf No arithmetic problems detected.}
{% else %}
\begin{longtable}{p{3.5cm}|r|r|r|c}
@@ -483,12 +523,12 @@ then we can tell if the problem lead to a profit or loss.
\endfoot
\hline \hline
\multicolumn{2}{l|}{ {\bf $\sum$ Deltas (Auditor-Exchange)} } &
- + {{ data.total_arithmetic_delta_plus }} &
- - {{ data.total_arithmetic_delta_minus }} & \\
+ + {{ coins.total_arithmetic_delta_plus }} &
+ - {{ coins.total_arithmetic_delta_minus }} & \\
\caption{Arithmetic inconsistencies.}
- \label{table:amount:arithmetic:inconsistencies}
+ \label{table:amount:arithmetic:inconsistencies:coins}
\endlastfoot
-{% for item in data.amount_arithmetic_inconsistencies %}
+{% for item in coins.amount_arithmetic_inconsistencies %}
\truncate{3.3cm}{ {\tiny {{ item.operation }} } } &
{{ item.rowid }} &
{{ item.exchange }} &
@@ -496,11 +536,39 @@ then we can tell if the problem lead to a profit or loss.
{{ item.profitable }} \\ \hline
{% endfor %}
\end{longtable}
+{% endif %}
-The {\bf P} colum is set to "1" if the arithmetic problem was be determined to be
-profitable for the exchange, "-1" if the problem resulted in a net loss for
-the exchange, and "0" if this is unclear or at least the gain/loss is not
-easily determined from the amounts and thus not included in the totals.
+\subsubsection{For reserves}
+
+% Table generation tested by testcase #XX in test-auditor.sh
+
+{% if reserves.amount_arithmetic_inconsistencies|length() == 0 %}
+ {\bf No arithmetic problems detected.}
+{% else %}
+ \begin{longtable}{p{3.5cm}|r|r|r|c}
+ {\bf Operation} & {\bf Row} & {\bf Exchange} & {\bf Auditor} & {\bf P} \\
+ \hline \hline
+\endfirsthead
+ {\bf Operation} & {\bf Row} & {\bf Exchange} & {\bf Auditor} & {\bf P} \\ \hline \hline
+\endhead
+ \hline \hline
+ {\bf Operation} & {\bf Row} & {\bf Exchange} & {\bf Auditor} & {\bf P} \\
+\endfoot
+ \hline \hline
+ \multicolumn{2}{l|}{ {\bf $\sum$ Deltas (Auditor-Exchange)} } &
+ + {{ reserves.total_arithmetic_delta_plus }} &
+ - {{ reserves.total_arithmetic_delta_minus }} & \\
+ \caption{Arithmetic inconsistencies.}
+ \label{table:amount:arithmetic:inconsistencies:reserves}
+\endlastfoot
+{% for item in reserves.amount_arithmetic_inconsistencies %}
+ \truncate{3.3cm}{ {\tiny {{ item.operation }} } } &
+ {{ item.rowid }} &
+ {{ item.exchange }} &
+ {{ item.auditor }} &
+ {{ item.profitable }} \\ \hline
+{% endfor %}
+ \end{longtable}
{% endif %}
diff --git a/contrib/render.py b/contrib/render.py
deleted file mode 100755
index cd50f7164..000000000
--- a/contrib/render.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/python3
-# This file is in the public domain.
-
-"""Expand Jinja2 templates based on JSON input.
-
-First command-line argument must be the JSON input from taler-auditor.
-Second command-line argument must be the JSON input from the
-taler-wire-auditor.
-
-The tool then reads the template from stdin and writes the expanded
-output to stdout.
-
-TODO: proper installation, man page, error handling, --help option.
-
-@author Christian Grothoff
-
-"""
-
-import sys
-import json
-import jinja2
-from jinja2 import BaseLoader
-
-
-class StdinLoader(BaseLoader):
- def __init__ (self):
- self.path = '-'
- def get_source(self, environment, template):
- source = sys.stdin.read()
- return source, self.path, lambda: false
-
-
-jsonFile1 = open (sys.argv[1], 'r')
-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,
- undefined=jinja2.StrictUndefined,
- autoescape=False)
-tmpl = jinjaEnv.get_template('stdin');
-
-print(tmpl.render(data = jsonData1, wire = jsonData2, aggregation = jsonData3, coins = jsonData4, deposits = jsonData5, reserves = jsonData6))