feat: cache soroban contracts, decouple notifications, tenant isolation, read replica#794
Merged
Merged
Conversation
7dc3004 to
03bb219
Compare
|
@Ogstevyn Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Summary
ContractCache) influid-serverfor Soroban contract definitions and ledger footprint schemas, with a background eviction task and HTTP endpoints (/contract/definition,/contract/footprint,/contract/cache/stats). TTL is configurable viaCONTRACT_CACHE_TTL_SECS.fluid-serveralert delivery path into a standaloneNotificationEngineTokio background task. The hot request path enqueues events on a bounded channel (NotificationHandle::send); backends (Slack webhook, extensible to SMTP/PagerDuty) consume events asynchronously with no impact on fee-bump latency.tenantIsolationMiddlewareandrequireTenantIdhelper inserverthat extract a verifiedtenantIdfrom the resolved API key and gate all downstream database access to that tenant. AtenantIsolationServiceprovides scoped query helpers (getTenantTransactions,getTenantApiKeys,getTenantWebhookDeliveries,getTenantDailySpend,getTenantById,getTenantQuotaTopUps) that hard-code thetenantIdpredicate.readPrismaclient (server/src/utils/readDb.ts) backed byREAD_REPLICA_URL(falls back toDATABASE_URL). Analytics queries inadminAnalytics.tsare migrated to this client so analytical reads no longer contend with write transactions on the primary database.Test plan
fluid-server: 8 unit tests incontract_cache.rs(#[tokio::test]) covering set/get, TTL expiry, invalidation, eviction, overwrite, and count. 7 unit tests innotifications/mod.rscovering severity labels, serialisation, channel capacity, handle cloning, multi-event processing, and backend name routing.server: Unit tests intenantIsolationService.test.ts(14 cases),tenantIsolation.test.ts(7 cases),readDb.test.ts(5 cases). ExistingadminAnalytics.test.tsupdated to mockreadDbinstead ofdbto reflect the replica switch.docs/for all four features.closes #706
closes #708
closes #702
closes #703