Skip to content

Conversation

@xenoliss
Copy link
Contributor

@xenoliss xenoliss commented Apr 9, 2025

This PR adds support for Call3Value calls by updating the MultisigBuilder and NestedMultisigBuilder contracts.

It also adds new specific Multisig (and NestedMultisig) builder implementations that tasks should now inherit from:

  • MultisigBuilderNoValue: for tasks that are not supposed to transfer ETH in the Multicall calls.
  • MultisigBuilderWithValue: for tasks that do transfer ETH in the Multicall calls.

An additional virtual method _allowEthTransfer is added to these contracts, with a default implementation that returns false.
The sign, approve, and run methods now rely on calling an internal _buildCallsChecked method that ensures the calls returned by _buildCalls are consistent with the policy defined by the _allowEthTransfer method.

@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Apr 9, 2025

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/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

Copy link
Contributor

@jackchuma jackchuma left a comment

Choose a reason for hiding this comment

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

I think it all looks great - might just want to add some testing around the new contracts added? (MultisigBuilderNoValue, MultisigBuilderWithValue, NestedMultisigBuilderNoValue, NestedMultisigBuilderWithValue)

@xenoliss
Copy link
Contributor Author

@jackchuma I refactored the approach to instead introduce an _allowEthTransfer method as you first suggested. I was getting concerned about having to define 2 specific implementations per MultisigBuilder + having to use new methods names (instead of the usual _buildCalls in the tasks).

@xenoliss xenoliss requested review from jackchuma and mdehoog April 10, 2025 08:53
@xenoliss xenoliss force-pushed the bo/multicall-Call3Value branch from 2406fe0 to c57a17c Compare April 10, 2025 08:54
@xenoliss xenoliss changed the title chore: add support Call3Value calls and add specific builder implementations chore: add support Call3Value calls Apr 10, 2025
@xenoliss xenoliss changed the title chore: add support Call3Value calls chore: add support for Call3Value calls Apr 10, 2025
/**
* @notice Returns whether ETH transfers are allowed to be performed by the Multicall calls.
*/
function _allowEthTransfer() internal view virtual returns (bool) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't have to be in this PR but I'm noticing now that all these virtual functions could be moved to MultisigBase.sol so they only need to be defined once

Copy link
Contributor

@mdehoog mdehoog Apr 12, 2025

Choose a reason for hiding this comment

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

I like the consistency of keeping this alongside _buildCalls(), so this seems okay for now. But we could consider moving all of the common virtual functions up a level in a follow up?

run();
}

function testRevert_buildCalls() external {
Copy link
Contributor

Choose a reason for hiding this comment

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

This test fails for me

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting, it passes locally. Can you post the error you get?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be solved, let me know.

}

function _simulateForSigner(address _safe, IMulticall3.Call3[] memory _calls)
function _buildCallsChecked() private view returns (IMulticall3.Call3Value[] memory) {
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the reason for the additional _allowEthTransfer() method gating? can we just trust the simulation / verification done by signers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason is mostly for extra security. I am fine removing it but there was some concern around missing a transfer.

Copy link
Contributor

Choose a reason for hiding this comment

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

I personally prefer the simplicity of what we had previously... it should be up to the signers to validate what is happening, including value transfers. There doesn't seem to be a particular reason to single out value transfer from the safes vs other actions the safe does. But don't feel strongly.

Copy link

@BoomchainLabs BoomchainLabs left a comment

Choose a reason for hiding this comment

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

Lgtm

mdehoog
mdehoog previously approved these changes Apr 12, 2025
@cb-heimdall cb-heimdall dismissed mdehoog’s stale review April 12, 2025 11:45

Approved review 2761889576 from mdehoog is now dismissed due to new commit. Re-request for approval.

@cb-heimdall
Copy link
Collaborator

Review Error for jackchuma @ 2025-04-12 11:47:21 UTC
User cannot review their own commit

@cb-heimdall
Copy link
Collaborator

Review Error for BoomchainLabs @ 2025-04-13 03:39:41 UTC
User must have write permissions to review

bytes32 hash = _getTransactionHash(_safe, _data);
_signatures = Signatures.prepareSignatures(_safe, hash, _signatures);

bytes memory simData = _execTransactionCalldata(_safe, data, _signatures);
Copy link
Contributor

Choose a reason for hiding this comment

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

_data

@xenoliss
Copy link
Contributor Author

Closing because out of date.

@xenoliss xenoliss closed this Apr 21, 2025
@xenoliss xenoliss deleted the bo/multicall-Call3Value branch April 22, 2025 16:31
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.

6 participants