@@ -289,7 +289,7 @@ public void InitializeOwner_UpdateInitializesWhenOwnerMissing()
289289 var engine = CreateEngine ( ) ;
290290 var contract = Deploy ( engine , out _ , out _ ) ;
291291
292- contract . ClearOwnerForTest ( ) ;
292+ contract . ClearOwnershipStateForTest ( ) ;
293293 Assert . IsNull ( contract . GetOwner ( ) ) ;
294294
295295 contract . InitializeForTest ( Bob . Account , true ) ;
@@ -299,6 +299,20 @@ public void InitializeOwner_UpdateInitializesWhenOwnerMissing()
299299 Merge ( contract ) ;
300300 }
301301
302+ [ TestMethod ]
303+ public void InitializeOwner_UpdateDoesNotReinitializeAfterRenounce ( )
304+ {
305+ var engine = CreateEngine ( ) ;
306+ var contract = Deploy ( engine , out _ , out _ ) ;
307+
308+ contract . RenounceOwnership ( ) ;
309+ contract . InitializeForTest ( Bob . Account , true ) ;
310+
311+ Assert . IsNull ( contract . GetOwner ( ) ) ;
312+ Assert . ThrowsException < TestException > ( ( ) => contract . TransferOwnership ( Charlie . Account ) ) ;
313+ Merge ( contract ) ;
314+ }
315+
302316 [ TestMethod ]
303317 public void RePropose_SupersedesPending ( )
304318 {
@@ -418,6 +432,12 @@ public static void ClearOwnerForTest()
418432 {
419433 Storage.Delete(new byte[] { 0xFD });
420434 }
435+
436+ public static void ClearOwnershipStateForTest()
437+ {
438+ Storage.Delete(new byte[] { 0xFD });
439+ Storage.Delete(new byte[] { 0xFB });
440+ }
421441}" ;
422442
423443 var tempFile = Path . Combine ( Path . GetTempPath ( ) , $ "{ Guid . NewGuid ( ) : N} .cs") ;
@@ -480,6 +500,9 @@ public abstract class OwnableTwoStepProxy(SmartContractInitialize initialize)
480500 [ DisplayName ( "clearOwnerForTest" ) ]
481501 public abstract void ClearOwnerForTest ( ) ;
482502
503+ [ DisplayName ( "clearOwnershipStateForTest" ) ]
504+ public abstract void ClearOwnershipStateForTest ( ) ;
505+
483506 [ DisplayName ( "transferOwnership" ) ]
484507 public abstract void TransferOwnership ( UInt160 newOwner ) ;
485508
0 commit comments