-
Notifications
You must be signed in to change notification settings - Fork 40
[1/x] Miden SDK as plain Rust dependencies #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@bitwalker I got to the point where I need to figure out where to put the Wasm module import (Miden SDK extern function) in the IR. How to represent a Miden SDK extern function Wasm import in IR?Component-level import vs. module-level import. As a component-level importPros (vs. module-level import):
Cons (vs. module-level import):
I want to go with component-level import, and I'm starting to draft the code for it. What do you think? |
See considerations on component vs. module import in #140 (comment)
00612b1
to
48622fa
Compare
4815b41
to
87164d6
Compare
@greenhat Now that I've finished rebasing/merging the other PRs, since you are still working on this one, you'll need to create a new temporary branch off of
You probably already know the process, but just to make sure everything is painless as possible, that's what I would do. There will be conflicts due to the formatter changes, but most things should be straightforward. As mentioned in one of my review comments on the other PRs: the Happy to answer any questions about any of the new changes as well, just let me know. |
Sure, will do. Thanks for the detailed steps and thanks for taking care of my previous PRs. |
See considerations on component vs. module import in #140 (comment)
module import's module and field.
ids and signatures.
strategy and draft Rust bindings for it along with the tranformation.
84b4423
to
1356d63
Compare
Miden SDK functions imports in the HIR textual form.
87d8060
to
82842eb
Compare
make `type Felt = u64`, simplify `get_inputs` and `add_asset` bindings, make `type Word = [u64, 4]`,
@bitwalker Thank you for the detailed review notes! I addressed them all. Please, make another round. |
|
||
/// No transformation needed | ||
#[inline(always)] | ||
pub fn no_transform( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just as a heads up, we should make sure that any function type which would be handled as no_transform
, uses Abi::Canonical
so that it goes through the normal lowering process. For the other Abi variants, we either want to transform them such that they are Canonical
, or that they require no further transformation aside from direct translation to Miden Assembly.
To be clear, haven't checked to see if that's already the case anyway, but wanted to raise it just in case that conflicts with what your operating assumptions are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Actually, since all the Miden ABI transformation happens in the frontend, I'll use Abi::Canonical
for all the function type definitions because all of them should have this ABI after the processing regardless whether an actual transformation was conducted. This means that Abi::Miden
is not used, so it can be deleted. Keep in mind that Abi
is not included in Signature
. Besides that, I removed (abi XXXXX)
in ComponentImport
textual form and printed it as part of FunctionType
in the textual form.
All the aforementioned changes are made in the #156 due to their invasive nature to the two subsequent PRs that makes rebasing a PITA. See commit 82870e3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just a couple last questions/notes, but I'll sign off and let you respond/handle those as you see fit.
I'll try to get to your next PR tomorrow, Friday at the latest!
7f19cfa
to
a5134b5
Compare
LGTM! |
Ref #138
Ref #118
This PR adds:
miden-sdk
crate with a small subset of tx kernel API functions, one for each transformation strategy, with partial transformation of the parameters and results on the Rust side (bindings);frontend-wasm
crate to recognize and transform parameters and results for function calls for these well-known functions during the Wasm translation;The native
Felt
type is not implemented in this PR and will be added in the next PR.