Skip to content

Add ability to declare word-sized constants from strings #2011

@PhilippGackstatter

Description

@PhilippGackstatter

We would like to be able to declare word-sized constants from strings, kind of how it already works for error messages. Writing:

const.METADATA_SLOT_NAME="miden::basic_fungible_faucet::metadata"

would declare a word-sized constant that is the hash of the given string. For error messages, I believe this is currently just one field element, but here we would like to get a hash that is a full word. Similar to error messages, this can be the BLAKE3 hash and doesn't have to be an RPO hash.

One thought is whether this should be explicit in which hash is used, in case we do want this mechanism to (at some later point) also be usable to create constants based on RPO hashes, in which case it would be possible to disambiguate right there. So something like the following is one idea:

const.METADATA_SLOT_NAME=hash.blake3("miden::basic_fungible_faucet::metadata")

Context: 0xMiden/miden-base#1394 (reply in thread)

Metadata

Metadata

Assignees

No one assigned

    Labels

    assemblyRelated to Miden assembly

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions