Skip to content

Conversation

0xClandestine
Copy link
Member

@0xClandestine 0xClandestine commented May 27, 2025

Motivation:

With the addition of non-arrified versions of decreaseBurnableShares and releaseSlashEscrow we want to avoid the use of EnumerableSet.at() as it reverts when attempting to retrieve indices that do not exist (> length).

Modifications:

  • Use EnumerableSet.tryGet and EnumerableSet.keys instead which does not revert (but simply does nothing) if the index doesn't exist.
  • Rename decreaseBurnOrRedistributableShares -> clearBurnOrRedistributableShares to better reflect the functions purpose.

Result:

Protocol guarantees are maintained, and better naming.

@0xClandestine 0xClandestine force-pushed the refactor/decreaseBurnOrRedistributableShares branch from a3bcba8 to 41adb7b Compare May 27, 2025 20:39
@0xClandestine 0xClandestine changed the title feat(draft): AllocationManager redistribution support (#1346) refactor: decreaseBurnOrRedistributableShares May 27, 2025
@0xClandestine 0xClandestine merged commit 4e3bf2e into release-dev/redistribution May 27, 2025
9 checks passed
@0xClandestine 0xClandestine deleted the refactor/decreaseBurnOrRedistributableShares branch May 27, 2025 21:12
0xClandestine added a commit that referenced this pull request May 27, 2025
**Motivation:**

With the addition of non-arrified versions of `decreaseBurnableShares`
and `releaseSlashEscrow` we want to avoid the use of
`EnumerableSet.at()` as it reverts when attempting to retrieve indices
that do not exist (> length).

**Modifications:**

- Use `EnumerableSet.tryGet` and `EnumerableSet.keys` instead which does
not revert (but simply does nothing) if the index doesn't exist.
- Rename `decreaseBurnOrRedistributableShares` ->
`clearBurnOrRedistributableShares` to better reflect the functions
purpose.

**Result:**

Protocol guarantees are maintained, and better naming.
0xClandestine added a commit that referenced this pull request May 30, 2025
**Motivation:**

With the addition of non-arrified versions of `decreaseBurnableShares`
and `releaseSlashEscrow` we want to avoid the use of
`EnumerableSet.at()` as it reverts when attempting to retrieve indices
that do not exist (> length).

**Modifications:**

- Use `EnumerableSet.tryGet` and `EnumerableSet.keys` instead which does
not revert (but simply does nothing) if the index doesn't exist.
- Rename `decreaseBurnOrRedistributableShares` ->
`clearBurnOrRedistributableShares` to better reflect the functions
purpose.

**Result:**

Protocol guarantees are maintained, and better naming.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants