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
38d20ba5
Unverified
Commit
38d20ba5
authored
Nov 30, 2022
by
Maurelian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ctb: Fix Proxy and ProxyAdmin test function names
parent
4270589b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
34 deletions
+34
-34
Proxy.t.sol
packages/contracts-bedrock/contracts/test/Proxy.t.sol
+11
-11
ProxyAdmin.t.sol
packages/contracts-bedrock/contracts/test/ProxyAdmin.t.sol
+23
-23
No files found.
packages/contracts-bedrock/contracts/test/Proxy.t.sol
View file @
38d20ba5
...
@@ -47,7 +47,7 @@ contract Proxy_Test is Test {
...
@@ -47,7 +47,7 @@ contract Proxy_Test is Test {
proxy.upgradeTo(address(simpleStorage));
proxy.upgradeTo(address(simpleStorage));
}
}
function test_implementationKey() external {
function test_implementationKey
_succeeds
() external {
// The hardcoded implementation key should be correct
// The hardcoded implementation key should be correct
vm.prank(alice);
vm.prank(alice);
proxy.upgradeTo(address(6));
proxy.upgradeTo(address(6));
...
@@ -60,7 +60,7 @@ contract Proxy_Test is Test {
...
@@ -60,7 +60,7 @@ contract Proxy_Test is Test {
assertEq(impl, address(6));
assertEq(impl, address(6));
}
}
function test_ownerKey() external {
function test_ownerKey
_succeeds
() external {
// The hardcoded owner key should be correct
// The hardcoded owner key should be correct
vm.prank(alice);
vm.prank(alice);
proxy.changeAdmin(address(6));
proxy.changeAdmin(address(6));
...
@@ -73,7 +73,7 @@ contract Proxy_Test is Test {
...
@@ -73,7 +73,7 @@ contract Proxy_Test is Test {
assertEq(owner, address(6));
assertEq(owner, address(6));
}
}
function test_
implementationProxyCallIfNotAdmin
() external {
function test_
proxyCallToImp_notAdmin_succeeds
() external {
// The implementation does not have a `upgradeTo`
// The implementation does not have a `upgradeTo`
// method, calling `upgradeTo` not as the owner
// method, calling `upgradeTo` not as the owner
// should revert.
// should revert.
...
@@ -93,7 +93,7 @@ contract Proxy_Test is Test {
...
@@ -93,7 +93,7 @@ contract Proxy_Test is Test {
assertEq(impl, address(64));
assertEq(impl, address(64));
}
}
function test_ownerProxyCall
IfNotAdmin
() external {
function test_ownerProxyCall
_notAdmin_succeeds
() external {
// Calling `changeAdmin` not as the owner should revert
// Calling `changeAdmin` not as the owner should revert
// as the implementation does not have a `changeAdmin` method.
// as the implementation does not have a `changeAdmin` method.
vm.expectRevert();
vm.expectRevert();
...
@@ -118,7 +118,7 @@ contract Proxy_Test is Test {
...
@@ -118,7 +118,7 @@ contract Proxy_Test is Test {
assertEq(owner, address(1));
assertEq(owner, address(1));
}
}
function test_
itDelegatesToTheImplementation
() external {
function test_
delegatesToImpl_succeeds
() external {
// Call the storage setter on the proxy
// Call the storage setter on the proxy
SimpleStorage(address(proxy)).set(1, 1);
SimpleStorage(address(proxy)).set(1, 1);
...
@@ -140,7 +140,7 @@ contract Proxy_Test is Test {
...
@@ -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
// There should be nothing in the current proxy storage
uint256 expect = SimpleStorage(address(proxy)).get(1);
uint256 expect = SimpleStorage(address(proxy)).get(1);
...
@@ -165,7 +165,7 @@ contract Proxy_Test is Test {
...
@@ -165,7 +165,7 @@ contract Proxy_Test is Test {
assertEq(result, 1);
assertEq(result, 1);
}
}
function test_
revertUpgradeToAndCall
() external {
function test_
upgradeToAndCall_functionDoesNotExist_reverts
() external {
// Get the current implementation address
// Get the current implementation address
vm.prank(alice);
vm.prank(alice);
address impl = proxy.implementation();
address impl = proxy.implementation();
...
@@ -197,7 +197,7 @@ contract Proxy_Test is Test {
...
@@ -197,7 +197,7 @@ contract Proxy_Test is Test {
);
);
}
}
function test_
payableUpgradeToAndCall
() external {
function test_
upgradeToAndCall_isPayable_succeeds
() external {
// Give alice some funds
// Give alice some funds
vm.deal(alice, 1 ether);
vm.deal(alice, 1 ether);
// Set the implementation and call and send
// Set the implementation and call and send
...
@@ -217,7 +217,7 @@ contract Proxy_Test is Test {
...
@@ -217,7 +217,7 @@ contract Proxy_Test is Test {
assertEq(address(proxy).balance, 1 ether);
assertEq(address(proxy).balance, 1 ether);
}
}
function test_
clashingFunctionSignature
s() external {
function test_
upgradeTo_clashingFunctionSignatures_succeed
s() external {
// Clasher has a clashing function with the proxy.
// Clasher has a clashing function with the proxy.
Clasher clasher = new Clasher();
Clasher clasher = new Clasher();
...
@@ -253,13 +253,13 @@ contract Proxy_Test is Test {
...
@@ -253,13 +253,13 @@ contract Proxy_Test is Test {
// Allow for `eth_call` to call proxy methods
// Allow for `eth_call` to call proxy methods
// by setting "from" to `address(0)`.
// by setting "from" to `address(0)`.
function test_
zeroAddressCaller
() external {
function test_
implementation_zeroAddressCaller_succeeds
() external {
vm.prank(address(0));
vm.prank(address(0));
address impl = proxy.implementation();
address impl = proxy.implementation();
assertEq(impl, address(simpleStorage));
assertEq(impl, address(simpleStorage));
}
}
function test_implementation
ZeroAddres
s() external {
function test_implementation
_isZeroAddress_revert
s() external {
// Set `address(0)` as the implementation.
// Set `address(0)` as the implementation.
vm.prank(alice);
vm.prank(alice);
proxy.upgradeTo(address(0));
proxy.upgradeTo(address(0));
...
...
packages/contracts-bedrock/contracts/test/ProxyAdmin.t.sol
View file @
38d20ba5
...
@@ -59,32 +59,32 @@ contract ProxyAdmin_Test is Test {
...
@@ -59,32 +59,32 @@ contract ProxyAdmin_Test is Test {
implementation = new SimpleStorage();
implementation = new SimpleStorage();
}
}
function test_setImplementationName() external {
function test_setImplementationName
_succeeds
() external {
vm.prank(alice);
vm.prank(alice);
admin.setImplementationName(address(1), "foo");
admin.setImplementationName(address(1), "foo");
assertEq(admin.implementationName(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");
vm.expectRevert("Ownable: caller is not the owner");
admin.setAddressManager(AddressManager((address(0))));
admin.setAddressManager(AddressManager((address(0))));
}
}
function test_
onlyOwnerSetImplementationName
() external {
function test_
setImplementationName_notOwner_reverts
() external {
vm.expectRevert("Ownable: caller is not the owner");
vm.expectRevert("Ownable: caller is not the owner");
admin.setImplementationName(address(0), "foo");
admin.setImplementationName(address(0), "foo");
}
}
function test_
onlyOwnerSetProxyType
() external {
function test_
setProxyType_notOwner_reverts
() external {
vm.expectRevert("Ownable: caller is not the owner");
vm.expectRevert("Ownable: caller is not the owner");
admin.setProxyType(address(0), ProxyAdmin.ProxyType.CHUGSPLASH);
admin.setProxyType(address(0), ProxyAdmin.ProxyType.CHUGSPLASH);
}
}
function test_owner() external {
function test_owner
_succeeds
() external {
assertEq(admin.owner(), alice);
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(proxy))), uint256(ProxyAdmin.ProxyType.ERC1967));
assertEq(
assertEq(
uint256(admin.proxyType(address(chugsplash))),
uint256(admin.proxyType(address(chugsplash))),
...
@@ -96,15 +96,15 @@ contract ProxyAdmin_Test is Test {
...
@@ -96,15 +96,15 @@ contract ProxyAdmin_Test is Test {
);
);
}
}
function test_erc1967GetProxyImplementation() external {
function test_erc1967GetProxyImplementation
_succeeds
() external {
getProxyImplementation(payable(proxy));
getProxyImplementation(payable(proxy));
}
}
function test_chugsplashGetProxyImplementation() external {
function test_chugsplashGetProxyImplementation
_succeeds
() external {
getProxyImplementation(payable(chugsplash));
getProxyImplementation(payable(chugsplash));
}
}
function test_delegateResolvedGetProxyImplementation() external {
function test_delegateResolvedGetProxyImplementation
_succeeds
() external {
getProxyImplementation(payable(resolved));
getProxyImplementation(payable(resolved));
}
}
...
@@ -123,15 +123,15 @@ contract ProxyAdmin_Test is Test {
...
@@ -123,15 +123,15 @@ contract ProxyAdmin_Test is Test {
}
}
}
}
function test_erc1967GetProxyAdmin() external {
function test_erc1967GetProxyAdmin
_succeeds
() external {
getProxyAdmin(payable(proxy));
getProxyAdmin(payable(proxy));
}
}
function test_chugsplashGetProxyAdmin() external {
function test_chugsplashGetProxyAdmin
_succeeds
() external {
getProxyAdmin(payable(chugsplash));
getProxyAdmin(payable(chugsplash));
}
}
function test_delegateResolvedGetProxyAdmin() external {
function test_delegateResolvedGetProxyAdmin
_succeeds
() external {
getProxyAdmin(payable(resolved));
getProxyAdmin(payable(resolved));
}
}
...
@@ -140,15 +140,15 @@ contract ProxyAdmin_Test is Test {
...
@@ -140,15 +140,15 @@ contract ProxyAdmin_Test is Test {
assertEq(owner, address(admin));
assertEq(owner, address(admin));
}
}
function test_erc1967ChangeProxyAdmin() external {
function test_erc1967ChangeProxyAdmin
_succeeds
() external {
changeProxyAdmin(payable(proxy));
changeProxyAdmin(payable(proxy));
}
}
function test_chugsplashChangeProxyAdmin() external {
function test_chugsplashChangeProxyAdmin
_succeeds
() external {
changeProxyAdmin(payable(chugsplash));
changeProxyAdmin(payable(chugsplash));
}
}
function test_delegateResolvedChangeProxyAdmin() external {
function test_delegateResolvedChangeProxyAdmin
_succeeds
() external {
changeProxyAdmin(payable(resolved));
changeProxyAdmin(payable(resolved));
}
}
...
@@ -188,15 +188,15 @@ contract ProxyAdmin_Test is Test {
...
@@ -188,15 +188,15 @@ contract ProxyAdmin_Test is Test {
}
}
}
}
function test_erc1967Upgrade() external {
function test_erc1967Upgrade
_succeeds
() external {
upgrade(payable(proxy));
upgrade(payable(proxy));
}
}
function test_chugsplashUpgrade() external {
function test_chugsplashUpgrade
_succeeds
() external {
upgrade(payable(chugsplash));
upgrade(payable(chugsplash));
}
}
function test_delegateResolvedUpgrade() external {
function test_delegateResolvedUpgrade
_succeeds
() external {
upgrade(payable(resolved));
upgrade(payable(resolved));
}
}
...
@@ -208,15 +208,15 @@ contract ProxyAdmin_Test is Test {
...
@@ -208,15 +208,15 @@ contract ProxyAdmin_Test is Test {
assertEq(impl, address(implementation));
assertEq(impl, address(implementation));
}
}
function test_erc1967UpgradeAndCall() external {
function test_erc1967UpgradeAndCall
_succeeds
() external {
upgradeAndCall(payable(proxy));
upgradeAndCall(payable(proxy));
}
}
function test_chugsplashUpgradeAndCall() external {
function test_chugsplashUpgradeAndCall
_succeeds
() external {
upgradeAndCall(payable(chugsplash));
upgradeAndCall(payable(chugsplash));
}
}
function test_delegateResolvedUpgradeAndCall() external {
function test_delegateResolvedUpgradeAndCall
_succeeds
() external {
upgradeAndCall(payable(resolved));
upgradeAndCall(payable(resolved));
}
}
...
@@ -235,7 +235,7 @@ contract ProxyAdmin_Test is Test {
...
@@ -235,7 +235,7 @@ contract ProxyAdmin_Test is Test {
assertEq(got, 1);
assertEq(got, 1);
}
}
function test_onlyOwner() external {
function test_onlyOwner
_notOwner_reverts
() external {
vm.expectRevert("Ownable: caller is not the owner");
vm.expectRevert("Ownable: caller is not the owner");
admin.changeProxyAdmin(payable(proxy), address(0));
admin.changeProxyAdmin(payable(proxy), address(0));
...
@@ -246,7 +246,7 @@ contract ProxyAdmin_Test is Test {
...
@@ -246,7 +246,7 @@ contract ProxyAdmin_Test is Test {
admin.upgradeAndCall(payable(proxy), address(implementation), hex"");
admin.upgradeAndCall(payable(proxy), address(implementation), hex"");
}
}
function test_isUpgrading() external {
function test_isUpgrading
_succeeds
() external {
assertEq(false, admin.isUpgrading());
assertEq(false, admin.isUpgrading());
vm.prank(alice);
vm.prank(alice);
...
...
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