Skip to content

[WIP] feat: Audit missing item for node intergration GetJudgement / Broadcast / Collect Result#910

Open
HanaYukii wants to merge 5 commits intomainfrom
feat/get-judgement-wire-xi
Open

[WIP] feat: Audit missing item for node intergration GetJudgement / Broadcast / Collect Result#910
HanaYukii wants to merge 5 commits intomainfrom
feat/get-judgement-wire-xi

Conversation

@HanaYukii
Copy link
Contributor

@HanaYukii HanaYukii commented Feb 27, 2026

Summary

Implement GetJudgement — the function that lets an auditor verify whether a work-report is honest (GP §17.16–17.17).

How it works:

  1. Fetch the original work-package bundle from the guarantor who made the claim
  2. Re-run the computation using the same PVM pipeline the guarantor used
  3. Compare the result — if it matches, the report is valid; otherwise it's invalid

The PVM execution pipeline is already in place (WorkPackageController.Process()). The missing piece is the networking layer to actually fetch bundles from other nodes, so a stub is used for now. All places that need node-layer wiring are marked with NODE-TODO.

What changed:

File What
fetch_bundle.go New — BundleFetcher interface + stub placeholder
judgement.go New — GetJudgement logic (fetch → re-execute → compare)
auditing.go Updated — added NODE-TODO annotations with integration guidance
work_package.go Updated — exported ComputeErasureRoot for bundle verification

Node-Side TODOs

All tagged NODE-TODO in code. Ref branch: feat/jam-np-ce-handler

Priority Tag What node layer needs to do
🔴 P0 [bundle fetch] Implement BundleFetcher interface (replace StubBundleFetcher in fetch_bundle.go). Fast path: request bundle from guarantor peers via CE using ReportGuarantee.Signatures[].ValidatorIndex. Verify with work_package.ComputeErasureRoot(). Slow path: reconstruct from ≥342 erasure-coded chunks.
🟡 P1 [CE144 send] BroadcastAnnouncement() — send audit announcement + VRF evidence to all validators
🟡 P1 [CE144 recv/sync] UpdateAssignmentMapFromOtherNode() + SyncAssignmentMapFromOtherNodes() — background recv writes to buffer, sync drains buffer per tranche to count no-shows
🟡 P1 [CE145 send] BroadcastAuditReport() — send signed judgment (validity + signature) to all validators
🟡 P1 [CE145 recv/sync] UpdatePositiveJudgersFromOtherNode() + SyncPositiveJudgersFromOtherNodes() — same buffer/drain pattern, feeds into next tranche's ComputeAnForValidator()
🟡 P1 [tranche sync flow] Define how CE144/CE145 recv handlers push to a shared buffer (channel or mutex-guarded map), and how Sync functions drain it. See SingleNodeAuditingAndPublish() Steps 9/16 for call sites.
🟢 P2 [timer] WaitNextTranche() — sleep until slotStart + (tranche+1) * 8s (GP §17.7)

Files changed:

File Change
judgement.go New — core GetJudgement logic
fetch_bundle.go New — BundleFetcher interface + stub
auditing.go Update — clearer code, add NODE-TODO comments
iwork_package.go Update — export ComputeErasureRoot

How GetJudgement works

GetJudgement(auditReport)

├─ Step A: DefaultBundleFetcher.FetchBundle(report)
│ → fetch raw bundle bytes from guarantor (CE) or erasure reconstruction

├─ Step B: work_package.NewSharedController(bundleBytes, coreIndex).Process()
│ → decode bundle → ΨI (is-authorized) → ΨR per work-item → assemble WorkReport
│ → all PVM infrastructure already in place

└─ Step C: workReportsEqual(recomputed, original)
→ canonical serialization (WorkReportSerialization) + bytes.Equal

Node-Side Integration TODOs Details

Bundle Fetching

Tag Function CE What node layer needs to provide
NODE-TODO [bundle fetch] StubBundleFetcher.FetchBundle() Bundle Request CE Replace stub with real impl: request full bundle from guarantor peers (identified via ReportGuarantee.Signatures[].ValidatorIndex), verify against PackageSpec.ErasureRoot using work_package.ComputeErasureRoot(). Fallback: reconstruct from ≥342 erasure-coded chunks.

Audit Announcement (CE144)

Tag Function Direction What node layer needs to provide
NODE-TODO [CE144 send] BroadcastAnnouncement() Send Broadcast audit announcement + VRF evidence to all validators. Ref: ce144.go — HandleAuditAnnouncement_Send
NODE-TODO [CE144 recv] UpdateAssignmentMapFromOtherNode() Recv On CE144 message arrival, merge into local assignment map. Ref: ce144.go — HandleAuditAnnouncement_Recv
NODE-TODO [CE144 sync] SyncAssignmentMapFromOtherNodes() Sync Collect all CE144 announcements received so far per tranche, determines no-show count. Ref: ce144.go — GetAllAuditAnnouncementsForHeader

Judgment Publication (CE145)

Tag Function Direction What node layer needs to provide
NODE-TODO [CE145 send] BroadcastAuditReport() Send Broadcast signed judgment (validity + signature) to all validators. Ref: ce145.go — HandleJudgmentAnnouncement_Auditor
NODE-TODO [CE145 recv] UpdatePositiveJudgersFromOtherNode() Recv On CE145 message arrival, merge into local positive-judger map. Ref: ce145.go — HandleJudgmentAnnouncement_Validator
NODE-TODO [CE145 sync] SyncPositiveJudgersFromOtherNodes() Sync Collect all CE145 judgments received so far per tranche. Ref: ce145.go — GetAllJudgmentsForWorkReport

Timer

Tag Function What node layer needs to provide
NODE-TODO [timer] WaitNextTranche() Timer/event mechanism: each tranche = A (8 seconds) after slot start (GP §17.7)

Implement the auditor work-report evaluation by re-executing the work-package through the existing PVM infrastructure and comparing the result against the claimed report.

- Add BundleFetcher interface for node layer to provide bundle retrieval

- Add StubBundleFetcher placeholder until CE protocol is integrated

- Wire GetJudgement via WorkPackageController.Process() (shared path)

- Compare work-reports using canonical WorkReportSerialization

- Export ComputeErasureRoot for independent bundle verification

Made-with: Cursor
@HanaYukii HanaYukii self-assigned this Feb 27, 2026
@HanaYukii HanaYukii changed the title feat: wire GetJudgement with re-execution (GP 17.16-17.17) [WIP] feat: wire GetJudgement with re-execution (GP 17.16-17.17) Feb 27, 2026
@HanaYukii
Copy link
Contributor Author

This PR listed the requirement of node side todo work for the auditing part, please help to check the discribtion and code.

@Terryhung FYI.

@HanaYukii HanaYukii changed the title [WIP] feat: wire GetJudgement with re-execution (GP 17.16-17.17) [WIP] feat: Audit missing item for node intergration GetJudgement / Broadcast / Collect Result Feb 27, 2026
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.

feat: GetJudgement into auditing flow — Ξ(p,c) re-execution & node integration

1 participant