DotnsPopResolver

Git Source

Inherits: Initializable, UUPSUpgradeable, OwnableUpgradeable, ERC165Upgradeable, IDotnsPopResolver

Title: DotnsPopResolver

Per-node resolver holding records produced by the PoP username flow.

Writes are gated on the protocol-registered POP_CONTROLLER rather than on node ownership. PoP records are issued by the gateway as part of identity issuance, not curated by the holder, so authority lives with the controller and not the user.

Note: security-contact: admin@parity.io

State Variables

protocolRegistry

Protocol-level address registry used to resolve the authorised writer.

IDotnsProtocolRegistry public protocolRegistry

_chatKeys

Stored chat-key bytes keyed by node.

mapping(bytes32 node => bytes chatKey) private _chatKeys

Stored lite-person labelhash keyed by full-person node.

Forward direction (full => lite): maps a full-person node to the labelhash of the lite username it was claimed from.

mapping(bytes32 fullNode => bytes32 liteLabelhash) private _liteLinks

_fullClaims

Reverse index mapping a lite labelhash to the full-person node it was promoted to.

Written alongside _liteLinks on every claim so consumers that look up by lite username resolve the full name without scanning events. Zero when the lite label has never been linked to a full claim.

mapping(bytes32 liteLabelhash => bytes32 fullNode) private _fullClaims

__gap

Reserved storage space to allow for layout changes in the future.

uint256[50] private __gap

Functions

onlyPopController

Restricts writes to the address registered as POP_CONTROLLER.

modifier onlyPopController() ;

constructor

Note: oz-upgrades-unsafe-allow: constructor

constructor() ;

initialize

Initialises the PoP resolver.

Called once through the UUPS proxy; _disableInitializers on the implementation makes direct calls revert and any repeat call on the proxy reverts with

Note: reverts: InvalidInitialization. The registry pointer is the only storage this setup needs because the authorised writer is resolved dynamically through POP_CONTROLLER. Emits @custom:emits OwnershipTransferred when msg.sender is recorded as the initial owner and @custom:emits Initialized once setup completes.

function initialize(IDotnsProtocolRegistry registry) external initializer;

Parameters

NameTypeDescription
registryIDotnsProtocolRegistryProtocol-level address registry used for writer resolution.

setChatKey

Sets the chat key for node.

Callable only by the address registered under DotnsProtocolRegistry.POP_CONTROLLER, otherwise @custom:reverts NotPopController. Overwrites any previous value. The payload must be exactly 65 bytes: the uncompressed secp256k1 public key encoding (1 prefix byte followed by the 32-byte X and 32-byte Y affine coordinates); any other length reverts with @custom:reverts InvalidChatKeyLength. Emits @custom:emits ChatKeyUpdated on every successful write.

function setChatKey(
    bytes32 node,
    bytes calldata chatKeyBytes
)
    external
    override
    onlyPopController;

Parameters

NameTypeDescription
nodebytes32The node whose chat key is being written.
chatKeyBytesbytes

Sets the lite-person link for a full-person node.

Callable only by the authorised PoP controller, otherwise

Notes:

  • reverts: NotPopController. Overwrites any previous link. When overwriting, the stale inverse entry is nulled so both the forward (liteLink) and reverse (fullClaim) indices remain consistent: re-linking the same fullNode to a new liteLabelhash clears fullClaim(oldLite), and re-linking the same liteLabelhash to a new fullNode clears liteLink(oldFull). The invariant fullClaim(liteLink(node)) == node always holds after the call. Emits

  • emits: LiteLinkUpdated on every successful write.

function setLiteLink(
    bytes32 fullNode,
    bytes32 liteLabelhash
)
    external
    override
    onlyPopController;

Parameters

NameTypeDescription
fullNodebytes32The full-person node carrying the link.
liteLabelhashbytes32The labelhash of the linked lite-person username.

chatKey

Returns the chat key associated with a node.

function chatKey(bytes32 node) external view override returns (bytes memory);

Parameters

NameTypeDescription
nodebytes32The node to query.

Returns

NameTypeDescription
<none>byteschatKey The stored chat key bytes, or empty if unset.

Returns the lite-person labelhash linked to a full-person node.

function liteLink(bytes32 fullNode) external view override returns (bytes32);

Parameters

NameTypeDescription
fullNodebytes32The full-person node to query.

Returns

NameTypeDescription
<none>bytes32liteLabelhash The linked lite-person labelhash, or zero if unset.

fullClaim

Returns the full-person node a given lite label has claimed.

Reverse of @custom:function liteLink. Written by the same setLiteLink call so the two directions stay in lockstep. Returns zero when the lite label has never been linked to a full claim.

function fullClaim(bytes32 liteLabelhash) external view override returns (bytes32);

Parameters

NameTypeDescription
liteLabelhashbytes32The labelhash of the lite-person username to query.

Returns

NameTypeDescription
<none>bytes32fullNode The full-person node claimed from this lite label, or zero if unset.

version

Returns implementation version.

Bumped on every upgrade. Used by deployment scripts as a post-upgrade assertion target.

function version() external pure virtual returns (string memory versionString);

Returns

NameTypeDescription
versionStringstringCurrent version string.

supportsInterface

function supportsInterface(bytes4 interfaceId) public view override returns (bool);

_onlyPopController

Internal check enforcing PoP-controller-only access.

function _onlyPopController() internal view;

_authorizeUpgrade

Function that should revert when msg.sender is not authorized to upgrade the contract. Called by {upgradeToAndCall}. Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.

function _authorizeUpgrade(address) internal onlyOwner {}
function _authorizeUpgrade(address newImplementation) internal override onlyOwner;