Skip to content

ML-KEM key registration pays for the index write but not for hashing the key #6511

Backlog

Description

@thepastaclaw

PastaClaw flagged this while reviewing #6507, where it was deferred to a follow-up instead of being fixed in that pull request. This issue tracks the follow-up.

ML-KEM key registration pays for the index write but not for hashing the key (blocking)

Impact: When an identity creation or update stores an ML-KEM key, its fee omits the HASH160 computation over the 1,184- or 1,568-byte public key.

Where: packages/rs-dpp/src/identity/identity_public_key/v0/methods/mod.rs:84-94 at b635d5548b1a:

KeyType::ML_KEM_768 | KeyType::ML_KEM_1024 => {
if data.len() != key_type.default_size() {
Err(ProtocolError::ParsingError(format!(
"the key length is invalid: {} Allowed sizes: {} bytes for {} key",
data.len(),
key_type.default_size(),
key_type
)))
} else {
Ok(ripemd160_sha256(data.as_slice()))
}

ML-KEM is the first non-unique key type that computes HASH160 here instead of using 20 bytes already supplied by the caller. Drive’s insert_reference_to_non_unique_key/v0/mod.rs:33–47 builds a byte-counted Sha256RipeMD160 operation but returns only the nested insert’s separate operation vector. Return both operations for ML-KEM indexing through the shared estimation and apply path, without adding a hash charge for historical hash-as-data keys.

Origin

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions