StoreUtils
Title: DotNS Store Utilities Library
Canonical helpers for protocol writes into per-user LabelStore instances.
One auth rule, one write path. Every DotNS consumer (controller, registrar,
registry, PoP controller) funnels label writes through writeNewLabel so
authorisation, deploy-on-first-use and conflict handling are identical across flows.
Note: security-contact: admin@parity.io
Functions
ensureLabelStore
Returns the LabelStore for user, deploying one via the factory if absent.
Deploy-on-demand: a user's store is created on their first protocol write so unused accounts never pay the deployment cost. The deploy path is gated by the factory, so callers that are not the factory owner and not a store writer
Note: reverts: NotAuthorised when a deployment is required.
function ensureLabelStore(IStoreFactory factory, address user)
internal
returns (address store);
Parameters
| Name | Type | Description |
|---|---|---|
factory | IStoreFactory | The store factory. |
user | address | The user whose label store is being resolved. |
Returns
| Name | Type | Description |
|---|---|---|
store | address | The resolved or newly deployed store address. |
writeNewLabel
Writes label for a name being registered, rejecting a conflicting entry.
An existing entry is tolerated only when it already holds label. An entry saying
something else was put there by someone else and must not be silently honoured:
storeLabel is single-write with no delete, so accepting it would leave the name
permanently mislabelled and untransferable. Matching entries stay a no-op, which keeps
re-registration by a previous holder, and a transfer back to one, working.
function writeNewLabel(
IStoreFactory factory,
address user,
bytes32 labelhash,
string memory label
)
internal
returns (address store);
Parameters
| Name | Type | Description |
|---|---|---|
factory | IStoreFactory | The store factory. |
user | address | The label store owner. |
labelhash | bytes32 | The labelhash key. |
label | string | The label string (typically the full name, e.g. "alice.dot"). |
Returns
| Name | Type | Description |
|---|---|---|
store | address | The resolved or newly deployed store address. |
Errors
LabelEntryConflict
Thrown when a name being registered already has a different label entry.
error LabelEntryConflict(address store, bytes32 labelhash, string existing);
Parameters
| Name | Type | Description |
|---|---|---|
store | address | The label store holding the conflicting entry. |
labelhash | bytes32 | The key that is already occupied. |
existing | string | The label already stored under labelhash. |