View Issue Details

IDProjectCategoryView StatusLast Update
0012266Talerexchangepublic2026-11-22 09:37
Reporterbot-oec [agent]  
PrioritynoneSeverityminor 
Status acknowledged 
Summary0012266: Refunds of a coin deposited twice into one contract are bounded by one deposit
DescriptionRefunds of a coin for a contract should be bounded by the sum of that coin's deposits into the contract. `src/exchangedb/do_refund.sql` reads one `coin_deposits` row with `SELECT INTO`. When a coin was deposited twice into the same contract, the bound is that one row's amount, and a refund up to the sum is refused.

**Steps to reproduce:**

1. Deposit one coin twice into the same contract of one merchant, EUR:1 and EUR:2: both 200.
2. Refund EUR:3 with a fresh transaction id (so it is not an inconsistent replay): expected 200, gets 409 (the refund exceeds the deposit row read).

The test `src/testing/test_exchange_api_refund_bound.c` does this; it fails on master at step 2 (expects 200, gets 409). The test will be on branch `dev/oec/formalization-findings` on git.taler.net; a note here will name the commit.

**Proposed fix:** the bound alone is not enough. Refund rows reference one deposit row, and the aggregator caps the merchant's share per deposit row: a refund of EUR:3 recorded on the EUR:1 row would leave the EUR:2 row to be paid out, while the coin got EUR:3 back. A fix has to split a refund over the contract's deposit rows of the coin, or refuse a second deposit of a coin into the same contract.

**Found by:** the formalization of the Taler protocols; the rule violated is (E1) in `spec/refund.md`: refunds of a coin for a contract are bounded by the sum of that coin's deposits into the contract.
TagsNo tags attached.

Required notifications

Address or linkRemarkAdded byNotifiedActions

Activities

bot-oec [agent]

2026-11-21 10:47

reporter   ~0030667

Test: branch `dev/oec/formalization-findings` of exchange.git (git.taler.net), commit a1177870731e "testing: refunds of a coin deposited twice into one contract (0012266)", on master 7b658d8da.

test_exchange_api_refund_bound_{cs,rsa} deposits one coin twice into one contract (EUR:1 and EUR:2) and refunds EUR:3 with a fresh transaction id: expected 200, gets 409 (the refund exceeds the one deposit row read).

Fails on master at refund-both.

Christian Grothoff

2026-11-21 22:37

manager   ~0030709

Not convinced we care. This should basically not happen in practice, partially spent coins are refreshed, not then deposited again.

bot-oec [agent]

2026-11-22 09:37

reporter   ~0030762

https://git-www.taler.net/exchange.git/log/?h=dev/oec/formalization-findings

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 => Christian Grothoff
2026-11-21 10:28bot-oecDeployed by => Christian Grothoff
2026-11-21 10:28bot-oecVerifier => oec
2026-11-21 10:28bot-oecCommunicator => CM_7
2026-11-21 10:47bot-oecNote Added: 0030667
2026-11-21 22:37Christian GrothoffStatusnew => acknowledged
2026-11-21 22:37Christian GrothoffNote Added: 0030709
2026-11-21 22:38Christian GrothoffView Statusprivate => public
2026-11-21 22:38Christian GrothoffPrioritynormal => none
2026-11-22 09:37bot-oecNote Added: 0030762