ILabelStore
Inherits: IDotnsStore
Title: ILabelStore
Interface for the per-user DotNS label store.
The LabelStore is the protocol-managed half of the per-user storage pair:
write-only by addresses registered in the protocol registry, read-only by
everyone else, and permanently locked per labelhash on first write. It
holds registration records only; every other per-name category (reverse,
content, forward address, chat key, lite link) lives on a dedicated
resolver, not here.
Note: security-contact: admin@parity.io
Functions
initialize
Initialises the store, binding it permanently to user_ and protocolRegistry_.
Callable exactly once via Initializable; both parameters are immutable post-call.
user_ must be non-zero, otherwise @custom:reverts InvalidUser.
protocolRegistry_ must be non-zero, otherwise @custom:reverts
InvalidProtocolRegistry. @param user_ The user this store is bound to forever.
function initialize(address user_, address protocolRegistry_) external;
Parameters
| Name | Type | Description |
|---|---|---|
user_ | address | |
protocolRegistry_ | address | The protocol registry used to authorise writers. |
storeLabel
Records a label under labelhash and locks the slot permanently.
Gated to addresses currently registered in the protocol registry, otherwise
Notes:
-
reverts: NotAuthorised.
labelhashmust be non-zero, otherwise -
reverts: InvalidLabel. The slot must not already hold an entry, otherwise
-
reverts: LabelAlreadyExists; the write is permanent so any second call reverts. Emits @custom:emits LabelStored on the single successful write.
function storeLabel(bytes32 labelhash, string calldata label) external;
Parameters
| Name | Type | Description |
|---|---|---|
labelhash | bytes32 | The labelhash key. |
label | string | The label string to store. |
protocolRegistry
Returns the protocol registry this store queries for write authorisation.
function protocolRegistry() external view returns (address protocolRegistry_);
Returns
| Name | Type | Description |
|---|---|---|
protocolRegistry_ | address | The registry address. |
hasLabel
Returns true iff a label has been stored under labelhash.
function hasLabel(bytes32 labelhash) external view returns (bool exists);
Parameters
| Name | Type | Description |
|---|---|---|
labelhash | bytes32 | The labelhash to check. |
Returns
| Name | Type | Description |
|---|---|---|
exists | bool | True iff the slot holds a label. |
isLocked
Returns true iff the slot for labelhash is permanently locked.
Always equal to hasLabel in the current design; exposed explicitly so future
implementations behind the beacon can distinguish "stored" from "locked" if needed.
function isLocked(bytes32 labelhash) external view returns (bool locked);
Parameters
| Name | Type | Description |
|---|---|---|
labelhash | bytes32 | The labelhash to check. |
Returns
| Name | Type | Description |
|---|---|---|
locked | bool | True iff the slot is locked. |
getLabel
Returns the stored label for labelhash, or the empty string if none.
function getLabel(bytes32 labelhash) external view returns (string memory label);
Parameters
| Name | Type | Description |
|---|---|---|
labelhash | bytes32 | The labelhash to look up. |
Returns
| Name | Type | Description |
|---|---|---|
label | string | The stored label string. |
getLabelCount
Returns the total number of labels ever stored.
function getLabelCount() external view returns (uint256 count);
Returns
| Name | Type | Description |
|---|---|---|
count | uint256 | Current length of the insertion-order list. |
getLabelAt
Returns the human-readable label at the given insertion-order index.
Primary read for "give me my names"; does not require the caller to know any labelhash. For the underlying labelhash key see @custom:function getLabelhashAt.
function getLabelAt(uint256 index) external view returns (string memory label);
Parameters
| Name | Type | Description |
|---|---|---|
index | uint256 | Zero-based index into the insertion-order list. |
Returns
| Name | Type | Description |
|---|---|---|
label | string | The stored label string at index. |
getLabelhashAt
Returns the labelhash at the given insertion-order index.
function getLabelhashAt(uint256 index) external view returns (bytes32 labelhash);
Parameters
| Name | Type | Description |
|---|---|---|
index | uint256 | Zero-based index into the insertion-order list. |
Returns
| Name | Type | Description |
|---|---|---|
labelhash | bytes32 | The labelhash at index. |
getLabels
Paginated read returning just the stored labels, in insertion order.
Primary bulk read for "give me all my names". Callers never need to touch
labelhashes. Length is min(limit, getLabelCount() - offset);
offset >= getLabelCount() returns an empty array (not a revert).
function getLabels(uint256 offset, uint256 limit) external view returns (string[] memory labels);
Parameters
| Name | Type | Description |
|---|---|---|
offset | uint256 | Start index. |
limit | uint256 | Maximum entries to return. |
Returns
| Name | Type | Description |
|---|---|---|
labels | string[] | Slice of label strings. |
getLabelhashes
Paginated read over the labelhash keys, in insertion order.
Advanced read for callers that need the raw labelhash keys. Symmetric with
Note: function: getLabels; same indices map to the same entries.
function getLabelhashes(
uint256 offset,
uint256 limit
)
external
view
returns (bytes32[] memory labelhashes);
Parameters
| Name | Type | Description |
|---|---|---|
offset | uint256 | Start index. |
limit | uint256 | Maximum entries to return. |
Returns
| Name | Type | Description |
|---|---|---|
labelhashes | bytes32[] | Slice of labelhash keys. |
Events
LabelStored
Emitted when a label is stored for the first (and only) time under a given labelhash. @param owner The user this store is bound to.
event LabelStored(address indexed owner, bytes32 indexed labelhash, string label);
Parameters
| Name | Type | Description |
|---|---|---|
owner | address | |
labelhash | bytes32 | The labelhash key. |
label | string | The stored label string (typically the full name, e.g. "alice.dot"). |
Errors
NotAuthorised
Thrown when a caller that is not currently protocol-registered attempts a write.
error NotAuthorised(address caller);
Parameters
| Name | Type | Description |
|---|---|---|
caller | address | The msg.sender that failed the isRegisteredAddress check. |
InvalidUser
Thrown when initialize is called with a zero user address.
error InvalidUser(address user);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | The invalid user argument. |
InvalidProtocolRegistry
Thrown when initialize is called with a zero protocol registry address.
error InvalidProtocolRegistry(address protocolRegistry);
Parameters
| Name | Type | Description |
|---|---|---|
protocolRegistry | address | The invalid registry argument. |
InvalidLabel
Thrown when storeLabel is called with a zero labelhash.
error InvalidLabel(bytes32 labelhash);
Parameters
| Name | Type | Description |
|---|---|---|
labelhash | bytes32 | The invalid labelhash argument. |
LabelAlreadyExists
Thrown when storeLabel is called for a labelhash already present in the index.
Labels are write-once and permanently locked on first store, so any second write for the same labelhash fails with this error regardless of caller or session.
error LabelAlreadyExists(bytes32 labelhash);
Parameters
| Name | Type | Description |
|---|---|---|
labelhash | bytes32 | The conflicting labelhash. |