Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ece50eb
add setup and rules about modules
teryanarmen Feb 10, 2023
2a99238
fix run script
teryanarmen Feb 10, 2023
6142597
use solc7.6 for fv
mmv08 Mar 31, 2023
2ce4faa
Merge branch 'main' of github.com:safe-global/safe-contracts into for…
mmv08 Mar 31, 2023
78fdf78
Mark assembly blocks as memory-safe
mmv08 Apr 6, 2023
c55691a
use solidity 0.8.19 for github action benchmark
mmv08 Apr 6, 2023
4d2284c
Update makefile
mmv08 Apr 11, 2023
2253f7e
fix the harness patch
mmv08 Apr 11, 2023
dc0cbf9
properties doc skeleton
mmv08 Apr 12, 2023
2524f74
properties notes
mmv08 Apr 20, 2023
6b03373
Merge branch 'main' of github.com:safe-global/safe-contracts into fea…
mmv08 Apr 27, 2023
ac6c56b
use 10m optimizer runs
mmv08 Apr 27, 2023
3ae2bde
Write calldata/return data to the memory allocated via the free memor…
mmv08 May 2, 2023
0c98fc0
memory-safe simulateAndRevert
mmv08 May 2, 2023
67d05a6
Merge branch 'main' of github.com:safe-global/safe-contracts into for…
mmv08 May 3, 2023
7a77545
Update CLA github action to v2.3.0
Uxio0 May 8, 2023
e8e9241
add certora workflow
mmv08 May 9, 2023
ed32c96
Fix changelog mention of createChainSpecificProxyWithNonce
frangio May 11, 2023
4b9c46f
Merge pull request #561 from frangio/changelog-fix
mmv08 May 11, 2023
1c29d23
fix script path
mmv08 May 10, 2023
c8932d4
use cvl2
mmv08 May 15, 2023
ad9b319
Merge pull request #560 from safe-global/formal-verification
mmv08 May 16, 2023
11e3459
Merge branch 'main' of github.com:safe-global/safe-contracts into fea…
mmv08 May 16, 2023
f8bd215
Remove gasleft in setupModules, add erc4337 compatibility test
mmv08 May 19, 2023
f77dfce
Fix typechecking in test files (#573)
mmv08 May 30, 2023
9cbdaa6
verify that guard can only be updated through setGuard
mmv08 May 17, 2023
1b25deb
Verify functions that may change the fallback handler address (#566)
mmv08 May 31, 2023
f37e0ed
Add an invariant for singleton address (#565)
mmv08 May 31, 2023
80ced58
Add an optimistic assumption about DELEGATECALL, update nonce monoton…
mmv08 May 31, 2023
13a5d89
Pump version to 1.4.1 (#579)
mmv08 May 31, 2023
36a07fe
Formal verification: native token balance updates (#582)
mmv08 Jun 15, 2023
1ed486b
Fix addresses for 1.4.1 in changelog (#590)
rmeissner Jun 15, 2023
7e46388
Fix certora CI action
mmv08 Jun 15, 2023
eec5ebc
Merge pull request #591 from safe-global/fix/certora-ci
mmv08 Jun 16, 2023
bf943f8
Formal verification: No message can be signed through the core contra…
mmv08 Jun 16, 2023
930478f
Merge branch 'main' of github.com:safe-global/safe-contracts into fea…
Jun 22, 2023
1a0d70c
fix munged patch
Jun 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add an optimistic assumption about DELEGATECALL, update nonce monoton…
…icity rule (#574)
  • Loading branch information
mmv08 authored May 31, 2023
commit 80ced58474041ae5481309ef8d2153dad48ee4a1
19 changes: 12 additions & 7 deletions certora/applyHarness.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
diff -druN Safe.sol Safe.sol
--- Safe.sol 2023-04-11 15:01:13
+++ Safe.sol 2023-04-11 15:01:55
--- Safe.sol 2023-05-16 15:08:39
+++ Safe.sol 2023-05-25 16:23:56
@@ -76,7 +76,7 @@
* so we create a Safe with 0 owners and threshold 1.
* This is an unusable Safe, perfect for the singleton
Expand All @@ -11,14 +11,19 @@ diff -druN Safe.sol Safe.sol

/**
diff -druN base/Executor.sol base/Executor.sol
--- base/Executor.sol 2023-04-11 15:01:13
+++ base/Executor.sol 2023-04-11 15:01:18
@@ -25,6 +25,8 @@
--- base/Executor.sol 2023-05-16 15:08:39
+++ base/Executor.sol 2023-05-25 16:23:31
@@ -25,11 +25,9 @@
Enum.Operation operation,
uint256 txGas
) internal returns (bool success) {
+ // MUNGED lets just be a bit more optimistic, `execute` does nothing and always returns true
+ return true;
+ // MUNGED lets just be a bit more optimistic, `execute` does nothing for `DELEGATECALL` and always returns true
if (operation == Enum.Operation.DelegateCall) {
- // solhint-disable-next-line no-inline-assembly
- assembly {
- success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)
- }
+ return true;
} else {
// solhint-disable-next-line no-inline-assembly
assembly {
13 changes: 9 additions & 4 deletions certora/specs/Safe.spec
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,25 @@ definition reachableOnly(method f) returns bool =
f.selector != sig:setup(address[],uint256,address,bytes,address,address,uint256,address).selector
&& f.selector != sig:simulateAndRevert(address,bytes).selector;

definition MAX_UINT256() returns uint256 = 0xffffffffffffffffffffffffffffffff;

/// Nonce must never decrease
rule nonceMonotonicity(method f) filtered {
f -> noHavoc(f) && reachableOnly(f) &&
f -> reachableOnly(f) &&
f.selector != sig:getStorageAt(uint256,uint256).selector
} {
uint256 nonceBefore = nonce();

// The nonce may overflow, but since it's increased only by 1 with each transaction, it is not realistically possible to overflow it.
require nonceBefore < MAX_UINT256();

calldataarg args; env e;
f(e, args);

uint256 nonceAfter = nonce();

assert nonceAfter == nonceBefore || to_mathint(nonceAfter) == nonceBefore + 1;
assert nonceAfter != nonceBefore =>
to_mathint(nonceAfter) == nonceBefore + 1 && f.selector == sig:execTransaction(address,uint256,bytes,SafeHarness.Operation,uint256,uint256,uint256,address,address,bytes).selector;
}


Expand Down Expand Up @@ -129,7 +134,7 @@ rule fallbackHandlerAddressChange(method f) filtered {

address fbHandlerAfter = fallbackHandlerAddress;

assert fbHandlerBefore != fbHandlerAfter =>
assert fbHandlerBefore != fbHandlerAfter =>
f.selector == sig:setup(address[],uint256,address,bytes,address,address,uint256,address).selector || f.selector == sig:setFallbackHandler(address).selector;
}

Expand All @@ -145,6 +150,6 @@ rule guardAddressChange(method f) filtered {

address guardAfter = getSafeGuard();

assert guardBefore != guardAfter =>
assert guardBefore != guardAfter =>
f.selector == sig:setGuard(address).selector;
}