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
92bc1b4f
Commit
92bc1b4f
authored
Jun 23, 2023
by
Andreas Bigger
Committed by
asnared
Jun 23, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port legacy contracts to triple slash natspec style
parent
f5bdbf00
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
257 additions
and
389 deletions
+257
-389
deployerwhitelist.go
op-bindings/bindings/deployerwhitelist.go
+1
-1
l1blocknumber.go
op-bindings/bindings/l1blocknumber.go
+1
-1
legacymessagepasser.go
op-bindings/bindings/legacymessagepasser.go
+1
-1
AddressManager.sol
...ges/contracts-bedrock/contracts/legacy/AddressManager.sol
+20
-38
DeployerWhitelist.sol
.../contracts-bedrock/contracts/legacy/DeployerWhitelist.sol
+32
-63
L1BlockNumber.sol
...ages/contracts-bedrock/contracts/legacy/L1BlockNumber.sol
+14
-25
L1ChugSplashProxy.sol
.../contracts-bedrock/contracts/legacy/L1ChugSplashProxy.sol
+60
-112
LegacyERC20ETH.sol
...ges/contracts-bedrock/contracts/legacy/LegacyERC20ETH.sol
+28
-50
LegacyMessagePasser.sol
...ontracts-bedrock/contracts/legacy/LegacyMessagePasser.sol
+11
-20
LegacyMintableERC20.sol
...ontracts-bedrock/contracts/legacy/LegacyMintableERC20.sol
+19
-39
ResolvedDelegateProxy.sol
...tracts-bedrock/contracts/legacy/ResolvedDelegateProxy.sol
+17
-27
DeployerWhitelist.t.sol
.../contracts-bedrock/contracts/test/DeployerWhitelist.t.sol
+6
-2
L1BlockNumber.t.sol
...ages/contracts-bedrock/contracts/test/L1BlockNumber.t.sol
+10
-1
LegacyERC20ETH.t.sol
...ges/contracts-bedrock/contracts/test/LegacyERC20ETH.t.sol
+16
-1
LegacyMessagePasser.t.sol
...ontracts-bedrock/contracts/test/LegacyMessagePasser.t.sol
+8
-1
ResolvedDelegateProxy.t.sol
...tracts-bedrock/contracts/test/ResolvedDelegateProxy.t.sol
+10
-4
check-l2.ts
packages/contracts-bedrock/tasks/check-l2.ts
+3
-3
No files found.
op-bindings/bindings/deployerwhitelist.go
View file @
92bc1b4f
This diff is collapsed.
Click to expand it.
op-bindings/bindings/l1blocknumber.go
View file @
92bc1b4f
...
...
@@ -31,7 +31,7 @@ var (
// L1BlockNumberMetaData contains all meta data concerning the L1BlockNumber contract.
var
L1BlockNumberMetaData
=
&
bind
.
MetaData
{
ABI
:
"[{
\"
inputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
constructor
\"
},{
\"
stateMutability
\"
:
\"
payable
\"
,
\"
type
\"
:
\"
fallback
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
getL1BlockNumber
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
uint256
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
version
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
string
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
string
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
stateMutability
\"
:
\"
payable
\"
,
\"
type
\"
:
\"
receive
\"
}]"
,
Bin
:
"0x60e060405234801561001057600080fd5b5060016080819052600060a081905260c08
190528061059461004a82
39600061018d015260006101640152600061013b01526105946000f3fe60806040526004361061002d5760003560e01c806354fd4d5014610052578063b9b3efe91461007d57610048565b3661004857600061003c6100a0565b90508060005260206000f35b600061003c6100a0565b34801561005e57600080fd5b50610067610134565b6040516100749190610344565b60405180910390f35b34801561008957600080fd5b506100926100a0565b604051908152602001610074565b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16638381f58a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610101573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101259190610395565b67ffffffffffffffff16905090565b606061015f7f00000000000000000000000000000000000000000000000000000000000000006101d7565b6101887f00000000000000000000000000000000000000000000000000000000000000006101d7565b6101b17f00000000000000000000000000000000000000000000000000000000000000006101d7565b6040516020016101c3939291906103c6565b604051602081830303815290604052905090565b60608160000361021a57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115610244578061022e8161046b565b915061023d9050600a836104d2565b915061021e565b60008167ffffffffffffffff81111561025f5761025f6104e6565b6040519080825280601f01601f191660200182016040528015610289576020820181803683370190505b5090505b841561030c5761029e600183610515565b91506102ab600a8661052c565b6102b6906030610540565b60f81b8183815181106102cb576102cb610558565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610305600a866104d2565b945061028d565b949350505050565b60005b8381101561032f578181015183820152602001610317565b8381111561033e576000848401525b50505050565b6020815260008251806020840152610363816040850160208701610314565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6000602082840312156103a757600080fd5b815167ffffffffffffffff811681146103bf57600080fd5b9392505050565b600084516103d8818460208901610314565b80830190507f2e000000000000000000000000000000000000000000000000000000000000008082528551610414816001850160208a01610314565b6001920191820152835161042f816002840160208801610314565b0160020195945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361049c5761049c61043c565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826104e1576104e16104a3565b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000828210156105275761052761043c565b500390565b60008261053b5761053b6104a3565b500690565b600082198211156105535761055361043c565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea164736f6c634300080f000a"
,
Bin
:
"0x60e060405234801561001057600080fd5b5060016080819052600060a081905260c08
290528161059461004a83
39600061018d015260006101640152600061013b01526105946000f3fe60806040526004361061002d5760003560e01c806354fd4d5014610052578063b9b3efe91461007d57610048565b3661004857600061003c6100a0565b90508060005260206000f35b600061003c6100a0565b34801561005e57600080fd5b50610067610134565b6040516100749190610344565b60405180910390f35b34801561008957600080fd5b506100926100a0565b604051908152602001610074565b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16638381f58a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610101573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101259190610395565b67ffffffffffffffff16905090565b606061015f7f00000000000000000000000000000000000000000000000000000000000000006101d7565b6101887f00000000000000000000000000000000000000000000000000000000000000006101d7565b6101b17f00000000000000000000000000000000000000000000000000000000000000006101d7565b6040516020016101c3939291906103c6565b604051602081830303815290604052905090565b60608160000361021a57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115610244578061022e8161046b565b915061023d9050600a836104d2565b915061021e565b60008167ffffffffffffffff81111561025f5761025f6104e6565b6040519080825280601f01601f191660200182016040528015610289576020820181803683370190505b5090505b841561030c5761029e600183610515565b91506102ab600a8661052c565b6102b6906030610540565b60f81b8183815181106102cb576102cb610558565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610305600a866104d2565b945061028d565b949350505050565b60005b8381101561032f578181015183820152602001610317565b8381111561033e576000848401525b50505050565b6020815260008251806020840152610363816040850160208701610314565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6000602082840312156103a757600080fd5b815167ffffffffffffffff811681146103bf57600080fd5b9392505050565b600084516103d8818460208901610314565b80830190507f2e000000000000000000000000000000000000000000000000000000000000008082528551610414816001850160208a01610314565b6001920191820152835161042f816002840160208801610314565b0160020195945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361049c5761049c61043c565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826104e1576104e16104a3565b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000828210156105275761052761043c565b500390565b60008261053b5761053b6104a3565b500690565b600082198211156105535761055361043c565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea164736f6c634300080f000a"
,
}
// L1BlockNumberABI is the input ABI used to generate the binding from.
...
...
op-bindings/bindings/legacymessagepasser.go
View file @
92bc1b4f
...
...
@@ -31,7 +31,7 @@ var (
// LegacyMessagePasserMetaData contains all meta data concerning the LegacyMessagePasser contract.
var
LegacyMessagePasserMetaData
=
&
bind
.
MetaData
{
ABI
:
"[{
\"
inputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
constructor
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes
\"
,
\"
name
\"
:
\"
_message
\"
,
\"
type
\"
:
\"
bytes
\"
}],
\"
name
\"
:
\"
passMessageToL1
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
name
\"
:
\"
sentMessages
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
bool
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
bool
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
version
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
string
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
string
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
}]"
,
Bin
:
"0x60e060405234801561001057600080fd5b5060016080819052600060a081905260c08
190528061069861004882
3960006101050152600060dc0152600060b301526106986000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806354fd4d501461004657806382e3702d14610064578063cafa81dc14610097575b600080fd5b61004e6100ac565b60405161005b9190610347565b60405180910390f35b610087610072366004610398565b60006020819052908152604090205460ff1681565b604051901515815260200161005b565b6100aa6100a53660046103e0565b61014f565b005b60606100d77f00000000000000000000000000000000000000000000000000000000000000006101da565b6101007f00000000000000000000000000000000000000000000000000000000000000006101da565b6101297f00000000000000000000000000000000000000000000000000000000000000006101da565b60405160200161013b939291906104af565b604051602081830303815290604052905090565b60016000808333604051602001610167929190610525565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815291815281516020928301208352908201929092520160002080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001691151591909117905550565b60608160000361021d57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b811561024757806102318161059e565b91506102409050600a83610605565b9150610221565b60008167ffffffffffffffff811115610262576102626103b1565b6040519080825280601f01601f19166020018201604052801561028c576020820181803683370190505b5090505b841561030f576102a1600183610619565b91506102ae600a86610630565b6102b9906030610644565b60f81b8183815181106102ce576102ce61065c565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610308600a86610605565b9450610290565b949350505050565b60005b8381101561033257818101518382015260200161031a565b83811115610341576000848401525b50505050565b6020815260008251806020840152610366816040850160208701610317565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6000602082840312156103aa57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000602082840312156103f257600080fd5b813567ffffffffffffffff8082111561040a57600080fd5b818401915084601f83011261041e57600080fd5b813581811115610430576104306103b1565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610476576104766103b1565b8160405282815287602084870101111561048f57600080fd5b826020860160208301376000928101602001929092525095945050505050565b600084516104c1818460208901610317565b80830190507f2e0000000000000000000000000000000000000000000000000000000000000080825285516104fd816001850160208a01610317565b60019201918201528351610518816002840160208801610317565b0160020195945050505050565b60008351610537818460208801610317565b60609390931b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000169190920190815260140192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036105cf576105cf61056f565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082610614576106146105d6565b500490565b60008282101561062b5761062b61056f565b500390565b60008261063f5761063f6105d6565b500690565b600082198211156106575761065761056f565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea164736f6c634300080f000a"
,
Bin
:
"0x60e060405234801561001057600080fd5b5060016080819052600060a081905260c08
290528161069861004883
3960006101050152600060dc0152600060b301526106986000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806354fd4d501461004657806382e3702d14610064578063cafa81dc14610097575b600080fd5b61004e6100ac565b60405161005b9190610347565b60405180910390f35b610087610072366004610398565b60006020819052908152604090205460ff1681565b604051901515815260200161005b565b6100aa6100a53660046103e0565b61014f565b005b60606100d77f00000000000000000000000000000000000000000000000000000000000000006101da565b6101007f00000000000000000000000000000000000000000000000000000000000000006101da565b6101297f00000000000000000000000000000000000000000000000000000000000000006101da565b60405160200161013b939291906104af565b604051602081830303815290604052905090565b60016000808333604051602001610167929190610525565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815291815281516020928301208352908201929092520160002080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001691151591909117905550565b60608160000361021d57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b811561024757806102318161059e565b91506102409050600a83610605565b9150610221565b60008167ffffffffffffffff811115610262576102626103b1565b6040519080825280601f01601f19166020018201604052801561028c576020820181803683370190505b5090505b841561030f576102a1600183610619565b91506102ae600a86610630565b6102b9906030610644565b60f81b8183815181106102ce576102ce61065c565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610308600a86610605565b9450610290565b949350505050565b60005b8381101561033257818101518382015260200161031a565b83811115610341576000848401525b50505050565b6020815260008251806020840152610366816040850160208701610317565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6000602082840312156103aa57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000602082840312156103f257600080fd5b813567ffffffffffffffff8082111561040a57600080fd5b818401915084601f83011261041e57600080fd5b813581811115610430576104306103b1565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610476576104766103b1565b8160405282815287602084870101111561048f57600080fd5b826020860160208301376000928101602001929092525095945050505050565b600084516104c1818460208901610317565b80830190507f2e0000000000000000000000000000000000000000000000000000000000000080825285516104fd816001850160208a01610317565b60019201918201528351610518816002840160208801610317565b0160020195945050505050565b60008351610537818460208801610317565b60609390931b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000169190920190815260140192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036105cf576105cf61056f565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082610614576106146105d6565b500490565b60008282101561062b5761062b61056f565b500390565b60008261063f5761063f6105d6565b500690565b600082198211156106575761065761056f565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea164736f6c634300080f000a"
,
}
// LegacyMessagePasserABI is the input ABI used to generate the binding from.
...
...
packages/contracts-bedrock/contracts/legacy/AddressManager.sol
View file @
92bc1b4f
...
...
@@ -3,35 +3,25 @@ pragma solidity 0.8.15;
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
/**
* @custom:legacy
* @title AddressManager
* @notice AddressManager is a legacy contract that was used in the old version of the Optimism
* system to manage a registry of string names to addresses. We now use a more standard
* proxy system instead, but this contract is still necessary for backwards compatibility
* with several older contracts.
*/
/// @custom:legacy
/// @title AddressManager
/// @notice AddressManager is a legacy contract that was used in the old version of the Optimism
/// system to manage a registry of string names to addresses. We now use a more standard
/// proxy system instead, but this contract is still necessary for backwards compatibility
/// with several older contracts.
contract AddressManager is Ownable {
/**
* @notice Mapping of the hashes of string names to addresses.
*/
/// @notice Mapping of the hashes of string names to addresses.
mapping(bytes32 => address) private addresses;
/**
* @notice Emitted when an address is modified in the registry.
*
* @param name String name being set in the registry.
* @param newAddress Address set for the given name.
* @param oldAddress Address that was previously set for the given name.
*/
/// @notice Emitted when an address is modified in the registry.
/// @param name String name being set in the registry.
/// @param newAddress Address set for the given name.
/// @param oldAddress Address that was previously set for the given name.
event AddressSet(string indexed name, address newAddress, address oldAddress);
/**
* @notice Changes the address associated with a particular name.
*
* @param _name String name to associate an address with.
* @param _address Address to associate with the name.
*/
/// @notice Changes the address associated with a particular name.
/// @param _name String name to associate an address with.
/// @param _address Address to associate with the name.
function setAddress(string memory _name, address _address) external onlyOwner {
bytes32 nameHash = _getNameHash(_name);
address oldAddress = addresses[nameHash];
...
...
@@ -40,24 +30,16 @@ contract AddressManager is Ownable {
emit AddressSet(_name, _address, oldAddress);
}
/**
* @notice Retrieves the address associated with a given name.
*
* @param _name Name to retrieve an address for.
*
* @return Address associated with the given name.
*/
/// @notice Retrieves the address associated with a given name.
/// @param _name Name to retrieve an address for.
/// @return Address associated with the given name.
function getAddress(string memory _name) external view returns (address) {
return addresses[_getNameHash(_name)];
}
/**
* @notice Computes the hash of a name.
*
* @param _name Name to compute a hash for.
*
* @return Hash of the given name.
*/
/// @notice Computes the hash of a name.
/// @param _name Name to compute a hash for.
/// @return Hash of the given name.
function _getNameHash(string memory _name) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(_name));
}
...
...
packages/contracts-bedrock/contracts/legacy/DeployerWhitelist.sol
View file @
92bc1b4f
...
...
@@ -3,55 +3,38 @@ pragma solidity 0.8.15;
import { Semver } from "../universal/Semver.sol";
/**
* @custom:legacy
* @custom:proxied
* @custom:predeployed 0x4200000000000000000000000000000000000002
* @title DeployerWhitelist
* @notice DeployerWhitelist is a legacy contract that was originally used to act as a whitelist of
* addresses allowed to the Optimism network. The DeployerWhitelist has since been
* disabled, but the code is kept in state for the sake of full backwards compatibility.
* As of the Bedrock upgrade, the DeployerWhitelist is completely unused by the Optimism
* system and could, in theory, be removed entirely.
*/
/// @custom:legacy
/// @custom:proxied
/// @custom:predeployed 0x4200000000000000000000000000000000000002
/// @title DeployerWhitelist
/// @notice DeployerWhitelist is a legacy contract that was originally used to act as a whitelist of
/// addresses allowed to the Optimism network. The DeployerWhitelist has since been
/// disabled, but the code is kept in state for the sake of full backwards compatibility.
/// As of the Bedrock upgrade, the DeployerWhitelist is completely unused by the Optimism
/// system and could, in theory, be removed entirely.
contract DeployerWhitelist is Semver {
/**
* @notice Address of the owner of this contract. Note that when this address is set to
* address(0), the whitelist is disabled.
*/
/// @notice Address of the owner of this contract. Note that when this address is set to
/// address(0), the whitelist is disabled.
address public owner;
/**
* @notice Mapping of deployer addresses to boolean whitelist status.
*/
/// @notice Mapping of deployer addresses to boolean whitelist status.
mapping(address => bool) public whitelist;
/**
* @notice Emitted when the owner of this contract changes.
*
* @param oldOwner Address of the previous owner.
* @param newOwner Address of the new owner.
*/
/// @notice Emitted when the owner of this contract changes.
/// @param oldOwner Address of the previous owner.
/// @param newOwner Address of the new owner.
event OwnerChanged(address oldOwner, address newOwner);
/**
* @notice Emitted when the whitelist status of a deployer changes.
*
* @param deployer Address of the deployer.
* @param whitelisted Boolean indicating whether the deployer is whitelisted.
*/
/// @notice Emitted when the whitelist status of a deployer changes.
/// @param deployer Address of the deployer.
/// @param whitelisted Boolean indicating whether the deployer is whitelisted.
event WhitelistStatusChanged(address deployer, bool whitelisted);
/**
* @notice Emitted when the whitelist is disabled.
*
* @param oldOwner Address of the final owner of the whitelist.
*/
/// @notice Emitted when the whitelist is disabled.
/// @param oldOwner Address of the final owner of the whitelist.
event WhitelistDisabled(address oldOwner);
/**
* @notice Blocks functions to anyone except the contract owner.
*/
/// @notice Blocks functions to anyone except the contract owner.
modifier onlyOwner() {
require(
msg.sender == owner,
...
...
@@ -60,27 +43,19 @@ contract DeployerWhitelist is Semver {
_;
}
/**
* @custom:semver 1.0.0
*/
constructor() Semver(1, 0, 0) {}
/// @custom:semver 1.0.1
constructor() Semver(1, 0, 1) {}
/**
* @notice Adds or removes an address from the deployment whitelist.
*
* @param _deployer Address to update permissions for.
* @param _isWhitelisted Whether or not the address is whitelisted.
*/
/// @notice Adds or removes an address from the deployment whitelist.
/// @param _deployer Address to update permissions for.
/// @param _isWhitelisted Whether or not the address is whitelisted.
function setWhitelistedDeployer(address _deployer, bool _isWhitelisted) external onlyOwner {
whitelist[_deployer] = _isWhitelisted;
emit WhitelistStatusChanged(_deployer, _isWhitelisted);
}
/**
* @notice Updates the owner of this contract.
*
* @param _owner Address of the new owner.
*/
/// @notice Updates the owner of this contract.
/// @param _owner Address of the new owner.
function setOwner(address _owner) external onlyOwner {
// Prevent users from setting the whitelist owner to address(0) except via
// enableArbitraryContractDeployment. If you want to burn the whitelist owner, send it to
...
...
@@ -94,21 +69,15 @@ contract DeployerWhitelist is Semver {
owner = _owner;
}
/**
* @notice Permanently enables arbitrary contract deployment and deletes the owner.
*/
/// @notice Permanently enables arbitrary contract deployment and deletes the owner.
function enableArbitraryContractDeployment() external onlyOwner {
emit WhitelistDisabled(owner);
owner = address(0);
}
/**
* @notice Checks whether an address is allowed to deploy contracts.
*
* @param _deployer Address to check.
*
* @return Whether or not the address can deploy contracts.
*/
/// @notice Checks whether an address is allowed to deploy contracts.
/// @param _deployer Address to check.
/// @return Whether or not the address can deploy contracts.
function isDeployerAllowed(address _deployer) external view returns (bool) {
return (owner == address(0) || whitelist[_deployer]);
}
...
...
packages/contracts-bedrock/contracts/legacy/L1BlockNumber.sol
View file @
92bc1b4f
...
...
@@ -5,25 +5,19 @@ import { L1Block } from "../L2/L1Block.sol";
import { Predeploys } from "../libraries/Predeploys.sol";
import { Semver } from "../universal/Semver.sol";
/**
* @custom:legacy
* @custom:proxied
* @custom:predeploy 0x4200000000000000000000000000000000000013
* @title L1BlockNumber
* @notice L1BlockNumber is a legacy contract that fills the roll of the OVM_L1BlockNumber contract
* in the old version of the Optimism system. Only necessary for backwards compatibility.
* If you want to access the L1 block number going forward, you should use the L1Block
* contract instead.
*/
/// @custom:legacy
/// @custom:proxied
/// @custom:predeploy 0x4200000000000000000000000000000000000013
/// @title L1BlockNumber
/// @notice L1BlockNumber is a legacy contract that fills the roll of the OVM_L1BlockNumber contract
/// in the old version of the Optimism system. Only necessary for backwards compatibility.
/// If you want to access the L1 block number going forward, you should use the L1Block
/// contract instead.
contract L1BlockNumber is Semver {
/**
* @custom:semver 1.0.0
*/
constructor() Semver(1, 0, 0) {}
/// @custom:semver 1.0.1
constructor() Semver(1, 0, 1) {}
/**
* @notice Returns the L1 block number.
*/
/// @notice Returns the L1 block number.
receive() external payable {
uint256 l1BlockNumber = getL1BlockNumber();
assembly {
...
...
@@ -32,9 +26,7 @@ contract L1BlockNumber is Semver {
}
}
/**
* @notice Returns the L1 block number.
*/
/// @notice Returns the L1 block number.
// solhint-disable-next-line no-complex-fallback
fallback() external payable {
uint256 l1BlockNumber = getL1BlockNumber();
...
...
@@ -44,11 +36,8 @@ contract L1BlockNumber is Semver {
}
}
/**
* @notice Retrieves the latest L1 block number.
*
* @return Latest L1 block number.
*/
/// @notice Retrieves the latest L1 block number.
/// @return Latest L1 block number.
function getL1BlockNumber() public view returns (uint256) {
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).number();
}
...
...
packages/contracts-bedrock/contracts/legacy/L1ChugSplashProxy.sol
View file @
92bc1b4f
This diff is collapsed.
Click to expand it.
packages/contracts-bedrock/contracts/legacy/LegacyERC20ETH.sol
View file @
92bc1b4f
...
...
@@ -4,73 +4,55 @@ pragma solidity 0.8.15;
import { Predeploys } from "../libraries/Predeploys.sol";
import { OptimismMintableERC20 } from "../universal/OptimismMintableERC20.sol";
/**
* @custom:legacy
* @custom:proxied
* @custom:predeploy 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000
* @title LegacyERC20ETH
* @notice LegacyERC20ETH is a legacy contract that held ETH balances before the Bedrock upgrade.
* All ETH balances held within this contract were migrated to the state trie as part of
* the Bedrock upgrade. Functions within this contract that mutate state were already
* disabled as part of the EVM equivalence upgrade.
*/
/// @custom:legacy
/// @custom:proxied
/// @custom:predeploy 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000
/// @title LegacyERC20ETH
/// @notice LegacyERC20ETH is a legacy contract that held ETH balances before the Bedrock upgrade.
/// All ETH balances held within this contract were migrated to the state trie as part of
/// the Bedrock upgrade. Functions within this contract that mutate state were already
/// disabled as part of the EVM equivalence upgrade.
contract LegacyERC20ETH is OptimismMintableERC20 {
/**
* @notice Initializes the contract as an Optimism Mintable ERC20.
*/
/// @notice Initializes the contract as an Optimism Mintable ERC20.
constructor()
OptimismMintableERC20(Predeploys.L2_STANDARD_BRIDGE, address(0), "Ether", "ETH")
{}
/**
* @notice Returns the ETH balance of the target account. Overrides the base behavior of the
* contract to preserve the invariant that the balance within this contract always
* matches the balance in the state trie.
*
* @param _who Address of the account to query.
*
* @return The ETH balance of the target account.
*/
/// @notice Returns the ETH balance of the target account. Overrides the base behavior of the
/// contract to preserve the invariant that the balance within this contract always
/// matches the balance in the state trie.
/// @param _who Address of the account to query.
/// @return The ETH balance of the target account.
function balanceOf(address _who) public view virtual override returns (uint256) {
return address(_who).balance;
}
/**
* @custom:blocked
* @notice Mints some amount of ETH.
*/
/// @custom:blocked
/// @notice Mints some amount of ETH.
function mint(address, uint256) public virtual override {
revert("LegacyERC20ETH: mint is disabled");
}
/**
* @custom:blocked
* @notice Burns some amount of ETH.
*/
/// @custom:blocked
/// @notice Burns some amount of ETH.
function burn(address, uint256) public virtual override {
revert("LegacyERC20ETH: burn is disabled");
}
/**
* @custom:blocked
* @notice Transfers some amount of ETH.
*/
/// @custom:blocked
/// @notice Transfers some amount of ETH.
function transfer(address, uint256) public virtual override returns (bool) {
revert("LegacyERC20ETH: transfer is disabled");
}
/**
* @custom:blocked
* @notice Approves a spender to spend some amount of ETH.
*/
/// @custom:blocked
/// @notice Approves a spender to spend some amount of ETH.
function approve(address, uint256) public virtual override returns (bool) {
revert("LegacyERC20ETH: approve is disabled");
}
/**
* @custom:blocked
* @notice Transfers funds from some sender account.
*/
/// @custom:blocked
/// @notice Transfers funds from some sender account.
function transferFrom(
address,
address,
...
...
@@ -79,18 +61,14 @@ contract LegacyERC20ETH is OptimismMintableERC20 {
revert("LegacyERC20ETH: transferFrom is disabled");
}
/**
* @custom:blocked
* @notice Increases the allowance of a spender.
*/
/// @custom:blocked
/// @notice Increases the allowance of a spender.
function increaseAllowance(address, uint256) public virtual override returns (bool) {
revert("LegacyERC20ETH: increaseAllowance is disabled");
}
/**
* @custom:blocked
* @notice Decreases the allowance of a spender.
*/
/// @custom:blocked
/// @notice Decreases the allowance of a spender.
function decreaseAllowance(address, uint256) public virtual override returns (bool) {
revert("LegacyERC20ETH: decreaseAllowance is disabled");
}
...
...
packages/contracts-bedrock/contracts/legacy/LegacyMessagePasser.sol
View file @
92bc1b4f
...
...
@@ -3,30 +3,21 @@ pragma solidity 0.8.15;
import { Semver } from "../universal/Semver.sol";
/**
* @custom:legacy
* @custom:proxied
* @custom:predeploy 0x4200000000000000000000000000000000000000
* @title LegacyMessagePasser
* @notice The LegacyMessagePasser was the low-level mechanism used to send messages from L2 to L1
* before the Bedrock upgrade. It is now deprecated in favor of the new MessagePasser.
*/
/// @custom:legacy
/// @custom:proxied
/// @custom:predeploy 0x4200000000000000000000000000000000000000
/// @title LegacyMessagePasser
/// @notice The LegacyMessagePasser was the low-level mechanism used to send messages from L2 to L1
/// before the Bedrock upgrade. It is now deprecated in favor of the new MessagePasser.
contract LegacyMessagePasser is Semver {
/**
* @notice Mapping of sent message hashes to boolean status.
*/
/// @notice Mapping of sent message hashes to boolean status.
mapping(bytes32 => bool) public sentMessages;
/**
* @custom:semver 1.0.0
*/
constructor() Semver(1, 0, 0) {}
/// @custom:semver 1.0.1
constructor() Semver(1, 0, 1) {}
/**
* @notice Passes a message to L1.
*
* @param _message Message to pass to L1.
*/
/// @notice Passes a message to L1.
/// @param _message Message to pass to L1.
function passMessageToL1(bytes memory _message) external {
sentMessages[keccak256(abi.encodePacked(_message, msg.sender))] = true;
}
...
...
packages/contracts-bedrock/contracts/legacy/LegacyMintableERC20.sol
View file @
92bc1b4f
...
...
@@ -4,38 +4,26 @@ pragma solidity 0.8.15;
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { ILegacyMintableERC20 } from "../universal/OptimismMintableERC20.sol";
/**
* @title LegacyMintableERC20
* @notice The legacy implementation of the OptimismMintableERC20. This
* contract is deprecated and should no longer be used.
*/
/// @title LegacyMintableERC20
/// @notice The legacy implementation of the OptimismMintableERC20. This
/// contract is deprecated and should no longer be used.
contract LegacyMintableERC20 is ILegacyMintableERC20, ERC20 {
/**
* @notice Emitted when the token is minted by the bridge.
*/
/// @notice Emitted when the token is minted by the bridge.
event Mint(address indexed _account, uint256 _amount);
/**
* @notice Emitted when a token is burned by the bridge.
*/
/// @notice Emitted when a token is burned by the bridge.
event Burn(address indexed _account, uint256 _amount);
/**
* @notice The token on the remote domain.
*/
/// @notice The token on the remote domain.
address public l1Token;
/**
* @notice The local bridge.
*/
/// @notice The local bridge.
address public l2Bridge;
/**
* @param _l2Bridge Address of the L2 standard bridge.
* @param _l1Token Address of the corresponding L1 token.
* @param _name ERC20 name.
* @param _symbol ERC20 symbol.
*/
/// @param _l2Bridge Address of the L2 standard bridge.
/// @param _l1Token Address of the corresponding L1 token.
/// @param _name ERC20 name.
/// @param _symbol ERC20 symbol.
constructor(
address _l2Bridge,
address _l1Token,
...
...
@@ -46,17 +34,13 @@ contract LegacyMintableERC20 is ILegacyMintableERC20, ERC20 {
l2Bridge = _l2Bridge;
}
/**
* @notice Modifier that requires the contract was called by the bridge.
*/
/// @notice Modifier that requires the contract was called by the bridge.
modifier onlyL2Bridge() {
require(msg.sender == l2Bridge, "Only L2 Bridge can mint and burn");
_;
}
/**
* @notice EIP165 implementation.
*/
/// @notice EIP165 implementation.
function supportsInterface(bytes4 _interfaceId) public pure returns (bool) {
bytes4 firstSupportedInterface = bytes4(keccak256("supportsInterface(bytes4)")); // ERC165
bytes4 secondSupportedInterface = ILegacyMintableERC20.l1Token.selector ^
...
...
@@ -65,22 +49,18 @@ contract LegacyMintableERC20 is ILegacyMintableERC20, ERC20 {
return _interfaceId == firstSupportedInterface || _interfaceId == secondSupportedInterface;
}
/**
* @notice Only the bridge can mint tokens.
* @param _to The account receiving tokens.
* @param _amount The amount of tokens to receive.
*/
/// @notice Only the bridge can mint tokens.
/// @param _to The account receiving tokens.
/// @param _amount The amount of tokens to receive.
function mint(address _to, uint256 _amount) public virtual onlyL2Bridge {
_mint(_to, _amount);
emit Mint(_to, _amount);
}
/**
* @notice Only the bridge can burn tokens.
* @param _from The account having tokens burnt.
* @param _amount The amount of tokens being burnt.
*/
/// @notice Only the bridge can burn tokens.
/// @param _from The account having tokens burnt.
/// @param _amount The amount of tokens being burnt.
function burn(address _from, uint256 _amount) public virtual onlyL2Bridge {
_burn(_from, _amount);
...
...
packages/contracts-bedrock/contracts/legacy/ResolvedDelegateProxy.sol
View file @
92bc1b4f
...
...
@@ -3,43 +3,33 @@ pragma solidity 0.8.15;
import { AddressManager } from "./AddressManager.sol";
/**
* @custom:legacy
* @title ResolvedDelegateProxy
* @notice ResolvedDelegateProxy is a legacy proxy contract that makes use of the AddressManager to
* resolve the implementation address. We're maintaining this contract for backwards
* compatibility so we can manage all legacy proxies where necessary.
*/
/// @custom:legacy
/// @title ResolvedDelegateProxy
/// @notice ResolvedDelegateProxy is a legacy proxy contract that makes use of the AddressManager to
/// resolve the implementation address. We're maintaining this contract for backwards
/// compatibility so we can manage all legacy proxies where necessary.
contract ResolvedDelegateProxy {
/**
* @notice Mapping used to store the implementation name that corresponds to this contract. A
* mapping was originally used as a way to bypass the same issue normally solved by
* storing the implementation address in a specific storage slot that does not conflict
* with any other storage slot. Generally NOT a safe solution but works as long as the
* implementation does not also keep a mapping in the first storage slot.
*/
/// @notice Mapping used to store the implementation name that corresponds to this contract. A
/// mapping was originally used as a way to bypass the same issue normally solved by
/// storing the implementation address in a specific storage slot that does not conflict
/// with any other storage slot. Generally NOT a safe solution but works as long as the
/// implementation does not also keep a mapping in the first storage slot.
mapping(address => string) private implementationName;
/**
* @notice Mapping used to store the address of the AddressManager contract where the
* implementation address will be resolved from. Same concept here as with the above
* mapping. Also generally unsafe but fine if the implementation doesn't keep a mapping
* in the second storage slot.
*/
/// @notice Mapping used to store the address of the AddressManager contract where the
/// implementation address will be resolved from. Same concept here as with the above
/// mapping. Also generally unsafe but fine if the implementation doesn't keep a mapping
/// in the second storage slot.
mapping(address => AddressManager) private addressManager;
/**
* @param _addressManager Address of the AddressManager.
* @param _implementationName implementationName of the contract to proxy to.
*/
/// @param _addressManager Address of the AddressManager.
/// @param _implementationName implementationName of the contract to proxy to.
constructor(AddressManager _addressManager, string memory _implementationName) {
addressManager[address(this)] = _addressManager;
implementationName[address(this)] = _implementationName;
}
/**
* @notice Fallback, performs a delegatecall to the resolved implementation address.
*/
/// @notice Fallback, performs a delegatecall to the resolved implementation address.
// solhint-disable-next-line no-complex-fallback
fallback() external payable {
address target = addressManager[address(this)].getAddress(
...
...
packages/contracts-bedrock/contracts/test/DeployerWhitelist.t.sol
View file @
92bc1b4f
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Testing utilities
import { CommonTest } from "./CommonTest.t.sol";
// Target contract
import { DeployerWhitelist } from "../legacy/DeployerWhitelist.sol";
contract DeployerWhitelist_Test is CommonTest {
DeployerWhitelist list;
/// @dev Sets up the test suite.
function setUp() public virtual override {
list = new DeployerWhitelist();
}
//
The owner should be address(0)
//
/ @dev Tests that `owner` is initialized to the zero address.
function test_owner_succeeds() external {
assertEq(list.owner(), address(0));
}
//
The storage slot for the owner must be the same
//
/ @dev Tests that `setOwner` correctly sets the contract owner.
function test_storageSlots_succeeds() external {
vm.prank(list.owner());
list.setOwner(address(1));
...
...
packages/contracts-bedrock/contracts/test/L1BlockNumber.t.sol
View file @
92bc1b4f
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Testing utilities
import { Test } from "forge-std/Test.sol";
// Target contract dependencies
import { L1Block } from "../L2/L1Block.sol";
import { L1BlockNumber } from "../legacy/L1BlockNumber.sol";
import { Predeploys } from "../libraries/Predeploys.sol";
// Target contract
import { L1BlockNumber } from "../legacy/L1BlockNumber.sol";
contract L1BlockNumberTest is Test {
L1Block lb;
L1BlockNumber bn;
uint64 constant number = 99;
/// @dev Sets up the test suite.
function setUp() external {
vm.etch(Predeploys.L1_BLOCK_ATTRIBUTES, address(new L1Block()).code);
lb = L1Block(Predeploys.L1_BLOCK_ATTRIBUTES);
...
...
@@ -30,16 +36,19 @@ contract L1BlockNumberTest is Test {
});
}
/// @dev Tests that `getL1BlockNumber` returns the set block number.
function test_getL1BlockNumber_succeeds() external {
assertEq(bn.getL1BlockNumber(), number);
}
/// @dev Tests that `fallback` is correctly dispatched.
function test_fallback_succeeds() external {
(bool success, bytes memory ret) = address(bn).call(hex"");
assertEq(success, true);
assertEq(ret, abi.encode(number));
}
/// @dev Tests that `receive` is correctly dispatched.
function test_receive_succeeds() external {
(bool success, bytes memory ret) = address(bn).call{ value: 1 }(hex"");
assertEq(success, true);
...
...
packages/contracts-bedrock/contracts/test/LegacyERC20ETH.t.sol
View file @
92bc1b4f
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Testing utilities
import { CommonTest } from "./CommonTest.t.sol";
import { LegacyERC20ETH } from "../legacy/LegacyERC20ETH.sol";
// Target contract dependencies
import { Predeploys } from "../libraries/Predeploys.sol";
// Target contract
import { LegacyERC20ETH } from "../legacy/LegacyERC20ETH.sol";
contract LegacyERC20ETH_Test is CommonTest {
LegacyERC20ETH eth;
/// @dev Sets up the test suite.
function setUp() public virtual override {
super.setUp();
eth = new LegacyERC20ETH();
}
/// @dev Tests that the default metadata was set correctly.
function test_metadata_succeeds() external {
assertEq(eth.name(), "Ether");
assertEq(eth.symbol(), "ETH");
assertEq(eth.decimals(), 18);
}
/// @dev Tests that `l2Bridge` and `l1Token` return the correct values.
function test_crossDomain_succeeds() external {
assertEq(eth.l2Bridge(), Predeploys.L2_STANDARD_BRIDGE);
assertEq(eth.l1Token(), address(0));
}
/// @dev Tests that `transfer` reverts since it does not exist.
function test_transfer_doesNotExist_reverts() external {
vm.expectRevert("LegacyERC20ETH: transfer is disabled");
eth.transfer(alice, 100);
}
/// @dev Tests that `approve` reverts since it does not exist.
function test_approve_doesNotExist_reverts() external {
vm.expectRevert("LegacyERC20ETH: approve is disabled");
eth.approve(alice, 100);
}
/// @dev Tests that `transferFrom` reverts since it does not exist.
function test_transferFrom_doesNotExist_reverts() external {
vm.expectRevert("LegacyERC20ETH: transferFrom is disabled");
eth.transferFrom(bob, alice, 100);
}
/// @dev Tests that `increaseAllowance` reverts since it does not exist.
function test_increaseAllowance_doesNotExist_reverts() external {
vm.expectRevert("LegacyERC20ETH: increaseAllowance is disabled");
eth.increaseAllowance(alice, 100);
}
/// @dev Tests that `decreaseAllowance` reverts since it does not exist.
function test_decreaseAllowance_doesNotExist_reverts() external {
vm.expectRevert("LegacyERC20ETH: decreaseAllowance is disabled");
eth.decreaseAllowance(alice, 100);
}
/// @dev Tests that `mint` reverts since it does not exist.
function test_mint_doesNotExist_reverts() external {
vm.expectRevert("LegacyERC20ETH: mint is disabled");
eth.mint(alice, 100);
}
/// @dev Tests that `burn` reverts since it does not exist.
function test_burn_doesNotExist_reverts() external {
vm.expectRevert("LegacyERC20ETH: burn is disabled");
eth.burn(alice, 100);
...
...
packages/contracts-bedrock/contracts/test/LegacyMessagePasser.t.sol
View file @
92bc1b4f
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Testing utilities
import { CommonTest } from "./CommonTest.t.sol";
import { LegacyMessagePasser } from "../legacy/LegacyMessagePasser.sol";
// Testing contract dependencies
import { Predeploys } from "../libraries/Predeploys.sol";
// Target contract
import { LegacyMessagePasser } from "../legacy/LegacyMessagePasser.sol";
contract LegacyMessagePasser_Test is CommonTest {
LegacyMessagePasser messagePasser;
/// @dev Sets up the test suite.
function setUp() public virtual override {
super.setUp();
messagePasser = new LegacyMessagePasser();
}
/// @dev Tests that `passMessageToL1` succeeds.
function test_passMessageToL1_succeeds() external {
vm.prank(alice);
messagePasser.passMessageToL1(hex"ff");
...
...
packages/contracts-bedrock/contracts/test/ResolvedDelegateProxy.t.sol
View file @
92bc1b4f
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Testing utilities
import { Test } from "forge-std/Test.sol";
// Target contract dependencies
import { AddressManager } from "../legacy/AddressManager.sol";
// Target contract
import { ResolvedDelegateProxy } from "../legacy/ResolvedDelegateProxy.sol";
contract ResolvedDelegateProxy_Test is Test {
...
...
@@ -10,6 +15,7 @@ contract ResolvedDelegateProxy_Test is Test {
SimpleImplementation internal impl;
SimpleImplementation internal proxy;
/// @dev Sets up the test suite.
function setUp() public {
// Set up the address manager.
addressManager = new AddressManager();
...
...
@@ -22,21 +28,21 @@ contract ResolvedDelegateProxy_Test is Test {
);
}
// Tests that the proxy properly bubbles up returndata when the delegatecall succeeds.
//
/ @dev
Tests that the proxy properly bubbles up returndata when the delegatecall succeeds.
function testFuzz_fallback_delegateCallFoo_succeeds(uint256 x) public {
vm.expectCall(address(impl), abi.encodeWithSelector(impl.foo.selector, x));
assertEq(proxy.foo(x), x);
}
// Tests that the proxy properly bubbles up returndata when the delegatecall reverts.
//
/ @dev
Tests that the proxy properly bubbles up returndata when the delegatecall reverts.
function test_fallback_delegateCallBar_reverts() public {
vm.expectRevert("SimpleImplementation: revert");
vm.expectCall(address(impl), abi.encodeWithSelector(impl.bar.selector));
proxy.bar();
}
// Tests that the proxy fallback reverts as expected if the implementation within the
// address manager is not set.
//
/ @dev
Tests that the proxy fallback reverts as expected if the implementation within the
//
/
address manager is not set.
function test_fallback_addressManagerNotSet_reverts() public {
AddressManager am = new AddressManager();
SimpleImplementation p = SimpleImplementation(
...
...
packages/contracts-bedrock/tasks/check-l2.ts
View file @
92bc1b4f
...
...
@@ -234,7 +234,7 @@ const check = {
signer
)
await
assertSemver
(
LegacyMessagePasser
,
'
LegacyMessagePasser
'
)
await
assertSemver
(
LegacyMessagePasser
,
'
LegacyMessagePasser
'
,
'
1.0.1
'
)
await
checkProxy
(
hre
,
'
LegacyMessagePasser
'
,
signer
.
provider
)
await
assertProxy
(
hre
,
'
LegacyMessagePasser
'
,
signer
.
provider
)
},
...
...
@@ -249,7 +249,7 @@ const check = {
signer
)
await
assertSemver
(
DeployerWhitelist
,
'
DeployerWhitelist
'
)
await
assertSemver
(
DeployerWhitelist
,
'
DeployerWhitelist
'
,
'
1.0.1
'
)
const
owner
=
await
DeployerWhitelist
.
owner
()
assert
(
owner
===
hre
.
ethers
.
constants
.
AddressZero
)
...
...
@@ -446,7 +446,7 @@ const check = {
signer
)
await
assertSemver
(
L1BlockNumber
,
'
L1BlockNumber
'
)
await
assertSemver
(
L1BlockNumber
,
'
L1BlockNumber
'
,
'
1.0.1
'
)
await
checkProxy
(
hre
,
'
L1BlockNumber
'
,
signer
.
provider
)
await
assertProxy
(
hre
,
'
L1BlockNumber
'
,
signer
.
provider
)
...
...
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