Relevant issue in the compiler repo: 0xMiden/compiler#870.
Why
- 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.
- 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
Relevant issue in the compiler repo: 0xMiden/compiler#870.
Why
Asset,AccountId, etc.) between the on-chain and off-chain code. For example, a note struct deserialized from the note storage can contain anAccountIdvalue. 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 sameAccountIdtype that is used in the on-chain (note) note type definition.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:
AssetAccountIdRecipient(Digest only)NoteMetadataNoteTagNoteTypeHow
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 wholemiden-protocolinto 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