Skip to content

Commit

Permalink
♻️ 1.3.1: Update MulticallerWithSigner with defensive signing (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vectorized authored Nov 17, 2023
1 parent 8a4540a commit 8c07107
Show file tree
Hide file tree
Showing 9 changed files with 267 additions and 143 deletions.
30 changes: 15 additions & 15 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
MulticallerTest:testMultiCallerWithSignerIncrementNonceSalt(uint256) (runs: 256, μ: 80066, ~: 81872)
MulticallerTest:testMultiCallerWithSignerIncrementNonceSaltWithERC1271(uint256) (runs: 256, μ: 580304, ~: 580357)
MulticallerTest:testMulticallerCdFallback(string) (runs: 256, μ: 306501, ~: 301746)
MulticallerTest:testMultiCallerWithSignerIncrementNonceSalt(uint256) (runs: 256, μ: 83521, ~: 82301)
MulticallerTest:testMultiCallerWithSignerIncrementNonceSaltWithERC1271(uint256) (runs: 256, μ: 614878, ~: 614930)
MulticallerTest:testMulticallerCdFallback(string) (runs: 256, μ: 295907, ~: 281868)
MulticallerTest:testMulticallerForwardsMessageValue() (gas: 214013)
MulticallerTest:testMulticallerGetNames() (gas: 147637)
MulticallerTest:testMulticallerReentrancyGuard() (gas: 19980)
MulticallerTest:testMulticallerRefund(uint256) (runs: 256, μ: 169898, ~: 172026)
MulticallerTest:testMulticallerRefund(uint256) (runs: 256, μ: 169978, ~: 172012)
MulticallerTest:testMulticallerReturnDataIsProperlyEncoded() (gas: 122173)
MulticallerTest:testMulticallerReturnDataIsProperlyEncoded(string,string,uint256) (runs: 256, μ: 520631, ~: 527233)
MulticallerTest:testMulticallerReturnDataIsProperlyEncoded(string,string,uint256) (runs: 256, μ: 487938, ~: 508582)
MulticallerTest:testMulticallerReturnDataIsProperlyEncoded(uint256,uint256,uint256,uint256) (runs: 256, μ: 122252, ~: 122252)
MulticallerTest:testMulticallerRevertWithCustomError() (gas: 35485)
MulticallerTest:testMulticallerRevertWithMessage() (gas: 38244)
MulticallerTest:testMulticallerRevertWithMessage(string) (runs: 256, μ: 39122, ~: 39181)
MulticallerTest:testMulticallerRevertWithMessage(string) (runs: 256, μ: 38922, ~: 38644)
MulticallerTest:testMulticallerRevertWithNothing() (gas: 35306)
MulticallerTest:testMulticallerSenderDoesNotRevertWithoutMulticallerDeployed() (gas: 3423)
MulticallerTest:testMulticallerTargetGetMulticallerSender() (gas: 27448)
MulticallerTest:testMulticallerWithNoData() (gas: 16213)
MulticallerTest:testMulticallerWithSigner(uint256) (runs: 256, μ: 127763, ~: 118802)
MulticallerTest:testMulticallerWithSigner(uint256) (runs: 256, μ: 131230, ~: 119355)
MulticallerTest:testMulticallerWithSignerEIP712Domain() (gas: 12375)
MulticallerTest:testMulticallerWithSignerGetMulticallerSigner() (gas: 135610)
MulticallerTest:testMulticallerWithSignerInvalidateNonces(uint256) (runs: 256, μ: 79498, ~: 77716)
MulticallerTest:testMulticallerWithSignerInvalidateNoncesWithERC1271(uint256) (runs: 256, μ: 584890, ~: 584632)
MulticallerTest:testMulticallerWithSignerGetMulticallerSigner() (gas: 136389)
MulticallerTest:testMulticallerWithSignerInvalidateNonces(uint256) (runs: 256, μ: 81419, ~: 79804)
MulticallerTest:testMulticallerWithSignerInvalidateNoncesWithERC1271(uint256) (runs: 256, μ: 616664, ~: 616391)
MulticallerTest:testMulticallerWithSignerNonPayableFunctions() (gas: 48884)
MulticallerTest:testMulticallerWithSignerReentrancyGuard() (gas: 124037)
MulticallerTest:testMulticallerWithSignerRevert() (gas: 203818)
MulticallerTest:testMulticallerWithSignerWithERC1271(uint256) (runs: 256, μ: 613068, ~: 601565)
MulticallerTest:testMulticallerWithSignerWithNoData() (gas: 128593)
MulticallerTest:testMulticallerWithSignerReentrancyGuard() (gas: 124909)
MulticallerTest:testMulticallerWithSignerRevert() (gas: 206240)
MulticallerTest:testMulticallerWithSignerWithERC1271(uint256) (runs: 256, μ: 659790, ~: 651359)
MulticallerTest:testMulticallerWithSignerWithNoData() (gas: 130147)
MulticallerTest:testNastyCalldataRevert() (gas: 3420)
MulticallerTest:testOffsetTrick(uint256,uint256,uint256) (runs: 256, μ: 571, ~: 571)
MulticallerTest:test__codesize() (gas: 49524)
MulticallerTest:test__codesize() (gas: 50276)
TestPlus:test__codesize() (gas: 1102)
17 changes: 10 additions & 7 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,14 @@ If you need them in your code, please copy and paste them.
#### `_AGGREGATE_WITH_SIGNER_TYPEHASH`
```solidity
bytes32 private constant _AGGREGATE_WITH_SIGNER_TYPEHASH =
0xc4d2f044d99707794280032fc14879a220a3f7dc766d75100809624f91d69e97;
0xfb989fd34c8af81a76f18167f528fc7315f92cacc19a0e63215abd54633f8a28;
```

For EIP-712 signature digest calculation for the `aggregateWithSigner` function.

`keccak256("AggregateWithSigner(address[] targets,bytes[] data,uint256[] values,uint256 nonce,uint256 nonceSalt)")`.
`keccak256("AggregateWithSigner(address signer,address[] targets,bytes[] data,uint256[] values,uint256 nonce,uint256 nonceSalt)")`.

- `signer`: The signer of the signature.
- `targets`: An array of addresses to call.
- `data`: An array of calldata to forward to the targets.
- `values`: How much ETH to forward to each target.
Expand All @@ -117,26 +118,28 @@ For EIP-712 signature digest calculation for the `aggregateWithSigner` function.
#### `_INVALIDATE_NONCES_FOR_SIGNER_TYPEHASH`
```solidity
bytes32 private constant _INVALIDATE_NONCES_FOR_SIGNER_TYPEHASH =
0xe75b4aefef1358e66ac7ed2f180022e0a7f661dcd2781630ce58e05bb8bdb1c1;
0x12b047058eea3df4085cdc159a103d9c100c4e78cfb7029cc39d02cb8b9e48f5;
```

For EIP-712 signature digest calculation for the `invalidateNoncesForSigner` function.

`keccak256("InvalidateNoncesForSigner(uint256[] nonces,uint256 nonceSalt)")`.
`keccak256("InvalidateNoncesForSigner(address signer,uint256[] nonces,uint256 nonceSalt)")`.

- `signer`: The signer of the signature.
- `nonces`: The array of nonces for the signer.
- `nonceSalt`: The current nonce salt of the signer.

#### `_INCREMENT_NONCE_SALT_FOR_SIGNER_TYPEHASH`
```solidity
bytes32 private constant _INCREMENT_NONCE_SALT_FOR_SIGNER_TYPEHASH =
0x898da98c106c91ce6f05405740b0ed23b5c4dc847a0dd1996fb93189d8310bef;
0xfa181078c7d1d4d369301511d3c5611e9367d0cebbf65eefdee9dfc75849c1d3;
```

For EIP-712 signature digest calculation for the `incrementNonceSaltForSigner` function.

`keccak256("IncrementNonceSaltForSigner(uint256 nonceSalt)")`.
`keccak256("IncrementNonceSaltForSigner(address signer,uint256 nonceSalt)")`.

- `signer`: The signer of the signature.
- `nonceSalt`: The current nonce salt of the signer.

#### `_DOMAIN_TYPEHASH`
Expand Down Expand Up @@ -327,7 +330,7 @@ The address of the multicaller with sender contract.
#### `MULTICALLER_WITH_SIGNER`
```solidity
address internal constant MULTICALLER_WITH_SIGNER =
0x0000000000005e17F9eA3651537Cffda3946E0be;
0x000000000000D9ECebf3C23529de49815Dac1c4c;
```

The address of the multicaller with signer contract.
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,31 @@ Please open an issue if you need help to deploy to an EVM chain of your choice.
- Ethereum
- Multicaller: [`0x0000000000002Bdbf1Bf3279983603Ec279CC6dF`](https://etherscan.io/address/0x0000000000002Bdbf1Bf3279983603Ec279CC6dF)
- MulticallerWithSender: [`0x00000000002Fd5Aeb385D324B580FCa7c83823A0`](https://etherscan.io/address/0x00000000002Fd5Aeb385D324B580FCa7c83823A0)
- MulticallerWithSigner: [`0x0000000000005e17F9eA3651537Cffda3946E0be`](https://etherscan.io/address/0x0000000000005e17F9eA3651537Cffda3946E0be)
- MulticallerWithSigner: [`0x000000000000D9ECebf3C23529de49815Dac1c4c`](https://etherscan.io/address/0x000000000000D9ECebf3C23529de49815Dac1c4c)
- Goerli
- Multicaller: [`0x0000000000002Bdbf1Bf3279983603Ec279CC6dF`](https://goerli.etherscan.io/address/0x0000000000002Bdbf1Bf3279983603Ec279CC6dF)
- MulticallerWithSender: [`0x00000000002Fd5Aeb385D324B580FCa7c83823A0`](https://goerli.etherscan.io/address/0x00000000002Fd5Aeb385D324B580FCa7c83823A0)
- MulticallerWithSigner: [`0x0000000000005e17F9eA3651537Cffda3946E0be`](https://goerli.etherscan.io/address/0x0000000000005e17F9eA3651537Cffda3946E0be)
- MulticallerWithSigner: [`0x000000000000D9ECebf3C23529de49815Dac1c4c`](https://goerli.etherscan.io/address/0x000000000000D9ECebf3C23529de49815Dac1c4c)
- Sepolia
- Multicaller: [`0x0000000000002Bdbf1Bf3279983603Ec279CC6dF`](https://sepolia.etherscan.io/address/0x0000000000002Bdbf1Bf3279983603Ec279CC6dF)
- MulticallerWithSender: [`0x00000000002Fd5Aeb385D324B580FCa7c83823A0`](https://sepolia.etherscan.io/address/0x00000000002Fd5Aeb385D324B580FCa7c83823A0)
- MulticallerWithSigner: [`0x0000000000005e17F9eA3651537Cffda3946E0be`](https://sepolia.etherscan.io/address/0x0000000000005e17F9eA3651537Cffda3946E0be)
- MulticallerWithSigner: [`0x000000000000D9ECebf3C23529de49815Dac1c4c`](https://sepolia.etherscan.io/address/0x000000000000D9ECebf3C23529de49815Dac1c4c)
- Polygon
- Multicaller: [`0x0000000000002Bdbf1Bf3279983603Ec279CC6dF`](https://polygonscan.com/address/0x0000000000002Bdbf1Bf3279983603Ec279CC6dF)
- MulticallerWithSender: [`0x00000000002Fd5Aeb385D324B580FCa7c83823A0`](https://polygonscan.com/address/0x00000000002Fd5Aeb385D324B580FCa7c83823A0)
- MulticallerWithSigner: [`0x0000000000005e17F9eA3651537Cffda3946E0be`](https://polygonscan.com/address/0x0000000000005e17F9eA3651537Cffda3946E0be)
- MulticallerWithSigner: [`0x000000000000D9ECebf3C23529de49815Dac1c4c`](https://polygonscan.com/address/0x000000000000D9ECebf3C23529de49815Dac1c4c)
- Mumbai
- Multicaller: [`0x0000000000002Bdbf1Bf3279983603Ec279CC6dF`](https://mumbai.polygonscan.com/address/0x0000000000002Bdbf1Bf3279983603Ec279CC6dF)
- MulticallerWithSender: [`0x00000000002Fd5Aeb385D324B580FCa7c83823A0`](https://mumbai.polygonscan.com/address/0x00000000002Fd5Aeb385D324B580FCa7c83823A0)
- MulticallerWithSigner: [`0x0000000000005e17F9eA3651537Cffda3946E0be`](https://mumbai.polygonscan.com/address/0x0000000000005e17F9eA3651537Cffda3946E0be)
- MulticallerWithSigner: [`0x000000000000D9ECebf3C23529de49815Dac1c4c`](https://mumbai.polygonscan.com/address/0x000000000000D9ECebf3C23529de49815Dac1c4c)
- Optimism
- Multicaller: [`0x0000000000002Bdbf1Bf3279983603Ec279CC6dF`](https://optimistic.etherscan.io/address/0x0000000000002Bdbf1Bf3279983603Ec279CC6dF)
- MulticallerWithSender: [`0x00000000002Fd5Aeb385D324B580FCa7c83823A0`](https://optimistic.etherscan.io/address/0x00000000002Fd5Aeb385D324B580FCa7c83823A0)
- MulticallerWithSigner: [`0x0000000000005e17F9eA3651537Cffda3946E0be`](https://optimistic.etherscan.io/address/0x0000000000005e17F9eA3651537Cffda3946E0be)
- MulticallerWithSigner: [`0x000000000000D9ECebf3C23529de49815Dac1c4c`](https://optimistic.etherscan.io/address/0x000000000000D9ECebf3C23529de49815Dac1c4c)
- Arbitrum
- Multicaller: [`0x0000000000002Bdbf1Bf3279983603Ec279CC6dF`](https://arbiscan.io/address/0x0000000000002Bdbf1Bf3279983603Ec279CC6dF)
- MulticallerWithSender: [`0x00000000002Fd5Aeb385D324B580FCa7c83823A0`](https://arbiscan.io/address/0x00000000002Fd5Aeb385D324B580FCa7c83823A0)
- MulticallerWithSigner: [`0x0000000000005e17F9eA3651537Cffda3946E0be`](https://arbiscan.io/address/0x0000000000005e17F9eA3651537Cffda3946E0be)
- MulticallerWithSigner: [`0x000000000000D9ECebf3C23529de49815Dac1c4c`](https://arbiscan.io/address/0x000000000000D9ECebf3C23529de49815Dac1c4c)

## Contracts

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "multicaller",
"license": "MIT",
"version": "1.3.0",
"version": "1.3.1",
"description": "Efficient multicaller contract",
"files": [
"src/**/*.sol"
Expand Down
2 changes: 1 addition & 1 deletion src/LibMulticaller.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ library LibMulticaller {
/**
* @dev The address of the multicaller with signer contract.
*/
address internal constant MULTICALLER_WITH_SIGNER = 0x0000000000005e17F9eA3651537Cffda3946E0be;
address internal constant MULTICALLER_WITH_SIGNER = 0x000000000000D9ECebf3C23529de49815Dac1c4c;

/**
* @dev Returns the caller of `aggregateWithSender` on `MULTICALLER_WITH_SENDER`.
Expand Down
Loading

0 comments on commit 8c07107

Please sign in to comment.