@@ -144,6 +144,43 @@ contract TestNonFungibleNttManager is Test {
144
144
145
145
// ================================== Admin Tests ==================================
146
146
147
+ function test_cannotDeployWithInvalidTokenIdWidth (uint8 _tokenIdWidth ) public {
148
+ vm.assume (
149
+ _tokenIdWidth != 1 && _tokenIdWidth != 2 && _tokenIdWidth != 4 && _tokenIdWidth != 8
150
+ && _tokenIdWidth != 16 && _tokenIdWidth != 32
151
+ );
152
+
153
+ vm.expectRevert (
154
+ abi.encodeWithSelector (
155
+ INonFungibleNttManager.InvalidTokenIdWidth.selector , _tokenIdWidth
156
+ )
157
+ );
158
+ NonFungibleNttManager implementation = new NonFungibleNttManager (
159
+ address (nftOne), _tokenIdWidth, IManagerBase.Mode.BURNING, chainIdOne
160
+ );
161
+ }
162
+
163
+ /// @dev We perform an upgrade with the existing tokenIdWidth to show that upgrades
164
+ /// are possible with the same tokenIdWidth. There is no specific error thrown when
165
+ /// the immutables check throws.
166
+ function test_cannotUpgradeWithDifferentTokenIdWidth () public {
167
+ vm.startPrank (owner);
168
+ {
169
+ NonFungibleNttManager newImplementation = new NonFungibleNttManager (
170
+ address (nftOne), tokenIdWidth, IManagerBase.Mode.LOCKING, chainIdOne
171
+ );
172
+ managerOne.upgrade (address (newImplementation));
173
+ }
174
+
175
+ uint8 newTokenIdWidth = 4 ;
176
+ NonFungibleNttManager newImplementation = new NonFungibleNttManager (
177
+ address (nftOne), newTokenIdWidth, IManagerBase.Mode.LOCKING, chainIdOne
178
+ );
179
+
180
+ vm.expectRevert ();
181
+ managerOne.upgrade (address (newImplementation));
182
+ }
183
+
147
184
function test_cannotInitalizeNotDeployer () public {
148
185
// Don't initialize.
149
186
vm.prank (owner);
0 commit comments