Skip to content

Store ABI type information as a custom section in .masp packages #1026

@marijamijailovic

Description

@marijamijailovic

Feature description

Right now the package manifest only has flattened types. For example, a function that takes two Points(custom struct Point) and return Point just shows params: [Felt, Felt, Felt, Felt], results: [Felt, Felt]. You can't tell from the manifest that those felts are part of an Point.
This info exists during compilation in the compiler frontend (compiler/frontend/wasm/src/). Parameter names, struct fields, and type names are all there in the canonical ABI sections — they just get thrown away during flattening.

The idea is to get this info before flattening and put it in a custom section in sections: Vec<Section>.

Example of what the section would contain:

  • Type definitions:
  point = record { x: felt, y: felt }
  account_id_data = record { prefix: felt, suffix: felt }
  • Function signatures:
  point-add(a: point, b: point) -> point
  account-to-word(id: account_id_data) -> word

Why is this feature needed?

With this miden call can accept an formatted struct Point as input, and show formatted output, instead of making users type 4 felts, and see 2 felts as output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions