Skip to content

chore: prepare split into protocol and standards#2184

Merged
bobbinth merged 34 commits intonextfrom
pgackst-protocol-and-standards
Dec 20, 2025
Merged

chore: prepare split into protocol and standards#2184
bobbinth merged 34 commits intonextfrom
pgackst-protocol-and-standards

Conversation

@PhilippGackstatter
Copy link
Contributor

@PhilippGackstatter PhilippGackstatter commented Dec 16, 2025

This PR implements a few changes before tackling #1563. Builds on top of #2158.

Specifically:

  • There is a dependency between AccountComponentInterface and WellKnownComponent.
    • The former should be defined in miden-protocol while the latter should be defined in miden-standards.
    • We plan to get rid of AccountComponentInterface in its current form, but a minimal fix is still needed to unblock this issue.
    • This migrates the functionality with a dependency to an extension trait, e.g. AccountComponentInterface will live in miden-protocol while AccountComponentInterfaceExt will be defined in miden-standards providing the integration with WellKnownComponent.
  • Similarly, there is a dependency between AccountInterface and WellKnownNote through AccountInterface::is_compatible_with.
    • This seems to be completely unused in base, client and node. I'm not sure if we plan to revive that in NoteConsumptionChecker or somewhere else? If not, we could remove it. Similar to the above approach, though, for now this is fixed as part of the extension trait.
    • While moving code, no logic was changed.
  • A good amount of code in build.rs will need to be shared between the build.rs files in the protocol and standards crate, for instance the error constants generation or walking masm files in a directory. The best approach seems to be to use an include! eventually.
    • Adding a separate crate with publish = false would make the crates that depend on that itself unpublishable, and adding a build-crate seems overkill.
    • For now this PR only refactors the error constants extraction to make it easy to put it in a separate file and include! it in both protocol and standards build.rs files.
    • The approach is to have three error modules (note that these are for testing only anyway). Tx kernel, protocol lib and standards. The main reason to split protocol out of tx kernel is that protocol errors do not necessarily need to fit into the tx kernel categories, and splitting them out allows us to validate that tx kernel errors do fit into a pre-defined category.

@mmagician mmagician self-requested a review December 16, 2025 10:32
Copy link
Collaborator

@mmagician mmagician left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the latter [WellKnownComponent] should be defined in miden-standards.

I wonder whether this will still be needed once we split out into miden-standards. WellKnownComponent is not really used much anyway (currently only inside tests, and as part of AccountComponentInterface logic afaics), and once we remove/refactor AccountComponentInterface, then we might be able to remove WellKnownComponent entirely.

It's not entirely clear to me yet how miden-standards crate will look like, but I imagine that any component exposed there would already be a "well-known component" by definition, and if needed, users would be able to import those via e.g.

use miden_standards::components::BasicWallet

But I think this can wait until the split is fully realized and we see how things look. For now the PR LGTM, thanks for breaking up the split into "preparation" and the split proper - makes reviewing much easier!

@PhilippGackstatter
Copy link
Contributor Author

PhilippGackstatter commented Dec 17, 2025

I wonder whether this will still be needed once we split out into miden-standards. WellKnownComponent is not really used much anyway (currently only inside tests, and as part of AccountComponentInterface logic afaics), and once we remove/refactor AccountComponentInterface, then we might be able to remove WellKnownComponent entirely.

I agree! To facilitate the split into protocol and standards, this change is needed for now, but we can definitely reevaluate later.


Adding one more change here: Moving add_assets_to_account from miden::active_note to miden::contracts::wallets::basic. When splitting miden into protocol and standard parts, this no longer works. I really like this refactor because it forces us to think about protocol and standards more carefully, e.g. here we have add_assets_to_account in active_note, but it depends on a standard component (basic wallet) and so it shouldn't be in the protocol library in the first place. Instead I think it's a helper of the basic wallet, so I moved it there.

@bobbinth
Copy link
Contributor

Adding one more change here: Moving add_assets_to_account from miden::active_note to miden::contracts::wallets::basic. When splitting miden into protocol and standard parts, this no longer works. I really like this refactor because it forces us to think about protocol and standards more carefully, e.g. here we have add_assets_to_account in active_note, but it depends on a standard component (basic wallet) and so it shouldn't be in the protocol library in the first place. Instead I think it's a helper of the basic wallet, so I moved it there.

I think this is related to #1855. Since we seem to cover it here, I'll assign it to you as well.

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you!

@PhilippGackstatter
Copy link
Contributor Author

While working on the next PR, I noticed I forgot to move AccountInterface::get_procedure_digests, so I added this here as well, following the same pattern as the rest of the PR, so probably no re-review required.

Base automatically changed from andrew-migrate-to-v20-vm to next December 20, 2025 07:51
@bobbinth bobbinth merged commit 63697be into next Dec 20, 2025
19 checks passed
@bobbinth bobbinth deleted the pgackst-protocol-and-standards branch December 20, 2025 08:11
afa7789 pushed a commit to afa7789/miden-base that referenced this pull request Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove wallet reference from note.masm in transaction kernel API

5 participants