Skip to content

Use fixed size array for asset_id#162

Merged
PaulLaux merged 7 commits intozsa1from
asset_id_fixed_size
May 6, 2025
Merged

Use fixed size array for asset_id#162
PaulLaux merged 7 commits intozsa1from
asset_id_fixed_size

Conversation

@PaulLaux
Copy link
Collaborator

@PaulLaux PaulLaux commented Apr 30, 2025

  • A fixed size for asset_id
  • Removed RTL chars to avoid confusing the text editor.
  • Minor spacing fixes

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enforces a fixed 65-byte format for the asset_id by updating the asset_digest function signature and modifying the asset ID encoding in the derive method.

  • Change asset_digest parameter type from Vec to [u8; 65].
  • Update the construction of the asset ID in derive() to use a fixed-size array.
  • Adjust in-code comments to align with the new fixed-size asset representation.

@QED-it QED-it deleted a comment from what-the-diff bot Apr 30, 2025
Copy link
Collaborator

@ConstanceBeguier ConstanceBeguier left a comment

Choose a reason for hiding this comment

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

Replace asset_id with AssetBase in the following comments

impl AssetBase {
    /// Deserialize the asset_id from a byte array.
    pub fn from_bytes(bytes: &[u8; 32]) -> CtOption<Self> {
        pallas::Point::from_bytes(bytes).map(AssetBase)
    }
    /// Serialize the asset_id to its canonical byte representation.
    pub fn to_bytes(self) -> [u8; 32] {
        self.0.to_bytes()
    }
    ```

Copy link
Collaborator

@ConstanceBeguier ConstanceBeguier left a comment

Choose a reason for hiding this comment

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

Approved after taking previous minor comments into account.

@PaulLaux PaulLaux changed the title force fixed size for asset_id Use fixed size array for asset_id May 6, 2025
@PaulLaux PaulLaux merged commit f2411a0 into zsa1 May 6, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants