Skip to content

Commit 67d05a6

Browse files
committed
Merge branch 'main' of github.com:safe-global/safe-contracts into formal-verification
2 parents 2524f74 + e870f51 commit 67d05a6

File tree

9 files changed

+289
-52
lines changed

9 files changed

+289
-52
lines changed

CHANGELOG.md

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,165 @@
22

33
This changelog only contains changes starting from version 1.3.0
44

5+
# Version 1.4.0
6+
7+
## Compiler settings
8+
9+
Solidity compiler: [0.7.6](https://github.com/ethereum/solidity/releases/tag/v0.7.6) (for more info see issue [#251](https://github.com/safe-global/safe-contracts/issues/251))
10+
11+
Solidity optimizer: `disabled`
12+
13+
## Expected addresses with [Safe Singleton Factory](https://github.com/safe-global/safe-singleton-factory)
14+
15+
### Core contracts
16+
17+
- `Safe` at `0xc962E67D9490E154D81181879ddf4CD3b65D2132`
18+
- `SafeL2` at `0x1eb4681c549d995AbdC4aB189cAbb9f00B508cAb`
19+
20+
### Factory contracts
21+
22+
- `SafeProxyFactory` at `0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67`
23+
24+
### Handler contracts
25+
26+
- `TokenCallbackHandler` at `0xeDCF620325E82e3B9836eaaeFdc4283E99Dd7562`
27+
- `CompatibilityFallbackHandler` at `0x2a15DE4410d4c8af0A7b6c12803120f43C42B820`
28+
29+
### Lib contracts
30+
31+
- `MultiSend` at `0x38869bf66a61cF6bDB996A6aE40D5853Fd43B526`
32+
- `MultiSendCallOnly` at `0x9641d764fc13c8B624c04430C7356C1C7C8102e2`
33+
- `CreateCall` at `0x9b35Af71d77eaf8d7e40252370304687390A1A52`
34+
- `SignMessageLib` at `0x58FCe385Ed16beB4BCE49c8DF34c7d6975807520`
35+
36+
### Storage reader contracts
37+
38+
- `SimulateTxAccessor` at `0x3d4BA2E0884aa488718476ca2FB8Efc291A46199`
39+
40+
## Changes
41+
42+
### General
43+
44+
#### Drop "Gnosis" from contract names
45+
46+
Removed the "Gnosis" prefix from all contract names.
47+
48+
### Core contract
49+
50+
File: [`contracts/SafeL2.sol`](https://github.com/safe-global/safe-contracts/blob/3c3fc80f7f9aef1d39aaae2b53db5f4490051b0d/contracts/SafeL2.sol)
51+
52+
#### Remove usage of the `GAS` opcode in module execute flows
53+
54+
Issue: [#459](https://github.com/safe-global/safe-contracts/issues/459)
55+
56+
The following rule of usage of the `GAS` opcode in the ERC-4337 standard made it impossible to build a module to support ERC4337:
57+
58+
> - Must not use GAS opcode (unless followed immediately by one of { CALL, DELEGATECALL, CALLCODE, STATICCALL }.)
59+
60+
We removed the `GAS` opcode usage in module transactions to forward all the available gas instead.
61+
62+
#### Require the `to` address to be a contract in `setupModules`
63+
64+
Issue: [#483](https://github.com/safe-global/safe-contracts/issues/483)
65+
66+
The `setupModules` method was changed to require the `to` address to be a contract. If the `to` address is not a contract, the transaction will revert with a `GS002` error code.
67+
68+
#### Enforce the `dataHash` is equal to `data` in the signature verification process for contract signatures
69+
70+
Issue: [#497](https://github.com/safe-global/safe-contracts/issues/497)
71+
72+
To prevent unexpected behaviour, the `dataHash` must now equal a hash of the `data` in the signature verification process for contract signatures. Otherwise, the transaction will revert with a `GS027` error code.
73+
74+
#### Fix `getModulesPaginated` to return a correct `next` pointer
75+
76+
Issue: [#461](https://github.com/safe-global/safe-contracts/issues/461)
77+
78+
The `getModulesPaginated` method was fixed to return a correct `next` pointer. The `next` pointer now equals the last module in the returned array.
79+
80+
#### Check the EIP-165 signature of the Guard before adding
81+
82+
Issue: [#309](https://github.com/safe-global/safe-contracts/issues/309)
83+
84+
When setting a guard, the core contract will check that the target address supports the Guard interface with an EIP-165 check. If it doesn't, the transaction will revert with the `GS300` error code.
85+
86+
#### Index essential parameters when emitting events
87+
88+
Issue: [#541](https://github.com/safe-global/safe-contracts/issues/541)
89+
90+
Index essential parameters in the essential events, such as:
91+
92+
- Owner additions and removals (Indexed parameter - owner address)
93+
- Fallback manager changes (Indexed parameter - fallback manager address)
94+
- Module additions and removals (Indexed parameter - module address)
95+
- Transaction guard changes (Indexed parameter - guard address)
96+
- Transaction execution/failure (Indexed parameter - transaction hash)
97+
98+
### Factory
99+
100+
Umbrella issue: [#462](https://github.com/safe-global/safe-contracts/issues/462)
101+
102+
#### Remove the `createProxy` method
103+
104+
This method uses the `CREATE` opcode, which is not counterfactual for a specific deployment. This caused user errors and lost/stuck funds and is now removed.
105+
106+
#### Add a check that Singleton exists for the initializer call
107+
108+
If the initializer data is provided, the Factory now checks that the Singleton contract exists and the success of the call to avoid a proxy being deployed uninitialized
109+
110+
#### Add `createNetworkSpecificProxy`
111+
112+
This method will use the chain id in the `CREATE2` salt; therefore, deploying a proxy to the same address on other networks is impossible.
113+
This method should enable the creation of proxies that should exist only on one network (e.g. specific governance or admin accounts)
114+
115+
#### Remove the `calculateProxyAddress` method
116+
117+
Method uses the revert approach to return data that only works well with some nodes, as they all return messages differently. Hence, we removed it, and the off-chain CREATE2 calculation is still possible.
118+
119+
#### Remove the `proxyRuntimeCode` method
120+
121+
The `.runtimeCode` method is not supported by the ZkSync compiler, so we removed it.
122+
123+
### Fallback handlers
124+
125+
Files:
126+
127+
- [CompatibilityFallbackHandler.sol](https://github.com/safe-global/safe-contracts/blob/3c3fc80f7f9aef1d39aaae2b53db5f4490051b0d/contracts/handler/CompatibilityFallbackHandler.sol)
128+
- [TokenCallbackHandler](https://github.com/safe-global/safe-contracts/blob/3c3fc80f7f9aef1d39aaae2b53db5f4490051b0d/contracts/handler/TokenCallbackHandler.sol)
129+
130+
#### Rename `DefaultCallbackHandler` to `TokenCallbackHandler`
131+
132+
Since the `DefaultCallbackHandler` only handled token callbacks, it was renamed to `TokenCallbackHandler`.
133+
134+
#### Remove `NAME` and `VERSION` constants
135+
136+
The `NAME` and `VERSION` constants were removed from the `CompatibilityFallbackHandler` contract.
137+
138+
#### Fix function signature mismatch for `isValidSignature`
139+
140+
Issue: [#440](https://github.com/safe-global/safe-contracts/issues/440)
141+
142+
Fixed mismatch between the function signature in the `isValidSignature` method and the `ISignatureValidator` interface.
143+
144+
### Libraries
145+
146+
#### CreateCall
147+
148+
File: [`contracts/libraries/CreateCall.sol`](https://github.com/safe-global/safe-contracts/blob/3c3fc80f7f9aef1d39aaae2b53db5f4490051b0d/contracts/libraries/CreateCall.sol)
149+
150+
#### Index the created contract address in the `ContractCreation` event
151+
152+
Issue: [#541](https://github.com/safe-global/safe-contracts/issues/541)
153+
154+
The deployed contract address in the `ContractCreation` event is now indexed.
155+
156+
### Deployment process
157+
158+
#### Use the Safe Singleton Factory for all deployments
159+
160+
Issue: [#460](https://github.com/safe-global/safe-contracts/issues/460)
161+
162+
Deployments with the [Safe Singleton Factory](https://github.com/safe-global/safe-singleton-factory) are now the default deployment process to ensure the same addresses on all chains.
163+
5164
# Version 1.3.0-libs.0
6165

7166
## Compiler settings

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ Documentation
9292

9393
Audits/ Formal Verification
9494
---------
95+
- [for Version 1.4.0 by Ackee Blockchain](docs/audit_1_4_0.md)
9596
- [for Version 1.3.0 by G0 Group](docs/audit_1_3_0.md)
9697
- [for Version 1.2.0 by G0 Group](docs/audit_1_2_0.md)
9798
- [for Version 1.1.1 by G0 Group](docs/audit_1_1_1.md)

contracts/handler/CompatibilityFallbackHandler.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ contract CompatibilityFallbackHandler is TokenCallbackHandler, ISignatureValidat
2323
* @dev Implementation of ISignatureValidator (see `interfaces/ISignatureValidator.sol`)
2424
* @param _data Arbitrary length data signed on the behalf of address(msg.sender).
2525
* @param _signature Signature byte array associated with _data.
26-
* @return a bool upon valid or invalid signature with corresponding _data.
26+
* @return The EIP-1271 magic value.
2727
*/
2828
function isValidSignature(bytes memory _data, bytes memory _signature) public view override returns (bytes4) {
2929
// Caller should be a Safe

contracts/handler/TokenCallbackHandler.sol

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ import "../interfaces/IERC165.sol";
1111
* @author Richard Meissner - @rmeissner
1212
*/
1313
contract TokenCallbackHandler is ERC1155TokenReceiver, ERC777TokensRecipient, ERC721TokenReceiver, IERC165 {
14-
string public constant NAME = "Default Callback Handler";
15-
string public constant VERSION = "1.0.0";
16-
1714
/**
1815
* @notice Handles ERC1155 Token callback.
1916
* return Standardized onERC1155Received return value.

docs/Safe_Audit_Report_1_4_0.pdf

997 KB
Binary file not shown.

docs/audit_1_4_0.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
### Audit Results
2+
3+
##### Auditor
4+
5+
- Ackee Blockchain (https://ackeeblockchain.com/)
6+
7+
##### Notes
8+
9+
The final audit was performed on commit [eb93dbb0f62e2dc1b308ac4c110038062df0a8c9](https://github.com/safe-global/safe-contracts/tree/eb93dbb0f62e2dc1b308ac4c110038062df0a8c9).
10+
11+
##### Files
12+
13+
- [Final Audit Report 1.4.0](Safe_Audit_Report_1_4_0.pdf)
14+
15+
##### External links for Audit Reports
16+
17+
- Ackee Blockchain is working on a hosted repository for the audit reports. We will provide the link here as soon as it is available.

hardhat.config.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@ import "./src/tasks/local_verify";
3838
import "./src/tasks/deploy_contracts";
3939
import "./src/tasks/show_codesize";
4040
import { BigNumber } from "@ethersproject/bignumber";
41+
import { DeterministicDeploymentInfo } from "hardhat-deploy/dist/types";
4142

4243
const primarySolidityVersion = SOLIDITY_VERSION || "0.7.6";
4344
const soliditySettings = !!SOLIDITY_SETTINGS ? JSON.parse(SOLIDITY_SETTINGS) : undefined;
4445

45-
const deterministicDeployment = (network: string) => {
46+
const deterministicDeployment = (network: string): DeterministicDeploymentInfo => {
4647
const info = getSingletonFactoryInfo(parseInt(network));
4748
if (!info) {
4849
throw new Error(`
@@ -78,9 +79,9 @@ const userConfig: HardhatUserConfig = {
7879
...sharedNetworkConfig,
7980
url: `https://mainnet.infura.io/v3/${INFURA_KEY}`,
8081
},
81-
xdai: {
82+
gnosis: {
8283
...sharedNetworkConfig,
83-
url: "https://xdai.poanetwork.dev",
84+
url: "https://rpc.gnosischain.com",
8485
},
8586
ewc: {
8687
...sharedNetworkConfig,

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "@safe-global/safe-contracts",
3-
"version": "1.3.0",
3+
"version": "1.4.0",
44
"description": "Ethereum multisig contract",
55
"homepage": "https://github.com/safe-global/safe-contracts/",
6-
"license": "GPL-3.0",
6+
"license": "LGPL-3.0",
77
"main": "dist/index.js",
88
"typings": "dist/index.d.ts",
99
"files": [
@@ -48,7 +48,7 @@
4848
"@gnosis.pm/mock-contract": "^4.0.0",
4949
"@gnosis.pm/safe-singleton-factory": "^1.0.3",
5050
"@nomiclabs/hardhat-ethers": "2.0.2",
51-
"@nomiclabs/hardhat-etherscan": "^2.1.0",
51+
"@nomiclabs/hardhat-etherscan": "^3.1.7",
5252
"@nomiclabs/hardhat-waffle": "2.0.1",
5353
"@openzeppelin/contracts": "^3.4.0",
5454
"@types/chai": "^4.2.14",
@@ -68,7 +68,7 @@
6868
"ethereum-waffle": "^3.3.0",
6969
"ethers": "5.4.0",
7070
"hardhat": "^2.2.1",
71-
"hardhat-deploy": "0.9.2",
71+
"hardhat-deploy": "0.11.26",
7272
"husky": "^5.1.3",
7373
"prettier": "^2.8.4",
7474
"prettier-plugin-solidity": "1.1.2",

0 commit comments

Comments
 (0)