Skip to content

Should the extended-message toggle use a BlockVersion::has_feature() API? #1706

@cbeck88

Description

@cbeck88

Shouldn't this use the BlockVersion::has_feature() API?

Originally posted by @jcape in #1700 (comment)

In confidential token ids PR, we added this code:

/// Toggles between old-style and new-style extended message
fn compute_extended_message_either_version(
    block_version: BlockVersion,
    message: &[u8],
    pseudo_output_commitments: &[CompressedCommitment],
    range_proof_bytes: &[u8],
) -> Vec<u8> {
    if block_version >= BlockVersion::THREE {
        // New-style extended message using merlin
        digest_extended_message(message, pseudo_output_commitments, range_proof_bytes).to_vec()
    } else {
        // Old-style extended message
        extend_message(message, pseudo_output_commitments, range_proof_bytes)
    }
}

This is actually not directly related to confidential tokens implementation.

We wanted to change the way the extended message was being computed to follow best practices like domain separation and framing when signing a message.

Reviewers agreed that this is an improvement.

To avoid toggling explicitly on block version values, we could treat this as a feature use_merlin_extended_message_digest or something, which can happen at the same time as the token id change. We need to describe this in an MCIP, either MCIP 25 or another MCIP.

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