Skip to content

Generalize the nested multisig #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 17, 2025
Merged

Generalize the nested multisig #136

merged 3 commits into from
Apr 17, 2025

Conversation

mdehoog
Copy link
Contributor

@mdehoog mdehoog commented Apr 16, 2025

With the DoubleNestedMultisigBuilder addition (#112), maintaining different implementations for various levels of nesting has gotten complicated.

This PR replaces the MultisigBuilder, NestedMultisigBuilder, and DoubleNestedMultisigBuilder with a single contract that supports arbitrary levels of nesting.

Tested by retaining the existing tests but replacing the implementation with the generalized version.

@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Apr 16, 2025

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@mdehoog mdehoog force-pushed the michael/generalize-multisig branch 2 times, most recently from d9d1261 to 0f4b5e5 Compare April 17, 2025 00:32
@mdehoog mdehoog marked this pull request as ready for review April 17, 2025 00:34
@mdehoog mdehoog force-pushed the michael/generalize-multisig branch 3 times, most recently from bb928e3 to 2d18709 Compare April 17, 2025 04:03
@mdehoog mdehoog force-pushed the michael/generalize-multisig branch from 2d18709 to f18c457 Compare April 17, 2025 04:11
@mdehoog mdehoog requested a review from jackchuma April 17, 2025 04:12
* Same as `sign()` for non-nested safes.
*/
function sign() public {
sign(new address[](0));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

are these overloads helpful or confusing? also below

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems unnecessary in my opinion

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opted to keep them for backwards compatibility with existing scripts, but marked them as deprecated

// first try SAFE_NONCE
try vm.envUint("SAFE_NONCE") {
nonce = vm.envUint("SAFE_NONCE");
} catch {}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is slightly different in that it now tries to load SAFE_NONCE for all levels of the safe, rather than just the non-nested version. Retained for backwards compatibility.

/*
* Same as `verify()` for a double layer of nesting.
*/
function verify(address _signerSafe, address _intermediateSafe, bytes memory _signatures) public {
Copy link
Contributor

Choose a reason for hiding this comment

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

If keeping these, this and the following verify can be marked as view

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, fixed


emit DataToSign(txData);

console.log("---\nIf submitting onchain, call Safe.approveHash on %s with the following hash:", _safe);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this log? I know it was already there but doesn't seem relevant to our ops process

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah not relevant to us, but for the OP multisig one of their signers is a multisig, so they added this to make it easier to submit an approveHash rather than generate an EOA sig. Kept in for that purpose

@mdehoog mdehoog merged commit 964811a into main Apr 17, 2025
2 checks passed
@mdehoog mdehoog deleted the michael/generalize-multisig branch April 17, 2025 23:17
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