Skip to content

fix: read node certification from NodeStored event payload#214

Open
sameh-farouk wants to merge 1 commit intomaster-cleanup-improvementsfrom
master-fix-node-certification
Open

fix: read node certification from NodeStored event payload#214
sameh-farouk wants to merge 1 commit intomaster-cleanup-improvementsfrom
master-fix-node-certification

Conversation

@sameh-farouk
Copy link
Copy Markdown
Member

@sameh-farouk sameh-farouk commented Apr 1, 2026

Summary

Fixes #193 — inconsistent node certification between chain and GraphQL.

nodeStored hardcoded certification = Diy and never read the actual value from the NodeStored event payload. Since spec v107, create_node assigns certification from the farming policy (which can be Certified), but the processor ignored it.

Root cause

On-chain, _create_node sets new_node.certification = farming_policy.node_certification and emits NodeStored with the full node struct. The processor received this event but always stored Diy. No NodeCertificationSet event is emitted on node creation (never has been, in any spec version), so there was no other path to capture the initial certification.

Verification

All 26 affected devnet nodes are associated with farming policy 3 (nodeCertification: Certified), confirming the root cause.

Fix

Read certification from the NodeStored event payload for each version that includes it:

  • v9: no certification field → Diy default preserved (correct)
  • v28/v43: reads certificationType.__kind via parseNodeCertification
  • v63/v105: reads certification.__kind via parseNodeCertification
  • v118: reads certification.__kind via parseNodeCertification

This matches the pattern already used in nodeUpdated.

Regression safety

  • Only one isVxx branch executes per event (mutually exclusive hash checks)
  • The Diy default (line 75) is set before any version-specific block, so it's always overridden for v28+
  • v9 nodes are unaffected — no certification field exists, default Diy is correct
  • nodeUpdated and nodeCertificationSet handlers are unchanged
  • npm run build passes

Test plan

  • npm run build passes
  • Re-index devnet and verify the affected nodes now show Certified

@sameh-farouk sameh-farouk linked an issue Apr 2, 2026 that may be closed by this pull request
@sameh-farouk sameh-farouk force-pushed the master-cleanup-improvements branch from ada6153 to f5de569 Compare April 3, 2026 23:08
@sameh-farouk sameh-farouk force-pushed the master-fix-node-certification branch from 3936a00 to 87bda91 Compare April 3, 2026 23:08
@sameh-farouk sameh-farouk force-pushed the master-cleanup-improvements branch 2 times, most recently from 4efd53f to 23cb0b5 Compare April 4, 2026 01:12
@sameh-farouk sameh-farouk force-pushed the master-fix-node-certification branch from 87bda91 to 89ea8cc Compare April 4, 2026 01:12
nodeStored hardcoded certification to Diy and never read the actual
value from the event payload. Since spec v107, create_node assigns
certification from the farming policy (which can be Certified), but
the processor ignored it. Nodes created under a Certified farming
policy showed as Diy in GraphQL.

Now reads certification from the event for all versions that include
it: certificationType for v28/v43, certification for v63/v105/v118.
The v9 default (Diy) is preserved since v9 Node has no certification
field. This matches the pattern already used in nodeUpdated.

Fixes: #193

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sameh-farouk sameh-farouk force-pushed the master-cleanup-improvements branch from 23cb0b5 to 8ff1cc7 Compare April 6, 2026 14:43
@sameh-farouk sameh-farouk force-pushed the master-fix-node-certification branch from 89ea8cc to 5a438e7 Compare April 6, 2026 14:43
@sameh-farouk
Copy link
Copy Markdown
Member Author

Tested on a test vm
19 nodes now correctly Certified, matching tfcahin:
62, 74, 75, 102, 126, 170, 173, 174, 175, 178, 180, 181, 182, 184, 186, 386, 387, 388, 389
All 32 production Certified nodes remain Certified on test (superset, no regressions).

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.

inconsistent node certification type between chain and graphql

1 participant