Skip to content

inner representation of ChainId shouldn't be String #196

Open
@tdelabro

Description

@tdelabro

https://github.com/starkware-libs/starknet-api/blob/main/src/core.rs#L20-L21

here ChainId is represented as a String

But in the specs the ChainId is used to compute the tx hash of all the transactions. This means it should fit in a Felt meaning it should be at most a ShortString of max size 31 characters.

I recommend we store it as a Felt for its internal representation, as it will simplify its usage for tx hash computation, and implement Display on it in a way that returns the short string representation.

With the current inner repr as String and no new method to make sure the max length is respected, anybody can write code that will break the protocol.

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