Closed Philogy closed 10 months ago
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅
I have read the CLA Document and I hereby sign the CLA
Hey, thanks for the contribution. Personally, I think this is a very cool idea:
MultiSend
contract usageaddress(0)
in the to
to call enableModule
multiple times for example instead of requiring a specialised contract to do so).The biggest drawback to the change is the requirement to deploy new MultiSend*
contracts and update where they get used, but I do think that it is useful enough to merit the downsides.
Hey, thanks for the contribution. Personally, I think this is a very cool idea:
- Sending transactions to address 0 is not really useful in and of itself (you can always use another address to burn ETH such as 0xee..ee), so it doesn't really impose any practical restrictions on
MultiSend
contract usage- Generally speaking it allows the Safe setup to do a lot of things (where you don't know the Safe address upfront, so you can use
address(0)
in theto
to callenableModule
multiple times for example instead of requiring a specialised contract to do so).- The solution uses an elegant branchless programming trick and has a low gas overhead
The biggest drawback to the change is the requirement to deploy new
MultiSend*
contracts and update where they get used, but I do think that it is useful enough to merit the downsides.
We can merge this and include it in the upcoming 1.5 release.
@Philogy do you think you'd have time to add a couple of tests for your change?
Totals | |
---|---|
Change from base Build 6720462527: | 0.0% |
Covered Lines: | 400 |
Relevant Lines: | 409 |
Safes may want to be able to use multi-send for combining configuring calls such as
enableModule
,setGuard
with each other or other external calls however specifying the safe's own address is impossible to currently do in initialization calls as the create2 salt for the safe depends on the hash of theinitializer
data which creates an unresolvable circular dependency. Allowingaddress(0)
to act as an alias for "self" allows configuring calls to easily be specified at initialization which is useful for people who want to deploy safes that enable certain modules/guards from the start.Implementation Explanation
The expression uses a binary-OR combined with a multiplication to implement a branch-less version of the following statement:
Here's the reasoning for why
or(to, mul(iszero(to), address())
is equivalent to the above ternary expression: