Skip to content

[midnight adapter] Add revoker for large action data - #1285

Closed
adhusson wants to merge 5 commits into
mainfrom
revoke-from-source
Closed

adhusson wants to merge 5 commits into
mainfrom
revoke-from-source

Conversation

@adhusson

@adhusson adhusson commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Pending actions can contain too much data to send in a revocation transaction. Add a Revoker that deploys a source contract from supplied creation code, reads the action data from it, and calls revoke on the vault or adapter.

The caller and Revoker must both be vault sentinels. The target must be the vault or an adapter with that parent vault. The source can reconstruct the data onchain; execution must still fit within the transaction gas limit.

Addresses Sherlock #14.

Checks

  • forge build src/periphery/Revoker.sol
  • forge fmt --check src/periphery/Revoker.sol
  • git diff --check
  • No tests added or run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 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-11-02T16:24:05.582898Z 303585f New commits
🔒 Security Review ✅ Completed 2026-10-31T14:37:26.509296Z 499b051 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/periphery/README.md Outdated

## Revoker

`Revoker` lets vault sentinels cancel pending vault or adapter actions whose data is too large to send in a transaction. It builds the data onchain and must also be a vault sentinel.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
`Revoker` lets vault sentinels cancel pending vault or adapter actions whose data is too large to send in a transaction. It builds the data onchain and must also be a vault sentinel.
`Revoker` lets vault sentinels cancel pending vault or adapter actions whose data is too large to send in a transaction. It is recommended to add it as a vault sentinel.

Comment thread src/periphery/Revoker.sol Resolved
@linear-code

linear-code Bot commented Nov 2, 2026

Copy link
Copy Markdown

PRO-315

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c254fd3391

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/periphery/README.md Resolved

@MathisGD MathisGD left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

  • weird that this gets discovered now
  • should we really be doing this contract ourselves
  • in future contracts, should we change timelocked to revert decoding data too long?

Comment thread src/periphery/Revoker.sol
Comment on lines +19 to +30
function revoke(address vault, address target, bytes memory creationCode) external {
require(target == vault || IMorphoMarketV1AdapterV2(target).parentVault() == vault, InvalidTarget());
require(IVaultV2(vault).isSentinel(msg.sender), NotSentinel());

address source;
assembly ("memory-safe") {
source := create(0, add(creationCode, 32), mload(creationCode))
}
require(source != address(0), DeploymentFailed());

IVaultV2(target).revoke(RevokeSource(source).revokeData());
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
function revoke(address vault, address target, bytes memory creationCode) external {
require(target == vault || IMorphoMarketV1AdapterV2(target).parentVault() == vault, InvalidTarget());
require(IVaultV2(vault).isSentinel(msg.sender), NotSentinel());
address source;
assembly ("memory-safe") {
source := create(0, add(creationCode, 32), mload(creationCode))
}
require(source != address(0), DeploymentFailed());
IVaultV2(target).revoke(RevokeSource(source).revokeData());
}
function revoke(address vault, address target, bytes memory creationCode) external {
require(target == vault || IMorphoMarketV1AdapterV2(target).parentVault() == vault, InvalidTarget());
require(IVaultV2(vault).isSentinel(msg.sender), NotSentinel());
IVaultV2(target).revoke(RevokeSource(source).revokeData());
}

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.

Do you mean revoke(address vault, address target, address source), with the caller deploying the source beforehand? Removing deployment while keeping bytes memory creationCode leaves source undefined.

@adhusson adhusson closed this Nov 2, 2026
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.

3 participants