Skip to content

fix: resolve claim dividends' signing Identity from the Procedure's own Context - #1663

Merged
polymesh-bot merged 2 commits into
developfrom
fix/claim-dividends-wrong-context-identity
Aug 27, 2026
Merged

fix: resolve claim dividends' signing Identity from the Procedure's own Context#1663
polymesh-bot merged 2 commits into
developfrom
fix/claim-dividends-wrong-context-identity

Conversation

@prashantasdeveloper

Copy link
Copy Markdown
Contributor

Summary

prepareClaimDividends called distribution.getParticipant() with no arguments, letting it default the identity to check via distribution.context.getSigningIdentity(). But the DividendDistribution entity carries whatever Context it happened to be fetched with, which is not necessarily the Procedure's own per-call Context (context.clone(), scoped to this call's signingAccount).

Any consumer that fetches entities off one shared/long-lived Context while overriding signingAccount per call — the polymesh-rest-api being the clearest example — hit this: claim() silently checked participation for whatever Identity the shared Context's signingAddress last happened to point to, instead of the Identity actually signing the claim. The result was a deterministic 'The signing Identity is not included in this Distribution' rejection for a genuine, funded participant.

Root cause, confirmed live

Reproduced end-to-end against a real chain v8 node + polymesh-rest-api, with temporary debug instrumentation in the running REST API's SDK copy:

[DEBUG prepareClaimDividends] { procedureSigningAddress: '...B4W4' (the claimant), distributionContextSigningAddress: '...jorVM' (unrelated), sameContext: false }
[DEBUG getParticipant] resolved { resolvedIdentityDid: '0xc64af9...', balance: '0', isTarget: false, isExclusion: true }

getParticipant() was resolving an entirely unrelated Identity (0 balance) via the stale shared Context, not the claimant. This also explains why a checkpoint-balance lookup and an equivalent pushBenefit payment (which takes explicit DIDs, never defaulting via signing identity) were both unaffected.

Fix

Resolve the signing Identity from the Procedure's own context explicitly and pass it into getParticipant({ identity }), so the Identity checked is always the one actually signing this call.

Test plan

  • Existing unit tests (claimDividends, DividendDistribution, Checkpoint) pass unmodified
  • tsc/eslint clean
  • Verified live: patched a running polymesh-rest-api container's SDK copy with this exact fix and reran PolymeshAssociation/polymesh-dev-env's corporate-actions/dividend-distributions suite (restoring its previously-removed self-claim step) against a real chain v8 node — 13/13 passing, including the claim step

F-OBrien
F-OBrien previously approved these changes Aug 27, 2026
prepareClaimDividends called distribution.getParticipant() with no args,
letting it default the identity to check off distribution.context - the
Context the DividendDistribution entity happened to be fetched with. That
Context is not necessarily this Procedure's own Context (context.clone()
scoped to this call's signingAccount), so any consumer that fetches
entities off a shared Context while overriding signingAccount per call
(e.g. the REST API) had claim() silently check participation for whatever
Identity that shared Context's signingAddress last pointed to, instead of
the Identity actually signing the claim - failing with 'The signing
Identity is not included in this Distribution' even for a genuine
participant.

Resolve the signing Identity from the Procedure's own Context explicitly
and pass it into getParticipant() so the correct Identity is always the
one checked.
@prashantasdeveloper
prashantasdeveloper force-pushed the fix/claim-dividends-wrong-context-identity branch from a844b29 to 6f13f8b Compare August 27, 2026 09:06
@sonarqubecloud

Copy link
Copy Markdown

@prashantasdeveloper

Copy link
Copy Markdown
Contributor Author

/fast-forward

@polymesh-bot
polymesh-bot merged commit 56c8e37 into develop Aug 27, 2026
17 checks passed
@polymesh-bot
polymesh-bot deleted the fix/claim-dividends-wrong-context-identity branch August 27, 2026 09:28
@polymesh-bot

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 31.1.0-beta.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants