-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Description: There is an issue in the AuditSequencer function where if multiple users verify the same pod multiple times, the TotalVerifiedPodCount in the station metrics is incremented each time. This results in an inflated count that doesn't accurately represent unique pod verifications.
Current Behavior:
- The
TotalVerifiedPodCountis incremented for every verification, even if the pod has already been verified by another user or the same user.
Steps to Reproduce:
- Verify a pod (e.g.,
Pod-1). - Have a second verifier audit the same pod.
- Observe that
TotalVerifiedPodCountis incremented for both verifications, even though only one pod was verified.
Expected Behavior:
TotalVerifiedPodCountshould only increment when a pod is verified for the first time, not for subsequent audits by different users.
Suggested Fix: We should not prevent multiple users from verifying the same pod. It's beneficial to allow multiple users to verify a single pod, as this can enhance the reliability and trustworthiness of the audit process.
Instead of blocking further verifications, we should introduce a system to record the verifiers' addresses and track how many unique verifiers have audited the pod. Here's a proposal:
- Verifiers List: Add a new field in the
ExtTrackSchemaEngagementto store the addresses of users who have verified the pod. Each time a user verifies the pod, their address is added to this list.
Verifiers []string `json:"verifiers"` // New field to track verifiers- Prevent Duplicate Entries in Verifiers List: Before adding a verifier to the list, check if their address is already recorded. If the verifier's address is already in the list, don't add it again.
alreadyVerified := false
for _, verifierAddr := range engagementData.Verifiers {
if verifierAddr == verifier {
alreadyVerified = true
break
}
}
if !alreadyVerified {
engagementData.Verifiers = append(engagementData.Verifiers, verifier)
}- Increment
TotalVerifiedPodCountOnly Once: Modify the logic to incrementTotalVerifiedPodCountonly when the pod is verified for the first time (whenIsVerifiedis false).
if !engagementData.IsVerified {
updatedStationMetrics.TotalVerifiedPodCount = stationMetrics.TotalVerifiedPodCount + 1
}By introducing this verifiers list, we ensure that:
- Multiple users can verify the same pod, which can increase audit reliability.
- Only unique verifications are counted in the
TotalVerifiedPodCount. - We can track which users have audited a pod, which could be useful for governance or future features.
Context:
- The proposed solution prevents inflated metrics and ensures that each pod is only counted once in the station metrics, while still allowing multiple users to verify the same pod.