Skip to content

Use target and value too#19

Draft
amiecorso wants to merge 4 commits intomainfrom
moirai-delegate-v3-amie-review1
Draft

Use target and value too#19
amiecorso wants to merge 4 commits intomainfrom
moirai-delegate-v3-amie-review1

Conversation

@amiecorso
Copy link
Copy Markdown
Collaborator

No description provided.

hannahjin and others added 4 commits March 10, 2026 16:55
…horizedPolicy

Extract shared infrastructure from AOAPolicy into a new abstract base
SingleExecutorPolicy, allowing optional executor (address(0) = no consensus
required). The existing always-require-signature behavior is preserved in
SingleExecutorAuthorizedPolicy which inherits SingleExecutorPolicy.

- SingleExecutorPolicy: owns SingleExecutorConfig, SingleExecutorExecutionData,
  EIP-712 typehashes (EXECUTION_TYPEHASH, EXECUTION_DATA_TYPEHASH,
  SINGLE_EXECUTOR_UNINSTALL_TYPEHASH), storage, and all shared helpers
  (_storeConfigHash, _requireConfigHash, _decodeSingleExecutorConfig,
  _consumeNonce, _isValidExecutorSig, _validateAndConsumeExecutionIntent,
  cancelNonces [virtual], setPolicyManager, pause/unpause)
- SingleExecutorAuthorizedPolicy: inherits SingleExecutorPolicy; enforces
  ZeroExecutor at install; requires executor sig on every execution
- MorphoLendPolicy, MorphoLoanProtectionPolicy: updated to inherit
  SingleExecutorAuthorizedPolicy with renamed hook methods
- Docs: aoa-policies.md → single-executor-policies.md with full terminology update
- Tests: renamed test dir and updated all references; 272 tests pass

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Introduces MoiraiDelegate, a one-shot policy that executes a fixed
calldata payload on behalf of an account under at least one of two
configurable conditions: a time-lock (unlockTimestamp) and/or an
executor-signed intent.

Key design decisions:
- Inherits SingleExecutorPolicy directly (not SingleExecutorAuthorizedPolicy)
  so executor is optional (zero address = no consensus required)
- Config encoded as flat abi.encode(MoiraiConfig), not the nested
  (SingleExecutorConfig, bytes) pattern, to avoid redundant nesting
- Single-execution guard via _executed[policyId] mapping
- cancelNonces overridden to decode MoiraiConfig (incompatible with
  base class's (SingleExecutorConfig, bytes) decoding)
- Empty executionData is a documented no-op that does NOT consume
  the one-shot lock

Includes full test suite (22 tests) covering install, execute, and
uninstall behavior.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@hannahjin hannahjin force-pushed the moirai-delegate-v3 branch from df4a712 to d147eee Compare March 18, 2026 16:47
@hannahjin hannahjin force-pushed the moirai-delegate-v3 branch from df80654 to 24beccd Compare March 30, 2026 22:22
Base automatically changed from moirai-delegate-v3 to main April 1, 2026 19:47
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