Add support for Polymesh Confidential Assets events#338
Open
F-OBrien wants to merge 1 commit into
Open
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.



Description
What changed
schema.graphql — Removed the 9 v1 entities (ConfidentialVenue, ConfidentialTransaction, ConfidentialAssetHolder, ConfidentialAssetHistory, ConfidentialAssetMovement, etc.) plus their confidential-only enums/jsonFields. Kept AffirmStatusEnum (used by regular settlements) and reused AffirmingPartyEnum. Added 8 new entities:
ConfidentialSettlement — id is the settlement ref (hash of the creation proof), with memo, assetRootBlock, legCount, and status (Pending/Executed/Rejected/Finalized)
ConfidentialLeg — stores each leg's SCALE-encoded encrypted data as hex. This is the critical piece: settlement.rs::finalize() deletes legs, memo, and all affirmation statuses from chain storage, so the indexer is a durable record
ConfidentialLegAffirmation — latest per-party per-leg status; mediators keyed by key index
ConfidentialCurveTreeLeaf — leaves of the Asset/Account/FeeAccount curve trees (needed to rebuild trees for proof generation; asset-tree leaves update in place, the others are append-only)
ConfidentialAccount, ConfidentialEncryptionKey, ConfidentialAsset (name/symbol/decimals/data, mediator key pairs, auditor keys, totalSupply), ConfidentialAccountAsset
Mappings — the four files in src/mappings/entities/confidentialAssets/ were replaced with mapConfidentialAccount, mapConfidentialAsset, mapConfidentialSettlement, and mapConfidentialCurveTree. One handler covers all eight leg-affirmation events, mapping them to party + status (e.g. SenderCounterUpdated/ReceiverClaimed → Finalized, *AffirmationReverted → Reverted), which also converges correctly for the instant-settlement flow that emits Affirmed followed by the finalizing event.
project.ts — the old confidentialAsset module keeps only generic event indexing (it never ran on a production chain); all new-pallet events are wired, with fee-account POLYX movements, relayer batches, and curve-tree root events intentionally left to the generic events table (roots expire by design and are derivable from leaves).
No DB migration needed — subql-node v6 auto-creates/drops entity tables and enum types on schema upgrade, and the new event/call enum values were already added in migration 14.
Verification
25 new unit tests in tests/unit/confidentialAssetHandlers.test.ts covering every handler including update paths and error cases — full unit suite passes (126 tests, 7 suites)
yarn build and yarn lint both clean; tsc --noEmit shows only a pre-existing @types/rimraf issue that exists on the clean tree too
Breaking Changes
JIRA Link
Checklist