gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: improve reporting, also use audi


From: gnunet
Subject: [taler-exchange] branch master updated: improve reporting, also use auditor fee calculation when computing reserve balance updates in case of disagreement on coin value/fee
Date: Fri, 28 Aug 2020 20:02:11 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 581a39b5 improve reporting, also use auditor fee calculation when 
computing reserve balance updates in case of disagreement on coin value/fee
581a39b5 is described below

commit 581a39b5b5037d4e0419d8ce5448371a52499d80
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Aug 28 20:02:08 2020 +0200

    improve reporting, also use auditor fee calculation when computing reserve 
balance updates in case of disagreement on coin value/fee
---
 src/auditor/generate-auditor-basedb.sh      |  8 +++++++-
 src/auditor/generate-revoke-basedb.sh       |  2 +-
 src/auditor/taler-helper-auditor-reserves.c | 27 ++++++++++++++++++++++-----
 src/auditor/taler-helper-auditor-wire.c     |  6 ++++--
 src/auditor/test-auditor.sh                 |  4 ++--
 5 files changed, 36 insertions(+), 11 deletions(-)

diff --git a/src/auditor/generate-auditor-basedb.sh 
b/src/auditor/generate-auditor-basedb.sh
index 1e5ea5c1..257b42eb 100755
--- a/src/auditor/generate-auditor-basedb.sh
+++ b/src/auditor/generate-auditor-basedb.sh
@@ -45,6 +45,10 @@ TARGET_DB=taler-auditor-basedb
 
 WALLET_DB=${BASEDB:-"wallet"}.wdb
 
+# delete existing wallet database
+rm -f $WALLET_DB
+
+
 # Configuration file will be edited, so we create one
 # from the template.
 CONF=generate-auditor-basedb-prod.conf
@@ -69,6 +73,7 @@ rm -rf $DATA_DIR || true
 dropdb $TARGET_DB >/dev/null 2>/dev/null || true
 createdb $TARGET_DB || exit_skip "Could not create database $TARGET_DB"
 
+
 # obtain key configuration data
 MASTER_PRIV_FILE=`taler-config -f -c $CONF -s EXCHANGE -o MASTER_PRIV_FILE`
 MASTER_PRIV_DIR=`dirname $MASTER_PRIV_FILE`
@@ -141,7 +146,7 @@ fi
 
 # Setup merchant
 
-curl -H "Content-Type: application/json" -X POST -d 
'{"payto_uris":["payto://x-taler-bank/localhost:8082/43"],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1",
 
"default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_ms"
 : 3600000},"default_pay_delay":{"d_ms": 3600000}}' 
http://localhost:9966/private/instances
+curl -H "Content-Type: application/json" -X POST -d 
'{"payto_uris":["payto://x-taler-bank/localhost/43"],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1",
 
"default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_ms"
 : 3600000},"default_pay_delay":{"d_ms": 3600000}}' 
http://localhost:9966/private/instances
 
 
 echo " DONE"
@@ -149,6 +154,7 @@ echo " DONE"
 # run wallet CLI
 echo "Running wallet"
 
+
 taler-wallet-cli --no-throttle --wallet-db=$WALLET_DB api 'runIntegrationTest' 
\
   "$(jq -n '
     {
diff --git a/src/auditor/generate-revoke-basedb.sh 
b/src/auditor/generate-revoke-basedb.sh
index 71af4fde..6be1ddaf 100755
--- a/src/auditor/generate-revoke-basedb.sh
+++ b/src/auditor/generate-revoke-basedb.sh
@@ -148,7 +148,7 @@ echo " DONE"
 
 # Setup merchant
 
-curl -H "Content-Type: application/json" -X POST -d 
'{"payto_uris":["payto://x-taler-bank/localhost:8082/43"],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1",
 
"default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_ms"
 : 3600000},"default_pay_delay":{"d_ms": 3600000}}' 
http://localhost:9966/private/instances
+curl -H "Content-Type: application/json" -X POST -d 
'{"payto_uris":["payto://x-taler-bank/localhost/43"],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1",
 
"default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_ms"
 : 3600000},"default_pay_delay":{"d_ms": 3600000}}' 
http://localhost:9966/private/instances
 
 
 # run wallet CLI
diff --git a/src/auditor/taler-helper-auditor-reserves.c 
b/src/auditor/taler-helper-auditor-reserves.c
index d596863e..d666aae8 100644
--- a/src/auditor/taler-helper-auditor-reserves.c
+++ b/src/auditor/taler-helper-auditor-reserves.c
@@ -491,6 +491,8 @@ handle_reserve_out (void *cls,
   struct ReserveSummary *rs;
   const struct TALER_DenominationKeyValidityPS *issue;
   struct TALER_Amount withdraw_fee;
+  struct TALER_Amount auditor_value;
+  struct TALER_Amount auditor_amount_with_fee;
   struct GNUNET_TIME_Absolute valid_start;
   struct GNUNET_TIME_Absolute expire_withdraw;
   enum GNUNET_DB_QueryStatus qs;
@@ -578,6 +580,23 @@ handle_reserve_out (void *cls,
     return GNUNET_OK;   /* exit function here, we cannot add this to the 
legitimate withdrawals */
   }
 
+  TALER_amount_ntoh (&withdraw_fee,
+                     &issue->fee_withdraw);
+  TALER_amount_ntoh (&auditor_value,
+                     &issue->value);
+  TALER_ARL_amount_add (&auditor_amount_with_fee,
+                        &auditor_value,
+                        &withdraw_fee);
+  if (0 !=
+      TALER_amount_cmp (&auditor_amount_with_fee,
+                        amount_with_fee))
+  {
+    report_row_inconsistency ("withdraw",
+                              rowid,
+                              "amount with fee from exchange does not match 
denomination value plus fee");
+  }
+
+
   GNUNET_CRYPTO_hash (reserve_pub,
                       sizeof (*reserve_pub),
                       &key);
@@ -587,7 +606,7 @@ handle_reserve_out (void *cls,
   {
     rs = GNUNET_new (struct ReserveSummary);
     rs->reserve_pub = *reserve_pub;
-    rs->total_out = *amount_with_fee;
+    rs->total_out = auditor_amount_with_fee;
     GNUNET_assert (GNUNET_OK ==
                    TALER_amount_get_zero (amount_with_fee->currency,
                                           &rs->total_in));
@@ -612,14 +631,12 @@ handle_reserve_out (void *cls,
   {
     TALER_ARL_amount_add (&rs->total_out,
                           &rs->total_out,
-                          amount_with_fee);
+                          &auditor_amount_with_fee);
   }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Reserve `%s' reduced by %s from withdraw\n",
               TALER_B2S (reserve_pub),
-              TALER_amount2s (amount_with_fee));
-  TALER_amount_ntoh (&withdraw_fee,
-                     &issue->fee_withdraw);
+              TALER_amount2s (&auditor_amount_with_fee));
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Increasing withdraw profits by fee %s\n",
               TALER_amount2s (&withdraw_fee));
diff --git a/src/auditor/taler-helper-auditor-wire.c 
b/src/auditor/taler-helper-auditor-wire.c
index 5e5d1674..1facd215 100644
--- a/src/auditor/taler-helper-auditor-wire.c
+++ b/src/auditor/taler-helper-auditor-wire.c
@@ -1017,7 +1017,7 @@ wire_out_cb (void *cls,
          we should count the wire transfer as entirely spurious, and
          additionally consider the justified wire transfer as missing. */
       TALER_ARL_report (report_wire_out_inconsistencies,
-                        json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s}",
+                        json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s, s:s}",
                                    "row", (json_int_t) rowid,
                                    "amount_wired", TALER_JSON_from_amount (
                                      &roi->details.amount),
@@ -1027,12 +1027,13 @@ wire_out_cb (void *cls,
                                    "timestamp", TALER_ARL_json_from_time_abs (
                                      date),
                                    "diagnostic", "receiver account mismatch",
+                                   "target", payto_uri,
                                    "account_section", wa->section_name));
       TALER_ARL_amount_add (&total_bad_amount_out_plus,
                             &total_bad_amount_out_plus,
                             &roi->details.amount);
       TALER_ARL_report (report_wire_out_inconsistencies,
-                        json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s}",
+                        json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s, s:s}",
                                    "row", (json_int_t) rowid,
                                    "amount_wired", TALER_JSON_from_amount (
                                      &zero),
@@ -1042,6 +1043,7 @@ wire_out_cb (void *cls,
                                    "timestamp", TALER_ARL_json_from_time_abs (
                                      date),
                                    "diagnostic", "receiver account mismatch",
+                                   "target", roi->details.credit_account_url,
                                    "account_section", wa->section_name));
       TALER_ARL_amount_add (&total_bad_amount_out_minus,
                             &total_bad_amount_out_minus,
diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh
index 4326fda4..62c4c664 100755
--- a/src/auditor/test-auditor.sh
+++ b/src/auditor/test-auditor.sh
@@ -1655,7 +1655,7 @@ echo "UPDATE auditor_denominations SET 
fee_withdraw_frac=5000000 WHERE coin_val=
 run_audit
 
 echo -n "Testing inconsistency detection... "
-AMOUNT=`jq -r .total_balance_summary_delta_plus < test-audit-reserves.json`
+AMOUNT=`jq -r .total_balance_summary_delta_minus < test-audit-reserves.json`
 if test "x$AMOUNT" == "xTESTKUDOS:0"
 then
     exit_fail "Reported total amount wrong: $AMOUNT"
@@ -1826,7 +1826,7 @@ check_with_database()
         fi
     done
     echo "Cleanup (disabled, leaving database $DB behind)"
-    dropdb $DB
+    # dropdb $DB
     rm -r $WIRE_FEE_DIR
 }
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]