gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated (7a7fa95 -> 6446eeb)


From: gnunet
Subject: [taler-anastasis] branch master updated (7a7fa95 -> 6446eeb)
Date: Sat, 29 Jul 2023 15:26:25 +0200

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

grothoff pushed a change to branch master
in repository anastasis.

    from 7a7fa95  more jdbc: fixes
     new 13a3663  -migrate to amounts as tuples
     new 86a72e0  -fix build errors
     new 6446eeb  -fix warnings

The 3 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/backend/anastasis-httpd_policy-upload.c   |  3 +-
 src/backend/anastasis-httpd_truth-challenge.c |  3 +-
 src/backend/anastasis-httpd_truth-solve.c     |  3 +-
 src/backend/anastasis-httpd_truth-upload.c    |  3 +-
 src/stasis/plugin_anastasis_postgres.c        | 47 ++++++++++++---------------
 src/stasis/stasis-0001.sql                    | 37 +++++++++++----------
 src/testing/testing_api_cmd_config.c          |  3 +-
 src/testing/testing_api_cmd_policy_lookup.c   |  3 +-
 src/testing/testing_api_cmd_policy_store.c    |  3 +-
 src/testing/testing_api_cmd_truth_challenge.c |  3 +-
 src/testing/testing_api_cmd_truth_solve.c     |  3 +-
 src/testing/testing_api_cmd_truth_store.c     |  3 +-
 12 files changed, 60 insertions(+), 54 deletions(-)

diff --git a/src/backend/anastasis-httpd_policy-upload.c 
b/src/backend/anastasis-httpd_policy-upload.c
index ab94d32..d966eba 100644
--- a/src/backend/anastasis-httpd_policy-upload.c
+++ b/src/backend/anastasis-httpd_policy-upload.c
@@ -558,6 +558,7 @@ await_payment (struct PolicyUploadContext *puc)
 static MHD_RESULT
 begin_payment (struct PolicyUploadContext *puc)
 {
+  static const char *no_uuids[1] = { NULL };
   json_t *order;
 
   GNUNET_CONTAINER_DLL_insert (puc_head,
@@ -608,7 +609,7 @@ begin_payment (struct PolicyUploadContext *puc)
                                          0,
                                          NULL, /* no inventory products */
                                          0,
-                                         NULL, /* no uuids */
+                                         no_uuids, /* no uuids */
                                          false, /* do NOT require claim token 
*/
                                          &proposal_cb,
                                          puc);
diff --git a/src/backend/anastasis-httpd_truth-challenge.c 
b/src/backend/anastasis-httpd_truth-challenge.c
index cda074c..b06ec78 100644
--- a/src/backend/anastasis-httpd_truth-challenge.c
+++ b/src/backend/anastasis-httpd_truth-challenge.c
@@ -799,6 +799,7 @@ begin_payment (struct ChallengeContext *gc)
   else
   {
     /* Create a fresh order */
+    static const char *no_uuids[1] = { NULL };
     json_t *order;
     struct GNUNET_TIME_Timestamp pay_deadline;
 
@@ -832,7 +833,7 @@ begin_payment (struct ChallengeContext *gc)
                                           0,
                                           NULL, /* no inventory products */
                                           0,
-                                          NULL, /* no uuids */
+                                          no_uuids, /* no uuids */
                                           false, /* do NOT require claim token 
*/
                                           &proposal_cb,
                                           gc);
diff --git a/src/backend/anastasis-httpd_truth-solve.c 
b/src/backend/anastasis-httpd_truth-solve.c
index eaa1dc5..bf00237 100644
--- a/src/backend/anastasis-httpd_truth-solve.c
+++ b/src/backend/anastasis-httpd_truth-solve.c
@@ -646,6 +646,7 @@ begin_payment (struct SolveContext *gc)
   else
   {
     /* Create a fresh order */
+    static const char *no_uuids[1] = { NULL };
     json_t *order;
     struct GNUNET_TIME_Timestamp pay_deadline;
 
@@ -679,7 +680,7 @@ begin_payment (struct SolveContext *gc)
                                           0,
                                           NULL, /* no inventory products */
                                           0,
-                                          NULL, /* no uuids */
+                                          no_uuids, /* no uuids */
                                           false, /* do NOT require claim token 
*/
                                           &proposal_cb,
                                           gc);
diff --git a/src/backend/anastasis-httpd_truth-upload.c 
b/src/backend/anastasis-httpd_truth-upload.c
index 428bbee..105d183 100644
--- a/src/backend/anastasis-httpd_truth-upload.c
+++ b/src/backend/anastasis-httpd_truth-upload.c
@@ -396,6 +396,7 @@ check_payment_cb (void *cls,
   case MHD_HTTP_NOT_FOUND:
     /* Setup fresh order */
     {
+      static const char *no_uuids[1] = { NULL };
       char *order_id;
       json_t *order;
 
@@ -426,7 +427,7 @@ check_payment_cb (void *cls,
                                              0,
                                              NULL, /* no inventory products */
                                              0,
-                                             NULL, /* no uuids */
+                                             no_uuids, /* no uuids */
                                              false, /* do NOT require claim 
token */
                                              &proposal_cb,
                                              tuc);
diff --git a/src/stasis/plugin_anastasis_postgres.c 
b/src/stasis/plugin_anastasis_postgres.c
index 147045f..0f5f30c 100644
--- a/src/stasis/plugin_anastasis_postgres.c
+++ b/src/stasis/plugin_anastasis_postgres.c
@@ -161,29 +161,26 @@ prepare_statements (void *cls)
                             "INSERT INTO anastasis_recdoc_payment "
                             "(user_id"
                             ",post_counter"
-                            ",amount_val"
-                            ",amount_frac"
+                            ",amount"
                             ",payment_identifier"
                             ",creation_date"
                             ") VALUES "
-                            "($1, $2, $3, $4, $5, $6);"),
+                            "($1, $2, $3, $4, $5);"),
     GNUNET_PQ_make_prepare ("challenge_payment_insert",
                             "INSERT INTO anastasis_challenge_payment "
                             "(truth_uuid"
-                            ",amount_val"
-                            ",amount_frac"
+                            ",amount"
                             ",payment_identifier"
                             ",creation_date"
                             ") VALUES "
-                            "($1, $2, $3, $4, $5);"),
+                            "($1, $2, $3, $4);"),
     GNUNET_PQ_make_prepare ("truth_payment_insert",
                             "INSERT INTO anastasis_truth_payment "
                             "(truth_uuid"
-                            ",amount_val"
-                            ",amount_frac"
+                            ",amount"
                             ",expiration"
                             ") VALUES "
-                            "($1, $2, $3, $4);"),
+                            "($1, $2, $3);"),
     GNUNET_PQ_make_prepare ("recdoc_payment_done",
                             "UPDATE anastasis_recdoc_payment "
                             "SET"
@@ -220,8 +217,7 @@ prepare_statements (void *cls)
                             "SELECT"
                             " creation_date"
                             ",post_counter"
-                            ",amount_val"
-                            ",amount_frac"
+                            ",amount"
                             ",paid"
                             " FROM anastasis_recdoc_payment"
                             " WHERE payment_identifier=$1;"),
@@ -234,8 +230,7 @@ prepare_statements (void *cls)
     GNUNET_PQ_make_prepare ("challenge_payment_select",
                             "SELECT"
                             " creation_date"
-                            ",amount_val"
-                            ",amount_frac"
+                            ",amount"
                             ",paid"
                             " FROM anastasis_challenge_payment"
                             " WHERE payment_identifier=$1"
@@ -246,8 +241,7 @@ prepare_statements (void *cls)
                             "SELECT"
                             " creation_date"
                             ",payment_identifier"
-                            ",amount_val"
-                            ",amount_frac"
+                            ",amount"
                             " FROM anastasis_challenge_payment"
                             " WHERE"
                             "  paid=FALSE"
@@ -261,8 +255,7 @@ prepare_statements (void *cls)
                             "SELECT"
                             " user_id"
                             ",payment_identifier"
-                            ",amount_val"
-                            ",amount_frac"
+                            ",amount"
                             " FROM anastasis_recdoc_payment"
                             " WHERE paid=FALSE;"),
     GNUNET_PQ_make_prepare ("gc_accounts",
@@ -295,8 +288,7 @@ prepare_statements (void *cls)
                             "($1, $2, $3, $4, $5, $6);"),
     GNUNET_PQ_make_prepare ("test_auth_iban_payment",
                             "SELECT"
-                            " credit_val"
-                            ",credit_frac"
+                            " credit"
                             ",wire_subject"
                             " FROM anastasis_auth_iban_in"
                             " WHERE debit_account_details=$1"
@@ -305,13 +297,12 @@ prepare_statements (void *cls)
                             "INSERT INTO anastasis_auth_iban_in "
                             "(wire_reference"
                             ",wire_subject"
-                            ",credit_val"
-                            ",credit_frac"
+                            ",credit"
                             ",debit_account_details"
                             ",credit_account_details"
                             ",execution_date"
                             ") VALUES "
-                            "($1, $2, $3, $4, $5, $6, $7);"),
+                            "($1, $2, $3, $4, $5, $6);"),
     GNUNET_PQ_make_prepare ("recovery_document_insert",
                             "INSERT INTO anastasis_recoverydocument "
                             "(user_id"
@@ -1403,7 +1394,8 @@ postgres_record_recdoc_payment (
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_auto_from_type (account_pub),
     GNUNET_PQ_query_param_uint32 (&post_counter),
-    TALER_PQ_query_param_amount (amount),
+    TALER_PQ_query_param_amount_tuple (pg->conn,
+                                       amount),
     GNUNET_PQ_query_param_auto_from_type (payment_secret),
     GNUNET_PQ_query_param_timestamp (&now),
     GNUNET_PQ_query_param_end
@@ -1506,7 +1498,8 @@ postgres_record_truth_upload_payment (
     duration);
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_auto_from_type (uuid),
-    TALER_PQ_query_param_amount (amount),
+    TALER_PQ_query_param_amount_tuple (pg->conn,
+                                       amount),
     GNUNET_PQ_query_param_timestamp (&exp),
     GNUNET_PQ_query_param_end
   };
@@ -1573,7 +1566,8 @@ postgres_record_challenge_payment (
   struct GNUNET_TIME_Timestamp now = GNUNET_TIME_timestamp_get ();
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_auto_from_type (truth_uuid),
-    TALER_PQ_query_param_amount (amount),
+    TALER_PQ_query_param_amount_tuple (pg->conn,
+                                       amount),
     GNUNET_PQ_query_param_auto_from_type (payment_secret),
     GNUNET_PQ_query_param_timestamp (&now),
     GNUNET_PQ_query_param_end
@@ -1640,7 +1634,8 @@ postgres_record_auth_iban_payment (
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_uint64 (&wire_reference),
     GNUNET_PQ_query_param_string (wire_subject),
-    TALER_PQ_query_param_amount (amount),
+    TALER_PQ_query_param_amount_tuple (pg->conn,
+                                       amount),
     GNUNET_PQ_query_param_string (debit_account),
     GNUNET_PQ_query_param_string (credit_account),
     GNUNET_PQ_query_param_timestamp (&execution_date),
diff --git a/src/stasis/stasis-0001.sql b/src/stasis/stasis-0001.sql
index cca8245..bd6e9ee 100644
--- a/src/stasis/stasis-0001.sql
+++ b/src/stasis/stasis-0001.sql
@@ -1,6 +1,6 @@
 --
 -- This file is part of Anastasis
--- Copyright (C) 2020, 2021, 2022 Anastasis SARL SA
+-- Copyright (C) 2020, 2021, 2022, 2023 Anastasis SARL SA
 --
 -- ANASTASIS is free software; you can redistribute it and/or modify it under 
the
 -- terms of the GNU General Public License as published by the Free Software
@@ -26,19 +26,25 @@ COMMENT ON SCHEMA anastasis IS 'anastasis backend data';
 SET search_path TO anastasis;
 
 
+CREATE TYPE taler_amount
+  AS
+  (val INT8
+  ,frac INT4
+  );
+COMMENT ON TYPE taler_amount
+  IS 'Stores an amount, fraction is in units of 1/100000000 of the base value';
+
+
 CREATE TABLE IF NOT EXISTS anastasis_truth_payment
   (truth_uuid BYTEA PRIMARY KEY CHECK(LENGTH(truth_uuid)=32),
-   amount_val INT8 NOT NULL,
-   amount_frac INT4 NOT NULL,
+   amount taler_amount NOT NULL,
    expiration INT8 NOT NULL);
 COMMENT ON TABLE anastasis_truth_payment
   IS 'Records about payments for truth uploads';
 COMMENT ON COLUMN anastasis_truth_payment.truth_uuid
   IS 'Identifier of the truth';
-COMMENT ON COLUMN anastasis_truth_payment.amount_val
+COMMENT ON COLUMN anastasis_truth_payment.amount
   IS 'Amount we were paid';
-COMMENT ON COLUMN anastasis_truth_payment.amount_frac
-  IS 'Amount we were paid fraction';
 COMMENT ON COLUMN anastasis_truth_payment.expiration
   IS 'At which date will the truth payment expire';
 
@@ -81,8 +87,7 @@ CREATE TABLE IF NOT EXISTS anastasis_recdoc_payment
   (payment_id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
    user_id BYTEA NOT NULL REFERENCES anastasis_user(user_id),
    post_counter INT4 NOT NULL DEFAULT 0 CHECK(post_counter >= 0),
-   amount_val INT8 NOT NULL,
-   amount_frac INT4 NOT NULL,
+   amount taler_amount NOT NULL,
    payment_identifier BYTEA NOT NULL CHECK(LENGTH(payment_identifier)=32),
    creation_date INT8 NOT NULL,
    paid BOOLEAN NOT NULL DEFAULT FALSE);
@@ -94,10 +99,8 @@ COMMENT ON COLUMN anastasis_recdoc_payment.user_id
   IS 'Link to the corresponding user who paid';
 COMMENT ON COLUMN anastasis_recdoc_payment.post_counter
   IS 'For how many posts does the user pay';
-COMMENT ON COLUMN anastasis_recdoc_payment.amount_val
+COMMENT ON COLUMN anastasis_recdoc_payment.amount
   IS 'Amount we were paid';
-COMMENT ON COLUMN anastasis_recdoc_payment.amount_frac
-  IS 'Amount we were paid fraction';
 COMMENT ON COLUMN anastasis_recdoc_payment.payment_identifier
   IS 'Payment identifier which the user has to provide';
 COMMENT ON COLUMN anastasis_recdoc_payment.creation_date
@@ -109,8 +112,7 @@ COMMENT ON COLUMN anastasis_recdoc_payment.paid
 CREATE TABLE IF NOT EXISTS anastasis_challenge_payment
   (payment_id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
    truth_uuid BYTEA CHECK(LENGTH(truth_uuid)=32) NOT NULL,
-   amount_val INT8 NOT NULL,
-   amount_frac INT4 NOT NULL,
+   amount taler_amount NOT NULL,
    payment_identifier BYTEA NOT NULL CHECK(LENGTH(payment_identifier)=32),
    creation_date INT8 NOT NULL,
    counter INT4 NOT NULL DEFAULT 3,
@@ -123,10 +125,8 @@ COMMENT ON COLUMN anastasis_challenge_payment.payment_id
   IS 'Serial number which identifies the payment';
 COMMENT ON COLUMN anastasis_challenge_payment.truth_uuid
   IS 'Link to the corresponding challenge which is paid';
-COMMENT ON COLUMN anastasis_challenge_payment.amount_val
+COMMENT ON COLUMN anastasis_challenge_payment.amount
   IS 'Amount we were paid';
-COMMENT ON COLUMN anastasis_challenge_payment.amount_frac
-  IS 'Amount we were paid fraction';
 COMMENT ON COLUMN anastasis_challenge_payment.payment_identifier
   IS 'Payment identifier which the user has to provide';
 COMMENT ON COLUMN anastasis_challenge_payment.counter
@@ -208,8 +208,7 @@ CREATE TABLE IF NOT EXISTS anastasis_auth_iban_in
   (auth_in_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE
   ,wire_reference INT8 NOT NULL PRIMARY KEY
   ,wire_subject TEXT NOT NULL
-  ,credit_val INT8 NOT NULL
-  ,credit_frac INT4 NOT NULL
+  ,credit taler_amount NOT NULL
   ,debit_account_details TEXT NOT NULL
   ,credit_account_details TEXT NOT NULL
   ,execution_date INT8 NOT NULL
@@ -220,6 +219,8 @@ COMMENT ON COLUMN anastasis_auth_iban_in.wire_reference
   IS 'Unique number identifying the wire transfer in LibEuFin/Nexus';
 COMMENT ON COLUMN anastasis_auth_iban_in.wire_subject
   IS 'For authentication, this contains the code, but also additional text';
+COMMENT ON COLUMN anastasis_auth_iban_in.credit
+  IS 'Amount we were credited';
 COMMENT ON COLUMN anastasis_auth_iban_in.execution_date
   IS 'Used both for (theoretical) garbage collection and to see if the 
transfer happened on time';
 COMMENT ON COLUMN anastasis_auth_iban_in.credit_account_details
diff --git a/src/testing/testing_api_cmd_config.c 
b/src/testing/testing_api_cmd_config.c
index bd245cc..7b0dbca 100644
--- a/src/testing/testing_api_cmd_config.c
+++ b/src/testing/testing_api_cmd_config.c
@@ -75,7 +75,8 @@ config_cb (void *cls,
   if (http_status != ss->http_status)
   {
     TALER_TESTING_unexpected_status (ss->is,
-                                     http_status);
+                                     http_status,
+                                     ss->http_status);
   }
   if (NULL == config)
   {
diff --git a/src/testing/testing_api_cmd_policy_lookup.c 
b/src/testing/testing_api_cmd_policy_lookup.c
index 9eb57c6..e8c4983 100644
--- a/src/testing/testing_api_cmd_policy_lookup.c
+++ b/src/testing/testing_api_cmd_policy_lookup.c
@@ -86,7 +86,8 @@ policy_lookup_cb (void *cls,
   if (http_status != pls->http_status)
   {
     TALER_TESTING_unexpected_status (pls->is,
-                                     http_status);
+                                     http_status,
+                                     pls->http_status);
   }
   if (NULL != pls->upload_reference)
   {
diff --git a/src/testing/testing_api_cmd_policy_store.c 
b/src/testing/testing_api_cmd_policy_store.c
index 9bb2118..e5404d0 100644
--- a/src/testing/testing_api_cmd_policy_store.c
+++ b/src/testing/testing_api_cmd_policy_store.c
@@ -140,7 +140,8 @@ policy_store_cb (void *cls,
   if (ud->http_status != pss->http_status)
   {
     TALER_TESTING_unexpected_status (pss->is,
-                                     ud->http_status);
+                                     ud->http_status,
+                                     pss->http_status);
   }
   switch (ud->us)
   {
diff --git a/src/testing/testing_api_cmd_truth_challenge.c 
b/src/testing/testing_api_cmd_truth_challenge.c
index 7132fcd..e4ea16b 100644
--- a/src/testing/testing_api_cmd_truth_challenge.c
+++ b/src/testing/testing_api_cmd_truth_challenge.c
@@ -101,7 +101,8 @@ truth_challenge_cb (void *cls,
   if (tcd->http_status != ksls->expected_http_status)
   {
     TALER_TESTING_unexpected_status (ksls->is,
-                                     tcd->http_status);
+                                     tcd->http_status,
+                                     ksls->expected_http_status);
   }
   switch (tcd->http_status)
   {
diff --git a/src/testing/testing_api_cmd_truth_solve.c 
b/src/testing/testing_api_cmd_truth_solve.c
index 1a935eb..40e662d 100644
--- a/src/testing/testing_api_cmd_truth_solve.c
+++ b/src/testing/testing_api_cmd_truth_solve.c
@@ -128,7 +128,8 @@ truth_solve_cb (void *cls,
   if (tsr->http_status != ksls->expected_http_status)
   {
     TALER_TESTING_unexpected_status (ksls->is,
-                                     tsr->http_status);
+                                     tsr->http_status,
+                                     ksls->expected_http_status);
   }
   switch (tsr->http_status)
   {
diff --git a/src/testing/testing_api_cmd_truth_store.c 
b/src/testing/testing_api_cmd_truth_store.c
index 2637702..675bc61 100644
--- a/src/testing/testing_api_cmd_truth_store.c
+++ b/src/testing/testing_api_cmd_truth_store.c
@@ -128,7 +128,8 @@ truth_store_cb (void *cls,
   if (ud->http_status != tss->http_status)
   {
     TALER_TESTING_unexpected_status (tss->is,
-                                     ud->http_status);
+                                     ud->http_status,
+                                     tss->http_status);
   }
   switch (ud->us)
   {

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