Commit 7d9820b6 authored by smartcontracts's avatar smartcontracts Committed by GitHub

fix(ctb): solc warnings in Proxy.sol (#2951)

Cleans up a few solc warnings in Proxy.sol.
Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 69ee689f
---
'@eth-optimism/contracts-bedrock': patch
---
Resolve compiler warnings in Proxy.sol
......@@ -5,7 +5,7 @@ GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 1181
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 251901)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 118108)
GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 45385)
GasBenchMark_L2OutputOracle:test_appendL2Output_benchmark() (gas: 68684)
GasBenchMark_L2OutputOracle:test_appendL2Output_benchmark() (gas: 68695)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 75024)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 35328)
CrossDomainHashing_Test:test_l2TransactionHash() (gas: 104131)
......@@ -67,24 +67,24 @@ L2CrossDomainMessenger_Test:test_L2MessengerSendMessage() (gas: 119682)
L2CrossDomainMessenger_Test:test_L2MessengerTwiceSendMessage() (gas: 133142)
L2CrossDomainMessenger_Test:test_L2MessengerXDomainSenderReverts() (gas: 10577)
L2CrossDomainMessenger_Test:test_L2MessengerxDomainMessageSenderResets() (gas: 54881)
L2OutputOracleTest:testCannot_AppendWithUnmatchedBlockhash() (gas: 26822)
L2OutputOracleTest:testCannot_appendEmptyOutput() (gas: 24097)
L2OutputOracleTest:testCannot_appendFutureTimetamp() (gas: 26086)
L2OutputOracleTest:testCannot_appendOnWrongFork() (gas: 26371)
L2OutputOracleTest:testCannot_appendOutputIfNotSequencer() (gas: 23488)
L2OutputOracleTest:testCannot_appendUnexpectedBlockNumber() (gas: 25995)
L2OutputOracleTest:testCannot_deleteL2Output_ifNotOwner() (gas: 24777)
L2OutputOracleTest:testCannot_deleteL2Output_withWrongRoot() (gas: 91069)
L2OutputOracleTest:testCannot_deleteL2Output_withWrongTime() (gas: 87084)
L2OutputOracleTest:test_appendWithBlockhashAndHeight() (gas: 75059)
L2OutputOracleTest:test_appendingAnotherOutput() (gas: 76861)
L2OutputOracleTest:test_changeSequencer() (gas: 55754)
L2OutputOracleTest:testCannot_AppendWithUnmatchedBlockhash() (gas: 26833)
L2OutputOracleTest:testCannot_appendEmptyOutput() (gas: 24108)
L2OutputOracleTest:testCannot_appendFutureTimetamp() (gas: 26097)
L2OutputOracleTest:testCannot_appendOnWrongFork() (gas: 26382)
L2OutputOracleTest:testCannot_appendOutputIfNotSequencer() (gas: 23499)
L2OutputOracleTest:testCannot_appendUnexpectedBlockNumber() (gas: 26006)
L2OutputOracleTest:testCannot_deleteL2Output_ifNotOwner() (gas: 24799)
L2OutputOracleTest:testCannot_deleteL2Output_withWrongRoot() (gas: 91113)
L2OutputOracleTest:testCannot_deleteL2Output_withWrongTime() (gas: 87128)
L2OutputOracleTest:test_appendWithBlockhashAndHeight() (gas: 75070)
L2OutputOracleTest:test_appendingAnotherOutput() (gas: 76883)
L2OutputOracleTest:test_changeSequencer() (gas: 55809)
L2OutputOracleTest:test_computeL2Timestamp() (gas: 30200)
L2OutputOracleTest:test_constructor() (gas: 48801)
L2OutputOracleTest:test_deleteL2Output() (gas: 76499)
L2OutputOracleTest:test_getL2Output() (gas: 82924)
L2OutputOracleTest:test_latestBlockNumber() (gas: 76198)
L2OutputOracleTest:test_nextBlockNumber() (gas: 15144)
L2OutputOracleTest:test_constructor() (gas: 48856)
L2OutputOracleTest:test_deleteL2Output() (gas: 76543)
L2OutputOracleTest:test_getL2Output() (gas: 82935)
L2OutputOracleTest:test_latestBlockNumber() (gas: 76220)
L2OutputOracleTest:test_nextBlockNumber() (gas: 15166)
L2OutputOracleTest:test_updateOwner() (gas: 34580)
L2OutputOracleUpgradeable_Test:test_cannotInitImpl() (gas: 8476)
L2OutputOracleUpgradeable_Test:test_cannotInitProxy() (gas: 13497)
......@@ -129,9 +129,9 @@ OptimismPortalUpgradeable_Test:test_cannotInitImpl() (gas: 10936)
OptimismPortalUpgradeable_Test:test_cannotInitProxy() (gas: 15978)
OptimismPortalUpgradeable_Test:test_initValuesOnProxy() (gas: 16034)
OptimismPortalUpgradeable_Test:test_upgrading() (gas: 230843)
OptimismPortal_Test:test_OptimismPortalConstructor() (gas: 17308)
OptimismPortal_Test:test_OptimismPortalConstructor() (gas: 17319)
OptimismPortal_Test:test_OptimismPortalContractCreationReverts() (gas: 14193)
OptimismPortal_Test:test_OptimismPortalReceiveEth() (gas: 126599)
OptimismPortal_Test:test_OptimismPortalReceiveEth() (gas: 126614)
OptimismPortal_Test:test_cannotVerifyRecentWithdrawal() (gas: 31924)
OptimismPortal_Test:test_depositTransaction_NoValueContract() (gas: 75775)
OptimismPortal_Test:test_depositTransaction_NoValueEOA() (gas: 76054)
......@@ -141,14 +141,14 @@ OptimismPortal_Test:test_depositTransaction_withEthValueAndContractContractCreat
OptimismPortal_Test:test_depositTransaction_withEthValueAndEOAContractCreation() (gas: 74962)
OptimismPortal_Test:test_depositTransaction_withEthValueFromContract() (gas: 82505)
OptimismPortal_Test:test_depositTransaction_withEthValueFromEOA() (gas: 83100)
OptimismPortal_Test:test_invalidWithdrawalProof() (gas: 45141)
OptimismPortal_Test:test_isOutputFinalized() (gas: 131766)
OptimismPortal_Test:test_simple_isOutputFinalized() (gas: 23898)
OptimismPortal_Test:test_invalidWithdrawalProof() (gas: 45152)
OptimismPortal_Test:test_isOutputFinalized() (gas: 131876)
OptimismPortal_Test:test_simple_isOutputFinalized() (gas: 23909)
Proxy_Test:test_clashingFunctionSignatures() (gas: 101427)
Proxy_Test:test_implementationKey() (gas: 20942)
Proxy_Test:test_implementationProxyCallIfNotAdmin() (gas: 30021)
Proxy_Test:test_implementationZeroAddress() (gas: 47985)
Proxy_Test:test_itDelegatesToTheImplementation() (gas: 45240)
Proxy_Test:test_implementationZeroAddress() (gas: 48000)
Proxy_Test:test_itDelegatesToTheImplementation() (gas: 45251)
Proxy_Test:test_ownerKey() (gas: 19091)
Proxy_Test:test_ownerProxyCallIfNotAdmin() (gas: 34711)
Proxy_Test:test_payableUpgradeToAndCall() (gas: 53865)
......
......@@ -57,6 +57,12 @@ contract Proxy {
_doProxyCall();
}
// slither-disable-next-line locked-ether
receive() external payable {
// Proxy call by default.
_doProxyCall();
}
/**
* @notice A modifier that reverts if not called by the owner or by address(0) to allow
* eth_call to interact with this proxy without needing to use low-level storage
......@@ -146,11 +152,11 @@ contract Proxy {
* @return Implementation address.
*/
function _getImplementation() internal view returns (address) {
address implementation;
address impl;
assembly {
implementation := sload(IMPLEMENTATION_KEY)
impl := sload(IMPLEMENTATION_KEY)
}
return implementation;
return impl;
}
/**
......@@ -183,15 +189,15 @@ contract Proxy {
* @notice Performs the proxy call via a delegatecall.
*/
function _doProxyCall() internal {
address implementation = _getImplementation();
require(implementation != address(0), "Proxy: implementation not initialized");
address impl = _getImplementation();
require(impl != address(0), "Proxy: implementation not initialized");
assembly {
// Copy calldata into memory at 0x0....calldatasize.
calldatacopy(0x0, 0x0, calldatasize())
// Perform the delegatecall, make sure to pass all available gas.
let success := delegatecall(gas(), implementation, 0x0, calldatasize(), 0x0, 0x0)
let success := delegatecall(gas(), impl, 0x0, calldatasize(), 0x0, 0x0)
// Copy returndata into memory at 0x0....returndatasize. Note that this *will*
// overwrite the calldata that we just copied into memory but that doesn't really
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment