@@ -219,6 +219,45 @@ contract XanV1UpgradeTest is Test {
219
219
_xanProxy.upgradeToAndCall ({newImplementation: _councilProposedImpl, data: "" });
220
220
}
221
221
222
+ function test_authorizeUpgrade_resets_the_scheduled_council_upgrade_data_on_upgrade_execution () public {
223
+ // Cache the current implementation
224
+ address currentImpl = _xanProxy.implementation ();
225
+
226
+ // Schedule and upgrade to the current implementation as the council
227
+ vm.prank (_COUNCIL);
228
+ _xanProxy.scheduleCouncilUpgrade (currentImpl);
229
+ (, uint48 endTime ) = _xanProxy.scheduledCouncilUpgrade ();
230
+ skip (endTime);
231
+ _xanProxy.upgradeToAndCall ({newImplementation: currentImpl, data: "" });
232
+ assertEq (_xanProxy.implementation (), currentImpl);
233
+
234
+ // Check that the scheduled upgrade has been reset to 0
235
+ (address scheduledImplPostUpgrade , uint48 scheduledEndTimePostUpgrade ) = _xanProxy.scheduledCouncilUpgrade ();
236
+ assertEq (scheduledImplPostUpgrade, address (0 ));
237
+ assertEq (scheduledEndTimePostUpgrade, 0 );
238
+ }
239
+
240
+ function test_authorizeUpgrade_resets_the_scheduled_voter_body_upgrade_data_on_upgrade_execution () public {
241
+ // Cache the current implementation
242
+ address currentImpl = _xanProxy.implementation ();
243
+
244
+ // Schedule and upgrade to the current implementation as the voter body
245
+ vm.startPrank (_defaultSender);
246
+ _xanProxy.lock (Parameters.MIN_LOCKED_SUPPLY);
247
+ _xanProxy.castVote (currentImpl);
248
+ vm.stopPrank ();
249
+ _xanProxy.scheduleVoterBodyUpgrade ();
250
+ (, uint48 endTime ) = _xanProxy.scheduledVoterBodyUpgrade ();
251
+ skip (endTime);
252
+ _xanProxy.upgradeToAndCall ({newImplementation: currentImpl, data: "" });
253
+ assertEq (_xanProxy.implementation (), currentImpl);
254
+
255
+ // Check that the scheduled upgrade has been reset to 0
256
+ (address scheduledImplPostUpgrade , uint48 scheduledEndTimePostUpgrade ) = _xanProxy.scheduledVoterBodyUpgrade ();
257
+ assertEq (scheduledImplPostUpgrade, address (0 ));
258
+ assertEq (scheduledEndTimePostUpgrade, 0 );
259
+ }
260
+
222
261
function test_upgradeToAndCall_emits_the_Upgraded_event () public {
223
262
vm.prank (_COUNCIL);
224
263
_xanProxy.scheduleCouncilUpgrade (_councilProposedImpl);
0 commit comments