Repository navigation
feat: allow ERC-1271 contract signers in MultiSigDeleGator - #214
Open
Muhammad-Altabba wants to merge 1 commit into
Open
Muhammad-Altabba wants to merge 1 commit into
Muhammad-Altabba wants to merge 1 commit into
Conversation
- Updated documentation to reflect that signers can be EOAs or ERC-1271 contracts. - Modified MultiSigDeleGator contract to accept ERC-1271 contracts as valid signers. - Adjusted signature validation logic to handle mixed EOA and contract signatures. - Added tests to ensure proper functionality with ERC-1271 contract signers, including nested multisig scenarios and validation of mixed signatures.
Muhammad-Altabba
force-pushed
the
feat/multisig-erc1271-signers
branch
from
October 23, 2026 06:40
e8076e3 to
7dd7d40
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #213
What?
MultiSigDeleGatoraccepts smart contract accounts as signers next to EOAs. Their signatures are checked with ERC-1271, and one multisig signature can contain both types.reinitialize,updateMultiSigParameters,addSigner,replaceSigner) no longer reject addresses with code. They still rejectaddress(0)and the DeleGator's own address.documents/MultisigDeleGator.mddescribes the signature format, a nested example, and the trust, gas and bundler considerations.Why?
See #213. In short: so that nested multisigs, passkey users (
HybridDeleGator) and EIP-7702 accounts can be signers.How?
Signature format
Exactly
thresholdentries, sorted by signer address, as before. Every entry starts with 65 bytes. The last of them (thevposition of an EOA signature) marks the type:vis 27 or 28:r (32) | s (32) | v (1)0:signer (20) | length (4) | zero (40) | 0 (1), followed bylengthbytes of signatureValidation
ECDSA.tryRecover. Contract entries are checked with OpenZeppelinSignatureChecker.isValidERC1271SignatureNow, and only after the signer is confirmed to be registered (isSigner), so other addresses are never called.SIG_VALIDATION_FAILEDwithout reverting: malformed bytes, non-zero reserved bytes, or a contract signer that rejects, reverts or returns a wrong value. Extra data after the last entry is rejected.MultiSigDeleGators are signers of each other.Design choices
vposition, so EOA entries need no extra storage read. Safe uses the samev == 0marker, but stores contract data at an offset after all entries (Safe signature encoding). Inline data is simpler to build and parse, especially when nested. The zero bytes keep one valid encoding per entry. The cost is a 65-byte header per contract entry.Behavior changes
isValidSignature,main→ this PR: 2-of-3 12,576 → 12,479, 3-of-5 17,519 → 17,505, 5-of-7 27,404 → 27,556.vnot 27 or 28, or a highs) now returnsSIG_VALIDATION_FAILEDinstead of reverting inECDSA.recover, the same as all other invalid entries. The signature is rejected either way. Only the error changes:InvalidERC1271SignatureinDelegationManager, andAA24 signature errorinstead ofAA23 revertedin the EntryPoint.Limitations
MultiSigDeleGatoror aHybridDeleGator) need a staked account (EntryPoint v0.8 or later) or a private bundler for UserOps. Details are in MultiSigDeleGator: support smart contract accounts as signers (ERC-1271) #213.SIG_VALIDATION_FAILED.Tests
New tests in
MultiSigDeleGatorTest.t.sol:HybridDeleGatorsigner with a passkey. An EOA with EIP-7702 code added as a signer (ECDSA and ERC-1271 entries), and an EOA signer that gets EIP-7702 code after it was added (ECDSA).The tests that expected contract signers to be rejected now expect success (
test_error_updateSigParamatersContractNewSigneris renamed totest_allow_updateSigParamatersContractNewSigner) or were removed (addSigner,replaceSigner).Results:
forge test --no-match-contract "DelegationMetaSwapAdapterForkTest|VedaLendingTest": 1052 passed, 0 failed. The two excluded suites are fork tests that need RPC URLs.forge coverage --match-contract MultiSigDeleGatorTest: all branches ofMultiSigDeleGator.solare covered.Notes for reviewers
_isValidSignature.VERSIONis unchanged (1.3.0). Tell me if it needs a bump.