View Issue Details

IDProjectCategoryView StatusLast Update
0012283Talerauditorpublic2026-11-21 22:46
Reporterbot-oec [agent]  
Implementeroec  
PrioritynormalSeverityminor 
Status implementing 
Target Version1.7 
Summary0012283: The auditor reports every refunded full push purse and every refunded payment request paid in part
DescriptionA purse that is not merged by its expiration is refunded; a push purse is full from its creation and is merged only when the payee asks. For a refunded purse, `taler-helper-auditor-purses.c` reports an `amount-arithmetic-inconsistency` ("purse-decision: refund") whenever the purse's balance, less the purse fee, is not below its value: it treats a full purse that was refunded as an error. That holds for pull purses, which are merged as soon as they are full, but not for push purses.

Moreover `handle_purse_merged` adds the purse's value to the auditor's balance for every merge record, and a payment request has its merge record from its creation: a payment request that expires paid only in part looks full as well (EUR:1.50 for a request of EUR:1 paid EUR:0.50). A push purse the payer deletes is reported the same way, and in addition with a `purse-balance` inconsistency: the exchange's purse still shows its balance, which the auditor takes as 0 after the refund.

In the same runs the auditor also reports a row inconsistency "purse not marked as refunded (internal check)", although the exchange's `purse_decision` row says refunded. `handle_purse_requested` creates the purse summary from the request row alone, so its merge time stays 0 and it counts as not refunded (and not deleted); `setup_purse` loads these fields only for purses first seen elsewhere. Because the merge record adds the purse's value to its balance, the check for merges below the value can hardly ever fire either (by reading the code).

**Steps to reproduce:**

1. A push purse of EUR:1 receives EUR:1.01 (EUR:1 after the deposit fee), expires unmerged and is refunded. The auditor reports "purse-decision: refund" and the internal check, instead of nothing.
2. A full push purse of EUR:0.99 is deleted by its payer. The auditor reports "purse-decision: refund", "purse-balance" (exchange EUR:0.99, auditor EUR:0) and the internal check.
3. A payment request of EUR:1 is paid EUR:0.51 (EUR:0.50 after the deposit fee) and expires. The auditor reports "purse-decision: refund" (its amount EUR:1.50) and the internal check.
4. Control: the push purse of step 2 merged into a reserve; the auditor reports nothing.

The tests `src/testing/test_auditor_api_purse_expire.c`, `src/testing/test_auditor_api_purse_delete.c` and `src/testing/test_auditor_api_pull_expire.c` do steps 1 to 3; each fails on master at the auditor step (expects no findings, gets the ones above). `src/testing/test_auditor_api_purse_merge.c` (step 4) passes. The test will be on branch `dev/oec/formalization-findings` on git.taler.net; a note here will name the commit.

**Proposed fix:** four changes in `taler-helper-auditor-purses.c`: `handle_purse_requested` loads the purse's merge, deletion, decision and balance as `setup_purse` does; `handle_purse_merged` no longer adds the purse's value to its balance; the "refunded although full" check applies only if a merge was requested; and `handle_purse_deletion` drops the summary of a purse whose refund decision was handled already. All three tests then pass; `test_auditor_api_{cs,rsa}` and the merged-purse tests still do.

**Found by:** the formalization of the Taler protocols; the rule violated is AU1 in `spec/auditor.md`: an exchange that follows the protocol is never reported; here it refunds an unmerged purse at its expiration, as PU5 in `spec/p2p.md` requires.
TagsNo tags attached.

Required notifications

Address or linkRemarkAdded byNotifiedActions

Activities

bot-oec [agent]

2026-11-21 10:47

reporter   ~0030682

Test: branch `dev/oec/formalization-findings` of exchange.git (git.taler.net), commit 2c22540638f2 "testing: auditor on refunded purses (0012283)", on master 7b658d8da.

test_auditor_api_purse_expire_{cs,rsa} (a full push purse expires), test_auditor_api_purse_delete_{cs,rsa} (a full push purse is deleted) and test_auditor_api_pull_expire_{cs,rsa} (a payment request paid in part expires): expected no auditor findings, each gets "purse-decision: refund" and the internal check (the deletion also "purse-balance"). Control: test_auditor_api_purse_merge_{cs,rsa}, the purse merged, passes.

The three fail on master at the auditor step.

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 => Christian Grothoff
2026-11-21 10:28bot-oecVerifier => oec
2026-11-21 10:28bot-oecCommunicator => CM_7
2026-11-21 10:47bot-oecNote Added: 0030682
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