Repository navigation
feat(dashpay): resolve the DashConnect contract per network - #1133
romchornyi wants to merge 2 commits into
Conversation
**DashConnect's availability was a test-network check, but what it needs is a contract.** Logging in to an app publishes a `loginKeyResponse` document to the key-exchange data contract, and a contract id only exists on the chain it was registered on. The gates asked `isTestNetwork` instead, asserted testnet or devnet, and mapped every non-devnet network to a testnet runtime — so mainnet could only ever be switched on by editing five places at once, and the mapping would have silently expected a testnet runtime for a mainnet data source. `DashConnectNetworkConfiguration` is now the one place that answers it: testnet has the pinned key-exchange contract, a devnet takes its id from Devnet Settings and reports a normal error while it is unset, and mainnet has no id — the contract is not deployed there yet — so DashConnect stays unavailable on mainnet exactly as before. Availability, the data source's contract id, and the runtime network it expects all come from that configuration. Pinning the mainnet id there is what will make the feature available. **App branding is per network.** The fallback name for a known app was keyed by its contract id alone; an app's id differs on every chain, so the table is now keyed by network, and a testnet id no longer brands a request on another network. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🕓 Review not started yet because this PR is a draft.
Commit 5cbfedc. Normal review starts when eligible; priority review starts as soon as a slot is available. |
|
Closing: superseded by #1202. Since protocol 14 the key-exchange documents go to the App Connect system contract (platform#4869), whose id is the same on every network, so there is no per-network contract id left to resolve. Whether DashConnect is offered on mainnet stays a product decision, gated in one place in #1202 ( |
Issue being fixed or feature implemented
DashConnect's availability was decided by whether the app is on a test network. What it actually needs is the key-exchange data contract. Logging in to an app publishes a
loginKeyResponsedocument to that contract, and a contract id only exists on the chain it was registered on.The test-network check was spread across five places:
isTestNetwork, two testnet/devnet asserts, and a runtime-network mapping that treated every non-devnet network as testnet. Enabling mainnet would have meant editing all five, and the mapping would have expected a testnet runtime for a mainnet data source.This stays a draft, and the reason is external to the code. The key-exchange contract is not deployed on mainnet, so this PR deliberately leaves DashConnect unavailable there. A contract id is per-network — it is derived from the owner identity and its nonce at registration — so there is no id to look up until someone registers the contract on mainnet; the deployment is being coordinated with the Yappr developer. Once an id exists, pinning it in one constant makes the feature available, subject to product and security sign-off and parity with Android. Android gates DashConnect off in production today (
SUPPORTS_CONNECT = !IS_PROD_BUILD).#1106, which this was previously stacked on, has merged; this branch now carries
developand targets it directly.What was done?
DashConnectNetworkConfigurationis the single per-network source of truth:loginKeyResponsecontract id: testnet pinned; devnet from Devnet Settings, with the existingdevnetLoginContractNotConfigurederror while it is unset; mainnetnilwithTODO(dashconnect-mainnet), which throwsloginContractUnavailableand never guesses an id;isAvailable(on:): whether the network has a key-exchange contract;runtimeNetwork(for:),currentNetwork();knownAppsis keyed by network, and only the testnet Yappr contract is listed.ConnectionsViewModel.featureUnavailableand its data-source assert, thePlatformDashConnectDataSourceinitializer assert and default network,loginKeyExchangeContractId(), and the runtime-network check inrequireContext.ConnectionRequest(loginRequest:)and the platform metadata fallback resolve branding for the request's own network.develop. This PR does not touchDashConnectStore, and after mergingdevelopthe devnet id still resolves throughDevnetConfiguration.dashConnectContractId, whichloginKeyExchangeContractId(for:devnetContractId:)takes as its default.How Has This Been Tested?
developis merged in (684f9305f, which carries feat(wallet): make devnet a selectable network #1106) with no conflicts. Thedashpaytest target builds on the first attempt, and every DashConnect class passes on the simulator in Debug — 111 tests, 0 failures:DashConnectDataSourceTests,DashConnectStoreTests,DashConnectUriTests,KeyExchangeCryptoTests,LoginKeyDerivationTests,PlatformDashConnectDataSourceTests,Secp256k1Tests.A clean merge can still hide a semantic clash, so the contract-id path was re-read after merging rather than assumed: every lookup in
PlatformDashConnectDataSourcestill routes throughDashConnectNetworkConfiguration.loginKeyExchangeContractId(for:), and the devnet id still comes fromDevnetConfiguration.dashConnectContractId, which that method takes as its default argument.New tests in
PlatformDashConnectDataSourceTests:scripts/a11y_audit.py --check: no new findings.Not tested on a device. Behaviour on testnet and devnet is unchanged by construction.
Breaking Changes
None.
Checklist:
For repository code-owners and collaborators only
🤖 Generated with Claude Code