chore: move protocol components from miden-lib to miden-objects#2191
chore: move protocol components from miden-lib to miden-objects#2191
miden-lib to miden-objects#2191Conversation
…/miden-base into andrew-migrate-to-v20-vm
|
I'm about to start reviewing the PR - so, haven't looked at code in detail yet, but I was imagining this slightly differently:
My understanding is that |
Yes 👍
I see, I think there was a misunderstanding then. I thought we wanted a single I think having a single protocol crate like with this PR may allow us to keep protocol-related things more nicely together. For instance, the block building process is currently split in objects and lib, i.e. I think when we touched objects in the past, we frequently also touched lib which is due to the relatively tight dependency and I don't see a significant downside to merging the two, or a significant upside in keeping them separate. So I think I slightly prefer the approach in this PR, but would also be fine with trying the split into three crates. |
bobbinth
left a comment
There was a problem hiding this comment.
Looks good! Thank you! I left some comments inline - but they are pretty small. I did not review the build.rs files in too much details - so, would be good to get another set of eyes on them.
The
CodeBuilderdynamically linksStandardsLib. The assumption is thatStandardsLibwill always be present in the executor and prover host's mast stores. Is this the right choice?
Yes - this will be a guarantee of the network: the standards library will always be available (and in fact, every version of the standards library will be assumed to be available to all network participants).
So I think I slightly prefer the approach in this PR, but would also be fine with trying the split into three crates.
I think it is fine to keep as is. A big part of my original motivation was to reduce the amount of work - but since the work has been done already, not much point in rolling it back.
I do think in the future we'll introduce a different incarnation of miden-objects - this will probably contain basic objects and their serialization/deserialization code, but not much else.
bobbinth
left a comment
There was a problem hiding this comment.
All looks good! Thank you! I left just one small nit inline - but we can easily address it in a follow-up.
There was a problem hiding this comment.
nit: I would probably rename this file into protocol_lib.rs to keep the naming consistent with standards_lib.rs.
…ocol-and-standards
Refactors the codebase to separate protocol and standards library code. The idea here is that
miden-objectswill eventually becomemiden-protocolandmiden-libwill becomemiden-standards.Main changes
StandardsLibin miden-lib. So, now we have three libraries,TransactionKernel::library,MidenLibandStandardsLib.sharedmodule was setup that should be kept in sync; however I could not find an easy way to actually share that code. In particular, using aninclude!in both build.rs scripts technically works when usingcargobutrust-analyzerwould always show an error.CodeBuilderwas left in miden-lib.StandardsLibby default, which seems desirable. We'd need an extension trait in lib for that.TransactionKernel::assemblerdirectly.AccountInterfaceis not being moved in this PR. While I think it should eventually live in the protocol crate, I realized it depends too tightly onAccountComponentInterfacewhose definition consists of references to standard components, and so it doesn't make sense to me to actually move it to objects now. I think we should do this as part of the account (component) interface refactor. Until that time, there's probably no real problem with leaving it in miden-lib.Review
I tried to keep commits organized as much as possible, and so reviewing by commit should make things a bit easier. Changes in
miden-txandmiden-testingare almost all contained in one of the last commits, which consists only of fixing imports.Open Questions
The
CodeBuilderdynamically linksStandardsLib. The assumption is thatStandardsLibwill always be present in the executor and prover host's mast stores. Is this the right choice?Follow-Up
In a follow-up, I would:
MidenLibwith themidennamespace intomiden::protocol.StandardsLibwith themiden::contractsnamespace intomiden::standards.part of #1563