Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
2389d445
Unverified
Commit
2389d445
authored
May 04, 2023
by
OptimismBot
Committed by
GitHub
May 04, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5553 from ethereum-optimism/refcell/verifyscript
feat(contracts-bedrock): Gnosis Safe Tx Hash Validation
parents
b9ca24ef
26f8c82f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
26 deletions
+43
-26
SafeBuilder.sol
packages/contracts-bedrock/scripts/universal/SafeBuilder.sol
+27
-10
PostSherlock.s.sol
...ges/contracts-bedrock/scripts/upgrades/PostSherlock.s.sol
+8
-8
PostSherlockL2.s.sol
...s/contracts-bedrock/scripts/upgrades/PostSherlockL2.s.sol
+8
-8
No files found.
packages/contracts-bedrock/scripts/universal/SafeBuilder.sol
View file @
2389d445
...
@@ -34,14 +34,10 @@ abstract contract SafeBuilder is EnhancedScript, GlobalConstants {
...
@@ -34,14 +34,10 @@ abstract contract SafeBuilder is EnhancedScript, GlobalConstants {
address[] internal approvals;
address[] internal approvals;
/**
/**
* @notice The entrypoint to this script.
* -----------------------------------------------------------
* Virtual Functions
* -----------------------------------------------------------
*/
*/
function run(address _safe, address _proxyAdmin) public returns (bool) {
vm.startBroadcast();
bool success = _run(_safe, _proxyAdmin);
if (success) _postCheck();
return success;
}
/**
/**
* @notice Follow up assertions to ensure that the script ran to completion.
* @notice Follow up assertions to ensure that the script ran to completion.
...
@@ -56,7 +52,30 @@ abstract contract SafeBuilder is EnhancedScript, GlobalConstants {
...
@@ -56,7 +52,30 @@ abstract contract SafeBuilder is EnhancedScript, GlobalConstants {
/**
/**
* @notice Internal helper function to compute the safe transaction hash.
* @notice Internal helper function to compute the safe transaction hash.
*/
*/
function _getTransactionHash(address _safe, address _proxyAdmin) internal returns (bytes32) {
function computeSafeTransactionHash(address _safe, address _proxyAdmin) public virtual returns (bytes32) {
return _getTransactionHash(_safe, _proxyAdmin);
}
/**
* -----------------------------------------------------------
* Implemented Functions
* -----------------------------------------------------------
*/
/**
* @notice The entrypoint to this script.
*/
function run(address _safe, address _proxyAdmin) public returns (bool) {
vm.startBroadcast();
bool success = _run(_safe, _proxyAdmin);
if (success) _postCheck();
return success;
}
/**
* @notice Computes the safe transaction hash for the provided safe and proxy admin.
*/
function _getTransactionHash(address _safe, address _proxyAdmin) internal view returns (bytes32) {
// Ensure that the required contracts exist
// Ensure that the required contracts exist
require(address(multicall).code.length > 0, "multicall3 not deployed");
require(address(multicall).code.length > 0, "multicall3 not deployed");
require(_safe.code.length > 0, "no code at safe address");
require(_safe.code.length > 0, "no code at safe address");
...
@@ -84,7 +103,6 @@ abstract contract SafeBuilder is EnhancedScript, GlobalConstants {
...
@@ -84,7 +103,6 @@ abstract contract SafeBuilder is EnhancedScript, GlobalConstants {
return hash;
return hash;
}
}
/**
/**
* @notice The implementation of the upgrade. Split into its own function
* @notice The implementation of the upgrade. Split into its own function
* to allow for testability. This is subject to a race condition if
* to allow for testability. This is subject to a race condition if
...
@@ -189,6 +207,5 @@ abstract contract SafeBuilder is EnhancedScript, GlobalConstants {
...
@@ -189,6 +207,5 @@ abstract contract SafeBuilder is EnhancedScript, GlobalConstants {
}
}
return signatures;
return signatures;
}
}
}
}
packages/contracts-bedrock/scripts/upgrades/PostSherlock.s.sol
View file @
2389d445
...
@@ -115,24 +115,24 @@ contract PostSherlockL1 is SafeBuilder {
...
@@ -115,24 +115,24 @@ contract PostSherlockL1 is SafeBuilder {
* could be added.
* could be added.
*/
*/
function test_script_succeeds() skipWhenNotForking external {
function test_script_succeeds() skipWhenNotForking external {
address safe;
address
_
safe;
address proxyAdmin;
address
_
proxyAdmin;
if (block.chainid == GOERLI) {
if (block.chainid == GOERLI) {
safe = 0xBc1233d0C3e6B5d53Ab455cF65A6623F6dCd7e4f;
_
safe = 0xBc1233d0C3e6B5d53Ab455cF65A6623F6dCd7e4f;
proxyAdmin = 0x01d3670863c3F4b24D7b107900f0b75d4BbC6e0d;
_
proxyAdmin = 0x01d3670863c3F4b24D7b107900f0b75d4BbC6e0d;
// Set the proxy admin for the `_postCheck` function
// Set the proxy admin for the `_postCheck` function
PROXY_ADMIN = ProxyAdmin(proxyAdmin);
PROXY_ADMIN = ProxyAdmin(
_
proxyAdmin);
}
}
require(
safe != address(0) &&
proxyAdmin != address(0));
require(
_safe != address(0) && _
proxyAdmin != address(0));
address[] memory owners = IGnosisSafe(payable(safe)).getOwners();
address[] memory owners = IGnosisSafe(payable(
_
safe)).getOwners();
for (uint256 i; i < owners.length; i++) {
for (uint256 i; i < owners.length; i++) {
address owner = owners[i];
address owner = owners[i];
vm.startBroadcast(owner);
vm.startBroadcast(owner);
bool success = _run(
safe,
proxyAdmin);
bool success = _run(
_safe, _
proxyAdmin);
vm.stopBroadcast();
vm.stopBroadcast();
if (success) {
if (success) {
...
...
packages/contracts-bedrock/scripts/upgrades/PostSherlockL2.s.sol
View file @
2389d445
...
@@ -3,7 +3,7 @@ pragma solidity 0.8.15;
...
@@ -3,7 +3,7 @@ pragma solidity 0.8.15;
import { console } from "forge-std/console.sol";
import { console } from "forge-std/console.sol";
import { SafeBuilder } from "../universal/SafeBuilder.sol";
import { SafeBuilder } from "../universal/SafeBuilder.sol";
import { IGnosisSafe, Enum } from "../
librari
es/IGnosisSafe.sol";
import { IGnosisSafe, Enum } from "../
interfac
es/IGnosisSafe.sol";
import { IMulticall3 } from "forge-std/interfaces/IMulticall3.sol";
import { IMulticall3 } from "forge-std/interfaces/IMulticall3.sol";
import { Predeploys } from "../../contracts/libraries/Predeploys.sol";
import { Predeploys } from "../../contracts/libraries/Predeploys.sol";
import { ProxyAdmin } from "../../contracts/universal/ProxyAdmin.sol";
import { ProxyAdmin } from "../../contracts/universal/ProxyAdmin.sol";
...
@@ -131,22 +131,22 @@ contract PostSherlockL2 is SafeBuilder {
...
@@ -131,22 +131,22 @@ contract PostSherlockL2 is SafeBuilder {
* could be added.
* could be added.
*/
*/
function test_script_succeeds() skipWhenNotForking external {
function test_script_succeeds() skipWhenNotForking external {
address safe;
address
_
safe;
address proxyAdmin;
address
_
proxyAdmin;
if (block.chainid == OP_GOERLI) {
if (block.chainid == OP_GOERLI) {
safe = 0xE534ccA2753aCFbcDBCeB2291F596fc60495257e;
_
safe = 0xE534ccA2753aCFbcDBCeB2291F596fc60495257e;
proxyAdmin = 0x4200000000000000000000000000000000000018;
_
proxyAdmin = 0x4200000000000000000000000000000000000018;
}
}
require(
safe != address(0) &&
proxyAdmin != address(0));
require(
_safe != address(0) && _
proxyAdmin != address(0));
address[] memory owners = IGnosisSafe(payable(safe)).getOwners();
address[] memory owners = IGnosisSafe(payable(
_
safe)).getOwners();
for (uint256 i; i < owners.length; i++) {
for (uint256 i; i < owners.length; i++) {
address owner = owners[i];
address owner = owners[i];
vm.startBroadcast(owner);
vm.startBroadcast(owner);
bool success = _run(
safe,
proxyAdmin);
bool success = _run(
_safe, _
proxyAdmin);
vm.stopBroadcast();
vm.stopBroadcast();
if (success) {
if (success) {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment