Skip to content
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

fix: use unchecked constructor for ProcedureName on Library deserialization #1554

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

greenhat
Copy link
Contributor

@greenhat greenhat commented Oct 30, 2024

Describe your changes

Following the conversation with @bitwalker the checked constructor fits only when parsing MASM code. The Miden package contains the export names crafted according to the Wasm CM naming scheme, i.e. namespace:package/interface@version#function.
Discovered in 0xPolygonMiden/compiler#347 when parsing the Miden package file of the basic wallet account code.
The test for the failing case added in #1544 in the Package deserialization test suite at

#[test]
fn basic_wallet_package_deserialization() {
// Test for the https://github.com/0xPolygonMiden/compiler/issues/347
// The included Miden package file is built at
// https://github.com/0xPolygonMiden/compiler/blob/6cd29e17b34c5abef7f6328c33af06f8bf203344/tests/integration/src/rust_masm_tests/rust_sdk.rs#L48-L63
let bytes = include_bytes!("../tests/data/basic_wallet.masp");
let package = Package::read_from_bytes(bytes).unwrap();
dbg!(&package.manifest);
assert_eq!(package.name, "basic_wallet");
}
.

Checklist before requesting a review

  • Repo forked and branch created from next according to naming convention.
  • Commit messages and codestyle follow conventions.
  • Relevant issues are linked in the PR description.
  • Tests added for new functionality.
  • Documentation/comments updated according to changes.

…ure names

The checked constructor fits when parsing MASM code.
The Miden package contains the export names crafted according to the Wasm CM naming scheme
i.e. `namespace:package/interface@version#function`.
Discovered in 0xPolygonMiden/compiler#347
when parsing the Miden package file of the basic wallet account code.
@bobbinth
Copy link
Contributor

Would it make sense to relax procedure naming rules to accomodate WASM CM format rather than making these types of exception? Or maybe we introduce another more relaxed constructor that is not fully "unchecked" but relaxed enough to handle WASM CM naming.

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.

2 participants