gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated (7cf67b30 -> ddf95c49)


From: gnunet
Subject: [taler-exchange] branch master updated (7cf67b30 -> ddf95c49)
Date: Fri, 10 Jul 2020 22:33:09 +0200

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

grothoff pushed a change to branch master
in repository exchange.

    from 7cf67b30 this invariant does not actually hold, i.e. if there is a 
/recoup request for a coin we never saw
     new d01c6fd9 fix wrong fmt string
     new ddf95c49 remove unused/unusable coin_sig, return correct coin_pub in 
recoup-reveal failure context

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:
 src/exchange/taler-exchange-httpd_responses.c |  6 +--
 src/exchangedb/plugin_exchangedb_postgres.c   | 11 ++++
 src/include/taler_exchangedb_plugin.h         |  2 +-
 src/include/taler_signatures.h                |  2 +-
 src/lib/exchange_api_common.c                 | 12 +++--
 src/testing/test_exchange_api.c               | 77 +++++++++++++++++++--------
 6 files changed, 78 insertions(+), 32 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_responses.c 
b/src/exchange/taler-exchange-httpd_responses.c
index 328d52bd..4bcb9e7a 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -250,7 +250,7 @@ TEH_RESPONSE_compile_transaction_history (
             TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH),
           .purpose.size = htonl (sizeof (pc)),
           .timestamp = GNUNET_TIME_absolute_hton (pr->timestamp),
-          .coin_pub = *coin_pub,
+          .coin_pub = pr->coin.coin_pub,
           .old_coin_pub = pr->old_coin_pub
         };
 
@@ -273,7 +273,7 @@ TEH_RESPONSE_compile_transaction_history (
         if (0 !=
             json_array_append_new (
               history,
-              json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o}",
+              json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
                          "type",
                          "OLD-COIN-RECOUP",
                          "amount",
@@ -284,8 +284,6 @@ TEH_RESPONSE_compile_transaction_history (
                          GNUNET_JSON_from_data_auto (&epub),
                          "coin_pub",
                          GNUNET_JSON_from_data_auto (&pr->coin.coin_pub),
-                         "coin_sig",
-                         GNUNET_JSON_from_data_auto (&pr->coin_sig),
                          "timestamp",
                          GNUNET_JSON_from_time_abs (pr->timestamp))))
         {
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c 
b/src/exchangedb/plugin_exchangedb_postgres.c
index 8e45d671..7934639b 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -4553,6 +4553,11 @@ postgres_get_coin_transactions (
                                                params,
                                                work[i].cb,
                                                &chc);
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "Coin %s yielded %d transactions of type %s\n",
+                TALER_B2S (coin_pub),
+                qs,
+                work[i].statement);
     if ( (0 > qs) ||
          (chc.failed) )
     {
@@ -6913,6 +6918,9 @@ postgres_insert_recoup_request (
     GNUNET_break (0);
     return GNUNET_DB_STATUS_HARD_ERROR;
   }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Inserting recoup for coin %s\n",
+              TALER_B2S (&coin->coin_pub));
   expiry = GNUNET_TIME_absolute_add (timestamp,
                                      pg->legal_reserve_expiration_time);
   reserve.gc = GNUNET_TIME_absolute_max (expiry,
@@ -6976,6 +6984,9 @@ postgres_insert_recoup_refresh_request (
 
   (void) cls;
   /* now store actual recoup information */
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Inserting recoup-refresh for coin %s\n",
+              TALER_B2S (&coin->coin_pub));
   qs = GNUNET_PQ_eval_prepared_non_select (session->conn,
                                            "recoup_refresh_insert",
                                            params);
diff --git a/src/include/taler_exchangedb_plugin.h 
b/src/include/taler_exchangedb_plugin.h
index 8b4e63cd..f5e5dccc 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -373,7 +373,7 @@ struct TALER_EXCHANGEDB_RecoupRefreshListEntry
 
   /**
    * Blinding factor supplied to prove to the exchange that
-   * the coin came from this reserve.
+   * the coin came from this @e old_coin_pub.
    */
   struct TALER_DenominationBlindingKeyP coin_blind;
 
diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h
index 3e4b893f..4e24c519 100644
--- a/src/include/taler_signatures.h
+++ b/src/include/taler_signatures.h
@@ -1219,7 +1219,7 @@ struct TALER_RecoupRequestPS
   struct TALER_CoinSpendPublicKeyP coin_pub;
 
   /**
-   * Hash of the denomination public key of the coin.
+   * Hash of the (revoked) denomination public key of the coin.
    */
   struct GNUNET_HashCode h_denom_pub;
 
diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c
index feaef7b3..743adb0f 100644
--- a/src/lib/exchange_api_common.c
+++ b/src/lib/exchange_api_common.c
@@ -876,10 +876,11 @@ TALER_EXCHANGE_verify_coin_history (
       TALER_amount_hton (&pc.recoup_amount,
                          &amount);
       if (GNUNET_OK !=
-          GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP,
-                                      &pc,
-                                      &exchange_sig.eddsa_signature,
-                                      &exchange_pub.eddsa_pub))
+          GNUNET_CRYPTO_eddsa_verify (
+            TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH,
+            &pc,
+            &exchange_sig.eddsa_signature,
+            &exchange_pub.eddsa_pub))
       {
         GNUNET_break_op (0);
         return GNUNET_SYSERR;
@@ -890,6 +891,9 @@ TALER_EXCHANGE_verify_coin_history (
     {
       /* signature not supported, new version on server? */
       GNUNET_break_op (0);
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Unexpected type `%s' in response\n",
+                  type);
       GNUNET_assert (GNUNET_SYSERR == add);
       return GNUNET_SYSERR;
     }
diff --git a/src/testing/test_exchange_api.c b/src/testing/test_exchange_api.c
index b8ec3699..410c1a49 100644
--- a/src/testing/test_exchange_api.c
+++ b/src/testing/test_exchange_api.c
@@ -675,28 +675,61 @@ run (void *cls,
                               "recoup-reveal-coin-1b",
                               "recoup-melt-coin-1b",
                               "EUR:5"),
-#if 1
-    /* "over-spend" 10 EUR recoup-refreshed coin */
-    TALER_TESTING_cmd_deposit ("recoup-refresh-deposit-failing",
-                               "recoup-withdraw-coin-1b",
-                               0,
-                               bc.user42_payto,
-                               "{\"items\":[{\"name\":\"more ice 
cream\",\"value\":1}]}",
-                               GNUNET_TIME_UNIT_ZERO,
-                               "EUR:11.5",
-                               MHD_HTTP_OK),
-    // FIXME: yes, we expect 'CONFLICT', but the
-    // coin history we get is totally wrong!
-    /* "spend" 10 EUR recoup-refreshed coin */
-    TALER_TESTING_cmd_deposit ("recoup-refresh-deposit-ok",
-                               "recoup-withdraw-coin-1b",
-                               0,
-                               bc.user42_payto,
-                               "{\"items\":[{\"name\":\"more ice 
cream\",\"value\":1}]}",
-                               GNUNET_TIME_UNIT_ZERO,
-                               "EUR:9.5", /* FIXME: pick 'right' amount! */
-                               MHD_HTTP_OK),
-#endif
+    /* melt 10 EUR coin *again* to get 1 EUR refreshed coin */
+    TALER_TESTING_cmd_melt ("recoup-remelt-coin-1a",
+                            "recoup-withdraw-coin-1b",
+                            MHD_HTTP_OK,
+                            "EUR:1",
+                            NULL),
+    TALER_TESTING_cmd_refresh_reveal ("recoup-reveal-coin-1a",
+                                      "recoup-remelt-coin-1a",
+                                      MHD_HTTP_OK),
+    /* Try melting for more than the residual value to provoke an error */
+    TALER_TESTING_cmd_melt ("recoup-remelt-coin-1b",
+                            "recoup-withdraw-coin-1b",
+                            MHD_HTTP_OK,
+                            "EUR:1",
+                            NULL),
+    TALER_TESTING_cmd_melt ("recoup-remelt-coin-1c",
+                            "recoup-withdraw-coin-1b",
+                            MHD_HTTP_OK,
+                            "EUR:1",
+                            NULL),
+    TALER_TESTING_cmd_melt ("recoup-remelt-coin-1d",
+                            "recoup-withdraw-coin-1b",
+                            MHD_HTTP_OK,
+                            "EUR:1",
+                            NULL),
+    TALER_TESTING_cmd_melt ("recoup-remelt-coin-1e",
+                            "recoup-withdraw-coin-1b",
+                            MHD_HTTP_OK,
+                            "EUR:1",
+                            NULL),
+    TALER_TESTING_cmd_melt ("recoup-remelt-coin-1f",
+                            "recoup-withdraw-coin-1b",
+                            MHD_HTTP_OK,
+                            "EUR:1",
+                            NULL),
+    TALER_TESTING_cmd_melt ("recoup-remelt-coin-1g",
+                            "recoup-withdraw-coin-1b",
+                            MHD_HTTP_OK,
+                            "EUR:1",
+                            NULL),
+    TALER_TESTING_cmd_melt ("recoup-remelt-coin-1h",
+                            "recoup-withdraw-coin-1b",
+                            MHD_HTTP_OK,
+                            "EUR:1",
+                            NULL),
+    TALER_TESTING_cmd_melt ("recoup-remelt-coin-1i",
+                            "recoup-withdraw-coin-1b",
+                            MHD_HTTP_OK,
+                            "EUR:1",
+                            NULL),
+    TALER_TESTING_cmd_melt ("recoup-remelt-coin-1b-failing",
+                            "recoup-withdraw-coin-1b",
+                            MHD_HTTP_CONFLICT,
+                            "EUR:1",
+                            NULL),
     /* Re-withdraw from this reserve */
     TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-2",
                                        "recoup-create-reserve-1",

-- 
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]