gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated (dc980317 -> 01ccbda6)


From: gnunet
Subject: [taler-exchange] branch master updated (dc980317 -> 01ccbda6)
Date: Fri, 10 Nov 2023 13:48:38 +0100

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

grothoff pushed a change to branch master
in repository exchange.

    from dc980317 -document untested cases
     new 67f06263 implement coin history for purse-with-deposit
     new 01ccbda6 add admin credentials for /admin/add/incoming, makes tests 
pass with latest libeufin-bank

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/include/taler_testing_lib.h                    |  6 ++
 .../test-taler-exchange-aggregator-postgres.conf   |  6 ++
 .../test-taler-exchange-wirewatch-postgres.conf    |  6 ++
 src/testing/test_bank_api.c                        |  6 +-
 src/testing/test_bank_api_fakebank.conf            |  7 ++
 src/testing/test_bank_api_nexus.conf               |  7 ++
 src/testing/test_exchange_api.conf                 | 11 +++
 src/testing/test_exchange_api_age_restriction.conf | 10 +++
 .../test_exchange_api_keys_cherry_picking.conf     |  9 +++
 src/testing/testing_api_cmd_coin_history.c         | 24 ++++++-
 src/testing/testing_api_cmd_purse_create_deposit.c | 80 +++++++++++++++-------
 src/testing/testing_api_misc.c                     | 17 +++++
 12 files changed, 161 insertions(+), 28 deletions(-)

diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index 2d002abe..a0a25832 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -125,6 +125,12 @@ struct TALER_TESTING_Credentials
    */
   struct TALER_BANK_AuthenticationData ba;
 
+  /**
+   * Bank authentication details for the admin bank
+   * account.
+   */
+  struct TALER_BANK_AuthenticationData ba_admin;
+
   /**
    * Configuration file data.
    */
diff --git a/src/testing/test-taler-exchange-aggregator-postgres.conf 
b/src/testing/test-taler-exchange-aggregator-postgres.conf
index c9dcbf43..8c3ee4ba 100644
--- a/src/testing/test-taler-exchange-aggregator-postgres.conf
+++ b/src/testing/test-taler-exchange-aggregator-postgres.conf
@@ -49,6 +49,12 @@ WIRE_GATEWAY_AUTH_METHOD = basic
 USERNAME = Exchange
 PASSWORD = x
 
+[admin-accountcredentials-1]
+WIRE_GATEWAY_URL = "http://localhost:8082/accounts/2/taler-wire-gateway/";
+WIRE_GATEWAY_AUTH_METHOD = basic
+USERNAME = Exchange
+PASSWORD = x
+
 [bank]
 HTTP_PORT = 8082
 
diff --git a/src/testing/test-taler-exchange-wirewatch-postgres.conf 
b/src/testing/test-taler-exchange-wirewatch-postgres.conf
index 81c96e24..4f13077a 100644
--- a/src/testing/test-taler-exchange-wirewatch-postgres.conf
+++ b/src/testing/test-taler-exchange-wirewatch-postgres.conf
@@ -48,6 +48,12 @@ WIRE_GATEWAY_AUTH_METHOD = basic
 USERNAME = Exchange
 PASSWORD = x
 
+[admin-accountcredentials-1]
+WIRE_GATEWAY_URL = "http://localhost:8082/accounts/2/taler-wire-gateway/";
+WIRE_GATEWAY_AUTH_METHOD = basic
+USERNAME = Exchange
+PASSWORD = x
+
 [bank]
 HTTP_PORT = 8082
 
diff --git a/src/testing/test_bank_api.c b/src/testing/test_bank_api.c
index 0dea6026..8cbc86bb 100644
--- a/src/testing/test_bank_api.c
+++ b/src/testing/test_bank_api.c
@@ -98,7 +98,7 @@ run (void *cls,
                                       1),
       TALER_TESTING_cmd_admin_add_incoming ("credit-1",
                                             "EUR:5.01",
-                                            &cred.ba,
+                                            &cred.ba_admin,
                                             cred.user42_payto),
       /**
        * This CMD doesn't care about the HTTP response code; that's
@@ -108,7 +108,7 @@ run (void *cls,
        */
       TALER_TESTING_cmd_admin_add_incoming_with_ref ("credit-1-fail",
                                                      "EUR:2.01",
-                                                     &cred.ba,
+                                                     &cred.ba_admin,
                                                      cred.user42_payto,
                                                      "credit-1",
                                                      -1),
@@ -126,7 +126,7 @@ run (void *cls,
                                      5),
       TALER_TESTING_cmd_admin_add_incoming ("credit-2",
                                             "EUR:3.21",
-                                            &cred.ba,
+                                            &cred.ba_admin,
                                             cred.user42_payto),
       TALER_TESTING_cmd_transfer ("debit-1",
                                   "EUR:3.22",
diff --git a/src/testing/test_bank_api_fakebank.conf 
b/src/testing/test_bank_api_fakebank.conf
index cd056c66..62fa4cd4 100644
--- a/src/testing/test_bank_api_fakebank.conf
+++ b/src/testing/test_bank_api_fakebank.conf
@@ -12,3 +12,10 @@ WIRE_GATEWAY_URL = 
"http://localhost:8082/accounts/2/taler-wire-gateway/";
 WIRE_GATEWAY_AUTH_METHOD = basic
 USERNAME = Exchange
 PASSWORD = x
+
+[admin-accountcredentials-2]
+WIRE_GATEWAY_URL = "http://localhost:8082/accounts/2/taler-wire-gateway/";
+WIRE_GATEWAY_AUTH_METHOD = basic
+# For now, fakebank still checks against the Exchange account...
+USERNAME = Exchange
+PASSWORD = x
diff --git a/src/testing/test_bank_api_nexus.conf 
b/src/testing/test_bank_api_nexus.conf
index 6fc97ee3..605c7b00 100644
--- a/src/testing/test_bank_api_nexus.conf
+++ b/src/testing/test_bank_api_nexus.conf
@@ -10,6 +10,13 @@ WIRE_GATEWAY_AUTH_METHOD = basic
 USERNAME = exchange
 PASSWORD = x
 
+[admin-accountcredentials-2]
+WIRE_GATEWAY_URL = http://localhost:8082/accounts/exchange/taler-wire-gateway/
+WIRE_GATEWAY_AUTH_METHOD = basic
+USERNAME = admin
+# 'secret' is from taler-unified-setup.sh
+PASSWORD = secret
+
 [libeufin-bankdb-postgres]
 CONFIG="postgresql:///talercheck"
 
diff --git a/src/testing/test_exchange_api.conf 
b/src/testing/test_exchange_api.conf
index 0d69773d..45c1fa89 100644
--- a/src/testing/test_exchange_api.conf
+++ b/src/testing/test_exchange_api.conf
@@ -68,6 +68,10 @@ ENABLE_CREDIT = YES
 WIRE_GATEWAY_AUTH_METHOD = none
 WIRE_GATEWAY_URL = "http://localhost:8082/accounts/2/taler-wire-gateway/";
 
+[admin-accountcredentials-1]
+WIRE_GATEWAY_AUTH_METHOD = none
+WIRE_GATEWAY_URL = "http://localhost:8082/accounts/2/taler-wire-gateway/";
+
 [exchange-account-2]
 PAYTO_URI = "payto://x-taler-bank/localhost/2?receiver-name=2"
 ENABLE_DEBIT = YES
@@ -79,6 +83,13 @@ USERNAME = Exchange
 PASSWORD = x
 WIRE_GATEWAY_URL = "http://localhost:8082/accounts/2/taler-wire-gateway/";
 
+[admin-accountcredentials-2]
+WIRE_GATEWAY_AUTH_METHOD = basic
+# For now, fakebank still checks against the Exchange account...
+USERNAME = Exchange
+PASSWORD = x
+WIRE_GATEWAY_URL = "http://localhost:8082/accounts/2/taler-wire-gateway/";
+
 
 [kyc-provider-test-oauth2]
 COST = 0
diff --git a/src/testing/test_exchange_api_age_restriction.conf 
b/src/testing/test_exchange_api_age_restriction.conf
index a14d3998..1345fcb1 100644
--- a/src/testing/test_exchange_api_age_restriction.conf
+++ b/src/testing/test_exchange_api_age_restriction.conf
@@ -54,6 +54,10 @@ ENABLE_CREDIT = YES
 WIRE_GATEWAY_AUTH_METHOD = none
 WIRE_GATEWAY_URL = "http://localhost:8082/accounts/42/taler-wire-gateway/";
 
+[admin-accountcredentials-1]
+WIRE_GATEWAY_AUTH_METHOD = none
+WIRE_GATEWAY_URL = "http://localhost:8082/accounts/42/taler-wire-gateway/";
+
 [exchange-account-2]
 PAYTO_URI = "payto://x-taler-bank/localhost/2?receiver-name=2"
 ENABLE_DEBIT = YES
@@ -65,6 +69,12 @@ USERNAME = Exchange
 PASSWORD = x
 WIRE_GATEWAY_URL = "http://localhost:8082/accounts/2/taler-wire-gateway/";
 
+[admin-accountcredentials-2]
+WIRE_GATEWAY_AUTH_METHOD = basic
+USERNAME = Exchange
+PASSWORD = x
+WIRE_GATEWAY_URL = "http://localhost:8082/accounts/2/taler-wire-gateway/";
+
 
 [kyc-provider-test-oauth2]
 COST = 0
diff --git a/src/testing/test_exchange_api_keys_cherry_picking.conf 
b/src/testing/test_exchange_api_keys_cherry_picking.conf
index 56951c16..14224242 100644
--- a/src/testing/test_exchange_api_keys_cherry_picking.conf
+++ b/src/testing/test_exchange_api_keys_cherry_picking.conf
@@ -34,6 +34,9 @@ ENABLE_CREDIT = YES
 [exchange-accountcredentials-1]
 WIRE_GATEWAY_URL = "http://localhost:9082/accounts/42/taler-wire-gateway/";
 
+[admin-accountcredentials-1]
+WIRE_GATEWAY_URL = "http://localhost:9082/accounts/42/taler-wire-gateway/";
+
 [exchange-account-2]
 PAYTO_URI = "payto://x-taler-bank/localhost/2?receiver-name=2"
 ENABLE_DEBIT = YES
@@ -45,5 +48,11 @@ WIRE_GATEWAY_AUTH_METHOD = basic
 USERNAME = Exchange
 PASSWORD = x
 
+[admin-accountcredentials-2]
+WIRE_GATEWAY_URL = "http://localhost:9082/accounts/2/taler-wire-gateway/";
+WIRE_GATEWAY_AUTH_METHOD = basic
+USERNAME = Exchange
+PASSWORD = x
+
 [bank]
 HTTP_PORT=8082
diff --git a/src/testing/testing_api_cmd_coin_history.c 
b/src/testing/testing_api_cmd_coin_history.c
index 811e4370..a1345f67 100644
--- a/src/testing/testing_api_cmd_coin_history.c
+++ b/src/testing/testing_api_cmd_coin_history.c
@@ -120,7 +120,12 @@ history_entry_cmp (
     return 1;
   if (0 != TALER_amount_cmp (&h1->amount,
                              &h2->amount))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Amount mismatch (%s)\n",
+                TALER_amount2s (&h1->amount));
     return 1;
+  }
   switch (h1->type)
   {
   case TALER_EXCHANGE_CTT_NONE:
@@ -178,10 +183,21 @@ history_entry_cmp (
     /* coin_sig is not initialized */
     if (0 != GNUNET_memcmp (&h1->details.purse_deposit.purse_pub,
                             &h2->details.purse_deposit.purse_pub))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Purse public key mismatch\n");
       return 1;
+    }
     if (0 != strcmp (h1->details.purse_deposit.exchange_base_url,
                      h2->details.purse_deposit.exchange_base_url))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Exchange base URL mismatch (%s/%s)\n",
+                  h1->details.purse_deposit.exchange_base_url,
+                  h2->details.purse_deposit.exchange_base_url);
+      GNUNET_break (0);
       return 1;
+    }
     return 0;
   case TALER_EXCHANGE_CTT_PURSE_REFUND:
     /* NOTE: not supported yet (trait not returned) */
@@ -259,12 +275,18 @@ analyze_command (void *cls,
         TALER_TESTING_get_trait_coin_pub (cmd,
                                           j,
                                           &rp))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Command `%s#%u' has no public key for a coin\n",
+                  cmd->label,
+                  j);
       break; /* command does nothing for coins */
+    }
     if (0 !=
         GNUNET_memcmp (rp,
                        coin_pub))
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "Command `%s#%u' is about another coin\n",
                   cmd->label,
                   j);
diff --git a/src/testing/testing_api_cmd_purse_create_deposit.c 
b/src/testing/testing_api_cmd_purse_create_deposit.c
index cf992946..4740f980 100644
--- a/src/testing/testing_api_cmd_purse_create_deposit.c
+++ b/src/testing/testing_api_cmd_purse_create_deposit.c
@@ -43,11 +43,21 @@ struct Coin
    */
   unsigned int coin_index;
 
+  /**
+   * Public key of the deposited coin.
+   */
+  struct TALER_CoinSpendPublicKeyP coin_pub;
+
   /**
    * Amount to deposit (with fee).
    */
   struct TALER_Amount deposit_with_fee;
 
+  /**
+   * Entry in the coin's history generated by this operation.
+   */
+  struct TALER_EXCHANGE_CoinHistoryEntry che;
+
 };
 
 
@@ -193,9 +203,15 @@ deposit_run (void *cls,
 
   (void) cmd;
   ds->is = is;
+  GNUNET_CRYPTO_eddsa_key_create (&ds->purse_priv.eddsa_priv);
+  GNUNET_CRYPTO_eddsa_key_create (&ds->merge_priv.eddsa_priv);
+  GNUNET_CRYPTO_ecdhe_key_create (&ds->contract_priv.ecdhe_priv);
+  GNUNET_CRYPTO_eddsa_key_get_public (&ds->purse_priv.eddsa_priv,
+                                      &ds->purse_pub.eddsa_pub);
+
   for (unsigned int i = 0; i<ds->num_coin_references; i++)
   {
-    const struct Coin *cr = &ds->coin_references[i];
+    struct Coin *cr = &ds->coin_references[i];
     struct TALER_EXCHANGE_PurseDeposit *pd = &deposits[i];
     const struct TALER_TESTING_Command *coin_cmd;
     const struct TALER_CoinSpendPrivateKeyP *coin_priv;
@@ -239,14 +255,20 @@ deposit_run (void *cls,
     pd->coin_priv = *coin_priv;
     pd->amount = cr->deposit_with_fee;
     pd->h_denom_pub = denom_pub->h_key;
+    GNUNET_CRYPTO_eddsa_key_get_public (&coin_priv->eddsa_priv,
+                                        &cr->coin_pub.eddsa_pub);
+    cr->che.type = TALER_EXCHANGE_CTT_PURSE_DEPOSIT;
+    cr->che.amount = cr->deposit_with_fee;
+    GNUNET_CRYPTO_eddsa_key_get_public (
+      &ds->purse_priv.eddsa_priv,
+      &cr->che.details.purse_deposit.purse_pub.eddsa_pub);
+    cr->che.details.purse_deposit.exchange_base_url
+      = TALER_TESTING_get_exchange_url (is);
+    TALER_age_commitment_hash (
+      &age_commitment_proof->commitment,
+      &cr->che.details.purse_deposit.phac);
   }
 
-  GNUNET_CRYPTO_eddsa_key_create (&ds->purse_priv.eddsa_priv);
-  GNUNET_CRYPTO_eddsa_key_create (&ds->merge_priv.eddsa_priv);
-  GNUNET_CRYPTO_ecdhe_key_create (&ds->contract_priv.ecdhe_priv);
-  GNUNET_CRYPTO_eddsa_key_get_public (&ds->purse_priv.eddsa_priv,
-                                      &ds->purse_pub.eddsa_pub);
-
   ds->purse_expiration =
     GNUNET_TIME_absolute_to_timestamp (
       GNUNET_TIME_relative_to_absolute (ds->rel_expiration));
@@ -323,23 +345,33 @@ deposit_traits (void *cls,
                 unsigned int index)
 {
   struct PurseCreateDepositState *ds = cls;
-  struct TALER_TESTING_Trait traits[] = {
-    TALER_TESTING_make_trait_merge_priv (&ds->merge_priv),
-    TALER_TESTING_make_trait_contract_priv (&ds->contract_priv),
-    TALER_TESTING_make_trait_purse_priv (&ds->purse_priv),
-    TALER_TESTING_make_trait_purse_pub (&ds->purse_pub),
-    TALER_TESTING_make_trait_contract_terms (ds->contract_terms),
-    TALER_TESTING_make_trait_deposit_amount (0,
-                                             &ds->target_amount),
-    TALER_TESTING_make_trait_timestamp (index,
-                                        &ds->purse_expiration),
-    TALER_TESTING_trait_end ()
-  };
-
-  return TALER_TESTING_get_trait (traits,
-                                  ret,
-                                  trait,
-                                  index);
+  if (index >= ds->num_coin_references)
+    return GNUNET_NO;
+
+  {
+    const struct Coin *co = &ds->coin_references[index];
+    struct TALER_TESTING_Trait traits[] = {
+      TALER_TESTING_make_trait_merge_priv (&ds->merge_priv),
+      TALER_TESTING_make_trait_contract_priv (&ds->contract_priv),
+      TALER_TESTING_make_trait_coin_history (index,
+                                             &co->che),
+      TALER_TESTING_make_trait_coin_pub (index,
+                                         &co->coin_pub),
+      TALER_TESTING_make_trait_purse_priv (&ds->purse_priv),
+      TALER_TESTING_make_trait_purse_pub (&ds->purse_pub),
+      TALER_TESTING_make_trait_contract_terms (ds->contract_terms),
+      TALER_TESTING_make_trait_deposit_amount (0,
+                                               &ds->target_amount),
+      TALER_TESTING_make_trait_timestamp (index,
+                                          &ds->purse_expiration),
+      TALER_TESTING_trait_end ()
+    };
+
+    return TALER_TESTING_get_trait (traits,
+                                    ret,
+                                    trait,
+                                    index);
+  }
 }
 
 
diff --git a/src/testing/testing_api_misc.c b/src/testing/testing_api_misc.c
index 665402fd..80ff0b6c 100644
--- a/src/testing/testing_api_misc.c
+++ b/src/testing/testing_api_misc.c
@@ -118,6 +118,23 @@ TALER_TESTING_get_credentials (
     }
     GNUNET_free (csn);
   }
+  {
+    char *csn;
+
+    GNUNET_asprintf (&csn,
+                     "admin-accountcredentials-%s",
+                     &exchange_account_section[strlen ("exchange-account-")]);
+    if (GNUNET_OK !=
+        TALER_BANK_auth_parse_cfg (ua->cfg,
+                                   csn,
+                                   &ua->ba_admin))
+    {
+      GNUNET_break (0);
+      GNUNET_free (csn);
+      return GNUNET_SYSERR;
+    }
+    GNUNET_free (csn);
+  }
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_string (ua->cfg,
                                              "exchange",

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