Skip to content

Extract user-facing types into miden-objects crate (unified Miden SDK types) #2743

@greenhat

Description

@greenhat

Relevant issue in the compiler repo: 0xMiden/compiler#870.

Why

  1. To pass the user-defined types containing Miden SDK types (Asset, AccountId, etc.) between the on-chain and off-chain code. For example, a note struct deserialized from the note storage can contain an AccountId value. Using the schema defined in the on-chain code (note), we will generate the off-chain type for the note. We want to reference the same AccountId type that is used in the on-chain (note) note type definition.
  2. Unify the API (helper methods) between the on-chain and off-chain user code.

What

Any type that is used in the tx kernel MASM procedures that have Rust bindings in the Miden on-chain SDK.

The list of types:

  • Asset
  • AccountId
  • Recipient (Digest only)
  • NoteMetadata
  • NoteTag
  • NoteType

How

We need to define these types in the separate crate (miden-objects) which will be a dependency to the Miden SDK crates in the compiler repo. The separate crate is needed to avoid pulling the whole miden-protocol into the Miden SDK.

In the Miden SDK API, we will re-export these types and use them in the Miden SDK API (functions).

/cc @bobbinth @bitwalker

Metadata

Metadata

Assignees

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