@@ -7,6 +7,7 @@ const UUPSUpgradeableMock = artifacts.require('UUPSUpgradeableMock');
7
7
const UUPSUpgradeableUnsafeMock = artifacts . require ( 'UUPSUpgradeableUnsafeMock' ) ;
8
8
const NonUpgradeableMock = artifacts . require ( 'NonUpgradeableMock' ) ;
9
9
const UUPSUnsupportedProxiableUUID = artifacts . require ( 'UUPSUnsupportedProxiableUUID' ) ;
10
+ const Address = artifacts . require ( '$Address' ) ;
10
11
11
12
contract ( 'UUPSUpgradeable' , function ( ) {
12
13
before ( async function ( ) {
@@ -15,6 +16,7 @@ contract('UUPSUpgradeable', function () {
15
16
this . implUpgradeUnsafe = await UUPSUpgradeableUnsafeMock . new ( ) ;
16
17
this . implUpgradeNonUUPS = await NonUpgradeableMock . new ( ) ;
17
18
this . implUnsupportedUUID = await UUPSUnsupportedProxiableUUID . new ( ) ;
19
+ this . helper = await Address . new ( ) ;
18
20
} ) ;
19
21
20
22
beforeEach ( async function ( ) {
@@ -43,15 +45,15 @@ contract('UUPSUpgradeable', function () {
43
45
expect ( await this . instance . current ( ) ) . to . be . bignumber . equal ( '1' ) ;
44
46
} ) ;
45
47
46
- it ( 'rejects upgrading directly from the implementation' , async function ( ) {
48
+ it ( 'calling upgradeTo on the implementation reverts ' , async function ( ) {
47
49
await expectRevertCustomError (
48
50
this . implInitial . upgradeTo ( this . implUpgradeOk . address ) ,
49
51
'UUPSUnauthorizedCallContext' ,
50
52
[ ] ,
51
53
) ;
52
54
} ) ;
53
55
54
- it ( 'rejects upgrading directly from the implementation with call ' , async function ( ) {
56
+ it ( 'calling upgradeToAndCall on the implementation reverts ' , async function ( ) {
55
57
await expectRevertCustomError (
56
58
this . implInitial . upgradeToAndCall (
57
59
this . implUpgradeOk . address ,
@@ -62,9 +64,9 @@ contract('UUPSUpgradeable', function () {
62
64
) ;
63
65
} ) ;
64
66
65
- it ( 'rejects upgrading from an invalid proxy' , async function ( ) {
67
+ it ( 'calling upgradeTo from a contract that is not a proxy reverts ' , async function ( ) {
66
68
await expectRevertCustomError (
67
- this . implUpgradeUnsafe . functionDelegateCall (
69
+ this . helper . $ functionDelegateCall(
68
70
this . implUpgradeOk . address ,
69
71
this . implUpgradeOk . contract . methods . upgradeTo ( this . implUpgradeUnsafe . address ) . encodeABI ( ) ,
70
72
) ,
@@ -73,9 +75,9 @@ contract('UUPSUpgradeable', function () {
73
75
) ;
74
76
} ) ;
75
77
76
- it ( 'rejects upgrading from an invalid proxy with call ' , async function ( ) {
78
+ it ( 'calling upgradeTo from a contract that is not a proxy reverts ' , async function ( ) {
77
79
await expectRevertCustomError (
78
- this . implUpgradeUnsafe . functionDelegateCall (
80
+ this . helper . $ functionDelegateCall(
79
81
this . implUpgradeOk . address ,
80
82
this . implUpgradeOk . contract . methods . upgradeToAndCall ( this . implUpgradeUnsafe . address , '0x' ) . encodeABI ( ) ,
81
83
) ,
0 commit comments