Skip to content

Avoid Felt in the SDK API where finite field arithmetic is unwanted #999

@greenhat

Description

@greenhat

Following the discouraging of using Felt to avoid finite field arithmetics in the docs repo at 0xMiden/docs#177, and the discussions elsewhere.

Why

Finite field arithmetic differs from integer arithmetic (wrapping, division). The asset quantity manipulation is one area where it can lead to unwanted results.

How

Use integer types in the SDK API where we want to avoid the finite field arithmetics. E.g. make the Asset::amount(&self) -> u64 and an Asset constructor for the fungible asset to accept the amount as u64 with bounds checking.

@bobbinth what do you think?

/cc @Keinberger

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