Skip to content

Commit 5ae5940

Browse files
authored
Merge pull request #369 from push-protocol/366-bump-down-oz-version-for-pgp-registry
Downgraded OZ version to 4.9.0
2 parents 8c210d5 + 6ab07f5 commit 5ae5940

File tree

15 files changed

+42
-53
lines changed

15 files changed

+42
-53
lines changed

contracts/PushComm/EPNSCommAdmin.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ pragma solidity ^0.8.20;
55
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
66

77
contract EPNSCommAdmin is ProxyAdmin {
8-
constructor(address _pushChannelAdmin) public ProxyAdmin(_pushChannelAdmin) { }
8+
constructor(address _pushChannelAdmin) public ProxyAdmin() { }
99
}

contracts/PushCore/EPNSCoreAdmin.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ pragma solidity ^0.8.20;
55
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
66

77
contract EPNSCoreAdmin is ProxyAdmin {
8-
constructor(address _pushChannelAdmin) public ProxyAdmin(_pushChannelAdmin) { }
8+
constructor(address _pushChannelAdmin) public ProxyAdmin() { }
99
}

contracts/PushCore/PushCoreV3.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { CoreTypes } from "../libraries/DataTypes.sol";
2222
import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
2323
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
2424
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
25-
import { PausableUpgradeable, Initializable } from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
25+
import { PausableUpgradeable, Initializable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
2626

2727
contract PushCoreV3 is Initializable, PushCoreStorageV1_5, PausableUpgradeable, PushCoreStorageV2, IPushCoreV3 {
2828
using SafeERC20 for IERC20;

contracts/libraries/Errors.sol

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ library Errors {
2222
error InvalidArg_MoreThanExpected(uint256 max_threshold, uint256 actual_value);
2323
/// @notice Reverts when uint256 argument passed is less than expected value.
2424
error InvalidArg_LessThanExpected(uint256 min_threshold, uint256 actual_value);
25-
/// @notice Reverts when operation failed because the contract is paused.
26-
error EnforcedPause();
2725
/// @notice The caller account is not authorized to perform an operation.
2826
error OwnableUnauthorizedAccount(address account);
2927

contracts/mocks/PushCoreMock.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { PushCoreStorageV2 } from "../PushCore/PushCoreStorageV2.sol";
1616

1717
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
1818
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
19-
import { PausableUpgradeable, Initializable } from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
19+
import { PausableUpgradeable, Initializable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
2020

2121
contract PushCoreMock is Initializable, PushCoreStorageV1_5, PausableUpgradeable, PushCoreStorageV2 {
2222
using SafeERC20 for IERC20;

contracts/token/Push.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ contract Push is Ownable{
103103
* @notice Construct a new PUSH token
104104
* @param account The initial account to grant all the tokens
105105
*/
106-
constructor(address account) Ownable(account){
106+
constructor(address account) Ownable(){
107107
// holder weight initial adjustments
108108
holderWeight[account] = block.number;
109109
born = block.number;

contracts/token/PushMigration.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
66
import {IERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";
77
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
88
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
9-
import { PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
9+
import { PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
1010

1111
contract PushMigrationHelper is OwnableUpgradeable, PausableUpgradeable{
1212
using SafeERC20 for IERC20;
@@ -32,7 +32,7 @@ contract PushMigrationHelper is OwnableUpgradeable, PausableUpgradeable{
3232
function initialize(address _owner, address _oldToken) external initializer {
3333
oldPushToken = IERC20(_oldToken);
3434

35-
__Ownable_init(_owner);
35+
__Ownable_init();
3636
}
3737

3838
function pauseContract() external onlyOwner{

package-lock.json

Lines changed: 8 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
"dependencies": {
2424
"@nomiclabs/hardhat-ethers": "^2.0.2",
2525
"@nomiclabs/hardhat-waffle": "^2.0.1",
26-
"@openzeppelin/contracts": "^5.0.0",
27-
"@openzeppelin/contracts-upgradeable": "^5.0.0",
26+
"@openzeppelin/contracts": "^4.9.0",
27+
"@openzeppelin/contracts-upgradeable": "^4.9.0",
2828
"bip39": "3.0.3",
2929
"chai": "^4.3.4",
3030
"chalk": "^4.1.1",

test/BaseTest.t.sol

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {EPNSCommProxy} from "contracts/PushComm/EPNSCommProxy.sol";
1515
import {EPNSCommAdmin} from "contracts/PushComm/EPNSCommAdmin.sol";
1616
import {PushMigrationHelper} from "contracts/token/PushMigration.sol";
1717
import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
18+
import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
1819

1920
import {Actors} from "./utils/Actors.sol";
2021
import {Events} from "./utils/Events.sol";
@@ -35,6 +36,7 @@ abstract contract BaseTest is Test, Constants, Events {
3536
PushMigrationHelper public pushMigrationHelper;
3637
PushMigrationHelper public pushMigrationHelperProxy;
3738
TransparentUpgradeableProxy public pushMigrationProxy;
39+
ProxyAdmin public pushProxyAdmin;
3840

3941
/* ***************
4042
Main Actors in Test
@@ -79,12 +81,14 @@ abstract contract BaseTest is Test, Constants, Events {
7981
tim_push_holder: createActor("tim_push_holder")
8082
});
8183

84+
changePrank(actor.admin);
8285
pushNttToken = new Push(actor.admin);
86+
pushProxyAdmin = new ProxyAdmin();
8387

8488
// Initialize pushMigration proxy admin and proxy contract
8589
pushMigrationProxy = new TransparentUpgradeableProxy(
8690
address(pushMigrationHelper),
87-
actor.admin,
91+
address(pushProxyAdmin),
8892
abi.encodeWithSignature(
8993
"initialize(address,address)",
9094
actor.admin,
@@ -95,13 +99,14 @@ abstract contract BaseTest is Test, Constants, Events {
9599
address(pushMigrationProxy)
96100
);
97101
// set governance as minter of ntt token
98-
vm.prank(actor.admin);
102+
changePrank(actor.admin);
99103
pushNttToken.setMinter(actor.governance);
100104

105+
epnsCoreProxyAdmin = new EPNSCoreAdmin(actor.admin);
101106
// Initialize coreMock proxy admin and coreProxy contract
102107
epnsCoreProxy = new EPNSCoreProxy(
103108
address(coreMock),
104-
actor.admin,
109+
address(epnsCoreProxyAdmin),
105110
actor.admin,
106111
address(pushToken),
107112
address(0), // WETH Address
@@ -111,25 +116,14 @@ abstract contract BaseTest is Test, Constants, Events {
111116
address(0), // aDai address
112117
0
113118
);
114-
address admin = address(
115-
uint160(
116-
uint256(
117-
vm.load(
118-
address(epnsCoreProxy),
119-
0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103
120-
)
121-
)
122-
)
123-
);
124-
vm.prank(actor.admin);
125-
EPNSCoreAdmin(admin).upgradeAndCall(
119+
changePrank(actor.admin);
120+
epnsCoreProxyAdmin.upgrade(
126121
ITransparentUpgradeableProxy(address(epnsCoreProxy)),
127-
address(coreProxy),
128-
""
122+
address(coreProxy)
129123
);
130124

131125
coreProxy = PushCoreV3(address(epnsCoreProxy));
132-
vm.prank(tokenDistributor);
126+
changePrank(tokenDistributor);
133127
pushToken.transfer(address(coreProxy), 1 ether);
134128

135129
// Initialize comm proxy admin and commProxy contract
@@ -143,7 +137,7 @@ abstract contract BaseTest is Test, Constants, Events {
143137
commProxy = PushCommV3(address(epnsCommProxy));
144138

145139
// Set-up Core Address in Comm & Vice-Versa
146-
vm.startPrank(actor.admin);
140+
changePrank(actor.admin);
147141
commProxy.setEPNSCoreAddress(address(coreProxy));
148142
commProxy.setPushTokenAddress(address(pushToken));
149143
coreProxy.setEpnsCommunicatorAddress(address(commProxy));

test/PushComm/unit_tests/WalletPGPActions/walletPGP.t.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ contract walletPGP_Test is BasePushCommTest {
171171
// it should REVERT
172172
bytes memory _data = getEncodedData(actor.bob_channel_owner);
173173

174-
vm.expectRevert("Nothing to delete");
174+
vm.expectRevert("Invalid Call");
175175
changePrank(actor.bob_channel_owner);
176176
commProxy.removeWalletFromUser(_data, false);
177177
}
@@ -212,7 +212,7 @@ contract walletPGP_Test is BasePushCommTest {
212212
// it should REVERT
213213
bytes memory _data = getEncodedData(address(firstERC721), 0);
214214

215-
vm.expectRevert("Nothing to delete");
215+
vm.expectRevert("Invalid Call");
216216
changePrank(actor.bob_channel_owner);
217217
commProxy.removeWalletFromUser(_data, true);
218218
}

test/PushComm/unit_tests/WalletPGPActions/walletPGPforETH.t.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ contract walletPGP_Test is BasePushCommTest {
193193
// it should REVERT
194194
bytes memory _data = getEncodedData(actor.bob_channel_owner);
195195

196-
vm.expectRevert("Nothing to delete");
196+
vm.expectRevert("Invalid Call");
197197
changePrank(actor.bob_channel_owner);
198198
commProxyEth.removeWalletFromUser(_data, false);
199199
}
@@ -234,7 +234,7 @@ contract walletPGP_Test is BasePushCommTest {
234234
uint coreBalanceBefore = pushToken.balanceOf(address(coreProxy));
235235
bytes memory _data = getEncodedData(address(firstERC721), 0);
236236

237-
vm.expectRevert("Nothing to delete");
237+
vm.expectRevert("Invalid Call");
238238
changePrank(actor.bob_channel_owner);
239239
commProxyEth.removeWalletFromUser(_data, true);
240240
}

test/PushCore/unit_tests/ContractPausability/contractPausability.t.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ contract ContractPausability_Test is BasePushCoreTest {
4747
vm.prank(actor.admin);
4848
coreProxy.pauseContract();
4949

50-
vm.expectRevert(abi.encodeWithSelector(Errors.EnforcedPause.selector));
50+
vm.expectRevert("Pausable: paused");
5151
_createChannel(actor.bob_channel_owner);
5252
}
5353

@@ -57,7 +57,7 @@ contract ContractPausability_Test is BasePushCoreTest {
5757
vm.prank(actor.admin);
5858
coreProxy.pauseContract();
5959

60-
vm.expectRevert(abi.encodeWithSelector(Errors.EnforcedPause.selector));
60+
vm.expectRevert("Pausable: paused");
6161
vm.prank(actor.bob_channel_owner);
6262
coreProxy.updateChannelState(0);
6363
}
@@ -70,7 +70,7 @@ contract ContractPausability_Test is BasePushCoreTest {
7070
vm.prank(actor.admin);
7171
coreProxy.pauseContract();
7272

73-
vm.expectRevert(abi.encodeWithSelector(Errors.EnforcedPause.selector));
73+
vm.expectRevert("Pausable: paused");
7474
vm.prank(actor.bob_channel_owner);
7575
coreProxy.updateChannelState(ADD_CHANNEL_MIN_FEES);
7676
}
@@ -81,7 +81,7 @@ contract ContractPausability_Test is BasePushCoreTest {
8181
vm.prank(actor.admin);
8282
coreProxy.pauseContract();
8383

84-
vm.expectRevert(abi.encodeWithSelector(Errors.EnforcedPause.selector));
84+
vm.expectRevert("Pausable: paused");
8585
vm.prank(actor.admin);
8686
coreProxy.blockChannel(actor.bob_channel_owner);
8787
}

test/PushMigrationHelper/unit_tests/4_migrationAdminActions/migrationAdminActions.t.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ contract MigrationAdminActions_Test is BaseTest {
2020

2121
function test_Revertwhen_NonAdminCalls_SetNewPushToken() public onlyOwner {
2222
vm.prank(actor.dan_push_holder);
23-
vm.expectRevert(abi.encodeWithSelector(Errors.OwnableUnauthorizedAccount.selector, actor.dan_push_holder));
23+
vm.expectRevert("Ownable: caller is not the owner");
2424
pushMigrationHelperProxy.setNewPushToken(address(pushNttToken));
2525
}
2626

@@ -53,7 +53,7 @@ contract MigrationAdminActions_Test is BaseTest {
5353

5454
function test_Revertwhen_NonAdminCalls_ToggleUnMigrationStatus() public onlyOwner {
5555
vm.prank(actor.dan_push_holder);
56-
vm.expectRevert(abi.encodeWithSelector(Errors.OwnableUnauthorizedAccount.selector, actor.dan_push_holder));
56+
vm.expectRevert("Ownable: caller is not the owner");
5757
pushMigrationHelperProxy.toggleUnMigrationStatus(true);
5858
}
5959

@@ -77,7 +77,7 @@ contract MigrationAdminActions_Test is BaseTest {
7777

7878
function test_Revertwhen_NonAdminCalls_BurnOldTokens() public onlyOwner {
7979
vm.prank(actor.dan_push_holder);
80-
vm.expectRevert(abi.encodeWithSelector(Errors.OwnableUnauthorizedAccount.selector, actor.dan_push_holder));
80+
vm.expectRevert("Ownable: caller is not the owner");
8181
pushMigrationHelperProxy.burnOldTokens(1_000 ether);
8282
}
8383

test/PushNttToken/unit_tests/2_nttInterface/setMinter/setMinter.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ contract SetMinter_Test is BaseTest {
1515

1616
function test_Revertwhen_CallerNotOwner() public onlyOwner {
1717
vm.prank(actor.dan_push_holder);
18-
vm.expectRevert(abi.encodeWithSelector(Errors.OwnableUnauthorizedAccount.selector, actor.dan_push_holder));
18+
vm.expectRevert("Ownable: caller is not the owner");
1919
pushNttToken.setMinter(actor.admin);
2020
}
2121

0 commit comments

Comments
 (0)