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

Migrate to miden-vm v0.11 #528

Merged
merged 9 commits into from
Oct 28, 2024
Merged

Migrate to miden-vm v0.11 #528

merged 9 commits into from
Oct 28, 2024

Conversation

Fumuran
Copy link
Contributor

@Fumuran Fumuran commented Oct 24, 2024

This PR updates the code of the miden-node to work with a next v0.11 version of the miden-vm and next version of miden-base.

bin/faucet/src/client.rs Outdated Show resolved Hide resolved
@Fumuran Fumuran marked this pull request as ready for review October 24, 2024 23:40
@@ -15,7 +15,7 @@ resolver = "2"

[workspace.package]
edition = "2021"
rust-version = "1.80"
rust-version = "1.82"
Copy link
Contributor

Choose a reason for hiding this comment

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

What's causing this bump?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

miden-crypto now require rust 1.82

@@ -13,7 +13,7 @@ BUILD_PROTO=BUILD_PROTO=1

.PHONY: clippy
clippy: ## Runs Clippy with configs
cargo clippy --locked --workspace --all-targets --all-features -- -D warnings
cargo clippy --locked --workspace --all-targets --all-features -- -D warnings --allow clippy::arc_with_non_send_sync
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems really unsafe 😅 But I don't understand these unsafe impl context's so I'll withhold judgement until its been explained.

I would suggest manually #[allow(arc_with_non_send_sync)] on the actual instances instead of blanket allowing this.

Copy link
Contributor

@polydez polydez Oct 25, 2024

Choose a reason for hiding this comment

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

No, it's safe, it's just a suppression of annoying clippy warnings introduced in the latest Rust versions. :) It warns you, if you use Arc where it is sufficient to use just Rc. I think, we should update our code and enable this lint, but in separate PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's create an issue to remove this once 0xPolygonMiden/miden-base#909 is fixed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can't comment on this; masm is not in my wheel house.

Copy link
Contributor

@polydez polydez left a comment

Choose a reason for hiding this comment

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

Overall looks good to me, thanks! The only concern I have is stepping into unsafe field where it's not really needed.

bin/faucet/src/client.rs Outdated Show resolved Hide resolved
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! I left a few comments inline.

bin/faucet/src/client.rs Outdated Show resolved Hide resolved
bin/faucet/src/client.rs Outdated Show resolved Hide resolved
@@ -13,7 +13,7 @@ BUILD_PROTO=BUILD_PROTO=1

.PHONY: clippy
clippy: ## Runs Clippy with configs
cargo clippy --locked --workspace --all-targets --all-features -- -D warnings
cargo clippy --locked --workspace --all-targets --all-features -- -D warnings --allow clippy::arc_with_non_send_sync
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's create an issue to remove this once 0xPolygonMiden/miden-base#909 is fixed.

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.

Actually, I pushed a commit which should address #528 (comment), #528 (comment), and #528 (comment).

@Mirko-von-Leipzig, @polydez - take a look and see if this is good to merge.

Copy link
Contributor

@Mirko-von-Leipzig Mirko-von-Leipzig left a comment

Choose a reason for hiding this comment

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

@bobbinth LGTM thank you.

self.faucet_account
.borrow_mut()
.lock()
.unwrap()
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should avoid using unwrap in favor of expect everywhere except tests if panic is highly unlikely to happen (otherwise, an error should be returned). This helps us to understand why method might fail or why we don't expect it to fail. I usually add .expect("Poisoned lock") for every lock or read/write in case of using RwLock.

@@ -60,20 +63,20 @@ impl FaucetClient {
initialize_faucet_client(config.clone()).await?;

let (faucet_account, account_seed, secret) = build_account(config.clone())?;
let faucet_account = Rc::new(RefCell::new(faucet_account));
let id = faucet_account.borrow().id();
let faucet_account = faucet_account;
Copy link
Contributor

Choose a reason for hiding this comment

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

This line seems to be useless.

@bobbinth
Copy link
Contributor

@Fumuran - could you fix up the remaining comments in this PR?

After this, let's merge 0xPolygonMiden/miden-base#929, and then update dependencies and merge this PR as well.

@bobbinth
Copy link
Contributor

0xPolygonMiden/miden-base#929 has now been merged. Let's update the Cargo.toml file, fix the remaining unwrap() here, and then merge.

@bobbinth bobbinth merged commit 22d3216 into next Oct 28, 2024
8 checks passed
@bobbinth bobbinth deleted the andrew-migrate-to-miden-vm-0.11 branch October 28, 2024 17:59
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.

4 participants