Skip to content

Fix: Reputation Registry and Circle Payout Issues - #372

Merged
cypriannwokolo2-creator merged 1 commit into
cocor-tech:masterfrom
SharifIbrahimDev:fix-all-issues
Aug 31, 2026
Merged

Fix: Reputation Registry and Circle Payout Issues#372
cypriannwokolo2-creator merged 1 commit into
cocor-tech:masterfrom
SharifIbrahimDev:fix-all-issues

Conversation

@SharifIbrahimDev

@SharifIbrahimDev SharifIbrahimDev commented Aug 30, 2026

Copy link
Copy Markdown

Overview

This PR resolves a series of critical logical and validation issues across the Reputation Registry and Circle contracts to improve the integrity and fairness of the system.

Changes Implemented

1. Reputation Registry Trust Model (#221)

  • Problem: In record(), any authenticated address could theoretically record activities for any user, relying heavily on the caller being a trusted circle contract.
  • Solution: Added explicit documentation and trust model definitions highlighting that data integrity for record() relies on cross-contract calls from verified circle contracts. The user.require_auth() guarantees user invocation authorization but offloads caller validation to the architecture.

2. Strict Streak Counting (#222)

  • Problem: In record_on_time_payment(), the streak counter was incremented unconditionally, ignoring whether the member actually paid in consecutive rounds.
  • Solution:
    • Introduced DataKey::LastRound to the storage schema to track the exact round a member last contributed.
    • Updated the signature of record_on_time_payment (and corresponding cross-contract calls) to include the round parameter.
    • The streak is now accurately incremented only if current_round == last_round + 1 (or if it's their very first payment), preventing artificial inflation of streak bonuses.

3. Vote Validation (#223)

  • Problem: In vote_payout(), members could cast votes for any arbitrary address, which could result in invalid addresses or non-members receiving the payout.
  • Solution: Implemented strict validation checks in vote_payout() to ensure that the vote_for address is verified as an active member (MEMBER_ACTIVE) within the circle before the vote is successfully recorded.

4. Auction Winner Logic (#224)

  • Problem: The resolve_auction() function incorrectly selected the bidder with the lowest discount_bips.
  • Solution: Reversed the logic to correctly identify the highest discount_bips (biggest discount = smallest payout for the winner), ensuring the auction correctly rewards the most competitive bid.

Related Issues

Closes #221
Closes #222
Closes #223
Closes #224

Testing

  • Ensure that cargo check passes and existing tests continue to perform as expected.
  • Verified state modifications and type safety in the smart contracts.

@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@SharifIbrahimDev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@ayomideadeniran

Copy link
Copy Markdown

Pr under review

@cypriannwokolo2-creator
cypriannwokolo2-creator merged commit 1d89aac into cocor-tech:master Aug 31, 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.

Bug Description Bug Description Bug Description Bug Description

3 participants