ChainSafe / ChainSafe/open-creator-rails
Feature: Add nonce-count claim/removeSubscription variants to avoid gas-limit loops
- Dominant language
- Solidity
- Stars
- 2
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
**What**
Add new `claim` and `removeSubscription` function variants in `src/Asset.sol` and `src/IAsset.sol` that accept a specific nonce count.
These functions should process only up to the provided nonce count as a bounded batch/iteration limit.
**Why**
Current unbounded or large-loop processing can become too expensive and exceed block gas limits in edge cases. This can lock claimable amounts or make `removeSubscription` (via cancel/revoke flows) impractical to execute.
A nonce-count parameter provides a controlled workaround so users/operators can process in smaller chunks and eventually complete operations.
**How**
- Extend `IAsset` with nonce-count-aware interfaces for `claim` and `removeSubscription`.
- Implement corresponding bounded-loop logic in `Asset` that stops at the provided nonce count.
- Ensure state progression allows repeated calls to continue where prior calls stopped.
- Preserve existing authorization and validation checks for claim/cancel/revoke flows.
- Add/adjust tests for:
- partial processing across multiple calls
- completion after repeated bounded calls
- invalid nonce count handling
- gas-sensitive regression scenarios
- Document expected caller behavior for chunked execution when large backlogs exist.
**Acceptance Criteria**
- `IAsset` and `Asset` expose nonce-count variants for `claim` and `removeSubscription`.
- Large claim/removal workloads can be executed over multiple transactions without exceeding gas limits.
- No claim amounts remain permanently locked due to loop size alone.
- `removeSubscription` via cancel/revoke remains executable under high nonce counts by chunking.
- Tests validate correctness, safety, and chunked progression behavior.
**Estimation**
**Dependencies**
None currently identified.
Contributor guide
Research direction
Start with the existing claim and removeSubscription entry points in src/Asset.sol and their declarations in src/IAsset.sol, then inspect the related cancel and revoke flows and current tests. Define how nonce-count variants validate limits and preserve progress across repeated calls. Done means bounded claim and removal operations complete large workloads without gas-limit loops while retaining existing authorization and validation behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- solidity
- Domain
- blockchain
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100