Skip to content

[midnight adapter] internal withdrawal - #1236

Open
adhusson wants to merge 7 commits into
mainfrom
deallocate-withdrawToVault
Open

adhusson wants to merge 7 commits into
mainfrom
deallocate-withdrawToVault

Conversation

@adhusson

@adhusson adhusson commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

withdraw to vault works through deallocate, alternative to #1215

can't withdraw through forceDeallocate but it's not really needed

Addresses Sherlock #18, Sherlock #21 and Sherlock #32.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T14:00:15.001010Z 42fcacb New commits
🔒 Security Review ✅ Completed 2026-10-25T23:10:00.540810Z 7c1b5a7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Comment thread src/adapters/MidnightAdapter.sol Resolved

@albert-llimos albert-llimos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is much better than #1215 imo.

Comment thread src/adapters/MidnightAdapter.sol Resolved
@bhargavbh

Copy link
Copy Markdown
Contributor

Noticed a slight concern with PA compatibility when thinking about the certora spec. Could be ignored if we assume vaults allocating to Blue and midnight don't support Blue PA.

Before with withdrawToVault:
a user could call withdrawToVault(0) to update the caps and then invoke the blue PA for reallocations. Mainly for collateral caps (shared between blue and midnight).

After this PR:
its no longer possible for someone using Blue PA to update caps and reallocate. The Blue PA would have the authority, since its an allocator, but no entrypoint that calls midnight's deallocate.

…Vault

# Conflicts:
#	src/adapters/MidnightAdapter.sol
#	test/MidnightAdapterTest.sol
@adhusson

Copy link
Copy Markdown
Contributor Author

if needed we can add back a public refreshAllocations() that calls withdrawtovault(0) & deallocates

MathisGD and others added 2 commits October 27, 2026 08:13
…Vault

# Conflicts:
#	src/adapters/MidnightAdapter.sol
Preserve internal withdrawal and self-funded allocation accounting across the adapter callback identifier renames.
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.

4 participants