Skip to content

New Fusioin Mode: MetaMask Delegation Toolkit mode#39

Draft
filmakarov wants to merge 12 commits intomainfrom
feat/mm-dtk-support
Draft

New Fusioin Mode: MetaMask Delegation Toolkit mode#39
filmakarov wants to merge 12 commits intomainfrom
feat/mm-dtk-support

Conversation

@filmakarov
Copy link
Contributor

@filmakarov filmakarov commented May 14, 2025

The flow is like this:

  • EOA user creates a MM deleGator smart account, or injects it's code to EOA address via ERC-7702
  • Gator SA issues the delegation to some session address or account, controlled by the MEE Node. Gator owner (EOA) signs the delegation, which hash superTx hash injected
  • This delegation only allows transferring assets required for the superTxn execution to the Nexus orchestrator Smart Account
  • Delegate redeems the delegation, tokens are sent to the Nexus orchestrator Smart Account
  • Nexus orchestrator Smart Account executes the superTxn as usual.

Current implementation expects the delegation to be restricted by the only caveat which is the exactExecution caveat, where calldata param has the superTxHash appended to it.
See https://docs.gator.metamask.io/how-to/create-delegation/restrict-delegation#exactexecution

chart1


PR-Codex overview

This PR introduces a new MockDelegationManager contract and enhances the delegation functionality within the project. It adds support for MM delegation signatures, modifies existing validation logic, and updates related tests to ensure functionality for the new delegation type.

Detailed summary

  • Added MockDelegationManager contract with a getDomainHash function.
  • Introduced SIG_TYPE_MM_DELEGATION in Constants.sol.
  • Enhanced K1MeeValidator to handle MmDelegationValidatorLib.
  • Updated error handling for ownership transfer in K1MeeValidator.
  • Added delegation-related structs and functions in MMDelegationHelpers.sol.
  • Implemented signature validation logic in MmDelegationValidatorLib.
  • Updated tests to cover MM delegation scenarios in MM_DTK_Test_Fork.t.sol and K1MEEValidator_Test.t.sol.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@filmakarov filmakarov requested a review from fichiokaku May 14, 2025 21:26
}
}

return _packValidationData(false, decodedSig.upperBoundTimestamp, decodedSig.lowerBoundTimestamp);
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't the order here be:

(false, lowerBoundTimestamp, upperBoundTimestamp

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, it's (isValidationFailed, validUntil, validAfter)

@filmakarov filmakarov marked this pull request as draft October 8, 2025 14:01
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.

2 participants