Commit 78d94606 authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge pull request #4228 from ethereum-optimism/jm/ctb-test-cleanup/3

Test function renaming (Proxy, Benchmarks, xDM)
parents 0d65f0b0 8ef35b07
GasBenchMark_L1CrossDomainMessenger:test_L1MessengerSendMessage_benchmark_0() (gas: 261323)
GasBenchMark_L1CrossDomainMessenger:test_L1MessengerSendMessage_benchmark_1() (gas: 75850)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 261344)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 75851)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 348151)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 112583)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 348173)
......@@ -8,7 +8,7 @@ GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (g
GasBenchMark_L2OutputOracle:test_proposeL2Output_benchmark() (gas: 88513)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 74953)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 36044)
CrossDomainMessenger_Test:test_baseGas() (gas: 20054)
CrossDomainMessenger_BaseGas_Test:test_baseGas_succeeds() (gas: 20098)
CrossDomainOwnableThroughPortal_Test:test_depositTransaction_crossDomainOwner() (gas: 61806)
CrossDomainOwnable_Test:test_onlyOwner() (gas: 34861)
CrossDomainOwnable_Test:test_revertOnlyOwner() (gas: 10530)
......@@ -181,40 +181,40 @@ OptimismPortal_Test:test_depositTransaction_withEthValueFromEOA_succeeds() (gas:
OptimismPortal_Test:test_isOutputFinalized_succeeds() (gas: 119474)
OptimismPortal_Test:test_receive_succeeds() (gas: 127522)
OptimismPortal_Test:test_simple_isOutputFinalized_succeeds() (gas: 24165)
Proxy_Test:test_clashingFunctionSignatures() (gas: 101347)
Proxy_Test:test_implementationKey() (gas: 20887)
Proxy_Test:test_implementationProxyCallIfNotAdmin() (gas: 29963)
Proxy_Test:test_implementationZeroAddress() (gas: 47581)
Proxy_Test:test_itDelegatesToTheImplementation() (gas: 45184)
Proxy_Test:test_ownerKey() (gas: 19102)
Proxy_Test:test_ownerProxyCallIfNotAdmin() (gas: 34637)
Proxy_Test:test_payableUpgradeToAndCall() (gas: 53708)
Proxy_Test:test_revertUpgradeToAndCall() (gas: 104495)
Proxy_Test:test_upgradeToAndCall() (gas: 125177)
Proxy_Test:test_zeroAddressCaller() (gas: 14729)
ProxyAdmin_Test:test_chugsplashChangeProxyAdmin() (gas: 35563)
ProxyAdmin_Test:test_chugsplashGetProxyAdmin() (gas: 15631)
ProxyAdmin_Test:test_chugsplashGetProxyImplementation() (gas: 51049)
ProxyAdmin_Test:test_chugsplashUpgrade() (gas: 48933)
ProxyAdmin_Test:test_chugsplashUpgradeAndCall() (gas: 82238)
ProxyAdmin_Test:test_delegateResolvedChangeProxyAdmin() (gas: 33935)
ProxyAdmin_Test:test_delegateResolvedGetProxyAdmin() (gas: 17647)
ProxyAdmin_Test:test_delegateResolvedGetProxyImplementation() (gas: 62038)
ProxyAdmin_Test:test_delegateResolvedUpgrade() (gas: 58494)
ProxyAdmin_Test:test_delegateResolvedUpgradeAndCall() (gas: 98008)
ProxyAdmin_Test:test_erc1967ChangeProxyAdmin() (gas: 33791)
ProxyAdmin_Test:test_erc1967GetProxyAdmin() (gas: 15617)
ProxyAdmin_Test:test_erc1967GetProxyImplementation() (gas: 52060)
ProxyAdmin_Test:test_erc1967Upgrade() (gas: 50003)
ProxyAdmin_Test:test_erc1967UpgradeAndCall() (gas: 78963)
ProxyAdmin_Test:test_isUpgrading() (gas: 19474)
ProxyAdmin_Test:test_onlyOwner() (gas: 22794)
ProxyAdmin_Test:test_onlyOwnerSetAddressManager() (gas: 10587)
ProxyAdmin_Test:test_onlyOwnerSetImplementationName() (gas: 11111)
ProxyAdmin_Test:test_onlyOwnerSetProxyType() (gas: 10749)
ProxyAdmin_Test:test_owner() (gas: 9783)
ProxyAdmin_Test:test_proxyType() (gas: 20534)
ProxyAdmin_Test:test_setImplementationName() (gas: 38923)
Proxy_Test:test_delegatesToImpl_succeeds() (gas: 45184)
Proxy_Test:test_implementationKey_succeeds() (gas: 20886)
Proxy_Test:test_implementation_isZeroAddress_reverts() (gas: 47648)
Proxy_Test:test_implementation_zeroAddressCaller_succeeds() (gas: 14707)
Proxy_Test:test_ownerKey_succeeds() (gas: 19081)
Proxy_Test:test_ownerProxyCall_notAdmin_succeeds() (gas: 34637)
Proxy_Test:test_proxyCallToImp_notAdmin_succeeds() (gas: 29985)
Proxy_Test:test_upgradeToAndCall_functionDoesNotExist_reverts() (gas: 104517)
Proxy_Test:test_upgradeToAndCall_isPayable_succeeds() (gas: 53707)
Proxy_Test:test_upgradeToAndCall_succeeds() (gas: 125155)
Proxy_Test:test_upgradeTo_clashingFunctionSignatures_succeeds() (gas: 101359)
ProxyAdmin_Test:test_chugsplashChangeProxyAdmin_succeeds() (gas: 35586)
ProxyAdmin_Test:test_chugsplashGetProxyAdmin_succeeds() (gas: 15675)
ProxyAdmin_Test:test_chugsplashGetProxyImplementation_succeeds() (gas: 51040)
ProxyAdmin_Test:test_chugsplashUpgradeAndCall_succeeds() (gas: 82239)
ProxyAdmin_Test:test_chugsplashUpgrade_succeeds() (gas: 48965)
ProxyAdmin_Test:test_delegateResolvedChangeProxyAdmin_succeeds() (gas: 33936)
ProxyAdmin_Test:test_delegateResolvedGetProxyAdmin_succeeds() (gas: 17669)
ProxyAdmin_Test:test_delegateResolvedGetProxyImplementation_succeeds() (gas: 62028)
ProxyAdmin_Test:test_delegateResolvedUpgradeAndCall_succeeds() (gas: 97966)
ProxyAdmin_Test:test_delegateResolvedUpgrade_succeeds() (gas: 58459)
ProxyAdmin_Test:test_erc1967ChangeProxyAdmin_succeeds() (gas: 33812)
ProxyAdmin_Test:test_erc1967GetProxyAdmin_succeeds() (gas: 15660)
ProxyAdmin_Test:test_erc1967GetProxyImplementation_succeeds() (gas: 52049)
ProxyAdmin_Test:test_erc1967UpgradeAndCall_succeeds() (gas: 78940)
ProxyAdmin_Test:test_erc1967Upgrade_succeeds() (gas: 50034)
ProxyAdmin_Test:test_isUpgrading_succeeds() (gas: 19431)
ProxyAdmin_Test:test_onlyOwner_notOwner_reverts() (gas: 22760)
ProxyAdmin_Test:test_owner_succeeds() (gas: 9738)
ProxyAdmin_Test:test_proxyType_succeeds() (gas: 20511)
ProxyAdmin_Test:test_setAddressManager_notOwner_reverts() (gas: 10600)
ProxyAdmin_Test:test_setImplementationName_notOwner_reverts() (gas: 11156)
ProxyAdmin_Test:test_setImplementationName_succeeds() (gas: 38945)
ProxyAdmin_Test:test_setProxyType_notOwner_reverts() (gas: 10814)
RLPReader_Test:test_readBytes_bytestring00_succeeds() (gas: 1857)
RLPReader_Test:test_readBytes_bytestring01_succeeds() (gas: 1900)
RLPReader_Test:test_readBytes_bytestring7f_succeeds() (gas: 1898)
......
......@@ -60,14 +60,14 @@ contract GasBenchMark_OptimismPortal is Portal_Initializer {
}
contract GasBenchMark_L1CrossDomainMessenger is Messenger_Initializer {
function test_L1MessengerSendMessage_benchmark_0() external {
function test_sendMessage_benchmark_0() external {
// The amount of data typically sent during a bridge deposit.
bytes
memory data = hex"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";
L1Messenger.sendMessage(bob, data, uint32(100));
}
function test_L1MessengerSendMessage_benchmark_1() external {
function test_sendMessage_benchmark_1() external {
setPrevBaseFee(vm, address(op), INITIAL_BASE_FEE);
// The amount of data typically sent during a bridge deposit.
bytes
......
......@@ -5,15 +5,15 @@ import { Messenger_Initializer, Reverter, CallerCaller } from "./CommonTest.t.so
// CrossDomainMessenger_Test is for testing functionality which is common to both the L1 and L2
// CrossDomainMessenger contracts. For simplicity, we use the L1 Messenger as the test contract.
contract CrossDomainMessenger_Test is Messenger_Initializer {
contract CrossDomainMessenger_BaseGas_Test is Messenger_Initializer {
// Ensure that baseGas passes for the max value of _minGasLimit,
// this is about 4 Billion.
function test_baseGas() external view {
function test_baseGas_succeeds() external view {
L1Messenger.baseGas(hex"ff", type(uint32).max);
}
// Fuzz for other values which might cause a revert in baseGas.
function testFuzz_baseGas(uint32 _minGasLimit) external view {
function testFuzz_baseGas_succeeds(uint32 _minGasLimit) external view {
L1Messenger.baseGas(hex"ff", _minGasLimit);
}
}
......@@ -47,7 +47,7 @@ contract Proxy_Test is Test {
proxy.upgradeTo(address(simpleStorage));
}
function test_implementationKey() external {
function test_implementationKey_succeeds() external {
// The hardcoded implementation key should be correct
vm.prank(alice);
proxy.upgradeTo(address(6));
......@@ -60,7 +60,7 @@ contract Proxy_Test is Test {
assertEq(impl, address(6));
}
function test_ownerKey() external {
function test_ownerKey_succeeds() external {
// The hardcoded owner key should be correct
vm.prank(alice);
proxy.changeAdmin(address(6));
......@@ -73,7 +73,7 @@ contract Proxy_Test is Test {
assertEq(owner, address(6));
}
function test_implementationProxyCallIfNotAdmin() external {
function test_proxyCallToImp_notAdmin_succeeds() external {
// The implementation does not have a `upgradeTo`
// method, calling `upgradeTo` not as the owner
// should revert.
......@@ -93,7 +93,7 @@ contract Proxy_Test is Test {
assertEq(impl, address(64));
}
function test_ownerProxyCallIfNotAdmin() external {
function test_ownerProxyCall_notAdmin_succeeds() external {
// Calling `changeAdmin` not as the owner should revert
// as the implementation does not have a `changeAdmin` method.
vm.expectRevert();
......@@ -118,7 +118,7 @@ contract Proxy_Test is Test {
assertEq(owner, address(1));
}
function test_itDelegatesToTheImplementation() external {
function test_delegatesToImpl_succeeds() external {
// Call the storage setter on the proxy
SimpleStorage(address(proxy)).set(1, 1);
......@@ -140,7 +140,7 @@ contract Proxy_Test is Test {
}
}
function test_upgradeToAndCall() external {
function test_upgradeToAndCall_succeeds() external {
{
// There should be nothing in the current proxy storage
uint256 expect = SimpleStorage(address(proxy)).get(1);
......@@ -165,7 +165,7 @@ contract Proxy_Test is Test {
assertEq(result, 1);
}
function test_revertUpgradeToAndCall() external {
function test_upgradeToAndCall_functionDoesNotExist_reverts() external {
// Get the current implementation address
vm.prank(alice);
address impl = proxy.implementation();
......@@ -197,7 +197,7 @@ contract Proxy_Test is Test {
);
}
function test_payableUpgradeToAndCall() external {
function test_upgradeToAndCall_isPayable_succeeds() external {
// Give alice some funds
vm.deal(alice, 1 ether);
// Set the implementation and call and send
......@@ -217,7 +217,7 @@ contract Proxy_Test is Test {
assertEq(address(proxy).balance, 1 ether);
}
function test_clashingFunctionSignatures() external {
function test_upgradeTo_clashingFunctionSignatures_succeeds() external {
// Clasher has a clashing function with the proxy.
Clasher clasher = new Clasher();
......@@ -253,13 +253,13 @@ contract Proxy_Test is Test {
// Allow for `eth_call` to call proxy methods
// by setting "from" to `address(0)`.
function test_zeroAddressCaller() external {
function test_implementation_zeroAddressCaller_succeeds() external {
vm.prank(address(0));
address impl = proxy.implementation();
assertEq(impl, address(simpleStorage));
}
function test_implementationZeroAddress() external {
function test_implementation_isZeroAddress_reverts() external {
// Set `address(0)` as the implementation.
vm.prank(alice);
proxy.upgradeTo(address(0));
......
......@@ -59,32 +59,32 @@ contract ProxyAdmin_Test is Test {
implementation = new SimpleStorage();
}
function test_setImplementationName() external {
function test_setImplementationName_succeeds() external {
vm.prank(alice);
admin.setImplementationName(address(1), "foo");
assertEq(admin.implementationName(address(1)), "foo");
}
function test_onlyOwnerSetAddressManager() external {
function test_setAddressManager_notOwner_reverts() external {
vm.expectRevert("Ownable: caller is not the owner");
admin.setAddressManager(AddressManager((address(0))));
}
function test_onlyOwnerSetImplementationName() external {
function test_setImplementationName_notOwner_reverts() external {
vm.expectRevert("Ownable: caller is not the owner");
admin.setImplementationName(address(0), "foo");
}
function test_onlyOwnerSetProxyType() external {
function test_setProxyType_notOwner_reverts() external {
vm.expectRevert("Ownable: caller is not the owner");
admin.setProxyType(address(0), ProxyAdmin.ProxyType.CHUGSPLASH);
}
function test_owner() external {
function test_owner_succeeds() external {
assertEq(admin.owner(), alice);
}
function test_proxyType() external {
function test_proxyType_succeeds() external {
assertEq(uint256(admin.proxyType(address(proxy))), uint256(ProxyAdmin.ProxyType.ERC1967));
assertEq(
uint256(admin.proxyType(address(chugsplash))),
......@@ -96,15 +96,15 @@ contract ProxyAdmin_Test is Test {
);
}
function test_erc1967GetProxyImplementation() external {
function test_erc1967GetProxyImplementation_succeeds() external {
getProxyImplementation(payable(proxy));
}
function test_chugsplashGetProxyImplementation() external {
function test_chugsplashGetProxyImplementation_succeeds() external {
getProxyImplementation(payable(chugsplash));
}
function test_delegateResolvedGetProxyImplementation() external {
function test_delegateResolvedGetProxyImplementation_succeeds() external {
getProxyImplementation(payable(resolved));
}
......@@ -123,15 +123,15 @@ contract ProxyAdmin_Test is Test {
}
}
function test_erc1967GetProxyAdmin() external {
function test_erc1967GetProxyAdmin_succeeds() external {
getProxyAdmin(payable(proxy));
}
function test_chugsplashGetProxyAdmin() external {
function test_chugsplashGetProxyAdmin_succeeds() external {
getProxyAdmin(payable(chugsplash));
}
function test_delegateResolvedGetProxyAdmin() external {
function test_delegateResolvedGetProxyAdmin_succeeds() external {
getProxyAdmin(payable(resolved));
}
......@@ -140,15 +140,15 @@ contract ProxyAdmin_Test is Test {
assertEq(owner, address(admin));
}
function test_erc1967ChangeProxyAdmin() external {
function test_erc1967ChangeProxyAdmin_succeeds() external {
changeProxyAdmin(payable(proxy));
}
function test_chugsplashChangeProxyAdmin() external {
function test_chugsplashChangeProxyAdmin_succeeds() external {
changeProxyAdmin(payable(chugsplash));
}
function test_delegateResolvedChangeProxyAdmin() external {
function test_delegateResolvedChangeProxyAdmin_succeeds() external {
changeProxyAdmin(payable(resolved));
}
......@@ -188,15 +188,15 @@ contract ProxyAdmin_Test is Test {
}
}
function test_erc1967Upgrade() external {
function test_erc1967Upgrade_succeeds() external {
upgrade(payable(proxy));
}
function test_chugsplashUpgrade() external {
function test_chugsplashUpgrade_succeeds() external {
upgrade(payable(chugsplash));
}
function test_delegateResolvedUpgrade() external {
function test_delegateResolvedUpgrade_succeeds() external {
upgrade(payable(resolved));
}
......@@ -208,15 +208,15 @@ contract ProxyAdmin_Test is Test {
assertEq(impl, address(implementation));
}
function test_erc1967UpgradeAndCall() external {
function test_erc1967UpgradeAndCall_succeeds() external {
upgradeAndCall(payable(proxy));
}
function test_chugsplashUpgradeAndCall() external {
function test_chugsplashUpgradeAndCall_succeeds() external {
upgradeAndCall(payable(chugsplash));
}
function test_delegateResolvedUpgradeAndCall() external {
function test_delegateResolvedUpgradeAndCall_succeeds() external {
upgradeAndCall(payable(resolved));
}
......@@ -235,7 +235,7 @@ contract ProxyAdmin_Test is Test {
assertEq(got, 1);
}
function test_onlyOwner() external {
function test_onlyOwner_notOwner_reverts() external {
vm.expectRevert("Ownable: caller is not the owner");
admin.changeProxyAdmin(payable(proxy), address(0));
......@@ -246,7 +246,7 @@ contract ProxyAdmin_Test is Test {
admin.upgradeAndCall(payable(proxy), address(implementation), hex"");
}
function test_isUpgrading() external {
function test_isUpgrading_succeeds() external {
assertEq(false, admin.isUpgrading());
vm.prank(alice);
......
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