[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated (9d5a3ef6 -> 421e802f)
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated (9d5a3ef6 -> 421e802f) |
Date: |
Thu, 07 Jan 2021 22:24:22 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a change to branch master
in repository exchange.
from 9d5a3ef6 only check tiny/done in internal mode
new 6ccda0b0 make reserve balance check used in internal_auditor mode only
new 421e802f fix test issues with new DB schema
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
contrib/auditor-report.tex.j2 | 6 +-
src/auditor/taler-helper-auditor-reserves.c | 129 +++++++++++++++-------------
src/auditor/test-auditor.sh | 26 +++---
src/auditor/test-revocation.sh | 8 +-
src/exchange/taler-exchange-closer.c | 2 +-
5 files changed, 91 insertions(+), 80 deletions(-)
diff --git a/contrib/auditor-report.tex.j2 b/contrib/auditor-report.tex.j2
index c2d406eb..38f44d4e 100644
--- a/contrib/auditor-report.tex.j2
+++ b/contrib/auditor-report.tex.j2
@@ -227,7 +227,11 @@ the tiny threshold. Below, we report {\em non-tiny} wire
transfers that are lagg
{{ item.deadline }} &
{{ item.amount }} &
{{ item.row }} &
- {{ item.claimed_done }} \\
+{% if 'claimed_done' in item %}
+ {{ item.claimed_done }}
+{% else %}
+ N/A
+{% endif %} \\
\nopagebreak
\multicolumn{4}{l}{ {\tt \small {{ item.coin_pub }} } } \\
\nopagebreak
diff --git a/src/auditor/taler-helper-auditor-reserves.c
b/src/auditor/taler-helper-auditor-reserves.c
index 8e53214f..87b555e0 100644
--- a/src/auditor/taler-helper-auditor-reserves.c
+++ b/src/auditor/taler-helper-auditor-reserves.c
@@ -1026,7 +1026,6 @@ verify_reserve_balance (void *cls,
{
struct ReserveContext *rc = cls;
struct ReserveSummary *rs = value;
- struct TALER_EXCHANGEDB_Reserve reserve;
struct TALER_Amount balance;
struct TALER_Amount nbalance;
enum GNUNET_DB_QueryStatus qs;
@@ -1063,73 +1062,81 @@ verify_reserve_balance (void *cls,
&nbalance));
}
- /* Now check OUR balance calculation vs. the one the exchange has
- in its database */
- reserve.pub = rs->reserve_pub;
- qs = TALER_ARL_edb->reserves_get (TALER_ARL_edb->cls,
- TALER_ARL_esession,
- &reserve);
- if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
+ if (internal_checks)
{
- /* If the exchange doesn't have this reserve in the summary, it
- is like the exchange 'lost' that amount from its records,
- making an illegitimate gain over the amount it dropped.
- We don't add the amount to some total simply because it is
- not an actualized gain and could be trivially corrected by
- restoring the summary. *///
- TALER_ARL_report (report_reserve_balance_insufficient_inconsistencies,
- json_pack ("{s:o, s:o}",
- "reserve_pub",
- GNUNET_JSON_from_data_auto (&rs->reserve_pub),
- "gain",
- TALER_JSON_from_amount (&nbalance)));
- if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
- {
- GNUNET_break (0);
- qs = GNUNET_DB_STATUS_HARD_ERROR;
- }
- rc->qs = qs;
- }
- else
- {
- /* Check that exchange's balance matches our expected balance for the
reserve */
- if (0 != TALER_amount_cmp (&nbalance,
- &reserve.balance))
+ /* Now check OUR balance calculation vs. the one the exchange has
+ in its database. This can only be done when we are doing an
+ internal audit, as otherwise the balance of the 'reserves' table
+ is not replicated at the auditor. */
+ struct TALER_EXCHANGEDB_Reserve reserve;
+
+ reserve.pub = rs->reserve_pub;
+ qs = TALER_ARL_edb->reserves_get (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ &reserve);
+ if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
- struct TALER_Amount delta;
-
- if (0 < TALER_amount_cmp (&nbalance,
- &reserve.balance))
- {
- /* balance > reserve.balance */
- TALER_ARL_amount_subtract (&delta,
- &nbalance,
- &reserve.balance);
- TALER_ARL_amount_add (&total_balance_summary_delta_plus,
- &total_balance_summary_delta_plus,
- &delta);
- }
- else
- {
- /* balance < reserve.balance */
- TALER_ARL_amount_subtract (&delta,
- &reserve.balance,
- &nbalance);
- TALER_ARL_amount_add (&total_balance_summary_delta_minus,
- &total_balance_summary_delta_minus,
- &delta);
- }
- TALER_ARL_report (report_reserve_balance_summary_wrong_inconsistencies,
- json_pack ("{s:o, s:o, s:o}",
+ /* If the exchange doesn't have this reserve in the summary, it
+ is like the exchange 'lost' that amount from its records,
+ making an illegitimate gain over the amount it dropped.
+ We don't add the amount to some total simply because it is
+ not an actualized gain and could be trivially corrected by
+ restoring the summary. *///
+ TALER_ARL_report (report_reserve_balance_insufficient_inconsistencies,
+ json_pack ("{s:o, s:o}",
"reserve_pub",
GNUNET_JSON_from_data_auto (
&rs->reserve_pub),
- "exchange",
- TALER_JSON_from_amount (&reserve.balance),
- "auditor",
+ "gain",
TALER_JSON_from_amount (&nbalance)));
+ if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
+ {
+ GNUNET_break (0);
+ qs = GNUNET_DB_STATUS_HARD_ERROR;
+ }
+ rc->qs = qs;
}
- }
+ else
+ {
+ /* Check that exchange's balance matches our expected balance for the
reserve */
+ if (0 != TALER_amount_cmp (&nbalance,
+ &reserve.balance))
+ {
+ struct TALER_Amount delta;
+
+ if (0 < TALER_amount_cmp (&nbalance,
+ &reserve.balance))
+ {
+ /* balance > reserve.balance */
+ TALER_ARL_amount_subtract (&delta,
+ &nbalance,
+ &reserve.balance);
+ TALER_ARL_amount_add (&total_balance_summary_delta_plus,
+ &total_balance_summary_delta_plus,
+ &delta);
+ }
+ else
+ {
+ /* balance < reserve.balance */
+ TALER_ARL_amount_subtract (&delta,
+ &reserve.balance,
+ &nbalance);
+ TALER_ARL_amount_add (&total_balance_summary_delta_minus,
+ &total_balance_summary_delta_minus,
+ &delta);
+ }
+ TALER_ARL_report (report_reserve_balance_summary_wrong_inconsistencies,
+ json_pack ("{s:o, s:o, s:o}",
+ "reserve_pub",
+ GNUNET_JSON_from_data_auto (
+ &rs->reserve_pub),
+ "exchange",
+ TALER_JSON_from_amount (&reserve.balance),
+ "auditor",
+ TALER_JSON_from_amount (&nbalance)));
+ }
+ }
+ } /* end of 'if (internal_checks)' */
/* Check that reserve is being closed if it is past its expiration date
(and the closing fee would not exceed the remaining balance) */
diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh
index 0c9ef472..08e13f98 100755
--- a/src/auditor/test-auditor.sh
+++ b/src/auditor/test-auditor.sh
@@ -104,13 +104,13 @@ function audit_only () {
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 -c $CONF -m $MASTER_PUB >
test-audit-reserves.json 2> test-audit-reserves.log || exit_fail "reserves
audit failed"
+ $VALGRIND taler-helper-auditor-reserves -i -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"
+ $VALGRIND taler-helper-auditor-reserves -i -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 -c $CONF -m $MASTER_PUB >
test-audit-wire.json 2> test-wire-audit.log || exit_fail "wire audit failed"
+ $VALGRIND taler-helper-auditor-wire -i -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"
+ $VALGRIND taler-helper-auditor-wire -i -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"
@@ -1177,14 +1177,14 @@ then
OLD_TIME=`echo "SELECT execution_date FROM reserves_in WHERE
reserve_in_serial_id=1;" | psql $DB -Aqt`
OLD_VAL=`echo "SELECT credit_val FROM reserves_in WHERE
reserve_in_serial_id=1;" | psql $DB -Aqt`
- RES_PUB=`echo "SELECT reserve_pub FROM reserves_in WHERE
reserve_in_serial_id=1;" | psql $DB -Aqt`
- OLD_EXP=`echo "SELECT expiration_date FROM reserves WHERE
reserve_pub='${RES_PUB}';" | psql $DB -Aqt`
+ RES_UUID=`echo "SELECT reserve_uuid FROM reserves_in WHERE
reserve_in_serial_id=1;" | psql $DB -Aqt`
+ OLD_EXP=`echo "SELECT expiration_date FROM reserves WHERE
reserve_uuid='${RES_UUID}';" | psql $DB -Aqt`
VAL_DELTA=1
NEW_TIME=`expr $OLD_TIME - 3024000000000 || true` # 5 weeks
NEW_EXP=`expr $OLD_EXP - 3024000000000 || true` # 5 weeks
NEW_CREDIT=`expr $OLD_VAL + $VAL_DELTA || true`
echo "UPDATE reserves_in SET
execution_date='${NEW_TIME}',credit_val=${NEW_CREDIT} WHERE
reserve_in_serial_id=1;" | psql -Aqt $DB
- echo "UPDATE reserves SET
current_balance_val=${VAL_DELTA}+current_balance_val,expiration_date='${NEW_EXP}'
WHERE reserve_pub='${RES_PUB}';" | psql -Aqt $DB
+ echo "UPDATE reserves SET
current_balance_val=${VAL_DELTA}+current_balance_val,expiration_date='${NEW_EXP}'
WHERE reserve_uuid='${RES_UUID}';" | psql -Aqt $DB
# Need to run with the aggregator so the reserve closure happens
run_audit aggregator
@@ -1215,11 +1215,11 @@ echo "===========20: reserve closure missing
================="
OLD_TIME=`echo "SELECT execution_date FROM reserves_in WHERE
reserve_in_serial_id=1;" | psql $DB -Aqt`
OLD_VAL=`echo "SELECT credit_val FROM reserves_in WHERE
reserve_in_serial_id=1;" | psql $DB -Aqt`
-RES_PUB=`echo "SELECT reserve_pub FROM reserves_in WHERE
reserve_in_serial_id=1;" | psql $DB -Aqt`
+RES_UUID=`echo "SELECT reserve_uuid FROM reserves_in WHERE
reserve_in_serial_id=1;" | psql $DB -Aqt`
NEW_TIME=`expr $OLD_TIME - 3024000000000 || true` # 5 weeks
NEW_CREDIT=`expr $OLD_VAL + 100 || true`
echo "UPDATE reserves_in SET
execution_date='${NEW_TIME}',credit_val=${NEW_CREDIT} WHERE
reserve_in_serial_id=1;" | psql -Aqt $DB
-echo "UPDATE reserves SET current_balance_val=100+current_balance_val WHERE
reserve_pub='${RES_PUB}';" | psql -Aqt $DB
+echo "UPDATE reserves SET current_balance_val=100+current_balance_val WHERE
reserve_uuid='${RES_UUID}';" | psql -Aqt $DB
# This time, run without the aggregator so the reserve closure is skipped!
run_audit
@@ -1236,7 +1236,7 @@ fi
# Undo
echo "UPDATE reserves_in SET
execution_date='${OLD_TIME}',credit_val=${OLD_VAL} WHERE
reserve_in_serial_id=1;" | psql -Aqt $DB
-echo "UPDATE reserves SET current_balance_val=current_balance_val-100 WHERE
reserve_pub='${RES_PUB}';" | psql -Aqt $DB
+echo "UPDATE reserves SET current_balance_val=current_balance_val-100 WHERE
reserve_uuid='${RES_UUID}';" | psql -Aqt $DB
}
@@ -1255,14 +1255,14 @@ then
OLD_TIME=`echo "SELECT execution_date FROM reserves_in WHERE
reserve_in_serial_id=1;" | psql $DB -Aqt`
OLD_VAL=`echo "SELECT credit_val FROM reserves_in WHERE
reserve_in_serial_id=1;" | psql $DB -Aqt`
- RES_PUB=`echo "SELECT reserve_pub FROM reserves_in WHERE
reserve_in_serial_id=1;" | psql $DB -Aqt`
- OLD_EXP=`echo "SELECT expiration_date FROM reserves WHERE
reserve_pub='${RES_PUB}';" | psql $DB -Aqt`
+ RES_UUID=`echo "SELECT reserve_uuid FROM reserves_in WHERE
reserve_in_serial_id=1;" | psql $DB -Aqt`
+ OLD_EXP=`echo "SELECT expiration_date FROM reserves WHERE
reserve_uuid='${RES_UUID}';" | psql $DB -Aqt`
VAL_DELTA=1
NEW_TIME=`expr $OLD_TIME - 3024000000000 || true` # 5 weeks
NEW_EXP=`expr $OLD_EXP - 3024000000000 || true` # 5 weeks
NEW_CREDIT=`expr $OLD_VAL + $VAL_DELTA || true`
echo "UPDATE reserves_in SET
execution_date='${NEW_TIME}',credit_val=${NEW_CREDIT} WHERE
reserve_in_serial_id=1;" | psql -Aqt $DB
- echo "UPDATE reserves SET
current_balance_val=${VAL_DELTA}+current_balance_val,expiration_date='${NEW_EXP}'
WHERE reserve_pub='${RES_PUB}';" | psql -Aqt $DB
+ echo "UPDATE reserves SET
current_balance_val=${VAL_DELTA}+current_balance_val,expiration_date='${NEW_EXP}'
WHERE reserve_uuid='${RES_UUID}';" | psql -Aqt $DB
# Need to first run the aggregator so the transfer is marked as done exists
pre_audit aggregator
diff --git a/src/auditor/test-revocation.sh b/src/auditor/test-revocation.sh
index d5874a8e..ad62b518 100755
--- a/src/auditor/test-revocation.sh
+++ b/src/auditor/test-revocation.sh
@@ -105,13 +105,13 @@ function audit_only () {
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 -c $CONF -m $MASTER_PUB >
test-audit-reserves.json 2> test-audit-reserves.log || exit_fail "reserves
audit failed"
+ $VALGRIND taler-helper-auditor-reserves -i -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"
+ $VALGRIND taler-helper-auditor-reserves -i -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 -c $CONF -m $MASTER_PUB >
test-audit-wire.json 2> test-wire-audit.log || exit_fail "wire audit failed"
+ $VALGRIND taler-helper-auditor-wire -i -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"
+ $VALGRIND taler-helper-auditor-wire -i -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"
diff --git a/src/exchange/taler-exchange-closer.c
b/src/exchange/taler-exchange-closer.c
index c32e933b..d797c545 100644
--- a/src/exchange/taler-exchange-closer.c
+++ b/src/exchange/taler-exchange-closer.c
@@ -475,7 +475,7 @@ run_reserve_closures (void *cls)
return;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "No more idle reserves, going back to aggregation\n");
+ "No more idle reserves to close, going to sleep.\n");
db_plugin->rollback (db_plugin->cls,
session);
GNUNET_assert (NULL == task);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-exchange] branch master updated (9d5a3ef6 -> 421e802f),
gnunet <=