Skip to content

Add automatic removal for missed contributions#149

Open
TUPM96 wants to merge 1 commit into
sorosave-protocol:mainfrom
TUPM96:codex/member-miss-removal-64
Open

Add automatic removal for missed contributions#149
TUPM96 wants to merge 1 commit into
sorosave-protocol:mainfrom
TUPM96:codex/member-miss-removal-64

Conversation

@TUPM96
Copy link
Copy Markdown

@TUPM96 TUPM96 commented May 25, 2026

Summary

  • add max_consecutive_misses to each savings group with admin/protocol-admin configuration
  • track per-member consecutive missed contributions and per-round missed participants
  • record missed contributions after round deadlines, remove members at the configured threshold, and deterministically redistribute removed payout slots to remaining members
  • reset a member's consecutive miss counter after a successful contribution

Validation

  • cargo fmt --check
  • cargo test --package sorosave (12 passed)
  • cargo clippy --package sorosave --all-targets -- -D warnings
  • git diff --check

Fixes #64

Copilot AI review requested due to automatic review settings May 25, 2026 09:39
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds configurable tracking of consecutive missed contributions, enabling admin-recorded misses that can remove defaulting members and adjust round completion behavior.

Changes:

  • Add max_consecutive_misses to groups and track per-round misses via RoundInfo.misses.
  • Persist and expose consecutive-miss counters (MemberMisses) plus admin APIs to configure and record misses.
  • Add tests for miss configuration, member removal on miss, and miss reset on successful contribution.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
contracts/sorosave/src/types.rs Extends persisted contract types (SavingsGroup, RoundInfo, DataKey) for miss tracking.
contracts/sorosave/src/storage.rs Adds persistent storage helpers for consecutive miss counters.
contracts/sorosave/src/contribution.rs Implements miss recording/removal logic and resets counters on contribution.
contracts/sorosave/src/group.rs Defaults and admin setter for max_consecutive_misses; initializes misses map in rounds.
contracts/sorosave/src/lib.rs Exposes new contract entrypoints to configure/query/record misses.
contracts/sorosave/src/payout.rs Initializes misses for newly created rounds during payout advancement.
contracts/sorosave/src/errors.rs Adds DeadlineNotReached error for miss-recording gating.
contracts/sorosave/src/test.rs Adds tests covering miss configuration, removal/redistribution, and miss reset behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +65 to 66
MemberMisses(u64, Address),
Dispute(u64),
Comment on lines 28 to 32
pub total_rounds: u32,
pub status: GroupStatus,
pub created_at: u64,
pub max_consecutive_misses: u32,
}
Comment on lines 38 to 44
pub round_number: u32,
pub recipient: Address,
pub contributions: Map<Address, bool>,
pub misses: Map<Address, bool>,
pub total_contributed: i128,
pub is_complete: bool,
pub deadline: u64,
Comment on lines +110 to +114
let result = env.storage().persistent().get(&key).unwrap_or(0);
if result > 0 {
extend_persistent_ttl(env, &key);
}
result
admin.require_auth();

if max_misses == 0 {
return Err(ContractError::InvalidAmount);
Comment on lines +116 to +118
if env.ledger().timestamp() < round_info.deadline {
return Err(ContractError::DeadlineNotReached);
}
@@ -1,8 +1,8 @@
use soroban_sdk::{Address, Env};
use soroban_sdk::{Address, Env, Vec};

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.

Implement automatic member removal after consecutive misses

2 participants