Skip to content

mina-poseidon: add hash prefixes for domain separation#3498

Open
dannywillems wants to merge 2 commits intomasterfrom
dw/hash-prefixes
Open

mina-poseidon: add hash prefixes for domain separation#3498
dannywillems wants to merge 2 commits intomasterfrom
dw/hash-prefixes

Conversation

@dannywillems
Copy link
Copy Markdown
Contributor

No description provided.

Comment on lines +101 to +127
/// `merkle_tree(depth)` — produces `"MinaMklTree{depth:03}"`
/// padded to 20 bytes.
#[must_use]
pub fn merkle_tree(depth: u32) -> [u8; LENGTH_IN_BYTES] {
create(&format!("MinaMklTree{depth:03}"))
}

/// `coinbase_merkle_tree(depth)` — produces
/// `"MinaCbMklTree{depth:03}"` padded to 20 bytes.
#[must_use]
pub fn coinbase_merkle_tree(depth: u32) -> [u8; LENGTH_IN_BYTES] {
create(&format!("MinaCbMklTree{depth:03}"))
}

/// `zkapp_body(chain_name)` — produces
/// `"{chain_name}ZkappBody"` padded/truncated to 20 bytes.
#[must_use]
pub fn zkapp_body(chain_name: &str) -> [u8; LENGTH_IN_BYTES] {
create(&format!("{chain_name}ZkappBody"))
}

/// `signature_other(chain_name)` — produces
/// `"{chain_name}Signature"` padded/truncated to 20 bytes.
#[must_use]
pub fn signature_other(chain_name: &str) -> [u8; LENGTH_IN_BYTES] {
create(&format!("{chain_name}Signature"))
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should all also be constants. Why don't we just leave this for now, figure out the proper way to do things in mina-rust, then we can migrate that code over to proof-systems afterwards?

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

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

2 participants