completing auditor split
This commit is contained in:
parent
a8b8258e12
commit
88fd81e5da
1
.gitignore
vendored
1
.gitignore
vendored
@ -34,7 +34,6 @@ GTAGS
|
||||
*.swp
|
||||
src/lib/test_exchange_api
|
||||
doc/doxygen/doxygen_sqlite3.db
|
||||
src/auditor/taler-auditor
|
||||
src/auditor/taler-auditor-dbinit
|
||||
src/auditor/taler-auditor-sign
|
||||
src/bank-lib/taler-fakebank-run
|
||||
|
@ -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.
|
||||
|
@ -467,9 +467,16 @@ 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.
|
||||
|
||||
% Table generation tested by testcase #18 in test-auditor.sh
|
||||
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.
|
||||
|
||||
{% if data.amount_arithmetic_inconsistencies|length() == 0 %}
|
||||
\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}
|
||||
@ -483,12 +490,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 }} & \\
|
||||
+ {{ aggregation.total_arithmetic_delta_plus }} &
|
||||
- {{ aggregation.total_arithmetic_delta_minus }} & \\
|
||||
\caption{Arithmetic inconsistencies.}
|
||||
\label{table:amount:arithmetic:inconsistencies}
|
||||
\label{table:amount:arithmetic:inconsistencies:aggregation}
|
||||
\endlastfoot
|
||||
{% for item in data.amount_arithmetic_inconsistencies %}
|
||||
{% for item in aggregation.amount_arithmetic_inconsistencies %}
|
||||
\truncate{3.3cm}{ {\tiny {{ item.operation }} } } &
|
||||
{{ item.rowid }} &
|
||||
{{ item.exchange }} &
|
||||
@ -496,11 +503,72 @@ 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 coins}
|
||||
|
||||
% Table generation tested by testcase #18 in test-auditor.sh
|
||||
|
||||
{% if coins.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)} } &
|
||||
+ {{ coins.total_arithmetic_delta_plus }} &
|
||||
- {{ coins.total_arithmetic_delta_minus }} & \\
|
||||
\caption{Arithmetic inconsistencies.}
|
||||
\label{table:amount:arithmetic:inconsistencies:coins}
|
||||
\endlastfoot
|
||||
{% for item in coins.amount_arithmetic_inconsistencies %}
|
||||
\truncate{3.3cm}{ {\tiny {{ item.operation }} } } &
|
||||
{{ item.rowid }} &
|
||||
{{ item.exchange }} &
|
||||
{{ item.auditor }} &
|
||||
{{ item.profitable }} \\ \hline
|
||||
{% endfor %}
|
||||
\end{longtable}
|
||||
{% endif %}
|
||||
|
||||
\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 %}
|
||||
|
||||
|
||||
|
@ -4,6 +4,7 @@ SUBDIRS = . doxygen
|
||||
|
||||
man_MANS = \
|
||||
prebuilt/man/taler-auditor.1 \
|
||||
prebuilt/man/taler-auditor-dbinit.1 \
|
||||
prebuilt/man/taler-auditor-exchange.1 \
|
||||
prebuilt/man/taler-auditor-sign.1 \
|
||||
prebuilt/man/taler-bank-transfer.1 \
|
||||
|
1
src/auditor/.gitignore
vendored
1
src/auditor/.gitignore
vendored
@ -1,6 +1,5 @@
|
||||
taler-auditor-httpd
|
||||
taler-auditor
|
||||
taler-wire-auditor
|
||||
taler-auditor-exchange
|
||||
test-report.aux
|
||||
test-report.pdf
|
||||
|
@ -12,16 +12,27 @@ pkgcfg_DATA = \
|
||||
auditor.conf
|
||||
|
||||
bin_PROGRAMS = \
|
||||
taler-auditor \
|
||||
taler-helper-auditor-reserves \
|
||||
taler-helper-auditor-coins \
|
||||
taler-helper-auditor-aggregation \
|
||||
taler-helper-auditor-deposits \
|
||||
taler-helper-auditor-wire \
|
||||
taler-auditor-dbinit \
|
||||
taler-auditor-exchange \
|
||||
taler-auditor-httpd \
|
||||
taler-auditor-sign \
|
||||
taler-auditor-dbinit
|
||||
taler-helper-auditor-aggregation \
|
||||
taler-helper-auditor-coins \
|
||||
taler-helper-auditor-deposits \
|
||||
taler-helper-auditor-reserves \
|
||||
taler-helper-auditor-wire
|
||||
|
||||
bin_SCRIPTS = \
|
||||
taler-auditor \
|
||||
taler-helper-auditor-render.py
|
||||
|
||||
edit_script = $(SED) -e 's,%pkgdatadir%,$(pkgdatadir),'g $(NULL)
|
||||
|
||||
taler-auditor: taler-auditor.in
|
||||
rm -f $@ $@.tmp && \
|
||||
$(edit_script) $< >$@.tmp && \
|
||||
chmod a-w+x $@.tmp && \
|
||||
mv $@.tmp $@
|
||||
|
||||
noinst_LIBRARIES = \
|
||||
libauditor.a
|
||||
@ -116,20 +127,6 @@ taler_helper_auditor_wire_LDADD = \
|
||||
-lgnunetutil
|
||||
|
||||
|
||||
taler_auditor_SOURCES = \
|
||||
taler-auditor.c
|
||||
taler_auditor_LDADD = \
|
||||
$(LIBGCRYPT_LIBS) \
|
||||
$(top_builddir)/src/util/libtalerutil.la \
|
||||
$(top_builddir)/src/json/libtalerjson.la \
|
||||
$(top_builddir)/src/bank-lib/libtalerbank.la \
|
||||
$(top_builddir)/src/exchangedb/libtalerexchangedb.la \
|
||||
$(top_builddir)/src/auditordb/libtalerauditordb.la \
|
||||
-ljansson \
|
||||
-lgnunetjson \
|
||||
-lgnunetutil
|
||||
|
||||
|
||||
taler_auditor_httpd_SOURCES = \
|
||||
taler-auditor-httpd.c taler-auditor-httpd.h \
|
||||
taler-auditor-httpd_deposit-confirmation.c taler-auditor-httpd_deposit-confirmation.h \
|
||||
|
@ -21,11 +21,6 @@
|
||||
#include "platform.h"
|
||||
#include "report-lib.h"
|
||||
|
||||
/**
|
||||
* Command-line option "-r": TALER_ARL_restart audit from scratch
|
||||
*/
|
||||
int TALER_ARL_restart;
|
||||
|
||||
/**
|
||||
* Handle to access the exchange's database.
|
||||
*/
|
||||
@ -518,26 +513,6 @@ TALER_ARL_init (const struct GNUNET_CONFIGURATION_Handle *c)
|
||||
TALER_EXCHANGEDB_plugin_unload (TALER_ARL_edb);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
if (TALER_ARL_restart)
|
||||
{
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
|
||||
"Full audit TALER_ARL_restart requested, dropping old audit data.\n");
|
||||
GNUNET_break (GNUNET_OK ==
|
||||
TALER_ARL_adb->drop_tables (TALER_ARL_adb->cls,
|
||||
GNUNET_NO));
|
||||
TALER_AUDITORDB_plugin_unload (TALER_ARL_adb);
|
||||
if (NULL ==
|
||||
(TALER_ARL_adb = TALER_AUDITORDB_plugin_load (TALER_ARL_cfg)))
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Failed to initialize auditor database plugin after drop.\n");
|
||||
TALER_EXCHANGEDB_plugin_unload (TALER_ARL_edb);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
GNUNET_break (GNUNET_OK ==
|
||||
TALER_ARL_adb->create_tables (TALER_ARL_adb->cls));
|
||||
}
|
||||
|
||||
return GNUNET_OK;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,12 @@
|
||||
static int global_ret;
|
||||
|
||||
/**
|
||||
* -r option: do full DB reset
|
||||
* -r option: do restart audits
|
||||
*/
|
||||
static int restart_db;
|
||||
|
||||
/**
|
||||
* -R option: do full DB reset
|
||||
*/
|
||||
static int reset_db;
|
||||
|
||||
@ -71,6 +76,11 @@ run (void *cls,
|
||||
(void) plugin->drop_tables (plugin->cls,
|
||||
GNUNET_YES);
|
||||
}
|
||||
else if (restart_db)
|
||||
{
|
||||
(void) plugin->drop_tables (plugin->cls,
|
||||
GNUNET_NO);
|
||||
}
|
||||
if (GNUNET_OK !=
|
||||
plugin->create_tables (plugin->cls))
|
||||
{
|
||||
@ -104,6 +114,10 @@ main (int argc,
|
||||
{
|
||||
const struct GNUNET_GETOPT_CommandLineOption options[] = {
|
||||
GNUNET_GETOPT_option_flag ('r',
|
||||
"restart",
|
||||
"restart audits (DANGEROUS: all audits resume from scratch)",
|
||||
&restart_db),
|
||||
GNUNET_GETOPT_option_flag ('R',
|
||||
"reset",
|
||||
"reset database (DANGEROUS: all existing data is lost!)",
|
||||
&reset_db),
|
||||
|
@ -197,12 +197,11 @@ main (int argc,
|
||||
}
|
||||
if (0 == qs)
|
||||
{
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
|
||||
GNUNET_log (
|
||||
GNUNET_ERROR_TYPE_WARNING,
|
||||
(remove_flag)
|
||||
?
|
||||
"Could not remove exchange from auditor database: entry already absent\n"
|
||||
:
|
||||
"Could not add exchange to auditor database: entry already existed\n");
|
||||
? "Could not remove exchange from database: entry already absent\n"
|
||||
: "Could not add exchange to database: entry already exists\n");
|
||||
TALER_AUDITORDB_plugin_unload (adb);
|
||||
return 4;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
23
src/auditor/taler-auditor.in
Executable file
23
src/auditor/taler-auditor.in
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
DIR=`mktemp -d reportXXXXXX`
|
||||
for n in aggregation coins deposits reserves wire
|
||||
do
|
||||
taler-helper-auditor-$n "$@" > ${DIR}/$n.json
|
||||
done
|
||||
|
||||
taler-helper-auditor-render.py \
|
||||
${DIR}/aggregation.json \
|
||||
${DIR}/coins.json \
|
||||
${DIR}/deposits.json \
|
||||
${DIR}/reserves.json \
|
||||
${DIR}/wire.json < %pkgdatadir%/auditor-report.tex.j2 > ${DIR}/auditor-report.tex
|
||||
cd ${DIR}
|
||||
pdflatex auditor-report.tex < /dev/null
|
||||
pdflatex auditor-report.tex < /dev/null
|
||||
pdflatex auditor-report.tex < /dev/null
|
||||
cd ..
|
||||
|
||||
echo "Result is in ${DIR}/auditor-report.pdf"
|
@ -1519,10 +1519,6 @@ main (int argc,
|
||||
"KEY",
|
||||
"public key of the exchange (Crockford base32 encoded)",
|
||||
&TALER_ARL_master_pub),
|
||||
GNUNET_GETOPT_option_flag ('r',
|
||||
"TALER_ARL_restart",
|
||||
"TALER_ARL_restart audit from the beginning (required on first run)",
|
||||
&TALER_ARL_restart),
|
||||
GNUNET_GETOPT_option_timetravel ('T',
|
||||
"timetravel"),
|
||||
GNUNET_GETOPT_OPTION_END
|
||||
@ -1533,13 +1529,13 @@ main (int argc,
|
||||
away and skip #TALER_OS_init(), which we do need */
|
||||
(void) TALER_project_data_default ();
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
GNUNET_log_setup ("taler-auditor-aggregation",
|
||||
GNUNET_log_setup ("taler-helper-auditor-aggregation",
|
||||
"MESSAGE",
|
||||
NULL));
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_PROGRAM_run (argc,
|
||||
argv,
|
||||
"taler-auditor-aggregation",
|
||||
"taler-helper-auditor-aggregation",
|
||||
"Audit Taler exchange aggregation activity",
|
||||
options,
|
||||
&run,
|
||||
@ -1549,4 +1545,4 @@ main (int argc,
|
||||
}
|
||||
|
||||
|
||||
/* end of taler-auditor-aggregation.c */
|
||||
/* end of taler-helper-auditor-aggregation.c */
|
||||
|
@ -185,8 +185,8 @@ static struct TALER_Amount total_refresh_hanging;
|
||||
* @param loss actual losses already (actualized before denomination was revoked)
|
||||
*/
|
||||
static void
|
||||
report_emergency_by_amount (const struct
|
||||
TALER_DenominationKeyValidityPS *issue,
|
||||
report_emergency_by_amount (
|
||||
const struct TALER_DenominationKeyValidityPS *issue,
|
||||
const struct TALER_Amount *risk,
|
||||
const struct TALER_Amount *loss)
|
||||
{
|
||||
@ -232,8 +232,8 @@ report_emergency_by_amount (const struct
|
||||
* @param risk amount that is at risk
|
||||
*/
|
||||
static void
|
||||
report_emergency_by_count (const struct
|
||||
TALER_DenominationKeyValidityPS *issue,
|
||||
report_emergency_by_count (
|
||||
const struct TALER_DenominationKeyValidityPS *issue,
|
||||
uint64_t num_issued,
|
||||
uint64_t num_known,
|
||||
const struct TALER_Amount *risk)
|
||||
@ -288,12 +288,11 @@ report_emergency_by_count (const struct
|
||||
* profitable for the exchange, and 0 if it is unclear
|
||||
*/
|
||||
static void
|
||||
report_amount_arithmetic_inconsistency (const char *operation,
|
||||
report_amount_arithmetic_inconsistency (
|
||||
const char *operation,
|
||||
uint64_t rowid,
|
||||
const struct
|
||||
TALER_Amount *exchange,
|
||||
const struct
|
||||
TALER_Amount *auditor,
|
||||
const struct TALER_Amount *exchange,
|
||||
const struct TALER_Amount *auditor,
|
||||
int profitable)
|
||||
{
|
||||
struct TALER_Amount delta;
|
||||
@ -1427,6 +1426,9 @@ deposit_cb (void *cls,
|
||||
dr.deposit_fee = issue->fee_deposit;
|
||||
dr.merchant = *merchant_pub;
|
||||
dr.coin_pub = *coin_pub;
|
||||
/* NOTE: This is one of the operations we might eventually
|
||||
want to do in parallel in the background to improve
|
||||
auditor performance! */
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_DEPOSIT,
|
||||
&dr.purpose,
|
||||
@ -2032,10 +2034,8 @@ analyze_coins (void *cls)
|
||||
(qs = TALER_ARL_edb->select_recoup_refresh_above_serial_id (
|
||||
TALER_ARL_edb->cls,
|
||||
TALER_ARL_esession,
|
||||
ppc.
|
||||
last_recoup_refresh_serial_id,
|
||||
&
|
||||
recoup_refresh_cb,
|
||||
ppc.last_recoup_refresh_serial_id,
|
||||
&recoup_refresh_cb,
|
||||
&cc)))
|
||||
{
|
||||
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
||||
@ -2342,10 +2342,6 @@ main (int argc,
|
||||
"KEY",
|
||||
"public key of the exchange (Crockford base32 encoded)",
|
||||
&TALER_ARL_master_pub),
|
||||
GNUNET_GETOPT_option_flag ('r',
|
||||
"TALER_ARL_restart",
|
||||
"TALER_ARL_restart audit from the beginning (required on first run)",
|
||||
&TALER_ARL_restart),
|
||||
GNUNET_GETOPT_option_timetravel ('T',
|
||||
"timetravel"),
|
||||
GNUNET_GETOPT_OPTION_END
|
||||
@ -2356,14 +2352,14 @@ main (int argc,
|
||||
away and skip #TALER_OS_init(), which we do need */
|
||||
(void) TALER_project_data_default ();
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
GNUNET_log_setup ("taler-auditor",
|
||||
GNUNET_log_setup ("taler-helper-auditor-coins",
|
||||
"MESSAGE",
|
||||
NULL));
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_PROGRAM_run (argc,
|
||||
argv,
|
||||
"taler-auditor",
|
||||
"Audit Taler exchange database",
|
||||
"taler-helper-auditor-coins",
|
||||
"Audit Taler coin processing",
|
||||
options,
|
||||
&run,
|
||||
NULL))
|
||||
|
@ -342,10 +342,6 @@ main (int argc,
|
||||
"KEY",
|
||||
"public key of the exchange (Crockford base32 encoded)",
|
||||
&TALER_ARL_master_pub),
|
||||
GNUNET_GETOPT_option_flag ('r',
|
||||
"TALER_ARL_restart",
|
||||
"TALER_ARL_restart audit from the beginning (required on first run)",
|
||||
&TALER_ARL_restart),
|
||||
GNUNET_GETOPT_option_timetravel ('T',
|
||||
"timetravel"),
|
||||
GNUNET_GETOPT_OPTION_END
|
||||
@ -356,13 +352,13 @@ main (int argc,
|
||||
away and skip #TALER_OS_init(), which we do need */
|
||||
(void) TALER_project_data_default ();
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
GNUNET_log_setup ("taler-auditor-deposits",
|
||||
GNUNET_log_setup ("taler-helper-auditor-deposits",
|
||||
"MESSAGE",
|
||||
NULL));
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_PROGRAM_run (argc,
|
||||
argv,
|
||||
"taler-auditor-deposits",
|
||||
"taler-helper-auditor-deposits",
|
||||
"Audit Taler exchange database for deposit confirmation consistency",
|
||||
options,
|
||||
&run,
|
||||
@ -372,4 +368,4 @@ main (int argc,
|
||||
}
|
||||
|
||||
|
||||
/* end of taler-auditor-deposits.c */
|
||||
/* end of taler-helper-auditor-deposits.c */
|
||||
|
@ -45,8 +45,6 @@ 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,
|
||||
@ -55,4 +53,4 @@ jinjaEnv = jinja2.Environment(loader=StdinLoader(),
|
||||
autoescape=False)
|
||||
tmpl = jinjaEnv.get_template('stdin');
|
||||
|
||||
print(tmpl.render(data = jsonData1, wire = jsonData2, aggregation = jsonData3, coins = jsonData4, deposits = jsonData5, reserves = jsonData6))
|
||||
print(tmpl.render(aggregation = jsonData1, coins = jsonData2, deposits = jsonData3, reserves = jsonData4, wire = jsonData5))
|
@ -529,7 +529,7 @@ handle_reserve_out (void *cls,
|
||||
/* check that execution date is within withdraw range for denom_pub */
|
||||
valid_start = GNUNET_TIME_absolute_ntoh (issue->start);
|
||||
expire_withdraw = GNUNET_TIME_absolute_ntoh (issue->expire_withdraw);
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
||||
"Checking withdraw timing: %llu, expire: %llu, timing: %llu\n",
|
||||
(unsigned long long) valid_start.abs_value_us,
|
||||
(unsigned long long) expire_withdraw.abs_value_us,
|
||||
@ -1641,10 +1641,6 @@ main (int argc,
|
||||
"KEY",
|
||||
"public key of the exchange (Crockford base32 encoded)",
|
||||
&TALER_ARL_master_pub),
|
||||
GNUNET_GETOPT_option_flag ('r',
|
||||
"TALER_ARL_restart",
|
||||
"TALER_ARL_restart audit from the beginning (required on first run)",
|
||||
&TALER_ARL_restart),
|
||||
GNUNET_GETOPT_option_timetravel ('T',
|
||||
"timetravel"),
|
||||
GNUNET_GETOPT_OPTION_END
|
||||
@ -1655,13 +1651,13 @@ main (int argc,
|
||||
away and skip #TALER_OS_init(), which we do need */
|
||||
(void) TALER_project_data_default ();
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
GNUNET_log_setup ("taler-auditor-reserves",
|
||||
GNUNET_log_setup ("taler-helper-auditor-reserves",
|
||||
"MESSAGE",
|
||||
NULL));
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_PROGRAM_run (argc,
|
||||
argv,
|
||||
"taler-auditor-reserves",
|
||||
"taler-helper-auditor-reserves",
|
||||
"Audit Taler exchange reserve handling",
|
||||
options,
|
||||
&run,
|
||||
|
@ -451,17 +451,6 @@ do_shutdown (void *cls)
|
||||
struct WireAccount *wa;
|
||||
|
||||
(void) cls;
|
||||
if (NULL != ctx)
|
||||
{
|
||||
GNUNET_CURL_fini (ctx);
|
||||
ctx = NULL;
|
||||
}
|
||||
if (NULL != rc)
|
||||
{
|
||||
GNUNET_CURL_gnunet_rc_destroy (rc);
|
||||
rc = NULL;
|
||||
}
|
||||
|
||||
if (NULL != report_row_inconsistencies)
|
||||
{
|
||||
json_t *report;
|
||||
@ -608,6 +597,16 @@ do_shutdown (void *cls)
|
||||
GNUNET_free (wa->section_name);
|
||||
GNUNET_free (wa);
|
||||
}
|
||||
if (NULL != ctx)
|
||||
{
|
||||
GNUNET_CURL_fini (ctx);
|
||||
ctx = NULL;
|
||||
}
|
||||
if (NULL != rc)
|
||||
{
|
||||
GNUNET_CURL_gnunet_rc_destroy (rc);
|
||||
rc = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -874,7 +873,7 @@ wire_missing_cb (void *cls,
|
||||
* (based on deposits) have indeed happened.
|
||||
*/
|
||||
static void
|
||||
check_for_required_transfers ()
|
||||
check_for_required_transfers (void)
|
||||
{
|
||||
struct GNUNET_TIME_Absolute next_timestamp;
|
||||
enum GNUNET_DB_QueryStatus qs;
|
||||
@ -1932,11 +1931,24 @@ reserve_closed_cb (void *cls,
|
||||
* @return transaction status code
|
||||
*/
|
||||
static enum GNUNET_DB_QueryStatus
|
||||
begin_transaction (void *cls)
|
||||
begin_transaction (void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
(void) cls;
|
||||
TALER_ARL_esession = TALER_ARL_edb->get_session (TALER_ARL_edb->cls);
|
||||
if (NULL == TALER_ARL_esession)
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Failed to initialize exchange session.\n");
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
TALER_ARL_asession = TALER_ARL_adb->get_session (TALER_ARL_adb->cls);
|
||||
if (NULL == TALER_ARL_asession)
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Failed to initialize auditor session.\n");
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
ret = TALER_ARL_adb->start (TALER_ARL_adb->cls,
|
||||
TALER_ARL_asession);
|
||||
if (GNUNET_OK != ret)
|
||||
@ -1987,14 +1999,13 @@ begin_transaction (void *cls)
|
||||
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qsx_gwap)
|
||||
{
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
|
||||
_ (
|
||||
"First analysis using this auditor, starting audit from scratch\n"));
|
||||
"First analysis of with wire auditor, starting audit from scratch\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
start_pp = pp;
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||
"Resuming audit at %s / %llu\n",
|
||||
"Resuming wire audit at %s / %llu\n",
|
||||
GNUNET_STRINGS_absolute_time_to_string (pp.last_timestamp),
|
||||
(unsigned long long) pp.last_reserve_close_uuid);
|
||||
}
|
||||
@ -2168,9 +2179,8 @@ run (void *cls,
|
||||
TALER_EXCHANGEDB_find_accounts (TALER_ARL_cfg,
|
||||
&process_account_cb,
|
||||
NULL);
|
||||
if (GNUNET_OK !=
|
||||
TALER_ARL_setup_sessions_and_run (&begin_transaction,
|
||||
NULL))
|
||||
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
|
||||
begin_transaction ())
|
||||
{
|
||||
global_ret = 1;
|
||||
GNUNET_SCHEDULER_shutdown ();
|
||||
@ -2179,8 +2189,9 @@ run (void *cls,
|
||||
|
||||
|
||||
/**
|
||||
* The main function of the database initialization tool.
|
||||
* Used to initialize the Taler Exchange's database.
|
||||
* The main function of the wire auditing tool. Checks that
|
||||
* the exchange's records of wire transfers match that of
|
||||
* the wire gateway.
|
||||
*
|
||||
* @param argc number of arguments from the command line
|
||||
* @param argv command line arguments
|
||||
@ -2196,10 +2207,6 @@ main (int argc,
|
||||
"KEY",
|
||||
"public key of the exchange (Crockford base32 encoded)",
|
||||
&TALER_ARL_master_pub),
|
||||
GNUNET_GETOPT_option_flag ('r',
|
||||
"TALER_ARL_restart",
|
||||
"TALER_ARL_restart audit from the beginning (required on first run)",
|
||||
&TALER_ARL_restart),
|
||||
GNUNET_GETOPT_option_timetravel ('T',
|
||||
"timetravel"),
|
||||
GNUNET_GETOPT_OPTION_END
|
||||
@ -2210,13 +2217,13 @@ main (int argc,
|
||||
away and skip #TALER_OS_init(), which we do need */
|
||||
(void) TALER_project_data_default ();
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
GNUNET_log_setup ("taler-wire-auditor",
|
||||
GNUNET_log_setup ("taler-helper-auditor-wire",
|
||||
"MESSAGE",
|
||||
NULL));
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_PROGRAM_run (argc,
|
||||
argv,
|
||||
"taler-wire-auditor",
|
||||
"taler-helper-auditor-wire",
|
||||
"Audit exchange database for consistency with the bank's wire transfers",
|
||||
options,
|
||||
&run,
|
||||
|
@ -80,30 +80,25 @@ 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-aggregation -L DEBUG -r -c $CONF -m $MASTER_PUB > test-audit-aggregation.json 2> test-audit-aggregation.log || exit_fail "aggregation audit failed"
|
||||
# Restart so that first run is always fresh, and second one is incremental
|
||||
taler-auditor-dbinit -r -c $CONF
|
||||
$VALGRIND taler-helper-auditor-aggregation -L DEBUG -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"
|
||||
$VALGRIND taler-helper-auditor-coins -L DEBUG -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"
|
||||
$VALGRIND taler-helper-auditor-deposits -L DEBUG -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-reserves -L DEBUG -r -c $CONF -m $MASTER_PUB > test-audit-reserves.json 2> test-audit-reserves.log || exit_fail "reserves audit failed"
|
||||
$VALGRIND taler-helper-auditor-reserves -L DEBUG -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"
|
||||
$VALGRIND taler-helper-auditor-wire -L DEBUG -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 "."
|
||||
@ -119,7 +114,7 @@ function post_audit () {
|
||||
wait
|
||||
echo "DONE"
|
||||
echo -n "TeXing ."
|
||||
../../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"
|
||||
taler-helper-auditor-render.py test-audit-aggregation.json test-audit-coins.json test-audit-deposits.json test-audit-reserves.json test-audit-wire.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"
|
||||
|
@ -152,7 +152,6 @@ handle_credit_history_finished (void *cls,
|
||||
switch (response_code)
|
||||
{
|
||||
case 0:
|
||||
GNUNET_break_op (0);
|
||||
ec = TALER_EC_INVALID_RESPONSE;
|
||||
break;
|
||||
case MHD_HTTP_OK:
|
||||
|
@ -7,6 +7,9 @@ TALER_TEST_HOME = test_taler_exchange_httpd_home/
|
||||
CURRENCY = EUR
|
||||
CURRENCY_ROUND_UNIT = EUR:0.01
|
||||
|
||||
[auditor]
|
||||
TINY_AMOUNT = EUR:0.01
|
||||
|
||||
[exchange]
|
||||
|
||||
# Directory with our terms of service.
|
||||
@ -65,7 +68,10 @@ PAYTO_URI = "payto://x-taler-bank/localhost:8082/3"
|
||||
WIRE_RESPONSE = ${TALER_CONFIG_HOME}/account-1.json
|
||||
ENABLE_DEBIT = YES
|
||||
ENABLE_CREDIT = YES
|
||||
TALER_BANK_AUTH_METHOD = NONE
|
||||
WIRE_GATEWAY_AUTH_METHOD = basic
|
||||
USERNAME = Exchange
|
||||
PASSWORD = x
|
||||
WIRE_GATEWAY_URL = "http://localhost:8082/3/"
|
||||
|
||||
|
||||
# Wire fees are specified by wire method
|
||||
|
Loading…
Reference in New Issue
Block a user