Rekeying to smart contracts

If I rekey an account to a smart contract, are checks like the ones below necessary?

Assert( Gtxn[1].close_remainder_to() == Global.zero_address()      ),
Assert( Gtxn[1].rekey_to() == Global.zero_address()                        ),

In theory, the smart contract has full authority over the accounts that have been rekeyed to it and no other account can rekey or close the account.

Is this correct?

It depends on the use case.
What is Gtxn[1] in this case?

But when you rekey an account A to a logicsig/smart signature contract account, then if the logicsig allows rekeying itself, then anyone can rekey A to the account of their choice and take ownership of A.
This is why in general you should always check that no rekeying occurs in smart signatures.

1 Like