Skip to content

Add support for Polymesh Confidential Assets events#338

Open
F-OBrien wants to merge 1 commit into
alphafrom
confidential-assets
Open

Add support for Polymesh Confidential Assets events#338
F-OBrien wants to merge 1 commit into
alphafrom
confidential-assets

Conversation

@F-OBrien

@F-OBrien F-OBrien commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

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

  • Updated the Readme.md (if required) ?

@F-OBrien F-OBrien requested a review from a team as a code owner July 8, 2026 20:59
@sonarqubecloud

sonarqubecloud Bot commented Jul 8, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant