feat: into_package() for ProtocolLib and StandardLib + CI Artifact#2859
feat: into_package() for ProtocolLib and StandardLib + CI Artifact#2859lima-limon-inc wants to merge 5 commits into0xMiden:nextfrom
into_package() for ProtocolLib and StandardLib + CI Artifact#2859Conversation
885c68c to
a9148d7
Compare
a9148d7 to
86f8f70
Compare
mmagician
left a comment
There was a problem hiding this comment.
Overall looks good, but there are two items I'd still like double checked:
- the CI should follow whatever patterns 0xMiden/miden-vm#3029 establishes, it looks like there are a lot of useful comments about the
upload-artifcatsjob there which will be relevant inprotocolrepo, too - verify whether only
ProtocolLiborStandardsLibneeds to be uploaded as per my comments
|
|
||
| /// Wraps this library into a [`Package`] named `PROTOCOL_PACKAGE_NAME`, | ||
| /// versioned with the `miden-protocol` crate's version. | ||
| pub fn into_package(self) -> Box<Package> { |
There was a problem hiding this comment.
I wonder if there are any meaningful tests we could add for into_package()
There was a problem hiding this comment.
I think before this gets merged, we should switch to building the protocol and standards packages as Miden projects, i.e. via miden-project.toml. You can still obtain a Library from the resulting package for legacy uses, but it produces a proper package rather than trying to create one from a Library, which IMO we should not do.
That way this function goes away, and packaging uses the standard workflow and tooling provided by the assembler, and we're guaranteed that all of the package metadata is correct.
There was a problem hiding this comment.
we should switch to building the protocol and standards packages as Miden projects, i.e. via
miden-project.toml
Would this need to happen here in the protocol repo? I haven't followed up on the packages/projects work recently
There was a problem hiding this comment.
Would this need to happen here in the
protocolrepo? I haven't followed up on the packages/projects work recently
I believe so. I believe that would imply switching to a masm miden-project here on the protocol repo.
There was a problem hiding this comment.
@mmagician Yes, the miden-project.toml would be defined for each logical workspace/project in this repo for which we want to produce a Miden package (we modeled the transaction kernel in the examples under miden-project in the VM repo, but the actual definition would look slightly different here). If you have specific questions about that, I'd be glad to hop on a call to discuss how to approach the project structure , or whatever is most convenient. I can take a stab at defining it too, but you guys know best how you intend to structure packages for things like standards.
There was a problem hiding this comment.
@bitwalker regarding your suggestion to switch to using miden-project.toml to build packages, IIUC we have two options:
Option A - each dependency package with its own manifest:
crates/miden-protocol/asm/miden-project.tomlwould be a workspace with four members:shared_utils,kernels/transactionprotocolasm/shared_modules/is either pre-linked as currently, or maybe refactored to promote to a 4th workspace member.
crates/miden-standards/asm/miden-project.tomlwould be a workspace with a singlestandardsmember that depends onprotocolabovebuild.rsin both crates would be rewritten to callAssembler::link_package
instead of assembling kernel/library imperatively. I think this is a positive change and will result in less boilerplate code for building.
Option B - only the userspace libraries (protocol & standards) get a manifest:
crates/miden-protocol/asm/protocol/miden-project.tomland
crates/miden-standards/asm/standards/miden-project.toml, both single-
package manifests- Kernel,
shared_utils, etc. stay assembled viabuild.rsas today and only the finalprotocol/standardslibraries are produced vialink_package.
LMK if this understanding is correct. AFAIU, for option B - if feasible - is simpler and would be a good start already.
But maybe long-term, we could still implement A.
Am I making sense? (as I said I'm only catching up on the package/project concepts)
| make packages | ||
| - name: Prepare artifacts | ||
| run: | | ||
| mv target/packages/miden-protocol.masp miden-protocol.masp |
There was a problem hiding this comment.
It looks like the last commit regressed the naming and we have the miden- prefix again
Closes 0xMiden/midenup#200
This PR is part of an ongoing effort to migrate serialization towards the
.maspPackageformat exclusively (see 0xMiden/midenup#191 (comment)).A new
into_package()method for bothProtocolLibandStandardLibwas added which directly returns the correspondingPackage.This new method is then used in
generate_package.rsscript, which publishs themaspartifact onto the Github release page.Notes:
into_package()was also added forStandardLibfor consistency's sake, it wasn't strictly necessary.