BootstrapOwnableUpgradeable
Inherits: OwnableUpgradeable
Title: BootstrapOwnableUpgradeable
Governance gate for an upgradeable dotNS contract: substrate Root, or the bootstrap owner while one is set.
The owner exists only to configure a fresh deployment. Ownership cannot move to another
account: the only transition is @custom:function renounceOwnership, after which Root is
the only governance. Only Root can renounce: a Root call passes the gate behind a proxy
only on a runtime where callerIsRoot works there, so the renounce proves that Root can
still govern after it. An owner renouncing on a runtime without that would leave no
account able to upgrade. DotnsProtocolRegistry holds the one bootstrap owner of a
deployment. Every other dotNS contract reads it from there through
Notes:
-
contract: ProtocolOwnedUpgradeable, so one renounce ends the bootstrap everywhere. The gate checks Root first and reads
msg.senderonly when the caller is not Root: a Root origin has no account behind it, so readingmsg.senderin its frame traps. A function behind the gate must not readmsg.sendereither. Root passes only when it called this contract directly (see @custom:function SystemUtils.callerIsRoot), so a contract reached later in a Root transaction cannot pass. The gate reads Root through -
function: SystemUtils.tryCallerIsRoot, so a deployment script still configures as the owner in a local simulation that has no System precompile. Adds no storage.
OwnableUpgradeablekeeps the owner in ERC-7201 namespaced storage, so a contract can switch its base fromOwnableUpgradeableto this one without moving any slot.
Functions
onlyRootOrOwner
Restricts a call to Root, or to the owner while one is set.
modifier onlyRootOrOwner() ;
transferOwnership
Disabled: ownership can only be renounced.
Always @custom:reverts OwnershipTransferDisabled.
function transferOwnership(address) public pure override;
renounceOwnership
Removes the bootstrap owner, leaving Root as the only governance.
Root only, otherwise @custom:reverts RenounceRequiresRoot. Irreversible: no function sets an owner again.
function renounceOwnership() public virtual override onlyRoot;
onlyRoot
Restricts a call to a direct Root dispatch.
modifier onlyRoot() ;
_checkRootOrOwner
Internal check behind @custom:modifier onlyRootOrOwner.
Reverts with OwnableUnauthorizedAccount when the caller is neither Root nor the owner.
Once the owner is renounced, owner() is zero and no account passes.
function _checkRootOrOwner() internal view;
Errors
OwnershipTransferDisabled
Thrown by @custom:function transferOwnership, which is disabled.
error OwnershipTransferDisabled();
RenounceRequiresRoot
Thrown by @custom:function renounceOwnership when the caller is not Root.
error RenounceRequiresRoot();