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
9aa2b9ae
Commit
9aa2b9ae
authored
Apr 05, 2023
by
Federico Gimenez
Committed by
Andreas Bigger
Aug 19, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
contracts-bedrock: eip 1967 constants in Constants.sol
parent
07a461c3
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
71 additions
and
49 deletions
+71
-49
mips_more.go
op-bindings/bindings/mips_more.go
+1
-1
preimageoracle_more.go
op-bindings/bindings/preimageoracle_more.go
+1
-1
proxy.go
op-bindings/bindings/proxy.go
+1
-1
proxy_more.go
op-bindings/bindings/proxy_more.go
+1
-1
.gas-snapshot
packages/contracts-bedrock/.gas-snapshot
+21
-20
L1ChugSplashProxy.sol
packages/contracts-bedrock/src/legacy/L1ChugSplashProxy.sol
+10
-10
Constants.sol
packages/contracts-bedrock/src/libraries/Constants.sol
+9
-0
Proxy.sol
packages/contracts-bedrock/src/universal/Proxy.sol
+10
-12
ProxyAdmin.sol
packages/contracts-bedrock/src/universal/ProxyAdmin.sol
+2
-3
Constants.t.sol
packages/contracts-bedrock/test/Constants.t.sol
+15
-0
No files found.
op-bindings/bindings/mips_more.go
View file @
9aa2b9ae
This diff is collapsed.
Click to expand it.
op-bindings/bindings/preimageoracle_more.go
View file @
9aa2b9ae
This diff is collapsed.
Click to expand it.
op-bindings/bindings/proxy.go
View file @
9aa2b9ae
This diff is collapsed.
Click to expand it.
op-bindings/bindings/proxy_more.go
View file @
9aa2b9ae
...
@@ -13,7 +13,7 @@ const ProxyStorageLayoutJSON = "{\"storage\":null,\"types\":{}}"
...
@@ -13,7 +13,7 @@ const ProxyStorageLayoutJSON = "{\"storage\":null,\"types\":{}}"
var
ProxyStorageLayout
=
new
(
solc
.
StorageLayout
)
var
ProxyStorageLayout
=
new
(
solc
.
StorageLayout
)
var
ProxyDeployedBin
=
"0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100be5780638f283970146100f8578063f851a440146101185761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61012d565b005b61006b61012d565b34801561008157600080fd5b5061006b6100903660046106d
9565b610224565b6100a86100a33660046106f4565b610296565b6040516100b59190610777565b60405180910390f35b3480156100ca57600080fd5b506100d3610419565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100b5565b34801561010457600080fd5b5061006b6101133660046106d9565b6104b0565b34801561012457600080fd5b506100d3610517565b60006101577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b905073ffffffffffffffffffffffffffffffffffffffff8116610201576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f50726f78793a20696d706c656d656e746174696f6e206e6f7420696e6974696160448201527f6c697a656400000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b3660008037600080366000845af43d6000803e8061021e573d6000fd5b503d6000f35b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061027d575033155b1561028e5761028b816105a3565b50565b61028b61012d565b60606102c07fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806102f7575033155b1561040a57610305846105a3565b6000808573ffffffffffffffffffffffffffffffffffffffff16858560405161032f9291906107ea565b600060405180830381855af49150503d806000811461036a576040519150601f19603f3d011682016040523d82523d6000602084013e61036f565b606091505b509150915081610401576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603960248201527f50726f78793a2064656c656761746563616c6c20746f206e657720696d706c6560448201527f6d656e746174696f6e20636f6e7472616374206661696c65640000000000000060648201526084016101f8565b91506104129050565b61041261012d565b9392505050565b60006104437fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061047a575033155b156104a557507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6104ad61012d565b90565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610509575033155b1561028e5761028b8161060b565b60006105417fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610578575033155b156104a557507fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc81905560405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60006106357fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61038390556040805173ffffffffffffffffffffffffffffffffffffffff8084168252851660208201529192507f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f910160405180910390a15050565b803573ffffffffffffffffffffffffffffffffffffffff811681146106d457600080fd5b919050565b6000602082840312156106eb57600080fd5b610412826106b0565b60008060006040848603121561070957600080fd5b610712846106b0565b9250602084013567ffffffffffffffff8082111561072f57600080fd5b818601915086601f83011261074357600080fd5b81358181111561075257600080fd5b87602082850101111561076457600080fd5b6020830194508093505050509250925092565b600060208083528351808285015260005b818110156107a457858101830151858201604001528201610788565b818111156107b6
576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b818382376000910190815291905056fea164736f6c634300080f000a"
var
ProxyDeployedBin
=
"0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100be5780638f283970146100f8578063f851a440146101185761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61012d565b005b61006b61012d565b34801561008157600080fd5b5061006b6100903660046106d
d565b610224565b6100a86100a33660046106f8565b610296565b6040516100b5919061077b565b60405180910390f35b3480156100ca57600080fd5b506100d3610419565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100b5565b34801561010457600080fd5b5061006b6101133660046106dd565b6104b0565b34801561012457600080fd5b506100d3610517565b60006101577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b905073ffffffffffffffffffffffffffffffffffffffff8116610201576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f50726f78793a20696d706c656d656e746174696f6e206e6f7420696e6974696160448201527f6c697a656400000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b3660008037600080366000845af43d6000803e8061021e573d6000fd5b503d6000f35b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061027d575033155b1561028e5761028b816105a3565b50565b61028b61012d565b60606102c07fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806102f7575033155b1561040a57610305846105a3565b6000808573ffffffffffffffffffffffffffffffffffffffff16858560405161032f9291906107ee565b600060405180830381855af49150503d806000811461036a576040519150601f19603f3d011682016040523d82523d6000602084013e61036f565b606091505b509150915081610401576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603960248201527f50726f78793a2064656c656761746563616c6c20746f206e657720696d706c6560448201527f6d656e746174696f6e20636f6e7472616374206661696c65640000000000000060648201526084016101f8565b91506104129050565b61041261012d565b9392505050565b60006104437fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061047a575033155b156104a557507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6104ad61012d565b90565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610509575033155b1561028e5761028b8161060c565b60006105417fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610578575033155b156104a557507fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc81815560405173ffffffffffffffffffffffffffffffffffffffff8316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a25050565b60006106367fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61038381556040805173ffffffffffffffffffffffffffffffffffffffff80851682528616602082015292935090917f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f910160405180910390a1505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146106d857600080fd5b919050565b6000602082840312156106ef57600080fd5b610412826106b4565b60008060006040848603121561070d57600080fd5b610716846106b4565b9250602084013567ffffffffffffffff8082111561073357600080fd5b818601915086601f83011261074757600080fd5b81358181111561075657600080fd5b87602082850101111561076857600080fd5b6020830194508093505050509250925092565b600060208083528351808285015260005b818110156107a85785810183015185820160400152820161078c565b818111156107ba
576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b818382376000910190815291905056fea164736f6c634300080f000a"
func
init
()
{
func
init
()
{
if
err
:=
json
.
Unmarshal
([]
byte
(
ProxyStorageLayoutJSON
),
ProxyStorageLayout
);
err
!=
nil
{
if
err
:=
json
.
Unmarshal
([]
byte
(
ProxyStorageLayoutJSON
),
ProxyStorageLayout
);
err
!=
nil
{
...
...
packages/contracts-bedrock/.gas-snapshot
View file @
9aa2b9ae
...
@@ -25,6 +25,7 @@ Bytes_slice_Test:test_slice_fromZeroIdx_works() (gas: 20804)
...
@@ -25,6 +25,7 @@ Bytes_slice_Test:test_slice_fromZeroIdx_works() (gas: 20804)
Bytes_toNibbles_Test:test_toNibbles_expectedResult128Bytes_works() (gas: 78882)
Bytes_toNibbles_Test:test_toNibbles_expectedResult128Bytes_works() (gas: 78882)
Bytes_toNibbles_Test:test_toNibbles_expectedResult5Bytes_works() (gas: 3992)
Bytes_toNibbles_Test:test_toNibbles_expectedResult5Bytes_works() (gas: 3992)
Bytes_toNibbles_Test:test_toNibbles_zeroLengthInput_works() (gas: 823)
Bytes_toNibbles_Test:test_toNibbles_zeroLengthInput_works() (gas: 823)
Constants_Test:test_eip1967Constants_succeeds() (gas: 453)
CrossDomainMessenger_BaseGas_Test:test_baseGas_succeeds() (gas: 20435)
CrossDomainMessenger_BaseGas_Test:test_baseGas_succeeds() (gas: 20435)
CrossDomainOwnable2_Test:test_onlyOwner_notMessenger_reverts() (gas: 8461)
CrossDomainOwnable2_Test:test_onlyOwner_notMessenger_reverts() (gas: 8461)
CrossDomainOwnable2_Test:test_onlyOwner_notOwner2_reverts() (gas: 57515)
CrossDomainOwnable2_Test:test_onlyOwner_notOwner2_reverts() (gas: 57515)
...
@@ -239,7 +240,7 @@ L2OutputOracleUpgradeable_Test:test_initValuesOnImpl_succeeds() (gas: 23902)
...
@@ -239,7 +240,7 @@ L2OutputOracleUpgradeable_Test:test_initValuesOnImpl_succeeds() (gas: 23902)
L2OutputOracleUpgradeable_Test:test_initValuesOnProxy_succeeds() (gas: 46800)
L2OutputOracleUpgradeable_Test:test_initValuesOnProxy_succeeds() (gas: 46800)
L2OutputOracleUpgradeable_Test:test_initializeImpl_alreadyInitialized_reverts() (gas: 15216)
L2OutputOracleUpgradeable_Test:test_initializeImpl_alreadyInitialized_reverts() (gas: 15216)
L2OutputOracleUpgradeable_Test:test_initializeProxy_alreadyInitialized_reverts() (gas: 20216)
L2OutputOracleUpgradeable_Test:test_initializeProxy_alreadyInitialized_reverts() (gas: 20216)
L2OutputOracleUpgradeable_Test:test_upgrading_succeeds() (gas: 19134
6
)
L2OutputOracleUpgradeable_Test:test_upgrading_succeeds() (gas: 19134
8
)
L2OutputOracle_constructor_Test:test_constructor_l2BlockTimeZero_reverts() (gas: 39212)
L2OutputOracle_constructor_Test:test_constructor_l2BlockTimeZero_reverts() (gas: 39212)
L2OutputOracle_constructor_Test:test_constructor_submissionInterval_reverts() (gas: 39222)
L2OutputOracle_constructor_Test:test_constructor_submissionInterval_reverts() (gas: 39222)
L2OutputOracle_constructor_Test:test_constructor_succeeds() (gas: 51777)
L2OutputOracle_constructor_Test:test_constructor_succeeds() (gas: 51777)
...
@@ -430,7 +431,7 @@ OptimismMintableTokenFactory_Test:test_createStandardL2Token_succeeds() (gas: 12
...
@@ -430,7 +431,7 @@ OptimismMintableTokenFactory_Test:test_createStandardL2Token_succeeds() (gas: 12
OptimismPortalUpgradeable_Test:test_initialize_cannotInitImpl_reverts() (gas: 11178)
OptimismPortalUpgradeable_Test:test_initialize_cannotInitImpl_reverts() (gas: 11178)
OptimismPortalUpgradeable_Test:test_initialize_cannotInitProxy_reverts() (gas: 16111)
OptimismPortalUpgradeable_Test:test_initialize_cannotInitProxy_reverts() (gas: 16111)
OptimismPortalUpgradeable_Test:test_params_initValuesOnProxy_succeeds() (gas: 26781)
OptimismPortalUpgradeable_Test:test_params_initValuesOnProxy_succeeds() (gas: 26781)
OptimismPortalUpgradeable_Test:test_upgradeToAndCall_upgrading_succeeds() (gas: 19141
2
)
OptimismPortalUpgradeable_Test:test_upgradeToAndCall_upgrading_succeeds() (gas: 19141
4
)
OptimismPortal_FinalizeWithdrawal_Test:test_finalizeWithdrawalTransaction_ifOutputRootChanges_reverts() (gas: 178667)
OptimismPortal_FinalizeWithdrawal_Test:test_finalizeWithdrawalTransaction_ifOutputRootChanges_reverts() (gas: 178667)
OptimismPortal_FinalizeWithdrawal_Test:test_finalizeWithdrawalTransaction_ifOutputTimestampIsNotFinalized_reverts() (gas: 182306)
OptimismPortal_FinalizeWithdrawal_Test:test_finalizeWithdrawalTransaction_ifOutputTimestampIsNotFinalized_reverts() (gas: 182306)
OptimismPortal_FinalizeWithdrawal_Test:test_finalizeWithdrawalTransaction_ifWithdrawalNotProven_reverts() (gas: 41780)
OptimismPortal_FinalizeWithdrawal_Test:test_finalizeWithdrawalTransaction_ifWithdrawalNotProven_reverts() (gas: 41780)
...
@@ -533,11 +534,11 @@ ProxyAdmin_Test:test_delegateResolvedGetProxyAdmin_succeeds() (gas: 17691)
...
@@ -533,11 +534,11 @@ ProxyAdmin_Test:test_delegateResolvedGetProxyAdmin_succeeds() (gas: 17691)
ProxyAdmin_Test:test_delegateResolvedGetProxyImplementation_succeeds() (gas: 62028)
ProxyAdmin_Test:test_delegateResolvedGetProxyImplementation_succeeds() (gas: 62028)
ProxyAdmin_Test:test_delegateResolvedUpgradeAndCall_succeeds() (gas: 98039)
ProxyAdmin_Test:test_delegateResolvedUpgradeAndCall_succeeds() (gas: 98039)
ProxyAdmin_Test:test_delegateResolvedUpgrade_succeeds() (gas: 58482)
ProxyAdmin_Test:test_delegateResolvedUpgrade_succeeds() (gas: 58482)
ProxyAdmin_Test:test_erc1967ChangeProxyAdmin_succeeds() (gas: 338
12
)
ProxyAdmin_Test:test_erc1967ChangeProxyAdmin_succeeds() (gas: 338
20
)
ProxyAdmin_Test:test_erc1967GetProxyAdmin_succeeds() (gas: 15616)
ProxyAdmin_Test:test_erc1967GetProxyAdmin_succeeds() (gas: 15616)
ProxyAdmin_Test:test_erc1967GetProxyImplementation_succeeds() (gas: 5207
1
)
ProxyAdmin_Test:test_erc1967GetProxyImplementation_succeeds() (gas: 5207
3
)
ProxyAdmin_Test:test_erc1967UpgradeAndCall_succeeds() (gas: 789
69
)
ProxyAdmin_Test:test_erc1967UpgradeAndCall_succeeds() (gas: 789
71
)
ProxyAdmin_Test:test_erc1967Upgrade_succeeds() (gas: 500
78
)
ProxyAdmin_Test:test_erc1967Upgrade_succeeds() (gas: 500
80
)
ProxyAdmin_Test:test_isUpgrading_succeeds() (gas: 19442)
ProxyAdmin_Test:test_isUpgrading_succeeds() (gas: 19442)
ProxyAdmin_Test:test_onlyOwner_notOwner_reverts() (gas: 22767)
ProxyAdmin_Test:test_onlyOwner_notOwner_reverts() (gas: 22767)
ProxyAdmin_Test:test_owner_succeeds() (gas: 9738)
ProxyAdmin_Test:test_owner_succeeds() (gas: 9738)
...
@@ -547,16 +548,16 @@ ProxyAdmin_Test:test_setImplementationName_notOwner_reverts() (gas: 11111)
...
@@ -547,16 +548,16 @@ ProxyAdmin_Test:test_setImplementationName_notOwner_reverts() (gas: 11111)
ProxyAdmin_Test:test_setImplementationName_succeeds() (gas: 38945)
ProxyAdmin_Test:test_setImplementationName_succeeds() (gas: 38945)
ProxyAdmin_Test:test_setProxyType_notOwner_reverts() (gas: 10814)
ProxyAdmin_Test:test_setProxyType_notOwner_reverts() (gas: 10814)
Proxy_Test:test_delegatesToImpl_succeeds() (gas: 45207)
Proxy_Test:test_delegatesToImpl_succeeds() (gas: 45207)
Proxy_Test:test_implementationKey_succeeds() (gas: 209
09
)
Proxy_Test:test_implementationKey_succeeds() (gas: 209
11
)
Proxy_Test:test_implementation_isZeroAddress_reverts() (gas: 4762
6
)
Proxy_Test:test_implementation_isZeroAddress_reverts() (gas: 4762
8
)
Proxy_Test:test_implementation_zeroAddressCaller_succeeds() (gas: 14752)
Proxy_Test:test_implementation_zeroAddressCaller_succeeds() (gas: 14752)
Proxy_Test:test_ownerKey_succeeds() (gas: 190
59
)
Proxy_Test:test_ownerKey_succeeds() (gas: 190
67
)
Proxy_Test:test_ownerProxyCall_notAdmin_succeeds() (gas: 346
15
)
Proxy_Test:test_ownerProxyCall_notAdmin_succeeds() (gas: 346
23
)
Proxy_Test:test_proxyCallToImp_notAdmin_succeeds() (gas: 300
08
)
Proxy_Test:test_proxyCallToImp_notAdmin_succeeds() (gas: 300
10
)
Proxy_Test:test_upgradeToAndCall_functionDoesNotExist_reverts() (gas: 10456
5
)
Proxy_Test:test_upgradeToAndCall_functionDoesNotExist_reverts() (gas: 10456
7
)
Proxy_Test:test_upgradeToAndCall_isPayable_succeeds() (gas: 5374
2
)
Proxy_Test:test_upgradeToAndCall_isPayable_succeeds() (gas: 5374
4
)
Proxy_Test:test_upgradeToAndCall_succeeds() (gas: 12519
0
)
Proxy_Test:test_upgradeToAndCall_succeeds() (gas: 12519
2
)
Proxy_Test:test_upgradeTo_clashingFunctionSignatures_succeeds() (gas: 1013
59
)
Proxy_Test:test_upgradeTo_clashingFunctionSignatures_succeeds() (gas: 1013
63
)
RLPReader_readBytes_Test:test_readBytes_bytestring00_succeeds() (gas: 1863)
RLPReader_readBytes_Test:test_readBytes_bytestring00_succeeds() (gas: 1863)
RLPReader_readBytes_Test:test_readBytes_bytestring01_succeeds() (gas: 1840)
RLPReader_readBytes_Test:test_readBytes_bytestring01_succeeds() (gas: 1840)
RLPReader_readBytes_Test:test_readBytes_bytestring7f_succeeds() (gas: 1861)
RLPReader_readBytes_Test:test_readBytes_bytestring7f_succeeds() (gas: 1861)
...
@@ -631,7 +632,7 @@ ResourceMetering_Test:test_meter_useMax_succeeds() (gas: 20020816)
...
@@ -631,7 +632,7 @@ ResourceMetering_Test:test_meter_useMax_succeeds() (gas: 20020816)
ResourceMetering_Test:test_meter_useMoreThanMax_reverts() (gas: 19549)
ResourceMetering_Test:test_meter_useMoreThanMax_reverts() (gas: 19549)
SafeCall_Test:test_callWithMinGas_noLeakageHigh_succeeds() (gas: 1021670598)
SafeCall_Test:test_callWithMinGas_noLeakageHigh_succeeds() (gas: 1021670598)
SafeCall_Test:test_callWithMinGas_noLeakageLow_succeeds() (gas: 1095190710)
SafeCall_Test:test_callWithMinGas_noLeakageLow_succeeds() (gas: 1095190710)
Semver_Test:test_behindProxy_succeeds() (gas: 50
674
8)
Semver_Test:test_behindProxy_succeeds() (gas: 50
755
8)
Semver_Test:test_version_succeeds() (gas: 9418)
Semver_Test:test_version_succeeds() (gas: 9418)
SequencerFeeVault_L2Withdrawal_Test:test_withdraw_toL2_succeeds() (gas: 78333)
SequencerFeeVault_L2Withdrawal_Test:test_withdraw_toL2_succeeds() (gas: 78333)
SequencerFeeVault_L2Withdrawal_Test:test_withdraw_toL2recipientReverts_fails() (gas: 46486)
SequencerFeeVault_L2Withdrawal_Test:test_withdraw_toL2recipientReverts_fails() (gas: 46486)
...
@@ -643,11 +644,11 @@ SequencerFeeVault_Test:test_withdraw_toL1_succeeds() (gas: 171357)
...
@@ -643,11 +644,11 @@ SequencerFeeVault_Test:test_withdraw_toL1_succeeds() (gas: 171357)
SetPrevBaseFee_Test:test_setPrevBaseFee_succeeds() (gas: 11549)
SetPrevBaseFee_Test:test_setPrevBaseFee_succeeds() (gas: 11549)
StandardBridge_Stateless_Test:test_isCorrectTokenPair_succeeds() (gas: 49936)
StandardBridge_Stateless_Test:test_isCorrectTokenPair_succeeds() (gas: 49936)
StandardBridge_Stateless_Test:test_isOptimismMintableERC20_succeeds() (gas: 33072)
StandardBridge_Stateless_Test:test_isOptimismMintableERC20_succeeds() (gas: 33072)
SystemConfig_Initialize_Test:test_initialize_events_succeeds() (gas: 720
59
)
SystemConfig_Initialize_Test:test_initialize_events_succeeds() (gas: 720
60
)
SystemConfig_Initialize_Test:test_initialize_startBlockOverride_succeeds() (gas: 6524
0
)
SystemConfig_Initialize_Test:test_initialize_startBlockOverride_succeeds() (gas: 6524
2
)
SystemConfig_Initialize_Test:test_initialize_values_succeeds() (gas: 64946)
SystemConfig_Initialize_Test:test_initialize_values_succeeds() (gas: 64946)
SystemConfig_Initialize_TestFail:test_initialize_lowGasLimit_reverts() (gas: 5565
3
)
SystemConfig_Initialize_TestFail:test_initialize_lowGasLimit_reverts() (gas: 5565
5
)
SystemConfig_Initialize_TestFail:test_initialize_startBlock_reverts() (gas: 7835
0
)
SystemConfig_Initialize_TestFail:test_initialize_startBlock_reverts() (gas: 7835
2
)
SystemConfig_Setters_TestFail:test_setBatcherHash_notOwner_reverts() (gas: 15607)
SystemConfig_Setters_TestFail:test_setBatcherHash_notOwner_reverts() (gas: 15607)
SystemConfig_Setters_TestFail:test_setGasConfig_notOwner_reverts() (gas: 15577)
SystemConfig_Setters_TestFail:test_setGasConfig_notOwner_reverts() (gas: 15577)
SystemConfig_Setters_TestFail:test_setGasLimit_notOwner_reverts() (gas: 15676)
SystemConfig_Setters_TestFail:test_setGasLimit_notOwner_reverts() (gas: 15676)
...
...
packages/contracts-bedrock/src/legacy/L1ChugSplashProxy.sol
View file @
9aa2b9ae
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
pragma solidity 0.8.15;
import { Constants } from "../libraries/Constants.sol";
/// @title IL1ChugSplashDeployer
/// @title IL1ChugSplashDeployer
interface IL1ChugSplashDeployer {
interface IL1ChugSplashDeployer {
function isUpgrading() external view returns (bool);
function isUpgrading() external view returns (bool);
...
@@ -21,12 +23,6 @@ contract L1ChugSplashProxy {
...
@@ -21,12 +23,6 @@ contract L1ChugSplashProxy {
/// contract, the appended bytecode will be deployed as given.
/// contract, the appended bytecode will be deployed as given.
bytes13 internal constant DEPLOY_CODE_PREFIX = 0x600D380380600D6000396000f3;
bytes13 internal constant DEPLOY_CODE_PREFIX = 0x600D380380600D6000396000f3;
/// @notice bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)
bytes32 internal constant IMPLEMENTATION_KEY = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/// @notice bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1)
bytes32 internal constant OWNER_KEY = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/// @notice Blocks a function from being called when the parent signals that the system should
/// @notice Blocks a function from being called when the parent signals that the system should
/// be paused via an isUpgrading function.
/// be paused via an isUpgrading function.
modifier onlyWhenNotPaused() {
modifier onlyWhenNotPaused() {
...
@@ -160,16 +156,18 @@ contract L1ChugSplashProxy {
...
@@ -160,16 +156,18 @@ contract L1ChugSplashProxy {
/// @notice Sets the implementation address.
/// @notice Sets the implementation address.
/// @param _implementation New implementation address.
/// @param _implementation New implementation address.
function _setImplementation(address _implementation) internal {
function _setImplementation(address _implementation) internal {
bytes32 proxyImplementation = Constants.PROXY_IMPLEMENTATION_ADDRESS;
assembly {
assembly {
sstore(
IMPLEMENTATION_KEY
, _implementation)
sstore(
proxyImplementation
, _implementation)
}
}
}
}
/// @notice Changes the owner of the proxy contract.
/// @notice Changes the owner of the proxy contract.
/// @param _owner New owner of the proxy contract.
/// @param _owner New owner of the proxy contract.
function _setOwner(address _owner) internal {
function _setOwner(address _owner) internal {
bytes32 proxyOwner = Constants.PROXY_OWNER_ADDRESS;
assembly {
assembly {
sstore(
OWNER_KEY
, _owner)
sstore(
proxyOwner
, _owner)
}
}
}
}
...
@@ -203,8 +201,9 @@ contract L1ChugSplashProxy {
...
@@ -203,8 +201,9 @@ contract L1ChugSplashProxy {
/// @return Implementation address.
/// @return Implementation address.
function _getImplementation() internal view returns (address) {
function _getImplementation() internal view returns (address) {
address implementation;
address implementation;
bytes32 proxyImplementation = Constants.PROXY_IMPLEMENTATION_ADDRESS;
assembly {
assembly {
implementation := sload(
IMPLEMENTATION_KEY
)
implementation := sload(
proxyImplementation
)
}
}
return implementation;
return implementation;
}
}
...
@@ -213,8 +212,9 @@ contract L1ChugSplashProxy {
...
@@ -213,8 +212,9 @@ contract L1ChugSplashProxy {
/// @return Owner address.
/// @return Owner address.
function _getOwner() internal view returns (address) {
function _getOwner() internal view returns (address) {
address owner;
address owner;
bytes32 proxyOwner = Constants.PROXY_OWNER_ADDRESS;
assembly {
assembly {
owner := sload(
OWNER_KEY
)
owner := sload(
proxyOwner
)
}
}
return owner;
return owner;
}
}
...
...
packages/contracts-bedrock/src/libraries/Constants.sol
View file @
9aa2b9ae
...
@@ -21,6 +21,15 @@ library Constants {
...
@@ -21,6 +21,15 @@ library Constants {
/// non-zero to reduce the gas cost of message passing transactions.
/// non-zero to reduce the gas cost of message passing transactions.
address internal constant DEFAULT_L2_SENDER = 0x000000000000000000000000000000000000dEaD;
address internal constant DEFAULT_L2_SENDER = 0x000000000000000000000000000000000000dEaD;
/// @notice The storage slot that holds the address of a proxy implementation.
/// @dev `bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)`
bytes32 internal constant PROXY_IMPLEMENTATION_ADDRESS =
0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/// @notice The storage slot that holds the address of the owner.
/// @dev `bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1)`
bytes32 internal constant PROXY_OWNER_ADDRESS = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/// @notice Returns the default values for the ResourceConfig. These are the recommended values
/// @notice Returns the default values for the ResourceConfig. These are the recommended values
/// for a production network.
/// for a production network.
function DEFAULT_RESOURCE_CONFIG() internal pure returns (ResourceMetering.ResourceConfig memory) {
function DEFAULT_RESOURCE_CONFIG() internal pure returns (ResourceMetering.ResourceConfig memory) {
...
...
packages/contracts-bedrock/src/universal/Proxy.sol
View file @
9aa2b9ae
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
pragma solidity 0.8.15;
import { Constants } from "../libraries/Constants.sol";
/// @title Proxy
/// @title Proxy
/// @notice Proxy is a transparent proxy that passes through the call if the caller is the owner or
/// @notice Proxy is a transparent proxy that passes through the call if the caller is the owner or
/// if the caller is address(0), meaning that the call originated from an off-chain
/// if the caller is address(0), meaning that the call originated from an off-chain
/// simulation.
/// simulation.
contract Proxy {
contract Proxy {
/// @notice The storage slot that holds the address of the implementation.
/// bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)
bytes32 internal constant IMPLEMENTATION_KEY = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/// @notice The storage slot that holds the address of the owner.
/// bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1)
bytes32 internal constant OWNER_KEY = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/// @notice An event that is emitted each time the implementation is changed. This event is part
/// @notice An event that is emitted each time the implementation is changed. This event is part
/// of the EIP-1967 specification.
/// of the EIP-1967 specification.
/// @param implementation The address of the implementation contract
/// @param implementation The address of the implementation contract
...
@@ -107,8 +101,9 @@ contract Proxy {
...
@@ -107,8 +101,9 @@ contract Proxy {
/// @notice Sets the implementation address.
/// @notice Sets the implementation address.
/// @param _implementation New implementation address.
/// @param _implementation New implementation address.
function _setImplementation(address _implementation) internal {
function _setImplementation(address _implementation) internal {
bytes32 proxyImplementation = Constants.PROXY_IMPLEMENTATION_ADDRESS;
assembly {
assembly {
sstore(
IMPLEMENTATION_KEY
, _implementation)
sstore(
proxyImplementation
, _implementation)
}
}
emit Upgraded(_implementation);
emit Upgraded(_implementation);
}
}
...
@@ -117,8 +112,9 @@ contract Proxy {
...
@@ -117,8 +112,9 @@ contract Proxy {
/// @param _admin New owner of the proxy contract.
/// @param _admin New owner of the proxy contract.
function _changeAdmin(address _admin) internal {
function _changeAdmin(address _admin) internal {
address previous = _getAdmin();
address previous = _getAdmin();
bytes32 proxyOwner = Constants.PROXY_OWNER_ADDRESS;
assembly {
assembly {
sstore(
OWNER_KEY
, _admin)
sstore(
proxyOwner
, _admin)
}
}
emit AdminChanged(previous, _admin);
emit AdminChanged(previous, _admin);
}
}
...
@@ -152,8 +148,9 @@ contract Proxy {
...
@@ -152,8 +148,9 @@ contract Proxy {
/// @return Implementation address.
/// @return Implementation address.
function _getImplementation() internal view returns (address) {
function _getImplementation() internal view returns (address) {
address impl;
address impl;
bytes32 proxyImplementation = Constants.PROXY_IMPLEMENTATION_ADDRESS;
assembly {
assembly {
impl := sload(
IMPLEMENTATION_KEY
)
impl := sload(
proxyImplementation
)
}
}
return impl;
return impl;
}
}
...
@@ -162,8 +159,9 @@ contract Proxy {
...
@@ -162,8 +159,9 @@ contract Proxy {
/// @return Owner address.
/// @return Owner address.
function _getAdmin() internal view returns (address) {
function _getAdmin() internal view returns (address) {
address owner;
address owner;
bytes32 proxyOwner = Constants.PROXY_OWNER_ADDRESS;
assembly {
assembly {
owner := sload(
OWNER_KEY
)
owner := sload(
proxyOwner
)
}
}
return owner;
return owner;
}
}
...
...
packages/contracts-bedrock/src/universal/ProxyAdmin.sol
View file @
9aa2b9ae
...
@@ -5,6 +5,7 @@ import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
...
@@ -5,6 +5,7 @@ import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { Proxy } from "./Proxy.sol";
import { Proxy } from "./Proxy.sol";
import { AddressManager } from "../legacy/AddressManager.sol";
import { AddressManager } from "../legacy/AddressManager.sol";
import { L1ChugSplashProxy } from "../legacy/L1ChugSplashProxy.sol";
import { L1ChugSplashProxy } from "../legacy/L1ChugSplashProxy.sol";
import { Constants } from "../libraries/Constants.sol";
/// @title IStaticERC1967Proxy
/// @title IStaticERC1967Proxy
/// @notice IStaticERC1967Proxy is a static version of the ERC1967 proxy interface.
/// @notice IStaticERC1967Proxy is a static version of the ERC1967 proxy interface.
...
@@ -163,9 +164,7 @@ contract ProxyAdmin is Ownable {
...
@@ -163,9 +164,7 @@ contract ProxyAdmin is Ownable {
Proxy(_proxy).upgradeTo(_implementation);
Proxy(_proxy).upgradeTo(_implementation);
} else if (ptype == ProxyType.CHUGSPLASH) {
} else if (ptype == ProxyType.CHUGSPLASH) {
L1ChugSplashProxy(_proxy).setStorage(
L1ChugSplashProxy(_proxy).setStorage(
// bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)
Constants.PROXY_IMPLEMENTATION_ADDRESS, bytes32(uint256(uint160(_implementation)))
0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc,
bytes32(uint256(uint160(_implementation)))
);
);
} else if (ptype == ProxyType.RESOLVED) {
} else if (ptype == ProxyType.RESOLVED) {
string memory name = implementationName[_proxy];
string memory name = implementationName[_proxy];
...
...
packages/contracts-bedrock/test/Constants.t.sol
0 → 100644
View file @
9aa2b9ae
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
import { Test } from "forge-std/Test.sol";
import { Constants } from "src/libraries/Constants.sol";
contract Constants_Test is Test {
/// @notice Check EIP1967 related constants.
function test_eip1967Constants_succeeds() external {
assertEq(
bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1), Constants.PROXY_IMPLEMENTATION_ADDRESS
);
assertEq(bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1), Constants.PROXY_OWNER_ADDRESS);
}
}
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