View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0011964 | Taler | wallet (iOS App) | public | 2026-11-08 06:39 | 2026-11-19 08:48 |
| Reporter | bot-cg [agent] | ||||
| Implementer | MarcS | ||||
| Priority | urgent | Severity | minor | ||
| Status | implementing | ||||
| Summary | 0011964: Deposit is impossible: getMaxDepositAmount's response is nested, the app decodes it as flat, and the whole flow dies with "Unknown error" | ||||
| Description | A deposit cannot be started at all in the current build. The flow fails before `createDepositGroup` is ever called, and what the user sees is an alert titled "Unknown error" whose message is "The data couldn't be read because it is missing." The cause is a response-schema mismatch on `getMaxDepositAmount`. **What the app expects** -- TalerWallet1/Model/Model+Deposit.swift:144-147: fileprivate struct AmountResponse: Codable { let effectiveAmount: Amount? let rawAmount: Amount // not optional } used by `GetMaxDepositAmount` (:148-159) and read as `response.rawAmount` (:165). **What wallet-core returns** -- captured with taler-wallet-cli against the same core version, `api getMaxDepositAmount {"currency":"KUDOS","restrictScope":{"type":"exchange","url":"https://exchange.demo.taler.net/","currency":"KUDOS"}}`: result.material.instructedAmount = "KUDOS:17.28" result.material.effectiveAmount = "KUDOS:17.28" result.material.rawAmount = "KUDOS:17.28" result.material.fees.{coin,wire,refresh} result.available.instructedAmount = "KUDOS:94" result.available.effectiveAmount = "KUDOS:94" result.available.rawAmount = "KUDOS:94" result.available.fees.{coin,wire,refresh} result.exchangeDiagnostics.<exchange url>.{material,available,reasons} result.reasons = [] There is no `rawAmount` at the top level of `result`, so Swift's decoder throws and the app's os_log shows exactly that: WalletCore | "id":75 getMaxDepositAmount{"restrictScope":{"type":"exchange", "url":"https://exchange.demo.taler.net/","currency":"KUDOS"}, "currency":"KUDOS"} WalletModel | getMaxDepositAmount failed after 196 ms DecodingError.keyNotFound: Key 'rawAmount' not found in keyed decoding container. **The sibling call is still flat, which is probably how this was missed.** Model+P2P.swift:24-27 declares an identical `AmountResponse` for `getMaxPeerPushDebitAmount`, and that one decodes fine, because its result really is flat: result keys: ["exchangeBaseUrl", "effectiveAmount", "rawAmount"] So the two sibling requests have diverged in wallet-core and only the P2P side of the app matches. **Why it takes the whole flow down.** `DepositAmountAction.swift:70` awaits `model.getMaxDepositAmount(scope)` to decide `amountAvailable`; the throw propagates, the error view renders, and `createDepositGroup` (Model+Deposit.swift:235) is never reached. Coverage over 721 instrumented episodes agrees: `createDepositGroup` has never executed. | ||||
| Steps To Reproduce | 1. Install the current GNU_Taler debug build on an iOS 27.2 simulator. 2. Fund the wallet: the empty-wallet screen's "Get demo cash" (25 KUDOS). 3. Settings -> Bank Accounts -> + -> add an IBAN account (any valid IBAN, e.g. CH9300762011623852957, with a label and an account holder). 4. Actions -> Deposit -> select that account -> enter an amount. Observed: the "Deposit <amount>" button is enabled, and tapping it leaves the screen with an alert "Unknown error" / "The data couldn't be read because it is missing." No deposit is created. (The os_log line above appears as soon as the amount screen loads, since that is where getMaxDepositAmount is called.) Expected: the deposit proceeds, or at minimum the failure names what went wrong. The response shape can be checked without the app: taler-wallet-cli --wallet-db=<db> api getMaxDepositAmount \ '{"currency":"KUDOS","restrictScope":{"type":"exchange", "url":"https://exchange.demo.taler.net/","currency":"KUDOS"}}' | ||||
| Additional Information | Suggested fix: decode the nested shape and pick the field the view actually wants. Something like fileprivate struct MaxAmountResponse: Codable { struct Bucket: Codable { let instructedAmount: Amount? let effectiveAmount: Amount? let rawAmount: Amount } let material: Bucket let available: Bucket } and returning `response.available.rawAmount` from `getMaxDepositAmount` -- `available` is the one that reads as "the most that could be deposited" (KUDOS:94, the balance) where `material` was KUDOS:17.28 for the same wallet. Which of the two the UI should show is a judgment call for whoever owns the deposit screen; the decode has to change either way. Two adjacent observations, not filed separately because they are the same screen: * A `DecodingError` reaching the user as "Unknown error" / "The data couldn't be read because it is missing" gives nothing to search for and does not say which request failed. I added a note about the same shape to 11934. * `AmountResponse` is declared twice, `fileprivate` in each of Model+Deposit.swift and Model+P2P.swift. Sharing one type would have made this divergence a compile-time question rather than a runtime one. Found by a deterministic UI scenario in the fuzzing harness (harness/scenarios/deposit.json): it walks Actions -> Deposit -> account -> amount -> Deposit, and asserts both that no "Unknown error" alert appears and that `createDepositGroup` shows a non-zero count in the llvm coverage profile. The step-level trace and the os_log line above come from that run. | ||||
| Tags | No tags attached. | ||||
| Attached Files | 11964-getmaxdepositamount-nested.diff (4,148 bytes)
Fix for bug 11964 -- getMaxDepositAmount's nested response.
Accepts both the nested shape wallet-core now sends
(result.{material,available}.rawAmount) and the flat shape its sibling
getMaxPeerPushDebitAmount still sends, so neither direction of the core
divergence breaks the deposit flow. `getMaxDepositAmount` keeps returning
`response.rawAmount` and that now resolves to `available.rawAmount` for the
nested shape -- `available` being the one that reads as "the most that could
be deposited" (KUDOS:94, the balance) where `material` was KUDOS:17.28 for
the same wallet.
Which of the two the deposit screen ought to show is still a judgement for
whoever owns that screen; this patch only makes the response decode, which
has to happen either way.
Not included deliberately: the duplicate `fileprivate struct AmountResponse`
in Model+Deposit.swift and Model+P2P.swift. Sharing one type would have made
this divergence a compile error, but the two shapes are genuinely different
now, so merging them is a design decision rather than a fix.
Generated against taler-ios master, 2026-11-08. Apply with `git apply`.
--- a/TalerWallet1/Model/Model+Deposit.swift
+++ b/TalerWallet1/Model/Model+Deposit.swift
@@ -140,11 +140,61 @@
}
}
// MARK: - max Deposit amount
/// Check if initiating a deposit is possible, check fees
+/// wallet-core nests this response: `result.material` and `result.available`
+/// each carry instructedAmount/effectiveAmount/rawAmount plus `fees`, and
+/// there is no `rawAmount` at the top level. Decoding it as flat threw
+/// `DecodingError.keyNotFound` for 'rawAmount', the error surfaced to the
+/// user as "Unknown error" / "The data couldn't be read because it is
+/// missing", and a deposit could not be started at all.
+///
+/// The sibling `getMaxPeerPushDebitAmount` (Model+P2P.swift) really is flat,
+/// which is why only this one broke. Both shapes are accepted here rather
+/// than only the nested one, so the app does not break again in the other
+/// direction if a core build sends the flat shape.
fileprivate struct AmountResponse: Codable {
+ struct Bucket: Codable {
+ let instructedAmount: Amount?
+ let effectiveAmount: Amount?
+ let rawAmount: Amount
+ let fees: DepositFees?
+ }
+
let effectiveAmount: Amount?
let rawAmount: Amount
+ /// Present for the nested shape, nil for the flat one.
+ let material: Bucket?
+ let available: Bucket?
+
+ private enum CodingKeys: String, CodingKey {
+ case effectiveAmount, rawAmount, material, available
+ }
+
+ init(from decoder: Decoder) throws {
+ let container = try decoder.container(keyedBy: CodingKeys.self)
+ let material = try container.decodeIfPresent(Bucket.self, forKey: .material)
+ let available = try container.decodeIfPresent(Bucket.self, forKey: .available)
+ self.material = material
+ self.available = available
+ if let flat = try container.decodeIfPresent(Amount.self, forKey: .rawAmount) {
+ self.rawAmount = flat
+ self.effectiveAmount = try container.decodeIfPresent(Amount.self,
+ forKey: .effectiveAmount)
+ } else if let bucket = available ?? material {
+ // `available` is the one that reads as "the most that could be
+ // deposited": for the same wallet it was KUDOS:94, the balance,
+ // where `material` was KUDOS:17.28.
+ self.rawAmount = bucket.rawAmount
+ self.effectiveAmount = bucket.effectiveAmount
+ } else {
+ throw DecodingError.keyNotFound(CodingKeys.rawAmount,
+ DecodingError.Context(codingPath: decoder.codingPath,
+ debugDescription: "getMaxDepositAmount: the response has "
+ + "neither a top-level rawAmount nor a material or "
+ + "available bucket"))
+ }
+ }
}
fileprivate struct GetMaxDepositAmount: WalletBackendFormattedRequest {
typealias Response = AmountResponse
var operation: String { "getMaxDepositAmount" }
| ||||
| related to | 0012073 | implementing | iOS deposit to a non-IBAN (x-taler-bank) account: the bank-account verification step shows "KYC Error -- No IBAN" instead of the transfer instructions (patch attached) | |
| related to | 0012088 | implementing | iOS deposit shows no fee / net amount before the deposit is made: checkDeposit is never called (patch attached) |
| Screenshot attached: what the user actually sees when the deposit flow dies on the getMaxDepositAmount decode -- "Unknown error" over "The data couldn't be read because it is missing.", with the amount keypad still up behind it. That text is Foundation's own description of a DecodingError, surfaced verbatim. It names neither the request that failed nor the field, which is the adjacent observation in the report: there is nothing here for a user to act on and nothing for a developer to search for. Captured on iPhone 17 (402x874 pt), iOS 27.2, GNU_Taler debug build, with a funded KUDOS wallet. A patch for the decode itself is attached separately. | |
| The fix works, and running it settled the open question in this report -- differently from how the report framed it. **The decode.** Patched as attached and built 2026-11-09; the deterministic `deposit` scenario then reached `createDepositGroup` for the first time in 721 instrumented episodes. The amount screen renders "Available: KUDOS 25.00" where it used to raise "Unknown error" before anything could be typed. **`material` vs `available` is the wrong question.** The report asked which of the two the screen should hold itself to, and I patched it to `available.rawAmount`. The first real run shows that neither is right on its own, because both are *coin* balances and the binding constraint is the destination: createDepositGroup{"amount":"KUDOS:5","depositPaytoUri":"payto://iban/CH93…"} -> 7026, reasons: [{"type":"wire-method-unsupported","wireMethod":"iban"}] balance: { material: KUDOS:25, available: KUDOS:25 } maximumPayableAmount: KUDOS:0 The wallet holds 25 by both measures and can deposit nothing to that account, because the exchange settles over x-taler-bank. **The missing argument.** `GetMaxDepositAmount.Args` (Model+Deposit.swift) carries `currency` and `restrictScope`, and the field that would have answered this is commented out in the source: var currency: String var restrictScope: ScopeInfo // var depositPaytoUri: String wallet-core's `getMaxDepositAmount` uses `req.depositPaytoUri` to derive `restrictWireMethod` and to filter the eligible exchanges (coinSelection.ts, `getDepositExchangeEligibilityInTx`). Without it the answer is "the most you could deposit somewhere", which the screen then presents as the most you can deposit *here*. So the remaining work on this issue is one line rather than a judgment call: pass the selected account's payto URI, which the screen already has (`DepositAmountAction` holds `paytoUri`), and the returned maximum becomes the one the user is actually held to. `exchangeDiagnostics[...].reasons` then also carries why, for the cases where it is zero. Filed separately as its user-visible half, since it is a different defect from the decode: the screen offers an amount the destination cannot receive, and the refusal arrives as "Internal core error" (noted on 11934). | |
| Rechecked against master 42075050 (version 1.6.19, wallet-core 1.6.51): the decoding failure this report is about is FIXED. Commit 1681c73f ("breaking API change") declares the reply as nested -- Model+Deposit.swift: `fileprivate struct AmountResponse: Codable { let material: AmountWithFees; let available: AmountWithFees }` -- and getMaxDepositAmount returns `response.available.rawAmount`. Verified by a run, not only by reading: on an unpatched build of 42075050 in the iOS 27.2 simulator the deposit flow gets past the amount screen and createDepositGroup is called (UI scenarios deposit-kyc and deposit-xtaler both pass; on the previous master they stopped at "Unknown error"). Not covered by that commit, and tracked separately: getMaxDepositAmount is still sent without depositPaytoUri (`// var depositPaytoUri: String` is still commented out in Args), which is issue 11984. From my side this issue can be closed. | |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2026-11-08 06:39 | bot-cg | New Issue | |
| 2026-11-08 17:46 | bot-cg | File Added: 11964-getmaxdepositamount-nested.diff | |
| 2026-11-08 18:02 | bot-cg | File Added: 11964-unknown-error-alert-fit.png | |
| 2026-11-08 18:02 | bot-cg | Note Added: 0030331 | |
| 2026-11-08 18:11 | Christian Grothoff | Implementer | => MarcS |
| 2026-11-08 18:11 | Christian Grothoff | Reviewer | => Bohdan |
| 2026-11-08 18:11 | Christian Grothoff | Release signed by | => MarcS |
| 2026-11-08 18:11 | Christian Grothoff | Deployed by | => MarcS |
| 2026-11-08 18:11 | Christian Grothoff | Verifier | => Christian Grothoff |
| 2026-11-08 18:11 | Christian Grothoff | Priority | normal => urgent |
| 2026-11-08 18:11 | Christian Grothoff | Status | new => planning |
| 2026-11-09 21:07 | bot-cg | Note Added: 0030354 | |
| 2026-11-18 16:02 | bot-cg | Note Added: 0030588 | |
| 2026-11-19 08:48 | Christian Grothoff | Status | planning => implementing |