Skip to main content

Module domain

Module domain 

Source
Expand description

Registered domain selectors for protocol-visible hash commitments.

This module follows the Miden domain-separation RFC (https://github.com/0xMiden/crypto/pull/1026): consensus-critical domains use registered numeric identifiers rather than hashed strings, packed as

selector = (domain_id << 8) | version

with domain_id a registered 24-bit integer (>= 1) and version an 8-bit per-domain version (>= 1). The selector rides in the second capacity element of the Poseidon2 sponge (hash_elements_in_domain); the first capacity element is hash-owned and carries the padding rule, mirroring the RFC’s frame/selector lane split. Unused parameter lanes are zero.

§Provisional registry entries

The RFC’s draft registry allocates 0x010000..0x01ffff to miden-vm, with concrete entries delegated to this repository. These are the range’s first entries, to be migrated into the machine-readable registry when it lands:

domain_idversiondomain
0x0100001kernel commitment (KERNEL_DOMAIN_TAG)
0x0100011execution claim (CLAIM_DOMAIN_TAG)
0x0100021proof request key (REQUEST_DOMAIN_TAG)

Selectors share one capacity namespace with the merge_in_domain values used for MAST control-block hashing. Those are opcode-sized (< 256) while every registered selector is >= 257 (domain_id >= 1), so those two ranges cannot collide. Distinctness among registered selectors is the registry’s responsibility: each domain_id is allocated once within its maintainer’s range, and the three defined here are pinned distinct by registry_entries_are_valid_and_distinct_selectors.

Constants§

EXECUTION_CLAIM_DOMAIN_ID
Registered domain id for the execution-claim commitment.
KERNEL_COMMITMENT_DOMAIN_ID
Registered domain id for the kernel commitment.
PROOF_REQUEST_DOMAIN_ID
Registered domain id for the proof-request key.

Functions§

domain_selector
Packs a registered domain id and per-domain version into a domain selector.