Skip to content

TokenSymbol::try_from(Felt) does not error on underflow #2464

@Mirko-von-Leipzig

Description

@Mirko-von-Leipzig

TokenSymbol::try_from(Felt::ZERO) should fail, but it does not as it only checks against the maximum value.

I guess it needs a

const MIN_ENCODED_VALUE: u64 = Self::from_static("A").0.as_int();

and an additional check.

As a separate issue, I'm also surprised that TokenSymbol::to_string is fallible -- surely it should always succeed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersstandardsRelated to standard note scripts or account components

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions