exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 5d5e2ef86158f43e4defb2eb531098891bbc6c21
parent fb3b92ebd09e3e91849646ad243725361a46f383
Author: Özgür Kesim <oec@codeblau.de>
Date:   Fri, 13 Nov 2026 13:20:11 +0100

[exchange] coin history: no ev_sigs in MELT entries (#11916)

Entries do not change after the reveal; clients repeat /reveal-melt.

Diffstat:
Msrc/exchange/taler-exchange-httpd_get-coins-COIN_PUB-history.c | 18------------------
Msrc/exchangedb/free_coin_transaction_list.c | 6------
Msrc/exchangedb/get_coin_transactions.c | 21++-------------------
Msrc/exchangedb/test_coin_history.c | 5+----
Msrc/include/exchange-database/free_coin_transaction_list.h | 6------
Msrc/include/taler/exchange/get-coins-COIN_PUB-history.h | 7-------
Msrc/lib/exchange_api_get-coins-COIN_PUB-history.c | 49+------------------------------------------------
Msrc/testing/testing_api_cmd_coin_history.c | 31+------------------------------
Msrc/testing/testing_api_cmd_refresh.c | 83-------------------------------------------------------------------------------
9 files changed, 5 insertions(+), 221 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_get-coins-COIN_PUB-history.c b/src/exchange/taler-exchange-httpd_get-coins-COIN_PUB-history.c @@ -172,7 +172,6 @@ compile_transaction_history ( const struct TALER_AgeCommitmentHashP *phac; const struct TALER_BlindingMasterSeedP *pbs; json_t *transfer_pubs = NULL; - json_t *ev_sigs = NULL; #if ENABLE_SANITY_CHECKS TEH_METRICS_num_verifications[TEH_MT_SIGNATURE_EDDSA]++; @@ -208,20 +207,6 @@ compile_transaction_history ( GNUNET_JSON_from_data_auto ( &melt->transfer_pubs[i]))); } - /* only set after a successful reveal, see get_coin_transactions() */ - if (NULL != melt->ev_sigs) - { - ev_sigs = json_array (); - GNUNET_assert (NULL != ev_sigs); - for (size_t i = 0; i < melt->num_coins; i++) - GNUNET_assert (0 == - json_array_append_new ( - ev_sigs, - GNUNET_JSON_PACK ( - TALER_JSON_pack_blinded_denom_sig ( - NULL, - &melt->ev_sigs[i])))); - } if (0 != json_array_append_new ( history, @@ -251,9 +236,6 @@ compile_transaction_history ( GNUNET_JSON_pack_array_steal ("transfer_pubs", transfer_pubs)), GNUNET_JSON_pack_allow_null ( - GNUNET_JSON_pack_array_steal ("ev_sigs", - ev_sigs)), - GNUNET_JSON_pack_allow_null ( GNUNET_JSON_pack_data_auto ("blinding_seed", pbs)), GNUNET_JSON_pack_allow_null ( diff --git a/src/exchangedb/free_coin_transaction_list.c b/src/exchangedb/free_coin_transaction_list.c @@ -43,12 +43,6 @@ TALER_EXCHANGEDB_free_coin_transaction_list ( { struct TALER_EXCHANGEDB_MeltListEntry *melt = tl->details.melt; - if (NULL != melt->ev_sigs) - { - for (size_t i = 0; i < melt->num_coins; i++) - TALER_blinded_denom_sig_free (&melt->ev_sigs[i]); - GNUNET_free (melt->ev_sigs); - } GNUNET_free (melt->transfer_pubs); GNUNET_free (melt->denom_pub_hashes); GNUNET_free (melt); diff --git a/src/exchangedb/get_coin_transactions.c b/src/exchangedb/get_coin_transactions.c @@ -260,11 +260,8 @@ add_coin_melt (void *cls, { struct TALER_DenominationHashP *denom_pub_hashes = NULL; struct TALER_TransferPublicKeyP *transfer_pubs = NULL; - struct TALER_BlindedDenominationSignature *ev_sigs = NULL; size_t num_transfer_pubs = 0; - size_t num_ev_sigs = 0; bool no_transfer_pubs; - bool no_ev_sigs; struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_auto_from_type ("rc", &melt->rc), @@ -302,12 +299,6 @@ add_coin_melt (void *cls, &num_transfer_pubs, (void **) &transfer_pubs), &no_transfer_pubs), - GNUNET_PQ_result_spec_allow_null ( - TALER_PQ_result_spec_array_blinded_denom_sig (pg->conn, - "ev_sigs", - &num_ev_sigs, - &ev_sigs), - &no_ev_sigs), GNUNET_PQ_result_spec_end }; @@ -322,10 +313,8 @@ add_coin_melt (void *cls, chc->failed = true; return; } - if ( ( (! no_transfer_pubs) && - (num_transfer_pubs != melt->num_coins) ) || - ( (! no_ev_sigs) && - (num_ev_sigs != melt->num_coins) ) ) + if ( (! no_transfer_pubs) && + (num_transfer_pubs != melt->num_coins) ) { GNUNET_break (0); GNUNET_PQ_cleanup_result (rs); @@ -340,11 +329,6 @@ add_coin_melt (void *cls, melt->transfer_pubs = transfer_pubs; transfer_pubs = NULL; } - if (! no_ev_sigs) - { - melt->ev_sigs = ev_sigs; - ev_sigs = NULL; - } GNUNET_PQ_cleanup_result (rs); } tl = GNUNET_new (struct TALER_EXCHANGEDB_TransactionList); @@ -995,7 +979,6 @@ TALER_EXCHANGEDB_get_coin_transactions ( ",refresh_id" ",noreveal_index" ",transfer_pubs" - ",CASE WHEN revealed THEN denom_sigs END AS ev_sigs" ",ARRAY(" " SELECT fresh_denoms.denom_pub_hash" " FROM unnest(refresh.denom_serials) WITH ORDINALITY" diff --git a/src/exchangedb/test_coin_history.c b/src/exchangedb/test_coin_history.c @@ -541,7 +541,7 @@ check_other_spends (struct TALER_EXCHANGEDB_PostgresContext *pg) FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs); FAILIF (! melt_balance_ok); - /* The original output list is available before and after reveal. */ + /* The melt entry is the same before and after the reveal. */ for (unsigned int revealed = 0; revealed < 2; revealed++) { bool found_melt = false; @@ -584,9 +584,6 @@ check_other_spends (struct TALER_EXCHANGEDB_PostgresContext *pg) transfer_pubs, sizeof (transfer_pubs))), TALER_EXCHANGEDB_free_coin_transaction_list (tl)); - /* the signatures over the fresh coins only after the reveal */ - FAILIF_C ((NULL != melt->ev_sigs) != (0 != revealed), - TALER_EXCHANGEDB_free_coin_transaction_list (tl)); } TALER_EXCHANGEDB_free_coin_transaction_list (tl); tl = NULL; diff --git a/src/include/exchange-database/free_coin_transaction_list.h b/src/include/exchange-database/free_coin_transaction_list.h @@ -332,12 +332,6 @@ struct TALER_EXCHANGEDB_MeltListEntry */ struct TALER_TransferPublicKeyP *transfer_pubs; - /** - * The @e num_coins blinded signatures over the fresh coins of the batch - * at @e noreveal_index, NULL if the reveal was not (yet) performed. - */ - struct TALER_BlindedDenominationSignature *ev_sigs; - }; diff --git a/src/include/taler/exchange/get-coins-COIN_PUB-history.h b/src/include/taler/exchange/get-coins-COIN_PUB-history.h @@ -195,13 +195,6 @@ struct TALER_EXCHANGE_CoinHistoryEntry * (before v46, or if the melt request had none). */ struct TALER_TransferPublicKeyP *transfer_pubs; - - /** - * The @e num_fresh_coins blinded denomination signatures over the - * fresh coins, NULL if the coin was not (yet) revealed or the - * exchange is older than v46. - */ - struct TALER_BlindedDenominationSignature *ev_sigs; } melt; struct diff --git a/src/lib/exchange_api_get-coins-COIN_PUB-history.c b/src/lib/exchange_api_get-coins-COIN_PUB-history.c @@ -248,12 +248,6 @@ help_deposit (struct CoinHistoryParseContext *pc, static void free_melt (struct TALER_EXCHANGE_CoinHistoryEntry *rh) { - if (NULL != rh->details.melt.ev_sigs) - { - for (size_t i = 0; i < rh->details.melt.num_fresh_coins; i++) - TALER_blinded_denom_sig_free (&rh->details.melt.ev_sigs[i]); - GNUNET_free (rh->details.melt.ev_sigs); - } GNUNET_free (rh->details.melt.transfer_pubs); GNUNET_free (rh->details.melt.denoms_h); } @@ -276,7 +270,6 @@ parse_melt (struct CoinHistoryParseContext *pc, json_t *transaction) { size_t num_transfer_pubs = 0; - const json_t *j_ev_sigs = NULL; struct GNUNET_JSON_Specification spec[] = { TALER_JSON_spec_amount_any ("melt_fee", &rh->details.melt.melt_fee), @@ -307,16 +300,11 @@ parse_melt (struct CoinHistoryParseContext *pc, &num_transfer_pubs, (void **) &rh->details.melt.transfer_pubs), NULL), - GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_array_const ("ev_sigs", - &j_ev_sigs), - NULL), GNUNET_JSON_spec_end () }; rh->details.melt.denoms_h = NULL; rh->details.melt.transfer_pubs = NULL; - rh->details.melt.ev_sigs = NULL; if (GNUNET_OK != GNUNET_JSON_parse (transaction, spec, @@ -333,7 +321,7 @@ parse_melt (struct CoinHistoryParseContext *pc, free_melt (rh); return GNUNET_SYSERR; } - /* transfer_pubs and ev_sigs have one entry per fresh coin */ + /* transfer_pubs have one entry per fresh coin */ if ( (NULL != rh->details.melt.transfer_pubs) && (num_transfer_pubs != rh->details.melt.num_fresh_coins) ) { @@ -341,41 +329,6 @@ parse_melt (struct CoinHistoryParseContext *pc, free_melt (rh); return GNUNET_SYSERR; } - if (NULL != j_ev_sigs) - { - size_t num = rh->details.melt.num_fresh_coins; - struct TALER_BlindedDenominationSignature *ev_sigs; - - if (json_array_size (j_ev_sigs) != num) - { - GNUNET_break_op (0); - free_melt (rh); - return GNUNET_SYSERR; - } - ev_sigs = GNUNET_new_array (GNUNET_NZL (num), - struct TALER_BlindedDenominationSignature); - { - struct GNUNET_JSON_Specification sspec[] = { - TALER_JSON_spec_array_of_blinded_denom_sigs (NULL, - num, - ev_sigs), - GNUNET_JSON_spec_end () - }; - - if (GNUNET_OK != - GNUNET_JSON_parse (j_ev_sigs, - sspec, - NULL, NULL)) - { - GNUNET_break_op (0); - GNUNET_free (ev_sigs); - free_melt (rh); - return GNUNET_SYSERR; - } - } - rh->details.melt.ev_sigs = ev_sigs; - } - /* check that melt fee matches our expectations from /keys! */ if ( (GNUNET_YES != TALER_amount_cmp_currency (&rh->details.melt.melt_fee, diff --git a/src/testing/testing_api_cmd_coin_history.c b/src/testing/testing_api_cmd_coin_history.c @@ -160,33 +160,6 @@ history_entry_cmp ( if (h1->details.melt.noreveal_index != h2->details.melt.noreveal_index) return 1; - /* the blinded signatures are exactly those of the reveal, - and absent if the melt was not (yet) revealed */ - if ( (NULL == h1->details.melt.ev_sigs) != - (NULL == h2->details.melt.ev_sigs) ) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Melt history %s ev_sigs\n", - (NULL == h2->details.melt.ev_sigs) - ? "lacks the revealed" - : "has unexpected"); - return 1; - } - if (NULL != h1->details.melt.ev_sigs) - { - if (h1->details.melt.num_fresh_coins != - h2->details.melt.num_fresh_coins) - return 1; - for (size_t j = 0; j < h1->details.melt.num_fresh_coins; j++) - if (0 != TALER_blinded_denom_sig_cmp ( - &h1->details.melt.ev_sigs[j], - &h2->details.melt.ev_sigs[j])) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Melt history has ev_sigs other than the reveal\n"); - return 1; - } - } /* Note: most other fields are not initialized in the trait as they are hard to extract from the API */ @@ -378,9 +351,7 @@ analyze_command (void *cls, /** * Check the details of the melt entries of a coin history: they must * have a noreveal index and transfer public keys, and the latter must be - * those the client derived for the batch at the noreveal index. The - * blinded signatures are checked against the reveal in - * history_entry_cmp(). + * those the client derived for the batch at the noreveal index. * * @param ss our state, with the coin's private key * @param hlen length of @a rhist diff --git a/src/testing/testing_api_cmd_refresh.c b/src/testing/testing_api_cmd_refresh.c @@ -429,81 +429,6 @@ do_reveal_retry (void *cls) /** - * Release the blinded signatures recorded in the expected - * coin history entry of a melt. - * - * @param[in,out] ms melt command state - */ -static void -free_expected_ev_sigs (struct MeltState *ms) -{ - if (NULL == ms->che.details.melt.ev_sigs) - return; - for (size_t i = 0; i < ms->che.details.melt.num_fresh_coins; i++) - TALER_blinded_denom_sig_free (&ms->che.details.melt.ev_sigs[i]); - GNUNET_free (ms->che.details.melt.ev_sigs); - ms->che.details.melt.num_fresh_coins = 0; -} - - -/** - * Record the blinded signatures of a successful reveal in the expected - * coin history entry of the melt, see history_entry_cmp(). - * - * @param[in,out] ms melt command state - * @param reply body of the /reveal-melt response - * @return #GNUNET_OK on success - */ -static enum GNUNET_GenericReturnValue -record_revealed_ev_sigs (struct MeltState *ms, - const json_t *reply) -{ - const json_t *j_ev_sigs; - struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_array_const ("ev_sigs", - &j_ev_sigs), - GNUNET_JSON_spec_end () - }; - struct TALER_BlindedDenominationSignature *ev_sigs; - size_t num; - - if (GNUNET_OK != - GNUNET_JSON_parse (reply, - spec, - NULL, NULL)) - { - GNUNET_break (0); - return GNUNET_SYSERR; - } - num = json_array_size (j_ev_sigs); - ev_sigs = GNUNET_new_array (GNUNET_NZL (num), - struct TALER_BlindedDenominationSignature); - { - struct GNUNET_JSON_Specification sspec[] = { - TALER_JSON_spec_array_of_blinded_denom_sigs (NULL, - num, - ev_sigs), - GNUNET_JSON_spec_end () - }; - - if (GNUNET_OK != - GNUNET_JSON_parse (j_ev_sigs, - sspec, - NULL, NULL)) - { - GNUNET_break (0); - GNUNET_free (ev_sigs); - return GNUNET_SYSERR; - } - } - free_expected_ev_sigs (ms); - ms->che.details.melt.ev_sigs = ev_sigs; - ms->che.details.melt.num_fresh_coins = num; - return GNUNET_OK; -} - - -/** * "refresh reveal" request callback; it checks that the response * code is expected and copies into its command's state the data * coming from the exchange, namely the fresh coins. @@ -564,13 +489,6 @@ reveal_cb (struct RevealMeltState *rrs, switch (hr->http_status) { case MHD_HTTP_OK: - if (GNUNET_OK != - record_revealed_ev_sigs (melt_cmd->cls, - hr->reply)) - { - TALER_TESTING_interpreter_fail (rrs->is); - return; - } rrs->num_fresh_coins = rmr->details.ok.num_coins; rrs->psa = GNUNET_new_array (rrs->num_fresh_coins, struct TALER_PlanchetMasterSecretP); @@ -1164,7 +1082,6 @@ melt_cleanup (void *cls, TALER_denom_ewv_free (&rms->blinding_values[i]); GNUNET_free (rms->blinding_values); } - free_expected_ev_sigs (rms); GNUNET_free (rms->melt_fresh_amounts); GNUNET_free (rms); }