Skip to content

[Contracts] agent_registry average_rating truncates and individual Rating records are never persisted #94

Description

@david87131

Why this matters

AgentInfo::average_rating returns total_score / total_ratings as a truncated integer, so a 4.5 average reads as 4 with a systematic downward bias. Separately, rate_agent only stores a boolean at DataKey::AgentRating(agent, rater); the Rating struct (score, rater, timestamp) is never written, so the type is dead code and individual ratings can never be audited. There is also no getter exposing the average rating.

Acceptance criteria

  • average_rating returns a scaled value (e.g. x100) or otherwise avoids silent truncation, documented in code
  • rate_agent persists the full Rating record so individual scores are auditable
  • A getter exposes an agent's average rating and individual ratings
  • A test asserts a 4.5-style average is represented without loss

Files to touch

  • contracts/agent_registry/src/types.rs
  • contracts/agent_registry/src/agent.rs

Out of scope

  • Time-decayed reputation
  • Migrating existing boolean flags

Activity

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

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignbugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions