feat: guard Product CDM signer mapping - #126
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
15 tasks
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.
Outcome
This PR hardens the opt-in Product CDM write path before Dotify attempts real Product-host runtime transactions. A Product CDM write now refuses to submit unless the host-selected signer public key and its derived pallet-revive H160 account match the Product identity that Dotify connected for key/session requests.
Issue and context
Refs #85.
Issue #85 tracks proving Product host compatibility before making Product SDK integrations part of the trusted path. Previous PRs introduced typed runtime read/write ports, an experimental Product CDM/PAPI adapter, Product sr25519 key/session proofs, and typed Classic unlock payment intents. The remaining write risk was identity divergence: a Product host could theoretically expose a signer that is not the same runtime account the UI/backend authenticated for access.
That matters because Classic unlock is a money and entitlement flow. If Product CDM writes eventually submit
musicRoyPayAccess, the paid access must be recorded for the same H160 account Dotify uses for protected-key requests. This PR closes that preflight gap without enabling Product writes in the shipped profile.Local scope document:
docs/backlog/polkadot-product-readiness-and-killer-dapp-roadmap.md.Architecture and key concepts
The write path remains behind
RuntimeWritePort:pallet-revivemaps a 32-byte Product/Substrate-style public key into the H160 account used by the EVM-compatible runtime surface. Dotify already derives that H160 when the user connects with Use Polkadot app. This PR passes that expected H160 into the Product writer setup and checks it before any CDM transaction handle is created.How it works
useCatalognow passes bothproductPublicKeyandevmAddressfor Product-host wallets intocreateRuntimeWriter.runtimeWriterProvidernow imports Product signer APIs through the public@parity/product-sdk/walletexport, derives H160 through@parity/product-sdk/address, and verifies:Any mismatch destroys the signer manager and fails before
createProductCdmContractscan build a transaction-capable resolver.Design decisions and tradeoffs
The default runtime adapter remains
viem. Product CDM writes are still opt-in because Dotify has not yet captured live Product-host evidence for native value forwarding, approval UX, and post-payment access reads.This PR does not bump Product SDK packages even though npm was rechecked on 2026-08-30 and newer Product SDK packages exist. That is deliberate: dependency migration and signer/account safety are different review surfaces. The SDK
0.25.xline should be tested in a dedicated compatibility PR.This PR also does not model CASH settlement. CASH remains an unsupported future rail until PCF/Product confirms how People-chain CASH can settle Asset-Hub runtime entitlements with verifiable evidence.
Security, failure, and operations
Product CDM writes now fail closed on identity/account ambiguity. The host cannot silently submit a runtime transaction for an H160 that differs from the Product identity Dotify connected.
No production environment variable changes are required.
VITE_DOTIFY_RUNTIME_ADAPTER=product-cdmremains a non-default, explicit smoke/test build setting. The published Product profile should stay onviemuntil a real Product host transaction smoke proves:pricePlanckvalue reachesmusicRoyPayAccess;musicAccHasPaidandmusicAccCanAccessread true after inclusion;Review guide
Suggested order
web/src/features/runtime/runtimeWriterProvider.ts- review the signer setup, public SDK import path, H160 derivation, mismatch handling, and fail-closed ordering.web/src/hooks/useCatalog.ts- confirm the Product identity H160 is passed into the writer only for Product-host wallets.web/src/features/runtime/runtimeWriterProvider.test.ts- verify the happy path, public-key mismatch, H160 mismatch, and signer-reported/derived H160 disagreement.docs/operations/product-devnet-deployment.md- review the manual Product CDM write smoke checklist and confirm it does not imply the default Product deployment is write-ready.docs/operations/dependency-security-status.mdand Product roadmap docs - confirm the 2026-08-30 SDK drift is represented without mixing dependency upgrades into this PR.Verify carefully
viem.Validation
npm run test:unit -- src/features/runtime/runtimeWriterProvider.test.ts src/features/runtime/productCdmRuntimeAdapter.test.ts src/features/payments/paymentModel.test.tsnpm run test:unitnpm run test:e2e -- classic-unlock.spec.tsnpm run buildnpm run build:product-devnetnpm run lintApp.tsx/ArtistShell.tsx.git diff --checkKnown limitations and follow-ups
This PR does not close #85. Remaining issue scope:
musicAccHasPaid/musicAccCanAccessfrom the same Product H160;0.25.xin a dedicated compatibility PR;Metadata checklist
Dotify sprints)