fix(payment): skip the Solana balance check when no Tatum API key is configured#4203
Open
Danswar wants to merge 2 commits into
Open
fix(payment): skip the Solana balance check when no Tatum API key is configured#4203Danswar wants to merge 2 commits into
Danswar wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The hourly
PaymentBalanceServiceSolana balance check on dev fails on every run:The error text reads like a subscription-tier problem, but the actual root cause is that
TATUM_API_KEYis not set on dev at all:cardanoTatumApiKey=TATUM_API_KEY), and its warn — "Cardano has no Tatum API key configured — skipping pay-in check" — fires on dev after every boot and never on prod.solana-mainnet.gateway.tatum.ioreproduces the error byte-identically: Tatum's anonymous tier serves basic JSON-RPC (getSlotworks) but gatesgetBalance.So dev's Solana client has been calling Tatum anonymously, and the only method that minds is the one the hourly balance check needs. #3878 scoped Solana out of the unconfigured-guard on the grounds that it made no unprompted Tatum calls — the hourly
PaymentBalanceServicecheck (via the finance-log cron) is exactly such a call, so that assumption no longer holds.What
Extends the #3878 pattern to this caller:
BlockchainClientbase:get isConfigured()(defaulttrue) — same semantics asCardanoClient's existing getter.SolanaClientoverride: Tatum API key present.PaymentBalanceService.getPaymentBalances: the existing not-configured warn-once-and-skip branch now also covers a client that exists but is unconfigured.Prod (key set) is unchanged, and a key that is set but rejected still errors — a real misconfiguration stays visible. Tron is deliberately not gated: its keyless balance calls show no failures on dev.
Companion: DFXServer/server#730 provisions a Grafana alert on the not-configured warn scoped to prod, so a
TATUM_API_KEYlost on prod (where the guard would otherwise reduce it to one boot-time warn) still pages.Replaces the
PaymentBalanceServicehalf of #4200 (suppressed the provider error string in shared code) and #4202 (RPC-provider swap built on the wrong "paid plan lacks the method" premise) — both closed.Test plan
payment-balance.service.spec.ts: unconfigured client → skipped, single warn, no error; configured client → balances fetched; configured client whose call rejects → still throws / logs ERROR (locks the set-but-rejected contract). 3/3 passingtsc --noEmit/ prettier cleanBlockchain client not configured for Solanawarn per boot instead