Skip to content

fix(currency-math): pack the curve tables into the app again - #1908

Merged
bmc08gt merged 1 commit into
code/cashfrom
fix/curve-tables-assets
Oct 30, 2026
Merged

bmc08gt merged 1 commit into
code/cashfrom
fix/curve-tables-assets

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Every launch of 2026.10.5 (4969) crashes with DiscreteBondingCurve not initialized (Bugsnag 6aadeebd, 7 events in 3 minutes on 10-30). Production 2026.10.3 predates the cause and isn't affected.

#1894 moved :libs:currency-math onto the KMP android target and its tables to src/androidMain/assets. That target skips res and assets unless androidResources { enable = true } is set, which the nine other KMP modules with Android resources already do. The 4969 AAB has no discrete_*.bin, so Curves.initialize fails inside launchBestEffort, and TokenController.buildTokenWithBalance hits DiscreteBondingCurve.getOrThrow().

Changes:

  • Enable androidResources in libs/currency-math/build.gradle.kts. The debug APK now contains both tables.
  • Add check<Variant>CurveAssets in the app, which reads SingleArtifact.ASSETS and fails when a table is missing. flipcashTestDebug runs the debug check, so PR CI catches it; assembleRelease and bundleRelease depend on the release check. With the flag removed, the check fails and names both files.

Moving :libs:currency-math onto the KMP android target in #1894 put the
curve tables in src/androidMain/assets, but that target skips assets
unless androidResources is enabled. Build 4969 shipped without
discrete_pricing_table.bin and discrete_cumulative_table.bin, so the
curve never initialized and every launch crashed on the first token
balance with "DiscreteBondingCurve not initialized" (Bugsnag 6aadeebd).

Enable androidResources for the module, and add a per-variant
check<Variant>CurveAssets task that fails when either table is missing
from the app's merged assets. flipcashTestDebug runs the debug check,
and assembleRelease and bundleRelease depend on the release one, since
the build itself succeeds without the tables.
@bmc08gt bmc08gt self-assigned this Oct 30, 2026
@bmc08gt
bmc08gt merged commit 49dfdbf into code/cash Oct 30, 2026
6 checks passed
@github-actions github-actions Bot added area: build-system Gradle, convention plugins, build-logic type: fix Bug fix labels Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: build-system Gradle, convention plugins, build-logic type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant