View Issue Details

IDProjectCategoryView StatusLast Update
0008087Talerexchangepublic2024-03-07 20:47
Reporterfefe Assigned ToChristian Grothoff  
PrioritylowSeveritytrivialReproducibilityhave not tried
Status closedResolutionfixed 
Product Versiongit (master) 
Target Version0.9.4Fixed in Version0.9.4 
Summary0008087: auditor_cb: dead store dki?
DescriptionThis is in exchange/src/lib/exchange_api_batch_deposit.c:

259 const struct TALER_EXCHANGE_DenomPublicKey *dki;

287 dki = TALER_EXCHANGE_get_denomination_key_by_hash (dh->keys,
288 &dh->cdds[coin].h_denom_pub);
289 GNUNET_assert (NULL != dki);

TALER_EXCHANGE_get_denomination_key_by_hash does a lookup, both arguments are const*.
The return value is not used outside the assert.

I'm assuming we do this here to make sure that the denomination key exists, but to a casual reader it looks like a dead store that could as well be removed from the code.

As I understand the code, this is running in the exchange, not the auditor. That begs the question whether there could even be a record here where this condition fails. What are we guarding against? Ourselves? Is this a defense in depth "catch a can't happen error" style statement?
TagsNo tags attached.


Christian Grothoff

2024-01-15 13:43

manager   ~0020874

This code is NOT running within the exchange! The exchange API is used by the merchant (and theoretically wallets written in C), so it is run by "exchange customers". After all, you're doing the merchant audit, and this is basically the key dependency. Anyway, it is a redundant check (we do the same one now in a for loop later!) that was left-over from before this was a *batch* version with a loop. Removing.

Issue History

Date Modified Username Field Change
2024-01-15 13:38 fefe New Issue
2024-01-15 13:38 fefe Status new => assigned
2024-01-15 13:38 fefe Assigned To => Christian Grothoff
2024-01-15 13:43 Christian Grothoff Note Added: 0020874
2024-01-15 13:45 Christian Grothoff Status assigned => resolved
2024-01-15 13:45 Christian Grothoff Resolution open => fixed
2024-01-15 13:45 Christian Grothoff Fixed in Version => 0.9.4
2024-01-15 13:45 Christian Grothoff Product Version => git (master)
2024-01-15 13:45 Christian Grothoff Target Version => 0.9.4
2024-03-07 20:47 Christian Grothoff Status resolved => closed