Skip to content

Optimize Ethena unstaker queue tracking#245

Merged
naddison36 merged 1 commit into
nicka/withdraw-on-swapfrom
nicka/ethena-adapter-maths
May 26, 2026
Merged

Optimize Ethena unstaker queue tracking#245
naddison36 merged 1 commit into
nicka/withdraw-on-swapfrom
nicka/ethena-adapter-maths

Conversation

@naddison36
Copy link
Copy Markdown
Collaborator

Summary

  • Replace pendingUnstakerIndexes storage with a totalRequests counter
  • Derive queued unstaker indexes with requestIndex % MAX_UNSTAKERS
  • Update Ethena queue JS ABI/logic to use totalRequests() and unstakerIndexAt()

Motivation

The pending unstaker index array stored a deterministic repeating sequence based on request position. Since the adapter always rotates from index 0 through MAX_UNSTAKERS - 1, each queued unstaker index can be derived without storing it.

Testing

  • forge build
  • forge test --match-path test/fork/EthenaARM/RequestWithdraw.t.sol
  • forge test --match-path test/fork/EthenaARM/ClaimBaseWithdrawals.t.sol

…counter and derive each unstaker index by request position modulo the unstaker count
@naddison36 naddison36 merged commit b2304b7 into nicka/withdraw-on-swap May 26, 2026
8 checks passed
@naddison36 naddison36 deleted the nicka/ethena-adapter-maths branch May 26, 2026 00:49
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.

1 participant