View Issue Details

IDProjectCategoryView StatusLast Update
0012282Talerauditorpublic2026-11-21 23:08
Reporterbot-oec [agent]  
Implementeroec  
PrioritynormalSeveritymajor 
Status implementing 
Target Version1.7 
Summary0012282: The auditor's coin check credits one deposit fee for any refund, so over-credited coins pass it
DescriptionA refund credits the coin its value less the refund fee; the deposit fee is waived at the wire transfer, not returned to the coin. `taler-helper-auditor-coins.c` credits one deposit fee as soon as a coin has any refund ("If we gave any refund, also discount ONE deposit fee"): after a full refund, as the exchange currently does, but also after a partial refund, where the exchange credits no deposit fee. (Purse refunds no longer set it since 7f43c9292.)

The per-coin check (per coin, debits never exceed its value plus its credits) therefore accepts a coin credited up to one deposit fee too much. The exchange currently credits the deposit fee on top after a full refund, and such a coin passes the per-coin check. Other checks still catch it once the coin spends the extra credit: the denomination's escrow balance runs short ("subtracting amount from escrow balance") and an emergency reports the loss. Once the exchange no longer credits the deposit fee on a full refund, the second deposit below is refused and the scenario no longer arises.

**Steps to reproduce:** found by reading the code. On an exchange that credits the deposit fee on top after a full refund, a coin of EUR:5 deposited in full, refunded in full and deposited in full again is caught by the escrow balance check (exchange EUR:4.99, auditor EUR:5) and by an emergency (loss EUR:5), but the per-coin check reports nothing for it; it would report the coin (a "deposit" record) without the extra deposit-fee credit. A test that requires the per-coin record may follow.

**Proposed fix:** credit a refund with its value less the refund fee only (`taler-helper-auditor-coins.c`). With it the test above and the auditor's other tests pass.

**Found by:** the formalization of the Taler protocols; the rule violated is (A1) "coin" in `spec/auditor.md` together with RD4 in `spec/refund.md`: per coin, debits never exceed its value plus credits, and a refund credits the coin its value less the refund fee.
TagsNo tags attached.

Required notifications

Address or linkRemarkAdded byNotifiedActions

Activities

bot-oec [agent]

2026-11-21 23:08

reporter   ~0030717

Proposed patch (exchange master ba48fdeac; test-auditor.sh passes with it, 328 checks). check_coin_history credits a refund with its amount less the refund fee only; the extra deposit fee for any refund goes, with the two variables only it used. With #12265 fixed in the exchange, the exchange and the auditor then agree; until then the auditor reports coins that spend the deposit fee credited on a full refund.

diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c
index d93eb2b1a..290ab4623 100644
--- a/src/auditor/taler-helper-auditor-coins.c
+++ b/src/auditor/taler-helper-auditor-coins.c
@@ -556,8 +556,6 @@ check_coin_history (const struct TALER_CoinSpendPublicKeyP *coin_pub,
   struct TALER_Amount total;
   struct TALER_Amount spent;
   struct TALER_Amount refunded;
- struct TALER_Amount deposit_fee;
- bool have_refund;
   uint64_t etag_out;
 
   /* FIXME-Optimization: could use 'etag' mechanism to only fetch transactions
@@ -585,10 +583,6 @@ check_coin_history (const struct TALER_CoinSpendPublicKeyP *coin_pub,
   GNUNET_assert (GNUNET_OK ==
                  TALER_amount_set_zero (value->currency,
                                         &spent));
- GNUNET_assert (GNUNET_OK ==
- TALER_amount_set_zero (value->currency,
- &deposit_fee));
- have_refund = false;
   for (struct TALER_EXCHANGEDB_TransactionList *pos = tl;
        NULL != pos;
        pos = pos->next)
@@ -600,7 +594,6 @@ check_coin_history (const struct TALER_CoinSpendPublicKeyP *coin_pub,
       TALER_ARL_amount_add (&spent,
                             &spent,
                             &pos->details.deposit->amount_with_fee);
- deposit_fee = pos->details.deposit->deposit_fee;
       break;
     case TALER_EXCHANGEDB_TT_MELT:
       /* spent += pos->amount_with_fee */
@@ -616,7 +609,6 @@ check_coin_history (const struct TALER_CoinSpendPublicKeyP *coin_pub,
       TALER_ARL_amount_add (&spent,
                             &spent,
                             &pos->details.refund->refund_fee);
- have_refund = true;
       break;
     case TALER_EXCHANGEDB_TT_RECOUP_REFRESH_RECEIVER:
       /* refunded += pos->value */
@@ -654,13 +646,10 @@ check_coin_history (const struct TALER_CoinSpendPublicKeyP *coin_pub,
       break;
     } /* switch (pos->type) */
   } /* for (...) */
- if (have_refund)
- {
- /* If we gave any refund, also discount ONE deposit fee */
- TALER_ARL_amount_add (&refunded,
- &refunded,
- &deposit_fee);
- }
+ /* A refund credits its amount less the refund fee; no deposit fee is
+ credited to the coin (it is waived at the wire transfer, and a purse
+ refund's amount contains it). Discounting one deposit fee for any
+ refund let coins spend more than they have. */
   /* total coin value = original value plus refunds */
   TALER_ARL_amount_add (&total,
                         &refunded,

Issue History

Date ModifiedUsernameFieldChange
2026-11-21 10:28bot-oecNew Issue
2026-11-21 10:28bot-oecImplementer => oec
2026-11-21 10:28bot-oecReviewer => Christian Grothoff
2026-11-21 10:28bot-oecRelease signed by => Antoine A
2026-11-21 10:28bot-oecDeployed by => Florian Dold
2026-11-21 10:28bot-oecVerifier => oec
2026-11-21 10:28bot-oecCommunicator => CM_7
2026-11-21 16:17oecImplementeroec =>
2026-11-21 16:17oecRelease signed byAntoine A => Florian Dold
2026-11-21 16:17oecVerifieroec => Florian Dold
2026-11-21 22:46Christian GrothoffImplementer => oec
2026-11-21 22:46Christian GrothoffStatusnew => implementing
2026-11-21 22:46Christian GrothoffTarget Version => 1.7
2026-11-21 22:46Christian GrothoffView Statusprivate => public
2026-11-21 23:08bot-oecNote Added: 0030717